[NTG-context] Re: Table and rotation: push together 45 degree rotated cells

2024-09-19 Thread Gerion Entrup
Am Donnerstag, 19. September 2024, 09:35:49 MESZ schrieb Hans Hagen via 
ntg-context:
> On 9/19/2024 7:54 AM, Mikael Sundqvist wrote:
> > Hi,
> > 
> > On Thu, Sep 19, 2024 at 12:23 AM Gerion Entrup  
> > wrote:
> >>
> >> Am Mittwoch, 18. September 2024, 22:53:55 MESZ schrieb Wolfgang Schuster:
> >>> Gerion Entrup schrieb am 18.09.2024 um 14:44:
> >>>> Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
> >>>>> Hi,
> >>>>>
> >>>>> I want to typeset a table where some of the column headings are really 
> >>>>> long, while in the columns itself consists only of numbers.
> >>>>> Therefore, my idea was to rotate the column headings but not 90 degrees 
> >>>>> (I found some solutions for that) but 45 degree.
> >>>>>
> >>>>> It then would be beneficial to push together the rotated cells, so the 
> >>>>> text of one cell actually starts above the previous cell.
> >>>>> Do you know, how to achieve that?
> >>>>>
> >>>>> Here is a minimal example:
> >>>>> ```
> >>>>> \startsetups[table:rotated]
> >>>>> \setupTABLE[frame=off]
> >>>>> \setupTABLE[row][first][bottomframe=on, style=bf, align={center, 
> >>>>> low}]
> >>>>> \setupTABLE[row][2][align=flushright]
> >>>>> \stopsetups
> >>>>>
> >>>>> \starttext
> >>>>> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
> >>>>> \bTABLE[setups=table:rotated]
> >>>>> \bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD 
> >>>>> \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European 
> >>>>> turtle dove} \eTD \eTR
> >>>>> \bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} 
> >>>>> \eTD \bTD \digits{2} \eTD \eTR
> >>>>> \eTABLE
> >>>>> \stoptext
> >>>>> ```
> >>>>> I would like to achieve that the text "Mexican redknee tarantula" is 
> >>>>> typeset right and above of "Water buffalo" so that the single columns 
> >>>>> have a width that is similar to the width of the single digit coming in 
> >>>>> the second row.
> >>>>
> >>>> To visualize this, I patched the PDF of the above example to the desired 
> >>>> result. See the attachment.
> >>>
> >>> You can use Metapost.
> >>
> >> Thanks for this solution. It, however, seems to fail with any other angle 
> >> than 315° (I tested 305, 325 and 314).
> > 
> > Try
> > 
> >
> > xyscaled(\the\struttotal,abs(sind(\MPvar{rotation}))*\the\widthofstring{\MPvar{text}});
> > 
> > with sind instead of sin. And maybe with abs around it, but one can
> > think of improvements for smaller angles. It all depends on what one
> > wants.
> 
> here is an alternative
> 
> \bTABLE[frame=off]
>\bTR[align={middle,low}]
>  \bTH \eTH
>  \bTH 
> \dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut 
> Water buffalo}\hss} \eTH
>  \bTH 
> \dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut 
> Mexican redknee tarantula}\hss} \eTH
>  \bTH 
> \dontleavehmode\kern1.5em\llap{\rotate[rotation=315,frame=on]{\strut 
> European turtle dove}\hss} \eTH
>\eTR
>\bTR[frame=on,align=middle]
>  \bTD Amount of legs \eTD
>  \bTD[width=3em] 4 \eTD
>  \bTD[width=3em] 8 \eTD
>  \bTD[width=3em] 2 \eTD
>\eTR
> \eTABLE

What is the meaning of \hss here? It seems to work just fine without it.

Gerion



signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Table and rotation: push together 45 degree rotated cells

2024-09-18 Thread Gerion Entrup
Am Mittwoch, 18. September 2024, 22:53:55 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 18.09.2024 um 14:44:
> > Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
> >> Hi,
> >>
> >> I want to typeset a table where some of the column headings are really 
> >> long, while in the columns itself consists only of numbers.
> >> Therefore, my idea was to rotate the column headings but not 90 degrees (I 
> >> found some solutions for that) but 45 degree.
> >>
> >> It then would be beneficial to push together the rotated cells, so the 
> >> text of one cell actually starts above the previous cell.
> >> Do you know, how to achieve that?
> >>
> >> Here is a minimal example:
> >> ```
> >> \startsetups[table:rotated]
> >>\setupTABLE[frame=off]
> >>\setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
> >>\setupTABLE[row][2][align=flushright]
> >> \stopsetups
> >>
> >> \starttext
> >> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
> >> \bTABLE[setups=table:rotated]
> >>\bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD 
> >> \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European 
> >> turtle dove} \eTD \eTR
> >>\bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD 
> >> \bTD \digits{2} \eTD \eTR
> >> \eTABLE
> >> \stoptext
> >> ```
> >> I would like to achieve that the text "Mexican redknee tarantula" is 
> >> typeset right and above of "Water buffalo" so that the single columns have 
> >> a width that is similar to the width of the single digit coming in the 
> >> second row.
> > 
> > To visualize this, I patched the PDF of the above example to the desired 
> > result. See the attachment.
> 
> You can use Metapost.

Thanks for this solution. It, however, seems to fail with any other angle than 
315° (I tested 305, 325 and 314).


> \startuseMPgraphic{tableheader}{text,rotation}
> 
>label.lft("\strut\bf\MPvar{text}",origin)
>  rotated \MPvar{rotation}
>  shifted (\the\strutht,0);

I guess, this one actually draws the text...


>setbounds currentpicture to unitsquare
>  
> xyscaled(\the\struttotal,sin(\MPvar{rotation})*\the\widthofstring{\MPvar{text}});

and this one calculates the faked width. Doesn't the sinus here calculate the 
height of the rotated text?

Beside from using Metapost (since I currently do not understand it and would 
only be able to copy paste your code), is there some kind of box construct 
which artificially reduces the width of the inner content?
I would have expected something like \fakewidth[width=1cm, 
align=flushright]{\rotate[rotation=-45, location=high]{A really long text, much 
longer than 1cm}}.
If I see it right, such a construct would also solve the problem, while less 
cleaner due to the fixed width.


Gerion




signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Table and rotation: push together 45 degree rotated cells

2024-09-18 Thread Gerion Entrup
Am Dienstag, 17. September 2024, 20:36:23 MESZ schrieb Gerion Entrup:
> Hi,
> 
> I want to typeset a table where some of the column headings are really long, 
> while in the columns itself consists only of numbers.
> Therefore, my idea was to rotate the column headings but not 90 degrees (I 
> found some solutions for that) but 45 degree.
> 
> It then would be beneficial to push together the rotated cells, so the text 
> of one cell actually starts above the previous cell.
> Do you know, how to achieve that?
> 
> Here is a minimal example:
> ```
> \startsetups[table:rotated]
>   \setupTABLE[frame=off]
>   \setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
>   \setupTABLE[row][2][align=flushright]
> \stopsetups
> 
> \starttext
> \define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
> \bTABLE[setups=table:rotated]
>   \bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD 
> \tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European 
> turtle dove} \eTD \eTR
>   \bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD 
> \bTD \digits{2} \eTD \eTR
> \eTABLE
> \stoptext
> ```
> I would like to achieve that the text "Mexican redknee tarantula" is typeset 
> right and above of "Water buffalo" so that the single columns have a width 
> that is similar to the width of the single digit coming in the second row.

To visualize this, I patched the PDF of the above example to the desired 
result. See the attachment.


> Another question in this context: Is is possible to specify a \setupTABLE 
> command that works for column 2-4 starting from row 2?
> Something like \setupTABLE[row][2-][column][2,3,4][background=color, 
> backgroundcolor=red].
> In this example this would cover all numbers but nothing else.
> 
> Best
> Gerion



mwe.fixed.pdf
Description: Adobe PDF document


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Table and rotation: push together 45 degree rotated cells

2024-09-17 Thread Gerion Entrup
Hi,

I want to typeset a table where some of the column headings are really long, 
while in the columns itself consists only of numbers.
Therefore, my idea was to rotate the column headings but not 90 degrees (I 
found some solutions for that) but 45 degree.

It then would be beneficial to push together the rotated cells, so the text of 
one cell actually starts above the previous cell.
Do you know, how to achieve that?

Here is a minimal example:
```
\startsetups[table:rotated]
\setupTABLE[frame=off]
\setupTABLE[row][first][bottomframe=on, style=bf, align={center, low}]
\setupTABLE[row][2][align=flushright]
\stopsetups

\starttext
\define\tablerotate{\dontleavehmode\rotate[rotation=-45, location=high]}
\bTABLE[setups=table:rotated]
\bTR \bTD \eTD \bTD \tablerotate{Water buffalo} \eTD \bTD 
\tablerotate{Mexican redknee tarantula} \eTD \bTD \tablerotate{European turtle 
dove} \eTD \eTR
\bTR \bTD Amount of legs \eTD \bTD \digits{4} \eTD \bTD \digits{8} \eTD 
\bTD \digits{2} \eTD \eTR
\eTABLE
\stoptext
```
I would like to achieve that the text "Mexican redknee tarantula" is typeset 
right and above of "Water buffalo" so that the single columns have a width that 
is similar to the width of the single digit coming in the second row.

Another question in this context: Is is possible to specify a \setupTABLE 
command that works for column 2-4 starting from row 2?
Something like \setupTABLE[row][2-][column][2,3,4][background=color, 
backgroundcolor=red].
In this example this would cover all numbers but nothing else.

Best
Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Combining styles (especially bold and italic)

2024-09-04 Thread Gerion Entrup
Am Dienstag, 3. September 2024, 20:51:39 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 03.09.2024 um 18:28:
> > Hi,
> >
> > I have the situation that I want to typeset a special formatted name within 
> > a section heading.
> > The name contains an italic part while the heading is bold, but both styles 
> > are defined at another place.
> > Is there a way to tell ConTeXt to combine them, so that it is bold _and_ 
> > italic?
> >
> > Here is a minimal example:
> > ```
> > \define\somename{HX\style[italic]{print}\autoinsertnextspace}
> 
> You want \italicface (or \style[italicface]) which selects either \it or 
> \bi.
> 
> \define\somename{HX{\italicface print}\autoinsertnextspace}
> 
> or
> 
> \define\somename{HX\style[italicface]{print}\autoinsertnextspace}
> 
> Wolfgang
> 
> 

Thanks, that answers my question!

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Combining styles (especially bold and italic)

2024-09-04 Thread Gerion Entrup
Am Dienstag, 3. September 2024, 20:31:31 MESZ schrieb Pablo Rodriguez via 
ntg-context:
> On 9/3/24 18:28, Gerion Entrup wrote:
> > Hi,
> >
> > I have the situation that I want to typeset a special formatted name
> > within a section heading.
> > The name contains an italic part while the heading is bold, but both
> > styles are defined at another place.
> > Is there a way to tell ConTeXt to combine them, so that it is bold
> > _and_ italic?
> Hi Gerion,
> 
> you may combine emphasis with bold and set emphasis to italic (default
> is slanted), such as in:
> 
>   \setupbodyfontenvironment [default] [em=italic]
> 
>   \define\somename{HX{\em print}\autoinsertnextspace}
> 
> I hope it helps,
> 
> Pablo

Thank you, that works for the minimal example and in my case but has the side 
effect to modify emphasis.
I wonder, if there is another solution without side effects.

Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Combining styles (especially bold and italic)

2024-09-04 Thread Gerion Entrup
Am Dienstag, 3. September 2024, 20:34:28 MESZ schrieb Henning Hraban Ramm:
> Am 03.09.24 um 18:28 schrieb Gerion Entrup:
> > Hi,
> > 
> > I have the situation that I want to typeset a special formatted name within 
> > a section heading.
> > The name contains an italic part while the heading is bold, but both styles 
> > are defined at another place.
> > Is there a way to tell ConTeXt to combine them, so that it is bold _and_ 
> > italic?
> 
> try \bi
> 
> Hraban

This does not really work in my case, since I have the italic style embedded in 
a command that I want to use in several contexts as sketched in the minimal 
example.

Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Combining styles (especially bold and italic)

2024-09-03 Thread Gerion Entrup
Hi,

I have the situation that I want to typeset a special formatted name within a 
section heading.
The name contains an italic part while the heading is bold, but both styles are 
defined at another place.
Is there a way to tell ConTeXt to combine them, so that it is bold _and_ italic?

Here is a minimal example:
```
\define\somename{HX\style[italic]{print}\autoinsertnextspace}

\setuphead[section, subject][style={\bfc}]

\starttext
\startsection[title=The \somename name]
\somename is a strange written name.
\stopsection
\stoptext
```

In the normal text, HXprint is written correctly, in the section heading 
"print" is italic but not bold.

Best
Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Placement of floats with an "anchor"

2024-09-03 Thread Gerion Entrup
Hi,

in my document, I recently left a TODO note that said:
"This floating graphic needs to be on the same page than this formula at the 
end."

My floating graphic currently uses:
\startplacefigure[title={bla}, location=top, reference=fig:bla]
...
\stopplacefigure

The graphic should be at the top of the page where the formulas are typeset at 
the end.
Normally, I would do that manually, when all other text is finished.

Can I somehow automate this in ConTeXt? So defining a (non visible) "anchor" at 
a random place within the normal text and then tell ConTeXt to place the float 
at the same page (if possible)?

Here is a minimal example to play around (the float is placed on page 1, while 
the "anchor" is on page 2).

```
\starttext

\input{knuth}
\input{knuth}
\input{knuth}
% anchorto is made up to demonstrate the problem
\startplacefigure[title={A figure explaining the formula.}, location=top, 
reference=some, anchorto={eq:important}]
\startalign[center]
\style[sans]{This is a figure that explains the formula.}
\stopalign
\stopplacefigure

It is explained with these equations (see also figure \in[some]):
\startformula[reference=eq:important]
\startalign
\NC a \NC = b \NR
\NC a \NC = b \NR
\NC a \NC = b \NR
\NC a \NC = b \NR
\NC a \NC = b \NR
\NC a \NC = b \NR
\NC a \NC = b \NR
\NC a \NC = b \NR
\NC a \NC = b \NR
\stopalign
\stopformula
\input{knuth}
\input{knuth}
\input{ward}

\stoptext
```

Best
Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Questions regarding fonts: obliques (fake italics), ligatures and kerning

2024-08-27 Thread Gerion Entrup
Hi,

thank you, that answers all my questions!

Gerion

Am Mittwoch, 28. August 2024, 00:03:34 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 27.08.2024 um 23:29:
> > Am Dienstag, 27. August 2024, 22:30:16 MESZ schrieb Wolfgang Schuster:
> >> Gerion Entrup schrieb am 27.08.2024 um 21:28:
> >>> Hi,
> >>>
> >>> I played around with different fonts, especially Bitstream XCharter and 
> >>> Overpass (http://overpassfont.org/) and wanted to combine them.
> >>> However, I see some issues regarding ligatures, kerning and 
> >>> obliques/italics.
> >>>
> >>> Here is a minimal example:
> >>> ```
> >>> \definefontfeature[default][mode=node, kern=yes, liga=yes]
> >>> % more features
> >>> % [mode=node, kern=yes, liga=yes, tlig=yes, itlg=yes, ccmp=yes, 
> >>> language=dflt, protrusion=quality, expansion=quality]
> >> There is no need to set default features like ligatures and kerning, the
> >> better alternative here is to use
> >>
> >>   \definefontfeature [default] [default] [protrusion=quality,...]
> >>
> >> which adds additional settings to the default set.
> >>
> >>> \definefontfamily [myfont][roman][xcharter]
> >>> \definefontfamily [myfont][sansserif][overpass][rscale=0.93]
> >>> \definefontfamily [myfont][teletype][overpass][rscale=0.93]
> >>> \definefontfamily [myfont][mono][overpassmono][rscale=0.93]
> >>> \definetypeface   [myfont][mathematics][math] [xcharter]
> >>>
> >>> \setupbodyfont[myfont, 11pt]
> >>>
> >>> \startTEXpage
> >>>
> >>> \showfontkerns
> >>>
> >>>Vitae, Vase, LT, VA, Y., Effizient, abcdel™, \italic{effi 
> >>> abcdel™}, \slanted{effi abcdel™}\\
> >>> \style[sans]{Vitae, Vase, LT, VA, Y., Effizient, abcdel™, \italic{effi 
> >>> abcdel™}, \slanted{effi abcdel™}}\\
> >>> \style[mono]{Vitae, Vase, LT, VA, Y., Effizient, abcdel™, \italic{effi 
> >>> abcdel™}, \slanted{effi abcdel™}}\\
> >>>
> >>> \showbodyfont[myfont]
> >>>
> >>> \stopTEXpage
> >>> ```
> >>> It produces the PDF in the attachment. I'm struggling with several things:
> >>> - xcharter seems to have no kerning applied. It is listed as font 
> >>> feature, though. Is it correct to have no kerning at all for that font?
> >> The font has kerning information but none for characters in the ASCII 
> >> range.
> > Good to know. Especially for the "Va" in "Vase", I expected kerning (it 
> > looks not equally spaced currently).
> >
> >
> >>> - xcharter also have no ligatures (at least it doesn't look like that). 
> >>> That is listed as font feature, too, although only for italic and 
> >>> slanted. According to https://tug.org/FontCatalogue/xcharter/ there are 
> >>> ligatures in the font.
> >> There are ligatures for ff[il].
> > They are defined in the font, but they are not used in the PDF output, 
> > aren't they? For example in the "ffi" in "Effizient" the "f" is not 
> > connected with the "i", while the ligature glyph has a connection there.
> 
> You have to change the value of the script tag because the don't set 
> them for the dflt script.
> 
> \definefontfeature[default][default][script=latn]
> 
> \definefontfamily[myfont][rm][xcharter]
> 
> \setupbodyfont[myfont]
> 
> \showmakeup[glyph]
> 
> \starttext
> 
> ff fi fl ffi ffl fb fh fk
> 
> \feature[-][ligatures]
> 
> ff fi fl ffi ffl fb fh fk
> 
> \stoptext
> 
> > I attached a screenshot for comparison. The ligature was generated with 
> > "\ShowCompleteFont{name:xcharter*default}{11pt}{1}" (with the fnt-10 
> > module).
> > It is, however, noticeable that the whole xcharter font is thicker in the 
> > output of \ShowCompleteFont. Is this part of the reason?
> 
> When you load a font by name use one which is listed in the table you 
> get with "mtxrun --script fonts --list --all  --pattern=xcharter*". In 
> this case the table is
> 
> identifierfamilyname fontname 
> filename   subfont   instances
> 
> xcharterbold  xcharter   xcharterbold XCharter-Bold.otf
> xcharterbolditalicxcharter   xcharterbolditalic 
> XCharter-BoldItalic.otf
> xcharterboldslanted   xcharter   xcharterboldslanted 
> XCh

[NTG-context] Re: Questions regarding fonts: obliques (fake italics), ligatures and kerning

2024-08-27 Thread Gerion Entrup
Am Dienstag, 27. August 2024, 22:30:16 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 27.08.2024 um 21:28:
> > Hi,
> >
> > I played around with different fonts, especially Bitstream XCharter and 
> > Overpass (http://overpassfont.org/) and wanted to combine them.
> > However, I see some issues regarding ligatures, kerning and 
> > obliques/italics.
> >
> > Here is a minimal example:
> > ```
> > \definefontfeature[default][mode=node, kern=yes, liga=yes]
> > % more features
> > % [mode=node, kern=yes, liga=yes, tlig=yes, itlg=yes, ccmp=yes, 
> > language=dflt, protrusion=quality, expansion=quality]
> 
> There is no need to set default features like ligatures and kerning, the 
> better alternative here is to use
> 
>  \definefontfeature [default] [default] [protrusion=quality,...]
> 
> which adds additional settings to the default set.
> 
> > \definefontfamily [myfont][roman][xcharter]
> > \definefontfamily [myfont][sansserif][overpass][rscale=0.93]
> > \definefontfamily [myfont][teletype][overpass][rscale=0.93]
> > \definefontfamily [myfont][mono][overpassmono][rscale=0.93]
> > \definetypeface   [myfont][mathematics][math] [xcharter]
> >
> > \setupbodyfont[myfont, 11pt]
> >
> > \startTEXpage
> >
> > \showfontkerns
> >
> >   Vitae, Vase, LT, VA, Y., Effizient, abcdel™, \italic{effi 
> > abcdel™}, \slanted{effi abcdel™}\\
> > \style[sans]{Vitae, Vase, LT, VA, Y., Effizient, abcdel™, \italic{effi 
> > abcdel™}, \slanted{effi abcdel™}}\\
> > \style[mono]{Vitae, Vase, LT, VA, Y., Effizient, abcdel™, \italic{effi 
> > abcdel™}, \slanted{effi abcdel™}}\\
> >
> > \showbodyfont[myfont]
> >
> > \stopTEXpage
> > ```
> > It produces the PDF in the attachment. I'm struggling with several things:
> > - xcharter seems to have no kerning applied. It is listed as font feature, 
> > though. Is it correct to have no kerning at all for that font?
> 
> The font has kerning information but none for characters in the ASCII range.

Good to know. Especially for the "Va" in "Vase", I expected kerning (it looks 
not equally spaced currently).


> > - xcharter also have no ligatures (at least it doesn't look like that). 
> > That is listed as font feature, too, although only for italic and slanted. 
> > According to https://tug.org/FontCatalogue/xcharter/ there are ligatures in 
> > the font.
> 
> There are ligatures for ff[il].

They are defined in the font, but they are not used in the PDF output, aren't 
they? For example in the "ffi" in "Effizient" the "f" is not connected with the 
"i", while the ligature glyph has a connection there.
I attached a screenshot for comparison. The ligature was generated with 
"\ShowCompleteFont{name:xcharter*default}{11pt}{1}" (with the fnt-10 module).
It is, however, noticeable that the whole xcharter font is thicker in the 
output of \ShowCompleteFont. Is this part of the reason?


> > - Overpass has a glyph for the ae ligature. Is it normal that it is not 
> > used as a ligature for ae?
> 
> This seems to be a stupid decision to replace ae by default with a 
> ligature, maybe dependent on the language but not for all of them.

Ok, I've seen it here as (somewhat) common ligature: 
https://en.wikipedia.org/wiki/Ligature_(writing)#Computer_typesetting
But there is also mentioned that TeX just has ff, fi, fl, ffi and ffl by 
default.


> > - Overpass Mono does not contain italic glyphs. I would have expected 
> > obliques when using \slanted then. However, it just remains normal.
> 
> You can use the slanted feature for this but the default setting is to 
> fall back to the upright alternative and you as a user has to make the 
> choice.
> 
> Example: \definefontfamily[myfont][tt][overpassmono][sl={features:slanted}]

Thank you! That make sense.


> > - I included the ™ in the example since its italic glyph is not slanted. 
> > For all fonts \slanted seems to switch to the extra (italic?) glyphs, while 
> > I would have expected obliques. At least overpass seems to have no 
> > dedicated slanted style, while xcharter has one.
> 
> How a glyph for a certain styles appears depends on the font designer.
> 
> 
> When you use \definefontfamily you get always the same style for italic 
> and slanted because most fonts provide only italic or oblique (but not 
> both). In some case you do something like the following font setting but 
> the best solution when you have a large font family have is to write a 
> typescript.
> 
>  \definefontfamily[myfont][rm][xcharter][sl=style:slanted]

Th

[NTG-context] Questions regarding fonts: obliques (fake italics), ligatures and kerning

2024-08-27 Thread Gerion Entrup
Hi,

I played around with different fonts, especially Bitstream XCharter and 
Overpass (http://overpassfont.org/) and wanted to combine them.
However, I see some issues regarding ligatures, kerning and obliques/italics.

Here is a minimal example:
```
\definefontfeature[default][mode=node, kern=yes, liga=yes]
% more features
% [mode=node, kern=yes, liga=yes, tlig=yes, itlg=yes, ccmp=yes, language=dflt, 
protrusion=quality, expansion=quality]

\definefontfamily [myfont][roman][xcharter]
\definefontfamily [myfont][sansserif][overpass][rscale=0.93]
\definefontfamily [myfont][teletype][overpass][rscale=0.93]
\definefontfamily [myfont][mono][overpassmono][rscale=0.93]
\definetypeface   [myfont][mathematics][math] [xcharter]

\setupbodyfont[myfont, 11pt]

\startTEXpage

\showfontkerns

 Vitae, Vase, LT, VA, Y., Effizient, abcdel™, \italic{effi 
abcdel™}, \slanted{effi abcdel™}\\
\style[sans]{Vitae, Vase, LT, VA, Y., Effizient, abcdel™, \italic{effi 
abcdel™}, \slanted{effi abcdel™}}\\
\style[mono]{Vitae, Vase, LT, VA, Y., Effizient, abcdel™, \italic{effi 
abcdel™}, \slanted{effi abcdel™}}\\

\showbodyfont[myfont]

\stopTEXpage
```
It produces the PDF in the attachment. I'm struggling with several things:
- xcharter seems to have no kerning applied. It is listed as font feature, 
though. Is it correct to have no kerning at all for that font?
- xcharter also have no ligatures (at least it doesn't look like that). That is 
listed as font feature, too, although only for italic and slanted. According to 
https://tug.org/FontCatalogue/xcharter/ there are ligatures in the font.
- Overpass has a glyph for the ae ligature. Is it normal that it is not used as 
a ligature for ae?
- Overpass Mono does not contain italic glyphs. I would have expected obliques 
when using \slanted then. However, it just remains normal.
- I included the ™ in the example since its italic glyph is not slanted. For 
all fonts \slanted seems to switch to the extra (italic?) glyphs, while I would 
have expected obliques. At least overpass seems to have no dedicated slanted 
style, while xcharter has one.
- Is there a command to show ligatures the same way there is a command for 
kerning?

I attached the output of the following commands, too:
mtxrun --script font --list --file --info --pattern='xcharter*'
mtxrun --script font --list --file --info --pattern='overpass*'

Thanks
Gerion


font-features.txt.zst
Description: application/zstd


mwe.pdf
Description: Adobe PDF document


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Strange extra space when using cases in an inner align in math

2024-08-25 Thread Gerion Entrup
Hi Mikael,

your examples are simpler, that is correct, but all of them have the extra 
space.
Thanks for the simpler code, I will integrate it!

Gerion

Am Dienstag, 20. August 2024, 12:41:45 MESZ schrieb Mikael Sundqvist:
> Hi,
> 
> There is indeed a space added in this case. But you do not need n=3.
> And in fact, you do not need a simplealign either, but can use an
> ordinary align, with location=packed. It looks like you had the wrong
> number of \NC. I hope the examples below help, the last one is merely
> for Hans for looking into why the relation-digit space is added there.
> 
> /Mikael
> 
> \definemathsimplealign[inneralign]
> 
> \showglyphs
> \showboxes
> 
> \showmakeup[mathglue]
> 
> \startdocument
> 
> OK with \typ {n=2} instead of \typ {n=3}:
> 
> \startformula
>   \startalign
> \NC a = b \NC \NR
> \NC   \NC \startinneralign[n=2,align={1:right,2:left}]
> \NC A  \NC = B \NR
> \NC f(x,y) \NC = \startcases
>\NC 1 \NC a \NR
>\NC 1 \NC b \NR
>\NC 1 \NC b \NR
>  \stopcases
>\NR
>   \stopinneralign
>   \NR
>   \stopalign
> \stopformula
> 
> With align and location set to packed, instead of simplealign
> 
> \startformula
>   \startalign
> \NC a = b \NC \NR
> \NC   \NC \startalign[n=2,location=packed,align={1:right,2:left}]
> \NC A  \NC = B \NR
> \NC f(x,y) \NC = \startcases
>\NC 1 \NC a \NR
>\NC 1 \NC b \NR
>\NC 1 \NC b \NR
>  \stopcases
>\NR
>   \stopalign
>   \NR
>   \stopalign
> \stopformula
> 
> Extra \typ {reldig} space before the 1:
> 
> \startformula
> \startalign[n=3,location=packed,align={1:right,2:middle,2:left}]
> \NC A  \NC = \NC B \NR
> \NC f(x,y) \NC = \NC \startcases
>\NC 1 \NC a \NR
>\NC 2 \NC b \NR
>      \stopcases
>\NR
> \stopalign
> \stopformula
> 
> \stopdocument
> 
> On Tue, Aug 20, 2024 at 11:55 AM Gerion Entrup  wrote:
> >
> > Hi,
> >
> > I currently have the case of a strange extra space in math mode when using 
> > cases in inner align.
> >
> > Here is a MWE to demonstrate the problem:
> > ```
> > \definemathsimplealign[inneralign]
> > \startdocument
> > \startformula
> > \startalign
> > \NC a = b \NR
> > \NC \NC 
> > \startinneralign[n=3,align={1:right,2:middle,3:left}]
> > \NC A \NC = \NC B \NR
> > \NC f(x,y) \NC = \NC \startcases
> >  \NC \text{strange}  \NC a \NR
> >  \NC \text{normal}  \NC b \NR
> >  \NC \text{also normal}  \NC b \NR
> > \stopcases
> > \stopinneralign
> > \stopalign
> > \stopformula
> > \stopdocument
> > ```
> >
> > "strange" and "normal" are not aligned what I would expect but strange has 
> > more space in front of it.
> > Is this a usage error or a bug in the math engine?
> >
> > Best,
> > Gerion___



signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Strange extra space when using cases in an inner align in math

2024-08-20 Thread Gerion Entrup
Hi,

I currently have the case of a strange extra space in math mode when using 
cases in inner align.

Here is a MWE to demonstrate the problem:
```
\definemathsimplealign[inneralign]
\startdocument
\startformula
\startalign
\NC a = b \NR
\NC \NC \startinneralign[n=3,align={1:right,2:middle,3:left}]
\NC A \NC = \NC B \NR
\NC f(x,y) \NC = \NC \startcases
 \NC \text{strange}  \NC a \NR
 \NC \text{normal}  \NC b \NR
 \NC \text{also normal}  \NC b \NR
\stopcases
\stopinneralign
\stopalign
\stopformula
\stopdocument
```

"strange" and "normal" are not aligned what I would expect but strange has more 
space in front of it.
Is this a usage error or a bug in the math engine?

Best,
Gerion

mwe.pdf
Description: Adobe PDF document


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Alignments of margin notes

2024-08-02 Thread Gerion Entrup
Am Freitag, 2. August 2024, 07:42:29 MESZ schrieb Pablo Rodriguez via ntg-
context:
> On 8/2/24 01:13, Gerion Entrup wrote:
> > Ok, I think I understand that in principal. Thanks for the explanation.
> > Can I somehow know in advance that a margin note makes use of \framed?
> 
> Hi Gerion,
> 
> there is an \ifinframed conditional, such as in:
> ...
> This may help to achieve what you want.
> 
> Just in case it helps,

Thanks for the answer, but we misunderstood. I'll try to formulate it clearer:
If I get it right, to set margin notes, you need to specify \setupmargindata 
in any case.
However, on the one hand, there might be notes that follow the style of the 
"style" argument within \setupmargindata.
And on the other hand, there might be notes that internally uses \framed and 
follow the "style" argument within a separately specified \setupmarginframed.

My question is, whether I have any chance to get in advance (when writing down 
the document styling) which style argument my future (not yet written) margin 
notes will follow to know if I need to specify a \setupmarginframed at all.

Is it the style argument of \setupmargindata or \setupmarginframed or is it a 
good practice to _always_ specify \setupmarginframed with the same style 
argument as given to \setupmargindata?

Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Alignments of margin notes

2024-08-01 Thread Gerion Entrup
Am Donnerstag, 1. August 2024, 17:37:21 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 01.08.2024 um 17:19:
> > Am Donnerstag, 1. August 2024, 16:36:06 MESZ schrieb Wolfgang Schuster:
> >> Gerion Entrup schrieb am 01.08.2024 um 16:20:
> >>> Am Donnerstag, 1. August 2024, 16:13:23 MESZ schrieb Wolfgang Schuster:
> >>>> Gerion Entrup schrieb am 01.08.2024 um 14:28:
> >>>>> Hi,
> >>>>>
> >>>>> I want to make a two sided document with margin notes.
> >>>>> The notes should not be hyphenated and always aligned to the inner text 
> >>>>> body.
> >>>>> However, I did not get this to work.
> >>>>> It hyphenates and the alignment is only correct at even pages.
> >>>>>
> >>>>> Do you know the correct way?
> >>>>>
> >>>>> Here is a MWE:
> >>>>> ```
> >>>>> \setuppagenumbering[location={footer, right}, alternative=doublesided]
> >>>>>
> >>>>> \definealign[myalign][inner, nothyphenated]
> >>>>> \setupmargindata[inmargin][
> >>>>> location=outer,
> >>>>> style=italic,
> >>>>>  % nothing of that seems to have any effect
> >>>>> % align=myalign,
> >>>>> % align=inner,
> >>>>> % align=nothyphentated,
> >>>>> align={inner, nothyphentated},
> >>>>> ]
> >>>> Use \setupmarginframed for the alignment.
> >>>>
> >>>> \setupmarginframed
> >>>>  [inmargin]
> >>>>  [align={inner,nothyphenated}]
> >>> Does the align parameter of \setupmargindata has any function, then?
> >>> Also, using setupmarginframed leads to other problems:
> >>> - The margin text is bold now(?)
> >>> - All margin nodes are on the left of the page now (this should be only 
> >>> the case for even pages)
> >> The location of the margin block and the style are still controlled by
> >> \setupmargindata and only the alignment has to be changed with
> >> \setupmarginframed.
> >>
> >> \setupmargindata
> >> [inmargin]
> >> [location=outer,
> >>  style=italic]
> >>
> >> \setupmarginframed
> >> [inmargin]
> >> [align={inner,nothyphenated}]
> > Thanks, that works for the alignment. It does not change the hyphenation.
> > I would have expected this line breaks in the margin note:
> >
> > significant
> > incredible
> > components
> >
> > Instead, ConTeXt generates:
> >
> > significant in­
> > credible com­
> > ponents
> >
> > In general:
> > Does the "align" argument in setupmargindata has a meaning at all?
> 
> The align key works and the output is correct but the problem in this 
> case is a user error.
> 
> When you compare mine and your example you should notice a difference in 
> the spelling of nothyphenated which has an extra "t" in your case.

Oh, you are right, I made a typo here (I appreciate your diplomatic words ;)).



> > Why is the action to setup margin notes splitted in setupmargindata and 
> > setupmarginframed? I find it kind of unintuitive.
> 
> There are two different mechanism at work here:
> 
> 1. The placement of the texts is controlled with the margindata 
> mechanism has style and align options.
> 
> 2. In addition to the placement mechanism some of the margin texts make 
> use of \framed for the content. Because not all margin texts should make 
> use \framed this is optional and controlled with an extra setup-command. 
> The separate setup mechanism avoid also problems with keys which have a 
> different meaning for the placement of the margin texts, e.g. location 
> is an already existing framed-key but it is also used to set the 
> horizontal position of the block.

Ok, I think I understand that in principal. Thanks for the explanation.
Can I somehow know in advance that a margin note makes use of \framed?


Gerion



signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Wiki in Mobile(?) format

2024-08-01 Thread Gerion Entrup
Am Donnerstag, 1. August 2024, 16:42:19 MESZ schrieb Taco Hoekwater:
> 
> > On 1 Aug 2024, at 16:15, Gerion Entrup  wrote:
> > 
> > Hi,
> > 
> > since a few weeks I have the problem that I get the mobile(?) view for the 
> > wiki, when I open a "wiki.contextgarden.net" link.
> > However, the mobile view is not feature complete (colors and renderings are 
> > missing).
> 
> There is a link at the bottom of each wiki page. Its label is either “Mobile 
> view” (in your firefox) or “Desktop” (in your Qutebrowser). I am sure you can 
> guess what clicking on it does. :)


Argh, I somehow missed that button. Qutebrowser without Cookies opens the wiki 
pages in desktop format.
Apparently, I have clicked on that button sometime before...
As a technical info: It seem to change the value in the cookie from 
mf_useformat=true to stopMobileRedirect=true.

Thank you very much!

Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Alignments of margin notes

2024-08-01 Thread Gerion Entrup
Am Donnerstag, 1. August 2024, 16:36:06 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 01.08.2024 um 16:20:
> > Am Donnerstag, 1. August 2024, 16:13:23 MESZ schrieb Wolfgang Schuster:
> >> Gerion Entrup schrieb am 01.08.2024 um 14:28:
> >>> Hi,
> >>>
> >>> I want to make a two sided document with margin notes.
> >>> The notes should not be hyphenated and always aligned to the inner text 
> >>> body.
> >>> However, I did not get this to work.
> >>> It hyphenates and the alignment is only correct at even pages.
> >>>
> >>> Do you know the correct way?
> >>>
> >>> Here is a MWE:
> >>> ```
> >>> \setuppagenumbering[location={footer, right}, alternative=doublesided]
> >>>
> >>> \definealign[myalign][inner, nothyphenated]
> >>> \setupmargindata[inmargin][
> >>>   location=outer,
> >>>   style=italic,
> >>> % nothing of that seems to have any effect
> >>>   % align=myalign,
> >>>   % align=inner,
> >>>   % align=nothyphentated,
> >>>   align={inner, nothyphentated},
> >>> ]
> >> Use \setupmarginframed for the alignment.
> >>
> >> \setupmarginframed
> >> [inmargin]
> >> [align={inner,nothyphenated}]
> > Does the align parameter of \setupmargindata has any function, then?
> > Also, using setupmarginframed leads to other problems:
> > - The margin text is bold now(?)
> > - All margin nodes are on the left of the page now (this should be only the 
> > case for even pages)
> 
> The location of the margin block and the style are still controlled by 
> \setupmargindata and only the alignment has to be changed with 
> \setupmarginframed.
> 
> \setupmargindata
>[inmargin]
>[location=outer,
> style=italic]
> 
> \setupmarginframed
>[inmargin]
>[align={inner,nothyphenated}]

Thanks, that works for the alignment. It does not change the hyphenation.
I would have expected this line breaks in the margin note:

significant
incredible
components

Instead, ConTeXt generates:

significant in­
credible com­
ponents

In general:
Does the "align" argument in setupmargindata has a meaning at all?
Why is the action to setup margin notes splitted in setupmargindata and 
setupmarginframed? I find it kind of unintuitive.


Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Alignments of margin notes

2024-08-01 Thread Gerion Entrup
Am Donnerstag, 1. August 2024, 16:13:23 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 01.08.2024 um 14:28:
> > Hi,
> > 
> > I want to make a two sided document with margin notes.
> > The notes should not be hyphenated and always aligned to the inner text 
> > body.
> > However, I did not get this to work.
> > It hyphenates and the alignment is only correct at even pages.
> > 
> > Do you know the correct way?
> > 
> > Here is a MWE:
> > ```
> > \setuppagenumbering[location={footer, right}, alternative=doublesided]
> > 
> > \definealign[myalign][inner, nothyphenated]
> > \setupmargindata[inmargin][
> > location=outer,
> > style=italic,
> >% nothing of that seems to have any effect
> > % align=myalign,
> > % align=inner,
> > % align=nothyphentated,
> > align={inner, nothyphentated},
> > ]
> 
> Use \setupmarginframed for the alignment.
> 
> \setupmarginframed
>[inmargin]
>[align={inner,nothyphenated}]

Does the align parameter of \setupmargindata has any function, then?
Also, using setupmarginframed leads to other problems:
- The margin text is bold now(?)
- All margin nodes are on the left of the page now (this should be only the 
case for even pages)


I tested with (and Hans' patch):
```
\setuppagenumbering[location={footer, right}, alternative=doublesided]

% \definealign[myalign][inner, nothyphenated]
\setupmarginframed[inmargin][
location=outer,
style=italic,
% align=myalign,
% align=inner,
% align=nothyphentated,
align={inner, nothyphentated},
]

\starttext

\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth

\stoptext

```


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Wiki in Mobile(?) format

2024-08-01 Thread Gerion Entrup
Hi,

since a few weeks I have the problem that I get the mobile(?) view for the 
wiki, when I open a "wiki.contextgarden.net" link.
However, the mobile view is not feature complete (colors and renderings are 
missing).

This only happens in Qutebrowser (maybe it sets a header wrong).
Since the mobile view seems to be incomplete, is it possible to deactivate it 
completely?
This is fixed when I open a www.contextgarden.net link.

As a comparison:

Open https://wiki.contextgarden.net/Command/setupframed
in Qutebrowser: wiki-setupframed-qutebrowser.png

Open https://www.contextgarden.net/Command/setupframed
in Qutebrowser: www-setupframed-qutebrowser.png

(Note: The pictures are really small to not exceed the MLs size limit.)

These are my headers for the request:
```
GET /Command/setupframed HTTP/1.1
Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cache-Control: no-cache
Connection: keep-alive
Cookie: mf_useformat=true
DNT: 1
Host: wiki.contextgarden.net
Pragma: no-cache
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like 
Gecko) QtWebEngine/6.7.2 Chrome/118.0.5993.220 Safari/537.36
sec-ch-ua: "Not=A?Brand";v="99", "Chromium";v="118"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Linux"
```

The same request in Firefox:
```
GET /Command/setupframed HTTP/1.1
Host: wiki.contextgarden.net
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 
Firefox/128.0
Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
Accept-Language: en-US,en;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br, zstd
DNT: 1
Sec-GPC: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: cross-site
If-Modified-Since: Sun, 02 Jun 2024 16:02:37 GMT
Priority: u=0, i
```

Can you reproduce the problem?

Best
Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Alignments of margin notes

2024-08-01 Thread Gerion Entrup
Am Donnerstag, 1. August 2024, 15:36:57 MESZ schrieb Hans Hagen:
> On 8/1/2024 2:50 PM, Taco Hoekwater wrote:
> > Hi,
> > 
> > Something seems wrong with the align processing inside \setupmargindata, 
> > because using a macro like
> > 
> > \def\Inmargin#1{\inmargin{\blank[-line]\startalignment[inner,nothyphenated]#1\stopalignment}}
> > 
> > works ok (the \blank[-line] is a side-effect of using the environment 
> > inside a margin text).
> can you test with
> 
> \permanent\protected\tolerant\def\definealign[#1]#*[#2]%
>{\pushmacro\raggedcommand
> \pushmacro\updateraggedskips
> \edef\m_spac_align_named{#1}%
> \edef\m_spac_align_asked{#2}%
> \spac_align_add_to_cache
> \popmacro\updateraggedskips
> \popmacro\raggedcommand}
> 
> (in cont-new.mkxl after \unprotect)

I see no visible change for my minimal example with that.


Gerion



signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Alignments of margin notes

2024-08-01 Thread Gerion Entrup
Hi,

I want to make a two sided document with margin notes.
The notes should not be hyphenated and always aligned to the inner text body.
However, I did not get this to work.
It hyphenates and the alignment is only correct at even pages.

Do you know the correct way?

Here is a MWE:
```
\setuppagenumbering[location={footer, right}, alternative=doublesided]

\definealign[myalign][inner, nothyphenated]
\setupmargindata[inmargin][
location=outer,
style=italic,
  % nothing of that seems to have any effect
% align=myalign,
% align=inner,
% align=nothyphentated,
align={inner, nothyphentated},
]

\starttext

\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth
\inmargin{significant incredible components}\input knuth

\stoptext
```

Best,
Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Draw leftframe to a description

2024-07-08 Thread Gerion Entrup
Hi,

I want to typeset an "excurses" description that is marked with a leftframe. 
The problem is that it spans about multiple pages and has footnotes.

Here is an MWE:
```
%% -> mwe-framedtext.pdf
\defineframedtext[excursusbg][
frame=off,
leftframe=on,
rulethickness=1mm,
framecolor=blue,
toffset=0mm,  % there is an offset anyways
]

%% -> mwe-textbackground.pdf
% \definetextbackground[excursusbg] [
%   location=text,
%   background=color,
%   backgroundcolor=lightblue,
%   frame=on,
%   loffset=10cm,  % seems to have no impact
% ]

\definedescription[excursus][
text={Excursus:\ },
alternative=top,
headstyle=bold,
margin=1cm,
width=broad,
before={\startexcursusbg},
after={\stopexcursusbg},
]

\starttext

\input ward

\startexcursus[title={A Knuth extract}]

\input knuth

\stopexcursus

\input ward

\startexcursus[title={A much longer Knuth extract}]

\input knuth
Sometimes, sentences have footnotes\footnote{Some footnote}.

\input knuth
\input knuth

\stopexcursus

\stoptext
```
See the attached PDFs for the different results.

In principal, I would like the excurses typesetted like to solution with 
\defineframedtext. However, this does not work with pagebreaks.
Additionally, the leftframe is too long (it begins above the "Excursus" text). 
I tried toffset to let the leftframe begin exactly at the "Excurses" text 
without success.

The solution with \textbackground looks somewhat promising. It supports 
pagebreaks, but draws above footnotes and prints a small rectangle at the end 
of the excursus. I also didn't found a way to specify a leftframe only.
Also, loffset seems to have no effect, here.

Do I use the false environments? Do you know a better solution?

Gerion

mwe-textbackground.pdf
Description: Adobe PDF document


mwe-framedtext.pdf
Description: Adobe PDF document


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: How to specify a default formatting for TABLE

2024-07-01 Thread Gerion Entrup
Am Dienstag, 2. Juli 2024, 00:17:36 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 01.07.2024 um 23:56:
> > Hi,
> > 
> > I want to format a bunch a tables with the same formatting.
> > It seems that specifying the \setupTABLE commands as part of the preamble 
> > works.
> > 
> > However, I need some tables that are formatted in another way.
> > Is there a generic way to specify this?
> > 
> > Here is a MWE:
> > [...]
> > 
> > The last two tables should be formatted as if the four setupTABLE commands 
> > in the header are not existent.
> > My solution does not work, however.
> 
> 1. Put your table settings in a setups-block and load the one you want 
> at the start of your table.
> 
> 2. You don't need \setupcolors[state=start] because colors are enabled 
> by default (since a veee...eeery long time).
> 
> 3. You can replace \bTD ... \eTD with \bTH ... \eTH for table headers to 
> get bold text.
> 
>  begin example
> \startsetups[table:a]
>\setupTABLE [each] [frame=off,width=1cm,height=1cm,align={middle,lohi}]
>\setupTABLE [each] [background=color,backgroundcolor=lightgray]
> \stopsetups
> 
> \startsetups[table:b]
>\setupTABLE [each] 
> [frame=off,width=2cm,height=1.2\lineheight,align=middle]
>\setupTABLE [each] [topframe=on,bottomframe=on]
> \stopsetups
> 
> \starttext
> 
> \bTABLE
>\bTR
>  \bTD A \eTD
>  \bTD B \eTD
>\eTR
>\bTR
>  \bTD C \eTD
>  \bTD D \eTD
>\eTR
> \eTABLE
> 
> \blank
> 
> \bTABLE[setups=table:a]
>\bTR
>  \bTD A \eTD
>  \bTD B \eTD
>\eTR
>\bTR
>  \bTD C \eTD
>  \bTD D \eTD
>\eTR
> \eTABLE
> 
> \blank
> 
> \bTABLE[setups=table:b]
>\bTR
>  \bTD A \eTD
>  \bTD B \eTD
>\eTR
>\bTR
>  \bTD C \eTD
>  \bTD D \eTD
>\eTR
> \eTABLE
> 
> \stoptext
>  end example
> 
> Wolfgang

Thank you very much! That are a bunch of nice tricks. The setups environment is 
really powerful.
I will actively search for this keyword in the documentation next time.

Gerion





signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] How to specify a default formatting for TABLE

2024-07-01 Thread Gerion Entrup
Hi,

I want to format a bunch a tables with the same formatting.
It seems that specifying the \setupTABLE commands as part of the preamble works.

However, I need some tables that are formatted in another way.
Is there a generic way to specify this?

Here is a MWE:
```
\setupTABLE[frame=off, offset=2pt]
\setupTABLE[row][first][topframe=on, bottomframe=on, style=bf]
\setupTABLE[row][last][bottomframe=on]
\setupTABLE[row][even][background=color,backgroundcolor=red]

\setupcolors[state=start]

\starttext

A table:\\
\bTABLE
\bTR \bTD head1 \eTD \bTD head2 \eTD \eTR
\bTR \bTD data1 \eTD \bTD data2 \eTD \eTR
\bTR \bTD data3 \eTD \bTD data4 \eTD \eTR
\eTABLE
\blank[line]

Another table with the same format:\\
\bTABLE
\bTR \bTD head1 \eTD \bTD head2 \eTD \eTR
\bTR \bTD data1 \eTD \bTD data2 \eTD \eTR
\bTR \bTD data3 \eTD \bTD data4 \eTD \eTR
\eTABLE
\blank[line]

This table should be formatted in another way (actually not formatted):\\
\bTABLE
\setupTABLE[row][each][topframe=off, bottomframe=off, style=, 
background=]
\bTR \bTD head1 \eTD \bTD head2 \eTD \eTR
\bTR \bTD data1 \eTD \bTD data2 \eTD \eTR
\bTR \bTD data3 \eTD \bTD data4 \eTD \eTR
\eTABLE
\blank[line]

This does not work either:\\
{
\setupTABLE[row][each][topframe=off, bottomframe=off, style=, background=]
% \setupTABLE[row][1,2,3][topframe=off, bottomframe=off, style=, background=] % 
this deactivates the color at least
\bTABLE
\bTR \bTD head1 \eTD \bTD head2 \eTD \eTR
\bTR \bTD data1 \eTD \bTD data2 \eTD \eTR
\bTR \bTD data3 \eTD \bTD data4 \eTD \eTR
\eTABLE
}

\stoptext
```

The last two tables should be formatted as if the four setupTABLE commands in 
the header are not existent.
My solution does not work, however.

Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Use headcommand in \definedescription together with \definehighlight (now: \definestartstop)

2024-07-01 Thread Gerion Entrup
Am Freitag, 28. Juni 2024, 11:59:19 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 28.06.2024 um 11:40:
> 
> > Do you know, why the groupedcommand solution does not work?
> 
> The command and the environment which are created by \definestartstop 
> can't be interchanged when you use the before/after and left/right keys.
> 
>  begin example
> \usemodule[visual]
> 
> \definestartstop
>[Example]
>[before={\par\leftaligned{\tttf [before]}\par},
>  after={\par\leftaligned{\tttf [after]}\par},
>left={{\tttf [left]}},
>   right={{\tttf [right]}}]
> 
> \starttext
> 
> \fakewords{10}{20}
> \startExample
> \fakewords{10}{20}
> \stopExample
> \fakewords{10}{20}
> 
> \blank
> 
> \fakewords{3}{5}
> \Example{\fakewords{3}{5}}
> \fakewords{3}{5}
> 
> \stoptext
>  end example
> 
> Wolfgang
> 

Ok, thanks for the explanation (I have added the example to the wiki).

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Use headcommand in \definedescription together with \definehighlight (now: \definestartstop)

2024-06-28 Thread Gerion Entrup
Am Donnerstag, 27. Juni 2024, 22:19:02 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 25.06.2024 um 08:41:
> > Am Dienstag, 25. Juni 2024, 00:09:09 MESZ schrieb Wolfgang Schuster:
> >> Gerion Entrup schrieb am 24.06.2024 um 23:57:
> >>> Am Montag, 24. Juni 2024, 21:20:19 MESZ schrieb Aditya Mahajan:
> >>>> On Mon, 24 Jun 2024, Gerion Entrup wrote:
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> I was in the process to convert an itemize part to a description and 
> >>>>> wanted to simplify the code in the same move.
> >>>>> I discovered headcommand for that, but struggled to set the text in an 
> >>>>> highlight _and_ make a colon at the end.
> >>>> Not sure what exactly you want, but how about:
> >>>>
> >>>> \definehighlight[hl][style={\m{>}\,\switchtobodyfont[tt]}]
> >>>> % This is the wrong way to define such a command as '>' is not part of 
> >>>> the style. I have left this definition just for comparison with the soln 
> >>>> below.
> >>> Is there a better way to define a highlight that sets a style (color, 
> >>> font) _and_ a prefix (symbol)?
> >>> Another way, I know of, would be just a plain def, something like 
> >>> \def{\hl}{\groupedcommand{>\,\switchtobodyfont[tt]}{}}, but actually I 
> >>> want to define a highlight (just with an additional prefix).
> >>
> >> 1. ConTeXt already uses \hl as name for a existing command.
> >>
> >> 2. Use \definestartstop:
> >>
> >> \definestartstop [gerion] [style=mono,left={›\thinspace}]
> >>
> >> \starttext
> >>
> >> text
> >>
> >> \gerion{text}
> >>
> >> \stoptext
> >>
> >>>> \definedescription[category][
> >>>>  alternative=top,
> >>>>  headstyle=bold,
> >>>>  width=broad,
> >>>> ]
> >>>>
> >>>> \definedescription[desc][
> >>>>  width=fit,
> >>>>  distance={\widthofstring{~}},
> >>
> >> distance=\spaceamount,
> >>
> >> Wolfgang
> > 
> > This seems to be much better but does not lead to the wanted result. The 
> > full example now is:
> > ```
> > \definestartstop[myhl][style=mono,left={›\thinspace}]
> > 
> > \definedescription[categorie][
> > alternative=top,
> > headstyle=bold,
> > width=broad,
> > ]
> > 
> > \definedescription[desc][
> > width=broad,
> > distance=\spaceamount,
> > headcommand={\groupedcommand{\startmyhl}{\stopmyhl :}},
> > headstyle=,
> > before={\startpacked},
> > after={\stoppacked},
> > alternative=hanging
> > ]
> > 
> > \starttext
> > 
> > This is a \myhl{highlight}.
> > 
> > Some listings
> > 
> > \startcategorie{Itemize}
> > \startitemize[packed]
> > \item \myhl{first}: one
> > \item \myhl{second}: two
> > \stopitemize
> > \stopcategorie
> > 
> > Now the same as desc:
> > \startcategorie{Desc}
> > \startdesc{first} one \stopdesc
> > \startdesc{second} two \stopdesc
> > \stopcategorie
> > 
> > \stoptext
> > ```
> > 
> > This adopts the correct style in \startdesc \stopdesc and sets the colon 
> > but omits the › (the left part).
> 
> You can do the following in the next version.
> 
> 1. Add "arguments=yes" to \definestartstop to enable the optional 
> argument for the new command.
> 
> 2. Use the new commands with the "headcommand" key and apply ":" as 
> right delimiter for the content of \Highlight.
> 
> \definestartstop
>[Highlight]
>[arguments=yes,
> style=mono,
>  left={›\thinspace}]
> 
> \definedescription
>[description]
>[  width=broad,
>distance=\spaceamount,
> headcommand=\Highlight[right=:],
> alternative=hanging]
> 
> \starttext
> 
> This is a \Highlight{highlight}.
> 
> \startdescription[title={Lorem ipsum}]
> \samplefile{lorem}
> \stopdescription
> 
> \stoptext
> 
> Wolfgang

Thanks, that will work.
Do you know, why the groupedcommand solution does not work?

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Use headcommand in \definedescription together with \definehighlight (now: \definestartstop)

2024-06-24 Thread Gerion Entrup
Am Dienstag, 25. Juni 2024, 00:09:09 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 24.06.2024 um 23:57:
> > Am Montag, 24. Juni 2024, 21:20:19 MESZ schrieb Aditya Mahajan:
> >> On Mon, 24 Jun 2024, Gerion Entrup wrote:
> >>
> >>> Hi,
> >>>
> >>> I was in the process to convert an itemize part to a description and 
> >>> wanted to simplify the code in the same move.
> >>> I discovered headcommand for that, but struggled to set the text in an 
> >>> highlight _and_ make a colon at the end.
> >> Not sure what exactly you want, but how about:
> >>
> >> \definehighlight[hl][style={\m{>}\,\switchtobodyfont[tt]}]
> >> % This is the wrong way to define such a command as '>' is not part of the 
> >> style. I have left this definition just for comparison with the soln below.
> > Is there a better way to define a highlight that sets a style (color, font) 
> > _and_ a prefix (symbol)?
> > Another way, I know of, would be just a plain def, something like 
> > \def{\hl}{\groupedcommand{>\,\switchtobodyfont[tt]}{}}, but actually I want 
> > to define a highlight (just with an additional prefix).
> 
> 1. ConTeXt already uses \hl as name for a existing command.
> 
> 2. Use \definestartstop:
> 
> \definestartstop [gerion] [style=mono,left={›\thinspace}]
> 
> \starttext
> 
> text
> 
> \gerion{text}
> 
> \stoptext
> 
> >> \definedescription[category][
> >>alternative=top,
> >>headstyle=bold,
> >>width=broad,
> >> ]
> >>
> >> \definedescription[desc][
> >>width=fit,
> >>distance={\widthofstring{~}},
> 
> distance=\spaceamount,
> 
> Wolfgang

This seems to be much better but does not lead to the wanted result. The full 
example now is:
```
\definestartstop[myhl][style=mono,left={›\thinspace}]

\definedescription[categorie][
alternative=top,
headstyle=bold,
width=broad,
]

\definedescription[desc][
width=broad,
distance=\spaceamount,
headcommand={\groupedcommand{\startmyhl}{\stopmyhl :}},
headstyle=,
before={\startpacked},
after={\stoppacked},
alternative=hanging
]

\starttext

This is a \myhl{highlight}.

Some listings

\startcategorie{Itemize}
\startitemize[packed]
\item \myhl{first}: one
\item \myhl{second}: two
\stopitemize
\stopcategorie

Now the same as desc:
\startcategorie{Desc}
\startdesc{first} one \stopdesc
\startdesc{second} two \stopdesc
\stopcategorie

\stoptext
```

This adopts the correct style in \startdesc \stopdesc and sets the colon but 
omits the › (the left part).

Gerion


mwe.pdf
Description: Adobe PDF document


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Use headcommand in \definedescription together with \definehighlight

2024-06-24 Thread Gerion Entrup
Am Montag, 24. Juni 2024, 21:20:19 MESZ schrieb Aditya Mahajan:
> On Mon, 24 Jun 2024, Gerion Entrup wrote:
> 
> > Hi,
> > 
> > I was in the process to convert an itemize part to a description and wanted 
> > to simplify the code in the same move.
> > I discovered headcommand for that, but struggled to set the text in an 
> > highlight _and_ make a colon at the end.
> 
> Not sure what exactly you want, but how about:
> 
> \definehighlight[hl][style={\m{>}\,\switchtobodyfont[tt]}]
> % This is the wrong way to define such a command as '>' is not part of the 
> style. I have left this definition just for comparison with the soln below.

Is there a better way to define a highlight that sets a style (color, font) 
_and_ a prefix (symbol)?
Another way, I know of, would be just a plain def, something like 
\def{\hl}{\groupedcommand{>\,\switchtobodyfont[tt]}{}}, but actually I want to 
define a highlight (just with an additional prefix).

> \definedescription[category][
>   alternative=top,
>   headstyle=bold,
>   width=broad,
> ]
> 
> \definedescription[desc][
>   width=fit,
>   distance={\widthofstring{~}},
> headcommand={\groupedcommand{>\,}{:}}, 

Hmm, this works, but duplicates the above definition.
If I don't want to use > as prefix but ›, I need to replace it in two places.

>   headstyle=\tt,
>   before={\startpacked},
>   after={\stoppacked},
>   alternative=hanging,
> ]

Gerion



signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Use headcommand in \definedescription together with \definehighlight

2024-06-24 Thread Gerion Entrup
Hi,

I was in the process to convert an itemize part to a description and wanted to 
simplify the code in the same move.
I discovered headcommand for that, but struggled to set the text in an 
highlight _and_ make a colon at the end.
Do you know, if this is possible?

Here is a MWE:
```
\definehighlight[hl][style={\m{>}\,\switchtobodyfont[tt]}]

\definedescription[category][
alternative=top,
headstyle=bold,
width=broad,
]

\definedescription[desc][
width=broad,
distance={\widthofstring{~}},
headcommand={\groupedcommand{\hl}{:}},
% headcommand={\groupedcommand{}{:}}, % this compiles but the highlight 
is lost
% headcommand={\groupedcommand{\starthl}{\stophl :}}, % this does not 
compile
headstyle=,
before={\startpacked},
after={\stoppacked},
alternative=hanging,
]

\starttext

This is a \hl{highlight}.

Some listings

\startcategory{Itemize}
\startitemize[packed]
\item \hl{first}: one
\item \hl{second}: two
\stopitemize
\stopcategory

Now the same as desc:
\startcategory{Desc}
\startdesc{first} one \stopdesc
\startdesc{second} two \stopdesc
\stopcategory

\stoptext
```
The itemize looks like it should look (except of the dots).

Best,
Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: weekend update

2024-06-24 Thread Gerion Entrup
Am Sonntag, 23. Juni 2024, 15:28:37 MESZ schrieb Hans Hagen:
> On 6/23/2024 2:35 PM, Gerion Entrup wrote:
> > Am Freitag, 21. Juni 2024, 19:00:03 MESZ schrieb Hans Hagen via ntg-context:
> >> -- support for stacking at the tex end (maybe for presentations)
> >>
> >> \starttext
> >>
> >> \definestacking[one]
> >> \definestacking[two]
> >>
> >> \startbuffer
> >> This is a test \stacking [one] {and a proof} of \stacking [two]
> >> {concept} indeed
> >> \stacking [one] {\blackrule [width=4cm]} is it and the question is how
> >> \stacking
> >> [two] {\scale [s=2] {fancy}} we can go
> >>
> >> \startstacking[one]
> >> \startformula
> >>   \sqrt{1+x}
> >> \stopformula
> >> \stopstacking
> >>
> >> and how useful \stacking[two]{\inframed{it}} is.
> >> \stopbuffer
> >>
> >> \startstackingsteps[one,two,{one,two}]
> >>   \startTEXpage[offset=1ts]
> >>   \getbuffer
> >>   \stopTEXpage
> >> \stopstackingsteps
> >>
> >> \startTEXpage[offset=1ts] \setupstacking[criterium={one}] \getbuffer
> >> \stopTEXpage
> >> \startTEXpage[offset=1ts] \setupstacking[criterium={two}] \getbuffer
> >> \stopTEXpage
> >> \startTEXpage[offset=1ts] \setupstacking[criterium={one,two}] \getbuffer
> >> \stopTEXpage
> >>
> >> \stoptext
> > 
> > Very nice, thank you!
> > 
> > I see some similarities to the "visible on" technique [1], I posted in a 
> > previous thread.
> 
> You mean the horrible transparency hack there?

Sure, exactly that :)

> > What comes there really handy are range specifiers, what seems not possible 
> > with this interface.
> > For example: "visible on=<2->" renders the content on every page except the 
> > first one
> > or "visible on=<1-5,13-15>" on the first page up to the fifth page and from 
> > page 13 to 15.
> > 
> > The mechanism stems from the Beamer overlay specifications, see section 9.3 
> > of the manual [2]
> > and can be much more complicated with modes (section 9.6.2).
> 
> I don't know beamer other than seeing presentations at meetings but I 
> assume that it has some accumulator. We do have steppers in mkii / mkiv 
> already in the presentation styles. The conceptual cleanest of them 
> depends on the viewer and free ones never catched up so that one is 
> acrobat specific. The stacker discussed now is just similar to the 
> metapost one but then at the tex end. (A quick hack with room for more a 
> bit more effiency if ther ei sneed for it.)
> 
> > To add this to the new interface, if you want that, the stack layers above 
> > need some kind of order,
> > which is implicit for numbers:
> > ```
> > \definestacking{one}
> > \definestacking{two}
> > \definestacking{three}
> > \definestackingorder{one,two, three}
> > ...
> > \setupstacking[criterium={one-three}]
> > ```
> > The order could also be implicitly defined after the order of the 
> > \definestacking calls.
> > 
> > Or would it be possible to have numbers always automatically (additionally) 
> > available as stacking layer?
> > So that this "just" works:
> > ```
> > \startbuffer
> > This is a test \stacking [1] {and a proof} of \stacking [2] {concept} 
> > indeed.
> > \stopbuffer
> > ...
> > \setupstacking[criterium={1-}]
> > ```
> > 
> > I also wondered, if it is possible to define a lot of layers 
> > semiautomatically in Lua
> > (in some graphics I needed around 20 layers). It seems that numbers in 
> > layer names currently are not allowed.
> > Is code like this possible somehow?
> > 
> > ```
> > \startluacode
> > for i = 1, 20 do
> >  context.definestacking(string.format("l\letterpercent.d", i))
> > end
> > \stopluacode
> > ```
> 
> The next version already will have this:
> 
> %D For Aditya Mahajan: ranges and such.
> %D
> %D \starttyping
> %D \starttext
> %D \startstackingsteps[1,{1:2,201},{1:3,301},{1,2,4},{1-5},{1-6},{1-7}]
> %D \startTEXpage
> %D \startstacking[1]   \framed{ONE}\stopstacking
> %D \startstacking[2]   \framed{TWO}\stopstacking
> %D \startstacking[201] \framed{MORE}   \stopstacking
> %D \startstacking[3]   \framed{THREE}  \stopstacking
> %D \startstacking[301] \framed{INDEED} \stopstacking
> %D   

[NTG-context] Re: weekend update

2024-06-23 Thread Gerion Entrup
Am Sonntag, 23. Juni 2024, 14:35:13 MESZ schrieb Gerion Entrup:
> Am Freitag, 21. Juni 2024, 19:00:03 MESZ schrieb Hans Hagen via ntg-context:
> > -- support for stacking at the tex end (maybe for presentations)
> > 
> > \starttext
> > 
> > \definestacking[one]
> > \definestacking[two]
> > 
> > \startbuffer
> > This is a test \stacking [one] {and a proof} of \stacking [two] 
> > {concept} indeed
> > \stacking [one] {\blackrule [width=4cm]} is it and the question is how 
> > \stacking
> > [two] {\scale [s=2] {fancy}} we can go
> > 
> > \startstacking[one]
> > \startformula
> >  \sqrt{1+x}
> > \stopformula
> > \stopstacking
> > 
> > and how useful \stacking[two]{\inframed{it}} is.
> > \stopbuffer
> > 
> > \startstackingsteps[one,two,{one,two}]
> >  \startTEXpage[offset=1ts]
> >  \getbuffer
> >  \stopTEXpage
> > \stopstackingsteps
> > 
> > \startTEXpage[offset=1ts] \setupstacking[criterium={one}] \getbuffer 
> > \stopTEXpage
> > \startTEXpage[offset=1ts] \setupstacking[criterium={two}] \getbuffer 
> > \stopTEXpage
> > \startTEXpage[offset=1ts] \setupstacking[criterium={one,two}] \getbuffer 
> > \stopTEXpage
> > 
> > \stoptext
> 
> Very nice, thank you!
> 
> I see some similarities to the "visible on" technique [1], I posted in a 
> previous thread.
> What comes there really handy are range specifiers, what seems not possible 
> with this interface.
> For example: "visible on=<2->" renders the content on every page except the 
> first one
> or "visible on=<1-5,13-15>" on the first page up to the fifth page and from 
> page 13 to 15.
> 
> The mechanism stems from the Beamer overlay specifications, see section 9.3 
> of the manual [2]
> and can be much more complicated with modes (section 9.6.2).
> 
> To add this to the new interface, if you want that, the stack layers above 
> need some kind of order,
> which is implicit for numbers:
> ```
> \definestacking{one}
> \definestacking{two}
> \definestacking{three}
> \definestackingorder{one,two, three}
> ...
> \setupstacking[criterium={one-three}]
> ```
> The order could also be implicitly defined after the order of the 
> \definestacking calls.
> 
> Or would it be possible to have numbers always automatically (additionally) 
> available as stacking layer?
> So that this "just" works:
> ```
> \startbuffer
> This is a test \stacking [1] {and a proof} of \stacking [2] {concept} indeed.
> \stopbuffer
> ...
> \setupstacking[criterium={1-}]
> ```
> 
> I also wondered, if it is possible to define a lot of layers 
> semiautomatically in Lua
> (in some graphics I needed around 20 layers). It seems that numbers in layer 
> names currently are not allowed.
> Is code like this possible somehow?
> 
> ```
> \startluacode
> for i = 1, 20 do
> context.definestacking(string.format("l\letterpercent.d", i))
> end
> \stopluacode
> ```
> 
> Gerion
> 
> 
> [1] 
> https://github.com/luhsra/texmf/blob/main/tex/latex/beamertools/beamertools.sty
> [2] https://ctan.org/pkg/beamer
> 

I need to correct myself (I had a typo in my tests before). Numbers as stacking 
layer names are possible.
This Lua code works fine:

```
\startluacode
   for i = 1, 20 do
   context("\\definestacking[l\letterpercent.d]", i)
   end
\stopluacode
```

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: weekend update

2024-06-23 Thread Gerion Entrup
Am Samstag, 22. Juni 2024, 02:47:31 MESZ schrieb Aditya Mahajan:
> On Fri, 21 Jun 2024, Hans Hagen via ntg-context wrote:
> 
> > Hi,
> > 
> > -- support for stacking at the tex end (maybe for presentations)
> > 
> > \starttext
> > 
> > \definestacking[one]
> > \definestacking[two]
> > 
> > \startstackingsteps[one,two,{one,two}]
> > \startTEXpage[offset=1ts]
> > \getbuffer
> > \stopTEXpage
> > \stopstackingsteps
> 
> I have crude macros which provide this features (save stuff in boxes and then 
> unbox) for showing stuff stepwise in presentation (without relying on fancy 
> PDF features which are viewer dependent). So, this new feature is very 
> interesting. Thanks!
> 
> I use stackers in the following ways:
> 
> Case 1: Show stuff step by step
> 
> \startstackingsteps[1,{1,2},{1,2,3},{1,2,3,4}]
> 
> \startstacking[1]
> ...
> \stopstacking
> 
> \startstacking[2]
> ...
> \stopstacking
> 
> \startstacking[3]
> ...
> \stopstacking
> 
> \startstacking[4]
> ...
> \stopstacking
> 
> \stopstackingsteps
> 
> 
> Case 2: Show stuff step by step but some things are only shown once
> 
> \startstackingsteps[1,{1,2,2only},{1,2,3},{1,2,3,4}]
> 
> 
> 
> \startstacking[2] % Show always after 2nd step
> ...
> \stopstacking
> 
> \startstacking[2only] % Show only during step 2
> ...
> \stopstacking
> 
> ...
> 
> \stopstackingsetps
> 
> Case 3: Show stuff step by step but some things are only for specific slides
> 
> \startstacking[2only,3only] % Show only during step 2 and 3:
> ...
> \stopstacking
> 
> So, I have a few requests:
> 
> 1. Can we add support for \startstacking[one,two]? 
> 
> 2. For case 1, could we have a shortcut to easily write 
> \startstackingsteps[1,{1,2},{1,2,3}...]. This gets really tedious when there 
> are say 6 or 7 steps. 
> 
>One option is:
> 
>\startstackingsteps[criterium={1,2,3}, alternative=normal] % or sequential
> 
> for the current implementation
> 
> and 
> 
>\startstackingsteps[criterium={1,2,3}, alternative=cumulative]
> 
>for the cumulative option (1,{1,2},{1,2,3}...)
> 
> 3. It will be nice to have a syntax to easily handle case 2 and 3. 
> 
> As a bonus, I found that tex stacking plays nicely with metapost stacking!
> 
> \starttext
> 
> \definestacking[1]
> \definestacking[2]
> \definestacking[3]
> 
> \startbuffer
> \subject{How to draw a circle}
> \startitemize
> \startstacking[2] \startitem Pick a point \stopitem \stopstacking
> \startstacking[3] \startitem Draw the circle \stopitem \stopstacking
> \stopitemize
> 
> \startplacefigure[location={here,none}]
>   \startMPcode[stacking={\namedstackingparameter\empty{criterium}}]
> newpair A; A := origin;
> newpath p; p := fullcircle scaled 3cm shifted A;
> 
> fill fullcircle scaled 3bp shifted A withstacking 2;
> 
> draw p withstacking 3;
> 
> setbounds currentpicture to bbox p ;
>   \stopMPcode
> \stopplacefigure
> \stopbuffer
> 
> \startstackingsteps[1,{1,2},{1,2,3}]
>  \startTEXpage[offset=1ts]
>  \getbuffer
>  \stopTEXpage
> \stopstackingsteps
> \stoptext
> 
> Thanks,
> Aditya

Sorry, I did not read your answer before writing an own. See my other mail, it 
has much in common with yours.

Gerion




signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: weekend update

2024-06-23 Thread Gerion Entrup
Am Freitag, 21. Juni 2024, 19:00:03 MESZ schrieb Hans Hagen via ntg-context:
> -- support for stacking at the tex end (maybe for presentations)
> 
> \starttext
> 
> \definestacking[one]
> \definestacking[two]
> 
> \startbuffer
> This is a test \stacking [one] {and a proof} of \stacking [two] 
> {concept} indeed
> \stacking [one] {\blackrule [width=4cm]} is it and the question is how 
> \stacking
> [two] {\scale [s=2] {fancy}} we can go
> 
> \startstacking[one]
> \startformula
>  \sqrt{1+x}
> \stopformula
> \stopstacking
> 
> and how useful \stacking[two]{\inframed{it}} is.
> \stopbuffer
> 
> \startstackingsteps[one,two,{one,two}]
>  \startTEXpage[offset=1ts]
>  \getbuffer
>  \stopTEXpage
> \stopstackingsteps
> 
> \startTEXpage[offset=1ts] \setupstacking[criterium={one}] \getbuffer 
> \stopTEXpage
> \startTEXpage[offset=1ts] \setupstacking[criterium={two}] \getbuffer 
> \stopTEXpage
> \startTEXpage[offset=1ts] \setupstacking[criterium={one,two}] \getbuffer 
> \stopTEXpage
> 
> \stoptext

Very nice, thank you!

I see some similarities to the "visible on" technique [1], I posted in a 
previous thread.
What comes there really handy are range specifiers, what seems not possible 
with this interface.
For example: "visible on=<2->" renders the content on every page except the 
first one
or "visible on=<1-5,13-15>" on the first page up to the fifth page and from 
page 13 to 15.

The mechanism stems from the Beamer overlay specifications, see section 9.3 of 
the manual [2]
and can be much more complicated with modes (section 9.6.2).

To add this to the new interface, if you want that, the stack layers above need 
some kind of order,
which is implicit for numbers:
```
\definestacking{one}
\definestacking{two}
\definestacking{three}
\definestackingorder{one,two, three}
...
\setupstacking[criterium={one-three}]
```
The order could also be implicitly defined after the order of the 
\definestacking calls.

Or would it be possible to have numbers always automatically (additionally) 
available as stacking layer?
So that this "just" works:
```
\startbuffer
This is a test \stacking [1] {and a proof} of \stacking [2] {concept} indeed.
\stopbuffer
...
\setupstacking[criterium={1-}]
```

I also wondered, if it is possible to define a lot of layers semiautomatically 
in Lua
(in some graphics I needed around 20 layers). It seems that numbers in layer 
names currently are not allowed.
Is code like this possible somehow?

```
\startluacode
for i = 1, 20 do
context.definestacking(string.format("l\letterpercent.d", i))
end
\stopluacode
```

Gerion


[1] 
https://github.com/luhsra/texmf/blob/main/tex/latex/beamertools/beamertools.sty
[2] https://ctan.org/pkg/beamer


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Specify separator within setupbtx for custom bibliography rendering

2024-06-21 Thread Gerion Entrup
Am Samstag, 1. Juni 2024, 16:16:38 MESZ schrieb Gerion Entrup:
> Hi,
> 
> according to the section "Custom citation renderings" in the bibliography 
> manual, I have specified an own setup for citation rendering.
> However, this seems only to work for single citations (of one source). I want 
> to also specify the separator but did not get it to run.
> 
> Here is a minimal example:
> ```
> \setupinteraction[state=start]
> 
> \startbuffer[testdata]
> @Book{knuth1,
>   author = {Donald E. Knuth},
>   title = {TEX and METAFONT. New directions in typesetting},
>   year = {1979},
>   publisher = {Addison-Wesley},
> }
> @Article{someother,
>   author = {Some Person and Some Otherperson},
>   title = {Another title},
>   year = {1900},
> }
> \stopbuffer
> 
> % enable tracing
> \enabletrackers[publications, publications.crossref, publications.details, 
> publications.cite, publications.strings]
> 
> \usebtxdataset[main][testdata.buffer]
> \usebtxdefinitions[aps]
> \setupbtx[dataset=main]
> \definebtxrendering[bibrendering][aps][dataset=main, numbering=short]
> \setupbtxlist[aps][
>   alternative=b,
>   distance=.5em,
> ]
> 
> \definebtx[aps:cite:special][aps:cite][
>   left={((},
>   right={))},
>   separator:2={sfd},
>   separator:3={sfd},
>   separator:4={sfd},
> ]
> 
> \startsetups btx:aps:cite:special
>   % just a dummy
>   \btxcitereference
>   \currentbtxtag
> \stopsetups
> 
> \setupbtx[aps:cite][
>   alternative=special,
> ]
> 
> \starttext
> 
> Both said something~\cite[knuth1, someother].
> 
> \placelistofpublications[bibrendering]
> 
> \stoptext
> ```
> 
> The output of this is:
> 
> > Both said something ((knuth1someother)).
> 
> How can I get the separator to work? My expectation would be:
> 
> > Both said something ((knuth1sfdsomeother)).
> 
> or
> 
> > Both said something ((knuth1sfd someother)).

I got some understanding of the underlying code now.
This setup solves the above issue:

```
\startsetups btx:aps:cite:special
% just a dummy
\fastsetup{btx:cite:concat}
\btxcitereference
\currentbtxtag
\stopsetups
```

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Transparency in external PDFs does not work

2024-06-21 Thread Gerion Entrup
Am Mittwoch, 19. Juni 2024, 09:50:33 MESZ schrieb Hans Hagen:
> On 6/18/2024 9:54 AM, Gerion Entrup wrote:
> > Am Montag, 17. Juni 2024, 23:50:16 MESZ schrieb Hans Hagen:
> >> On 6/17/2024 5:07 PM, Gerion Entrup wrote:
> >>> Hi,
> >>>
> >>> I'm using LaTeX-Beamer and TikZ for figure typesetting.
> If you use that kind of simple graphics, you can avoid this transparency 
> hacking by using metafun:
> 
> \setupbodyfont[dejavu]
> 
> \starttext
> 
> \startuseMPgraphic{test}
>  pickup pencircle scaled 2mm ;
>  draw fullcircle scaled 3cm withcolor darkred  withstacking 1 ;
>  draw fullcircle scaled 2cm withcolor darkblue withstacking 2 ;
>  draw textext("one")   withcolor darkgreen withstacking 11 ;
>  draw textext("two")   withcolor darkgreen withstacking 12 ;
>  draw textext("three") withcolor darkgreen withstacking 13 ;
> \stopuseMPgraphic
> 
> \startTEXpage[offset=.25ts]
>  \useMPgraphic{test}{stacking={1,11}}
> \stopTEXpage
> 
> \startTEXpage[offset=.25ts]
>  \useMPgraphic{test}{stacking={2,12}}
> \stopTEXpage
> 
> \startTEXpage[offset=.25ts]
>  \useMPgraphic{test}{stacking={1,2,13}}
> \stopTEXpage
> 
> \stoptext
> 
> It's an already old feature but probably not that well known. If needed 
> I can make something similar at the tex end.
> 
> Hans

Thank you for the example, but learning metafun is another chapter and the
graphics are much more complicated than the minimal example given.

I saw that you pushed an updated version that fixes the bug [1]. Thank you!

Gerion

[1] 
https://github.com/contextgarden/context/commit/0bcdd3ce47a406ed7852724504e3efe28bc2d9e1#diff-603950e83d66ef32e79066259f4f456250f9f3ae795ade93db2df48d0da1034d


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-18 Thread Gerion Entrup
Am Montag, 17. Juni 2024, 21:20:19 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 17.06.2024 um 13:04:
> > Am Donnerstag, 6. Juni 2024, 16:34:03 MESZ schrieb Wolfgang Schuster:
> >> [...]
> >>
> >> Wolfgang
> >>
> > 
> > I tried to combine this with the code of the mail thread: "setuphead in 
> > connection with the command argument" but had not luck.
> > ConTeXt always stops with:
> > ```
> > close source> level 1, order 2, name './mwe.tex'
> > tex error   > runaway error: end of file encountered
> > mtx-context | fatal error: return code: 1
> > ```
> > 
> > Here is the MWE:
> > ```
> > [...]
> > 
> > \startsetups[my_chapter]
> > \startlocalheadsetup
> > \startframed[chapter_frame]
> > \blank[2cm]
> > \startfont[Serif sa 8]
> > \color[darkgray]{\headnumbercontent}
> > \stopfont
> > \blank[5mm]
> > \startfont[SerifBold sa 2]
> > \color[m-indigo-800]{\headtextcontent}
> > \stopfont
> > \blank[1cm]
> > \startfont[SerifBold sa 1.5]
> > 
> > \color[m-indigo-800]{\structureuservariable{subtitle}}
> > \stopfont
> > \blank[3cm]
> > 
> > \startextract[author={\structureuservariable{quoteauthor}}]
> > \structureuservariable{quote}
> > \stopextract
> > \stopframed
> > \stoplocalheadsetup
> > \stopsetups
> 
> The userdata environment uses the buffer mechanism of Context which has 
> a few limitations where you can use it, e.g. putting the environment in 
> the arguments of other commands (like the setup-environment above) 
> fails. One way to avoid this is to replace the \startextract ... 
> \stopextract in this case with the code for the quoted text, another way 
> is to put all content in a buffer and just load the buffer in the 
> setups-environment.
> 
> \startbuffer[my_chapter]
>   \startlocalheadsetup
>   \startframed[chapter_frame]
>   ...
>   \stopframed
>   \stoplocalheadsetup
> \stopbuffer
> 
> \startsetups[my_chapter]
>\getbuffer[my_chapter]
> \stopsetups
> 
> Wolfgang
> 

Thanks, I solved it by embedding the extract code directly (more less).

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Transparency in external PDFs does not work

2024-06-18 Thread Gerion Entrup
Am Montag, 17. Juni 2024, 23:50:16 MESZ schrieb Hans Hagen:
> On 6/17/2024 5:07 PM, Gerion Entrup wrote:
> > Hi,
> > 
> > I'm using LaTeX-Beamer and TikZ for figure typesetting.
> > With this combination, it is easy to combine Beamer's animation system with 
> > TikZ transparency feature.
> > This way, the resulting PDFs contain the full graphic on every page, but 
> > parts of it are invisible for a specific page.
> > One of these files is attached as an example.
> > 
> > The problem is to embed these PDFs into a ConTeXt document.
> > For example, this MWE seems to not respect transparency (see mwe.pdf):
> > ```
> > \starttext
> > \externalfigure[fig.pdf][page=1]
> > \stoptext
> > ```
> > 
> > I use Okular/Poppler as PDF viewer.
> > Can I fix this somehow or is it a bug somewhere deeper?
> next time check the file that you include ... it has no transparency (it 
> has zero values)

I don't really have a clue about the PDF standard. It is made with the TikZ 
opacity flag therefore I thought it controls the transparency.
See the attached tex file to reproduce fig.pdf (compilation with `latexmk 
-pdflua fig.tex`).

I also found a workaround. It is possible to import fig.pdf with Inkscape and 
export just the correct page as PDF again and embed that in ConTeXt:
```
inkscape --export-page=1 fig.pdf --export-type=pdf --export-filename=1.pdf
```

Gerion



\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{fit}

\usepackage[active, tightpage]{preview}
\PreviewEnvironment{tikzpicture}

% taken from https://github.com/luhsra/texmf/blob/main/tex/latex/beamertools/beamertools.sty
\tikzset{
	onslide/.code args={<#1>#2}{%
		\only<#1>{\pgfkeysalso{#2}}
	},
	alt/.code args={<#1>#2#3}{%
		\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
	},
	global opacity/.style={
		opacity=#1,
		text opacity=#1,
		every shadow/.append style={opacity=#1},
		every on layer/.append style={opacity=#1},
		every node/.append style={opacity=#1},
		prefix after command={\pgfextra{\tikzset{every pin/.style={opacity=#1},
		every pin edge/.style={opacity=#1},
		every label/.style={opacity=#1,
	},
	invisible/.style={global opacity=0},
	visible/.style={global opacity=1},
	visible on/.style={alt=#1{}{invisible}},
	invisible on/.style={alt=#1{invisible}{}},
}

\begin{document}
	\begin{frame}
		\begin{tikzpicture}
			\node[draw, visible on=<1>] (fp) {First Page};
			\node[draw, visible on=<2>] (sp) {Second Page};
			\node[draw, fit=(fp)(sp)] {};
		\end{tikzpicture}
	\end{frame}

\end{document}


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Transparency in external PDFs does not work

2024-06-17 Thread Gerion Entrup
Hi,

I'm using LaTeX-Beamer and TikZ for figure typesetting.
With this combination, it is easy to combine Beamer's animation system with 
TikZ transparency feature.
This way, the resulting PDFs contain the full graphic on every page, but parts 
of it are invisible for a specific page.
One of these files is attached as an example.

The problem is to embed these PDFs into a ConTeXt document.
For example, this MWE seems to not respect transparency (see mwe.pdf):
```
\starttext
\externalfigure[fig.pdf][page=1]
\stoptext
```

I use Okular/Poppler as PDF viewer.
Can I fix this somehow or is it a bug somewhere deeper?

Best
Gerion


fig.pdf
Description: Adobe PDF document


mwe.pdf
Description: Adobe PDF document


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-17 Thread Gerion Entrup
Am Donnerstag, 6. Juni 2024, 16:34:03 MESZ schrieb Wolfgang Schuster:
> \startsetups [userdata:extract]
>  \startnarrower
>  \setupindenting[next]
>  \getuserdata
>  \hairline
>  \dontleavehmode\wordright{\itx\userdataparameter{author}}
>  \stopnarrower
> \stopsetups
> 
> \defineuserdataalternative
>[extract]
>[renderingsetup=userdata:extract]
> 
> \defineuserdata
>[extract]
>[style=italic,
> alternative=extract]
> 
> \starttext
> 
> \startextract[author=René Descartes]
>  Cogito ergo sum.
> \stopextract
> 
> \stoptext
> 
> Wolfgang
> 

I tried to combine this with the code of the mail thread: "setuphead in 
connection with the command argument" but had not luck.
ConTeXt always stops with:
```
close source> level 1, order 2, name './mwe.tex'
tex error   > runaway error: end of file encountered
mtx-context | fatal error: return code: 1
```

Here is the MWE:
```
\startsetups [userdata:extract]
\getuserdata
\hairline
\itx\userdataparameter{author}
\stopsetups

% original definition (also does not work)
% \startsetups [userdata:extract]
%  \startnarrower
%  \setupindenting[next]
%  \getuserdata
%  \hairline
%  \dontleavehmode\wordright{\itx\userdataparameter{author}}
%  \stopnarrower
% \stopsetups

\defineuserdataalternative
   [extract]
   [renderingsetup=userdata:extract]

\defineuserdata
   [extract]
   [style=italic,
alternative=extract]

\defineframed[chapter_frame][
width=\textwidth,
align=flushright,
offset=0pt,
rulethickness=0pt
]

\startsetups[my_chapter]
\startlocalheadsetup
\startframed[chapter_frame]
\blank[2cm]
\startfont[Serif sa 8]
\color[darkgray]{\headnumbercontent}
\stopfont
\blank[5mm]
\startfont[SerifBold sa 2]
\color[m-indigo-800]{\headtextcontent}
\stopfont
\blank[1cm]
\startfont[SerifBold sa 1.5]

\color[m-indigo-800]{\structureuservariable{subtitle}}
\stopfont
\blank[3cm]

\startextract[author={\structureuservariable{quoteauthor}}]
\structureuservariable{quote}
\stopextract
\stopframed
\stoplocalheadsetup
\stopsetups

\defineheadalternative[chap][renderingsetup=my_chapter]

\setuphead[title, chapter][
alternative=chap,
after={\page[yes]},
sectionsegments=2:2,
header=high,
footer=high,
style=
]

\starttext

% embedded startextract into startchapter does not work
\startchapter[title=Foo][subtitle=bla, quoteauthor={René Descartes}, quote={%
Cogito ergo sum.
}]
\stopchapter

\startextract[author=René Descartes]
Cogito ergo sum.
\stopextract

\stoptext
```



I also tried to combine it less interleaved, but it fails with the same error:
```
\startsetups [userdata:extract]
\getuserdata
\hairline
\itx\userdataparameter{author}
\stopsetups

% original definition (also does not work)
% \startsetups [userdata:extract]
%  \startnarrower
%  \setupindenting[next]
%  \getuserdata
%  \hairline
%  \dontleavehmode\wordright{\itx\userdataparameter{author}}
%  \stopnarrower
% \stopsetups

\defineuserdataalternative
   [extract]
   [renderingsetup=userdata:extract]

\defineuserdata
   [extract]
   [style=italic,
alternative=extract]

\defineframed[chapter_frame][
width=\textwidth,
align=flushright,
offset=0pt,
rulethickness=0pt
]
\defineframed[chapter_quote][
width=\textwidth,
align=flushright,
offset=0pt,
rulethickness=0pt
]

\startsetups[my_chapter]
\startlocalheadsetup
\startframed[chapter_frame]
\blank[2cm]
\startfont[Serif sa 8]
\color[darkgray]{\headnumbercontent}
\stopfont
\blank[5mm]
\startfont[SerifBold sa 2]
\color[m-indigo-800]{\headtextcontent}
\stopfont
\blank[1cm]
\startfont[SerifBold sa 1.5]

\color[m-indigo-800]{\structureuservariable{subtitle}}
\stopfont
\blank[3cm]
\startframed[chapter_quote]
\structureuservariable{quote}
\stopframed
\stopframed
\stoplocalheadsetup
\stopsetups

\defineheadalternative[chap][renderi

[NTG-context] Re: Math manual

2024-06-17 Thread Gerion Entrup
Am Sonntag, 16. Juni 2024, 18:59:52 MESZ schrieb skyhorse--- via ntg-context:
> 
> Mikael Sundqvist  wrote:
> >
> > ./tex/texmf-context/doc/context/documents/general/manuals/mathincontext-screen.pdf
> > ./tex/texmf-context/doc/context/documents/general/manuals/mathincontext-paper.pdf
> >
> 
> 
> Sorry about my locational ignorance, but where can I view this document?
> 
> I only have  - math-mkiv.pdf
>- math-tweaks.pdf
> in my dir:
> /opt/context-lmtx/tex/texmf-context/doc/context/documents/general/manuals
> 
> 
> Can you please provide me with the URL to the directory?
> 
> Thank you

Additionally to the other answers here, you can also find them on Github:
https://github.com/contextgarden/context/blob/main/doc/context/documents/general/manuals/mathincontext-paper.pdf

Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: x mark symbol and general symbol guide

2024-06-15 Thread Gerion Entrup
Am Samstag, 15. Juni 2024, 12:19:37 MESZ schrieb Hans Hagen:
> On 6/15/2024 11:02 AM, Gerion Entrup wrote:
> > Am Freitag, 13. Oktober 2023, 14:33:24 MESZ schrieb Gerion Entrup:
> >> Hi,
> >>
> >> I recently tried to typeset a table with checkmarks and x marks.
> >> \checkmark exists but is there a predefined x mark symbol (\xmark does
> >> not work)?
> >>
> >> In general: For LaTeX there exists the very helpful comprehensive LaTeX 
> >> symbol list [1].
> >> Is there a similar documentation for ConTeXt somewhere?
> >>
> >> Best,
> >> Gerion
> >>
> >> [1] https://www.ctan.org/pkg/comprehensive
> >>
> > 
> > Just as an info. I'm using Noto symbols now:
> > ```
> > \definefont[symbolFont][name:notosanssymbols2regular*default at 11pt]
> > \define{\yes}{{\symbolFont\utfchar{0x1f5f8}}}
> > \define{\no}{{\symbolFont\utfchar{0x1f5f4}}}
> > 
> > \starttext
> > \yes and \no.
> > \stoptext
> fwiw: 1F5F8 looks pretty bad (in otf) (i checked as i though it was a 
> bug in lmtx)

Hmm, you are right, like a little frayed. 02713 and 02714 are similar.
I guess, this should look like they were drawn with a brush.

Gerion



signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: x mark symbol and general symbol guide

2024-06-15 Thread Gerion Entrup
Am Freitag, 13. Oktober 2023, 14:33:24 MESZ schrieb Gerion Entrup:
> Hi,
> 
> I recently tried to typeset a table with checkmarks and x marks.
> \checkmark exists but is there a predefined x mark symbol (\xmark does
> not work)?
> 
> In general: For LaTeX there exists the very helpful comprehensive LaTeX 
> symbol list [1].
> Is there a similar documentation for ConTeXt somewhere?
> 
> Best,
> Gerion
> 
> [1] https://www.ctan.org/pkg/comprehensive
> 

Just as an info. I'm using Noto symbols now:
```
\definefont[symbolFont][name:notosanssymbols2regular*default at 11pt]
\define{\yes}{{\symbolFont\utfchar{0x1f5f8}}}
\define{\no}{{\symbolFont\utfchar{0x1f5f4}}}

\starttext
\yes and \no.
\stoptext
```


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Prefix the text in an enumeration.

2024-06-14 Thread Gerion Entrup
Am Freitag, 14. Juni 2024, 11:51:28 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 14.06.2024 um 11:01:
> > Am Donnerstag, 13. Juni 2024, 16:31:58 MESZ schrieb Wolfgang Schuster:
> >> \startsetups[question:intro]
> >> \setupparagraphintro[first][\bold{Answer:} ]
> >> \blank
> >> \stopsetups
> >>
> >> \defineenumeration[question][
> >>  alternative=top,
> >>  text=Question,
> >>  title=yes,
> >>  titleleft=,
> >>  titleright=,
> >>  right={:},
> >>  headstyle=bold,
> >> inbetween=\setup{question:intro},
> >> ]
> >>
> >> \starttext
> >>
> >> Some text:
> >>
> >> \startquestion[title={How long does a loop last?}]
> >> For a while.
> >> \stopquestion
> >>
> >> \stoptext
> > 
> > Thank you. That works well for this case.
> > 
> > I have a follow up question. I tried to additionally set a titledistance 
> > and reproduce that for the "Answer:"-part.
> > ConTeXt then introduces a mysterious newline.
> > 
> > See this example:
> > 
> > \definehspace[dist][1em]
> > \startsetups[question:intro]
> > \setupparagraphintro[first][\bold{Answer:}\hspace[1em]]
> > \blank
> > \stopsetups
> 
> You need 2 changes for \setupparagraphintro:
> 
> 1. Change the argument of \hspace to "dist" because the commands accepts 
> only keywords and everything else (even a valid length) is ignored and 
> results in a horizontal skip of 0pt.

Hrmm, this was a typo.

> 
> 2. You have to add curly braces around the content when the content 
> includes square brackets because nesting of optional arguments isn't 
> supported yet.

Thanks for the help, that was the missing part.

> 
> The correct version of the one above is:
> 
> \startsetups[question:intro]
> \setupparagraphintro[first][{\bold{Answer:}\hspace[dist]}]
> \blank
> \stopsetups
> 
> Wolfgang
> 

Gerion



signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Prefix the text in an enumeration.

2024-06-14 Thread Gerion Entrup
Am Donnerstag, 13. Juni 2024, 16:31:58 MESZ schrieb Wolfgang Schuster:
> \startsetups[question:intro]
>\setupparagraphintro[first][\bold{Answer:} ]
>\blank
> \stopsetups
> 
> \defineenumeration[question][
> alternative=top,
> text=Question,
> title=yes,
> titleleft=,
> titleright=,
> right={:},
> headstyle=bold,
>inbetween=\setup{question:intro},
> ]
> 
> \starttext
> 
> Some text:
> 
> \startquestion[title={How long does a loop last?}]
> For a while.
> \stopquestion
> 
> \stoptext

Thank you. That works well for this case.

I have a follow up question. I tried to additionally set a titledistance and 
reproduce that for the "Answer:"-part.
ConTeXt then introduces a mysterious newline.

See this example:
```
\definehspace[dist][1em]
\startsetups[question:intro]
   \setupparagraphintro[first][\bold{Answer:}\hspace[1em]]
   \blank
\stopsetups

\defineenumeration[question][
alternative=top,
text=Question,
title=yes,
titleleft=,
titledistance=1em,
titleright=,
right={:},
headstyle=bold,
   inbetween=\setup{question:intro},
]

\starttext

Some text:

\startquestion[title={How long does a loop last?}]
For a while.
\stopquestion

\stoptext
```

Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Prefix the text in an enumeration.

2024-06-13 Thread Gerion Entrup
Hi,

is there a way to automatically prefix the text body in an enumeration?

Consider this example:
```
\defineenumeration[question][
alternative=top,
text=Question,
title=yes,
titleleft=,
titleright=,
right={:},
headstyle=bold,
]

\starttext

Some text:

\startquestion[title={How long does a loop last?}]
\bold{Answer:} For a while.
\stopquestion

\stoptext
```

I'd like to have the `\bold{Answer:}` automatically. So for example something 
like this:
```
\defineenumeration[question][
alternative=top,
text=Question,
title=yes,
titleleft=,
titleright=,
right={:},
headstyle=bold,
prefix={\bold{Answer:}},
]

\starttext

Some text:

\startquestion[title={How long does a loop last?}]
For a while.
\stopquestion

\stoptext
```

I tried to misuse `inbetween` for that but `alternative=top` seems to make a 
(not modifiable space) between the heading and the text body.

Best
Gerion 

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Scale content to height of the font, measure font height

2024-06-11 Thread Gerion Entrup
Am Montag, 10. Juni 2024, 15:53:19 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 10.06.2024 um 13:16:
> > Hi,
> > 
> > I'd like to scale something (actually a symbol drawn in TikZ) to the exact
> > high of the char 'M'. I found the scale environment for it but struggle to
> > measure the correct font height. I found the 
> > "definemeasure/measure/measured"
> > commands but they define a dimension and are not for doing measurements on
> > rendered text. Is there a simple way to get the height a char as a 
> > dimension?
> > 
> > MWE:
> > ```
> > \starttext
> > % Is it possible to replace 1cm with a common expression?
> > This is the letter M. \scale[height=1cm]{a} should have the exact same size 
> > as
> > M.
> > 
> > This should also be true {\tfc with a bigger M. \scale[height=1cm]{a}}.
> > \stoptext
> > ```
> 
> \starttext
> M\scale[height=\heightofstring{M}]{a}M
> \stoptext
> 
> Wolfgang
> 

Thank you all! Added to the wiki: https://wiki.contextgarden.net/Dimensions

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Scale content to height of the font, measure font height

2024-06-10 Thread Gerion Entrup
Hi,

I'd like to scale something (actually a symbol drawn in TikZ) to the exact 
high of the char 'M'. I found the scale environment for it but struggle to 
measure the correct font height. I found the "definemeasure/measure/measured" 
commands but they define a dimension and are not for doing measurements on 
rendered text. Is there a simple way to get the height a char as a dimension?

MWE:
```
\starttext
% Is it possible to replace 1cm with a common expression?
This is the letter M. \scale[height=1cm]{a} should have the exact same size as 
M.

This should also be true {\tfc with a bigger M. \scale[height=1cm]{a}}.
\stoptext
```

Best
Gerion



signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-06 Thread Gerion Entrup
Am Donnerstag, 6. Juni 2024, 13:51:53 MESZ schrieb Hans Hagen via ntg-context:
> On 6/6/2024 12:30 PM, Gerion Entrup wrote:
> > Hi,
> > 
> > I like to achieve something that looks like this:
> > ```
> > \definedelimitedtext[extract][blockquote]
> > \setupdelimitedtext
> >[extract]
> >[leftmargin=1.5pc,
> > style={\italic},
> > before={\setupindenting[next]},
> > after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
> > \tfx\italic{René Descartes} \stopalignment}]
> > 
> > \starttext
> > \startextract
> >  Cogito ergo sum.
> > \stopextract
> > \stoptext
> > ```
> > 
> > So it should setup a quotation and mentions the author.
> > However, here the author is hardcoded within the blockquote. I would like 
> > it to use like this:
> > ```
> > \definedelimitedtext[extract][blockquote]
> > \setupdelimitedtext
> >[extract]
> >[leftmargin=1.5pc,
> > style={\italic},
> > before={\setupindenting[next]},
> > after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
> > \tfx\italic{\getcustomvariable{author}} \stopalignment}]
> > 
> > \starttext
> > \startextract[author=René Descartes]
> >  Cogito ergo sum.
> > \stopextract
> > \stoptext
> > ```
> > 
> > Is there an easy way to achieve that?
> > I tried with \structureuservariable (like possible in \startchapter) but it 
> > does not work.
> 
> not all constructs hav ethese user variables (yet)
> 
> i'll add an option for arguments tostart/stop so that you can do
> 
> \starttext
> 
> \definedelimitedtext
>[dextract]
>[blockquote]
>[leftmargin=1.5pc,
> style=italic,
> before=\setupindenting[next],
> after=\setups{extract:whatever}]
> 
> \definestartstop
>[extract]
>[arguments=yes,
> before=\setups{extract:start},
> after=\setups{extract:stop}]
> 
> \startsetups extract:start
>  \startdextract
> \stopsetups
> 
> \startsetups extract:stop
>  \startstopparameter{author}
>  \stopdextract
>  \blank[1ex,samepage]
>  \hrule
>  \blank[1ex,samepage]
>  \dontleavehmode
>  \wordright{\itx\startstopparameter{author}}
> \stopsetups
> 
> \starttext
> 
> \startextract[author=René Descartes]
>  Cogito ergo sum.
> \stopextract
> 
> \stoptext
> 
> but first i want Wolfgang to check the patch,

For me, Wolfgang's answer fulfills all my needs.
So, from my point of view, this is not needed anymore.
Thank you for your effort anyway!

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-06 Thread Gerion Entrup
Am Donnerstag, 6. Juni 2024, 16:34:03 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 06.06.2024 um 12:30:
> > Hi,
> > 
> > I like to achieve something that looks like this:
> > ```
> > \definedelimitedtext[extract][blockquote]
> > \setupdelimitedtext
> >[extract]
> >[leftmargin=1.5pc,
> > style={\italic},
> > before={\setupindenting[next]},
> > after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
> > \tfx\italic{René Descartes} \stopalignment}]
> > 
> > \starttext
> > \startextract
> >  Cogito ergo sum.
> > \stopextract
> > \stoptext
> > ```
> > 
> > So it should setup a quotation and mentions the author.
> > However, here the author is hardcoded within the blockquote. I would like 
> > it to use like this:
> > ```
> > \definedelimitedtext[extract][blockquote]
> > \setupdelimitedtext
> >[extract]
> >[leftmargin=1.5pc,
> > style={\italic},
> > before={\setupindenting[next]},
> > after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
> > \tfx\italic{\getcustomvariable{author}} \stopalignment}]
> > 
> > \starttext
> > \startextract[author=René Descartes]
> >  Cogito ergo sum.
> > \stopextract
> > \stoptext
> > ```
> > 
> > Is there an easy way to achieve that?
> > I tried with \structureuservariable (like possible in \startchapter) but it 
> > does not work.
> 
> \startsetups [userdata:extract]
>  \startnarrower
>  \setupindenting[next]
>  \getuserdata
>  \hairline
>  \dontleavehmode\wordright{\itx\userdataparameter{author}}
>  \stopnarrower
> \stopsetups
> 
> \defineuserdataalternative
>[extract]
>[renderingsetup=userdata:extract]
> 
> \defineuserdata
>[extract]
>[style=italic,
> alternative=extract]
> 
> \starttext
> 
> \startextract[author=René Descartes]
>  Cogito ergo sum.
> \stopextract
> 
> \stoptext

Really cool! Thank you. If I see it right, this is completely generic,
so with this it is possible to define any start stop
with completely variable arguments.

Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Combine \setupdelimitedtext with an author (define custom variable?)

2024-06-06 Thread Gerion Entrup
Hi,

I like to achieve something that looks like this:
```
\definedelimitedtext[extract][blockquote]
\setupdelimitedtext
  [extract]
  [leftmargin=1.5pc,
   style={\italic},
   before={\setupindenting[next]},
   after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
\tfx\italic{René Descartes} \stopalignment}]

\starttext
\startextract
Cogito ergo sum.
\stopextract
\stoptext
```

So it should setup a quotation and mentions the author.
However, here the author is hardcoded within the blockquote. I would like it to 
use like this:
```
\definedelimitedtext[extract][blockquote]
\setupdelimitedtext
  [extract]
  [leftmargin=1.5pc,
   style={\italic},
   before={\setupindenting[next]},
   after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
\tfx\italic{\getcustomvariable{author}} \stopalignment}]

\starttext
\startextract[author=René Descartes]
Cogito ergo sum.
\stopextract
\stoptext
```

Is there an easy way to achieve that?
I tried with \structureuservariable (like possible in \startchapter) but it 
does not work.

Best,
Gerion



signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: setuphead in connection with the command argument

2024-06-06 Thread Gerion Entrup
Am Montag, 3. Juni 2024, 15:13:20 MESZ schrieb Hans Hagen via ntg-context:
> On 6/3/2024 1:36 PM, Gerion Entrup wrote:
> > Thank you. I think that I understand command vs alternative now.
> > With try and error, I experienced, that the font/style of the `style`
> > parameter interleave in a strange way. Therefore I see it as related.
> > What i mean is:
> style: outer level, also sets interline spacing and adapts before after 
> blanks
> 
> numberstyle and textstyle : specific to the element

Thank you! I will try to wrap it up in the Wiki.

Gerion




signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: setuphead in connection with the command argument

2024-06-03 Thread Gerion Entrup
Am Montag, 3. Juni 2024, 00:05:22 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 01.06.2024 um 16:34:
> > Am Samstag, 1. Juni 2024, 09:53:46 MESZ schrieb Wolfgang Schuster:
> >> Gerion Entrup schrieb am 31.05.2024 um 00:37:
> >>> What, if I define multiple of them? Is the system not made for this?
> >>
> >> Multiple of what?
> > 
> > When I define `alternative=` _and_ `command=` in the same `\setuphead`.
> > Or `alternative=` and `style=`, or `alternative=` and `command=`.
> > 
> > I guess style is applied just to the arguments/macros of the command/the 
> > alternative?
> > And combining alternative and command never make sense.
> 
> The following descriptions applies to most setup commands when exclude 
> special cases like \setupbodyfont or \setuplayout.
> 
> 
> When you make multiple changes to the values of a command with
> 
>  \setuphead [section] [style=bold]
> 
> and
> 
> \setuphead [section] [color=blue]
> 
> you achieve the same result as setting both values at the same time like
> 
> \setuphead [section] [style=bold,color=blue]
> 
> 
> What you're doing here is just passing some value to a parameter, 
> nothing else happens at this time. When you process a document Context 
> has already passed the value "normal" to the "alternative" parameter in 
> the \setuphead command. When you now pass a custom macro the "command" 
> parameter in \setuphead all you have done is to set a value, nothing 
> else happened at this point.
> 
> 
> The evaluation of the parameter happens when Context places the content 
> of a heading with \startchapter etc. in your document and only at this 
> point it has to make a decision what should happen when both "command" 
> and "alternative" are set. The order in which the parameters are used is 
> the following: a) check if the "command" parameter has a value and if 
> this is true is it and ignore the "alternative" value b) if no value is 
> present for the "command" parameter use the value of "alternative".
> 
> 
> The value of the "style" parameter is unrelated of the 
> command/alternative values because it isn't needed to choose a layout 
> for the heading, all the parameter does is to change the font/style 
> which is independent of the layout.
> 

Thank you. I think that I understand command vs alternative now.
With try and error, I experienced, that the font/style of the `style`
parameter interleave in a strange way. Therefore I see it as related.
What i mean is:

Example 1
```
\define[2]\MyChapter{%
\bold This is bold #1 #2
}
\setuphead[title, chapter][command=\MyChapter, style=\italic]
\starttext
\startchapter[title=foo]
\stopchapter
\stoptext
```

"This is bold" is bold, but "1" and "foo" are italic.
The font size is normal.
It seems, that "style" is just applied to "#1" and "#2" _before_ evaluating 
MyChapter.

Example 2
```
\define[2]\MyChapter{%
\bold This is bold #1 #2
}

% this should be the "default" style
\setuphead[title, chapter][command=\MyChapter, style=\tfc]
\starttext
\startchapter[title=foo]
\stopchapter
\stoptext
```

"This is bold" is bold, "1" and "2" are normal, but the whole font size is 
bigger.
It seems, that "style" is applied partially to the whole text and somehow 
special to "#1" and "#2" (Why are these arguments not bold?)


As of your explanations, I currently think of the following logic for 
typesetting (in pseudocode):

```
function typeset_chapter(style, numberstyle, textstyle, command, alternative, 
chapter_number, chapter_title) {

local formatted_chapter_number = apply_style(numberstyle, 
apply_style(style, chapter_number))
local formatted_chapter_title = apply_style(textstyle, apply_style(style, 
chapter_title))
if (alternative != "normal")
set_TeX_macro("\headnumbercontent", formatted_chapter_number)
set_TeX_macro("\headtextcontent", formatted_chapter_title)
typeset_as_TeX(get_TeX_code(alternative))
else
evaluate_TeX_function(command, #1=formatted_chapter_number, 
#2=formatted_chapter_title)
endif
}
```
But this does not fit to example 2.

Best
Gerion





signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: setuphead in connection with the command argument

2024-06-01 Thread Gerion Entrup
Am Samstag, 1. Juni 2024, 09:53:46 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 31.05.2024 um 00:37:
> > What, if I define multiple of them? Is the system not made for this?
> 
> Multiple of what?

When I define `alternative=` _and_ `command=` in the same `\setuphead`.
Or `alternative=` and `style=`, or `alternative=` and `command=`.

I guess style is applied just to the arguments/macros of the command/the 
alternative?
And combining alternative and command never make sense.

Thank you very much for your long answer, that was very enlightening!

Best
Gerion





signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Specify separator within setupbtx for custom bibliography rendering

2024-06-01 Thread Gerion Entrup
Hi,

according to the section "Custom citation renderings" in the bibliography 
manual, I have specified an own setup for citation rendering.
However, this seems only to work for single citations (of one source). I want 
to also specify the separator but did not get it to run.

Here is a minimal example:
```
\setupinteraction[state=start]

\startbuffer[testdata]
@Book{knuth1,
author = {Donald E. Knuth},
title = {TEX and METAFONT. New directions in typesetting},
year = {1979},
publisher = {Addison-Wesley},
}
@Article{someother,
author = {Some Person and Some Otherperson},
title = {Another title},
year = {1900},
}
\stopbuffer

% enable tracing
\enabletrackers[publications, publications.crossref, publications.details, 
publications.cite, publications.strings]

\usebtxdataset[main][testdata.buffer]
\usebtxdefinitions[aps]
\setupbtx[dataset=main]
\definebtxrendering[bibrendering][aps][dataset=main, numbering=short]
\setupbtxlist[aps][
  alternative=b,
  distance=.5em,
]

\definebtx[aps:cite:special][aps:cite][
left={((},
right={))},
separator:2={sfd},
separator:3={sfd},
separator:4={sfd},
]

\startsetups btx:aps:cite:special
% just a dummy
\btxcitereference
\currentbtxtag
\stopsetups

\setupbtx[aps:cite][
alternative=special,
]

\starttext

Both said something~\cite[knuth1, someother].

\placelistofpublications[bibrendering]

\stoptext
```

The output of this is:

> Both said something ((knuth1someother)).

How can I get the separator to work? My expectation would be:

> Both said something ((knuth1sfdsomeother)).

or

> Both said something ((knuth1sfd someother)).

Best,
Gerion

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: setuphead in connection with the command argument

2024-05-30 Thread Gerion Entrup
Am Donnerstag, 30. Mai 2024, 22:54:47 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 30.05.2024 um 16:25:
> > The chapter format that I want to achieve in the end is nearly the one in 
> > the attachment (excerpt of Christian Dietrich's PhD thesis).
> 
> When you have a complex layout it is easier to use the 
> \defineheadalternative command to create it.
> 
> To change the font for each element disable the default settings with 
> \setuphead[style=] and use \startfont (or \definedfont) to apply a 
> different style for the number, title etc.
> 
>  begin example
> \defineframed
>[ChapterFrame]
>[width=\textwidth,
> align=flushright,
> offset=0pt,
> rulethickness=0pt]
> 
> \startsetups [christian_dietrich]
>\startlocalheadsetup
>  \startframed[ChapterFrame]
>\blank[2cm]
>\startfont[Serif sa 8]
>  \color[darkgray]{\headnumbercontent}
>\stopfont
>\blank[5mm]
>\startfont[SerifBold sa 2]
>  \color[darkred]{\headtextcontent}
>\stopfont
>\blank[1cm]
>\startfont[SerifBold sa 1.5]
>  \color[darkred]{\structureuservariable{subtitle}}
>\stopfont
>  \stopframed
>\stoplocalheadsetup
> \stopsetups
> 
> \defineheadalternative
>[christian_dietrich]
>[renderingsetup=christian_dietrich]
> 
> \setuphead
>[chapter]
>[alternative=christian_dietrich,
> header=empty,
> style=]
> 
> \starttext
> 
> \startchapter[title=Chapter title][subtitle=Chapter subtitle]
> \samplefile{lorem}
> \stopchapter
> 
> \stoptext
>  end example

Thank you very much! That looks really clean. I will add it to the wiki.

Can you bring some clarification regarding "style=", "command=" and 
"alternative="?
What, if I define multiple of them? Is the system not made for this?

I just tested my initial example regarding font size with `command=\MyChapter, 
style=` and the font size was only affected by the code of \MyChapter.
What is the default style?

Best
Gerion



signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: setuphead in connection with the command argument

2024-05-30 Thread Gerion Entrup
Am Donnerstag, 30. Mai 2024, 18:49:08 MESZ schrieb Bruce Horrocks:
> 
> > On 30 May 2024, at 15:15, Gerion Entrup  wrote:
> > 
> > Let's begin with a minimal example:
> > ```
> > \define[2]\MyChapter{%
> > #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> > }
> 
> Stop there!
> 
> Use \definehead to create your own variation of a heading - much more robust. 
> Something like the following (untested):
> 
>   \startsetups PlaceSubTitleAndIntro
> % Set font and and style etc for the subtitle here
> \structureuservariable(subtitle)
> 
> % Set font and style etc for the intro text here
> \structureuservariable(intro)
>   \stopsetups
> 
>   \definehead [MyChapter] [chapter]
>   \setuphead [MyChapter]
> [ style={...}, % heading style
>   after={\setup{PlaceSubTitleAndIntro}},
> ]
> 
>   \starttext
>   \startMyChapter[title={Foo}]
> [ subtitle={Bar},
>   intro={Some explanation},
> ]
>   The text of the chapter
>   \stopMyChapter
>   \stoptext

Thanks for the input. A comparable example is also listed in the wiki.
I like the approach for placing subtitle and intro alone. However, I also want 
to style chapter number and chapter title separately.
I'm also not sure, if an extra heading (MyChapter) is needed, since all my 
chapters are styled in this way.
Isn't it possible to define "after" of chapter directly?

Best
Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: setuphead in connection with the command argument

2024-05-30 Thread Gerion Entrup
Hi Tomáš,

first, thank you for the answer.

Am Donnerstag, 30. Mai 2024, 16:47:36 MESZ schrieb Tomáš Hála:
> Hi Gebrion,
> 
> > ## Font size + ## Bold text
> 
> for font size etc., you can use 
>   \setuphead [chapter] [style={\setupbodyfont[11pt]}]  or
>   \setuphead [chapter] [style=\tf]
> 
>   \setuphead [chapter] [style=\bf]

So this sentence of the wiki [1] is wrong (documentation of the command 
argument)?:
> Command to use for typesetting the title; overrules all other styling. First 
> argument is the number, second the title text.

If I see it right, `style=` only affects the typesetting of `#1` and `#2`, so I 
need setupbodyfont _and_ switchtobodyfont, didn't I?
Also, when I want #1 and #2 to be in different sizes, I choose the "base" size 
with style=\setupbodyfont and adjust it further with switchtobodyfont just for 
one the the argument?

All in all, the correct documentation would be:
> Command to use for typesetting the title. First argument is the number, 
> second the title text. Styling of these parameters can be achieved only by 
> specifying style=.


> > ## Line breaks + ## Framed
> > How can I achieve line breaks?
> 
> \define[2]\MyChapter{%
>   \framedtext{%
>  #1 #2:\\
>  \structureuservariable{subtitle}\\
>  (\structureuservariable{intro})
>   }
> }

This produces an extra line break between '#2' and ':', I don't get why. 
Otherwise, it looks quite nice.


> > I also want to set everything except of the intro in a flushright 
> > environment but do not know how. I tried:
> 
> As above: 
>   \framedtext[align=flushright]{%

That works, thank you!


Best,
Gerion

> --
> 
> On Thu, May 30, 2024 at 02:15:01PM +, Gerion Entrup wrote:
> > Hi,
> > 
> > I'm trying to adapt the format of chapters in my document and have a few 
> > questions regarding setuphead.
> > My aim is to have the chapter (title) on a separate page with an additional 
> > intro in different text sizes for title, subtitle and the intro.
> > I chose to use the "command=" argument in setuphead for that.
> > However, I'm not quite sure about it's internals.
> > 
> > Let's begin with a minimal example:
> > ```
> > \define[2]\MyChapter{%
> > #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> > }
> > 
> > \setuphead[title, chapter][command=\MyChapter]
> > 
> > \setupbodyfont[11pt]
> > 
> > \starttext
> > \startchapter[title=foo][subtitle=bar, intro={some explanation}]
> > some text
> > \stopchapter
> > \stoptext
> > ```
> > This produces 1.pdf.
> > 
> > 
> > ## Font size
> > 
> > What is the reason that that the font of the chapter is bigger? How can I 
> > reset it to normal size? This does not work at all:
> > ```
> > \define[2]\MyChapter{%
> > \setupbodyfont[11pt] #1 #2: \structureuservariable{subtitle} 
> > (\structureuservariable{intro})
> > }
> > ```
> > However, changing to a bigger font works somehow. Is there a factor applied 
> > to the font size internally? For example:
> > ```
> > \define[2]\MyChapter{%
> > \setupbodyfont[20pt] #1 #2: \structureuservariable{subtitle} 
> > (\structureuservariable{intro})
> > }
> > ```
> > produces 2.pdf (the chapter font is not 20pt).
> > 
> > 
> > ## Line breaks
> > 
> > How can I achieve line breaks?
> > This does not work:
> > ```
> > \define[2]\MyChapter{%
> > #1 #2:\\
> > \structureuservariable{subtitle}\\
> > (\structureuservariable{intro})
> > }
> > ```
> > (see 3.pdf)
> > 
> > I also want to set everything except of the intro in a flushright 
> > environment but do not know how. I tried:
> > ```
> > \define[2]\MyChapter{%
> > \startalignment[flushright]
> > #1 #2:\\
> > \structureuservariable{subtitle}\\
> > \stopalignment
> > \structureuservariable{intro}
> > }
> > ```
> > (see 4.pdf, no change)
> > 
> > 
> > ## Bold text
> > 
> > I tried to get the text bold. However, `#1` and `#2` does not seem to 
> > follow this.
> > ```
> > \define[2]\MyChapter{%
> > \bold #1 #2: \structureuservariable{subtitle} 
> > (\structureuservariable{intro})
> > }
> > ```
> > 
> > ## Makeups
> > 
> > The best solution, I had so far, was to define a makeup, but I don't get it 
> > to work with text with mixed alignment and it does not solve the font size 
> >

[NTG-context] Re: setuphead in connection with the command argument

2024-05-30 Thread Gerion Entrup
The chapter format that I want to achieve in the end is nearly the one in the 
attachment (excerpt of Christian Dietrich's PhD thesis).

Best
Gerion


Am Donnerstag, 30. Mai 2024, 16:15:01 MESZ schrieb Gerion Entrup:
> Hi,
> 
> I'm trying to adapt the format of chapters in my document and have a few 
> questions regarding setuphead.
> My aim is to have the chapter (title) on a separate page with an additional 
> intro in different text sizes for title, subtitle and the intro.
> I chose to use the "command=" argument in setuphead for that.
> However, I'm not quite sure about it's internals.
> 
> Let's begin with a minimal example:
> ```
> \define[2]\MyChapter{%
>   #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> }
> 
> \setuphead[title, chapter][command=\MyChapter]
> 
> \setupbodyfont[11pt]
> 
> \starttext
> \startchapter[title=foo][subtitle=bar, intro={some explanation}]
> some text
> \stopchapter
> \stoptext
> ```
> This produces 1.pdf.
> 
> 
> ## Font size
> 
> What is the reason that that the font of the chapter is bigger? How can I 
> reset it to normal size? This does not work at all:
> ```
> \define[2]\MyChapter{%
>   \setupbodyfont[11pt] #1 #2: \structureuservariable{subtitle} 
> (\structureuservariable{intro})
> }
> ```
> However, changing to a bigger font works somehow. Is there a factor applied 
> to the font size internally? For example:
> ```
> \define[2]\MyChapter{%
>   \setupbodyfont[20pt] #1 #2: \structureuservariable{subtitle} 
> (\structureuservariable{intro})
> }
> ```
> produces 2.pdf (the chapter font is not 20pt).
> 
> 
> ## Line breaks
> 
> How can I achieve line breaks?
> This does not work:
> ```
> \define[2]\MyChapter{%
> #1 #2:\\
> \structureuservariable{subtitle}\\
> (\structureuservariable{intro})
> }
> ```
> (see 3.pdf)
> 
> I also want to set everything except of the intro in a flushright environment 
> but do not know how. I tried:
> ```
> \define[2]\MyChapter{%
> \startalignment[flushright]
> #1 #2:\\
> \structureuservariable{subtitle}\\
> \stopalignment
> \structureuservariable{intro}
> }
> ```
> (see 4.pdf, no change)
> 
> 
> ## Bold text
> 
> I tried to get the text bold. However, `#1` and `#2` does not seem to follow 
> this.
> ```
> \define[2]\MyChapter{%
> \bold #1 #2: \structureuservariable{subtitle} 
> (\structureuservariable{intro})
> }
> ```
> 
> ## Makeups
> 
> The best solution, I had so far, was to define a makeup, but I don't get it 
> to work with text with mixed alignment and it does not solve the font size 
> problem:
> ```
> \definemakeup[chapter][align=left, top=]
> \define[2]\MyChapter{%
> \startmakeup[chapter]
> #1 #2:\\
> \structureuservariable{subtitle}\\
> \stopmakeup
> (\structureuservariable{intro})
> }
> ```
> (see 5.pdf)
> 
> ## Framed
> 
> I also have tried this but it does not bring any linebreaks:
> ```
> \define[2]\MyChapter{%
> \framed[frame=off, offset=0pt]{#1\\#2:\\ 
> \structureuservariable{subtitle}\\ (\structureuservariable{intro})}
> }
> ```
> (see 6.pdf)
> 
> I hope you can shed some light into setuphead with command. I search on the 
> wiki, Stackoverflow and the manuals but didn't really find anything.
> 
> Best,
> Gerion
> 
> 



chapter.pdf
Description: Adobe PDF document


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] setuphead in connection with the command argument

2024-05-30 Thread Gerion Entrup
Hi,

I'm trying to adapt the format of chapters in my document and have a few 
questions regarding setuphead.
My aim is to have the chapter (title) on a separate page with an additional 
intro in different text sizes for title, subtitle and the intro.
I chose to use the "command=" argument in setuphead for that.
However, I'm not quite sure about it's internals.

Let's begin with a minimal example:
```
\define[2]\MyChapter{%
#1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
}

\setuphead[title, chapter][command=\MyChapter]

\setupbodyfont[11pt]

\starttext
\startchapter[title=foo][subtitle=bar, intro={some explanation}]
some text
\stopchapter
\stoptext
```
This produces 1.pdf.


## Font size

What is the reason that that the font of the chapter is bigger? How can I reset 
it to normal size? This does not work at all:
```
\define[2]\MyChapter{%
\setupbodyfont[11pt] #1 #2: \structureuservariable{subtitle} 
(\structureuservariable{intro})
}
```
However, changing to a bigger font works somehow. Is there a factor applied to 
the font size internally? For example:
```
\define[2]\MyChapter{%
\setupbodyfont[20pt] #1 #2: \structureuservariable{subtitle} 
(\structureuservariable{intro})
}
```
produces 2.pdf (the chapter font is not 20pt).


## Line breaks

How can I achieve line breaks?
This does not work:
```
\define[2]\MyChapter{%
#1 #2:\\
\structureuservariable{subtitle}\\
(\structureuservariable{intro})
}
```
(see 3.pdf)

I also want to set everything except of the intro in a flushright environment 
but do not know how. I tried:
```
\define[2]\MyChapter{%
\startalignment[flushright]
#1 #2:\\
\structureuservariable{subtitle}\\
\stopalignment
\structureuservariable{intro}
}
```
(see 4.pdf, no change)


## Bold text

I tried to get the text bold. However, `#1` and `#2` does not seem to follow 
this.
```
\define[2]\MyChapter{%
\bold #1 #2: \structureuservariable{subtitle} 
(\structureuservariable{intro})
}
```

## Makeups

The best solution, I had so far, was to define a makeup, but I don't get it to 
work with text with mixed alignment and it does not solve the font size problem:
```
\definemakeup[chapter][align=left, top=]
\define[2]\MyChapter{%
\startmakeup[chapter]
#1 #2:\\
\structureuservariable{subtitle}\\
\stopmakeup
(\structureuservariable{intro})
}
```
(see 5.pdf)

## Framed

I also have tried this but it does not bring any linebreaks:
```
\define[2]\MyChapter{%
\framed[frame=off, offset=0pt]{#1\\#2:\\ \structureuservariable{subtitle}\\ 
(\structureuservariable{intro})}
}
```
(see 6.pdf)

I hope you can shed some light into setuphead with command. I search on the 
wiki, Stackoverflow and the manuals but didn't really find anything.

Best,
Gerion



1.pdf
Description: Adobe PDF document


2.pdf
Description: Adobe PDF document


3.pdf
Description: Adobe PDF document


4.pdf
Description: Adobe PDF document


5.pdf
Description: Adobe PDF document


6.pdf
Description: Adobe PDF document
% 1.pdf
\define[2]\MyChapter{%
	#1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
}

% % 2.pdf
% \define[2]\MyChapter{%
% 	\setupbodyfont[20pt] #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
% }

% % 3.pdf
% \define[2]\MyChapter{%
% #1 #2:\\
% \structureuservariable{subtitle}\\
% (\structureuservariable{intro})
% }

% % 4.pdf
% \define[2]\MyChapter{%
% \startalignment[flushright]
% #1 #2:\\
% \structureuservariable{subtitle}\\
% \stopalignment
% \structureuservariable{intro}
% }

% % 5.pdf
% \definemakeup[chapter][align=left, top=]
% \define[2]\MyChapter{%
% \startmakeup[chapter]
% #1 #2:\\
% \structureuservariable{subtitle}\\
% \stopmakeup
% (\structureuservariable{intro})
% }


% % 6.pdf
% \define[2]\MyChapter{%
% \framed[frame=off, offset=0pt]{#1\\#2:\\ \structureuservariable{subtitle}\\ (\structureuservariable{intro})}
% }

\setuphead[title, chapter][command=\MyChapter]

\setupbodyfont[11pt]

\starttext
\startchapter[title=foo][subtitle=bar, intro={some explanation}]
some text
\stopchapter
\stoptext


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Combine lua and btx setup, was: Re: Customize citation format of a bibliography (use the short form as reference format)

2024-04-25 Thread Gerion Entrup
I solved it, although it's kinda hacky. I'm pretty sure that
publications.citevariants.short is not meant to be called directly.

Do you know why `context.getdetail(dataset, tag, "author")` does not work in 
render_cite?
It always returns nil.


```
\setupinteraction[state=start]

\startbuffer[testdata]
@Book{knuth1,
author = {Donald E. Knuth},
title = {TEX and METAFONT. New directions in typesetting},
year = {1979},
publisher = {Addison-Wesley},
}
@Article{someother,
author = {Some Person and Some Otherperson},
title = {Another title},
year = {1900},
}
\stopbuffer

% enable tracing
\enabletrackers[publications, publications.crossref, publications.details, 
publications.cite, publications.strings]

\usebtxdataset[main][testdata.buffer]
\usebtxdefinitions[aps]
\setupbtx[dataset=main]
\definebtxrendering[bibrendering][aps][dataset=main, numbering=short]
\setupbtxlist[aps][
  alternative=b,
  distance=.5em,
]

\definebtx[aps:cite:special][aps:cite]
\startluacode
function render_cite(dataset, tag, righttext)
local luadata = publications.datasets[dataset].luadata
local entry = luadata[tag]
local extrasign = ""
if entry.author:lower():find("knuth") then
extrasign = ">"
end
context("[" .. extrasign)
print(righttext)
publications.citevariants.short({dataset = dataset, reference = tag, 
variant = "short", righttext = righttext})
context("]")
end
\stopluacode

\startsetups btx:aps:cite:special
\btxcitereference
\ctxlua{render_cite([==[\currentbtxdataset]==], [==[\currentbtxtag]==], 
[==[\currentbtxrighttext]==])}
\stopsetups
\setupbtx[aps:cite][alternative=special]

\starttext

\def\comma{,}

Knuth developed \TeX~\cite[knuth1]
Several persons said something~\cite[someother].

\placelistofpublications[bibrendering]

\stoptext
```

Gerion

Am Dienstag, 23. April 2024, 16:03:50 MESZ schrieb Gerion Entrup:
> Here is a solution for the first part of my question. This is based on
> https://www.mail-archive.com/ntg-context@ntg.nl/msg101156.html
> and try and error based on publ-imp-aps.mkvi and publ-imp-apa.mkvi:
> 
> It display now the citation _and_ numbering labels in the short form:
> ```
> \setupinteraction[state=start]
> 
> \startbuffer[testdata]
> @Book{knuth1,
>   author = {Donald E. Knuth},
>   title = {TEX and METAFONT. New directions in typesetting},
>   year = {1979},
>   publisher = {Addison-Wesley},
> }
> @Article{someother,
>   author = {Some Person and Some Otherperson},
>   title = {Another title},
>   year = {1900},
> }
> \stopbuffer
> 
> % enable tracing
> \enabletrackers[publications, publications.crossref, publications.details, 
> publications.cite, publications.strings]
> 
> \usebtxdataset[main][testdata.buffer]
> \usebtxdefinitions[aps]
> \setupbtx[dataset=main]
> \definebtxrendering[bibrendering][aps][dataset=main, numbering=short]
> \setupbtxlist[aps][
>   alternative=b,
>   distance=.5em,
> ]
> \setupbtx[aps:cite][alternative=short]
> 
> \starttext
> 
> Knuth developed \TeX \cite[knuth1]
> Several persons said something \cite[someother].
> 
> \placelistofpublications[bibrendering]
> 
> \stoptext
> ```
> 
> The remaining part now is to mark publications of Knuth in a different way.
> I have tried this and failed. Here is my code so far:
> ```
> \startluacode
> function render_cite(short, author)
>   print(author)
>   if author:lower():find("knuth") then
>   context("[>" .. short .. "]")
>   else
>   context("[" .. short .. "]")
>   end
> end
> \stopluacode
> \definebtx[aps:cite:special][aps:cite]
> \startsetups btx:aps:cite:special
>   \btxcitereference
>   \ctxlua{render_cite([==[\btxflush{year}]==], [==[\btxflush{author}]==])}
> \stopsetups
> % use it with \cite[special][knuth1]
> ```
> This has several problems:
> - \btxflush{short} does not work as I expected that. How can I get the short 
> form?
> - \btxflush to pass arguments to lua does not work as intended. On the lua 
> side the
>variable "author" resolves to "\btxflushauthor{author}" and not to "D. E. 
> Knuth".
>How can I pass the data?
> 
> I use Lua only because I find it more convenient as a programming language. 
> If a
> plain tex solution is simpler, I'm happy to use that. 
> 
> 
> Another question that came up while studying the source code:
> What effect have \c!, \s!, and \v!? These commands exist a lot in the above
> cited files.
> 
> Gerion
> 
> 
> Am Mittwo

[NTG-context] Combine lua and btx setup, was: Re: Customize citation format of a bibliography (use the short form as reference format)

2024-04-23 Thread Gerion Entrup
Here is a solution for the first part of my question. This is based on
https://www.mail-archive.com/ntg-context@ntg.nl/msg101156.html
and try and error based on publ-imp-aps.mkvi and publ-imp-apa.mkvi:

It display now the citation _and_ numbering labels in the short form:
```
\setupinteraction[state=start]

\startbuffer[testdata]
@Book{knuth1,
author = {Donald E. Knuth},
title = {TEX and METAFONT. New directions in typesetting},
year = {1979},
publisher = {Addison-Wesley},
}
@Article{someother,
author = {Some Person and Some Otherperson},
title = {Another title},
year = {1900},
}
\stopbuffer

% enable tracing
\enabletrackers[publications, publications.crossref, publications.details, 
publications.cite, publications.strings]

\usebtxdataset[main][testdata.buffer]
\usebtxdefinitions[aps]
\setupbtx[dataset=main]
\definebtxrendering[bibrendering][aps][dataset=main, numbering=short]
\setupbtxlist[aps][
  alternative=b,
  distance=.5em,
]
\setupbtx[aps:cite][alternative=short]

\starttext

Knuth developed \TeX \cite[knuth1]
Several persons said something \cite[someother].

\placelistofpublications[bibrendering]

\stoptext
```

The remaining part now is to mark publications of Knuth in a different way.
I have tried this and failed. Here is my code so far:
```
\startluacode
function render_cite(short, author)
print(author)
if author:lower():find("knuth") then
context("[>" .. short .. "]")
else
context("[" .. short .. "]")
end
end
\stopluacode
\definebtx[aps:cite:special][aps:cite]
\startsetups btx:aps:cite:special
\btxcitereference
\ctxlua{render_cite([==[\btxflush{year}]==], [==[\btxflush{author}]==])}
\stopsetups
% use it with \cite[special][knuth1]
```
This has several problems:
- \btxflush{short} does not work as I expected that. How can I get the short 
form?
- \btxflush to pass arguments to lua does not work as intended. On the lua side 
the
   variable "author" resolves to "\btxflushauthor{author}" and not to "D. E. 
Knuth".
   How can I pass the data?

I use Lua only because I find it more convenient as a programming language. If a
plain tex solution is simpler, I'm happy to use that. 


Another question that came up while studying the source code:
What effect have \c!, \s!, and \v!? These commands exist a lot in the above
cited files.

Gerion


Am Mittwoch, 17. April 2024, 15:44:12 MESZ schrieb Gerion Entrup:
> Hi,
> 
> > The APS style is an example of a number-based citation system. As you
> > are looking for a tag-based citation, it might be better to start with
> > something like the APA style.
> 
> I'm kind of satisfied with the publication-list layout of the APS style so I 
> chose
> this as a base. If it is simpler to start with the APA style, I can do that.
> 
> My hope is that it is possible to just change the "label" that is used for
> referencing and keep everything else as is.
> 
> > Is there some specification for your short tag-based citation style?
> 
> biblatex implements this with the "alphabetic" style. I'm not aware of
> a specification, though. Does the "short" form in ConTeXt exist for a
> specific reason? :)
> 
> Gerion
> 
> > On Tue, 16 Apr 2024 06:04:35 +0200
> > Gerion Entrup  wrote:
> > 
> > > Hi,
> > > 
> > > I'm trying to customize a cite format in a bibliography. Currently,
> > > I'm using the aps style which fits so far, except of the plain number
> > > as reference. In concrete, I want to change the following:
> > > - Use the first letter of the last name and the year as reference
> > > (this should be exactly the short form). It is more less also
> > > described here [1].
> > > - Highlight publications of a certain author with an extra char (e.g.
> > > '>')
> > > 
> > > Here is a minimal example (lets assume, every occurrence of Knuth
> > > should be highlighted): ```
> > > \setupinteraction[state=start]
> > > 
> > > \startbuffer[testdata]
> > > @Book{knuth1,
> > >   author = {Donald E. Knuth},
> > >   title = {TEX and METAFONT. New directions in typesetting},
> > >   year = {1979},
> > >   publisher = {Addison-Wesley},
> > > }
> > > @Article{someother,
> > >   author = {Some Person and Some Otherperson},
> > >   title = {Another title},
> > >   year = {1900},
> > > }
> > > \stopbuffer
> > > 
> > > % enable tracing
> > > \enabletrackers[publications, publications.crossref,
> > > publications.details, publicati

[NTG-context] Re: Customize citation format of a bibliography (use the short form as reference format)

2024-04-17 Thread Gerion Entrup
Hi,

> The APS style is an example of a number-based citation system. As you
> are looking for a tag-based citation, it might be better to start with
> something like the APA style.

I'm kind of satisfied with the publication-list layout of the APS style so I 
chose
this as a base. If it is simpler to start with the APA style, I can do that.

My hope is that it is possible to just change the "label" that is used for
referencing and keep everything else as is.

> Is there some specification for your short tag-based citation style?

biblatex implements this with the "alphabetic" style. I'm not aware of
a specification, though. Does the "short" form in ConTeXt exist for a
specific reason? :)

Gerion

> On Tue, 16 Apr 2024 06:04:35 +0200
> Gerion Entrup  wrote:
> 
> > Hi,
> > 
> > I'm trying to customize a cite format in a bibliography. Currently,
> > I'm using the aps style which fits so far, except of the plain number
> > as reference. In concrete, I want to change the following:
> > - Use the first letter of the last name and the year as reference
> > (this should be exactly the short form). It is more less also
> > described here [1].
> > - Highlight publications of a certain author with an extra char (e.g.
> > '>')
> > 
> > Here is a minimal example (lets assume, every occurrence of Knuth
> > should be highlighted): ```
> > \setupinteraction[state=start]
> > 
> > \startbuffer[testdata]
> > @Book{knuth1,
> > author = {Donald E. Knuth},
> > title = {TEX and METAFONT. New directions in typesetting},
> > year = {1979},
> > publisher = {Addison-Wesley},
> > }
> > @Article{someother,
> > author = {Some Person and Some Otherperson},
> > title = {Another title},
> > year = {1900},
> > }
> > \stopbuffer
> > 
> > % enable tracing
> > \enabletrackers[publications, publications.crossref,
> > publications.details, publications.cite, publications.strings]
> > 
> > \usebtxdataset[main][testdata.buffer]
> > \usebtxdefinitions[aps]
> > \setupbtx[dataset=main]
> > \definebtxrendering[bibrendering][aps][dataset=main]
> > 
> > % this seems to have no effect?
> > \setupbtx[alternative=short]
> > 
> > \starttext
> > 
> > Knuth developed \TeX \cite[knuth1].
> > Several persons said something \cite[someother].
> > 
> > \placelistofpublications[bibrendering]
> > 
> > \stoptext
> > ```
> > 
> > It should be rendered as:
> > ```
> > Knuth developed TeX [>Knu79].
> > Several persons said something [PO00].
> > 
> > [Knu79] D.E. Knuth, TEX and METAFONT. New directions in
> > typesetting (Addi­son-Wesley, 1979). [PO00] S. Person and S.
> > Otherperson, Another title, (1900). ```
> > 
> > How can I achieve that \cite[something] always renders in the short
> > form by default? How can I customize that references to Knuth contain
> > this extra '>'? How can I customize the APS style to also use the
> > short form in the list of publications instead of numbers?
> > 
> > Best
> > Gerion
> > 
> > [1]
> > https://tex.stackexchange.com/questions/295444/citation-style-with-first-letters-of-authors-lastname



signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Customize citation format of a bibliography (use the short form as reference format)

2024-04-15 Thread Gerion Entrup
Hi,

I'm trying to customize a cite format in a bibliography. Currently, I'm using 
the aps style which fits so far, except of the plain number as reference.
In concrete, I want to change the following:
- Use the first letter of the last name and the year as reference (this should 
be exactly the short form). It is more less also described here [1].
- Highlight publications of a certain author with an extra char (e.g. '>')

Here is a minimal example (lets assume, every occurrence of Knuth should be 
highlighted):
```
\setupinteraction[state=start]

\startbuffer[testdata]
@Book{knuth1,
author = {Donald E. Knuth},
title = {TEX and METAFONT. New directions in typesetting},
year = {1979},
publisher = {Addison-Wesley},
}
@Article{someother,
author = {Some Person and Some Otherperson},
title = {Another title},
year = {1900},
}
\stopbuffer

% enable tracing
\enabletrackers[publications, publications.crossref, publications.details, 
publications.cite, publications.strings]

\usebtxdataset[main][testdata.buffer]
\usebtxdefinitions[aps]
\setupbtx[dataset=main]
\definebtxrendering[bibrendering][aps][dataset=main]

% this seems to have no effect?
\setupbtx[alternative=short]

\starttext

Knuth developed \TeX \cite[knuth1].
Several persons said something \cite[someother].

\placelistofpublications[bibrendering]

\stoptext
```

It should be rendered as:
```
Knuth developed TeX [>Knu79].
Several persons said something [PO00].

[Knu79] D.E. Knuth, TEX and METAFONT. New directions in typesetting 
(Addi­son-Wesley, 1979).
[PO00]  S. Person and S. Otherperson, Another title, (1900).
```

How can I achieve that \cite[something] always renders in the short form by 
default?
How can I customize that references to Knuth contain this extra '>'?
How can I customize the APS style to also use the short form in the list of 
publications instead of numbers?

Best
Gerion

[1] 
https://tex.stackexchange.com/questions/295444/citation-style-with-first-letters-of-authors-lastname

signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Suggestions and problems of the manuals

2024-01-25 Thread Gerion Entrup
Am Mittwoch, 17. Januar 2024, 13:44:51 CET schrieb Gerion Entrup:
> Hi,
> 
> I discovered the manuals in the context distribution. My general way to
> built the manuals were these steps:
> ```
> # execute one time
> git clone https://github.com/contextgarden/context.git
> cd context/doc/context/sources/general/manuals/
> 
> # for every manual
> cd $MANUALFOLDER
> context $MAIN_MANUAL_FILE.tex
> ```
> Is there a way to speed this up, so to build all manuals with one
> command (some make file or shell script for example)?
> 
> I saw some problems within the manuals:
> - In units/units-mkiv.tex the spacing seems not to work with current
>   LMTX. See the attached screenshot (units-mkiv.png) for my rendering.
>   In my understanding the spaces should differ.
> - I changed some typos(?) and other stuff in that file. The patch is
>   attached (0001-units-mkiv-improve.patch).
> - math/math-mkiv.tex seems not to compile. The last lines of the log:
>   system  >
>   system  > ConTeXt  ver: 2024.01.08 11:23 LMTX  fmt: 2024.1.16  
> int: english/english
>   Sorry, but I can't typeset math unless various parameters have been 
> set. This is
>   normally done by loading special math fonts into the math family slots. 
> Your font
>   set is lacking at least the parameter mentioned earlier.
>   mtx-context | fatal error: return code: 1

> - I tried to find a prebuild version and found 
> https://mirror.contextgarden.net/general/manuals/math-mkiv.pdf.
>   However, this document seems to be from 2021 and has a kind of wobbly
>   rendering in Okular/Poppler (I remember the same phenomena with early
>   LMTX). See the screenshot attached (math-mkiv-online.png). Is there a
>   newer version somewhere? Maybe it is meaningful to delete the old
>   version.

It also does not compile with the newest upload:
ConTeXt  ver: 2024.01.24 22:39 LMTX  fmt: 2024.1.25


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Own command definition breaks with interaction: Use of \do_my_command doesn't match its definition

2024-01-25 Thread Gerion Entrup
Hi,

I want to make a proper definition of a new command to be able to
process it in Lua. I found something on StackOverflow [1] but that
breaks in enumeration _and_ when interaction is enabled and I do not
understand why? Can you give me some help here?

I want to make commands like \foo{bla} and \foo[b]{bla} possible at the
same time. Here is a minimal example (also attached):

```
\startluacode
function userdata.my_command(keywords, text)
commands.writestatus("test", string.format("text: %s, config: %s", 
text, keywords))
local cfg = utilities.parsers.settings_to_hash(keywords)

if cfg['emph'] ~= nil then
context("\\emph{" .. text .. "}")
elseif cfg['bold'] ~= nil then
context("\\bold{" .. text .. "}")
else
context(text)
end
end
\stopluacode

% without that line there is no problem
\setupinteraction[state=start]

\defineenumeration[enu][text=Enu]

\unprotect
\def\mc{\dosingleempty\do_my_command}
\def\do_my_command[#1]#2{%
\iffirstargument{%
\ctxlua{userdata.my_command('#1', [==[#2]==])}%
}\else {%
\ctxlua{userdata.my_command('', [==[#2]==])}%
}\fi
}
\protect

\starttext

% all the following works
\mc{foo} \mc[bold]{foo} \mc[emph]{foo}

\startenu[title=Some]
\stopenu

% this breaks
\startenu[title=Some \mc{foo}]
\stopenu

\stoptext
```

The compilation fails with:
```
tex error   > tex error on line 41 in file ./test.tex: Use of 
\do_my_command doesn't match its definition
```

Best,
Gerion

[1] https://tex.stackexchange.com/a/55778
\startluacode
function userdata.my_command(keywords, text)
	commands.writestatus("test", string.format("text: %s, config: %s", text, keywords))
local cfg = utilities.parsers.settings_to_hash(keywords)

	if cfg['emph'] ~= nil then
		context("\\emph{" .. text .. "}")
	elseif cfg['bold'] ~= nil then
		context("\\bold{" .. text .. "}")
	else
		context(text)
	end
end
\stopluacode

% without that line there is no problem
\setupinteraction[state=start]

\defineenumeration[enu][text=Enu]

\unprotect
\def\mc{\dosingleempty\do_my_command}
\def\do_my_command[#1]#2{%
 	\iffirstargument{%
		\ctxlua{userdata.my_command('#1', [==[#2]==])}%
	}\else {%
		\ctxlua{userdata.my_command('', [==[#2]==])}%
	}\fi
}
\protect

\starttext

% all the following works
\mc{foo} \mc[bold]{foo} \mc[emph]{foo}

\startenu[title=Some]
\stopenu

% this breaks
\startenu[title=Some \mc{foo}]
\stopenu

\stoptext


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Fwd: Re: x mark symbol and general symbol guide

2024-01-18 Thread Gerion Entrup
Am Donnerstag, 11. Januar 2024, 15:56:32 CET schrieb Gerion Entrup:
> Am Dienstag, 9. Januar 2024, 21:17:57 CET schrieb Hans Hagen:
> > On 1/9/2024 8:31 PM, Gerion Entrup wrote:
> > 
> > > My system awesome font is version 6 but isn't the one bundled with
> > > ConTeXt version 5 (FontAwesome.otf)? This one:
> > > tex/texmf/fonts/data/fonticons/fontawesome/FontAwesome.otf: OpenType font 
> > > data
> > > 
> > > I would assume that ConTeXt is using the bundled file by default.
> > It's not our hobby to keep up with font versions and changing names so 
> > we depend on users to signal that. Also, with fonts you never know what 
> > updated fonts will break.
> > 
> > In a next upload we'll define a list of names [5-9] so that we're more 
> > future proof.
> 
> Thanks.
> 
> Sure, it was my interest to understand, if the error lays in my
> installation or is due to the predefined files. Especially, since I did
> not manage to display a single symbol of FontAwesome at all, not even
> the one that seems to be explicitly defined.
> 
> For me, it is not relevant at all, in which version the font is.
> My main interest is to get an \xmark symbol.

FontAwesome works with the new version 2024.01.18 (the times symbol is
not present but an xmark symbol directly). Thank you!

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Suggestions and problems of the manuals

2024-01-17 Thread Gerion Entrup
resslevel 3, 14 streams, 0 uncompressed, 9 compressed, 5 not 
compressed, threshold 40
mkiv lua stats  > positions: 4 collected, 0 deltas, 0 shared partials, 
0 partial entries
mkiv lua stats  > used platform: linux-64, type: unix, binary subtree: 
texmf-linux-64
mkiv lua stats  > used engine: luametatex version: 2.10.11, 
functionality level: 20231231, format id: 698, compiler: gcc
mkiv lua stats  > tex properties: 807097 hash slots used of 2097152, 
50666 control sequences, approximate memory usage: 49 MB
mkiv lua stats  > lua properties: engine: lua 5.4, used memory: 84 MB, 
ctx: 80 MB, max: 80 MB, symbol mask: utf (τεχ)
mkiv lua stats  > runtime: 0.528 seconds, 1 processed pages, 1 shipped 
pages, 1.895 pages/second
mtx-context | purged files: 
math-mkiv-t-b-ce3b35636ef01ee62897a2beb76049e0.log, 
math-mkiv-t-b-ce3b35636ef01ee62897a2beb76049e0.tmp, 
math-mkiv-t-b-ce3b35636ef01ee62897a2beb76049e0.tuc
system  | total runtime: 1.044 seconds of 1.071 seconds

buffers > typeset > no changes in 'demo-4', processing skipped
floatblocks > '3' limited
floatblocks > 3 saved
pages   > flushing realpage 14, userpage 12, subpage 14
floatblocks > 1 moved
floatblocks > 2 moved
floatblocks > 3 moved
pages   > flushing realpage 15, userpage 13, subpage 15
pages   > flushing realpage 16, userpage 14, subpage 16
pages   > flushing realpage 17, userpage 15, subpage 17
pages   > flushing realpage 18, userpage 16, subpage 18
pages   > flushing realpage 19, userpage 17, subpage 19
structure   > sectioning > section @ level 3 : 0.3.1 -> Scripts
tex error   > tex error on line 370 in file 
/home/gerion/src/context/doc/context/sources/general/manuals/math/math-spacing.tex:
 Math error: parameter 'subshiftdown' with id 49 in style 2 is not set

 \math_m_nop
#1->\relax \ifmmode #1\else \normalstartimath 
\usemathstyleparameter \mathematicsparameter \c!mathstyle \expand 
\everyinsidemathematics \relax \begingroup #1\endgroup \normalstopimath
\fi

{\switchtobodyfont [cambria]\math{F_j = \int\nolimits _a^b}
} {Cambria}

360 font can be very detailed in where italic correction is to be 
applied and how
361 advanced stepwise kerns are used, but not many fonts have 
extensive information.
362 Here are some differences in rendering. In \OPENTYPE\ the 
super- and subscript of
363 an integral are moved right and left half of the italic 
correction.
364
365 \startlinecorrection
366 \startcombination[6*1]
367 {\switchtobodyfont  [modern]\math{F_j = \int\nolimits 
_a^b}} {Latin Modern}
368 {\switchtobodyfont [pagella]\math{F_j = \int\nolimits 
_a^b}} {Pagella}
369 {\switchtobodyfont  [dejavu]\math{F_j = \int\nolimits 
_a^b}} {Dejavu}
370 >>  {\switchtobodyfont [cambria]\math{F_j = \int\nolimits 
_a^b}} {Cambria}
371 {\switchtobodyfont[lucidaot]\math{F_j = \int\nolimits 
_a^b}} {Lucida OT}
372 {\switchtobodyfont[xits]\math{F_j = \int\nolimits 
_a^b}} {Xits}
373 \stopcombination
374 \stoplinecorrection
375
376 \stopsection
377
378 \startsection[title=Bad fonts]
379
380 There might be fonts out there where the italic correction is 
supposed to be
Sorry, but I can't typeset math unless various parameters have been 
set. This is
normally done by loading special math fonts into the math family slots. 
Your font
set is lacking at least the parameter mentioned earlier.
mtx-context | fatal error: return code: 1
- I tried to find a prebuild version and found 
https://mirror.contextgarden.net/general/manuals/math-mkiv.pdf.
  However, this document seems to be from 2021 and has a kind of wobbly
  rendering in Okular/Poppler (I remember the same phenomena with early
  LMTX). See the screenshot attached (math-mkiv-online.png). Is there a
  newer version somewhere? Maybe it is meaningful to delete the old
  version.


Best
Gerion
From 187f2bf0901d414bf55869054d29ee2c4bec1a64 Mon Sep 17 00:00:00 2001
From: Gerion Entrup 
Date: Tue, 16 Jan 2024 23:40:40 +0100
Subject: [PATCH] units-mkiv: improve

- typos
- remove getbuffer without context
- demonstrate usage of pm and to
---
 doc/context/sources/general/manuals/units/units-mkiv.tex | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/doc/context/sources/general/manuals/units/units-mkiv.tex b/doc/context/sources/general/man

[NTG-context] Re: Fwd: Re: x mark symbol and general symbol guide

2024-01-11 Thread Gerion Entrup
Am Dienstag, 9. Januar 2024, 21:17:57 CET schrieb Hans Hagen:
> On 1/9/2024 8:31 PM, Gerion Entrup wrote:
> 
> > My system awesome font is version 6 but isn't the one bundled with
> > ConTeXt version 5 (FontAwesome.otf)? This one:
> > tex/texmf/fonts/data/fonticons/fontawesome/FontAwesome.otf: OpenType font 
> > data
> > 
> > I would assume that ConTeXt is using the bundled file by default.
> It's not our hobby to keep up with font versions and changing names so 
> we depend on users to signal that. Also, with fonts you never know what 
> updated fonts will break.
> 
> In a next upload we'll define a list of names [5-9] so that we're more 
> future proof.

Thanks.

Sure, it was my interest to understand, if the error lays in my
installation or is due to the predefined files. Especially, since I did
not manage to display a single symbol of FontAwesome at all, not even
the one that seems to be explicitly defined.

For me, it is not relevant at all, in which version the font is.
My main interest is to get an \xmark symbol.


Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Fwd: Re: x mark symbol and general symbol guide

2024-01-09 Thread Gerion Entrup
Am Dienstag, 9. Januar 2024, 18:31:10 CET schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 09.01.2024 um 16:21:
> > Hi,
> >
> > I have to come back to that topic, since it seems not to work.
> > The said source code produces just the text "times" and "check" for me
> > (see 1.pdf). I also tried:
> >
> > ```
> > \usesymbols[fontawesome]
> >
> > \starttext
> > \showsymbolset[fontawesome-solid]
> > \stoptext
> > ```
> > and get a list of symbols that do not belong to fontawesome (see 2.pdf).
> >
> > I also tried to find the symbol file directly in the context
> > distribution and found:
> > tex/texmf-context/tex/context/base/mkiv/symb-imp-fontawesome.mkiv
> >
> > However, most parts are commented out there, one of the few remaining
> > symbols is wheelchair. However, when using that, I just got the string
> > _378 (3.pdf). Source code:
> >
> > ```
> > \usesymbols[fontawesome]
> >
> > \startTEXpage[offset=1pt]
> > \symbol[fontawesome][wheelchair]
> > \stopTEXpage
> > ```
> >
> > Is there a problem with my installation?
> > Additional output:
> > ```
> > % mtxrun --script fonts --list --all --pattern='fontawesome'
> > identifier familyname   fontname
> > filename 
> > subfont   instances
> >
> > fontawesomefontawesome  fontawesome 
> > FontAwesome.otf
> > fontawesome6brands fontawesome6brands   fontawesome6brandsregular   
> > /usr/share/fonts/fontawesome/Font Awesome 6 Brands-Regular-400.otf
> > fontawesome6brandsnormal   fontawesome6brands   fontawesome6brandsregular   
> > /usr/share/fonts/fontawesome/Font Awesome 6 Brands-Regular-400.otf
> > fontawesome6freenormal fontawesome6free fontawesome6freesolid   
> > /usr/share/fonts/fontawesome/Font Awesome 6 Free-Solid-900.otf
> > fontawesomenormal  fontawesome  fontawesome 
> > FontAwesome.otf
> > fontawesomeregular fontawesome  fontawesome 
> > FontAwesome.otf
> > ```
> 
> The symbols expect version 5 of fontawesome but you have version 6.
> 
> I guess it's time to switch to the new version of the fonts which can be 
> done by replacing 5 (file:fontawsome5...) with 6 (file:fontawsome6...) 
> in the following lines in symb-imp-fontawesome.mkiv
> 
> \definefontsynonym [FontAwesomeBrands] 
> [file:fontawesome5brandsregular400.otf]
> \definefontsynonym [FontAwesomeRegular] 
> [file:fontawesome5freeregular400.otf]
> \definefontsynonym [FontAwesomeSolid] [file:fontawesome5freesolid900.otf]
> 
> Wolfgang

My system awesome font is version 6 but isn't the one bundled with
ConTeXt version 5 (FontAwesome.otf)? This one:
tex/texmf/fonts/data/fonticons/fontawesome/FontAwesome.otf: OpenType font data

I would assume that ConTeXt is using the bundled file by default.

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: vim syntax highlighting bug?

2024-01-09 Thread Gerion Entrup
Thanks for your effort!
I have the same problem in Neovim and linked the pull request there:
https://github.com/neovim/neovim/issues/26966

Best,
Gerion

Am Montag, 8. Januar 2024, 12:16:14 CET schrieb Vincent Hennebert:
> I was in touch with the maintainer of the context.vim syntax file about 
> this. It turns out to be an issue with the lua.vim file that is included 
> in the context one. Lua.vim highlights trailing parentheses as errors, 
> but that’s done in a way that doesn’t work well when the file is 
> included by other syntax files. It somehow steals the syntax context and 
> makes Vim stay in Lua mode when it should go back to ConTeXt mode (I’m 
> not too savvy of the details).
> 
> The maintainer came up with a workaround [1] to force returning to 
> ConTeXt mode, although the parenthesis remains highlighted as an error.
> 
> That highlight bothers me, so my own workaround is to copy the lua.vim 
> file in my own .vim/syntax folder and comment out the ‘syn match 
> luaParenError ")"’ line (l.61 in my Vim version).
> 
> Maybe playing with the ‘contained’ keyword (in lua.vim) could lead to a 
> proper solution, but I’m happy enough with my workaround that I haven’t 
> felt the need to investigate this issue any further.
> 
> Hope that helps,
> Vincent
> 
> [1] https://github.com/vim/vim/pull/13778
> 
> On 06/01/2024 12:28, Damien Thiriet via ntg-context wrote:
> > Hello,
> > 
> > 
> > Happy New Year!
> > 
> > I got into a bug in my Vim syntax highlighting version.
> > Highlight stays in lua mode after ctxlua macro is closed.
> > Here is a MWE, where «this should not be highlitghted as
> > a comment indeed is.
> > 
> > \starttext
> > 
> > Hello!
> > \ctxlua{context("does the parser work?")}
> > 
> > -- this should not be highlighted as a comment
> > 
> > \stoptext
> > 
> > Do other Vim users come into this?
> > Is my syntax file outdated?
> > 
> > I am using this Vim version on OpenBSD 7.3 -stable:
> > VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep  6 2023 08:55:14)
> > Included patches: 1-1876
> > 
> > Best regards,
> > 
> > Damien Thiriet



signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Fwd: Re: x mark symbol and general symbol guide

2024-01-09 Thread Gerion Entrup
Hi,

I have to come back to that topic, since it seems not to work.
The said source code produces just the text "times" and "check" for me
(see 1.pdf). I also tried:

```
\usesymbols[fontawesome]

\starttext
\showsymbolset[fontawesome-solid]
\stoptext
```
and get a list of symbols that do not belong to fontawesome (see 2.pdf).

I also tried to find the symbol file directly in the context
distribution and found:
tex/texmf-context/tex/context/base/mkiv/symb-imp-fontawesome.mkiv

However, most parts are commented out there, one of the few remaining
symbols is wheelchair. However, when using that, I just got the string
_378 (3.pdf). Source code:

```
\usesymbols[fontawesome]

\startTEXpage[offset=1pt]
\symbol[fontawesome][wheelchair]
\stopTEXpage
```

Is there a problem with my installation?
Additional output:
```
% mtxrun --script fonts --list --all --pattern='fontawesome'
identifier familyname   fontname
filename subfont   
instances

fontawesomefontawesome  fontawesome 
FontAwesome.otf
fontawesome6brands fontawesome6brands   fontawesome6brandsregular   
/usr/share/fonts/fontawesome/Font Awesome 6 Brands-Regular-400.otf
fontawesome6brandsnormal   fontawesome6brands   fontawesome6brandsregular   
/usr/share/fonts/fontawesome/Font Awesome 6 Brands-Regular-400.otf
fontawesome6freenormal fontawesome6free fontawesome6freesolid   
/usr/share/fonts/fontawesome/Font Awesome 6 Free-Solid-900.otf
fontawesomenormal  fontawesome  fontawesome 
FontAwesome.otf
fontawesomeregular fontawesome  fontawesome 
FontAwesome.otf
```

Best,
Gerion



Am Montag, 16. Oktober 2023, 15:36:34 CET schrieb Gerion Entrup:
> Hans already answered my question. Thank you!
> 
> Gerion
> --  Forwarded Message  --
> 
> Subject: Re: [NTG-context] x mark symbol and general symbol guide
> Date: Freitag, 13. Oktober 2023, 18:13:42 CEST
> From: Hans Hagen 
> To: Gerion Entrup 
> 
> On 10/13/2023 2:33 PM, Gerion Entrup wrote:
> > Hi,
> > 
> > I recently tried to typeset a table with checkmarks and x marks.
> > \checkmark exists but is there a predefined x mark symbol (\xmark does
> > not work)?
> > 
> > In general: For LaTeX there exists the very helpful comprehensive LaTeX 
> > symbol list [1].
> > Is there a similar documentation for ConTeXt somewhere?
> \usesymbols[fontawesome]
> 
> \startTEXpage[offset=1ts]
>  \symbol[fontawesome-solid][times]\quad
>  \symbol[fontawesome-solid][check]
> \stopTEXpage
> 
> you can run symb-imp-fontawesome and get a list
> 
> Hans
> 
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
> 
> -
> 



1.pdf
Description: Adobe PDF document


2.pdf
Description: Adobe PDF document


3.pdf
Description: Adobe PDF document


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: LMTX: Command handling, Interface between TeX and Lua

2023-12-14 Thread Gerion Entrup
Am Mittwoch, 13. Dezember 2023, 21:57:35 CET schrieb Bruce Horrocks:
> 
> > On 13 Dec 2023, at 17:13, Gerion Entrup  wrote:
> > 
> > Is there a simple way to define a new command/environment and handle
> > the keyword arguments in Lua? For example defining a frontend command
> > like this:
> 
> I don't have the answer to your other questions but I do have an example for 
> this one.
> It's not mine - I'm fairly sure it came from this list but I can't find who 
> that was any more.
> 
> \startluacode
> userdata = userdata or { }
> 
> function userdata.mycommand(keywords, keyvals, str) 
> keyword_options = utilities.parsers.settings_to_array(keywords)
> named_values = utilities.parsers.settings_to_hash(keyvals)
> 
> context('First option = ' .. keyword_options[1])
> context('\\par')
> context('Color chosen = ' .. named_values['color'])
> context('\\par')
> context('Curly braces = ' .. str)
> context('\\par')
> end
> \stopluacode
> 
> \def\mycommand[#1][#2]#3{\ctxlua{
> userdata.mycommand('#1', '#2', [==[#3]==])}} 
> 
> \starttext
> \mycommand[top, inmargin, now][color=green, roof=gabled]{Anne of Green 
> Gables?}
> \stoptext

Thank you. That helps a lot already!

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] LMTX: Command handling, Interface between TeX and Lua

2023-12-13 Thread Gerion Entrup
Hi,

I'd like to understand more of the inner workings of LMTX.
When I understand it right, most of the code is now processed in Lua but
I was not able to find it.

For example, I tried to find out how setupitemgroup is handled (just as
an example of a more complex command). The wiki has a (kind of)
autogenerated description:
https://wiki.contextgarden.net/Command/setupitemgroup
I found the data for this (at least this is my guess) here:
tex/texmf-context/tex/context/interface/mkiv/i-itemgroup.xml

Are these xml files created by hand or somehow generated? Now, when I
use `\setupitemgroup[itemize:1][symbol=3,itemalign=middle]`: How are the
arguments handled and is this a generic process or specific to each
command?

Is there a simple way to define a new command/environment and handle
the keyword arguments in Lua? For example defining a frontend command
like this:

\startsomething[firstword={Some},secondword={Text}]
Body
\stopsomething


which I can handle in some lua code like this:

function something(firstword, secondword, body)
tex.print(firstword)
tex.print(secondword)
tex.print(body)
end

Are there any resources beside the context code itself where I can learn
that?

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Fwd: Re: x mark symbol and general symbol guide

2023-10-16 Thread Gerion Entrup
Hans already answered my question. Thank you!

Gerion
--  Forwarded Message  --

Subject: Re: [NTG-context] x mark symbol and general symbol guide
Date: Freitag, 13. Oktober 2023, 18:13:42 CEST
From: Hans Hagen 
To: Gerion Entrup 

On 10/13/2023 2:33 PM, Gerion Entrup wrote:
> Hi,
> 
> I recently tried to typeset a table with checkmarks and x marks.
> \checkmark exists but is there a predefined x mark symbol (\xmark does
> not work)?
> 
> In general: For LaTeX there exists the very helpful comprehensive LaTeX 
> symbol list [1].
> Is there a similar documentation for ConTeXt somewhere?
\usesymbols[fontawesome]

\startTEXpage[offset=1ts]
 \symbol[fontawesome-solid][times]\quad
 \symbol[fontawesome-solid][check]
\stopTEXpage

you can run symb-imp-fontawesome and get a list

Hans

-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

-


symbols.pdf
Description: Adobe PDF document


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] x mark symbol and general symbol guide

2023-10-13 Thread Gerion Entrup
Hi,

I recently tried to typeset a table with checkmarks and x marks.
\checkmark exists but is there a predefined x mark symbol (\xmark does
not work)?

In general: For LaTeX there exists the very helpful comprehensive LaTeX symbol 
list [1].
Is there a similar documentation for ConTeXt somewhere?

Best,
Gerion

[1] https://www.ctan.org/pkg/comprehensive


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Nested aligns in formulasjj

2023-08-14 Thread Gerion Entrup
Am Montag, 14. August 2023, 13:44:44 CEST schrieb Mikael Sundqvist:
> Hi,
> 
> I do not understand what you want to have, so here is just something
> weird, but probably you look for simplealign.
> 
> \definemathsimplealign
> [whatever]
> 
> \starttext
> \startformula
> \startalign
> \NC a = \NC (b, c) \quad \mtext{with}\NR
> \NC \NC \startwhatever
> \NC b \NC = something \NR
> \NC c \NC = someother \NR
> \stopwhatever \NR
> \NC somelong = \NC bla \NR
> \stopalign
> \stopformula
> \stoptext

Thanks, this looks exactly like that what I want. However, this does not
really nest aligns, but defines a new alignment group/environment (if I
interpret it correctly). But after all, it is a viable workaround.

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: Nested aligns in formulasjj

2023-08-14 Thread Gerion Entrup
Am Montag, 14. August 2023, 13:33:33 CEST schrieb Hans Hagen:
> On 8/14/2023 1:16 PM, Gerion Entrup wrote:
> > Hi,
> > 
> > I try to typeset a nested align in a formula. However, the results looks
> > really wrong. Here is a MWE:
> > 
> > ```
> > \starttext
> > \startformula
> > \startalign
> > \NC a = \NC (b, c) \quad \text{with}\NR
> > \NC   \NC \startalign
> > \NC b \NC = something \NR
> > \NC c \NC = someother \NR
> >   \stopalign \NR
> > \NC somelong = \NC bla \NR
> > \stopalign
> > \stopformula
> > \stoptext
> > ```
> > Am I doing something wrong or are nested aligns not possible?
> it will work if you configure the inner align to be tight (i delegate 
> that answer)
> 
> \startformula
> a   = \alignhere (b, c) \quad \text{with}
>\breakhere b = \text{something}
>\breakhere c = \text{someother}
>\breakhere
> \text{somelong} = \alignhere bla
> \stopformula
> 
> might be okay for your purpose

Thanks, but unfortunately not. I guess, I simplified the MWE too much.
This does not align the b and c. It should become clear here:

```
\startformula
a   = \alignhere (b, thisislonger) \quad \text{with}
   \breakhere b = \text{something}
   \breakhere thisislonger = \text{someother}
   \breakhere
\text{somelong} = \alignhere bla
\stopformula
```


Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Nested aligns in formulasjj

2023-08-14 Thread Gerion Entrup
Hi,

I try to typeset a nested align in a formula. However, the results looks
really wrong. Here is a MWE:

```
\starttext
\startformula
\startalign
\NC a = \NC (b, c) \quad \text{with}\NR
\NC   \NC \startalign
\NC b \NC = something \NR
\NC c \NC = someother \NR
  \stopalign \NR
\NC somelong = \NC bla \NR
\stopalign
\stopformula
\stoptext
```
Am I doing something wrong or are nested aligns not possible?


Best,
Gerion


test.pdf
Description: Adobe PDF document


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: floatcombinations seem to not work correctly after lmtx update

2023-08-01 Thread Gerion Entrup
Am Montag, 19. Juni 2023, 13:53:02 CEST schrieb Gerion Entrup via ntg-context:
> In this minimal example everything works. However, in my real document
> the subfigures have enormous space between them so just two pictures are
> visible (see the attached png).

I finally found the cause. I had these lines in my header:
```
\setupcaptions[minwidth=0.95\textwidth,
   way=bychapter,
   prefixsegments=chapter]
```
In the new context, this seem to apply to all captions, while in the old
context, it seems to apply only to those captions that are not specified
otherwise.

Best
Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: Link from a PDF to a reference of an embedded PDF

2023-07-24 Thread Gerion Entrup
Hi Pablo,

> not sure I’m getting your point right.

Thank you for the detailed answer.
But I fear, I have not expressed myself precise enough.
The solution that you described does not directly fit to my setting.
I'll try to rephrase. Maybe it gets more clear then. I think, named
destinations could be a important part in the solution.

I'm do not know the structure of PDFs exactly, therefore some of my
terms might be wrong. I'll name the two things from now on the following
way:
- a destination: This is a defined position within a PDF document; so
  some position that a PDF viewer is able to jump to. In ConTeXt, you
  can set such a position most of the time with the "reference" keyword.
  In LaTeX, you use \label.
- a reference: This is a link that you can click on and cause the
  PDF viewer to jump/scroll to the linked destination. In ConTeXt, you
  can use \in to create a reference. In LaTeX, you use \ref.

The situation is that I have a PDF-document (inner.pdf) that defines
several destinations and I want to embed that document with
\externalfigure into another PDF-document (outer.pdf). My question is:
Is it possible to create references within the source code of outer.pdf
that correctly set a link to a destination that is defined in inner.pdf?
Asked in another way: Is is possible that \externalfigure can extract
the (maybe named) destinations of inner.pdf and translate them in such a
way, that I can use \in within the outer document to link to them.


Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Link from a PDF to a reference of an embedded PDF

2023-07-20 Thread Gerion Entrup
Hi,

I found the "interaction" parameter in the documentation for
setupexternalfigure/externalfigure [1]. I, however do not quite
understand it. When embedding another PDF with this command, it seems to
be possible to include the references of the underlying PDF. It is
possible to link to them within the main context document? In [2], I
found something maybe related but it requires a tuc file.

Example:

inner.tex:
```
\starttext
\startsection[title=References, reference=sec:ref]
Some text
\placeformula[eq:foo]
\startformula
1 + 2 = 3
\stopformula
or:
\startitemize[n]
\item[item:bla] bla
\item[item:blub] blub
\stopitemize

Find all references \in[sec:ref], \in[eq:foo], \in[item:bla], \in[item:blub].
\stoptext
```

outer.tex:
```
\starttext
\externalfigure[inner.pdf][width=10cm, interactive=reference]

Find all references \in[sec:ref], \in[eq:foo], \in[item:bla], \in[item:blub].
\stoptext
```

Can I somehow access the references of inner.tex from outer.tex?
For me, it is not that relevant, that the correct number is set, but the
interaction within the outer PDF should work, so clicking on the
reference should scroll to the correct content.

Background of my question: I normally do graphics in a separate PDFs.
Some graphics consists of source code together with a graphical
representation and I want to be able to link to single source code lines.


Gerion


[1] https://wiki.contextgarden.net/Command/setupexternalfigure
[2] https://wiki.contextgarden.net/References#References_to_an_external_file


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] floatcombinations seem to not work correctly after lmtx update

2023-06-19 Thread Gerion Entrup via ntg-context
Hi,

I recently updated my Context (lmtx). Unfortunately, I'm not aware of
the previous version anymore. The current one is 2023.06.04 18:58.

After the update one of my documents broke at floatcombinations.
The relevant code is this one:
```
\useMPlibrary[dum]
\setupcombinations[alternative=text]

\definefloat[subfigure][local=yes]
\setupcaption[subfigure][numberconversion=a, prefix=no, headseparator={)}]
\setuplabeltext[subfigure=]

\appendvalue{stopplacefigure}{\resetcounter[subfigure]}

\starttext
test sdlkf jlsdjf lksjdf
\startplacefigure[title=Test]
\startfloatcombination[nx=3]
  \startplacesubfigure[title=Test]
\externalfigure[dummy][width=0.3\textwidth]
  \stopplacesubfigure
  \startplacesubfigure[title=Test]
\externalfigure[dummy][width=0.3\textwidth]
  \stopplacesubfigure
  \startplacesubfigure[title=Test]
\externalfigure[dummy][width=0.3\textwidth]
  \stopplacesubfigure
\stopfloatcombination
\stopplacefigure
lskdjf lskjfd lksjdfljsdkjf
\stoptext
```
In this minimal example everything works. However, in my real document
the subfigures have enormous space between them so just two pictures are
visible (see the attached png).

Do you have a clue, why this happens? Otherwise, I would take the
preamble of the real document and try to lower it down to have a
reproducible example (but that takes a lot of time, so I wanted to ask
beforehand).

Best,
Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Typeset multiple pictures not in a strict matrix (\startfloatcombination)

2023-03-07 Thread Gerion Entrup via ntg-context
Hi,

I'm trying to typeset several pictures as a floatcombination but not in
the form of strict cells of a matrix.

Here is some ASCII art to demonstrate the positions of the pictures:

  ---
  | |
  | |
  ---
a) Some caption

    -
  |  |  |   |
  |  |  |   |
  |  |  |   |
    -
 b) fooc) foo

 Figure 1.1: Foo Bar


I tried to typeset it with this code (based on 
https://tex.stackexchange.com/a/502903):

\useMPlibrary[dum]
\setupcombinations[alternative=text]

\definefloat[subfigure][local=yes]
\setupcaption[subfigure][numberconversion=a]
\setuplabeltext[subfigure=]

\appendvalue{stopplacefigure}{\resetcounter[subfigure]}

\starttext
\startplacefigure[title=Test]
\startfloatcombination[nx=1, ny=2]
  \startplacesubfigure[title=Test]
\externalfigure[dummy][width=4cm,height=1cm]
  \stopplacesubfigure
  \startfloatcombination[nx=2, ny=1]
\startplacesubfigure[title=Test]
  \externalfigure[dummy][width=4cm,height=1cm]
\stopplacesubfigure
\startplacesubfigure[title=Test]
  \externalfigure[dummy][width=4cm,height=1cm]
\stopplacesubfigure
  \stopfloatcombination
\stopfloatcombination
\stopplacefigure
\stoptext

However, this does not work (the pictures are all in one row).
Do you have some advice?

Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Description together with itemize, luametatex

2023-03-06 Thread Gerion Entrup via ntg-context
Am Montag, 6. März 2023, 14:34:28 CET schrieb Aditya Mahajan via ntg-context:
> On Mon, 6 Mar 2023, Gerion Entrup via ntg-context wrote:
> 
> > Hi,
> > 
> > I'm trying to use a description environment in conjunction with an
> > itemize with the latest luametatex. Is this supposed to work?
> > 
> > Here is an MWE:
> > ```
> > \definedescription[desc][headstyle=bold]
> > 
> > \starttext
> > Foo
> > 
> > \desc{Some title} Some text
> > \startitemize
> > \item Some item
> > \stopitemize
> > 
> > \stoptext
> 
> Use \startdesc ... \stopdesc
> 
> \definedescription[desc][headstyle=bold]
> 
> \starttext
> Foo
> 
> \startdesc[title={Some title}]
>   Some text
> \startitemize
> \item Some item
> \stopitemize
> \stopdesc
> 
> \stoptext

That worked. Thank you!


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Visual highlighted text with title, mix of enumeration and framedtext

2023-03-06 Thread Gerion Entrup via ntg-context
Hi,

I want to typeset a "Good to know" section that is visually highlighted
and can spawn across multiple pages.

In LaTeX this would be possible with the mdframed package. See the
attached screenshot for an example how it might look like (it is copied
out of page 4: Definition: Inhomogeneous linear of the mdframed
documentation:
http://mirrors.ctan.org/macros/latex/contrib/mdframed/mdframed.pdf)

I have searched in the wiki and found \defineenumeration:
This is near of that what I need. However I explicitly does not need an
enumeration (so no number or counter). Also I am not sure if I can set a
background and so on.

The other possibility is \defineframedtext. For example this goes much
in the direction that I want:
\definecolor[gbackground][s=0.98]
\defineframedtext[gtk][frame=on,
   offset=5pt,
   background=color,
   width=0.95\textwidth,
   backgroundcolor=gbackground]

However, there does not seem a possibility to define a title and it
seems to not work on multiple pages.

Is there a mix of an enumeration and framedtext that can produce
something like in the attached picture?

Best,
Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Description together with itemize, luametatex

2023-03-06 Thread Gerion Entrup via ntg-context
Hi,

I'm trying to use a description environment in conjunction with an
itemize with the latest luametatex. Is this supposed to work?

Here is an MWE:
```
\definedescription[desc][headstyle=bold]

\starttext
Foo

\desc{Some title} Some text
\startitemize
\item Some item
\stopitemize

\stoptext
```

This currently fails with:
```
resolvers   | formats | executing runner 'run luametatex format': 
/home/gerion/context/tex/texmf-linux-64/bin/luametatex --jobname="./test.tex" 
--fmt=/home/gerion/context/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.fmt
 
--lua=/home/gerion/context/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.lui
  --c:currentrun=1 --c:fulljobname="./test.tex" --c:input="./test.tex" 
--c:kindofrun=1 --c:maxnofruns=9 
--c:texmfbinpath="/home/gerion/context/tex/texmf-linux-64/bin"
system  >
system  > ConTeXt  ver: 2023.02.23 21:26 LMTX  fmt: 2023.3.4  int: 
english/english
system  >
system  > 'cont-new.mkxl' loaded
open source > level 1, order 1, name 
'/home/gerion/context/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 1, order 1, name 
'/home/gerion/context/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system  > files > jobname './test', input './test.tex', result './test'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
open source > level 1, order 2, name './test.tex'
fonts   > preloading latin modern fonts (second stage)
fonts   > 'fallback modern rm 12pt' is loaded
lua error   > lua error on line 8 in file ./test.tex:

registered function call [809]: 
...ext/tex/texmf-context/tex/context/base/mkiv/strc-num.lua:448: attempt to 
index a nil value (local 'd')
stack traceback:
...ext/tex/texmf-context/tex/context/base/mkiv/strc-num.lua:448: in 
function <...ext/tex/texmf-context/tex/context/base/mkiv/strc-num.lua:442>
(...tail calls...)
 1 \definedescription[desc][headstyle=bold]
 2
 3 \starttext
 4 Foo
 5
 6 \desc{Some title} Some text
 7  \startitemize
 8 >>   \item Some item
 9  \stopitemize
10
11 \stoptext
12
mtx-context | fatal error: return code: 1
```

Best,
Gerion


signature.asc
Description: This is a digitally signed message part.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Help test a LMTX bug fix: tweaks in PDF generation

2022-10-11 Thread Gerion Entrup via ntg-context
Am Sonntag, 9. Oktober 2022, 17:33:09 CEST schrieb Leah Neukirchen via 
ntg-context:
> So please: Try to preview and then try to print the attached PDF;
> and report back if either preview or printout does not look like
> the attached reference PNG image (i.e. something is missing,
> the fonts look different, or have wrong relative size.)

Okular, MuPDF and pdf.js (Firefox) on Linux look fine.
Gimp and Krita also look fine (but I think they are both using poppler).
LibreOffice Draw does not (font sizes are wrong). However, this is not directly 
a PDF viewer, so I'm pretty sure it can be ignored.

Best,
Gerion




___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Context path resolving, Problem with MkIV and TeXLive

2022-05-12 Thread Gerion Entrup via ntg-context
Hi,

I'm having a problem with TeXLive 2021 in conjunction with MkIV.
Basically, executing context results in:

% context
mtxrun  | unknown script 'context.lua' or 'mtx-context.lua

I researched this and found that probably there is a path problem.
LaTeX seems to be using kpathsea and /etc/texmf.cnf while context uses
texmfcnf.lua.

Looking into this file, it defines nearly all paths relative to "home:"
or "selfautoparent:". Home is self explaining. I have no clue what
selfautoparent is and also did not find an explanation in the internet.

Anyway, selfautoparent seems not to be resolved correctly. I figured
this by running `mtxrun --variables`. Here is a little excerpt:

resolvers   | lists | TEXMF
resolvers   | lists |   env: 
{$TEXMFCONFIG,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFPROJECT,!!$TEXMFFONTS,!!$TEXMFLOCAL,!!$TEXMFDIST}
resolvers   | lists |   var: TEXMF
resolvers   | lists |   exp: 
{home:.texlive2020/texmf-config,home:texmf,!!selfautoparent:texmf-config,!!selfautoparent:texmf-var,!!selfautoparent:texmf-project,!!selfautoparent:texmf-fonts,!!.,!!selfautoparent:texmf-dist}
resolvers   | lists |   res: 
{/home/gerion/.texlive2020/texmf-config,/home/gerion/texmf,!!./texmf-config,!!./texmf-var,!!./texmf-project,!!./texmf-fonts,!!.,!!./texmf-dist}
...
resolvers   | lists | TEXMFSYSVAR
resolvers   | lists |   env: selfautoparent:texmf-var
resolvers   | lists |   var: TEXMFSYSVAR
resolvers   | lists |   exp: selfautoparent:texmf-var
resolvers   | lists |   res: ./texmf-var
resolvers   | lists | TEXMFVAR
resolvers   | lists |   env: unset
resolvers   | lists |   var: TEXMFVAR
resolvers   | lists |   exp: home:.texlive2020/texmf-var
resolvers   | lists |   res: /home/gerion/.texlive2020/texmf-var

"home:" seems to be resolved correctly to "/home/gerion". "selfautoparent"
seems to be resolved to "." (the current directory?).
My context (and TeXLive) installation is in /usr/share/texmf-dist.
So running mtxrun --generate in exactly this directory and running
context after that works:

% mtxrun --generate
resolvers   | resolving | variable 'SELFAUTOLOC' set to '/usr/bin'
resolvers   | resolving | variable 'SELFAUTODIR' set to '/usr'
resolvers   | resolving | variable 'SELFAUTOPARENT' set to '.'
resolvers   | resolving | variable 'TEXMFCNF' set to ''
resolvers   | resolving | variable 'TEXMF' set to ''
resolvers   | resolving | variable 'TEXOS' set to 'usr'
resolvers   | resolving |
resolvers   | resolving | using configuration specification 
'home:texmf/web2c;{selfautoloc:,selfautoloc:/share/texmf-local/web2c,selfautoloc:/share/texmf-dist/web2c,selfautoloc:/share/texmf/web2c,selfautoloc:/texmf-local/web2c,selfautoloc:/texmf-dist/web2c,selfautoloc:/texmf/web2c,selfautodir:,selfautodir:/share/texmf-local/web2c,selfautodir:/share/texmf-dist/web2c,selfautodir:/share/texmf/web2c,selfautodir:/texmf-local/web2c,selfautodir:/texmf-dist/web2c,selfautodir:/texmf/web2c,$SELFAUTOGRANDPARENT/texmf-local/web2c,selfautoparent:,selfautoparent:/share/texmf-local/web2c,selfautoparent:/share/texmf-dist/web2c,selfautoparent:/share/texmf/web2c,selfautoparent:/texmf-local/web2c,selfautoparent:/texmf-dist/web2c,selfautoparent:/texmf/web2c}'
resolvers   | resolving |
resolvers   | resolving | looking for regular 'texmfcnf.lua' on 
given path '/home/gerion/texmf/web2c' from specification 'home:texmf/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on 
weird path '/usr/bin' from specification 'selfautoloc:'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on 
given path '/usr/bin/share/texmf-local/web2c' from specification 
'selfautoloc:/share/texmf-local/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on 
given path '/usr/bin/share/texmf-dist/web2c' from specification 
'selfautoloc:/share/texmf-dist/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on 
given path '/usr/bin/share/texmf/web2c' from specification 
'selfautoloc:/share/texmf/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on 
given path '/usr/bin/texmf-local/web2c' from specification 
'selfautoloc:/texmf-local/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on 
given path '/usr/bin/texmf-dist/web2c' from specification 
'selfautoloc:/texmf-dist/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on 
given path '/usr/bin/texmf/web2c' from specification 'selfautoloc:/texmf/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on 
weird path '/usr' from specification 'selfautodir:'
resolver

Re: [NTG-context] Bibliography in MKIV, custom rendering

2017-07-31 Thread Gerion Entrup
Am Montag, 31. Juli 2017, 04:23:16 CEST schrieb Gerion Entrup:
> Hi,
> 
> I need your help again. I've a bibliography and some entries references to 
> websites. Unfortunately the URL is not always rendered and the name ist 
> always 
> parsed as name of a person, not from an organisation etc.
> 
> What I want to achieve is to use the standard aps style, but with 
> additionally 
> the following two rules:
> 1. The name is always rendered without abbrevations (I guess, this is 
> authorconversion=normal).
> 2. If an URL is given, it is always rendered.
> 
> My input is a bib-file. Here is a minimal example:
> 
> input.bib
> ```
> @misc{objective-c,
> author = "Apple Inc.",
> note = "Online; accessed at 31-July-2017",
> title = "About Objective-C",
> url = 
> "https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html";,
> year = "2014"
> }
> ```
> 
> test.tex
> ```
> \usebtxdataset[default][input.bib]
> \usebtxdefinitions[aps]
> \setupbtx[default:cite][alternative=num]
> \setupbtx[default:list][authorconversion=normal]
> 
> \starttext
> According to Apple Inc., Objective-C is the main programming language, when 
> writing software for MacOS~\cite[objective-c].
> 
> \placelistofpublications
> \stoptext
> ```
> 
> I've tried to understand the manual, yout can see some of my attempts in the 
> minimal example. But I don't get really far.
> 
> Can you give me a hint?

I have "fixed" this with directly modifying the publ-imp-aps.mkvi. I guess,
this is the worst way to achive this thing, but I don't know a better one.

Here is the patch, if someone is interested.

Gerion

--- publ-imp-aps.mkvi.original  2017-07-31 21:23:14.736856430 +0200
+++ publ-imp-aps.mkvi   2017-07-31 21:24:46.860462851 +0200
@@ -58,7 +58,7 @@
 \definebtx
   [aps:\s!list]
   [aps]
-  [\c!authorconversion=normalshort]
+  [\c!authorconversion=normal]
 
 \definebtx
   [aps:\s!list:author]
@@ -1117,6 +1117,12 @@
 
 \startsetups btx:aps:list:misc
 \fastsetup{btx:aps:list:electronic}
+\btxdoif {url} {
+\btxspace
+\btxleftparenthesis
+\goto{\hyphenatedurl{\btxflush{url}}}[url(\btxflush{url})]
+\btxrightparenthesis
+}
 % Note that organization is an "ignored" field.
 \stopsetups

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Couple of questions

2017-07-31 Thread Gerion Entrup
Am Montag, 31. Juli 2017, 08:01:49 CEST schrieb Jan Willem Flamma:
> Dear Gerion,
> 
> Add 
> 
> \setuphead[subsubsection]
> [incrementnumber=no]
This works :). Thank you very much!


Gerion

> > On 30 Jul 2017, at 22:51, Gerion Entrup  wrote:
> > 
> > Am Samstag, 29. Juli 2017, 11:13:21 CEST schrieb Pablo Rodriguez:
> >> On 07/29/2017 04:45 AM, Gerion Entrup wrote:
> >>> Was not that simple, but I found the problem, that causes it:
> >>> subsubsections without numbers.
> >>> [...]
> >>> Is there a way to fix this?
> >> 
> >> I would say this may be a bug.
> > Does someone know a way to workaround?
> > 
> > This only way I see is to simply simulate a subsubsection (with some blanks
> > and a big font).
> > 
> > Gerion
> > 
> > 
> >> I don’t know how it is implemented, but prefixsegments (or prefixes) for
> >> captions only work when number is enabled.
> >> 
> >> This makes sense if the section is part of the prefixsegments, but not
> >> if it isn’t.
> >> 
> >> Another sample that shows the problem:
> >> 
> >>\mainlanguage[de]
> >>\setupexternalfigures[location=default]
> >>\setuphead[subsection][number=no]
> >>\setupcaptions[prefixsegments=chapter]
> >>\setuphead[subsubsection][number=yes]
> >> 
> >>\starttext
> >> 
> >>\chapter[title=Kapitel]
> >>\placefigure{Eine Kuh}{\externalfigure[cow.pdf][scale=250]}
> >> 
> >>\section[title=Abschnitt]
> >>\placefigure{Eine Kuh}{\externalfigure[cow.pdf][scale=250]}
> >> 
> >>\subsection[title=Hier gibt’s ein Problem]
> >>\placefigure{Eine Kuh}{\externalfigure[cow.pdf][scale=250]}
> >> 
> >>\subsection[title=Und hier gibt’s ein Problem auch]
> >>\placefigure{Eine Kuh}{\externalfigure[cow.pdf][scale=250]}
> >> 
> >>\subsubsection[title=Aber hier gibt’s kein Problem]
> >>\placefigure{Eine Kuh}{\externalfigure[cow.pdf][scale=250]}
> >>\stoptext
> >> 
> >> If this isn’t a bug, the code to avoid the problem is too tricky for me
> >> (and simply far beyond my knowledge).
> >> 
> >> Excuse my ignorance,
> >> 
> >> Pablo
> >> 
> > 
> > 
> > ___
> > If your question is of interest to others as well, please add an entry to 
> > the Wiki!
> > 
> > maillist : ntg-context@ntg.nl / 
> > http://www.ntg.nl/mailman/listinfo/ntg-context
> > webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> > archive  : https://bitbucket.org/phg/context-mirror/commits/
> > wiki : http://contextgarden.net
> > ___
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Bibliography in MKIV, custom rendering

2017-07-30 Thread Gerion Entrup
Hi,

I need your help again. I've a bibliography and some entries references to 
websites. Unfortunately the URL is not always rendered and the name ist always 
parsed as name of a person, not from an organisation etc.

What I want to achieve is to use the standard aps style, but with additionally 
the following two rules:
1. The name is always rendered without abbrevations (I guess, this is 
authorconversion=normal).
2. If an URL is given, it is always rendered.

My input is a bib-file. Here is a minimal example:

input.bib
```
@misc{objective-c,
author = "Apple Inc.",
note = "Online; accessed at 31-July-2017",
title = "About Objective-C",
url = 
"https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html";,
year = "2014"
}
```

test.tex
```
\usebtxdataset[default][input.bib]
\usebtxdefinitions[aps]
\setupbtx[default:cite][alternative=num]
\setupbtx[default:list][authorconversion=normal]

\starttext
According to Apple Inc., Objective-C is the main programming language, when 
writing software for MacOS~\cite[objective-c].

\placelistofpublications
\stoptext
```

I've tried to understand the manual, yout can see some of my attempts in the 
minimal example. But I don't get really far.

Can you give me a hint?

Gerion
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Couple of questions

2017-07-30 Thread Gerion Entrup
Am Samstag, 29. Juli 2017, 11:13:21 CEST schrieb Pablo Rodriguez:
> On 07/29/2017 04:45 AM, Gerion Entrup wrote:
> > Was not that simple, but I found the problem, that causes it:
> > subsubsections without numbers.
> > [...]
> > Is there a way to fix this?
> 
> I would say this may be a bug.
Does someone know a way to workaround?

This only way I see is to simply simulate a subsubsection (with some blanks
and a big font).

Gerion


> I don’t know how it is implemented, but prefixsegments (or prefixes) for
> captions only work when number is enabled.
> 
> This makes sense if the section is part of the prefixsegments, but not
> if it isn’t.
> 
> Another sample that shows the problem:
> 
> \mainlanguage[de]
> \setupexternalfigures[location=default]
> \setuphead[subsection][number=no]
> \setupcaptions[prefixsegments=chapter]
> \setuphead[subsubsection][number=yes]
> 
> \starttext
> 
> \chapter[title=Kapitel]
> \placefigure{Eine Kuh}{\externalfigure[cow.pdf][scale=250]}
> 
> \section[title=Abschnitt]
> \placefigure{Eine Kuh}{\externalfigure[cow.pdf][scale=250]}
> 
> \subsection[title=Hier gibt’s ein Problem]
> \placefigure{Eine Kuh}{\externalfigure[cow.pdf][scale=250]}
> 
> \subsection[title=Und hier gibt’s ein Problem auch]
> \placefigure{Eine Kuh}{\externalfigure[cow.pdf][scale=250]}
> 
> \subsubsection[title=Aber hier gibt’s kein Problem]
> \placefigure{Eine Kuh}{\externalfigure[cow.pdf][scale=250]}
> \stoptext
> 
> If this isn’t a bug, the code to avoid the problem is too tricky for me
> (and simply far beyond my knowledge).
> 
> Excuse my ignorance,
> 
> Pablo
> 


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Couple of questions

2017-07-28 Thread Gerion Entrup
Am Freitag, 28. Juli 2017, 17:05:59 CEST schrieb Pablo Rodriguez:
> On 07/28/2017 02:22 AM, Gerion Entrup wrote:
> > 2. Own title format
> > I've set an own title format for chapters, like described in the wiki. 
> > Unfortunately this applies to the table of contents and bibliography as 
> > well.
> > Below a minimal example, that reproduces it:
> > ```
> > \setupinteraction[state=start]
> > 
> > \define[2]\MyChapter{\framed[frame=off,bottomframe=on,topframe=on]
> > {\vbox{\headtext{chapter} #1\blank#2}}}
> > 
> > \setuphead[chapter][command=\MyChapter, style={\switchtobodyfont[24pt,ss]}, 
> > header=empty, page=mychapterpagebreak]
> > \setupheadtext[chapter=Chapter, content=Table of Contents]
> > 
> > \starttext
> > \completecontent
> > \page[yes]
> > 
> > \startchapter[title=foo]
> > 
> > \stoptext
> > ```
> > How can I prevent the printing of "Chapter" in the table of contents and
> > bibliography?
> 
> Hi Gerion,
> 
> play with the sample, in order to see what fits you best:
> 
> \setupinteraction[state=start]
> 
> \define[2]\MyChapter{\framed[frame=off,bottomframe=on,topframe=on]
> {\vbox{\headtext{chapter} #1\blank[small]#2}}}
> 
> \setuphead[chapter][command=\MyChapter,
> style={\switchtobodyfont[24pt,ss]}, header=empty, page=mychapterpagebreak]
> 
> \startsectionblockenvironment[bodypart]
> \setupheadtext[chapter=Chapter]
> \stopsectionblockenvironment
> 
> \startsectionblockenvironment[appendix]
> \setupheadtext[chapter=Appendix]
> \stopsectionblockenvironment
> 
> \starttext
> \startfrontmatter
> \chapter{Table of Contents}\placecontent
> \stopfrontmatter
> 
> \startbodymatter
> \startchapter[title=foo]
> \stopbodymatter
> 
> \startappendices
> \chapter{Bibliography}
> \stopappendices
> 
> \startbackmatter
> \chapter{Bibliography}
> \stopbackmatter
> 
> \stoptext
Thank you, that works for me.


> > 5. Numbering of floats
> > I want a numbering for my figures in this format:
> > way=bychapter, prefixsegments=chapter
> > 
> > I guess, this is the default, but I've explicitly set it.
> > In some captions the prefix is ignored. For example there are 5 figures in 
> > chapter 2, then the captions of the figures (the text is in German) are:
> > Abbildung 2.1   foo
> > Abbildung 2.2   bar
> > Abbildung 3foobar
> > Abbildung 4otherfoo
> > Abbildung 5lastfoo
> > 
> > Is there anything, I can do, to prevent this?
> 
> I cannot reproduce the problem you mention:
> 
> \mainlanguage[de]
> \starttext
> \dorecurse{5}{\chapter{Kapitel}
> \placefigure{Eine Kuh}{\externalfigure[cow.pdf]}}
> \chapter{Kapitel}
> \dorecurse{5}{\placefigure{Eine andere Kuh}
> {\externalfigure[cow.pdf]}}
> \dorecurse{5}{\chapter{Kapitel}
> \placefigure{Noch eine andere Kuh}{\externalfigure[cow.pdf]}}
> \stoptext
> 
> In general, please provide minimal samples of code that show your problem.
Was not that simple, but I found the problem, that causes it:
subsubsections without numbers.

Here is a minimal example:
```
\mainlanguage[de]
\setuphead[subsubsection][number=off]
\setupcaptions[way=bychapter,
   prefixsegments=chapter]

\starttext

\startchapter[title=Kapitel]
\placefigure{Eine Kuh}{\externalfigure[cow.pdf]}

\startsection[title=Abschnitt]
\startsubsection[title=Unterabschnitt]
\placefigure{Eine Kuh}{\externalfigure[cow.pdf]}

\startsubsubsection[title=Und hier gibts ein Problem]
\placefigure{Eine Kuh}{\externalfigure[cow.pdf]}
\stopsubsubsection

\startsubsubsection[title=Und hier gibts ein Problem]
\stopsubsubsection

\stopsubsection
\stopsection
\stopchapter

\stoptext
```
Is there a way to fix this?

Gerion


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Couple of questions

2017-07-28 Thread Gerion Entrup
Am Freitag, 28. Juli 2017, 16:34:01 CEST schrieb Pablo Rodriguez:
> On 07/28/2017 02:22 AM, Gerion Entrup wrote:
> > [...]
> > 6. Multiple references
> > I want to create the same footnote on multiple locations in the text. 
> > Therefore I used:
> > ```
> > \setupinteraction[state=start]
> > 
> > \starttext
> > This\footnote[letter-s]{"s" is a letter.} is\note[letter-s] a 
> > nons\note[letter-s]ens\note[letter-s]e text.
> > \stoptext
> > 
> > ```
> > But this uses different fonts for the number in the text. Is there a way to 
> > fix 
> > this or do it better?
> 
> Hi Gerion,
> 
> the easiest way is to disable bold in links:
> 
> \setupinteraction[state=start, style=]
> 
> Or I guess you would have to enable bold in the footnote reference numbers.
Ah ok, then both types of references are treated different.
Your solution works, thank you.

Gerion


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Couple of questions

2017-07-27 Thread Gerion Entrup
Hi,

this is a rather long mail, but I'll add the answers to the wiki.

For the future: Should I write one mail per question or all in one? :)

1. Color of references and table of content:
How can I define/change the colors of references and the table of content? And
why are some references red and others green?


2. Own title format
I've set an own title format for chapters, like described in the wiki. 
Unfortunately this applies to the table of contents and bibliography as well.
Below a minimal example, that reproduces it:
```
\setupinteraction[state=start]

\define[2]\MyChapter{\framed[frame=off,bottomframe=on,topframe=on]
{\vbox{\headtext{chapter} #1\blank#2}}}

\setuphead[chapter][command=\MyChapter, style={\switchtobodyfont[24pt,ss]}, 
header=empty, page=mychapterpagebreak]
\setupheadtext[chapter=Chapter, content=Table of Contents]

\starttext
\completecontent
\page[yes]

\startchapter[title=foo]

\stoptext
```
How can I prevent the printing of "Chapter" in the table of contents and
bibliography?


3. Text size in t-vim
I've defined a smaller text size in t-vim, but this seems to affect \inline... 
as well. Is there a way to circumvent this?

Minimal example:
```
\setupinteraction[state=start]

\usemodule[t-vim]
\definevimtyping[python][syntax=python,
 style={\switchtobodyfont[8pt,tt]},]
\starttext
\startpython
for line in foo:
print(line)
\stoppython
This is keyword \inlinepython{in} Python.
\stoptext
```


4. Captions of combinations
The wiki shows, how to completely autolabel figures in a combination with mkiv.
Is there a way to simply prefix the label with a), b), c),...?

Another related question: Is there a way to define the width and align of the 
labels of a combination?


5. Numbering of floats
I want a numbering for my figures in this format:
way=bychapter, prefixsegments=chapter

I guess, this is the default, but I've explicitly set it.
In some captions the prefix is ignored. For example there are 5 figures in 
chapter 2, then the captions of the figures (the text is in German) are:
Abbildung 2.1   foo
Abbildung 2.2   bar
Abbildung 3foobar
Abbildung 4otherfoo
Abbildung 5lastfoo

Is there anything, I can do, to prevent this?


6. Multiple references
I want to create the same footnote on multiple locations in the text. 
Therefore I used:
```
\setupinteraction[state=start]

\starttext
This\footnote[letter-s]{"s" is a letter.} is\note[letter-s] a 
nons\note[letter-s]ens\note[letter-s]e text.
\stoptext

```
But this uses different fonts for the number in the text. Is there a way to fix 
this or do it better?




___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Get number of chapter and section

2017-07-25 Thread Gerion Entrup
Hi,

I've another question. Currently I'm experimenting with the header and can 
retrieve the chapter name with \getmarkin[chapter].
How can I get the current number of the chapter (\getnumber[chapter] does not 
work) and the section?

Regards,
Gerion
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] t-vim module: math in "normal" code and background color

2017-07-19 Thread Gerion Entrup
Am Mittwoch, 19. Juli 2017, 21:07:09 CEST schrieb Aditya Mahajan:
> On Wed, 19 Jul 2017, Gerion Entrup wrote:
> 
> > Am Dienstag, 18. Juli 2017, 04:04:51 CEST schrieb Aditya Mahajan:
> >> On Mon, 17 Jul 2017, Gerion Entrup wrote:
> >>
> >>> Hi,
> >>>
> >>> I have two questions with the vim module.
> >>>
> >>> 1. I want to use the math mode inside the code. I've seen the escape 
> >>> option,
> >>> e.g. here [1], but this seems to work only with comments. Is there a
> >>> possibility to use it directly in the code, too?
> >>
> >> Short answer. No.
> >>
> >> Long answer. t-vim relies on vim to syntax highlight the code. Since the
> >> code is not valid python, the default python syntax highlighting will not
> >> work. In principle, it is possible to write a vim syntax highlighting
> >> script for a derivative of python where math terms are allowed, but that
> >> requires a lot of work for each language. The whole point of t-vim module
> >> was that I am lazy and don't want to write the parser for each language
> >> :-)
> >
> > I've invested some time and rewrote parts of the vimscript file of t-vim.
> > Now one or more escapechars can be defined, that helps vim to not interpret
> > the text:
> 
> I'll look at this later
> 
> > Another point I saw is, that highlight together with TeX-code is not really 
> > usable:
> > ```
> > \usemodule[vim]
> > \definevimtyping[python][syntax=python, escape=on]
> >
> > \starttext
> > \startpython[highlight=1]
> > # Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
> > \stoppython
> > \stoptext
> > ```
> 
> By default, the highlighting is done using the bars mechanism. It works 
> for simple cases but fails with math mode (the spaces are not covered). 
> One option is to highlight using the textbackground mechanism:
> 
> \definetextbackground[texthighlight]
>  [
>background=color,
>backgroundcolor=gray,
>frame=off,
>  ]
> 
> \define[1]\texthighlight{\starttexthighlight#1\stoptexthighlight}
> 
> \usemodule[vim]
> \definevimtyping[python][syntax=python, escape=on, 
> highlightcommand=\texthighlight]
> 
> \starttext
> 
> \startpython[highlight=3]
> for x in 1:n
>print(x)
> # Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
> for x in 1:n
>print(x)
> \stoppython
> \stoptext
Thank you, this works much better (critic on high level: the sum symbol is
higher than the highlight box, relevant on fractions).

 
> The spacing in math mode is bad. What is happening is the following. To 
> make sure that spaces are obeyed in the code listing, I set (a modified 
> version of) \activatespacehandler{on}, so the output that you get is the 
> following:
> 
> {\obeyspaces
>   \def\obeyedspace{\hskip\interwordspace\relax}
> \m{\sum_{i=1}^{n}i \in F \int_i f}}
> 
> The simplest way to fix this is to define a new command:
> 
> \define[1]\MATH{\bgroup\activatespacehandler{off}\m{\rescan{#1}}\egroup}
> 
> and use \MATH{} instead of \m{}.
> 
> I'll test this is a bit, and if the solution is robust, then I will map 
> \m{...} to something equivalent to the above in the t-vim environments.
I saw the strange spacing. Thank you very much to provide a solution.

Gerion

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] t-vim module: math in "normal" code and background color

2017-07-18 Thread Gerion Entrup
Am Dienstag, 18. Juli 2017, 04:04:51 CEST schrieb Aditya Mahajan:
> On Mon, 17 Jul 2017, Gerion Entrup wrote:
> 
> > Hi,
> >
> > I have two questions with the vim module.
> >
> > 1. I want to use the math mode inside the code. I've seen the escape 
> > option, 
> > e.g. here [1], but this seems to work only with comments. Is there a 
> > possibility to use it directly in the code, too?
> 
> Short answer. No.
> 
> Long answer. t-vim relies on vim to syntax highlight the code. Since the 
> code is not valid python, the default python syntax highlighting will not 
> work. In principle, it is possible to write a vim syntax highlighting 
> script for a derivative of python where math terms are allowed, but that 
> requires a lot of work for each language. The whole point of t-vim module 
> was that I am lazy and don't want to write the parser for each language 
> :-)

I've invested some time and rewrote parts of the vimscript file of t-vim.
Now one or more escapechars can be defined, that helps vim to not interpret
the text:
```
\usemodule[vim]
\definevimtyping[python][syntax=python]
\definevimtyping[cpp][syntax=cpp]

\starttext
\startpython
# Returns range(°\m{\sum_{i=1}^{n}i \in F \int_i f}°
def sum_upto(°\m{n \in \mathbb{N} \sum_{i=1}}°)
r = range(1, °\m{n}° + °\m{\sum_{i=1} 1}°)
return sum(r)
\stoppython
\startcpp
  foobar(°\m{q_0}°);
\stopcpp
\stoptext
```

I'm not familiar enough with TeX or ConTeXt to get the TeX part to work, so
the escapechar '°' is hardcoded at the moment. If you like the patch, this
has to be fixed.

Another problem, as you see in the above example, is, that vim interprets
the second ')' in the startcpp section as color code "Error", so the whole
part is colorized. This can be circumventented with the escapechars '°"', but
I have no idea how to teach tex/lua to not interpret the '"'. Simply writing
 -c "let escapechar='°\"'" %
etc. in the t-vim.tex does not work.


Another point I saw is, that highlight together with TeX-code is not really 
usable:
```
\usemodule[vim]
\definevimtyping[python][syntax=python, escape=on]

\starttext
\startpython[highlight=1]
# Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
\stoppython
\stoptext
```
 
> > Minimal example:
> > ```
> > \usemodule[vim]
> > \definevimtyping[python][syntax=python, escape=on]
> >
> > \starttext
> > \startpython
> > # Returns \m{\sum_{i=1}^{n}i}
> > def sum_upto(\m{n \in \mathbb{N}})
> >r = range(1, \m{n} + 1)
> >return sum(r)
> > \stoppython
> > \stoptext
> > ```
> 
> Another option will be to use the algorithmic module: 
> https://bitbucket.org/wolfs/algorithmic/src/
> 
> > 2. It would be cool, if I can define some background color for the code. 
> > Unfortunately I'm very new to context and haven't seen a direct option. I 
> > assume this is possible with some kind of extra environment around the code?
> 
> You can add
> 
> \setupbackground[background=color, backgroundcolor=gray]
> 
> \setupvimtyping[python]
>  [
>before={\startbackground},
>after={\stopbackground},
>  ]
> 
> or, instead of modifying the default background, define a new background 
> and use that.
OK, thank you.

Gerion

From 994de513a23210f1f4d50d24270f8f988abdd21c Mon Sep 17 00:00:00 2001
From: Gerion Entrup 
Date: Wed, 19 Jul 2017 00:13:52 +0200
Subject: [PATCH] t-vim: extended escape mode

With this change it is possible to define one or more escapechars, that
are used by vim to recognize parts that should not be interpreted.
---
 2context.vim | 50 +-
 t-vim.tex| 12 ++--
 2 files changed, 35 insertions(+), 27 deletions(-)

diff --git a/2context.vim b/2context.vim
index 9c72ba1..b208e65 100644
--- a/2context.vim
+++ b/2context.vim
@@ -8,6 +8,11 @@
 " output buffer. The script parses content line-by-line from the first buffer
 " and pastes the modified result on the second buffer.
 
+" Compare a char of  at  with some Unicode 
+function UnicodeCompare(string, bytepos, ochar)
+return strpart(a:string, a:bytepos, max([strlen(a:ochar), 1])) ==# a:ochar
+endfunction
+
 " Split screen and go to the second buffer, ensure modifiable is set, and the
 " buffer is empty.
 sblast 
@@ -38,9 +43,9 @@ if !exists("highlight")
   let highlight=[]
 endif
 
-" Set escapecomments
-if !exists("escapecomments")
-  let escapecomments=0
+" Set escapechar
+if !exists("escapechar")
+  let escapechar=''
 endif
 
 let s:strip = strlen( matchstr( getline(s:lstart), '^\s*' ) )
@@ -71,37 +76,48 @@ let s:lines = []
 let s:buffer_lnum = 1
 let s:lnum = s:l

[NTG-context] t-vim module: math in "normal" code and background color

2017-07-17 Thread Gerion Entrup
Hi,

I have two questions with the vim module.

1. I want to use the math mode inside the code. I've seen the escape option, 
e.g. here [1], but this seems to work only with comments. Is there a 
possibility to use it directly in the code, too?

Minimal example:
```
\usemodule[vim]
\definevimtyping[python][syntax=python, escape=on]

\starttext
\startpython
# Returns \m{\sum_{i=1}^{n}i}
def sum_upto(\m{n \in \mathbb{N}})
r = range(1, \m{n} + 1)
return sum(r)
\stoppython
\stoptext
```

2. It would be cool, if I can define some background color for the code. 
Unfortunately I'm very new to context and haven't seen a direct option. I 
assume this is possible with some kind of extra environment around the code?

(I've subscribed the list, so you don't have to CC me.)

Thank you in advance,
Gerion

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

  1   2   >