summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/breqn
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-04-20 03:03:09 +0000
committerNorbert Preining <norbert@preining.info>2020-04-20 03:03:09 +0000
commit2a6dafa8ee740f345650d6a697665bf85a57cc77 (patch)
tree41026274cc0ff06c74d65d2fa12b025a3d3d5764 /macros/latex/contrib/breqn
parent0e85a1501dd8b23f1debab0ed20d89b11146ad34 (diff)
CTAN sync 202004200303
Diffstat (limited to 'macros/latex/contrib/breqn')
-rw-r--r--macros/latex/contrib/breqn/CHANGES.md12
-rw-r--r--macros/latex/contrib/breqn/breqn.dtx46
-rw-r--r--macros/latex/contrib/breqn/breqn.pdfbin661613 -> 662197 bytes
-rw-r--r--macros/latex/contrib/breqn/flexisym.dtx6
-rw-r--r--macros/latex/contrib/breqn/flexisym.pdfbin286070 -> 286432 bytes
-rw-r--r--macros/latex/contrib/breqn/mathstyle.dtx111
-rw-r--r--macros/latex/contrib/breqn/mathstyle.pdfbin185205 -> 187035 bytes
7 files changed, 118 insertions, 57 deletions
diff --git a/macros/latex/contrib/breqn/CHANGES.md b/macros/latex/contrib/breqn/CHANGES.md
index bad962a4b7..c3d8781a5d 100644
--- a/macros/latex/contrib/breqn/CHANGES.md
+++ b/macros/latex/contrib/breqn/CHANGES.md
@@ -1,5 +1,17 @@
# Release notes for the `breqn` packages
+
+## v0.98j (2020/04/19)
+
+ * Remove `color` and `background` options from the documentation, as they have never done anything!
+ (Todo: make them do something...)
+ * Fix spacing bug in `dseries` with arbitrary fonts.
+ * Really fix `\\genfrac` this time, making it backwards compatible with amsmath definition.
+ * Revamp of `mathstyle` code for setting `\mathstyle` to ensure consistency between
+ LuaTeX and other engines.
+ (This was originally just a quick fix of the value of `\\mathstyle` within double
+ subscripts or superscripts)
+
## v0.98i (2020/02/18)
* Fix clash with new version of `babel` around use of the generic `\\@elt` command.
diff --git a/macros/latex/contrib/breqn/breqn.dtx b/macros/latex/contrib/breqn/breqn.dtx
index 9f344f3d1e..10b584bd83 100644
--- a/macros/latex/contrib/breqn/breqn.dtx
+++ b/macros/latex/contrib/breqn/breqn.dtx
@@ -150,8 +150,8 @@
%
%
% \title{The \pkg{breqn} package}
-% \def\fileversion{0.98i}
-% \def\filedate{2020/02/18}
+% \def\fileversion{0.98j}
+% \def\filedate{2020/04/19}
% \date{\pkg{breqn} bundle: \filedate\space\fileversion}
% \author{Authors: Michael J. Downes, Morten H\o gholm\\ Maintained by Morten H\o gholm, Will Robertson\\ Feedback: \texttt{https://github.com/wspr/breqn/issues}}
%
@@ -189,18 +189,29 @@
%
% \section{Package loading}
%
+% The \pkg{breqn} package automatically loads \pkg{amsmath} to avoid loading order conflicts.
+% It also automatically loads \pkg{flexisym} and \pkg{mathstyle}, but in some cases these
+% packages need to be loaded separately. The canonical order for package loading is:
+% \begin{verbatim}
+% \usepackage{amsmath}
+% \usepackage{flexisym}
+% \usepackage{breqn}
+% \end{verbatim}
%
% The recommended way of loading the \pkg{breqn} package is to load it
-% \emph{after} other packages dealing with math, \ie, after
-% \pkg{amsmath}, \pkg{amssymb}, or packages such as \pkg{mathpazo} or
-% \pkg{mathptmx}.
+% \emph{before} other packages dealing with math symbols, \ie, before
+% \pkg{amssymb}, or packages such as \pkg{mathpazo} or \pkg{mathptmx}.
+% However, this can sometimes lead to macro definition clashes, and in such cases
+% you may need to juggle the loading order to make it work.
+%
+% \subsection{Options for \pkg{flexisym}}
%
% The \pkg{flexisym} package (described in section \vref{flexisym}) is
% required by \pkg{breqn} and ensures the math symbols are set up
% correctly. By default \pkg{breqn} loads it with support for Computer
% Modern but if you use a different math package requiring slightly
-% different definitions, it must be loaded before \pkg{breqn}. Below
-% is an example of how you enable \pkg{breqn} to work with the widely
+% different definitions, \pkg{flexisym} must be explicitly loaded before \pkg{breqn} as shown above.
+% Below is an example of how you enable \pkg{breqn} to work with the widely
% used \pkg{mathpazo} package.
% \begin{verbatim}
%\usepackage{mathpazo}
@@ -214,11 +225,6 @@
% \fn{flexisym.dtx} for how to create a support file---it is easier
% than one might think. Contributions welcome.
%
-% The documentation for the package was formerly found in
-% \fn{breqndoc}. It has now been added to this implementation
-% file. Below follows the contents of the original \pkg{breqn}
-% documentation. Not all details hold anymore but I have prioritized
-% fixing the package.
%
% \section{Introduction}
%
@@ -556,8 +562,6 @@
% \begin{dmath}[spread={1pt}]
% \begin{dmath}[frame]
% \begin{dmath}[frame={1pt},framesep={2pt}]
-% \begin{dmath}[background={red}]
-% \begin{dmath}[color={purple}]
% \begin{dmath}[breakdepth={0}]
% \end{verbatim}
%
@@ -603,15 +607,6 @@
% Use the \opt{framesep} option to change the amount of space separating
% the frame from what it encloses. The default space is \cs{fboxsep}.
%
-% Use the \opt{background} option to produce a colored background for the
-% equation body. The \pkg{breqn} package doesn't automatically load the
-% \pkg{color} package, so this option won't work unless you remember
-% to load the \pkg{color} package yourself.
-%
-% Use the \opt{color} option to specify a different color for the contents
-% of the equation. Like the \opt{background} option, this doesn't work if
-% you forgot to load the \pkg{color} package.
-%
% Use the \opt{breakdepth} option to change the level of delimiter nesting
% to which line breaks are allowed. To prohibit line breaks within
% delimiters, set this to 0:
@@ -1381,7 +1376,7 @@
% Declare package name and date.
% \begin{macrocode}
\RequirePackage{expl3}
-\ProvidesExplPackage{breqn}{2020/02/18}{0.98i}{Breaking equations}
+\ProvidesExplPackage{breqn}{2020/04/19}{0.98j}{Breaking equations}
% \end{macrocode}
% Regrettably, \pkg{breqn} is internally a mess, so we have to take
% some odd steps.
@@ -6241,8 +6236,9 @@
\def\premath{%
% \end{macrocode}
% BRM: Tricky to cleanup space OR add space ONLY BETWEEN math!
+% FMi: improvement to measure against current font.
% \begin{macrocode}
- \ifdim\lastskip<.3em \unskip
+ \ifdim\lastskip<\fontdimen2\font \unskip
\else\ifnum\lastpenalty<\@M \dquad\fi\fi
}%
% \end{macrocode}
diff --git a/macros/latex/contrib/breqn/breqn.pdf b/macros/latex/contrib/breqn/breqn.pdf
index 900eee8636..7f4ccad37c 100644
--- a/macros/latex/contrib/breqn/breqn.pdf
+++ b/macros/latex/contrib/breqn/breqn.pdf
Binary files differ
diff --git a/macros/latex/contrib/breqn/flexisym.dtx b/macros/latex/contrib/breqn/flexisym.dtx
index cb9206c14e..571ec4a20d 100644
--- a/macros/latex/contrib/breqn/flexisym.dtx
+++ b/macros/latex/contrib/breqn/flexisym.dtx
@@ -78,8 +78,8 @@
% \fi
%
% \title{The \textsf{flexisym} package}
-% \def\fileversion{0.98i}
-% \def\filedate{2020/02/18}
+% \def\fileversion{0.98j}
+% \def\filedate{2020/04/19}
% \date{\filedate\space\fileversion}
% \author{Authors: Michael J. Downes, Morten H\o gholm\\ Maintained by Morten H\o gholm, Will Robertson\\ Feedback: \texttt{https://github.com/wspr/breqn/issues}}
%
@@ -97,7 +97,7 @@
% \begin{macrocode}
%<*package>
\RequirePackage{expl3}[2009/08/05]
-\ProvidesExplPackage{flexisym}{2020/02/18}{0.98i}{Make math characters macros}
+\ProvidesExplPackage{flexisym}{2020/04/19}{0.98j}{Make math characters macros}
\edef\do{%
\noexpand\AtEndOfPackage{%
diff --git a/macros/latex/contrib/breqn/flexisym.pdf b/macros/latex/contrib/breqn/flexisym.pdf
index 0fddf92710..69009a85d8 100644
--- a/macros/latex/contrib/breqn/flexisym.pdf
+++ b/macros/latex/contrib/breqn/flexisym.pdf
Binary files differ
diff --git a/macros/latex/contrib/breqn/mathstyle.dtx b/macros/latex/contrib/breqn/mathstyle.dtx
index 6df4e9426a..94aad71329 100644
--- a/macros/latex/contrib/breqn/mathstyle.dtx
+++ b/macros/latex/contrib/breqn/mathstyle.dtx
@@ -57,8 +57,8 @@
% \fi
%
% \title{The \textsf{mathstyle} package}
-% \def\fileversion{0.98i}
-% \def\filedate{2020/02/18}
+% \def\fileversion{0.98j}
+% \def\filedate{2020/04/19}
% \date{\filedate\quad\fileversion}
% \author{Authors: Michael J. Downes, Morten H\o gholm\\ Maintained by Morten H\o gholm, Will Robertson\\ Feedback: \texttt{https://github.com/wspr/breqn/issues}}
%
@@ -151,7 +151,7 @@
%<*package>
\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
% \end{macrocode}
%
@@ -215,6 +215,7 @@
% \end{macro}
%
% \begin{macro}{\mathstyle}
+% \begin{macro}{\mathstyledenom}
% A counter for the math style: 0--display, 2--text, 4--script, 6--scriptscript.
% The logic is that display maths will explicitly
% set \verb|\mathstyle| to zero (see above), so by default it is set to the
@@ -224,12 +225,14 @@
% \begin{macrocode}
\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
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% Save the four style changing primitives, \cs{mathchoice} and the
% fraction commands.
@@ -247,18 +250,18 @@
\@saveprimitive\abovewithdelims\@@abovewithdelims
% \end{macrocode}
% Then we redeclare the four style changing primitives: set the value of
-% \cs{mathstyle} if Lua\TeX{} is not in use.q
+% \cs{mathstyle} if Lua\TeX{} is not in use.
% \begin{macrocode}
\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
% \end{macrocode}
% First we get the primitive operations. These should have been
@@ -283,8 +286,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
@@ -338,17 +343,69 @@
% \end{macro}
%
% \begin{macro}{\genfrac}
+% The amsmath definition:
+% \begin{verbatim}
+% \DeclareRobustCommand{\genfrac}[4]{%
+% \def\@tempa{#1#2}%
+% \edef\@tempb{\@nx\@genfrac\@mathstyle{#4}%
+% \csname @@\ifx @#3@over\else above\fi
+% \ifx\@tempa\@empty \else withdelims\fi\endcsname}
+% \@tempb{#1#2#3}}
+% \end{verbatim}
+% with arguments:
+% \begin{itemize}
+% \item left-delim
+% \item right-delim
+% \item line thickness (default if empty)
+% \item mathstyle override
+% \item numerator
+% \item denominator
+% \end{itemize}
% The fractions. Note that this uses the same names as in
% \pkg{amsmath}. Much the same except here they call \cs{fracstyle}.
% \begin{macrocode}
\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#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
+ \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#3\maxdimen over\else above\fi
+ \if @#1@\else withdelims\fi\endcsname #1 #2 #3\relax
+ #6%
+ }%
+ }%
+}
+\fi
% \end{macrocode}
% \changes{v0.90}{2011/08/03}{\cs{fracstyle} must be called \emph{after}
% changing to the required style}
@@ -360,14 +417,14 @@
\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}
% \end{macrocode}
% The \cs{fracstyle} command is a switch to go one level down but no
@@ -377,15 +434,11 @@
\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
diff --git a/macros/latex/contrib/breqn/mathstyle.pdf b/macros/latex/contrib/breqn/mathstyle.pdf
index c9d84aee9a..3400c7a99c 100644
--- a/macros/latex/contrib/breqn/mathstyle.pdf
+++ b/macros/latex/contrib/breqn/mathstyle.pdf
Binary files differ