[NTG-context] Math letters in commands

Hans Hagen pragma at wxs.nl
Mon Sep 12 21:45:01 CEST 2016


On 9/12/2016 8:25 PM, Hans Åberg wrote:
> Found a workaround: The idea is to use \csname …\endcsname with two delimiters not likely to be used in math mode, below chosen to ‘…’.
>
> But then there seems to be a bug in the LuaTex \letcharcode command: There must be a character between “$” and the first occurring \activecatcode letter. Possibly this also causes a bug in \startformula, as discussed before.

it's not a bug .. tex looks ahead for a second $ and in the process 
expands  the next token which happens to be a letter at that point so it 
gets injected as letter (it's the way tex works)

\appendtoks
     \catcode`𝐝\lettercatcode
     \catcode`𝐢\lettercatcode
     \catcode`𝐦\lettercatcode
\to \everymathematics

\definemathcommand[𝐝𝐢𝐦][nolop]{\mfunction{𝐦𝐢𝐝}}

\starttext

Note that $ \𝐝𝐢𝐦 𝑉 = 𝖫$, although $\dim 𝑉 = 4$.

And a bug: $\𝐝𝐢𝐦 𝑉$.

\stoptext

fwiw, the current beta makes math characters also letters now

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


More information about the ntg-context mailing list