summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/minim-math/minim-math.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-03-07 03:02:56 +0000
committerNorbert Preining <norbert@preining.info>2023-03-07 03:02:56 +0000
commit4f55c9271affed648c1a939790a73083043752f5 (patch)
tree5de3491421bbf46cdb941a9a70158ca43e748919 /macros/luatex/generic/minim-math/minim-math.tex
parent75cd005305bd2c2a0ec383f30ee5b1749ed15183 (diff)
CTAN sync 202303070302
Diffstat (limited to 'macros/luatex/generic/minim-math/minim-math.tex')
-rw-r--r--macros/luatex/generic/minim-math/minim-math.tex79
1 files changed, 72 insertions, 7 deletions
diff --git a/macros/luatex/generic/minim-math/minim-math.tex b/macros/luatex/generic/minim-math/minim-math.tex
index 06fb632a5c..d24a6693dc 100644
--- a/macros/luatex/generic/minim-math/minim-math.tex
+++ b/macros/luatex/generic/minim-math/minim-math.tex
@@ -77,7 +77,7 @@
\protected\def\mbb#1{{\mathstyle{bb}#1}}
\protected\def\frak#1{{\mathstyle{frak}#1}}
\protected\def\bffrak#1{{\mathstyle{bffrak}#1}}
-\protected\def\scr#1{{\mathstyle{scr}#1}} \let\mcal = \cal
+\protected\def\scr#1{{\mathstyle{scr}#1}} \let\mcal = \scr
\protected\def\bfscr#1{{\mathstyle{bfscr}#1}} \let\bfcal = \bfscr
% 1 Processing the character table
@@ -137,8 +137,26 @@
% decimal comma settings
\explicitmathchar \comma
+\Umathchardef \ordcomma "0"0"2C
+\protected\def\smartcomma{%
+ \futurelet\smartcomma:next\smartcomma:do}
+\def\smartcomma:do{\let\smartcomma:c\comma
+ \ifx0\smartcomma:next\let\smartcomma:c\ordcomma\fi
+ \ifx1\smartcomma:next\let\smartcomma:c\ordcomma\fi
+ \ifx2\smartcomma:next\let\smartcomma:c\ordcomma\fi
+ \ifx3\smartcomma:next\let\smartcomma:c\ordcomma\fi
+ \ifx4\smartcomma:next\let\smartcomma:c\ordcomma\fi
+ \ifx5\smartcomma:next\let\smartcomma:c\ordcomma\fi
+ \ifx6\smartcomma:next\let\smartcomma:c\ordcomma\fi
+ \ifx7\smartcomma:next\let\smartcomma:c\ordcomma\fi
+ \ifx8\smartcomma:next\let\smartcomma:c\ordcomma\fi
+ \ifx9\smartcomma:next\let\smartcomma:c\ordcomma\fi
+ \smartcomma:c}
+
\protected\def\decimalcomma {\Umathcode`\, = 0 \Umathcharfam`\, `\,}
\protected\def\nodecimalcomma{\Umathcode`\, = 6 \Umathcharfam`\, `\,}
+\protected\def\smartdecimalcomma{\mathlet,\smartcomma}
+
% set the colon to how it used to be
\Umathcode`\:="3"0"2236 % \ratio
@@ -439,13 +457,18 @@
\def\norm#1{\left\vert#1\right\vert} \let \abs=\norm
\def\Norm#1{\left\Vert#1\right\Vert}
-% a smaller inverse-function sign
-\protected\def\inv{^{\scriptscriptstyle
- \mathbin{\setbox0=\hbox{$\scriptscriptstyle-$}
- \kern.75\wd0 \pdfextension save
+% a slightly smaller unary minus
+\def\unaryminus{\mathord{\mathpalette\unaryminus:make{}}}
+\def\unaryminus:make#1#2{%
+ \setbox0 = \hbox{$#1-$}
+ \kern .75\wd0
+ \pdfextension save
\pdfextension setmatrix{.75 0 0 1}
- \kern-\wd0\box0 \pdfextension restore}
- \mkern-2mu 1}}
+ \kern -\wd0 \box0
+ \pdfextension restore}
+
+% a smaller inverse-function sign
+\protected\def\inv{^{\scriptscriptstyle\unaryminus1}}%
% upright multiletter symbols
\def\mord#1{\mathord{\mathstyle{up}#1}}
@@ -504,6 +527,48 @@
\newmathop {End} \newmathop {Aut}
\newmathop {Dom} \newmathop {Codom}
+% 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}
+
+% \[ ... \]
+\protected\def\[{\ifdisplay:\expandafter\startdisplay\else\Ustartmath\fi}
+\protected\def\]{\global\expandafter\display:false
+ \ifdisplay:\expandafter\stopdisplay\else\Ustopmath\fi}
+
+\protected\def\startdisplay{%
+ % if the display starts a paragraph, omit baselineskip
+ % and ensure that the long \beforedisplayskip is used
+ \ifvmode \nointerlineskip
+ \noindent \hbox to .5\hsize{\hss}\fi
+ \Ustartdisplaymath
+ % for left-aligned equations, force manual placement
+ \ifleftdisplays\muskip0mu\fi}
+\protected\def\stopdisplay{%
+ \ifleftdisplays
+ \hskip\displaywidth minus\displaywidth\fi
+ \global\expandafter\display:nrfalse
+ \ifdisplay:nr
+ \eqno\the\display:specialnr
+ \global\display:specialnr{\the\setdisplay:nr}\fi
+ \Ustopdisplaymath
+ \ignorespaces}
+
+% default equation numbering
+\newcount\equationnumber \equationnumber = 0
+\setdisplaynr{\global\advance\eqnr1(\the\equationnumber)}
+
%  standard mappings