[NTG-context] ConTeXt equivalent of \newmcodes@

Hans Hagen pragma at wxs.nl
Mon Apr 27 22:44:24 CEST 2015


On 4/27/2015 9:14 PM, Maggyero wrote:
>  > 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'*.:}}

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

$\xyz^{\xyz}$


-- 

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


More information about the ntg-context mailing list