[NTG-context] Questions about \starttext

Wolfgang Schuster schuster.wolfgang at gmail.com
Mon Apr 2 20:39:32 CEST 2018



> Tomas Hala <mailto:tomas.hala at mendelu.cz>
> 20. März 2018 um 12:43
> Hi all,
>
> doing some tests I discovered two interesting facts.
>
> The first is that commands \starttext and \stoptext do not behave as a 
> group.
>
> Minimal example (tested on TL2015, TL2016, TL2017, current CTX from 
> the Garden):
>
> \starttext
> text
> \starttext
> \bf text
> \stoptext
> text % this text is in bold, too.
> \stoptext
>
> Is this the expected behaviour, or not?

Opening a group with \starttext makes no sense because there is nothing 
after \stoptext.

The possibility to nest \starttext is necessary when you \startproduct 
etc. where components
can be be documents on its own and this means \startcomponent includes 
\starttext in its
definition.

> The second interesting thing is that the unbalanced document is 
> compiled without protests:
>
> Minimal example #1 (tested on TL2015, TL2016, TL2017, current CTX from 
> the Garden):
>
> \starttext
> text % in this case, the "text" is shipped out

Take a look at the command line when you process a file and you should 
see something like this:

mtx-context     | run 1: luatex --fmt="[...]/cont-en" --jobname="test" 
[...] --c:input="./test.tex" [...] "cont-yes.mkiv"


As you can see the luatex engine processes the file cont-yes.mkiv and 
not your document
which put as argument to context. Your document is just read by 
cont-yes.mkiv and at the
end of the document ConTeXt inserts an extra \stoptext which is ignored 
when your document
is valid (equal number of \starttext and \stoptext).

> Minimal example #2 (tested on TL2015, TL2016, TL2017, current CTX from 
> the Garden):
>
> text % in this case, the "text" is not shipped out
> \stoptext

The reason why no text appears is that ConTeXt doesn’t load the default 
fonts
untill \starttext. The reason for this is to is a gain in speed and you 
save resources.

You can test this by adding \setupbodyfont[modern] at the begin of your 
example.


Wolfgang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20180402/f4826ce3/attachment.html>


More information about the ntg-context mailing list