summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/mh/mathtools.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/mh/mathtools.dtx')
-rw-r--r--Master/texmf-dist/source/latex/mh/mathtools.dtx664
1 files changed, 563 insertions, 101 deletions
diff --git a/Master/texmf-dist/source/latex/mh/mathtools.dtx b/Master/texmf-dist/source/latex/mh/mathtools.dtx
index ef5dea37965..6c76f41d408 100644
--- a/Master/texmf-dist/source/latex/mh/mathtools.dtx
+++ b/Master/texmf-dist/source/latex/mh/mathtools.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2004-2011 by Morten Hoegholm <mh.ctan@gmail.com>
+% Copyright (C) 2004-2011 by Morten Hoegholm
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -12,7 +12,8 @@
%
% This work has the LPPL maintenance status "maintained".
%
-% This Current Maintainer of this work is Morten Hoegholm.
+% This Current Maintainer of this work is
+% Lars Madsen, Will Robertson and Joseph Wright
%
% This work consists of the main source file mathtools.dtx
% and the derived files
@@ -66,7 +67,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: mathtools 2011/04/06 v1.11}
+\Msg{* Package: mathtools 2012/05/10 v1.12}
\Msg{************************************************************************}
\keepsilent
@@ -76,7 +77,7 @@
This is a generated file.
-Copyright (C) 2002-2011 by Morten Hoegholm <mh.ctan@gmail.com>
+Copyright (C) 2002-2011 by Morten Hoegholm
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
@@ -88,7 +89,7 @@ LaTeX version 2005/12/01 or later.
This work has the LPPL maintenance status "maintained".
-This Current Maintainer of this work is Morten Hoegholm,
+This Current Maintainer of this work is
Lars Madsen, Will Robertson and Joseph Wright.
This work consists of the main source file mathtools.dtx
@@ -127,7 +128,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{mathtools.drv}%
- [2011/04/06 v1.11 mathematical typesetting tools]
+ [2012/05/10 v1.12 mathematical typesetting tools]
\documentclass{ltxdoc}
\IfFileExists{fourier.sty}{\usepackage{fourier}}{}
\addtolength\marginparwidth{-25pt}
@@ -172,6 +173,7 @@ and the derived files
}%
}
+
\newcommand*\ProvidedBy[2]{%
\hskip1sp
\marginpar{%
@@ -190,6 +192,16 @@ and the derived files
}%
}
+\newcommand*\tsxPosting[2]{%
+ \hskip1sp
+ \marginpar{%
+ \parbox[b]{\marginparwidth}{\small\sffamily\raggedright
+ \strut Posted on \texttt{\small tex.stackexchange.com} \\#1\\#2%
+ }%
+ }%
+}
+
+
\expandafter\def\expandafter\MakePrivateLetters\expandafter{%
\MakePrivateLetters \catcode`\_=11\relax
}
@@ -258,13 +270,14 @@ and the derived files
%
% \GetFileInfo{mathtools.drv}
%
-% \CheckSum{2584}
+% \CheckSum{2836}
%
% \title{The \pkg{mathtools} package\thanks{This file has version number
% \fileversion, last revised \filedate.}}
%
-% \author{Morten H\o gholm, Lars Madsen,\\ Will Robertson and Joseph
-% Wright\\ (maintainers)}
+% \author{Lars Madsen, Will Robertson and Joseph
+% Wright\\ (maintainers)\thanks{The maintainers would like to thank
+% Morten H\o gholm for his contributions to this package}}
% \date{\filedate}
%
% \maketitle
@@ -275,7 +288,7 @@ and the derived files
% 1)~correct various bugs/defeciencies in \pkg{amsmath} until
% these are fixed by the \AmS{} and 2)~provide useful tools
% for mathematical typesetting, be it a small macro for
-% typesetting a prescript or an underbraket, or entirely new
+% typesetting a prescript or an underbracket, or entirely new
% display math constructs such as a \env{multlined} environment.
% \end{abstract}
%
@@ -358,7 +371,7 @@ and the derived files
% [v] = 200
% \end{gathered}
% \]
-% Yes, the \texttt[p] has been gobbled without any warning
+% Yes, the \texttt{[p]} has been gobbled without any warning
% whatsoever.\footnote{\pkg{amsmath} thought the \texttt[p] was an
% optional argument, checked if it was \texttt{t} or \texttt{b} and
% when both tests failed, assumed it was a \texttt{c}.} This is
@@ -386,7 +399,7 @@ and the derived files
% \begin{codesyntax}
% \SpecialUsageIndex{\mathtoolsset}\cs{mathtoolsset}\marg{key val list}
% \end{codesyntax}
-% Many of the tools shown in this manual can be turned on and off be
+% Many of the tools shown in this manual can be turned on and off by
% setting a switch to either true or false. In all cases it is done
% with the command \cs{mathtoolsset}. A typical use could be something like
% \begin{verbatim}
@@ -446,7 +459,7 @@ and the derived files
% these macros I find it better to read the article; an online
% version can be found at
% \begin{quote}
-% \url{http://www.tug.org/TUboat/Articles/tb22-4/tb72perlS.pdf}
+% \url{http://www.tug.org/TUGboat/Articles/tb22-4/tb72perlS.pdf}
% \end{quote}
% Note that the definitions shown in the article do not exactly
% match the definitions in \pkg{mathtools}. Besides providing an
@@ -650,6 +663,8 @@ and the derived files
% command \cs{adjustlimits} is useful in these cases, as you can
% just put it in front of these consecutive operators and it'll make
% the limits line up.
+% \medskip\par\noindent
+% \begin{minipage}{\textwidth}
% \begin{verbatim}
% \[
% \text{a)} \adjustlimits\lim_{n\to\infty} \max_{p\ge n} \quad
@@ -658,7 +673,8 @@ and the derived files
% \text{d)} \adjustlimits\limsup_{n\to\infty} \max_{p\ge n}
% \]
% \end{verbatim}
-% \[
+% \end{minipage}
+% \[
% \text{a)} \adjustlimits\lim_{n\to\infty} \max_{p\ge n} \quad
% \text{b)} \adjustlimits\lim_{n\to\infty} \max_{p^2\ge n} \quad
% \text{c)} \adjustlimits\lim_{n\to\infty} \sup_{p^2\ge nK} \quad
@@ -667,6 +683,42 @@ and the derived files
% The use of \cs{sb} instead of \texttt{\_} is allowed.
%
%
+% \subsubsection{Swapping space above \texorpdfstring{\AmS}{AMS} display math environments }
+% \label{sec:swapping}
+%
+% One feature that the plain old \env{equation} environment has that
+% the \AmS\ environments does not (because of thechnical reasons), is
+% the feature of using less space above the equation if the situation
+% presents itself. The \AmS\ environments cannot do this, but one can
+% manually, using
+% \begin{codesyntax}
+% \SpecialUsageIndex{\SwapAboveDisplaySkip}
+% \cs{SwapAboveDisplaySkip}
+% \end{codesyntax}
+% as the very first content within an \AmS\ display math
+% environment. It will then issue an \cs{abovedisplayshortskip}
+% instead of the normal \cs{abovedisplayskip}.
+%
+% Note it will not work with the \env{equation} or \env{multline} environments.
+%
+% Here is an example of the effect
+% \begin{verbatim}
+% \noindent\rule\textwidth{1pt}
+% \begin{align*} A &= B \end{align*}
+% \noindent\rule\textwidth{1pt}
+% \begin{align*}
+% \SwapAboveDisplaySkip
+% A &= B
+% \end{align*}
+% \end{verbatim}
+% \noindent\rule\textwidth{1pt}
+% \begin{align*} A &= B \end{align*}
+% \noindent\rule\textwidth{1pt}
+% \begin{align*}
+% \SwapAboveDisplaySkip
+% A &= B
+% \end{align*}
+%
%
% \subsection{Controlling tags}
%
@@ -732,6 +784,13 @@ and the derived files
% \usetagform{default}
% \end{verbatim}
%
+% \changes{v1.12}{2012/05/09}{Added caveat}
+% \noindent\textbf{Caveat regarding \pkg{ntheorem}}: If you like to
+% change the appearence of the tags \emph{and} you are also using the
+% \pkg{ntheorem} package, then please postpone the change of
+% appearance until \emph{after} loading \pkg{ntheorem}. (In order to
+% do its thing \pkg{ntheorem} has to mess with the tags\dots)
+%
% \subsubsection{Showing only referenced tags}
%
% \begin{codesyntax}
@@ -825,21 +884,23 @@ and the derived files
% Note that this feature only works if you use \cs{eqref} or
% \cs{refeq} to reference your equations.
%
-% When using \key{showonlyrefs} it might be usefull to be able to
-% actually add a few equation numbers without directly refering to
+% When using \key{showonlyrefs} it might be useful to be able to
+% actually add a few equation numbers without directly referring to
% them.
% \begin{codesyntax}
% \SpecialUsageIndex{\noeqref}\cs{noeqref}\marg{label,label,\dots}
% \end{codesyntax}
% \FeatureRequest{Rasmus Villemoes}{2008/03/26}
-% The syntax is somewhat similar to \cs{nocite}.
+% The syntax is somewhat similar to \cs{nocite}. If a label in the
+% list is undefined we will throw a warning in the same manner as
+% \cs{ref}.
%
% \medskip\noindent\textbf{BUG 1:} Unfortunately the use of the
% \key{showonlyref} introduce a bug within amsmath's typesetting
% of formula versus equation number. This bug manifest itself by
% allowing formulas to be typeset close to or over the equation
% number. Currently no general fix is known, other than making sure
-% that ones formulas are not long enough to touch the equation
+% that one's formulas are not long enough to touch the equation
% number.
%
% To make a long story stort, amsmath typesets its math environments
@@ -848,15 +909,15 @@ and the derived files
% number is recorded such that the formula or the equation number can
% be moved (if necessary) in the typesetting part. When
% \key{showonlyref} is enabled, the width of the equation number
-% depend on whether or not this number is refered~to. To determine
+% depend on whether or not this number is referred~to. To determine
% this, we need to know the current label. But the current label is
% \emph{not} known in the measuring phase. Thus the measured width is
-% always zero (because no label equals not refered to) and therefore
+% always zero (because no label equals not referred to) and therefore
% the typesetting phase does not take the equation number into
% account.
%
% \medskip\noindent\textbf{BUG 2:} Currently there is a bug between
-% \key{showonlyrefs} and the \pkg{ntheorem} package, then the
+% \key{showonlyrefs} and the \pkg{ntheorem} package, when the
% \pkg{ntheorem} option \key{thmmarks} is active. The shown equation
% numbers may come out wrong (seems to be multiplied by 2). The
% easiest fix is to add the following line
@@ -903,7 +964,7 @@ and the derived files
% extensible arrows are the only two of their kind defined by
% \pkg{amsmath}, but luckily \pkg{mathtools} helps with that. The
% extensible arrow-like symbols in \pkg{mathtools} follow the same
-% naming scheme as the ones in \pkg{amsmath} so to get an extensible
+% naming scheme as the one's in \pkg{amsmath} so to get an extensible
% \cs{Leftarrow} you simply do a
% \begin{verbatim}
% \[
@@ -991,7 +1052,7 @@ and the derived files
% \mathop{\thinboxed[blue]{\sum}}_{n}
% \mathop{\thinboxed[blue]{\LaTeXunderbrace{\thinboxed[green]{foof}}}}_{zzz}
% \]
-% \normalsize Now there's to little space between the brace and the
+% \normalsize Now there's too little space between the brace and the
% $zzz$ and also too little space between the brace and the $foof$.
% If you use Computer Modern you'll actually see that the $f$
% overlaps with the brace! Let's try in \cs{footnotesize}:
@@ -1122,8 +1183,8 @@ and the derived files
% the default is \cs{,}.
%
% As an extra trick the fences will behave as open and closing fences
-% inconstract to their auto-scaling nature.\footnote{\cs{left} and
-% \cs{right} does \emph{not} produce open an closing fences, thus
+% in constract to their auto-scaling nature.\footnote{\cs{left} and
+% \cs{right} do \emph{not} produce open and closing fences, thus
% the space before or after may be too large. Inside this
% construction they behave.}
%
@@ -1291,6 +1352,21 @@ and the derived files
% The environments \env{rcases}, \env{rcases*}, \env{drcases} and
% \env{drcases*} are equivalent to \env{cases} and \env{dcases}, but
% here the brace is placed on the right instead of on the left.
+% \begin{verbatim}
+% \[
+% \begin{rcases*}
+% x^2 & for $x>0$\\
+% x^3 & else
+% \end{rcases*} \quad \Rightarrow \cdots
+% \]
+% \end{verbatim}
+% \[
+% \begin{rcases*}
+% x^2 & for $x>0$\\
+% x^3 & else
+% \end{rcases*} \quad \Rightarrow\cdots
+% \]
+%
%
% \subsubsection{Emulating indented lines in alignments}
% \begin{codesyntax}
@@ -1298,7 +1374,7 @@ and the derived files
% \end{codesyntax}
% \ProvidedBy{Lars Madsen}{2008/06/05}
% In \cite{Swanson}, Ellen Swanson recommends that when ever one has
-% a long displayed formula, spannig several lines, and it is
+% a long displayed formula, spanning several lines, and it is
% unfeasible to align against a relation within the first line, then
% all lines in the display should be aligned at the left most edge of
% the first line, and all subsequent lines should be indented by 2em
@@ -1341,13 +1417,20 @@ and the derived files
%
% The \texttt{amsmath} package provie the \cs{boxed} macro to box
% material in math mode. But this of course will not work if the box
-% should cross an alignment point. We provide a macro that can.
+% should cross an alignment point. We provide a macro that
+% can.\footnote{Note that internally \cs{Aboxed} does use \cs{boxed}.}
% \hskip1sp
% \marginpar{%
% \parbox[b]{\marginparwidth}{\small\sffamily\raggedright
% \strut Evolved from a request by\\Merciadri Luca\\
% 2010/06/28\\on comp.text.tex%
-% }
+% }\strut
+% }%
+% \marginpar{\strut\\%
+% \parbox[b]{\marginparwidth}{\small\sffamily\raggedright
+% \strut Reimplemented by\\Florent Chervet (GL) \\
+% 2011/06/11\\on comp.text.tex%
+% }\strut
% }%
% \begin{codesyntax}
% \SpecialEnvIndex{\Aboxed}\cs{Aboxed}\marg{left hand side
@@ -1365,10 +1448,28 @@ and the derived files
% \Aboxed{ f(x) & = \int h(x)\, dx} \\
% & = g(x)
% \end{align*}
-%
+% One can have multiple boxes on each line, and the
+% >>\texttt{\textnormal{\&}}\quad right hand side<< can even be
+% missing. Here is an example of how the padding in the box can be changed
+% \begin{verbatim}
+% \begin{align*}
+% \setlength\fboxsep{1em}
+% \Aboxed{ f(x) &= 0 } & \Aboxed{ g(x) &= b} \\
+% \Aboxed{ h(x) } & \Aboxed{ i(x) }
+% \end{align*}
+% \end{verbatim}
+% \begin{align*}
+% \setlength\fboxsep{1em}
+% \Aboxed{ f(x) &= 0 } & \Aboxed{ g(x) &= b} \\
+% \Aboxed{ h(x) } & \Aboxed{ i(x) }
+% \end{align*}
+% Note how the \cs{fboxsep} change only affect the box coming
+% immediately after it.
%
% \subsubsection{Adding arrows between lines in an alignment}
%
+% This first macro is a bit misleading, it is only intended to be
+% used in combination with the \env{alignat(*)} environment.
% \begin{codesyntax}
% \SpecialEnvIndex{\ArrowBetweenLines}\cs{ArrowBetweenLines}\oarg{symbol}\\
% \SpecialEnvIndex{\ArrowBetweenLines*}\cs{ArrowBetweenLines*}\oarg{symbol}
@@ -1381,20 +1482,21 @@ and the derived files
% }
% }%
% To add, say $\Updownarrow$ between two lines in an alignment use
-% \cs{ArrowBetweenLines} and the \env{alignat} environment:
+% \cs{ArrowBetweenLines} and the \env{alignat} environment (note the
+% extra pair of \texttt{\&}'s in front):
% \begin{verbatim}
-% \begin{alignat*}{2}
+% \begin{alignat}{2}
% && \framebox[1.5cm]{} &= \framebox[3cm]{}\\
% \ArrowBetweenLines % \Updownarrow is the default
% && \framebox[1.5cm]{} &= \framebox[2cm]{}
-% \end{alignat*}
+% \end{alignat}
% \end{verbatim}
% resulting in
-% \begin{alignat*}{2}
+% \begin{alignat}{2}
% && \framebox[1.5cm]{} &= \framebox[3cm]{}\\
% \ArrowBetweenLines
% && \framebox[1.5cm]{} &= \framebox[2cm]{}
-% \end{alignat*}
+% \end{alignat}
% Note the use of \verb+&&+ starting each \emph{regular} line of
% math. For adding the arrow on the right, use
% \cs{ArrowBetweenLines*}\oarg{symbol}, and end each line of math
@@ -1457,7 +1559,7 @@ and the derived files
% & = d
% \end{align*}
% Thus \verb?\vdotswithin{=}? create a box corersponding to
-% \verb?{}={}? and typeset a $\vdots$ centered inside it. When doing
+% \verb?{}={}? and typeset a >>$\vdots$<< centered inside it. When doing
% this as a normal line in an alignment leaves us with excessive space
% which \verb?\shortvdotswithin{=}? takes care with for us.
%
@@ -1496,7 +1598,7 @@ and the derived files
% indicated. Their original values are \verb?2.15\origjot? and
% \verb?\origjot? respectively (\verb?\origjot? is usually 3pt).
%
-% \subsection{Short intertext}
+% \subsection{Intertext and short intertext}
%
%
% \begin{codesyntax}
@@ -1504,7 +1606,7 @@ and the derived files
% \end{codesyntax}
% \cttPosting{Gabriel Zachmann and Donald Arseneau}{2000/05/12--13}
% \pkg{amsmath} provides the command \cs{intertext} for interrupting
-% a multi line display while still maintaining the alignment points.
+% a multiline display while still maintaining the alignment points.
% However the spacing often seems quite excessive as seen below.
% \begin{verbatim}
% \begin{align}
@@ -1530,9 +1632,57 @@ and the derived files
% c&=d
% \end{align}
%
+% \noindent
+% It turns out that both \cs{shortintertext} and the original
+% \cs{intertext} from \pkg{amsmath} has a slight problem. If we use
+% the \env{spreadlines} (see section~\ref{sec:spread}) to open up
+% the equations in a multiline calculation, then this opening up
+% value also applies to the spacing above and below the original
+% \cs{shortintertext} and \cs{intertext}. \tsxPosting{Tobias Weh
+% \\(referring to a suggestion by Chung-chieh Shan)}{2011/05/29}
+% It can be illustrated using the following example, an interested
+% reader, can apply it with and with out the original \cs{intertext}
+% and \cs{shortintertext}.
+% \begin{verbatim}
+% % the original \intertext and \shortintertext
+% \mathtoolsset{original-intertext,original-shortintertext}
+% \newcommand\myline{\par\noindent\rule{\textwidth}{1mm}}
+% \myline
+% \begin{spreadlines}{1em}
+% \begin{align*}
+% AA\\ BB\\ \intertext{\myline}
+% AA\\ BB\\ \shortintertext{\myline}
+% AA\\ BB
+% \end{align*}
+% \end{spreadlines}
+% \myline
+% \end{verbatim}
%
+% We now fix this internaly for both \cs{intertext} and
+% \cs{shortintertext}, plus we add the posibility to fine tune
+% spacing around these constructions. The original versions can be
+% brought back using the \texttt{original-x} keys below.
+% \begin{codesyntax}
+% \SpecialUsageIndex{\intertext}\cs{intertext}\marg{text}\\
+% \SpecialUsageIndex{\shortintertext}\cs{shortintertext}\marg{text}\\
+% \SpecialKeyIndex{original-intertext}$\key{original-intertext}=\texttt{true}\vert\texttt{false}$ \quad(default: \texttt{false})\\
+% \SpecialKeyIndex{original-shortintertext}$\key{original-shortintertext}=\texttt{true}\vert\texttt{false}$
+% \quad(default: \texttt{false})\\
+% \SpecialKeyIndex{above-intertext-dim}$\key{above-intertext-dim}=\meta{dimen}$ \quad(default: 0pt)\\
+% \SpecialKeyIndex{below-intertext-dim}$\key{below-intertext-dim}=\meta{dimen}$ \quad(default: 0pt)\\
+% \SpecialKeyIndex{above-shortintertext-dim}$\key{above-shortintertext-dim}=\meta{dimen}$ \quad(default: 3pt)\\
+% \SpecialKeyIndex{below-shortintertext-dim}$\key{below-shortintertext-dim}=\meta{dimen}$ \quad(default: 3pt)
+% \end{codesyntax}
+% The updated \cs{shortintertext} will look like the original version
+% unless for areas with an enlarged \cs{jot} value (see for example
+% the \env{spreadlines}, section~\ref{sec:spread}). Whereas \cs{intertext}
+% will have a slightly smaller value above and below (corresponding
+% to about 3pt less space above and below), the spacing around
+% \cs{intertext} should now match the normal spacing going into and
+% out of an \env{align}.
%
-%
+% \textbf{Tip:} \cs{intertext} and \cs{shortintertext} also works
+% within \env{gather}.
%
% \subsection{Paired delimiters}
%
@@ -1630,22 +1780,22 @@ and the derived files
% More interestingly we can refer to the size inside the
% \meta{code}. Here we do a weird three argument `braket'
% \begin{verbatim}
-% \DeclarePairedDelimiterX\brakket[3]{\langle}{\rangle}%
+% \DeclarePairedDelimiterX\braket[3]{\langle}{\rangle}%
% {#1\,\delimsize\vert\,#2\,\delimsize\vert\,#3}
% \end{verbatim}
% Then we can get
% \DeclarePairedDelimiterX\innerp[2]{\langle}{\rangle}{#1,#2}
-% \DeclarePairedDelimiterX\brakket[3]{\langle}{\rangle}%
+% \DeclarePairedDelimiterX\braket[3]{\langle}{\rangle}%
% {#1\,\delimsize\vert\,#2\,\delimsize\vert\,#3}
% \begin{verbatim}
% \[
% \innerp*{A}{ \frac{1}{2} } \quad
-% \brakket[\Big]{B}{\sum_{k} f_k}{C}
+% \braket[\Big]{B}{\sum_{k} f_k}{C}
% \]
% \end{verbatim}
% \[
% \innerp*{A}{ \frac{1}{2} } \quad
-% \brakket[\Big]{B}{\sum_{k}}{C}
+% \braket[\Big]{B}{\sum_{k}}{C}
% \]
% \iffalse
% \bigskip
@@ -1669,6 +1819,38 @@ and the derived files
% is a feature of the \cs{left}\dots\cs{right} construction).
% \fi
%
+%
+% \subsubsection{Expert use}
+%
+% Within the starred version of \cs{DeclarePairedDelimiter} and
+% \cs{DeclarePairedDelimiterX} we make a few changes such that the
+% auto scaled \cs{left} and \cs{right} fences behave as opening and
+% closing fences, i.e.\ $\sin(x)$ vs. $\sin\left(x\right)$ (the later
+% made via \verb|$\sin\left(x\right)$|), notice the gab between
+% '$\sin$' and '('. In some special cases it may be useful to be
+% able to tinker with the behavior.
+% \begin{codesyntax}
+% \SpecialUsageIndex{\reDeclarePairedDelimiterInnerWrapper}\cs{reDeclarePairedDelimiterInnerWrapper}\marg{macro name}\marg{\textnormal{\texttt{star}} or \textnormal{\texttt{nostar}}}\marg{code}
+% \end{codesyntax}
+% Internally several macros are created, including two call backs
+% that take care of the formatting. There is one internal macro for
+% the starred version, labeled \texttt{star}, the other one is
+% labeled \texttt{nostar}. Within \meta{code}, \texttt{\#1} will be
+% replaced by the scaled left fence, \texttt{\#3} the corresponding
+% scaled right fence, and \texttt{\#2} the stuff in between. For
+% example, here is how one might turn the content into \cs{mathinner}:
+% \begin{verbatim}
+% \DeclarePairedDelimiter\abs\lvert\rvert
+% \reDeclarePairedDelimiterInnerWrapper\abs{star}{#1#2#3}
+% \reDeclarePairedDelimiterInnerWrapper\abs{nostar}{\mathinner{#1#2#3}}
+% \end{verbatim}
+% The default values for the call backs corresponds to
+% \begin{verbatim}
+% star: \mathopen{}\mathclose\bgroup #1#2\aftergroup\egroup #3
+% nostar: \mathopen{#1}#2\mathclose{#3}
+% \end{verbatim}
+%
+%
% \subsection{Special symbols}
%
% This part of the manual is about special symbols. So far only one
@@ -1728,7 +1910,7 @@ and the derived files
% \medskip
% \noindent\textbf{Warning:} \texttt{centercolon} \emph{does not}
% work with languages that make use of an active colon, most notably
-% French. Sadly the \texttt{babel} package does not distinguish
+% \emph{French}. Sadly the \texttt{babel} package does not distinguish
% between text and math when it comes to active characters. Nor does
% it provide any hooks to deal with math. So currently no general
% solution exists for this problem.
@@ -1781,7 +1963,8 @@ and the derived files
% \SpecialUsageIndex{\bigtimes}\cs{bigtimes}
% \end{codesyntax}
%
-% \emph{Note:} that these symbols are constructed via
+% \noindent
+% \textbf{Note:} that these symbols are constructed via
% features from the \pkg{graphicx} package, and thus may not display
% correctly in most DVI previewers. Also note that \cs{nuparrow} and
% \cs{ndownarrow} are constructed via \cs{nrightarrow} and
@@ -1914,7 +2097,8 @@ and the derived files
% \myisotope{A}{Z}{X}\to \myisotope{A-4}{Z-2}{Y}+
% \myisotope{4}{2}{\alpha}
% \]
-%
+% (Though a package like \pkg{mhchem} might be more suitable for this
+% type of material.)
%
% \subsection{Declaring math sizes}
%
@@ -1935,7 +2119,7 @@ and the derived files
% been fixed in \LaTeX, this fix will be removed from
% \pkg{mathtools}.
%
-% \subsection{Spreading equations}
+% \subsection{Spreading equations}\label{sec:spread}
%
% \begin{codesyntax}
% \SpecialEnvIndex{spreadlines}
@@ -1943,7 +2127,7 @@ and the derived files
% \cs{end}\arg{spreadlines}
% \end{codesyntax}
% \cttPosting{Michael J.~Downes}{2002/10/17}
-% The spacing between lines in a multi line math environment such as
+% The spacing between lines in a multiline math environment such as
% \env{gather} is governed by the dimension \cs{jot}. The
% \env{spreadlines} environment takes one argument denoting the
% value of \cs{jot} inside the environment:
@@ -2049,7 +2233,7 @@ and the derived files
% \SpecialUsageIndex{\splitdfrac}\cs{splitdfrac}\marg{numer}\marg{denom}
% \end{codesyntax}
% \cttPosting{Michael J.~Downes}{2001/12/06}
-% These commands provide split fractions e.g., multi line fractions:
+% These commands provide split fractions e.g., multiline fractions:
% \begin{verbatim}
% \[
% a=\frac{
@@ -2213,7 +2397,7 @@ and the derived files
% \begin{macrocode}
%<*package>
\ProvidesPackage{mathtools}%
- [2011/04/06 v1.11 mathematical typesetting tools]
+ [2012/04/24 v1.12 mathematical typesetting tools]
% \end{macrocode}
% \changes{v1.10}{2011/02/12}{Might as well make sure that we need the
% latest version of \texttt{mhsetup}}
@@ -2410,7 +2594,9 @@ and the derived files
% \end{macrocode}
% We test if the equation was labelled. We already know if it was
% tagged manually. Have to watch out for \TeX\ inserting a blank line
-% so do not let the tag have width zero.
+% so do not let the tag have width zero. Rememeber
+% \cs{@safe@activestrue/false} in order to handle active chars in labels.
+% \changes{v1.12}{2012/04/24}{Added \cs{@safe@activestrue/false}}
% \begin{macrocode}
\if_meaning:NN \df@label\@empty
\MH_if_boolean:nTF {manual_tag}% this was \MH_if_boolean:nT before
@@ -2422,14 +2608,27 @@ and the derived files
\MH_if_boolean:nTF {manual_tag}
{ \MH_if_boolean:nTF {show_manual_tags}
{ \MT_prev_tagform:n {#1} }
- { \@ifundefined{MT_r_\df@label}
- { }
+ { \@safe@activestrue
+ \@ifundefined{MT_r_\df@label}
+% \end{macrocode}
+% Next we need to remember to deactivate the manual tags switch. This
+% is usually done using \verb|\MT_extended_maketag:n|, but this is not
+% the case if the show manual tags is false and the manual tag is not
+% referred to.
+% \changes{v1.12}{2011/06/08}{Added the falsification of manual tag
+% when show manual tags is off and maual tag is not referred to}
+% \begin{macrocode}
+ { \global\MH_set_boolean_F:n {manual_tag} }
{ \MT_prev_tagform:n {#1} }
+ \@safe@activesfalse
}
}
- { \@ifundefined{MT_r_\df@label}
+ {
+ \@safe@activestrue
+ \@ifundefined{MT_r_\df@label}
{ }
{ \refstepcounter{equation}\MT_prev_tagform:n {#1} }
+ \@safe@activesfalse
}
\fi:
\global\MH_set_boolean_T:n {raw_maketag}
@@ -2438,6 +2637,7 @@ and the derived files
% \end{macro}
% \begin{macro}{\MT_extended_maketag:n}
% The extended version of \cs{maketag@@@}.
+% \changes{v1.12}{2012/04/24}{Added \cs{@safe@activestrue/false}}
% \begin{macrocode}
\def\MT_extended_maketag:n #1{
\ifx\df@label\@empty
@@ -2447,16 +2647,18 @@ and the derived files
{
\MH_if_boolean:nTF {show_manual_tags}
{ \MT_maketag:n {#1} }
- { \@ifundefined{MT_r_\df@label}
+ { \@safe@activestrue
+ \@ifundefined{MT_r_\df@label}
{ }
{ \MT_maketag:n {#1} }
+ \@safe@activesfalse
}
}
{ \MT_maketag:n {#1} }
\fi:
% \end{macrocode}
% As this function is always called we let it set the marker for a manual
-% tag false when exiting.
+% tag false when exiting (well actually not true, see above).
% \begin{macrocode}
\global\MH_set_boolean_F:n {manual_tag}
}
@@ -2593,19 +2795,45 @@ and the derived files
%
% \begin{macro}{\noeqref}
% \changes{v1.04}{2008/03/26}{Added \cs{noeqref} (daleif)}
-% Macro for adding numbers to non-refered equations. Syntax similar
+% \changes{v1.12}{2012/04/20}{Labels containing active chars (babel)
+% are now allowed}
+% \changes{v1.12}{2012/04/24}{\cs{noeqref} will now make a reference
+% warning if users use undefined labels in \cs{noeqref}, requested
+% by Tue Christensen}
+% Macro for adding numbers to non-referred equations. Syntax similar
% to \cs{nocite}.
% \begin{macrocode}
\MHInternalSyntaxOff
\newcommand\noeqref[1]{\@bsphack
\@for\@tempa:=#1\do{%
+ \@safe@activestrue%
\edef\@tempa{\expandafter\@firstofone\@tempa}%
+ \@ifundefined{r@\@tempa}{%
+ \protect\G@refundefinedtrue%
+ \@latex@warning{Reference `\@tempa' on page \thepage \space
+ undefined (\string\noeqref)}%
+ }{}%
\if@filesw\protected@write\@auxout{}%
- {\string\MT@newlabel{\@tempa}}\fi}
+ {\string\MT@newlabel{\@tempa}}\fi%
+ \@safe@activesfalse}
\@esphack}
-\MHInternalSyntaxOn
+
% \end{macrocode}
% \end{macro}
+%
+% \begin{macro}{\@safe@activestrue}
+% \begin{macro}{\@safe@activesfalse}
+% These macros are provided by babel. We \emph{provide} them here,
+% just to make sure they exist.
+% \begin{macrocode}
+\providecommand\@safe@activestrue{}%
+\providecommand\@safe@activesfalse{}%
+
+\MHInternalSyntaxOn
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
%
% \subsection{Extensible arrows etc.}
%
@@ -3234,6 +3462,41 @@ and the derived files
%
% \subsection{Paired delimiters}
%
+% \changes{v1.13}{2012/05/10}{Extended \cs{DeclarePairedDelimiter(X)}}
+% \begin{macro}{\MT_delim_default_inner_wrappers:n}
+% In some cases users may want to control the internals a bit more. We
+% therefore create two call back macros each time the
+% \cs{DeclarePaired...} macro is issued. The default value of these
+% call backs are provided by |\MT_delim_default_inner_wrappers:n|
+% \begin{macrocode}
+\newcommand\MT_delim_default_inner_wrappers:n [1]{
+ \@namedef{MT_delim_\MH_cs_to_str:N #1 _star_wrapper:nnn}##1##2##3{
+ \mathopen{}\mathclose\bgroup ##1 ##2 \aftergroup\egroup ##3
+ }
+ \@namedef{MT_delim_\MH_cs_to_str:N #1 _nostar_wrapper:nnn}##1##2##3{
+ \mathopen{##1}##2\mathclose{##3}
+ }
+ }
+
+% \end{macrocode}
+% \begin{macro}{\reDeclarePairedDelimiterInnerWrapper}
+% Macro enabling the user to alter an existing call back. Note that
+% currently no checks are performed. First argument is the name of
+% the macro we are altering (as defined via \cs{DeclarePaired...}),
+% the second is \texttt{star} or \texttt{nostar}. In the last
+% argument \texttt{\#1} and \texttt{\#3} respectively refer to the
+% scaled fences and \texttt{\#3} refer to whatever come between.
+% \begin{macrocode}
+\newcommand\reDeclarePairedDelimiterInnerWrapper[3]{
+ \@namedef{MT_delim_\MH_cs_to_str:N #1 _ #2 _wrapper:nnn}##1##2##3{
+ #3
+ }
+}
+
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
% \begin{macro}{\DeclarePairedDelimiter}
% \changes{v1.06}{2008/08/01}{Made user command robust}
% This macro defines |#1| to be a control sequence that takes either
@@ -3247,9 +3510,13 @@ and the derived files
% \changes{1.08e}{2010/09/02}{`Fixed' \cs{left}\dots\cs{right} bad spacing}
% \changes{1.08e}{2010/09/14}{redid the \cs{left}\dots\cs{right} fix,
% see \cs{DeclarePairedDelimiterX} for details.}
+% \changes{v1.13}{2012/05/10}{Using call back instead}
% \begin{macrocode}
+ \MT_delim_default_inner_wrappers:n{#1}
\@namedef{MT_delim_\MH_cs_to_str:N #1 _star:}##1
- {\mathopen{}\mathclose\bgroup\left#2 ##1 \aftergroup\egroup\right #3}%
+ %{\mathopen{}\mathclose\bgroup\left#2 ##1 \aftergroup\egroup\right #3}%
+ { \@nameuse{MT_delim_\MH_cs_to_str:N #1 _star_wrapper:nnn}%
+ {\left#2}{##1}{\right#3} }%
% \end{macrocode}
% The command with optional argument. It should be \cs{bigg} or
% alike.
@@ -3262,9 +3529,15 @@ and the derived files
% \end{macrocode}
% With the default optional argument we wind up with \cs{relax},
% else we get \cs{biggr} and \cs{biggl} etc.
-% \begin{macrocode}
- \mathopen{\@nameuse {\MH_cs_to_str:N ##1 l} #2} ##2
- \mathclose{\@nameuse {\MH_cs_to_str:N ##1 r} #3}}
+% \changes{v1.13}{2012/05/10}{Using call back instead}
+% \begin{macrocode}
+ %\mathopen{\@nameuse {\MH_cs_to_str:N ##1 l} #2} ##2
+ %\mathclose{\@nameuse {\MH_cs_to_str:N ##1 r} #3}}
+ \@nameuse{MT_delim_\MH_cs_to_str:N #1 _nostar_wrapper:nnn}%
+ {\@nameuse {\MH_cs_to_str:N ##1 l} #2}
+ {##2}
+ {\@nameuse {\MH_cs_to_str:N ##1 r} #3}
+ }
% \end{macrocode}
% The user command comes here. Just check for the star and choose
% the right internal command.
@@ -3286,7 +3559,8 @@ and the derived files
% can specify the number of arguments the created macro has, and they
% can specify the code for the inner part of the macro. Other than
% that the code is fairly similar to \cs{DeclarePairedDelimiter}
-% \changes{v1.08e}{2010/09/02}{Provided better implementation of \cs{DeclarePairedDelimiterX}}
+% \changes{v1.08e}{2010/09/02}{Provided better implementation of
+% \cs{DeclarePairedDelimiterX}}
% \begin{macrocode}
\def\MHempty{}
\def\DeclarePairedDelimiterX#1[#2]#3#4#5{%
@@ -3304,6 +3578,11 @@ and the derived files
\fi
\fi
% \end{macrocode}
+% \changes{v1.13}{2012/05/10}{Using call back instead}
+% Initiate the default call backs.
+% \begin{macrocode}
+ \MT_delim_default_inner_wrappers:n{#1}
+% \end{macrocode}
% We make sure to store the delimiter size in the local variable
% \cs{delimsize}. Then users can refer to the size in the fifth
% argument. In the starred version it will refer to \cs{middle} and in
@@ -3315,16 +3594,20 @@ and the derived files
[#2]
{
\begingroup
- \def\delimsize{\middle}
+ \def\delimsize{\middle}
% \end{macrocode}
% This is slightly controversial, \cs{left}\dots\cs{right} are known
% to produce an inner atom, thus may cause different spacing than
-% normal delimiters. We `fix' this by introducing \cs{mathopen} and \cs{mathclose}:
+% normal delimiters. We `fix' this by introducing \cs{mathopen} and
+% \cs{mathclose}. This change is now factored out into call backs.
% \changes{v1.08e}{2010/09/14}{redid the left/right fix, inspired by
% ctt thread named `spacing after \cs{right}) and before \cs{left})'
% started 2010-08-12.}
+% \changes{v1.13}{2012/05/10}{Using call back instead}
% \begin{macrocode}
- \mathopen{}\mathclose\bgroup\left#3 #5 \aftergroup\egroup\right#4
+ %\mathopen{}\mathclose\bgroup\left#3 #5 \aftergroup\egroup\right#4
+ \@nameuse{MT_delim_\MH_cs_to_str:N #1 _star_wrapper:nnn}
+ {\left#3}{#5}{\right#4}
\endgroup
}
% \end{macrocode}
@@ -3353,19 +3636,30 @@ and the derived files
% \end{macrocode}
% Next we provide the inner workhorse. We need a bit of expansion
% magic to get \cs{delimsize} to work.
+% \changes{v1.13}{2012/05/10}{Using call back instead}
% \begin{macrocode}
\@xp\@xp\@xp
\newcommand
\@xp\csname MT_delim_\MH_cs_to_str:N #1 _nostar_inner:\endcsname
[#2]
{
- \mathopen{%
+ %\mathopen{%
+ % \let\MHempty\@gobble
+ % \@xp\@xp\@xp\csname\@xp\MH_cs_to_str:N \delimsize l\endcsname #3}
+ %#5
+ %\mathclose{%
+ % \let\MHempty\@gobble
+ % \@xp\@xp\@xp\csname\@xp\MH_cs_to_str:N \delimsize r\endcsname #4}
+ \@nameuse{MT_delim_\MH_cs_to_str:N #1 _nostar_wrapper:nnn}
+ {
\let\MHempty\@gobble
- \@xp\@xp\@xp\csname\@xp\MH_cs_to_str:N \delimsize l\endcsname #3}
- #5
- \mathclose{%
+ \@xp\@xp\@xp\csname\@xp\MH_cs_to_str:N \delimsize l\endcsname #3
+ }
+ {#5}
+ {
\let\MHempty\@gobble
- \@xp\@xp\@xp\csname\@xp\MH_cs_to_str:N \delimsize r\endcsname #4}
+ \@xp\@xp\@xp\csname\@xp\MH_cs_to_str:N \delimsize r\endcsname #4
+ }
\endgroup
}
\DeclareRobustCommand{#1}{
@@ -3909,6 +4203,23 @@ and the derived files
}
% \end{macrocode}
% \end{macro}
+%
+% \subsection{Swapping above display skip}
+%
+% \begin{macro}{\SwapAboveDisplaySkip}
+% This macro is intended to be used at the start of \AmS\
+% environments, in order to force it to use
+% \cs{abovedisplayshortskip} instead of \cs{abovedisplayskip} above
+% the displayed math. Because of the use of \cs{noalign} it will not
+% work inside \env{equation} or \env{multline}.
+% \begin{macrocode}
+\newcommand\SwapAboveDisplaySkip{%
+ \noalign{\vskip-\abovedisplayskip\vskip\abovedisplayshortskip}
+}
+
+% \end{macrocode}
+%
+% \end{macro}
%
% \subsection{An aid to alignment}
%
@@ -3916,48 +4227,39 @@ and the derived files
% \changes{v1.05}{2008/06/05}{Added \cs{MoveEqLeft} (daleif)}
% \changes{v1.05b}{2008/06/18}{We don't need \cs{setlength} here
% (daleif), after discussion about \cs{global} and \cs{setlength}
-% on ctt} This is a very simple macro, we `move' a line in an
+% on ctt}
+% \changes{v1.12}{2011/06/12}{We don't even need lengths. GL
+% suggested on ctt to just apply them directly.}
+% This is a very simple macro, we `move' a line in an
% alignment backwards in order to simulate that all subsequent lines
% have been indented. Note that simply using \verb+\kern-2m+ after
% the \verb+&+ is not enough, then the alignemnt environment never
% detects that there is anything (though simulated) in the cell
% before the \verb+&+.
% \begin{macrocode}
-\newcommand\MoveEqLeft[1][2]{%
- \global\@tempdima=#1em%
- \kern\@tempdima%
- &
- \kern-\@tempdima}
+\newcommand\MoveEqLeft[1][2]{\kern #1em & \kern -#1em}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Aboxed}
% \changes{v1.08}{2010/06/29}{Added \cs{Aboxed}}
% The idea from \cs{MoveEqLeft} can be used for other things. Here we
-% create a macro that will allow a user to box a single line in an
+% create a macro that will allow a user to box an equation inside an
% alignment.
+% \changes{v1.12}{2011/08/17}{\cs{Aboxed} reimplemented, cudos to GL}
% \begin{macrocode}
-\newcommand\Aboxed[1]{\@Aboxed#1\ENDDNE}
+\newcommand\Aboxed[1]{\let\bgroup{\romannumeral-`}\@Aboxed#1&&\ENDDNE}
% \end{macrocode}
-% Idea: get the left and right part
-% typeset them in a \cs{boxed} AFTER an \& and pull it backwards
-% but in order to get the horizontal placement to work. As with
-% \cs{MoveEqLeft} we need to set some appropriate space to the left
-% of the \& .
-% \changes{v1.11}{2011/04/06}{Removed unnessary \{\} pair}
+% The macro has been reimplemented courtesy of Florent Chervet out of
+% a posting on ctt, \url{https://groups.google.com/group/comp.text.tex/browse_thread/thread/5d66395f2a1b5134/93fd9661484bd8d8?#93fd9661484bd8d8}
% \begin{macrocode}
-\def\@Aboxed#1&#2\ENDDNE{%
- \settowidth\@tempdima{$\displaystyle#1$}%
- \addtolength\@tempdima{\fboxsep}%
- \addtolength\@tempdima{\fboxrule}%
- \global\@tempdima=\@tempdima
- \kern\@tempdima
- &
- \kern-\@tempdima
- \boxed{#1#2}
+\def\@Aboxed#1&#2&#3\ENDDNE{%
+ \ifnum0=`{}\fi \setbox \z@
+ \hbox{$\displaystyle#1{}\m@th$\kern\fboxsep \kern\fboxrule }%
+ \edef\@tempa {\kern \wd\z@ &\kern -\the\wd\z@ \fboxsep
+ \the\fboxsep \fboxrule \the\fboxrule }\@tempa \boxed {#1#2}%
}
% \end{macrocode}
-%
% \end{macro}
%
% \begin{macro}{\ArrowBetweenLines}
@@ -4202,16 +4504,126 @@ and the derived files
%
% \section{Macros by other people}
%
-% \subsection{Short intertext}
+% \subsection{Intertext and short intertext}
+%
+% It turns out that \cs{intertext} use a bit too much
+% space. Especially noticable if combined with the \env{spreadlines}
+% environment, the extra space is also applied above and below
+% \cs{intertext}, which ends up looking unproffesional. Chung-chieh
+% Shan
+% (\url{http://conway.rutgers.edu/~ccshan/wiki/blog/posts/Beyond_amsmath/})
+% via Tobias Weh suggested a fix. We apply it here, but also keep the
+% original \cs{intertext} in case a user would rather want it.
+% \begin{macro}{\MT_orig_intertext:}
+% \begin{macro}{\MT_intertext:}
+% \begin{macro}{\l_MT_above_intertext_dim}
+% \begin{macro}{\l_MT_below_intertext_dim}
+% First store the originam Ams version.
+% \begin{macrocode}
+\MH_let:NwN \MT_orig_intertext: \intertext@
+% \end{macrocode}
+% And then for some reconfiguration. First a few lengths
+% \begin{macrocode}
+\newdimen\l_MT_above_intertext_dim
+\newdimen\l_MT_below_intertext_dim
+\define@key{\MT_options_name:}
+ {aboveintertextdim}{\setlength\l_MT_above_interetext_dim{#1}}
+\define@key{\MT_options_name:}
+ {belowintertextdim}{\setlength\l_MT_below_intertext_dim{#1}}
+% \end{macrocode}
+% Their default values are zero. Now for our extended version of
+% CCShan's solution.
+% \begin{macrocode}
+\def\MT_intertext: {%
+ \def\intertext##1{%
+ \ifvmode\else\\\@empty\fi
+ \noalign{%
+ \penalty\postdisplaypenalty\vskip\belowdisplayskip
+ \vskip-\lineskiplimit % CCS
+ \vskip\normallineskiplimit % CCS
+ \vskip\l_MT_above_intertext_dim
+ \vbox{\normalbaselines
+ \ifdim\linewidth=\columnwidth
+ \else \parshape\@ne \@totalleftmargin \linewidth
+ \fi
+ \noindent##1\par}%
+ \penalty\predisplaypenalty\vskip\abovedisplayskip%
+ \vskip-\lineskiplimit % CCS
+ \vskip\normallineskiplimit % CCS
+ \vskip\l_MT_above_intertext_dim
+ }%
+}}
+% \end{macrocode}
+% And provide a key to switch
+% \begin{macrocode}
+\def\MT_orig_intertext_true: { \MH_let:NwN \intertext@ \MT_orig_intertext: }
+\def\MT_orig_intertext_false: { \MH_let:NwN \intertext@ \MT_intertext: }
+\define@key{\MT_options_name:}{original-intertext}[true]{
+ \@nameuse{MT_orig_intertext_#1:}
+}
+% \end{macrocode}
+% And use the new version as default.
+% \begin{macrocode}
+\setkeys{\MT_options_name:}{
+ original-intertext=false
+}
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
% Gabriel Zachmann, Donald Arseneau on comp.text.tex 2000/05/12-13
% \begin{macro}{\shortintertext}
-% This is like \cs{intertext} but uses shorter skips betweeb the math.
+% \begin{macro}{\MT_orig_shortintertext}
+% \begin{macro}{\MT_shortintertext}
+% \begin{macro}{\l_above_shortintertext_dim}
+% \begin{macro}{\l_below_shortintertext_dim}
+% This is like \cs{intertext} but uses shorter skips between the
+% math. Again this turned out to have the same problem as
+% \cs{intertext}, so we provide two versions.
+% \begin{macrocode}
+\def\MT_orig_shortintertext:n #1{%
+ \ifvmode\else\\\@empty\fi
+ \noalign{%
+ \penalty\postdisplaypenalty\vskip\abovedisplayshortskip
+ \vbox{\normalbaselines
+ \if_dim:w \linewidth=\columnwidth
+ \else:
+ \parshape\@ne \@totalleftmargin \linewidth
+ \fi:
+ \noindent#1\par}%
+ \penalty\predisplaypenalty\vskip\abovedisplayshortskip%
+ }%
+}
+% \end{macrocode}
+% Lengths like above
+% \begin{macrocode}
+\newdimen\l_MT_above_shortintertext_dim
+\newdimen\l_MT_below_shortintertext_dim
+\define@key{\MT_options_name:}
+ {aboveshortintertextdim}{\setlength \l_MT_above_shortintertext_dim{#1}}
+\define@key{\MT_options_name:}
+ {belowshortintertextdim}{\setlength \l_MT_below_shortintertext_dim{#1}}
+% \end{macrocode}
+% Looks best with the `old' values of the original \cs{jot}
+% setting. So we set them to 3pt each.
+% \begin{macrocode}
+\setkeys{\MT_options_name:}{
+ aboveshortintertextdim=3pt,
+ belowshortintertextdim=3pt
+}
+% \end{macrocode}
+% Next, just add the same as we did for \cs{intertext}
% \begin{macrocode}
-\def\shortintertext#1{%
+\def\MT_shortintertext:n #1{%
\ifvmode\else\\\@empty\fi
\noalign{%
\penalty\postdisplaypenalty\vskip\abovedisplayshortskip
+ \vskip-\lineskiplimit
+ \vskip\normallineskiplimit
+ \vskip\l_MT_above_shortintertext_dim
\vbox{\normalbaselines
\if_dim:w \linewidth=\columnwidth
\else:
@@ -4219,9 +4631,30 @@ and the derived files
\fi:
\noindent#1\par}%
\penalty\predisplaypenalty\vskip\abovedisplayshortskip%
+ \vskip-\lineskiplimit
+ \vskip\normallineskiplimit
+ \vskip\l_MT_below_shortintertext_dim
}%
}
% \end{macrocode}
+% Next we need to be able to switch.
+% \begin{macrocode}
+\def\MT_orig_shortintertext_true: { \MH_let:NwN \shortintertext \MT_orig_shortintertext:n }
+\def\MT_orig_shortintertext_false: { \MH_let:NwN \shortintertext \MT_shortintertext:n }
+\define@key{\MT_options_name:}{original-shortintertext}[true]{
+ \@nameuse{MT_orig_shortintertext_#1:}
+}
+% \end{macrocode}
+% With the updated one as the default.
+% \begin{macrocode}
+\setkeys{\MT_options_name:}{
+ original-shortintertext=false
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
% \end{macro}
%
% \subsection{Fine-tuning mathematical layout}
@@ -4447,13 +4880,24 @@ and the derived files
% December~20th 2000 by Michael J.~Downes. The comments are his. I
% have added some formatting options to the arguments so that a user
% can emulate the \pkg{isotope} package.
+%
+% \changes{v.1.12}{2012/04/19}{Extended \cs{prescript} to change style
+% if used in say S context. Requestd by Oliver Buerschaper.}
+% Update 2012: One drawback from MJD's original implementation, is
+% that the math style is hardwired, such that if used in say
+% \cs{scriptstyle} context, then the style/size of the prescript
+% remain the same size. A slightly expensive fix, is to use the
+% \cs{mathchoice} construction. First exdent MJD's code a little
+% (keeping his comments)
+% \begin{macro}{\MT_prescript_inner:}
+% We make the style an extra forth argument
% \begin{macrocode}
-\DeclareRobustCommand{\prescript}[3]{
+\newcommand{\MT_prescript_inner:}[4]{
% \end{macrocode}
% Put the sup in box 0 and the sub in box 2.
% \begin{macrocode}
- \@mathmeasure\z@\scriptstyle{\MT_prescript_sup:{#1}}
- \@mathmeasure\tw@\scriptstyle{\MT_prescript_sub:{#2}}
+ \@mathmeasure\z@#4{\MT_prescript_sup:{#1}}
+ \@mathmeasure\tw@#4{\MT_prescript_sub:{#2}}
\if_dim:w \wd\tw@>\wd\z@
\setbox\z@\hbox to\wd\tw@{\hfil\unhbox\z@}
\else:
@@ -4472,6 +4916,24 @@ and the derived files
\MT_prescript_arg:{#3}
}
% \end{macrocode}
+% \end{macro}
+% Next create \cs{prescript} using \cs{mathchoice}
+% \begin{macrocode}
+\DeclareRobustCommand{\prescript}[3]{
+ \mathchoice
+% \end{macrocode}
+% In D and T style, we use MJD's default:
+% \begin{macrocode}
+ {\MT_prescript_inner:{#1}{#2}{#3}{\scriptstyle}}
+ {\MT_prescript_inner:{#1}{#2}{#3}{\scriptstyle}}
+% \end{macrocode}
+% In the others we step one style down. Of couse in SS style, using
+% \cs{scriptscript} may seem wrong, but there is no lower style.
+% \begin{macrocode}
+ {\MT_prescript_inner:{#1}{#2}{#3}{\scriptscriptstyle}}
+ {\MT_prescript_inner:{#1}{#2}{#3}{\scriptscriptstyle}}
+}
+% \end{macrocode}
% \end{macro}
% Then the named arguments. Can you see I'm preparing for templates?
% \begin{macrocode}