diff options
Diffstat (limited to 'macros/latex/contrib/mathtools/mathtools.dtx')
-rw-r--r-- | macros/latex/contrib/mathtools/mathtools.dtx | 354 |
1 files changed, 241 insertions, 113 deletions
diff --git a/macros/latex/contrib/mathtools/mathtools.dtx b/macros/latex/contrib/mathtools/mathtools.dtx index b065615eb0..15cf76b323 100644 --- a/macros/latex/contrib/mathtools/mathtools.dtx +++ b/macros/latex/contrib/mathtools/mathtools.dtx @@ -2,7 +2,7 @@ % % Copyright (C) 2004-2011 by Morten Hoegholm % Copyright (C) 2012-2019 by Lars Madsen -% Copyright (C) 2020 by Lars Madsen, The LaTeX3 team +% Copyright (C) 2020- by Lars Madsen, The LaTeX3 team % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -133,7 +133,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{mathtools.drv}% - [2021/04/12 v1.27 mathematical typesetting tools] + [2022/02/02 v1.28 mathematical typesetting tools] \documentclass{ltxdoc} \IfFileExists{fourier.sty}{\usepackage{fourier}}{} @@ -239,6 +239,7 @@ and the derived files } + \expandafter\def\expandafter\MakePrivateLetters\expandafter{% \MakePrivateLetters \catcode`\_=11\relax } @@ -294,6 +295,16 @@ and the derived files \def\theindex{\MTtheindex\MakePrivateLetters} +\NewDocumentCommand\Framebox{ o O{c} m }{% + \IfNoValueTF{#1}{% + \framebox{\footnotesize\strut #3}% + }{% + \framebox[#1][#2]{\footnotesize\strut #3}% + }% +} + + + %\usepackage[draft]{fixme} %\fxsetup{ % multiuser, @@ -322,7 +333,7 @@ colorlinks, % % \GetFileInfo{mathtools.drv} % -% \CheckSum{3529} +% \CheckSum{3581} % % \title{The \pkg{mathtools} package\thanks{This file has version number % \fileversion, last revised \filedate.}} @@ -335,7 +346,7 @@ colorlinks, % \begin{abstract} % \noindent The \pkg{mathtools} package is an extension package to % \pkg{amsmath}. There are two things on \pkg{mathtools}' agenda: -% (1)~correct various bugs/defeciencies in \pkg{amsmath} until +% (1)~correct various bugs/deficiencies 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 underbracket, or entirely new @@ -400,7 +411,7 @@ colorlinks, % The option \opt{fixamsmath} (default) fixes two bugs in % \pkg{amsmath}.\footnote{See the online \LaTeX{} bugs database % \url{http://www.latex-project.org/cgi-bin/ltxbugs2html} under -% \AmS\LaTeX{} problem reports 3591 and 3614.} Should you for some +% \AmS-\LaTeX{} problem reports 3591 and 3614.} Should you for some % reason not want to fix these bugs then just add the option % \opt{donotfixamsmathbugs} (if you can do it without typos). The % reason for this extremely long name is that I really don't see why @@ -553,14 +564,14 @@ colorlinks, % \endgroup % Notice how the limit of the right summation sign is typeset in a % more compact style than the left. It is because \TeX{} sets the -% limits of operators in a \emph{cramped} style. For each of \TeX' +% limits of operators in a \emph{cramped} style. For each of \TeX's % four math styles (\cs{displaystyle}, \cs{textstyle}, % \cs{scriptstyle}, and \cs{scriptscriptstyle}), there also exists a % cramped style that doesn't raise exponents as much. Besides in the % limits of operators, \TeX{} also automatically uses these cramped % styles in radicals such as \cs{sqrt} and in the denominators of % fractions, but unfortunately there are no primitive commands that -% allows you to detect crampedness or switch to it. +% allow you to detect crampedness or switch to it. % % \pkg{mathtools} offers the command \cs{cramped} which forces a % cramped style in normal un-cramped math. Additionally you can @@ -594,7 +605,7 @@ colorlinks, % \end{quote} % Typesetting on a grid is generally considered quite desirable, but % as the second line of the example shows, the exponents of $2$ -% causes the line to be too tall for the normal value of +% cause the line to be too tall for the normal value of % \cs{baselineskip}, so \TeX{} inserts a \cs{lineskip} (normal value % is \the\lineskip). In order to circumvent the problem, we can % force a cramped style so that the exponents aren't raised as much: @@ -785,7 +796,7 @@ colorlinks, % \label{sec:swapping} % % One feature that the plain old \env{equation} environment has that -% the \AmS\ environments does not (because of technical reasons), is +% the \AmS\ environments do not (because of technical 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 @@ -822,7 +833,7 @@ colorlinks, % % In this section various tools for altering the appearance of tags % are shown. All of the tools here can be used at any point in the -% document but they should probably be affect the whole document, so +% document but they should probably affect the whole document, so % the preamble is the best place to issue them. % % \subsubsection{The appearance of tags} @@ -896,6 +907,13 @@ colorlinks, % \SpecialKeyIndex{showmanualtags}$\key{showmanualtags}=\texttt{true}\vert\texttt{false}$\\ % \SpecialUsageIndex{\refeq}\cs{refeq}\marg{label} % \end{codesyntax} +% First of, one should always use \cs{eqref} when referring to +% equation numbers. When \opt{showonlyrefs} is true, we monitor +% \cs{eqref}\marg{label}, and those used will get an equation number, +% whereas those not used will not. Note: We do \emph{not} monitor the +% normal \cs{ref} command! See the follow paragraph for situations +% for what to do when \cs{eqref} cannot be used to refer to the equation. +% % An equation where the tag is produced with a manual \cs{tag*} % shouldn't be referenced with the normal \cs{eqref} because that % would format it according to the current tag format. Using just @@ -994,8 +1012,8 @@ colorlinks, % \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 +% \key{showonlyref} introduces a bug within amsmath's typesetting +% of formula versus equation number. This bug manifests 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 one's formulas are not long enough to touch the equation @@ -1007,7 +1025,7 @@ colorlinks, % 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 referred~to. To determine +% depends 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 referred to) and therefore @@ -1019,7 +1037,7 @@ colorlinks, % \pkg{ntheorem} option \key{thmmarks} is active. The shown equation % numbers may come out wrong (seems to be multiplied by 2). Or the end % marker may be placed in the wrong place if a proof ends with a -% displayed formula, and that formula is not refered to. +% displayed formula, and that formula is not referred to. % % There are two possible solutions to this both involving \pkg{empheq}. % The easiest fix is to add the following line @@ -1029,7 +1047,7 @@ colorlinks, % before loading \pkg{ntheorem}. But the \texttt{overload} option of % course disables things like \cs{intertext} and \cs{shotintertext}. % -% The other thing to try is to use drop the \texttt{overload} option +% The other thing to try is to drop the \texttt{overload} option % and use \env{empheq} on the very last expression, as in % \begin{verbatim} % \begin{empheq}{align} @@ -1125,10 +1143,22 @@ colorlinks, % \cs{xLeftrightarrow} we added a space to the argument(s), making % the arrow slightly longer and moving the argument away from the % large arrow head. -% -% -% % +% \begin{codesyntax} +% \SpecialUsageIndex{\xlongrightarrow} +% \cs{xlongrightarrow}\oarg{sub}\marg{sup}\texttt{~~~~} +% \SpecialUsageIndex{\xlongleftarrow} +% \cs{xlongleftarrow}\oarg{sub}\marg{sup}\texttt{~~~~} +% \end{codesyntax} +% \FeatureRequest{rbrito {\footnotesize (issue \#12)}}{added 2022}% +% Similar to \cs{xright/leftarrow} but based on the \emph{long} +% versions. For short arguments it stays the same length as the +% \cs{long...} base arrow. +% \begin{align*} +% A & \longrightarrow B & A & \longleftarrow B \\ +% A & \xlongrightarrow[b]{a} B & A & \xlongleftarrow[b]{a} B \\ +% A & \xlongrightarrow[below]{above} B & A & \xlongleftarrow[below]{above} B \\ +% \end{align*} % % \subsubsection{Braces and brackets} % @@ -1205,13 +1235,13 @@ colorlinks, % As \cs{overbrace} has the exact same problems, there are good % reasons for \pkg{mathtools} to make redefinitions of % \cs{underbrace} and \cs{overbrace}. These new versions work -% equally well in all font sizes and fixes the spacing issues and +% equally well in all font sizes and fix the spacing issues and % apart from working with the default Computer Modern fonts, they % also work with the packages \pkg{mathpazo}, \pkg{pamath}, % \pkg{fourier}, \pkg{eulervm}, \pkg{cmbright}, and \pkg{mathptmx}. % If you use the \pkg{ccfonts} to get the full Concrete fonts, the % original version saved under the names \cs{LaTeXunderbrace} and -% \cs{LaTeXoverbrace} are better, due to of the special design of +% \cs{LaTeXoverbrace} is better, due to the special design of % the Concrete extensible braces. In that case you should probably % just add the lines % \begin{verbatim} @@ -1270,7 +1300,7 @@ colorlinks, % type valid in the usual \env{array} environment. % % While we are at it, we also provide fenced versions of the -% \env{smallmatrix} environment, To keep up with the naming of the +% \env{smallmatrix} environment. To keep up with the naming of the % large matrix environments, we provide both a starred and a % non-starred version. Since \env{smallmatrix} is defined in a % different manner than the \env{matrix} environment, the option to @@ -1322,9 +1352,9 @@ colorlinks, % the default is \cs{,}. % % As an extra trick the fences will behave as open and closing fences -% in constract to their auto-scaling nature.\footnote{\cs{left} and +% despite their auto-scaling nature.\footnote{\cs{left} and % \cs{right} creates an \emph{inner} construction, and not as one -% might expect something where a preceeding \cs{sin} sees an opening +% might expect something where a preceding \cs{sin} sees an opening % fence, thus the space before or after may be too large. Inside this % construction they behave.} % @@ -1358,19 +1388,21 @@ colorlinks, % right and preceded by a hard space of size \key{lastline-preskip}. % Both these hard spaces have a default value of \cs{multlinegap}. % Here we use a `t' in the first optional argument denoting a -% top-aligned building block (the default is `c'). +% top-aligned building block (the default is `c').\footnote{The helper macro +% \cs{Framebox}\marg{...} is equivalent to +% \cs{framebox}\marg{\cs{footnotesize}\cs{strut} ...}} % \begin{verbatim} % \[ % A = \begin{multlined}[t] -% \framebox[4cm]{first} \\ -% \framebox[4cm]{last} +% \Framebox[4cm]{first} \\ +% \Framebox[4cm]{last} % \end{multlined} B % \] % \end{verbatim} % \[ % A = \begin{multlined}[t] -% \framebox[4cm]{first} \\ -% \framebox[4cm]{last} +% \Framebox[4cm]{first} \\ +% \Framebox[4cm]{last} % \end{multlined} B % \] % Note also that \env{multlined} gives you access to an extended @@ -1379,25 +1411,25 @@ colorlinks, % \begin{verbatim} % \[ % \begin{multlined} -% \framebox[.65\columnwidth]{First line} \\ -% \framebox[.5\columnwidth]{Second line} \\ +% \Framebox[.65\columnwidth]{First line} \\ +% \Framebox[.5\columnwidth]{Second line} \\ % \shoveleft{L+E+F+T} \\ % \shoveright{R+I+G+H+T} \\ % \shoveleft[1cm]{L+E+F+T} \\ % \shoveright[\widthof{$R+I+G+H+T$}]{R+I+G+H+T} \\ -% \framebox[.65\columnwidth]{Last line} +% \Framebox[.65\columnwidth]{Last line} % \end{multlined} % \] % \end{verbatim} % \[ % \begin{multlined} -% \framebox[.65\columnwidth]{First line} \\ -% \framebox[.5\columnwidth]{Second line} \\ +% \Framebox[.65\columnwidth]{First line} \\ +% \Framebox[.5\columnwidth]{Second line} \\ % \shoveleft{L+E+F+T} \\ % \shoveright{R+I+G+H+T} \\ % \shoveleft[1cm]{L+E+F+T} \\ % \shoveright[\widthof{$R+I+G+H+T$}]{R+I+G+H+T} \\ -% \framebox[.65\columnwidth]{Last line} +% \Framebox[.65\columnwidth]{Last line} % \end{multlined} % \] % @@ -1406,15 +1438,15 @@ colorlinks, % \begin{verbatim} % \[ % \begin{multlined}[b][7cm] -% \framebox[4cm]{first} \\ -% \framebox[4cm]{last} +% \Framebox[4cm]{first} \\ +% \Framebox[4cm]{last} % \end{multlined} = B % \] % \end{verbatim} % \[ % \begin{multlined}[b][7cm] -% \framebox[4cm]{first} \\ -% \framebox[4cm]{last} +% \Framebox[4cm]{first} \\ +% \Framebox[4cm]{last} % \end{multlined} = B % \] % There can be two optional arguments (position and width) and @@ -1428,14 +1460,14 @@ colorlinks, % not work as expected. The implementation contains an `invisible' % line after the first \env{multline} row, inside an \env{array} this % line is no longer `invisible' because \env{array} sets -% \cs{baselineskip} to zero. Currently we have no general workaround +% \cs{baselineskip} to zero. We have no general workaround % for this. % % \medskip\noindent % \textbf{Bug 2:} % \CommentAdded{2015/11/12} % Due to the way \env{multlined} is implemented, certain -% constructions does not work inside \env{multlined}. We have added a +% constructions do not work inside \env{multlined}. We have added a % hook (\cs{MultlinedHook}) that can be added to. The default value % is a fix for \env{subarray} and \env{crampedsubarray} and thus for % \cs{substack} and \cs{crampedsubstack} (and a few others, thus add @@ -1484,7 +1516,7 @@ colorlinks, % \cs{end}\arg{cases*} % \end{codesyntax} % \FeatureRequest{Lars Madsen}{2004/07/01} -% Anyone who have tried to use an integral in the regular +% Anyone who has tried to use an integral in the regular % \env{cases} environment from \pkg{amsmath} will have noticed that % it is set as % \[ @@ -1552,16 +1584,19 @@ colorlinks, % \SpecialEnvIndex{\MoveEqLeft}\cs{MoveEqLeft}\oarg{number} % \end{codesyntax} % \ProvidedBy{Lars Madsen}{2008/06/05} In \cite{Swanson}, Ellen -% Swanson recommends that when ever one has a long displayed formula, +% Swanson recommends that whenever one has 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 2\,em (or if needed by a % smaller amount). That is we are talking about displays that end up -% looking like this +% looking like this\footnote{Maintainer (daleif)'s note: This is one +% of my most used constructions whenever I edit manuscripts. I'd +% rather use this than for example \env{multline} as I find it gives +% the text a more consistent look.} % \begin{align*} -% \MoveEqLeft \framebox[10cm][c]{Long first line}\\ -% & = \framebox[6cm][c]{ \hphantom{g} 2nd line}\\ +% \MoveEqLeft \Framebox[10cm][c]{Long first line}\\ +% & = \Framebox[6cm][c]{2nd line}\\ % & \leq \dots % \end{align*} % Traditionally one could do this by starting subsequent lines by @@ -1569,8 +1604,8 @@ colorlinks, % was made using \cs{MoveEqLeft}: % \begin{verbatim} % \begin{align*} -% \MoveEqLeft \framebox[10cm][c]{Long first line}\\ -% & = \framebox[6cm][c]{ \hphantom{g} 2nd line}\\ +% \MoveEqLeft \Framebox[10cm][c]{Long first line}\\ +% & = \Framebox[6cm][c]{2nd line}\\ % & \leq \dots % \end{align*} % \end{verbatim} @@ -1581,22 +1616,22 @@ colorlinks, % to accommodate the extra distance to the alignment point: % \begin{verbatim} % \begin{align*} -% \MoveEqLeft[3] \framebox[10cm][c]{Part 1}\\ -% = {} & \framebox[8cm][c]{2nd line}\\ -% & + \framebox[4cm][c]{ last part} +% \MoveEqLeft[3] \Framebox[10cm][c]{Part 1}\\ +% = {} & \Framebox[8cm][c]{2nd line}\\ +% & + \Framebox[4cm][c]{last part} % \end{align*} % \end{verbatim} % \begin{align*} -% \MoveEqLeft[3] \framebox[10cm][c]{Long first line}\\ -% = {} & \framebox[6cm][c]{ 2nd line}\\ -% & + \framebox[4cm][c]{ last part} +% \MoveEqLeft[3] \Framebox[10cm][c]{Long first line}\\ +% = {} & \Framebox[6cm][c]{2nd line}\\ +% & + \Framebox[4cm][c]{last part} % \end{align*} % % % \noindent\textbf{Caveat regarding \cs{MoveEqLeft}}: If the first % part of the equation starts with say \verb|[a]|, \cs{MoveEqLeft} may % attempt to eat it! You can prevent this by specifying the optional -% argument (remember the default is the same as \cs{MoveEqLeft[2]} or +% argument (remember the default is the same as \cs{MoveEqLeft[2]}) or % by using \cs{MoveEqLeft\{\}}. % % \subsubsection{Boxing a single line in an alignment} @@ -1634,8 +1669,8 @@ colorlinks, % & = 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 +% ``\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} @@ -1648,7 +1683,7 @@ colorlinks, % \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 +% Note how the \cs{fboxsep} change only affects the box coming % immediately after it. % % \marginpar{\strut\\% @@ -1661,6 +1696,33 @@ colorlinks, % use of \texttt{\&}. Just add a set of braces around the construction % you want to hide. % +% \medskip\noindent\textbf{Tip:} At times users want a \cs{Aboxed} +% with a different type of box. To help we provide a \cs{Aboxed} builder: +% \begin{codesyntax} +% \SpecialUsageIndex{\MakeAboxedCommand}\cs{MakeAboxedCommand}\cs{Aboxedname}\cs{boxmacro} +% \end{codesyntax} +% where \cs{boxname} should be a macro taking a single argument. The +% normal \cs{Aboxed} is the same as +% \verb|\MakeAboxedCommand\Aboxed\fbox|. Thus you can do +% \newcommand\myboxA[1]{\fcolorbox{gray}{yellow}{#1}} +% \newcommand\myboxB[1]{{\fboxsep=5pt\fboxrule=2pt\fbox{#1}}} +% \MakeAboxedCommand\AboxedA\myboxA +% \MakeAboxedCommand\AboxedB\myboxB +% \begin{align*} +% \AboxedA{ f(x) &= x^2 } & \AboxedB{ f(x) &= x^2 } +% \end{align*} +% via +% \begin{verbatim} +% \newcommand\myboxA[1]{\fcolorbox{gray}{yellow}{#1}} +% \newcommand\myboxB[1]{{\fboxsep=5pt\fboxrule=2pt\fbox{#1}}} +% \MakeAboxedCommand\AboxedA\myboxA +% \MakeAboxedCommand\AboxedB\myboxB +% \begin{align*} +% \AboxedA{ f(x) &= x^2 } & \AboxedB{ f(x) &= x^2 } +% \end{align*} +% \end{verbatim} +% +% % \subsubsection{Adding arrows between lines in an alignment} % % This first macro is a bit misleading, it is only intended to be @@ -1713,7 +1775,7 @@ colorlinks, % % \subsubsection{Centered \texorpdfstring{\cs{vdots}}{\textbackslash vdots}} % -% If one want to mark a vertical continuation, there is +% If one wants to mark a vertical continuation, there is % the \verb?\vdots? command, but combine this with an alignment and % we get something rather suboptimal % \FeatureRequest{Bruno Le Floch \\(and many others)}{2011/01/25} @@ -1735,7 +1797,7 @@ colorlinks, % \SpecialKeyIndex{shortvdotsadjustabove}\makebox{$\key{shortvdotsadjustabove}=\meta{length}$}\\ % \SpecialKeyIndex{shortvdotsadjustbelow}\makebox{$\key{shortvdotsadjustbelow}=\meta{length}$} % \end{codesyntax} -% Two examples in one +% Two examples in one % \begin{verbatim} % \begin{align*} % a &= b \\ @@ -1754,7 +1816,7 @@ colorlinks, % & = d % \end{align*} % Thus \verb?\vdotswithin{=}? creates a box corresponding to -% \verb?{}={}? and typeset a >>$\vdots$<< centered inside it. When +% \verb?{}={}? and typesets 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. % @@ -1842,7 +1904,7 @@ colorlinks, % \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 without the original \cs{intertext} +% reader can apply it with and without the original \cs{intertext} % and \cs{shortintertext}. % \begin{verbatim} % % the original \intertext and \shortintertext @@ -1859,8 +1921,8 @@ colorlinks, % \myline % \end{verbatim} % -% We now fix this internaly for both \cs{intertext} and -% \cs{shortintertext}, plus we add the possibility to fine tune +% We now fix this internally for both \cs{intertext} and +% \cs{shortintertext}, plus we add the possibility to fine-tune % spacing around these constructions. The original versions can be % brought back using the \texttt{original-x} keys below. % \begin{codesyntax} @@ -1909,7 +1971,7 @@ colorlinks, % \abs{\frac{a}{b}} % \] % Here it won't give a nice result, so you have to manually put in -% either \cs{left}--\cs{right} pair or a \cs{bigl}--\cs{bigr} pair. +% either a \cs{left}--\cs{right} pair or a \cs{bigl}--\cs{bigr} pair. % Both methods mean that you have to delete your \cs{abs} command, % which may not sound like an ideal solution. % @@ -1959,10 +2021,10 @@ colorlinks, % \cs{DeclarePairedDelimiterX} extends the features of % \cs{DeclarePairedDelimiter} such that the user will get a macro % which is fenced off at either end, plus the capability to provide -% the \meta{body} for what ever the macro should do within these +% the \meta{body} for whatever the macro should do within these % fences. % -% Inside the \meta{body} part, the macro \cs{delimsize} refer to the +% Inside the \meta{body} part, the macro \cs{delimsize} refers to the % size of the outer fences. It can then be used inside \meta{body} to % scale any inner fences. % @@ -1990,16 +2052,16 @@ colorlinks, % {#1\,\delimsize\vert\,\mathopen{}#2\,\delimsize\vert\,\mathopen{}#3} % \end{verbatim} % \begin{itshape} -% Note the use of >>\verb|\mathopen{}|<< in the \meta{body} of +% Note the use of `\verb|\mathopen{}|' in the \meta{body} of % \cs{braket}, this is very important when a scalable delimiter is % being used and it does not present itself as a left or right % delimiter. You will see why it is needed if you use -% \verb|\braket{A}{-B}| in a version without +% \verb|\braket{A}{-B}{C}| in a version without % \verb|\mathopen{}|.\footnote{Basically, the problem is that % \cs{vert} is a `symbol', thus $\vert-B$ is interpreted -% \emph{subtraction}, not a symbol followed by negative $B$. When -% \cs{mathopen\{\}} is added, \TeX\ is told that an opening -% delimiter just occurred, and it will adjust the minus +% \emph{subtraction}, not a symbol followed by negative $B$ (aka a +% sign). When \cs{mathopen\{\}} is added, \TeX\ is told that an +% opening delimiter just occurred, and it will adjust the minus % accordingly.} % \end{itshape} % @@ -2041,8 +2103,8 @@ colorlinks, % is a feature of the \cs{left}\dots\cs{right} construction). % \fi % -% With the inner scaling, we can provide macros whos syntax closely -% follow the mathematical meaning. Fx for building sets, try +% With the inner scaling, we can provide macros whose syntax closely +% follows the mathematical meaning. Fx for building sets, try % this\footnote{The reason for using a separate \cs{SetSymbol} macro % has to do with complicated set definitions, where the condition % spans several lines. In this case \cs{Set} cannot be used. Thus it @@ -2082,7 +2144,7 @@ colorlinks, % \cs{mathchoice\{}\cs{:\}\{}\cs{:\}\{}\cs{,\}\{}\cs{,\}} instead of \cs{nonscript}\cs{:}.} % % Combining with \pkg{etoolbox} it becomes easy to make a function -% that automatically provide a marker for a blank argument: +% that automatically provides a marker for a blank argument: % \begin{verbatim} % \usepackage{etoolbox} % \DeclarePairedDelimiterX\norm[1]\lVert\rVert{ @@ -2101,7 +2163,7 @@ colorlinks, % \FeatureRequest{Barbara Beeton (on TSE)}{2013/10/07} % \cs{DeclarePairedDelimiterX} has an annoying caveat: it is very hard % to make a macro \verb|\lnorm{a}| that should result in $\lVert -% a\rVert_2$.\footnote{The added >>\texttt{\_2}<< is hard to get around +% a\rVert_2$.\footnote{The added `\texttt{\_2}' is hard to get around % the argument parsing.} % % As a consequence we provide @@ -2128,14 +2190,14 @@ colorlinks, % \end{verbatim} % Thus giving support for \verb|\Prob{A \given B}|. % -% \medskip\noindent\textbf{Note 1:} As the number of arguments increase +% \medskip\noindent\textbf{Note 1:} As the number of arguments increases % the \cs{DeclarePairedDelimiter...} macros become hard for users to % understand. A key-value interface would be better. This is planed % for a future release. In % \url{http://tex.stackexchange.com/a/136767/3929} there is a % suggested replacement for \cs{DeclarePairedDelimiter}, that greatly % reduces the number of macros and provides a key-val -% interface. However, the code use \pkg{xparse}, and if we want to use +% interface. However, the code uses \pkg{xparse}, and if we want to use % \pkg{xparse} for some of our macros, we might just as well rewrite % the entire \pkg{mathtools} package in \pkg{expl3}. Also it is not % obvious how to get \pkg{xparse} to support \verb|[3]| for the number @@ -2143,7 +2205,7 @@ colorlinks, % % \medskip\noindent\textbf{Note 2:} If you want to define your own % manual scaler macros, it is important that you besides \cs{foo} also -% defines \cs{fool} and \cs{foor}. When a scaler is specified, in say +% define \cs{fool} and \cs{foor}. When a scaler is specified, in say % \cs{abs[\cs{big}]}\marg{arg}, we actually use \cs{bigl} and % \cs{bigr}. % @@ -2155,7 +2217,7 @@ colorlinks, % 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 gap between -% '$\sin$' and '('. In some special cases it may be useful to be +% `$\sin$' and `('. In some special cases it may be useful to be % able to tinker with the behavior. % \begin{codesyntax} % \SpecialUsageIndex{\reDeclarePairedDelimiterInnerWrapper} @@ -2176,7 +2238,7 @@ colorlinks, % \reDeclarePairedDelimiterInnerWrapper\abs{nostarnonscaled}{\mathinner{#1#2#3}} % \reDeclarePairedDelimiterInnerWrapper\abs{nostarscaled}{\mathinner{#1#2#3}} % \end{verbatim} -% The default values for the call backs corresponds to +% The default values for the call backs correspond to % \begin{verbatim} % star: \mathopen{}\mathclose\bgroup #1#2\aftergroup\egroup #3 % nostarnonscaled: \mathopen#1#2\mathclose#3 @@ -2205,7 +2267,7 @@ colorlinks, % construction. Currently, this can only be applied to macros made % using \cs{DeclarePairedDelimiter} and \emph{not} macros made using % \cs{DeclarePairedDelimiterX} or \cs{DeclarePairedDelimiterXPP} as -% the contents is typeset inside a group (to limit \cs{delimsize}) +% the contents are typeset inside a group (to limit \cs{delimsize}) % and thus hide any \verb|&| or \verb|\\| from \env{align} and % \env{align} breaks down. % @@ -2300,7 +2362,7 @@ colorlinks, % the equal sign, leading to an odd-looking output. The command % \cs{vcentcolon} is a shorthand for such a vertically centered % colon, and can be used as in |$a \vcentcolon= b$| and results in -% the desired output: $a \vcentcolon= b$. % for now +% the desired output: $a \vcentcolon= b$. % See also the \pkg{colonequals} package. % % Typing \cs{vcentcolon} every time is quite tedious, so one can use @@ -2341,11 +2403,11 @@ colorlinks, % \SpecialUsageIndex{\Colonsim}\cs{Colonsim}\\ % \SpecialUsageIndex{\dblcolon}\cs{dblcolon} % \end{codesyntax} -% The font packages \pkg{txfonts} and \pkg{pxfonts} provides various +% The font packages \pkg{txfonts} and \pkg{pxfonts} provide various % symbols that include a vertically centered colon but with tighter % spacing. For example, the combination |:=| exists as the symbol % \cs{coloneqq} which typesets as $\coloneqq$ instead of -% $\vcentcolon=$. The primary disadvantage of using these fonts are +% $\vcentcolon=$. The primary disadvantage of using these fonts is % the support packages' lack of support for \pkg{amsmath} (and thus % \pkg{mathtools}) and worse yet, the side-bearings are way too % tight; see~\cite{A-W:MG04} for examples. If you're not using these @@ -2375,11 +2437,11 @@ colorlinks, % \end{codesyntax} % % \noindent -% \textbf{Note:} that these symbols are constructed via +% \textbf{Note:} 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 -% \cs{nleftarrrow} respectively, so these needs to be +% \cs{nleftarrrow} respectively, so these need to be % present. Usually this is done via \pkg{amssymb}, but some packages % may be incompatible with \pkg{amssymb} so the user will have to % load \pkg{amssymb} or a similar package, that provides @@ -2442,15 +2504,15 @@ colorlinks, % \par % \end{quote} % \noindent -% As of 2013, \cs(\cs) are robust, as is the italic corrected versions. +% As of 2013, \cs(\cs) are robust, as are the italic corrected versions. % % \medskip\noindent \textbf{Caveat:} Italic correction is a % treacherous area. For example any penalties will cancel the italic % correction inserted by % \verb|\(| (for an explanation see \cite{TBT}, section 4.3.3). We -% have changed Michaels original to accommodate one specific penalty +% have changed Michael's original to accommodate one specific penalty % construction: the \emph{tie}, i.e., -% >>\verb|text~\(|<< will work as expected (as~of July, 2014). +% `\verb|text~\(|' will work as expected (as~of July, 2014). % % \subsection{Left sub/superscripts} % @@ -2692,7 +2754,7 @@ colorlinks, % \medskip\noindent \textbf{Note:} If you try to nest \cs{splitfrac} % inside each other you may need to add \cs{mathstrut} to the first % argument of the nested fraction to get the spacing look even. It is -% not added by default as often a more cramped looked is desired: +% not added by default as often a more cramped look is desired: % \begin{verbatim} % \[ % \frac{ @@ -2748,9 +2810,9 @@ colorlinks, % \FeatureRequest{Frank Mittelbach}{2020} In typography we use % \emph{struts} to ensure specific line spacing. In text we have the % \cs{strut} and in math \cs{mathstrut}. Both have no width, but -% equals the height and depth of an »(« from the current text/math +% equal the height and depth of an »(« from the current text/math % font and size. In math we often need to make minute adjustments in -% macro definitiones etc. The \emph{extended} math strut +% macro definitions etc. The \emph{extended} math strut % \cs{xmathstrut} allows to \emph{increase} (decrease if negative) % the math strut in two ways. % @@ -2759,7 +2821,7 @@ colorlinks, % \verb|\xmathstrut{0.1}| % \end{center} % will give you a new strut where 10\% of the \emph{total height of -% the normal math stut} (\verb|\mathstrut=\xmathstrut{0}|) will be +% the normal math strut} (\verb|\mathstrut=\xmathstrut{0}|) will be % added to both \emph{the height} and \emph{the depth} of the % original strut (thus 20\% gets added in total). On the other hand % \begin{center} @@ -2809,6 +2871,7 @@ colorlinks, % \llap{\rlap{\rule{18mm}{0.1pt}}\quad}a \vfb{\mathstrut} \ \vfb{\xmathstrut{0}}\ % \vfb{\xmathstrut{0.5} } \ \vfb{\xmathstrut{-0.1} }\ \vfb{\xmathstrut[0.5]{0}} a % \] +% \newpage % \begin{verbatim} % \newcommand\vfb[1]{\begingroup\fboxsep=0pt\boxed{\,#1\,}\endgroup} % \[ @@ -2983,7 +3046,7 @@ colorlinks, % \begin{macrocode} %<*package> \ProvidesPackage{mathtools}% - [2021/04/12 v1.27 mathematical typesetting tools] + [2021/02/02 v1.28 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}} @@ -2996,14 +3059,17 @@ colorlinks, % We'd like to make \cs{(}\cs{)} and \cs{[}\cs{]} robust. This can % easily be done via the \pkg{fixltx2e} package, but auto loading that % package may cause problems for some. We make copies instead. +% Update 2021: We have removed robustifying \cs{(}\cs{)}\cs{[}\cs{]} +% as this is now in the \LaTeX\ kernel. We still use +% \verb|\EQ_MakeRobust| elsewhere though. % \begin{macro}{\EQ_MakeRobust} % \begin{macro}{\forced_EQ_MakeRobust} % \begin{macrocode} % borrowed from fixltx2e \def\EQ_MakeRobust#1{% \@ifundefined{\expandafter\@gobble\string#1}{% - \@latex@error{The control sequence `\string#1' is undefined!% - \MessageBreak There is nothing here to make robust}% + \@latex@error{The~control~sequence~`\string#1'~is~undefined!% + \MessageBreak There~is~nothing~here~to~make~robust}% \@eha }% {% @@ -3021,7 +3087,7 @@ colorlinks, \noexpand\protect\expandafter\noexpand \csname\expandafter\@gobble\string#1\space\endcsname}% }% - {\@latex@info{The control sequence `\string#1' is already robust}}% + {\@latex@info{The~control~sequence~`\string#1'~is~already~robust}}% }% } % \end{macrocode} @@ -3030,8 +3096,8 @@ colorlinks, % \begin{macrocode} \def\forced_EQ_MakeRobust#1{% \@ifundefined{\expandafter\@gobble\string#1}{% - \@latex@error{The control sequence `\string#1' is undefined!% - \MessageBreak There is nothing here to make robust}% + \@latex@error{The~control~sequence~`\string#1'~is~undefined!% + \MessageBreak There~is~nothing~here~to~make~robust}% \@eha }% {% @@ -3129,18 +3195,20 @@ colorlinks, } % \end{macrocode} % \end{macro} -% \changes{v1.13}{2013/02/11}{Make \cs{(}\cs{)} and \cs{[}\cs{]} -% robust} -% We start of with making \cs{(}\cs{)} and \cs{[}\cs{]} robust, -% unless the user explicitly asked us not to. -% \begin{macrocode} -\MH_if_boolean:nT {robustify}{ - \EQ_MakeRobust\( - \EQ_MakeRobust\) - \EQ_MakeRobust\[ - \EQ_MakeRobust\] -} -% \end{macrocode} +% ^^A \changes{v1.13}{2013/02/11}{Make \cs{(}\cs{)} and \cs{[}\cs{]} +% ^^A robust} +% ^^A We start of with making \cs{(}\cs{)} and \cs{[}\cs{]} robust, +% ^^A unless the user explicitly asked us not to. +% ^^A \changes{v1.28}{2021/12/31}{Removed robustifying \cs{(}\cs{)} and +% ^^A \cs{[}\cs{]} as this is now in the \LaTeX{} kernel.} +% ^^A % \begin{macrocode} +% ^^A \MH_if_boolean:nT {robustify}{ +% ^^A \EQ_MakeRobust\( +% ^^A \EQ_MakeRobust\) +% ^^A \EQ_MakeRobust\[ +% ^^A \EQ_MakeRobust\] +% ^^A } +% ^^A % \end{macrocode} % % % \section{Macros I got ideas for myself} @@ -3541,6 +3609,8 @@ colorlinks, % \changes{v1.24}{2020/03/13}{Added spaces to move the argument away % from the arrow head in \cs{xLeftarrow}, \cs{xRightarrow} and % \cs{xLeftrightarrow}. Suggested by FM} +% \changes{1.28}{2022/01/01}{Added \cs{xlongrightarrow} and +% \cs{xlongleftarrow} as suggested in Issue \#12} % \begin{macrocode} \providecommand*\xleftrightarrow[2][]{% \ext@arrow 3095\MT_leftrightarrow_fill:{#1}{#2}} @@ -3578,6 +3648,13 @@ colorlinks, \arrowfill@\leftharpoondown\relbar\relbar} \def\MT_leftharpoonup_fill:{% \arrowfill@\leftharpoonup\relbar\relbar} +% \end{macrocode} +% 2022: added \verb+_fill:+ macros based upon \cs{longrightarrow} and \cs{longleftarrow} +% \begin{macrocode} +\def\MT_longrightarrow_fill:{% + \arrowfill@\relbar\relbar\longrightarrow} +\def\MT_longleftarrow_fill:{% + \arrowfill@\longleftarrow\relbar\relbar} \providecommand*\xrightharpoondown[2][]{% \ext@arrow 0359\MT_rightharpoondown_fill:{#1}{#2}} \providecommand*\xrightharpoonup[2][]{% @@ -3599,6 +3676,14 @@ colorlinks, $\ext@arrow 3095\MT_leftharpoondown_fill:{#1}{\phantom{#2}}$}% \kern-\wd0 \lower.22ex\box0}} % \end{macrocode} +% 2022: added \verb+\xlong...+ macros based upon \cs{longrightarrow} +% and \cs{longleftarrow} +% \begin{macrocode} +\providecommand*\xlongrightarrow[2][]{% + \ext@arrow 0359\MT_longrightarrow_fill:{#1}{#2}} +\providecommand*\xlongleftarrow[2][]{% + \ext@arrow 3095\MT_longleftarrow_fill:{#1}{#2}} +% \end{macrocode} % \end{macro} % \end{macro} % \end{macro} @@ -5349,12 +5434,55 @@ colorlinks, \def\@Aboxed#1\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}% + \edef\@tempa {\kern \wd\z@ &\kern -\the\wd\z@ +% \end{macrocode} +% The \verb|\fboxsep\the\fboxsep...| line ensures that you can use +% \verb|\fboxsep=10pt\Aboxed{...}| in a pinch. +% \begin{macrocode} + \fboxsep\the\fboxsep \fboxrule \the\fboxrule }\@tempa \boxed {#1#2}% } % \end{macrocode} % \end{macro} % +% \begin{macro}{\MakeAboxedCommand} +% \changes{1.28}{2022/01/01}{Added} +% At times users want macros equivalent to \cs{Aboxed} but with a +% different box as the base. So we provide one +% \begin{macrocode} +\newcommand\MakeAboxedCommand[2]{ + % #1: command to create + % #2: box command to use + \newcommand#1[1]{\let\bgroup{\romannumeral-`}% + \@nameuse{@@\MH_cs_to_str:N #1}##1&&\ENDDNE} + \@namedef{@@\MH_cs_to_str:N #1}##1&##2&##3\ENDDNE{% +% \end{macrocode} +% Instead of hardcoding the kerning of box rule and box sep, we record +% the width of an empty box and kern half of it. +% \begin{macrocode} + \settowidth\@tempdimc{#2{}}% + \ifnum0=`{}\fi \setbox \z@ + \hbox{$\displaystyle##1{}\m@th$\kern0.5\@tempdimc}% +% \end{macrocode} +% The \verb|\fboxsep\the\fboxsep...| line enables +% \verb|\fboxsep=10\Command{...&...}|. Of course only works for boxed +% that uses \cs{fboxsep} and \cs{fboxrule}. +% \begin{macrocode} + \edef\@tempa{\kern\wd\z@&\kern-\the\wd\z@% + \fboxsep\the\fboxsep \fboxrule \the\fboxrule}% + \@tempa% +% \end{macrocode} +% Instead of using \cs{boxed} directly, we mimick the definition of +% \cs{boxed} and should thus be able to use any box. +% \begin{macrocode} + #2{\m@th$\displaystyle ##1##2$}% + } +} + +% \end{macrocode} +% +% \end{macro} +% +% % \begin{macro}{\ArrowBetweenLines} % \changes{v1.05}{2008/06/05}{Added \cs{ArrowBetweenLines} as it % belongs here and not just in my \LaTeX book (daleif)} |