summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/math-ali.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/math-ali.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/math-ali.mkiv805
1 files changed, 331 insertions, 474 deletions
diff --git a/Master/texmf-dist/tex/context/base/math-ali.mkiv b/Master/texmf-dist/tex/context/base/math-ali.mkiv
index f83619a2271..94800b3ba8b 100644
--- a/Master/texmf-dist/tex/context/base/math-ali.mkiv
+++ b/Master/texmf-dist/tex/context/base/math-ali.mkiv
@@ -5,7 +5,7 @@
%D subtitle=Math Alignments,
%D author={Hans Hagen, Taco Hoekwater \& Aditya Mahajan},
%D date=\currentdate,
-%D copyright=PRAGMA-ADE / Hans Hagen]
+%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
@@ -15,8 +15,20 @@
\unprotect
+% helpers .. will move
+
+\def\doxxdoubleempty#1#2%
+ {\ifx#2[\expandafter\dodoxxdoubleempty\else\expandafter\noxxdoubleempty\fi#1#2}
+
+\def\dodoxxdoubleempty#1[#2]#3%
+ {\ifx#3[\else\expandafter\nonoxxdoubleempty\fi#1[#2]#3}
+
+\def\noxxdoubleempty #1{#1[][]}
+\def\nonoxxdoubleempty#1[#2]{#1[#2][]}
+
%D The code here has been moved from other files. Beware: the \MKII\ and
-%D \MKIV\ code is not gathered in files with the same name.
+%D \MKIV\ code is not gathered in files with the same name. In the
+%D meantime this code has been adapted to \MKIV\ but mnore is possible.
%D \macros
%D {definemathalignment, setupmathalignment, startmathalignment}
@@ -26,102 +38,99 @@
% n>1 #### needed, strange # interaction in recurse
-\def\presetdisplaymath{\displ@y} % some day i will relocate the plain stuff
-
-\def\buildeqalign
+\def\math_build_eqalign
{\scratchtoks\emptytoks
\dorecurse{\mathalignmentparameter\c!m}
{\ifnum\recurselevel>\plusone
- \appendtoks
- \tabskip\mathalignmentparameter\c!distance&\tabskip\zeropoint
- \to\scratchtoks
+ %\appendtoks
+ % \tabskip\mathalignmentparameter\c!distance&\tabskip\zeropoint
+ %\to\scratchtoks
+ \scratchtoks\expandafter{\the\scratchtoks\tabskip\mathalignmentparameter\c!distance&\tabskip\zeropoint}%
\fi
\normalexpanded{\scratchtoks{\the\scratchtoks\the\!!toksa}}%
\dorecurse{\numexpr\mathalignmentparameter\c!n-\plusone\relax}
{\normalexpanded{\scratchtoks{\the\scratchtoks\the\!!toksb}}}}%
\normalexpanded{\scratchtoks{\the\scratchtoks\the\!!toksc}}}
-\def\forgetalign
- {\tabskip\zeropoint\everycr\emptytoks}
-
-\let\firstineqalign\empty
-\let\nextineqalign \empty
-\let\leftofeqalign \empty
-\let\rightofeqalign\empty
+\def\math_math_in_eqalign#1{$\tabskip\zeropoint\everycr\emptytoks\displaystyle{{}#1{}}$}
+\def\math_text_in_eqalign#1{$\tabskip\zeropoint\everycr\emptytoks#1$}
-\def\mathineqalign#1{$\forgetalign\displaystyle{{}#1{}}$}
-\def\textineqalign#1{$\forgetalign#1$}
+\def\displayopenupvalue{.25\bodyfontsize}
\def\eqalign#1% why no halign here, probably because of displaywidth
- {\emptyhbox\,\vcenter
- {\openup.25\bodyfontsize% was: \openup\jot
+ {\emptyhbox
+ \mskip\thinmuskip
+ \vcenter
+ {\openup\displayopenupvalue % was: \openup\jot
\mathsurround\zeropoint
- \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##{}}$\hfil\crcr#1\crcr}%
- }\,}
+ \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##{}}$\hfil\crcr#1\crcr}}%
+ \mskip\thinmuskip}
% preamble is scanned for tabskips so we need the span to prevent an error message
\setnewconstant\eqalignmode\plusone
-\def\preparereqalignno
- {\!!toksa{\strut\firstineqalign\hfil\leftofeqalign\span\mathineqalign{##}\rightofeqalign\tabskip\zeropoint}%
- \!!toksb{&\nextineqalign\leftofeqalign\span\mathineqalign{##}\rightofeqalign\tabskip\zeropoint}%
+% use zeroskipplusfill
+
+\def\math_prepare_r_eqalign_no
+ {\!!toksa{\strut\math_first_in_eqalign\hfil\math_left_of_equalign\span\math_math_in_eqalign{##}\math_right_of_eqalign\tabskip\zeropoint}%
+ \!!toksb{&\math_next_in_eqalign\math_left_of_equalign\span\math_math_in_eqalign{##}\math_right_of_eqalign\tabskip\zeropoint}%
\ifnum\mathraggedstatus=\plusone
- \!!toksc{\hfil&\span\textineqalign{##}\tabskip\zeropoint}%
+ \!!toksc{\hfil&\span\math_text_in_eqalign{##}\tabskip\zeropoint}%
\else\ifnum\mathraggedstatus=\plusthree
- \!!toksc{\hfil\tabskip\zeropoint\!!plus 1\!!fill&\span\textineqalign{##}\tabskip\zeropoint}%
+ \!!toksc{\hfil\tabskip\zeropoint\!!plus 1\!!fill&\span\math_text_in_eqalign{##}\tabskip\zeropoint}%
\else
- \!!toksc{\hfil\tabskip\centering&\llap{\span\textineqalign{##}}\tabskip\zeropoint}%
+ \!!toksc{\hfil\tabskip\centering&\llap{\span\math_text_in_eqalign{##}}\tabskip\zeropoint}%
\fi\fi
\global\mathnumberstatus\zerocount
- \buildeqalign
- \presetdisplaymath
+ \math_build_eqalign
+ \the\mathdisplayaligntweaks
\tabskip\centering}
-\def\prepareleqalignno
- {\!!toksa{\strut\firstineqalign\hfil\leftofeqalign\span\mathineqalign{##}\rightofeqalign\tabskip\zeropoint}%
- \!!toksb{&\nextineqalign\leftofeqalign\span\mathineqalign{##}\rightofeqalign\tabskip\zeropoint}%
+\def\math_prepare_l_eqalign_no
+ {\!!toksa{\strut\math_first_in_eqalign\hfil\math_left_of_equalign\span\math_math_in_eqalign{##}\math_right_of_eqalign\tabskip\zeropoint}%
+ \!!toksb{&\math_next_in_eqalign\math_left_of_equalign\span\math_math_in_eqalign{##}\math_right_of_eqalign\tabskip\zeropoint}%
% problem: number is handled after rest and so ends up in the margin
\ifnum\mathraggedstatus=\plusone
- \!!toksc{\hfil&\kern-\displaywidth\rlap{\span\textineqalign{##}}\tabskip\displaywidth}%
+ \!!toksc{\hfil&\kern-\displaywidth\rlap{\span\math_text_in_eqalign{##}}\tabskip\displaywidth}%
\else\ifnum\mathraggedstatus=\plusthree
- \!!toksc{\hfil\tabskip\zeropoint\!!plus 1\!!fill&\kern-\displaywidth\span\mrlap{\span\textineqalign{##}}\tabskip\displaywidth}%
+ \!!toksc{\hfil\tabskip\zeropoint\!!plus 1\!!fill&\kern-\displaywidth\span\math_rlap{\span\math_text_in_eqalign{##}}\tabskip\displaywidth}%
\else
- \!!toksc{\hfil\tabskip\centering&\kern-\displaywidth\rlap{\span\textineqalign{##}}\tabskip\displaywidth}%
+ \!!toksc{\hfil\tabskip\centering&\kern-\displaywidth\rlap{\span\math_text_in_eqalign{##}}\tabskip\displaywidth}%
\fi\fi
\global\mathnumberstatus\zerocount
- \buildeqalign
- \presetdisplaymath
+ \math_build_eqalign
+ \the\mathdisplayaligntweaks
\tabskip\centering}
-\def\dobotheqalignno#1#2%
+\def\math_both_eqalign_no#1#2%
{\ifmmode
- \displ@y % \let\doplaceformulanumber\relax % strange hack
+ \the\mathdisplayaligntweaks % \let\doplaceformulanumber\relax % strange hack
\vcenter\bgroup
- \let\finishalignno\egroup
+ \let\math_finish_eqalign_no\egroup
\else
- \let\finishalignno\relax
+ \let\math_finish_eqalign_no\relax
\fi
#1%
\halign \ifcase\eqalignmode \or to \displaywidth \fi \@EA {\the\scratchtoks\crcr#2\crcr}%
- \finishalignno}
+ \math_finish_eqalign_no}
-\def\dobothaligneqalignno#1%
+\def\math_both_eqalign_no_aligned#1%
{\ifmmode
- \displ@y
+ \the\mathdisplayaligntweaks
\global\mathnumberstatus\plusone
\ifcase\mathraggedstatus
- \def\finishalignno{\crcr\egroup}%
+ \def\math_finish_eqalign_no{\crcr\egroup}%
\else
% we're in a mathbox
\vcenter\bgroup
- \def\finishalignno{\crcr\egroup\egroup}%
+ \def\math_finish_eqalign_no{\crcr\egroup\egroup}%
\fi
\fi
#1%
\halign \ifcase\eqalignmode \or to \displaywidth \fi \@EA \bgroup\the\scratchtoks\crcr}
-\def\mrlap#1%
+\def\math_rlap#1%
{\setbox\scratchbox\hbox{#1}%
\ifdim\wd\scratchbox>\mathnumbercorrection
\xdef\mathnumbercorrection{\the\wd\scratchbox}%
@@ -129,130 +138,142 @@
\box\scratchbox
\global\mathnumberstatus\plustwo}
-% \def\dobothaligneqalignno#1%
-% {\ifmmode
-% \displ@y
-% \global\mathnumberstatus\plusone
-% we're in a mathbox
-% \vcenter\bgroup
-% \def\finishalignno{\crcr\egroup\egroup}%
-% \else
-% \def\finishalignno{\crcr\egroup}%
-% \fi
-% #1%
-% \halign \ifcase\eqalignmode \or to \displaywidth \fi \@EA \bgroup\the\scratchtoks\crcr}
-
-\def\reqalignno {\dobotheqalignno \preparereqalignno}
-\def\leqalignno {\dobotheqalignno \prepareleqalignno}
-\def\alignreqalignno{\dobothaligneqalignno\preparereqalignno}
-\def\alignleqalignno{\dobothaligneqalignno\prepareleqalignno}
-\def\finishalignno {\crcr\egroup}
-
-\let \equalignno \reqalignno
-\let\aligneqalignno\alignreqalignno
-
-%D Here we implement the user interface part.
-
-\unexpanded\def\setupmathalignment
- {\dodoubleempty\dosetupmathalignment}
-
-\def\dosetupmathalignment[#1][#2]%
- {\ifsecondargument
- \getparameters[\??eq#1][#2]%
- \else
- \getparameters[\??eq][#1]%
- \fi}
-
-\let\currentmathalignment\empty
-
-\def\mathalignmentparameter#1%
- {\executeifdefined{\??eq\currentmathalignment#1}{\executeifdefined{\??eq#1}\empty}}
-
-\setupmathalignment
- [\c!n=2,
- \c!m=1,
- \c!distance=1em]
+\def\math_handle_eqalign_no_r_normal {\math_both_eqalign_no_normal \math_prepare_r_eqalign_no}
+\def\math_handle_eqalign_no_l_normal {\math_both_eqalign_no_normal \math_prepare_l_eqalign_no}
+\def\math_handle_eqalign_no_r_aligned{\math_both_eqalign_no_aligned\math_prepare_r_eqalign_no}
+\def\math_handle_eqalign_no_l_aligned{\math_both_eqalign_no_aligned\math_prepare_l_eqalign_no}
+\def\math_finish_eqalign_no {\crcr\egroup}
-\def\numberedeqalign
- {\doifelse{\formulaparameter\c!location}\v!left\alignleqalignno\alignreqalignno}
+\let \reqalignno \math_handle_eqalign_no_r_normal
+\let \leqalignno \math_handle_eqalign_no_l_normal
+\let\alignreqalignno \math_handle_eqalign_no_r_aligned
+\let\alignleqalignno \math_handle_eqalign_no_l_aligned
+\let \eqalignno \math_handle_eqalign_no_r_normal
+\let \aligneqalignno \math_handle_eqalign_no_r_aligned
-\def\doxxdoubleempty#1#2%
- {\ifx#2[\expandafter\dodoxxdoubleempty\else\expandafter\noxxdoubleempty\fi#1#2}
+%D Here we implement the user interface part. We start with basic math alignments:
-\def\dodoxxdoubleempty#1[#2]#3%
- {\ifx#3[\else\expandafter\nonoxxdoubleempty\fi#1[#2]#3}
+\newcount\c_math_eqalign_column
-\def\noxxdoubleempty #1{#1[][]}
-\def\nonoxxdoubleempty#1[#2]{#1[#2][]}
+\newtoks \everymathalignment
-\newcount\eqaligncolumn
+\def\math_alignment_NR_indeed[#1][#2]%
+ {\donestedformulanumber{#1}{#2}% to be tagged (better an attribute)
+ \crcr
+ \dostoptagged % finish row
+ \noalign{\glet\math_alignment_NC\math_alignment_NC_first}} % noalign used for change state, conditional does not work here
-\def\firstineqalign{\global\eqaligncolumn\plusone}
-\def\nextineqalign {\global\advance\eqaligncolumn\plusone}
-\def\leftofeqalign {\getvalue{\??eq:\v!left :\number\eqaligncolumn}}
-\def\rightofeqalign{\getvalue{\??eq:\v!right:\number\eqaligncolumn}}
+\def\math_alignment_NC_first
+ {\glet\math_alignment_NC\math_alignment_NC_rest}
-\def\doseteqaligncolumn#1%
- {\letvalueempty{\??eq:\v!left :\number\eqaligncolumn}%
- \letvalueempty{\??eq:\v!right:\number\eqaligncolumn}%
- \doif{#1}\v!left {\letvalue{\??eq:\v!right:\number\eqaligncolumn}\hfill}%
- \doif{#1}\v!right {\letvalue{\??eq:\v!left :\number\eqaligncolumn}\hfill}%
- \doif{#1}\v!middle{\letvalue{\??eq:\v!right:\number\eqaligncolumn}\hfill
- \letvalue{\??eq:\v!left :\number\eqaligncolumn}\hfill}}
+\def\math_alignment_NC_rest
+ {\aligntab}
-\def\dodoalignNC
- {\gdef\doalignNC##1{&##1}}
+\def\math_alignment_EQ
+ {\NC=}
-\def\doalignNR[#1][#2]%
- {\donestedformulanumber{#1}{#2}\crcr}
+\def\math_alignment_NR
+ {\aligntab
+ \dostoptagged % finish cell
+ \dodoubleempty\math_alignment_NR_indeed} % use xx from tabulate
-%D \starttyping
-%D \placeformula[eqn0]\startformula \startalign[n=1] a\NR \stopalign \stopformula See \in[eqn0]
-%D \placeformula[eqn1]\startformula \startalign[n=1] a\NR \stopalign \stopformula See \in[eqn1]
-%D \placeformula \startformula \startalign[n=1] a\NR[eqn2] \stopalign \stopformula See \in[eqn2]
-%D \placeformula[eqn3]\startformula \startalign[n=1] a\NR[+] \stopalign \stopformula See \in[eqn3]
-%D \stoptyping
+\appendtoks
+ \glet\math_alignment_NC\math_alignment_NC_first
+ \unexpanded\def\NC{\math_alignment_NC}% messy, due to lookahead (we cannot use a flag)
+ \let\EQ\math_alignment_EQ
+ \let\NR\math_alignment_NR
+\to \everymathalignment
-% todo: pop in cell
+\unexpanded\def\math_alignment_start#1%
+ {\edef\currentmathalignment{#1}%
+ \dosingleempty\math_alignment_start_indeed}
-\def\dostartmathalignment[#1][#2]%
+\def\math_alignment_start_indeed[#1]%
{% \begingroup not permitted ($$...assignments...\halign... )
- \pushmacro\doalignNC
- \edef\currentmathalignment{#1}%
- \doifassignmentelse{#2}{\setupmathalignment[#1][#2]}\donothing
- \def\NC{\doalignNC}%
- \global\let\doalignNC\dodoalignNC
- \def\EQ{&=}%
- \def\NR{&\global\let\doalignNC\dodoalignNC\doxxdoubleempty\doalignNR}%
- % amstex compatibility mode: (ugly, will disappear)
- \def\notag{\def\\{&\crcr}}%
- \doifelse{#2}{*}{\def\\{&\crcr}}{\def\\{&\doalignNR[+][]\crcr}}%
- % end of compatibility mode
- \eqaligncolumn\zerocount
+ \iffirstargument
+ \setupmathalignment[\currentmathalignment][#1]%
+ \fi
+ \the\everymathalignment
+ \c_math_eqalign_column\zerocount
\processcommacommand
[\mathalignmentparameter\c!align]
- {\advance\eqaligncolumn\plusone\doseteqaligncolumn}% takes argument
- % the real action
- \global\eqaligncolumn\plusone
+ {\advance\c_math_eqalign_column\plusone\doseteqaligncolumn}% takes argument
+ \global\c_math_eqalign_column\plusone
+ \dostarttagged\t!math\empty
+ \dostarttagged\t!mathtable\currentmathalignment
\numberedeqalign}
-\def\dostopmathalignment
- {\finishalignno
- \popmacro\doalignNC}
+\def\math_alignment_stop
+ {\math_finish_eqalign_no
+ \dostoptagged
+ \dostoptagged}
+
+\installcorenamespace{mathalignment}
+\installcorenamespace{mathalignmentvariant}
-\unexpanded\def\definemathalignment
- {\dodoubleempty\dodefinemathalignment}
+\installcommandhandler \??mathalignment {mathalignment} \??mathalignment
-\def\dodefinemathalignment[#1]% [#2]%
- {\setvalue{\e!start#1}{\dodoubleempty\dostartmathalignment[#1]}%
- \setvalue{\e!stop #1}{\dostopmathalignment}%
- \setupmathalignment[#1]}% [#2]
+\appendtoks
+ \setuevalue{\e!start\currentmathalignment}{\math_alignment_start{\currentmathalignment}}%
+ \setvalue {\e!stop \currentmathalignment}{\math_alignment_stop}%
+\to \everydefinemathalignment
-%D For the moment we only provide english commands.
+\setupmathalignment
+ [\c!n=2,
+ \c!m=1,
+ \c!distance=1em]
\definemathalignment[align] % default case (this is what amstex users expect)
\definemathalignment[\v!mathalignment] % prefered case (this is cleaner, less clashing)
+\def\numberedeqalign
+ {\doifelse{\formulaparameter\c!location}\v!left
+ \math_handle_eqalign_no_l_aligned
+ \math_handle_eqalign_no_r_aligned}
+
+\def\math_first_in_eqalign
+ {\global\c_math_eqalign_column\plusone
+ \dostarttagged\t!mathtablerow \empty
+ \dostarttagged\t!mathtablecell\empty}
+
+\def\math_next_in_eqalign
+ {\global\advance\c_math_eqalign_column\plusone
+ \dostoptagged % finish cell
+ \dostarttagged\t!mathtablecell\empty}
+
+\def\math_left_of_equalign
+ {\ifcsname\??mathalignmentvariant\number\c_math_eqalign_column\endcsname
+ \ifcase\csname\??mathalignmentvariant\number\c_math_eqalign_column\endcsname\or
+ \relax \or \hfill \or \hfill
+ \fi
+ \fi}
+
+\def\math_right_of_eqalign
+ {\ifcsname\??mathalignmentvariant\number\c_math_eqalign_column\endcsname
+ \ifcase\csname\??mathalignmentvariant\number\c_math_eqalign_column\endcsname\or
+ \hfill \or \relax \or \hfill
+ \fi
+ \fi}
+
+\def\doseteqaligncolumn#1% we could just add to the preamble (as with other alignments)
+ {\expandafter\let\csname\??mathalignmentvariant\number\c_math_eqalign_column\expandafter\endcsname
+ \csname\??mathalignmentvariant\ifcsname\??mathalignmentvariant#1\endcsname#1\else\v!normal\fi\endcsname}
+
+\letvalue{\??mathalignmentvariant\v!normal}\zerocount
+\letvalue{\??mathalignmentvariant\v!left }\plusone
+\letvalue{\??mathalignmentvariant\v!right }\plustwo
+\letvalue{\??mathalignmentvariant\v!middle}\plusthree
+
+\def\math_align_NR_generic[#1][#2]%
+ {\donestedformulanumber{#1}{#2}\crcr}
+
+%D \starttyping
+%D \placeformula[eqn0]\startformula \startalign[n=1] a\NR \stopalign \stopformula See \in[eqn0]
+%D \placeformula[eqn1]\startformula \startalign[n=1] a\NR \stopalign \stopformula See \in[eqn1]
+%D \placeformula \startformula \startalign[n=1] a\NR[eqn2] \stopalign \stopformula See \in[eqn2]
+%D \placeformula[eqn3]\startformula \startalign[n=1] a\NR[+] \stopalign \stopformula See \in[eqn3]
+%D \stoptyping
+
%D \startbuffer
%D \placeformula \startformula \eqalignno {
%D a &= b & \formulanumber \cr
@@ -292,17 +313,6 @@
%D
%D \startbuffer
%D \placeformula \startformula \startalign
-%D a &= b \\
-%D c &= d \notag \\
-%D &= e \notag \\
-%D &= f \\
-%D \stopalign \stopformula
-%D \stopbuffer
-%D
-%D \typebuffer \getbuffer
-%D
-%D \startbuffer
-%D \placeformula \startformula \startalign
%D \NC a \NC \eq b \NR[+]
%D \NC c \NC \neq d \NR
%D \NC \NC \neq f \NR[for:demo-b-1]
@@ -315,53 +325,6 @@
%D \typebuffer \getbuffer
%D
%D \startbuffer
-%D \placeformula \startformula \startalign[*]
-%D a &= b \\
-%D c &= d \\
-%D &= e \\
-%D &= f \\
-%D \stopalign \stopformula
-%D \stopbuffer
-%D
-%D \typebuffer \getbuffer
-%D
-%D \startbuffer
-%D \placeformula \startformula \startalign
-%D x &= y \\
-%D a &= b \\
-%D \stopalign \stopformula
-%D \stopbuffer
-%D
-%D \typebuffer \getbuffer
-%D
-%D \startbuffer
-%D \placeformula \startformula \startalign[m=3]
-%D x &= y & x &= y & z &= t \\
-%D a &= b & p &= q & w &= s \\
-%D \stopalign \stopformula
-%D \stopbuffer
-%D
-%D \typebuffer \getbuffer
-%D
-%D \startbuffer
-%D \placeformula \startformula \startalign[m=3,distance=0pt]
-%D x &= y &= x &= y &= z &= t \\
-%D a &= b &= p &= q &= w &= s \\
-%D \stopalign \stopformula
-%D \stopbuffer
-%D
-%D \typebuffer \getbuffer
-%D
-%D \startbuffer
-%D \placeformula \startformula \startalign[n=5,distance=0pt]
-%D x &= yy &= xx &= yy &= zz \\
-%D a &= b &= p &= q &= w \\
-%D \stopalign \stopformula
-%D \stopbuffer
-%D
-%D \typebuffer \getbuffer
-%D
-%D \startbuffer
%D \placeformula \startformula \startalign[n=3,align={left,middle,right}]
%D \NC l \NC = \NC r \NR
%D \NC left \NC = \NC right \NR
@@ -440,73 +403,64 @@
%D
%D Another wish \unknown
-\unexpanded\def\setupmathcases
- {\dodoubleempty\dosetupmathcases}
-
-\def\dosetupmathcases[#1][#2]%
- {\ifsecondargument
- \getparameters[\??ce#1][#2]%
- \else
- \getparameters[\??ce][#1]%
- \fi}
-
-\let\currentmathcases\empty
+\installcorenamespace{mathcases}
-\def\mathcasesparameter#1%
- {\executeifdefined{\??ce\currentmathcases#1}{\executeifdefined{\??ce#1}\empty}}
+\installcommandhandler \??mathcases {mathcases} \??mathcases
\setupmathcases
[\c!distance=1em,
\c!numberdistance=2.5em,
- \c!left={\left\{\,},
+ \c!left={\left\{\mskip\thinmuskip},
\c!right={\right.}]
-\def\dodocasesNC
- {\gdef\docasesNC{\endmath&}}
+\appendtoks
+ \setuevalue{\e!start\currentmathcases}{\math_cases_start{\currentmathcases}}%
+ \setvalue {\e!stop \currentmathcases}{\math_cases_stop}%
+\to \everydefinemathcases
-\let\docasesNR\doalignNR
-
-\def\dostartmathcases[#1][#2]%
+\unexpanded\def\math_cases_start#1%
{\begingroup
\edef\currentmathcases{#1}%
- \doifassignmentelse{#2}{\setupmathcases[#1][#2]}\donothing
+ \dosingleempty\math_cases_start_indeed}
+
+\unexpanded\def\math_cases_start_indeed[#1]%
+ {\iffirstargument
+ \setupcurrentmathcases[#1]%
+ \fi
\mathcasesparameter\c!left
\vcenter\bgroup
- \pushmacro\docasesNC
+ \pushmacro\math_cases_NC
\let\endmath\relax
- \def\NC{\docasesNC}%
- \def\MC{\docasesNC\ifmmode\else$\def\endmath{$}\fi}%
- \global\let\docasesNC\dodocasesNC
- \def\NR{\unskip\endmath&\global\let\docasesNC\dodocasesNC\doxxdoubleempty\docasesNR}%
+ \def\NC{\math_cases_NC}%
+ \def\MC{\math_cases_NC\ifmmode\else$\def\endmath{$}\fi}%
+ \global\let\math_cases_NC\math_cases_NC_indeed
+ \def\NR{\unskip\endmath&\global\let\math_cases_NC\math_cases_NC_indeed\doxxdoubleempty\math_cases_NR}%
\normalbaselines
\mathsurround\zeropoint
\everycr\emptytoks
\tabskip\zeropoint
- \global\eqaligncolumn\plusone
+ \global\c_math_eqalign_column\plusone
\halign\bgroup
$\mathcasesparameter\c!style##$\hfil
&\hskip\mathcasesparameter\c!distance\relax
- \popmacro\docasesNC##\hfil
+ \popmacro\math_cases_NC##\hfil
&\hskip\mathcasesparameter\c!numberdistance\relax
\let\formuladistance\!!zeropoint
- \span\textineqalign{##}%
+ \span\math_text_in_eqalign{##}%
\crcr} % todo: number
-\def\dostopmathcases
+\def\math_cases_stop
{\crcr
\egroup
- \popmacro\docasesNC
+ \popmacro\math_cases_NC
\egroup
\mathcasesparameter\c!right
\endgroup}
-\unexpanded\def\definemathcases
- {\dodoubleempty\dodefinemathcases}
+\def\math_cases_NC_indeed
+ {\gdef\math_cases_NC{\endmath&}}
-\def\dodefinemathcases[#1]% [#2]%
- {\setvalue{\e!start#1}{\dodoubleempty\dostartmathcases[#1]}%
- \setvalue{\e!stop #1}{\dostopmathcases}%
- \setupmathcases[#1]}% [#2]
+\let\math_cases_NR\math_align_NR_generic
\definemathcases[cases]
\definemathcases[\v!mathcases]
@@ -556,20 +510,9 @@
%D
%D Yet another one \unknown
-\unexpanded\def\setupmathmatrix
- {\dodoubleempty\dosetupmathmatrix}
-
-\def\dosetupmathmatrix[#1][#2]%
- {\ifsecondargument
- \getparameters[\??mx#1][#2]%
- \else
- \getparameters[\??mx][#1]%
- \fi}
-
-\let\currentmathmatrix\empty
+\installcorenamespace{mathmatrix}
-\def\mathmatrixparameter#1%
- {\executeifdefined{\??mx\currentmathmatrix#1}{\executeifdefined{\??mx#1}\empty}}
+\installcommandhandler \??mathmatrix {mathmatrix} \??mathmatrix
\setupmathmatrix
[\c!distance=1em,
@@ -577,127 +520,22 @@
\c!right=,
\c!align=\v!middle]
-\def\dosetmatrixcolumn#1% hh: todo: \definematrixalign
- {\letvalue{\??eq:\v!left :\number\eqaligncolumn}\hfil
- \letvalue{\??eq:\v!right:\number\eqaligncolumn}\hfil
- \doif{#1}\v!left {\letvalue{\??eq:\v!left :\number\eqaligncolumn}\relax
- \letvalue{\??eq:\v!right:\number\eqaligncolumn}\hfil}%
- \doif{#1}\v!right {\letvalue{\??eq:\v!left :\number\eqaligncolumn}\hfil
- \letvalue{\??eq:\v!right:\number\eqaligncolumn}\relax }%
- \doif{#1}\v!middle{\letvalue{\??eq:\v!left :\number\eqaligncolumn}\hfil
- \letvalue{\??eq:\v!right:\number\eqaligncolumn}\hfil}}
-
-\def\buildmathmatrix % beware: etex only
- {\scratchtoks\emptytoks
- \normalexpanded{\scratchtoks{\the\scratchtoks\the\!!toksa}}%
- \dorecurse{\numexpr\scratchcounter-\plusone\relax}
- {\normalexpanded{\scratchtoks{\the\scratchtoks\the\!!toksb}}}%
- \normalexpanded{\scratchtoks{\the\scratchtoks\the\!!toksc }}}
-
-\def\preparemathmatrix
- {\!!toksa{\strut \firstineqalign\leftofeqalign \span
- \textineqalign{\mathmatrixparameter\c!style ##}\rightofeqalign}%
- \!!toksb{&\hskip\mathmatrixparameter\c!distance
- \nextineqalign\leftofeqalign \span
- \textineqalign{\mathmatrixparameter\c!style ##}\rightofeqalign}%
- \!!toksc{&&\hskip\mathmatrixparameter\c!distance
- \leftofeqalign \span
- \textineqalign{\mathmatrixparameter\c!style ##}\rightofeqalign}%
- \buildmathmatrix
- \halign \@EA \bgroup\the\scratchtoks \crcr}
-
-\unexpanded\def\definemathmatrix
- {\dodoubleempty\dodefinemathmatrix}
-
-\def\dodefinemathmatrix[#1]% [#2]%
- {\setuvalue{\e!start#1}{\dodoubleempty\dostartmathmatrix[#1]}%
- \setvalue {\e!stop #1}{\dostopmathmatrix}% no u else lookahead problem
- \setupmathmatrix[#1]}% [#2]
-
-\definemathmatrix[matrix]
-\definemathmatrix[\v!mathmatrix]
-
-\unexpanded\def\dodomatrixNC
- {\gdef\domatrixNC{\endmath&}}
-
-\def\installmathmatrixhandler#1#2%
- {\setvalue{\??mx:#1}{#2}}
-
-% First alternative:
-%
-% \def\processlowhighmathmatrix#1%
-% {\def\mathmatrixleft
-% {\setbox\nextbox}
-% \def\mathmatrixright
-% {#1.5\dimexpr\nextboxdp-\nextboxht\relax
-% \hbox{$\mathmatrixparameter\c!left
-% \vcenter{\unvbox\nextbox}%
-% \mathmatrixparameter\c!right$}}%
-% \let\mathmatrixbox\vbox}
-%
-% \installmathmatrixhandler\v!high {\processlowhighmathmatrix\raise}
-% \installmathmatrixhandler\v!low {\processlowhighmathmatrix\lower}
-%
-% \installmathmatrixhandler\v!top {\processlowhighmathmatrix\raise}
-% \installmathmatrixhandler\v!bottom{\processlowhighmathmatrix\lower}
-%
-% \installmathmatrixhandler\v!lohi
-% {\def\mathmatrixleft {\mathmatrixparameter\c!left}%
-% \def\mathmatrixright{\mathmatrixparameter\c!right}%
-% \let\mathmatrixbox\vcenter}
-%
-% An alternative
-%
-% \let\mathmatrixleft \empty
-% \let\mathmatrixright\empty
-%
-% \def\processlowhighmathmatrix#1%
-% {\dowithnextbox
-% {#1.5\dimexpr\nextboxdp-\nextboxht\relax
-% \hbox{$\mathmatrixparameter\c!left
-% \vcenter{\unvbox\nextbox}%
-% \mathmatrixparameter\c!right$}}%
-% \vbox}
-%
-% \def\processlohimathmatrix
-% {\dowithnextbox
-% {\mathmatrixparameter\c!left
-% \vcenter{\unvbox\nextbox}%
-% \mathmatrixparameter\c!right}%
-% \vbox}
-%
-% \installmathmatrixhandler\v!high {\def\mathmatrixbox{\processlowhighmathmatrix\raise}}
-% \installmathmatrixhandler\v!low {\def\mathmatrixbox{\processlowhighmathmatrix\lower}}
-% \installmathmatrixhandler\v!top {\def\mathmatrixbox{\processlowhighmathmatrix\raise}}
-% \installmathmatrixhandler\v!bottom{\def\mathmatrixbox{\processlowhighmathmatrix\lower}}
-% \installmathmatrixhandler\v!lohi {\let\mathmatrixbox \processlohimathmatrix}
-%
-% Final version
-
-\let\mathmatrixleft \empty % experimental hook
-\let\mathmatrixright\empty % experimental hook
-
-\def\processlowhighmathmatrix#1#2%
- {\dowithnextbox
- {\scratchdimen\dimexpr(\nextboxdp-\nextboxht)/2 \ifcase#2\or+\mathaxisheight\textfont2\fi\relax
- \ifcase#1\relax\or\lower\scratchdimen\or\or\raise\scratchdimen\fi
- \hbox{$\mathmatrixparameter\c!left
- \vcenter{\unvbox\nextbox}%
- \mathmatrixparameter\c!right$}}%
- \vbox}
-
-\installmathmatrixhandler\v!top {\def\mathmatrixbox{\processlowhighmathmatrix\plusthree\plusone }}
-\installmathmatrixhandler\v!high {\def\mathmatrixbox{\processlowhighmathmatrix\plusthree\zerocount}}
-\installmathmatrixhandler\v!lohi {\def\mathmatrixbox{\processlowhighmathmatrix\plustwo \zerocount}}
-\installmathmatrixhandler\v!low {\def\mathmatrixbox{\processlowhighmathmatrix\plusone \zerocount}}
-\installmathmatrixhandler\v!bottom{\def\mathmatrixbox{\processlowhighmathmatrix\plusone \plusone }}
+\appendtoks
+ \setuevalue{\e!start\currentmathmatrix}{\math_matrix_start{\currentmathmatrix}}%
+ \setvalue {\e!stop \currentmathmatrix}{\math_matrix_stop}% no u else lookahead problem
+\to \everydefinemathmatrix
-\def\dostartmathmatrix[#1][#2]%
+\unexpanded\def\math_matrix_start#1%
{\begingroup
\edef\currentmathmatrix{#1}%
- \doifassignmentelse{#2}{\setupmathmatrix[#1][#2]}\donothing
+ \dosingleempty\math_matrix_start_indeed}
+
+\unexpanded\def\math_matrix_start_indeed[#1]%
+ {\iffirstargument
+ \setupcurrentmathmatrix[#1]%
+ \fi
\emptyhbox
- \executeifdefined{\??mx:\mathmatrixparameter\c!location}{\getvalue{\??mx:\v!lohi}}%
+ \math_matrix_align_method_analyze
\mathmatrixleft
\mathmatrixbox\bgroup
\pushmacro\domatrixNC
@@ -710,13 +548,15 @@
\mathsurround\zeropoint
\everycr\emptytoks
\tabskip\zeropoint
- \eqaligncolumn\zerocount % could be \scratchcounter
- \processcommacommand[\mathmatrixparameter\c!align]{\advance\eqaligncolumn\plusone\dosetmatrixcolumn}%
- \scratchcounter=\ifnum\eqaligncolumn>\zerocount \eqaligncolumn \else \plusone \fi
- \global\eqaligncolumn\plusone
- \preparemathmatrix } % uses scratchcounter
+ \c_math_eqalign_column\zerocount
+ \processcommacommand
+ [\mathmatrixparameter\c!align]
+ {\advance\c_math_eqalign_column\plusone\doseteqaligncolumn}% was \dosetmatrixcolumn
+ \scratchcounter=\ifnum\c_math_eqalign_column>\zerocount \c_math_eqalign_column \else \plusone \fi
+ \global\c_math_eqalign_column\plusone
+ \math_matrix_prepare}
-\def\dostopmathmatrix
+\def\math_matrix_stop
{\crcr
\mathstrut\crcr
\noalign{\kern-\baselineskip}%
@@ -726,6 +566,59 @@
\mathmatrixright
\endgroup}
+\definemathmatrix[matrix]
+\definemathmatrix[\v!mathmatrix]
+
+\def\math_matrix_prepare
+ {\!!toksa{\strut\math_first_in_eqalign\math_left_of_equalign\span
+ \math_text_in_eqalign{\mathmatrixparameter\c!style##}\math_right_of_eqalign}%
+ \!!toksb{&\hskip\mathmatrixparameter\c!distance
+ \math_next_in_eqalign\math_left_of_equalign\span
+ \math_text_in_eqalign{\mathmatrixparameter\c!style##}\math_right_of_eqalign}%
+ \!!toksc{&&\hskip\mathmatrixparameter\c!distance
+ \math_left_of_equalign\span
+ \math_text_in_eqalign{\mathmatrixparameter\c!style##}\math_right_of_eqalign}%
+ \scratchtoks\emptytoks
+ \normalexpanded{\scratchtoks{\the\scratchtoks\the\!!toksa}}%
+ \dorecurse{\numexpr\scratchcounter-\plusone\relax}
+ {\normalexpanded{\scratchtoks{\the\scratchtoks\the\!!toksb}}}%
+ \normalexpanded{\scratchtoks{\the\scratchtoks\the\!!toksc}}%
+ \halign \@EA \bgroup\the\scratchtoks \crcr}
+
+\unexpanded\def\dodomatrixNC
+ {\gdef\domatrixNC{\endmath&}}
+
+\installcorenamespace{mathmatrixalignmethod}
+
+\let\mathmatrixleft \empty % experimental hook
+\let\mathmatrixright\empty % experimental hook
+
+\def\math_matrix_process#1#2%
+ {\dowithnextbox
+ {\scratchdimen\dimexpr(\nextboxdp-\nextboxht)/2 \ifcase#2\or+\mathaxisheight\textfont2\fi\relax
+ \ifcase#1\relax\or\lower\scratchdimen\or\or\raise\scratchdimen\fi
+ \hbox{$\mathmatrixparameter\c!left
+ \vcenter{\unvbox\nextbox}%
+ \mathmatrixparameter\c!right$}}%
+ \vbox}
+
+\unexpanded\def\installmathmatrixalignmethod#1#2%
+ {\setvalue{\??mathmatrixalignmethod#1}{#2}}
+
+\def\math_matrix_align_method_analyze
+ {\csname\??mathmatrixalignmethod\ifcsname\??mathmatrixalignmethod\mathmatrixparameter\c!location\endcsname
+ \mathmatrixparameter\c!location
+ \else
+ \v!normal
+ \fi\endcsname}
+
+\installmathmatrixalignmethod\v!top {\def\mathmatrixbox{\math_matrix_process\plusthree\plusone }}
+\installmathmatrixalignmethod\v!high {\def\mathmatrixbox{\math_matrix_process\plusthree\zerocount}}
+\installmathmatrixalignmethod\v!lohi {\def\mathmatrixbox{\math_matrix_process\plustwo \zerocount}}
+\installmathmatrixalignmethod\v!low {\def\mathmatrixbox{\math_matrix_process\plusone \zerocount}}
+\installmathmatrixalignmethod\v!bottom{\def\mathmatrixbox{\math_matrix_process\plusone \plusone }}
+\installmathmatrixalignmethod\v!normal{\def\mathmatrixbox{\math_matrix_process\plustwo \zerocount}} % lohi
+
%D \startbuffer
%D \placeformula \startformula[-] \startmatrix
%D \NC 1 \NC x \NC a \NR
@@ -736,7 +629,7 @@
%D
%D \typebuffer \getbuffer
%D
-%D \definemathmatrix[bmatrix][left={\left[\,},right={\,\right]}]
+%D \definemathmatrix[bmatrix][left={\left[\mskip\thinmuskip},right={\mskip\thinmuskip\right]}]
%D
%D \startbuffer
%D \placeformula \startformula[-] \startbmatrix
@@ -861,62 +754,21 @@
%D The intertext commands have to be expandable (in aligment lookahead) so
%D we cannot use \type {\unexpanded}.
-\let\stopintertext\relax
-
\def\startintertext#1\stopintertext
- {\noalign{\dointertext{#1}}}
+ {\noalign{\math_intertext{#1}}}
+
+\let\stopintertext\relax
\def\intertext#1%
- {\noalign{\dointertext{#1}}}
+ {\noalign{\math_intertext{#1}}}
-\unexpanded\def\dointertext#1%
+\unexpanded\def\math_intertext#1%
{\penalty\postdisplaypenalty
\afterdisplayspace
\vbox{\forgetall\noindent#1\par}%
\penalty\predisplaypenalty
\beforedisplayspace}
-% %D \macros
-% %D {substack}
-% %D
-% %D Preliminary code:
-% %D
-% %D \starttyping
-% %D \startformula
-% %D \sum_{%
-% %D \startsubstack
-% %D i = 1 \NR
-% %D i \neq n \NR
-% %D i \neq m
-% %D \stopsubstack
-% %D }a_i
-% %D \stopformula
-% %D \stoptyping
-
-% \unexpanded\def\startsubstack
-% {\begingroup
-% \emptyhbox
-% \vcenter\bgroup
-% \pushmacro\domatrixNC
-% \let\stopmathmode\relax
-% \def\NC{\domatrixNC}%
-% \def\MC{\domatrixNC\startmathmode}%
-% \global\let\domatrixNC\dodomatrixNC
-% \def\NR
-% {\stopmathmode
-% \global\let\domatrixNC\dodomatrixNC
-% \crcr\noalign{\nointerlineskip}}%
-% \mathsurround\zeropoint
-% \everycr\emptytoks
-% \halign\bgroup\hfil$\scriptstyle\mathstrut##$\hfil\crcr}
-
-% \unexpanded\def\stopsubstack
-% {\crcr
-% \egroup
-% \popmacro\domatrixNC
-% \egroup
-% \endgroup}
-
%D \macros
%D {substack}
%D
@@ -967,7 +819,7 @@
\everycr\emptytoks
\halign\bgroup\hfil$\scriptstyle##$\hfil\crcr}
-\unexpanded\def\stopsubstack
+\def\stopsubstack
{\crcr
\egroup
\egroup
@@ -982,12 +834,12 @@
\ifx\mathparentwd\undefined \newdimen\mathparentwd \fi
-\let\normalbordermatrix\bordermatrix
+\let\normalbordermatrix\bordermatrix % move that code to here instead
\def\bordermatrix
{\begingroup
\setbox\scratchbox\hbox{\mr\char"239C}%
- \global\mathparentwd\wd\scratchbox\relax
+ \global\mathparentwd\wd\scratchbox
\endgroup
\normalbordermatrix}
@@ -1017,11 +869,11 @@
%D Use these macros sparingly. Remember, \TEX\ was designed for
%D mathematics, so there is usually a proper method for typesetting
%D common math notation.
+%D
+%D These macros are a cleaner version of \type {\binrel@} and
+%D \type {\binrel@@} macros in \AMSTEX\ packages.
-%D These macros are a clearer version of \type{\binrel@} and
-%D \type{\binrel@@} macros in \AMSTEX\ packages.
-
-\def\preparebinrel#1%
+\def\math_binrel_apply#1%
{\begingroup
\setbox\scratchbox\hbox
{\thinmuskip 0mu
@@ -1030,48 +882,46 @@
\setbox\scratchbox\hbox{$#1\mathsurround\zeropoint$}%
\kern-\wd\scratchbox
${}#1{}\mathsurround\zeropoint$}%
- \normalexpanded
- {\endgroup
- \let\noexpand\currentbinrel
- \ifdim\wd\scratchbox<\zeropoint
- \mathbin
- \else\ifdim\wd\scratchbox>\zeropoint
- \mathrel
- \else
- \relax
- \fi\fi}}
+ \ifdim\wd\scratchbox<\zeropoint
+ \endgroup
+ \expandafter\mathbin
+ \else\ifdim\wd\scratchbox>\zeropoint
+ \endgroup
+ \expandafter\expandafter\expandafter\mathrel
+ \else
+ \endgroup
+ \expandafter\expandafter\expandafter\firstofoneargument
+ \fi\fi}
\unexpanded\def\overset#1#2%
- {\preparebinrel{#2}%
- \currentbinrel{\mathop{\kern\zeropoint#2}\limits\normalsuperscript{#1}}}
+ {\math_binrel_apply{#2}{\mathop{\kern\zeropoint#2}\limits\normalsuperscript{#1}}}
\unexpanded\def\underset#1#2%
- {\preparebinrel{#2}%
- \currentbinrel{\mathop{\kern\zeropoint#2}\limits\normalsubscript{#1}}}
+ {\math_binrel_apply{#2}{\mathop{\kern\zeropoint#2}\limits\normalsubscript {#1}}}
%D The following code comes from \type {math-str.mkiv}.
-
+%D
%D Here we implement a basic math alignment mechanism. Numbers
%D are also handled. The macros \type {\startinnermath} and
%D \type {\stopinnermath} can be overloaded in specialized
%D modules.
-\unexpanded\def\startinnermath
- {\getvalue{\e!start\??fm\formulaparameter\c!align}}
+\installcorenamespace{mathinnerstart}
+\installcorenamespace{mathinnerstop}
-\unexpanded\def\stopinnermath
- {\getvalue{\e!stop \??fm\formulaparameter\c!align}}
+\unexpanded\def\startinnermath{\csname\??mathinnerstart\formulaparameter\c!align\endcsname}
+\unexpanded\def\stopinnermath {\csname\??mathinnerstop \formulaparameter\c!align\endcsname}
-\def\mathinnerstrut
+\unexpanded\def\mathinnerstrut
{\doif{\formulaparameter\c!strut}\v!yes\strut}
-\long\unexpanded\def\defineinnermathhandler#1#2#3%
- {\setvalue{\e!start\??fm#1}{#2}%
- \setvalue{\e!stop \??fm#1}{#3}}
+\unexpanded\def\defineinnermathhandler#1#2#3%
+ {\setvalue{\??mathinnerstart#1}{#2}%
+ \setvalue{\??mathinnerstop #1}{#3}}
\newif\iftracemath
-\def\mathhbox
+\def\math_hbox
{\iftracemath\ruledhbox\else\hbox\fi}
\newconstant\mathraggedstatus % normal left center right
@@ -1079,40 +929,47 @@
\let\mathnumbercorrection\!!zeropoint
+\let\math_the_r_eq_no\empty
+\let\math_the_l_eq_no\empty
+
\unexpanded\def\startmathbox#1%
{\hsize\displaywidth
\global\mathnumberstatus\plusone
\mathraggedstatus#1\relax
\let\mathnumbercorrection\!!zeropoint
- \global\let\@eqno \empty \def\eqno {\gdef\@eqno }%
- \global\let\@leqno\empty \def\leqno{\gdef\@leqno}%
+ \global\let\math_the_r_eq_no\empty
+ \global\let\math_the_l_eq_no\empty
+ \def\reqno{\gdef\math_the_r_eq_no}%
+ \def\leqno{\gdef\math_the_l_eq_no}%
+ \let\eqno\reqno
% added
- \let\normalreqno\eqno
+ \let\normalreqno\reqno
\let\normalleqno\leqno
+ \let\normaleqno \eqno
% added
\doplaceformulanumber
- \setbox\scratchbox\mathhbox to \displaywidth\bgroup
+ \setbox\scratchbox\math_hbox to \displaywidth\bgroup
\mathinnerstrut
$%
\displaystyle
\ifcase\mathraggedstatus\or\hfill\or\hfill\fi}
-\def\llappedmathno
+\def\math_box_llapped_math_no
{\ifcase\mathraggedstatus\or
- \@eqno
+ \math_the_r_eq_no
\or
- \llap{\@eqno}%
+ \llap{\math_the_r_eq_no}%
\or
- \llap{\@eqno}%
+ \llap{\math_the_r_eq_no}%
\fi}
-\def\rlappedmathno
+\def\math_box_rlapped_math_no
{\ifcase\mathraggedstatus\or
- \rlap{\@leqno}%
+ \rlap{\math_the_l_eq_no}%
\or
- \rlap{\@leqno}%
+ \rlap{\math_the_l_eq_no}%
\or
- \@leqno
+ \math_the_l_eq_no
\fi}
\unexpanded\def\stopmathbox
@@ -1130,21 +987,21 @@
\ifcase\mathnumberstatus
\box\scratchbox
\or
- \ifx\@leqno\empty
- \ifx\@eqno\empty
+ \ifx\math_the_l_eq_no\empty
+ \ifx\math_the_r_eq_no\empty
\box\scratchbox
\else
\ifdone
- \vbox{\box\scratchbox\hbox to \displaywidth{\hss\llappedmathno}}%
+ \vbox{\box\scratchbox\hbox to \displaywidth{\hss\math_box_llapped_math_no}}%
\else
- \hss\box\scratchbox\llappedmathno % hss makes room for number
+ \hss\box\scratchbox\math_box_llapped_math_no % hss makes room for number
\fi
\fi
\else
\ifdone
- \vbox{\hbox to \displaywidth{\rlappedmathno\hss}\box\scratchbox}%
+ \vbox{\hbox to \displaywidth{\math_box_rlapped_math_no\hss}\box\scratchbox}%
\else
- \rlappedmathno\box\scratchbox\hss % hss makes room for number
+ \math_box_rlapped_math_no\box\scratchbox\hss % hss makes room for number
\fi
\fi
\or
@@ -1293,7 +1150,7 @@
% \NC 3 \NC z \NC c \NR
% \stopmatrix \stopformula
-% \definemathmatrix[bordermatrix][left={\left[\,},right={\,\right]}]
+% \definemathmatrix[bordermatrix][left={\left[\mskip\thinmuskip},right={\mskip\thinmuskip\right]}]
% \placeformula \startformula[-] \startbordermatrix
% \NC 1 \NC x \NC a \NR