[NTG-context] ConTeXt equivalent of \newmcodes@

Maggyero maggyero at gmail.com
Mon Apr 27 21:14:15 CEST 2015


> Does \definemathcommand [xyz] [nolop] {xyz} do what you want?

Not really if, instead of xyz, I want a name with hyphens, quotes, stars or
colons. Compare the output of

\definemathcommand[xyz][nolop]{fancy-function-name'*.:}

in ConTeXt with the output of

\DeclareMathOperator{\xyz}{fancy-function-name'*.:}

in LaTeX. What I can do is

\definemathcommand[xyz][nolop]{\kern\zeropoint\mfunction{fancy-function-name'*.:}}

which gives the same result as \DeclareMathOperator, except for the hyphens
and the star are converted into binary operators and the colon which is
preceded by a space, since I didn't use \newmcodes@, that is why I asked
how to implement the macro \newmcodes@ in ConTeXt, which is defined in
LaTeX as

\begingroup \catcode`\"=12
    \gdef\newmcodes@{\mathcode`\'39\mathcode`\*42\mathcode`\."613A%
    \ifnum\mathcode`\-=45 \else
        \mathchardef\std at minus\mathcode`\-\relax
    \fi
    \mathcode`\-45\mathcode`\/47\mathcode`\:"603A\relax}
\endgroup

so that the following code can compile in ConTeXt:

\definemathcommand[xyz][nolop]{\newmcodes@
\kern\zeropoint\mfunction{fancy-function-name'*.:}}


Maggyero
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150427/2d4785d5/attachment.html>


More information about the ntg-context mailing list