[luatex] \mathstyle

Khaled Hosny khaledhosny at eglug.org
Sun Dec 2 20:11:35 CET 2012


On Sun, Dec 02, 2012 at 07:28:19PM +0100, Herbert Voss wrote:
> Hi,
> I do not really understand the definition of
> \mathstyle. From the documentation on page 133
> I thought that this should work:
> 
> \directlua{tex.enableprimitives("",tex.extraprimitives())}
> 
> \def\Test{%
>  \ifnum\mathstyle=\textstyle \hbox{Text}
>  \else\ifnum\mathstyle=\scriptstyle \hbox{Script}
>   \else\ifnum\mathstyle=\scriptscriptstyle \hbox{ScriptScript}
>     \else \hbox{nothing} \fi \fi \fi}
> 
> $L_{\Test} \Test L_{\Test_{\Test}}$
> 
> \bye
> 
> 
> But it detects only \textstyle not the other ones.
> Is that the intended behaviour?

You have to check for cramped styles as well:
\def\Test{%
 \ifnum\mathstyle=\textstyle \hbox{Text}
 \else\ifnum\mathstyle=\scriptstyle \hbox{Script}
  \else\ifnum\mathstyle=\scriptscriptstyle \hbox{ScriptScript}
   \else\ifnum\mathstyle=\crampedtextstyle \hbox{CrampedText}
    \else\ifnum\mathstyle=\crampedscriptstyle \hbox{CrampedScript}
     \else\ifnum\mathstyle=\crampedscriptscriptstyle \hbox{CrampedScriptScript}
      \else \hbox{nothing} \fi \fi \fi \fi \fi \fi}

Regards
Khaled


More information about the luatex mailing list