summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/minim-math/minim-math.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-10-21 03:01:29 +0000
committerNorbert Preining <norbert@preining.info>2023-10-21 03:01:29 +0000
commit6deeaf1bda76263051b929f5d5401c98d85e74ef (patch)
tree385460fec9e3be1f3e98950bde1c729aa3a8aa5b /macros/luatex/generic/minim-math/minim-math.tex
parentc9ab6fbcc0f960c5e669419f2565ff121a7f33fd (diff)
CTAN sync 202310210301
Diffstat (limited to 'macros/luatex/generic/minim-math/minim-math.tex')
-rw-r--r--macros/luatex/generic/minim-math/minim-math.tex63
1 files changed, 42 insertions, 21 deletions
diff --git a/macros/luatex/generic/minim-math/minim-math.tex b/macros/luatex/generic/minim-math/minim-math.tex
index d24a6693dc..1a8f1157c1 100644
--- a/macros/luatex/generic/minim-math/minim-math.tex
+++ b/macros/luatex/generic/minim-math/minim-math.tex
@@ -9,12 +9,23 @@
% \mathdef c {expansion}
\protected\def\mathdef#1#2{%
- \def\mathdef:tmp{#2}%
- \mathlet{#1}\mathdef:tmp}
-% \mathlet c \csname
-\protected\def\mathlet#1#2{%
+ \protected\def\mathdef:tmp{#2}%
\mathcode`#1="8000\relax
- \letcharcode`#1=#2}
+ \letcharcode`#1=\mathdef:tmp}
+% \mathlet c \csname
+\let\mathlet = \mathdef
+
+% sensible defaults
+\matheqdirmode = 1 % short skips also in rtl
+\mathdisplayskipmode = 1
+%
+% not set here, but maybe relevant:
+%
+% \mathsurroundskip = ...
+% \mathitalicsmode = 1
+% \mathscriptboxmode = 2
+% \matheqnogapstep = 1000 % default value
+% \predisplaygapfactor = 2000 % default value
% 1 Global style transformations
@@ -86,20 +97,20 @@
\newcount \accentfam \accentfam = 0
\newcount \extensiblefam \extensiblefam = 0
-\def\math:accent{\ifmmode% spec num char
+\protected\def\math:accent{\ifmmode% spec num char
\expandafter\math:mathaccent\else
\expandafter\math:textaccent\fi}
\def\math:mathaccent#1#2#3{\Umathaccent #1"0 \accentfam #2 }
\def\math:textaccent#1#2#3#4{#4#3}% might be a normal combining accent
-\def\math:stack#1#2#3{% spec num char
+\protected\def\math:stack#1#2#3{% spec num char
\withoptions[]{\math:stack:{#1}{#2}{#3}}}
\def\math:stack:#1#2#3[#4]#5{%
{\mathop{\math:accent{#1}{#2}{#3}{#5}}%
\ifx\math:stack#4\math:stack\else \limits
\ifx\math:stack#1\math:stack^\else_\fi{#4}\fi}}
-\def\math:radical{\ifmmode% num char
+\protected\def\math:radical{\ifmmode% num char
\expandafter\math:mathradical\else
\expandafter\math:textradical\fi}
\def\math:mathradical#1#2{\Uradical\radicalfam #1 }
@@ -255,6 +266,7 @@
\normalroots
+\let\of=\relax
\mathlet √ \sqrt
\mathdef ∛ {\root3\of}
\mathdef ∜ {\root4\of}
@@ -529,23 +541,34 @@
% 1 Displayed equations
-\newif\ifdisplay:
-\newif\ifdisplay:nr
-\newif\ifleftdisplays
-\newtoks\setdisplaynr
-\newtoks\display:specialnr
-\display:specialnr{\the\setdisplaynr}
-
% \display
\protected\def\display{\display:true}
% \displaynr {nr}
\protected\def\displaynr{\display:true\display:nrtrue
\nextifcat\bgroup\display:specialnr\relax}
+% \leftdisplaystrue
+\newif\ifleftdisplays
+% \setdisplaynr {...}
+\newtoks\setdisplaynr
+% \equationnumber
+\newcount\equationnumber \equationnumber = 0
+\setdisplaynr{\global\advance\equationnumber1(\the\equationnumber)}
+
+\newif\ifdisplay:
+\newif\ifdisplay:nr
+\newtoks\display:specialnr
+\display:specialnr{\the\setdisplaynr}
+
% \[ ... \]
-\protected\def\[{\ifdisplay:\expandafter\startdisplay\else\Ustartmath\fi}
-\protected\def\]{\global\expandafter\display:false
+\protected\def\[#1\]{%
+ \ifdisplay:\expandafter\startdisplay\else\Ustartmath\fi
+ \tagging:tagformula{#1}#1\relax
+ \global\expandafter\display:false
\ifdisplay:\expandafter\stopdisplay\else\Ustopmath\fi}
+\protected\def\]{\errmessage{Unmatched \string\]}}
+\ifdefined \tagging:tagformula \else
+ \let\tagging:tagformula=\ignore \fi
\protected\def\startdisplay{%
% if the display starts a paragraph, omit baselineskip
@@ -553,6 +576,8 @@
\ifvmode \nointerlineskip
\noindent \hbox to .5\hsize{\hss}\fi
\Ustartdisplaymath
+ % compatibility with minim-pdf
+ \csname tagging:indisplaytrue\endcsname
% for left-aligned equations, force manual placement
\ifleftdisplays\muskip0mu\fi}
\protected\def\stopdisplay{%
@@ -565,10 +590,6 @@
\Ustopdisplaymath
\ignorespaces}
-% default equation numbering
-\newcount\equationnumber \equationnumber = 0
-\setdisplaynr{\global\advance\eqnr1(\the\equationnumber)}
-
%  standard mappings