%D \module %D [ file=math-ini, %D version=2008.01.02, %D title=\CONTEXT\ Math Macros, %D subtitle=Initializations, %D author=Hans Hagen, %D date=\currentdate, %D copyright=PRAGMA] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. \writestatus{loading}{ConTeXt Math Macros / Initializations} %D This module provides namespaces for math fonts, thereby %D permitting mixed usage of math fonts. Although not strictly %D needed, we also provide a family name mapping mechanism as %D used in the (original) AMS math definition files, but here %D these names can recursively be remapped and if needed, %D dynamically be changed. We've tried to minimize the number %D of definition commands and use plain \TEX\ definitions as %D fallback. We've tried to follow a couple of conventions %D from plain and AMS math in order to achieve backward %D compatinility. We also kept an eye on future usage of these %D modules in the perspective of MathML and unicode fonts. \unprotect \ifx\v!compact\undefined \def\v!compact{compact} \fi %D We move these definitions into the format: % test [[\char948 \ctxlua{tex.sprint(utf.char(948))}]] % test $[[\char948 \ctxlua{tex.sprint(utf.char(948))}]]$ \registerctxluafile{math-ini}{1.001} \registerctxluafile{math-dim}{1.001} \registerctxluafile{math-ent}{1.001} \registerctxluafile{math-ext}{1.001} \registerctxluafile{math-vfu}{1.001} \registerctxluafile{math-map}{1.001} \registerctxluafile{math-noa}{1.001} \registerctxluafile{math-tag}{1.001} \definesystemattribute[mathalphabet] [public] \definesystemattribute[mathsize] [public] \definesystemattribute[mathpunctuation][public] \definesystemattribute[mathgreek] [public] \definesystemattribute[mathalternate] [public] % experiment % Normally this is applied to only one character. % % $ABC$ $\cal ABC$ $\mathaltcal ABC$ \def\mathalternate#1{\ctxlua{mathematics.setalternate(0,"#1")}} % fam 0 \def\mathaltcal{\mathalternate{cal}\cal} % ss01 in xits % todo: only in mmode \unexpanded\def\mathgreekupright{\attribute\mathgreekattribute22 } \unexpanded\def\mathgreekitalic {\attribute\mathgreekattribute33 } \unexpanded\def\mathgreekdefault{\attribute\mathgreekattribute\attributeunsetvalue} \let\mathgreeknormal\mathgreekupright \let\mathgreeknone \mathgreekdefault \def\setmathattribute#1#2{\ifmmode\ctxlua{mathematics.syncboth ("#1","#2")}\fi} \def\setmathalphabet #1{\ifmmode\ctxlua{mathematics.syncname ("#1")}\fi} \def\setmathstyle #1{\ifmmode\ctxlua{mathematics.syncstyle("#1")}\fi} \unexpanded\def\mr {\setmathattribute{regular}{tf}} \unexpanded\def\mathdefault {\setmathattribute{regular}{it}} \unexpanded\def\mathscript {\setmathalphabet{script}} \unexpanded\def\mathfraktur {\setmathalphabet{fraktur}} \unexpanded\def\mathblackboard{\setmathalphabet{blackboard}} \unexpanded\def\mathrm{\setmathattribute{rm}{tf}} \unexpanded\def\mathss{\setmathattribute{ss}{tf}} \unexpanded\def\mathtt{\setmathattribute{tt}{tf}} \unexpanded\def\mathtf{\setmathstyle{tf}} \unexpanded\def\mathbf{\setmathstyle{bf}} \unexpanded\def\mathsl{\setmathstyle{sl}} \unexpanded\def\mathit{\setmathstyle{it}} \unexpanded\def\mathbs{\setmathstyle{bs}} \unexpanded\def\mathbi{\setmathstyle{bi}} \let\tfmath\mathtf % maybe a grouped command \let\bfmath\mathbf \let\slmath\mathsl \let\itmath\mathit \let\bsmath\mathbs \let\bimath\mathbi \let\Bbb\mathblackboard \unexpanded\def\frak {\ifmmode\expandafter\mathfraktur \fi} \unexpanded\def\cal {\ifmmode\expandafter\mathscript \fi} \unexpanded\def\bbd {\ifmmode\expandafter\mathblackboard\fi} \unexpanded\def\blackboard{\ifmmode\expandafter\mathblackboard\fi} \unexpanded\def\fraktur {\ifmmode\expandafter\mathfraktur \fi} \unexpanded\def\gothic {\ifmmode\expandafter\mathfraktur \fi} \unexpanded\def\mathcal #1{{\mathscript #1}} % for AMS compatibility \unexpanded\def\mathfrak#1{{\mathfraktur #1}} % for AMS compatibility \unexpanded\def\mathbb #1{{\mathblackboard#1}} % for AMS compatibility \let\normalmr\mr % \prependtoks % \let\mr\normalmr % \let\rm\mathrm \let\ss\mathss \let\tt\mathtt % \let\tf\mathtf \let\bf\mathbf \let\it\mathit \let\sl\mathsl \let\bi\mathbi \let\bs\mathbs % \let\frak\mathfraktur \let\cal\mathscript \let\bbd\mathblackboard % \mathdefault % \to \everymathematics \let\normaltf\tf \unexpanded\def\tf{\ifmmode\mathtf\else\normaltf\fi} \let\normalbf\bf \unexpanded\def\bf{\ifmmode\mathbf\else\normalbf\fi} \let\normalit\it \unexpanded\def\it{\ifmmode\mathit\else\normalit\fi} \let\normalsl\sl \unexpanded\def\sl{\ifmmode\mathsl\else\normalsl\fi} \let\normalbi\bi \unexpanded\def\bi{\ifmmode\mathbi\else\normalbi\fi} \let\normalbs\bs \unexpanded\def\bs{\ifmmode\mathbs\else\normalbs\fi} \let\normalrm\rm \unexpanded\def\rm{\ifmmode\mathrm\else\normalrm\fi} \let\normalss\ss \unexpanded\def\ss{\ifmmode\mathss\else\normalss\fi} \let\normaltt\tt \unexpanded\def\tt{\ifmmode\mathtt\else\normaltt\fi} \unexpanded\def\mr{\ifmmode \normalmr\fi} \prependtoks % \let\mr\normalmr % \let\rm\mathrm \let\ss\mathss \let\tt\mathtt % \let\tf\mathtf \let\bf\mathbf \let\it\mathit \let\sl\mathsl \let\bi\mathbi \let\bs\mathbs % \let\frak\mathfraktur \let\cal\mathscript \let\bbd\mathblackboard \mathdefault \to \everymathematics %D \macros %D {boldsymbol} %D %D To be done. \let\mathboldsymbol\relax % yet unsupported, will be \def\boldsymbol {\mathortext\mathboldsymbol\bold} %D Helpers: \def\utfmathclass #1{\cldcontext{mathematics.utfmathclass (\!!bs#1\!!es)}} \def\utfmathstretch#1{\cldcontext{mathematics.utfmathstretch(\!!bs#1\!!es)}} \def\utfmathcommand#1{\cldcontext{mathematics.utfmathcommand(\!!bs#1\!!es)}} \def\utfmathfiller #1{\cldcontext{mathematics.utfmathfiller (\!!bs#1\!!es)}} % \def\utfmathclassdefault #1#2{\ctxlua{ % tex.sprint(mathematics.utfmathclass("#1","#2")) % }} % % \def\utfmathcommanddefault#1#2#3{\ctxlua{ % local cmd = mathematics.utfmathcommand("#1","") or "" % if cmd == "" then % commands.cs("#2","#3") % else % commands.cs(cmd) % end}} % % % \def\@@mathlimopcomm #1{\mathop{#1}} %no \limits \def\@@mathnolopcomm #1{\mathop{#1}\nolimits} \def\@@mathboxcomm #1{\dontleavehmode\hbox\Ustartmath\mathsurround\zeropoint#1\Ustopmath} \def\@@mathchoicecomm#1{[todo #1]} \setnewconstant\mathordcode 0 \let\mathordcomm \mathord \setnewconstant\mathopcode 1 \let\mathopcomm \mathop \setnewconstant\mathbincode 2 \let\mathbincomm \mathbin \setnewconstant\mathrelcode 3 \let\mathrelcomm \mathrel \setnewconstant\mathopencode 4 \let\mathopencomm \mathopen \setnewconstant\mathclosecode 5 \let\mathclosecomm \mathclose \setnewconstant\mathpunctcode 6 \let\mathpunctcomm \mathpunct \setnewconstant\mathalphacode 7 \let\mathalphacomm \firstofoneargument \setnewconstant\mathinnercode 0 \let\mathinnercomm \mathinner \setnewconstant\mathnothingcode 0 \let\mathnothingcomm \firstofoneargument \setnewconstant\mathlimopcode 1 \let\mathlimopcomm \@@mathlimopcomm \setnewconstant\mathnolopcode 1 \let\mathnolopcomm \@@mathnolopcomm \setnewconstant\mathchoicecode 0 \let\mathchoicecomm \@@mathchoicecomm \setnewconstant\mathboxcode 0 \let\mathboxcomm \@@mathboxcomm \setnewconstant\mathaccentcode 8 \setnewconstant\mathradicalcode 9 \def\puremathcode#1{\the\csname math#1code\endcsname} \def\puremathcomm#1{\csname math#1comm\endcsname} % \startlines % $\mathopnolimits{\rm d}x$ % $\mathopnolimits{\kern\zeropoint \rm d}x$ % $\puremathcomm{nolop}{\rm d}x$ % $\puremathcomm{nolop}{\kern\zeropoint\rm d}x$ % \blank % $\puremathcomm{nolop}{\mr d}x$ % $\puremathcomm{nolop}{\kern\zeropoint\mr d}x$ % $\mathop{\kern\zeropoint\mr d}x$ % $\mathopnolimits{\kern\zeropoint d}x$ % \stoplines % this will be sorted out: \let\mathcharacter \getvalue \let\textcharacter \getvalue \unexpanded\def\definefamilysynonym {\dotripleempty\dodefinefamilysynonym} \def\dodefinefamilysynonym [#1][#2][#3]{} \unexpanded\def\definemathsymbol {\dosixtupleempty\dodefinemathsymbol} \def\dodefinemathsymbol [#1][#2][#3][#4][#5][#6]{} \unexpanded\def\definemathcharacter {\dosixtupleempty\dodefinemathcharacter} \def\dodefinemathcharacter [#1][#2][#3][#4][#5][#6]{} \unexpanded\def\definemathcommand {\dotripleempty\dodefinemathcommand} \def\dodefinemathcommand[#1][#2][#3]#4% command class args meaning {\ifthirdargument \processaction [#3] [one=>\setuvalue{#1}##1{\puremathcomm{#2}{#4{##1}}}, two=>\setuvalue{#1}##1##2{\puremathcomm{#2}{#4{##1}{##2}}}]% \else\ifsecondargument \setuvalue{#1}{\puremathcomm{#2}{#4}}% \else \setuvalue{#1}{\puremathcomm{nothing}{#4}}% \fi\fi} %D Moved from font-ini.mkiv: %D %D \macros %D {mf,mbox,enablembox,mathop} %D %D Todo: \unexpanded\def\mf {\csname\fontalternative\endcsname} \let\normalmathop\mathop \unexpanded\def\mathop {\normalmathop \bgroup \let\rm\mf \let\next=} \def\normalmbox {\normalhbox\bgroup\mf \dowithnextbox{\flushnextbox\egroup}\normalhbox} \def\mbox % we cannot add \dontleavehmode ... else no \setbox0\mbox possible {\ifmmode\normalmbox\else\normalhbox\fi} \unexpanded\def\enablembox {\appendtoks \ifx\normalhbox\undefined\let\normalhbox\hbox\fi \let\hbox\mbox \to\everymathematics} %D needed for sin, cos etc \let\mathfunction\firstofoneargument \def\mfunction #1{{\mr#1}} \def\mfunctionlabeltext#1{{\mr\mathlabeltext{#1}}} % \def\mlimitsfunction #1{\mathlimopcomm{{\mr#1}} % \def\mnolimitsfunction#1{\mathnolopcomm{{\mr#1}} %D Taco posted this solution as response to a mail by Olivier, so %D let's integrate it here. \def\currentmscaledstyle{rm} % will be plugged into the typeface text=ss option \unexpanded\def\do@mathopnolimits #1{\mathop{\mscaledtext{#1}}\nolimits} \unexpanded\def\do@mfunction #1{\mscaledtext{#1}} \unexpanded\def\do@mfunctionlabeltext#1{\mscaledtext{\mathlabeltext{#1}}} \def\setmathfunctionstyle#1% rm ss tt (can be made faster if needed) {\doifsomething{#1} {\def\currentmscaledstyle{#1}% \let\mathopnolimits \do@mathopnolimits \let\mfunction \do@mfunction \let\mfunctionlabeltext\do@mfunctionlabeltext}} \def\mscaledtext#1% {\mathchoice {\hbox{\csname\currentmscaledstyle\endcsname\tf #1}} {\hbox{\csname\currentmscaledstyle\endcsname\tf #1}} {\hbox{\csname\currentmscaledstyle\endcsname\tfx #1}} {\hbox{\csname\currentmscaledstyle\endcsname\tfxx#1}}} %D We can force the way functions are typeset by manipulating the text %D option: %D %D \starttyping %D \definetypeface[iwona][ss][sans][iwona][default][encoding=texnansi] %D \definetypeface[iwona][mm][math][iwona][default][encoding=texnansi,text=ss] %D \stoptyping %D %D This hooks into the math handler with: % no longer supported this way, has to be done with \setupmathematics % % \appendtoks % \setmathfunctionstyle\currentmathtextstyle % \to \everybodyfont %D Usage: %D %D \starttyping %D \setmathfunctionstyle\fontstyle % or {rm} or {ss} or .. %D \rm test $\sin{(x^{\sin(x^{\sin(x)})})}$ test %D \ss test $\sin{(x^{\sin(x^{\sin(x)})})}$ test %D \tt test $\sin{(x^{\sin(x^{\sin(x)})})}$ test %D \stoptyping %D Some goodies: \def\Angstrom{\nomathematics{\Aring}} %D \macros %D {nonknuthmode, donknuthmode} %D %D The underscore is frequently used in manuals but unfortunately \TEX\ prefers %D it to be a math specific character. And since computer modern fonts didn't %D have an underscore, one had to use commands to fake one. Nowadays we do %D have underscores in latin modern, and since all other fonts have them, we %D decided to get away from the restriction to use the underscore character in %D text mode. %D %D \starttyping %D \def\test#1{#1} %D %D \nonknuthmode $x_2$ x_2 \test{$x_2$} \test{x_2} %D %D \donknuthmode $x_2$ x_2 \test{$x_2$} \test{x_2} %D \stoptyping %D %D The result is as expected: the first line typesets ok, while the second %D one triggers an error message. \setnewconstant\activemathcharcode "8000 \newtoks\activatedmathcharacters \def\activatemathcharacter#1% {\appendtoks \global\mathcode#1=\activemathcharcode \to \activatedmathcharacters} \def\activatemathcharacters {\the\activatedmathcharacters} \setnewconstant\primeasciicode 39 % ' \activatemathcharacter\circumflexasciicode \activatemathcharacter\underscoreasciicode \activatemathcharacter\ampersandasciicode \activatemathcharacter\primeasciicode % not used: % % \mathcode\spaceasciicode\activemathcharcode % % not used: % % \bgroup % \catcode\underscoreasciicode\activecatcode % \doglobal\appendtoks % \mathcode\underscoreasciicode\activemathcharcode % \let_\activemathunderscore % \to \everymathematics % \egroup % % plain tex legacy: \bgroup \catcode\primeasciicode\activecatcode \doglobal\appendtoks \let'\domathprime \to \everymathematics \egroup \newtoks\everydonknuthmode \newtoks\everynonknuthmode \newconditional \knuthmode \def\nonknuthmode {\pushcatcodetable \setcatcodetable\ctxcatcodes \the\everynonknuthmode \let\nonknuthmode\relax \popcatcodetable} \def\donknuthmode {\pushcatcodetable \setcatcodetable\ctxcatcodes \the\everydonknuthmode \popcatcodetable} \bgroup \catcode\underscoreasciicode\activecatcode \catcode\circumflexasciicode\activecatcode \catcode\ampersandasciicode \activecatcode \global \everynonknuthmode {\appendtoks \let_\normalsubscript \let^\normalsuperscript \let&\normalmathaligntab % use \def when it's \aligntab \to \everymathematics} \egroup \appendtoks \setfalse\knuthmode \catcode\underscoreasciicode\othercatcode \catcode\circumflexasciicode\othercatcode \catcode\ampersandasciicode \othercatcode \to \everynonknuthmode \appendtoks \settrue\knuthmode \catcode\underscoreasciicode\subscriptcatcode \catcode\circumflexasciicode\superscriptcatcode \catcode\ampersandasciicode \alignmentcatcode \to \everydonknuthmode \appendtoks \startextendcatcodetable\ctxcatcodes \catcode\underscoreasciicode\othercatcode \catcode\circumflexasciicode\othercatcode \catcode\ampersandasciicode \othercatcode \stopextendcatcodetable \to \everynonknuthmode \appendtoks \startextendcatcodetable\ctxcatcodes \catcode\underscoreasciicode\subscriptcatcode \catcode\circumflexasciicode\superscriptcatcode \catcode\ampersandasciicode \alignmentcatcode \stopextendcatcodetable \to \everydonknuthmode % \def\prefermathcatcodes % {\catcode\underscoreasciicode\subscriptcatcode % \catcode\circumflexasciicode\superscriptcatcode % \catcode\ampersandasciicode \alignmentcatcode} %D Even more drastic: \unexpanded\def\asciimode {\catcodetable\txtcatcodes \nonknuthmode} \unexpanded\def\startasciimode {\pushcatcodetable \catcodetable\txtcatcodes \nonknuthmode} \unexpanded\def\stopasciimode {\popcatcodetable \ifconditional\knuthmode\else\donknuthmode\fi} %D Needed for unicode: \def\nulloperator{\mathortext{\mathop{\emptyhbox}}{\emptyhbox}} %D \macros %D {setupmathematics} %D %D Configuration for integrals. (If needed we can speed this up and make it %D installable; no processaction is needed then). \newtoks\everysetupmathematics \unexpanded\def\setupmathematics {\dosingleargument\dosetupmathematics} \def\dosetupmathematics[#1]% {\getparameters[\??mo][#1]% \the\everysetupmathematics} \def\mathematicsparameter#1{\ifcsname\??mo#1\endcsname\csname\??mo#1\endcsname\fi} %D Memory saver: \appendtoks \doifelse{\mathematicsparameter\v!compact}\v!yes {\ctxlua{fonts.vf.math.optional=true}} {\ctxlua{fonts.vf.math.optional=false}}% \to \everysetupmathematics \setupmathematics [\v!compact=no] %D Delayed: greek. %D %D \starttyping %D \usetypescript[cambria]\setupbodyfont[cambria] %D \startTEXpage %D $\alpha \mathgreekupright \alpha \mathgreekitalic \alpha$ %D \stopTEXpage %D \stoptyping % [lc uc] normal (upright) = 2, italic = 3, none = 0/1 \setevalue{\??mo:greek:\v!normal :\v!normal}{\attribute\mathgreekattribute22 } \setevalue{\??mo:greek:\v!normal :\v!italic}{\attribute\mathgreekattribute23 } \setevalue{\??mo:greek:\v!normal :\v!none }{\attribute\mathgreekattribute21 } \setevalue{\??mo:greek:\v!italic :\v!normal}{\attribute\mathgreekattribute32 } \setevalue{\??mo:greek:\v!italic :\v!italic}{\attribute\mathgreekattribute33 } \setevalue{\??mo:greek:\v!italic :\v!none }{\attribute\mathgreekattribute31 } \setevalue{\??mo:greek:\v!none :\v!normal}{\attribute\mathgreekattribute12 } \setevalue{\??mo:greek:\v!none :\v!italic}{\attribute\mathgreekattribute13 } \setevalue{\??mo:greek:\v!none :\v!none }{\attribute\mathgreekattribute\attributeunsetvalue} \appendtoks \csname\??mo:greek:\@@molcgreek:\@@moucgreek\endcsname \to \everymathematics \setupmathematics [lcgreek=\v!italic, ucgreek=\v!normal] % was: none %D \macros %D {enablemathpunctuation,disablemathpunctuation} %D %D \startbuffer %D \enablemathpunctuation$(1,2) (1, 2) (1{,}2) \hbox{foo, not bar}$ %D \stopbuffer %D %D \typebuffer %D %D \blank{\getbuffer}\blank \setfalse \automathpunctuation \def\enablemathpunctuation {\settrue \automathpunctuation} \def\disablemathpunctuation{\setfalse\automathpunctuation} \ifx\v!autopunctuation\undefined \def\v!autopunctuation{autopunctuation} \fi \appendtoks \doifelse{\mathematicsparameter\v!autopunctuation}\v!yes\enablemathpunctuation\disablemathpunctuation \to \everysetupmathematics \appendtoks \ifconditional\automathpunctuation\attribute\mathpunctuationattribute\plusone\fi \to \everymathematics \setupmathematics [\v!autopunctuation=\v!no] %D \macros %D {mathstyle} %D %D If one want to be sure that something is typeset in the %D appropriate style, \type {\mathstyle} can be used: %D %D \starttyping %D \mathstyle{something} %D \stoptyping % \def\mathstyle#1% % {\mathchoice % {\displaystyle #1}% % {\textstyle #1}% % {\scriptstyle #1}% % {\scriptscriptstyle#1}} % % We now have a primitive operation for this. As the % macro overloads a new primitive introduced in \LUATEX, % we need to use \type {\normalmathstyle} when we consult % the current math style. % % \let \mathstyle \Ustack % spoils cramped % % \let \mathstyle \firstofoneargument % % 0 = display % 1 = crampeddisplay % 2 = text % 3 = crampedtext % 4 = script % 5 = crampedscript % 6 = scriptscript % 7 = crampedscriptscript \def\uncramped#1% {{\ifcase\normalmathstyle \or \displaystyle \or \or \textstyle \or \or \scriptstyle \or \or \scriptscriptstyle \fi #1}} \def\cramped#1% {{\ifcase\normalmathstyle \crampeddisplaystyle \or \or % 0 -> 1 \crampedtextstyle \or \or % 2 -> 3 \crampedscriptstyle \or \or % 4 -> 5 \crampedscriptscriptstyle \fi % 6 -> 7 #1}} \def\triggermathstyle#1% #1 is number {\ifcase#1\relax \displaystyle \or \crampeddisplaystyle \or \textstyle \or \crampedtextstyle \or \scriptstyle \or \crampedscriptstyle \or \scriptscriptstyle \or \crampedscriptscriptstyle \else % error \fi} \def\cramped#1% {{\ifcase\normalmathstyle \crampeddisplaystyle \or \or % 0 -> 1 \crampedtextstyle \or \or % 2 -> 3 \crampedscriptstyle \or \or % 4 -> 5 \crampedscriptscriptstyle \fi % 6 -> 7 #1}} \def\mathstylefont#1% #1 is number (\normalmathstyle) {\ifcase#1\relax \textfont \or \textfont \or \textfont \or \textfont \or \scriptfont \or \scriptfont \or \scriptscriptfont \or \scriptscriptfont \else \textfont \fi\zerocount} %D Something similar can be used in the (re|)|definition %D of \type {\text}. This version is a variation on the one %D in the math module (see \type{m-math} and|/|or \type %D {m-newmat}). \unexpanded\def\mathtext {\mathortext\domathtext\hbox} \def\domathtext#1% {\mathchoice {\dodomathtext\displaystyle\textface {#1}}% {\dodomathtext\textstyle \textface {#1}}% {\dodomathtext\textstyle \scriptface {#1}}% {\dodomathtext\textstyle \scriptscriptface{#1}}} \def\dodomathtext#1#2#3% no \everymath ! %{\hbox{\everymath{#1}\switchtobodyfont [#2]#3}} % 15 sec {\hbox{\everymath{#1}\setcurrentfontbody{#2}#3}} % 3 sec (no math) %D Safeguard against redefinitions: \appendtoks \let\_\normalunderscore % is textunderscore or fakeunderscore \to \everymathematics %D Because we may overload \type {\text} in other (structuring) %D macros, we say: \appendtoks \let\text\mathtext \to \everymathematics %D The next code is derived from plain \TEX. \newcount\interdisplaylinepenalty \interdisplaylinepenalty=100 \newif\ifdt@p \def\displ@y {\global\dt@ptrue \openup\displayopenupvalue % was \openup\jot \everycr {\noalign {\ifdt@p \global\dt@pfalse \ifdim\prevdepth>-\thousandpoint \vskip-\lineskiplimit \vskip\normallineskiplimit \fi \else \penalty\interdisplaylinepenalty \fi}}} \let\normaldispl@y\displ@y \def\displ@y{\resetdisplaymatheq\normaldispl@y} \def\m@th{\mathsurround\zeropoint} % obsolete %D Text in math: \def\mathortext {\ifmmode \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} % \defineactivecharacter _ {\mathortext{_}{\_}} text_text $a^2$ % force text mode, will be overloaded later \ifx\text\undefined \let\text\hbox \fi \def\mathoptext#1{\mathop{\text{#1}}} % for a while: \ifnum\luatexversion>65 \def\Umathbotaccent{\Umathaccent bottom } \fi \protect \endinput