Re: [NTG-context] blank[\lineheight] works with LMTX, fails with MkIV

2019-12-21 Thread Wolfgang Schuster

mf schrieb am 21.12.2019 um 11:07:

Il 20/12/19 20:04, Rik Kabel ha scritto:


MkIV fails with

tex error   > tex error on line 3 in file 
c://Users/micro/Desktop/fail.tex: ! Missing \endcsname inserted

given the following mwe:

\starttext
a
\blank[\lineheight]
z
\stoptext

Not critical as there are lots of ways to do this, but it seems 
strange that it should work in one and not the other.




\starttext
a
\blank[\the\lineheight]
z
\stoptext


To understand the differenecs between MkIV adn LMTX you should know how 
\blank handles the arguments.



1. MkII

ConTeXt processes the argument list in TeX and checks first if the 
argument is a valid name (e.g. big) which is then expanded, when the 
argument isn't a valid name it is handled as a dimension which is added 
to the skip value. Since everything happens in TeX length registers 
(e.g. \lineheight) are allowed in the argument.



2. MkIV

ConTeXt passes the complete list with all arguments to Lua where a loop 
iterates over all entries. The problem here is that Lua can't deal with 
\lineheight because it expects the value of the register and you have to 
pass the length as \the\lineheight which delivers the current value for 
the line height.



3. LMTX

The same things as MkIV but there is a additional check on the TeX end 
before the arguments are passed to Lua where ConTeXt checks if the 
argument is a dimension. The reason why this is only done for LMTX is 
that a new command (\ifchkdim) in the engine was needed for this and 
many of these new helpers exist only here.


Be aware that this check works only when a length register is the 
*first* argument in the list because every other case the check fails.



\starttext

line 1

\blank[line]

line 2

\blank[\lineheight] % works

line 3

\blank[preference,line]

line 4

\blank[preference,\lineheight] % fails

line 5

\stoptext


Wolfgang

___
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] blank[\lineheight] works with LMTX, fails with MkIV

2019-12-21 Thread mf

Il 20/12/19 20:04, Rik Kabel ha scritto:


MkIV fails with

tex error   > tex error on line 3 in file 
c://Users/micro/Desktop/fail.tex: ! Missing \endcsname inserted

given the following mwe:

\starttext
a
\blank[\lineheight]
z
\stoptext

Not critical as there are lots of ways to do this, but it seems 
strange that it should work in one and not the other.




\starttext
a
\blank[\the\lineheight]
z
\stoptext

___
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] blank[\lineheight] works with LMTX, fails with MkIV

2019-12-20 Thread Rik Kabel

MkIV fails with

   tex error   > tex error on line 3 in file 
c://Users/micro/Desktop/fail.tex: ! Missing \endcsname inserted

given the following mwe:

   \starttext
   a
   \blank[\lineheight]
   z
   \stoptext

Not critical as there are lots of ways to do this, but it seems strange 
that it should work in one and not the other.


--
Rik

___
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
___