ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: blank[\lineheight] works with LMTX, fails with MkIV
Date: Sat, 21 Dec 2019 15:57:53 +0100	[thread overview]
Message-ID: <4964f504-723f-578f-eef6-e17fc8afa89b@gmail.com> (raw)
In-Reply-To: <d659a958-655c-9944-9478-7cfc2b9e0ab1@fastwebnet.it>


[-- Attachment #1.1: Type: text/plain, Size: 1948 bytes --]

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


[-- Attachment #1.2: Type: text/html, Size: 2804 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

      reply	other threads:[~2019-12-21 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 19:04 Rik Kabel
2019-12-21 10:07 ` mf
2019-12-21 14:57   ` Wolfgang Schuster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4964f504-723f-578f-eef6-e17fc8afa89b@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).