diff options
author | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-14 17:38:55 +0000 |
---|---|---|
committer | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-14 17:38:55 +0000 |
commit | 15995e10bfc68edf79970c4ea4fbb6678566c46e (patch) | |
tree | 2de7ca2a83f2d37ef043ad7429a5cb945bb79ddb /Master/texmf-dist/tex/context/base/math-ini.mkiv | |
parent | c9a39f716f1e5ec820ed3aab2c9aef25c5a9d730 (diff) |
ConTeXt 2012.05.14 16:00
git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/math-ini.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/math-ini.mkiv | 940 |
1 files changed, 664 insertions, 276 deletions
diff --git a/Master/texmf-dist/tex/context/base/math-ini.mkiv b/Master/texmf-dist/tex/context/base/math-ini.mkiv index f778afa08c5..710a65f5b36 100644 --- a/Master/texmf-dist/tex/context/base/math-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/math-ini.mkiv @@ -5,7 +5,7 @@ %D subtitle=Initializations, %D author=Hans Hagen, %D date=\currentdate, -%D copyright=PRAGMA] +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for @@ -27,20 +27,26 @@ \unprotect -\ifx\v!compact\undefined \def\v!compact{compact} \fi +\ifdefined\v!autopunctuation \else \def\v!autopunctuation{autopunctuation} \fi +\ifdefined\v!integral \else \def\v!integral {integral} \fi + +\def\s!lcgreek {lcgreek} +\def\s!ucgreek {ucgreek} +\def\s!italics {italics} +\def\s!integral{integral} %D We move these definitions into the format: -% test [[\char948 \ctxlua{tex.sprint(utf.char(948))}]] -% test $[[\char948 \ctxlua{tex.sprint(utf.char(948))}]]$ +% test [[\char948 \cldcontext{utf.char(948)}]] +% test $[[\char948 \cldcontext{utf.char(948)}]]$ \registerctxluafile{math-ini}{1.001} \registerctxluafile{math-dim}{1.001} \registerctxluafile{math-act}{1.001} -\registerctxluafile{math-ent}{1.001} \registerctxluafile{math-ext}{1.001} \registerctxluafile{math-vfu}{1.001} \registerctxluafile{math-map}{1.001} +\registerctxluafile{math-ren}{1.001} \registerctxluafile{math-noa}{1.001} \registerctxluafile{math-tag}{1.001} @@ -49,52 +55,133 @@ \definesystemattribute[mathpunctuation][public] \definesystemattribute[mathgreek] [public] \definesystemattribute[mathalternate] [public] +\definesystemattribute[mathrendering] [public] +\definesystemattribute[mathcategory] [public] +\definesystemattribute[mathmode] [public] +\definesystemattribute[mathitalics] [public] -% experiment +\appendtoks + \attribute\mathmodeattribute\plusone +\to \everydisplay -% Normally this is applied to only one character. +\appendtoks + \attribute\mathmodeattribute\plusone +\to \everybeforedisplayformula + +\setnewconstant\defaultmathfamily \zerocount % 255 + +%D Some measures (maybe spac-mth): + +% \def\mathskipsmall {\mskip\thinmuskip} +% \def\mathskipmedium{\mskip\medmuskip} +% \def\mathskipbig {\mskip\thickmuskip} + +%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 % -% $ABC$ $\cal ABC$ $\mathaltcal ABC$ +% \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} + +\installcorenamespace{mathematics} + +\installswitchcommandhandler \??mathematics {mathematics} \??mathematics + +\unexpanded\def\startmathematics % no grouping, if ever then also an optional second + {\doifnextoptionalelse\math_mathematics_start_yes\math_mathematics_start_nop} + +\unexpanded\def\math_mathematics_start_yes[#1]% + {\pushmacro\currentmathematics + \edef\currentmathematics{#1}% check for valid + \the\everyswitchmathematics} -\def\mathalternate#1{\ctxlua{mathematics.setalternate(0,"#1")}} % fam 0 +\unexpanded\def\math_mathematics_start_nop + {\pushmacro\currentmathematics + \let\currentmathematics\empty + \the\everyswitchmathematics} -\def\mathaltcal{\mathalternate{cal}\cal} % ss01 in xits +\unexpanded\def\stopmathematics + {\popmacro\currentmathematics + \the\everyswitchmathematics} + +\definemathematics[\v!default] % not needed, but nicer when nesting back to normal + +% Normally this is applied to only one character. +% +% $ABC$ $\cal ABC$ $\mathaltcal ABC$ % todo: only in mmode -\unexpanded\def\mathgreekupright{\attribute\mathgreekattribute22 } -\unexpanded\def\mathgreekitalic {\attribute\mathgreekattribute33 } -\unexpanded\def\mathgreekdefault{\attribute\mathgreekattribute\attributeunsetvalue} +\unexpanded\def\mathgreekupright{\attribute\c_math_greek_attribute22 } +\unexpanded\def\mathgreekitalic {\attribute\c_math_greek_attribute33 } +\unexpanded\def\mathgreekdefault{\attribute\c_math_greek_attribute\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\setmathattribute#1#2{\ifmmode\ctxcommand{setmathattribute("#1","#2")}\fi} +\unexpanded\def\setmathalphabet #1{\ifmmode\ctxcommand{setmathalphabet("#1")}\fi} +\unexpanded\def\setmathstyle #1{\ifmmode\ctxcommand{setmathstyle("#1")}\fi} +\unexpanded\def\setmathalternate #1{\ifmmode\ctxcommand{setmathalternate(\number\defaultmathfamily,"#1")}\fi} -\unexpanded\def\mr {\setmathattribute{regular}{tf}} +\installcorenamespace{mathstylealternate} % might become a setuphandler -\unexpanded\def\mathdefault {\setmathattribute{regular}{it}} -\unexpanded\def\mathscript {\setmathalphabet{script}} -\unexpanded\def\mathfraktur {\setmathalphabet{fraktur}} -\unexpanded\def\mathblackboard{\setmathalphabet{blackboard}} +\unexpanded\def\setmathstylealterternate#1% + {\ifcsname\??mathstylealternate\fontclass:#1\endcsname + \expandafter\setmathalternate\csname\??mathstylealternate\fontclass:#1\endcsname + \else\ifcsname\??mathstylealternate#1\endcsname + \expandafter\setmathalternate\csname\??mathstylealternate#1\endcsname + \fi\fi} -\unexpanded\def\mathrm{\setmathattribute{rm}{tf}} -\unexpanded\def\mathss{\setmathattribute{ss}{tf}} -\unexpanded\def\mathtt{\setmathattribute{tt}{tf}} +\unexpanded\def\setupmathrendering % the name might change + {\dodoubleargument\math_setup_rendering} -\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}} +\def\math_setup_rendering[#1][#2]% + {\ifsecondargument + \getparameters[\??mathstylealternate#1:][#2]% + \else + \getparameters[\??mathstylealternate][#1]% + \fi} + +\unexpanded\def\mathaltcal{\setmathalternate{cal}\cal} % ss01 in xits + +\let\mathalternate\setmathalternate % obsolete + +\unexpanded\def\mr {\setmathattribute\s!regular\s!tf\setmathstylealterternate\s!tf} + +\unexpanded\def\mathdefault {\setmathattribute\s!regular\s!it\setmathstylealterternate\s!it} +\unexpanded\def\mathscript {\setmathalphabet \s!script \setmathstylealterternate\s!script} +\unexpanded\def\mathfraktur {\setmathalphabet \s!fraktur \setmathstylealterternate\s!fraktur} +\unexpanded\def\mathblackboard{\setmathalphabet \s!blackboard \setmathstylealterternate\s!blackboard} + +\unexpanded\def\mathrm {\setmathattribute\s!rm\s!tf \setmathstylealterternate\s!tf} +\unexpanded\def\mathss {\setmathattribute\s!ss\s!tf \setmathstylealterternate\s!tf} +\unexpanded\def\mathtt {\setmathattribute\s!tt\s!tf \setmathstylealterternate\s!tf} + +\unexpanded\def\mathtf {\setmathstyle\s!tf \setmathstylealterternate\s!tf} +\unexpanded\def\mathsl {\setmathstyle\s!it \setmathstylealterternate\s!it} % no sl +\unexpanded\def\mathit {\setmathstyle\s!it \setmathstylealterternate\s!it} + +\unexpanded\def\mathbf {\setmathstyle\s!bf \setmathstylealterternate\s!bf} +\unexpanded\def\mathbs {\setmathstyle\s!bi \setmathstylealterternate\s!bi} % no sl +\unexpanded\def\mathbi {\setmathstyle\s!bi \setmathstylealterternate\s!bi} \let\tfmath\mathtf % maybe a grouped command -\let\bfmath\mathbf \let\slmath\mathsl \let\itmath\mathit + +\let\bfmath\mathbf \let\bsmath\mathbs \let\bimath\mathbi @@ -113,14 +200,6 @@ \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} @@ -134,13 +213,41 @@ \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 We could set the rendering attribute at the \LUA\ end but as there +%D can be many small math snippets we keep track of the state at the +%D \TEX\ end (mapping is export safe). +%D +%D \starttyping +%D \startformula +%D \reals {\mathbf R} \utfchar{"0211D} \utfchar{"1D411} +%D \stopformula +%D +%D \setupmathematics +%D [symbolset=blackboard-to-bold] +%D +%D \startformula +%D \reals {\mathbf R} \utfchar{"0211D} \utfchar{"1D411} +%D \stopformula +%D \stoptyping + +\newcount\c_math_renderings_attribute + +\appendtoks + \c_math_renderings_attribute\ctxcommand{mathrenderset("\mathematicsparameter\c!symbolset")}\relax +\to \everysetupmathematics % only in mathematics + +\appendtoks + \ifcase\c_math_renderings_attribute\else + \attribute\mathrenderingattribute\c_math_renderings_attribute + \fi +\to \everymathematics + +\setupmathematics + [\c!symbolset=] + %D \macros %D {boldsymbol} %D @@ -148,93 +255,84 @@ \let\mathboldsymbol\relax % yet unsupported, will be -\def\boldsymbol +\unexpanded\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} +\def\utfmathclass #1{\ctxcommand{utfmathclass (\!!bs#1\!!es)}} +\def\utfmathstretch#1{\ctxcommand{utfmathstretch(\!!bs#1\!!es)}} +\def\utfmathcommand#1{\ctxcommand{utfmathcommand(\!!bs#1\!!es)}} +\def\utfmathfiller #1{\ctxcommand{utfmathfiller (\!!bs#1\!!es)}} + +%D Not used that much: + +\installcorenamespace{mathcodecommand} + +\unexpanded\def\mathlimop #1{\mathop{#1}} %no \limits +\unexpanded\def\mathbox #1{\dontleavehmode\hbox\Ustartmath\mathsurround\zeropoint#1\Ustopmath} +\unexpanded\def\mathnolop #1{\mathop{#1}\nolimits} + +\let\mathnothing\firstofoneunexpanded +\let\mathalpha \firstofoneunexpanded + +\setnewconstant\mathordcode \zerocount \letvalue{\??mathcodecommand ord}\mathord +\setnewconstant\mathopcode \plusone \letvalue{\??mathcodecommand op}\mathop +\setnewconstant\mathbincode \plustwo \letvalue{\??mathcodecommand bin}\mathbin +\setnewconstant\mathrelcode \plusthree \letvalue{\??mathcodecommand rel}\mathrel +\setnewconstant\mathopencode \plusfour \letvalue{\??mathcodecommand open}\mathopen +\setnewconstant\mathclosecode \plusfive \letvalue{\??mathcodecommand close}\mathclose +\setnewconstant\mathpunctcode \plussix \letvalue{\??mathcodecommand punct}\mathpunct +\setnewconstant\mathalphacode \plusseven \letvalue{\??mathcodecommand alpha}\mathalpha +\setnewconstant\mathinnercode \zerocount \letvalue{\??mathcodecommand inner}\mathinner +\setnewconstant\mathnothingcode \zerocount \letvalue{\??mathcodecommand nothing}\mathnothing +\setnewconstant\mathlimopcode \plusone \letvalue{\??mathcodecommand limop}\mathlimop +\setnewconstant\mathnolopcode \plusone \letvalue{\??mathcodecommand nolop}\mathnolop +\setnewconstant\mathboxcode \zerocount \letvalue{\??mathcodecommand box}\mathbox +\setnewconstant\mathchoicecode \zerocount %letvalue{\??mathcodecommand choice}\mathnothing + +\setnewconstant\mathaccentcode \pluseight +\setnewconstant\mathradicalcode \plusnine + + \def\mathcodenumber #1{\the\csname math#1code\endcsname} +\unexpanded\def\mathcodecommand#1{\csname\??mathcodecommand#1\endcsname} % \startlines % $\mathopnolimits{\rm d}x$ % $\mathopnolimits{\kern\zeropoint \rm d}x$ -% $\puremathcomm{nolop}{\rm d}x$ -% $\puremathcomm{nolop}{\kern\zeropoint\rm d}x$ +% $\mathcodecommand{nolop}{\rm d}x$ +% $\mathcodecommand{nolop}{\kern\zeropoint\rm d}x$ % \blank -% $\puremathcomm{nolop}{\mr d}x$ -% $\puremathcomm{nolop}{\kern\zeropoint\mr d}x$ +% $\mathcodecommand{nolop}{\mr d}x$ +% $\mathcodecommand{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]{} + +\installcorenamespace{mathcommand} \unexpanded\def\definemathcommand - {\dotripleempty\dodefinemathcommand} + {\dotripleempty\math_define_command} -\def\dodefinemathcommand[#1][#2][#3]#4% command class args meaning +\def\math_define_command[#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}}}]% + \edef\nofmathcommandarguments{#3}% + \ifx\nofmathcommandarguments\v!one + \setuvalue{\??mathcommand#1}##1{\mathcodecommand{#2}{#4{##1}}}% + \else\ifx\nofmathcommandarguments\v!two + \setuvalue{\??mathcommand#1}##1##2{\mathcodecommand{#2}{#4{##1}{##2}}}% + \else + \setuvalue{\??mathcommand#1}{\mathcodecommand{#2}{#4}}% + \fi\fi \else\ifsecondargument - \setuvalue{#1}{\puremathcomm{#2}{#4}}% + \setuvalue{\??mathcommand#1}{\mathcodecommand{#2}{#4}}% \else - \setuvalue{#1}{\puremathcomm{nothing}{#4}}% - \fi\fi} + \setuvalue{\??mathcommand#1}{\mathcodecommand{nothing}{#4}}% + \fi\fi + \letcsnamecsname\csname#1\endcsname\csname\??mathcommand#1\endcsname} + +\unexpanded\def\mathcommand#1% + {\csname\??mathcommand#1\endcsname} %D Moved from font-ini.mkiv: %D @@ -252,27 +350,84 @@ {\normalmathop \bgroup \let\rm\mf - \let\next=} + \let\nexttoken=} + +% this one too: \letvalue{\??mathcodecommand op}\mathop ? -\def\normalmbox +\unexpanded\def\normalmbox {\normalhbox\bgroup\mf - \dowithnextbox{\flushnextbox\egroup}\normalhbox} + \dowithnextboxcs\math_mbox_finish\normalhbox} + +\def\math_mbox_finish + {\flushnextbox + \egroup} -\def\mbox % we cannot add \dontleavehmode ... else no \setbox0\mbox possible +\unexpanded\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} + {\appendtoks\math_enable_mbox\to \everymathematics} + {\everymathematics\expandafter{\the\everymathematics\math_enable_mbox}} + +\def\math_enable_mbox + {\ifdefined\normalhbox\else\let\normalhbox\hbox\fi % ? + \let\hbox\mbox} + +%D The next hack is needed needed for sine, cosine etc. + +\let\mathfunction\firstofoneunexpanded + +\let\math_tags_function \firstofoneunexpanded +\let\math_tags_functionlabeltext\mathlabeltext + +\let\math_tags_mo\firstofoneunexpanded +\let\math_tags_mi\firstofoneunexpanded + +\unexpanded\def\math_tags_mn#1{\begingroup\mr#1\endgroup} +\unexpanded\def\math_tags_ms#1{\begingroup\mr#1\endgroup} -%D needed for sin, cos etc +\unexpanded\def\mfunction #1{{\mr\math_tags_function{#1}}} +\unexpanded\def\mfunctionlabeltext#1{{\mr\math_tags_functionlabeltext{#1}}} -\let\mathfunction\firstofoneargument +% Once this is stable we can store the number at the tex end which is +% faster. Functions getnumbers >= 1000. + +\expanded\def\math_tags_mathfunction_indeed #1{\ctxcommand{taggedmathfunction("#1",false,\ifconditional\c_apply_function true\else false\fi)}} +\expanded\def\math_tags_mathfunctionlabeltext_indeed#1{\ctxcommand{taggedmathfunction("#1",true ,\ifconditional\c_apply_function true\else false\fi)}} + +\expanded\def\math_tags_mo_indeed#1{\begingroup \attribute\mathcategoryattribute\plusone #1\endgroup} +\expanded\def\math_tags_mi_indeed#1{\begingroup \attribute\mathcategoryattribute\plustwo #1\endgroup} +\expanded\def\math_tags_mn_indeed#1{\begingroup\mr\attribute\mathcategoryattribute\plusthree#1\endgroup} +\expanded\def\math_tags_ms_indeed#1{\begingroup\mr\attribute\mathcategoryattribute\plusfour #1\endgroup} + +\newconditional\c_apply_function + +\unexpanded\def\math_tags_apply#1#2% + {\begingroup + \settrue\c_apply_function + #1% + \endgroup + \begingroup + % todo: auto () + #2% + \endgroup} + +\appendtoks + \let\math_tags_function \math_tags_mathfunction_indeed + \let\math_tags_functionlabeltext\math_tags_mathfunctionlabeltext_indeed + \let\math_tags_mo \math_tags_mo_indeed + \let\math_tags_mi \math_tags_mi_indeed + \let\math_tags_mn \math_tags_mn_indeed + \let\math_tags_ms \math_tags_ms_indeed +\to \everyenableelements -\def\mfunction #1{{\mr#1}} -\def\mfunctionlabeltext#1{{\mr\mathlabeltext{#1}}} +\appendtoks + \let\mo \math_tags_mo + \let\mi \math_tags_mi + \let\mn \math_tags_mn + \let\ms \math_tags_ms + \let\apply\math_tags_apply +\to\everymathematics % \def\mlimitsfunction #1{\mathlimopcomm{{\mr#1}} % \def\mnolimitsfunction#1{\mathnolopcomm{{\mr#1}} @@ -282,18 +437,18 @@ \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}}} +\unexpanded\def\math_function_style_opnolimits #1{\mathop{\mscaledtext{#1}}\nolimits} +\unexpanded\def\math_function_style_mfunction #1{\mscaledtext{\math_tags_function{#1}}} +\unexpanded\def\math_function_style_mfunctionlabeltext#1{\mscaledtext{\math_tags_functionlabeltext{#1}}} -\def\setmathfunctionstyle#1% rm ss tt (can be made faster if needed) +\unexpanded\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}} + \let\mathopnolimits \math_function_style_opnolimits + \let\mfunction \math_function_style_mfunction + \let\mfunctionlabeltext\math_function_style_mfunctionlabeltext}} -\def\mscaledtext#1% +\unexpanded\def\mscaledtext#1% {\mathchoice {\hbox{\csname\currentmscaledstyle\endcsname\tf #1}} {\hbox{\csname\currentmscaledstyle\endcsname\tf #1}} @@ -327,7 +482,7 @@ %D Some goodies: -\def\Angstrom{\nomathematics{\Aring}} +\unexpanded\def\Angstrom{\nomathematics{\Aring}} %D \macros %D {nonknuthmode, donknuthmode} @@ -362,7 +517,7 @@ \def\activatemathcharacters {\the\activatedmathcharacters} -\setnewconstant\primeasciicode 39 % ' +% \setnewconstant\primeasciicode 39 % ' \activatemathcharacter\circumflexasciicode \activatemathcharacter\underscoreasciicode @@ -382,33 +537,108 @@ % \let_\activemathunderscore % \to \everymathematics % \egroup + +% Here follows some plain legacy: primes. % -% plain tex legacy: +% The \let\prime\math_prime_indeed might become an obsolete as we have +% \doubleprime and \tripleprime and collapsing can nicely handle the +% script then. +% +% Collapsing to 0x2033 and 0x2034 happens elsewhere. -\bgroup - \catcode\primeasciicode\activecatcode - \doglobal\appendtoks - \let'\domathprime - \to \everymathematics -\egroup +% \switchtobodyfont[modern] +% \switchtobodyfont[cambria] +% \switchtobodyfont[xits] +% \switchtobodyfont[minion] +% \setupbodyfont[dejavu] +% +% \startbuffer +% \def\SampleLine#1{% +% \NC#1 +% \NC\switchtobodyfont[#1]$f^2$ % 1 +% \NC\switchtobodyfont[#1]$f\prime^2$ % 2 +% \NC\switchtobodyfont[#1]$f\prime\prime^2$ % 3 +% \NC\switchtobodyfont[#1]$f\prime\prime\prime^2$ % 4 +% \NC\switchtobodyfont[#1]$f{\prime}^2$ % 5 +% \NC\switchtobodyfont[#1]$f{\prime\prime}^2$ % 6 +% \NC\switchtobodyfont[#1]$f{\prime\prime\prime}^2$ % 7 +% \NC\switchtobodyfont[#1]$f'(x)$ % 8 +% \NC\switchtobodyfont[#1]$f''(x)$ % 9 +% \NC\switchtobodyfont[#1]$f'''(x)$ % 10 +% \NC\NR +% } +% +% \starttabulate[|Tl|Tc|Tc|Tc|Tc|Tc|Tc|Tc|Tc|Tc|Tc|] +% \NC\NC1\NC2\NC3\NC4\NC5\NC6\NC7\NC8\NC9\NC10\NC\NR +% \SampleLine{modern} +% \SampleLine{cambria} +% \SampleLine{xits} +% \SampleLine{minion} +% \stoptabulate +% \stopbuffer +% +% \typebuffer \getbuffer -\newtoks\everydonknuthmode -\newtoks\everynonknuthmode +% most math fonts have messed up primes, just test this: $\prime^{\prime^{\prime}}$ -\newconditional \knuthmode +{ \catcode\circumflexasciicode\othercatcode \global\let\othercircumflextoken ^ } +{ \catcode\circumflexasciicode\superscriptcatcode \global\let\superscriptcircumflextoken^ } -\def\nonknuthmode - {\pushcatcodetable - \setcatcodetable\ctxcatcodes - \the\everynonknuthmode - \let\nonknuthmode\relax - \popcatcodetable} +\ifdefined \prime \else + \Umathchardef\prime "0 "0 "2032 +\fi -\def\donknuthmode - {\pushcatcodetable - \setcatcodetable\ctxcatcodes - \the\everydonknuthmode - \popcatcodetable} +\let\math_prime_indeed_normal\prime + +\appendtoks + \let\math_prime_indeed_normal\prime % gets defined later + \let\mathfontprime\prime % for tracing + \let\prime\math_prime_indeed % so this is needed +\to \everydump + +\unexpanded\def\math_prime_indeed + {\iffontchar\textfont\zerocount"FE325\relax + ^\bgroup + \expandafter\math_prime_indeed_virtual % virtual mess (using funny signal) + \else +% \expandafter\math_prime_indeed_normal % gets collapsed + \expandafter\math_prime_indeed_crapped % gets collapsed + \fi} + +\def\math_prime_indeed_crapped + {{^{\math_prime_indeed_normal}}} + +\let\prime\math_prime_indeed + +\def\math_prime_indeed_virtual + {\math_prime_indeed_normal + \futurelet\nexttoken\math_prime_indeed_choice} + +\installcorenamespace{mathprime} + +\def\math_prime_indeed_choice + {\csname\??mathprime + \ifx '\nexttoken a\else + \ifx \math_prime_indeed_normal\nexttoken a\else + \ifx \prime\nexttoken a\else + \ifx\superscriptcircumflextoken\nexttoken b\else + \ifx\othercircumflextoken \nexttoken b\else + c\fi\fi\fi\fi\fi + \endcsname} + +\setvalue{\??mathprime a}#1{\math_prime_indeed_virtual} +\setvalue{\??mathprime b}#1#2{#2\egroup} +\setvalue{\??mathprime c}{\egroup} + +\let\activemathprime\math_prime_indeed + +\bgroup + + \catcode\primeasciicode\activecatcode + + \global\everymathematics\expandafter{\the\everymathematics\let'\math_prime_indeed} % todo: do this at the lua end + +\egroup \bgroup @@ -416,95 +646,146 @@ \catcode\circumflexasciicode\activecatcode \catcode\ampersandasciicode \activecatcode - \global \everynonknuthmode {\appendtoks - \let_\normalsubscript - \let^\normalsuperscript - \let&\normalmathaligntab % use \def when it's \aligntab - \to \everymathematics} + \doglobal \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 +\newtoks\everydonknuthmode +\newtoks\everynonknuthmode -\appendtoks - \startextendcatcodetable\ctxcatcodes - \catcode\underscoreasciicode\othercatcode - \catcode\circumflexasciicode\othercatcode - \catcode\ampersandasciicode \othercatcode - \stopextendcatcodetable -\to \everynonknuthmode +\newconditional \knuthmode -\appendtoks - \startextendcatcodetable\ctxcatcodes - \catcode\underscoreasciicode\subscriptcatcode - \catcode\circumflexasciicode\superscriptcatcode - \catcode\ampersandasciicode \alignmentcatcode - \stopextendcatcodetable -\to \everydonknuthmode +\let\nonknuthmode\relax +\let\donknuthmode\relax -% \def\prefermathcatcodes -% {\catcode\underscoreasciicode\subscriptcatcode -% \catcode\circumflexasciicode\superscriptcatcode -% \catcode\ampersandasciicode \alignmentcatcode} +% \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 + +%D Even more drastic (this code will move as nonknuthmode is default now) + +% \unexpanded\def\enableasciimode +% {\ctxlua{resolvers.macros.enablecomment()}% +% \glet\enableasciimode\relax} +% +% \unexpanded\def\asciimode +% {\catcodetable\txtcatcodes +% \enableasciimode +% \nonknuthmode} +% +% \unexpanded\def\startasciimode +% {\pushcatcodetable +% \catcodetable\txtcatcodes +% \enableasciimode +% \nonknuthmode} +% +% \unexpanded\def\stopasciimode +% {\popcatcodetable +% \ifconditional\knuthmode\else\donknuthmode\fi} -%D Even more drastic: +\unexpanded\def\enableasciimode + {\ctxlua{resolvers.macros.enablecomment()}% + \glet\enableasciimode\relax} \unexpanded\def\asciimode {\catcodetable\txtcatcodes - \nonknuthmode} + \enableasciimode} \unexpanded\def\startasciimode {\pushcatcodetable \catcodetable\txtcatcodes - \nonknuthmode} + \enableasciimode} \unexpanded\def\stopasciimode - {\popcatcodetable - \ifconditional\knuthmode\else\donknuthmode\fi} + {\popcatcodetable} %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 +%D Memory saver: -\unexpanded\def\setupmathematics - {\dosingleargument\dosetupmathematics} +\appendtoks + \ifx\currentmathematics\empty + \doifelse{\mathematicsparameter\c!compact}\v!yes\enabledirectives\disabledirectives[math.virtual.optional]% + \fi +\to \everysetupmathematics -\def\dosetupmathematics[#1]% - {\getparameters[\??mo][#1]% - \the\everysetupmathematics} +\setupmathematics + [\c!compact=no] -\def\mathematicsparameter#1{\ifcsname\??mo#1\endcsname\csname\??mo#1\endcsname\fi} +%D Arabic: -%D Memory saver: +\newconditional\c_math_right_to_left \appendtoks - \doifelse{\mathematicsparameter\v!compact}\v!yes - {\ctxlua{fonts.handlers.vf.math.optional=true}} - {\ctxlua{fonts.handlers.vf.math.optional=false}}% -\to \everysetupmathematics + \doifelse{\mathematicsparameter\c!align}{r2l}\settrue\setfalse\c_math_right_to_left +\to \everyswitchmathematics -\setupmathematics - [\v!compact=no] +\unexpanded\def\math_basics_synchronize_direction + {\mathdir T\ifconditional\c_math_right_to_left R\else L\fi T} + +\appendtoks + \math_basics_synchronize_direction +%to \everymathematics % comes too late and I'm not in the mood for a mixed mode kludge now +\to \everyswitchmathematics %D Delayed: greek. %D @@ -517,25 +798,86 @@ % [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 } +% We can move the setting to the lua end and use abstract numbers instead +% if funny ones here. + +\installcorenamespace{mathgreek} -\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 } +\newconstant\c_math_greek_attribute -\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} +\setvalue{\??mathgreek\v!normal :\v!normal}{22} +\setvalue{\??mathgreek\v!normal :\v!italic}{23} +\setvalue{\??mathgreek\v!normal :\v!none }{21} + +\setvalue{\??mathgreek\v!italic :\v!normal}{32} +\setvalue{\??mathgreek\v!italic :\v!italic}{33} +\setvalue{\??mathgreek\v!italic :\v!none }{31} + +\setvalue{\??mathgreek\v!none :\v!normal}{12} +\setvalue{\??mathgreek\v!none :\v!italic}{13} +\letvalue{\??mathgreek\v!none :\v!none }\attributeunsetvalue + +\appendtoks + \edef\p_lcgreek_ucgreek{\mathematicsparameter\s!lcgreek:\mathematicsparameter\s!ucgreek}% + \c_math_greek_attribute\csname\??mathgreek + \ifcsname\??mathgreek\p_lcgreek_ucgreek\endcsname\p_lcgreek_ucgreek\else\v!none\fi + \endcsname\relax +\to \everyswitchmathematics + +\appendtoks + \attribute\mathgreekattribute\c_math_greek_attribute +\to \everymathematics + +\setupmathematics + [\s!lcgreek=\v!italic, + \s!ucgreek=\v!normal] % was: none + +%D Math italics (experiment) + +% we need keys + +\installcorenamespace{mathitalics} + +\setnewconstant\c_math_italics_attribute\attributeunsetvalue + +\letvalue{\??mathitalics 1}\plusone % fontitalics +\letvalue{\??mathitalics 2}\plustwo % fontdata +\letvalue{\??mathitalics 3}\plusthree % quad based +\letvalue{\??mathitalics 4}\plusfour % combination of 1 and 3 +\letvalue{\??mathitalics\v!none}\attributeunsetvalue + +\def\math_italics_initialize + {\ifnum\c_math_italics_attribute=\attributeunsetvalue \else + \ctxcommand{setmathitalics()}% one time + \global\let\math_italics_initialize\relax + \fi} \appendtoks - \csname\??mo:greek:\@@molcgreek:\@@moucgreek\endcsname + \edef\p_italics{\mathematicsparameter\s!italics}% + \c_math_italics_attribute\csname\??mathitalics + \ifcsname\??mathitalics\p_italics\endcsname\p_italics\else\v!none\fi + \endcsname\relax + \math_italics_initialize +\to \everyswitchmathematics % only in mathematics + +\appendtoks + \attribute\mathitalicsattribute\c_math_italics_attribute \to \everymathematics \setupmathematics - [lcgreek=\v!italic, - ucgreek=\v!normal] % was: none + [\s!italics=] + +% looks nicer but can generate bogus csnames +% +% \setvalue{\??mathitalics1}{\math_italics_initialize\c_math_italics_attribute\plusone } % fontitalics +% \setvalue{\??mathitalics2}{\math_italics_initialize\c_math_italics_attribute\plustwo } % fontdata +% \setvalue{\??mathitalics3}{\math_italics_initialize\c_math_italics_attribute\plusthree} % quad based +% \setvalue{\??mathitalics4}{\math_italics_initialize\c_math_italics_attribute\plusfour } % combination of 1 and 3 +% +% \appendtoks +% \c_math_italics_attribute\attributeunsetvalue +% \csname\??mathitalics\mathematicsparameter\s!italics\endcsname +% \to \everyswitchmathematics % only in mathematics %D \macros %D {enablemathpunctuation,disablemathpunctuation} @@ -548,16 +890,14 @@ %D %D \blank{\getbuffer}\blank -\setfalse \automathpunctuation - -\def\enablemathpunctuation {\settrue \automathpunctuation} -\def\disablemathpunctuation{\setfalse\automathpunctuation} +\newconditional\automathpunctuation -\ifx\v!autopunctuation\undefined \def\v!autopunctuation{autopunctuation} \fi +\unexpanded\def\enablemathpunctuation {\settrue \automathpunctuation} +\unexpanded\def\disablemathpunctuation{\setfalse\automathpunctuation} \appendtoks - \doifelse{\mathematicsparameter\v!autopunctuation}\v!yes\enablemathpunctuation\disablemathpunctuation -\to \everysetupmathematics + \doifelse{\mathematicsparameter\v!autopunctuation}\v!yes\settrue\setfalse\automathpunctuation +\to \everyswitchmathematics \appendtoks \ifconditional\automathpunctuation\attribute\mathpunctuationattribute\plusone\fi @@ -565,7 +905,7 @@ \setupmathematics [\v!autopunctuation=\v!no] - + %D \macros %D {mathstyle} %D @@ -630,14 +970,6 @@ % 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 @@ -651,22 +983,59 @@ \textfont \fi\zerocount} +%D A plain inheritance: + +\def\mathpalette#1#2% + {\mathchoice + {#1\displaystyle {#2}}% + {#1\textstyle {#2}}% + {#1\scriptstyle {#2}}% + {#1\scriptscriptstyle{#2}}} + +%D Often we can use: +%D +%D \startbuffer +%D $x^{\mathstylehbox{x^{\mathstylehbox{x}}}}$ +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +\unexpanded\def\mathstylehbox#1% + {\normalexpanded{\hbox\bgroup + $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup} + +\unexpanded\def\mathstylevbox#1% + {\normalexpanded{\vbox\bgroup + $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup} + +\unexpanded\def\mathstylevcenter#1% + {\normalexpanded{\vcenter\bgroup + $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup} + +\unexpanded\def\mathstylevcenteredhbox#1% + {\normalexpanded{\vcenter\bgroup\hbox\bgroup + $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup\egroup} + +\unexpanded\def\mathstylevcenteredvbox#1% + {\normalexpanded{\vcenter\bgroup\vbox\bgroup + $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup\egroup} + %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} + {\mathortext\math_text_choice\hbox} -\def\domathtext#1% +\def\math_text_choice#1% {\mathchoice - {\dodomathtext\displaystyle\textface {#1}}% - {\dodomathtext\textstyle \textface {#1}}% - {\dodomathtext\textstyle \scriptface {#1}}% - {\dodomathtext\textstyle \scriptscriptface{#1}}} + {\math_text_choice_indeed\displaystyle\textface {#1}}% + {\math_text_choice_indeed\textstyle \textface {#1}}% + {\math_text_choice_indeed\textstyle \scriptface {#1}}% + {\math_text_choice_indeed\textstyle \scriptscriptface{#1}}} -\def\dodomathtext#1#2#3% no \everymath ! +\def\math_text_choice_indeed#1#2#3% no \everymath ! %{\hbox{\everymath{#1}\switchtobodyfont [#2]#3}} % 15 sec {\hbox{\everymath{#1}\setcurrentfontbody{#2}#3}} % 3 sec (no math) @@ -681,36 +1050,57 @@ \appendtoks \let\text\mathtext \to \everymathematics -%D The next code is derived from plain \TEX. +%D The next code is derived from plain \TEX. The names will change! -\newcount\interdisplaylinepenalty \interdisplaylinepenalty=100 +\newcount\interdisplaylinepenalty \interdisplaylinepenalty\plushundred -\newif\ifdt@p +% Actually, not using an if saves one macro so there is no penalty +% for splitting up this macro. +% +% \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}}} + +\newtoks\mathdisplayaligntweaks + +\appendtoks + \resetdisplaymatheq % moved to here +\to \mathdisplayaligntweaks -\def\displ@y - {\global\dt@ptrue +\unexpanded\def\math_display_align_hack % I don't like the global, maybe we should push and pop + {\global\let\math_display_align_hack_indeed\math_display_align_hack_remove_skip \openup\displayopenupvalue % was \openup\jot - \everycr - {\noalign - {\ifdt@p - \global\dt@pfalse - \ifdim\prevdepth>-\thousandpoint - \vskip-\lineskiplimit - \vskip\normallineskiplimit - \fi - \else - \penalty\interdisplaylinepenalty - \fi}}} + \everycr{\noalign{\math_display_align_hack_indeed}}} -\let\normaldispl@y\displ@y +\def\math_display_align_hack_remove_skip + {\ifdim\prevdepth>-\thousandpoint + \vskip\dimexpr-\lineskiplimit+\normallineskiplimit\relax + \fi + \global\let\math_display_align_hack_indeed\math_display_align_hack_insert_penalty} -\def\displ@y{\resetdisplaymatheq\normaldispl@y} +\def\math_display_align_hack_insert_penalty + {\penalty\interdisplaylinepenalty} -\def\m@th{\mathsurround\zeropoint} % obsolete +\appendtoks + \math_display_align_hack +\to \mathdisplayaligntweaks %D Text in math: -\def\mathortext +\unexpanded\def\mathortext {\ifmmode \expandafter\firstoftwoarguments \else @@ -721,14 +1111,12 @@ % force text mode, will be overloaded later -\ifx\text\undefined \let\text\hbox \fi +\ifdefined\text\else \let\text\hbox \fi -\def\mathoptext#1{\mathop{\text{#1}}} +\unexpanded\def\mathoptext#1{\mathop{\text{#1}}} % for a while: -\ifnum\luatexversion>65 - \def\Umathbotaccent{\Umathaccent bottom } -\fi +\def\Umathbotaccent{\Umathaccent bottom } \protect \endinput |