summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/breqn/mathstyle.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/breqn/mathstyle.sty')
-rw-r--r--Master/texmf-dist/tex/latex/breqn/mathstyle.sty85
1 files changed, 59 insertions, 26 deletions
diff --git a/Master/texmf-dist/tex/latex/breqn/mathstyle.sty b/Master/texmf-dist/tex/latex/breqn/mathstyle.sty
index c6186311701..6921131b1dc 100644
--- a/Master/texmf-dist/tex/latex/breqn/mathstyle.sty
+++ b/Master/texmf-dist/tex/latex/breqn/mathstyle.sty
@@ -31,7 +31,7 @@
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\ProvidesExplPackage{mathstyle}{2020/02/18}{0.98i}{Tracking mathstyle implicitly}
+\ProvidesExplPackage{mathstyle}{2020/04/19}{0.98j}{Tracking mathstyle implicitly}
\ExplSyntaxOff
\providecommand\@saveprimitive[2]{%
\begingroup
@@ -73,7 +73,8 @@
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname directlua\endcsname\relax
- \chardef\mathstyle\@ne
+ \chardef\mathstyle=2\relax
+ \chardef\mathstyledenom=0\relax
\else
\directlua{tex.enableprimitives("", {"mathstyle"})}
\fi
@@ -91,13 +92,13 @@
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname directlua\endcsname\relax
\DeclareRobustCommand{\displaystyle}{%
- \@@displaystyle \chardef\mathstyle\z@}
+ \@@displaystyle \chardef\mathstyle0\relax}
\DeclareRobustCommand{\textstyle}{%
- \@@textstyle \chardef\mathstyle\tw@}
+ \@@textstyle \chardef\mathstyle2\relax}
\DeclareRobustCommand{\scriptstyle}{%
- \@@scriptstyle \chardef\mathstyle4 }
+ \@@scriptstyle \chardef\mathstyle4\relax}
\DeclareRobustCommand{\scriptscriptstyle}{%
- \@@scriptscriptstyle \chardef\mathstyle6 }
+ \@@scriptscriptstyle \chardef\mathstyle6\relax}
\fi
\begingroup \catcode`\^=7\relax \catcode`\_=8\relax % just in case
\lowercase{\endgroup
@@ -110,8 +111,10 @@
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname directlua\endcsname\relax
\def\subsupstyle{%
- \ifnum\mathstyle<5 \chardef\mathstyle4 %
- \else \chardef\mathstyle6 %
+ \ifnum\mathstyle<4\relax
+ \chardef\mathstyle\numexpr4+\mathstyledenom\relax
+ \else
+ \chardef\mathstyle\numexpr6+\mathstyledenom\relax
\fi
}
\else
@@ -143,38 +146,68 @@
\providecommand\@thirdoffour[4]{#3}
\providecommand\@fourthoffour[4]{#4}
\DeclareRobustCommand\genfrac[6]{%
- {#1\fracstyle
+ {%
+ % emulate old amsmath syntax:
+ \if 0#4\relax\displaystyle\else
+ \if 1#4\relax\textstyle\else
+ \if 2#4\relax\scriptstyle\else
+ \if 3#4\relax\scriptscriptstyle\else
+ #4%
+ \fi\fi\fi\fi
+ \fracstyle
+ {\begingroup #5\endgroup
+ \csname @@\ifx\maxdimen#3\maxdimen over\else above\fi
+ \if @#1@\else withdelims\fi\endcsname #1 #2 #3\relax
+ \ifnum\mathstyledenom=0\relax
+ \chardef\mathstyledenom=1\relax
+ \edef\mathstyle@tempa{\number\mathstyle}%
+ \chardef\mathstyle=\numexpr\mathstyle@tempa+1\relax
+ \fi
+ #6%
+ \chardef\mathstyledenom=0\relax}%
+ }%
+}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname directlua\endcsname\relax\else
+\DeclareRobustCommand\genfrac[6]{%
+ {%
+ % emulate old amsmath syntax:
+ \if 0#4\relax\displaystyle\else
+ \if 1#4\relax\textstyle\else
+ \if 2#4\relax\scriptstyle\else
+ \if 3#4\relax\scriptscriptstyle\else
+ #4%
+ \fi\fi\fi\fi
+ \fracstyle
{\begingroup #5\endgroup
- \csname @@\ifx\maxdimen#4\maxdimen over\else above\fi
- \if @#2@\else withdelims\fi\endcsname #2#3\relax
- #6}%
+ \csname @@\ifx\maxdimen#3\maxdimen over\else above\fi
+ \if @#1@\else withdelims\fi\endcsname #1 #2 #3\relax
+ #6%
+ }%
}%
}
+\fi
\renewcommand{\frac}{\genfrac{}{}{}{}}
\providecommand{\dfrac}{}
\providecommand{\tfrac}{}
-\renewcommand{\dfrac}{\genfrac\displaystyle{}{}{}}
-\renewcommand{\tfrac}{\genfrac\textstyle{}{}{}}
+\renewcommand{\dfrac}{\genfrac{}{}{}\displaystyle}
+\renewcommand{\tfrac}{\genfrac{}{}{}\displaystyle}
\providecommand{\binom}{}
\providecommand{\tbinom}{}
\providecommand{\dbinom}{}
-\renewcommand{\binom}{\genfrac{}(){0pt}}
-\renewcommand{\dbinom}{\genfrac\displaystyle(){0pt}}
-\renewcommand{\tbinom}{\genfrac\textstyle(){0pt}}
+\renewcommand{\binom}{\genfrac(){0pt}{}}
+\renewcommand{\dbinom}{\genfrac(){0pt}\displaystyle}
+\renewcommand{\tbinom}{\genfrac(){0pt}\textstyle}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname directlua\endcsname\relax
\def\fracstyle{%
\ifcase\numexpr\mathstyle\relax
- \chardef\mathstyle=\@ne
- \or
- \chardef\mathstyle=\@ne
- \or
- \chardef\mathstyle=\tw@
- \or
- \chardef\mathstyle=\tw@
- \else
- \chardef\mathstyle=\thr@@
+ \chardef\mathstyle=0\relax % 0
+ \or \chardef\mathstyle=1\relax % 1
+ \or \chardef\mathstyle=2\relax % 2
+ \or \chardef\mathstyle=3\relax % 3
+ \else \chardef\mathstyle=3\relax % 4 or more
\fi
}
\else