diff options
author | Karl Berry <karl@freefriends.org> | 2019-09-14 22:07:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-09-14 22:07:09 +0000 |
commit | 77c6ab621157215821ffc5d8b0dd655748c262e7 (patch) | |
tree | 8c7cc34fd220c9cacf2bfb1f0149419f083805ea /Master/texmf-dist/source/latex-dev | |
parent | e1f5126a433abad76994faf305f1df3ad04b6f02 (diff) |
latex-dev (15sep19)
git-svn-id: svn://tug.org/texlive/trunk@52096 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex-dev')
176 files changed, 37100 insertions, 6516 deletions
diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amsbsy.dtx b/Master/texmf-dist/source/latex-dev/amsmath/amsbsy.dtx new file mode 100644 index 00000000000..890fbd0d827 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amsbsy.dtx @@ -0,0 +1,238 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 1999 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +%\iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\usepackage{amsbsy} +\GetFileInfo{amsbsy.sty} +\begin{document} +\title{The \pkg{amsbsy} package} +\author{Frank Mittelbach\and Rainer Sch\"opf\and Michael Downes} +\date{Version \fileversion, \filedate} +\DocInput{amsbsy.dtx} +\end{document} +%</driver> +%\fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% +% \section{Introduction} +% +% The package \texttt{amsbsy}, first written in 1989, implements a +% few commands for producing \textbf{bold} characters in the `normal' +% \emph{math version}. +% \begin{quote}\em +% Note: It is recommended nowadays to use the \pkg{bm} package, which +% became available in 1997. +% \end{quote} +% +% If we have bold fonts which contain the character in question then +% we will use these fonts to produce the wanted character. But +% sometimes math fonts are only available in a certain weight +% (e.g.\ the AMS symbol fonts). +% \DescribeMacro\pmb +% For these cases we provide a command which is called \verb+\pmb+ (an +% acronym for \textbf{p}oor \textbf{m}an's \textbf{b}old) with one argument. +% The bolder weight is achieved by copying the argument three times in +% slightly different positions which is better than nothing but no +% match for a real bold font. +% +% \DescribeMacro\boldsymbol +% There also exists the \verb+\boldsymbol+ command which is better in +% all cases where bold fonts exists. This command will internally +% switch to the corresponding `bold' \emph{math version} typeset its +% argument in this version. +% +% Both commands will preserve the nature of their arguments, i.e.\ if +% they get a relational atom their result will again be a relation as +% far as \tex/'s mathspacing is concerned. +% +% Since it is good policy to make at least a small test we try to +% typeset the infinity sign ($\infty$) first with \verb+\pmb+ and then +% with \verb+\boldsymbol+. +% \[ +% \pmb{\infty} = \boldsymbol{\infty} \quad ? +% \] +% \StopEventually{} +% +% Standard package info. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\ProvidesPackage{amsbsy}[1999/11/29 v1.2d Bold Symbols] +% \end{macrocode} +% +% \section{The implementation} +% +% We need some functions from the \pkg{amsgen} package. +% \begin{macrocode} +\RequirePackage{amsgen} +% \end{macrocode} +% +%\begin{macro}{\boldsymbol} +% In implementing boldsymbol, we must take into account \tex/'s +% limitation of only 16 mathgroups (math families, in Knuth's +% terminology). If we wanted to maintain mathgroups for both the bold +% and non-bold version of each math font, it would not take long to +% run out of mathgroups. Therefore what we do instead for a bold +% symbol is embed it in an \verb|\hbox|; inside that \verb|\hbox|, +% when we start another math formula, we can change all the +% mathgroups to their bold equivalents. +% +% However, to get the correct math style inside the hbox (display, +% text, script or scriptscript) we have to use \verb|\mathchoice|. +% Since \verb|\mathversion{bold}| has a lot of overhead, and +% \verb|\mathchoice| typesets the argument text four times, we would +% rather not put the \verb|\mathversion| command inside each +% \verb|\hbox| in the \verb|\mathchoice|; on the other hand, +% \verb|\mathversion| gives an error message if it's used in math +% mode. Therefore if we want to execute \verb|\mathversion{bold}| +% before starting the \verb|\mathchoice| we have to temporarily +% disable the \verb|\@nomath| error. (The error message is intended +% to keep people from accidentally emboldening a preceding part of a +% math formula, since only the mathgroups defined at the end of a +% math formula will determine the fonts used in that formula; but we +% are going to typeset our bold symbol not in the current formula but +% in an embedded formula, so that this danger doesn't apply here.) +% \begin{macrocode} +\DeclareRobustCommand{\boldsymbol}[1]{% +% \end{macrocode} +% Start a group to localize the change of \verb|\@nomath|: +% \begin{macrocode} + \begingroup +% \end{macrocode} +% Disable \verb|\@nomath| so that we don't have to leave math +% mode before executing \verb|\mathversion|: +% \begin{macrocode} + \let\@nomath\@gobble \mathversion{bold}% +% \end{macrocode} +% \cs{math@atom} is a test macro which looks at its argument and +% produces a math atom of the proper class. +% \begin{macrocode} + \math@atom{#1}{% +% \end{macrocode} +% Although it is tempting to use \verb|\text| here, to save some +% main memory, that caused a bug in the past due to some internal +% interactions with \verb|\mathversion|. +% \begin{macrocode} + \mathchoice% + {\hbox{$\m@th\displaystyle#1$}}% + {\hbox{$\m@th\textstyle#1$}}% + {\hbox{$\m@th\scriptstyle#1$}}% + {\hbox{$\m@th\scriptscriptstyle#1$}}}% +% \end{macrocode} +% End the group we started earlier. +% \begin{macrocode} + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@atom} +% The macro \verb+\math@atom+ looks at its argument and produce a +% correct math atom, i.e.\ a primitive like \verb+\mathopen+. +% Until the day we have a real implementation for all cases we use +% the \verb+\binrel@+ command from \amstex/ which can distinguish +% between binary, relation and ord atoms. +% \begin{macrocode} +\def\math@atom#1#2{% + \binrel@{#1}\binrel@@{#2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pmb} +% Poor man's bold command, works by typesetting multiple copies of +% the given argument with small offsets. +% \begin{macrocode} +\DeclareRobustCommand{\pmb}{% + \ifmmode\else \expandafter\pmb@@\fi\mathpalette\pmb@} +% \end{macrocode} +% +% \cs{pmb@@} is called by \cn{pmb} in the non-math-mode case. +% Discard the first two arguments which are for the math-mode case. +% \begin{macrocode} +\def\pmb@@#1#2#3{\leavevmode\setboxz@h{#3}% + \dimen@-\wdz@ + \kern-.5\ex@\copy\z@ + \kern\dimen@\kern.25\ex@\raise.4\ex@\copy\z@ + \kern\dimen@\kern.25\ex@\box\z@ +} +% \end{macrocode} +% +% \begin{macrocode} +\newdimen\pmbraise@ +% \end{macrocode} +% Note: because of the use of \cs{mathpalette}, if \cs{pmb@} is applied to a +% single math italic character (or a single character from some other +% slanted math font), the italic correction will be added. This will +% cause subscripts to fall too far away from the character in some +% cases, e.g., $\pmb{T}_1$ or $\pmb{\mathcal{T}}_1$. +% \begin{macrocode} +\def\pmb@#1#2{\setbox8\hbox{$\m@th#1{#2}$}% + \setboxz@h{$\m@th#1\mkern.5mu$}\pmbraise@\wdz@ + \binrel@{#2}% + \dimen@-\wd8 % + \binrel@@{% + \mkern-.8mu\copy8 % + \kern\dimen@\mkern.4mu\raise\pmbraise@\copy8 % + \kern\dimen@\mkern.4mu\box8 }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\binrel@#1{\begingroup + \setboxz@h{\thinmuskip0mu + \medmuskip\m@ne mu\thickmuskip\@ne mu + \setbox\tw@\hbox{$#1\m@th$}\kern-\wd\tw@ + ${}#1{}\m@th$}% +% \end{macrocode} +% The \cn{noexpand} here should be unnecessary, but just in case +% \ldots +% \begin{macrocode} + \edef\@tempa{\endgroup\let\noexpand\binrel@@ + \ifdim\wdz@<\z@ \mathbin + \else\ifdim\wdz@>\z@ \mathrel + \else \relax\fi\fi}% + \@tempa +} +% \end{macrocode} +% For completeness, assign a default value for \cs{binrel@@}. +% \begin{macrocode} +\let\binrel@@\relax +% \end{macrocode} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \CheckSum{131} +% \Finale diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amsbsy.ins b/Master/texmf-dist/source/latex-dev/amsmath/amsbsy.ins new file mode 100644 index 00000000000..fe1cd5413de --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amsbsy.ins @@ -0,0 +1,50 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amsbsy.sty}{\from{amsbsy.dtx}{}} +} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amscd.dtx b/Master/texmf-dist/source/latex-dev/amsmath/amscd.dtx new file mode 100644 index 00000000000..2d0a35d685d --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amscd.dtx @@ -0,0 +1,322 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 1999 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +%\iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\usepackage{amscd} +\GetFileInfo{amscd.sty} +% Dummy citation to avoid error in an example. +\bibcite{fre:cichon}{C} +\begin{document} +\title{The \pkg{amscd} package} +\author{Frank Mittelbach\and Rainer Sch\"opf\and Michael Downes} +\date{Version \fileversion, \filedate} +\DocInput{amscd.dtx} +\end{document} +%</driver> +%\fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% \newcommand{\operatorname}[1]{\mathop{\mathrm{#1}}} +% \newcommand{\per}{\operatorname{per}} +% \newcommand{\cov}{\operatorname{cov}} +% \newcommand{\non}{\operatorname{non}} +% \newcommand{\cf}{\operatorname{cf}} +% \newcommand{\add}{\operatorname{add}} +% \newcommand{\End}{\operatorname{End}} +% +% \section{Introduction} +% +% The \pkg{amscd} package provides a \env{CD} environment that +% emulates the commutative diagram capabilities of \amstex/ version +% 2.x. This means that only simple rectangular diagrams are +% supported, with no diagonal arrows or more exotic features. Many +% users will be better served by one of the more powerful diagram +% packages such as \pkg{diagram}, \pkg{xypic}, or \pkg{kuvio}. +% +% Example: +% \begin{equation}\begin{CD} +% S^{{\mathcal{W}}_\Lambda}\otimes T @>j>> T\\ +% @VVV @VV{\End P}V\\ +% (S\otimes T)/I @= (Z\otimes T)/J +% \end{CD}\end{equation} +% \begin{verbatim} +% \begin{equation}\begin{CD} +% S^{{\mathcal{W}}_\Lambda}\otimes T @>j>> T\\ +% @VVV @VV{\End P}V\\ +% (S\otimes T)/I @= (Z\otimes T)/J +% \end{CD}\end{equation} +% \end{verbatim} +% (assuming \cn{End} is defined as an `operator name'. +% +% Another example: +% +% We will make liberal use of Cichon's Diagram \cite{fre:cichon}: +% \begin{equation} +% \begin{CD} +% \cov(\mathcal{L}) @>>> \non(\mathcal{K}) @>>> \cf(\mathcal{K}) @>>> +% \cf(\mathcal{L})\\ +% @VVV @AAA @AAA @VVV\\ +% \add(\mathcal{L}) @>>> \add(\mathcal{K}) @>>> \cov(\mathcal{K}) @>>> +% \non(\mathcal{L}) +% \end{CD}\end{equation} +% \begin{verbatim} +% \begin{equation}\begin{CD} +% \cov(\mathcal{L}) @>>> \non(\mathcal{K}) @>>> \cf(\mathcal{K}) @>>> +% \cf(\mathcal{L})\\ +% @VVV @AAA @AAA @VVV\\ +% \add(\mathcal{L}) @>>> \add(\mathcal{K}) @>>> \cov(\mathcal{K}) @>>> +% \non(\mathcal{L}) +% \end{CD}\end{equation} +% \end{verbatim} +% +% \StopEventually{} +% +% Standard package info. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\ProvidesPackage{amscd}[2017/04/14 v2.1 AMS Commutative Diagrams] +% \end{macrocode} +% \begin{macrocode} +\RequirePackage{amsgen} +% \end{macrocode} +% Better not to redefine \verb|\math@cr| if it is already defined, +% because for CD use only we want to omit the part of the code +% related to \verb|\dspbrk@lvl| (see \fn{amsmath.sty}). +% +% [mjd,1999/11/04] These definitions have gone somewhat obsolete; but +% we had probably better leave them as they are for backward +% compatibility. +% \begin{macrocode} +\@ifundefined{math@cr}{% + \def\math@cr{{\ifnum0=`}\fi + \@ifstar{\global\@eqpen\@M\math@cr@}% + {\global\@eqpen\interdisplaylinepenalty \math@cr@}} +% \end{macrocode} +% The following section merely duplicates some code from the +% \pkg{amsmath} package, in case the \pkg{amscd} package is used by +% itself. For documentation of the code refer to \fn{amsmath.dtx}. +% \begin{macrocode} + \def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}} + \def\math@cr@@[#1]{\ifnum0=`{\fi}\math@cr@@@ + \noalign{\vskip#1\relax}} + \def\restore@math@cr{\def\math@cr@@@{\cr}} +}{} +\restore@math@cr +% \end{macrocode} +% [mjd,1999/11/04] These definitions too are somewhat obsolete; +% but we had probably better leave them as they are for backward +% compatibility. +% \begin{macrocode} +\@ifundefined{rightarrowfill@}{ + \def\rightarrowfill@#1{\m@th\setboxz@h{$#1-$}\ht\z@\z@ + $#1\copy\z@\mkern-6mu\cleaders + \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill + \mkern-6mu\mathord\rightarrow$} + \def\leftarrowfill@#1{\m@th\setboxz@h{$#1-$}\ht\z@\z@ + $#1\mathord\leftarrow\mkern-6mu\cleaders + \hbox{$#1\mkern-2mu\copy\z@\mkern-2mu$}\hfill + \mkern-6mu\box\z@$} + \def\leftrightarrowfill@#1{\m@th\setboxz@h{$#1-$}\ht\z@\z@ + $#1\mathord\leftarrow\mkern-6mu\cleaders + \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill + \mkern-6mu\mathord\rightarrow$} +}{} +% \end{macrocode} +% +% \begin{macrocode} +\def\atdef@#1{\expandafter\def\csname\space @\string#1\endcsname} +\@ifundefined{Iat}{% + \DeclareRobustCommand{\Iat}{\FN@\at@} +}{} +\begingroup \catcode`\@=\active +% \end{macrocode} +% Define math \qc{\@} to replicate its mathcode-dictated behavior. +% This is in case \qc{\@} occurs outside of \env{CD}. +% \begin{macrocode} +\csname if\string @compatibility\endcsname +\else \fam=\mathcode`\@ + \xdef @{\mathchar\number\fam\space } +\fi +\gdef\CDat{\let @=\Iat} +\endgroup +\mathcode`\@="8000 % make @ pseudo-active in math +\def\at@{\let\next@\at@@ + \ifcat\noexpand\next a\else + \ifcat\noexpand\next0\else + \ifcat\noexpand\next\relax\else + \let\next@\at@@@\fi\fi\fi\next@} +\def\at@@#1{\expandafter + \ifx\csname\space @\string#1\endcsname\relax + \DN@{\at@@@#1}% + \else + \DN@{\csname\space @\string#1\endcsname}% + \fi\next@}% +% \end{macrocode} +% The following items should be defined only if they are not +% already defined, either to leave the package name untouched (in +% the case of \cs{PackageError}) or to avoid redundant allocation +% of token or dimen registers. +% \begin{macrocode} +\@ifundefined{default@tag}{% + \def\default@tag{% + \def\tag{\PackageError{amscd}{\protect\tag\space not allowed + here}\@eha}}% +}{}% +\@ifundefined{at@@@}{% + \def\at@@@{\PackageError{amscd}{\Invalid@@ @}{\the\athelp@}\char64\relax} +}{} +\@ifundefined{athelp@}{\csname newhelp\endcsname\athelp@ +{Only certain combinations beginning with @ make sense to me.^^J% +I'll assume you wanted @@ for a printed @.}}{} +\@ifundefined{minaw@}{\newdimen\minaw@}{} +\@ifundefined{bigaw@}{\newdimen\bigaw@}{} +% \end{macrocode} +% +% Assignment of a couple of dimensions, and initialization of +% \verb=\ampersand@=. We check to see if we need to define +% \verb=\minaw@= and \verb=\bigaw@=. +% \begin{macrocode} +\minaw@11.111pt +\newdimen\minCDarrowwidth +\minCDarrowwidth2.5pc +\newif\ifCD@ +\let\ampersand@\relax +% \end{macrocode} +% +% Added \verb|\restore@math@cr\default@tag| to fix line numbering +% problems, 7-JUN-1991. Suggested by I.~Zakharevich. +% \begin{macrocode} +\newenvironment{CD}{% + \CDat + \bgroup\relax\iffalse{\fi\let\ampersand@&\iffalse}\fi + \CD@true\vcenter\bgroup\let\\\math@cr\restore@math@cr\default@tag + \tabskip\z@skip\baselineskip20\ex@ + \lineskip3\ex@\lineskiplimit3\ex@\halign\bgroup + &\hfill$\m@th##$\hfill\crcr +}{% + \crcr\egroup\egroup\egroup +} +% \end{macrocode} +% +% \begin{macro}{\CD@check} +% This check is used by all macros that must not appear outside the +% \env{CD} environment. The first argument is the symbol to be used +% after \verb+@+, the second one the action to be performed. +% +% Once again we use the trick of defining a temporary control +% sequence \verb+\next@+ and calling it after the final \verb+\fi+. +% This is not absolutely necessary, but it ensures that the +% conditional text is processed in one and the same column +% of the enclosing alignment. +% \begin{macrocode} +\def\CD@check#1#2{\ifCD@\DN@{#2}\else + \DN@{\PackageError{amscd}{@\protect#1 not + allowed outside of the CD environment}\@eha}% + \fi\next@} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\atdef@>#1>#2>{\ampersand@ + \ifCD@ \global\bigaw@\minCDarrowwidth \else \global\bigaw@\minaw@ \fi + \setboxz@h{$\m@th\scriptstyle\;{#1}\;\;$}% + \ifdim\wdz@>\bigaw@\global\bigaw@\wdz@\fi +% \end{macrocode} +% If \verb|#2| is empty we can save some work. +% \begin{macrocode} + \@ifnotempty{#2}{\setbox\@ne\hbox{$\m@th\scriptstyle\;{#2}\;\;$}% + \ifdim\wd\@ne>\bigaw@\global\bigaw@\wd\@ne\fi}% + \ifCD@\enskip\fi + \mathrel{\mathop{\hbox to\bigaw@{\rightarrowfill@\displaystyle}}% + \limits^{#1}\@ifnotempty{#2}{_{#2}}}% + \ifCD@\enskip\fi \ampersand@} +% +\atdef@<#1<#2<{\ampersand@ + \ifCD@ \global\bigaw@\minCDarrowwidth \else \global\bigaw@\minaw@ \fi + \setboxz@h{$\m@th\scriptstyle\;\;{#1}\;$}% + \ifdim\wdz@>\bigaw@ \global\bigaw@\wdz@ \fi + \@ifnotempty{#2}{\setbox\@ne\hbox{$\m@th\scriptstyle\;\;{#2}\;$}% + \ifdim\wd\@ne>\bigaw@ \global\bigaw@\wd\@ne \fi}% + \ifCD@\enskip\fi + \mathrel{\mathop{\hbox to\bigaw@{\leftarrowfill@\displaystyle}}% + \limits^{#1}\@ifnotempty{#2}{_{#2}}}% + \ifCD@\enskip\fi \ampersand@} +% \end{macrocode} +% +% Variants of the above two arrows, using \verb|(| and \verb|)| +% characters instead of \verb|<| and \verb|>| characters, are +% provided for those whose keyboards don't have the latter. +% \begin{macrocode} +\begingroup \catcode`\~=\active \lccode`\~=`\@ +\lowercase{% + \global\atdef@)#1)#2){~>#1>#2>} + \global\atdef@(#1(#2({~<#1<#2<} +}% end lowercase +\endgroup +% \end{macrocode} +% +% \begin{macrocode} +\atdef@ A#1A#2A{\CD@check{A..A..A}{\llap{$\m@th\vcenter{\hbox + {$\scriptstyle#1$}}$}\Big\uparrow + \rlap{$\m@th\vcenter{\hbox{$\scriptstyle#2$}}$}&&}} +% +\atdef@ V#1V#2V{\CD@check{V..V..V}{\llap{$\m@th\vcenter{\hbox + {$\scriptstyle#1$}}$}\Big\downarrow + \rlap{$\m@th\vcenter{\hbox{$\scriptstyle#2$}}$}&&}} +% +\atdef@={\CD@check={&\enskip\mathrel + {\vbox{\hrule\@width\minCDarrowwidth\vskip2\ex@\hrule\@width + \minCDarrowwidth}}\enskip&}} +% +\atdef@|{\CD@check|{\Big\Vert&&}} +% +\atdef@\vert{\CD@check\vert{\Big\Vert&&}} +% +\atdef@.{\CD@check.{&&}} +% \end{macrocode} +% +% The \cn{pretend} command has weird syntax that doesn't fit well +% with standard \latex/ syntax so we leave it undone, at least for +% now. [mjd,1994/10/27] +% \begin{macrocode} +%\def\pretend#1\haswidth#2{\setboxz@h{$\m@th\scriptstyle{#2}$}\hbox +% to\wdz@{\hfill$\m@th\scriptstyle{#1}$\hfill}} +% \end{macrocode} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \CheckSum{459} +% \Finale diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amscd.ins b/Master/texmf-dist/source/latex-dev/amsmath/amscd.ins new file mode 100644 index 00000000000..148c4cb32e5 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amscd.ins @@ -0,0 +1,50 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amscd.sty}{\from{amscd.dtx}{}} +} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amsgen.dtx b/Master/texmf-dist/source/latex-dev/amsmath/amsgen.dtx new file mode 100644 index 00000000000..5edc26b9cc4 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amsgen.dtx @@ -0,0 +1,386 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 1999 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +% \iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\usepackage{amsgen} +\GetFileInfo{amsgen.sty} +\begin{document} +\title{The \pkg{amsgen} package} +\author{American Mathematical Society\\Michael Downes} +\date{Version \fileversion, \filedate} +\DocInput{amsgen.dtx} +\end{document} +%</driver> +% \fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% +% \section{Introduction} +% This is an internal package for storing common functions +% that are shared by more than one package in the \amslatex/ +% distribution. Some of these might eventually make it into the \latex/ +% kernel. +% +% \StopEventually{} +% +% Standard package info. +% Using \cs{ProvidesFile} rather than \cs{ProvidesPackage} because +% the latter, when input by, e.g, \cls{amsbook}, results in +% \texttt{LaTeX warning: You have requested document class `amsbook', +% but the document class provides `amsgen'.} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\ProvidesFile{amsgen.sty}[1999/11/30 v2.0 generic functions] +% \end{macrocode} +% +% \section{Implementation} +% Some general macros shared by \fn{amsart.dtx}, \fn{amsmath.dtx}, +% \fn{amsfonts.dtx}, \dots +% +% \begin{macro}{\@saveprimitive} +% The \pkg{amsmath} package redefines a number of \tex/ primitives. +% In case some preceding package also decided to redefine one of +% those same primitives, we had better do some checking to make +% sure that we are able to save the primitive meaning for internal +% use. This is handled by the \cs{@saveprimitive} function. We +% follow the example of \cs{@@input} where the primitive meaning is +% stored in an internal control sequence with a |@@| prefix. +% Primitive control sequences can be distinguished by the fact that +% \cs{string} and \cs{meaning} return the same information. +% \begin{macrocode} +\providecommand{\@saveprimitive}[2]{\begingroup\escapechar`\\\relax + \edef\@tempa{\string#1}\edef\@tempb{\meaning#1}% + \ifx\@tempa\@tempb \global\let#2#1% + \else +% \end{macrocode} +% Check to see if \arg{2} was already given the desired primitive +% meaning somewhere else. +% \begin{macrocode} + \edef\@tempb{\meaning#2}% + \ifx\@tempa\@tempb + \else + \@latex@error{Unable to properly define \string#2; primitive + \noexpand#1no longer primitive}\@eha + \fi + \fi + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xp} +% \begin{macro}{\@nx} +% Shorthands for long command names. +% \begin{macrocode} +\let\@xp=\expandafter +\let\@nx=\noexpand +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@emptytoks} +% A token register companion for \cs{@empty}. Saves a little main mem and +% probably makes initializations such as |\toks@{}| run faster too. +% \begin{macrocode} +\newtoks\@emptytoks +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@oparg} +% Use of \cs{@oparg} simplifies some constructions where a macro +% takes an optional argument in square brackets. We can't use +% \cn{newcommand} here because this function might be previously +% defined by the \pkg{amsmath} package in a loading sequence such as +% \begin{verbatim} +% \usepackage{amsmath,amsthm} +% \end{verbatim} +% \begin{macrocode} +\def\@oparg#1[#2]{\@ifnextchar[{#1}{#1[#2]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@ifempty} +% \begin{macro}{\@ifnotempty} +% |\@ifnotempty| and |\@ifempty| use category 11 |@| characters to +% test whether the argument is empty or not, since these are highly +% unlikely to occur in the argument. As with \cn{@oparg}, there is a +% possibility that these commands were defined previously in +% \fn{amsmath.sty}. +% \begin{macrocode} +\long\def\@ifempty#1{\@xifempty#1@@..\@nil} +\long\def\@xifempty#1#2@#3#4#5\@nil{% + \ifx#3#4\@xp\@firstoftwo\else\@xp\@secondoftwo\fi} +% \end{macrocode} +% \cs{@ifnotempty} is a shorthand that makes code read better when +% no action is needed in the empty case. At a cost of double +% argument-reading---so for often-executed code, avoiding +% \cs{@ifnotempty} might be wise. +% \begin{macrocode} +\long\def\@ifnotempty#1{\@ifempty{#1}{}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Some abbreviations to conserve token mem. +% \begin{macrocode} +\def\FN@{\futurelet\@let@token} +\def\DN@{\def\next@} +\def\RIfM@{\relax\ifmmode} +\def\setboxz@h{\setbox\z@\hbox} +\def\wdz@{\wd\z@} +\def\boxz@{\box\z@} +\def\relaxnext@{\let\@let@token\relax} +% \end{macrocode} +% +% \begin{macro}{\new@ifnextchar} +% This macro is a new version of \latex/'s \verb+\@ifnextchar+, +% macro that does not skip over spaces. +% \begin{macrocode} +\long\def\new@ifnextchar#1#2#3{% +% \end{macrocode} +% By including the space after the equals sign, we make it possible +% for \cs{new@ifnextchar} to do look-ahead for any token, including a +% space! +% \begin{macrocode} + \let\reserved@d= #1% + \def\reserved@a{#2}\def\reserved@b{#3}% + \futurelet\@let@token\new@ifnch +} +% +\def\new@ifnch{% + \ifx\@let@token\reserved@d \let\reserved@b\reserved@a \fi + \reserved@b +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@ifstar} +% There will essentially never be a space before the \qc{\*}, so +% using \cs{@ifnextchar} is unnecessarily slow. +% \begin{macrocode} +\def\@ifstar#1#2{\new@ifnextchar *{\def\reserved@a*{#1}\reserved@a}{#2}} +% \end{macrocode} +% \end{macro} +% +% The hook \cs{every@size} was changed to \cs{every@math@size} in the +% December 1994 release of \latex/ and its calling procedures changed. +% If \cs{every@math@size} is undefined it means the user has an older +% version of \latex/ so we had better define it and patch a couple of +% functions (\cs{glb@settings} and \cs{set@fontsize}). +% \begin{macrocode} +\@ifundefined{every@math@size}{% +% \end{macrocode} +% Reuse the same token register; since it was never used except for +% the purposes that are affected below, this is OK. +% \begin{macrocode} +\let\every@math@size=\every@size +\def\glb@settings{% + \expandafter\ifx\csname S@\f@size\endcsname\relax + \calculate@math@sizes + \fi + \csname S@\f@size\endcsname + \ifmath@fonts +% \ifnum \tracingfonts>\tw@ +% \@font@info{Setting up math fonts for +% \f@size/\f@baselineskip}\fi + \begingroup + \escapechar\m@ne + \csname mv@\math@version \endcsname + \globaldefs\@ne + \let \glb@currsize \f@size + \math@fonts + \endgroup + \the\every@math@size + \else +% \ifnum \tracingfonts>\tw@ +% \@font@info{No math setup for \f@size/\f@baselineskip}% +% \fi + \fi +} +% \end{macrocode} +% Remove |\the\every@size| from \cs{size@update}. +% \begin{macrocode} +\def\set@fontsize#1#2#3{% + \@defaultunits\@tempdimb#2pt\relax\@nnil + \edef\f@size{\strip@pt\@tempdimb}% + \@defaultunits\@tempskipa#3pt\relax\@nnil + \edef\f@baselineskip{\the\@tempskipa}% + \edef\f@linespread{#1}% + \let\baselinestretch\f@linespread + \def\size@update{% + \baselineskip\f@baselineskip\relax + \baselineskip\f@linespread\baselineskip + \normalbaselineskip\baselineskip + \setbox\strutbox\hbox{% + \vrule\@height.7\baselineskip + \@depth.3\baselineskip + \@width\z@}% +%%% \the\every@size + \let\size@update\relax}% + } +}{}% end \@ifundefined test +% \end{macrocode} +% +% \begin{macro}{\ex@} +% The \cs{ex@} variable provides a small unit of space for use in +% math-mode constructions, that varies according to the current type +% size. For example, the \cn{pmb} command uses \cs{ex@} units. +% Since a macro or mu unit solution for the \meta{dimen} \cs{ex@} won't +% work without changing a lot of current code in the \pkg{amsmath} +% package, we set \cs{ex@} through the \cs{every@math@size} hook. +% The value of \cs{ex@} is scaled nonlinearly in a range of roughly +% 0.5pt to 1.5pt, by the function \cs{compute@ex@}. +% \begin{macrocode} +\newdimen\ex@ +\addto@hook\every@math@size{\compute@ex@} +% \end{macrocode} +% \end{macro} +% +% \cs{compute@ex@} computes \cs{ex@} as a nonlinear scaling from 10pt +% to current font size (\cs{f@size}). Using .97 as the multiplier makes 1 +% |ex@| $\approx$ .9pt when the current type size is 8pt and 1 |ex@| +% $\approx$ 1.1pt when the current type size is 12pt. +% +% The formula is essentially +% \begin{displaymath} +% \newcommand{\points}{\mbox{pt}} +% \newcommand{\floor}[1]{\lfloor#1\rfloor} +% 1\points \pm (1\points - (.97)^{\floor{\vert 10 - n\vert}}) +% \end{displaymath} +% where $n$ = current type size, but adjusted to differentiate +% half-point sizes as well as whole point sizes, and there is a +% cutoff for extraordinarily large values of \cs{f@size} ($>$ 20pt) +% so that the value of \cs{ex@} never exceeds 1.5pt. +% +% \begin{macrocode} +\def\compute@ex@{% + \begingroup + \dimen@-\f@size\p@ + \ifdim\dimen@<-20\p@ +% \end{macrocode} +% Never make \cs{ex@} larger than 1.5pt. +% \begin{macrocode} + \global\ex@ 1.5\p@ + \else +% \end{macrocode} +% Adjust by the reference size and multiply by 2 to allow for +% half-point sizes. +% \begin{macrocode} + \advance\dimen@10\p@ \multiply\dimen@\tw@ +% \end{macrocode} +% Save information about the current sign of \cs{dimen@}. +% \begin{macrocode} + \edef\@tempa{\ifdim\dimen@>\z@ -\fi}% +% \end{macrocode} +% Get the absolute value of \cs{dimen@}. +% \begin{macrocode} + \dimen@ \ifdim\dimen@<\z@ -\fi \dimen@ + \advance\dimen@-\@m sp % fudge factor +% \end{macrocode} +% Here we use \cs{vfuzz} merely as a convenient scratch register +% \begin{macrocode} + \vfuzz\p@ +% \end{macrocode} +% Multiply in a loop. +% \begin{macrocode} + \def\do{\ifdim\dimen@>\z@ + \vfuzz=.97\vfuzz + \advance\dimen@ -\p@ +%\message{\vfuzz: \the\vfuzz, \dimen@: \the\dimen@}% + \@xp\do \fi}% + \do + \dimen@\p@ \advance\dimen@-\vfuzz + \global\ex@\p@ + \global\advance\ex@ \@tempa\dimen@ + \fi + \endgroup +%\typeout{\string\f@size: \f@size}\showthe\ex@ +} +% \end{macrocode} +% Tests of the \cs{compute@ex@} function yield the following results: +% +% \begin{center}\begin{tabular}{rlrl} +% \cs{f@size}& \cs{ex@}& \cs{f@size}& \cs{ex@}\\ +% 10& 1.0pt& 9& 0.94089pt\\ +% 11& 1.05911pt& 8.7& 0.91266pt\\ +% 12& 1.11473pt& 8.5& 0.91266pt\\ +% 14.4& 1.23982pt& 8.4& 0.88527pt\\ +% 17.28& 1.36684pt& 8& 0.88527pt\\ +% 20.74& 1.5pt& 7& 0.83293pt\\ +% 19.5& 1.4395pt& 6& 0.78369pt\\ +% && 5& 0.73737pt\\ +% && 1& 0.57785pt +% \end{tabular}\end{center} +% +% \begin{macro}{\@addpunct} +% Use of the \cs{@addpunct} function allows ending punctuation in +% section headings and elsewhere to be intelligently omitted +% when punctuation is already present. +% \begin{macrocode} +\def\@addpunct#1{\ifnum\spacefactor>\@m \else#1\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\frenchspacing} +% Change \cn{frenchspacing} to ensure that \cs{@addpunct} will +% continue to work properly even when `french' spacing is in effect. +% \begin{macrocode} +\def\frenchspacing{\sfcode`\.1006\sfcode`\?1005\sfcode`\!1004% + \sfcode`\:1003\sfcode`\;1002\sfcode`\,1001 } +% \end{macrocode} +% \end{macro} +% +% \subsection{Miscellaneous} +% \begin{macrocode} +\def\nomath@env{\@amsmath@err{% + \string\begin{\@currenvir} allowed only in paragraph mode% +}\@ehb% "You've lost some text" +} +% \end{macrocode} +% A trade-off between main memory space and hash size; using +% \verb+\Invalid@@+ saves 14 bytes of main memory for each use of +% \verb+\Invalid@+, at the cost of one control sequence name. +% \verb+\Invalid@+ is currently used about five times and +% \verb+\Invalid@@+ is used by itself in some other instances, +% which means that it saves us more memory than \verb+\FN@+, +% \verb+\RIfM@+, and some of the other abbreviations above. +% \begin{macrocode} +\def\Invalid@@{Invalid use of \string} +% \end{macrocode} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \CheckSum{337} +% \Finale diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amsgen.ins b/Master/texmf-dist/source/latex-dev/amsmath/amsgen.ins new file mode 100644 index 00000000000..8c5683cb5a6 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amsgen.ins @@ -0,0 +1,50 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amsgen.sty}{\from{amsgen.dtx}{}} +} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amsmath.dtx b/Master/texmf-dist/source/latex-dev/amsmath/amsmath.dtx new file mode 100644 index 00000000000..8671694b706 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amsmath.dtx @@ -0,0 +1,6383 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 2000, 2013 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +%\iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\raggedbottom +\let\savedarg\arg +\usepackage{amsmath} +\let\arg\savedarg +\GetFileInfo{amsmath.sty} +\begin{document} +\title{The \pkg{amsmath} package} +\author{Frank Mittelbach\and Rainer Sch\"opf\and Michael Downes\and + David M. Jones\and David Carlisle} +\date{Version \fileversion, \filedate} +\providecommand{\histnote}{} +\renewenvironment{histnote}{% + \trivlist\item[\hspace{\labelsep}\bfseries Historical Note:]% +}{% + \endtrivlist +} +\DocInput{amsmath.dtx} +\end{document} +%</driver> +%\fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% +% \section{Introduction} +% +% A \latex/ package named \pkg{amstex} was created in 1988--1989 by +% adapting \fn{amstex.tex} for use within \latex/. The \pkg{amsmath} +% package is the successor of the \pkg{amstex} package. It was +% substantially overhauled to integrate it with \latex/2e, which +% arrived on the scene in 1994. It provides more or less the same +% features, but there are quite a few organizational differences as +% well as some new features and bug fixes. For example, the +% \pkg{amstex} package automatically loaded the \pkg{amsfonts} +% package, but the \pkg{amsmath} package does not. At the present +% time (November 1999) user-level documentation of the commands +% provided here is found in the AMSmath Users' Guide, +% \fn{amsldoc.tex}. +% +% \StopEventually{} +% +% Standard file identification. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must be December 1994 or later +% \end{macrocode} +% +% Providing a rollback to earlier version(s) +% \begin{macrocode} +\providecommand\DeclareRelease[3]{} +\providecommand\DeclareCurrentRelease[2]{} +% +\DeclareRelease{}{2018-12-01}{amsmath-2018-12-01.sty} +\DeclareCurrentRelease{}{2019-04-01} +% \end{macrocode} +% +% \begin{macrocode} +\ProvidesPackage{amsmath}[2019/04/01 v2.17c AMS math features] +% \end{macrocode} +% +% \section{Catcode defenses} +% +% Some packages change the catcode of characters that are essential +% in low-level \tex/ syntax. Any package that does so does not +% qualify as a PWWO package (\qq{Plays Well With Others}) because it +% can cause other packages to fail if they are loaded later. \LaTeX{} +% is partly to blame for this because it fails to provide adequate +% built-in safeguards in the package loading mechanisms. In the +% absence of such safeguards, we will provide them here. +% \begin{macrocode} +\edef\@temp{\catcode 96=\number\catcode 96 } +\catcode\string `\`=12 +\def\do#1{\catcode\number`#1=\number\catcode`#1} +\edef\@temp{% + \noexpand\AtEndOfPackage{% + \@temp + \do\"\do\'\do\(\do\)\do\*\do\+\do\,\do\-\do\.% + \do\/\do\<\do\=\do\>\do\[\do\]\do\^\do\_\relax + }% +} +\@temp +\def\do#1{\catcode\number`#1=12 } +\do\"\do\'\do\(\do\)\do\*\do\+\do\,\do\-\do\. +\do\/\do\<\do\=\do\>\do\[\do\] +\catcode`\^=7 \catcode`\_=8 +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Declare some options} +% +% Handling of limits on integrals, sums, operatornames. +% \begin{macrocode} +\DeclareOption{intlimits}{\let\ilimits@\displaylimits} +\DeclareOption{nointlimits}{\let\ilimits@\nolimits} +\DeclareOption{sumlimits}{\let\slimits@\displaylimits} +\DeclareOption{nosumlimits}{\let\slimits@\nolimits} +\DeclareOption{namelimits}{\PassOptionsToPackage{namelimits}{amsopn}} +\DeclareOption{nonamelimits}{% + \PassOptionsToPackage{nonamelimits}{amsopn}} +% \end{macrocode} +% +% The following two switches might have been defined already by the +% documentclass, but it doesn't hurt to re-execute the \cs{newif}'s. +% \begin{macrocode} +\newif\ifctagsplit@ +\newif\iftagsleft@ +% \end{macrocode} +% Right or left placement of equation numbers. +% \begin{macrocode} +\DeclareOption{leqno}{\tagsleft@true} +\DeclareOption{reqno}{\tagsleft@false} +\DeclareOption{centertags}{\ctagsplit@true} +\DeclareOption{tbtags}{\ctagsplit@false} +% \end{macrocode} +% +% The \opt{cmex10} option is an escape hatch for people who don't +% happen to have sizes 7--9 of the \fn{cmex} fonts available to them +% yet. (Strictly speaking they are considered part of a minimum +% \latex/ distribution now, i.e., all \LaTeXe{} users should have +% them, without needing to get the AMSFonts distrib.) +% \begin{macrocode} +\DeclareOption{cmex10}{% + \ifnum\cmex@opt=\@ne \def\cmex@opt{0}% + \else \def\cmex@opt{10}\fi +} +% \end{macrocode} +% To help things work out better with various package loading orders +% of \pkg{amsmath} and \pkg{amsfonts}, we establish a variable to +% communicate the status of the cmex font definition. If the +% \pkg{amsfonts} package was loaded first this variable might be +% already defined, in which case we want to preserve its value. +% \begin{macrocode} +\@ifundefined{cmex@opt}{\def\cmex@opt{7}}{} +% \end{macrocode} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Flush-left equations [DMJ]} +% +% The left margin of math enviroments is controlled by +% \cs{@mathmargin}. This can be set to \cs{@centering} to +% implement the default behaviour, i.e., centered equations, and to +% something else to implement the flushleft style. +% +% In theory, all that's needed to activate the flushleft mode +% in the AMS document classes is something like this: +% \begin{verbatim} +% \DeclareOption{fleqn}{% +% \AtBeginDocument{\@mathmargin30pt\relax}% +% } +% \end{verbatim} +% (In fact, unless the document class wants to specify the +% \cs{@mathmargin}, it doesn't need to do anything with the +% \opt{fleqn} option.) +% \begin{macrocode} +\newif\if@fleqn +% +\newskip\@mathmargin +\@mathmargin\@centering +% +\DeclareOption{fleqn}{% + \@fleqntrue + \@mathmargin = -1sp + \let\mathindent=\@mathmargin + \AtBeginDocument{% + \ifdim\@mathmargin= -1sp + \@mathmargin\leftmargini minus\leftmargini + \fi + }% +} +% \end{macrocode} +% +% DMJ: This ensures that \cs{@mathmargin} is given some sort of +% sensible default if the class doesn't specify one, while still +% allowing a user to override the default value in their document +% preamble. (Incidentally, I'm initializing \cs{@mathmargin} to +% \cs{leftmargini} for compatibility with \fn{fleqn.clo}, but I'm +% not at all convinced that's the right thing to do.) +% +% The next question is what happens when amsmath is used with +% one of the standard classes. Unfortunately, \latex/ implements +% \opt{fleqn} somewhat clumsily; instead of paramaterizing the +% definitions of the math structures (as I've attempted to do +% here), \fn{fleqn.clo} declares a dimen \cn{mathindent} that is +% much like my \cs{@mathmargin} and then redefines \cn\[, \cn\], +% \cn{equation}, and \cn{eqnarray}. This means that things could +% get rather messy in 2.09 compatibility mode, since \fn{fleqn.clo} +% might be loaded after \fn{amsmath.sty}, which could cause a real +% mess. +% +% [mjd,1999/07/07]: Let \cs{mathindent} = \cs{@mathmargin} as +% envisioned by DMJ. Compatibility-mode documents will all use the +% \pkg{amstex} package, not \pkg{amsmath}. There is a remote chance +% of a problem if someone makes an assignment to \cs{mathindent} in a +% way that implicitly assumes it is a dimen register (inasmuch as it +% has now become a skip register), and the string ``plus'' follows in +% the input stream, but if someone's document croaks in that way, I +% think they will just have to bite the bullet and fix it. The +% alternative is to penalize a lot of other users with a known +% handicap. +% +% \section{Spacing around \cn{aligned} and \cn{gathered}} +% +% [dpc, 2016] Option to control the space to the left of aligned and gathered. +% +% Previously \cn{aligned} and \cn{gathered} inserted a thin space on +% their left but not their right, there is no good reason for this +% that anyone can remember, it has just always been that way +% inherited from amstex. The usual advice to authors has been to use +% |\!\begin{aligned}| to get better spacing. +% +% Here introduce: +% +% \opt{alignedleftspaceyes} to keep the behaviour of adding this space. +% +% \opt{alignedleftspaceno} to disable adding this space. +% +% \opt{alignedleftspaceyesifneg} the new default behaviour, do not add +% the space unless the environment is preceded by a negative skip or +% kern, so that |\!\begin{aligned}| works as before. +% +% \changes{v2.16a}{2016/11/05}{New options to control aligned spacing} +% \begin{macrocode} +\DeclareOption{alignedleftspaceyes}{\def\alignedspace@left{\null\,}} +\DeclareOption{alignedleftspaceno}{\def\alignedspace@left{\null}} +\DeclareOption{alignedleftspaceyesifneg}{% +\def\alignedspace@left{% + \edef\@tempa{\expandafter\@car\the\lastskip\@nil}% + \if-\@tempa\null\,% + \else + \edef\@tempa{\expandafter\@car\the\lastkern\@nil}% + \if-\@tempa\null\,% + \else\null + \fi + \fi}% +} +% \end{macrocode} +% +% +% \begin{macrocode} +\DeclareOption{?}{} +% \end{macrocode} +% +% \begin{macrocode} +\ExecuteOptions{% + nointlimits,sumlimits,namelimits,centertags,alignedleftspaceyesifneg} +% \end{macrocode} +% The \cs{par} after \cs{ProcessOptions} is to ensure the correct +% line number on screen if an error occurs during option processing; +% otherwise the lookahead for a \qc{\*} option would result in \tex/ +% showing the following line instead. +% \begin{macrocode} +\ProcessOptions\par +% \end{macrocode} +% +% \begin{macrocode} +\@ifpackagewith{amsmath}{?}{% + \typeout{^^J% +Documentation for the amsmath package is found in amsldoc.dvi^^J% +(or .pdf or .tex).^^J% +^^J% +See also https://www.ams.org/tex/amslatex.html.^^J% +^^J% +Note: Using the first edition of The LaTeX Companion (1994) without^^J% +errata as a guide for amsmath use is not recommended.^^J% + }% +}{% + \typeout{% +For additional information on amsmath, use the \lq ?\rq\space option.% + }% +} +% \end{macrocode} +% +% Processing to handle the \opt{cmex10} option is a little tricky +% because of different possible loading orders for \pkg{amsmath} and +% \pkg{amsfonts}. The package \pkg{amsmath} sets the \cs{cmex@opt} +% flag to 7 or 10, and the package \pkg{amsfonts} sets the flag to 1 +% or 0. +% \begin{macrocode} +\ifnum\cmex@opt=7 \relax + \DeclareFontShape{OMX}{cmex}{m}{n}{% + <-8>cmex7<8>cmex8<9>cmex9% + <10><10.95><12><14.4><17.28><20.74><24.88>cmex10% + }{}% + \expandafter\let\csname OMX/cmex/m/n/10\endcsname\relax +\else + \ifnum\cmex@opt=\z@ % need to override cmex7 fontdef from amsfonts +% \end{macrocode} +% Force reloading of the OMX/cmex font definition file. +% \begin{macrocode} + \begingroup + \fontencoding{OMX}\fontfamily{cmex}% + \expandafter\let\csname OMX+cmex\endcsname\relax + \try@load@fontshape + \endgroup +% \end{macrocode} +% The \fn{cmex10} font gets special preload handling in the building +% of the \latex/ format file, need an extra bit here to work around +% that. +% \begin{macrocode} + \expandafter\let\csname OMX/cmex/m/n/10\endcsname\relax + \def\cmex@opt{10}% + \fi +\fi +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Call some other packages} +% +% The \pkg{amstext} package provides the \cn{text} command. The +% \pkg{amsbsy} package provides \cn{boldsymbol} and \cn{pmb}. (Since +% 1997 it is usually better to use the \pkg{bm} package instead; but +% I think we have to keep \pkg{amsbsy} here for backward +% compatibility [mjd,1999/11/19].) The \pkg{amsopn} package provides +% \cn{DeclareMathOperator}. +% \begin{macrocode} +\RequirePackage{amstext}[1995/01/25] +\RequirePackage{amsbsy}[1995/01/20] +\RequirePackage{amsopn}[1995/01/20] +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Miscellaneous} +% +% \begin{macro}{\ams@newcommand} +% Where \pkg{stix} and \pkg{amsmath} define the same control +% sequences, we want to avoid inadvertently overriding \pkg{stix}'s +% definitions. If \pkg{stix} is loaded before \pkg{amsmath}, the +% following conditional takes care of the problem. There is +% similar code in the \pkg{stix} package in case \pkg{amsmath} is +% loaded first. +% \begin{macrocode} +\@ifpackageloaded{stix}{% + \let\ams@newcommand\providecommand + \let\ams@renewcommand\providecommand + \let\ams@def\providecommand + \let\ams@DeclareRobustCommand\providecommand +}{% + \let\ams@newcommand\newcommand + \let\ams@renewcommand\renewcommand + \let\ams@def\def + \let\ams@DeclareRobustCommand\DeclareRobustCommand +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@amsmath@err} +% Defining this error function saves main mem. +% \begin{macrocode} +\def\@amsmath@err{\PackageError{amsmath}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\AmS} +% The \cs{AmS} prefix can be used to construct the combination +% |\AmS-\LaTeX|. +% \begin{macrocode} +\providecommand{\AmS}{{\protect\AmSfont + A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}} +% \end{macrocode} +% In \cn{AmSfont} we call cmsy directly in lieu of trying to access +% it through the math fonts setup (e.g. |\the\textfont2|) because +% math fonts can't be relied on to be properly set up if we are not +% inside a math formula. This means that if this command is used in a +% document where CM fonts are not wanted, then a font substitution +% will need to be declared, e.g.: +% \begin{verbatim} +% \DeclareFontShape{OMS}{cmsy}{m}{n}{ <-> sub * xxx/m/n }{} +% \end{verbatim} +% where |xxx| is some alternate font family. +% Taking the first letter of \cs{f@series} will produce |b| or |m| +% for the most common values (|b,bx,m|). It may produce nonsense for +% more unusual values of \cs{f@series}, so for safety's sake we have +% an additional \cs{if} test. We want to avoid setting the series to +% |bx| because in a standard \latex/ installation the combination +% |cmsy/bx/n| does not have a font definition, and the user +% would get a font substitution warning on screen. +% \begin{macrocode} +\newcommand{\AmSfont}{% + \usefont{OMS}{cmsy}{\if\@xp\@car\f@series\@nil bb\else m\fi}{n}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@mathmeasure} +% The function |\@mathmeasure| takes three arguments; the third arg +% is typeset as a math formula in an hbox, using arg |#2| as the +% mathstyle, and the result is left in the box named by the first +% arg. It is assumed that we are already in math mode, so we can turn +% off |\everymath| (in particular, |\check@mathfonts|). +% +% As of 2018/12 release we don't turn off |\evermath| as this +% optimization can be harmful. +% \changes{v2.17b}{2018/12/01}{Don't drop \cs{frozen@everymath}} +% \begin{macrocode} +\ifx\leavevmode@ifvmode\@undefined % kernel is < 2018/12 +\def\@mathmeasure#1#2#3{\setbox#1\hbox{\frozen@everymath\@emptytoks + \m@th$#2#3$}} +\else +\def\@mathmeasure#1#2#3{\setbox#1\hbox{% + \m@th$#2#3$}} +\fi +% \end{macrocode} +% \end{macro} +% +% The \cs{inf@bad} constant is for testing overfull boxes. +% \begin{macrocode} +\@ifundefined{inf@bad}{% + \newcount\inf@bad \inf@bad=1000000 \relax +}{} +% \end{macrocode} +% +%\subsection{Math spacing commands} +% +% \begin{macro}{\tmspace} +% \begin{macro}{\,} +% \begin{macro}{\thinspace} +% \begin{macro}{\!} +% \begin{macro}{\negthinspace} +% \begin{macro}{\:} +% \begin{macro}{\medspace} +% \begin{macro}{\negmedspace} +% \begin{macro}{\;} +% \begin{macro}{\thickspace} +% \begin{macro}{\negthickspace} +% Here we fill in some gaps in the set of spacing commands, and make them +% all work equally well in or out of math. +% We want all these commands to be robust but declaring them all with +% \cs{DeclareRobustCommand} uses up an control sequence name per +% command; to avoid this, we define a common command \cs{tmspace} +% (text-or-math space) which carries the robustness burden for all of +% them. The standard \cs{relax} before the \cs{ifmmode} is not +% necessary because of the \cs{protect} added by +% \cs{DeclareRobustCommand}. +% \changes{v2.17b}{2018/12/01}{Start LR-mode for \cs{thinspace} and +% friends if necessary (github/49)} +% \begin{macrocode} +\ifx\leavevmode@ifvmode\@undefined +\DeclareRobustCommand{\tmspace}[3]{% + \ifmmode\mskip#1#2\else\kern#1#3\fi\relax} +\else +\DeclareRobustCommand{\tmspace}[3]{% + \ifmmode\mskip#1#2\else\leavevmode@ifvmode\kern#1#3\fi\relax} +\fi +\renewcommand{\,}{\tmspace+\thinmuskip{.1667em}} +\let\thinspace\, +\renewcommand{\!}{\tmspace-\thinmuskip{.1667em}} +\let\negthinspace\! +\renewcommand{\:}{\tmspace+\medmuskip{.2222em}} +\let\medspace\: +\newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}} +\renewcommand{\;}{\tmspace+\thickmuskip{.2777em}} +\let\thickspace\; +\newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\mspace} +% And while we're at it, why don't we provide an equivalent of +% \cn{hspace} for math mode use. This allows use of |mu| units in +% (for example) constructing compound math symbols. +% \begin{macrocode} +\newcommand{\mspace}[1]{\mskip#1\relax} +% \end{macrocode} +% \end{macro} +% +% \subsection{Vertical bar symbols} +% \begin{macro}{\lvert} +% \begin{macro}{\rvert} +% \begin{macro}{\lVert} +% \begin{macro}{\rVert} +% Add left/right specific versions of \cn{vert}, \cn{Vert}. Don't +% assume the delimiter codes are the CM defaults. +% \begin{macrocode} +\def\@tempa#1#2\@nil{% + \ifx\delimiter#1\@tempcnta#2\relax\else\@tempcnta\z@\fi +} +\@xp\@tempa\vert\@empty\@nil +\ifnum\@tempcnta>\z@ + \advance\@tempcnta "4000000 + \xdef\lvert{\delimiter\number\@tempcnta\space } + \advance\@tempcnta "1000000 + \xdef\rvert{\delimiter\number\@tempcnta\space } +\else + \ifx\@@undefined\lvert + % Fall back to cmex encoding since we don't know what else to do. + \DeclareMathDelimiter{\lvert} + {\mathopen}{symbols}{"6A}{largesymbols}{"0C} + \DeclareMathDelimiter{\rvert} + {\mathclose}{symbols}{"6A}{largesymbols}{"0C} + \fi +\fi +\@xp\@tempa\Vert\@empty\@nil +\ifnum\@tempcnta>\z@ + \advance\@tempcnta "4000000 + \xdef\lVert{\delimiter\number\@tempcnta\space } + \advance\@tempcnta "1000000 + \xdef\rVert{\delimiter\number\@tempcnta\space } +\else + \ifx\@@undefined\lVert + \DeclareMathDelimiter{\lVert} + {\mathopen}{symbols}{"6B}{largesymbols}{"0D} + \DeclareMathDelimiter{\rVert} + {\mathclose}{symbols}{"6B}{largesymbols}{"0D} + \fi +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Fractions} +% Bury the generalized fraction primitives \cs{over}, \cs{atop}, +% etc., because of their bizarre syntax, which is decidedly out of +% place in a \latex/ document. +% \begin{macrocode} +\@saveprimitive\over\@@over +\@saveprimitive\atop\@@atop +\@saveprimitive\above\@@above +\@saveprimitive\overwithdelims\@@overwithdelims +\@saveprimitive\atopwithdelims\@@atopwithdelims +\@saveprimitive\abovewithdelims\@@abovewithdelims +% \end{macrocode} +% +% \begin{macro}{\primfrac} +% If someone insists on using \cs{over}, give a warning the first +% time and then resurrect the old definition. Laissez-faire policy. +% \begin{macrocode} +\DeclareRobustCommand{\primfrac}[1]{% + \PackageWarning{amsmath}{% +Foreign command \@backslashchar#1;\MessageBreak +\protect\frac\space or \protect\genfrac\space should be used instead% +\MessageBreak + } + \global\@xp\let\csname#1\@xp\endcsname\csname @@#1\endcsname + \csname#1\endcsname +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\renewcommand{\over}{\primfrac{over}} +\renewcommand{\atop}{\primfrac{atop}} +\renewcommand{\above}{\primfrac{above}} +\renewcommand{\overwithdelims}{\primfrac{overwithdelims}} +\renewcommand{\atopwithdelims}{\primfrac{atopwithdelims}} +\renewcommand{\abovewithdelims}{\primfrac{abovewithdelims}} +% \end{macrocode} +% +% \cn{frac} calls \cn{@@over} directly instead of via \cn{genfrac}, for +% better speed because it is so common. \cn{tfrac} and \cn{dfrac} are +% abbreviations for some commonly needed mathstyle overrides. To +% conserve csnames we avoid making \cn{dfrac} and \cn{tfrac} robust +% (\cn{genfrac} is itself robust). +% \begin{macrocode} +\DeclareRobustCommand{\frac}[2]{{\begingroup#1\endgroup\@@over#2}} +\newcommand{\dfrac}{\genfrac{}{}{}0} +\newcommand{\tfrac}{\genfrac{}{}{}1} +% \end{macrocode} +% The \cn{binom} command for binomial notation works like \cn{frac} +% and has similar variants. Note that we do not use \cs{z@} in +% \cn{dbinom} and \cn{tbinom} because they are not top-level robust +% like \cn{binom}, and so the \cs{z@} with the potentially +% problematic \qc{\@} character would become visible when writing one +% of those commands to a \fn{.toc} file. +% \begin{macrocode} +\DeclareRobustCommand{\binom}{\genfrac()\z@{}} +\newcommand{\dbinom}{\genfrac(){0pt}0} +\newcommand{\tbinom}{\genfrac(){0pt}1} +% \end{macrocode} +% +% \begin{macro}{\genfrac} +% \changes{v2.16a}{2016/11/05}{New genfrac implementation for extended +% TeXs} +% This command provides access to \tex/'s generalized fraction +% primitives. Args: \arg{1} left delim, \arg{2} right delim, \arg{3} +% line thickness, \arg{4} mathstyle override, \arg{5} numerator, +% \arg{6} denominator. But we only read the first four args at first, +% in order to give us a moment to select the proper generalized +% fraction primitive. Any of those four args could be empty, and when +% empty the obvious defaults are selected (no delimiters, default +% line thickness (normally .4pt), and no mathstyle override). +% +% the |withdelims| primitives do not work in xetex with OpenType +% fonts, and the relevant font dimen parameters are often not set +% in luatex as theer are no matching values in the OpenType Math +% table, so here we use variants that use the font parameters if +% they are set, but scale using |\left\right| rather than the +% |withdelims| primitives. +% +% \begin{macrocode} +\ifx\directlua\@undefined +% \end{macrocode} +% +% \begin{macrocode} +\ifx\XeTeXcharclass\@undefined +% \end{macrocode} +% Classic version +% \begin{macrocode} +\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{macrocode} +% +% \begin{macrocode} +\else +% \end{macrocode} +% XeTeX version +% \begin{macrocode} +\def\genfrac@rule#1#2#3#4{% +\hbox{$\left#1\vcenter{\hrule \@width\z@ + \@height + \ifdim\fontdimen#2#3\tw@=\z@ + #4\fontdimen6#3\tw@ + \else + \fontdimen#2#3\tw@ + \fi + }\right.$}} +% \end{macrocode} +% +% \begin{macrocode} +\def\genfrac@choice#1#2{% +\ifx @#2@\else +% \end{macrocode} +% \changes{v2.17a}{2017/09/02}{move \cs{nulldelimiterspace} correction} +% \begin{macrocode} +\ifx c#1\kern-\nulldelimiterspace\fi +{\delimitershortfall\z@\delimiterfactor\@m + \mathsurround\z@\nulldelimiterspace\z@ +\mathchoice +{\genfrac@rule{#2}{20}\textfont{2.39}}% +{\genfrac@rule{#2}{21}\textfont{1}}% +{\genfrac@rule{#2}{21}\scriptfont{1.45}}% +{\genfrac@rule{#2}{21}\scriptscriptfont{1.35}}% +}% +\ifx o#1\kern-\nulldelimiterspace\fi +\fi +} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareRobustCommand{\genfrac}[6]{{% +\@mathstyle{#4}% +\genfrac@choice o{#1}% +{\begingroup#5\endgroup\ifx @#3@\@@over\else\@@above\fi#3\relax#6}% +\genfrac@choice c{#2}% +}} +% \end{macrocode} +% +% \begin{macrocode} +\fi +\else +% \end{macrocode} +% LuaTeX version +% \begin{macrocode} +\def\genfrac@rule#1#2#3{% +\hbox{$\left#1\vcenter{\hrule \@width\z@ + \@height + \ifdim\Umathfractiondelsize#2=\z@ + #3\fontdimen6#3\tw@ + \else + \Umathfractiondelsize#2% + \fi + }\right.$}} +% \end{macrocode} +% +% \begin{macrocode} +\def\genfrac@choice#1#2{% +\ifx @#2@\else +% \end{macrocode} +% \changes{v2.17a}{2017/09/02}{move \cs{nulldelimiterspace} correction} +% \begin{macrocode} +\ifx c#1\kern-\nulldelimiterspace\fi +{\delimitershortfall\z@\delimiterfactor\@m + \mathsurround\z@\nulldelimiterspace\z@ +\mathchoice +{\genfrac@rule{#2}\displaystyle{2.39}}% +{\genfrac@rule{#2}\textstyle{1}}% +{\genfrac@rule{#2}\scriptstyle{1.45}}% +{\genfrac@rule{#2}\scriptscriptstyle{1.35}}% +}% +\ifx o#1\kern-\nulldelimiterspace\fi +\fi +} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareRobustCommand{\genfrac}[6]{{% +\@mathstyle{#4}% +\genfrac@choice o{#1}% +{\begingroup#5\endgroup\ifx @#3@\@@over\else\@@above\fi#3\relax#6}% +\genfrac@choice c{#2}% +}} +% \end{macrocode} +% +% \begin{macrocode} +\fi +% \end{macrocode} +% +% End of test for Lua\TeX/Xe\TeX. +% +% \cs{@genfrac} takes the preceding arguments and reads the +% numerator and denominator. Note that there's no convenient way to +% make the numerator and denominator \emph{contents} +% displaystyle, through this interface. +% +% Args: \arg{1} mathstyle, \arg{2} fraction primitive, +% \arg{3} delimiters and rule thickness, +% \arg{4} numerator, \arg{5} denominator. +% \begin{macrocode} +\def\@genfrac#1#2#3#4#5{{#1{\begingroup#4\endgroup#2#3\relax#5}}} +% \end{macrocode} +% \end{macro} +% +% Empty mathstyle arg: no change; 0 = displaystyle, 1 = textstyle, 2 +% = scriptstyle, 3 = scriptscriptstyle. +% \begin{macrocode} +\def\@mathstyle#1{% + \ifx\@empty#1\@empty\relax + \else\ifcase#1\displaystyle % case 0 + \or\textstyle\or\scriptstyle\else\scriptscriptstyle\fi\fi} +% \end{macrocode} +% +% \subsection{Sums and Integrals} +% Default value for sum limits is \cs{displaylimits}, see option +% `nosumlimits'. +% +% We redefine all the cumulative operator symbols to use +% \cs{slimits@} so that switching between \cs{displaylimits} and +% \cs{nolimits} can be controlled by package options. Also add +% \cs{DOTSB} for the benefit of the dots lookahead. But we'd better +% make sure \cn{coprod} and the others are simple mathchars; if not, +% the attempted changes will probably fail miserably. +% +% \changes{v2.15}{2016/02/20}{Accept \cs{Umathchar}} +% \begin{macrocode} +\begingroup +% \end{macrocode} +% \begin{macrocode} +\edef\@tempa{\string\mathchar"} +\edef\@tempd{\string\Umathchar"} +\def\@tempb#1"#2\@nil{#1"} +\edef\@tempc{\expandafter\@tempb\meaning\coprod "\@nil} +\ifx\@tempc\@tempd\let\@tempc\@tempa\fi +% \end{macrocode} +% \begin{macrocode} +\ifx\@tempa\@tempc + \global\let\coprod@\coprod + \gdef\coprod{\DOTSB\coprod@\slimits@} + \global\let\bigvee@\bigvee + \gdef\bigvee{\DOTSB\bigvee@\slimits@} + \global\let\bigwedge@\bigwedge + \gdef\bigwedge{\DOTSB\bigwedge@\slimits@} + \global\let\biguplus@\biguplus + \gdef\biguplus{\DOTSB\biguplus@\slimits@} + \global\let\bigcap@\bigcap + \gdef\bigcap{\DOTSB\bigcap@\slimits@} + \global\let\bigcup@\bigcup + \gdef\bigcup{\DOTSB\bigcup@\slimits@} + \global\let\prod@\prod + \gdef\prod{\DOTSB\prod@\slimits@} + \global\let\sum@\sum + \gdef\sum{\DOTSB\sum@\slimits@} + \global\let\bigotimes@\bigotimes + \gdef\bigotimes{\DOTSB\bigotimes@\slimits@} + \global\let\bigoplus@\bigoplus + \gdef\bigoplus{\DOTSB\bigoplus@\slimits@} + \global\let\bigodot@\bigodot + \gdef\bigodot{\DOTSB\bigodot@\slimits@} + \global\let\bigsqcup@\bigsqcup + \gdef\bigsqcup{\DOTSB\bigsqcup@\slimits@} +\fi +\endgroup +% \end{macrocode} +% +% \subsection{Roots and radicals} +% +% \begin{macro}{\root} +% This root stuff needs syntax work and implementation work. Surely +% something more compact can be done?? [mjd, 1994/09/05] +% \begin{macrocode} +\newcommand{\leftroot}{\@amsmath@err{\Invalid@@\leftroot}\@eha} +\newcommand{\uproot}{\@amsmath@err{\Invalid@@\uproot}\@eha} +\newcount\uproot@ +\newcount\leftroot@ +\renewcommand{\root}{\relaxnext@ + \DN@{\ifx\@let@token\uproot\let\next@\nextii@\else + \ifx\@let@token\leftroot\let\next@\nextiii@\else + \let\next@\plainroot@\fi\fi\next@}% + \def\nextii@\uproot##1{\uproot@##1\relax\FN@\nextiv@}% + \def\nextiv@{\ifx\@let@token\@sptoken\DN@. {\FN@\nextv@}\else + \DN@.{\FN@\nextv@}\fi\next@.}% + \def\nextv@{\ifx\@let@token\leftroot\let\next@\nextvi@\else + \let\next@\plainroot@\fi\next@}% + \def\nextvi@\leftroot##1{\leftroot@##1\relax\plainroot@}% + \def\nextiii@\leftroot##1{\leftroot@##1\relax\FN@\nextvii@}% + \def\nextvii@{\ifx\@let@token\@sptoken + \DN@. {\FN@\nextviii@}\else + \DN@.{\FN@\nextviii@}\fi\next@.}% + \def\nextviii@{\ifx\@let@token\uproot\let\next@\nextix@\else + \let\next@\plainroot@\fi\next@}% + \def\nextix@\uproot##1{\uproot@##1\relax\plainroot@}% + \bgroup\uproot@\z@\leftroot@\z@\FN@\next@} +\def\plainroot@#1\of#2{\setbox\rootbox\hbox{% + $\m@th\scriptscriptstyle{#1}$}% + \mathchoice{\r@@t\displaystyle{#2}}{\r@@t\textstyle{#2}} + {\r@@t\scriptstyle{#2}}{\r@@t\scriptscriptstyle{#2}}\egroup} +% \end{macrocode} +% \end{macro} +% +% \changes{v2.0}{1999/06/17}{Normalize @@sqrt to sqrtsign} + +% Name change from \cs{@@sqrt} to \cs{sqrtsign} happened in the +% 1995/12/01 release of \latex/. If we were to assume that +% \cs{sqrtsign} is defined then someone with the 1995/06/01 release +% of \latex/ would have trouble using this package. +% \begin{macrocode} +\@ifundefined{sqrtsign}{\let\sqrtsign\@@sqrt}{} +\def\r@@t#1#2{\setboxz@h{$\m@th#1\sqrtsign{#2}$}% + \dimen@\ht\z@\advance\dimen@-\dp\z@ + \setbox\@ne\hbox{$\m@th#1\mskip\uproot@ mu$}% + \advance\dimen@ by1.667\wd\@ne + \mkern-\leftroot@ mu\mkern5mu\raise.6\dimen@\copy\rootbox + \mkern-10mu\mkern\leftroot@ mu\boxz@} +% \end{macrocode} +% +% \subsection{Et cetera} +% +% \changes{v2.0}{1999/06/18}{Leave Greek cap letters unaltered} +% +% Specific names for the variant italic cap Greek letters are not +% defined by \latex/. If no preceding package defined these, we will +% define them now. +% \begin{macrocode} +\@ifundefined{varGamma}{% + \DeclareMathSymbol{\varGamma}{\mathord}{letters}{"00} + \DeclareMathSymbol{\varDelta}{\mathord}{letters}{"01} + \DeclareMathSymbol{\varTheta}{\mathord}{letters}{"02} + \DeclareMathSymbol{\varLambda}{\mathord}{letters}{"03} + \DeclareMathSymbol{\varXi}{\mathord}{letters}{"04} + \DeclareMathSymbol{\varPi}{\mathord}{letters}{"05} + \DeclareMathSymbol{\varSigma}{\mathord}{letters}{"06} + \DeclareMathSymbol{\varUpsilon}{\mathord}{letters}{"07} + \DeclareMathSymbol{\varPhi}{\mathord}{letters}{"08} + \DeclareMathSymbol{\varPsi}{\mathord}{letters}{"09} + \DeclareMathSymbol{\varOmega}{\mathord}{letters}{"0A} +}{} +% \end{macrocode} +% +% \begin{macro}{\overline} +% \amstex/ redefines \cn{overline} as shown here, for reasons that +% are probably less important in \latex/: Make it read its argument +% as a macro argument rather than a ``math field'' (\emph{The +% \tex/book}, Chapter 26), to avoid problems when something that is +% apparently a single symbol is actually a non-simple macro (e.g., +% \cn{dag}) \emph{and} is given as a single-token argument without +% enclosing braces. +% \begin{macrocode} +\@saveprimitive\overline\@@overline +\DeclareRobustCommand{\overline}[1]{\@@overline{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\boxed} +% The \cs{boxed} command is specifically intended to put a box around +% an equation or piece of an equation. (Not including the equation +% number.) This isn't trivial for end-users to do it properly +% with \cs{fbox} so we provide a command for them. +% \begin{macrocode} +\newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\implies} +% \begin{macro}{\impliedby} +% \begin{macrocode} +\newcommand{\implies}{\DOTSB\;\Longrightarrow\;} +\newcommand{\impliedby}{\DOTSB\;\Longleftarrow\;} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\And} +% \begin{macrocode} +\def\And{\DOTSB\;\mathchar"3026 \;} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\nobreakdash} +% The command \cn{nobreakdash} is designed only for use before a +% hyphen or dash (|-|, |--|, or |---|). +% Setting the hyphen in a box and then unboxing it means that the +% normal penalty will not be added after it---and if the penalty is +% not there a break will not be taken (unless an explicit penalty +% or glue follows, thus the final \verb=\nobreak=). +% \begin{macrocode} +\newcommand{\nobreakdash}{\leavevmode + \toks@\@emptytoks \def\@tempa##1{\toks@\@xp{\the\toks@-}\FN@\next@}% + \DN@{\ifx\@let@token-\@xp\@tempa + \else\setboxz@h{\the\toks@\nobreak}\unhbox\z@\fi}% + \FN@\next@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\colon} +% \cs{colon} is for a colon in math that resembles a text colon: +% small space on the left, larger space on the right. The \qc{\:} +% character by itself is treated as a \cs{mathrel} i.e. large, equal +% spacing on both sides. +% \begin{macrocode} +\renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript + \mkern-\thinmuskip{:}\mskip6muplus1mu\relax} +% \end{macrocode} +% \end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Ellipsis dots} +% +% We can't use \cs{newif} for \cs{ifgtest@} because we want +% to include \cs{global} in the definitions of +% \cs{gtest@true} and \cs{gtest@false}. +% \begin{macrocode} +\let\ifgtest@\iffalse % initial value +\def\gtest@true{\global\let\ifgtest@\iftrue} +\def\gtest@false{\global\let\ifgtest@\iffalse} +\let\DOTSI\relax +\let\DOTSB\relax +\let\DOTSX\relax +{\uccode`7=`\\ \uccode`8=`m \uccode`9=`a \uccode`0=`t \uccode`!=`h + \uppercase{% + \gdef\math@#1#2#3#4#5#6\math@{\gtest@false\ifx 7#1\ifx 8#2% + \ifx 9#3\ifx 0#4\ifx !#5\xdef\meaning@{#6}\gtest@true + \fi\fi\fi\fi\fi}}} +{\uccode`7=`c \uccode`8=`h \uccode`9=`\" + \uppercase{\gdef\mathch@#1#2#3#4#5#6\mathch@{\gtest@false + \ifx 7#1\ifx 8#2\ifx 9#5\gtest@true\xdef\meaning@{9#6}\fi\fi\fi}}} +% \end{macrocode} +% \changes{v2.15}{2016/02/20}{Accept \cs{Umathchar}} +% \begin{macrocode} +{\uccode`(=`U \uccode`)=`m + \uppercase{\gdef\Umathch@#1#2#3#4"#5"#6\Umathch@{\gtest@false + \ifx(#2\ifx)#3\gtest@true + \ifcase"#5 \or\or\gdef\thedots@{\dotsb@}\or\gdef\thedots@{\dotsb@}\fi + \fi\fi + }}} +% \end{macrocode} +% \changes{v2.15}{2016/02/20}{Decode the mathcode of character tokens for Unicode TeX} +% For Unicode TeXs, if the next token is a character token look up the (U)mathcode. Do not do this for classic TeX for compatibility reasons. +% \begin{macrocode} +\ifx\Umathcharnumdef\@undefined +\gdef\thecharacter@#1\thecharacter@{} +\else +{\uccode`(=`t \uccode`)=`c + \uppercase{\gdef\thecharacter@#1#2#3#4#5\thecharacter@{% + \ifx(#1\ifx)#4% + \@xp\getmathcode@\meaning@\getmathcode@ + \fi\fi +}}} +\def\getmathcode@#1 #2 #3#4\getmathcode@{% + \Umathcharnumdef\@tempa\Umathcodenum`#3\relax + \edef\meaning@{\meaning\@tempa}% + \@xp\Umathch@\meaning@\Umathch@ +} +\fi +% \end{macrocode} +% \begin{macrocode} +\newcount\classnum@ +\def\getmathch@#1.#2\getmathch@{\classnum@#1 \divide\classnum@4096 + \ifcase\number\classnum@\or\or\gdef\thedots@{\dotsb@}\or + \gdef\thedots@{\dotsb@}\fi} +{\uccode`4=`b \uccode`5=`i \uccode`6=`n + \uppercase{\gdef\mathbin@#1#2#3{\relaxnext@ + \def\nextii@##1\mathbin@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \gtest@false\DN@##1\mathbin@{}% + \ifx 4#1\ifx 5#2\ifx 6#3\DN@{\FN@\nextii@}\fi\fi\fi\next@}}} +{\uccode`4=`r \uccode`5=`e \uccode`6=`l + \uppercase{\gdef\mathrel@#1#2#3{\relaxnext@ + \def\nextii@##1\mathrel@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \gtest@false\DN@##1\mathrel@{}% + \ifx 4#1\ifx 5#2\ifx 6#3\DN@{\FN@\nextii@}\fi\fi\fi\next@}}} +{\uccode`5=`m \uccode`6=`a \uccode`7=`c + \uppercase{\gdef\macro@#1#2#3#4\macro@{\gtest@false + \ifx 5#1\ifx 6#2\ifx 7#3\gtest@true + \xdef\meaning@{\macro@@#4\macro@@}\fi\fi\fi}}} +\def\macro@@#1->#2\macro@@{#2} +\newcount\DOTSCASE@ +{\uccode`6=`\\ \uccode`7=`D \uccode`8=`O \uccode`9=`T \uccode`0=`S + \uppercase{\gdef\DOTS@#1#2#3#4#5{\gtest@false\DN@##1\DOTS@{}% + \ifx 6#1\ifx 7#2\ifx 8#3\ifx 9#4\ifx 0#5\let\next@\DOTS@@ + \fi\fi\fi\fi\fi + \next@}}} +{\uccode`3=`B \uccode`4=`I \uccode`5=`X + \uppercase{\gdef\DOTS@@#1{\relaxnext@ + \def\nextii@##1\DOTS@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \DN@{\FN@\nextii@}% + \ifx 3#1\global\DOTSCASE@\z@\else + \ifx 4#1\global\DOTSCASE@\@ne\else + \ifx 5#1\global\DOTSCASE@\tw@\else\DN@##1\DOTS@{}% + \fi\fi\fi\next@}}} +{\uccode`5=`\\ \uccode`6=`n \uccode`7=`o \uccode`8=`t + \uppercase{\gdef\not@#1#2#3#4{\relaxnext@ + \def\nextii@##1\not@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \gtest@false\DN@##1\not@{}% + \ifx 5#1\ifx 6#2\ifx 7#3\ifx 8#4\DN@{\FN@\nextii@}\fi\fi\fi + \fi\next@}}} +% \end{macrocode} +% \changes{v2.15}{2016/02/20}{macro added to strip \cs{long} during tests} +% \begin{macrocode} +{\uccode`9=`\l % + \uppercase{\gdef\striplong@#1#2#3\relax{% + \ifx9#2 \@xp\@xp\@xp\zap@to@space\fi}}} +\def\zap@to@space#1 {} +% \end{macrocode} +% \begin{macrocode} +\def\keybin@{\gtest@true + \ifx\@let@token+\else\ifx\@let@token=\else + \ifx\@let@token<\else\ifx\@let@token>\else + \ifx\@let@token-\else\ifx\@let@token*\else\ifx\@let@token:\else + \gtest@false\fi\fi\fi\fi\fi\fi\fi} +% \end{macrocode} +% Patch to ensure \cs{@ldots} is defined. (Name changed to +% \cn{mathellipsis} in Dec 94 release of \latex/.) +% \begin{macrocode} +\@ifundefined{@ldots}{\def\@ldots{\mathellipsis}}{} +% \end{macrocode} +% \begin{macro}{\ldots} +% \begin{macro}{\dots} +% Reiterate the standard definition of \cs{ldots} to keep it from +% being clobbered by the redefinition of \cs{dots}. +% \begin{macrocode} +\DeclareRobustCommand{\ldots}{% + \ifmmode \mathellipsis \else \textellipsis \fi +} +\DeclareRobustCommand{\dots}{% + \ifmmode \@xp\mdots@\else \@xp\textellipsis \fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macrocode} +\def\tdots@{\leavevmode\unskip\relaxnext@ + \DN@{$\m@th\@ldots\, + \ifx\@let@token,\,$\else\ifx\@let@token.\,$\else + \ifx\@let@token;\,$\else\ifx\@let@token:\,$\else + \ifx\@let@token?\,$\else\ifx\@let@token!\,$\else + $ \fi\fi\fi\fi\fi\fi}% + \ \FN@\next@} +\def\mdots@{\FN@\mdots@@} +% \end{macrocode} +% \changes{v2.15}{2016/02/20}{Indent \cs{mdots@@} for readability and add additional tests} +% \begin{macrocode} +\def\mdots@@{\gdef\thedots@{\dotso@}% + \ifx\@let@token\boldsymbol + \gdef\thedots@\boldsymbol{\boldsymboldots@}% + \else + \ifx,\@let@token \gdef\thedots@{\dotsc}% + \else + \ifx\not\@let@token + \gdef\thedots@{\dotsb@}% + \else + \keybin@ + \ifgtest@ % if \keybin@ test + \gdef\thedots@{\dotsb@}% + \else +% \end{macrocode} +% \changes{v2.15d}{2016/06/28}{Add space token to prevent runaway argument error} +% \begin{macrocode} + \xdef\meaning@{\meaning\@let@token. .........}% +% \end{macrocode} +% In previous versions \verb|\long| macros were not seen by the lokkahead. +% That was bad as this file uses \verb|\(re)newcommand| for \verb|\implies| etc. +% \begin{macrocode} + \xdef\meaning@@{\@xp\striplong@\meaning@\relax\meaning@}% +% \end{macrocode} +% \begin{macrocode} + \@xp\math@\meaning@\math@ + \ifgtest@ % if \mathxxx test + \@xp\mathch@\meaning@\mathch@ + \ifgtest@ % if \mathchar + \@xp\getmathch@\meaning@\getmathch@ + \fi % end if \mathchar + \else % \not \mathxxx +% \end{macrocode} +% Test for \verb|\Umathchar| added. +% \begin{macrocode} + \@xp\Umathch@\meaning@"0"\Umathch@ + \ifgtest@ % if \Umathchar + \else % else not \Umathcar +% \end{macrocode} +% \begin{macrocode} + \@xp\macro@\meaning@@\macro@ + \ifgtest@ % if macro test + \@xp\not@\meaning@\not@ + \ifgtest@ % if macro starts \not test + \gdef\thedots@{\dotsb@}% + \else% else not \not + \@xp\DOTS@\meaning@\DOTS@ + \ifgtest@ % \if DOTS + \ifcase\number\DOTSCASE@ %ifcase dots + \gdef\thedots@{\dotsb@}% + \or\gdef\thedots@{\dotsi}\else + \fi % endifcase dots + \else % not macro starts \DOTS + \@xp\math@\meaning@\math@ + \ifgtest@ % \if macro starts \mathxxxx + \@xp\mathbin@\meaning@\mathbin@ + \ifgtest@ % if macro starts \mathbin + \gdef\thedots@{\dotsb@}% + \else % not macro starting \mathbin + \@xp\mathrel@\meaning@\mathrel@ + \ifgtest@ % if macro starts \mathrel + \gdef\thedots@{\dotsb@}% + \fi % endif macro starts \mathrel (no else) + \fi % endif macro starts \mathbin + \fi % endif macro starts with \mathxxx (no else) + \fi % endif macro starts \DOTS else + \fi % end macro starting \not \ifgtest@ test (no else) +% \end{macrocode} +% Additional test for a catcode 12 character. +% \begin{macrocode} + \else + \@xp\thecharacter@\meaning@\thecharacter@ +% \end{macrocode} +% \begin{macrocode} + \fi % end macro \ifgtest@ test (no else) + \fi % end if \Umathchar test + \fi % end \math@ \ifgtest@ + \fi % end \keybin@ \ifgtest@ test (no else) + \fi % end if \not (no else) + \fi % end if comma (no else) + \fi % end if boldsymbol (no else) + \thedots@} +% \end{macrocode} +% +% The \qc{\=} character is necessary in the two \cs{let} assignments +% in \cs{boldsymboldots@}, because the symbol we are making +% bold might be an \qc{\=} sign. +% \begin{macrocode} +\def\boldsymboldots@#1{% + \bold@true\let\@let@token=#1\let\delayed@=#1\mdots@@ + \boldsymbol#1\bold@false} +% \end{macrocode} +% +% The definition of \cs{@cdots} is merely the \fn{plain.tex} +% definition of \cs{cdots}. +% \begin{macrocode} +\ams@def\@cdots{\mathinner{\cdotp\cdotp\cdotp}} +\newcommand{\dotsi}{\!\@cdots} +\let\dotsb@\@cdots +% \end{macrocode} +% +% If any new right delimiters are defined, they would need to be +% added to the definition of \cs{rightdelim@} in order for \cn{dots} +% to work properly in all cases. +% \begin{macrocode} +\def\rightdelim@{\gtest@true + \ifx\@let@token)\else + \ifx\@let@token]\else + \ifx\@let@token\rbrack\else + \ifx\@let@token\}\else + \ifx\@let@token\rbrace\else + \ifx\@let@token\rangle\else + \ifx\@let@token\rceil\else + \ifx\@let@token\rfloor\else + \ifx\@let@token\rgroup\else + \ifx\@let@token\rmoustache\else + \ifx\@let@token\right\else + \ifx\@let@token\bigr\else + \ifx\@let@token\biggr\else + \ifx\@let@token\Bigr\else + \ifx\@let@token\Biggr\else\gtest@false + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} +\def\extra@{% + \rightdelim@\ifgtest@ + \else\ifx\@let@token$\gtest@true + \else\xdef\meaning@{\meaning\@let@token..........}% + \@xp\macro@\meaning@\macro@\ifgtest@ + \@xp\DOTS@\meaning@\DOTS@ + \ifgtest@ + \ifnum\DOTSCASE@=\tw@\gtest@true\else\gtest@false + \fi\fi\fi\fi\fi} +\newif\ifbold@ +\def\dotso@{\relaxnext@ + \ifbold@ + \let\@let@token\delayed@ + \def\nextii@{\extra@\@ldots\ifgtest@\,\fi}% + \else + \def\nextii@{\DN@{\extra@\@ldots\ifgtest@\,\fi}\FN@\next@}% + \fi + \nextii@} +% \end{macrocode} +% Why not save some tokens? (space vs. time). +% \begin{macrocode} +\def\extrap@#1{% + \DN@{#1\,}% + \ifx\@let@token,\else + \ifx\@let@token;\else + \ifx\@let@token.\else\extra@ + \ifgtest@\else + \let\next@#1\fi\fi\fi\fi\next@} +% \end{macrocode} +% +% \begin{macro}{\cdots} +% \begin{macro}{\dotsb} +% \begin{macro}{\dotsm} +% \begin{macro}{\dotso} +% \begin{macro}{\dotsc} +% The \cn{cdots} command. +% \begin{macrocode} +\ams@DeclareRobustCommand{\cdots}{\DN@{\extrap@\@cdots}\FN@\next@} +\let\dotsb\cdots +\let\dotsm\cdots +\DeclareRobustCommand{\dotso}{\relax + \ifmmode \DN@{\extrap@\@ldots}% + \else \let\next@\tdots@\fi + \FN@\next@} +\DeclareRobustCommand{\dotsc}{% + \DN@{\ifx\@let@token;\@ldots\,% + \else \ifx\@let@token.\@ldots\,% + \else \extra@\@ldots \ifgtest@\,\fi + \fi\fi}% + \FN@\next@} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\longrightarrow} +% \begin{macro}{\Longrightarrow} +% \begin{macro}{\longleftarrow} +% \begin{macro}{\Longleftarrow} +% \begin{macro}{\longleftrightarrow} +% \begin{macro}{\Longleftrightarrow} +% \begin{macro}{\mapsto} +% \begin{macro}{\longmapsto} +% \begin{macro}{\hookrightarrow} +% \begin{macro}{\hookleftarrow} +% \begin{macro}{\iff} +% Various arrows. +% \begin{macrocode} +\renewcommand{\longrightarrow}{% + \DOTSB\protect\relbar\protect\joinrel\rightarrow} +\renewcommand{\Longrightarrow}{% + \DOTSB\protect\Relbar\protect\joinrel\Rightarrow} +\renewcommand{\longleftarrow}{% + \DOTSB\leftarrow\protect\joinrel\protect\relbar} +\renewcommand{\Longleftarrow}{% + \DOTSB\Leftarrow\protect\joinrel\protect\Relbar} +\renewcommand{\longleftrightarrow}{\DOTSB\leftarrow\joinrel\rightarrow} +\renewcommand{\Longleftrightarrow}{\DOTSB\Leftarrow\joinrel\Rightarrow} +\renewcommand{\mapsto}{\DOTSB\mapstochar\rightarrow} +\renewcommand{\longmapsto}{\DOTSB\mapstochar\longrightarrow} +\renewcommand{\hookrightarrow}{\DOTSB\lhook\joinrel\rightarrow} +\renewcommand{\hookleftarrow}{\DOTSB\leftarrow\joinrel\rhook} +\renewcommand{\iff}{\DOTSB\;\Longleftrightarrow\;} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\doteq} +% The \cn{doteq} command formerly used \cs{buildrel}; we avoid that +% because it requires `\cn{over}' as part of its syntax. Use 0pt +% instead of \cs{z@} for robustitude. +% \begin{macrocode} +\renewcommand{\doteq}{% + \DOTSB\mathrel{\mathop{\kern0pt =}\limits^{\textstyle.}}} +% \end{macrocode} +% \end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Integral signs} +% +% \begin{macro}{\if@display} +% The straightforward \cs{ifinner} test to see if the current math +% context is non-display, fails if, for instance, we are typesetting +% a multiline display within an \cs{halign}, with the pieces going +% into constructions like +% \begin{verbatim} +% $\displaystyle...$ +% \end{verbatim} +% So we need a better test to find out if we are `in a display'. We +% therefore create \cs{if@display}. +% +% \begin{macrocode} +\newif\if@display +\everydisplay\@xp{\the\everydisplay \@displaytrue} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\int} +% \begin{macro}{\oint} +% \begin{macro}{\iint} +% \begin{macro}{\iiint} +% \begin{macro}{\iiiint} +% \begin{macro}{\idotsint} +% Default value for integral limits is \cs{nolimits}, see the +% definition of the `nointlimits' option. +% \begin{macrocode} +\renewcommand{\int}{\DOTSI\intop\ilimits@} +\renewcommand{\oint}{\DOTSI\ointop\ilimits@} +\def\intkern@{\mkern-6mu\mathchoice{\mkern-3mu}{}{}{}} +\def\intdots@{\mathchoice{\@cdots}% + {{\cdotp}\mkern1.5mu{\cdotp}\mkern1.5mu{\cdotp}}% + {{\cdotp}\mkern1mu{\cdotp}\mkern1mu{\cdotp}}% + {{\cdotp}\mkern1mu{\cdotp}\mkern1mu{\cdotp}}} +% +\ams@newcommand{\iint}{\DOTSI\protect\MultiIntegral{2}} +\ams@newcommand{\iiint}{\DOTSI\protect\MultiIntegral{3}} +\ams@newcommand{\iiiint}{\DOTSI\protect\MultiIntegral{4}} +\newcommand{\idotsint}{\DOTSI\protect\MultiIntegral{0}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\MultiIntegral} +% If the \cs{limits} option is applied, use \cs{mathop} and fudge +% the left-hand space a bit to make the subscript visually centered. +% +% \verb'#1' is the multiplicity. +% \begin{macrocode} +\newcommand{\MultiIntegral}[1]{% + \edef\ints@c{\noexpand\intop + \ifnum#1=\z@\noexpand\intdots@\else\noexpand\intkern@\fi + \ifnum#1>\tw@\noexpand\intop\noexpand\intkern@\fi + \ifnum#1>\thr@@\noexpand\intop\noexpand\intkern@\fi + \noexpand\intop + \noexpand\ilimits@ + }% + \futurelet\@let@token\ints@a +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\ints@a{% + \ifx\limits\@let@token \ints@b + \else \ifx\displaylimits\@let@token \ints@b + \else\ifx\ilimits@\displaylimits \ints@b + \fi\fi\fi + \ints@c +} +% \end{macrocode} +% +% \begin{macrocode} +\def\ints@b{% + \mkern-7mu\mathchoice{\mkern-2mu}{}{}{}% + \mathop\bgroup + \mkern7mu\mathchoice{\mkern2mu}{}{}{}% + \let\ilimits@\egroup +}% +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Size dependent definitions} +% +% We now define all stuff which has to change whenever a new math +% size is to be activated. \latex/ provides a hook called +% |\every@math@size| to support such a need. All assignments in the +% |\every@math@size| hook that need to take outside effect should be +% global. +% +% \subsection{Struts for math} +% +% The various kinds of struts could use some analysis and perhaps +% consolidation. +% +% For example perhaps the \cn{bBigg} delimiters could use +% \begin{verbatim} +% 1.2\ht\strutbox (1.8, 2.4, 3.0) +% \end{verbatim} +% instead of +% \begin{verbatim} +% 1.0\big@size (1.5, 2.0, 2.5) +% \end{verbatim} +% since \cs{strut} is reset with every size change [mjd, 1994/10/07]. +% But this change would introduce the possibility of changed line +% and page breaks in existing documents, so would need to be +% handled with care. +% +% \begin{macro}{\Mathstrut@} +% \begin{macro}{\Mathstrutbox@} +% \begin{macro}{\resetMathstrut@} +% Here comes the code for Spivak's |\Mathstrut@|. +% \begin{macrocode} +\newbox\Mathstrutbox@ +\setbox\Mathstrutbox@=\hbox{} +\def\Mathstrut@{\copy\Mathstrutbox@} +% \end{macrocode} +% The setting of the height and depth of the |\Mathstrutbox@| is done +% in the |\every@math@size| hook since it depends on the height of a +% paren. As \cs{every@math@size} is triggered by |$| after a font +% size change, we want to avoid using another math formula |$...$| to +% measure the math paren height; instead we go through the mathcode +% of the \qc{\(} character. We assume that the mathcode has a leading +% hex digit 4 indicating `open delimiter'; this allows us to make a +% relatively simple function to get the correct font and character +% position. +% +% \changes{v2.15}{2016/02/20}{Modify \cs{resetMathstrut@} for Unicode \TeX} +% \changes{v2.15b}{2016/03/10}{Modify \cs{resetMathstrut@} for classic \TeX\ to preserve box 0} +% Original code assuming |\mathcode| is kept for 8bit \TeX. Unicode \TeX{} +% uses |\Umathcharnumdef| which works for xetex and luatex, which use +% different forms for |\mathchardef|. (New luatex always reports +% definitions using |\Umathchardef| syntax even if |\mathchardef| used.) +% +% The unicode version uses e-tex |\fontcharht| to avoid boxing which +% could also be done for pdftex, but not done here. +% \begin{macrocode} +\ifx\Umathcharnumdef\@undefined +% \end{macrocode} +% Original code +% \begin{macrocode} +\def\resetMathstrut@{% + \begingroup + \setbox\z@\hbox{% + \mathchardef\@tempa\mathcode`\(\relax + \def\@tempb##1"##2##3{\the\textfont"##3\char"}% + \expandafter\@tempb\meaning\@tempa \relax + }% + \edef\@tempa{% + \ht\Mathstrutbox@\the\ht\z@\relax + \dp\Mathstrutbox@\the\dp\z@\relax}% + \expandafter\endgroup\@tempa +} +\else +% \end{macrocode} +% xetex/luatex version +% \changes{v2.15a}{2016/03/03}{missing percent added} +% \begin{macrocode} +\def\resetMathstrut@{% + \begingroup + \Umathcharnumdef\@tempa\Umathcodenum`\(\relax + \def\@tempb##1"##2"##3"##4\relax{% + \endgroup + \ht\Mathstrutbox@=\fontcharht\textfont"##3 "##4\relax + \dp\Mathstrutbox@=\fontchardp\textfont"##3 "##4\relax}% + \expandafter\@tempb\meaning\@tempa \relax +} +% \end{macrocode} +% \begin{macrocode} +\fi +% \end{macrocode} +% These height and depth assignments are implicitly global. +% \begin{macrocode} +\addto@hook\every@math@size{\resetMathstrut@} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\strut@} +% \begin{macro}{\strutbox@} +% Next follows a special internal strut which is supposed to match +% the height and the depth of a normal |\strut| minus +% |\normallineskiplimit| according to M. Spivak. +% +% This should really go into the definition of \cs{size@update}, and +% then the box reset could be local; but \cs{size@update} doesn't +% have any hook and is handled in such a way that it cannot even be +% changed except by changing \cs{set@fontsize}. So instead we put +% \cs{reset@strutbox@} into \cs{every@math@size} and make it global. +% Then because of some complications in the way \cs{glb@settings} and +% \cs{check@mathfonts} work, we have to re-invoke it at the beginning +% of every environment that might use \cs{strut@}. Fortunately this +% can be achieved (more or less) through the \cs{spread@equation} +% hook. [mjd,2000/03/10] +% \begin{macrocode} +\newbox\strutbox@ +\def\strut@{\copy\strutbox@} +\def\reset@strutbox@{% + \global\setbox\strutbox@\hbox{% + \lower.5\normallineskiplimit + \vbox{\kern-\normallineskiplimit\copy\strutbox}}} +\addto@hook\every@math@size{\reset@strutbox@} +\AtBeginDocument{\reset@strutbox@} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Big delimiters} +% +% We are now going to redefine the plain \tex/ commands \cn{big}, +% \cn{bigl}, etc., to produce different results in different sizes. +% Actually we only have to define \cn{big}, \cn{Big}, etc., since +% they are used to construct the directional versions \cn{bigl}, +% \cn{bigr}, and the rest. +% +% \begin{macro}{\big} +% \begin{macro}{\Big} +% \begin{macro}{\bigg} +% \begin{macro}{\Bigg} +% To save token space we put everything into the common macro +% |\bBigg@|. The macros are now simply a call to |\bBigg@| with a +% factor to determine the correct height of the delimiter as an +% argument. This code should better go into a future version of +% the \latex/ kernel; the macro |\n@space| is then superfluous (since +% it is only used once) and should be removed to avoid wasting hash +% table space unnecessarily. +% \begin{macrocode} +\renewcommand{\big}{\bBigg@\@ne} +\renewcommand{\Big}{\bBigg@{1.5}} +\renewcommand{\bigg}{\bBigg@\tw@} +\renewcommand{\Bigg}{\bBigg@{2.5}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bBigg@} +% Now we tackle the macro which has to do the real work. It +% actually has two arguments, the factor and the wanted delimiter. +% \changes{v2.17b}{2018/12/01}{Start LR-mode for \cs{bigl} and +% friends if necessary (github/49)} +% \begin{macrocode} +\ifx\leavevmode@ifvmode\@undefined +\def\bBigg@#1#2{% +% \end{macrocode} +% We start with an extra set of braces because we want +% constructions like |\def\bigl{\mathopen\big}| to work without the +% overhead of extra arguments. +% \begin{macrocode} + {\@mathmeasure\z@{\nulldelimiterspace\z@}% + {\left#2\vcenter to#1\big@size{}\right.}% + \box\z@}} +\else +\def\bBigg@#1#2{\leavevmode@ifvmode + {\@mathmeasure\z@{\nulldelimiterspace\z@}% + {\left#2\vcenter to#1\big@size{}\right.}% + \box\z@}} +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\big@size} +% |\big@size| needs to be set to 1.2 times the height of a math +% paren. This height is already recorded in |\Mathstrutbox@|. +% \begin{macrocode} +\addto@hook\every@math@size{% + \global\big@size 1.2\ht\Mathstrutbox@ + \global\advance\big@size 1.2\dp\Mathstrutbox@ } +\newdimen\big@size +% \end{macrocode} +% \end{macro} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Math accents} +% +% We want to change the leading digit of math accents to be +% \cs{accentclass@} so that it can vary according to certain internal +% purposes. +% \begin{macrocode} +\def\accentclass@{7} +\def\noaccents@{\def\accentclass@{0}} +% \end{macrocode} +% +% There are a few \meta{math alphabet}s in the standard fonts where +% we have to change the extra macros because the standard definitions +% don't account for these accent problems. The first is for the +% \cs{mathit} command. +% \begin{macrocode} +\DeclareFontEncoding{OML}{}{\noaccents@} +% \end{macrocode} +% The next one corrects the \cs{cal} alphabet. +% \begin{macrocode} +\DeclareFontEncoding{OMS}{}{\noaccents@} +% \end{macrocode} +% +% \begin{macro}{\dddot} +% \begin{macro}{\ddddot} +% Triple and quadruple dot accents. +% \begin{macrocode} +\ams@newcommand{\dddot}[1]{% + {\mathop{#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@ + \hbox{\normalfont ...}\vss}}}} +\ams@newcommand{\ddddot}[1]{% + {\mathop{#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@ + \hbox{\normalfont....}\vss}}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% The following code deals with support for compound accents. +% By redefining \cs{set@mathaccent} we ensure that +% \cn{DeclareMathAccent} will define accent commands to run our +% \cs{mathaccentV} function instead of the primitive \cs{mathaccent}. +% \begin{macrocode} +\def\set@mathaccent#1#2#3#4{% + \xdef#2{\@nx\protect\@nx\mathaccentV + {\@xp\@gobble\string#2}\hexnumber@#1#4}% +} +% \end{macrocode} +% +% \begin{macro}{\hat} +% \begin{macro}{\check} +% \begin{macro}{\tilde} +% \begin{macro}{\acute} +% \begin{macro}{\grave} +% \begin{macro}{\dot} +% \begin{macro}{\ddot} +% \begin{macro}{\breve} +% \begin{macro}{\bar} +% \begin{macro}{\vec} +% \begin{macro}{\mathring} +% We redefine the standard math accent commands to +% call \cs{mathaccentV}, using the mathgroup/encoding-number +% information embedded in their previous definitions. If the +% definition of an accent command does not have the expected form, we +% leave the accent command alone, but give a warning. For widehat and +% widetilde, we need to avoid clobbering the definitions done by the +% \pkg{amsfonts} package. Arbitrating the contention between +% \pkg{amsmath} and \pkg{amsfonts} to allow doubling a widetilde +% accent looks tricky, so for the time being [mjd,1999/07/19] we just +% leave \cn{widehat} and \cn{widetilde} alone. As a result, if the +% \pkg{amsmath} package is loaded on top of a vanilla \latex/ +% documentclass, everything runs through with no warnings. If a +% Lucida Math or other math fonts package is loaded in addition to +% \pkg{amsmath}, there are greater difficulties, but those are +% addressed elsewhere. +% +% +% \changes{v2.15}{2016/02/20}{Detect \cs{Umathaccent} on package load} +% Adjust the test made at package load to recognise +% |\Umathaccent|. Although currently it is just used to give a +% modified warning that the accents will not be redefined. +% +% Note that the engines behave quite differently here, luatex +% even without these definitions using the OpenType accent set up by +% unicode-math stacks |\hat{hat{f}}| correctly but xetex acts like +% classic tex and needs this adjustment. This difference is not +% addressed here at all. +% +% This test is just at package loading and has no affect on the +% definitions used in 8bit TeX. +% \begin{macrocode} +%\def\@tempa#1{\@xp\@tempb\meaning#1\@nil#1} +% \end{macrocode} +% The extended definition below tests if the accent is already +% robust (as newer \LaTeX{} kernels do this by default) and if so +% picks up the robust definition. However, as of +% now it still redefines it to be non-robust. +% \begin{macrocode} +\def\@tempa#1{% + \@ifundefined{\@xp\@gobble\string#1\space}% + {\@xp\@tempb\meaning#1\@nil#1}% + {\@xp\@xp\@xp\@tempb\@xp\meaning + \csname\@xp\@gobble\string#1\space\endcsname\@nil#1}% +} +\def\@tempb#1>#2#3 #4\@nil#5{% + \@xp\ifx\csname#3\endcsname\mathaccent + \@tempc#4?"7777\@nil#5% + \else + \@xp\ifx\csname#3\endcsname\Umathaccent + \@tempd#4\@nil#5% + \else + \PackageWarningNoLine{amsmath}{% + Unable to redefine math accent \string#5}% + \fi\fi} +\def\@tempc#1"#2#3#4#5#6\@nil#7{% + \chardef\@tempd="#3\relax\set@mathaccent\@tempd{#7}{#2}{#4#5}} +\def\@tempd#1\@nil#2{% + \PackageWarningNoLine{amsmath}{% + Unable to redefine \string\Umathaccent\space\string#2}% +} +% \end{macrocode} +% \begin{macrocode} +\@tempa{\hat} +\@tempa{\check} +\@tempa{\tilde} +\@tempa{\acute} +\@tempa{\grave} +\@tempa{\dot} +\@tempa{\ddot} +\@tempa{\breve} +\@tempa{\bar} +\@tempa{\vec} +\@ifundefined{mathring}{% + \DeclareMathAccent{\mathring}{\mathalpha}{operators}{"17} +}{% + \@tempa{\mathring} +} +%%\@tempa\widetilde +%%\@tempa\widehat +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% Regression testing of amsmath 2.0 showed that in some documents +% there occurred fragments of the form +% \begin{verbatim} +% \hat\mathcal{G} +% \end{verbatim} +% This is not at all correct syntax for the argument of a \latex/ +% command but it produced the intended result anyway because of the +% internal syntax of the \cs{mathaccent} primitive. With +% \cs{mathaccentV}, it will yield an error message. We therefore do a +% special check for such syntax problems in order to make the error +% message more informative. (dmj: ??????) +% \begin{macrocode} +\newcommand{\acc@check}{} +\newcommand{\acc@error}{} +\def\acc@check{\@ifnextchar\@empty\relax\acc@error} +% \end{macrocode} +% We put most of the tokens in a separate macro so they do not get +% scanned unless they are actually needed. +% \begin{macrocode} +\def\acc@error{% + \@amsmath@err{% + Improper argument for math accent:\MessageBreak + Extra braces must be added to prevent wrong output% + }\@ehc +} +% \end{macrocode} +% +% For \cs{mathaccentV} part of the processing is dependent on the +% depth of nesting of math accent commands. We introduce a dedicated +% counter for this instead of using chardef because we want to +% increment/decrement it during processing, and incrementing a +% chardef integer is more work. +% \begin{macrocode} +\newcount\macc@depth +% \end{macrocode} +% +% Provide this function in case it is not already available. +% \begin{macrocode} +\long\def\@gobblethree#1#2#3{} +% \end{macrocode} +% +% The \cs{mathaccentV} function first counts the number of nested +% math accents by setting the argument in a throw-away box. (This is +% not as risky as such an operation would normally be because the +% argument is generally either a simple math symbol or a nested math +% accent call with a simple math symbol at the bottom of the +% nesting.) +% +% There are two benefits from counting the nesting levels first +% before doing anything else: (1) we can fall back to a simple +% \cs{mathaccent} call if the nesting depth is 1, and (2) if the +% nesting depth is greater than 1, we would like to be able to tell +% when we have reached the lowest level, because at that point we +% want to save the argument for later use and place an accent on top +% of a phantom copy. +% +% When we have multiple accents, they will be placed on top of the +% invisible box, followed by some suitable kerns, then a visible copy +% of the nucleus. To see why, let us look at what goes wrong with a +% double application of the \cs{mathaccent} primitive. The standard +% definition of \cs{hat} is \verb'\mathaccent"705E', so +% \verb'\hat{\hat{F}}' expands to +%\begin{verbatim} +%\mathaccent"705E{\mathaccent"705E{F}} +%\end{verbatim} +% The result of this operation is +%\begin{verbatim} +%\vbox(12.11111+0.0)x7.81946 +%.\hbox(6.94444+0.0)x0.0, shifted 1.40973 +%..\OT1/cmr/m/n/10 ^ +%.\kern-4.30554 +%.\vbox(9.47221+0.0)x7.81946 +%..\hbox(6.94444+0.0)x0.0, shifted 2.24309 +%...\OT1/cmr/m/n/10 ^ +%..\kern-4.30554 +%..\hbox(6.83331+0.0)x7.81946 +%...\OML/cmm/m/it/10 F +%\end{verbatim} +% \tex/ starts by constructing a vbox with the hat character on top +% of the F. Then it puts another hat character on top of the vbox; +% but without skew information, because that is only applied by +% \cs{mathaccent} when the base object is a simple symbol. So the +% first accent is skewed to the correct position but all later +% accents are not. By the way, the actual width of the F in the above +% example is less than 7.81946; the box in which it is packed was +% automatically lengthened by the width of the F's italic correction +% (without actually putting in a kern for it). +% +% To get the second accent shifted farther to the right we +% artificially increase the width of the innermost box and add +% a compensating kern afterward. Furthermore, to get proper placement +% of a following subscript or superscript, we take the base symbol +% out, leaving a phantom in its place, and print it by itself +% following the kern. We then need to increase the kern amount to +% move the base character backward under the accents again. +% Here is what the results look like: +%\begin{verbatim} +%\vbox(12.11111+0.0)x9.48618 +%.\hbox(6.94444+0.0)x0.0, shifted 2.24309 +%..\OT1/cmr/m/n/10 ^ +%.\kern-4.30554 +%.\vbox(9.47221+0.0)x9.48618 +%..\hbox(6.94444+0.0)x0.0, shifted 2.24309 +%...\OT1/cmr/m/n/10 ^ +%..\kern-4.30554 +%..\hbox(6.83331+0.0)x9.48618 +%...\hbox(6.83331+0.0)x7.81946 +%...\kern 1.66672 +%\kern -9.48618 +%\OML/cmm/m/it/10 F +%\end{verbatim} +% +% Much of this implementation is based on code from the \pkg{accents} +% package of Javier Bezos. I added the test to revert to a simple +% \cs{mathaccent} when accents are not nested, and some other +% refinements to reduce the number of kerns used (to conserve box +% memory) and the number of cycles through \cs{mathchoice} (to make +% things run a little faster). It was all rather difficult and my +% first two attempts had serious bugs but I hope and believe that +% this version will do better. [mjd,2000/03/15] +% +% The \qq{V} in \cs{mathaccentV} is just an indication that it takes +% five arguments. It is important that the name includes +% \texttt{mathaccent}, otherwise \cs{DeclareMathAccent} will balk at +% redefining one of our accent commands, for example when an +% alternative math font package is loaded. +% \begin{macrocode} +\def\mathaccentV#1#2#3#4#5{% + \ifmmode + \gdef\macc@tmp{\macc@depth\@ne}% + \setbox\z@\hbox{% + \let\mathaccentV\macc@test + \let\use@mathgroup\@gobbletwo \let\select@group\@gobblethree + \frozen@everymath{}$#5$% + }% + \macc@tmp + \ifnum\macc@depth=\@ne + \global\let\macc@nucleus\@empty + \mathaccent"\accentclass@ + \else + \@xp\macc@nested + \fi + #2#3#4{#5}% + \macc@nucleus + \else + \@xp\nonmatherr@\csname#1\endcsname + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\def\macc@test#1#2#3#4{\xdef\macc@tmp{\macc@tmp\advance\macc@depth\@ne}} +% \end{macrocode} +% +% \begin{macrocode} +\def\macc@group{-1} +% \end{macrocode} +% +% \begin{macrocode} +\def\macc@nested#1#2#3#4{% + \begingroup + \let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar + \mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}% + \macc@set@skewchar\relax + \let\mathaccentV\macc@nested@a + \macc@nested@a\relax#1#2#3{#4}% + \endgroup +} +% \end{macrocode} +% +% \begin{macrocode} +\let\macc@palette\mathpalette +% \end{macrocode} +% +% \begin{macrocode} +\def\macc@nested@a#1#2#3#4#5{% +% \end{macrocode} +% This test saves some work that would otherwise be always repeated +% fourfold thanks to \cs{mathchoice}. +% \begin{macrocode} + \ifnum\macc@group=\mathgroup + \else \macc@set@skewchar\relax \edef\macc@group{\the\mathgroup}% + \fi + \mathchardef\macc@code "\accentclass@ #2#3#4\relax + \macc@palette\macc@a{#5}% +} +% \end{macrocode} +% +% The reason that \cs{macc@set@skewchar} takes an argument is so that +% it can serve as a direct substitute for \cs{math@egroup}, in +% addition to being used separately. +% +% Setting a skewchar with this method works for symbols of variable +% mathgroup (class 7, letters and numbers) but not necessarily for +% special symbols like \cn{partial} or \cs{xi} whose mathgroup +% doesn't change; fortunately the most commonly used ones come from +% mathgroup one, which is the fall-back mathgroup for skewchar. +% \begin{macrocode} +\def\macc@set@skewchar#1{% + \begingroup + \ifnum\mathgroup=\m@ne \let\@tempa\@ne + \else + \ifnum\skewchar\textfont\mathgroup=\m@ne \let\@tempa\@ne + \else \let\@tempa\mathgroup + \fi + \fi + \count@=\skewchar\textfont\@tempa + \advance\count@"7100 + \edef\@tempa{\endgroup + \mathchardef\noexpand\macc@skewchar=\number\count@\relax}% + \@tempa + #1% +} +% \end{macrocode} +% +% Arg1 is math-style, arg2 is accent base object. We assume that math +% style doesn't change within the nested group of accents; this means +% we can set \cs{macc@style} only once and redefine \cs{macc@palette} +% to use it, in order to run \cs{mathchoice} only once instead of +% multiplying the calls exponentially as the nesting level increases. +% \begin{macrocode} +\def\macc@a#1#2{% + \begingroup + \let\macc@style#1\relax + \def\macc@palette##1{##1\macc@style}% + \advance\macc@depth\m@ne + \ifnum\macc@depth=\z@ + \gdef\macc@nucleus{#2}% +% \end{macrocode} +% Extra \cs{@empty} tokens are to prevent low-level \tex/ errors from +% the potential syntactic error that \cs{acc@check} checks for. +% \begin{macrocode} + \setbox\z@\hbox{$#1#2\@empty{}\macc@skewchar$}% + \setbox\tw@\hbox{$#1#2\@empty\macc@skewchar$}% + \dimen@\tw@\wd\tw@ \advance\dimen@-\tw@\wd\z@ + \xdef\macc@kerna{\the\dimen@\relax}% + \setbox4\hbox{$#1#2\acc@check\@empty$}% + \global\setbox\@ne\hbox to\wd4{}% + \ht\@ne\ht4 \dp\@ne\dp4 + \xdef\macc@kernb{\the\wd4\relax}% + \mathaccent\macc@code{\box\@ne\kern\macc@kerna}% + \else + \mathaccent\macc@code{\let\macc@adjust\@empty #1#2\@empty}% + \macc@adjust + \fi + \endgroup +} +% \end{macrocode} +% +% \begin{macrocode} +\def\macc@adjust{% + \dimen@\macc@kerna\advance\dimen@\macc@kernb + \kern-\dimen@ +} +% \end{macrocode} +% +% The commands \cs{Hat}, \cs{Tilde}, \ldots, are supported as +% synonyms of \cs{hat}, \cs{tilde}, \ldots, for backward +% compatibility. +% \begin{macrocode} +\def\Hat{\hat} +\def\Check{\check} +\def\Tilde{\tilde} +\def\Acute{\acute} +\def\Grave{\grave} +\def\Dot{\dot} +\def\Ddot{\ddot} +\def\Breve{\breve} +\def\Bar{\bar} +\def\Vec{\vec} +% \end{macrocode} +% +% This error message about math mode is used several times so we make +% an abbreviation for it. +% \begin{macrocode} +\def\nonmatherr@#1{\@amsmath@err{\protect + #1 allowed only in math mode}\@ehd} +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Mods, continued fractions, etc.} +% +% \begin{macro}{\bmod} +% \begin{macro}{\pmod} +% \begin{macro}{\pod} +% \begin{macro}{\mod} +% The commands \cn{bmod}, \cn{pmod}, \cn{pod}, \cn{mod} aren't +% currently robust. [mjd, 1994/09/05] +% \begin{macrocode} +\renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin + {\operator@font mod}\penalty900 + \mkern5mu\nonscript\mskip-\medmuskip} +\newcommand{\pod}[1]{\allowbreak + \if@display\mkern18mu\else\mkern8mu\fi(#1)} +\renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}} +\newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu + \else\mkern12mu\fi{\operator@font mod}\,\,#1} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cfrac} +% Continued fractions. The optional arg l or r controls horizontal +% placement of the numerators. The |\kern-\nulldelimiterspace| +% is needed in the definition if we want the right-hand sides of the +% fraction rules to line up. The \cs{strut} keeps the numerator of +% a subsidiary cfrac from coming too close to the fraction rule above +% it. +% \begin{macrocode} +\newcommand{\cfrac}[3][c]{{\displaystyle\frac{% + \strut\ifx r#1\hfill\fi#2\ifx l#1\hfill\fi}{#3}}% + \kern-\nulldelimiterspace} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\overset} +% \begin{macro}{\underset} +% \cn{overset} and \cn{underset} put symbols above, respectively +% below, a symbol that is not a \cs{mathop} and therefore does not +% naturally accept limits. \cs{binrel@@} uses information collected +% by \cs{binrel@} to make the resulting construction be of type +% mathrel or mathbin if the base symbol is either of those types. +% \begin{macrocode} +\newcommand{\overset}[2]{\binrel@{#2}% + \binrel@@{\mathop{\kern\z@#2}\limits^{#1}}} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand{\underset}[2]{\binrel@{#2}% + \binrel@@{\mathop{\kern\z@#2}\limits_{#1}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\overunderset} +% This is the combination of the previous two commands which is +% something that is sometimes needed. +% \changes{v2.17c}{FMi}{New command \cs{overunderset}} +% \begin{macrocode} +\newcommand{\overunderset}[3]{\binrel@{#3}% + \binrel@@{\mathop{\kern\z@#3}\limits^{#1}_{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sideset} +% \cn{sideset} allows placing `adscript' symbols at the four +% corners of a \cs{mathop}, \emph{in addition to} limits. Left-side +% adscripts go into arg \arg{1}, in the form |_{...}^{...}|, and +% right-side adscripts go into arg \arg{2}. +% +% As currently written [mjd, 1995/01/21] this is pretty haphazard. +% In order to really make it work properly in full generality we'd +% have to read and measure the top and bottom limits and use +% mathchoice to always get the right mathstyle for each piece, +% etc., etc. +% \begin{macrocode} +\newcommand{\sideset}[3]{% + \@mathmeasure\z@\displaystyle{#3}% +% \end{macrocode} +% Use a global box assignment here since the depth override is +% implicitly global. Then move the constructed box to a local box +% register (2) to ensure it won't get destroyed during the next two +% mathmeasure statements. This precaution may be more extreme than +% necessary in practice. +% \begin{macrocode} + \global\setbox\@ne\vbox to\ht\z@{}\dp\@ne\dp\z@ + \setbox\tw@\box\@ne + \@mathmeasure4\displaystyle{\copy\tw@#1}% + \@mathmeasure6\displaystyle{#3\nolimits#2}% + \dimen@-\wd6 \advance\dimen@\wd4 \advance\dimen@\wd\z@ + \hbox to\dimen@{}\mathop{\kern-\dimen@\box4\box6}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\smash} +% We add to the \cn{smash} command an optional argument +% denoting the part of the formula to be smashed. +% \changes{v2.17b}{2018/12/01}{Start LR-mode for \cs{smash} +% if necessary (github/49)} +% \begin{macrocode} +\ifx\leavevmode@ifvmode\@undefined +\renewcommand{\smash}[1][tb]{% + \def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% + \edef\finsm@sh{\csname mb@#1\endcsname\z@\z@\box\z@}% + \ifmmode \@xp\mathpalette\@xp\mathsm@sh + \else \@xp\makesm@sh + \fi +} +\else +\renewcommand{\smash}[1][tb]{% + \def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% + \edef\finsm@sh{\csname mb@#1\endcsname\z@\z@ \leavevmode@ifvmode\box\z@}% + \ifmmode \@xp\mathpalette\@xp\mathsm@sh + \else \@xp\makesm@sh + \fi +} +\fi +% \end{macrocode} +% \end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Extensible arrows} +% +% The minus sign used in constructing these arrow fills is smashed so +% that superscripts above the arrows won't be too high. This +% primarily affects the \cn{xleftarrow} and \cn{xrightarrow} arrows. +% +% \begin{macrocode} +\mathchardef\std@minus\mathcode`\-\relax +\mathchardef\std@equal\mathcode`\=\relax +% \end{macrocode} +% In case some alternative math fonts are loaded later: +% \begin{macrocode} +\AtBeginDocument{% + \mathchardef\std@minus\mathcode`\-\relax + \mathchardef\std@equal\mathcode`\=\relax +} +% \end{macrocode} +% +% \begin{macro}{\relbar} +% \begin{macro}{\Relbar} +% \begin{macrocode} +\ams@def\relbar{\mathrel{\mathpalette\mathsm@sh\std@minus}} +\ams@def\Relbar{\mathrel\std@equal} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +\def\arrowfill@#1#2#3#4{% + $\m@th\thickmuskip0mu\medmuskip\thickmuskip\thinmuskip\thickmuskip + \relax#4#1\mkern-7mu% + \cleaders\hbox{$#4\mkern-2mu#2\mkern-2mu$}\hfill + \mkern-7mu#3$% +} +\def\leftarrowfill@{\arrowfill@\leftarrow\relbar\relbar} +\def\rightarrowfill@{\arrowfill@\relbar\relbar\rightarrow} +\def\leftrightarrowfill@{\arrowfill@\leftarrow\relbar\rightarrow} +\def\Leftarrowfill@{\arrowfill@\Leftarrow\Relbar\Relbar} +\def\Rightarrowfill@{\arrowfill@\Relbar\Relbar\Rightarrow} +\def\Leftrightarrowfill@{\arrowfill@\Leftarrow\Relbar\Rightarrow} +% \end{macrocode} +% +% \begin{macrocode} +\def\overarrow@#1#2#3{\vbox{\ialign{##\crcr#1#2\crcr + \noalign{\nointerlineskip}$\m@th\hfil#2#3\hfil$\crcr}}} +\ams@renewcommand{\overrightarrow}{% + \mathpalette{\overarrow@\rightarrowfill@}} +\ams@renewcommand{\overleftarrow}{% + \mathpalette{\overarrow@\leftarrowfill@}} +\ams@newcommand{\overleftrightarrow}{% + \mathpalette{\overarrow@\leftrightarrowfill@}} +% \end{macrocode} +% +% \begin{macrocode} +\def\underarrow@#1#2#3{% + \vtop{\ialign{##\crcr$\m@th\hfil#2#3\hfil$\crcr + \noalign{\nointerlineskip\kern1.3\ex@}#1#2\crcr}}} +\ams@newcommand{\underrightarrow}{% + \mathpalette{\underarrow@\rightarrowfill@}} +\ams@newcommand{\underleftarrow}{% + \mathpalette{\underarrow@\leftarrowfill@}} +\ams@newcommand{\underleftrightarrow}{% + \mathpalette{\underarrow@\leftrightarrowfill@}} +% \end{macrocode} +% +% \begin{macrocode} +%\newcommand{\xrightarrow}[2][]{\ext@arrow 0359\rightarrowfill@{#1}{#2}} +\def\ext@arrow#1#2#3#4#5#6#7{% + \mathrel{\mathop{% +% \end{macrocode} +% Measure the superscript and subscript. +% \begin{macrocode} + \setbox\z@\hbox{#5\displaystyle}% + \setbox\tw@\vbox{\m@th + \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}% + \hbox{$\scriptstyle\mkern#3mu{#7}\mkern#4mu$}% + \copy\z@ + }% + \hbox to\wd\tw@{\unhbox\z@}}% +% \end{macrocode} +% We don't want to place an empty subscript since that will produce +% too much blank space below the arrow. +% \begin{macrocode} + \limits + \@ifnotempty{#7}{^{\if0#1\else\mkern#1mu\fi + #7\if0#2\else\mkern#2mu\fi}}% + \@ifnotempty{#6}{_{\if0#1\else\mkern#1mu\fi + #6\if0#2\else\mkern#2mu\fi}}}% +} +% \end{macrocode} +% +% Some extensible arrows to serve as mathrels and taking +% sub/superscripts. These commands are robust because they take an +% optional argument. +% \begin{macrocode} +\newcommand{\xrightarrow}[2][]{\ext@arrow 0359\rightarrowfill@{#1}{#2}} +\newcommand{\xleftarrow}[2][]{\ext@arrow 3095\leftarrowfill@{#1}{#2}} +% \end{macrocode} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Array-related environments} +% \subsection{Remarks} +% +% Because these environments can be nested within the equation +% structures that allow \cn{tag}, there is some cross-influence in +% the internal workings of the \cn{\\} command. +% +% \subsection{The \env{subarray} environment and \cn{substack} command} +% +% The \cn{substack} command can be used to set subscripts +% and superscripts that consist of several lines. Usage: +% \begin{verbatim} +% X_{\substack{a=1\\b=2}} +% \end{verbatim} +% +% \changes{v2.0}{1999/06/17}{Removed environment definitions: Sb, Sp} +% +% \begin{environment}{subarray} +% The \env{subarray} environment makes a small-size array suitable +% for use in a subscript or superscript. At the moment the supported +% arguments are not the full possibilities of \env{array} but only +% |c| or |l| for centered or left-aligned. And only one column. +% \begin{macrocode} +\newenvironment{subarray}[1]{% +% \end{macrocode} +% Note: The predecessors of \env{subarray} (\env{Sb} and \env{Sp}, +% inherited from \amstex/) used \cs{vbox} instead of \cs{vcenter}. +% But when a multiline subscript is placed in \cs{limits} position +% \cs{vcenter} is no worse than \cs{vbox}, and when it is placed +% in the \cs{nolimits} position (e.g., for an integral), \cs{vcenter} +% provides clearly better positioning than \cs{vbox}. +% \begin{macrocode} + \vcenter\bgroup +% \end{macrocode} +% Use \cs{Let@} to set the proper meaning of the \cn{\\} and \cn{\\*} +% commands. And restore the meaning of \cs{math@cr@@@} to \cs{cr} +% (see above) in case \env{subarray} is used inside one of the more +% complicated alignment macros where the meaning of \cs{math@cr@@@} +% is different. Similarly, call \cs{default@tag} to ensure that a +% line break here doesn't get an equation number! +% \begin{macrocode} + \Let@ \restore@math@cr \default@tag +% \end{macrocode} +% Set the line spacing to be the same as \cs{atop} (when \cs{atop} +% occurs in \cs{textstyle} or smaller), cf \textit{The \tex/book}, +% Appendix G. +% \begin{macrocode} + \baselineskip\fontdimen10 \scriptfont\tw@ + \advance\baselineskip\fontdimen12 \scriptfont\tw@ + \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ + \lineskiplimit\lineskip +% \end{macrocode} +% Start the \cs{vbox} \cs{halign} structure that encloses the +% contents. Notice that we never get \cs{scriptscriptstyle}. That +% would require a \cs{mathchoice} (ugh). +% \begin{macrocode} + \ialign\bgroup\ifx c#1\hfil\fi + $\m@th\scriptstyle##$\hfil\crcr +}{% + \crcr\egroup\egroup +} +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\substack} +% The \cn{substack} command is just an abbreviation for the +% most common use of \env{subarray}. +% \begin{macrocode} +\newcommand{\substack}[1]{\subarray{c}#1\endsubarray} +% \end{macrocode} +% \end{macro} +% +% \subsection{Matrices} +% +% \begin{environment}{smallmatrix} +% \env{smallmatrix} is again an alignment, this time in a centered +% box. The opening incantations are basically the same as those in +% \cs{multilimits@}, followed by the alignment itself. A remark: +% the baselineskip (|9\ex@|) used in \amstex/ is too large for +% use in text with the usual baselineskip of $12$ or $13$ points; we +% change it here to |6\ex@| and also adjust the \cs{lineskip} +% and \cs{lineskiplimit} slightly to compensate. (MJD) +% \begin{macrocode} +\newenvironment{smallmatrix}{\null\,\vcenter\bgroup + \Let@\restore@math@cr\default@tag + \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip + \ialign\bgroup\hfil$\m@th\scriptstyle##$\hfil&&\thickspace\hfil + $\m@th\scriptstyle##$\hfil\crcr +}{% + \crcr\egroup\egroup\,% +} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{matrix} +% The \env{matrix} environment is just an \env{array} that provides +% up to ten centered columns, so that users don't have to give the +% col-spec argument explicitly---unless they want some of the columns +% noncentered, that is. The maximum number of columns is actually not +% fixed at ten but given by the counter |MatrixCols|, and can +% therefore be increased by changing that counter. +% +% The extra space of \cn{arraycolsep} that \env{array} adds on each +% side is a waste so we remove it here (perhaps we should instead +% remove it from \env{array} in general, but that's a harder task). +% +% TODO: Think about re-implementing \cn{matrix} to get rid of the +% \cs{c@MatrixCols} limit and have hard-wired preamble that doesn't +% have to be rebuilt each time. +% +% We must use \cn{renewenvironment} for \env{matrix} and +% \env{pmatrix} because \latex/ doesn't kill the definitions found in +% \fn{plain.tex}, even though it probably should because of their +% foreign syntax. +% \begin{macrocode} +\renewenvironment{matrix}{% + \matrix@check\matrix\env@matrix +}{% + \endarray \hskip -\arraycolsep +} +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\env@matrix} +% +% \begin{macrocode} +\def\env@matrix{\hskip -\arraycolsep + \let\@ifnextchar\new@ifnextchar + \array{*\c@MaxMatrixCols c}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\c@MaxMatrixCols} +% \begin{macrocode} +\newcount\c@MaxMatrixCols \c@MaxMatrixCols=10 +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\matrix@check} +% For various reasons, authors sometimes use the Plain \TeX{} form of +% \cn{matrix} or \cn{pmatrix} in \LaTeX{} documents. If they later +% add an invocation of the \pkg{amsmath} package to their document, +% the Plain \TeX{} syntax would lead to rather unintelligible error +% messages. The \cs{matrix@check} function does some checking to +% forestall that problem. +% \begin{macrocode} +\def\matrix@check#1{% + \@xp\ifx\csname\@currenvir\endcsname#1% + \else\matrix@error#1% +% \end{macrocode} +% This error recovery is not that good but is better than the +% infinite loop that can result from calling \cs{array} without a +% matching \cs{endarray}. (The array setup leaves \cs{par} empty.) +% \begin{macrocode} + \@xp\@gobble + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\matrix@error} +% +% \begin{macrocode} +\def\matrix@error#1{% + \@amsmath@err{% +Old form `\string#1' should be \string\begin{\@xp\@gobble\string#1}% + }{% +`\string#1{...}' is old Plain-TeX syntax whose use is +ill-advised in LaTeX.% + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\renewenvironment{pmatrix}{% + \left(% + \matrix@check\pmatrix\env@matrix +}{ + \endmatrix\right)% +} +\newenvironment{bmatrix}{\left[\env@matrix}{\endmatrix\right]} +\newenvironment{Bmatrix}{% + \left\lbrace\env@matrix +}{% + \endmatrix\right\rbrace +} +\newenvironment{vmatrix}{\left\lvert\env@matrix}{\endmatrix\right\rvert} +\newenvironment{Vmatrix}{\left\lVert\env@matrix}{\endmatrix\right\rVert} +% \end{macrocode} +% +% \begin{macrocode} +\let\hdots\@ldots +% \end{macrocode} +% +% \begin{macrocode} +\newcommand{\hdotsfor}[1]{% + \ifx[#1\@xp\shdots@for\else\hdots@for\@ne{#1}\fi} +\newmuskip\dotsspace@ +\def\shdots@for#1]{\hdots@for{#1}} +\def\hdots@for#1#2{\multicolumn{#2}c% + {\m@th\dotsspace@1.5mu\mkern-#1\dotsspace@ + \xleaders\hbox{$\m@th\mkern#1\dotsspace@.\mkern#1\dotsspace@$}% + \hfill + \mkern-#1\dotsspace@}% + } +% \end{macrocode} +% +% \begin{environment}{cases} +% The easiest way to produce the \env{cases} environment is to base +% it on the \env{array} environment. We must use +% \cn{renewenvironment} to override the definition of \cn{cases} that +% \latex/ (unwisely) leaves in place from \fn{plain.tex}. +% \begin{macrocode} +\renewenvironment{cases}{% + \matrix@check\cases\env@cases +}{% + \endarray\right.% +} +\def\env@cases{% + \let\@ifnextchar\new@ifnextchar + \left\lbrace + \def\arraystretch{1.2}% + \array{@{}l@{\quad}l@{}}% +} +% \end{macrocode} +% \end{environment} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Equation sub-numbering} +% +% \begin{macrocode} +\newcounter{parentequation}% Counter for ``parent equation''. +% \end{macrocode} +% +% We can't assume \cs{ignorespacesafterend} is defined since it was +% not there in the earliest releases of \latex/ 2e. And we need to +% include the \cs{global} for the same reason. +% \begin{macrocode} +\@ifundefined{ignorespacesafterend}{% + \def\ignorespacesafterend{\global\@ignoretrue}% +}{} +% \end{macrocode} +% +% \begin{environment}{subequations} +% \begin{macrocode} +\newenvironment{subequations}{% +% \end{macrocode} +% Before sending down the `equation' counter to the subordinate +% level, add 1 using standard \cn{refstepcounter}. +% \begin{macrocode} + \refstepcounter{equation}% +% \end{macrocode} +% Define \cn{theparentequation} equivalent to current +% \cn{theequation}. \cn{edef} is necessary to expand the current +% value of the equation counter. This might in rare cases cause +% something to blow up, in which case the user needs to add +% \cn{protect}. +% \begin{macrocode} + \protected@edef\theparentequation{\theequation}% + \setcounter{parentequation}{\value{equation}}% +% \end{macrocode} +% And set the equation counter to 0, so that the normal incrementing +% processes in the various equation environments will produce the +% desired results. +% \begin{macrocode} + \setcounter{equation}{0}% + \def\theequation{\theparentequation\alph{equation}}% + \ignorespaces +}{% + \setcounter{equation}{\value{parentequation}}% + \ignorespacesafterend +} +% \end{macrocode} +% \end{environment} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Equation numbering} +% +% In the multiline equation environments provided here, the task +% of equation numbering is linked to the task of line breaking +% in the sense that it is the \cn{\\} command that marks where an +% equation number for the current line will be processed and added to +% the page. +% +% \begin{macro}{\numberwithin} +% Provide a convenient way to specify that equations should be +% numbered within sections. +% \begin{macrocode} +\newcommand{\numberwithin}[3][\arabic]{% + \@ifundefined{c@#2}{\@nocounterr{#2}}{% + \@ifundefined{c@#3}{\@nocnterr{#3}}{% + \@addtoreset{#2}{#3}% + \@xp\xdef\csname the#2\endcsname{% + \@xp\@nx\csname the#3\endcsname .\@nx#1{#2}}}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\eqref} +% To make references to equation numbers easier, we provide +% \cn{eqref}. We almost don't need \cn{textup}, except that +% \cs{tagform@} doesn't supply the italic correction. +% \begin{macrocode} +\newcommand{\eqref}[1]{\textup{\tagform@{\ref{#1}}}} +% \end{macrocode} +% \end{macro} +% +% \subsection{Preliminary macros} +% +% The following macros implement the \latex/ syntax for the +% \cn{\\} command, i.e. the possibility to add an asterisk to +% inhibit a page break, or an optional argument to denote additional +% vertical space. They are modelled more or less after the +% corresponding macros for \latex/'s \env{eqnarray} and \env{array} +% environments. +% +% [We can perhaps use the eqnarray mechanism if we change it so that +% it also uses \cs{openup}.] +% +% \begin{macro}{\dspbrk@lvl} +% We begin by defining the \cs{dspbrk@lvl} counter. This counter +% records the desirability of a break after the current row, as a +% number between $0$ and $4$. Its default value is $-1$ meaning that +% no explicit \cn{displaybreak} command was given, and the default +% \cs{interdisplaylinepenalty} is to be used. +% \begin{macrocode} +\newcount\dspbrk@lvl +\dspbrk@lvl=-1 +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\interdisplaylinepenalty} +% We set the \cs{interdisplaylinepenalty} to $10000$. +% \begin{macrocode} +\interdisplaylinepenalty\@M +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\allowdisplaybreaks} +% The \cn{allowdisplaybreaks} command. Since this is intended for use +% outside displayed formulas (typically in the preamble), it does not +% need to use \cs{new@ifnextchar}. +% \begin{macrocode} +\newcommand{\allowdisplaybreaks}[1][4]{% + \interdisplaylinepenalty\getdsp@pen{#1}\relax +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\getdsp@pen} +% Modelled after \latex/'s \cs{@getpen}. We use higher numbers +% than would normally be provided by \cs{@lowpenalty}, +% \cs{@medpenalty}, and \cs{@highpenalty}, since display +% breaks are almost always less desirable. +% \begin{macrocode} +\def\getdsp@pen#1{% + \ifcase #1\@M \or 9999 \or 6999 \or 2999 \or \z@\fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\displaybreak} +% \begin{macro}{\dspbrk@} +% \begin{macro}{\dspbrk@context} +% \begin{macro}{\nogood@displaybreak} +% For breaks in a certain row of a alignment. +% \begin{macrocode} +\newcommand{\displaybreak}{\new@ifnextchar[\dspbrk@{\dspbrk@[4]}} +\chardef\dspbrk@context=\sixt@@n +% \end{macrocode} +% +% \begin{macrocode} +\def\dspbrk@[#1]{% + \ifmeasuring@ + \else + \ifcase\dspbrk@context % case 0 --- OK + \global\dspbrk@lvl #1\relax + \or % case 1 --- inside a box + \nogood@displaybreak + \else % other cases --- outside of a display + \@amsmath@err{\Invalid@@\displaybreak}\@eha + \fi + \fi +} +% \end{macrocode} +% +% This is the value of \cn{displaybreak} when it occurs inside some +% structure where it will not work. +% \begin{macrocode} +\def\nogood@displaybreak{% + \@amsmath@err{\protect +\displaybreak\space cannot be applied here}% +{One of the enclosing environments creates an + unbreakable box\MessageBreak +(e.g., split, aligned, gathered, ...).}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\math@cr} +% The macro \cs{math@cr} ends a row inside one of the equation +% environments, i.e., this is the internal name of the \cn{\\} +% commands in these environments. As usual for this kind of macro +% inside of alignments we insert a special brace into \tex/'s input +% stream. The initial \cs{relax} is needed to trigger entry into the +% \textit{u} template of the current column if the author ended the +% current row with an empty column (i.e., the mathcr was immediately +% preceded by an ampersand). +% \begin{macrocode} +\def\math@cr{\relax\iffalse{\fi\ifnum0=`}\fi +% \end{macrocode} +% The first step is now to check whether an asterisk follows. +% \cs{@eqpen} is used to hold the penalty value to be put on +% the vertical list. +% Then we call up \cs{math@cr@} which performs the next step. +% If an asterisk is read page breaking is inhibited. +% \begin{macrocode} + \@ifstar{\global\@eqpen\@M\math@cr@}% +% \end{macrocode} +% Otherwise we have to check the \cs{dspbrk@lvl} value. +% \begin{macrocode} + {\global\@eqpen + \ifnum\dspbrk@lvl <\z@ \interdisplaylinepenalty + \else -\@getpen\dspbrk@lvl \fi + \math@cr@}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@cr@} +% The purpose of \cs{math@cr@} is to check whether an optional +% argument follows. If not it provides \cs{z@} as default +% value. +% \begin{macrocode} +\def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@cr@@} +% \cs{math@cr@@} closes the special brace opened in +% \cs{math@cr}, and calls \cs{math@cr@@@} which is supposed +% the `real' row ending command. The meaning of this macro depends +% on the environment in which it is used. +% \begin{macrocode} +\def\math@cr@@[#1]{\ifnum0=`{\fi \iffalse}\fi\math@cr@@@ +% \end{macrocode} +% Finally we put the additional space onto the vertical list. +% \begin{macrocode} + \noalign{\vskip#1\relax}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Let@} +% \cs{Let@} is called by all environments where \cn{\\} +% ends a row of an alignment. +% \begin{macrocode} +\def\Let@{\let\\\math@cr} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\restore@math@cr} +% We mentioned already that the exact meaning of \cs{math@cr@@@} +% depends on the current environment. Since it is often a simple +% \cs{cr} we provide \cs{restore@math@cr} to reset it. +% \begin{macrocode} +\def\restore@math@cr{\def\math@cr@@@{\cr}} +% \end{macrocode} +% This is also the default case. +% \begin{macrocode} +\restore@math@cr +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intertext} +% \begin{macro}{\intertext@} +% The \cn{intertext} command is used for inserting text between the +% rows of an alignment. It might better be done as an environment, +% but the \cs{begingroup} from \cn{begin} would cause the +% \cs{noalign} to fail. +% \begin{macrocode} +\newcommand{\intertext}{\@amsmath@err{\Invalid@@\intertext}\@eha} +% \end{macrocode} +% \cs{intertext@} is called by all environments that allow the use of +% the \cn{intertext} command. +% \begin{macrocode} +\def\intertext@{% + \def\intertext##1{% +% \end{macrocode} +% If current mode is not vmode, the most likely reason is that the +% writer forgot the \cn{\\} that is supposed to precede +% \cn{intertext}. All right, then, let's try adding it our ownself. +% But, to be slightly careful: \cn{\\} does a futurelet, and it's +% slightly dangerous to allow a letted token to barge around loose in +% our internal code when it has been let to a conditional token +% like \cs{fi}. So let's interpose something in front of the \cs{fi} +% for the futurelet to take instead. (And careful again: it has to be +% something evanescent, not (e.g.) \cs{relax} which would cause the +% next halign cell to fire up and keep \cs{noalign} from working.) +% \begin{macrocode} + \ifvmode\else\\\@empty\fi + \noalign{% + \penalty\postdisplaypenalty\vskip\belowdisplayskip + \vbox{\normalbaselines +% \end{macrocode} +% We need to do something extra if the outside environment is a list +% environment. I don't see offhand an elegant way to test ``are we +% inside any list environment'' that is both easy and reliable (for +% example, checking for zero \cs{@totalleftmargin} wouldn't catch the +% case where \cs{@totalleftmargin} is zero but \cs{linewidth} is less +% than \cs{columnwidth}), so it seems to me checking \cs{linewidth} +% is the best practical solution. +% \changes{v2.15c}{2016/05/23}{\cs{ignorespaces} at the start of the argument} +% \begin{macrocode} + \ifdim\linewidth=\columnwidth + \else \parshape\@ne \@totalleftmargin \linewidth + \fi + \noindent\ignorespaces##1\par}% + \penalty\predisplaypenalty\vskip\abovedisplayskip% + }% +}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \subsection{Implementing tags and labels} +% +% In this section we describe some of the macros needed to make the +% \cn{tag} command work in various places. We start by defining a +% help text to be used when a \cn{tag} command is used somewhere +% it should not appear. +% +% \begin{macro}{\tag@help} +% This is the default error help text provided when \cn{tag} +% generates an error message. +% Note that \cs{newhelp} generates a control sequence name +% from the string given as its argument so that a leading +% backslash is provided automatically. +% \begin{macrocode} +\newhelp\tag@help + {tag cannot be used at this point.\space + If you don't understand why^^Jyou should consult + the documentation.^^JBut don't worry: just continue, and I'll + forget what happened.} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\gobble@tag} +% This macro is to be used when \cn{tag} should silently +% skip its argument. +% It is made to handle the \qc{\*}-form of \cn{tag} as well. +% \begin{macrocode} +\def\gobble@tag{\@ifstar\@gobble\@gobble} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\invalid@tag} +% \cs{invalid@tag} is a macro that should be used whenever +% \cn{tag} appears in an illegal place. +% It sets up \cs{tag@help} (as defined above) as help message, +% prints its argument as error message, and skips \cn{tag}'s +% argument. +% \begin{macrocode} +\def\invalid@tag#1{\@amsmath@err{#1}{\the\tag@help}\gobble@tag} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\dft@tag} +% \begin{macro}{\default@tag} +% \cs{dft@tag} provides a convenient way to disallow the +% use of \cn{tag} at certain points. +% One simply has to write +% \begin{verbatim} +%\let\tag\dft@tag +% \end{verbatim} +% and the \cn{tag} command will produce an error message, +% with a suitable error help text, and discard its argument. +% \begin{macrocode} +\def\dft@tag{\invalid@tag{\string\tag\space not allowed here}} +% \end{macrocode} +% Since this is used several times we provide an abbreviation for +% it. +% \begin{macrocode} +\def\default@tag{\let\tag\dft@tag} +% \end{macrocode} +% Since this is also the default, i.e.\ the \cn{tag} command +% should not be used except in special places, we issue a +% \cs{default@tag} command. +% \begin{macrocode} +\default@tag +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Now that we have taken care of the case that \cn{tag} is not +% allowed we will provide some macros to process tags appropriately. +% As the user documentation states, a \cn{tag} command (without +% the asterisk typesets its argument according to the document +% styles' conventions, whereas a \cn{tag*} command typesets its +% argument exactly as given. We define therefore the following +% interface: +% +% \begin{macro}{\maketag@@} +% \begin{macro}{\maketag@@@} +% \begin{macro}{\tagform@} +% \cn{tag} is supposed to call \cs{maketag@@} which checks +% whether an asterisk follows. If this is the case it calls up +% \cs{maketag@@@} which sets its argument `as is'. Otherwise +% \cs{tagform@} is called to do the job. (This macro is to be +% defined appropriately by the document style.) +% \begin{macrocode} +\def\maketag@@{\@ifstar\maketag@@@\tagform@} +% \end{macrocode} +% We define \cs{maketag@@@} to use the normal font of the document +% text (since this is the usual practice for numbering of document +% elements) and to put a box around the tag. Furthermore we use +% \cs{m@th} for exceptional cases where the tag involves a +% superscript or some such math. (Probably from an explicit use of +% \cs{tag*} rather than from the automatic numbering.) +% \begin{macrocode} +\def\maketag@@@#1{\hbox{\m@th\normalfont#1}} +% \end{macrocode} +% We use the following default definition for \cs{tagform@} +% that puts only parentheses around the tag. +% \begin{macrocode} +\def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% We need to insinuate \cs{tagform@} into \cs{@eqnnum} in case +% \env{eqnarray} is used (probably in a document that was originally +% written without use of the \pkg{amsmath} package). +% \begin{macrocode} +\iftagsleft@ + \def\@eqnnum{\hbox to1sp{}\rlap{\normalfont\normalcolor + \hskip -\displaywidth\tagform@\theequation}} +\else + \def\@eqnnum{{\normalfont\normalcolor \tagform@\theequation}} +\fi +% \end{macrocode} +% +% \begin{macro}{\thetag} +% Sometimes one needs to set a literal tag according to the rules of +% the document style. To achieve this we provide the \cn{thetag} +% command. It typesets its argument by calling \cs{tagform@} on +% it. +% \begin{macrocode} +\newcommand{\thetag}{\leavevmode\tagform@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\df@tag} +% \begin{macro}{\make@df@tag} +% \begin{macro}{\make@df@tag@@} +% \begin{macro}{\make@df@tag@@@} +% Sometimes it is necessary for a \cn{tag} command to store a tag +% in a safe place and to process it later, e.g., for a tag in a row +% of an alignment where the tag can only be typeset when the +% \cn{\\} at the end of the row was seen. Such a tag is stored in +% the macro \cs{df@tag} (for `deferred tag'). For this purpose we +% provide the \cs{make@df@tag} macro. It is built very similar to +% the \cs{maketag@@} macro above. +% \begin{macrocode} +\let\df@tag\@empty +\def\make@df@tag{\@ifstar\make@df@tag@@\make@df@tag@@@} +% \end{macrocode} +% \cs{make@df@tag} sets \cs{@currentlabel} and defines +% \cs{df@tag} appropriately. +% +% To simplify the task of tracking \cs{tag} and \cs{label} +% commands inside math display environments, we defer \cs{label} +% commands until the tag is typeset, similar to the way that +% \cs{tag}s themselves are deferred. This allows arbitrary +% placement of \cs{label} and \cs{tag} commands and also means we +% only increment the \cs{equation} counter when we really need to, +% thus avoiding the \cs{setb@ck} nonsense that used to be required. +% +% \begin{macrocode} +\def\make@df@tag@@#1{% + \gdef\df@tag{\maketag@@@{#1}\def\@currentlabel{#1}}} +% \end{macrocode} +% Autogenerated number: +% \begin{macrocode} +\def\make@df@tag@@@#1{\gdef\df@tag{\tagform@{#1}% + \toks@\@xp{\p@equation{#1}}\edef\@currentlabel{\the\toks@}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\ltx@label} +% \begin{macro}{\label@in@display} +% \begin{macro}{\df@label} +% Next, we store the default definition of \cs{label} in +% \cs{ltx@label} and then define a new version of \cs{label} for use +% in math display environments. \cs{label@in@display} merely issues a +% warning message if there is already a pending label (which will be +% discarded) and then stores the label in \cs{df@label}. +% \begin{macrocode} +\let\ltx@label\label +% +\def\label@in@display{% + \ifx\df@label\@empty\else + \@amsmath@err{Multiple \string\label's: + label '\df@label' will be lost}\@eha + \fi + \gdef\df@label +} +% \end{macrocode} +% In case there is an enumerate inside a minipage inside an equation, +% we need to reset \cn{label} to its normal value: +% \begin{macrocode} +\toks@\@xp{\@arrayparboxrestore \let\label\ltx@label}% +\edef\@arrayboxrestore{\the\toks@} +% \end{macrocode} +% +% \begin{macrocode} +\let\df@label\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\make@display@tag} +% Now we define a macro to process \cs{tag} and \cs{label} commands +% in various display environments. If the |@eqnsw| switch is set, +% then we should supply an equation number; otherwise, if the +% |@tag| switch is set, we should use the tag stored in +% \cs{df@tag}. Finally, we process any pending \cs{label}s. +% +% TODO: Arguably, \cs{make@display@tag} should issue a warning +% message if there is a \cs{label} but neither a tag nor an +% equation number. Also, it would probably be worthwhile to +% explore whether \cs{iftag@} could be done away with and replaced +% by checks to see if \cs{df@tag} is empty or not. +% \begin{macrocode} +\def\make@display@tag{% + \if@eqnsw \incr@eqnum \print@eqnum + \else \iftag@ \df@tag \global\let\df@tag\@empty \fi + \fi +% \end{macrocode} +% Need to check the \cs{ifmeasuring@} flag otherwise the \cs{write} +% node from \cn{label} might be discarded in a temp box and clearing +% \cs{df@label} will keep it from being reiterated on the real +% typesetting pass. +% \begin{macrocode} + \ifmeasuring@ + \else + \ifx\df@label\@empty + \else + \@xp\ltx@label\@xp{\df@label}% + \global\let\df@label\@empty + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% Now we define the special versions of \cn{tag} used within the +% \env{align} environments. +% +% \begin{macro}{\tag@in@align} +% The \cn{tag} command may only appear once in a row of +% an alignment. Therefore we first check the switch |tag@| +% that is set to false at the begin of every row. +% If this switch is true a \cn{tag} was already given in this +% row and we define \cs{next@} to expand to a call to +% \cs{invalid@tag}. +% \begin{macrocode} +\def\tag@in@align{% + \relax + \iftag@ + \DN@{\invalid@tag{Multiple \string\tag}}% + \else +% \end{macrocode} +% Otherwise we set the |tag@| switch. But there is more to +% be done: we must also prevent the automatic generation of a +% tag. Therefore we also reset the |@eqnsw|. +% \begin{macrocode} + \global\tag@true +% \end{macrocode} +% Changed to \cs{nonumber}, since that seems to be all that's +% required.---dmj, 1994/12/21 +% \begin{macrocode} + \nonumber +% \end{macrocode} +% Within a row of an \env{align} environment the \cn{tag} +% command must not typeset the tag immediately since its +% position can be determined only later. +% Therefore we use the \cs{make@df@tag} macro defined +% earlier. +% Finally we call \cs{next@} to process the argument +% that follows. +% \begin{macrocode} + \let\next@\make@df@tag + \fi + \next@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\raisetag} +% Usage: \cn{raisetag} \meta{dimen} +% +% This will modify the vertical placement of the tag of the current +% equation by \meta{dimen}. Note that according to the current uses +% of \cs{raise@tag} in e.g., \cs{place@tag@gather}, no adjustment +% occurs if the tag falls in its normal position; i.e., \cn{raisetag} +% has no effect unless the tag has already been shifted off-line. +% +% \begin{macrocode} +\newcommand{\raisetag}[1]{\skip@#1\relax + \xdef\raise@tag{\vskip\iftagsleft@\else-\fi\the\skip@\relax}% +} +% \end{macrocode} +% \cn{raise@tag} will be reemptied at the beginning of each equation, +% which might occur at a |\begin{xxx}| or \cn{\\}. +% \begin{macrocode} +\let\raise@tag\@empty +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\notag} +% For consistency we provide \cn{notag}, equivalent to +% \cn{nonumber}. The alternative would have been to rename +% \cn{tag} as \cn{number} to go along with \cn{nonumber}, +% but of course \cs{number} is a \tex/ primitive that should not +% be redefined. +% \begin{macrocode} +\newcommand{\notag}{\nonumber} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\nonumber} +% Need to add some additional code to \cn{nonumber} to deal with some +% complications related to nested environments. +% \begin{macrocode} +\renewcommand{\nonumber}{% + \if@eqnsw + \ifx\incr@eqnum\@empty \addtocounter{equation}\m@ne \fi + \fi + \let\print@eqnum\@empty \let\incr@eqnum\@empty + \global\@eqnswfalse +} +% \end{macrocode} +% +% \begin{macrocode} +\def\print@eqnum{\tagform@\theequation} +\def\incr@eqnum{\refstepcounter{equation}\let\incr@eqnum\@empty} +% \end{macrocode} +% \end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Multiline equation environments} +% +% \subsection{Remarks} +% +% In late 1994 David M. Jones did a thorough overhaul of these +% environments so that the number placement and a few other aspects +% are substantially improved over the original versions that were +% ported essentially unchanged from \fn{amstex.tex} in 1989. Most of +% the commentary in this section is DMJ's, and comments of any +% significance that I added are marked by my initials and date +% [mjd, 1995/01/11]. +% +% \subsection{Preliminaries} +% +% \begin{macro}{\ifinalign@} +% \begin{macro}{\ifingather@} +% We define two switches that are set to true in certain +% alignments: |inalign@| and |ingather@| inside of +% the \env{align} and \env{gather} environments. +% These switches are needed to control certain actions that +% depend on the surrounding conditions, more specifically: +% on the setting already done by the surrounding environments. +% \begin{macrocode} +\newif\ifinalign@ +\newif\ifingather@ +% \end{macrocode} +% \begin{histnote} +% Removed the \cs{ifinany@} test [mjd,1999/06/28] since it was mainly +% used for the purpose now handled by \cs{spread@equation}. +% \changes{v1.2g}{1999/06/28}{Removed ifinany@} +% \end{histnote} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@arrayparboxrestore} +% Here we must reset a few additional parameters. +% \begin{macrocode} +\@xp\def\@xp\@arrayparboxrestore\@xp{\@arrayparboxrestore + \ingather@false\inalign@false \default@tag + \let\spread@equation\@spread@equation + \let\reset@equation\@empty + \def\print@eqnum{\tagform@\theequation}% + \def\incr@eqnum{\refstepcounter{equation}\let\incr@eqnum\@empty}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\iftag@} +% The switch |tag@| is set to false at the beginning of every +% row and set to true by a \cn{tag} command. +% This allows us to check whether there is more than one tag on +% a row. +% \begin{macrocode} +\newif\iftag@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifst@rred} +% The switch |st@rred| is set to true by all starred +% environments +% and set to false by the unstarred versions. +% \begin{macrocode} +\newif\ifst@rred +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifmeasuring@} +% All display environments get typeset twice---once during a +% ``measuring'' phase and then again during a ``production'' phase; +% \cs{ifmeasuring@} will be used to determine which case we're in, +% so we can take appropriate action. +% +% \begin{macrocode} +\newif\ifmeasuring@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifshifttag@} +% \cs{ifshifttag@} is used by \env{gather} to communicate between +% \cs{calc@shift@gather} and \cs{place@tag@gather} whether an +% equation tag should be shifted to a separate line. It's also +% used by \env{multline}. +% \begin{macrocode} +\newif\ifshifttag@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\row@} +% \begin{macrocode} +\newcount\row@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\column@} +% The counter \cs{column@} is used by the alignment macros to +% keep track of the current column. +% +% \begin{macrocode} +\newcount\column@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\column@plus} +% \cs{\column@plus} is a useful abbreviation. +% \begin{macrocode} +\def\column@plus{% + \global\advance\column@\@ne +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\maxfields@} +% \begin{macrocode} +\newcount\maxfields@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\add@amp} +% \begin{macro}{\add@amps} +% \begin{macrocode} +\def\add@amp#1{\if m#1&\@xp\add@amp\fi} +\def\add@amps#1{% + \begingroup + \count@#1\advance\count@-\column@ + \edef\@tempa{\endgroup + \@xp\add@amp\romannumeral\number\count@ 000q}% + \@tempa +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\andhelp@} +% The help text stored in \cs{andhelp@} is used for errors +% generated by too many \qc{\&} characters in a row. +% \begin{macrocode} +\newhelp\andhelp@ +{An extra & here is so disastrous that you should probably exit^^J +and fix things up.} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\eqnshift@} +% \cs{eqnshift@} is used by \env{align} and \env{gather} as the +% indentation of the lines of the environment from the left margin. +% \begin{macrocode} +\newdimen\eqnshift@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\alignsep@} +% \begin{macrocode} +\newdimen\alignsep@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tagshift@} +% \begin{macrocode} +\newdimen\tagshift@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mintagsep} +% \cs{mintagsep} is the minimum allowable separation between an +% equation and its tag. We set it to half a quad in +% \cs{textfont}2, which is \tex/'s built-in value. +% \begin{macrocode} +\newcommand{\mintagsep}{.5\fontdimen6\textfont\tw@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\minalignsep} +% This should probably be a skip register [mjd,1999/06/18] +% \begin{macrocode} +\newcommand{\minalignsep}{10pt} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tagwidth@} +% \begin{macrocode} +\newdimen\tagwidth@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\totwidth@} +% \begin{macrocode} +\newdimen\totwidth@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\lineht@} +% The dimen register \cs{lineht@} is used to keep track of the +% height (or depth, if tags are on the right) of a row in an +% alignment. +% \begin{macrocode} +\newdimen\lineht@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tag@width} +% \begin{macro}{\savetaglength@} +% \begin{macro}{\shift@tag} +% \begin{macro}{\tag@shifts} +% \begin{macrocode} +\def\tag@width#1{% + \ifcase\@xp#1\tag@lengths\fi +} + +\def\savetaglength@{% + \begingroup + \let\or\relax + \xdef\tag@lengths{\tag@lengths\or \the\wdz@}% + \endgroup +} + +\def\shift@tag#1{% + \ifcase\@xp#1\tag@shifts\fi\relax +} + +\let\tag@shifts\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\saveshift@} +% \begin{macrocode} +\def\saveshift@#1{% + \begingroup + \let\or\relax + \xdef\tag@shifts{\or#1\tag@shifts}% + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\spread@equation} +% This does the line-spacing adjustment that is normally wanted for +% displayed equations. We also call \cs{reset@strutbox@} here because +% otherwise a preceding font size change might leave \cs{strutbox@} +% with wrong contents. This is a less-than-ideal solution but +% probably good enough for now, until the situation can be +% overhauled. +% \begin{macrocode} +\def\spread@equation{\reset@strutbox@ + \openup\jot \let\spread@equation\@empty} +\let\@spread@equation\spread@equation +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\displ@y} +% \begin{macro}{\displ@y@} +% \begin{macro}{\@display@init} +% \cs{displ@y} is from \fn{plain.tex}, with +% \cs{interdisplaylinepenalty} changed to \cs{@eqpen}. Also we +% transplanted most of its internal organs to \cs{@display@init} to +% support \cs{displ@y@} and other possibilities. Don't try to make +% sense of these naming conventions! They are a narrowly calculated +% mishmash of Knuth/Spivak/Lamport/Mittelbach precedents. The reason +% for not cleaning them up and forcing all names to a consistent +% scheme is that then in principle we'd have to do it everywhere else +% too. And we programmers are paranoid about the side effects of name +% changes. +% \begin{macrocode} +\def\displ@y{\@display@init{}} +\def\@display@init#1{% + \global\dt@ptrue \spread@equation + \everycr{% + \noalign{% + #1% + \ifdt@p + \global\dt@pfalse + \vskip-\lineskiplimit + \vskip\normallineskiplimit + \else + \penalty\@eqpen \global\dspbrk@lvl\m@ne + \fi + }% + }% +} +% \end{macrocode} +% \cs{displ@y@} is nearly the same; it additionally sets the |tag@| +% switch and the \cs{column@} and \cs{dspbrk@lvl} counters to their +% default values. The argument is normally a bit of code to empty out +% \cs{raise@tag}, but in \env{multline} we don't want that to happen +% in \cs{everycr}. +% \begin{macrocode} +\def\displ@y@{\@display@init{% + \global\column@\z@ \global\dspbrk@lvl\m@ne + \global\tag@false \global\let\raise@tag\@empty +}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\black@} +% \changes{v2.17a}{2017/09/02}{add fixed width box so overfull warning generated in centred environments in lists} +% This macro is made to produce an overfull box message and +% possibly (depending on the value of \cs{overfullrule}) +% a rule in the margin if the total width of an alignment +% is larger than the value of \cs{displaywidth}. +% \begin{macrocode} +\def\black@#1{% + \noalign{% + \ifdim#1>\displaywidth + \dimen@\prevdepth + \nointerlineskip + \vskip-\ht\strutbox@ + \vskip-\dp\strutbox@ + \vbox{\noindent\hbox to\displaywidth{\hbox to#1{\strut@\hfill}}}% + \prevdepth\dimen@ + \fi + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\savecounters@} +% \begin{macro}{\restorecounters@} +% These are used during the measuring phase of the various display +% math environments to save and restore the values of all \latex/ +% counters. We make these local to a group, so nested environments +% works. +% +% Changed \cn{stepcounter} to |\csname c@...\endcsname| to avoid +% overhead of ifundefined test [mjd, 1995/01/20]. +% \begin{macrocode} +\def\savecounters@{% + \begingroup + \def\@elt##1{% + \global\csname c@##1\endcsname\the\csname c@##1\endcsname}% + \xdef\@gtempa{% + \cl@@ckpt + \let\@nx\restorecounters@\@nx\@empty + }% + \endgroup + \let\restorecounters@\@gtempa +} +% +\let\restorecounters@\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\savealignstate@} +% \begin{macro}{\restorealignstate@} +% These are used to save the values of various parameters that are +% shared by \env{align} and \env{gather} when the former is used +% inside the latter. +% \begin{macrocode} +\def\savealignstate@{% + \begingroup + \let\or\relax + \xdef\@gtempa{% + \global\totwidth@\the\totwidth@ + \global\row@\the\row@ + \gdef\@nx\tag@lengths{\tag@lengths}% + \let\@nx\restorealignstate@\@nx\@empty + }% + \endgroup + \let\restorealignstate@\@gtempa +} + +\let\restorealignstate@\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\savecolumn@} +% \begin{macro}{\restorecolumn@} +% +% \begin{macrocode} +\def\savecolumn@{% + \edef\restorecolumn@{% + \global\column@\number\column@ + \let\@nx\restorecolumn@\@nx\@empty + }% +} +\let\restorecolumn@\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Scanning the environment's body} +% +% Several of the math alignment macros must scan their body twice: +% once to determine how wide the columns are and then to actually +% typeset them. This means that we must collect all text in this body +% before calling the environment macros. +% +% \begin{macro}{\@envbody} +% We start by defining a token register to contain the body. +% \begin{macrocode} +\newtoks\@envbody +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\addto@envbody} +% Then we define a macro to add something (i.e.\ its argument) to the +% token register \cs{@envbody}. +% \begin{macrocode} +\def\addto@envbody#1{\global\@envbody\@xp{\the\@envbody#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\collect@body} +% The macro \cs{collect@body} starts the scan for the |\end{...}| +% command of the current environment. It takes a macro name as +% argument. This macro is supposed to take the whole body of the +% environment as its argument. For example, |\begin{align}| would +% call |\collect@body\@align| if |@align#1{...}| is the macro that +% sets the alignment with body \arg{1}. +% +% \begin{macrocode} +\def\collect@body#1{% + \@envbody{\@xp#1\@xp{\the\@envbody}}% + \edef\process@envbody{\the\@envbody\@nx\end{\@currenvir}}% + \@envbody\@emptytoks \def\begin@stack{b}% +% \end{macrocode} +% +% If we simply called \cs{collect@@body} directly, +% the error message for a \cn{par} token (usually from a blank line) +% would be +% \begin{verbatim} +% ! Paragraph ended before \collect@@body was complete. +% \end{verbatim} +% But we use a little finesse to get a more intelligible error +% message: +% \begin{verbatim} +% ! Paragraph ended before \multline* was complete. +% \end{verbatim} +% In order to avoid using up csnames unnecessarily we use the actual +% environment name as the name of the temporary function that is +% \cs{let} to \cs{collect@@body}; but then in order to preserve the +% theoretical possibility of nesting for environments that use +% \cs{collect@body} (not currently required by any \pkg{amsmath} +% environment [mjd,1999/06/23]), we do the \cs{let} inside a group. +% \begin{macrocode} + \begingroup + \@xp\let\csname\@currenvir\endcsname\collect@@body +% \end{macrocode} +% This small twist eliminates the need for \cs{expandafter}'s in +% \cs{collect@@body}. +% \begin{macrocode} + \edef\process@envbody{\@xp\@nx\csname\@currenvir\endcsname}% + \process@envbody +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\push@begins} +% When adding a piece of the current environment's contents to +% \cs{@envbody}, we scan it to check for additional \cn{begin} +% tokens, and add a `b' to the stack for any that we find. +% \begin{macrocode} +\def\push@begins#1\begin#2{% + \ifx\end#2\else b\@xp\push@begins\fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\collect@@body} +% \cs{collect@@body} takes two arguments: the first will consist of +% all text up to the next \cn{end} command, the second will be the +% \cn{end} command's argument. If there are any extra \cn{begin} +% commands in the body text, a marker is pushed onto a stack by the +% \cs{push@begins} function. Empty state for this stack means that we +% have reached the \cn{end} that matches our original \cn{begin}. +% Otherwise we need to include the \cn{end} and its argument in the +% material that we are adding to our environment body accumulator. +% +% \begin{histnote} +% In a former implementation, the error messages resulting from a +% typo in the environment name were unsatisfactory, because it was +% matching of the environment name that was used to determine the end +% of our environment body, instead of counting begin-end pairs. +% Thanks to Lars Hellstr\"{o}m for a suggestion that led to this +% improvement. [mjd,1999/06/23] +% \end{histnote} +% \begin{macrocode} +\def\collect@@body#1\end#2{% + \edef\begin@stack{\push@begins#1\begin\end \@xp\@gobble\begin@stack}% + \ifx\@empty\begin@stack + \endgroup + \@checkend{#2}% + \addto@envbody{#1}% + \else + \addto@envbody{#1\end{#2}}% + \fi + \process@envbody % A little tricky! Note the grouping +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Simple aligning environments} +% +% \begin{macro}{\math@cr@@@aligned} +% From tabskip we get an extra space of minalignsep after every +% second column; but when this falls at the right edge of the whole +% aligned structure, we need to cancel that space. +% \begin{macrocode} +\def\math@cr@@@aligned{% + \ifodd\column@ \let\next@\@empty + \else \def\next@{&\kern-\alignsep@}% + \fi + \next@ \cr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\start@aligned} +% The \env{aligned} and \env{alignedat} environments are identical +% except that the latter takes a mandatory argument to specify the +% number of align structures, while the former allows any number of +% align structures automatically (the use of \env{alignedat} is +% deprecated). So, they will be defined in terms of +% \cs{start@aligned}, which will take two arguments. The first +% argument specifies the placement of the environments; it is +% either |c|, |t|, or |b|. The second is the number of align +% structures; a value of~$-1$ means that an arbitrary number are +% allowed. +% \begin{macrocode} +\newcommand{\start@aligned}[2]{% + \RIfM@\else + \nonmatherr@{\begin{\@currenvir}}% + \fi + \savecolumn@ % Assumption: called inside a group +% \end{macrocode} +% The \cs{null} here is to keep the \cs{,} glue from causing the +% invocation of the clause in \tex/'s built-in tag placement +% algorithm that can cause an equation to be shifted all the way over +% to the margin. +% \begin{macrocode} + \alignedspace@left + \if #1t\vtop \else \if#1b \vbox \else \vcenter \fi \fi \bgroup + \maxfields@#2\relax + \ifnum\maxfields@>\m@ne + \multiply\maxfields@\tw@ +% \end{macrocode} +% Introduced new \cs{math@cr@@@} so we can provide standard error +% message for too many \qc{\&}'s in \env{alignedat}. +% \begin{macrocode} + \let\math@cr@@@\math@cr@@@alignedat + \alignsep@\z@skip + \else + \let\math@cr@@@\math@cr@@@aligned + \alignsep@\minalignsep + \fi +% \end{macrocode} +% Reset the meaning of \cn{\\}. +% \begin{macrocode} + \Let@ \chardef\dspbrk@context\@ne +% \end{macrocode} +% Restore the default definition of \cn{tag} (error message), in +% case \env{aligned} is used inside, e.g., a \env{gather} +% environment that accepts \cn{tag}. +% \begin{macrocode} + \default@tag + \spread@equation % no-op if already called +% \end{macrocode} +% Finally we start the alignment itself. For \env{aligned} we add +% \cs{minalignsep} after every second column to mimic the +% behavior of \env{align}. For \env{alignedat} the user has to +% specify interalign space explicitly. +% \begin{macrocode} + \global\column@\z@ + \ialign\bgroup + &\column@plus + \hfil + \strut@ + $\m@th\displaystyle{##}$% + \tabskip\z@skip + &\column@plus + $\m@th\displaystyle{{}##}$% + \hfil + \tabskip\alignsep@ + \crcr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@cr@@@alignedat} +% \cs{math@cr@@@alignedat} checks to make sure the user hasn't put in +% too many \qc{\&}s in \env{alignedat}. Since \env{alignedat} +% doesn't use \cs{displ@y@}, we also reset \cs{column@} here. Note +% than in \env{aligned}, \cs{column@} will increase without bound, +% since it never gets reset, but this is harmless. +% \begin{macrocode} +\def\math@cr@@@alignedat{% + \ifnum\column@>\maxfields@ + \begingroup + \measuring@false + \@amsmath@err{Extra & on this line}% + {\the\andhelp@}% "An extra & here is disastrous" + \endgroup + \fi + \global\column@\z@ + \cr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\alignsafe@testopt} +% Testing for an optional argument can be really, really tricky in +% certain complicated contexts. This we discovered by getting some +% bug reports for uses of \env{aligned}. So here is a safer +% form of \latex/'s \cs{@testopt} function. +% \begin{macrocode} +\def\alignsafe@testopt#1#2{% + \relax\iffalse{\fi\ifnum`}=0\fi + \@ifnextchar[% + {\let\@let@token\relax \ifnum`{=\z@\fi\iffalse}\fi#1}% + {\let\@let@token\relax \ifnum`{=\z@\fi\iffalse}\fi#1[#2]}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{aligned} +% The \env{aligned} environment takes an optional argument that +% indicates its vertical position in relation to surrounding +% material: |t|, |c|, or |b| for top, center, or bottom. +% \begin{macrocode} +\newenvironment{aligned}{% + \let\@testopt\alignsafe@testopt + \aligned@a +}{% + \crcr\egroup + \restorecolumn@ + \egroup +} +\newcommand{\aligned@a}[1][c]{\start@aligned{#1}\m@ne} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{alignedat} +% To get a top or bottom positioned \env{alignedat} structure, you +% would write something like +% \begin{verbatim} +% \begin{alignedat}[t]{3} +% \end{verbatim} +% +% \begin{macrocode} +\newenvironment{alignedat}{% + \let\@testopt\alignsafe@testopt + \alignedat@a +}{% + \endaligned +} +\newcommand{\alignedat@a}[1][c]{\start@aligned{#1}} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{gathered} +% The \env{gathered} environment is for several lines that are +% centered independently. +% \begin{macrocode} +\newenvironment{gathered}[1][c]{% + \RIfM@\else + \nonmatherr@{\begin{gathered}}% + \fi + \alignedspace@left + \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi \bgroup + \Let@ \chardef\dspbrk@context\@ne \restore@math@cr + \spread@equation + \ialign\bgroup + \hfil\strut@$\m@th\displaystyle##$\hfil + \crcr +}{% + \endaligned +} +% \end{macrocode} +% \end{environment} +% +% +% \subsection{The \env{gather} environment} +% +% \begin{macro}{\start@gather} +% \begin{macrocode} +\def\start@gather#1{% + \RIfM@ + \nomath@env + \DN@{\@namedef{end\@currenvir}{}\@gobble}% + \else + $$% + #1% + \ifst@rred \else \global\@eqnswtrue \fi + \let\next@\gather@ + \fi + \collect@body\next@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{gather} +% \begin{environment}{gather*} +% \begin{macrocode} +\newenvironment{gather}{% + \start@gather\st@rredfalse +}{% + \math@cr \black@\totwidth@ \egroup + $$\ignorespacesafterend +} + +\newenvironment{gather*}{% + \start@gather\st@rredtrue +}{% + \endgather +} +% \end{macrocode} +% \end{environment} +% \end{environment} +% +% \begin{macro}{\gather@} +% \begin{macrocode} +\def\gather@#1{% + \ingather@true \let\split\insplit@ + \let\tag\tag@in@align \let\label\label@in@display + \chardef\dspbrk@context\z@ + \intertext@ \displ@y@ \Let@ + \let\math@cr@@@\math@cr@@@gather + \gmeasure@{#1}% + \global\shifttag@false + \tabskip\z@skip + \global\row@\@ne + \halign to\displaywidth\bgroup + \strut@ + \setboxz@h{$\m@th\displaystyle{##}$}% + \calc@shift@gather + \set@gather@field + \tabskip\@centering + &\setboxz@h{\strut@{##}}% + \place@tag@gather + \tabskip \iftagsleft@ \gdisplaywidth@ \else \z@skip \span\fi + \crcr + #1% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\gmeasure@} +% \begin{macrocode} +\def\gmeasure@#1{% + \begingroup + \measuring@true + \totwidth@\z@ + \global\let\tag@lengths\@empty + \savecounters@ + \setbox\@ne\vbox{% + \everycr{\noalign{\global\tag@false + \global\let\raise@tag\@empty \global\column@\z@}}% + \let\label\@gobble + \halign{% + \setboxz@h{$\m@th\displaystyle{##}$}% + \ifdim\wdz@>\totwidth@ + \global\totwidth@\wdz@ + \fi + &\setboxz@h{\strut@{##}}% + \savetaglength@ + \crcr + #1% + \math@cr@@@ + }% + }% + \restorecounters@ + \if@fleqn + \global\advance\totwidth@\@mathmargin + \fi + \iftagsleft@ + \ifdim\totwidth@>\displaywidth + \global\let\gdisplaywidth@\totwidth@ + \else + \global\let\gdisplaywidth@\displaywidth + \fi + \fi + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@cr@@@gather} +% Modified \cs{math@cr@@@gather} so that it always puts in the +% final field, which needs to be done under the new method for +% determining tag placement. This is probably more efficient +% anyway. +% +% \begin{macrocode} +\def\math@cr@@@gather{% + \ifst@rred\nonumber\fi + &\relax + \make@display@tag + \ifst@rred\else\global\@eqnswtrue\fi +% \end{macrocode} +% We advance \cs{row@} here, rather than at the beginning of the +% preamble, because otherwise the \env{split} environment will +% cause \cs{row@} to be advanced twice instead of once. +% \begin{macrocode} + \global\advance\row@\@ne + \cr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\calc@shift@gather} +% \cs{calc@shift@gather} has must make two decisions: (1) whether the +% equation tag for the current line should be put on a separate +% line and (2) what the distance between the equation and the +% equation tag should be. We implement \tex/'s built-in +% tag-placement as well as possible, with one improvement: the +% minimum separation between tag and equation is now a +% user-settable parameter. +% +% [1995/01/17] Added a check to make sure that the width of the tag +% on the current line is $>0$ before testing to see if tagwidth + +% linewidth + mintagsep $>$ displaywidth. Since an imbedded align +% shows up as line with width \cn{displaywidth}, and even lines +% without a tag get processed as if an empty tag were present, the +% result was that the empty tag assigned to the line containing the +% align was being shifted downwards, creating extra space after the +% align. +% \begin{macrocode} +\def\calc@shift@gather{% + \dimen@\mintagsep\relax + \tagwidth@\tag@width\row@\relax +% \end{macrocode} +% If we're in \opt{fleqn} mode, there is no flexibility about +% placement of the equation, so all we can do is see if there's +% room for the tag in the given margin. +% \begin{macrocode} + \if@fleqn + \global\eqnshift@\@mathmargin + \ifdim\tagwidth@>\z@ + \advance\dimen@\tagwidth@ + \iftagsleft@ + \ifdim\dimen@>\@mathmargin + \global\shifttag@true + \fi + \else + \advance\dimen@\@mathmargin + \advance\dimen@\wdz@ + \ifdim\dimen@>\displaywidth + \global\shifttag@true + \fi + \fi + \fi + \else + \global\eqnshift@\displaywidth + \global\advance\eqnshift@-\wdz@ + \ifdim\tagwidth@>\z@ + \multiply\dimen@\tw@ + \advance\dimen@\wdz@ + \advance\dimen@\tagwidth@ + \ifdim\dimen@>\displaywidth + \global\shifttag@true + \else + \ifdim\eqnshift@<4\tagwidth@ + \global\advance\eqnshift@-\tagwidth@ + \fi + \fi + \fi + \global\divide\eqnshift@\tw@ + \iftagsleft@ + \global\eqnshift@-\eqnshift@ + \global\advance\eqnshift@\displaywidth + \global\advance\eqnshift@-\wdz@ + \fi + \ifdim\eqnshift@<\z@ + \global\eqnshift@\z@ + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\place@tag@gather} +% \begin{macro}{\set@gather@field} +% \begin{macrocode} +\def\place@tag@gather{% + \iftagsleft@ + \kern-\gdisplaywidth@ + \ifshifttag@ + \rlap{\vbox{% + \normalbaselines + \boxz@ + \vbox to\lineht@{}% + \raise@tag + }}% + \global\shifttag@false + \else + \rlap{\boxz@}% + \fi + \else + \ifdim\totwidth@>\displaywidth + \dimen@\totwidth@ + \advance\dimen@-\displaywidth + \kern-\dimen@ + \fi + \ifshifttag@ + \llap{\vtop{% + \raise@tag + \normalbaselines + \setbox\@ne\null + \dp\@ne\lineht@ + \box\@ne + \boxz@ + }}% + \global\shifttag@false + \else + \llap{\boxz@}% + \fi + \fi +} +% +\def\set@gather@field{% + \iftagsleft@ + \global\lineht@\ht\z@ + \else + \global\lineht@\dp\z@ + \fi + \kern\eqnshift@ + \boxz@ + \hfil +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \subsection{The \env{align} family of environments} +% +% The \env{align}, \env{flalign}, \env{alignat}, \env{xalignat}, +% and \env{xxalignat} environments are virtually +% identical, and thus will share much code. We'll refer to the +% environments generically as ``\env{align}'' and will +% distinguish between them explicitly +% only when necessary. +% +% \begin{macro}{\ifxxat@} +% \begin{macro}{\ifcheckat@} +% \begin{macro}{\xatlevel@} +% The \cs{xatlevel@} macro will be used, informally speaking, to +% distinguish between the \env{alignat} and \env{xalignat}, and +% \env{xxalignat} environments. +% +% \begin{macrocode} +\newif\ifxxat@ + +\newif\ifcheckat@ + +\let\xatlevel@\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\start@align} +% \cs{start@align} will be called by all of the \env{align}-like +% environments. The first argument will be the \cs{xatlevel@}, +% i.e., 0, 1, or~2; the second argument will be either +% \cs{st@rredtrue} or \cs{st@rredfalse}. The third argument will +% be the number of aligned +% structures in the environment (either as supplied by the user, or +% $-1$ to indicate that checking shouldn't be done). After +% performing the appropriate error detection and initialization, +% \cs{start@align} calls \cs{align@}. +% +% Note that the \cs{equation} counter is no longer stepped at the +% beginning of these environments. +% +% TODO: Implement \cs{shoveleft} and \cs{shoveright} for +% \env{align}. +% \begin{macrocode} +\def\start@align#1#2#3{% + \let\xatlevel@#1% always \z@, \@ne, or \tw@ + \maxfields@#3\relax + \ifnum\maxfields@>\m@ne + \checkat@true + \ifnum\xatlevel@=\tw@ + \xxat@true + \fi + \multiply\maxfields@\tw@ + \else + \checkat@false + \fi + \ifingather@ + \iffalse{\fi\ifnum0=`}\fi + \DN@{\vcenter\bgroup\savealignstate@\align@#2}% + \else + \ifmmode + \if@display + \DN@{\align@recover}% + \else + \nomath@env + \DN@{\@namedef{end\@currenvir}{}\@gobble}% + \fi + \else + $$% + \let\split\insplit@ + \DN@{\align@#2}% + \fi + \fi + \collect@body\next@ +} +% \end{macrocode} +% +% With version 1.2 of \pkg{amsmath}, it was possible to use +% \env{align*} and relatives in certain wrong contexts without +% getting an error, e.g. +% \begin{verbatim} +% \begin{equation*} +% \begin{align*} +% ... +% \end{align*} +% \end{equation*} +% \end{verbatim} +% +% For backward compatibility we therefore give only a warning for +% this condition instead of a full error, and try to recover using +% the \env{aligned} environment. The alignment of the material may be +% adversely affected but it will at least remain readable. +% \begin{macrocode} +\def\align@recover#1#2#3{% + \endgroup + \@amsmath@err{% +Erroneous nesting of equation structures;\MessageBreak +trying to recover with `aligned'% + }\@ehc + \begin{aligned}\relax#1\end{aligned}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{align} +% \begin{environment}{align*} +% \begin{environment}{flalign} +% \begin{environment}{flalign*} +% \begin{environment}{alignat} +% \begin{environment}{alignat*} +% \begin{environment}{xalignat} +% \begin{environment}{xalignat*} +% \begin{environment}{xxalignat} +% The definitions of the various \env{align} environments are quite +% straight-forward. +% +% \begin{macrocode} +\newenvironment{alignat}{% + \start@align\z@\st@rredfalse +}{% + \endalign +} +\newenvironment{alignat*}{% + \start@align\z@\st@rredtrue +}{% + \endalign +} +\newenvironment{xalignat}{% + \start@align\@ne\st@rredfalse +}{% + \endalign +} +\newenvironment{xalignat*}{% + \start@align\@ne\st@rredtrue +}{% + \endalign +} +\newenvironment{xxalignat}{% + \start@align\tw@\st@rredtrue +}{% + \endalign +} +\newenvironment{align}{% + \start@align\@ne\st@rredfalse\m@ne +}{% + \math@cr \black@\totwidth@ + \egroup + \ifingather@ + \restorealignstate@ + \egroup + \nonumber + \ifnum0=`{\fi\iffalse}\fi + \else + $$% + \fi + \ignorespacesafterend +} +\newenvironment{align*}{% + \start@align\@ne\st@rredtrue\m@ne +}{% + \endalign +} +\newenvironment{flalign}{% + \start@align\tw@\st@rredfalse\m@ne +}{% + \endalign +} +\newenvironment{flalign*}{% + \start@align\tw@\st@rredtrue\m@ne +}{% + \endalign +} +% \end{macrocode} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% +% +% \begin{macro}{\align@} +% TODO: Some of these sets of initializations show up in multiple +% places. It might be worth making an abbreviation for them. +% +% \begin{macrocode} +\def\align@#1#2{% + \inalign@true \intertext@ \Let@ \chardef\dspbrk@context\z@ + \ifingather@\else\displ@y@\fi + \let\math@cr@@@\math@cr@@@align + \ifxxat@\else \let\tag\tag@in@align \fi + \let\label\label@in@display + #1% set st@r + \ifst@rred\else \global\@eqnswtrue \fi + \measure@{#2}% + \global\row@\z@ + \tabskip\eqnshift@ + \halign\bgroup + \span\align@preamble\crcr + #2% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@cr@@@align} +% \begin{macrocode} +\def\math@cr@@@align{% + \ifst@rred\nonumber\fi + \if@eqnsw \global\tag@true \fi + \global\advance\row@\@ne + \add@amps\maxfields@ + \omit + \kern-\alignsep@ + \iftag@ + \setboxz@h{\@lign\strut@{\make@display@tag}}% + \place@tag + \fi + \ifst@rred\else\global\@eqnswtrue\fi + \global\lineht@\z@ + \cr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\math@cr@@@align@measure} +% \begin{macrocode} +\def\math@cr@@@align@measure{% + &\omit + \global\advance\row@\@ne + \ifst@rred\nonumber\fi + \if@eqnsw \global\tag@true \fi + \ifnum\column@>\maxfields@ + \ifcheckat@ + \begingroup + \measuring@false + \@amsmath@err{Extra & on this line}% + {\the\andhelp@}% "An extra & here is disastrous" + \endgroup + \else + \global\maxfields@\column@ + \fi + \fi + \setboxz@h{\@lign\strut@{% + \if@eqnsw + \stepcounter{equation}% + \tagform@\theequation + \else + \iftag@\df@tag\fi + \fi + }}% + \savetaglength@ + \ifst@rred\else\global\@eqnswtrue\fi + \cr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\field@lengths} +% \begin{macro}{\savefieldlength@} +% \begin{macro}{\fieldlengths@} +% \begin{macrocode} +\let\field@lengths\@empty + +\def\savefieldlength@{% + \begingroup + \let\or\relax + \xdef\field@lengths{% + \field@lengths + \ifnum\column@=0 + \or + \else + ,% + \fi + \the\wdz@ + }% + \endgroup +} + +\def\fieldlengths@#1{% + \ifcase\@xp#1\field@lengths\fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\maxcolumn@widths} +% \cs{maxcolumn@widths} will be used to hold the widths of the +% fields of the \env{alignat} environment. The widths will be +% separated by the token \cn{or}, making it easy to extract a given +% width using \cn{ifcase}. +% \begin{macrocode} +\let\maxcolumn@widths\@empty +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\maxcol@width} +% \cs{maxcol@width} $n$ = maximum width of $n$th column of the current +% \env{alignat} (i.e., the $n$th field of \cs{maxcolumn@widths}.) +% It expands to a \<dimen>, so it can be used as the right-hand +% side of a \<variable assignment> or \<arithmetic> statement. +% It's argument can be any \<number>, \<integer variable> or macro +% that expands to one of these. [Check to make sure this is true.] +% +% This is subtler than it looks. +% \begin{macrocode} +\def\maxcol@width#1{% + \ifcase\@xp#1\maxcolumn@widths\fi\relax +} +% \end{macrocode} +% \end{macro} +% +% Now comes the real fun. A typical \env{align} environments looks +% something like this, where the vertical bars mark the edges of +% the fields of the underlying \cs{halign}: +% \[ +% \makeatletter\tabskip\@centering\offinterlineskip +% \halign to\displaywidth{%^^A +% &$\strut$\vrule\hfil$\m@th\displaystyle{\@lign#}$\vrule +% \tabskip1pt&\vrule$\m@th\displaystyle{\@lign#}$\hfil\vrule +% \tabskip\@centering\cr +% \omit\small\hfil 1\hfil &\omit\small\hfil 2 &\omit\small\hfil +% 3\hfil &\omit\small\hfil 4\hfil & \omit\small\hfil 5\hfil +% &\omit\small\hfil 6\hfil\cr +% \noalign{\vskip8pt\relax} +% V_i + q_i v_j & =v_i , & X_i & = x_i - q_i x_j, +% & U_i & = u_i,\qquad +% \hbox{for $i\ne j$;} %&\omit\hfill \llap{(3)} +% \cr +% V_j & = v_j, & X_j & = x_j, +% & U_j & = u_j + \sum_{i\ne j} q_i u_i. %&\omit\hfill \llap{(4)} +% \cr} +% \] +% Note that each align structure consists of two fields, with no +% space between them (a small space has been added here to +% highlight the boundaries). Furthermore, the text inside the +% odd-numbered fields is flushright, while the text inside the +% even-numbered fields is flushleft. The equation tags (shown on +% the right here) can be on either the right or the left. If there +% is not room (in a sense to be defined shortly) for the tag on the +% same line as the equation, the tag will be shifted to a separate +% line. +% +% Each environment also has a certain number of ``flexible +% spaces,'' meaning spaces whose width we are allowed to adjust to +% take up the amount of ``free space'' in the line, meaning the +% space not taken up by the equation tag and the fields of the +% underlying \cs{halign}. +% +% The flexible spaces come in two flavors: interalign spaces and +% margin spaces. If there are $n$ align structures ($n=3$ in the +% illustration above), there are $n-1$ interalign spaces, unless we +% are in an \env{alignat} environment, in which case there are no +% flexible interalign spaces. +% +% The number of margin spaces is a little more complicated: +% Normally, there are two, but if we're in \opt{fleqn} mode, there +% is only one. Furthermore, if we're in an \env{xxalignat} or +% \env{flalign} environment (corresponding to $\cs{xatlevel@} = 2$, +% then there are no flexible margin spaces. +% +% Calculating the interalign and margin spaces is done in two +% stages. +% +% First, the total amount of free space is divided uniformly among +% all the flexible spaces, without regard for the lengths of the tags +% on the various lines. For the non-\opt{fleqn} case, this +% corresponds to centering the align structures between the margins. +% Note that in \opt{fleqn} mode, the right margin is still allowed to +% be larger than \cs{@mathmargin}. This introduces an element of +% asymmetry into the appearance of the environment, but it has the +% advantage of leaving more space for equation tags in the right +% margin. If the right margin were constrained to be equal to the +% left margin in this case, tags would need to be shifted to a +% separate line more often than would be desirable. +% +% Ordinarily, all flexible spaces will be given the same width. +% However, this is not invariably true, since the interalign spaces +% are constrained to be at least \cs{minalignsep} wide, while---in +% the absence of equation tags, at least---the margin spaces are +% allowed to shrink to zero. As we shall see in a minute, if there +% are tags in the environment, then the margins are also bounded +% below by \cs{mintagsep}. +% +% Next, we examine each line of the environment that has a tag to +% see if there is a gap of at least \cs{mintagsep} between the +% equation and its tag. If there isn't, we attempt to center the +% equation between the tag and the opposite margin, leaving a gap +% of at least \cs{mintagsep} on either side, in order to preserve +% some symmetry, i.e., we want the equation to \emph{look} like +% it's centered between the margin and the tag, so we don't want +% the margin space to be less than the gap between the tag and the +% equation. (Arguably, it would be better to allow the margin +% space to shrink to zero in this case in order to avoid shifting +% the tag to a separate line at any cost, but that would require +% all of our calculations to be a little more complicated and hence +% a little slower.) Finally, if no values of the interalign spaces +% and the margins (with the constraints outlined above) will +% produce an acceptable distance between the equation and its tag, +% then the tag will be shifted to a separate line. +% +% \begin{macro}{\measure@} +% \cs{measure@} collects the various bits of information that we'll +% need to perform the calculations outlined above, namely, the +% number of align structures in the environment, the natural +% lengths of the fields on each row, the maximum widths of each +% column, and the widths of the equation tags on each line. It +% also calculates the number of flexible interalign and margin +% spaces and computes the initial values of the parameters +% \cs{eqnshift@} and \cs{alignsep@}, which correspond to the widths +% of the margins and the interalign spaces, respectively. +% \begin{macrocode} +\def\measure@#1{% + \begingroup + \measuring@true + \global\eqnshift@\z@ + \global\alignsep@\z@ + \global\let\tag@lengths\@empty + \global\let\field@lengths\@empty + \savecounters@ + \global\setbox0\vbox{% + \let\math@cr@@@\math@cr@@@align@measure + \everycr{\noalign{\global\tag@false + \global\let\raise@tag\@empty \global\column@\z@}}% + \let\label\@gobble + \global\row@\z@ + \tabskip\z@ + \halign{\span\align@preamble\crcr + #1% + \math@cr@@@ + \global\column@\z@ + \add@amps\maxfields@\cr + }% + }% + \restorecounters@ +% \end{macrocode} +% It's convenient to have \cs{maxfields@} rounded up to the nearest +% even number, so that \cs{maxfields@} is precisely twice the +% number of align structures. +% \begin{macrocode} + \ifodd\maxfields@ + \global\advance\maxfields@\@ne + \fi +% \end{macrocode} +% It doesn't make sense to have a single align structure in either +% \env{flalign} or \env{xxalignat}. So, we check for that case now +% and, if necessary, switch to an \env{align} or \env{alignat}. +% Arguably, we should issue a warning message, but why bother? +% \begin{macrocode} + \ifnum\xatlevel@=\tw@ + \ifnum\maxfields@<\thr@@ + \let\xatlevel@\z@ + \fi + \fi +% \end{macrocode} +% |\box0| now contains the lines of the \cs{halign}. After the +% following maneuver, |\box1| will contain the last line of the +% \cs{halign}, which is what we're interested in. (Incidentally, +% the penalty we're removing is the \cs{@eqpen} inserted by +% \cs{math@cr}. Normally, this is \cs{interdisplaylinepenalty}, +% unless the user has overridden that with a \cs{displaybreak} +% command.) +% \begin{macrocode} + \setbox\z@\vbox{% + \unvbox\z@ \unpenalty \global\setbox\@ne\lastbox + }% +% \end{macrocode} +% |\box1| begins with \cs{tabskip} glue and contains alternating +% \cs{hbox}es (the fields whose widths we're trying to get) and +% \cs{tabskip} glue [need better diagram]: +% \begin{verbatim} +% \hbox{\tabskip\hbox\tabskip...\hbox\tabskip}\end{verbatim} +% In fact, all the \cs{tabskip} glue will be 0pt, because all the +% \cs{tabskip}s in an \env{alignat} environment have a natural +% width of 0pt, and the \cs{halign} has been set in its natural +% width. +% +% One nice result of this is that we can read \cs{totwidth@} off +% immediately, since it is just the width of |\box1|, plus +% \cs{@mathmargin} if we're in \opt{fleqn} mode. (Actually, we +% also have to take \cs{minalignsep} into account, but we'll do +% that later): +% \begin{macrocode} + \global\totwidth@\wd\@ne + \if@fleqn \global\advance\totwidth@\@mathmargin \fi +% \end{macrocode} +% Now we initialize \cs{align@lengths} and start peeling the boxes +% off, one by one, and adding their widths to \cs{align@lengths}. +% We stop when we run out of boxes, i.e., when \cs{lastbox} returns +% a void box. We're going to build a list using \cs{or} as a +% delimiter, so we want to disable it temporarily. +% \begin{macrocode} + \global\let\maxcolumn@widths\@empty + \begingroup + \let\or\relax + \loop + \global\setbox\@ne\hbox{% + \unhbox\@ne \unskip \global\setbox\thr@@\lastbox + }% + \ifhbox\thr@@ + \xdef\maxcolumn@widths{ \or \the\wd\thr@@ \maxcolumn@widths}% + \repeat + \endgroup +% \end{macrocode} +% Now we calculate the number of flexible spaces and the initial +% values of \cs{eqnshift@} and \cs{alignsep@}. +% We start by calculating $\cs{displaywidth}-\cs{totwidth@}$, +% which gives us the total amount of ``free space'' in a row. +% \begin{macrocode} + \dimen@\displaywidth + \advance\dimen@-\totwidth@ +% \end{macrocode} +% Next we calculate the number of columns of flexible spaces in the +% display, which depends on whether we're in \opt{fleqn} mode and +% in which particular environment we are in. +% +% We use \cs{@tempcnta} to store the total number of flexible spaces +% in the align and \cs{@tempcntb} for the number of interalign +% spaces. +% \begin{macrocode} + \ifcase\xatlevel@ +% \end{macrocode} +% In \env{alignat}, the interalign spaces are under user control, +% not ours. So, we set \cs{alignsep@} and \cs{minalignsep} both +% equal to 0pt. Later, when calculating a new value for +% \cs{alignsep@}, we will only save the new value if it is less +% than the current value of \cs{alignsep@} (i.e., \cs{alignsep@} +% will never increase). Since the values we calculate will never +% be negative, this will ensure that \cs{alignsep@} remains zero in +% \env{alignat}. +% \begin{macrocode} + \global\alignsep@\z@ + \let\minalignsep\z@ + \@tempcntb\z@ +% \end{macrocode} +% In \opt{fleqn} mode, the left margin---and hence the right margin +% in this case---is fixed. Otherwise, we divide the free space +% equally between the two margins. +% \begin{macrocode} + \if@fleqn + \@tempcnta\@ne + \global\eqnshift@\@mathmargin + \else + \@tempcnta\tw@ + \global\eqnshift@\dimen@ + \global\divide\eqnshift@\@tempcnta + \fi + \or +% \end{macrocode} +% In an \env{align} or \env{xalignat} environment with $n$ aligned +% structures, there are $n-1$ interalign spaces and either 1 or~2 +% flexible margins, depending on whether we're in \opt{fleqn} mode +% or not. +% \begin{macrocode} + \@tempcntb\maxfields@ + \divide\@tempcntb\tw@ + \@tempcnta\@tempcntb + \advance\@tempcntb\m@ne +% \end{macrocode} +% If we are in \opt{fleqn} mode, we fix the left margin and divide +% the free space equally among the interalign spaces and the right +% margin. +% \begin{macrocode} + \if@fleqn + \global\eqnshift@\@mathmargin + \global\alignsep@\dimen@ + \global\divide\alignsep@\@tempcnta + \else +% \end{macrocode} +% Otherwise, we divide the free space equally among the interalign +% spaces and both margins. +% \begin{macrocode} + \global\advance\@tempcnta\@ne + \global\eqnshift@\dimen@ + \global\divide\eqnshift@\@tempcnta + \global\alignsep@\eqnshift@ + \fi + \or +% \end{macrocode} +% Finally, if we're in an \env{flalign} or \env{xxalignat} +% environment, there are no flexible margins and $n-1$ flexible +% interalign spaces. +% \begin{macrocode} + \@tempcntb\maxfields@ + \divide\@tempcntb\tw@ + \global\advance\@tempcntb\m@ne + \global\@tempcnta\@tempcntb + \global\eqnshift@\z@ + \global\alignsep@\dimen@ +% \end{macrocode} +% If we're in \opt{fleqn} mode, we need to add back the +% \cs{@mathmargin} that was removed when \cs{dimen@} was originally +% calculated above. +% \begin{macrocode} + \if@fleqn + \global\advance\alignsep@\@mathmargin\relax + \fi + \global\divide\alignsep@\@tempcntb + \fi +% \end{macrocode} +% Now we make sure \cs{alignsep@} isn't too small. +% \begin{macrocode} + \ifdim\alignsep@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \ifdim\eqnshift@>\z@ + \if@fleqn\else + \global\eqnshift@\displaywidth + \global\advance\eqnshift@-\totwidth@ + \global\advance\eqnshift@-\@tempcntb\alignsep@ + \global\divide\eqnshift@\tw@ + \fi + \fi + \fi + \ifdim\eqnshift@<\z@ + \global\eqnshift@\z@ + \fi + \calc@shift@align +% \end{macrocode} +% Next, we calculate the value of \cs{tagshift@}. This is the glue +% that will be inserted in front of the equation tag to make sure +% it lines up flush against the appropriate margin. +% \begin{macrocode} + \global\tagshift@\totwidth@ + \global\advance\tagshift@\@tempcntb\alignsep@ + \if@fleqn + \ifnum\xatlevel@=\tw@ + \global\advance\tagshift@-\@mathmargin\relax + \fi + \else + \global\advance\tagshift@\eqnshift@ + \fi + \iftagsleft@ \else + \global\advance\tagshift@-\displaywidth + \fi +% \end{macrocode} +% Finally, we increase \cs{totwidth@} by an appropriate multiple of +% \cs{minalignsep}. If the result is greater than +% \cs{displaywidth}, it means that at least one line in the +% \env{align} is overfull and we will issue an appropriate warning +% message (via \cs{bl@ck}) at the end of the environment. +% \begin{macrocode} + \dimen@\minalignsep\relax + \global\advance\totwidth@\@tempcntb\dimen@ + \ifdim\totwidth@>\displaywidth + \global\let\displaywidth@\totwidth@ + \else + \global\let\displaywidth@\displaywidth + \fi + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% The code for calculating the appropriate placement of equation +% tags in the \env{align} environments is quite complicated and +% varies wildly depending on the settings of the |tagsleft@| and +% |@fleqn| switches. To minimize memory and hash space usage, we +% only define the variant appropriate for the current setting of +% those switches. +% +% It would be worthwhile to examine this code more closely someday +% and see if it could be optimized any. +% +% \paragraph{Tag placement when \cs{tagsleft@true}, +% \cs{@fleqntrue}.} +% +% We begin with the version of \cs{calc@shift@align} appropriate +% for flush-left equations with tags on the left. +% +% \begin{macro}{\calc@shift@align} +% This is the simplest case. Since the left margin is fixed, in +% general the only thing to do is check whether there is room for +% the tag in the left margin. The only exception is that if +% $\cs{eqnshift@} = 0\,\mathrm{pt}$---meaning that we're in a +% \env{flalign} environment and this is the first line with a tag +% that we've encountered---then we set $\cs{eqnshift@} = +% \cs{@mathmargin}$ and recalculate \cs{alignsep@}. This is done +% by \cs{x@calc@shift@lf}. +% \begin{macrocode} +\iftagsleft@\if@fleqn + \def\calc@shift@align{% + \global\let\tag@shifts\@empty + \begingroup +% \end{macrocode} +% \cs{@tempdima} is initialized to $\cs{@mathmargin} - +% \cs{mintagsep}$, which yields the maximum size of a tag that will +% not be shifted to another line. +% \begin{macrocode} + \@tempdima\@mathmargin\relax + \advance\@tempdima-\mintagsep\relax +% \end{macrocode} +% Now we examine each row in turn. If the width of the tag on the +% line is non-positive---meaning either that there is no tag or +% else that the user has forced it to have zero width---we mark the +% tag to remain unshifted. Otherwise, we call \cs{x@calc@shift@lf} +% to determine whether any adjustments need to be made to +% \cs{eqnshift@} and \cs{alignsep@}. Note the difference in +% treatment of zero-width tags between this code and \tex/'s +% built-in algorithm: here, a width of zero prohibits the tag from +% being shifted, while in \tex/'s built-in algorithm, a width of +% zero forces the tag to be shifted. +% \begin{macrocode} + \loop + \ifnum\row@>0 + \ifdim\tag@width\row@>\z@ + \x@calc@shift@lf + \else + \saveshift@0% + \fi + \advance\row@\m@ne + \repeat + \endgroup + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x@calc@shift@lf} +% As mentioned above, \cs{x@calc@shift@lf} first checks to see if +% the current left margin is set to 0 and, if so, resets it to +% \cs{@mathmargin} and recalculates \cs{alignsep@}. Next, it +% checks whether the length of the current tag exceeds the +% previously calculated limit and, if so, marks the tag to be +% shifted to a separate line. +% \begin{macrocode} + \def\x@calc@shift@lf{% + \ifdim\eqnshift@=\z@ + \global\eqnshift@\@mathmargin\relax + \alignsep@\displaywidth + \advance\alignsep@-\totwidth@ + \global\divide\alignsep@\@tempcntb + \ifdim\alignsep@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \fi + \fi + \ifdim\tag@width\row@>\@tempdima + \saveshift@1% + \else + \saveshift@0% + \fi + } +\fi\fi +% \end{macrocode} +% \end{macro} +% +% \paragraph{Tag placement when \cs{tagsleft@false}, +% \cs{@fleqntrue}.} +% +% Next we consider the case when equations are flush-left, but tags +% are on the right. This case is somewhat more complicated than +% the previous one, since we can adjust the right margin by varying +% the inter-align separatin. Thus, when a tag is found to be too +% close to its equation, we first attempt to decrease +% \cs{alignsep@} enough to move the equation off to an acceptable +% distance. Only if that would require a value of \cs{alignsep@} +% less than \cs{minalignsep} do we move the tag to a separate line. +% +% \begin{macro}{\calc@shift@align} +% This version of \cs{calc@shift@align} differs from the previous +% version only in calling \cs{x@calc@shift@rf} rather than +% \cs{x@calc@shift@lf}. +% \begin{macrocode} +\iftagsleft@\else\if@fleqn + \def\calc@shift@align{% + \global\let\tag@shifts\@empty + \begingroup + \loop + \ifnum\row@>0 + \ifdim\tag@width\row@>\z@ + \x@calc@shift@rf + \else + \saveshift@0% + \fi + \advance\row@\m@ne + \repeat + \endgroup + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x@calc@shift@rf} +% To start, we need to know two quantities: the number of align +% structures in the current row and the ``effective length'' of the +% row, defined as the distance from the left margin to the +% right edge of the text assuming that \cs{eqnshift@} and +% \cs{alignsep@} are both~0. To get the number of align +% structures, we first count the number of columns by counting the +% number of entries in the \cs{fieldlengths@} for the current row. +% The effective length is calcuated by \cs{x@rcalc@width} and put +% in the temporary register \cs{@tempdimc}, using \cs{@tempdimb} as +% an auxiliary variable. +% \begin{macrocode} + \def\x@calc@shift@rf{% + \column@\z@ + \@tempdimb\z@ + \@tempdimc\z@ + \edef\@tempb{\fieldlengths@\row@}% + \@for\@tempa:=\@tempb\do{% + \advance\column@\@ne + \x@rcalc@width + }% + \begingroup +% \end{macrocode} +% If there are $n$ columns in the current row, then there are +% $\lfloor (n+1)/2 \rfloor$ align structures and $\lfloor (n-1)/2 +% \rfloor$ interalign spaces. +% \begin{macrocode} + \advance\column@\m@ne + \divide\column@\tw@ +% \end{macrocode} +% If this is smaller than the maximum number of interalign spaces +% in the environment, then we need to reduce \cs{@tempcnta} (the +% total number of flexible spaces in the current line) by +% $\cs{@tempcntb} - \cs{column@}$ and reset \cs{@tempcntb} to +% \cs{column@}. +% \begin{macrocode} + \ifnum\@tempcntb>\column@ + \advance\@tempcnta-\@tempcntb + \advance\@tempcnta\column@ + \@tempcntb\column@ + \fi +% \end{macrocode} +% Next, we add the width of the tag and the (fixed) left margin to +% the effective length calculated above. This can be used to +% calculate how much ``free space'' there is in the current line +% and thus how much leeway we have to increase the amount of space +% between the tag and the equation. +% \begin{macrocode} + \tagwidth@\tag@width\row@\relax + \@tempdima\eqnshift@ + \advance\@tempdima\@tempdimc\relax + \advance\@tempdima\tagwidth@ +% \end{macrocode} +% The first thing to check is whether the tag should be shifted to +% a separate line. To do this, we add the minimum interalign +% separation and the \cs{mintagsep} to the value of \cs{@tempdima} +% just calculated. This yields the minimum acceptable length of +% the current line. If that is greater than \cs{displaywidth}, we +% mark the tag to be calculated. Otherwise, we mark the tag to be +% kept on the same line and then check to see if the \cs{alignsep@} +% needs to be reduced to make room for the tag. +% \begin{macrocode} + \dimen@\minalignsep\relax + \multiply\dimen@\@tempcntb + \advance\dimen@\mintagsep\relax + \advance\dimen@\@tempdima + \ifdim\dimen@>\displaywidth + \saveshift@1% + \else + \saveshift@0% +% \end{macrocode} +% Now we perform essentially the same calculation, but using the +% current value of \cs{alignsep@} instead of \cs{minalignsep}. +% This gives the current length of the line. If this is greater +% than \cs{displaywidth}, we recalculate \cs{alignsep@} to make +% room for the tag. +% \begin{macrocode} + \dimen@\alignsep@\relax + \multiply\dimen@\@tempcntb + \advance\dimen@\@tempdima + \advance\dimen@\tagwidth@ + \ifdim\dimen@>\displaywidth + \dimen@\displaywidth + \advance\dimen@-\@tempdima + \ifnum\xatlevel@=\tw@ + \advance\dimen@-\mintagsep\relax + \fi + \divide\dimen@\@tempcnta + \ifdim\dimen@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \else + \global\alignsep@\dimen@ + \fi + \fi + \fi + \endgroup + } +\fi\fi +% \end{macrocode} +% \end{macro} +% +% \paragraph{Tag placement when \cs{tagsleft@false}, +% \cs{@fleqnfalse}.} +% +% This is similar to the previous case, except for the added +% complication that both \cs{alignsep@} and \cs{eqnshift@} can +% vary, which makes the computations correspondingly more +% complicated. +% +% \begin{macro}{\calc@shift@align} +% \begin{macrocode} +\iftagsleft@\else\if@fleqn\else + \def\calc@shift@align{% + \global\let\tag@shifts\@empty + \begingroup + \loop + \ifnum\row@>0 + \ifdim\tag@width\row@>\z@ + \x@calc@shift@rc + \else + \saveshift@0% + \fi + \advance\row@\m@ne + \repeat + \endgroup + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x@calc@shift@rc} +% \begin{macrocode} + \def\x@calc@shift@rc{% + \column@\z@ + \@tempdimb\z@ + \@tempdimc\z@ + \edef\@tempb{\fieldlengths@\row@}% + \@for\@tempa:=\@tempb\do{% + \advance\column@\@ne + \x@rcalc@width + }% + \begingroup + \advance\column@\m@ne + \divide\column@\tw@ + \ifnum\@tempcntb>\column@ + \advance\@tempcnta-\@tempcntb + \advance\@tempcnta\column@ + \@tempcntb\column@ + \fi + \tagwidth@\tag@width\row@\relax + \@tempdima\@tempdimc + \advance\@tempdima\tagwidth@ + \dimen@\minalignsep\relax + \multiply\dimen@\@tempcntb + \advance\dimen@\mintagsep\relax + \ifnum\xatlevel@=\tw@ \else + \advance\dimen@\mintagsep\relax + \fi + \advance\dimen@\@tempdima + \ifdim\dimen@>\displaywidth + \saveshift@1% + \else + \saveshift@0% + \dimen@\eqnshift@ + \advance\dimen@\@tempdima + \advance\dimen@\@tempcntb\alignsep@ + \advance\dimen@\tagwidth@ + \ifdim\dimen@>\displaywidth + \dimen@\displaywidth + \advance\dimen@-\@tempdima + \ifnum\xatlevel@=\tw@ + \advance\dimen@-\mintagsep\relax + \fi + \divide\dimen@\@tempcnta + \ifdim\dimen@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \eqnshift@\displaywidth + \advance\eqnshift@-\@tempdima + \advance\eqnshift@-\@tempcntb\alignsep@ + \global\divide\eqnshift@\tw@ + \else + \ifdim\dimen@<\eqnshift@ + \ifdim\dimen@<\z@ + \global\eqnshift@\z@ + \else + \global\eqnshift@\dimen@ + \fi + \fi + \ifdim\dimen@<\alignsep@ + \global\alignsep@\dimen@ + \fi + \fi + \fi + \fi + \endgroup + } +\fi\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x@rcalc@width} +% \begin{macrocode} +\iftagsleft@\else + \def\x@rcalc@width{% + \ifdim\@tempa > \z@ + \advance\@tempdimc\@tempdimb + \ifodd\column@ + \advance\@tempdimc\maxcol@width\column@ + \@tempdimb\z@ + \else + \advance\@tempdimc\@tempa\relax + \@tempdimb\maxcol@width\column@ + \advance\@tempdimb-\@tempa\relax + \fi + \else + \advance\@tempdimb\maxcol@width\column@\relax + \fi + } +\fi +% \end{macrocode} +% \end{macro} +% +% \paragraph{Tag placement when \cs{tagsleft@true}, +% \cs{@fleqnfalse}.} +% +% \begin{macro}{\calc@shift@align} +% \begin{macrocode} +\iftagsleft@\if@fleqn\else + \def\calc@shift@align{% + \global\let\tag@shifts\@empty + \begingroup + \loop + \ifnum\row@>\z@ + \ifdim\tag@width\row@>\z@ + \x@calc@shift@lc + \else + \saveshift@0% + \fi + \advance\row@\m@ne + \repeat + \endgroup + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x@calc@shift@lc} +% \begin{macrocode} + \def\x@calc@shift@lc{% + \column@\z@ +% \end{macrocode} +% \cs{@tempdima} will (eventually) be set to the effective width of +% the current row, defined as the distance from the leftmost point +% of the current line to the end of the last field of the +% \cs{halign}, ignoring any intervening \cs{tabskip}s, plus the +% width of the current tag. That is, it will be the width of the +% first non-empty field plus the sum of the maximum widths of all +% following fields, plus the tag width. +% +% \cs{@tempdimb} will be the ``indentation'' of leftmost end of +% text, ignoring the \cs{tabskip} glue, i.e., it will be the sum of +% the maximum widths of any fields to the left of the first +% non-empty field, plus whatever empty space there is at the +% beginning of the first non-empty field. +% \begin{macrocode} + \@tempdima\z@ % ``width of equation'' + \@tempdimb\z@ % ``indent of equation'' + \edef\@tempb{\fieldlengths@\row@}% + \@for\@tempa:=\@tempb\do{% + \advance\column@\@ne + \x@lcalc@width + }% + \begingroup + \tagwidth@\tag@width\row@\relax +% \end{macrocode} +% \cs{@tempdima} is now easy to calculate, since it is just +% $\cs{totwidth@} - \cs{@tempdimb} + \cs{tagwidth@}$. +% \begin{macrocode} + \@tempdima\totwidth@ + \advance\@tempdima-\@tempdimb + \advance\@tempdima\tagwidth@ +% \end{macrocode} +% Next, we check to see whether there is room for both the equation +% and the tag on the same line, by calculating the minimum +% acceptable length of the current row and comparing that to +% \cs{displaywidth}. Note that here we use \cs{@tempcntb}, i.e., +% the number of interalign spaces after the first non-empty align +% structure. +% \begin{macrocode} + \dimen@\minalignsep\relax + \multiply\dimen@\@tempcntb + \advance\dimen@\mintagsep\relax + \ifnum\xatlevel@=\tw@ \else + \advance\dimen@\mintagsep\relax + \fi + \advance\dimen@\@tempdima +% \end{macrocode} +% If the minimum acceptable width of the current line is greater +% than \cs{displaywidth}, we mark the current tag to be shifted to +% a separate line. +% \begin{macrocode} + \ifdim\dimen@>\displaywidth + \saveshift@1% + \else +% \end{macrocode} +% Otherwise, the tag can stay on the same line as the equation, but +% we need to check whether it is too close to the equation. So, we +% calculate the distance between the left margin and the left side +% of the equation, using the current values of \cs{eqnshift@} and +% \cs{alignsep@}. Note that we use \cs{count@} here, not +% \cs{@tempcntb}, as above. +% \begin{macrocode} + \saveshift@0% + \dimen@\alignsep@ + \multiply\dimen@\count@ + \advance\dimen@\eqnshift@ + \advance\dimen@\@tempdimb +% \end{macrocode} +% If the left margin is less than twice the tag width, we calculate +% new values of \cs{eqnshift@} and \cs{alignsep@} to move the +% equation further away from the tag. In particular, we center the +% current line between its tag and the right margin. Note that +% although we later will need to transform \cs{dimen@} into a value +% suitable for use as \cs{eqnshift@}, for the time being it is more +% useful to think of it as the space separating the tag from the +% equation. +% \begin{macrocode} + \ifdim\dimen@<2\tagwidth@ + \dimen@\displaywidth + \advance\dimen@-\@tempdima + \ifnum\xatlevel@=\tw@ + \advance\dimen@-\mintagsep\relax + \fi +% \end{macrocode} +% In certain circumstances we will get a divide-by-zero error here +% unless we guard against it. Use of \cs{@tempcnta} is complicated, +% sometimes it is assigned globally, sometimes locally. Need to sort +% it out one of these days [mjd,2000/06/02]. +% \begin{macrocode} + \ifnum\@tempcnta>\z@ + \divide\dimen@\@tempcnta + \else \dimen@\z@ + \fi +% \end{macrocode} +% As usual, we check to make sure we don't set \cs{alignsep@} +% smaller than \cs{minalignsep} and, in any case, that we don't +% replace \cs{alignsep@} by a larger value. +% \begin{macrocode} + \ifdim\dimen@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \dimen@\displaywidth + \advance\dimen@-\@tempdima + \advance\dimen@-\@tempcntb\alignsep@ + \global\divide\dimen@\tw@ + \else + \ifdim\dimen@<\alignsep@ + \global\alignsep@\dimen@ + \fi + \fi +% \end{macrocode} +% Next, we calculate an appropriate value of \cs{eqnshift@}, +% assuming that \cs{dimen@} is the desired separation between the +% tag and equation of the current line. This means that we first +% need to adjust \cs{dimen@} if we're in an \env{flalign} +% environment. +% \begin{macrocode} + \ifnum\xatlevel@=\tw@ + \dimen@\mintagsep\relax + \fi +% \end{macrocode} +% Now we calculate the value of \cs{eqnshift@} needed to produce a +% separation of \cs{dimen@} between the equation tag and the +% beginning of the equation. To do this, we need the following +% equation to hold: +% \[ +% \cs{eqnshift@} + n\cs{alignsep@} + \cs{@tempdimb} +% = \cs{tagwidth@} + \cs{dimen@} +% \] +% where $n = \cs{count@}$ is the number of interalign spaces before +% the first non-empty field of the current line. +% \begin{macrocode} + \advance\dimen@\tagwidth@ + \advance\dimen@-\@tempdimb + \advance\dimen@-\count@\alignsep@ +% \end{macrocode} +% The value of \cs{eqnshift@} just calculated is the minimum +% acceptable value; thus, we save it only if it is larger than the +% current value. +% \begin{macrocode} + \ifdim\dimen@>\eqnshift@ + \global\eqnshift@\dimen@ + \fi + \fi + \fi + \endgroup + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x@lcalc@width} +% This macro calculates the ``indentation'' of the current row, as +% defined above under the description of \cs{x@calc@shift@lc}. +% This macro is called for each field of the current line, with +% \cs{@tempa} set to the width of the current field. Ideally, the +% loop enclosing \cs{x@lcalc@width} would terminate as soon as +% \cs{@tempa} is non-zero, but that would be a bit tricky to +% arrange. Instead, we use \cs{@tempdima} as a flag to signal when +% we've encountered the first non-empty field. +% +% \begin{macrocode} + \def\x@lcalc@width{% + \ifdim\@tempdima = \z@ +% \end{macrocode} +% If the current field is empty (i.e., $\cs{@tempa} = +% \mathrm{0\,pt}$, then we increment \cs{@tempdimb} by the width of +% the current field). Otherwise, we set $\cs{@tempdima} = +% \mathrm{1\,pt}$ as a signal value and increment \cs{@tempdimb} by +% the width of whatever empty space there might be at the left of +% the current field. +% \begin{macrocode} + \ifdim\@tempa > \z@ + \@tempdima\p@ + \ifodd\column@ + \advance\@tempdimb \maxcol@width\column@ + \advance\@tempdimb-\@tempa + \fi +% \end{macrocode} +% In addition, we need to adjust the values of \cs{@tempcnta} and +% \cs{@tempcntb} to account for any empty align structures that +% might occur at the beginning of the current line. More +% specifically, we first set \cs{count@} equal to the number of +% interalign spaces preceding the current field (namely, $\lfloor +% (\cs{\column@}-1)/2 \rfloor$), and then subtract \cs{count@} from +% both \cs{@tempcnta} and \cs{@tempcntb}. The rationale is that +% for the purposes of adjusting the spacing between the tag and the +% equation, the only flexible interalign spaces are those after +% the first non-empty align structure, so we need to treat those +% different from the ones before the first non-empty align +% structure. +% \begin{macrocode} + \count@\column@ + \advance\count@\m@ne + \divide\count@\tw@ + \advance\@tempcnta-\count@ + \advance\@tempcntb-\count@ + \else + \advance\@tempdimb \maxcol@width\column@\relax + \fi + \fi + } +\fi\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\place@tag} +% \cs{place@tag} takes care of the placment of tags in the +% \env{align} environments. +% \begin{macrocode} +\def\place@tag{% + \iftagsleft@ + \kern-\tagshift@ + \if1\shift@tag\row@\relax + \rlap{\vbox{% + \normalbaselines + \boxz@ + \vbox to\lineht@{}% + \raise@tag + }}% + \else + \rlap{\boxz@}% + \fi + \kern\displaywidth@ + \else + \kern-\tagshift@ + \if1\shift@tag\row@\relax +% \end{macrocode} +% Added depth to correct vertical spacing of shifted +% equation tags.---dmj, 1994/12/29 +% \begin{macrocode} + \llap{\vtop{% + \raise@tag + \normalbaselines + \setbox\@ne\null + \dp\@ne\lineht@ + \box\@ne + \boxz@ + }}% + \else + \llap{\boxz@}% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\align@preamble} +% \begin{macrocode} +\def\align@preamble{% + &\hfil + \strut@ + \setboxz@h{\@lign$\m@th\displaystyle{##}$}% + \ifmeasuring@\savefieldlength@\fi + \set@field + \tabskip\z@skip + &\setboxz@h{\@lign$\m@th\displaystyle{{}##}$}% + \ifmeasuring@\savefieldlength@\fi + \set@field + \hfil + \tabskip\alignsep@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\set@field} +% \cs{set@field} increments the column counter, tracks the value of +% \cs{lineht@} and finally inserts the box containing the contents +% of the current field. +% \begin{macrocode} +\def\set@field{% + \column@plus + \iftagsleft@ + \ifdim\ht\z@>\lineht@ + \global\lineht@\ht\z@ + \fi + \else + \ifdim\dp\z@>\lineht@ + \global\lineht@\dp\z@ + \fi + \fi + \boxz@ +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection {The \env{split} environment} +% +% \begin{macro}{\split@err} +% A special error function for \env{split} to conserve main mem (at a +% cost of string pool/hash size. +% \begin{macrocode} +\edef\split@err#1{% + \@nx\@amsmath@err{% + \string\begin{split} won't work here% + }{% + \@xp\@nx\csname + Did you forget a preceding \string\begin{equation}?^^J% + If not, perhaps the `aligned' environment is what + you want.\endcsname}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{split} +% If the \env{split} environment occurs inside \env{align} or +% \env{gather}, it can make use of the enclosing halign; if it is +% called inside a simple equation, we add an implicit `gather' +% container. +% +% \begin{macrocode} +\newenvironment{split}{% + \if@display + \ifinner + \@xp\@xp\@xp\split@aligned + \else + \ifst@rred \else \global\@eqnswtrue \fi + \fi + \else \let\endsplit\@empty \@xp\collect@body\@xp\split@err + \fi + \collect@body\gather@split +}{% + \crcr + \egroup + \egroup + \iftagsleft@ \@xp\lendsplit@ \else \@xp\rendsplit@ \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\let\split@tag\relax % init +% \end{macrocode} +% +% \begin{macrocode} +\def\gather@split#1#2#3{% + \@xp\endgroup \reset@equation % math@cr will handle equation numbering + \iftag@ + \toks@\@xp{\df@tag}% + \edef\split@tag{% + \gdef\@nx\df@tag{\the\toks@}% + \global\@nx\tag@true \@nx\nonumber + }% + \else \let\split@tag\@empty + \fi + \spread@equation +% \end{macrocode} +% The extra vcenter wrapper here is not really a good thing but +% without it there are compatibility problems with old documents that +% throw in some extra material between \verb'\begin{equation}' and +% \verb'\begin{split}' (for example, \verb'\hspace{-1pc}' or +% \verb'\left\{'). [mjd,1999/09/20] +% \begin{macrocode} + \vcenter\bgroup + \gather@{\split@tag \begin{split}#1\end{split}}% + \def\endmathdisplay@a{% + \math@cr \black@ \totwidth@ \egroup + \egroup + }% +} +% \end{macrocode} +% +% \end{environment} +% +% \begin{macro}{\insplit@} +% \begin{macrocode} +\def\insplit@{% + \global\setbox\z@\vbox\bgroup + \Let@ \chardef\dspbrk@context\@ne \restore@math@cr + \default@tag % disallow use of \tag here + \ialign\bgroup + \hfil + \strut@ + $\m@th\displaystyle{##}$% + &$\m@th\displaystyle{{}##}$% + \hfill % Why not \hfil?---dmj, 1994/12/28 + \crcr +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\rendsplit@} +% Moved the box maneuvers inside the \cs{ifinalign@}, since that is +% the only place they are needed.---dmj, 1994/12/28 +% +% TODO: Explore interaction of tag-placement algorithm with +% \env{split}. Is there any way for \env{split} to pass the +% relevant information out to the enclosing \env{gather} or +% \env{align}? +% \begin{macrocode} +\def\rendsplit@{% + \ifinalign@ +% \end{macrocode} +% Changed |\box9| into a \cs{vtop} here for better spacing. +% \begin{macrocode} + \global\setbox9 \vtop{% + \unvcopy\z@ + \global\setbox8 \lastbox + \unskip + }% + \setbox\@ne\hbox{% + \unhcopy8 + \unskip + \global\setbox\tw@\lastbox + \unskip + \global\setbox\thr@@\lastbox + }% + \ifctagsplit@ + \gdef\split@{% + \hbox to\wd\thr@@{}% + &\vcenter{\vbox{\moveleft\wd\thr@@\boxz@}}% + }% + \else + \global\setbox7 \hbox{\unhbox\tw@\unskip}% +% \end{macrocode} +% Added \cs{add@amps} to make sure we put the last line of the +% \env{split} into the proper column of an \env{align} environment +% with multiple align structures.---dmj, 1994/12/28 +% +% Special care has to be taken in this case because the \env{split} +% turns into two lines of the \env{align} instead of just one. So, +% we have to make sure that the first line produced by the +% \env{split} doesn't upset our bookkeeping, hence we call +% \cs{savetaglength@} to insert 0\,pt as the tag for this +% pseudo-line, and we advance the \cs{row@} counter and reset +% \cs{lineht@} afterwards. It would be nice if we could just +% replace the \cs{crcr} by \cs{math@cr@@@}, but that would cause +% problems with the tag processing. +% \begin{macrocode} + \gdef\split@{% + \global\@tempcnta\column@ + &\setboxz@h{}% + \savetaglength@ + \global\advance\row@\@ne + \vbox{\moveleft\wd\thr@@\box9}% + \crcr + \noalign{\global\lineht@\z@}% + \add@amps\@tempcnta + \box\thr@@ + &\box7 + }% + \fi + \else + \ifctagsplit@ + \gdef\split@{\vcenter{\boxz@}}% + \else +% \end{macrocode} +% Changed to just \cs{boxz@}, otherwise last line gets centered +% rather than aligned properly with respect to the rest of the +% lines. But this means that we can't see inside of the last line +% to decide whether the tag needs to be moved. Will have to think +% about this.---dmj, 1994/12/28 +% \begin{macrocode} + \gdef\split@{% + \boxz@ +% \box9 +% \crcr +% \hbox{\box\thr@@\box7}% + }% + \fi + \fi + \aftergroup\split@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\lendsplit@} +% \begin{macrocode} +\def\lendsplit@{% + \global\setbox9\vtop{\unvcopy\z@}% + \ifinalign@ +% \end{macrocode} +% Moved following two boxes inside the \cs{ifinalign@}, since they +% are only used in that case. In fact, if we just kept track of +% the width of the first column, we could dispense with this +% entirely. Surely that would be more efficient than all these box +% copies.---dmj, 1994/12/28 +% \begin{macrocode} + \setbox\@ne\vbox{% + \unvcopy\z@ + \global\setbox8\lastbox + }% + \setbox\@ne\hbox{% + \unhcopy8% + \unskip + \setbox\tw@\lastbox + \unskip + \global\setbox\thr@@\lastbox + }% + \ifctagsplit@ + \gdef\split@{% + \hbox to\wd\thr@@{}% + &\vcenter{\vbox{\moveleft\wd\thr@@\box9}}% + }% + \else + \gdef\split@{% + \hbox to\wd\thr@@{}% + &\vbox{\moveleft\wd\thr@@\box9}% + }% + \fi + \else + \ifctagsplit@ + \gdef\split@{\vcenter{\box9}}% + \else + \gdef\split@{\box9}% + \fi + \fi + \aftergroup\split@ +} +% \end{macrocode} +% \end{macro} +% +% With \pkg{amsmath} 1.2 it was possible to put things like +% \verb'\left\{' between \verb'\begin{equation}' and +% \verb'\begin{split}' without getting any error message. For +% backward compatibility we try to avoid a fatal error in this case +% and instead attempt recovery with \env{aligned}. +% \begin{macrocode} +\def\split@aligned#1#2{% + \iffalse{\fi\ifnum0=`}\fi + \collect@body\split@al@a} +% \end{macrocode} +% +% \begin{macrocode} +\def\split@al@a#1#2#3{% + \split@warning + \endgroup +% \end{macrocode} +% If the \opt{fleqn} and \opt{tbtags} options are both in effect then +% we will need to add an optional argument on the \env{aligned} +% environment. +% \begin{macrocode} + \toks@{\begin{aligned}}% + \if@fleqn \split@al@tagcheck \fi +% \end{macrocode} +% The \cs{relax} here is to prevent \cs{@let@token} from being left +% equal to an ampersand if that happens to be the first thing in the body. +% \begin{macrocode} + \the\toks@\relax#1\end{aligned}% + \ifnum0=`{\fi\iffalse}\fi +} +% \end{macrocode} +% +% \begin{macrocode} +\def\split@al@tagcheck{% + \ifctagsplit@ + \else + \iftagsleft@ \toks@\@xp{\the\toks@ [t]}% + \else \toks@\@xp{\the\toks@ [b]}% + \fi + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\def\split@warning{% + \PackageWarning{amsmath}{% +Cannot use `split' here;\MessageBreak trying to recover with `aligned'}% +} +% \end{macrocode} +% +% \subsection{The \env{multline} environment} +% +% In the original \amstex/, \cn{multlinegap} is a macro with an +% argument that resets an internal dimension (one with an \qc{\@} +% character in its name). Here, to save control sequence names, we +% define \cn{multlinegap} to be the dimension itself and the +% documentation instructs users to use \cn{setlength} if they +% need to change it. +% \begin{macro}{\multlinegap} +% \begin{macro}{\multlinetaggap} +% Changed \cs{multlinegap} and \cs{multlinetaggap} to skip +% registers. Also changed name to \cs{multlinetaggap} from +% \cs{multlinetaggap@}. +% \begin{macrocode} +\newskip\multlinegap +\multlinegap10pt +\newskip\multlinetaggap +\multlinetaggap10pt +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\start@multline} +% \begin{macrocode} +\def\start@multline#1{% + \RIfM@ + \nomath@env + \DN@{\@namedef{end\@currenvir}{}\@gobble}% + \else + $$% + #1% + \ifst@rred + \nonumber + \else + \global\@eqnswtrue + \fi + \let\next@\multline@ + \fi + \collect@body\next@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{multline} +% \begin{environment}{multline*} +% \begin{macrocode} +\newenvironment{multline}{% + \start@multline\st@rredfalse +}{% + \iftagsleft@ \@xp\lendmultline@ \else \@xp\rendmultline@ \fi + \ignorespacesafterend +} +% \end{macrocode} +% +% \begin{macrocode} +\newenvironment{multline*}{\start@multline\st@rredtrue}{\endmultline} +% \end{macrocode} +% \end{environment} +% \end{environment} +% +% \begin{macro}{\multline@} +% \begin{macrocode} +\def\multline@#1{% + \Let@ +% \end{macrocode} +% +% For multline neither \cs{displ@y} no \cs{displ@y@} is quite right; +% we want to advance the row number and (I suppose?) the +% display-pagebreak level, but we only want to do tag-related stuff +% once before the first line, not repeat it for every line. (Recall +% that the arg of \cs{@display@init} goes into \cs{everycr}.) +% \begin{macrocode} + \@display@init{\global\advance\row@\@ne \global\dspbrk@lvl\m@ne}% + \chardef\dspbrk@context\z@ + \restore@math@cr +% \end{macrocode} +% The \env{multline} environment is somewhat unusual, in that +% \cs{tag} and \cs{label} are enabled only during the measuring +% phase and disabled during the production phase. +% Here we disable \cs{tag} and \cs{label}; \cs{mmeasure@} will +% re-enable them temporarily. +% \begin{macrocode} + \let\tag\tag@in@align + \global\tag@false \global\let\raise@tag\@empty + \mmeasure@{#1}% + \let\tag\gobble@tag \let\label\@gobble + \tabskip \if@fleqn \@mathmargin \else \z@skip \fi + \totwidth@\displaywidth + \if@fleqn + \advance\totwidth@-\@mathmargin + \fi + \halign\bgroup + \hbox to\totwidth@{% +% \end{macrocode} +% In order to get the spacing of the last line right in fleqn +% mode, we need to play a little game here. Normally the +% stretchability of the \cs{hskip} here will be suppressed by the +% \cs{hfil} at the end of the template, except inside the last line, +% when that \cs{hfil} will be removed by the \cs{hfilneg} in +% \cs{lendmultline@}. +% \begin{macrocode} + \if@fleqn + \hskip \@centering \relax + \else + \hfil + \fi + \strut@ + $\m@th\displaystyle{}##\endmultline@math + \hfil + }% + \crcr +% \end{macrocode} +% In \opt{fleqn} mode, it's the \cs{tabskip} of \cs{@mathmargin} +% that needs to be removed in the first line, not the \cs{hfil} at +% the beginning of the template. +% \begin{macrocode} + \if@fleqn + \hskip-\@mathmargin + \def\multline@indent{\hskip\@mathmargin}% put it back + \else + \hfilneg + \def\multline@indent{\hskip\multlinegap}% + \fi + \iftagsleft@ + \iftag@ + \begingroup + \ifshifttag@ + \rlap{\vbox{% + \normalbaselines + \hbox{% + \strut@ + \make@display@tag + }% + \vbox to\lineht@{}% + \raise@tag + }}% +% \end{macrocode} +% If the equation tag doesn't fit on the same line with the first +% line of the display, we'll indent the first line by +% \cn{multlinegap}. This is a change from \pkg{amstex}, where the +% first line would have been flush against the left margin in this +% case. A corresponding change will be made in \cs{rendmultline@}. +% \begin{macrocode} + \multline@indent + \else + \setbox\z@\hbox{\make@display@tag}% + \dimen@\@mathmargin \advance\dimen@-\wd\z@ + \ifdim\dimen@<\multlinetaggap + \dimen@\multlinetaggap + \fi + \box\z@ \hskip\dimen@\relax + \fi + \endgroup + \else + \multline@indent + \fi + \else + \multline@indent + \fi + #1% +} +% \end{macrocode} +% +% An extra level of indirection for the closing \verb'$' in multline +% allows us to avoid getting an extra thinmuskip from a final +% mathpunct in the equation contents, when equation numbers are on +% the right. If we did not use this workaround, the sequence of +% elements for a final comma would be, e.g., +% \begin{verbatim} +% ... ,<hskip><box containing equation number> +% \end{verbatim} +% which is equivalent to a sequence \verb'<mathpunct><mathord>' as +% far as the automatic math spacing is concerned. +% \begin{macrocode} +\def\endmultline@math{$} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\lendmultline@} +% Bug fix: changed \cs{crcr} to \cs{math@cr} so that \cs{@eqpen} +% gets reset properly if \cs{displaybreak} is used on the +% penultimate line of an \env{align}. +% \begin{macrocode} +\def\lendmultline@{% + \hfilneg + \hskip\multlinegap + \math@cr + \egroup + $$% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\rendmultline@} +% \begin{macrocode} +\def\rendmultline@{% + \iftag@ + $\let\endmultline@math\relax + \ifshifttag@ + \hskip\multlinegap +% \end{macrocode} +% Added depth to correct vertical spacing of shifted equation +% tags.---dmj, 1994/12/29 +% \begin{macrocode} + \llap{\vtop{% + \raise@tag + \normalbaselines + \setbox\@ne\null + \dp\@ne\lineht@ + \box\@ne + \hbox{\strut@\make@display@tag}% + }}% + \else + \hskip\multlinetaggap + \make@display@tag + \fi + \else + \hskip\multlinegap + \fi + \hfilneg +% \end{macrocode} +% Use \cs{math@cr} rather than just \cs{crcr} so that \cs{@eqpen} +% gets reset properly if \cs{displaybreak} is used. +% \begin{macrocode} + \math@cr + \egroup$$% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mmeasure@} +% \begin{macrocode} +\def\mmeasure@#1{% + \begingroup + \measuring@true +% \end{macrocode} +% We use \cs{begin/endgroup} rather than |{}| in this definition of +% \cn{label} because the latter would create an extra (wasteful of +% main mem) null box in the current math list. [mjd, 1995/01/17] +% \begin{macrocode} + \def\label##1{% + \begingroup\measuring@false\label@in@display{##1}\endgroup}% + \def\math@cr@@@{\cr}% + \let\shoveleft\@iden \let\shoveright\@iden + \savecounters@ + \global\row@\z@ + \setbox\@ne\vbox{% + \global\let\df@tag\@empty + \halign{% + \setboxz@h{\@lign$\m@th\displaystyle{}##$}% + \iftagsleft@ + \ifnum\row@=\@ne + \global\totwidth@\wdz@ + \global\lineht@\ht\z@ + \fi + \else + \global\totwidth@\wdz@ + \global\lineht@\dp\z@ + \fi + \crcr + #1% + \crcr + }% + }% + \ifx\df@tag\@empty\else\global\tag@true\fi + \if@eqnsw\global\tag@true\fi + \iftag@ + \setboxz@h{% + \if@eqnsw + \stepcounter{equation}% + \tagform@\theequation + \else + \df@tag + \fi + }% + \global\tagwidth@\wdz@ + \dimen@\totwidth@ + \advance\dimen@\tagwidth@ + \advance\dimen@\multlinetaggap + \iftagsleft@\else + \if@fleqn + \advance\dimen@\@mathmargin + \fi + \fi + \ifdim\dimen@>\displaywidth + \global\shifttag@true + \else + \global\shifttag@false + \fi + \fi + \restorecounters@ + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\shoveleft} +% \begin{macro}{\shoveright} +% \cs{shoveleft} and \cs{shoveright} need to do slightly different +% things depending on whether tags are on the left or the right and +% whether we're in \opt{fleqn} mode. For compactness of code, we +% make the appropriate decisions at ``compile'' time rather than at +% load time. +% +% TODO: Investigate making \cs{shoveright} behave ``properly''(?) if +% used on the first line of a \env{multline} and make \cs{shoveleft} +% behave properly if used on the last line of a \env{multline}. But +% in his \fn{amstex.doc} Spivak indicates those commands should never +% be used on a first or last line. Perhaps better to leave the +% question open unless/until real-life examples turn up. +% \begin{macrocode} +\iftagsleft@ + \def\shoveright#1{% + #1% + \hfilneg + \hskip\multlinegap + } +\else + \def\shoveright#1{% + #1% + \hfilneg + \iftag@ + \ifshifttag@ + \hskip\multlinegap + \else + \hskip\tagwidth@ + \hskip\multlinetaggap + \fi + \else + \hskip\multlinegap + \fi + } +\fi + +\if@fleqn + \def\shoveleft#1{#1}% +\else + \iftagsleft@ + \def\shoveleft#1{% + \setboxz@h{$\m@th\displaystyle{}#1$}% + \setbox\@ne\hbox{$\m@th\displaystyle#1$}% + \hfilneg + \iftag@ + \ifshifttag@ + \hskip\multlinegap + \else + \hskip\tagwidth@ + \hskip\multlinetaggap + \fi + \else + \hskip\multlinegap + \fi + \hskip.5\wd\@ne + \hskip-.5\wdz@ + #1% + } + \else + \def\shoveleft#1{% + \setboxz@h{$\m@th\displaystyle{}#1$}% + \setbox\@ne\hbox{$\m@th\displaystyle#1$}% + \hfilneg + \hskip\multlinegap + \hskip.5\wd\@ne + \hskip-.5\wdz@ + #1% + } + \fi +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{The \env{equation} environment} +% +% Rewritten from the ground up for version 2.0 to fix no-shrink and +% no-shortskips bugs [mjd,2000/01/06]. +% +% Standard \latex/ provides three environments for one-line equations: +% \cn{[}\cn{]}, \env{equation}, and \env{displaymath}. We add +% \env{equation*} as a synonym for \env{displaymath}. +% \begin{macrocode} +\@saveprimitive\leqno\@@leqno +\@saveprimitive\eqno\@@eqno +\def\eqno{\@@eqno\let\eqno\relax\let\leqno\relax} +\def\leqno{\@@leqno\let\leqno\relax\let\eqno\relax} +% +\let\veqno=\@@eqno +\iftagsleft@ \let\veqno=\@@leqno \fi +% \end{macrocode} +% +% Support for the \pkg{showkeys} package: provide no-op definitions +% for a couple of SK functions, if they are not already defined. Then +% we can just call them directly in our code without any extra fuss. +% If the \pkg{showkeys} package is loaded later, our trivial +% definitions will get overridden and everything works fine. +% \begin{macrocode} +\@ifundefined{SK@@label}{% + \let\SK@@label\relax \let\SK@equationtrue\relax +}{} +% \end{macrocode} +% +% \begin{macrocode} +\let\reset@equation\@empty +% \end{macrocode} +% +% Cf \cs{tag@in@align}. This is a bit of a mess though. Could use +% some work. [mjd,1999/12/21] +% \begin{macrocode} +\let\alt@tag\@empty +\def\tag@in@display#1#{\relax\tag@in@display@a{#1}} +\def\tag@in@display@a#1#2{% + \iftag@ + \invalid@tag{Multiple \string\tag}\relax + \else + \global\tag@true \nonumber \reset@equation \st@rredtrue + \if *\string#1% + \gdef\alt@tag{\def\SK@tagform@{#2\@gobble}% + \ifx\SK@@label\relax \let\tagform@\SK@tagform@ \fi + }% + \make@df@tag@@{#2}% + \else + \make@df@tag@@@{#2}% + \fi + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\let\restore@hfuzz\@empty +% \end{macrocode} +% +% \begin{macrocode} +\def\mathdisplay#1{% + \ifmmode \@badmath + \else + $$\def\@currenvir{#1}% +% \end{macrocode} +% Allow use of \cn{displaybreak}. +% \begin{macrocode} + \let\dspbrk@context\z@ +% \end{macrocode} +% Although in some cases simpler label handling would seem to be +% sufficient, always using \cs{label@in@display} makes it easier to +% support the \pkg{showkeys} package. +% \begin{macrocode} + \let\tag\tag@in@display \let\label\label@in@display \SK@equationtrue + \global\let\df@label\@empty \global\let\df@tag\@empty + \global\tag@false + \let\mathdisplay@push\mathdisplay@@push + \let\mathdisplay@pop\mathdisplay@@pop + \if@fleqn +% \end{macrocode} +% Turn off overfull box messages temporarily\mdash otherwise there +% would be unwanted extra ones emitted during our measuring +% operations. +% \begin{macrocode} + \edef\restore@hfuzz{\hfuzz\the\hfuzz\relax}% + \hfuzz\maxdimen +% \end{macrocode} +% Initially set the equation body in a box of displaywidth. Then if +% the box is not overfull, as we find by checking \cs{badness}, we +% have acquired useful information for the subsequent processing. +% \begin{macrocode} + \setbox\z@\hbox to\displaywidth\bgroup + \let\split@warning\relax \restore@hfuzz + \everymath\@emptytoks \m@th $\displaystyle + \fi + \fi +} +% \end{macrocode} +% +% Arg 1 is not currently used. I thought it might come in handy for +% error messages. +% \begin{macrocode} +\def\endmathdisplay#1{% + \ifmmode \else \@badmath \fi + \endmathdisplay@a + $$% +% \end{macrocode} +% I guess the following code means this structure is non-reentrant. +% But there is plenty of scope for tricky bugs here; suppressing them +% by brute force at least makes it possible to get things working +% correctly for normal use. [mjd,2000/01/06] +% \begin{macrocode} + \global\let\df@label\@empty \global\let\df@tag\@empty + \global\tag@false \global\let\alt@tag\@empty + \global\@eqnswfalse +} +% \end{macrocode} +% +% \begin{macrocode} +\def\endmathdisplay@a{% + \if@eqnsw \gdef\df@tag{\tagform@\theequation}\fi + \if@fleqn \@xp\endmathdisplay@fleqn + \else \ifx\df@tag\@empty \else \veqno \alt@tag \df@tag \fi + \ifx\df@label\@empty \else \@xp\ltx@label\@xp{\df@label}\fi + \fi + \ifnum\dspbrk@lvl>\m@ne + \postdisplaypenalty -\@getpen\dspbrk@lvl + \global\dspbrk@lvl\m@ne + \fi +} +% \end{macrocode} +% +% A boolean variable: Was that last box overfull or not? A value of 0 +% means yes, it was overfull. +% \begin{macrocode} +\let\too@wide\@ne +% \end{macrocode} +% +% Special handling is needed for flush-left equations. We need to +% measure the equation body (found in box 0 after we close it with +% the \cs{egroup}). Then after a fairly normal test to see if it fits +% within the available space, we need to consider overlapping into +% the displayindent area if displayindent is nonzero (as in an +% indented list). If there is an equation number we may have to shift +% it by hand to a separate line when there is not enough room; +% we can no longer take advantage of the automatic shifting provided +% by the \cn{leqno}, \cn{eqno} primitives. +% +% We initially add \cs{@mathmargin} glue at the end of box 0 to get +% an accurate overfull test. If \cs{@mathmargin} contains any shrink +% then we cannot reliably tell whether the box will be overfull or +% not simply by doing hand calculations from the actual width of the +% equation body. We have to actually set the box and find out what +% happens. +% +% On the other hand if we put the \cs{@mathmargin} glue at the +% beginning of the box it's awkward to remove it afterwards. So we +% first put it in at the end and later we will move it to the +% beginning as needed. +% +% \begin{macrocode} +\def\endmathdisplay@fleqn{% + $\hfil\hskip\@mathmargin\egroup +% \end{macrocode} +% We need to save the information about whether box 0 was overfull in +% a variable, otherwise it will disappear in the next setbox +% operation. And we couldn't set the equation number box earlier than +% now, because the body of the equation might have contained a +% \cs{tag} command (well, it could have been done, but this way +% we can reuse the tag-handling code from elsewhere). +% \begin{macrocode} + \ifnum\badness<\inf@bad \let\too@wide\@ne \else \let\too@wide\z@ \fi + \ifx\@empty\df@tag + \else + \setbox4\hbox{\df@tag + \ifx\df@label\@empty \else \@xp\ltx@label\@xp{\df@label}\fi + }% + \fi + \csname emdf@% + \ifx\df@tag\@empty U\else \iftagsleft@ L\else R\fi\fi + \endcsname +} +% \end{macrocode} +% +% For an unnumbered flush-left equation we hope first that the +% the contents fit within displaywidth. If not we need to fall back +% on a more complicated reboxing operation. +% \begin{macrocode} +\def\emdf@U{% + \restore@hfuzz + \ifodd\too@wide % not too wide: just need to swap the glue around + \hbox to\displaywidth{\hskip\@mathmargin\unhbox\z@\unskip}% + \else % M+B > displaywidth + \emdf@Ua + \fi +} +% \end{macrocode} +% +% Some notation: $M$ \cs{@mathmargin}, $B$ the width of the equation +% body, $I$ \cs{displayindent}, $D$ \cs{displaywidth}, $N$ the width +% of the equation number (aka the tag), $S$ \cs{mintagsep}, $C$ +% \cs{columnwidth}. If $M+B > \mbox{displaywidth}$, and if we assume +% $M$ contains shrink, then the only solution left is to encroach +% into the displayindent space. +% \begin{macrocode} +\def\emdf@Ua{% + \hbox to\columnwidth{% + \ifdim\displayindent>\z@ + \hskip\displayindent minus\displayindent + \fi + \hskip\@mathmargin \unhbox\z@ \unskip + }% + \displayindent\z@ \displaywidth\columnwidth +} +% \end{macrocode} +% +% Find out first if the tag fits in ideal position. If so we can just +% plunk down box 2. Otherwise we need to do something more complicated. +% \begin{macrocode} +\def\emdf@R{% + \setbox\tw@\hbox to\displaywidth{% + \hskip\@mathmargin \unhcopy\z@\unskip\hfil\hskip\mintagsep\copy4 + }% + \restore@hfuzz + \ifnum\badness<\inf@bad \box\tw@ \else \emdf@Ra \fi +} +% \end{macrocode} +% +% We shift the equation number to line 2 if it does not fit within +% \cs{displaywidth}. Note that we do not first attempt to let the +% equation body shift leftward into the \cs{displayindent} space. If +% that is desired it will have to be done by hand by adding negative +% space at the beginning of the equation body. I don't expect this to +% arise very often in practice since most of the time +% \cs{displayindent} is zero anyway. +% \begin{macrocode} +\def\emdf@Ra{% + \skip@\displayindent minus\displayindent + \displayindent\z@ \displaywidth\columnwidth + \spread@equation \everycr{}\tabskip\z@skip + \halign{\hbox to\displaywidth{##}\cr + \relax + \ifdim\skip@>\z@ \hskip\skip@ \fi + \hskip\@mathmargin\unhbox\z@\unskip\hfil\cr + \noalign{\raise@tag}% + \hfil\box4 \cr}% +} +% \end{macrocode} +% +% Find out first if the tag fits in ideal position. If so we can just +% plunk down box 2. Otherwise we need to do something more +% complicated. +% \begin{macrocode} +\def\emdf@L{% +% \end{macrocode} +% Calculate the difference between $M$ and $N+S$. If the latter is +% greater, we don't want to add any extra glue between the number and +% the equation body. Otherwise the amount that we want to add is +% \verb'x minus x' where $x=M-(N+S)$. I.e., the distribution of +% spaces across the line is $N,S,x minus x,B,hfil$. +% \begin{macrocode} + \@tempdima\@mathmargin + \advance\@tempdima-\wd4 \advance\@tempdima-\mintagsep + \skip@\@tempdima minus\@tempdima + \setbox\tw@\hbox to\displaywidth{% + \copy4\hskip\mintagsep + \ifdim\skip@>\z@ \hskip\skip@\fi + \unhcopy\z@\unskip + }% + \restore@hfuzz + \ifnum\badness<\inf@bad \box\tw@ \else \emdf@La \fi +} +% \end{macrocode} +% +% If the equation body and equation number will not fit on the same +% line, we put the number on line 1 and the body on line 2, with the +% body positioned as for an unnumbered equation. +% \begin{macrocode} +\def\emdf@La{% + \spread@equation \everycr{}\tabskip\z@skip + \halign{\hbox to\displaywidth{##}\cr + \box4 \hfil \cr + \noalign{\raise@tag}% + \hskip\@mathmargin\unhbox\z@\unskip\hfil\cr}% +} +% \end{macrocode} +% +% If someone has \verb'\[ \]' nested inside a minipage environment +% nested inside a numbered equation, the mathdisplay variables that +% are global will get out of whack unless we take extra care. So we +% make a stack and push all the variables before entering mathdisplay +% and pop them afterwards. But we can save a little work by not doing +% this at the top level, only at inner levels. +% \begin{macrocode} +\newtoks\mathdisplay@stack +\let\mathdisplay@push\@empty +\def\mathdisplay@@push{% + \begingroup + \toks@\@xp{\df@label}\@temptokena\@xp{\df@tag}% + \toks8\@xp{\alt@tag}% + \edef\@tempa{% + \global\if@eqnsw\@nx\@eqnswtrue\else\@nx\@eqnswfalse\fi + \global\iftag@\@nx\tag@false\else\@nx\tag@true\fi + \gdef\@nx\df@label{\the\toks@}\gdef\@nx\df@tag{\the\@temptokena}% + \gdef\@nx\alt@tag{\the\toks8}% + \global\mathdisplay@stack{\the\mathdisplay@stack}% + }% + \global\mathdisplay@stack\@xp{\@tempa} + \endgroup +} +% \end{macrocode} +% +% \begin{macrocode} +\let\mathdisplay@pop\@empty +\def\mathdisplay@@pop{\the\mathdisplay@stack} +% \end{macrocode} +% +% \begin{macrocode} +\renewenvironment{equation}{% + \incr@eqnum + \mathdisplay@push + \st@rredfalse \global\@eqnswtrue + \mathdisplay{equation}% +}{% + \endmathdisplay{equation}% + \mathdisplay@pop + \ignorespacesafterend +} +% \end{macrocode} +% +% \begin{macrocode} +\newenvironment{equation*}{% + \mathdisplay@push + \st@rredtrue \global\@eqnswfalse + \mathdisplay{equation*}% +}{% + \endmathdisplay{equation*}% + \mathdisplay@pop + \ignorespacesafterend +} +% \end{macrocode} +% +% Note: \latex/ defines the \env{displaymath} environment in +% terms of \cn{[} and \cn{]}. +% \begin{macrocode} +\DeclareRobustCommand{\[}{\begin{equation*}} +\DeclareRobustCommand{\]}{\end{equation*}} +% \end{macrocode} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \section{Credits} +% +% Much of the code for the \pkg{amsmath} package had its orgin in +% \fn{amstex.tex}, written by Michael Spivak. The initial work of +% porting \fn{amstex.tex} to \fn{amstex.sty} was done in 1988--1989 +% by Frank Mittelbach and Rainer Sch\"opf. In 1994 David M. Jones +% added the support for the \opt{fleqn} option and did extensive +% improvements to the \env{align[at]} family of environments and to +% the equation number handling in general. Michael Downes at the AMS +% served as coordinator for the efforts of Mittelbach, Sch\"opf, and +% Jones, and has contributed various bug fixes and additional +% refinements over time. +% +% Versions 1.0 and 1.1 of the package carried the name \pkg{amstex} +% instead of \pkg{amsmath}, to indicate its origins; the name was +% changed in 1994 to make it user-oriented rather than +% history-oriented. +% +\endinput diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amsmath.ins b/Master/texmf-dist/source/latex-dev/amsmath/amsmath.ins new file mode 100644 index 00000000000..7a6a0873595 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amsmath.ins @@ -0,0 +1,50 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999, 2000, 2013 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amsmath.sty}{\from{amsmath.dtx}{}} +} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amsopn.dtx b/Master/texmf-dist/source/latex-dev/amsmath/amsopn.dtx new file mode 100644 index 00000000000..b7047377f3a --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amsopn.dtx @@ -0,0 +1,263 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 1999 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +%\iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\let\savedarg\arg +\usepackage{amsopn} +\let\arg\savedarg +\GetFileInfo{amsopn.sty} +\begin{document} +\title{The \pkg{amsopn} package} +\author{Michael Downes} +\date{Version \fileversion, \filedate} +\DocInput{amsopn.dtx} +\end{document} +%</driver> +%\fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% +% \section{Introduction} +% +% The \pkg{amsopn} package provides a command +% \cn{DeclareMathOperator} for defining new `math operator names' +% similar to the standard function names \cn{sin}, \cn{lim}, +% \cn{max}, etc. +% +% \StopEventually{} +% +% Standard file identification. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\ProvidesPackage{amsopn}[2016/03/08 v2.02 operator names] +% \end{macrocode} +% +% What \cs{nolimits@} does is keep a \cn{limits} typed by the user +% from having any effect. This is used for operatornames whose +% standard usage is never to have limits. +% \begin{macrocode} +\def\nolimits@{\@ifnextchar\limits{\nolimits\@gobble}{\nolimits}} +% \end{macrocode} +% +% In operator names, it is sometimes desired to have text-mode +% punctuation characters such as |*-/:'|. +% Because the body of an +% operator name is set in math mode, these few punctuation +% characters will not come out right (wrong symbol/and or wrong +% spacing). The purpose of \cs{newmcodes@} is to make them act like +% their normal text versions. +% +% Where practical, we use decimal numbers to cut down main mem +% usage (\qc{\"} not needed). +% use |\Umathcodedefnum| with xetex and LuaTeX to avoid problems +% using |\mathcode| if |-| has already been defined using |\Umathcode|. +% \changes{v2.02}{2016/03/08}{Unicode TeX version of \cs{newmcodes@}} +% \begin{macrocode} +\begingroup \catcode`\"=12 +\ifx\Umathcode\@undefined +\gdef\newmcodes@{\mathcode`\'39\mathcode`\*42\mathcode`\."613A% +% \end{macrocode} +% Define \cs{std@minus} for \cs{relbar} use; otherwise there are +% problems with arrows constructed with relbar. +% \begin{macrocode} + \ifnum\mathcode`\-=45 \else + \mathchardef\std@minus\mathcode`\-\relax + \fi + \mathcode`\-45\mathcode`\/47\mathcode`\:"603A\relax} +% \end{macrocode} +% \begin{macrocode} +\else +% \end{macrocode} +% \begin{macrocode} +\gdef\newmcodes@{\mathcode`\'39\mathcode`\*42\mathcode`\."613A% + \ifnum\Umathcodenum`\-=45 \else + \Umathcharnumdef\std@minus\Umathcodenum`\-\relax + \fi + \mathcode`\-45\mathcode`\/47\mathcode`\:"603A\relax} +% \end{macrocode} +% \begin{macrocode} +\fi +\endgroup +% \end{macrocode} +% +% The command \cs{operatorname} prints its argument as a `math +% operator' like \cs{sin} or \cs{det}, with proper font and spacing. +% \begin{macrocode} +\DeclareRobustCommand{\operatorname}{% + \@ifstar{\qopname\newmcodes@ m}% + {\qopname\newmcodes@ o}}% +% \end{macrocode} +% In the interior of the \cs{mathop} we need a null object (we choose +% a zero kern for minimum waste of main mem) in order to guard +% against the case where \arg{3} is a single letter; \tex/ will seize +% it and center it on the math axis if there is nothing else inside +% the \cs{mathop} atom. +% \begin{macrocode} +\DeclareRobustCommand{\qopname}[3]{% + \mathop{#1\kern\z@\operator@font#3}% + \csname n#2limits@\endcsname} +% \end{macrocode} +% +% \begin{macro}{\DeclareMathOperator} +% The command \cn{DeclareMathOperator} defines the first argument to +% be an operator name whose text is the second argument. The star +% form means that the operator name should take limits (like \cn{max} +% or \cn{lim}). +% \begin{macrocode} +\newcommand{\DeclareMathOperator}{% + \@ifstar{\@declmathop m}{\@declmathop o}} +% \end{macrocode} +% \end{macro} +% +% In the basic set of operator names (below) we did not use +% \cn{DeclareRobustCommand} because of the hash table cost. But we +% use it here to minimize the chances of trouble, since we are +% producing a user-defined command. +% \begin{macrocode} +\long\def\@declmathop#1#2#3{% + \@ifdefinable{#2}{% + \DeclareRobustCommand{#2}{\qopname\newmcodes@#1{#3}}}} +% +\@onlypreamble\DeclareMathOperator +\@onlypreamble\@declmathop +% \end{macrocode} +% +% \begin{macrocode} +\def\arccos{\qopname\relax o{arccos}} +\def\arcsin{\qopname\relax o{arcsin}} +\def\arctan{\qopname\relax o{arctan}} +\def\arg{\qopname\relax o{arg}} +\def\cos{\qopname\relax o{cos}} +\def\cosh{\qopname\relax o{cosh}} +\def\cot{\qopname\relax o{cot}} +\def\coth{\qopname\relax o{coth}} +\def\csc{\qopname\relax o{csc}} +\def\deg{\qopname\relax o{deg}} +\def\det{\qopname\relax m{det}} +\def\dim{\qopname\relax o{dim}} +\def\exp{\qopname\relax o{exp}} +\def\gcd{\qopname\relax m{gcd}} +\def\hom{\qopname\relax o{hom}} +\def\inf{\qopname\relax m{inf}} +\def\injlim{\qopname\relax m{inj\,lim}} +\def\ker{\qopname\relax o{ker}} +\def\lg{\qopname\relax o{lg}} +\def\lim{\qopname\relax m{lim}} +\def\liminf{\qopname\relax m{lim\,inf}} +\def\limsup{\qopname\relax m{lim\,sup}} +\def\ln{\qopname\relax o{ln}} +\def\log{\qopname\relax o{log}} +\def\max{\qopname\relax m{max}} +\def\min{\qopname\relax m{min}} +\def\Pr{\qopname\relax m{Pr}} +\def\projlim{\qopname\relax m{proj\,lim}} +\def\sec{\qopname\relax o{sec}} +\def\sin{\qopname\relax o{sin}} +\def\sinh{\qopname\relax o{sinh}} +\def\sup{\qopname\relax m{sup}} +\def\tan{\qopname\relax o{tan}} +\def\tanh{\qopname\relax o{tanh}} +% \end{macrocode} +% +% \begin{macro}{\operator@font} +% \begin{macro}{\operatorfont} +% This command is provided to allow the document styles to decide in +% which way math operators like `max' or `log' are typeset. The +% default is to set them in \meta{math group} zero of the current +% math version. The original name was \cs{operator@font}, retained +% for compatibility; the second name was added to make it +% more accessible so that users can call this font for use in special +% constructs that are not ordinary operator names but conceptually +% related. +% \begin{macrocode} +\def\operator@font{\mathgroup\symoperators} +\def\operatorfont{\operator@font} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% For backwards compatibility we keep this old command name for the +% time being: +% \begin{macrocode} +\def\operatornamewithlimits{\operatorname*} +% \end{macrocode} +% +% These macros use \cs{mathpalette}s so that they will change size +% in script and scriptscript styles, though it's hard to imagine they +% will ever be used there (the arrows, particularly, look bad in +% subscript sizes). Notice that the use of \cs{ex@} means that the +% vertical spacing may not be optimal in script and scriptscript +% sizes. Unfortunately \tex/ provides no easy way to do math mode +% vertical spacing that varies with current math style like mu units. +% \begin{macrocode} +\def\varlim@#1#2{% + \vtop{\m@th\ialign{##\cr + \hfil$#1\operator@font lim$\hfil\cr + \noalign{\nointerlineskip\kern1.5\ex@}#2\cr + \noalign{\nointerlineskip\kern-\ex@}\cr}}% +} +\def\varinjlim{% + \mathop{\mathpalette\varlim@{\rightarrowfill@\textstyle}}\nmlimits@ +} +\def\varprojlim{% + \mathop{\mathpalette\varlim@{\leftarrowfill@\textstyle}}\nmlimits@ +} +\def\varliminf{\mathop{\mathpalette\varliminf@{}}\nmlimits@} +\def\varliminf@#1{\@@underline{\vrule\@depth.2\ex@\@width\z@ + \hbox{$#1\m@th\operator@font lim$}}} +\def\varlimsup{\mathop{\mathpalette\varlimsup@{}}\nmlimits@} +\def\varlimsup@#1{\@@overline{\hbox{$#1\m@th\operator@font lim$}}} +% \end{macrocode} +% +% \begin{macrocode} +\let\nmlimits@\displaylimits +\DeclareOption{namelimits}{\let\nmlimits@\displaylimits} +\DeclareOption{nonamelimits}{\let\nmlimits@\nolimits} +\ProcessOptions\relax +% \end{macrocode} +% +% If we don't load the \pkg{amsgen} package then the use of \cs{ex@} +% in \cs{varlim@} will lead to trouble. +% \begin{macrocode} +\RequirePackage{amsgen}\relax +% \end{macrocode} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \changes{v1.2a}{1995/02/20}{Fixed operatorname +% (shouldn't have same limits behavior as operatorname*)} +% +% \Finale diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amsopn.ins b/Master/texmf-dist/source/latex-dev/amsmath/amsopn.ins new file mode 100644 index 00000000000..8c977446cc2 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amsopn.ins @@ -0,0 +1,50 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amsopn.sty}{\from{amsopn.dtx}{}} +} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amstext.dtx b/Master/texmf-dist/source/latex-dev/amsmath/amstext.dtx new file mode 100644 index 00000000000..a4c9aeb5d98 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amstext.dtx @@ -0,0 +1,302 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 1999 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +% \iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\usepackage{amstext} +\GetFileInfo{amstext.sty} +\begin{document} +\title{The \pkg{amstext} package} +\author{Frank Mittelbach \and Rainer Sch\"opf} +\date{Version \fileversion, \filedate} +\DocInput{amstext.dtx} +\end{document} +%</driver> +% \fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% +% \section{Introduction} +% +% This style file implements the \AmSTeX{} macro \cn{text} for use +% with the new font selection scheme. The \cn{text} macro is a +% sophisticated command which allows the user to insert ``normal text'' +% into math formulas without worrying about correct sizes in sub- or +% superscripts. It can also be used in ordinary text; there it +% produces an unbreakable unit similar to \cn{mbox}. +% +% Here is an example demonstrating some of its features: +% \[ +%^^A mathbin spacing is nonscript glue, disappears in superscript +% x^{2\,\times\,\text{size of $y$}} +% \leq +% z_{i_{\text{upper bound of the array}}} +% \] +% This was produced by +% \begin{verbatim} +% \[ +% x^{2\,\times\,\text{size of $y$}} +% \leq +% z_{i_{\text{upper bound of the array}}} +% \] +% \end{verbatim} +% +% Additionally this style file redefines an internal \fn{plain.tex} +% macro called \cs{mathhexbox} so that commands like \cn{dag} +% or \cn{P} will change sizes if used in math subscripts. +% +% \StopEventually{} +% Package information. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must be December 1994 or later +\ProvidesPackage{amstext}[2000/06/29 v2.01 AMS text] +% \end{macrocode} +% +% \section{The implementation} +% We need a few tools from \fn{amsgen.sty}. +% \begin{macrocode} +\RequirePackage{amsgen} +% \end{macrocode} +% +% \begin{macro}{\text} +% Now we come to the \cn{text} macro which is used to place +% ordinary text inside of math formulas. If it is used outside +% math it will produce an unbreakable unit of text. +% \begin{macrocode} +\DeclareRobustCommand{\text}{% + \ifmmode\expandafter\text@\else\expandafter\mbox\fi} +% \end{macrocode} +% At the present time (late 1994) the \latex/ internal function +% |\nfss@text| is used in |\ref|, in font commands like |\textbf|, +% and in a few text symbol definitions like |\$| and |\pounds|. By +% equating |\nfss@text| to |\text| we give it the ability of +% |\text| to change sizes properly if used in a subscript. +% \begin{macrocode} +\let\nfss@text\text +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\text@} +% If \cn{text} is encountered inside math mode the macro +% \cs{text@} is called. It has one mandatory argument, the text +% which should be produced. Since we do not know in which math +% style we are currently in we call \cs{mathchoice} to tyeset +% our text in all four possible styles. +% \begin{macrocode} +\def\text@#1{{\mathchoice +% \end{macrocode} +% To save token space we call a macro \cs{textdef@} which takes +% three arguments: the current math style, the corresponding size +% macro and the text to typeset possibly with some additional +% information for typesetting. +% \begin{macrocode} + {\textdef@\displaystyle\f@size{#1}}% +% \end{macrocode} +% The other three cases are similar except for the +% \cs{iffirstchoice} switch which we set to false. This is +% done to prevent \LaTeX{} macros like \cn{ref} or \cn{index} +% from writing their arguments more than once. +% \begin{macrocode} + {\textdef@\textstyle\f@size{\firstchoice@false #1}}% + {\textdef@\textstyle\sf@size{\firstchoice@false #1}}% + {\textdef@\textstyle \ssf@size{\firstchoice@false #1}}% +% \end{macrocode} +% Here we need to check whether a math size-change occurred inside +% the argument of \cn{text}. If so, restore +% \begin{macrocode} + \check@mathfonts + }% +} +% \end{macrocode} +% The macros \cs{f@size}, \cs{sf@size} and \cs{ssf@size} hold the +% sizes which should be used when we are loading a new font for use +% in \cs{textfont}, \cs{scriptfont} and \cs{scriptscriptfont}. There +% is some question whether we should use use \cs{tf@size} or +% \cs{f@size} for the main size, but since the primary purpose of the +% \cn{text} macro is to switch back to text within a display, it +% seems that \cs{f@size} is the better choice. (Indeed it could be +% said that the \cn{text} actually provides two different functions: +% one for escaping out of math mode in a display to print some words, +% and the other for handling math objects that are named by a +% fragment of text, when \cn{operatorname} isn't the right choice. +% For the latter \cs{tf@size} might be more correct but for the +% former \cs{f@size} is clearly better.) +% \end{macro} +% +% \begin{macro}{\textdef@} +% To typeset the argument of \cn{text} correctly we have to make +% several actions. We start by placing everything inside an +% \cs{hbox}. But this is not enough: we need one extra level of +% grouping. These extra braces are necessary because of the new +% font selection scheme which might produce an \cs{aftergroup} +% to globally restore some font values after the current group. To +% prevent any damage by this mechanism we add the braces thereby +% bringing the token inserted by \cs{aftergroup} inside the +% \cs{hbox}.\footnote{The mechanism will not produce a second +% \cs{aftergroup}. For more details see the technical documentation +% for NFSS2.} +% \begin{macrocode} +\def\textdef@#1#2#3{\hbox{{% +% \end{macrocode} +% Since text typeset inside an \cs{hbox} always stays in the size +% of the text surrounding the formula we have to adjust this for +% script and scriptscript sizes. For any math formula inside this +% argument this will be achieved by setting \cs{everymath} to +% the first argument of \cs{textdef@} since this argument +% contains the math size in the current typeset case of +% \cs{mathchoice}. +% Since \latex/ also knows about \cn{parbox}es and the +% \env{minipage} environment it might be neccessary to adjust +% \cs{everydisplay} too but this has to be tested further. +% \begin{macrocode} + \everymath{#1}% +% \end{macrocode} +% The next line of code changes locally (i.e.\ inside the current +% \cs{hbox}) the value of \cs{f@size}. This macro holds the +% size for typesetting ordinary text (e.g.\ loading or selecting a +% new font via \cs{selectfont}). By changing it to a smaller +% value a following \cs{selectfont} will switch to the wanted +% size. +% \begin{macrocode} + \let\f@size#2\selectfont +% \end{macrocode} +% Now we simply call the third argument and close all open groups. +% \begin{macrocode} + #3}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\iffirstchoice@} +% Here is the switch that we use to decide if \cn{ref} etc.\ +% should print its warnings. The default is true since +% normally these warnings shouldn't be suppressed. +% \begin{macrocode} +\newif\iffirstchoice@ +\firstchoice@true +% \end{macrocode} +% \end{macro} +% +% \subsection{Re-definition of \latex/ macros to work with \cn{text}} +% +% If a counter-changing command occurs inside the argument of +% \cn{text}, we don't want the counter to be changed four times +% because \cn{stepcounter} and \cn{addtocounter} have global effect. +% So we add the \cs{iffirstchoice@} test to make the counter +% operations execute only once. +% +% \begin{macro}{\stepcounter} +% Use \cs{def} rather than \cn{renewcommand*} because the star-form +% (for non-\cs{long} definitions) doesn't work with the June 1994 +% release of \latex/. +% \begin{macrocode} +\def\stepcounter#1{% + \iffirstchoice@ + \addtocounter{#1}\@ne + \begingroup \let\@elt\@stpelt \csname cl@#1\endcsname \endgroup + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\addtocounter} +% \begin{macrocode} +\def\addtocounter#1#2{% + \iffirstchoice@ + \@ifundefined {c@#1}{\@nocounterr {#1}}% + {\global \advance \csname c@#1\endcsname #2\relax}% + \fi} +% \end{macrocode} +% \end{macro} +% +% For \cn{ref}, \cn{pageref}, and indeed anything else that issues a +% warning or error, \cn{text} will produce four copies of the +% warning/error message. To suppress the last three copies, we change +% \cs{GenericInfo}, \cs{GenericWarning}, \cs{GenericError}. +% \begin{macrocode} +\let\m@gobble\@empty +\@xp\let\csname m@gobble4\endcsname\@gobblefour +\long\@xp\def\csname m@gobble6\endcsname#1#2#3#4#5#6{} +% \end{macrocode} +% +% \begin{macrocode} +\toks@{% + \csname m@gobble\iffirstchoice@\else 4\fi\endcsname + \protect} +\edef\GenericInfo{\the\toks@ + \@xp\@nx\csname GenericInfo \endcsname} +% +\edef\GenericWarning{\the\toks@ + \@xp\@nx\csname GenericWarning \endcsname} +% +\toks@{% + \csname m@gobble\iffirstchoice@\else 6\fi\endcsname + \protect} +\edef\GenericError{\the\toks@ + \@xp\@nx\csname GenericError \endcsname} +% \end{macrocode} +% +% At one time \cn{label}, \cs{@wrindex} and \cs{@wrglossary} were +% changed here too to use the \cs{iffirstchoice@} test but it seems +% that was a mistake because those are non-immediate writes. +% Something like +% \begin{verbatim} +% \text{something \index{foo}} +% \end{verbatim} +% within a math formula would therefore \emph{lose the index term} if +% the surrounding context was not displaystyle. (Unlikely in +% practice, but not impossible.) [mjd,1994/12/09] +% +%\subsection{Applications of \cn{text}} +% +% \begin{macro}{\mathhexbox} +% We start with an re-definition of the \fn{plain.tex} macro +% \cs{mathhexbox}. (Although M. Spivak in \amstex/ uses the name +% \cs{mathhexbox@} for this purpose, I [FMi] don't see any reason +% to use a new name since the new definition is superior, has the +% same syntax and is used for the same purpose.) +% \begin{macrocode} +\begingroup \catcode`\"=12 +\gdef\mathhexbox#1#2#3{\text{$\m@th\mathchar"#1#2#3$}} +\endgroup +% \end{macrocode} +% This redefinition means that now symbols like \S, \P, \dag, \ldots, +% which are defined via \cs{mathhexbox} in \fn{plain.tex} or +% elsewhere now correctly change sizes if they are used in math mode. +% \end{macro} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \CheckSum{129} +% \Finale diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amstext.ins b/Master/texmf-dist/source/latex-dev/amsmath/amstext.ins new file mode 100644 index 00000000000..84fcb0cb951 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amstext.ins @@ -0,0 +1,51 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amstext.sty}{\from{amstext.dtx}{}} +} + +\endbatchfile + diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.dtx b/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.dtx new file mode 100644 index 00000000000..2165dde41ad --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.dtx @@ -0,0 +1,127 @@ +% +% \iffalse meta-comment +% +% Copyright (C) 1995, 1999 American Mathematical Society. +% Copyright (C) 2016-2019 LaTeX3 Project and American Mathematical Society. +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is the LaTeX3 Project. +% +% \fi +% +%\iffalse +%<*driver> +\documentclass{amsdtx} +\def\MaintainedByLaTeXTeam#1{% +\begin{center}% +\fbox{\fbox{\begin{tabular}{@{}l@{}}% +This file is maintained by the \LaTeX{} Project team.\\% +Bug reports can be opened (category \texttt{#1}) at\\% +\url{https://latex-project.org/bugs/}.\end{tabular}}}\end{center}} +\usepackage{amsxtra} +\GetFileInfo{amsxtra.sty} +\begin{document} +\title{The \pkg{amsxtra} package} +\author{American Mathematical Society\\Michael Downes} +\date{Version \fileversion, \filedate} +\DocInput{amsxtra.dtx} +\end{document} +%</driver> +%\fi +% +% \maketitle +% \MaintainedByLaTeXTeam{amslatex} +% +% \MakeShortVerb\| +% +% \section{Introduction} +% The \pkg{amsxtra} package contains a few rarely used commands that +% were present in version 1.1 of the \pkg{amstex} package: +% \cn{fracwithdelims}, {accentedsymbol}, \cn{sphat}, \cn{spcheck}, +% \cn{sptilde}, \cn{spdot}, \cn{spddot}, \cn{spdddot}, \cn{spbreve}. +% If any of these commands were used in existing documents, the +% \pkg{amsxtra} package provides a way to get them. But for 99\% of +% documents using the \pkg{amstex} package these commands are just +% wasted overhead. +% +% \StopEventually{} +% +% \begin{macrocode} +\ProvidesPackage{amsxtra}[1999/11/15 v1.2c AMS extra commands] +% \end{macrocode} +% We need to ensure that either the \pkg{amstex} package or the +% \pkg{amsmath} package is loaded. This means we need something a +% little more complicated than \cn{RequirePackage}. +% \begin{macrocode} +\@ifpackageloaded{amstex}{}{% + \RequirePackage{amsmath}[1996/10/01 v1.2]} +% \end{macrocode} +% +% Superscripted accent characters. +% \begin{macrocode} +\def\sphat{^{\mathchoice{}{}% + {\,\,\smash[b]{\hbox{\lower4\ex@\hbox{$\m@th\widehat{\null}$}}}}% + {\,\smash[b]{\hbox{\lower3\ex@\hbox{$\m@th\hat{\null}$}}}}}} +\def\spcheck{^\vee} +\def\sptilde{^\sim} +\def\spdot{^{\hbox{\raise\ex@\hbox{\normalfont .}}}} +\def\spddot{^{\hbox{\raise\ex@\hbox{\normalfont ..}}}} +\def\spdddot{^{\hbox{\raise\ex@\hbox{\normalfont...}}}} +\def\spbreve{^{\!\smash[b]{\hbox{\lower4\ex@\hbox{\u{}}}}}} +% \end{macrocode} +% +% The \cn{fracwithdelims} command is skipped if the base package is +% \pkg{amsmath}; it is only needed if the base package is +% \pkg{amstex}. +% \begin{macrocode} +\@ifpackageloaded{amstex}{% +\def\fracwithdelims#1#2{\new@ifnextchar[{\fracwithdelims@#1#2}% + {\fracwithdelims@#1#2[\@empty]}} +\def\fracwithdelims@#1#2[#3]#4#5{\relax + \ifx\@empty#3{#4\overwithdelims#1#2#5}\else + {#4\abovewithdelims#1#2#3\relax#5}\fi} +}{} +% \end{macrocode} +% +% Perhaps |\accentedsymbol| should use |\newsavebox|, but I don't +% know of any compelling reason at the moment.[mjd,5-Sep-1994] +% |\accentedsymbol| can only produce a single size of +% the given symbol, so you'd need two different versions for main +% size and subscript size. +% \begin{macrocode} +\def\accentedsymbol#1#2{% + \expandafter\newbox + \csname\expandafter\@gobble\string#1@box\endcsname + \expandafter\setbox + \csname\expandafter\@gobble\string#1@box\endcsname + \hbox{$\m@th#2$}% + \newcommand{#1}{% + \expandafter\copy + \csname\expandafter\@gobble\string#1@box\endcsname{}}% +} +% \end{macrocode} +% +% Change the definition of \qc{\~} to automatically remove a +% preceding space as well as a following space, if present. +% \begin{macrocode} +\def~{\nobreakspace} +\DeclareRobustCommand{\nobreakspace}{\unskip\nobreak\ \ignorespaces} +% \end{macrocode} +% +% The usual \cs{endinput} to ensure that random garbage at the end of +% the file doesn't get copied by \fn{docstrip}. +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \CheckSum{113} +% \Finale diff --git a/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.ins b/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.ins new file mode 100644 index 00000000000..9e739c3d4b9 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/amsmath/amsxtra.ins @@ -0,0 +1,51 @@ +%% +%% Copyright 2010 American Mathematical Society. +%% Copyright 2016 LaTeX3 Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX3 Project. +%% +%% ==================================================================== + +\input docstrip + +\askforoverwritefalse + +\keepsilent + +\preamble + +Copyright 1995, 1999 American Mathematical Society. +Copyright 2016 LaTeX3 Project and American Mathematical Society. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is the LaTeX3 project. + +\endpreamble + +\usedir{tex/latex/amsmath} + +\generate{ + \file{amsxtra.sty}{\from{amsxtra.dtx}{}} +} + +\endbatchfile + diff --git a/Master/texmf-dist/source/latex-dev/base/alltt.dtx b/Master/texmf-dist/source/latex-dev/base/alltt.dtx index 358a0599029..c106b5a97ff 100644 --- a/Master/texmf-dist/source/latex-dev/base/alltt.dtx +++ b/Master/texmf-dist/source/latex-dev/base/alltt.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/alltt.ins b/Master/texmf-dist/source/latex-dev/base/alltt.ins index 73d2d0b420b..e60d1f6df37 100644 --- a/Master/texmf-dist/source/latex-dev/base/alltt.ins +++ b/Master/texmf-dist/source/latex-dev/base/alltt.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/classes.dtx b/Master/texmf-dist/source/latex-dev/base/classes.dtx index a2dde6ade16..9fed94dfdd9 100644 --- a/Master/texmf-dist/source/latex-dev/base/classes.dtx +++ b/Master/texmf-dist/source/latex-dev/base/classes.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -53,7 +53,7 @@ %<*driver> \ProvidesFile{classes.drv} %</driver> - [2018/09/03 v1.4i + [2019/08/27 v1.4j %<article|report|book> Standard LaTeX document class] %<10pt|11pt|12pt> Standard LaTeX file (size option)] % \end{macrocode} @@ -213,6 +213,7 @@ % \changes{v1.3l}{1995/10/20}{Disabled in compatibility mode all % options that are new in \LaTeXe.} % \changes{v1.3v}{1997/06/16}{Documentation fixes.} +% \changes{v1.4j}{2019/08/27}{Various commands made robust} % % % \title{Standard Document Classes for \LaTeX{} version 2e\thanks{This @@ -220,7 +221,8 @@ % % \author{% % Copyright (C) 1992 by Leslie Lamport \and -% Copyright (C) 1994-97 by Frank Mittelbach \and Johannes Braams +% Copyright (C) 1994-2019 by Frank Mittelbach \and Johannes Braams \and +% \LaTeX3 Project Team % } % \date{\filedate} % \MaintainedByLaTeXTeam{latex} @@ -608,6 +610,11 @@ % \begin{macrocode} \normalsize % \end{macrocode} +% We use |\MakeRobust| instead of |\DeclareRobustCommand| above to avoid a log +% entry for the redefinition. +% \begin{macrocode} +\MakeRobust\normalsize +% \end{macrocode} % \end{macro} % \end{macro} % @@ -618,7 +625,7 @@ % \changes{v1.2e}{1994/04/14}{\cs{small} is no longer defined in the % kernel; use \cs{newcommand}} % \begin{macrocode} -\newcommand\small{% +\DeclareRobustCommand\small{% %<*10pt> \@setfontsize\small\@ixpt{11}% \abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@ @@ -660,7 +667,7 @@ % kernel, so use \cs{renewcommand}. ASAJ.} % \changes{v1.2e}{1994/04/14}{use \cs{newcommand} again} % \begin{macrocode} -\newcommand\footnotesize{% +\DeclareRobustCommand\footnotesize{% %<*10pt> \@setfontsize\footnotesize\@viiipt{9.5}% \abovedisplayskip 6\p@ \@plus2\p@ \@minus4\p@ @@ -712,30 +719,30 @@ % \changes{v1.2e}{1994/04/14}{use \cs{newcommand} again} % \begin{macrocode} %<*10pt> -\newcommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt} -\newcommand\tiny{\@setfontsize\tiny\@vpt\@vipt} -\newcommand\large{\@setfontsize\large\@xiipt{14}} -\newcommand\Large{\@setfontsize\Large\@xivpt{18}} -\newcommand\LARGE{\@setfontsize\LARGE\@xviipt{22}} -\newcommand\huge{\@setfontsize\huge\@xxpt{25}} -\newcommand\Huge{\@setfontsize\Huge\@xxvpt{30}} +\DeclareRobustCommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt} +\DeclareRobustCommand\tiny{\@setfontsize\tiny\@vpt\@vipt} +\DeclareRobustCommand\large{\@setfontsize\large\@xiipt{14}} +\DeclareRobustCommand\Large{\@setfontsize\Large\@xivpt{18}} +\DeclareRobustCommand\LARGE{\@setfontsize\LARGE\@xviipt{22}} +\DeclareRobustCommand\huge{\@setfontsize\huge\@xxpt{25}} +\DeclareRobustCommand\Huge{\@setfontsize\Huge\@xxvpt{30}} %</10pt> %<*11pt> -\newcommand\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}} -\newcommand\tiny{\@setfontsize\tiny\@vipt\@viipt} -\newcommand\large{\@setfontsize\large\@xiipt{14}} -\newcommand\Large{\@setfontsize\Large\@xivpt{18}} -\newcommand\LARGE{\@setfontsize\LARGE\@xviipt{22}} -\newcommand\huge{\@setfontsize\huge\@xxpt{25}} -\newcommand\Huge{\@setfontsize\Huge\@xxvpt{30}} +\DeclareRobustCommand\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}} +\DeclareRobustCommand\tiny{\@setfontsize\tiny\@vipt\@viipt} +\DeclareRobustCommand\large{\@setfontsize\large\@xiipt{14}} +\DeclareRobustCommand\Large{\@setfontsize\Large\@xivpt{18}} +\DeclareRobustCommand\LARGE{\@setfontsize\LARGE\@xviipt{22}} +\DeclareRobustCommand\huge{\@setfontsize\huge\@xxpt{25}} +\DeclareRobustCommand\Huge{\@setfontsize\Huge\@xxvpt{30}} %</11pt> %<*12pt> -\newcommand\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}} -\newcommand\tiny{\@setfontsize\tiny\@vipt\@viipt} -\newcommand\large{\@setfontsize\large\@xivpt{18}} -\newcommand\Large{\@setfontsize\Large\@xviipt{22}} -\newcommand\LARGE{\@setfontsize\LARGE\@xxpt{25}} -\newcommand\huge{\@setfontsize\huge\@xxvpt{30}} +\DeclareRobustCommand\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}} +\DeclareRobustCommand\tiny{\@setfontsize\tiny\@vipt\@viipt} +\DeclareRobustCommand\large{\@setfontsize\large\@xivpt{18}} +\DeclareRobustCommand\Large{\@setfontsize\Large\@xviipt{22}} +\DeclareRobustCommand\LARGE{\@setfontsize\LARGE\@xxpt{25}} +\DeclareRobustCommand\huge{\@setfontsize\huge\@xxvpt{30}} \let\Huge=\huge %</12pt> % \end{macrocode} @@ -1766,9 +1773,9 @@ % information provided. The definitions of these macros are shown % here for information. % \begin{macrocode} -% \newcommand*{\title}[1]{\gdef\@title{#1}} -% \newcommand*{\author}[1]{\gdef\@author{#1}} -% \newcommand*{\date}[1]{\gdef\@date{#1}} +% \DeclareRobustCommand*{\title}[1]{\gdef\@title{#1}} +% \DeclareRobustCommand*{\author}[1]{\gdef\@author{#1}} +% \DeclareRobustCommand*{\date}[1]{\gdef\@date{#1}} % \end{macrocode} % The |\date| macro gets today's date by default. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex-dev/base/classes.ins b/Master/texmf-dist/source/latex-dev/base/classes.ins index b87115cee6b..b56871b111e 100644 --- a/Master/texmf-dist/source/latex-dev/base/classes.ins +++ b/Master/texmf-dist/source/latex-dev/base/classes.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/cmextra.ins b/Master/texmf-dist/source/latex-dev/base/cmextra.ins index 292bcd46d61..00a85544645 100644 --- a/Master/texmf-dist/source/latex-dev/base/cmextra.ins +++ b/Master/texmf-dist/source/latex-dev/base/cmextra.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2018 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2018 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file may only be distributed together with a copy of the LaTeX base system. You may however distribute the LaTeX base system without diff --git a/Master/texmf-dist/source/latex-dev/base/cmfonts.fdd b/Master/texmf-dist/source/latex-dev/base/cmfonts.fdd index 1c83814ee5d..f3303947926 100644 --- a/Master/texmf-dist/source/latex-dev/base/cmfonts.fdd +++ b/Master/texmf-dist/source/latex-dev/base/cmfonts.fdd @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/cmfonts.ins b/Master/texmf-dist/source/latex-dev/base/cmfonts.ins index 79da8994dba..b28cb7ba29d 100644 --- a/Master/texmf-dist/source/latex-dev/base/cmfonts.ins +++ b/Master/texmf-dist/source/latex-dev/base/cmfonts.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file may only be distributed together with a copy of the LaTeX base system. You may however distribute the LaTeX base system without diff --git a/Master/texmf-dist/source/latex-dev/base/doc.dtx b/Master/texmf-dist/source/latex-dev/base/doc.dtx index aad15515431..971bb6053eb 100644 --- a/Master/texmf-dist/source/latex-dev/base/doc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/doc.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/docstrip.dtx b/Master/texmf-dist/source/latex-dev/base/docstrip.dtx index be3dda6d32d..5ee3d1b7ae3 100644 --- a/Master/texmf-dist/source/latex-dev/base/docstrip.dtx +++ b/Master/texmf-dist/source/latex-dev/base/docstrip.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/docstrip.ins b/Master/texmf-dist/source/latex-dev/base/docstrip.ins index 61a9343af62..7b68b7ce85b 100644 --- a/Master/texmf-dist/source/latex-dev/base/docstrip.ins +++ b/Master/texmf-dist/source/latex-dev/base/docstrip.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -52,7 +52,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -65,7 +65,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/ec.ins b/Master/texmf-dist/source/latex-dev/base/ec.ins index c6115089819..196396a24a7 100644 --- a/Master/texmf-dist/source/latex-dev/base/ec.ins +++ b/Master/texmf-dist/source/latex-dev/base/ec.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file may only be distributed together with a copy of the LaTeX base system. You may however distribute the LaTeX base system without diff --git a/Master/texmf-dist/source/latex-dev/base/exscale.dtx b/Master/texmf-dist/source/latex-dev/base/exscale.dtx index 49e53ca5f87..575a89ce687 100644 --- a/Master/texmf-dist/source/latex-dev/base/exscale.dtx +++ b/Master/texmf-dist/source/latex-dev/base/exscale.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/exscale.ins b/Master/texmf-dist/source/latex-dev/base/exscale.ins index 4e4a36996de..cc8d8d9ae90 100644 --- a/Master/texmf-dist/source/latex-dev/base/exscale.ins +++ b/Master/texmf-dist/source/latex-dev/base/exscale.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/fix-cm.dtx b/Master/texmf-dist/source/latex-dev/base/fix-cm.dtx index b4311efa3c3..7f770cf8c00 100644 --- a/Master/texmf-dist/source/latex-dev/base/fix-cm.dtx +++ b/Master/texmf-dist/source/latex-dev/base/fix-cm.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/fix-cm.ins b/Master/texmf-dist/source/latex-dev/base/fix-cm.ins index 56a7923a133..eb4547d5761 100644 --- a/Master/texmf-dist/source/latex-dev/base/fix-cm.ins +++ b/Master/texmf-dist/source/latex-dev/base/fix-cm.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/fontdef.dtx b/Master/texmf-dist/source/latex-dev/base/fontdef.dtx index 36a31ef19bf..38d51411c39 100644 --- a/Master/texmf-dist/source/latex-dev/base/fontdef.dtx +++ b/Master/texmf-dist/source/latex-dev/base/fontdef.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -39,7 +39,7 @@ %<driver, >\ProvidesFile{fontdef.drv} % \fi % \ProvidesFile{fontdef.dtx} -%<-latexrelease> [2018/09/24 v3.0b LaTeX Kernel +%<-latexrelease> [2019/08/27 v3.0c LaTeX Kernel % \iftrue (\else %<text, >(Text %<math, >(Math @@ -837,7 +837,6 @@ % % \begin{macrocode} \DeclareMathSymbol{\aleph}{\mathord}{symbols}{"40} -\def\hbar{{\mathchar'26\mkern-9muh}} \DeclareMathSymbol{\imath}{\mathord}{letters}{"7B} \DeclareMathSymbol{\jmath}{\mathord}{letters}{"7C} \DeclareMathSymbol{\ell}{\mathord}{letters}{"60} @@ -849,13 +848,8 @@ \DeclareMathSymbol{\prime}{\mathord}{symbols}{"30} \DeclareMathSymbol{\emptyset}{\mathord}{symbols}{"3B} \DeclareMathSymbol{\nabla}{\mathord}{symbols}{"72} -\def\surd{{\mathchar"1270}} \DeclareMathSymbol{\top}{\mathord}{symbols}{"3E} \DeclareMathSymbol{\bot}{\mathord}{symbols}{"3F} -\def\angle{{\vbox{\ialign{$\m@th\scriptstyle##$\crcr - \not\mathrel{\mkern14mu}\crcr - \noalign{\nointerlineskip} - \mkern2.5mu\leaders\hrule \@height.34pt\hfill\mkern2.5mu\crcr}}}} \DeclareMathSymbol{\triangle}{\mathord}{symbols}{"34} \DeclareMathSymbol{\forall}{\mathord}{symbols}{"38} \DeclareMathSymbol{\exists}{\mathord}{symbols}{"39} @@ -869,6 +863,17 @@ \DeclareMathSymbol{\heartsuit}{\mathord}{symbols}{"7E} \DeclareMathSymbol{\spadesuit}{\mathord}{symbols}{"7F} % \end{macrocode} +% +% \changes{v3.0c}{2019/08/27}{Various commands made robust throughout +% the file} +% \begin{macrocode} +\DeclareRobustCommand\hbar{{\mathchar'26\mkern-9muh}} +\DeclareRobustCommand\surd{{\mathchar"1270}} +\DeclareRobustCommand\angle{{\vbox{\ialign{$\m@th\scriptstyle##$\crcr + \not\mathrel{\mkern14mu}\crcr + \noalign{\nointerlineskip} + \mkern2.5mu\leaders\hrule \@height.34pt\hfill\mkern2.5mu\crcr}}}} +% \end{macrocode} % % % \subsubsection{Large Operators} @@ -881,14 +886,14 @@ \DeclareMathSymbol{\bigcap}{\mathop}{largesymbols}{"54} \DeclareMathSymbol{\bigcup}{\mathop}{largesymbols}{"53} \DeclareMathSymbol{\intop}{\mathop}{largesymbols}{"52} - \def\int{\intop\nolimits} + \DeclareRobustCommand\int{\intop\nolimits} \DeclareMathSymbol{\prod}{\mathop}{largesymbols}{"51} \DeclareMathSymbol{\sum}{\mathop}{largesymbols}{"50} \DeclareMathSymbol{\bigotimes}{\mathop}{largesymbols}{"4E} \DeclareMathSymbol{\bigoplus}{\mathop}{largesymbols}{"4C} \DeclareMathSymbol{\bigodot}{\mathop}{largesymbols}{"4A} \DeclareMathSymbol{\ointop}{\mathop}{largesymbols}{"48} - \def\oint{\ointop\nolimits} + \DeclareRobustCommand\oint{\ointop\nolimits} \DeclareMathSymbol{\bigsqcup}{\mathop}{largesymbols}{"46} \DeclareMathSymbol{\smallint}{\mathop}{symbols}{"73} % \end{macrocode} @@ -961,7 +966,7 @@ \DeclareMathSymbol{\Leftrightarrow}{\mathrel}{symbols}{"2C} \DeclareMathSymbol{\Leftarrow}{\mathrel}{symbols}{"28} \DeclareMathSymbol{\Rightarrow}{\mathrel}{symbols}{"29} -\def\neq{\not=} \let\ne=\neq +\DeclareRobustCommand\neq{\not=} \let\ne=\neq \DeclareMathSymbol{\leq}{\mathrel}{symbols}{"14} \let\le=\leq \DeclareMathSymbol{\geq}{\mathrel}{symbols}{"15} @@ -987,7 +992,7 @@ \DeclareMathSymbol{\rightarrow}{\mathrel}{symbols}{"21} \let\to=\rightarrow \DeclareMathSymbol{\mapstochar}{\mathrel}{symbols}{"37} - \def\mapsto{\mapstochar\rightarrow} + \DeclareRobustCommand\mapsto{\mapstochar\rightarrow} \DeclareMathSymbol{\sim}{\mathrel}{symbols}{"18} \DeclareMathSymbol{\simeq}{\mathrel}{symbols}{"27} \DeclareMathSymbol{\perp}{\mathrel}{symbols}{"3F} @@ -1051,9 +1056,9 @@ \DeclareRobustCommand \Relbar{\mathrel{=}} \DeclareMathSymbol{\lhook}{\mathrel}{letters}{"2C} - \def\hookrightarrow{\lhook\joinrel\rightarrow} + \DeclareRobustCommand\hookrightarrow{\lhook\joinrel\rightarrow} \DeclareMathSymbol{\rhook}{\mathrel}{letters}{"2D} - \def\hookleftarrow{\leftarrow\joinrel\rhook} + \DeclareRobustCommand\hookleftarrow{\leftarrow\joinrel\rhook} \DeclareRobustCommand \bowtie{\mathrel\triangleright\joinrel\mathrel\triangleleft} % \end{macrocode} @@ -1155,43 +1160,45 @@ % \subsubsection{Over and under something, etc} % % \begin{macrocode} -\def\overrightarrow#1{\vbox{\m@th\ialign{##\crcr +\DeclareRobustCommand\overrightarrow[1]{\vbox{\m@th\ialign{##\crcr \rightarrowfill\crcr\noalign{\kern-\p@\nointerlineskip} $\hfil\displaystyle{#1}\hfil$\crcr}}} -\def\overleftarrow#1{\vbox{\m@th\ialign{##\crcr +\DeclareRobustCommand\overleftarrow[1]{\vbox{\m@th\ialign{##\crcr \leftarrowfill\crcr\noalign{\kern-\p@\nointerlineskip}% $\hfil\displaystyle{#1}\hfil$\crcr}}} -\def\overbrace#1{\mathop{\vbox{\m@th\ialign{##\crcr\noalign{\kern3\p@}% +\DeclareRobustCommand\overbrace[1] + {\mathop{\vbox{\m@th\ialign{##\crcr\noalign{\kern3\p@}% \downbracefill\crcr\noalign{\kern3\p@\nointerlineskip}% $\hfil\displaystyle{#1}\hfil$\crcr}}}\limits} -\def\underbrace#1{\mathop{\vtop{\m@th\ialign{##\crcr +\DeclareRobustCommand\underbrace[1]{\mathop{\vtop{\m@th\ialign{##\crcr $\hfil\displaystyle{#1}\hfil$\crcr \noalign{\kern3\p@\nointerlineskip}% \upbracefill\crcr\noalign{\kern3\p@}}}}\limits} % \end{macrocode} % (quite a waste of tokens, IMHO --- Frank) % \begin{macrocode} -\def\skew#1#2#3{{\muskip\z@#1mu\divide\muskip\z@\tw@ \mkern\muskip\z@ +\DeclareRobustCommand\skew[3] + {{\muskip\z@#1mu\divide\muskip\z@\tw@ \mkern\muskip\z@ #2{\mkern-\muskip\z@{#3}\mkern\muskip\z@}\mkern-\muskip\z@}{}} % \end{macrocode} % % \changes{v2.2n}{1995/11/21}{Incorporate changed figures, % as in plain.tex} % \begin{macrocode} -\def\rightarrowfill{$\m@th\smash-\mkern-7mu% +\DeclareRobustCommand\rightarrowfill{$\m@th\smash-\mkern-7mu% \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill \mkern-7mu\mathord\rightarrow$} -\def\leftarrowfill{$\m@th\mathord\leftarrow\mkern-7mu% +\DeclareRobustCommand\leftarrowfill{$\m@th\mathord\leftarrow\mkern-7mu% \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill \mkern-7mu\smash-$} \DeclareMathSymbol{\braceld}{\mathord}{largesymbols}{"7A} \DeclareMathSymbol{\bracerd}{\mathord}{largesymbols}{"7B} \DeclareMathSymbol{\bracelu}{\mathord}{largesymbols}{"7C} \DeclareMathSymbol{\braceru}{\mathord}{largesymbols}{"7D} -\def\downbracefill{$\m@th \setbox\z@\hbox{$\braceld$}% +\DeclareRobustCommand\downbracefill{$\m@th \setbox\z@\hbox{$\braceld$}% \braceld\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\braceru \bracelu\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\bracerd$} -\def\upbracefill{$\m@th \setbox\z@\hbox{$\braceld$}% +\DeclareRobustCommand\upbracefill{$\m@th \setbox\z@\hbox{$\braceld$}% \bracelu\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\bracerd \braceld\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\braceru$} % \end{macrocode} @@ -1295,8 +1302,8 @@ % \end{macrocode} % % \begin{macrocode} -\def\mathsterling{\mathit{\mathchar"7024}} -\def\mathunderscore{\kern.06em\vbox{\hrule\@width.3em}} +\DeclareRobustCommand\mathsterling{\mathit{\mathchar"7024}} +\DeclareRobustCommand\mathunderscore{\kern.06em\vbox{\hrule\@width.3em}} % \end{macrocode} % \end{macro} % \end{macro} @@ -1307,7 +1314,7 @@ % \begin{macro}{\mathellipsis} % This is plain \TeX's |\ldots|. % \begin{macrocode} -\def\mathellipsis{\mathinner{\ldotp\ldotp\ldotp}}% +\DeclareRobustCommand\mathellipsis{\mathinner{\ldotp\ldotp\ldotp}}% % \end{macrocode} % \end{macro} % @@ -1321,13 +1328,13 @@ %<*math|latexrelease> %<latexrelease>\IncludeInRelease{2018/12/01}% %<latexrelease> {\Big}{Start LR-mode}% -\def\big#1{\leavevmode@ifvmode +\DeclareRobustCommand\big[1]{\leavevmode@ifvmode {\hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}}} -\def\Big#1{\leavevmode@ifvmode +\DeclareRobustCommand\Big[1]{\leavevmode@ifvmode {\hbox{$\left#1\vbox to11.5\p@{}\right.\n@space$}}} -\def\bigg#1{\leavevmode@ifvmode +\DeclareRobustCommand\bigg[1]{\leavevmode@ifvmode {\hbox{$\left#1\vbox to14.5\p@{}\right.\n@space$}}} -\def\Bigg#1{\leavevmode@ifvmode +\DeclareRobustCommand\Bigg[1]{\leavevmode@ifvmode {\hbox{$\left#1\vbox to17.5\p@{}\right.\n@space$}}} %</math|latexrelease> %<latexrelease>\EndIncludeInRelease diff --git a/Master/texmf-dist/source/latex-dev/base/format.ins b/Master/texmf-dist/source/latex-dev/base/format.ins index 3a7782a06e0..5a1bf6e79c6 100644 --- a/Master/texmf-dist/source/latex-dev/base/format.ins +++ b/Master/texmf-dist/source/latex-dev/base/format.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2018 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -16,7 +16,7 @@ %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt %% and version 1.3c or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2018 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". @@ -101,7 +101,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". @@ -123,7 +123,7 @@ extension .ins) which are part of the distribution. This is a generated file. -Copyright 1993-2018 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -136,7 +136,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file may only be distributed together with a copy of the LaTeX base system. You may however distribute the LaTeX base system without diff --git a/Master/texmf-dist/source/latex-dev/base/graphpap.dtx b/Master/texmf-dist/source/latex-dev/base/graphpap.dtx index 5442c287cc8..7e4b322f326 100644 --- a/Master/texmf-dist/source/latex-dev/base/graphpap.dtx +++ b/Master/texmf-dist/source/latex-dev/base/graphpap.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/graphpap.ins b/Master/texmf-dist/source/latex-dev/base/graphpap.ins index 253d89baf95..eb1d356edc6 100644 --- a/Master/texmf-dist/source/latex-dev/base/graphpap.ins +++ b/Master/texmf-dist/source/latex-dev/base/graphpap.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/ifthen.dtx b/Master/texmf-dist/source/latex-dev/base/ifthen.dtx index b538f895d06..1a289df1c35 100644 --- a/Master/texmf-dist/source/latex-dev/base/ifthen.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ifthen.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ifthen.ins b/Master/texmf-dist/source/latex-dev/base/ifthen.ins index 6b3008e1799..acfa2fcf433 100644 --- a/Master/texmf-dist/source/latex-dev/base/ifthen.ins +++ b/Master/texmf-dist/source/latex-dev/base/ifthen.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/inputenc.dtx b/Master/texmf-dist/source/latex-dev/base/inputenc.dtx index 93f64577e20..65f260826de 100644 --- a/Master/texmf-dist/source/latex-dev/base/inputenc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/inputenc.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/inputenc.ins b/Master/texmf-dist/source/latex-dev/base/inputenc.ins index 80993e28197..0831576d768 100644 --- a/Master/texmf-dist/source/latex-dev/base/inputenc.ins +++ b/Master/texmf-dist/source/latex-dev/base/inputenc.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2019 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/latex209.dtx b/Master/texmf-dist/source/latex-dev/base/latex209.dtx index cc5563c632a..10de2958ba0 100644 --- a/Master/texmf-dist/source/latex-dev/base/latex209.dtx +++ b/Master/texmf-dist/source/latex-dev/base/latex209.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/latex209.ins b/Master/texmf-dist/source/latex-dev/base/latex209.ins index f0834e83df4..7bd0eed06a7 100644 --- a/Master/texmf-dist/source/latex-dev/base/latex209.ins +++ b/Master/texmf-dist/source/latex-dev/base/latex209.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/latexrelease.dtx b/Master/texmf-dist/source/latex-dev/base/latexrelease.dtx index 02194cee116..cfb1bff8aaa 100644 --- a/Master/texmf-dist/source/latex-dev/base/latexrelease.dtx +++ b/Master/texmf-dist/source/latex-dev/base/latexrelease.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/latexrelease.ins b/Master/texmf-dist/source/latex-dev/base/latexrelease.ins index 1ddcfc4c290..9358692a910 100644 --- a/Master/texmf-dist/source/latex-dev/base/latexrelease.ins +++ b/Master/texmf-dist/source/latex-dev/base/latexrelease.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2018 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2018 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/latexsym.dtx b/Master/texmf-dist/source/latex-dev/base/latexsym.dtx index 58e88d63649..52b12e0c36f 100644 --- a/Master/texmf-dist/source/latex-dev/base/latexsym.dtx +++ b/Master/texmf-dist/source/latex-dev/base/latexsym.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -31,7 +31,7 @@ % \iffalse % this is a METACOMMENT ! % % File `latexsym.dtx'. -% Copyright 1994-1998 by Frank Mittelbach. All rights reserved. +% Copyright (C) 1994-2019 by Frank Mittelbach. All rights reserved. % %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{latexsym} diff --git a/Master/texmf-dist/source/latex-dev/base/latexsym.ins b/Master/texmf-dist/source/latex-dev/base/latexsym.ins index 031e1d40629..7b42cf9132b 100644 --- a/Master/texmf-dist/source/latex-dev/base/latexsym.ins +++ b/Master/texmf-dist/source/latex-dev/base/latexsym.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". @@ -87,7 +87,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -100,7 +100,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file may only be distributed together with a copy of the LaTeX base system. You may however distribute the LaTeX base system without diff --git a/Master/texmf-dist/source/latex-dev/base/letter.dtx b/Master/texmf-dist/source/latex-dev/base/letter.dtx index d3d3fa4e6ab..b8a8f0a257f 100644 --- a/Master/texmf-dist/source/latex-dev/base/letter.dtx +++ b/Master/texmf-dist/source/latex-dev/base/letter.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/letter.ins b/Master/texmf-dist/source/latex-dev/base/letter.ins index 28d77dd3b53..b71c06b95ac 100644 --- a/Master/texmf-dist/source/latex-dev/base/letter.ins +++ b/Master/texmf-dist/source/latex-dev/base/letter.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/ltalloc.dtx b/Master/texmf-dist/source/latex-dev/base/ltalloc.dtx index 5da3582e556..4932dc707be 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltalloc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltalloc.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltbibl.dtx b/Master/texmf-dist/source/latex-dev/base/ltbibl.dtx index 79505680c43..0823620f992 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltbibl.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltbibl.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltboxes.dtx b/Master/texmf-dist/source/latex-dev/base/ltboxes.dtx index 6bfbc38af97..7e1c2c38b02 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltboxes.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltboxes.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2017 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltboxes.dtx} - [2017/03/29 v1.3a LaTeX Kernel (Box Commands)] + [2019/08/27 v1.3b LaTeX Kernel (Box Commands)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltboxes.dtx} @@ -53,6 +53,10 @@ % % % \changes{v1.1e}{1998/08/17}{(RmS) Minor Documentation fixes.} +% \changes{v1.3b}{2019/08/27}{Various commands made robust} +% +% +% % \section{\LaTeX\ Box commands} % % @@ -265,7 +269,7 @@ % {\cs{long} added} % The basic horizontal box command for \LaTeX. % \begin{macrocode} -\long\def\mbox#1{\leavevmode\hbox{#1}} +\DeclareRobustCommand\mbox[1]{\leavevmode\hbox{#1}} % \end{macrocode} % \end{macro} % @@ -483,7 +487,7 @@ % {\cs{long} added} % Save |#1| in a box register. % \begin{macrocode} -\long\def\sbox#1#2{\setbox#1\hbox{% +\DeclareRobustCommand\sbox[2]{\setbox#1\hbox{% \color@setgroup#2\color@endgroup}} % \end{macrocode} % \end{macro} @@ -579,7 +583,7 @@ % \begin{macro}{\usebox} % unchanged % \begin{macrocode} -\def\usebox#1{\leavevmode\copy #1\relax} +\DeclareRobustCommand\usebox[1]{\leavevmode\copy #1\relax} % \end{macrocode} % \end{macro} % @@ -589,7 +593,7 @@ % (Extra space removed 14 Jan 88) % RmS 92/08/24: Replaced occurrence of |\@halfwidth| by |\@wholewidth| % \begin{macrocode} -\long\def\frame#1{% +\DeclareRobustCommand\frame[1]{% \leavevmode \hbox{% \hskip-\@wholewidth @@ -631,7 +635,7 @@ % \changes{v1.0s}{1995/04/27} % {Move \cs{leavevmode} for graphics/1512} % \begin{macrocode} -\long\def\fbox#1{% +\DeclareRobustCommand\fbox[1]{% \leavevmode \setbox\@tempboxa\hbox{% \color@begingroup @@ -1140,7 +1144,7 @@ % \LaTeX\ version works outside math. % \task{???}{why the second `relax in `underline ?} % \begin{macrocode} -\def\underline#1{% +\DeclareRobustCommand\underline[1]{% \relax \ifmmode\@@underline{#1}% \else $\@@underline{\hbox{#1}}\m@th$\relax\fi} @@ -1274,9 +1278,9 @@ % right adjusted. % \begin{macrocode} \def\@@line{\hb@xt@\hsize} -\def\leftline#1{\@@line{#1\hss}} -\def\rightline#1{\@@line{\hss#1}} -\def\centerline#1{\@@line{\hss#1\hss}} +\DeclareRobustCommand\leftline[1]{\@@line{#1\hss}} +\DeclareRobustCommand\rightline[1]{\@@line{\hss#1}} +\DeclareRobustCommand\centerline[1]{\@@line{\hss#1\hss}} % \end{macrocode} % \end{macro} % \end{macro} @@ -1290,8 +1294,8 @@ % reference point without taking up space. % \end{macro} % \begin{macrocode} -\def\rlap#1{\hb@xt@\z@{#1\hss}} -\def\llap#1{\hb@xt@\z@{\hss#1}} +\DeclareRobustCommand\rlap[1]{\hb@xt@\z@{#1\hss}} +\DeclareRobustCommand\llap[1]{\hb@xt@\z@{\hss#1}} % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex-dev/base/ltclass.dtx b/Master/texmf-dist/source/latex-dev/base/ltclass.dtx index b3a23310130..3d19971701f 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltclass.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltclass.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2019 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltclass.dtx} - [2019/07/09 v1.3a LaTeX Kernel (Class & Package Interface)] + [2019/09/11 v1.3c LaTeX Kernel (Class & Package Interface)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltclass.dtx} @@ -155,11 +155,27 @@ % verbatim to the file name given as the first argument, together with % some comments about how it was produced. % -% The environment is allowed only before |\documentclass| to ensure -% that all packages or options necessary for this particular run are -% present when needed. The begin and end tags should each be on a -% line by itself. There is also a star-form; this does not write -% extra comments into the file. +% The package can also be called with an optional argument which is +% used to alter some of its behavior: option \texttt{force} or +% \texttt{overwrite} will allow for overwriting existing files, +% option \texttt{nosearch} will only check the current directory +% when looking if the file exists. This can be useful if you want to +% generate a local (modified) copy of some file that is already in the +% search tree of \TeX{}. Finally, you can use \texttt{nopremable} to +% prevent it from writing the standard blurb at the top of the file +% (this is actually the same as using the star form of the environment). +% +% The environment is now allowed anywhere in the document, but to ensure +% that all packages or options necessary are available when the +% document is run, it is normally best to place it at the top of your +% file (before \cs{documentclass}). +% A possible use case for using it inside the document body is if you +% want to reuse some text several times in the document you could then +% write it and later use \cs{input} to retrieve it where needed. +% +% +% The begin and end tags should each be on a +% line by itself. % % \subsection{Option processing} % @@ -1580,8 +1596,8 @@ % \end{macrocode} % % \begin{macrocode} -\def\AtBeginDocument{\g@addto@macro\@begindocumenthook} -\def\AtEndDocument{\g@addto@macro\@enddocumenthook} +\DeclareRobustCommand\AtBeginDocument{\g@addto@macro\@begindocumenthook} +\DeclareRobustCommand\AtEndDocument{\g@addto@macro\@enddocumenthook} \@onlypreamble\AtBeginDocument % \end{macrocode} % \end{macro} @@ -1707,10 +1723,67 @@ % \begin{macrocode} % \changes{v1.3a}{2019/07/01}{Support UTF8 and spaces in % filecontents environment file name} +% \changes{v1.3b}{2019/08/27}{Make various commands robust} +% \changes{v1.3c}{2019/09/11}{Support optional argument for filecontents} +% %</2ekernel> %<*2ekernel|latexrelease> %<latexrelease>\IncludeInRelease{2019/10/01}% -%<latexrelease> {\filec@ntents}{Spaces in file names}% +%<latexrelease> {\filec@ntents}{Spaces in file names + optional arg}% +% + + +% \end{macrocode} +% We use |@tempswa| to mean no preamble writing and reuse |@filesw| +% to indicate no overwriting: +% \begin{macrocode} +\def\filecontents{\@tempswatrue\@fileswtrue + \@ifnextchar[\filec@ntents@opt\filec@ntents +} +\@namedef{filecontents*}{\@tempswafalse\@fileswtrue + \@ifnextchar[\filec@ntents@opt\filec@ntents +} +% \end{macrocode} +% To handle the optional argument we execute for each option the +% command \cs{filec@ntents@OPTION} if it exist or complain about +% unknown option. +% \begin{macrocode} +\def\filec@ntents@opt[#1]{% + \@for\@tempa:=#1\do{% + \ifcsname filec@ntents@\@tempa\endcsname + \csname filec@ntents@\@tempa\endcsname + \else + \@latex@error{Unknown filecontents option #1}% + {Valid options are force (or overwrite), nosearch, noheader}% + \fi}% + \filec@ntents +} +% \end{macrocode} +% Option \texttt{force}) (or \texttt{overwrite}) changes the +% overwriting switch +% \begin{macrocode} +\let\filec@ntents@force\@fileswfalse +\let\filec@ntents@overwrite\@fileswfalse % alternative name +% \end{macrocode} +% and option \texttt{noheader} the preamble switch (which is +% equivalent to using the star form of the environment). +% \begin{macrocode} +\let\filec@ntents@noheader\@tempswafalse +% \end{macrocode} +% Option \texttt{nosearch} only checks the current directory not +% the how \TeX{} tree for the existence of the file to write. +% \begin{macrocode} +\def\filec@ntents@nosearch{% + \let\filec@ntents@checkdir\@currdir + \def\filec@ntents@where{in current directory}} +% \end{macrocode} +% By default we search the whole tree: +% \begin{macrocode} +\let\filec@ntents@checkdir\@empty +\def\filec@ntents@where{exists on the system} +% \end{macrocode} +% +% \begin{macrocode} \begingroup% \@tempcnta=1 \loop @@ -1725,15 +1798,10 @@ % \end{macrocode} % % \begin{macrocode} -\gdef\filecontents{\@tempswatrue\filec@ntents}% -\gdef\filecontents*{\@tempswafalse\filec@ntents}% -% \end{macrocode} -% -% \begin{macrocode} \gdef\filec@ntents#1{% - \set@curr@file{#1}% - \edef\q@curr@file{\expandafter\quote@name\expandafter{\@curr@file}}% - \openin\@inputcheck\q@curr@file \space % + \set@curr@file{\filec@ntents@checkdir#1}% + \edef\q@curr@file{\expandafter\quote@name\expandafter{\@curr@file}}% + \openin\@inputcheck\q@curr@file \space % \ifeof\@inputcheck% \@latex@warning@no@line% {Writing file `\@currdir\@curr@file'}% @@ -1751,13 +1819,54 @@ % \changes{v1.0y}{1997/10/10} % {Use \cs{@gobbletwo}} % \begin{macrocode} - \closein\@inputcheck% - \@latex@warning@no@line% - {File `\@curr@file' already exists on the system.\MessageBreak% + \if@filesw% + \@latex@warning@no@line% + {File `\@curr@file' already \filec@ntents@where.\MessageBreak% Not generating it from this source}% - \let\write\@gobbletwo% - \let\closeout\@gobble% + \let\write\@gobbletwo% + \let\closeout\@gobble% + \else% +% \end{macrocode} +% If we are overwriting, we try to make sure that the user is not +% by mistake overwriting the input file (\cs{jobname}). Of course, +% this only works for input files ending in \texttt{.tex}. If a +% different extension is used there is no way to see that we are +% overwriting outselves! +% \begin{macrocode} + \edef\reserved@a{#1}% + \edef\reserved@a{\detokenize\expandafter{\reserved@a}}% + \edef\reserved@b{\detokenize\expandafter{\jobname}}% + \ifx\reserved@a\reserved@b% + \@fileswtrue% + \else% + \edef\reserved@b{\reserved@b\detokenize{.tex}}% + \ifx\reserved@a\reserved@b + \@fileswtrue% + \fi% + \fi% +% \end{macrocode} +% We allocate a write channel but we open it only if it is +% (hopefully) safe. If not opened that means we are going to write +% on the terminal. +% \begin{macrocode} + \chardef\reserved@c15 % + \ch@ck7\reserved@c\write% + \if@filesw% % Foul ... trying to overwrite \jobname! + \@latex@error{Trying to overwrite `\jobname.tex'}{You can't % + write to the file you a reading from!\MessageBreak% + Data is written to screen instead.}% + \else% + \@latex@warning@no@line% + {Writing or overwriting file `\@currdir\@curr@file'}% + \immediate\openout\reserved@c#1\relax% + \fi% + \fi% \fi% +% \end{macrocode} +% Closing the \cs{@inputcheck} is done here ot avoid having to do +% this in each branch. +% \begin{macrocode} + \closein\@inputcheck% \if@tempswa% % \end{macrocode} % @@ -1848,7 +1957,16 @@ %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease %<latexrelease>\IncludeInRelease{0000/00/00}% -%<latexrelease> {\filec@ntents}{Spaces in file names}% +%<latexrelease> {\filec@ntents}{Spaces in file names + optional arg}% +%<latexrelease> +%<latexrelease>\let\filec@ntents@opt \@undefined +%<latexrelease>\let\filec@ntents@force \@undefined +%<latexrelease>\let\filec@ntents@overwrite \@undefined +%<latexrelease>\let\filec@ntents@noheader \@undefined +%<latexrelease>\let\filec@ntents@nosearch \@undefined +%<latexrelease>\let\filec@ntents@checkdir \@undefined +%<latexrelease>\let\filec@ntents@where \@undefined +%<latexrelease> %<latexrelease>\begingroup% %<latexrelease>\@tempcnta=1 %<latexrelease>\loop @@ -1948,12 +2066,16 @@ \T\I{Tab}{Spac}| \immediate\write\@unused{}} \global\let\endfilecontents*\endfilecontents -\@onlypreamble\filecontents -\@onlypreamble\endfilecontents -\@onlypreamble\filecontents* -\@onlypreamble\endfilecontents* +% \end{macrocode} +% We no longer prevent the code to be used after begin document (no +% rollback needed for this change). +% \begin{macrocode} +%\@onlypreamble\filecontents +%\@onlypreamble\endfilecontents +%\@onlypreamble\filecontents* +%\@onlypreamble\endfilecontents* \endgroup -\@onlypreamble\filec@ntents +%\@onlypreamble\filec@ntents % \end{macrocode} % \end{macro} % \end{macro} @@ -2559,7 +2681,7 @@ % % Most often the second argument (before-date-code) will be empty. % \begin{macrocode} -\long\def\IfTargetDateBefore#1{% +\DeclareRobustCommand\IfTargetDateBefore[1]{% \ifnum\pkgcls@innerdate <% \expandafter\@parse@version\expandafter0#1//00\@nil \typeout{Exclude code introduced on #1}% diff --git a/Master/texmf-dist/source/latex-dev/base/ltcntrl.dtx b/Master/texmf-dist/source/latex-dev/base/ltcntrl.dtx index c4e755eca71..eb1b9319579 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltcntrl.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltcntrl.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx b/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx index 8158ef7c611..8217b3f91b8 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltdefns.dtx b/Master/texmf-dist/source/latex-dev/base/ltdefns.dtx index 3a7d6f06ea6..44d7bfde648 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltdefns.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltdefns.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltdefns.dtx} - [2018/09/26 v1.5e LaTeX Kernel (definition commands)] + [2019/08/27 v1.5f LaTeX Kernel (definition commands)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltdefns.dtx} @@ -1046,7 +1046,7 @@ % % \emph{Note}: setting |\protect| to any value other than |\relax| % whilst in `typesetting' mode will cause commands to go into an -% infinite loop! In particular, setting |\relax| to |\@empty| will +% infinite loop! In particular, setting |\protect| to |\@empty| will % cause |\_| to loop forever. It will also break lots of other % things, such as protected |\ifmmode|s inside |\halign|s. If you % really really have to do such a thing, then please set @@ -1101,7 +1101,9 @@ % \end{macro} % % \begin{macro}{\@typeset@protect} -% +% We set \cs{@typeset@protect} to \cs{relax} rather than \cs{@empty} +% to make sure that the protection mechanism stops the look-ahead +% and expansion performed at the start of \cs{halign} cells. % \begin{macrocode} \let\@typeset@protect\relax % \end{macrocode} @@ -1166,12 +1168,27 @@ % % \begin{macro}{\MakeRobust} % \changes{v1.4a}{2015/01/08}{Added macro} -% -% The macro firstly checks if the controls sequence in question exists -% at all. +% \changes{v1.5f}{2019/08/27}{Make the assignments global as we may +% need to apply them inside a group} +% +% This macro makes an existing fragile macro robust, but only if it +% hasn't been robust in the past, i.e., it checks for the existence +% of the macro +% \verb*=\<name> = and if that exists it assumes that +% \verb=\<name>= is already robust. In that case either undefine +% the inner macro first or use \cs{DeclareRobustCommand} to +% define it in a robust way directly. We could probably test the +% top-level definition to have the right kind of structure, but +% this is somewhat problematical as we then have to distinguish +% between \cs{long} macros and others and also take into account +% that sometimes the top-level is deliberately dones manually (like +% with \cs{begin}). +% +% The macro firstly checks if the control sequence in question exists +% at all. % \begin{macrocode} %</2ekernel> -%<latexrelease>\IncludeInRelease{2015/01/01}{\MakeRobust}{\MakeRobust}% +%<latexrelease>\IncludeInRelease{2019/10/01}{\MakeRobust}{\MakeRobust}% %<*2ekernel|latexrelease> \def\MakeRobust#1{% \@ifundefined{\expandafter\@gobble\string#1}{% @@ -1189,12 +1206,12 @@ {% \@ifundefined{\expandafter\@gobble\string#1\space}% {% - \expandafter\let\csname + \global\expandafter\let\csname \expandafter\@gobble\string#1\space\endcsname=#1% \edef\reserved@a{\string#1}% \def\reserved@b{#1}% \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}% - \edef#1{% + \xdef#1{% \ifx\reserved@a\reserved@b \noexpand\x@protect\noexpand#1% \fi @@ -1206,6 +1223,32 @@ }% %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{2015/01/01}{\MakeRobust}{\MakeRobust}% +%<latexrelease>\def\MakeRobust#1{% +%<latexrelease> \@ifundefined{\expandafter\@gobble\string#1}{% +%<latexrelease> \@latex@error{The control sequence `\string#1' is undefined!% +%<latexrelease> \MessageBreak There is nothing here to make robust}% +%<latexrelease> \@eha +%<latexrelease> }% +%<latexrelease> {% +%<latexrelease> \@ifundefined{\expandafter\@gobble\string#1\space}% +%<latexrelease> {% +%<latexrelease> \expandafter\let\csname +%<latexrelease> \expandafter\@gobble\string#1\space\endcsname=#1% +%<latexrelease> \edef\reserved@a{\string#1}% +%<latexrelease> \def\reserved@b{#1}% +%<latexrelease> \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}% +%<latexrelease> \edef#1{% +%<latexrelease> \ifx\reserved@a\reserved@b +%<latexrelease> \noexpand\x@protect\noexpand#1% +%<latexrelease> \fi +%<latexrelease> \noexpand\protect\expandafter\noexpand +%<latexrelease> \csname\expandafter\@gobble\string#1\space\endcsname}% +%<latexrelease> }% +%<latexrelease> {\@latex@info{The control sequence `\string#1' is already robust}}% +%<latexrelease> }% +%<latexrelease>}% +%<latexrelease>\EndIncludeInRelease %<latexrelease>\IncludeInRelease{0000/00/00}{\MakeRobust}{\MakeRobust}% %<latexrelease>\let\MakeRobust\@undefined %<latexrelease>\EndIncludeInRelease @@ -1213,6 +1256,49 @@ % \end{macrocode} % \end{macro} % +% +% + +% \begin{macro}{\kernel@make@fragile} +% The opposite of |\MakeRobust| execpt that it doesn't do many +% checks as it is internal to the kernel. Why does one want such a +% thing? +% Only for compatibility reasons if \texttt{latexrelease} requests +% a rollback of the kernel. For this reason we pretend that this +% command existed in all earler versions of \LaTeX{} i.e., we are +% not rolling it back since we need it precisely then. But we have +% to get it into the \texttt{latexrelease} file so that a roll +% forward is possible too. +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\kernel@make@fragile}{Undo robustness}% +\def\kernel@make@fragile#1{% + \@ifundefined{\expandafter\@gobble\string#1\space}% +% \end{macrocode} +% If not robust do nothing. +% \begin{macrocode} + {}% +% \end{macrocode} +% Otherwise copy \verb*=\foo = back to \verb=\foo= and then undefine +% the payload command. +% \begin{macrocode} + {% + \global\expandafter\let\expandafter #1\csname + \expandafter\@gobble\string#1\space\endcsname + \global\expandafter\let\csname + \expandafter\@gobble\string#1\space\endcsname\@undefined + }% +} +%<latexrelease>\EndIncludeInRelease +%</2ekernel|latexrelease> +%<*2ekernel> +% \end{macrocode} +% \end{macro} +% +% +% % \subsection{Internal defining commands} % % These commands are used internally to define other \LaTeX{} @@ -1392,19 +1478,6 @@ \def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch} % \end{macrocode} % \end{macro} - -% \changes{v1.0n}{1994/05/10}{Added \cs{makeatletter} and -% \cs{makeatother} ASAJ.} -% -% \begin{macro}{\makeatletter} -% \begin{macro}{\makeatother} -% Make internal control sequences accessible or inaccessible. -% \begin{macrocode} -\def\makeatletter{\catcode`\@11\relax} -\def\makeatother{\catcode`\@12\relax} -% \end{macrocode} -% \end{macro} -% \end{macro} % % % \begin{macro}{\@ifstar} @@ -1459,6 +1532,22 @@ % \end{macrocode} % \end{macro} % +% +% +% \begin{macro}{\makeatletter} +% \begin{macro}{\makeatother} +% \changes{v1.0n}{1994/05/10}{Added \cs{makeatletter} and +% \cs{makeatother} ASAJ.} +% Make internal control sequences accessible or inaccessible. +% \begin{macrocode} +\DeclareRobustCommand\makeatletter{\catcode`\@11\relax} +\DeclareRobustCommand\makeatother{\catcode`\@12\relax} +% \end{macrocode} +% \end{macro} +% \end{macro} +% + +% % \section{Discretionary Hyphenation} % \begin{macro}{\-} % \changes{1.2x}{1995/12/13}{Documentation changed.} @@ -1535,6 +1624,56 @@ \@includeinreleasefalse % \end{macrocode} % +% \changes{v1.5f}{2019/08/27}{Make various commands robust} +% +% Delayed from |ltplain.dtx| +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\allowbreak}{Make various commands robust}% +\MakeRobust\allowbreak +\MakeRobust\bigbreak +\MakeRobust\break +\MakeRobust\dotfill +\MakeRobust\frenchspacing +\MakeRobust\goodbreak +\MakeRobust\hrulefill +\MakeRobust\medbreak +\MakeRobust\nobreak +\MakeRobust\nonfrenchspacing +\MakeRobust\obeylines +\MakeRobust\obeyspaces +\MakeRobust\slash +\MakeRobust\smallbreak +\MakeRobust\strut +\MakeRobust\underbar +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\allowbreak}{Make various commands robust}% +%<latexrelease> +%<latexrelease>\kernel@make@fragile\allowbreak +%<latexrelease>\kernel@make@fragile\bigbreak +%<latexrelease>\kernel@make@fragile\break +%<latexrelease>\kernel@make@fragile\dotfill +%<latexrelease>\kernel@make@fragile\frenchspacing +%<latexrelease>\kernel@make@fragile\goodbreak +%<latexrelease>\kernel@make@fragile\hrulefill +%<latexrelease>\kernel@make@fragile\medbreak +%<latexrelease>\kernel@make@fragile\nobreak +%<latexrelease>\kernel@make@fragile\nonfrenchspacing +%<latexrelease>\kernel@make@fragile\obeylines +%<latexrelease>\kernel@make@fragile\obeyspaces +%<latexrelease>\kernel@make@fragile\slash +%<latexrelease>\kernel@make@fragile\smallbreak +%<latexrelease>\kernel@make@fragile\strut +%<latexrelease>\kernel@make@fragile\underbar +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% % \begin{macrocode} %</2ekernel> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex-dev/base/ltdirchk.dtx b/Master/texmf-dist/source/latex-dev/base/ltdirchk.dtx index 75f9e1d5320..b9db177f195 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltdirchk.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltdirchk.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2019 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/lterror.dtx b/Master/texmf-dist/source/latex-dev/base/lterror.dtx index daf645b8b8c..3f6c4369705 100644 --- a/Master/texmf-dist/source/latex-dev/base/lterror.dtx +++ b/Master/texmf-dist/source/latex-dev/base/lterror.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{lterror.dtx} - [2018/08/05 v1.2p LaTeX Kernel (errors)] + [2019/08/30 v1.2q LaTeX Kernel (errors)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{lterror.dtx} @@ -87,7 +87,7 @@ % \changes{v1.2p}{2016/10/15} % {Require e\TeX{}} % -% \section{Error handling} +% \section{Error handling and tracing} % % This section defines \LaTeX's error commands. % @@ -738,7 +738,6 @@ Type H <return> for immediate help.}% % out, since we decided to use catcode 15 instead. % \begin{macrocode} %\def\@invalidchar{\@latex@error{Invalid character in input}\@ehc} -%</2ekernel> % \end{macrocode} % \end{macro} % @@ -759,5 +758,44 @@ Type H <return> for immediate help.}% % In output routine, caused by a float environment or % |\marginpar| occurring in inner vertical mode. % +% +% \subsection{Tracing} +% +% The \texttt{trace} package implements the commands \cs{traceon} +% and \cs{traceoff} that work similar to \cs{tracingall} but skip +% certain code blocks that produce a lot of tracing output being of no +% interest during debugging (for example loading a font). +% Code blocks that should be hidden during tracing need +% to be surrounded by the macros \cs{conditionally@traceoff} +% and \cs{contionally@traceon}. +% +% For the kernel code the \texttt{trace} package then redefines a +% number of macros to include this tracing support. +% +% However, in order to allow any macro package to react to +% \cs{traceon} we also provide dummy definitions for the two +% commands in the kernel so that they can be used by external +% packages without the +% need to distinguish between \texttt{trace} being loaded or not. +% + +% \begin{macro}{\conditionally@traceon} +% \changes{v1.2q}{2019/08/30}{Macro added} +% \begin{macro}{\conditionally@traceoff} +% \changes{v1.2q}{2019/08/30}{Macro added} +% These are only dummy definitions. For details see the +% \texttt{trace} package. +% \begin{macrocode} +\let\conditionally@traceon\@empty +\let\conditionally@traceoff\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macrocode} +%</2ekernel> +% \end{macrocode} +% %\Finale \endinput diff --git a/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx b/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx index 7d628f52e1e..afb085a4174 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2019 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltfiles.dtx} - [2019/07/01 v1.2a LaTeX Kernel (File Handling)] + [2019/08/27 v1.2b LaTeX Kernel (File Handling)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltfiles.dtx} @@ -750,8 +750,9 @@ % \begin{macro}{\IfFileExists} % % \changes{v1.2a}{2019/07/01}{Support UTF-8} +% \changes{v1.2b}{2019/08/27}{Make command robust} % \begin{macrocode} -\def\IfFileExists#1{% +\DeclareRobustCommand\IfFileExists[1]{% \set@curr@file{#1}% \edef\q@curr@file{\expandafter\quote@name\expandafter{\@curr@file}}% \expandafter\IfFileExists@\expandafter{\q@curr@file}} @@ -761,8 +762,7 @@ % \begin{macro}{\IfFileExists@} % \changes{v0.9b}{1993/12/04}{Macro added} % \changes{v0.9p}{1994/01/18}{New Definition} -% \changes{v1.0t}{1995/05/25} -% {(CAR) added \cs{long}} +% \changes{v1.0t}{1995/05/25}{(CAR) added \cs{long}} % % \begin{macrocode} \long\def \IfFileExists@#1#2#3{% @@ -857,13 +857,14 @@ % {(CAR) added \cs{long}} % \changes{v1.1o}{2019/02/07}{Expand \cs{@filef@und} before executing % second argument (github/109)} +% \changes{v1.2b}{2019/08/27}{Make command robust} % \begin{macrocode} %</2ekernel> %<latexrelease>\IncludeInRelease{2019/10/01}% %<latexrelease> {\InputIfFileExists}{Don't lose the file name}% %<*2ekernel|latexrelease> % \begin{macrocode} -\long\def \InputIfFileExists#1#2{% +\DeclareRobustCommand \InputIfFileExists[2]{% \IfFileExists{#1}% {% \expandafter\@swaptwoargs\expandafter diff --git a/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx b/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx index db98a9cb8ff..de161a777ea 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfinal.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2019 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltfinal.dtx} - [2019/04/09 v2.1g LaTeX Kernel (Final Settings)] + [2019/08/27 v2.1g LaTeX Kernel (Final Settings)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltfinal.dtx} @@ -709,6 +709,7 @@ \let\UseRawInputEncoding\relax % \end{macrocode} % +% This ends the skipped code in Unicode engines: % \begin{macrocode} \fi %</2ekernel|latexrelease> diff --git a/Master/texmf-dist/source/latex-dev/base/ltfloat.dtx b/Master/texmf-dist/source/latex-dev/base/ltfloat.dtx index ac1e37688ee..7e0c35df22b 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfloat.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfloat.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltfntcmd.dtx b/Master/texmf-dist/source/latex-dev/base/ltfntcmd.dtx index e500ed871a2..e214057bc4b 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfntcmd.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfntcmd.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2019 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltfssbas.dtx b/Master/texmf-dist/source/latex-dev/base/ltfssbas.dtx index 11abbae1121..da9dab5d382 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfssbas.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfssbas.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2019 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -35,7 +35,7 @@ % % \ProvidesFile{ltfssbas.dtx} - [2019/07/09 v3.2c LaTeX Kernel (NFSS Basic Macros)] + [2019/08/27 v3.2d LaTeX Kernel (NFSS Basic Macros)] % \iffalse \documentclass{ltxdoc} \begin{document} @@ -145,21 +145,11 @@ % substitution font/shape macro.} % \changes{v1.0a}{1989/04/10}{Starting with version numbers!! % \cs{ifmmode} added in \cs{math@group}} -% \changes{v2.1w}{1994/11/17} -% {\cs{@tempa} to \cs{reserved@a}} -% \changes{v3.0z}{2015/02/21} -% {Removed autoload code} +% \changes{v2.1w}{1994/11/17}{\cs{@tempa} to \cs{reserved@a}} +% \changes{v3.0z}{2015/02/21}{Removed autoload code} +% \changes{v3.2d}{2019/08/27}{Make various commands robust} % % -% The `2ekernel' code ensures that a |\usepackage{autofss1}| is -% essentially ignored if a `full' format is being used that has -% picture mode already in the format. -% -% Note the |autofss2| loading is currently disabled. -% -% \begin{macrocode} -%<2ekernel>\expandafter\let\csname ver@autofss1.sty\endcsname\fmtversion -% \end{macrocode} % % % \section{Preliminary macros} @@ -817,7 +807,7 @@ % in the current size. If also the size should change one has to % issue a |\fontsize| command first. % \begin{macrocode} -\def\usefont#1#2#3#4{\fontencoding{#1}\fontfamily{#2}% +\DeclareRobustCommand\usefont[4]{\fontencoding{#1}\fontfamily{#2}% \fontseries{#3}\fontshape{#4}\selectfont \ignorespaces} % \end{macrocode} @@ -1838,7 +1828,7 @@ % \end{macrocode} % Version for engines other than Xe\TeX. % \begin{macrocode} -\gdef\showhyphens#1{% +\DeclareRobustCommand\showhyphens[1]{% \setbox0\vbox{% \color@begingroup \everypar{}% @@ -1862,7 +1852,7 @@ % suppressed from the terminal output by ensuring that % |\tracingonline| is locally zero. % \begin{macrocode} -\long\def\showhyphens#1{% +\DeclareRobustCommand\showhyphens[1]{% \setbox0\vbox{% \usefont{TU}{lmr}{m}{n}% \hsize 1sp % diff --git a/Master/texmf-dist/source/latex-dev/base/ltfsscmp.dtx b/Master/texmf-dist/source/latex-dev/base/ltfsscmp.dtx index 8157428fde5..d62eeb6f47b 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfsscmp.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfsscmp.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx b/Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx index cca3df4693c..d1284a08e8a 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfssdcl.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -36,7 +36,7 @@ % % \ProvidesFile{ltfssdcl.dtx} - [2016/02/18 v3.0r LaTeX Kernel (NFSS Declarative Interface)] + [2019/08/27 v3.0s LaTeX Kernel (NFSS Declarative Interface)] % \iffalse \documentclass{ltxdoc} \begin{document} @@ -1078,12 +1078,17 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\DeclareMathAlphabet} -% could do with more checks like allowing single number in |#4| -% lowercase in |#4| etc +% \begin{macro}{\DeclareMathAccent} +% Could do with more checks like allowing single number in |#4| +% lowercase in |#4| etc % \changes{v3.0r}{2016/02/18} % {Check for mathaccent not \cs{mathaccemt}} +% \changes{v3.0s}{2019/08/27}{Make math accents robust} % \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {DeclareMathAccent}{Make math accents robust}% \def\DeclareMathAccent#1#2#3#4{% \expandafter\in@\csname sym#3\expandafter\endcsname \expandafter{\group@list}% @@ -1097,9 +1102,14 @@ \advance\count\tw@-\count@ \if\relax\noexpand#1% is command? \edef\reserved@a{\noexpand\in@ - {\expandafter\@gobble\string\mathaccent}{\meaning#1}}% + {\expandafter\@gobble\string\mathaccent} + {\expandafter\meaning + \csname\expandafter\@gobble\string#1\space\endcsname}}% \reserved@a \ifin@ + \expandafter\let + \csname\expandafter\@gobble\string#1\space\endcsname + \@undefined \expandafter\set@mathaccent \csname sym#3\endcsname#1#2% {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% @@ -1123,21 +1133,87 @@ \@latex@error{Symbol font `#3' is not defined}\@eha \fi } +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {DeclareMathAccent}{Make math accents robust}% +%<latexrelease>\def\DeclareMathAccent#1#2#3#4{% +%<latexrelease> \expandafter\in@\csname sym#3\expandafter\endcsname +%<latexrelease> \expandafter{\group@list}% +%<latexrelease> \ifin@ +%<latexrelease> \begingroup +%<latexrelease> \count\z@=#4\relax +%<latexrelease> \count\tw@\count\z@ +%<latexrelease> \divide\count\z@\sixt@@n +%<latexrelease> \count@\count\z@ +%<latexrelease> \multiply\count@\sixt@@n +%<latexrelease> \advance\count\tw@-\count@ +%<latexrelease> \if\relax\noexpand#1% is command? +%<latexrelease> \edef\reserved@a{\noexpand\in@ +%<latexrelease> {\expandafter\@gobble\string\mathaccent}{\meaning#1}}% +%<latexrelease> \reserved@a +%<latexrelease> \ifin@ +%<latexrelease> \expandafter\set@mathaccent +%<latexrelease> \csname sym#3\endcsname#1#2% +%<latexrelease> {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% +%<latexrelease> \@font@info{Redeclaring math accent \string#1}% +%<latexrelease> \else +%<latexrelease> \expandafter\ifx +%<latexrelease> \csname\expandafter\@gobble\string#1\endcsname +%<latexrelease> \relax +%<latexrelease> \expandafter\set@mathaccent +%<latexrelease> \csname sym#3\endcsname#1#2% +%<latexrelease> {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% +%<latexrelease> \else +%<latexrelease> \@latex@error{Command `\string#1' already defined}\@eha +%<latexrelease> \fi +%<latexrelease> \fi +%<latexrelease> \else +%<latexrelease> \@latex@error{Not a command name: `\noexpand#1'}\@eha +%<latexrelease> \fi +%<latexrelease> \endgroup +%<latexrelease> \else +%<latexrelease> \@latex@error{Symbol font `#3' is not defined}\@eha +%<latexrelease> \fi +%<latexrelease>} +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% \begin{macrocode} \@onlypreamble\DeclareMathAccent % \end{macrocode} % \end{macro} % % \begin{macro}{\set@mathaccent} % \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\set@mathaccent}{makemath accents robust}% \def\set@mathaccent#1#2#3#4{% - \xdef#2{\mathaccent"\mathchar@type#3\hexnumber@#1#4\relax}} + \xdef#2{\mathaccent"\mathchar@type#3\hexnumber@#1#4\relax}% + \MakeRobust#2% +} \@onlypreamble\set@mathaccent +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\set@mathaccent}{makemath accents robust}% +%<latexrelease> +%<latexrelease>\def\set@mathaccent#1#2#3#4{% +%<latexrelease> \xdef#2{\mathaccent"\mathchar@type#3\hexnumber@#1#4\relax}} +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % \end{macro} % % \begin{macro}{\DeclareMathSymbol} % \changes{v3.0r}{2016/02/18} % {Check for mathchar not \cs{mathchar}} +% \changes{v3.0s}{2019/09/09}{Allow definition if the math symbol was +% a command already robust} % \begin{macrocode} \def\DeclareMathSymbol#1#2#3#4{% \expandafter\in@\csname sym#3\expandafter\endcsname @@ -1151,17 +1227,30 @@ \multiply\count@\sixt@@n \advance\count\tw@-\count@ \if\relax\noexpand#1% is command? +% \end{macrocode} +% Store the command name with a space attached inside +% \cs{reserved@@b} in case we look at a robust definition. +% \begin{macrocode} + \edef\reserved@b{\expandafter\noexpand + \csname\expandafter\@gobble\string#1\space\endcsname}% +% \end{macrocode} +% Test both \verb=#1= and \verb*=#1 = for containing \texttt{mathchar}. +% \begin{macrocode} \edef\reserved@a {\noexpand\in@{\expandafter\@gobble\string\mathchar}% - {\meaning#1}}% + {\meaning#1\expandafter\meaning\reserved@b}}% \reserved@a +% \end{macrocode} +% Drop \verb*=#1 = in case it was defined before. +% \begin{macrocode} + \global\expandafter\let\reserved@b\@undefined \ifin@ \expandafter\set@mathsymbol \csname sym#3\endcsname#1#2% {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% \@font@info{Redeclaring math symbol \string#1}% \else - \expandafter\ifx + \expandafter\ifx \csname\expandafter\@gobble\string#1\endcsname \relax \expandafter\set@mathsymbol @@ -1278,7 +1367,12 @@ % \begin{macro}{\@DeclareMathDelimiter} % \changes{v3.0r}{2016/02/18} % {Check for delimiter not \cs{delimiter}} +% \changes{v3.0s}{2019/08/27}{Make math delimiters robust} % \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\@DeclareMathDelimiter}{Make math delimiters robust}% \def\@DeclareMathDelimiter#1#2#3#4#5#6{% \expandafter\in@\csname sym#3\expandafter\endcsname \expandafter{\group@list}% @@ -1304,9 +1398,11 @@ \edef\reserved@d{\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% % \edef\reserved@a{\noexpand\in@ - {\expandafter\@gobble\string\delimiter}{\meaning#1}}% + {\expandafter\@gobble\string\delimiter}% + {\expandafter\meaning\csname\expandafter\@gobble\string#1\space\endcsname}}% \reserved@a \ifin@ + \expandafter\let\csname\expandafter\@gobble\string#1\space\endcsname\@undefined \expandafter\set@mathdelimiter \csname sym#3\expandafter\endcsname \csname sym#5\endcsname#1#2% @@ -1332,6 +1428,68 @@ \@latex@error{Symbol font `#3' is not defined}\@eha \fi } +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\@DeclareMathDelimiter}{Make math delimiters robust}% +%<latexrelease>\def\@DeclareMathDelimiter#1#2#3#4#5#6{% +%<latexrelease> \expandafter\in@\csname sym#3\expandafter\endcsname +%<latexrelease> \expandafter{\group@list}% +%<latexrelease> \ifin@ +%<latexrelease> \expandafter\in@\csname sym#5\expandafter\endcsname +%<latexrelease> \expandafter{\group@list}% +%<latexrelease> \ifin@ +%<latexrelease> \begingroup +%<latexrelease> \count\z@=#4\relax +%<latexrelease> \count\tw@\count\z@ +%<latexrelease> \divide\count\z@\sixt@@n +%<latexrelease> \count@\count\z@ +%<latexrelease> \multiply\count@\sixt@@n +%<latexrelease> \advance\count\tw@-\count@ +%<latexrelease> \edef\reserved@c{\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% +%<latexrelease> % +%<latexrelease> \count\z@=#6\relax +%<latexrelease> \count\tw@\count\z@ +%<latexrelease> \divide\count\z@\sixt@@n +%<latexrelease> \count@\count\z@ +%<latexrelease> \multiply\count@\sixt@@n +%<latexrelease> \advance\count\tw@-\count@ +%<latexrelease> \edef\reserved@d{\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% +%<latexrelease> % +%<latexrelease> \edef\reserved@a{\noexpand\in@ +%<latexrelease> {\expandafter\@gobble\string\delimiter}{\meaning#1}}% +%<latexrelease> \reserved@a +%<latexrelease> \ifin@ +%<latexrelease> \expandafter\set@mathdelimiter +%<latexrelease> \csname sym#3\expandafter\endcsname +%<latexrelease> \csname sym#5\endcsname#1#2% +%<latexrelease> \reserved@c\reserved@d +%<latexrelease> \@font@info{Redeclaring math delimiter \string#1}% +%<latexrelease> \else +%<latexrelease> \expandafter\ifx +%<latexrelease> \csname\expandafter\@gobble\string#1\endcsname +%<latexrelease> \relax +%<latexrelease> \expandafter\set@mathdelimiter +%<latexrelease> \csname sym#3\expandafter\endcsname +%<latexrelease> \csname sym#5\endcsname#1#2% +%<latexrelease> \reserved@c\reserved@d +%<latexrelease> \else +%<latexrelease> \@latex@error{Command `\string#1' already defined}\@eha +%<latexrelease> \fi +%<latexrelease> \fi +%<latexrelease> \endgroup +%<latexrelease> \else +%<latexrelease> \@latex@error{Symbol font `#5' is not defined}\@eha +%<latexrelease> \fi +%<latexrelease> \else +%<latexrelease> \@latex@error{Symbol font `#3' is not defined}\@eha +%<latexrelease> \fi +%<latexrelease>} +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% \begin{macrocode} \@onlypreamble\@DeclareMathDelimiter % \end{macrocode} % \end{macro} @@ -1384,10 +1542,27 @@ % % \changes{v2.1q}{1995/04/02}{fix pr/1329} % \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\set@mathdelimiter}{make delimiters robust}% \def\set@mathdelimiter#1#2#3#4#5#6{% \xdef#3{\delimiter"\mathchar@type#4\hexnumber@#1#5% - \hexnumber@#2#6 }} + \hexnumber@#2#6 }% + \MakeRobust#3% +} \@onlypreamble\set@mathdelimiter +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\set@mathdelimiter}{make delimiters robust}% +%<latexrelease> +%<latexrelease>\def\set@mathdelimiter#1#2#3#4#5#6{% +%<latexrelease> \xdef#3{\delimiter"\mathchar@type#4\hexnumber@#1#5% +%<latexrelease> \hexnumber@#2#6 }} +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex-dev/base/ltfssini.dtx b/Master/texmf-dist/source/latex-dev/base/ltfssini.dtx index 4d545f22405..b073a5cc379 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfssini.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfssini.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2019 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -36,7 +36,7 @@ % % \ProvidesFile{ltfssini.dtx} - [2019/07/09 v3.1c LaTeX Kernel (NFSS Initialisation)] + [2019/08/27 v3.1d LaTeX Kernel (NFSS Initialisation)] % \iffalse \documentclass{ltxdoc} \begin{document} @@ -80,6 +80,7 @@ % {(DPC) Make file from previous file, lfonts.dtx 1995/05/23 v2.2e} % \changes{v3.1b}{2016/10/15} % {Require e\TeX{}} +% \changes{v3.1d}{2019/08/27}{Make various commands robust} % % % \section{NFSS Initialisation} @@ -268,9 +269,9 @@ % Finally we provide two abbreviations to switch to the \LaTeX{} % \emph{versions}. % \begin{macrocode} -\def\boldmath{\@nomath\boldmath +\DeclareRobustCommand\boldmath{\@nomath\boldmath \mathversion{bold}} -\def\unboldmath{\@nomath\unboldmath +\DeclareRobustCommand\unboldmath{\@nomath\unboldmath \mathversion{normal}} % \end{macrocode} % Here we switch to the default math version by defining the internal @@ -293,7 +294,10 @@ % without changes to the source. % \begin{macrocode} \def\newfont#1#2{\@ifdefinable#1{\font#1=#2\relax}} -\def\symbol#1{\char #1\relax} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareRobustCommand\symbol[1]{\char #1\relax} % \end{macrocode} % \end{macro} % \end{macro} @@ -332,7 +336,7 @@ % assume that the standard math fonts are used. Thus it needs % changing in case other math encodings are used. % \begin{macrocode} -\def\oldstylenums#1{% +\DeclareRobustCommand\oldstylenums[1]{% \begingroup % \end{macrocode} % Provide spacing using the interword space of the current font. diff --git a/Master/texmf-dist/source/latex-dev/base/ltfsstrc.dtx b/Master/texmf-dist/source/latex-dev/base/ltfsstrc.dtx index 0270fcb066c..05dafa20c6e 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltfsstrc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltfsstrc.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/lthyphen.dtx b/Master/texmf-dist/source/latex-dev/base/lthyphen.dtx index 32b73bf8926..ba4b018dce7 100644 --- a/Master/texmf-dist/source/latex-dev/base/lthyphen.dtx +++ b/Master/texmf-dist/source/latex-dev/base/lthyphen.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltidxglo.dtx b/Master/texmf-dist/source/latex-dev/base/ltidxglo.dtx index cb46fde90a8..19349c17dc1 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltidxglo.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltidxglo.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltidxglo.dtx} - [1996/01/20 v1.1e LaTeX Kernel (Index and Glossary)] + [2019/08/27 v1.1f LaTeX Kernel (Index and Glossary)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltidxglo.dtx} @@ -76,6 +76,7 @@ % \changes{v1.1a}{1994/05/19}{Initial version of ltidxglo.dtx, % split from ltidxbib.dtx} % \changes{v1.1d}{1995/10/25}{Doc cleanup} +% \changes{v1.1f}{2019/08/27}{Make \cs{index} and \cs{gloassary} robust} % % % \begin{oldcomments} diff --git a/Master/texmf-dist/source/latex-dev/base/ltlength.dtx b/Master/texmf-dist/source/latex-dev/base/ltlength.dtx index fab7c6fdd2b..7b72946d6e9 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltlength.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltlength.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltlength.dtx} - [2015/01/08 v1.1c LaTeX Kernel (Lengths)] + [2019/08/27 v1.1d LaTeX Kernel (Lengths)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltlength.dtx} @@ -59,10 +59,9 @@ % % \changes{v1.0c}{1994/03/29} % {Create file ltcntlen from parts of ltmiscen and ltherest.} -% \changes{v1.1a}{1994/05/19} -% {Extract file ltlength from ltcntlen.} -% \changes{v1.1b}{1995/08/11} -% {Doc typos fixed for latex/753} +% \changes{v1.1a}{1994/05/19}{Extract file ltlength from ltcntlen.} +% \changes{v1.1b}{1995/08/11}{Doc typos fixed for latex/753} +% \changes{v1.1d}{2019/08/27}{Make various command robust} % % \section{Lengths} % @@ -141,9 +140,9 @@ % Clear the memory afterwards (which might be a lot). % \begin{macrocode} \setbox\@tempboxa\box\voidb@x} -\def\settoheight{\@settodim\ht} -\def\settodepth {\@settodim\dp} -\def\settowidth {\@settodim\wd} +\DeclareRobustCommand\settoheight{\@settodim\ht} +\DeclareRobustCommand\settodepth {\@settodim\dp} +\DeclareRobustCommand\settowidth {\@settodim\wd} % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex-dev/base/ltlists.dtx b/Master/texmf-dist/source/latex-dev/base/ltlists.dtx index d59b7ac4f48..4dcbb8b56a2 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltlists.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltlists.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltlogos.dtx b/Master/texmf-dist/source/latex-dev/base/ltlogos.dtx index 1754d066300..ab20b60c59f 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltlogos.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltlogos.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltlogos.dtx} - [1998/08/17 v1.1i LaTeX Kernel (Logos)] + [2019/08/27 v1.1j LaTeX Kernel (Logos)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltlogos.dtx} @@ -70,9 +70,10 @@ % \begin{macro}{\TeX} % The \TeX{} logo, adjusted so that a full stop after the logo % counts as ending a sentence. +% \changes{v1.1j}{2019/08/27}{Make \cs{TeX} command robust} % \begin{macrocode} %<*2ekernel> -\def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} +\DeclareRobustCommand\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex-dev/base/ltmath.dtx b/Master/texmf-dist/source/latex-dev/base/ltmath.dtx index d7c283f9ef8..c38f42b4f95 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltmath.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltmath.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -38,7 +38,7 @@ %<*driver> % \fi \ProvidesFile{ltmath.dtx} - [2018/09/24 v1.2b LaTeX Kernel (Math Setup)] + [2019/08/27 v1.2c LaTeX Kernel (Math Setup)] % \iffalse %</driver> % @@ -95,49 +95,50 @@ % \changes{v1.0r}{1995/05/07}{Use \cs{hb@xt@}} % \changes{v1.0r}{1995/05/21}{Update some plain macros} % \changes{v1.0t}{1995/06/28}{minor doc edits} +% \changes{v1.2c}{2019/08/27}{Make various commands robust} % % \begin{macro}{\log} % The standard operators: % \begin{macrocode} -\def\log{\mathop{\operator@font log}\nolimits} -\def\lg{\mathop{\operator@font lg}\nolimits} -\def\ln{\mathop{\operator@font ln}\nolimits} -\def\lim{\mathop{\operator@font lim}} -\def\limsup{\mathop{\operator@font lim\,sup}} -\def\liminf{\mathop{\operator@font lim\,inf}} -\def\sin{\mathop{\operator@font sin}\nolimits} -\def\arcsin{\mathop{\operator@font arcsin}\nolimits} -\def\sinh{\mathop{\operator@font sinh}\nolimits} -\def\cos{\mathop{\operator@font cos}\nolimits} -\def\arccos{\mathop{\operator@font arccos}\nolimits} -\def\cosh{\mathop{\operator@font cosh}\nolimits} -\def\tan{\mathop{\operator@font tan}\nolimits} -\def\arctan{\mathop{\operator@font arctan}\nolimits} -\def\tanh{\mathop{\operator@font tanh}\nolimits} -\def\cot{\mathop{\operator@font cot}\nolimits} -\def\coth{\mathop{\operator@font coth}\nolimits} -\def\sec{\mathop{\operator@font sec}\nolimits} -\def\csc{\mathop{\operator@font csc}\nolimits} -\def\max{\mathop{\operator@font max}} -\def\min{\mathop{\operator@font min}} -\def\sup{\mathop{\operator@font sup}} -\def\inf{\mathop{\operator@font inf}} -\def\arg{\mathop{\operator@font arg}\nolimits} -\def\ker{\mathop{\operator@font ker}\nolimits} -\def\dim{\mathop{\operator@font dim}\nolimits} -\def\hom{\mathop{\operator@font hom}\nolimits} -\def\det{\mathop{\operator@font det}} -\def\exp{\mathop{\operator@font exp}\nolimits} -\def\Pr{\mathop{\operator@font Pr}} -\def\gcd{\mathop{\operator@font gcd}} -\def\deg{\mathop{\operator@font deg}\nolimits} +\DeclareRobustCommand\log{\mathop{\operator@font log}\nolimits} +\DeclareRobustCommand\lg{\mathop{\operator@font lg}\nolimits} +\DeclareRobustCommand\ln{\mathop{\operator@font ln}\nolimits} +\DeclareRobustCommand\lim{\mathop{\operator@font lim}} +\DeclareRobustCommand\limsup{\mathop{\operator@font lim\,sup}} +\DeclareRobustCommand\liminf{\mathop{\operator@font lim\,inf}} +\DeclareRobustCommand\sin{\mathop{\operator@font sin}\nolimits} +\DeclareRobustCommand\arcsin{\mathop{\operator@font arcsin}\nolimits} +\DeclareRobustCommand\sinh{\mathop{\operator@font sinh}\nolimits} +\DeclareRobustCommand\cos{\mathop{\operator@font cos}\nolimits} +\DeclareRobustCommand\arccos{\mathop{\operator@font arccos}\nolimits} +\DeclareRobustCommand\cosh{\mathop{\operator@font cosh}\nolimits} +\DeclareRobustCommand\tan{\mathop{\operator@font tan}\nolimits} +\DeclareRobustCommand\arctan{\mathop{\operator@font arctan}\nolimits} +\DeclareRobustCommand\tanh{\mathop{\operator@font tanh}\nolimits} +\DeclareRobustCommand\cot{\mathop{\operator@font cot}\nolimits} +\DeclareRobustCommand\coth{\mathop{\operator@font coth}\nolimits} +\DeclareRobustCommand\sec{\mathop{\operator@font sec}\nolimits} +\DeclareRobustCommand\csc{\mathop{\operator@font csc}\nolimits} +\DeclareRobustCommand\max{\mathop{\operator@font max}} +\DeclareRobustCommand\min{\mathop{\operator@font min}} +\DeclareRobustCommand\sup{\mathop{\operator@font sup}} +\DeclareRobustCommand\inf{\mathop{\operator@font inf}} +\DeclareRobustCommand\arg{\mathop{\operator@font arg}\nolimits} +\DeclareRobustCommand\ker{\mathop{\operator@font ker}\nolimits} +\DeclareRobustCommand\dim{\mathop{\operator@font dim}\nolimits} +\DeclareRobustCommand\hom{\mathop{\operator@font hom}\nolimits} +\DeclareRobustCommand\det{\mathop{\operator@font det}} +\DeclareRobustCommand\exp{\mathop{\operator@font exp}\nolimits} +\DeclareRobustCommand\Pr{\mathop{\operator@font Pr}} +\DeclareRobustCommand\gcd{\mathop{\operator@font gcd}} +\DeclareRobustCommand\deg{\mathop{\operator@font deg}\nolimits} % \end{macrocode} % \end{macro} % % \begin{macro}{\bmod} % And some operators have to be done by hand: % \begin{macrocode} -\def\bmod{% +\DeclareRobustCommand\bmod{% \nonscript\mskip-\medmuskip\mkern5mu% \mathbin{\operator@font mod}\penalty900\mkern5mu% \nonscript\mskip-\medmuskip} @@ -146,7 +147,7 @@ % % \begin{macro}{\pmod} % \begin{macrocode} -\def\pmod#1{% +\DeclareRobustCommand\pmod[1]{% \allowbreak\mkern18mu({\operator@font mod}\,\,#1)} % \end{macrocode} % \end{macro} @@ -156,18 +157,18 @@ % \begin{macro}{\big} % Variants on |\big| and friends for use with delimiters: % \begin{macrocode} -\def\bigl{\mathopen\big} -\def\bigm{\mathrel\big} -\def\bigr{\mathclose\big} -\def\Bigl{\mathopen\Big} -\def\Bigm{\mathrel\Big} -\def\Bigr{\mathclose\Big} -\def\biggl{\mathopen\bigg} -\def\biggm{\mathrel\bigg} -\def\biggr{\mathclose\bigg} -\def\Biggl{\mathopen\Bigg} -\def\Biggm{\mathrel\Bigg} -\def\Biggr{\mathclose\Bigg} +\DeclareRobustCommand\bigl{\mathopen\big} +\DeclareRobustCommand\bigm{\mathrel\big} +\DeclareRobustCommand\bigr{\mathclose\big} +\DeclareRobustCommand\Bigl{\mathopen\Big} +\DeclareRobustCommand\Bigm{\mathrel\Big} +\DeclareRobustCommand\Bigr{\mathclose\Big} +\DeclareRobustCommand\biggl{\mathopen\bigg} +\DeclareRobustCommand\biggm{\mathrel\bigg} +\DeclareRobustCommand\biggr{\mathclose\bigg} +\DeclareRobustCommand\Biggl{\mathopen\Bigg} +\DeclareRobustCommand\Biggm{\mathrel\Bigg} +\DeclareRobustCommand\Biggr{\mathclose\Bigg} % \end{macrocode} % \end{macro} % @@ -252,23 +253,55 @@ % {(DPC) use \cs{expandafter} instead of \cs{next}} % \changes{v1.0p}{1994/11/18} % {(DPC) colour support} + % \begin{macro}{\hphantom} % \begin{macro}{\vphantom} % \begin{macrocode} \newif\ifv@ \newif\ifh@ % \end{macrocode} +% +% +% +% +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\vphantom}{Make commands robust}% +% \end{macrocode} +% +% \begin{macrocode} +\DeclareRobustCommand\vphantom{\v@true\h@false\ph@nt} +% \end{macrocode} % % \begin{macrocode} -\def\vphantom{\v@true\h@false\ph@nt} +\DeclareRobustCommand\hphantom{\v@false\h@true\ph@nt} % \end{macrocode} % % \begin{macrocode} -\def\hphantom{\v@false\h@true\ph@nt} +\DeclareRobustCommand\phantom{\v@true\h@true\ph@nt} % \end{macrocode} % +% \begin{macro}{\mathstrut} +% \begin{macrocode} +\DeclareRobustCommand\mathstrut{\vphantom(} +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} -\def\phantom{\v@true\h@true\ph@nt} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\vphantom}{Make commands robust}% +%<latexrelease> +%<latexrelease>\kernel@make@fragile\vphantom +%<latexrelease>\kernel@make@fragile\hphantom +%<latexrelease>\kernel@make@fragile\phantom +%<latexrelease>\kernel@make@fragile\mathstrut +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % % \begin{macrocode} @@ -318,11 +351,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\mathstrut} -% \begin{macrocode} -\def\mathstrut{\vphantom(} -% \end{macrocode} -% \end{macro} % % \begin{macro}{\smash} % \changes{v1.0p}{1994/11/18} @@ -330,7 +358,7 @@ % \changes{v1.0p}{1994/11/18} % {(DPC) colour support} % \begin{macrocode} -\def\smash{% +\DeclareRobustCommand\smash{% \relax % \relax, in case this comes first in \halign \ifmmode \expandafter\mathpalette\expandafter\mathsm@sh @@ -368,19 +396,26 @@ % \end{macrocode} % \end{macro} % -% +% +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\cases}{Make commands robust}% +% \end{macrocode} +% % \begin{macro}{\cases} % \changes{LaTeX2.09}{1991/08/14} % {(RmS) inserted extra braces around entry for NFSS} % \begin{macrocode} -\def\cases#1{\left\{\,\vcenter{\normalbaselines\m@th +\DeclareRobustCommand\cases[1]{\left\{\,\vcenter{\normalbaselines\m@th \ialign{$##\hfil$&\quad{##}\hfil\crcr#1\crcr}}\right.} % \end{macrocode} % \end{macro} % % \begin{macro}{\matrix} % \begin{macrocode} -\def\matrix#1{\null\,\vcenter{\normalbaselines\m@th +\DeclareRobustCommand\matrix[1]{\null\,\vcenter{\normalbaselines\m@th \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr \mathstrut\crcr\noalign{\kern-\baselineskip} #1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}\,} @@ -389,10 +424,24 @@ % % \begin{macro}{\pmatrix} % \begin{macrocode} -\def\pmatrix#1{\left(\matrix{#1}\right)} +\DeclareRobustCommand\pmatrix[1]{\left(\matrix{#1}\right)} % \end{macrocode} % \end{macro} % +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\cases}{Make commands robust}% +%<latexrelease> +%<latexrelease>\kernel@make@fragile\cases +%<latexrelease>\kernel@make@fragile\matrix +%<latexrelease>\kernel@make@fragile\pmatrix +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% % % \begin{macro}{\bordermatrix} % \changes{LaTeX2e}{1994/01/25}{Removed \cs{p@renwd}.} @@ -475,7 +524,7 @@ % % \begin{macro}{\*} % \begin{macrocode} -\def\*{\discretionary{\thinspace\the\textfont2\char2}{}{}} +\DeclareRobustCommand\*{\discretionary{\thinspace\the\textfont2\char2}{}{}} % \end{macrocode} % \end{macro} % @@ -712,7 +761,7 @@ % \begin{macro}{\stackrel} % A disguise for plain \TeX's buildrel. % \begin{macrocode} -\def\stackrel#1#2{\mathrel{\mathop{#2}\limits^{#1}}} +\DeclareRobustCommand\stackrel[2]{\mathrel{\mathop{#2}\limits^{#1}}} % \end{macrocode} % \end{macro} % @@ -724,7 +773,7 @@ % \begin{macro}{\frac} % A disguise for plain \TeX's |\over|. % \begin{macrocode} -\def\frac#1#2{{\begingroup#1\endgroup\over#2}} +\DeclareRobustCommand\frac[2]{{\begingroup#1\endgroup\over#2}} % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex-dev/base/ltmiscen.dtx b/Master/texmf-dist/source/latex-dev/base/ltmiscen.dtx index 122ef3b39bf..8cd61207514 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltmiscen.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltmiscen.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltmiscen.dtx} - [2018/10/11 v1.1o LaTeX Kernel (Misc. Environments)] + [2019/08/29 v1.1p LaTeX Kernel (Misc. Environments)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltmiscen.dtx} @@ -72,6 +72,7 @@ % \changes{v1.1d}{1996/06/03}{Move setting of verbatim font and % \cs{@noligs}.} % \changes{v1.1g}{1998/08/17}{(RmS) Minor documentation fixes.} +% \changes{v1.1p}{2019/08/27}{Make various commands robust} % % \section{Miscellaneous Environments} % This section implements the basic environment mechanism, and also @@ -505,8 +506,13 @@ % remember line number. Used by \cs{@badend} to display % position of non-matching \cs{begin}.} % \changes{v1.1e}{1996/07/26}{remove \cs{global} before \cs{@ignore...}} +% \changes{v1.1p}{2019/08/27}{Make command robust} % \begin{macrocode} -\def\begin#1{% +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\begin}{Making \begin/\end robust}% +\DeclareRobustCommand\begin[1]{% \@ifundefined{#1}% {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}% {\def\reserved@a{\def\@currenvir{#1}% @@ -515,17 +521,123 @@ \@ignorefalse \begingroup\@endpefalse\reserved@a} % \end{macrocode} -% \end{macro} +% A version that doesn't start out with \cs{relax} when in +% typesetting mode would be the following, but since \cs{begin} +% issues a \cs{begingroup} it wouldn't help much with respect to +% allowing things like \cs{noalign} or \cs{multicolumn} inside. +% \begin{macrocode} +%\edef\begin +% {\unexpanded{% +% \ifx\protect\@typeset@protect +% \expandafter\@gobble +% \fi +% \protect +% }% +% \expandafter\noexpand\csname begin \endcsname +% } +%\@namedef{begin }#1{% +% \@ifundefined{#1}% +% {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}% +% {\def\reserved@a{\def\@currenvir{#1}% +% \edef\@currenvline{\on@line}% +% \csname #1\endcsname}}% +% \@ignorefalse +% \begingroup\@endpefalse\reserved@a} +% \end{macrocode} % % \begin{macro}{\end} +% While \cs{begin} was made robust simply by using +% \cs{DeclareRobustCommand} we need to be a bit more subtle with +% \cs{end} as there are packages out there that try to look into +% the top-level contents of \verb=\end{foo}= (that is at the expansion +% of \verb=\endfoo=) to see if it contains certain macros. This is +% done by hitting \verb=\end{foo}= with three \cs{expandafter}s, +% the first to get +%\begin{verbatim} +% \csname endfoo\endcsname \@checkend{foo}% etc. +%\end{verbatim} +% the second to expand the \cs{csname}, i.e., to get to +%\begin{verbatim} +% \endfoo \@checkend{foo}% etc. +%\end{verbatim} +% and the third to finally get to the top-level content of +% \verb=\endfoo=, i.e. +%\begin{verbatim} +% <top-level content of \endfoo> \@checkend{foo}% etc. +%\end{verbatim} +% Therefore a robust replacement should produce the same results +% after three expansions (there first is obviously different). +% +% Basically the definition of \cs{end} should either produce +% \verb*=\protect\end = (when not doing typesetting) or it should +% produce \verb*=\end = (without the \cs{protect}) when doing typesetting. +% Furthermore, it should (when in typesetting mode) show exactly the +% same result as +% \verb*=\end = (which is the original fragile definition +% of \cs{end}) when you expand either of them twice, i.e., +%\begin{verbatim} +% \endfoo \@checkend{foo}% etc. +%\end{verbatim} +% That is achieved with the code below (which is worth studying +% carefully). +% +% There is some trickery involved here: in particular we use +% \cs{romannumeral} to change a single expansion into three +% successive expansions in one go. That primitive expands until it +% has scanned a number (0 in this case, so it doesn't produce any +% output) and so it allows us to place arbitrary many +% \cs{expandafter}s inside that are all going to be executed when +% \cs{romannumeral} is hit by a single \cs{expandafter}. +% % \changes{v1.1e}{1996/07/26}{remove \cs{global} before \cs{@ignore...}} +% \changes{v1.1p}{2019/08/27}{Make command robust} +% +% \begin{macrocode} +\edef\end + {\unexpanded{% + \romannumeral + \ifx\protect\@typeset@protect + \expandafter %1 + \expandafter %2 + \expandafter %1 + \expandafter %3 expands the \csname inside \end<space> + \expandafter %1 + \expandafter %2 expands \end<space> + \expandafter %1 expands the \else + \z@ + \else + \expandafter\z@\expandafter\protect + \fi + }% + \expandafter\noexpand\csname end \endcsname + } +% \end{macrocode} +% And here is the original definition of \cs{end} the way it was in +% \LaTeX{} for several decades now hidden in \verb*=\end =. % \begin{macrocode} -\def\end#1{% +\@namedef{end }#1{% \csname end#1\endcsname\@checkend{#1}% \expandafter\endgroup\if@endpe\@doendpe\fi \if@ignore\@ignorefalse\ignorespaces\fi} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% An here the rollback in case that is ever needed. +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\begin}{Making \begin/\end robust}% +%<latexrelease>\kernel@make@fragile\begin +%<latexrelease>\kernel@make@fragile\end +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % \end{macro} +% \end{macro} +% +% +% +% % % \begin{macro}{\@checkend} % \begin{macrocode} @@ -598,6 +710,7 @@ % \begin{macrocode} \def\@icentercr[#1]{\vskip #1\ignorespaces} % \end{macrocode} +% % \end{macro} % % @@ -615,15 +728,57 @@ % \end{macrocode} % \end{environment} % +% +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\centering}{Make commands robust}% +% \end{macrocode} +% % \begin{macro}{\centering} % \begin{macrocode} -\def\centering{% +\DeclareRobustCommand\centering{% \let\\\@centercr \rightskip\@flushglue\leftskip\@flushglue \parindent\z@\parfillskip\z@skip} % \end{macrocode} % \end{macro} % +% \begin{macro}{\raggedright} +% \begin{macrocode} +\DeclareRobustCommand\raggedright{% + \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip + \leftskip\z@skip + \parindent\z@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\raggedleft} +% \begin{macrocode} +\DeclareRobustCommand\raggedleft{% + \let\\\@centercr + \rightskip\z@skip\leftskip\@flushglue + \parindent\z@\parfillskip\z@skip} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\centering}{Make commands robust}% +%<latexrelease> +%<latexrelease>\kernel@make@fragile\centering +%<latexrelease>\kernel@make@fragile\raggedright +%<latexrelease>\kernel@make@fragile\raggedleft +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% +% % \begin{macro}{\@rightskip} % \begin{macrocode} \newskip\@rightskip \@rightskip \z@skip @@ -644,14 +799,6 @@ % \end{macrocode} % \end{environment} % -% \begin{macro}{\raggedright} -% \begin{macrocode} -\def\raggedright{% - \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip - \leftskip\z@skip - \parindent\z@} -% \end{macrocode} -% \end{macro} % % \begin{environment}{flushright} % \changes{v0.9h}{1993/12/13}{Removed optional argument of \cs{item}} @@ -667,15 +814,6 @@ % \end{macrocode} % \end{environment} % -% \begin{macro}{\raggedleft} -% \begin{macrocode} -\def\raggedleft{% - \let\\\@centercr - \rightskip\z@skip\leftskip\@flushglue - \parindent\z@\parfillskip\z@skip} -% \end{macrocode} -% \end{macro} -% % % \subsection{Verbatim} % diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews01.tex b/Master/texmf-dist/source/latex-dev/base/ltnews01.tex deleted file mode 100644 index 92090e17d01..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews01.tex +++ /dev/null @@ -1,152 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews01.tex - -% This is issue 1 of LaTeX News. - -\documentclass -% [type1fonts] - {ltnews} - -\publicationmonth{June} -\publicationyear{1994} -\publicationissue{1} - -\begin{document} - -\maketitle - -\section{Welcome to \LaTeXNews} - -An issue of \emph{\LaTeXNews} will accompany every future release of -\LaTeX. It will tell you about important events, such as major bug -fixes, newly available packages, or any other \LaTeX{} news. - -\section{\LaTeXe---the new \LaTeX{} release} - -The most important news is the release of \LaTeXe, the new version of -the \LaTeX{} software. This version has better support for fonts, -graphics and colour, and will be actively maintained by the \LaTeX3 -project team. Upgrades will be issued every six months, in June and -December. - -\section{Why a new \LaTeX?} - -Over the years many extensions have been developed for \LaTeX. This -is, of course, a sure sign of its continuing popularity but it has had -one unfortunate result: incompatible \LaTeX{} formats came into use at -different sites. Thus, to process documents from various places, a -site maintainer was forced to keep \LaTeX{} (with and without \NFSS), -\SLiTeX, \AmSLaTeX, and so on. In addition, when looking at a source -file it was not always clear for which format the document was written. - -To put an end to this unsatisfactory -situation a new release of \LaTeX{} was produced. -It brings all such extensions back under a single format and thus -prevents the proliferation of mutually incompatible dialects of -\LaTeX~2.09. The new release was available for several months as a -test version, and the final release of 1~June officially -replaces the old version. - -\section{Processing documents with \LaTeXe} - -Documents written for \LaTeX~2.09 will -still be read by \LaTeXe. Any such document is run in -\emph{\LaTeX~2.09 compatibility mode}. - -Unfortunately, compatibility mode comes with a price: it can run -up to 50\% slower than \LaTeX~2.09 did. If you want to run your document -in the faster \emph{native mode}, you should try replacing the line: -\begin{verbatim} - \documentstyle[<options>,<packages>]{<class>} -\end{verbatim} -with: -\begin{verbatim} - \documentclass[<options>]{<class>} - \usepackage{latexsym,<packages>} -\end{verbatim} -Unfortunately, this will not always work, because some \LaTeX~2.09 -packages will only work in \LaTeXe{} compatibility mode. You should find -out if there is a \LaTeXe{} version of the package available. - -\LaTeXe{} native mode also gives access to the new features of \LaTeXe, -described in \emph{\LaTeXe{} for authors}. - -\section{New packages} - -\LaTeXe{} has much better support for graphics, colour, fonts, and -multi-lingual typesetting. The following software should be available -from the distributor who brought you \LaTeXe: - -\begin{citations} -\item[babel] for typesetting in many languages. -\item[color] for colour support. -\item[graphics] for including images. -\item[mfnfss] for using bitmap fonts. -\item[psnfss] for using Type~1 fonts. -\item[tools] other packages by the \LaTeX3 team. -\end{citations} -The packages come with full documentation, and are also described in -\emph{\LaTeX: A Document Processing System} or -\emph{The \LaTeX{} Companion}. - -\section{Further information} - -More information about \LaTeXe{} is to be found in: - -\begin{citations} -\item[\LaTeX: A Document Preparation System] - Leslie Lamport, \AW, 2nd ed, 1994. -\item[The \LaTeX{} Companion] - Goossens, Mittelbach and Samarin, \AW, 1994. -\end{citations} -The \LaTeX{} distribution comes with documentation on the new features of -\LaTeX: - -\begin{citations} -\item[\LaTeXe{} for authors] - describes the new features of \LaTeX{} documents, - in the file \verb|usrguide.tex|. -\item[\LaTeXe{} for class and package writers] - describes the new features of \LaTeX{} classes and packages, - in the file \verb|clsguide.tex|. -\item[\LaTeXe{} font selection] - describes the new features of \LaTeX{} fonts for - class and package writers, - in the file \verb|fntguide.tex|. -\end{citations} -For more information on \TeX{} and \LaTeX, get in touch with your local -\TeX{} Users Group, or the international \TeX{} Users Group, -P.~O.~Box~869, Santa~Barbara, CA~93102-0869, USA, Fax:~+1~805~963~8358, -EMail:~tug@tug.org. - -\end{document} - - - diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews02.tex b/Master/texmf-dist/source/latex-dev/base/ltnews02.tex deleted file mode 100644 index d46cb1b52f5..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews02.tex +++ /dev/null @@ -1,154 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews02.tex - -% This is issue 2 of LaTeX News. - -\documentclass -% [lw35fonts] - {ltnews} - -\publicationmonth{December} -\publicationyear{1994} -\publicationissue{2} - -\begin{document} - -\maketitle - -\section{Welcome to \LaTeXNews~2} - -An issue of \emph{\LaTeXNews} will accompany every future release of -\LaTeX. It will tell you about important events, such as major bug -fixes, newly available packages, or any other \LaTeX{} news. - -\section{December 1994 release of \LaTeX} - -December 1994 sees the second release of \LaTeXe. We are on schedule -to deliver a release of \LaTeX{} every six months, in December and -June. - -This release has seen quite a lot of activity, which is not too -surprising as it's only been a year since the first test release of -\LaTeXe. We don't expect so much activity in the next six months. - -Many of the changes are minor improvements and bug-fixes---see -\emph{\LaTeXe{} for authors} (\verb|usrguide.tex|), \emph{\LaTeXe{} -font selection} (\verb|fntguide.tex|) and our change log -(\verb|changes.txt|) for more details. - -However, there are two important new packages available for \LaTeX: -\texttt{inputenc} and AMS-\LaTeX. - -\section{Accented input} - -One of the problems with writing non-English documents in \LaTeX{} is -the accent commands. Reading documents containing text like -\verb|na\"\i ve| is frustrating, especially if your keyboard allows -you to type \texttt{na\"\i ve}. - -In the past, \LaTeX{} has not supported input containing accented -characters such as \texttt{\"\i}, because Windows, Macintosh and Unix -all have different ways of dealing with accented input, called -\emph{input encodings}. - -However, the \verb|inputenc| package allows you to specify which input -encoding your document is written with, for example to use the ISO -Latin-1 encoding, you type: -\begin{verbatim} - \usepackage[latin1]{inputenc} -\end{verbatim} -At the moment, \verb|inputenc| supports the \verb|ascii| and -\verb|latin1| input encodings, but more will be added with future -releases. - -The \verb|inputenc| package is -currently a test release. The user interface for the full release will -be upwardly compatible with the test version. - -\section{AMS-\LaTeX{}} - - AMS-\LaTeX{} is a set of miscellaneous extensions for \LaTeX{} - distributed by the American Mathematical Society. They provide superior - information structure and superior printed output for mathematical - documents. - - There are far too many features of AMS-\LaTeX{} to list here. - AMS-\LaTeX{} is described in the accompanying documentation, - and in \emph{The \LaTeX{} Companion}. - - Version 1.2beta of AMS-\LaTeX{} was released for testing by intrepid - users in October 1994. The full release of AMS-\LaTeX{}~1.2 is expected - in early January 1995. - - It will be divided into two bundles: - \begin{itemize} - - \item the \verb|amsfonts| packages, which give access to - hundreds of new mathematical symbols, and new math fonts - such as blackboard bold and fraktur. - - \item the \verb|amsmath| packages, which provide finer control over - mathematical typesetting, such as multi-line subscripts, - enhanced theorem and proof environments, - and improved displayed equations, - - \end{itemize} - For compatibility with older documents, an \verb|amstex| package will be - provided. - -\section{\LaTeX{} on the internet} - -\LaTeX{} has its own home page on the World Wide Web, with the URL: -\begin{verbatim} - http://www.tex.ac.uk/CTAN/latex/ -\end{verbatim} -This page describes \LaTeX{} and the \LaTeX3 project, and contains -pointers to other \LaTeX{} resources, such as the user guides, the -\TeX{} Frequently Asked Questions, and the \LaTeX{} bugs database. - -The electronic home of anything \TeX-related is the Comprehensive -\TeX{} Archive Network (CTAN). This is a network of cooperating ftp -sites, with over a gigabyte of \TeX{} material: -\begin{verbatim} - ftp://ftp.tex.ac.uk/tex-archive/ - ftp://ftp.shsu.edu/tex-archive/ - ftp://ftp.dante.de/tex-archive/ -\end{verbatim} -For more information, see the \LaTeX{} home page. - -\section{Further information} - -For more information on \TeX{} and \LaTeX, get in touch with your local -\TeX{} Users Group, or the international \TeX{} Users Group, -P.~O.~Box~869, Santa~Barbara, CA~93102-0869, USA, Fax:~+1~805~963~8358, -EMail:~tug@tug.org. - - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews03.tex b/Master/texmf-dist/source/latex-dev/base/ltnews03.tex deleted file mode 100644 index d7c8ff0b205..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews03.tex +++ /dev/null @@ -1,145 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews03.tex - -% This is issue 3 of LaTeX News. - -\documentclass -% [lw35fonts] - {ltnews} - -\publicationmonth{June} -\publicationyear{1995} -\publicationissue{3} - -\begin{document} - -\maketitle - -\section{Welcome to \LaTeXNews~3} - -An issue of \emph{\LaTeXNews} will accompany every future release of -\LaTeX. It will tell you about important events, such as major bug -fixes, newly available packages, or any other \LaTeX{} news. - -\section{June 1995 release of \LaTeX} - -June 1995 sees the third release of \LaTeXe. We are on schedule -to deliver a release of \LaTeX{} every six months, in December and -June. - -In the last \emph{\LaTeXNews}, we said ``we don't expect so much -activity in the next six months,'' which has turned out not to be -true! - -\section{Additional input encodings} - -In the last release of \LaTeX{} we distributed a test version of the -\texttt{inputenc} package which allows the use of input characters -other than just a--z and A--Z. The package has proved to be robust, -so we are now distributing an expanded version. -The new release comes with a number of input encodings: - -\begin{itemize} -\item \texttt{ascii} the standard encoding, -\item \texttt{latin1} the ISO Western European alphabet, -\item \texttt{latin2} the ISO Eastern European alphabet, -\item \texttt{cp437} the IBM codepage 437, -\item \texttt{cp850} the IBM codepage 850, and -\item \texttt{applemac} the Apple Macintosh encoding. -\end{itemize} -These can be used by specifying an option to the \texttt{inputenc} -package, for example: -\begin{verbatim} - \usepackage[latin1]{inputenc} -\end{verbatim} -The new input encodings are currently being tested, but we don't -expect any major changes. - -\section{\LaTeX\ getting smaller} - -In the past releases of \LaTeXe, the amount of memory \LaTeX{} -requires has increased, but we are pleased to say that this trend has -been reversed. We hope that future releases of \LaTeX{} will continue -to get smaller. - -For example, on this document, the December 1994 release used 52,622 -words of memory, and the June 1995 release uses 51,216 words of -memory, which is a 2.7\% reduction. - -We are currently experimenting with other ways of reducing the size of -\LaTeX. For example, we are experimenting with an option to remove -the \texttt{picture} and \texttt{tabbing} environments from the -\LaTeX{} kernel, and to load them from a file the first time they are -used. This should help \LaTeX{} to run on machines with limited -memory. See \texttt{autoload.txt} for details. - -\section{Distribution and modification} - -One topic of discussion that has kept us busy is the distribution and -modification conditions of \LaTeX. We are committed to keeping -\LaTeX{} as free reliable software, and ensuring that (as far as -possible) \LaTeX{} documents will produce the same results on all -systems. - -The modification conditions are currently under discussion, and we -would like to hear from anyone interested. Please read -\texttt{modguide.tex} for more information. - -\section{AMS-\LaTeX\ full release} - -The AMS-\LaTeX\ packages were still in beta test in the December 1994 -release of \LaTeX, and the full release came out in January 1995. - -AMS-\LaTeX\ is described in the \emph{User's Guide} -(\texttt{amsldoc.tex}) and in \emph{The \LaTeX{} Companion}. - -\section{PostScript fonts} - -There is a new test release of the PSNFSS packages for accessing -PostScript fonts in \LaTeXe. This includes an update to all of the -fonts, to remove many of the underfull and overfull \verb|\hbox| -warnings, and improve the setting of non-English languages. - -The new release of \LaTeX{} removes all of the `hidden' uses of -Computer Modern mathematics. For example, the footnote markers used -to use math mode, so always used Computer Modern digits rather than -ones from the current text font. This has now been fixed. - -\section{Further information} - -For more information on \TeX{} and \LaTeX, get in touch with your local -\TeX{} Users Group, or the international \TeX{} Users Group, -P.~O.~Box~869, Santa~Barbara, CA~93102-0869, USA, Fax:~+1~805~963~8358, -EMail:~tug@tug.org. - -The \LaTeX{} home page is \verb|http://www.tex.ac.uk/ctan/latex/| -and contains links to other WWW resources for \LaTeX. - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews04.tex b/Master/texmf-dist/source/latex-dev/base/ltnews04.tex deleted file mode 100644 index 15e95999521..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews04.tex +++ /dev/null @@ -1,143 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews04.tex - -% This is issue 4 of LaTeX News. - -\documentclass -% [lw35fonts] - {ltnews} - - -\publicationmonth{December} -\publicationyear{1995} -\publicationissue{4} - -\begin{document} - -\maketitle - -\section{Welcome to \LaTeXNews~4} - -An issue of \emph{\LaTeXNews} will accompany every future release of -\LaTeX. It will tell you about important events, such as major bug -fixes, newly available packages, or any other \LaTeX{} news. -This issue accompanies the fourth release of \LaTeXe. - - -\section{\LaTeX\ getting smaller} - -The last release in June started a trend of \LaTeX\ becoming -smaller, we are pleased to announce that this has continued with this -release. In particular the experimental `autoload' version described in -\texttt{autoload.txt} is much smaller as more parts of \LaTeX\ are -autoloaded. - -\section{New `concurrent' docstrip} - -The time taken to `unpack' this release from the documented sources -should be much reduced (roughly half the time, depending on -installation conditions). This is due to an improved version of the -docstrip program that has been contributed by Marcin Woli\'nski. -This can write up to 16 files at once. The -previous version could only write one file at a time which meant that -it was very slow when producing many small files from the same source -file as the source needed to be re-read for each file written. - -\section{New T1 encoded fonts} - -This year J\"org Knappen has completed a new release of the `Cork' -(T1) encoded Computer Modern fonts: the dc fonts release 1.2. - -This release of the dc fonts fixes many bugs (including the missing -\verb|?`| (?`) and \verb|!`| (!`) ligatures) and improves the fonts in -many other ways. It is strongly recommended that you upgrade as soon as -possible if currently you are using the old dc fonts, release 1.1 or -earlier. The new fonts are available from the CTAN archives, in -\texttt{tex-archive/fonts/dc}. - -The names of the font files are \emph{different}. This does not affect -\LaTeX\ documents but \emph{does} affect the installation procedure as -it assumes that you have the \emph{new} fonts, and will write suitable -`fd' files for those fonts. If you have not yet upgraded your dc fonts -then, after unpacking the distribution, you \emph{must} -\verb|latex olddc.ins| to produce `fd' files for the old dc fonts. -This must be done \emph{before} the format is made. Running the test -document at \texttt{ltxcheck.tex} the end of the installation will -inform you if the wrong set of `fd' files has been installed. - -Note that this change does not affect the standard `OT1' Computer -Modern fonts that \LaTeX\ uses by default. - -\section{More robust commands} - -The commands \verb|\cite| and \verb|\sqrt| are now robust. - -Although most commands with optional arguments are fragile, as -documented, such commands defined using the second optional argument -of \verb|\newcommand| and its derivatives are now \emph{robust}. - -\section{New Interface to building `extension' classes} - -The mechanism provided by \verb|\DeclareOption|, \verb|\ProcessOptions| -and \verb|\LoadClass| has proved to be a powerful and expressive means -of defining one class in terms of another `base' class. However there -have been some requests to simplify the declaration of the common case -where you want the `base' class to be called with \emph{all} the -options that were specified to the extension class. This is now -provided by the new command \verb|\LoadClassWithOptions|. A similar -command \verb|\RequirePackageWithOptions| is provided for package use. -More details of this feature are provided in \texttt{clsguide.tex} and -\texttt{ltclass.dtx}. - -\section{More Input Encodings} - -The experimental \texttt{inputenc} package allows a more natural style -of input of accented and other characters. - -Three new input encodings are now supported. -\begin{itemize} -\item \texttt{ansinew} the Windows ansi encoding, - as used in Microsoft Windows 3.x. -\item \texttt{cp437de} a variant of \texttt{cp437}, which uses \ss\ - rather than $\beta$ in the appropriate slot. -\item \texttt{next} the encoding used on Next computers. -\end{itemize} - -\section{Further information} - -For more information on \TeX{} and \LaTeX, get in touch with your local -\TeX{} Users Group, or the international \TeX{} Users Group, -1850 Union Street, \#1637, San Francisco, CA~94123, USA, -Fax:~+1~415~982~8559, -EMail:~tug@tug.org. -The \LaTeX{} home page is \verb|http://www.tex.ac.uk/ctan/latex/| -and contains links to other WWW resources for \LaTeX. - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews05.tex b/Master/texmf-dist/source/latex-dev/base/ltnews05.tex deleted file mode 100644 index 9416f0e4ed3..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews05.tex +++ /dev/null @@ -1,158 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews05.tex - -% This is issue 5 of LaTeX News. - -\documentclass -% [lw35fonts] - {ltnews} - -% \usepackage[T1]{fontenc} - -\publicationmonth{June} -\publicationyear{1996} -\publicationissue{5} - -\begin{document} - -\maketitle - -\section{Welcome to \LaTeXNews~5} -This issue of \emph{\LaTeXNews} accompanies the fifth release of the -new standard \LaTeX{}, \LaTeXe. - -\section{Extra possibilities for section headings} -Most \LaTeX\ sectioning commands are defined using -\verb|\@startsection|. -For example, the \textsf{article} class defines: -\begin{small} -\begin{verbatim} -\newcommand\section{\@startsection - {section}{1}{0pt}{-3.5ex plus-1ex minus-.2ex}% - {2.3ex plus.2ex}{\normalfont\Large\bfseries}} -\end{verbatim} -\end{small} -The last argument specifies the style in which the section heading is -to be typeset. - -The new feature added at this release is that at the \emph{end} of -this argument you may specify a command that \emph{takes an argument}. -This command will be applied to the section number and heading. -For example, one could use the \verb|\MakeUppercase| command to -produce uppercase headings. A package or class file could contain: -\begin{small} -\begin{verbatim} -\renewcommand\section{\@startsection - {section}{1}{0pt}{-3.5ex plus-1ex minus-.2ex}% - {2.3ex plus.2ex}{\normalfont\Large\MakeUppercase}} -\end{verbatim} -\end{small} -to produce section headings using uppercase medium weight text, rather -than the bold text used by \textsf{article}. Note that, like the font -choice, the uppercasing applies only to the actual heading (including -any automatically generated section number), not to the text as it may -appear in the running head or table of contents. - -\section{The `openany' option in the `book' class} -The \textsf{openany} option allows chapter and similar openings to -occur on left hand pages. Previously this option only affected -\verb|\chapter| and \verb|\backmatter|. It now also affects -\verb|\part|, \verb|\frontmatter| and \verb|\mainmatter|. - -\section{More font (output) encodings} -The font encoding name \texttt{T3} has been allocated to the encoding -used in the new 256-character \textsc{IPA} fonts (for the phonetic -alphabet) produced by Rei Fukui. His package, \textsf{tipa}, -gives access to these fonts and should soon be available. (The -encoding named \texttt{OT3} is the 128-character encoding used in the -\textsc{IPA} fonts produced by Washington State University.) - - - -\section{More input encodings supported} -The \textsf{inputenc} package now supports the IBM codepage~852 used -in Eastern Europe, with the option~\texttt{[cp852]} contributed by -Petr~Sojka. - -Also, the \textsf{inputenc} package now activates most `control codes' -with \textsc{ascii} values below 32. -Currently none of the encodings in the standard distribution makes use -of these positions. - -\section{Fixes and improvements} -The \LaTeX\ kernel has only had minor changes, apart from -\verb|\@startsection| mentioned above. -However, some small fixes have been incorporated removing the -following problems: - -\begin{itemize} -\item - In tabular and array, previous versions of \LaTeX\ `lost' the - inter-column space from an `\texttt{l}'-column, when that column - was completely empty. - -\item - Previously, the use of the \verb|\nofiles| command could change - the \emph{vertical spacing} in a document.\\ A side effect of fixing - this is that when \verb|\nofiles| is used, \verb|\label| puts a - blank line in the log file. - -\item - \LaTeX~often loads fonts `on demand'. Previously, this could - happen inside the argument of an accent command and this would - cause the accent to appear in the wrong place. - -\end{itemize} - -\section{Changes to the `tools' packages} - -\begin{itemize} -\item - The \textsf{longtable} package now uses a modified algorithm, - contributed by David Kastrup, to align the `chunks' of a table. - It is now unnecessary to edit the document to add - \verb|\setlongtables| before the final run of \LaTeX. - In certain cases of overlapping \verb|\multicolumn| entries, the new - algorithm will produce better column widths than the old (at the - price of extra passes through \LaTeX). - -\item - The \textsf{dcolumn} package now has the extra possibility of - specifying the number of digits both \emph{before} and after the - `decimal point'. This makes it easy to centre the column of numbers - under a wide heading. -\end{itemize} - -\section{New copy of the \LaTeX\ bug database} -\verb|http://www.tex.ac.uk/ctan/latex/bugs.html| will soon have links -to a copy of the searchable \LaTeX\ bugs database at Mainz (Germany) -as well as the original copy at Sussex (England). - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews06.tex b/Master/texmf-dist/source/latex-dev/base/ltnews06.tex deleted file mode 100644 index b5c7a28a245..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews06.tex +++ /dev/null @@ -1,149 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews06.tex - -% This is issue 6 of LaTeX News. - -\documentclass -% [lw35fonts] - {ltnews} - -% \usepackage[T1]{fontenc} - -\publicationmonth{December} -\publicationyear{1996} -\publicationissue{6} - -\begin{document} - -\maketitle - -\section{Welcome to \LaTeXNews~6} -This issue of \emph{\LaTeXNews} accompanies the sixth release of the -new standard \LaTeX{}, \LaTeXe. - -\section{Mono-case file names} -Previously \LaTeX\ has used some files with `mixed-case' file names -such as \texttt{T1cmr.fd} and \texttt{T1enc.def}. - -These file names cause problems on some systems (in particular they -are illegal on the ISO 9660 CDROM format) and so in this release -all file names have been made lowercase (for example -\texttt{t1cmr.fd} and \texttt{t1enc.def}). - -This change should \emph{not} affect any document. Within \LaTeX, -encodings still have the usual uppercase names in uses such as -\verb|\usepackage[T1]{fontenc}| and \verb|\fontencoding{T1}|. -\LaTeX\ will automatically convert to the lowercase form while -constructing the file name. -\LaTeX\ will input the `fd' file under the old name if it fails to -find the file with the new name, so existing collections of fd files -should still work with this new release. - -The change \emph{does} affect the configuration files that may be used -to make the \LaTeX\ format with initex. For example, the file -\texttt{fonttext.ltx} previously specified \verb|\input{T1cmr.fd}|. -It now has \verb|\input{t1cmr.fd}|. -If you use a local file \texttt{fonttext.cfg} -you will need to make similar changes, as \verb|\input{T1cmr.fd}| -will not work as \texttt{T1cmr.fd} is no longer in the distribution. - -The files affected by this change all have names of the form -\verb|*.fd| or \verb|*enc.def|. - -\section{Another input encoding} -Thanks to work by S\o ren Sandmann, the \textsf{inputenc} package now -supports the IBM codepage~865 used in Scandinavia. - -\section{Better user-defined math display environments} -Suppose that you want to define an environment for displaying text -that is numbered as an equation. A straightforward way to do this is -as follows: -\begin{verbatim} - \newenvironment{texteqn} - {\begin{equation} - \begin{minipage}{0.9\linewidth}} - {\end{minipage} - \end{equation}} -\end{verbatim} -However, if you have tried this then you will probably have noticed -that it does not work perfectly when used in the middle of a paragraph -because an inter-word space appears at the beginning of the first -line after the environment. - -There is now an extra command (with a very long name) available that -you can use to avoid this problem; it should be inserted as shown here: -\begin{verbatim} - \newenvironment{texteqn} - {\begin{equation} - \begin{minipage}{0.9\linewidth}} - {\end{minipage} - \end{equation} - \ignorespacesafterend} -\end{verbatim} - -\section{Docstrip improvements} -The \textsf{docstrip} program that is used to unpack the \LaTeX\ -sources has undergone further development. The new version should be -able to process all old `batchfiles' but it allows a simpler syntax in -new `batchfiles' (no need to define \verb|\def\batchfile{|\ldots). - -It also allows `target' directories to be specified when writing -files. This directory support is disabled by default unless activated -in a local \texttt{docstrip.cfg} configuration file. -See \texttt{docstrip.dtx} for details. - -\section{AMS \LaTeX\ update} -Since the last \LaTeX\ release in June, the American Mathematical -Society have re-issued the `AMS\LaTeX' classes and packages, fixing -several reported problems. - -\section{Graphics package update} -The \LaTeX\ color and graphics packages have been updated slightly, -principally to support more dvi drivers, see the readme file in the -\textsf{graphics} distribution. - -\section{EC Fonts released} -The first release of the Extended Computer Modern fonts has just been -made. (In January 1997.) - -This release of \LaTeX\ does \emph{not} default to these `ec' fonts -as its T1 encoded fonts. By default it will -use the `dc' fonts if the T1 encoding is requested. - -As noted in \texttt{install.txt} you may run \TeX\ on the install file -\texttt{ec.ins} \emph{after} unpacking the base distribution but -\emph{before} making the \LaTeX\ format. This will produce -suitable `fd' files making \LaTeX\ (including, for the first time, the -\textsf{slides} class) use the `ec' fonts as the default T1 encoded -font set. - - -\end{document} - diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews07.tex b/Master/texmf-dist/source/latex-dev/base/ltnews07.tex deleted file mode 100644 index 81d0ed3143c..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews07.tex +++ /dev/null @@ -1,146 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews07.tex - -% This is issue 7 of LaTeX News. - -\documentclass -% [lw35fonts] - {ltnews} - -% \usepackage[T1]{fontenc} - -\publicationmonth{June} -\publicationyear{1997} -\publicationissue{7} - -\begin{document} - -\maketitle - -\section{T1 encoded Computer Modern fonts} -As in the last release the base \LaTeX\ distribution contains -three different sets of `fd' files for T1 encoded fonts. - -In this release the default installation uses \texttt{ec.ins} -and so installs files suitable for the current `EC fonts' -distribution. If you have still not updated to the EC fonts and -are using the earlier test versions, known as DC then you should -unpack \texttt{newdc.ins} (for DC release 1.2 or later) or -\texttt{olddc.ins} (for the original releases of the DC fonts). -This should be done after unpacking \texttt{unpack.ins} but -before making the format by running ini\TeX{} on \texttt{latex.ltx}. -There are further details in \texttt{install.txt}. - - -\section{T1 encoded Concrete fonts} -The Metafont sources for T1 encoded `Concrete' fonts have been -removed from the \textsf{mfnss} distribution as they were based -on the now obsolete DC fonts release 1.1. Similarly the -\textsf{cmextra.ins} install file in the \textsf{base} distribution no -longer generates fd files for the `Concrete' fonts. -To use these fonts in either T1 or OT1 encoding it is -recommended that you obtain Walter Schmidt's \textsf{ccfonts} package -and fonts from CTAN \texttt{macros/latex/contrib/supported/ccfonts}. - - -\section{Further input encodings} -Two more \textsf{inputenc} packages have been added: for latin5, -thanks to H. Turgut Uyar; and for latin3, thanks to J\"org Knappen. - - -\section{Normalising spacing after punctuation} -The command \verb|\normalsfcodes| was introduced at the last patch -release. This is normally given the correct definition automatically -and so need not be explicitly set. It is used to correct a problem, -reported by Donald Arseneau, that punctuation in page headers has -always (in all known \TeX\ formats) been potentially incorrect if the -page break happens while a local setting of the space codes (for -instance by the command \verb|\frenchspacing|) is in effect. A common -example of this happening in \LaTeX\ is in the \textsf{verbatim} -environment. - - -\section{Accessing Bold Math Symbols} -The \textsf{tools} distribution contains a new package, \textsf{bm}, -which defines a command \verb|\bm| that allows individual bold symbols -to be accessed within a math expression (in contrast to -\verb|\boldmath| which makes whole math expressions default to bold -fonts). It is more general than the existing \textsf{amsbsy} package; -however, to ease the translation of documents between these two -packages, \textsf{bm} makes \verb|\boldsymbol| an alias for -\verb|\bm|. - -This package was previously made available from the `contrib' area of -the CTAN archives, and as part of Y\&Y's \LaTeX\ support for the -MathTime fonts. - - -\section{Policy on standard classes} - -Many of the problem reports we receive concerning the standard classes -are not concerned with bugs but are suggesting, more or less politely, -that the design decisions embodied in them are `not optimal' and -asking us to modify them. - -There are several reasons why we have decided not to make such changes -to these files. -\begin{itemize} -\item - However misguided, the current behaviour is clearly what was - intended when these classes were designed. -\item - It is not good practice to change such aspects of `standard classes' - because many people will be relying on them. -\end{itemize} - -We have therefore decided not to even consider making such -modifications, nor to spend time justifying that decision. This does -not mean that we do not agree that there are many deficiencies in the -design of these classes, but we have many tasks with higher priority -than continually explaining why the standard classes for \LaTeX{} -cannot be changed. - -We would, of course, welcome the production of better classes, or of -packages that can be used to enhance these classes. - - -\section{New addresses for TUG} -For information about joining the \TeX{} Users Group, and about lots -of other \LaTeX-related matters, please contact -them at their new address: -\begin{quote}\small - \TeX{} Users Group, P.O. Box 1239,\\ - Three Rivers, CA~93271-1239, USA\\ - Fax:~+1~209~561~4584\\ - E-mail: \texttt{tug@mail.tug.org}\\ - URL: \texttt{http://www.tug.org/} -\end{quote} - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews08.tex b/Master/texmf-dist/source/latex-dev/base/ltnews08.tex deleted file mode 100644 index b43c4f53f9e..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews08.tex +++ /dev/null @@ -1,154 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews08.tex - -% This is issue 8 of LaTeX News. - -\documentclass -% [lw35fonts] - {ltnews} - -% \usepackage[T1]{fontenc} - -\publicationmonth{December} -\publicationyear{1997} -\publicationissue{8} - -\begin{document} - -\maketitle - -\section{New supported font encodings} - -Two new font encodings are supported as options to the \textsf{fontenc} -package: -\begin{description} -\item [OT4] -This is a seven-bit encoding designed for Polish. The \LaTeX\ support -was developed by Mariusz Olko. -\item [TS1] This is the `Text Companion Encoding'; it contains symbols -designed to be used in text, as opposed to mathematical formulas, and -some accents designed for uppercase letters. It is currently -supported by the `tc' fonts, which match the T1 encoded `ec' text -fonts. A subset of the glyphs in this encoding is supported by -virtual fonts distributed with the PostScript font metrics on the -\textsc{ctan} archives. (This is the `8c' encoding in Karl Berry's -fontname scheme.) The \textsf{textcomp} package provides access to -this encoding but here is a warning to current users of that package: -some of the internal names for the characters have changed. -\end{description} - - -\section{New input encodings} - -These additions to the \textsf{inputenc} package are -\texttt{decmulti} (the DEC Multinational -Character Set, contributed by M.~Y.~Chartoire) -and \texttt{cp1250} (an MS-Windows encoding for Central and Eastern -Europe, contributed by Marcin Woli\'nski). There is also a -\texttt{cp1252} encoding that is identical to \texttt{ansinew}. - - -\section{Tools} - -The \textsf{calc} package (used in many examples in \emph{The \LaTeX\ -Companion}) has been contributed to this distribution by Kresten Krab -Thorup and Frank Jensen. This is essentially the same as the version -that has been available from the \textsc{ctan} archives for some time, -with one minor change: to use \LaTeX-style error messages. It enables -the use of arithmetic expressions within arguments to standard -\LaTeX{} commands where a length or a counter value is required. For -example: -\begin{verbatim} - \setcounter {page} { \value{page} * 2 + 1 } - \parbox { 3in - ( 2mm + \textwidth / 9 ) } -\end{verbatim} - -There have also been some improvements to several other packages in -this collection. In particular, \textsf{bm} now works correctly with -constructions such as \verb|\bm{f'}| involving \texttt{'} or other -characters which use \TeX's special ``\verb|\mathcode"8000|'' -feature. Also, \textsf{multicol} sets the length \verb|\columnwidth| -to an appropriate value; this enables it to work with classes that -support two-column setting, e.g.,~the AMS classes. - - -\section{Graphics} - -The special \verb|oztex.def| driver file has been removed, and Oz\TeX\ -support has been merged with dvips, following advice from -Andrew Trevorrow about Oz\TeX~3.x. - -The \textsf{keyval} package has had some internal improvements: to -use \LaTeX\ format error messages; and to avoid `\verb|#| doubling'. -This latter change means that the \verb|command| key for the -\textsf{graphicx} version of \verb|\includegraphics| should now be used -with one \verb|#| rather than two. For example, \verb|command = `gunzip #1|. -Fortunately this key is almost never used in practice, so few if any -documents should be affected by this change. - - -\section{\LaTeX3 experimental programming conventions} - -As announced at the \TeX\ Users Group meeting (Summer 1997), a group of -highly experimental packages will soon be released to allow experienced\\ -\TeX\ programmers to experiment with, and comment on, a proposed set -of syntax conventions and basic data-types that might form -the basis for programming large scale projects in \TeX. -They will be located in\\ -this CTAN directory: -\begin{verbatim} - CTAN:macros/latex/packages/expl3 -\end{verbatim} -The documentation of this material is as follows: individual package -files provide outline, draft documentation; there is an article that -gives an overview of the syntax and related concepts; there is a -\texttt{readme.txt} file containing a brief description of the -collection. - -All aspects of these packages are liable, indeed likely, to change. -They should not be used at this stage for anything -that requires a stable system. However, we do encourage people to -experiment with these packages, and to send comments on them to the -\texttt{LaTeX-L} mailing list. -To subscribe to this list, mail to: -\begin{verbatim} - listserv@urz.uni-heidelberg.de -\end{verbatim} -the following one line message: -\begin{verbatim} - subscribe LATEX-L <<first-name>> <<second-name>> -\end{verbatim} - -% Revert to this if gets too full. -% See \texttt{modguide.tex} for -% information on how to subscribe to \texttt{LaTeX-L}. - -\end{document} - diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews09.tex b/Master/texmf-dist/source/latex-dev/base/ltnews09.tex deleted file mode 100644 index c4f8b43ec87..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews09.tex +++ /dev/null @@ -1,142 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews09.tex - -% This is issue 9 of LaTeX News. - -\documentclass -% [lw35fonts] - {ltnews}[1999/02/23] - -%\usepackage[T1]{fontenc} - -\publicationmonth{June} -\publicationyear{1998} -\publicationissue{9} - -\begin{document} - -\maketitle - - -\section{New math font encodings} - -A joint working group of the \TeX{} Users Group and the \LaTeX3 -Project is developing a new 8-bit math font encoding for \TeX{}. -It is designed to overcome several limitations and implementation -problems of the old math font encodings and to simplify switching -between different sets of math fonts, much as the \LaTeX{} font -selection interface has simplified switching between text fonts. - -Since the work on this project relies entirely on volunteer work, we -cannot give a specific release date yet. However, a prototype -implementation already exists. This contains several sets of virtual -fonts, some \LaTeX{} packages and a kernel module; we hope to -integrate it into the main \LaTeX{} distribution for the next -release. - -Documents using only standard \LaTeX{} commands for math symbols -should not be affected by switching to the new math font encodings -However, documents, classes or packages making specific assumptions -about the encoding of math symbol fonts are likely to break. - -Further information about the Math Font Group may be found on -the World Wide Web at \texttt{http://www.tug.org/twg/mfg/}. - - -\section{A new math accent} - -A new math accent, \verb|\mathring|, has been added. This is a math mode -version of the ring accent (\r{}) which is available in text -mode with the command \verb|\r|. - -\section{Extended \cs{DeclareMathDelimiter}} - -The command \verb|\DeclareMathDelimiter| has been extended. -Normally this command takes six arguments. Previously, when being used -to declare a character (such as \texttt{[}) as a delimiter, a variant -form was used with only five arguments. The argument specifying the -default `math class' was omitted. Now the full six-argument form may be -used in this case. The extra information is used to implicitly declare -the character via \verb|\DeclareMathSymbol| for use when the symbol is -not used with \verb|\left| or \verb|\right|. - -The old five-argument form is detected and will work as before. - -\newpage - -\section{Tools distribution} - -The \texttt{multicol} package now supports the production of multiple -columns without balancing the last page. To get this effect use the -\texttt{multicols*} environment. - -The \texttt{layout} package was partly recoded by Hideo Umeki to -display page layout effects in a better way. - -As suggested by Donald Arseneau, the \texttt{calc} package was extended -to support the new commands \verb|\widthof{<text>}|, -\verb|\heightof{<text>}|, and \verb|\depthof{<text>}| within a -\texttt{calc}-expression. At the same time we modified a few kernel -commands so that \texttt{calc}-expressions can now be used in various -useful places such as the dimension arguments to the \texttt{tabular} -environment and the \verb|\rule| command. For many other standard -\LaTeX{} commands this was already possible. - - -\section{Support for Cyrillic encodings} - -We are very pleased that, after a lengthy period of development, a set -of fonts, encodings and support files for using \LaTeX\ with Cyrillic -characters will soon be available. - -Test versions of the `LH' fonts for these Cyrillic encodings, based on -the Computer Modern design, are available from CTAN archives in the -directory \texttt{fonts/cyrillic/lh-test}. The \LaTeX\ support files -(by Werner Lemberg and Vladimir Volovich) are also available from CTAN -archives in\\ - \texttt{macros/latex/contrib/supported/t2} - - -\section{Default docstrip header} - -Many \LaTeX\ users now distribute packages in documented source form -using the \textsf{docstrip} system. Docstrip allows a header to be -placed on generated package files, suitable for giving copyright -information, or distribution conditions. - -We have changed the default version of this header so that it allows -stripped files to be distributed in ready-to-run installations such as -the \TeX{}Live CD\@. If you use the default header for distributing -your files you should check that the new copyright text is acceptable -to you. The file \texttt{docstrip.dtx} explains how to produce your own -header if you wish to do so. - - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews10.tex b/Master/texmf-dist/source/latex-dev/base/ltnews10.tex deleted file mode 100644 index d9e0d4de530..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews10.tex +++ /dev/null @@ -1,153 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews10.tex 12/01/1998 - -% This is issue 10 of LaTeX News. - -\documentclass -% [lw35fonts] - {ltnews}[1999/02/23] - -% \usepackage[T1]{fontenc} - -\publicationmonth{December} -\publicationyear{1998} -\publicationissue{10} - -\begin{document} - -\maketitle - - -\section{Five years of \LaTeXe} - -Since this is the 10th edition of \LaTeX{} News, the (no longer) New -Standard \LaTeX{} must have hit the streets almost this long ago. In -fact it was only the beta-version that some people got just in time for -Christmas~1993, and since then there has been a lot of tidying-up and -smoothing of rough edges (not to mention a few bug fixes!). - -Maybe it is time for something more radically different to emerge and -be hungrily adopted by the world; but don't panic, we shall be -maintaining what you have now for a long time yet. Amongst the more -polite things that have been written about our efforts, we found that this -quote (somewhat censored to protect the guilty) well reflects some of -our feelings about working on \LaTeX{} over the years: \textit{the mere -existence of \LaTeXe{} is a great miracle}. - - - \section{Restructuring the \LaTeX{} distribution} - - Since the (once) `new' standard \LaTeX{} has reached such a venerable - age, we are reviewing the way in which the system is presented to the - world. - - An early intention is to define, given the wide variety of good - packages now available, what now constitutes a useful installation of - \LaTeX{}. We also hope that such a definition will help document - portability if it leads to a future in which a \LaTeX{} class - designer can reasonably assume that a known list of - facilities will be there for all users (so that each class - need not supply them). - - As a first small step towards this definition, we shall replace the - \texttt{latex/packages} subdirectory on \ctan{}. - This directory was a curious mixture of the important, such as the - \LaTeX{} \texttt{tools}, that any self-respecting \LaTeX{} - installation ought to have, and the esoteric or experimental. - - The esoterica from \texttt{packages} will be moved to - new locations, as follows: - \begin{quote} - \texttt{expl3} to \texttt{latex/exptl/project}\\ - \texttt{mfnfss} to \texttt{latex/contrib/supported/mfnfss} - \end{quote} - - The subdirectory that replaces \texttt{packages} will be called - \texttt{latex/required}; all the other sub-directories of - \texttt{packages} will be moved there. - -\vspace{17pt} -\pagebreak - - \section{\LaTeX\ Project on the Internet} -A new \texttt{latex-project.org} domain has been registered. -The web site is not yet fully functional but the old \LaTeX\ pages from -\ctan\ are available at \texttt{http://www.latex-project.org/} and the -\LaTeX\ bug reporting address has been changed to -\texttt{latex-bugs@latex-project.org}. - - \section{Restructuring the \LaTeX{} package licenses} - -Several people have requested an easy mechanism for the distribution -of \LaTeX\ packages and other software ``under the same conditions as -\LaTeX''. The old \texttt{legal.txt} file was unsuitable as a general -licence as it referred to specific \LaTeX\ authors, and to specific -files. - -Therefore, in this release \texttt{legal.txt} contains just the -copyright notice and a reference to the new \emph{\LaTeX\ Project -Public License} (LPPL) for the distribution and modification -conditions. The \texttt{tools}, \texttt{graphics}, and \texttt{mfnfss} -packages also now refer to this license in their distribution notices. - - \section{Support for Cyrillic encodings} - -Basic Cyrillic support, as announced in \LaTeX{} News~9, is now -finally an official part of \LaTeX{}. It includes support for the -following standard Cyrillic font encodings (this list may -grow):~\mbox{\texttt{T2A T2B T2C X2}}. - -It also includes various Cyrillic input encodings (20~in total, -including commonly used variants and Mongolian Cyrillic -encodings). This provides platform independent and -sophisticated basic support for high-quality typesetting in various -Cyrillic-based languages. - -For further information see the file \texttt{cyrguide.tex}. - -\section{Tools distribution} - -The \texttt{varioref} package has been extended to support textual -page references to a range of objects: e.g.,~if \texttt{eq-first} -and \texttt{eq-last} are the label names for the first and last -equation in a sequence, then you can now write -\begin{verbatim} - see~\vrefrange{eq-first}{eq-last} -\end{verbatim} -This results in different text depending on whether both -labels fall on the same page. - -Some additional user commands, as well as building-blocks for writing -private extensions, are described in the accompanying documentation. - - - -\end{document} - diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews11.tex b/Master/texmf-dist/source/latex-dev/base/ltnews11.tex deleted file mode 100644 index 6587a691af9..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews11.tex +++ /dev/null @@ -1,141 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews11.tex 01/06/1999 -% This is issue 11 of LaTeX News. - -\documentclass -% [lw35fonts] % uncomment this line to get Times - {ltnews} - -% \usepackage[T1]{fontenc} - -\publicationmonth{June} -\publicationyear{1999} -\publicationissue{11} - -\begin{document} - -\maketitle - -\section{Back in sync} - -The last release of \LaTeX{} was delayed even longer than you have -come to expect. We hope that it proved worth waiting for. It -required a major integration of the code from several people and, -independently, the introduction of the LPPL (see \LaTeX{} News~10) plus -several related changes to our internal systems. It therefore seemed -sensible to wait until everything was complete rather than do things -in too much hurry. - -This seem to have been a successful strategy as -the recent patch release was related to an isolated change that was -done many months previously. If this release does not appear a lot -closer to its nominal date then \ldots~well, you will not be reading -this sentence! - -\section{Yearly release cycles} - -With the year 2000 rapidly approaching, we intend to switch to a -release frequency of just one per year (with patches if necessary) for -the core of \LaTeXe{}. These days the system is sufficiently stable -that the original update policy is costing everybody more time than is -now warranted. - -\section{LPPL update} - -Thanks to extensive and valuable input from Matt Swift -(\email{swift@alum.mit.edu}) we now have a clearer and more detailed -form of the \LaTeX{} Project Public Licence. This release contains -both the original version (in \file{lppl-1-0.txt}) and the updated -version, LPPL~1.1. - -\section{The future of Sli\TeX{}} - -We still get a very small trickle of reports about this part of the -system (if you are no longer able to recall \LaTeX~2.09 then you will -know it as the \class{slides} class). We have not classified them (in -our minds at least) as bugs since we have always known that there are -many problems with this class. It is clear to us that the only -sensible action would be to redesign the system completely; in -particular, to remove much of its complexity whose purpose is to -support 10-year-old overlay technology. However, this would take a -lot too much time and would be completely out of proportion to its -current usage. - -We are therefore planning to make the \class{slides} class -unsupported in the sense that any problem related to the use of -invisible fonts is considered to be a feature (The \LaTeXe{} manual by -Leslie Lamport doesn't even describe this part of the class any more). -Of course, if it still has its enthusiasts then we are happy to cede -it to their loving care (somewhat like a preserved steam locomotive, -in some parts of the world). - -\section{Fontenc package peculiarities} - -The \verb=\usepackage= interface normally ensures that a package is -loaded only once. The \pkg{fontenc} package has become an -exception to this rule: it can be loaded several times using different -options, e.g., allowing the user to add a font encoding in the -preamble. This comes at a price for package writers: the low-level -commands (see \file{ltclass.dtx}) used to check if a package was -loaded, and with which options, do not work for the \pkg{fontenc} -package. - -\section{New math font encodings} - -As we announced in \LaTeX{} News~9, a joint working group of the -\TeX{} Users Group and the \LaTeX3 Project has developed a new -\mbox{8-bit} math font encoding for \TeX{}. -The reason why this work is not yet released is because of other -exciting developments in the world of math fonts and math characters. -It is obviously wise to ensure that the encoding work is fully -integrated with the available fonts. - -Those interested are reminded that further information about the Math -Font Group may be found on the World Wide Web at:\\ -\url{http://www.tug.org/twg/mfg/}. - -\section{Tools distribution} - -The \pkg{multicol} package has now got a small but useful extension -which allows you to force a column break where this is really -necessary. This is done with the command \verb=\columnbreak=, which -can be used like \verb=\pagebreak= (e.g.,~within paragraphs) except -that it cannot have an optional argument and thus it always forces a -new column. - -\section{Coming soon} - -Major work on a new class file structure to support flexible -designs is well under way; some of this work will be presented at the -TUG'99 conference in Vancouver, Canada. With a bit of luck much of -this work could be ready for integration into the next release---so -watch this space! - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews12.tex b/Master/texmf-dist/source/latex-dev/base/ltnews12.tex deleted file mode 100644 index 47609689cea..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews12.tex +++ /dev/null @@ -1,154 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews12.tex -% -% This is issue 12 of LaTeX News. - -\documentclass -% [lw35fonts] % uncomment this line to get Times - {ltnews}[1999/12/01] - -% \usepackage[T1]{fontenc} - -\publicationmonth{December} -\publicationyear{1999} -\publicationissue{12} - -% Should go to .cls: -\newcommand{\acro}[1]{\textsc{\MakeLowercase{#1}}} - -\begin{document} - -\maketitle - -\section{LPPL update} - -Since the release of the \LaTeX{} Project Public Licence version~1.1, -we have received a small number of queries which resulted in some -minor changes to improve the wording or explain the intentions better. -As a consequence this release now contains LPPL~1.2 in the file -\file{lppl.txt} and the previous versions as \file{lppl-1-0.txt} and -\file{lppl-1-1.txt}. - -\section{fixltx2e package} - - This package provides fixes to \LaTeXe{} which are desirable but - cannot be integrated into the \LaTeXe{} kernel directly as they - would produce a version incompatible to earlier releases (either - in formatting or functionality). - - By having these fixes in the form of a package, users can benefit - from them without the danger that their documents will fail, or - produce unexpected results, at other sites; this works because a - document will contain a clear indication (the \verb=\usepackage= - line, preferably with a required date) that at least some of these - fixes are required to format it. - -\section{Outcome of TUG '99 (Vancouver)} - -The slides from the \acro{TUG}'99 presentation we gave on \emph{a -new interface for \LaTeX\ class designers} are available from the -\LaTeX\ Project website; look for the file \verb|tug99.pdf| at: -\begin{quote} - \url{http://www.latex-project.org/talks/} -\end{quote} - -Please note that this document was intended only to be informal -``speaker's notes'' for our own use. We decided to make them available (the -speaker's notes as well as the slides that were presented) because several -people requested copies after the talk. However, they are \emph{not} in -a polished copy-edited form and are not intended for publication. - -Prototype implementations of parts of this interface are now available from: -\begin{quote} - \url{http://www.latex-project.org/code/experimental/} -\end{quote} - -We are continuing to add new material at this location so as to -stimulate further discussion of the underlying concepts. As of -December 1, 1999 -the following parts can be downloaded. -\begin{description} - - \item[xparse] Prototype implementation of the interface for declaring - document command syntax. See the \texttt{.dtx} files for - documentation. - - \item[template] Prototype implementation of the template interface - (needs parts of \texttt{xparse}). - - The file \texttt{template.dtx} in that directory has a large section - of documentation at the front describing the commands in the - interface and giving a `worked example' building up some templates - for caption formatting. - - \item[xcontents] Interface description for table of contents data (no - code yet). Coding examples have been thoroughly discussed on the - \texttt{latex-l} list. - - \item[xfootnote] Working examples for generating footnotes, - etc. Needs \texttt{xparse} and \texttt{template}. - - \end{description} -All examples are organised in subdirectories and additionally - available as \texttt{gzip} \texttt{tar} files. - - Please remember -that this material is intended only for experimentation and comments; -thus any aspect of it, e.g., the user interface or the functionality, -may change and, in fact, is very likely to change. -For this reason it is explicitly forbidden to place this material on -\acro{CD-ROM} distributions or public servers. - -These concepts, as well as their implementation, are under discussion -on the list \texttt{LATEX-L}. You can join this list, which is -intended solely for discussing ideas and concepts for future versions -of \LaTeX, by sending mail to -%\begin{quote} - \email{listserv@URZ.UNI-HEIDELBERG.DE} -%\end{quote} -containing the line - \begin{quote} - \texttt{SUBSCRIBE LATEX-L} \textit{Your Name} - \end{quote} - -This list is archived and, after subscription, you can retrieve older -posts to it by sending mail to the above address, containing a command -such as: -\begin{quote} -\texttt{GET LATEX-L LOGyymm} -\end{quote} -where \texttt{yy}=Year and \texttt{mm}=Month, e.g. -\begin{quote} -\texttt{GET LATEX-L LOG9910} -\end{quote} -for all messages sent in October 1999. - - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews13.tex b/Master/texmf-dist/source/latex-dev/base/ltnews13.tex deleted file mode 100644 index ae08f3d90d1..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews13.tex +++ /dev/null @@ -1,201 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews13.tex -% -% This is issue 13 of LaTeX News. - -\documentclass -% [lw35fonts] % uncomment this line to get Palatino - {ltnews}[2000/07/21] - -% \usepackage[T1]{fontenc} - -\publicationmonth{June} -\publicationyear{2000} -\publicationissue{13} - - -\begin{document} - -\maketitle - -\raisefirstsection -\section{Yearly release cycle} - -We announced in \textit{\LaTeX{} News~11} that we intended to switch -to a 12-monthly release schedule. With the present (June~2000) -release, this switch is being made: thus the next release of \LaTeX{} -will be dated June~2001. We shall of course continue, as in the past, -to release patches as needed to fix significant bugs. - - -\section{PSNFSS: \small Quote of the Month} - -\begin{quote} - You should say in the \LaTeX{} News that Walter Schmidt has taken over - \PSNFSS{} from me. It gives me a certain pleasure to be able to draw a - line under that part of my life\ldots - - \begin{latexonly} - \vspace{-\baselineskip} - \end{latexonly} - - \begin{flushright} - Sebastian Rahtz - \end{flushright} -\end{quote} - -\begin{latexonly} - \vspace{-\baselineskip} -\end{latexonly} - -\noindent -The \PSNFSS{} material, which supports the use\latex{\\} -of common PostScript fonts with \LaTeX{}, has been thoroughly updated. -Most noticeably, the \package{mathpple} package, which used to be -distributed separately, is now part of the basic \PSNFSS{} bundle; -this package provides mathematical typesetting with the Palatino -typeface family. In addition, numerous bugs and flaws have been fixed -and the distribution has been `cleaned up'. The file -\file{changes.txt} contains a detailed list of these changes. -\latex{\looseness=-1} %%!!!!! It worked! - -The documentation (in \file{psnfss2e.pdf}) has been completely -rewritten to provide a comprehensive introduction to the use -of PostScript fonts. - -Notice that the new \PSNFSS{} needs updated files for font metrics, -virtual fonts and font definitions. If you received the new -version~(8.1) as part of a complete \TeX{} system then these new font -files should also have been installed. However, if you intend to -install or update \PSNFSS{} yourself, please read the instructions in -the file \file{00readme.txt} of the new \PSNFSS{} distribution. - -Support for commercial PostScript fonts, such as -Lucida~Bright, has been removed from the basic distribution; -it is now available from \ctan{}: -\begin{latexonly} - \file{\ctanhttp macros/latex/\\ - contrib/supported/psnfssx}. -\end{latexonly} -\begin{htmlonly} - \url{http://www.tex.ac.uk/tex-archive/macros/latex/contrib/supported/psnfssx}. -\end{htmlonly} - -\section{New AMS-\LaTeX{}} - -Version 2.0 of AMS-\LaTeX{} was released on December 1, 1999. It can -be obtained via \url{ftp://ftp.ams.org/pub/tex/} or -\url{http://www.ams.org/tex/amslatex.html}, as well from \ctan{}: -\begin{latexonly} - \file{\ctanhttp macros/latex/\\ - required/amslatex}. -\end{latexonly} -\begin{htmlonly} - \url{http://www.tex.ac.uk/tex-archive/macros/latex/required/amslatex}. -\end{htmlonly} - -This release consists chiefly of bug fixes and consolidation of the -existing features. The division of AMS-\LaTeX{} into two main parts -(the math packages;\latex{\\} -the AMS document classes) has been made more pronounced. -The files \file{diffs-m.txt}, \file{diffs-c.txt}, -\file{amsmath.faq}, and \file{amsclass.faq} describe the\latex{\\} -changes and address some common questions. - -The primary documentation files remain \file{amsldoc.tex}, for the -\package{amsmath} package, and \file{instr-l.tex}, for the AMS -document classes.\latex{\\} -The documentation for the \package{amsthm} package,\latex{\\} -however, has been moved from \file{amsldoc.tex}\latex{\\} -to a separate document \file{amsthdoc.tex}. - -\begin{latexonly} - \vfill -\end{latexonly} - -\section{New input encoding \package{latin4}} - -The package \package{inputenc} has, thanks to Hana Skoumalov\'a, -been extended to cover the \package{latin4} input encoding; this -covers Baltic and Scandinavian languages as well as Greenland -Inuit and Lappish. - -\begin{latexonly} - \vfill -\end{latexonly} - -\section{New experimental code} - -In \textit{\LaTeX{} News~12} we announced some ongoing work towards a -`Designer Interface for \LaTeX' and we presented some early results -thereof. Since then, at Gutenberg\,2000 in Toulouse and TUG\,2000 in -Oxford, we described a new output routine and an improved method of -handling vertical mode material between paragraphs. In combination -these support higher quality \emph{automated}\footnote - {The stress here is on automated!} -page-breaking and page make-up\latex{\\} -for complex pages---the best yet achieved with \TeX{}! - -A paper describing the new output routine is -\begin{latexonly} - at\\ - \file{http://www.latex-project.org/papers/xo-pfloat.pdf% - \hspace*{-16pt}}\\ -\end{latexonly} -\begin{htmlonly} - at \url{http://www.latex-project.org/papers/xo-pfloat.pdf}. -\end{htmlonly} -All code examples and documentation are available -\begin{latexonly} - at\\ - \file{http://www.latex-project.org/code/experimental/% - \latex{\hspace*{-5pt}}}.\\[3pt] -\end{latexonly} -\begin{htmlonly} - at \url{http://www.latex-project.org/code/experimental/}. - -\end{htmlonly} -This directory has been extended to contain -\begin{description} - \item[galley] Prototype implementation of the interface\latex{\\} - for manipulating vertical material in galleys. - \item[xinitials] Prototype implementation of the interface\latex{\\} - for paragraph initials (needs the \texttt{galley} package. - \item[xtheorem] Contributed example using the \texttt{template} - package to provide a designer interface for theorem environments. - \item[xoutput] A prototype implementation of the new output routine - as described in the \texttt{xo-pfloat.pdf} paper. Expected - availability: at or shortly after\latex{\\} - the TUG\,2000 conference. -\end{description} - -\end{document} - - diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews14.tex b/Master/texmf-dist/source/latex-dev/base/ltnews14.tex deleted file mode 100644 index 1e5c8d72c8f..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews14.tex +++ /dev/null @@ -1,169 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews14.tex -% -% This is issue 14 of LaTeX News. - -\documentclass -% [lw35fonts] % uncomment this line to get Palatino - {ltnews}[2001/07/12] - -% \usepackage[T1]{fontenc} - -\publicationmonth{June} -\publicationyear{2001} -\publicationissue{14} - - -\begin{document} - -\maketitle - -\raisefirstsection -\section{Future releases} - -We are currently exploring how to best support the very large -community of individuals, organisations and enterprises that depend on -the robustness and availability of the current standard \LaTeX{} -distribution. The results of this may lead to some changes in the -regular release schedule and the handling of bug reports during the -next year. - -\section{New release of \textsf{Babel} (required)} - -Earlier this year a new release of \textsf{Babel} (3.7) became -available. You can read about its new features in -\begin{latexonly} - \file{http://www.ctan.org/tex-archive/macros/}\\ - \hspace*{4em}\file{latex/required/babel/announce.txt} -\end{latexonly} -\begin{htmlonly} - \url{http://www.ctan.org/tex-archive/macros/latex/required/babel/announce.txt} -\end{htmlonly} - -One of the bugs that got fixed in this release deals with how labels -are handled by \LaTeX{}. Because this part of the kernel is modified -by \textsf{babel}, the relevant changes need to be coordinated. -Therefore to use \textsf{Babel} with this release of \LaTeX{} you will -need to update your version of \textsf{babel} to at least 3.7. - -\section{New input encoding \package{latin9}} - -The package \package{inputenc} has, thanks to Karsten Tinnefeld, been -extended to cover the \package{latin9} input encoding. The -ISO-Latin~9 encoding is a useful modern replacement for ISO-Latin~1 -that contains a few characters needed for French and Finnish. Of wider -interest, it also contains the euro currency sign; this could be the -killer argument for many 8-bit texts to use Latin-9 in the future. - -According to a Linux manpage, ISO~Latin-9 supports Albanian, Basque, -Breton, Catalan, Danish, Dutch, English, Estonian, Faroese, Finnish, -French, Frisian, Galician, German, Greenlandic, Icelandic, Irish -Gaelic, Italian, Latin, Luxembourgish, Norwegian, Portuguese, -Rhaeto-Romanic, Scottish Gaelic, Spanish and Swedish.\\ -The characters added in \package{latin9} are (in \LaTeX{} notation):\\ -\begin{small} -\verb| \texteuro \v S \v s \v Z \v z \OE \oe \" Y | -\end{small}\\ -They displace the following characters from \package{latin1}:\\ -\begin{small} -\verb| \textcurrency \textbrokenbar \"{} \'{} \c{} |\\ -\verb| \textonequarter \textonehalf \textthreequarters | -\end{small} - - -\section{New tools} - -The new package \package{trace} provides many commands to control -\LaTeX{}'s tracing and debugging output, including the excellent new -information available with \eTeX{} such as the extremely useful -tracing of local assignments. You will find it in the tools -distribution. - -It offers the command \verb|\traceon|, which is similar to -\verb|\tracingall| but suppresses uninteresting stuff such as font -loading by NFSS (which can go on for pages if you are unlucky). It -also offers \verb|\traceoff| to \ldots\ guess what! Full details are -in the documented source file, \file{trace.dtx}. - -In the base \package{ifthen} package we have added -the uppercase synonyms \verb|\NOT| \verb|\AND| and \verb|\OR|. - -\section{New experimental code} - -In \textit{\LaTeX{} News~12} we announced some ongoing work towards a -`Designer Interface for \LaTeX' and we presented some early results -thereof. Since then, at Gutenberg\,2000 in Toulouse and TUG\,2000 in -Oxford, we described a new output routine and an improved method of -handling vertical mode material between paragraphs. In combination -these support higher quality \emph{automated}\footnote - {The stress here is on automated!} -page-breaking and page make-up\latex{\\} -for complex pages---the best yet achieved with \TeX{}! - -More recently we have added material to handle the complex front -matter requirements of journal articles; this was presented at -Gutenberg\,2001 in Metz. - -A paper describing the new output routine is -\begin{latexonly} - at\\ -\begin{small} - \file{http://www.latex-project.org/papers/xo-pfloat.pdf}\\ -\end{small} -\end{latexonly} -\begin{htmlonly} - at \url{http://www.latex-project.org/papers/xo-pfloat.pdf}. -\end{htmlonly} -All code examples and documentation are available -\begin{latexonly} - at\\ -\begin{small} - \file{http://www.latex-project.org/code/experimental} -\end{small} -\end{latexonly} -\begin{htmlonly} - at \url{http://www.latex-project.org/code/experimental/}. -\end{htmlonly} - -This directory has been extended to contain the following. -\begin{description} - \item[galley] Prototype implementation of the interface\latex{\\} - for manipulating vertical material in galleys. - \item[xinitials] Prototype implementation of the interface\latex{\\} - for paragraph initials (needs the \texttt{galley} package). - \item[xtheorem] Contributed example using the \texttt{template} - package to provide a designer interface for theorem environments. - \item[xor] A prototype implementation of the new output routine - as described in the \texttt{xo-pfloat.pdf} paper. - \item[xfrontm] A prototype version of - the new font matter interface. -\end{description} - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews15.tex b/Master/texmf-dist/source/latex-dev/base/ltnews15.tex deleted file mode 100644 index 389ed6334d9..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews15.tex +++ /dev/null @@ -1,169 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews15.tex -% -% This is issue 15 of LaTeX News. - -\documentclass -% [lw35fonts] % uncomment this line to get Palatino - {ltnews}[2004/02/28] - -% \usepackage[T1]{fontenc} - -\publicationmonth{December} -\publicationyear{2003} -\publicationissue{15} - -\begin{document} - -\maketitle - -%\raisefirstsection - -\section{Anniversary release} - -Yes, it's now 10~years since the first release in this series and, for -Knuthists, this release also contains \textit{Issue 16}\,! - -Meanwhile this \textit{Issue~15} describes the major new features in -the current release whilst \textit{Issue~16} looks\newline -a little way into the future of \LaTeX{}. - - -\section{LPPL -- new version} - -Most importantly, there is now a new version, 1.3, of the \LaTeX{} -Project Public Licence. Many of you will\newline -be thrilled to know that, following the exchange of over 1600 e-mail -messages dissecting various aspects of its philosophy such as `how -many angels can appear in the name of a file before it becomes -non-free', this version\newline -is now officially a DFSG (Debian Free Software Guidelines) approved license. -The discussions start at -\url{http://lists.debian.org/debian-legal/2002/debian-legal-200207/threads.html} -with high traffic throughout August to October~2002 and further -heated discussions starting in April~2003 and concluding -around June at -\url{http://lists.debian.org/debian-legal/2003/debian-legal-200306/msg00206.html}. - -The important features of the new version are useful clarifications in -the wording, and revised procedures\newline -for making a change to the Current Maintainer of a package. Special -thanks to all those people from\newline Debian Legal who worked -constructively with us\newline -on this onerous task, especially but not exclusively\newline -Jeff Licquia and Branden Robinson. - - -\section{Small updates to varioref} - -The English has been corrected in \verb|\reftextbefore| -(an incompatible change). There are other extensions -such as \verb|\labelformat|, \verb|\Ref|, \verb|\Vref| and \verb|\vpagerefnum|. -Some Dutch text has also been changed and two\newline -new options added: \package{slovak} and \package{slovene}. - - -\section{New and more robust commands} - -Many of the math mode commands for compound symbols have been made -robust and a new robust command has been added: \verb|\nobreakdashes|. -This last is a low-level command, borrowed from the \package{amsmath} -package, for use only before hyphens or dashes. It prevents the line -break that is normally allowed\newline -after the following sequence of dashes. - - -\section{Fixing font sizes} - -The new \package{fix-cm} package, by Walter Schmidt, changes the CM font -definition (\texttt{.fd}) files so that similar design sizes are used -in both the \texttt{OT1} and \texttt{T1} encodings. - - -\section{Font encodings} - -A number of options have been added to the \package{textcomp} package, -enabling only available glyphs to be used. -Also, the `NFSS font families' are now divided into five different groups -according to the subset of glyphs each provides from the full -collection of symbols in the TS1 encoding. -Given sufficient information about a font family -\package{textcomp} will use this in order to limit the\newline -typesetting to those glyphs that are available. - -Use of this mechanism has also enhanced \verb|\oldstylenums| -to use the current font if possible. - - -\section{Displaying font tables} - -With the \package{nfssfont} package you can now -specify the font to display by giving its `NFSS classification', -rather than needing to know its external font file's name. -It is also now possible to generate large collections of font -tables in batch mode by providing a suitable input file. - - -\section{New input encodings} - -The \package{inputenc} package has been extended as follows: -\package{macce} input encoding -(Apple Central European), -thanks to Radek Tryc and Marcin Wolinski; \package{cp1257}\newline -for Baltic languages; \package{latin10}, -thanks to Ionel Ciob\^{i}c\u{a}.\newline -The euro symbol has by -now been added to several encodings: -\package{ansinew}, \package{cp1250} -and \package{cp1252} (which also\newline -has another addition), whilst \package{cp858} -adds it to \package{cp850}. - - -\section{Unicode input} - -Partial, experimental support for text files that use the Unicode -encoding form UTF-8 is now provided by the option \package{utf8} for -the \package{inputenc} package. - -The only Unicode text file characters supported by the current version -are those based on the most common inputs for glyphs from the small -collection\newline -of standard \LaTeX{} Latin encodings. - - -\section{And finally \ldots\ pict2e} - -The old, non-functional version of this package has been removed - as there is now a fully working version from Hubert G\"a{\ss}lein - and Rolf Niepraschk. It is described - in \textit{The \LaTeX{} Manual}. - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews16.tex b/Master/texmf-dist/source/latex-dev/base/ltnews16.tex deleted file mode 100644 index 69e05973a8e..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews16.tex +++ /dev/null @@ -1,161 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews16.tex -% -% This is issue 16 of LaTeX News. - -\documentclass -% [lw35fonts] % uncomment this line to get Palatino - {ltnews}[2004/02/28] - -% \usepackage[T1]{fontenc} - -\publicationmonth{December} -\publicationyear{2003} -\publicationissue{16} - -\begin{document} - -\maketitle - -%\raisefirstsection - -\section{Anniversary news} - -This anniversary \textit{Issue~16} takes a brief look into the future work of -the \LaTeX3 Project Team, both short and and longer range. Please let -us know if you want %\newline -to get involved with us in any of this work (see below). - -An overview of the 10th Anniversary Release, dated 2003/12/01, is -can be found in \textit{Issue~15}. - - -\section{TLC2: The \LaTeX{} Companion -- 2nd edition!} - -Since you are reading this newsletter, there is a good chance that -you, or a friend, has already bought this encyclopedic volume: the -incomparable Second\newline -Edition of this work that is every \LaTeX{}ie's\newline -ultimate lucky charm. - -If by some chance you have not yet purchased your own copy then get -into training, get shopping, and get flexing your muscles (both -physical---it's $1100+$~pages,\newline -and intellectual) by using it to discover -masses of invaluable `insider information' about: -\begin{itemize} -\item the latest release of Standard \LaTeX{}; -\item over~200~extension packages; -\item plus related software and systems. -\end{itemize} -For more information on this all new (??\ldots OK,\newline -not \emph{all}, but over 90\%!!), -all accurate (we hope!)\newline -10th~Anniversary Edition, check out\newline - \mbox{\url{http://www.awprofessional.com/titles/0201362996}}. - - -\section{Future maintenance} - -We are currently exploring how best to support the very large and -rapidly growing community of individuals, organisations and -enterprises that depend on the robustness and availability of the -current standard \LaTeX{} distribution. Although we remain firmly\newline -resolved not to make changes in the base distribution (the kernel) of -Standard \LaTeX{}, there is still much that needs doing to maintain -its reliability and utility and to keep up the necessary level of -communication with users and supporters. Also, as with all advanced -software systems, bugs are still turning up occasionally so %\newline -some fixes are still essential. - -One major impediment to providing adequate service levels in this area -is, of course, the difficulties inherent in obtaining the time and -commitment of skilled minds---hence the appeal above to anyone -interested %\newline -in getting involved. - - -\section{LPPL certification} - -There are still some outstanding diplomatic tasks around the -\LaTeX{} Project Public Licence: these include -e.g.,~getting it `OSF certified' and ensuring that it gains -more support and wider use, even in the FSF world\newline -where it has long been tolerated. - - -\section{Use of \eTeX/pdf\TeX} - -We expect that within the next two years, releases of \LaTeX{} will -change modestly in order to run best under an extended \TeX{} engine -that contains the \eTeX{} primitives, e.g., \eTeX{} or pdf\TeX{}. -The details of this possible upgrade need further work so we are not -making a definite announcement yet. - -Although the current release does not \emph{require} \eTeX{} features, -we certainly recommend using an extended \TeX{}, especially if you -need to debug macros. - - -\section{End of `autoload' support} - -As computer systems generally grow in capacity, requirements change -and so we believe that the \package{autoload} variant of \LaTeX{} is -no longer required. Thus, although the code remains it is no longer -supported. We hope this does not cause any problems. - - -\section{New models, new code} - -In the period 1999--2001 we published many results of our work over -the previous decade on the development of new concepts and models -for automated typesetting based on \TeX{} as the underlying platform. -These can be found at \url{http://www.latex-project.org/papers/} -and -\mbox{\url{http://www.latex-project.org/code/experimental/}}. - -Since then a very large proportion of the The Team's efforts have been -diverted to provide the core author team for TLC2, which provides -over 1000 pages of carefully researched and tested documentation of -many aspects of the vast world of \LaTeX{} related software that -was developed over that same time period and that continues -to grow and improve prodigiously. - -Completion of that task \ldots\ until TLC3!! \ldots\ presents the -possibility of getting back to this more exciting development work, -or even to more radical work on non-\TeX{}-based models and -implementations. - -Of course, any such ideas are predicated on our ability to organise -(with you, we hope) an efficient\newline -but responsive maintenance and support system\newline -for Standard \LaTeX{}. - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews17.tex b/Master/texmf-dist/source/latex-dev/base/ltnews17.tex deleted file mode 100644 index 99267429bc4..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews17.tex +++ /dev/null @@ -1,230 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews17.tex -% -% This is issue 17 of LaTeX News. - -\documentclass -% [lw35fonts] % uncomment this line to get Palatino - {ltnews}[2004/02/28] - -% \usepackage[T1]{fontenc} - - -\publicationmonth{December} -\publicationyear{2005} -\publicationissue{17} - -\begin{document} - -\maketitle - -% \raisefirstsection - -\section{Project licence news} - -The \LaTeX{} Project Public License has been updated slightly so that -it is now version 1.3c. In the warranty section the -phrase ``unless required by applicable law'' has been reinstated, -having got lost at some point. Also, -it now contains three clarifications: of the difference between -``maintained'' and ``author-maintained''; of the -term ``Base Interpreter''; and when clause 6b and 6d shall not apply. - -Following requests, we now also provide the text of the licence as a -\LaTeX{} document (in the file \texttt{lppl.tex}). This file can be -processed either as a stand-alone document or it can be included -(without any modification) into another \LaTeX{} document, e.g., as an -appendix, using \verb|\input| or \verb|\include|. - - -\section{New guide on font encodings} - -Way back in 1995 work was started on a guide to document the -officially allocated \LaTeX{} font encoding names. However, for one -reason or another this guide (named \textit{\LaTeX{} font encodings}) -was, until now, not added to the distribution. It describes the major -7-bit and 8-bit font encodings used in the \LaTeX{} world and explains -the restrictions required of conforming text font encodings. It also -lists all the `encoding specific commands' (the LICR or \LaTeX{} -Internal Character Representation) for characters supported by the -encodings \texttt{OT1} and \texttt{T1}. - -When the file \texttt{encguide.tex} is processed by \LaTeX{}, it will -attempt to typeset an encoding table for each encoding it describes. -For this to be possible, \LaTeX{} must be able to find \texttt{.tfm} -files for a representative example font for each encoding. If -\LaTeX{} cannot find such a file then a warning is issued and the -corresponding table is omitted. - - -\section{Robust commands in math} - -The font changing commands in text-mode have been robust commands for years, -but the same has not been true for the math versions such as -\verb|\mathbf|. While the math-mode commands worked correctly in -section heads, they could cause problems in other places such as index -entries. With this release, these math-mode commands are now robust in -the same way as their text-mode counterparts. - -%% -\pagebreak -%% - - -\section{Updates of required packages} - -Several of the packages in the \package{tools} bundle have been updated -for this release. - -The \package{xspace} package has some new features. One is an -interface for adding and removing the exceptions it knows about and -another is that it works with active characters. These remove problems -of incompatibility with the \package{babel} system. - -In \textit{\LaTeX\ News~16} we announced that some packages might -begin to take advantage of \eTeX{} extensions on systems where these -are available: and the latest version of \package{xspace} does just -that. Note also that \package{fixltx2e} will make use of the -facilities in \eTeX{} whenever these are present (see below). - -The \package{calc} package has also been given an update with a few -extra commands. -The commands \verb|\maxof| and \verb|\minof|, each with two -brace-delimited arguments, provide the usual numeric $\max$ and $\min$ -operations. The commands \verb|\settototalheight| and -\verb|\totalheightof| work like \verb|\settoheight| and -\verb|\heightof|. There are also some internal improvements to make -\package{calc} work with some more primitive \TeX\ constructs, such as -\verb|\ifcase|. - -The \package{varioref} package has acquired a few more default -strings but there are still a number of languages for -which good strings are still missing. - -The \package{showkeys} package has also been updated slightly to work -with more recent developments in \package{varioref}. Also, it now -provides an easy way to define the look of the printed labels with -the command \verb|\showkeyslabelformat|. - -\section{Work on \LaTeX{} fixes} - -The package known as \package{fixltx2e} has three new additions. A new -command \verb|\textsubscript| has been added as a complement to the -command \verb|\textsuperscript| in the kernel. Secondly, a new form of -\verb|\DeclareMathSizes| that allows all of its arguments to have a -dimension suffix. This means you can now use expressions such as -\verb|\DeclareMathSizes{9.5dd}{9.5dd}{7.4dd}{6.6dd}|. - -The third new -addition is the robust command \verb|\TextOrMath| which takes two -arguments and executes one of them when typesetting in text or math -mode respectively. This command also takes advantage of \eTeX{} -extensions if available; more specifically, -%% -%%\pagebreak -%% -when the \eTeX{} extensions are available, it does not -destroy kerning between previous letters and the text to be typeset. -The command is also used -internally in \package{fixltx2e} to resolve a problem with -\verb|\fnsymbol|. - -Also, further work has been done on reimplementing -the command \verb|\addpenalty|, which is used internally in several -places: we hope it is an improvement! - -\section{The graphics bundle} - -The \package{graphics} bundle now supports the -\package{dvipdfmx} post-processor and Jonathan Kew's XE\TeX\ -program. By support we mean that the graphics packages recognize the -new options \texttt{xetex} and \texttt{dvipdfmx} but we do not -distribute the respective driver files. - -This leads elegantly to a description of the -new policy concerning such driver files in the \package{graphics} bundle. -Most driver files for our graphics packages are maintained by the -developers of the associated post-processor or \TeX\ programs. -The teams developing these packages are working very hard: their rapid -development offers a stark contrast to the current schedule of \LaTeX\ -releases. It is therefore no longer practical -for the \LaTeX\ Team to be responsible for distributing the -latest versions of these driver files. - -Therefore the installation files for \package{graphics} have been -split: there is now \file{graphics.ins} to install the package files and -\file{graphics-drivers.ins} for the driver files (located in -\file{drivers.dtx}). -There is no need -to install all those provided in the file \file{drivers.dtx}. - -Please also note that, as requested by the maintainers of -\package{PStricks}, we have removed the package \package{pstcol} as -current versions of \package{PSTricks} make it obsolete. - -%% -\newpage -%% - - -\section{Future development} - -The title of this section is a little misleading as it actually -describes \emph{current} development. In 1998 the \package{expl3} -bundle of packages was put on \ctan\ to demonstrate a possible \LaTeX3 -programming environment. These packages have been lying dormant for some -time while the \LaTeX\ Project Team were preoccupied by other things -such as developing the experimental packages \package{xor}, -\package{template}, etc., (and also writing that indispensable -and encyclopaedic volume,\\ -The \LaTeX{} Companion -- 2nd edition). - -In October 2004 work on this code base was resumed with the goal of -some day turning it into a kernel for \LaTeX3. This work can now -also make full use of the widely accepted \eTeX\ extensions. Currently -two areas are central to this work. - -\begin{itemize} -\item Extending the - kernel code of \LaTeX3. -\item Converting the experimental packages - such as \package{xor}, \package{template} to use the new - syntax internally. -\end{itemize} - -Beware! Development of -\package{expl3} is happening so fast that the descriptions above might -be out of date when you read this! If you wish to see what's going on -then go to -\url{http://www.latex-project.org/code.html} where you can download - fully working code (we hope!). - -\end{document} - diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews18.tex b/Master/texmf-dist/source/latex-dev/base/ltnews18.tex deleted file mode 100644 index 4e6090c02b8..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews18.tex +++ /dev/null @@ -1,51 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews18.tex -% -% This is issue 18 of LaTeX News. - -\documentclass - [lw35fonts] % uncomment this line to get Palatino - {ltnews}[2004/02/28] - -% \usepackage[T1]{fontenc} - - -\publicationmonth{December} -\publicationyear{2007} -\publicationissue{18} - -\begin{document} - -\maketitle - -\noindent This news never existed. - -\end{document} - diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews19.tex b/Master/texmf-dist/source/latex-dev/base/ltnews19.tex deleted file mode 100644 index 6441449c2a8..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews19.tex +++ /dev/null @@ -1,116 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews19.tex -% -% This is issue 19 of LaTeX News. - -\documentclass{ltnews} - -\usepackage[T1]{fontenc} - -\usepackage{lmodern,url} - -\publicationmonth{September} -\publicationyear{2009} - -\publicationissue{19} - -\begin{document} - -\maketitle - -\section{New \LaTeX\ release} - -This issue of \LaTeX~News marks the first release of a new version of -\LaTeXe\ since the publication of The \LaTeX\ Companion in 2005--2006. - -Just in time for \TeX\ Live 2009, this version is a maintenance -release and introduces no new features. A number of small changes have -been made to correct minor bugs in the kernel, slightly extend the Unicode -support, and improve various -aspects of some of the \texttt{tools} packages. - -\section{New code repository} - -Since the last \LaTeX\ release, the entire code base has been moved -to a public \textsc{svn} repository% -\footnote{\url{http://www.latex-project.org/svnroot/latex2e-public/}} -and the entire build architecture re-written. In fact, it has only -been possible for us to consider a new \LaTeX\ release since earlier -this year when the test suite was finally set up with the new system. -In the process, a bug in the \LaTeX\ picture fonts distributed with -\TeX\ Live was discovered, proving that the -tests are working and are still very valuable. - -Now that we can easily generate new packaged versions of the \LaTeXe\ -distribution, we expect to be able to roll out bug fixes in a much -more timely manner than over the last few years. New versions should -be distributed yearly with \TeX\ Live. Having said this, the -maintenance of the \LaTeXe\ kernel is slowing down as the bugs become -fewer and more subtle. Remember that we cannot change any of the -underlying architecture of the kernel or any design decisions of the -standard classes because we must preserve backwards compatibility with -legacy documents at all costs. - -Even new features cannot be added, because any new documents using -them will not compile in systems (such as journal production engines) -that are generally not updated once they've been proven to work as -necessary. - -None of this is to say that we consider \LaTeXe\ to be any less -relevant for document production than in years past: a stable system -is a useful one. -Moreover, the package system continues to provide a flourishing and stable -means -for the development of a wide range of extensions. - -\newpage - -\section{Babel} - -One area of the \LaTeXe\ code base that is still receiving feedback to -be incorporated into the main distribution is the Babel system for -multilingual typesetting. -While the Babel sources have already been added to the \textsc{svn} repository the -integration of the test system for Babel is still outstanding. - - -\section{The future} - -While work on \LaTeXe\ tends to maintenance over active development, -the \LaTeX3 project is -seeing new life. Our goals here are to provide a transition from the -\LaTeXe\ document processing model to one with a more flexible -foundation. Work is continuing in the \textsf{expl3} programming -language and the \textsf{xpackages} for document design. Future -announcements -about \LaTeX3 will be available via the \LaTeX\ Project -website and in TUGboat. - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews20.tex b/Master/texmf-dist/source/latex-dev/base/ltnews20.tex deleted file mode 100644 index b095411c676..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews20.tex +++ /dev/null @@ -1,153 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 1993--2011 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews20.tex -% -% This is issue 20 of LaTeX News. - -\documentclass{ltnews} - -\usepackage[T1]{fontenc} - -\usepackage{lmodern,url} - -\publicationmonth{June} -\publicationyear{2011} - -\publicationissue{20} - -\begin{document} - -\maketitle - -\section{Scheduled \LaTeX\ bug-fix release} - -This issue of \LaTeX~News marks the first bug-fix release of -\LaTeXe\ since shifting to a new build system in 2009. -Provided sufficient changes are made each year, we expect to -repeat such releases once per year to stay in sync with \TeX\ Live. -Due to the excitement of \TeX's $2^5$-th birthday last year, -we missed our window of opportunity to do so for 2010. -This situation has been rectified this year! - -\section{Continued development} - -The \LaTeXe\ program is no longer being actively developed, as any non-negligible changes now could have dramatic backwards compatibility issues with old documents. Similarly, new features cannot be added to the kernel since any new documents written now would then be incompatible with legacy versions of \LaTeX. - -The situation on the package level is quite different though. While most of us have stopped developing packages for \LaTeXe{} there are many contributing developers that continue to enrich \LaTeXe{} by providing or extending add-on packages with new or better functionality. - -However, the \LaTeX\ team certainly recognises that there are improvements to be made to the kernel code; over the last few years we have been working on building, expanding, and solidifying the \textsf{expl3} programming layer for future \LaTeX\ development. We are using \textsf{expl3} to build new interfaces for package development and tools for document design. Progress here is continuing. - -\section{Release notes} - -In addition to a few small documentation fixes, the following changes have been made to the \LaTeXe\ code; in accordance with the philosophy of minimising forwards and backwards compatibility problems, most of these will not be noticeable to the regular \LaTeX\ user. - -\paragraph{Font subsets covered by Latin Modern and \TeX\ Gyre} - -The Latin Modern and \TeX\ Gyre fonts are a modern suite of families based -on the well-known Computer Modern and `PostScript 16' families with many additional -characters for high-quality multilingual typesetting.% -\footnote{% - See their respective TUGboat articles for more information:\\ - \url{http://www.tug.org/TUGboat/tb24-1/jackowski.pdf}\\ - \url{http://www.tug.org/TUGboat/tb27-2/tb87hagen-gyre.pdf}% -} - -Information about their symbol coverage in the \verb|TS1| encoding is now included -in \texttt{textcomp}'s default font definitions. - -% \paragraph{Private conditional switch in italic correction} -% negligible improvement/only useful to LaTeX programmers: not worth documenting I think? - -% \paragraph{Improve formatting in \texttt{doc} for filenames with some punctuation} -% negligible improvement, again? - -\paragraph{Redefinition of \cs{enddocument}} - -Inside the definition of \verb=\end{document}= the \texttt{.aux} file is read back in to resolve cross-references and build the table of contents etc. From 2.09 days this was done using \verb=\input= without any surrounding braces which could lead to some issues in boundary cases, especially if \verb=\input= was redefined by some package. It was therefore changed to use \LaTeXe{}'s internal name for this function. As a result, packages that modify \verb=\enddocument= other than through the officially provided hooks may need to get updated. - -\paragraph{Small improvement with split footnotes in \texttt{ftnright}} - -If in the first column there is more than a full column worth of footnote -material the material will be split resulting in footnotes out of -order. This issue is now at least detected and generates an error but the algorithm used by the package is -unable to gracefully handle it in an automated fashion (some alternatives for resolving the problem if it happens are given in the package documentation). - -\paragraph{Improvement in \texttt{xspace} and font-switching} - -The \texttt{xspace} package provides the command \verb|\xspace| -which attempts to be clever about inserting spaces automatically -after user-defined control sequences. -An important bug fix has been made to this command to correct its -behaviour when used in conjunction with font-switching commands -such as \verb|\emph| and \verb|\textbf|. -Previously, writing -\begin{verbatim} - \newcommand\foo{foo\xspace} - ... \emph{\foo} bar baz - ... \emph{\foo}, bar baz -\end{verbatim} -would result in an extraneous space being inserted after `foo' in -both cases; this has now been corrected. - - -\paragraph{RTL in \texttt{multicol}} - - The 1.7 release of \texttt{multicol} adds support for languages that are typeset - right-to-left. For those languages the order of the columns on the page - also needs to be reversed---something that wasn't possible in earlier releases. - -The new feature is supported through the -commands \verb|\RLmulticolcolumns| (switching to right-to-left typesetting) -and \verb|\LRmulticolcolumns| (switching to left-to-right typesetting) the -latter being the default. - -\paragraph{Improve French \texttt{babel} interaction with \texttt{varioref}} - - Extracting and saving the page number turned out to be a source of subtle - bugs. Initially it was done through an \verb"\edef" with a bunch of -\verb"\expandafter" commands inside. This posed a problem if the page number - itself contained code which needed protection (e.g., pr/4080) so this got - changed in the last release to use \verb"\protected@edef". However, that in turn failed with Babel -(bug report/4093) if the label contained active characters, e.g., a ``:'' in French. So now -we use (after one failed attempt pr/4159) even more \verb"\expandafter" commands and \verb"\romannumeral" trickery to avoid any expansion other - than what is absolutely required---making the code in that space absolutely unreadable. -\begin{verbatim} - \expandafter\def\expandafter#1\expandafter{% - \romannumeral - \expandafter\expandafter\expandafter - \z@ - \expandafter \@cdr - \romannumeral - \expandafter\expandafter\expandafter - \z@ - \csname r@#2\endcsname\@nil}% -\end{verbatim} -Code like this nicely demonstrates the limitations in the programming layer of \LaTeXe{} and the advantages that \textsf{expl3} will offer on this level. - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews21.tex b/Master/texmf-dist/source/latex-dev/base/ltnews21.tex deleted file mode 100644 index b7c87d6f324..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews21.tex +++ /dev/null @@ -1,255 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2014 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews21.tex -% -% This is issue 21 of LaTeX News. - -\documentclass{ltnews} -\def\ConTeXt{C\kern-.0333emon\-\kern-.0667em\TeX\kern-.0333emt} -\usepackage[T1]{fontenc} - -\usepackage{lmodern,url,hologo} - -\publicationmonth{May} -\publicationyear{2014} - -\publicationissue{21} - -\begin{document} - -\maketitle - -\section{Scheduled \LaTeX\ bug-fix release} - -This issue of \LaTeX~News marks the second bug-fix release of -\LaTeXe\ (standard \LaTeX) since shifting to a new build system in 2009. -Provided sufficient changes are made, we expect to -make such releases yearly or every two years, in sync with \TeX\ Live. - - - -\subsection{Release notes} - -This release makes no changes to the core code in the \LaTeXe\ format -but there are a small number of documentation fixes (not listed -here). In addition several packages in the \textsf{base} and -\textsf{required} areas have been updated as detailed below. - - -This has been done in accordance with the philosophy of minimising -problems in both forwards and backwards compatibility, so most of -these changes should not be noticed by the regular \LaTeX\ user. - -References in the text below of the form ``graphics/3873'' are to -bug reports listed -at:\\ \url{http://latex-project.org/cgi-bin/ltxbugs2html} - - -\let\paragraph\subsubsection - -\paragraph{\textsf{fixltx2e} updates} - - - -There are a number of bugs and faulty design decisions in \LaTeXe{} -that should have been corrected long ago in the kernel code. However, -such corrections cannot be done as this would break backwards -compatibility in the following sense. A large number of documents -exist by now that have worked around the bug or have even made use of -a particular misfeature. Thus changing the kernel code would break -too many existing documents. - -The corrections for these types of bug have therefore been collected together -in a package that can be loaded only when needed; its name is \textsf{fixltx2e}. -For this release we made the following changes to this package: -\begin{itemize} -\item - Misspelled float placement specifiers such as - \verb=\begin{figure}[tv]= instead of \texttt{tb} are silently - ignored by the kernel code. Now we test for such letters and issue - an error message. -\item - \LaTeX's float handling algorithm can get out of sync if you mix - single and double-column floats (as they are placed independently - of each other). This was corrected in \textsf{fixltx2e} a few years ago - but the fix was not perfect as one situation using - \verb=\enlargethispage= generated a low-level \TeX{} error. - This behaviour of the package is now improved. -\end{itemize} - - - - -\paragraph{New \textsf{fltrace} package} - -For years the file \texttt{ltoutput.dtx} contained some hidden code to -trace the detailed behaviour of the float placement algorithm of -\LaTeX. Prompted by questions on StackExchange we now extract this -code into a new \textsf{fltrace} package. To see the float algorithm -in action (or to understand why it decides to place all your floats at -the very end of the document) use -\begin{verbatim} - \usepackage{fltrace} \tracefloats -\end{verbatim} -To stop tracing somewhere in the document use -\verb=\tracefloatsoff= and to see the current value of various float -parameters use \verb=\tracefloatvals=. As the package is identical to -the kernel code with tracing added, it may or may not work if you load any -other package that manipulates that part of the kernel code. In such a -case your best bet is to load \textsf{fltrace} first. - -\paragraph{\textsf{inputenc} package updates} - -The \textsf{inputenc} package allows different input encodings for -\LaTeX\ documents to be specified including the important -\texttt{utf8} option used to specify the Unicode UTF-8 encoding. A -common mistake in documents has been to also include this option when -using the Unicode-based \TeX\ engines \hologo{LuaTeX} and \hologo{XeTeX} -producing strange errors as these engines natively deal with UTF-8 -characters. - -If a document stored in an 8bit encoding is processed by -\hologo{pdfTeX}, it needs the \textsf{inputenc} package to work -correctly. However, if such a document is processed unchanged by -\hologo{LuaTeX} or \hologo{XeTeX}, then accented characters may -silently get dropped from the output. - -The package has been modified so that if used with \hologo{LuaTeX} or -\hologo{XeTeX}, then it just issues a warning if \texttt{utf8} or -\texttt{ascii} is specified, and stops with an error for any other -encoding requested. - - - -One further improvement has been made to the encoding definition files -(\texttt{.def}) used by \textsf{inputenc}: the catcode of \texttt{@} -is now saved and restored when reading them instead of always using -\verb=\makeatother= inside the files (latex/4192). - - - -\paragraph{The tools directory} - -In the past each of the sub-directories in the ``required'' section of -the \LaTeX{} distribution contained a single \texttt{.ins} file to -generate the code files from the source files. We have now -started to provide individual \texttt{.ins} files for each of those -packages that are likely to require updates outside a major -\LaTeX{} release. - -\paragraph{\textsf{multicol} updates} - -Version 1.8 of \textsf{multicol} implements some improvements/fixes -and one extension. In the past the balancing algorithm enlarged the -column height until it found a solution that satisfied all -constraints. If there were insufficient break points then the final -column height could have been much larger than expected and if that -happened near the end of the page it resulted in the text overflowing -into the bottom margin. This situation is now detected and in that -case a normal page is cut and balancing is resumed on the next -page. Some overflow is still allowed and controlled via the parameter -\verb=\maxbalancingoverflow=. - -The use of \verb=\enlargethispage= is now properly supported within -the environment. Finally a new command \verb=\docolaction= was added -to allow the execution of code depending on the column in which the -command is executed. See the documentation for details. - -Bug fixes: the new version fixes both a color leak that could happen -in certain situations and the problem that \texttt{multicols} could -mess up the positioning of \verb=\marginpar=s that followed the -environment. - - -\paragraph{\textsf{tabularx} updates} - -The restrictions on embedding \verb|\tabularx| \verb|\endtabularx| -into the definition of a new environment have been relaxed -slightly. See the package documentation for details. - -\paragraph{\textsf{showkeys} updates} - -The \textsf{showkeys} package has been updated to fix problems if used -at the start of list items, and to work if brace groups (\verb|{| and -\verb|}|) are used in the optional argument of -\verb|\cite|. (tools/4162, tools/4173) - - -\paragraph{\textsf{color} updates} - -The \verb|\nopagecolor| command suggested by Heiko Oberdiek, -available for some years in the \textsf{pdftex} option, has been -added to the core package as suggested in graphics/3873. Currently -this is supported in the driver files for \textsf{dvips} and -\textsf{pdftex}. Patches to support other drivers are welcome. - - \paragraph{\textsf{graphicx} updates} - -The \textsf{graphicx} version of \verb|\rotatebox| now allows -\verb|\par| (and blank lines) in values, to match the change made -to the \textsf{graphics} version some years ago. See graphics/4296. - - -\paragraph{\textsf{keyval} updates} - -All parsing used in the \textsf{keyval} package has been changed -to allow \verb|\par| (and blank lines) in values. -(A second change, to parsing of brace groups -in a construct such as \texttt{key=\{\{\{value\}\}\}}, was reverted in v1.15.) -See graphics/3446. - - - - -\vfill - -\section{Standard \LaTeX\ (\LaTeXe) and \textsf{expl3}} - -The substantial collection of innovative code in \textsf{expl3} -implements a new programming language that has for a while now been -used by some writers of \LaTeXe\ packages. This code has recently -also been made available for use on top of plain \TeX\ or {\ConTeXt}, -largely to support generic packages that are supposed to work with -different flavours of \TeX. These uses in no way affect authors of -\LaTeX\ documents and such \LaTeXe\ packages will continue to work as -advertised by their authors with standard \LaTeX. - -This code base will also become an important foundation for the kernel -of \LaTeX3 and so the new programming language can be described as -`The \LaTeX3 Programming Language'. However, if you see or hear that a -package `uses \LaTeX3' then it remains very unlikely (as yet) to mean -that the package is part of some `new version of \LaTeX'. - -News about the development and use of \textsf{expl3} and about other -developments in the \LaTeX3 code base is reported regularly in the -\LaTeX3~News series (\url{http://latex-project.org/l3news/}), the most -recent issue of which was published in March 2014. - - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews22.tex b/Master/texmf-dist/source/latex-dev/base/ltnews22.tex deleted file mode 100644 index c574f60568e..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews22.tex +++ /dev/null @@ -1,244 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2015 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews22.tex -% -% This is issue 22 of LaTeX News. - -\documentclass{ltnews} -\usepackage[T1]{fontenc} - -\usepackage{lmodern,url,hologo} - -\publicationmonth{January} -\publicationyear{2015} - -\publicationissue{22} - -\begin{document} - -\maketitle - -\section{New \LaTeXe\ bug-fix policy} - -\subsection{Introduction} - -For some years we have supplied bug fixes to the \LaTeXe\ kernel via the -\textsf{fixltx2e} package. This -kept the kernel stable, but at the expense of meaning that most users did not -benefit from bug fixes, and that some compromises -which were made to save space in the -machines of the time are still affecting most users today. - -In this release we have started a new update policy. All the fixes previously -available via \textsf{fixltx2e} are now enabled \emph{by default} in the -format, as are some further extensions for extended \TeX\ engines, \eTeX, -\hologo{XeTeX} and \hologo{LuaTeX}. Compatibility and stability are still -important considerations, and while most users will not notice these -improvements, or will want to benefit from them, a new \textsf{latexrelease} -package is provided that will revert all the changes and re-instate the -definitions from earlier releases. The package can also be used with older -releases to effectively \emph{update} the kernel to be equivalent to this 2015 -release. - -A new document, \textsf{latexchanges}, is distributed with the release -that documents all the changes to documented commands since the 2014 -\LaTeX\ release, and will be updated in future releases if further -changes have been made. - -\subsection{The \textsf{latexrelease} package} - -As noted above a new package is available to manage differences between \LaTeX\ -releases. If you wish to revert all changes back to the definitions as they -were in previous releases you may start your document requesting the \LaTeX{} release from May~2014: -\begin{verbatim} -\RequirePackage[2014/05/01]{latexrelease} -\documentclass{article} -\end{verbatim} -Conversely if you start a large project now and want to protect yourself -against possible future changes, you may start your document -\begin{verbatim} -\RequirePackage[2015/01/01]{latexrelease} -\documentclass{article} -\end{verbatim} -Then the version of \textsf{latexrelease} distributed with any future \LaTeX\ -release will revert any changes made in that format, and revert to the -definitions as they where at the beginning of 2015. - -If you wish to share a document using the latest features with a -user restricted to using an older -format, you may use the form above and make the \textsf{latexrelease} package -available on the older installation. The package will then update the format -definitions as needed to enable the older format to work as if dated on the date -specified in the package option. - -\subsection{The \cs{IncludeInRelease} command} - -The mechanism used in the \textsf{latexrelease} package is available for use in -package code. If in your \textsf{zzz} package you have -\begin{verbatim} -\RequirePackage{latexrelease} -\IncludeInRelease{2015/06/01} - {\zzz}{\zzz definition} - \def\zzz......new code -\EndIncludeInRelease -\IncludeInRelease{0000/00/00} - {\zzz}{\zzz definition} - \def\zzz....original -\EndIncludeInRelease -\end{verbatim} -then in a document using a format dated 2015/06/01 or later, the ``new code'' -will be used, and for documents being processed with an older format, the -``original'' code will be used. Note the format date here may be the original -format date as shown at the start of every \LaTeX\ run, or a format date -specified as a package option to the \textsf{latexrelease} package. - -So if the document has -\begin{verbatim} -\RequirePackage[2014/05/01]{latexrelease} -\documentclass{article} -\usepackage{zzz} -\end{verbatim} -then it will use the \emph{original} definition of \verb|\zzz| even if -processed with the current format, as the format acts as if dated 2014/05/01. - - -\subsection{Limitations of the approach} - -The new concept provides full backward and forward compatibility for -the \LaTeX{} format, i.e., with the help of a current -\textsf{latexrelease} package the kernel can emulate all released -formats (starting with 2014/06/01\footnote{Patching an older format - most likely works too, given that the changes in the past have been - minimal, though this isn't guaranteed and hasn't been tested.}). - - -However, this is not necessarily true for all packages. - Only if a package makes use of the \cs{IncludeInRelease} -functionality will it adjust to the -requested \LaTeX{} release date. Initially this will only be true for -a few selected packages and in general it may not even be advisable for packages -that have their own well-established release cycles and methods. - -Thus, to regenerate a document with 100\,\% compatible behavior -it will still be necessary -to archive it together with all its inputs, for example, by archiving -the base distribution trees (and any modifications made). However, the -fact that a document requests a specific \LaTeX{} release date should -help identifying what release tree to use to achieve perfect accuracy. - - -\section{Updates to the kernel} - -\subsection{Updates incorporated from \textsf{fixltx2e}} - -The detailed list of changes incorporated from \textsf{fixltx2e} is -available in the new \textsf{latexchanges} document that is -distributed with this release. The main changes are that $2$-column -floats are kept in sequence with one column floats, corrections are -made to the \verb|\mark| system to ensure correct page headings in -$2$-column documents, several additional commands are made robust. - -\subsection{\eTeX\ register allocation} - -\LaTeX\ has traditionally used allocation routines inherited from plain \TeX\ -that allocated registers in the range $0$--$255$. Almost all distributions have -for some years used \eTeX\ based formats (or \hologo{XeTeX} or \hologo{LuaTeX}) -which have $2^{15}$ registers of each type ($2^{16}$ in the case of -\hologo{LuaTeX}). The \textsf{etex} package has been available to provided an -allocation mechanism for these extended registers but now the format will by -default allocate in a range suitable for the engine being used. The new -allocation mechanism is different than the \textsf{etex} package mechanism, and -supports \hologo{LuaTeX}'s full range and an allocation mechanism for \LaTeX\ -floats as described below. - -On \eTeX\ based engines, an additional command, \verb|\newmarks| is available -(as with the \textsf{etex} package) that allocates extended \eTeX\ marks, and -similarly if \hologo{XeTeX} is detected a new command -\verb|\newXeTeXintercharclass| is available, this is similar to the command -previously defined in the \texttt{xelatex.ini} file used to build the -\texttt{xelatex} format. - -\subsection{Additional \LaTeX{} float storage} - -\LaTeX's float placement algorithm needs to store floats (figures and tables) -until it finds a suitable page to output them. It allocates $18$ registers for -this storage, but this can often be insufficient. - The contributed \textsf{morefloats} package has -been available to extend this list; however, it also only allocates from the -standard range $0$--$255$ so cannot take advantage of the extended registers. -The new allocation mechanism in this release incorporates a new command -\verb|\extrafloats|. If you get the error: -\mbox{\texttt{Too many unprocessed floats.}} -then you can add (say) \verb|\extrafloats{500}| to the document preamble to -make many more boxes available to hold floats. - - -\subsection{Built-in support for Unicode engines} - -The kernel sources now detect the engine being used and adjust definitions -accordingly, this reduces the need for the ``\texttt{.ini}'' files used to make -the formats to patch definitions defined in \texttt{latex.ltx}. - -As noted above the format now includes extended allocation routines. - -The distribution includes a file \textsf{unicode-letters.def} derived from the -Unicode Consortium's Unicode Character Data files that details the upper and -lower case transformation data for the full Unicode range. This is used to set -the \verb|lccode| and \verb|uccode| values if a Unicode engine is being used, -rather than the values derived from the T1 font encoding which are used with -8-bit engines. - -Finally \verb|\typein| is modified if \hologo{LuaTeX} is detected -such that it works with this engine. - -\section{l3build} - -This release has been tested and built using a new build system implemented in -\textsf{Lua}, intended to be run on the \textsf{texlua} interpreter distributed -with modern \TeX\ distributions. It is already separately available -from CTAN. This replaces earlier build systems (based at various times on -\textsf{make}, \textsf{cons}, and Windows \textsf{bat} files). It allows the -sources to be tested and packaged on a range of platforms (within the team, -OS X, Windows, Linux and Cygwin platforms are used). It also allows the -format to be tested on \hologo{XeTeX} and \hologo{LuaTeX} as well as the -standard \hologo{pdfTeX}/\eTeX\ engines. - -\section{Hyperlinked documentation and TDS zip files} - -As well as updating the build system, the team have looked again at exactly -what gets released to \textsc{ctan}. Taking inspiration from Heiko Oberdiek's -\textsf{latex-tds} bundle, the PDF documentation provided now includes -hyperlinks where appropriate. This has been done without modifying the sources -such that users without \textsf{hyperref} available can still typeset the -documentation using only the core distribution. At the same time, the release -now includes ready-to-install TDS-style zip files. This will be of principal -interest to \TeX\ system maintainers, but end users with older machines who -wish to manually update \LaTeX\ will also benefit. - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews23.tex b/Master/texmf-dist/source/latex-dev/base/ltnews23.tex deleted file mode 100644 index 149bd1a74bb..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews23.tex +++ /dev/null @@ -1,257 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2015 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews23.tex -% -% This is issue 23 of LaTeX News. - -\documentclass{ltnews} -\usepackage[T1]{fontenc} - -\usepackage{lmodern,url,hologo} - -\makeatletter % -- provide command introduced in new release - % so this typesets with an old format - -% Check we are not in the preamble of a composite document -\def\@tempa{\@latex@error{Can be used only in preamble}\@eha} -\ifx\DeclareTextCommandDefault\@tempa -\else - \DeclareTextCommandDefault\textcommabelow[1] - {\hmode@bgroup\ooalign{\null#1\crcr\hidewidth\raise-.31ex - \hbox{\check@mathfonts\fontsize\ssf@size\z@ - \math@fontsfalse\selectfont,}\hidewidth}\egroup} -\fi -\makeatother - -\publicationmonth{October} -\publicationyear{2015} - -\publicationissue{23} - -\begin{document} - -\maketitle - -\tableofcontents - -\section{Enhanced support for \hologo{LuaTeX}} - -As noted in \LaTeX\ News 22, the 2015/01/01 release of \LaTeX{} -introduced built-in support for extended \TeX\ systems. - -The range of allocated register numbers (for example, for count -registers) is now set according to the underlying engine capabilities -to 256, 32768 or 65536. Additional allocators were also added for the -facilities added by \hologo{eTeX} (\verb|\newmark|) and \hologo{XeTeX} -(\verb|\newXeTeXintercharclass|). At that time, however, the work to -incorporate additional allocators for \hologo{LuaTeX} was not ready for -distribution. - -The main feature of this release is that by default it includes -allocators for \hologo{LuaTeX}-provided features, such as Lua -functions, bytecode registers, catcode tables and Lua callbacks. -Previously these features have been provided by the contributed -\package{luatex} (Heiko Oberdiek) and \package{luatexbase} -(\'{E}lie Roux, - Manuel P\'{e}gouri\'{e}-Gonnard and Philipp Gesang) -packages. However, just as -noted with the \package{etex} package in the previous release, it is -better if allocation is handled by the format to avoid problems with -conflicts between different allocation schemes, or definitions made -before a package-defined allocation scheme is enabled. - -The facilities incorporated into the format with this release, and -described below, are closely modelled on the \package{luatexbase} -package and we thank the authors, and especially \'{E}lie Roux, for -help in arranging this transition. - -The implementation of these \hologo{LuaTeX} features has been -redesigned to match the allocation system introduced in the 2015/01/01 -\LaTeX\ release, and there are some other differences from the previous -\package{luatexbase} package. However, as noted below, -\package{luatexbase} is being updated in line with this \LaTeX\ release -to provide the previous interface as a wrapper around the new -implementation, so we expect the majority of documents using -\package{luatexbase} to work without change. - -\subsection{Names of \hologo{LuaTeX} primitive commands} - -The 2015/01/01 \LaTeX\ release for the first time initialised -\hologo{LuaTeX} in \textsf{latex.ltx} if \hologo{LuaTeX} is being -used. Following the convention used in the contributed -\textsf{lualatex.ini} file used to set up the format for earlier -releases, most \hologo{LuaTeX}-specific primitives were defined with -names prefixed by \texttt{luatex}. This was designed to minimize name -clashes but had the disadvantage that names did not match the -\hologo{LuaTeX} manual, or the names used in other formats, and -produced some awkward command names such as \verb|\luatexluafunction|. -From this release the names are enabled without the \texttt{luatex} -prefix. - -In practice this change should not affect many documents; relatively -few packages access the primitive commands, and many of those are -already set up to work with prefixed or unprefixed names, so that they -work with multiple formats. - -For package writers, if you want to ensure that your code works with -this and earlier releases, use unprefixed names in the package and -ensure that they are defined by using code such as: -\begin{verbatim} -\directlua{tex.enableprimitives("", - tex.extraprimitives( - "omega", "aleph", "luatex"))} -\end{verbatim} -Conversely if your document uses a package relying on prefixed names -then you can add: -\begin{verbatim} -\directlua{tex.enableprimitives("luatex", - tex.extraprimitives( - "omega", "aleph", "luatex"))} -\end{verbatim} -to your document. - -Note the compatibility layer offered by the \package{luatexbase} package -described below makes several commands available under both names. - -As always, this change can be reverted using:\\ -\verb|\RequirePackage[2015/01/01]{latexrelease}|\\ -at the start of the document. - - - -\subsection{\TeX\ commands for allocation in \hologo{LuaTeX}} -For detailed descriptions of the new allocation commands see the -documented sources in \textsf{ltluatex.dtx} or chapter N of -\textsf{source2e}; however, the following new allocation commands are -defined by default in \hologo{LuaTeX}: -\verb|\newattribute|, -\verb|\newcatcodetable|, -\verb|\newluafunction| and -\verb|\newwhatsit|. -In addition, the commands \verb|\setattribute| and -\verb|\unsetattribute| are defined to set and unset Lua attributes -(integer values similar to counters, but attached to nodes). Finally -several catcode tables are predefined: -\verb|\catcodetable@initex|, -\verb|\catcodetable@string|, -\verb|\catcodetable@latex|, -\verb|\catcodetable@atletter|. - -\subsection{Predefined Lua functions} -If used with \hologo{LuaTeX}, \LaTeX\ will initialise a Lua table, -\textsf{luatexbase}, with functions supporting allocation and also -the registering of Lua callback functions. - -\subsection{Support for older releases and plain \TeX} -The \hologo{LuaTeX} allocation functionality made available in this -release is also available in plain \TeX\ and older \LaTeX\ releases -in the files \textsf{ltluatex.tex} and \textsf{ltluatex.lua} which may be -used simply by including the \TeX\ file: \verb|\input{ltluatex}|. -An alternative for old \LaTeX\ releases is to use:\\ -\verb|\RequirePackage[2015/10/01]{latexrelease}|\\ -which will update the kernel to the current release, including -\hologo{LuaTeX} support. - -\subsection{Additional \hologo{LuaTeX} support packages} -In addition to the base \LaTeX\ release two packages have been -contributed to the \textsf{contrib} area on CTAN. The -\package{ctablestack} package offers some commands to help package -writers control the \hologo{LuaTeX} \textsf{catcodetable} -functionality, and the \package{luatexbase} package replaces the -previously available package of the same name, providing a compatible -interface but implemented over the \package{ltluatex} code. - -\section{More Floats and Inserts} -If \hologo{eTeX} is available, the number of registers allocated in -the format to hold floats such as figures is increased from 18 to 52. - -The extended allocation system introduced in 2015/01/01 means that in -most cases it is no longer necessary to load the \package{etex} -package. Many classes and packages that previously loaded this package -no longer do so. Unfortunately in some circumstances where a package -or class previously used the \package{etex} \verb|\reserveinserts| -command, it is possible for a document that previously worked to -generate an error ``no room for a new insert''. In practice this error -can always be avoided by declaring inserts earlier, before the -registers below 256 are all allocated. However, it is better not -to require packages to be re-ordered and in some cases the re-ordering -is complicated due to delayed allocations in \verb|\AtBeginDocument|. - -In this release, a new implementation of -\verb|\newinsert| is used which allocates inserts from the previously -allocated float lists once the classical register allocation has run -out. This allows an extra 52 (or in \hologo{LuaTeX}, 64~thousand) -insert allocations which is more than enough for practical documents -(by default, \LaTeX\ only uses two insert allocations). - -\section{Updated Unicode data} - - -The file \textsf{unicode-letters.def} recording catcodes, upper and -lower case mappings and other properties for Unicode characters has -been regenerated using the data files from Unicode~8.0.0. - -\section{Support for Comma Accent} -The command \verb|\textcommabelow| has been added to the format. -This is mainly used for the Romanian letters -\textcommabelow{S}\textcommabelow{s}\textcommabelow{T}\textcommabelow{t}. -This was requested in latex/4414 in the \LaTeX\ bug tracker. - -\section{Extended \package{inputenc}} -The \texttt{utf8} option for \package{inputenc} has been extended to support -the letters s and t with comma accent, -U+0218\,--\,U+021b. Similarly circumflex w and y U+0174\,--\,U+0177 are defined. -Also U+00a0 and U+00ad are declared by default, and defined to be -\verb|\nobreakspace| and \verb|\-| respectively. - -The error message given on undefined UTF-8 input characters -now displays the Unicode number -in U+\textit{hex} format in addition -to showing the character. - -\section{Pre-release Releases} -The patch level mechanism has been used previously to identify \LaTeX\ -releases that have small patches applied to the main release, without -changing the main format date. - -The mechanism has now been extended to allow identification of -pre-release versions of the software (which may or may not be released -via CTAN) but can be identified with a banner such as\\ -{\catcode`\<=13 \def<{\string<} \catcode`\>=13 \def>{\string>}% -\verb|LaTeX2e <2015/10/01> pre-release-1|}\\ -Internally this is identified as a patch release with a negative patch -level. - -\section{Updates in tools} - -The \package{multicol} package has been updated to fix the interaction -with ``here'' floats that land on the same page as the start or end of -a \textsf{multicols} environment. - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews24.tex b/Master/texmf-dist/source/latex-dev/base/ltnews24.tex deleted file mode 100644 index 573f1e87c87..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews24.tex +++ /dev/null @@ -1,263 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2015,2016 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews24.tex -% -% This is issue 24 of LaTeX News. - -\documentclass{ltnews} -\usepackage[T1]{fontenc} - -\usepackage{lmodern,url,hologo} - -\makeatletter % -- provide command introduced in new release - % so this typesets with an old format - -% Check we are not in the preamble of a composite document -\def\@tempa{\@latex@error{Can be used only in preamble}\@eha} -\ifx\DeclareTextCommandDefault\@tempa -\else - \DeclareTextCommandDefault\textcommabelow[1] - {\hmode@bgroup\ooalign{\null#1\crcr\hidewidth\raise-.31ex - \hbox{\check@mathfonts\fontsize\ssf@size\z@ - \math@fontsfalse\selectfont,}\hidewidth}\egroup} - \DeclareTextCommandDefault\textcommaabove[1]{% - \hmode@bgroup - \ooalign{% - \hidewidth - \raise.7ex\hbox{% - \check@mathfonts\fontsize\ssf@size\z@\math@fontsfalse\selectfont`% - }% - \hidewidth\crcr - \null#1\crcr - }% - \egroup - } -\fi - -\makeatother - -\publicationmonth{February} -\publicationyear{2016} - -\publicationissue{24} - -\begin{document} - -\maketitle - -\tableofcontents - -\section{\hologo{LuaTeX} support} - -This release refines the \hologo{LuaTeX} support introduced in the -2015/10/01 release. A number of patches have been added to improve the -behavior of \package{ltluatex} (thanks largely to code review by Philipp Gesang). -The kernel code has been adjusted to -allow for changes in \hologo{LuaTeX} v0.85--v0.88. Most notably, newer -\hologo{LuaTeX} releases allow more than $16$ write streams and these are now -enabled for use by \verb|\newwrite|, but also the experimental -\texttt{newtoken} Lua library has been renamed back to \texttt{token} -which required small adjustments in the \hologo{LuaTeX} setup. - -The biggest change in \hologo{LuaTeX} v0.85--v0.87 compared to previous -versions is that all the primitives (originally defined in -\hologo{pdfTeX}) dealing with the PDF ``back end'' -are no longer defined, being replaced by a much smaller set of new primitives. -This does not directly affect the core \LaTeX{} -files in this release but has required major changes to the -\texttt{.ini} files used by \TeX{} Live and similar distributions to -set up the format files. These changes in the \hologo{LuaTeX} engine -will affect any packages using these back end commands (packages such -as \package{graphics}, \package{color}, \package{hyperref}, etc.). -Until all contributed packages are updated to the new syntax users may -need to add aliases for the old \hologo{pdfTeX} commands. A new -\package{luapdftexalias} package has been contributed to CTAN (not part of the -core \LaTeX\ release) that may be used for this purpose. - -See also the sections below for related changes in the -\textsf{tools} and \textsf{graphics} bundles. - - -\section{Unicode data} - -As noted in \LaTeX{} News~22, the 2015/01/01 release of \LaTeX{} introduced -built-in support for extended \TeX{} systems. In particular, the kernel now -loads appropriate data from the Unicode Consortium to set \verb|\lccode|, -\verb|\uccode|, \verb|\catcode| and \verb|\sfcode| values in an automated -fashion for the entire Unicode range. - -The initial approach taken by the team was to incorporate the existing model -used by (plain) \hologo{XeTeX} and to pre-process the ``raw'' Unicode data into -a ready-to-use form as \verb|unicode-letters.def|. However, the relationship -between the Unicode Consortium files and \TeX{} data structures is non-trivial and still -being explored. As such, it is preferable to directly parse the original -(\verb|.txt|) files at point of use. The team has therefore ``spun-out'' both -the data and the loading to a new generic package, \package{unicode-data}. This -package makes the original Unicode Consortium data files available in the -\verb|texmf| tree (in \verb|tex/generic/unicode-data|) and provides generic -loaders suitable for reading this data into the plain, \LaTeXe{}, and other, -formats. - -At present, the following data files are included in this new package: -\begin{itemize}\parskip=0pt - \item \verb|CaseFolding.txt| - \item \verb|EastAsianWidth.txt| - \item \verb|LineBreak.txt| - \item \verb|MathClass.txt| - \item \verb|SpecialCasing.txt| - \item \verb|UnicodeData.txt| -\end{itemize} -These files are used either by \LaTeXe{} or by \package{expl3} -(i.e.~they represent the set currently required by the team). The -Unicode Consortium provides various other data files and we would be happy to add -these to the generic package, as it is intended to provide a single place -to collect this material in the \verb|texmf| tree. Such requests can be -mailed to the team as~usual or logged at the package home page: -\url{https://github.com/latex3/unicode-data}. - -The new approach extends use of Unicode data in setting \TeX{} information in -two ways. First, the \verb|\sfcode| of all end-of-quotation/closing punctuation -is now set to $0$ (transparent to \TeX{}). Second, \verb|\Umathcode| values are -now set using \verb|MathClass.txt| rather than setting up only letters (which -was done using an arbitrary plane~$0$/plane~$1$ separation). There are also -minor refinements to the existing code setting, particularly splitting the -concepts of case and letter/non-letter category codes. - -For \hologo{XeTeX}, users should note that \verb|\xtxHanGlue| and -\verb|\xtxHanSpace| are \emph{no longer defined}, that no assignments are made -to \verb|\XeTeXinterchartoks| and that no \verb|\XeTeXintercharclass| data is -loaded into the format. The values which were previously inherited from -the plain \hologo{XeTeX} setup files are \emph{not} suitable for properly -typesetting East Asian text. There are third-party packages addressing this -area well, notably those in the \package{CTeX} bundle. Third-party packages -may need adjustment to load the data themselves; see the \textsf{unicode-data} -package for one possible loader. - -\section{More support for east European accents} - -As noted in \LaTeX{} News~23, comma accent support was added for \texttt{s} and -\texttt{t} in the 2015/10/01 release. In this release a matching -\verb|\textcommaabove| accent has been added for U+0123 (\verb|\c{g}|, -\textcommaabove{g}) which is the lower case of U+0122 (\verb|\c{G}|, -\textcommabelow{G}). In the OT1 and T1 encodings the combinations are -declared as composites with the \verb|\c| command, which matches the -Unicode names ``\textsf{latin (capital|small) letter g with cedilla}'' and -also allows \verb|\MakeUppercase{\c{g}}| to produce \verb|\c{G}|, as -required. In T1 encoding, the composite of \verb|\c| with \texttt{k}, \texttt{l}, -\texttt{n} and \texttt{r} are also -declared to use the comma below accent rather than cedilla to match the -conventional use of these letters. - -The UTF-8 \texttt{inputenc} option \texttt{utf8} has been extended to -support all latin combinations that can be reasonably constructed with a -(single) accent command an a base character for the T1 encoding so -\textcommaabove{g}, \k{u} and similar characters may be directly input -using UTF-8 encoding. - -\section{Changes in Graphics} - -The changes in \hologo{LuaTeX}~v0.87 mean that the \package{color} and -\package{graphics} packages no longer share the \texttt{pdftex.def} file -between \hologo{LuaTeX} and \hologo{pdfTeX}. A separate file -\texttt{luatex.def} (distributed separately) has been produced, and -distributions are encouraged to modify \texttt{graphics.cfg} and -\texttt{color.cfg} configuration files to default to the \texttt{luatex} -option if \hologo{LuaTeX}~v0.87 or later is being used. The team has -contributed suitable \texttt{.cfg} files to CTAN to be used -as models. - -Normally it is best to let the local \texttt{graphics.cfg} -automatically supply the right option depending on the \TeX\ engine -being used; however the \package{color} and \package{graphics} (and so -\package{graphicx}) packages have been extended to have an explicit -\texttt{luatex} option comparable to the existing \texttt{pdftex} and -\texttt{xetex} options. - -The \package{trig} package has been updated so that pre-computed values -such as $\sin(90)$ now expand to digits (\texttt{1} rather than the -internal token \verb|\@one| in this case). This allows them to be used -directly in PDF literal strings. - -\section{Changes in Tools} - -\hologo{LuaTeX} from version v0.87 no longer supports the -\verb|\write18| syntax to access system commands. A new package -\package{shellesc} has been added to \textsf{tools} that defines a new -command \verb|\ShellEscape| that may be used in all \TeX\ variants to -provide a consistent access to system commands. The package also -defines \verb|\write18| in \hologo{LuaTeX} so that it continues to access -system commands as before; see the package documentation for details. - -\section{Improving support for Unicode engines} - -\looseness=-1 -Stability concerns are always paramount when considering any change to -the \LaTeXe{} kernel. At the same time, it is important that the format -remains usable and gives reliable results for users. For the Unicode -\TeX{} engines \hologo{XeTeX} and \hologo{LuaTeX} there are important -differences in behavior from classical ($8$-bit) \TeX{} engines which -mean that identical default behaviors are not appropriate. Over the -past 18 months the team has addressed the most pressing of these -considerations (as detailed above and in \LaTeX{} News~22 and 23), -primarily by integrating existing patches into the kernel. There are, -though, important areas which still need consideration, and which -\emph{may} result in refinements to kernel support in this area in -future releases. - -The default font setup in \LaTeXe{} at present is to use the \texttt{OT1} -encoding. This assumes that hyphenation patterns have been read using -appropriate codes: the \texttt{T1} encoding is assumed. The commonly-used -hyphenation patterns today, \package{hyph-utf8}, are set up in this -way for $8$-bit engines (\hologo{pdfTeX}) but for Unicode engines use -Unicode code points. This means that hyphenation will be incorrect -with Unicode engines unless a Unicode font is loaded. This requires -a concept of a Unicode font encoding, which is currently provided by -the \package{fontspec} package in two versions, \texttt{EU1} and -\texttt{EU2}. The team is working to fully understand what is meant -by a ``Unicode font encoding'', as unlike a classical \TeX{} encoding -it is essentially impossible to know what glyphs will be provided -(though each slot is always defined with the same meaning). There -is also an overlap between this area and ideas of language and writing -system, most obviously in documents featuring mixed scripts (for example -Latin and Cyrillic). - -As well as these font considerations, the team is also exploring -to what extent it is possible to allow existing ($8$-bit) -documents to compile directly with Unicode engines without requiring -changes in the sources. Whether this is truly possible remains an open -question. - -It is important to stress that changes will only be made in this area where -they do \emph{not} affect documents processed with -\hologo{eTeX}/\hologo{pdfTeX} (i.e.~documents which are written for -``classical'' $8$-bit \TeX{} engines). Changes will also be made only where -they clearly address deficiencies in the current setup for Unicode engines -(i.e.~where current behaviors are wrong). - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews25.tex b/Master/texmf-dist/source/latex-dev/base/ltnews25.tex deleted file mode 100644 index e32187e702f..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews25.tex +++ /dev/null @@ -1,137 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2016 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews25.tex -% -% This is issue 25 of LaTeX News. - -\documentclass{ltnews} -\usepackage[T1]{fontenc} - -\usepackage{lmodern,url,hologo} - - -\publicationmonth{March} -\publicationyear{2016} - -\publicationissue{25} - -\begin{document} - -\maketitle - -\section{Lua\TeX} -This \LaTeX\ release sees several internal changes designed to ensure -that the system is still usable with Lua\TeX\ versions greater than -0.80, which have introduced many changes into the engine, most notably -the removal or renaming of most of the primitive commands introduced by -pdf\TeX. Also the lists of Lua callbacks handled by the callback -allocation mechanism has been updated to match the callbacks defined -in Lua\TeX\ version 0.90. - -These changes have also required updates in \textsf{tools} -and \textsf{amsmath} as described below. - -This is the first release of \LaTeX\ for which the test suite reports -no failures when used with Lua\TeX. - -\section{Documentation checksums} -The \package{doc} package has always provided two mechanisms that were -mainly intended to guard against file truncation or corruption when -files were commonly distributed by email through unreliable mail -gateways: a Character Table of the ASCII character set could be -inserted (and checked) and a ``checksum'' (count of the number of -backslashes in the code sections) could be checked. These features -are not really needed with modern distribution mechanisms and can be a -distraction when reading the source code and so have been removed. The -\package{doc} package has been updated so that if you use a -\verb|\CheckSum| command then, as before, the number is checked; -however, if you omit the command then no error or warning is given. - - -\section{Updates to \package{inputenc}} - -The UTF-8 support in \package{inputenc} has been further extended with -support for non-breaking hyphens and more dashes. - -\section{Updates in Tools} - -The \package{varioref} package has been updated with improved -documentation of multi\-lingual support, and avoiding unnecessary warnings in -some cases with \verb|\reftextfaraway|. - -The \package{tabularx} package's handling of \verb|\endtabularx| in -environment definitions has been fixed to again match its documentation. - -The \package{bm} package has been updated as required by the changes -to \verb|\mathchardef| in Lua\TeX. - - -\section{amsmath} - -Since the launch of \LaTeXe\ in 1993, the \textsf{amsmath} bundle has -been part of the \emph{required} packages in the core \LaTeX\ -distribution, with bug reports handled by the \LaTeX\ bug database at -\url{https://latex-project.org/bugs-upload.html}. - -The \textsf{amsmath} packages and the \textsf{amscls} classes have -been maintained by the American Mathematical Society. - -With this release a new arrangement has been agreed between the -American Mathematical Society and the \LaTeX3 project. The \LaTeX3 -project will take over maintenance of the \textsf{amsmath} bundle, -with the American Mathematical Society retaining maintenance of -\textsf{amscls}. - -The recommended installation of these files in the \TeX\ directory -structure remains unchanged as \path|tex/latex/amsmath| and -\path|tex/latex/amscls| respectively. - -This release of \package{amsmath} includes several updates so that -\package{amsmath} does not generate errors when math is used with -Lua\TeX\ v0.87+, which has changes to \verb|\mathchardef| that are -incompatible with the previous version of \package{amsmath}. It also -improves \verb|\dots| handling so that \verb|\long| macros are -correctly handled (for example, \verb|\dots \Rightarrow| now -uses centered dots), as well as commands expanding to character tokens -(for example, \verb|\times \dots \times| will use centered dots with -\verb|\times| defined as in the \package{unicode-math} package). - -\section{Related updates} -In addition to the updates in the core \LaTeX\ release, some files in -the CTAN ``contrib'' area have also been updated. Notably there have -been further updates to the \textsf{unicode-data} files; also, the -files required to build plain and \LaTeX\ formats have now been -submitted to CTAN as \textsf{tex-ini-files}. The -addition of a new \texttt{luatex} option for \textsf{graphics}-related -packages (\textsf{luatex-def} on CTAN) has required updates to the -configuration files to select a -default option and these have similarly been uploaded to CTAN as -\textsf{graphics-cfg}. (Previously these files were maintained -directly in the \TeX\ Live repository, and were not available on CTAN.) -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews26.tex b/Master/texmf-dist/source/latex-dev/base/ltnews26.tex deleted file mode 100644 index 3dc40ffb73e..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews26.tex +++ /dev/null @@ -1,239 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2017 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews26.tex -% -% This is issue 26 of LaTeX News. - -\documentclass{ltnews} -\usepackage[T1]{fontenc} - -\usepackage{lmodern,url,hologo} - -\publicationmonth{January} -\publicationyear{2017} - -\publicationissue{26} - -\begin{document} - -\maketitle -\tableofcontents - -\setlength\rightskip{0pt plus 3em} -\section{\eTeX{}} - -In \LaTeX{} News~16 (December 2003) the team announced -\begin{quotation} -We expect that within the next two years, releases of \LaTeX{} will -change modestly in order to run best under an extended \TeX{} engine -that contains the \eTeX{} primitives, e.g., \eTeX{} or pdf\TeX{}. -\end{quotation} -and also said -\begin{quotation} -Although the current release does not \emph{require} \eTeX{} features, we -certainly recommend using an extended \TeX{}, especially if you need to debug -macros. -\end{quotation} - -For many years the team have worked on the basis that users will have \eTeX{} -available but had not revisited the above statements formally. As of the -January 2017 release of \LaTeXe{}, \eTeX{} is \emph{required} to build the -format, and attempting to build a format without the extensions will fail. - -Practically, modern \TeX{} distributions provide the extensions in all engines -other than the ``pure'' Knuth \texttt{tex}, and indeed parts of the -format-building process already require \eTeX{}, most notably some of the UTF-8 -hyphenation patterns. As such, there should be no noticeable effect on users of -this change. - -The team expect to make wider use of \eTeX{} within the kernel in future; -details will be announced where they impact on end users in a visible way. - -\section{Default encodings in \hologo{XeLaTeX} and \hologo{LuaLaTeX}} -The default encoding in \LaTeX\ has always been the original -128-character encoding \texttt{OT1}. For Unicode based \TeX\ engines, this -is not really suitable, and is especially problematic with -\hologo{XeLaTeX} as in the major distributions this is built with -Unicode based hyphenation patterns in the format. In practice this has -not been a major problem as documents use the contributed -\textsf{fontspec} package in order to switch to a -Unicode encoded font. - -In this release we are adding \texttt{TU} as a new supported -encoding in addition to the previously supported encodings such as \texttt{OT1} -and \texttt{T1}. This denotes a Unicode based font encoding. It is essentially -the same as the \texttt{TU} encoding that has been on trial with the -experimental \texttt{tuenc} option to \textsf{fontspec} for the past -year. - -The \hologo{XeLaTeX} and \hologo{LuaLaTeX} formats will now default -to \texttt{TU} encoding and \texttt{lmr} (Latin Modern) family. In the -case of \hologo{LuaLaTeX} the contributed \textsf{luaotfload} Lua -module will be loaded at the start of each run to enable the loading -of OpenType fonts. - -The \textsf{fontspec} package is being adjusted in a companion release -to recognise the new encoding default arrangements. - -Note that in practice no font supports the full Unicode range, and so -\texttt{TU} encoded fonts, unlike fonts specified for \texttt{T1}, may be -expected to be incomplete in various ways. In the current release the file -\texttt{tuenc.def} that implements the \texttt{TU} encoding-specific commands -has made some basic assumptions for (for example) default handling of -accent commands, and the set of command names is derived from the -command names used for the UTF-8 support in the \textsf{inputenc} package, -restricted roughly to the character ranges classically provided by -the \texttt{T1} and \texttt{TS1} encodings, but is part of a longer term plan -seen over recent releases to increase support for Unicode based \TeX\ engines -into the core \LaTeX\ support. - - - -If for any reason you need to process a document with the previous -default \texttt{OT1} encoding, you may switch encoding in the usual ways, for -example -\begin{verbatim} -\usepackage[OT1]{fontenc} -\end{verbatim} -or you may roll back all the changes for this release by starting the -document with -\begin{verbatim} -\RequirePackage[2016/12/31]{latexrelease} -\end{verbatim} - -\section{\cs{showhyphens} in \hologo{XeLaTeX}} -Due to the way \hologo{XeLaTeX} interfaces to font libraries, the -standard definition of \cs{showhyphens} does not work. A variant -definition has been available in the contributed \textsf{xltxtra} -package, however a (slightly different) definition for \cs{showhyphens} -is now included in \hologo{XeLaTeX} by default. As usual -this change will be undone if an earlier -release is specified using the \textsf{latexrelease} package. - -\section{The \textsf{fixltx2e} package} -As described in \LaTeX{} News~22, the \textsf{fixltx2e} package has become -obsolete with the new update policy. Since 2015 it has just made a -warning and exited. In this release we have re-introduced all -the code from the original fixes in the 2014 \LaTeX\ but guarded by -\verb|\IncludeInRelease{2015/01/01}|. -So for current releases \textsf{fixltx2e} still just displays a warning -but for old releases, whether that is an old format, or a format with -the version date reset via the \textsf{latexrelease} package, the -fixes in the original \textsf{fixltx2e} will be applied. - -This improves the ability to run old documents in a way that is compatible -with contemporary formats. If you have a 2014 document that used -\verb|\usepackage{fixltx2e}| and you add -\verb|\RequirePackage[2014/01/01]{latexrelease}| and process it with the -current format then \textsf{latexrelease} will undo most changes made -since 2014, but now when the document includes \textsf{fixltx2e} it -will act like a 2014 version of the package and apply the code fixes, -not just give a warning that the package is obsolete. - -\section{The \textsf{latexbug} package} - -As explained in more detail -at the \LaTeX\ Project - website\footnote{\url{https://www.latex-project.org/bugs/}} -a new package, \textsf{latexbug}, has been produced to help produce -test files to accompany bug reports on the core \LaTeX\ distribution. -This is being published separately to CTAN at the same time as this -release. By using the \textsf{latexbug} package you can easily check -that the packages involved in the test are all part of the core -release. The \LaTeX\ project cannot handle bug reports on contributed -packages, which should be directed to the package maintainer as given -in the package documentation. - -\section{Updates to \textsf{amsmath}} -The \textsf{amsmath} package has two updates at this release. -\begin{itemize} -\item The spacing to the left of the \texttt{aligned} and - \texttt{gathered} environments has been fixed: the spurious thin - space is no longer added by default. Package options control this - to revert to the original behaviour where required; see the - \textsf{amsldoc} guide for further details. -\item The large delimiters around generalised fractions (for example - in the \cs{binom} construct) did not work in previous releases if - using \hologo{LuaTeX} or \hologo{XeTeX} with OpenType math fonts. This is - related to the lack of specific metrics for this use in the OpenType Math - table. In principle \hologo{LuaTeX} has two additional named metrics - to control the delimiters but these are not initialised by default, - and in \hologo{XeTeX} it does not seem possible to make them work at all. - So for Unicode \TeX\ systems, a new implementation of - \cs{genfrac} is used at this release that uses \verb|\left\right| - internally but parameterised to give spacing as close to the - original as possible. The implementation in (pdf)\TeX\ is - unaffected. -\end{itemize} - -\section{Updates to \textsf{tools}} -The \textsf{array} package has been updated to fix a longstanding but -previously unreported issue with unwanted interactions between tables -in the page head or foot and the body of the page, as reported in -\href{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=tools/4488}{PR - tools/4488}. -There is also an update to the \hologo{LuaTeX} support in \textsf{bm}. - -\section{An addendum to the release changes in 2015: page breaks and vertical spacing} - -In 2015 we announced the introduction of the roll-back\slash -roll-forward concept to manage bug fixes and additions to core -\LaTeX{} in a manageable way. We also announced at that time -that we now incorporate all fixes from \textsf{fixltx2e} into the -kernel (as the old mechanism produced problems instead of improving -the situation). Refer to -\href{https://www.latex-project.org/news/latex2e-news/ltnews22.pdf}{\texttt{ltnews22.pdf}} -for details. - -One of the fixes from \textsf{fixltx2e} was for a glaring bug in -\cs{addvspace} that was originally detected in the mid-nineties and -back then added to the \textsf{fixltx2e} support package. In certain -situations \cs{addvspace} would result in a page/column break below -the baseline of the last line. As a result documents using -\cs{flushbottom} would show a clear misalignment (even more prominent -when typesetting in two-column mode). - -Starting with release 2015/01/01 this is now finally corrected already -in the kernel and not only in \textsf{fixltx2e}. In nearly all -circumstances this will either make no difference to existing -documents, or it will locally improve the visual appearance of that -document without changing anything on other pages. However, by the -nature of the change it is also possible that there are further -non-local changes to the page breaks due to the different break -positions introduced by the fix. - -Thus, for documents that have been written before 2015 and that should -be preserved unchanged at all costs you may have to add -\begin{verbatim} -\RequirePackage[2014/01/01]{latexrelease} -\end{verbatim} -at the top of the document, to roll back the format to a date before -the policy change. - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews27.tex b/Master/texmf-dist/source/latex-dev/base/ltnews27.tex deleted file mode 100644 index 93281c19126..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews27.tex +++ /dev/null @@ -1,135 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2017 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews27.tex -% -% This is issue 27 of LaTeX News. - -\documentclass{ltnews} -\usepackage[T1]{fontenc} - -\usepackage{lmodern,url,hologo} - -\publicationmonth{April} -\publicationyear{2017} - -\publicationissue{27} - -\begin{document} - -\maketitle -\tableofcontents - -\setlength\rightskip{0pt plus 3em} - -\section{ISO 8601 Date format} -Since before the first releases of \LaTeXe, \LaTeX\ has used a date -format in the form \textsc{yyyy/mm/dd}. This has many advantages over more -conventional formats, as it is easy to sort and avoids the unfortunate -ambiguity between different communities as to whether 01/02/2017 is the -1st of February or 2nd of January. - -However there is another date format, formalised by the -International Standard ISO~8601. The basic format defined by this -standard is functionally equivalent to the \LaTeX\ format, but using -\texttt{-} rather than \texttt{/}. This date format is now supported -in many Operating Systems and applications -(for example the \verb|date --iso-8601| command in Linux and similar systems). - -From this release, \LaTeX\ will accept ISO format date strings in the -date argument of \verb|\ProvidesPackage|, \verb|\usepackage|, etc. -Currently we recommend that you do not use this format in any packages -that need to work with older \LaTeX\ releases; -the \textsf{latexrelease} package may be used with older releases to - add this functionality. This change is handled in a special way by - \textsf{latexrelease}: The package always adds support for ISO dates -whatever format date is requested; this is required so that the -necessary date comparisons may be made. - -The new functionality can be seen in the startup banner which -advertises \texttt{LaTeX2e <2017-04-15>}. - -\section{Further TU encoding improvements} -The 2017/01/01 release saw the introduction of the new TU encoding for -specifying Unicode fonts with \hologo{LuaTeX} and -\hologo{XeTeX}. There were a number of small corrections and additions -in the patch releases updating 2017/01/01, and a further addition in -this release, notably extended support for the dot-under accent, -\verb|\d|. - - -\section{Disabling hyphenation} -The existing \LaTeX\ code for \verb|\verb| and \verb|verbatim| had some -issues when used with fonts that were not loaded with hyphenation -disabled via setting \verb|\hyphenchar| to $-1$. In this release these -verbatim environments use a \verb|\language| setting, -\verb|\l@nohyphenation|, that has no hyphenation patterns associated. - -The format ensures that a language has been allocated with this name. -For most users this will in fact be no change as the standard -\textsf{babel} language has for a long time allocated a language with -this name. - -In order that page breaks in \texttt{verbatim} do not influence the -language used in the page head and foot, the format now normalises the -language used in the output routine to a default language as described -below. - -\section{Discretionary hyphenation} -The \LaTeX\ definition of \verb|\-| has been adjusted so that it will -insert the current font's \verb|\hyphenchar|, as would the -\TeX\ primitive. A comment in \textsf{source2e} has given -this new definition since the first releases of \LaTeXe, and in this -release we finally acted upon this comment. Previously \verb|\-| -always inserted a \texttt{-} at a break point even if a different -character would be used for automatic hyphenation with the current font. - -\section{Default document language} - -A new integer parameter \verb|\document@default@language| is -introduced; this is initialised to $-1$ but is set at -\verb|\begin{document}| to the language in force at that time if it - has not been set by preamble code. This is very similar to the - handling of the default color, and is used in a similar way to - normalise the settings for page head and foot as described above. -Users should not normally need to set this explicitly but it is expected that -language packages such as \textsf{babel} may set this if the default -behaviour is not suitable. - -\section{Line spacing in parboxes} -Inside a \verb|\parbox| -\LaTeX\ normalises the baseline spacing. However it has not -previously reset \verb|\lineskiplimit|. This meant that -lines of a paragraph that have ascenders or descenders could be set -with \emph{closer} line spacing than lines without. This can easily -happen if you use a \verb|\parbox| in an AMS alignment, as they use a -relatively large value of \verb|\lineskiplimit|. -As usual, the \textsf{latexrelease} package may be used to -force the older behavior. - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews28.tex b/Master/texmf-dist/source/latex-dev/base/ltnews28.tex deleted file mode 100644 index 92c087e6b02..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews28.tex +++ /dev/null @@ -1,365 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2017-2018 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews28.tex -% -% This is issue 28 of LaTeX News. - -\documentclass{ltnews} -\usepackage[T1]{fontenc} - -\usepackage{lmodern,url,hologo} - -\providecommand\acro[1]{\textsc{#1}} -\providecommand\meta[1]{$\langle$\textit{#1}$\rangle$} - - -\publicationmonth{April} -\publicationyear{2018} - -\publicationissue{28} - -\begin{document} - -\maketitle -\tableofcontents - -\setlength\rightskip{0pt plus 3em} - -\section{A new home for \LaTeXe{} sources} - -In the past the development version of the \LaTeXe{} source files has -been managed in a Subversion source control system with read access -for the public. This way it was possible to download in an emergency -the latest version even before it was released to CTAN and made its -way into the various distributions. - -We have recently changed this setup and now manage the sources using -Git and placed the master sources on GitHub at -\begin{quote} -\url{https://github.com/latex3/latex2e} -\end{quote} -where we already store the sources -for \pkg{expl3} and other work. As before, direct write access is restricted -to \LaTeX{} Project Team members, but everything is publicly accessible -including the ability to download, clone (using Git) or checkout -(using SVN). More details are given in~\cite{Mittelbach:TB39-1}. - -\section{Bug reports for core \LaTeXe{}} - -For more than two decades we used GNATS, an open source bug tracking -system developed by the FSF. While that has served us well in the past -it started to show its age more and more. So as part of this move we -also decided to finally retire the old \LaTeX{} bug database and replace -it with the standard ``Issue Tracker'' available at Github. - -The requirements and the workflow for reporting a bug in the core -\LaTeX{} software is documented at -\begin{quote} -\url{https://www.latex-project.org/bugs/} -\end{quote} -and with further details also discussed in~\cite{Mittelbach:TB39-1}. - - -\section{UTF-8: the new default input encoding} - -The first \TeX{} implementations only supported reading 7-bit -\acro{ascii} files---any accented or otherwise ``special'' character -had to be entered using commands, if it could be represented at -all. For example to obtain an ``\"a'' one would enter \verb=\"a=, and to -typeset a ``\ss'' the command \verb=\ss=. Furthermore fonts at that -time had 128 glyphs inside, holding the \acro{ascii} characters, some -accents to build composite glyphs from a letter and an accent, and a -few special symbols such as parentheses, etc. - -With 8-bit \TeX{} engines such as \hologo{pdfTeX} this situation changed -somewhat: it was now possible to process 8-bit files, i.e., files that -could encode 256 different characters. However, 256 is still a fairly -small number and with this limitation it is only possible to encode a -few languages and for other languages one would need to change the -encoding (i.e., interpret the character positions 0--255 in a -different way). The first code points 0--127 were essentially normed -(corresponding to \acro{ascii}) while the second half 128--255 would -vary by holding different accented characters to support a certain set -of languages. - -Each computer used one of these encodings when storing or interpreting -files and as long as two computers used the same encoding it was -(easily) possible to exchange files between them and have them -interpreted and processed correctly. - -But different computers may have used different encodings and given -that a computer file is simply a sequence of bytes with no indication for -which encoding is intended, chaos could easily happen and has -happened. For example, the German word ``Gr\"o\ss e'' (height) entered on a -German keyboard could show up as ``Gr\v T\`ae'' on a different -computer using a different encoding by default. - -So in summmary the situation wasn't at all good and it was clear in -the early nineties that \LaTeXe{} (that was being developed to provide -a \LaTeX{} version usable across the world) had to provide a solution -to this issue. - -The \LaTeXe{} answer was the introduction of the \package{inputenc} -package~\cite{Mittelbach:Brno95} through which it is possible to -provide support for multiple encodings. It also allows to correctly -process a file written in one encoding on a computer using a different -encoding and even supports documents where the encoding changes -midway. - -Since the first release of \LaTeXe{} in 1994, \LaTeX{} documents that -used any characters outside \acro{ascii} in the source (i.e. any -characters in the range of 128--255) were supposed to load -\package{inputenc} and specify in which file encoding they were -written and stored. -% -If the \package{inputenc} package was not loaded then \LaTeX{} used a -``raw'' encoding which essentially took each byte from the input file -and typeset the glyph that happened to be in that position in the -current font---something that sometimes produces the right result but -often enough will not. - -In 1992 Ken Thompson and Rob Pike developed the UTF-8 encoding scheme -which enables the encoding of all Unicode characters within 8-bit sequences. -Over time this encoding has gradually taken over the world, -replacing the legacy 8-bit encodings used before. These days all major -computer operating systems use UTF-8 to store their files and it -requires some effort to explicitly store files in one of the legacy -encodings. - -As a result, whenever \LaTeX{} users want to use any accented -characters from their keyboard (instead of resorting to \verb=\"a= and -the like) they always have to use -\begin{verbatim} - \usepackage[utf8]{inputenc} -\end{verbatim} -in the preamble of their documents as otherwise \LaTeX{} will produce -gibberish. - -\subsection{The new default} - -With this release, the default encoding for \LaTeX\ files has been -changed from the ``fall through raw'' encoding to UTF-8 if used with -classic \TeX\ or \hologo{pdfTeX}. The implementation is essentially -the same as the existing UTF-8 support from -\verb|\usepackage[utf8]{inputenc}|. - -The \hologo{LuaTeX} and \hologo{XeTeX} engines always supported the -UTF-8 encoding as their native (and only) input encoding, so with -these engines \package{inputenc} was always a no-op. - -This means that with new documents one can assume UTF-8 input and it -is no longer required to always specify -\verb|\usepackage[utf8]{inputenc}|. But if this line is present it -will not hurt either. - - -\subsection{Compatibility} - -For most existing documents this change will be transparent: -\begin{itemize} -\item documents using only \acro{ascii} in the input file and - accessing accented characters via commands; -\item documents that specified the encoding of their file via an - option to the \package{inputenc} package and then used 8-bit - characters in that encoding; -\item documents that already had been stored in UTF-8 (whether or not - specifying this via \package{inputenc}). -\end{itemize} -Only documents that have been stored in a legacy encoding and used -accented letters from the keyboard \emph{without} loading -\package{inputenc} (relying on the similarities between the input used -and the T1 font encoding) are affected. - -These documents will now generate an error that they contain invalid -UTF-8 sequences. However, such documents may be easily processed by -adding the new command \verb|\UseRawInputEncoding| as the first line -of the file. This will re-instate the previous ``raw'' encoding -default. - -\verb|\UseRawInputEncoding| may also be used on the command line to -process existing files without requiring the file to be edited -\begin{verbatim} - pdflatex '\UseRawInputEncoding \input' file -\end{verbatim} -will process the file using the previous default encoding. - -Possible alternatives are reencoding the file to UTF-8 using a tool -(such as recode or iconv or an editor) or adding the line -\begin{flushleft} -\verb= \usepackage[=\meta{encoding}\verb=]{inputenc}= -\end{flushleft} -to the preamble specifying the \meta{encoding} that fits the file -encoding. In many cases this will be \texttt{latin1} or -\texttt{cp1252}. For other encoding names and their meaning see the -\package{inputenc} documentation. - -As usual, this change may also be reverted via the more general -\package{latexrelease} package mechanism, by speciying a release date -earlier than this release. - - -\subsection{BOM: byte order mark handling} - -When using Unicode the first bytes of a file may be a, so called, BOM -character (byte order mark) to indicate the byte oder used in the -file. While this is not required with UTF-8 encoded files (where the -byte order is known) it is nevertheless allowed by the standard and -some editors add that byte sequence to the beginning of a file. In the -past such files would have generated a ``Missing begin document'' -error or displayed strange characters when loaded at a later stage. - -With the addition of UTF-8 support to the kernel it is now possible to -identify and ignore such BOMs characters even before -\verb=\documentclass= so that these issues will no longer be showing -up. - - - -\section[A general rollback concept] - {A general rollback concept for packages and classes} - - In 2015 a rollback concept for the \LaTeX{} kernel was introduced. - Providing this feature allowed us to make corrections to the - software (which more or less didn't happen for nearly two decades) - while continuing to maintain backward compatibility to the highest - degree. - - In this release we have now extended this concept to - the world of packages and classes which was not covered - initially. As the classes and the extension packages have different - requirements compared to the kernel, the approach is different (and - simplified). This should make it easy for package developers to - apply it to their packages and authors to use when necessary. - - The documentation of this new feature is given in an article - submitted to TUGboat and also available from our - website~\cite{Mittelbach:TB39-2}. - - -\section[Integration of \pkg{remreset} and \pkg{chngcntr} packages] - {Integration of \pkg{remreset} and \pkg{chngcntr} packages - into the kernel} - -With the optional argument to \cs{newcounter} \LaTeX{} offers to -automatically reset counters when some counter is stepped, e.g., -stepping a \texttt{chapter} counter resets the \texttt{section} -counter (and recursively all other heading counters). However, what -was until now missing was a way to undo such a link between counters -or to link two counters after they have been defined. - -This can be now be done with \cs{counterwithin} and \cs{counterwithout}, -respectively. In the past one had to load the \pkg{chngcntr} package -for this. For the programming level we also added -\cs{@removefromreset} as the counterpart of the already existing -\cs{@addtoreset} command. Up to now this was offered by the -\pkg{remreset} package. - -\section{Testing for undefined commands} -\LaTeX\ packages often use a test \verb|\@ifundefined| to test if a command -is defined. Unfortunately this had the side effect of \emph{defining} -the command to \verb|\relax| in the case that it had no definition. - The new release uses a modified definition -(using extra testing possibilities available in \hologo{eTeX}. The new definition -is more natural, however code that was relying on the side effect of the -command being tested being defined if it was previously undefined may have to add -\verb|\let\|\meta{command}\verb|\relax|. - - -\section{Changes to packages in the tools category} - -\subsection{\LaTeX{} table columns with fixed widths} - -Frank published a short paper in -TUGboat~\cite{Mittelbach:TB38-2-213} on producing tables that have -columns with fixed widths. The outlined approach using column -specifiers ``\texttt{w}'' and ``\texttt{W}'' has now been integrated -into the \pkg{array} package. - -\subsection{Obscure overprinting with \pkg{multicol} fixed} - -A rather peculiar bug was reported on StackExchange for -\pkg{multicol}. If the column/page breaking was fully controlled by -the user (through \cs{columnbreak}) instead of letting the environment -do its job and if then more \cs{columnbreak} commands showed up on the -last page then the balancing algorithm was thrown off track. -As a result some parts of the columns did overprint each other. - -The fix required a redesign of the output routines used by -\pkg{multicol} and while it ``should'' be transparent in other cases -(and all tests in the regession test suite came out fine) there is the -off-chance that code that hooked into internals of \pkg{multicol} -needs adjustment. - - -\section{Changes to packages in the amsmath category} - -With this release of \LaTeX{} a few minor issues with \pkg{amsmath} -have been corrected. - -\subsection{Updated user's guide} - -Furthermore, \texttt{amsldoc.pdf}, the AMS user's -guide for the \pkg{amsmath} package~\cite{amsldoc}, has been updated -from version~2.0 to~2.1 to incorporate changes and corrections made -between 2016 and 2018. - - -\begin{thebibliography}{9} - -\bibitem{Mittelbach:TB39-1} Frank Mittelbach: - \emph{New rules for reporting bugs in the \LaTeX{} core software}. - In: TUGboat, 39\#1, 2018. - \url{https://www.latex-project.org/publications/} - -\bibitem{Mittelbach:Brno95} Frank Mittelbach: - \emph{\LaTeXe{} Encoding Interface --- Purpose, concepts, and - Open Problems}. - Talk given in Brno June 1995. - \url{https://www.latex-project.org/publications/} - -\bibitem{Mittelbach:TB39-2} Frank Mittelbach: - \emph{A rollback concept for packages and classes}. - Submitted to TUGboat. - \url{https://www.latex-project.org/publications/} - -\bibitem{Mittelbach:TB38-2-213} Frank Mittelbach: - \emph{\LaTeX{} table columns with fixed widths}. - In: TUGboat, 38\#2, 2017. - \url{https://www.latex-project.org/publications/} - -\bibitem{amsldoc} American Mathematical Society and The \LaTeX3 Project: - \emph{User's Guide for the \texttt{amsmath} package} (Version 2.1). - April 2018. - Available from - \url{https://www.ctan.org} - and distributed as part of every \LaTeX{} distribution. - -\end{thebibliography} - -\end{document} diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews29.tex b/Master/texmf-dist/source/latex-dev/base/ltnews29.tex deleted file mode 100644 index 1cc856aaed5..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews29.tex +++ /dev/null @@ -1,526 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2018 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews29.tex -% -% This is issue 29 of LaTeX News. - -\documentclass{ltnews} -\usepackage[T1]{fontenc} - -\usepackage{lmodern,url,hologo} - -\usepackage{csquotes} - -\providecommand\acro[1]{\textsc{#1}} -\providecommand\meta[1]{$\langle$\textit{#1}$\rangle$} - - -\providecommand\XeTeX{\hologo{XeTeX}} -\providecommand\LuaTeX{\hologo{LuaTeX}} -\providecommand\pdfTeX{\hologo{pdfTeX}} - -\newcommand\githubissue[2][]{\ifhmode\unskip\fi - \quad\penalty500\strut\nobreak\hfill - \mbox{\small\slshape(% - \href{https://github.com/latex3/latex2e/issues/\getfirstgithubissue#2 \relax}% - {github issue#1 #2}% - )}% - \par} - -% simple solution right now (just link to the first issue if there are more) -\def\getfirstgithubissue#1 #2\relax{#1} - -\newcommand\sxissue[1]{\ifhmode\unskip\fi - \quad\penalty500\strut\nobreak\hfill - \mbox{\small\slshape(\url{https://tex.stackexchange.com/#1})}\par} - -\let\cls\pkg -\newcommand\env[1]{\texttt{#1}} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\iffalse % only for TUB production -\usepackage{graphicx} -\makeatletter -% Xe\TeX{} requires reflecting the first E, hence we complain if the -% graphics package is not present. (For plain documents, this can be -% loaded via Eplain.) Also, at Barbara's suggestion, if the current -% font is slanted, we rotate by 180 instead of reflecting so there is at -% least a chance to look ok. (The magic values here seem more or less -% ok for \texttt{cmsl} and \texttt{cmti}.) -% -% \begin{macrocode} -\def\tubreflect#1{% - \@ifundefined{reflectbox}{% - \TBerror{A graphics package must be loaded for \string\XeTeX}% - }{% - \ifdim \fontdimen1\font>0pt - \raise 1.6ex \hbox{\kern.1em\rotatebox{180}{#1}}\kern-.1em - \else - \reflectbox{#1}% - \fi - }% -} -\def\tubhideheight#1{\setbox0=\hbox{#1}\ht0=0pt \dp0=0pt \box0 } -\def\XekernbeforeE{-.125em} -\def\XekernafterE{-.1667em} -\DeclareRobustCommand{\Xe}{\leavevmode - \tubhideheight{\hbox{X% - \setbox0=\hbox{\TeX}\setbox1=\hbox{E}% - \ifdim \fontdimen1\font>0pt \def\XekernbeforeE{0em}\fi - \lower\dp0\hbox{\raise\dp1\hbox{\kern\XekernbeforeE\tubreflect{E}}}% - \kern\XekernafterE}}} -\def\XeTeX{\Xe\TeX} -\def\XeLaTeX{\Xe{\kern.11em \LaTeX}} -\fi -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\publicationmonth{December} -\publicationyear{2018} - -\publicationissue{29} - -\begin{document} - -%\addtolength\textheight{4.2pc} % only for TUB - -\maketitle -\tableofcontents - -\setlength\rightskip{0pt plus 3em} - -\bigskip - -\section{Introduction} - -The December 2018 release of \LaTeX{} is a maintenance release in -which we have fixed a few bugs in the software: some are old, some -newer, and they are mostly rather obscure. - -\section[Bug reports for core \LaTeXe{} and packages] - {Bug reports for core \LaTeXe{} and packages maintained by the Project Team} - -In Spring 2018 we established a new issue tracking system -(Github issues at \url{https://github.com/latex3/latex2e/issues}) for both -the \LaTeX{} core and the packages maintained by the -\LaTeX{} Project Team, with an updated procedure for how to report a -bug or problem. - -Initial experience with this system is good, with people who report -problems following the guidelines and including helpful working -examples to show the problem---thanks for doing this. - -The detailed requirements and the workflow for reporting a bug in the -core \LaTeX{} software is documented at -\begin{quote} -\url{https://www.latex-project.org/bugs/} -\end{quote} -with further details and discussion in~\cite{29:Mittelbach:TB39-1}. - - -\section{Changes to the \LaTeX{} kernel} - -\subsection{UTF-8:\ updates to the default input encoding} - -In the April 2018 release of \LaTeX{} we changed the default encoding -from 7-bit \acro{ascii} to \acro{utf}-8 when using classic \TeX\ or -\hologo{pdfTeX}; see \textit{\LaTeX{} News~28}~\cite{29:ltnews28} for -details. - -Now, after half a year of experience with -this new default, -we have -made a small number of adjustments to further improve the user experience. -These include: -\begin{itemize} -\item - Some improvements when displaying error messages about \acro{utf}-8 - characters that have not been set up for use with \LaTeX{}, - or are invalid for some other reason; -% -\githubissue[s]{60, 62 and 63} -% -\item - The addition of a number of previously missing declarations for - characters that are in fact available with the default fonts, e.g., - \cs{j} \enquote{\j} (0237), \cs{SS} \enquote{\SS} (1E9E), - \verb=\k{}= \enquote{\k{ }} (02DB) and \verb=\.{}= \enquote{\.{ }} - (02D9); -\item - Correcting the names for \cs{guillemetleft} - \enquote{\guillemotleft} and \cs{guillemetright} - \enquote{\guillemotright} in all encoding files. These correct - names are in addition to the old (but wrong) Adobe names: Adobe - mistakenly called them Guillemot, which is a sea bird. -% - \githubissue{65} -% -\item - Added \cs{Hwithstroke} (\enquote{\Hwithstroke}) and \cs{hwithstroke} - (\enquote{\hwithstroke}) necessary for typesetting Maltese. -% - \sxissue{q/460110} -\end{itemize} - - - -\subsection{Fixed \cs{verb*} and friends in \texorpdfstring{\XeTeX}{XeTeX} and \LuaTeX{}} - - -The original \cs{verb*} and \texttt{verbatim*} in \LaTeX{} were coded -under the assumption that the position of the space character (i.e., -\acro{ascii} 32) in a typewriter font contains a visible space glyph -``\verb*= =''. This is correct for \pdfTeX{} with the most used font -encodings \texttt{OT1} and \texttt{T1}. However, this unfortunately -does not work for Unicode engines using the \texttt{TU} encoding since -the space character slot (\acro{ascii} 32) then usually contains a real -(normal) space, which has the effect that \cs{verb*} produces the same -results as \cs{verb}. - -The \cs{verb*} code now always uses the newly introduced command -\cs{verbvisiblespace} to produce the visible space character and this -command will get appropriate definitions for use with the different -engines. With \pdfTeX{} it will simply use \cs{asciispace}, which is -a posh name for ``select character 32 in the current font'', but with -Unicode engines the default definition is -\begin{verbatim} - \DeclareRobustCommand\verbvisiblespace - {\leavevmode - {\usefont{OT1}{cmtt}{m}{n}\asciispace}} -\end{verbatim} -which uses the visible space from the font Computer Modern Typewriter, -regardless of the currently chosen typewriter font. Internally the -code ensures that the character used has exactly the same width as the -other characters in the current (monospaced) font; thus, for example, -code displays line up properly. - -It is possible to redefine this command to select your own character, -for example -\begin{verbatim} - \DeclareRobustCommand\verbvisiblespace - {\textvisiblespace} -\end{verbatim} -will select the the ``official'' visible space character of the -current font. This may look like the natural default, but it wasn't -chosen as our default because many fonts just don't have that Unicode -character, or they have one with a strange shape. -% -\githubissue[s]{69 and 70} - - -\subsection{Error message corrected} -Trying to redefine an undefined command could in a few cases generate -an error message with a missing space, e.g., -\verb=\renewcommand\1{...}= gave -\begin{verbatim} - LaTeX Error: \1undefined. -\end{verbatim} -This is now fixed. -% -\githubissue{41} - - -\subsection{Fixed fatal link error with \pkg{hyperref}} - -If an \cs{href} link text gets broken across pages, \pdfTeX{} and -\LuaTeX{} will generate a fatal error unless both parts of the link -are internally at the same boxing level. In two-column mode that was -not the case if one of the pages had spanning top floats. This has now -been changed so that the error is avoided. -% -\githubissue{94} - - -\subsection{Avoid page breaks caused by invisible commands} - -Commands like \cs{label} or \cs{index} could generate a potential page -break in places where a page break was otherwise prohibited, e.g., -when used between two consecutive headings. This has now been -corrected. If for some reason you really want a break and you relied -on this faulty behavior, you can always add one using \cs{pagebreak}, -with or without an optional argument. -% -\githubissue{81} - - - -\subsection{Prevent spurious spaces when reading table of contents data} - -When table of contents data is read in from a \texttt{.toc} file, the -new-line character at the end of each line is converted by \TeX{} to a -space. In normal processing this is harmless (as \TeX{} is doing this -input reading whilst in vertical mode and each line in the file -represents a single line (paragraph) in the table of contents. If, -however, this is done in horizontal mode, which is sometimes the case, -then these spaces will appear in the output. If you then omit some of -the input lines (e.g., because you do not display \acro{toc} data below a -certain level), then these spaces accumulate in the typeset output and -you get surprising, and unwanted, gaps inside the text. - -The new code now adds a \texttt{\%} sign at the end of problematic -lines in the \texttt{.toc} file so that \TeX{} will not generate such -spaces that may survive to spoil the printed result. As some third -party packages have augmented or changed the core \LaTeX{} -functionality in that area (for example, by adding additional -arguments to the commands in \acro{toc} files) the code uses a conservative -approach and the \texttt{\%} signs are added only when certain -conditions are met. Therefore some packages might require updates if -they want to benefit from this correction, especially if they -unconditionally overwrite \LaTeX{}'s \cs{addcontentsline} definition. -% -\githubissue{73} - - -\subsection{Prevent protrusion in table of contents lines} - -In \TeX{}'s internal processing model, -paragraph data is one of the -major data structures. As a result, -many things are internally modeled -as paragraphs even if they are not conceptually -``text paragraphs'' in -the traditional sense. -In a few cases this has some surprising effects -that are not always -for the better. One example is -standard \acro{toc} entries, -where you have -heading data followed by some dot leaders and a page -number at the right, produced, for example, from this: -\begin{quote} - \contentsline {subsection}{Error message corrected}{2}{section*.7} -\end{quote} -The space reserved for the page number is of a fixed width, so that -the dots always end in the same place. Well, they did end in the same -place until the advent of protrusion support in the \TeX{} engines. -Now, with the \pkg{microtype} package loaded, it is possible that the -page number will protrude slightly into the margin (even though it’s -typeset inside a box) and as a result this page number box gets -shifted. With enough bad luck this can get you another dot in the -line, sticking out like the proverbial sore thumb, as exhibited in the -question on StackExchange that triggered the correction. - -\LaTeX{} now takes care that there will be no protrusion happening on -such lines, even if it is generally enabled for the whole document. -% -\sxissue{q/172785} - - - -\subsection{Start L-R mode for \cs{thinspace} and friends} - -In \LaTeX{}, commands that are intended only for paragraph (L-R) mode -are generally careful to start paragraph mode if necessary; thus they -can be used at the start of a paragraph without surprising and -unwanted consequences. This important requirement had been overlooked -for a few horizontal spacing commands, such as \cs{thinspace} -(a.k.a.\ ``\cs{,}''), and for some other support commands such as -\cs{smash} or \cs{phantom}. Thus they ended up adding vertical space -when used at the beginning of a paragraph or, in the case of -\cs{smash}, creating a paragraph of their own. This has now been -corrected, and a corresponding update has been made to the -\pkg{amsmath} package, in which these commands are also defined. -% -\githubissue[s]{49 and 50} - - - -\subsection{Guarding \cs{pfill} in \pkg{doc}} - -For presenting index entries pointing to -code fragments and the like, -the \pkg{doc} package has a \cs{pfill} command that -generates within the index a line of dots leading from -the command name to the page or code line numbers. -If necessary it would automatically split the entry -over two lines. That worked well enough for a quarter century, but we -discovered recently that it is broken inside -the \cls{ltugboat} class, -where it sometimes produces -bad spacing within continuation lines. - -The reason turned out to be a redefinition of the \LaTeX{} command -\cs{nobreakspace} (\verb=~=) inside the class \cls{ltugboat}, which -removed any preceding space (and thus unfortunately also removed the -dots on the continuation line). While one can argue that this is a -questionable redefinition (if only done by a single class and not generally), -it has been in the class so long that changing it would -certainly break older documents. So instead we now guard against that -removal of space. -% -\githubissue[s]{25 and 75} - - - - - -\section{Changes to packages in the \pkg{tools} category} - -\subsection{Sometimes the \pkg{trace} package turned off too much} - -The \pkg{trace} package is a useful little tool for tracing macro -execution: it hides certain lengthy and typically uninteresting -expansions resulting from font changes and similar activities. -However, it had the problem that it also reset other tracing settings -such as \cs{showoutput} in such situations, so that you couldn't use -\cs{showoutput} in the preamble to get symbolic output of all the -pages in the document. This has now been corrected. - - - - -\subsection{Update to \pkg{xr}} - -The \pkg{xr} package has been updated so that the code that reads the -\texttt{.aux} file has been made more robust. It now correctly -ignores conditionals (added by \pkg{hyperref} and other packages) -rather than generating low level parsing errors. -\sxissue{a/452321} - - -\subsection{Column data for \env{multicols*} sometimes vanished} - -In certain situations involving \env{multicols*}, when there are more -explicit \cs{columnbreak} requests than there are columns on the -current page, data could vanish due to the removal of an internal -penalty marking the end of the environment. This has been corrected by -explicitly reinserting that penalty if necessary. -% -\githubissue{53} - -\subsection{Extension to \cs{docolaction} in \pkg{multicol}} - -The \cs{docolaction} command can be used to carry out actions -depending on the column you are currently in, i.e., first, any inner -one (if more than two) or last. However, if the action generates text -then there is the question: is this text part of the current column or -the one after? That is, on the next run, do we test before or after it, -to determine in which column we are? - -This is now resolved as follows: if you use \cs{docolaction*} any -generated text by the chosen action is considered to be after the test -point. But if you use the command without the star then all the material -it generates will be placed before the test point to determine the -current column, i.e., the text will become part of the current column -and may affect the test result on the next run. - - - -\subsection{Prevent color leak in \pkg{array}} - -In some cases the color used inside a \env{tabular} cell could ``leak -out'' into the surrounding text. This has been corrected. -% -\githubissue{72} - -\subsection{Support fragile commands in \texttt{array} or \texttt{tabular} column templates} - -The preamble specifiers \texttt{p}, \texttt{m} and \texttt{b} each receives -a user supplied argument: the width of the paragraph column. Normally -that is something harmless, like a length or a simple length -expression. But in more complicated settings involving the \pkg{calc} -package it could break with a low-level error message. This has now -been corrected. -% -\sxissue{q/459285} - - - -\section{Changes to packages in the amsmath category} - -The changes in the kernel made for \cs{thinspace}, \cs{smash}, -etc.\ (see above) have been reflected in the \pkg{amsmath} package -code, so that loading this package doesn't revert them. -% -\githubissue[s]{49 and 50} - - - - - -\section{Website updates} - -\subsection{Publications area reorganized and extended} - -To help readers to find relevant information in more convenient and -easy ways, the area of the website covering publications by the -\LaTeX{} Project Team was reorganized and extended (many more -abstracts added). We now provide the articles, talks and supplementary -data structured both by year and also by major -topics~\cite{29:site-pub}. Feel free to take a look. - -\subsection{Japanese translations of the user's guide} - -Yukitoshi Fujimura has kindly translated -into Japanese two documents that are -distributed with standard \LaTeX{}. -These are: -\begin{itemize} -\item - \LaTeXe{} for authors; -\item - User's Guide for the \pkg{amsmath}~Package~\cite{29:amsldoc}. -\end{itemize} -They can be found on the website documentation page~\cite{29:site-doc}. -You will now also find there a typeset version of the full \LaTeXe{} -source code (with index etc.\@) and a number of other goodies. - - - - -\begin{thebibliography}{9} - -\bibitem{29:Mittelbach:TB39-1} Frank Mittelbach: - \emph{New rules for reporting bugs in the \LaTeX{} core software}. - In: TUGboat, 39\#1, 2018. - \url{https://latex-project.org/publications/} - -\bibitem{29:ltnews28} - \emph{\LaTeX{} News, Issue 28}. - In: TUGboat, 39\#1, 2018.\\ - \rlap{\url{https://latex-project.org/news/latex2e-news/}} - -\bibitem{29:site-doc} - \emph{\LaTeX{} documentation on the \LaTeX{} Project Website}.\\ - \url{https://latex-project.org/documentation/} - -\bibitem{29:site-pub} - \emph{\LaTeX{} Project publications on the \LaTeX{} Project Website}.\\ - \url{https://latex-project.org/publications/} - -\bibitem{29:amsldoc} American Mathematical Society and The \LaTeX3 Project: - \emph{User's Guide for the \texttt{amsmath} Package} (Version 2.1). - April 2018. - Available from - \url{https://www.ctan.org} - and distributed as part of every \LaTeX{} distribution. - -\end{thebibliography} - -\end{document} - diff --git a/Master/texmf-dist/source/latex-dev/base/ltnews30.tex b/Master/texmf-dist/source/latex-dev/base/ltnews30.tex deleted file mode 100644 index 7b4b282cc9e..00000000000 --- a/Master/texmf-dist/source/latex-dev/base/ltnews30.tex +++ /dev/null @@ -1,297 +0,0 @@ -% \iffalse meta-comment -% -% Copyright 2019 -% The LaTeX3 Project and any individual authors listed elsewhere -% in this file. -% -% This file is part of the LaTeX base system. -% ------------------------------------------- -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This file has the LPPL maintenance status "maintained". -% -% The list of all files belonging to the LaTeX base distribution is -% given in the file `manifest.txt'. See also `legal.txt' for additional -% information. -% -% The list of derived (unpacked) files belonging to the distribution -% and covered by LPPL is defined by the unpacking scripts (with -% extension .ins) which are part of the distribution. -% -% \fi -% Filename: ltnews30.tex -% -% This is issue 30 of LaTeX News. - -\documentclass{ltnews} -\usepackage[T1]{fontenc} - -\usepackage{lmodern,url,hologo} - -\usepackage{csquotes} - -\providecommand\acro[1]{\textsc{#1}} -\providecommand\meta[1]{$\langle$\textit{#1}$\rangle$} - - -\providecommand\XeTeX{\hologo{XeTeX}} -\providecommand\LuaTeX{\hologo{LuaTeX}} -\providecommand\pdfTeX{\hologo{pdfTeX}} - -\providecommand\githubissue[2][]{\ifhmode\unskip\fi - \quad\penalty500\strut\nobreak\hfill - \mbox{\small\slshape(% - \href{https://github.com/latex3/latex2e/issues/\getfirstgithubissue#2 \relax}% - {github issue#1 #2}% - )}% - \par} - -% simple solution right now (just link to the first issue if there are more) -\def\getfirstgithubissue#1 #2\relax{#1} - -\providecommand\sxissue[1]{\ifhmode\unskip\fi - \quad\penalty500\strut\nobreak\hfill - \mbox{\small\slshape(\url{https://tex.stackexchange.com/#1})}\par} - -\providecommand\gnatsissue[2]{\ifhmode\unskip\fi - \quad\penalty500\strut\nobreak\hfill - \mbox{\small\slshape(% - \href{https://www.latex-project.org/cgi-bin/ltxbugs2html?pr=#1\%2F#2}% - {gnats issue #1/#2}% - )}% - \par} - -\let\cls\pkg -\providecommand\env[1]{\texttt{#1}} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\iffalse % only for TUB production -\usepackage{graphicx} -\makeatletter -% Xe\TeX{} requires reflecting the first E, hence we complain if the -% graphics package is not present. (For plain documents, this can be -% loaded via Eplain.) Also, at Barbara's suggestion, if the current -% font is slanted, we rotate by 180 instead of reflecting so there is at -% least a chance to look ok. (The magic values here seem more or less -% ok for \texttt{cmsl} and \texttt{cmti}.) -% -% \begin{macrocode} -\def\tubreflect#1{% - \@ifundefined{reflectbox}{% - \TBerror{A graphics package must be loaded for \string\XeTeX}% - }{% - \ifdim \fontdimen1\font>0pt - \raise 1.6ex \hbox{\kern.1em\rotatebox{180}{#1}}\kern-.1em - \else - \reflectbox{#1}% - \fi - }% -} -\def\tubhideheight#1{\setbox0=\hbox{#1}\ht0=0pt \dp0=0pt \box0 } -\def\XekernbeforeE{-.125em} -\def\XekernafterE{-.1667em} -\DeclareRobustCommand{\Xe}{\leavevmode - \tubhideheight{\hbox{X% - \setbox0=\hbox{\TeX}\setbox1=\hbox{E}% - \ifdim \fontdimen1\font>0pt \def\XekernbeforeE{0em}\fi - \lower\dp0\hbox{\raise\dp1\hbox{\kern\XekernbeforeE\tubreflect{E}}}% - \kern\XekernafterE}}} -\def\XeTeX{\Xe\TeX} -\def\XeLaTeX{\Xe{\kern.11em \LaTeX}} -\fi -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\publicationmonth{Pre-release Version --- unfinished} -\publicationyear{2019} - -\publicationissue{30} - -\begin{document} - -%\addtolength\textheight{4.2pc} % only for TUB - -\maketitle -\tableofcontents - -\setlength\rightskip{0pt plus 3em} - -\bigskip - -\section{Introduction} - -This document is under construction \ldots - - -\section{Improving Unicode handling in \pdfTeX{}} - -The perhaps most important improvement in this release is an even -better support for UTF-8 characters when using \pdfTeX{}.\footnote{The - Japanese engines e-p\TeX{} and e-up\TeX{} can't use these features - yet as they don't support the primitive \cs{ifincsname}. Work is - under way to resolve this in the engines.} - -In Unicode engines any Unicode character (that is not acting as a -command, i.e., is \enquote{active}) can be used as part of the -\cs{label}/\cs{ref} mechanism or can be displayed in a message or -written to a file. In 8-bit engines, however, this was severely -restricted, essentially you had to limit yourself to using -\acro{ascii} letters, digits and a few punctuation symbols. With the -new release most of these restrictions have been removed and you now -can write labels such as -\begin{verbatim} - \label{eq:größer} -\end{verbatim} -or use accented characters, etc.\ as part of a \cs{typeout} message. -The only requirement remaining is that only those UTF-8 characters -that are also available for typesetting can be used, i.e., only those -which which adequate font support is loaded. Otherwise you will get an -error message stating that a particular Unicode character is not set -up for use with \LaTeX{}. - -What is not possible with an 8-bit engine such as \pdfTeX{} is to use -characters other than \acro{ascii} letters as part of a command -name. This is due to the fact that all other characters in such -engines are not single character tokens, but in fact consist of a -sequence of bytes and this is not supported in command names. - -\section{Improving file name handling in \pdfTeX{}} - -A related change is that file names used as part of \cs{input}, \cs{includegraphics}, etc.\ can now contain Unicode characters as well as spaces. In this case even characters that can't be typeset because of missing font support can be used. - - - - -\section{Other changes to the \LaTeX{} kernel} - - -\subsection{Guard against \cs{unskip} at the start of a tabular cell} - -If a \env{tabular} or \env{array} cell started with command that -issued an \cs{unskip} as its first action centering the column got -broken because the space on the left got removed. This got corrected -by adding a minuscule additional space after the stretching space that -could be safely removed in such a case without being noticeable. - -This change was also applied in the \pkg{array} package. - -\githubissue{102} - - -\subsection{Fixes to Unicode table data} - -\texttt{U+012F} which is \enquote{i with ogonek} should produce an -\enquote{i} and not a\enquote{dotless i}. This has been corrected. - -\githubissue{122} - -The Unicode slots \texttt{27E8} and \texttt{27E9} have been mapped to -\cs{textlangle} and \cs{textrangle} which is the recommended mapping. - -\githubissue{110} - -When doing cut-and-paste from other documents f-ligatures might show -up as Unicode characters. In the past those got rejected. We now -translate them back to individual characters so that they get -accepted. If supported by the font (which is normally the case) they -are then reconstructed as ligatures and thus come out as -desired. Otherwise they will come out as individual characters which -is fine too. - -\githubissue{154} - - -\subsection{Improve \cs{InputIfFileExists}'s handling of file names} - -In rare circumstances it was possible that \cs{InputIfFileExists} -would work incorrectly, e.g., a construction such as -\begin{verbatim} -\InputIfFileExists{foo}{\input{bar}}{} -\end{verbatim} -Would not load the files \texttt{foo.tex} and \texttt{bar.tex} but -would load \texttt{foo.tex} twice. This has been corrected. - -\githubissue{109} - - -\subsection{Improve wording of a warning message} - -\emph{write} - -\githubissue{107} - - -\subsection{Avoid \cs{DeclareErrorFont} side effects} - -\emph{write} - -\gnatsissue{latex}{4399} - - - -\subsection{\pkg{nfssfont}: Generate a font table as the default action} - -With the small file \texttt{nfssfont.tex} it is possible to produce -font tables and other font tests in the style set up by Don Knuth. As -in nearly all cases producing a font table is the desired action this -action has been made the default so that one can simply hit enter -instead of having to write \verb=\table\bye=. - - - - - - -\section{Changes to packages in the \pkg{tools} category} - -\subsection{\pkg{multicol}: Introduce \texttt{minrows} counter for balancing} - -When there are only a few lines of text on a page at the end of a -\env{multicols} environment balancing them looks rather odd, e.g., if -you then end up with three columns each containing a single line. This -can now be controlled through the counter \texttt{minrows} (default is -1) which requires at least that many lines in the first column during -balancing. Thus, if you set it to \texttt{2} one would get a -distribution of \texttt{2+1+0} lines and if set it to three, the result -would have been \texttt{3+0+0} instead of the default \texttt{1+1+1}. - -What is most appropriate really depends on the circumstances, but this -now gives you the tools to make local or global adjustments. - - - -\section{Changes to packages in the \pkg{amsmath} category} - -\subsection{\pkg{amsmath}: Introduce \texttt{overunderset} command} - -\emph{describe} - - - -\section{Documentation updates} - -\subsection{High-lighting the standard NFSS codes for series} - -\emph{describe} - - -\begin{thebibliography}{9} - -\bibitem{29:site-doc} - \emph{\LaTeX{} documentation on the \LaTeX{} Project Website}.\\ - \url{https://latex-project.org/documentation/} - -\bibitem{29:site-pub} - \emph{\LaTeX{} Project publications on the \LaTeX{} Project Website}.\\ - \url{https://latex-project.org/publications/} - -\end{thebibliography} - -\end{document} - diff --git a/Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx b/Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx index 86135e96c84..b16af5c8c6a 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltoutenc.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -1030,12 +1030,25 @@ % \begin{macrocode} \@onlypreamble\DeclareTextComposite % \end{macrocode} +% % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % +% +% +% +% +% +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\UseTextAccent}{Make commands robust}% +% \end{macrocode} +% % \begin{macro}{\UseTextAccent} % \begin{macro}{\UseTextSymbol} % \changes{v1.7p}{1995/11/17}{Support \cs{@wrong@font@char} latex/1676} @@ -1054,7 +1067,7 @@ % \task{?}{Improve this and document its problems, see pr/3160} % \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)} % \begin{macrocode} -\def\UseTextAccent#1#2#3{% +\DeclareRobustCommand\UseTextAccent[3]{% \hmode@start@before@group {% % \end{macrocode} @@ -1070,7 +1083,7 @@ % % \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)} % \begin{macrocode} -\def\UseTextSymbol#1#2{% +\DeclareRobustCommand\UseTextSymbol[2]{% \hmode@start@before@group {% \def\@wrong@font@char{\MessageBreak @@ -1082,6 +1095,20 @@ % \end{macrocode} % % \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\UseTextAccent}{Make commands robust}% +%<latexrelease> +%<latexrelease>\kernel@make@fragile\UseTextAccent +%<latexrelease>\kernel@make@fragile\UseTextSymbol +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% +% \begin{macrocode} \def\@use@text@encoding#1{% \edef\f@encoding{#1}% \xdef\font@name{% diff --git a/Master/texmf-dist/source/latex-dev/base/ltoutenc.ins b/Master/texmf-dist/source/latex-dev/base/ltoutenc.ins index 62e35e77073..e3f436fbc15 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltoutenc.ins +++ b/Master/texmf-dist/source/latex-dev/base/ltoutenc.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/ltoutput.dtx b/Master/texmf-dist/source/latex-dev/base/ltoutput.dtx index d1fe26b90a0..138bc85ba38 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltoutput.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltoutput.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -37,7 +37,7 @@ %<*driver> % \fi \ProvidesFile{ltoutput.dtx} - [2018/11/28 v1.4d LaTeX Kernel (Output Routine)] + [2019/08/27 v1.4e LaTeX Kernel (Output Routine)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltoutput.dtx} @@ -783,6 +783,7 @@ % {Added macro} % \changes{v1.1f}{1994/11/14}{Use normal box register: why a box?} % \changes{v1.1l}{1995/04/24}{Add \cs{vbox} latex/1392} +% \changes{v1.4e}{2019/08/27}{Make \cs{AtBeginDvi} robust} % % We use a box register in which to put % stuff that must appear before anything else in the @@ -792,7 +793,7 @@ % page when it is unboxed. % \begin{macrocode} \newbox\@begindvibox -\def \AtBeginDvi #1{% +\DeclareRobustCommand \AtBeginDvi [1]{% \global \setbox \@begindvibox \vbox{\unvbox \@begindvibox #1}% } diff --git a/Master/texmf-dist/source/latex-dev/base/ltpage.dtx b/Master/texmf-dist/source/latex-dev/base/ltpage.dtx index 4d5601556db..c5ce52b1c65 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltpage.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltpage.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltpage.dtx} - [2000/06/02 v1.0k LaTeX Kernel (page style setup)] + [2019/08/27 v1.0l LaTeX Kernel (page style setup)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltpage.dtx} @@ -63,6 +63,7 @@ % \changes{v1.0a}{1994/03/07}{Initial version, split from ltherest.dtx} % \changes{v1.0b}{1994/04/19}{Improve documentation} % \changes{v1.0i}{1996/04/18}{Improve documentation} +% \changes{v1.0l}{2019/08/27}{Make various commands robust} % % % \subsection{Page Style Commands} @@ -175,6 +176,14 @@ % \end{macro} % \end{macro} % +% +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\markboth}{Make commands robust}% +% \end{macrocode} +% % \begin{macro}{\markboth} % \begin{macro}{\markright} % \changes{v1.0d}{1994/05/20}{Changed setting for \cs{protect}.} @@ -193,7 +202,7 @@ % \changes{v1.0j}{2000/05/26}{Reimplementation to fix expansion % error (pr/3203).} % \begin{macrocode} -\def\markboth#1#2{% +\DeclareRobustCommand\markboth[2]{% \begingroup \let\label\relax \let\index\relax \let\glossary\relax \unrestored@protected@xdef\@themark {{#1}{#2}}% @@ -201,7 +210,10 @@ \mark{\the\@temptokena}% \endgroup \if@nobreak\ifvmode\nobreak\fi\fi} -\def\markright#1{% +% \end{macrocode} +% +% \begin{macrocode} +\DeclareRobustCommand\markright[1]{% \begingroup \let\label\relax \let\index\relax \let\glossary\relax % \end{macrocode} @@ -216,6 +228,21 @@ % \end{macro} % \end{macro} % +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\markboth}{Make commands robust}% +%<latexrelease> +%<latexrelease>\kernel@make@fragile\markboth +%<latexrelease>\kernel@make@fragile\markright +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% +% % % \begin{macro}{\@markright} % \changes{v1.0j}{2000/05/26}{Reimplementation to fix expansion @@ -269,7 +296,7 @@ % interfering with the 1fil space of |\newpage|.) % % \begin{macrocode} -\def\raggedbottom{% +\DeclareRobustCommand\raggedbottom{% \def\@textbottom{\vskip \z@ \@plus.0001fil}\let\@texttop\relax} % \end{macrocode} % \end{macro} @@ -278,7 +305,7 @@ % |\flushbottom|: % Inverse of |\raggedbottom| --- makes all pages the same height. % \begin{macrocode} -\def\flushbottom{% +\DeclareRobustCommand\flushbottom{% \let\@textbottom\relax \let\@texttop\relax} % \end{macrocode} % \end{macro} @@ -290,7 +317,7 @@ % \changes{LaTeX2e}{1993/12/18}{Added \cs{emergencystretch}} % \changes{v1.0h}{1994/07/20}{Save a few tokens} % \begin{macrocode} -\def\sloppy{% +\DeclareRobustCommand\sloppy{% \tolerance 9999% \emergencystretch 3em% \hfuzz .5\p@ @@ -310,7 +337,7 @@ % \changes{v1.0f}{1995/04/24}{reset \cs{emergencystretch} latex/1344} % Resets \TeX's parameters to their normal finicky values. % \begin{macrocode} -\def\fussy{% +\DeclareRobustCommand\fussy{% \emergencystretch\z@ \tolerance 200% \hfuzz .1\p@ diff --git a/Master/texmf-dist/source/latex-dev/base/ltpageno.dtx b/Master/texmf-dist/source/latex-dev/base/ltpageno.dtx index da1d574b158..f6b10985b81 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltpageno.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltpageno.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltpar.dtx b/Master/texmf-dist/source/latex-dev/base/ltpar.dtx index 3b72b43a9cc..75b4894eb1d 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltpar.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltpar.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltpictur.dtx b/Master/texmf-dist/source/latex-dev/base/ltpictur.dtx index 6b84231ab5b..ad82cd477f3 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltpictur.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltpictur.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltpictur.dtx} - [2016/03/29 v1.1l LaTeX Kernel (Picture Mode)] + [2019/08/27 v1.1m LaTeX Kernel (Picture Mode)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltpictur.dtx} @@ -95,6 +95,8 @@ % \changes{v0.1e}{1994/05/22}{Use new warning cmds} % \changes{v1.0f}{1994/11/17} % {\cs{@tempa} to \cs{reserved@a}} +% \changes{v1.1m}{2019/08/27}{Remove several unnecessary \cs{gdef} definitions} +% \changes{v1.1m}{2019/08/27}{Make various commands robust} % % \begin{oldcomments} % @@ -196,8 +198,8 @@ % \changes{v1.0h}{1995/05/12}{Macro added for latex/1355} % |#1| should be a |(| (eating any white space before the bracket), % \begin{macrocode} -\long\gdef\picture#1{\pictur@#1} -\gdef\pictur@(#1){% +\long\def\picture#1{\pictur@#1} +\def\pictur@(#1){% \@ifnextchar({\@picture(#1)}{\@picture(#1)(0,0)}} % \end{macrocode} % \end{macro} @@ -205,7 +207,7 @@ % % \begin{macro}{\@picture} % \begin{macrocode} -\gdef\@picture(#1,#2)(#3,#4){% +\def\@picture(#1,#2)(#3,#4){% \@picht#2\unitlength \setbox\@picbox\hb@xt@#1\unitlength\bgroup \hskip -#3\unitlength @@ -221,7 +223,7 @@ % (proposed by John Hobby)} % % \begin{macrocode} -\gdef\endpicture{% +\def\endpicture{% \egroup\hss\egroup \ht\@picbox\@picht\dp\@picbox\z@ \mbox{\box\@picbox}} @@ -233,7 +235,7 @@ % changed 20 Jul 87). % % \begin{macrocode} -\long\gdef\put(#1,#2)#3{% +\long\def\put(#1,#2)#3{% \@killglue\raise#2\unitlength \hb@xt@\z@{\kern#1\unitlength #3\hss}% \ignorespaces} @@ -244,7 +246,7 @@ % \changes{v0.1c}{1994/04/28}{(DPC) Ignore spaces between )(} % |#3| had better be a |(|. % \begin{macrocode} -\gdef\multiput(#1,#2)#3{% +\def\multiput(#1,#2)#3{% \@xdim #1\unitlength \@ydim #2\unitlength \@multiput(} @@ -254,7 +256,7 @@ % \begin{macro}{\multiput} % \changes{v0.1c}{1994/04/28}{(DPC) Macro added} % \begin{macrocode} -\long\gdef\@multiput(#1,#2)#3#4{% +\long\def\@multiput(#1,#2)#3#4{% \@killglue\@multicnt #3\relax \@whilenum \@multicnt >\z@\do {\raise\@ydim\hb@xt@\z@{\kern\@xdim #4\hss}% @@ -266,16 +268,16 @@ % % \begin{macro}{\@killglue} % \begin{macrocode} -\gdef\@killglue{\unskip\@whiledim \lastskip >\z@\do{\unskip}} +\def\@killglue{\unskip\@whiledim \lastskip >\z@\do{\unskip}} % \end{macrocode} % \end{macro} % % \begin{macro}{\thinlines} % \begin{macro}{\thicklines} % \begin{macrocode} -\gdef\thinlines{\let\@linefnt\tenln \let\@circlefnt\tencirc +\DeclareRobustCommand\thinlines{\let\@linefnt\tenln \let\@circlefnt\tencirc \@wholewidth\fontdimen8\tenln \@halfwidth .5\@wholewidth} -\gdef\thicklines{\let\@linefnt\tenlnw \let\@circlefnt\tencircw +\DeclareRobustCommand\thicklines{\let\@linefnt\tenlnw \let\@circlefnt\tencircw \@wholewidth\fontdimen8\tenlnw \@halfwidth .5\@wholewidth} % \end{macrocode} % \end{macro} @@ -283,19 +285,20 @@ % % \begin{macro}{\linethickness} % \begin{macrocode} -\gdef\linethickness#1{\@wholewidth #1\relax \@halfwidth .5\@wholewidth} +\DeclareRobustCommand\linethickness[1] + {\@wholewidth #1\relax \@halfwidth .5\@wholewidth} % \end{macrocode} % \end{macro} % % \begin{macro}{\ishortstack} % \begin{macrocode} -\gdef\shortstack{\@ifnextchar[\@shortstack{\@shortstack[c]}} +\def\shortstack{\@ifnextchar[\@shortstack{\@shortstack[c]}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@ishortstack} % \begin{macrocode} -\gdef\@shortstack[#1]{% +\def\@shortstack[#1]{% \leavevmode \vbox\bgroup \baselineskip-\p@\lineskip 3\p@ @@ -315,22 +318,22 @@ % % \begin{macro}{\@ishortstack} % \begin{macrocode} -\gdef\@ishortstack#1{\ialign{\mb@l {##}\unskip\mb@r\cr #1\crcr}\egroup} +\def\@ishortstack#1{\ialign{\mb@l {##}\unskip\mb@r\cr #1\crcr}\egroup} % \end{macrocode} % \end{macro} % % \begin{macro}{\@stackcr} % \begin{macro}{\@ixstackcr} % \begin{macrocode} -\gdef\@stackcr{\@ifstar\@ixstackcr\@ixstackcr} -\gdef\@ixstackcr{\@ifnextchar[\@istackcr{\cr\ignorespaces}} +\def\@stackcr{\@ifstar\@ixstackcr\@ixstackcr} +\def\@ixstackcr{\@ifnextchar[\@istackcr{\cr\ignorespaces}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@istackcr} % \begin{macrocode} -\gdef\@istackcr[#1]{\cr\noalign{\vskip #1}\ignorespaces} +\def\@istackcr[#1]{\cr\noalign{\vskip #1}\ignorespaces} % \end{macrocode} % \end{macro} % @@ -507,7 +510,7 @@ % % \begin{macro}{\line} % \begin{macrocode} -\gdef\line(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax +\def\line(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax \@linelen #3\unitlength \ifdim\@linelen<\z@\@badlinearg\else \ifnum\@xarg =\z@ \@vline @@ -519,7 +522,7 @@ % % \begin{macro}{\@sline} % \begin{macrocode} -\gdef\@sline{% +\def\@sline{% \ifnum\@xarg<\z@ \@negargtrue \@xarg -\@xarg \@yyarg -\@yarg \else \@negargfalse \@yyarg \@yarg \fi \ifnum \@yyarg >\z@ \@tempcnta\@yyarg \else \@tempcnta -\@yyarg \fi @@ -580,7 +583,7 @@ % % \begin{macro}{\@hline} % \begin{macrocode} -\gdef\@hline{\ifnum \@xarg <\z@ \hskip -\@linelen \fi +\def\@hline{\ifnum \@xarg <\z@ \hskip -\@linelen \fi \vrule \@height \@halfwidth \@depth \@halfwidth \@width \@linelen \ifnum \@xarg <\z@ \hskip -\@linelen \fi} % \end{macrocode} @@ -588,7 +591,7 @@ % % \begin{macro}{\@getlinechar} % \begin{macrocode} -\gdef\@getlinechar(#1,#2){\@tempcnta#1\relax\multiply\@tempcnta 8% +\def\@getlinechar(#1,#2){\@tempcnta#1\relax\multiply\@tempcnta 8% \advance\@tempcnta -9\ifnum #2>\z@ \advance\@tempcnta #2\relax\else \advance\@tempcnta -#2\relax\advance\@tempcnta 64 \fi \char\@tempcnta} @@ -597,7 +600,7 @@ % % \begin{macro}{\vector} % \begin{macrocode} -\gdef\vector(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax +\def\vector(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax \@tempcnta \ifnum\@xarg<\z@ -\@xarg\else\@xarg\fi \ifnum\@tempcnta<5\relax \@linelen #3\unitlength @@ -612,7 +615,7 @@ % % \begin{macro}{\@hvector} % \begin{macrocode} -\gdef\@hvector{\@hline\hb@xt@\z@{\@linefnt +\def\@hvector{\@hline\hb@xt@\z@{\@linefnt \ifnum \@xarg <\z@ \@getlarrow(1,0)\hss\else \hss\@getrarrow(1,0)\fi}} % \end{macrocode} @@ -620,13 +623,13 @@ % % \begin{macro}{\@vvector} % \begin{macrocode} -\gdef\@vvector{\ifnum \@yarg <\z@ \@downvector \else \@upvector \fi} +\def\@vvector{\ifnum \@yarg <\z@ \@downvector \else \@upvector \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@svector} % \begin{macrocode} -\gdef\@svector{\@sline +\def\@svector{\@sline \@tempcnta\@yarg \ifnum\@tempcnta <\z@ \@tempcnta -\@tempcnta\fi \ifnum\@tempcnta <5% \hskip -\wd\@linechar @@ -639,7 +642,7 @@ % \begin{macro}{\@getlarrow} % \changes{v1.1h}{1999/04/15}{Replaced octal number, CAR} % \begin{macrocode} -\gdef\@getlarrow(#1,#2){\ifnum #2=\z@ \@tempcnta 27 % '33 +\def\@getlarrow(#1,#2){\ifnum #2=\z@ \@tempcnta 27 % '33 \else \@tempcnta #1\relax\multiply\@tempcnta \sixt@@n \advance\@tempcnta -9 \@tempcntb #2\relax\multiply\@tempcntb \tw@ @@ -652,7 +655,7 @@ % \changes{v1.1h}{1999/04/15}{Replaced octal number, CAR} % \begin{macro}{\@getrarrow} % \begin{macrocode} -\gdef\@getrarrow(#1,#2){\@tempcntb #2\relax +\def\@getrarrow(#1,#2){\@tempcntb #2\relax \ifnum\@tempcntb <\z@ \@tempcntb -\@tempcntb\relax\fi \ifcase \@tempcntb\relax \@tempcnta 45 % '55 \or @@ -671,13 +674,13 @@ % % \begin{macro}{\@vline} % \begin{macrocode} -\gdef\@vline{\ifnum \@yarg <\z@ \@downline \else \@upline\fi} +\def\@vline{\ifnum \@yarg <\z@ \@downline \else \@upline\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@upline} % \begin{macrocode} -\gdef\@upline{% +\def\@upline{% \hb@xt@\z@{\hskip -\@halfwidth \vrule \@width \@wholewidth \@height \@linelen \@depth \z@\hss}} % \end{macrocode} @@ -685,7 +688,7 @@ % % \begin{macro}{\@downline} % \begin{macrocode} -\gdef\@downline{% +\def\@downline{% \hb@xt@\z@{\hskip -\@halfwidth \vrule \@width \@wholewidth \@height \z@ \@depth \@linelen \hss}} % \end{macrocode} @@ -695,7 +698,7 @@ % \changes{v1.1h}{1999/04/15}{Replaced octal number, CAR} % \changes{v1.1i}{2000/01/15}{Removed space at end-of-line, CAR} % \begin{macrocode} -\gdef\@upvector{\@upline\setbox\@tempboxa\hbox{\@linefnt\char 54}% '66 +\def\@upvector{\@upline\setbox\@tempboxa\hbox{\@linefnt\char 54}% '66 \raise \@linelen \hb@xt@\z@{\lower \ht\@tempboxa\box\@tempboxa\hss}} % \end{macrocode} % \end{macro} @@ -703,7 +706,7 @@ % \changes{v1.1h}{1999/04/15}{Replaced octal number, CAR} % \begin{macro}{\@downvector} % \begin{macrocode} -\gdef\@downvector{\@downline\lower \@linelen +\def\@downvector{\@downline\lower \@linelen \hb@xt@\z@{\@linefnt\char 63 % '77 \hss}} % \end{macrocode} @@ -800,7 +803,7 @@ % % \begin{macro}{\dashbox} % \begin{macrocode} -\gdef\dashbox#1(#2,#3){\leavevmode\hb@xt@\z@{\baselineskip \z@skip +\def\dashbox#1(#2,#3){\leavevmode\hb@xt@\z@{\baselineskip \z@skip \lineskip \z@skip \@dashdim #2\unitlength \@dashcnt \@dashdim \advance\@dashcnt 200 @@ -1081,7 +1084,7 @@ % \begin{macro}{\@getcirc} % \changes{v1.1j}{2003/12/30}{issue warning if circle size can't be met pr/3473} % \begin{macrocode} -\gdef\@getcirc#1{\@tempdima #1\relax \advance\@tempdima 2\p@ +\def\@getcirc#1{\@tempdima #1\relax \advance\@tempdima 2\p@ \@tempcnta\@tempdima \@tempdima 4\p@ \divide\@tempcnta\@tempdima \ifnum \@tempcnta >10\relax @@ -1114,13 +1117,13 @@ % % \begin{macro}{\@put} % \begin{macrocode} -\gdef\@put#1#2#3{\raise #2\hb@xt@\z@{\hskip #1#3\hss}} +\def\@put#1#2#3{\raise #2\hb@xt@\z@{\hskip #1#3\hss}} % \end{macrocode} % \end{macro} % % \begin{macro}{\oval} % \begin{macrocode} -\gdef\oval(#1,#2){\@ifnextchar[{\@oval(#1,#2)}{\@oval(#1,#2)[]}} +\def\oval(#1,#2){\@ifnextchar[{\@oval(#1,#2)}{\@oval(#1,#2)[]}} % \end{macrocode} % \end{macro} % @@ -1146,7 +1149,7 @@ % % \begin{macro}{\@oval} % \begin{macrocode} -\gdef\@oval(#1,#2)[#3]{\begingroup\boxmaxdepth \maxdimen +\def\@oval(#1,#2)[#3]{\begingroup\boxmaxdepth \maxdimen \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue % \end{macrocode} % \changes{v1.1l}{2016/03/29}{initialise tests} @@ -1189,7 +1192,7 @@ % % \begin{macro}{\@ovvert} % \begin{macrocode} -\gdef\@ovvert#1#2{\vbox to\@ovyy{% +\def\@ovvert#1#2{\vbox to\@ovyy{% \if@ovb \@tempcntb \@tempcnta \advance \@tempcntb #1\relax \kern -\@ovro \hbox{\char \@tempcntb}\nointerlineskip \else \kern \@ovri \kern \@ovdy \fi @@ -1209,7 +1212,7 @@ % % \begin{macro}{\@ovhorz} % \begin{macrocode} -\gdef\@ovhorz{\hb@xt@\@ovxx{\kern \@ovro +\def\@ovhorz{\hb@xt@\@ovxx{\kern \@ovro \if@ovr \else \kern \@ovdx \fi % \end{macrocode} % \changes{v1.1l}{2016/03/29} @@ -1232,7 +1235,7 @@ %<latexrelease> {Avoid almost zero length leaders}% %<latexrelease>\let\if@ovvline\@undefined %<latexrelease>\let\if@ovhline\@undefined -%<latexrelease>\gdef\@oval(#1,#2)[#3]{\begingroup\boxmaxdepth \maxdimen +%<latexrelease>\def\@oval(#1,#2)[#3]{\begingroup\boxmaxdepth \maxdimen %<latexrelease> \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue %<latexrelease> \@tfor\reserved@a :=#3\do %<latexrelease> {\csname @ov\reserved@a false\endcsname}% @@ -1254,7 +1257,7 @@ %<latexrelease> \advance\@ovdy\@ovro \ht\@tempboxa\z@ \dp\@tempboxa\z@ %<latexrelease> \@put{-\@ovdx}{-\@ovdy}{\box\@tempboxa}% %<latexrelease> \endgroup} -%<latexrelease>\gdef\@ovvert#1#2{\vbox to\@ovyy{% +%<latexrelease>\def\@ovvert#1#2{\vbox to\@ovyy{% %<latexrelease> \if@ovb \@tempcntb \@tempcnta \advance \@tempcntb #1\relax %<latexrelease> \kern -\@ovro \hbox{\char \@tempcntb}\nointerlineskip %<latexrelease> \else \kern \@ovri \kern \@ovdy \fi @@ -1262,7 +1265,7 @@ %<latexrelease> \if@ovt \@tempcntb \@tempcnta \advance \@tempcntb #2\relax %<latexrelease> \hbox{\char \@tempcntb}% %<latexrelease> \else \kern \@ovdy \kern \@ovro \fi}} -%<latexrelease>\gdef\@ovhorz{\hb@xt@\@ovxx{\kern \@ovro +%<latexrelease>\def\@ovhorz{\hb@xt@\@ovxx{\kern \@ovro %<latexrelease> \if@ovr \else \kern \@ovdx \fi %<latexrelease> \leaders \hrule \@height \@wholewidth \hfil %<latexrelease> \if@ovl \else \kern \@ovdx \fi @@ -1275,13 +1278,13 @@ % \changes{LaTeX2.09}{1993/08/05} % {(RMS) Added error message if \cs{circle} is used in math mode.} % \begin{macrocode} -\gdef\circle{\@inmatherr\circle\@ifstar\@dot\@circle} +\def\circle{\@inmatherr\circle\@ifstar\@dot\@circle} % \end{macrocode} % \end{macro} % % \begin{macro}{\@circle} % \begin{macrocode} -\gdef\@circle#1{% +\def\@circle#1{% \begingroup \boxmaxdepth \maxdimen \@tempdimb #1\unitlength \ifdim \@tempdimb >15.5\p@ \@getcirc\@tempdimb \@ovro\ht\@tempboxa @@ -1299,13 +1302,13 @@ % \begin{macro}{\@dot} % Internal form of |\circle*|. % \begin{macrocode} -\gdef\@dot#1{\@tempdimb #1\unitlength \@circ\@tempdimb{112}} +\def\@dot#1{\@tempdimb #1\unitlength \@circ\@tempdimb{112}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@circ} % \begin{macrocode} -\gdef\@circ#1#2{\@tempdima #1\relax \advance\@tempdima .5\p@ +\def\@circ#1#2{\@tempdima #1\relax \advance\@tempdima .5\p@ \@tempcnta\@tempdima \@tempdima \p@ \divide\@tempcnta\@tempdima \ifnum\@tempcnta >15\relax \@tempcnta 15\relax \fi @@ -1442,7 +1445,7 @@ % \begin{macro}{\qbeziermax} % The maximum number of points to plot. % \begin{macrocode} -\gdef\qbeziermax{500} +\def\qbeziermax{500} % \end{macrocode} % \end{macro} % @@ -1474,12 +1477,12 @@ % ignore spaces between its arguments. % |#2| should be white space, and |#4| should be |(|. % \begin{macrocode} -\gdef\bezier#1)#2(#3)#4({\@bezier#1)(#3)(} +\def\bezier#1)#2(#3)#4({\@bezier#1)(#3)(} % \end{macrocode} % % \begin{macro}{\@bezier} % \begin{macrocode} -\gdef\@bezier#1(#2,#3)(#4,#5)(#6,#7){% +\def\@bezier#1(#2,#3)(#4,#5)(#6,#7){% \ifnum #1=\z@ \@ovxx #4\unitlength \advance\@ovxx -#2\unitlength @@ -1533,10 +1536,55 @@ \hb@xt@\z@{\kern\@xdim \unhcopy\@tempboxa\hss}% \advance\count@\@ne}}} -%</2ekernel> % \end{macrocode} % \end{macro} % \end{macro} % +% As the commands above all use ``picture'' interface we couldn't define them with +% |\DeclareRobustCommand| so we do that now. +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\bezier}{Make commands robust}% +\MakeRobust\bezier +\MakeRobust\circle +\MakeRobust\dashbox +\MakeRobust\line +\MakeRobust\linethickness +\MakeRobust\multiput +\MakeRobust\oval +\MakeRobust\put +\MakeRobust\qbezier +\MakeRobust\shortstack +\MakeRobust\thinlines +\MakeRobust\vector +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\bezier}{Make commands robust}% +%<latexrelease> +%<latexrelease>\kernel@make@fragile\bezier +%<latexrelease>\kernel@make@fragile\circle +%<latexrelease>\kernel@make@fragile\dashbox +%<latexrelease>\kernel@make@fragile\line +%<latexrelease>\kernel@make@fragile\linethickness +%<latexrelease>\kernel@make@fragile\multiput +%<latexrelease>\kernel@make@fragile\oval +%<latexrelease>\kernel@make@fragile\put +%<latexrelease>\kernel@make@fragile\qbezier +%<latexrelease>\kernel@make@fragile\shortstack +%<latexrelease>\kernel@make@fragile\thinlines +%<latexrelease>\kernel@make@fragile\vector +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% +% \begin{macrocode} +%</2ekernel> +% \end{macrocode} +% % \Finale % diff --git a/Master/texmf-dist/source/latex-dev/base/ltplain.dtx b/Master/texmf-dist/source/latex-dev/base/ltplain.dtx index 5c4050b734a..2337133f2f9 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltplain.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltplain.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2017 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -314,8 +314,10 @@ % \begin{macro}{\newskip} % \begin{macro}{\newmuskip} % \begin{macro}{\newbox} +% \begin{macro}{\newtoks} % \begin{macro}{\newread} % \begin{macro}{\newwrite} +% \begin{macro}{\newfam} % \begin{macro}{\newlanguage} % \changes{v1.0c}{1994/03/28} % {Remove some \cs{outer} declarations.} @@ -429,6 +431,8 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % %\begin{macro}{\e@alloc@chardef} % \changes{v2.0a}{2014/12/30}{macro added} diff --git a/Master/texmf-dist/source/latex-dev/base/ltsect.dtx b/Master/texmf-dist/source/latex-dev/base/ltsect.dtx index cb1c6d2c304..239d4c547fd 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltsect.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltsect.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -31,7 +31,7 @@ %%% From File: ltsect.dtx %<*driver> % \fi -\ProvidesFile{ltsect.dtx}[2018/09/26 v1.1c LaTeX Kernel (Sectioning)] +\ProvidesFile{ltsect.dtx}[2019/08/27 v1.1d LaTeX Kernel (Sectioning)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltsect.dtx} @@ -85,6 +85,7 @@ % {\cs{@tempa} to \cs{reserved@a}} % \changes{v1.0m}{1995/05/03}{TO: Promoted documentation to doc.sty % standard} +% \changes{v1.1d}{2019/08/27}{Make various commands robust} % % \begin{macrocode} %<*2ekernel> @@ -114,65 +115,104 @@ % And finally, the |\maketitle| command produces the actual title, % using the information previously saved with the other commands. % +% +% +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\title}{Make commands robust}% +% \end{macrocode} +% +% % \begin{macro}{\title} -% \begin{macro}{\@title} % \changes{LaTeX2e}{1993/12/11}{Added default} % |\title| for use in |\maketitle|. If not given |\maketitle| will % produce an error message. % \begin{macrocode} -\def\title#1{\gdef\@title{#1}} -\def\@title{\@latex@error{No \noexpand\title given}\@ehc} +\DeclareRobustCommand\title[1]{\gdef\@title{#1}} % \end{macrocode} % \end{macro} -% \end{macro} +% % % \begin{macro}{\author} -% \begin{macro}{\@author} % \changes{LaTeX2e}{1993/12/11}{Added default} % % |\author| for use in |\maketitle|. If not given |\maketitle| will % produce a warning message. % % \begin{macrocode} -\def\author#1{\gdef\@author{#1}} -\def\@author{\@latex@warning@no@line{No \noexpand\author given}} +\DeclareRobustCommand\author[1]{\gdef\@author{#1}} % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}{\date} -% \begin{macro}{\@date} % |\date| for use in |\maketitle|. If not given |\maketitle| will % produce |\today| as the default. % \begin{macrocode} -\def\date#1{\gdef\@date{#1}} -\gdef\@date{\today} +\DeclareRobustCommand\date[1]{\gdef\@date{#1}} % \end{macrocode} % \end{macro} -% \end{macro} % % \changes{1.0h}{1994/11/04}{(ASAJ) Added \cs{protected@xdef} to % \cs{thanks}.} % \begin{macro}{\thanks} % \begin{macrocode} -\def\thanks#1{\footnotemark +\DeclareRobustCommand\thanks[1]{\footnotemark \protected@xdef\@thanks{\@thanks \protect\footnotetext[\the\c@footnote]{#1}}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@thanks} -% \begin{macrocode} -\let\@thanks\@empty -% \end{macrocode} -% \end{macro} % \begin{macro}{\and} % \begin{macrocode} -\def\and{% % \begin{tabular} +\DeclareRobustCommand\and{% % \begin{tabular} \end{tabular}% \hskip 1em \@plus.17fil% - \begin{tabular}[t]{c}}% % \end{tabular} + \begin{tabular}[t]{c}}% % \end{tabular} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\title}{Make commands robust}% +%<latexrelease> +%<latexrelease>\kernel@make@fragile\title +%<latexrelease>\kernel@make@fragile\author +%<latexrelease>\kernel@make@fragile\date +%<latexrelease>\kernel@make@fragile\thanks +%<latexrelease>\kernel@make@fragile\and +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% +% +% \begin{macro}{\@title} +% \begin{macrocode} +\def\@title{\@latex@error{No \noexpand\title given}\@ehc} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@author} +% \begin{macrocode} +\def\@author{\@latex@warning@no@line{No \noexpand\author given}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@date} +% \begin{macrocode} +\gdef\@date{\today} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@thanks} +% \begin{macrocode} +\let\@thanks\@empty % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex-dev/base/ltspace.dtx b/Master/texmf-dist/source/latex-dev/base/ltspace.dtx index 6f212bba159..d840b13bbbe 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltspace.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltspace.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltspace.dtx} - [2018/10/10 v1.3i LaTeX Kernel (spacing)] + [2019/08/27 v1.3j LaTeX Kernel (spacing)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltspace.dtx} @@ -62,6 +62,7 @@ % \changes{v1.2q}{1996/07/27}{Further documentation of problems} % \changes{v1.2r}{1996/07/27}{Correct documentation of problems} % \changes{v1.2w}{1998/08/17}{Documentation fixes.} +% \changes{v1.3j}{2019/08/27}{Make various commands robust} % % % \section{Spacing} @@ -274,18 +275,66 @@ %<*2ekernel> \message{spacing,} % \end{macrocode} +% +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\pagebreak}{Make commands robust}% +% \end{macrocode} % % \begin{macro}{\pagebreak} % \begin{macro}{\nopagebreak} % \changes{v1.2h}{1995/07/05}{Reimplemented both using \cs{@no@pgbk}} % \changes{v1.2j}{1995/10/16}{(DPC) Use \cs{@testopt} /1911} % \begin{macrocode} -\def\pagebreak{\@testopt{\@no@pgbk-}4} -\def\nopagebreak{\@testopt\@no@pgbk4} +\DeclareRobustCommand\pagebreak{\@testopt{\@no@pgbk-}4} +\DeclareRobustCommand\nopagebreak{\@testopt\@no@pgbk4} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\linebreak} +% \begin{macro}{\nolinebreak} +% \changes{v1.2u}{1996/10/29}{Reimplemented both using \cs{@no@lnbk}} +% \changes{v1.2j}{1995/10/16}{(DPC) Use \cs{@testopt} /1911} +% \begin{macrocode} +\DeclareRobustCommand\linebreak{\@testopt{\@no@lnbk-}4} +\DeclareRobustCommand\nolinebreak{\@testopt\@no@lnbk4} % \end{macrocode} % \end{macro} % \end{macro} % +% \begin{macro}{\samepage} +% \begin{macrocode} +\DeclareRobustCommand\samepage{\interlinepenalty\@M + \postdisplaypenalty\@M + \interdisplaylinepenalty\@M + \@beginparpenalty\@M + \@endparpenalty\@M + \@itempenalty\@M + \@secpenalty\@M + \interfootnotelinepenalty\@M} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\pagebreak}{Make commands robust}% +%<latexrelease> +%<latexrelease>\kernel@make@fragile\pagebreak +%<latexrelease>\kernel@make@fragile\nopagebreak +%<latexrelease>\kernel@make@fragile\linebreak +%<latexrelease>\kernel@make@fragile\nolinebreak +%<latexrelease>\kernel@make@fragile\samepage +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% % % \begin{macro}{\@no@pgbk} % \changes{v1.2h}{1995/07/05}{Macro replaces \cs{@pgbk} @@ -302,16 +351,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\linebreak} -% \begin{macro}{\nolinebreak} -% \changes{v1.2u}{1996/10/29}{Reimplemented both using \cs{@no@lnbk}} -% \changes{v1.2j}{1995/10/16}{(DPC) Use \cs{@testopt} /1911} -% \begin{macrocode} -\def\linebreak{\@testopt{\@no@lnbk-}4} -\def\nolinebreak{\@testopt\@no@lnbk4} -% \end{macrocode} -% \end{macro} -% \end{macro} +% % \begin{macro}{\@no@lnbk} % \changes{v1.2u}{1996/10/29}{Macro replaces \cs{@lnbk} % and \cs{@nolnbk}} @@ -331,19 +371,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\samepage} -% \begin{macrocode} -\def\samepage{\interlinepenalty\@M - \postdisplaypenalty\@M - \interdisplaylinepenalty\@M - \@beginparpenalty\@M - \@endparpenalty\@M - \@itempenalty\@M - \@secpenalty\@M - \interfootnotelinepenalty\@M} -% \end{macrocode} -% \end{macro} -% % % \begin{macro}{\\} % \changes{v1.2a}{1994/11/11}{(DPC) Make robust} @@ -1140,9 +1167,9 @@ % \begin{macro}{\enspace} % \changes{v1.3h}{2018/09/24}{Start LR-mode if necessary (git/49)} % \begin{macrocode} -\def\thinspace{\leavevmode@ifvmode\kern .16667em } -\def\negthinspace{\leavevmode@ifvmode\kern-.16667em } -\def\enspace{\leavevmode@ifvmode\kern.5em } +\DeclareRobustCommand\thinspace{\leavevmode@ifvmode\kern .16667em } +\DeclareRobustCommand\negthinspace{\leavevmode@ifvmode\kern-.16667em } +\DeclareRobustCommand\enspace{\leavevmode@ifvmode\kern.5em } % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex-dev/base/lttab.dtx b/Master/texmf-dist/source/latex-dev/base/lttab.dtx index 54bffa5974e..646015daf3d 100644 --- a/Master/texmf-dist/source/latex-dev/base/lttab.dtx +++ b/Master/texmf-dist/source/latex-dev/base/lttab.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -31,7 +31,7 @@ %%% From File: lttab.dtx %<*driver> % \fi -\ProvidesFile{lttab.dtx}[2018/12/30 v1.1p LaTeX Kernel (Columns)] +\ProvidesFile{lttab.dtx}[2019/08/27 v1.1p LaTeX Kernel (Columns)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{lttab.dtx} @@ -84,8 +84,9 @@ % \changes{v1.0c}{1994/05/07}{Removed surplus braces from % \cs{@ifnextchar} constructs} % \changes{v1.0f}{1994/05/21}{Use new error commands} -% \changes{v1.0j}{1994/11/17} -% {\cs{@tempa} to \cs{reserved@a}} +% \changes{v1.0j}{1994/11/17}{\cs{@tempa} to \cs{reserved@a}} +% \changes{v1.1q}{2019/08/27}{Remove several unnecessary \cs{gdef} definitions} +% \changes{v1.1q}{2019/08/27}{Make various commands robust} % % \subsection{tabbing} % @@ -386,7 +387,7 @@ % a local variable). That this is allowed is a fundamental design % flaw which is not going to be corrected now. % \begin{macrocode} -\gdef\@startline{% +\def\@startline{% \ifnum \@nxttabmar >\@hightab \@badtab \global\@nxttabmar \@hightab @@ -401,7 +402,7 @@ % % \begin{macro}{\@stopline} % \begin{macrocode} -\gdef\@stopline{% +\def\@stopline{% \unskip \@stopfield \if@rjfield @@ -424,7 +425,7 @@ % \changes{v1.0d}{1994/05/13} % {Colour support} % \begin{macrocode} -\gdef\@startfield{% +\def\@startfield{% \global\setbox\@curfield\hbox\bgroup\color@begingroup} % \end{macrocode} % \end{macro} @@ -433,7 +434,7 @@ % \changes{v1.0d}{1994/05/13} % {Colour support} % \begin{macrocode} -\gdef\@stopfield{% +\def\@stopfield{% \color@endgroup\egroup} % \end{macrocode} % \end{macro} @@ -442,7 +443,7 @@ % \changes{v1.0d}{1994/05/13} % {Colour support} % \begin{macrocode} -\gdef\@contfield{% +\def\@contfield{% \global\setbox\@curfield\hbox\bgroup\color@begingroup \unhbox\@curfield} % \end{macrocode} @@ -450,38 +451,34 @@ % % \begin{macro}{\@addfield} % \begin{macrocode} -\gdef\@addfield{\global\setbox\@curline\hbox{\unhbox +\def\@addfield{\global\setbox\@curline\hbox{\unhbox \@curline\unhbox\@curfield}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@ifatmargin} % \begin{macrocode} -\gdef\@ifatmargin{\ifdim \wd\@curline =\z@} +\def\@ifatmargin{\ifdim \wd\@curline =\z@} % \end{macrocode} % \end{macro} % % \begin{macro}{\@tabcr} % \begin{macrocode} -\gdef\@tabcr{\@stopline \@ifstar{\penalty \@M \@xtabcr}\@xtabcr} +\def\@tabcr{\@stopline \@ifstar{\penalty \@M \@xtabcr}\@xtabcr} % \end{macrocode} % \end{macro} % % \begin{macro}{\@xtabcr} % \begin{macrocode} -\gdef\@xtabcr{\@ifnextchar[\@itabcr{\@startline\ignorespaces}} +\def\@xtabcr{\@ifnextchar[\@itabcr{\@startline\ignorespaces}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@itabcr} % \begin{macrocode} -\gdef\@itabcr[#1]{\vskip #1\@startline\ignorespaces} +\def\@itabcr[#1]{\vskip #1\@startline\ignorespaces} % \end{macrocode} % -% \begin{macrocode} -\gdef\kill{\@stopfield\@startline\ignorespaces} -% \end{macrocode} -% \end{macro} % % \begin{macro}{\tabbing} % \changes{v1.1f}{1995/10/23}{(CAR)Make \cs{@hightab} consistently a @@ -489,7 +486,7 @@ % \changes{latex2e}{1993/12/13}{Removed optional argument of \cs{item}} % We use |\relax| to prevent |\item| from scanning too far. % \begin{macrocode} -\gdef\tabbing{\lineskip \z@skip\let\>\@rtab\let\<\@ltab\let\=\@settab +\def\tabbing{\lineskip \z@skip\let\>\@rtab\let\<\@ltab\let\=\@settab \let\+\@tabplus\let\-\@tabminus\let\`\@tabrj\let\'\@tablab \let\\=\@tabcr \@hightab\@firsttab @@ -512,7 +509,7 @@ % % \begin{macro}{\endtabbing} % \begin{macrocode} -\gdef\endtabbing{% +\def\endtabbing{% \@stopline\ifnum\@tabpush >\z@ \@badpoptabs \fi\endtrivlist} % \end{macrocode} % \end{macro} @@ -520,7 +517,7 @@ % \begin{macro}{\@rtab} % Omitted |\global| added to |\@rtab| 17 Jun 86 % \begin{macrocode} -\gdef\@rtab{\@stopfield\@addfield\ifnum \@curtab<\@hightab +\def\@rtab{\@stopfield\@addfield\ifnum \@curtab<\@hightab \global\advance\@curtab \@ne \else\@badtab\fi \@tempdima\dimen\@curtab \advance\@tempdima -\dimen\@curtabmar @@ -534,7 +531,7 @@ % \changes{v1.1f}{1995/10/23}{(CAR)Ensure that \cs{@hightab} increases % by at most one} % \begin{macrocode} -\gdef\@settab{\@stopfield\@addfield +\def\@settab{\@stopfield\@addfield \ifnum \@curtab <\@maxtab \ifnum\@curtab =\@hightab \advance\@hightab \@ne @@ -552,7 +549,7 @@ % % \begin{macro}{\@ltab} % \begin{macrocode} -\gdef\@ltab{\@ifatmargin\ifnum\@curtabmar >\@firsttab +\def\@ltab{\@ifatmargin\ifnum\@curtabmar >\@firsttab \global\advance\@curtab \m@ne \global\advance\@curtabmar\m@ne\else \@badtab\fi\else \@latex@error{\string\<\space in mid line}\@ehd\fi\ignorespaces} @@ -561,7 +558,7 @@ % % \begin{macro}{\@tabplus} % \begin{macrocode} -\gdef\@tabplus{% +\def\@tabplus{% \ifnum\@nxttabmar<\@hightab \global\advance\@nxttabmar\@ne \else @@ -573,7 +570,7 @@ % % \begin{macro}{\@tabminus} % \begin{macrocode} -\gdef\@tabminus{% +\def\@tabminus{% \ifnum\@nxttabmar>\@firsttab \global\advance\@nxttabmar\m@ne \else @@ -585,7 +582,7 @@ % % \begin{macro}{\@tabrj} % \begin{macrocode} -\gdef\@tabrj{% +\def\@tabrj{% \@stopfield\@addfield\global\@rjfieldtrue\@startfield\ignorespaces} % \end{macrocode} % \end{macro} @@ -593,7 +590,7 @@ % \begin{macro}{\@tablab} % |\setbox\@curline| made |\global| in |\@tablab|. 17 Jun 86 % \begin{macrocode} -\gdef\@tablab{% +\def\@tablab{% \@stopfield \global\setbox\@curline\hbox{% \box\@curline @@ -605,9 +602,16 @@ % \end{macrocode} % \end{macro} % +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\pushtabs}{Make commands robust}% +% \end{macrocode} +% % \begin{macro}{\pushtabs} % \begin{macrocode} -\gdef\pushtabs{% +\DeclareRobustCommand\pushtabs{% \@stopfield\@addfield\global\advance\@tabpush \@ne \begingroup \@contfield} % \end{macrocode} @@ -621,7 +625,7 @@ % a local variable). That this is allowed is a fundamental design % flaw which is not going to be corrected now. % \begin{macrocode} -\gdef\poptabs{\@stopfield\@addfield +\DeclareRobustCommand\poptabs{\@stopfield\@addfield \ifnum \@tabpush >\z@ \endgroup \global\advance\@tabpush \m@ne @@ -636,7 +640,25 @@ % \end{macrocode} % \end{macro} % +% \begin{macrocode} +\DeclareRobustCommand\kill{\@stopfield\@startline\ignorespaces} +% \end{macrocode} +% \end{macro} % +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\pushtabs}{Make commands robust}% +%<latexrelease> +%<latexrelease>\kernel@make@fragile\pushtabs +%<latexrelease>\kernel@make@fragile\poptabs +%<latexrelease>\kernel@make@fragile\kill +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% % \begin{macro}{\tabbingsep} % \begin{macrocode} \newdimen\tabbingsep @@ -785,7 +807,7 @@ % % \begin{macro}{\extracolsep} % \begin{macrocode} -\def\extracolsep#1{\tabskip #1\relax} +\DeclareRobustCommand\extracolsep[1]{\tabskip #1\relax} % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex-dev/base/ltthm.dtx b/Master/texmf-dist/source/latex-dev/base/ltthm.dtx index 78e8a2e586f..ee1b51ac5d8 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltthm.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltthm.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltvers.dtx b/Master/texmf-dist/source/latex-dev/base/ltvers.dtx index f8da6086ac6..4a5cc5283bf 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltvers.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltvers.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2019 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -115,8 +115,19 @@ {2019-10-01} %</2ekernel|latexrelease> %<*2ekernel> -\def\patch@level{-2} +\def\patch@level{-3} % \end{macrocode} +% +% \begin{macro}{\development@branch@name} +% For more fine grain control there is the possibility to name the +% current development branch. This is only used when the +% \cs{patch@level} is negative (i.e., a pre-release format) and is +% intended to help help us internally when we locally install a +% format out of some development branch. +% \begin{macrocode} +\edef\development@branch@name{development \the\year-\the\month-\the\day} +% \end{macrocode} +% \end{macro} % \end{macro} % \end{macro} % \end{macro} @@ -179,9 +190,21 @@ \write16{\fmtname \space<\fmtversion> patch level \patch@level} \else \everyjob\expandafter{\the\everyjob - \typeout{\fmtname \space<\fmtversion> pre-release\patch@level}} + \typeout{\fmtname \space<\fmtversion> pre-release\patch@level + \ifx\development@branch@name\@undefined \else + \ifx\development@branch@name\@empty \else + \space (\development@branch@name\space branch)% + \fi + \fi + }} \immediate - \write16{\fmtname \space<\fmtversion> pre-release\patch@level} + \write16{\fmtname \space<\fmtversion> pre-release\patch@level + \ifx\development@branch@name\@undefined \else + \ifx\development@branch@name\@empty \else + \space (\development@branch@name\space branch)% + \fi + \fi + } \fi \fi %</2ekernel> @@ -207,7 +230,8 @@ % \begin{macrocode} \def\IncludeInRelease#1{% \if@includeinrelease - \PackageError{latexrelease}{mis-matched IncludeInRelease}{}% + \PackageError{latexrelease}{mis-matched IncludeInRelease}% + {There is an \string\EndIncludeRelease\space missing}% \@includeinreleasefalse \fi \kernel@ifnextchar[% @@ -260,7 +284,7 @@ \long\def\@check@IncludeInRelease#1\IncludeInRelease #2#3\@end@check@IncludeInRelease{% \ifx\@check@IncludeInRelease#2\else - \PackageError{latexrelease}{skipped IncludeInRelease}{}% + \PackageError{latexrelease}{skipped IncludeInRelease for tag \string#2}{}% \fi} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex-dev/base/ltxdoc.dtx b/Master/texmf-dist/source/latex-dev/base/ltxdoc.dtx index 329353d1235..21cc2d3dcfa 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltxdoc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltxdoc.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2018 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/ltxref.dtx b/Master/texmf-dist/source/latex-dev/base/ltxref.dtx index a5c11bf21b6..1d8c41c4397 100644 --- a/Master/texmf-dist/source/latex-dev/base/ltxref.dtx +++ b/Master/texmf-dist/source/latex-dev/base/ltxref.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltxref.dtx} - [2014/09/29 v1.1k LaTeX Kernel (Cross Referencing)] + [2019/08/22 v1.1l LaTeX Kernel (Cross Referencing)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltxref.dtx} @@ -126,6 +126,50 @@ % % \end{oldcomments} % +% \DescribeMacro\labelformat +% A reference via |\ref| produces by default the data associated with +% the corresponding |\label| command (typically a number); any +% additional formatting has to be provided by the user. If, for +% example, references to equations are always to be typeset as +% ``equation (\textit{number})'', one has to code +% ``\verb=equation (\ref{=\textit{key}\verb=})=''. With |\labelformat| +% there is a possibility to generate such +% frills automatically without resorting to low-level coding. +% The command takes two arguments: the first is +% the name of a counter and the second is its representation when +% referenced. This means that for a successful usage, one has to know +% the counter name being used for generating the label, though in +% practice this should not pose a problem. The current counter number +% is picked up as an argument. +% Here are two examples: +%\begin{verbatim} +% \labelformat{section}{section~#1} +% \labelformat{equation}{equation~(#1)}} +%\end{verbatim} +% +% \DescribeMacro\Ref +% A side effect of using |\labelformat| is that, depending on the +% defined formatting, it becomes impossible to use |\ref| at the +% beginning of a sentence (if its replacement text starts with a +% lowercase letter). To overcome this problem we +% introduce the command |\Ref| that behave like +% |\ref| except that it uppercases the first token +% of the generated string. +% + +% To make |\Ref| work properly the very first token in the second +% argument of |\labelformat| has to be a simple \textsc{ascii} or +% UTF-8 letter, otherwise the capitalization will fail or worse, you +% will end up with some error messages. If you actually need something +% more complicated in this place (e.g., an accented letter not written +% as a UTF-8 character) you have to explicitly surround it with +% braces, to identify the part that needs to be capitalized. For +% example, for figure references in the Hungarian language you might +% want to write |\labelformat{figure}{{\'a}bra~\thefigure}| or use +% |\labelformat{figure}{ábra~\thefigure}| which avoids the brace +% problem. +% +% % \begin{macro}{\G@refundefinedtrue} % \changes{v1.1i}{1995/12/07}{Renamed (back) from \cs{G@refundefined}} % \begin{macro}{\@refundefined} @@ -247,7 +291,6 @@ % % \begin{macro}{\label} % \changes{v1.1d}{1994/11/04}{(ASAJ)Added \cs{protected@write}} -% \begin{macro}{\refstepcounter} % \changes{v1.1d}{1994/11/04}{(ASAJ)Added \cs{protected@edef}} % The commands |\label| and |\refstepcounter| have been changed to % allow |\protect|'ed commands to work properly. For example, @@ -263,79 +306,111 @@ {\string\newlabel{#1}{{\@currentlabel}{\thepage}}}% \@esphack} % \end{macrocode} +% \end{macro} % % \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\refstepcounter}{Add \labelformat and \Ref}% +% \end{macrocode} +% +% \begin{macro}{\refstepcounter} +% Step the counter and allow for labels to point to its current value. +% \begin{macrocode} \def\refstepcounter#1{\stepcounter{#1}% \protected@edef\@currentlabel - {\csname p@#1\endcsname\csname the#1\endcsname}% +% \end{macrocode} +% By generating the second csname first the |\p@...| command can +% grab it as an argument which can be helpful for more complicated +% typesetting arrangements. +% +% The trick is to ensure that |\csname the#1\endcsname| is turned +% into a single token before |\p@...| is expanded further. This +% way, if the |\p@...| command is a macro with one argument it will +% receive |\the...|. With the original kernel code (i.e., without the +% |\expandafter|) it will instead pick up |\csname| which would be +% disastrous. +% +% Using |\expandafter| instead of braces delimiting the argument is +% better because, assuming that the |\p@...| command is not defined +% as a macro with one argument, the braces will stay and prohibit +% kerning that might otherwise happen between the glyphs generated +% by |\the...| and surrounding glyphs. +% +% \changes{v1.1l}{2019/08/22}{Allow \cs{p@...} to have an +% argument} +% \begin{macrocode} + {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}% } % \end{macrocode} % \end{macro} -% \end{macro} -% -% -% \begin{macro}{\@currentlabel} -% For |\label| commands that come before any environment % +% \begin{macro}{\labelformat} +% A shortcut to set the |\p@...| macro for a counter. It will pick +% up the counter representation as an argument so that it can be +% specially formatted. +% \changes{v1.1l}{2019/08/22}{Commanded moved from \texttt{varioref.sty}} % \begin{macrocode} -\def\@currentlabel{} +\def\labelformat#1{\expandafter\def\csname p@#1\endcsname##1} % \end{macrocode} % \end{macro} % +% \begin{macro}{\Ref} +% This macro expands the result of |\ref| and then uppercases the +% first token. Only useful if the label was generated via +% |\labelformat| and contains some lower case letter at its start. If +% the label starts with a complicated construct (e.g., an accented +% letter that is provided via a command, e.g., \verb=\"a= instead +% of a UTF-8 character like ä) one has to surround everything that +% needs uppercasing in +% a brace group in the definition of |\labelformat|.\footnote{There +% is one problem with this approach: the braces are kept in a +% normal \texttt{\textbackslash ref} which might spoil kerning. +% Perhaps one day this needs redoing.} +% \changes{v1.1l}{2019/08/22}{Commanded moved from \texttt{varioref.sty}} % \begin{macrocode} -%</2ekernel> +\DeclareRobustCommand\Ref[1]{\protected@edef\@tempa{\ref{#1}}% + \expandafter\MakeUppercase\@tempa} % \end{macrocode} +% \end{macro} % -% \subsection{An extension of counter referencing} % % -% At the moment a reference to a counter |foo| will generate the -% equivalent of |\p@foo\thefoo| although not quite in this form. For -% some applications it would be nice of one could have |\thefoo| being -% an argument to |\p@foo| to be able to put material before and after -% the number generated by |\thefoo|. This can be easily achieved with -% a small change to one of the kernel commands as follows: +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\refstepcounter}{Add \labelformat and \Ref}% +%<latexrelease> +%<latexrelease>\def\refstepcounter#1{\stepcounter{#1}% +%<latexrelease> \protected@edef\@currentlabel +%<latexrelease> {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}% +%<latexrelease>} +%<latexrelease>\let\labelformat\@undefined +%<latexrelease>\let\Ref\@undefined +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% +% +% +% % -%\begin{verbatim} -%\def\refstepcounter#1{\stepcounter{#1}% -% \protected@edef\@currentlabel -% {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}% -%} -%\end{verbatim} % -% The trick is to ensure that |\csname the#1\endcsname| is turned into -% a single token before |\p@...| is expanded further. This way, if the -% |\p@...| command is a macro with one argument it will receive -% |\the...|. With the kernel code (i.e., without the |\expandafter|) -% it will instead pick up |\csname| which would be disastrous. -% -% Using |\expandafter| instead of braces delimiting the argument is -% better because, assuming that the |\p@...| command is not defined as -% a macro with one argument, the braces will stay and prohibit kerning -% that might otherwise happen between the glyphs generated by -% |\the...| and surrounding glyphs. -% -% We have refrained from making this change in the kernel code -% although for existing documents it would be 100\% backward -% compatible. The reason being that any class or package making use of -% this functionality would then horribly fail with older \LaTeX{} -% installations. -% -% Instead we suggest that people who are interested in using this -% functionality in a document class or package add the redefinition to -% the class file. To ensure that this redefinition is properly applied -% they might want to test for the original definition first, e.g. +% \begin{macro}{\@currentlabel} +% Default for |\label| commands that come before any environment. +% \begin{macrocode} +\def\@currentlabel{} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</2ekernel> +% \end{macrocode} % -%\begin{verbatim} -%\CheckCommand*\refstepcounter[1]{\stepcounter{#1}% -% \protected@edef\@currentlabel -% {\csname p@#1\endcsname\csname the#1\endcsname}% -%} -%\renewcommand*\refstepcounter[1]{\stepcounter{#1}% -% \protected@edef\@currentlabel -% {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}% -%} -%\end{verbatim} % % \Finale % diff --git a/Master/texmf-dist/source/latex-dev/base/makeindx.dtx b/Master/texmf-dist/source/latex-dev/base/makeindx.dtx index 280416f65b2..aa998bf3cac 100644 --- a/Master/texmf-dist/source/latex-dev/base/makeindx.dtx +++ b/Master/texmf-dist/source/latex-dev/base/makeindx.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/makeindx.ins b/Master/texmf-dist/source/latex-dev/base/makeindx.ins index d7ad42e2f95..b31b967c41a 100644 --- a/Master/texmf-dist/source/latex-dev/base/makeindx.ins +++ b/Master/texmf-dist/source/latex-dev/base/makeindx.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/newdc.ins b/Master/texmf-dist/source/latex-dev/base/newdc.ins index 5bbbe900da5..5786282a87a 100644 --- a/Master/texmf-dist/source/latex-dev/base/newdc.ins +++ b/Master/texmf-dist/source/latex-dev/base/newdc.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file may only be distributed together with a copy of the LaTeX base system. You may however distribute the LaTeX base system without diff --git a/Master/texmf-dist/source/latex-dev/base/newlfont.dtx b/Master/texmf-dist/source/latex-dev/base/newlfont.dtx index f058ddced9b..5bba5441ddc 100644 --- a/Master/texmf-dist/source/latex-dev/base/newlfont.dtx +++ b/Master/texmf-dist/source/latex-dev/base/newlfont.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/nfssfont.dtx b/Master/texmf-dist/source/latex-dev/base/nfssfont.dtx index 00b82a14990..a77dfba7b3b 100644 --- a/Master/texmf-dist/source/latex-dev/base/nfssfont.dtx +++ b/Master/texmf-dist/source/latex-dev/base/nfssfont.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2019 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/nfssfont.ins b/Master/texmf-dist/source/latex-dev/base/nfssfont.ins index 222551ea306..c1ac6634714 100644 --- a/Master/texmf-dist/source/latex-dev/base/nfssfont.ins +++ b/Master/texmf-dist/source/latex-dev/base/nfssfont.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/olddc.ins b/Master/texmf-dist/source/latex-dev/base/olddc.ins index 694cc6df6f5..b512ab2e3e1 100644 --- a/Master/texmf-dist/source/latex-dev/base/olddc.ins +++ b/Master/texmf-dist/source/latex-dev/base/olddc.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file may only be distributed together with a copy of the LaTeX base system. You may however distribute the LaTeX base system without diff --git a/Master/texmf-dist/source/latex-dev/base/oldlfont.dtx b/Master/texmf-dist/source/latex-dev/base/oldlfont.dtx index 3c768e1e8fc..bf393414883 100644 --- a/Master/texmf-dist/source/latex-dev/base/oldlfont.dtx +++ b/Master/texmf-dist/source/latex-dev/base/oldlfont.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/preload.dtx b/Master/texmf-dist/source/latex-dev/base/preload.dtx index 0bc9fb4415e..a6d7903299a 100644 --- a/Master/texmf-dist/source/latex-dev/base/preload.dtx +++ b/Master/texmf-dist/source/latex-dev/base/preload.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/proc.dtx b/Master/texmf-dist/source/latex-dev/base/proc.dtx index 724b939fd28..a74dfa36e4f 100644 --- a/Master/texmf-dist/source/latex-dev/base/proc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/proc.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/proc.ins b/Master/texmf-dist/source/latex-dev/base/proc.ins index 48765bddec3..15161a49601 100644 --- a/Master/texmf-dist/source/latex-dev/base/proc.ins +++ b/Master/texmf-dist/source/latex-dev/base/proc.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/slides.dtx b/Master/texmf-dist/source/latex-dev/base/slides.dtx index 4ccd6824e6c..54cfaa20fd8 100644 --- a/Master/texmf-dist/source/latex-dev/base/slides.dtx +++ b/Master/texmf-dist/source/latex-dev/base/slides.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2016 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/slides.ins b/Master/texmf-dist/source/latex-dev/base/slides.ins index a5bbc579c33..a25c3f8fe25 100644 --- a/Master/texmf-dist/source/latex-dev/base/slides.ins +++ b/Master/texmf-dist/source/latex-dev/base/slides.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". @@ -96,7 +96,7 @@ extension .ins) which are part of the distribution. This is a generated file. -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -109,7 +109,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file may only be distributed together with a copy of the LaTeX base system. You may however distribute the LaTeX base system without @@ -138,7 +138,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -151,7 +151,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file may only be distributed together with a copy of the LaTeX base system. You may however distribute the LaTeX base system without diff --git a/Master/texmf-dist/source/latex-dev/base/slifonts.fdd b/Master/texmf-dist/source/latex-dev/base/slifonts.fdd index 5a0a4ee2473..abb950d6a1b 100644 --- a/Master/texmf-dist/source/latex-dev/base/slifonts.fdd +++ b/Master/texmf-dist/source/latex-dev/base/slifonts.fdd @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/syntonly.dtx b/Master/texmf-dist/source/latex-dev/base/syntonly.dtx index 98c8e4dfc36..6d4c710d0d2 100644 --- a/Master/texmf-dist/source/latex-dev/base/syntonly.dtx +++ b/Master/texmf-dist/source/latex-dev/base/syntonly.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2017 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/base/syntonly.ins b/Master/texmf-dist/source/latex-dev/base/syntonly.ins index c05eb92bf07..2adf6c3d789 100644 --- a/Master/texmf-dist/source/latex-dev/base/syntonly.ins +++ b/Master/texmf-dist/source/latex-dev/base/syntonly.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 1993-2017 +Copyright (C) 1993-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file has the LPPL maintenance status "maintained". diff --git a/Master/texmf-dist/source/latex-dev/base/tulm.fdd b/Master/texmf-dist/source/latex-dev/base/tulm.fdd index a5a212c6e11..dfda332ce4f 100644 --- a/Master/texmf-dist/source/latex-dev/base/tulm.fdd +++ b/Master/texmf-dist/source/latex-dev/base/tulm.fdd @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 2016-2017 +% Copyright 2016-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % @@ -30,7 +30,7 @@ %\iffalse This is a META comment % % File `cmfonts.fdd'. -% Copyright (C) 2016-2017 LaTeX3 Project +% Copyright (C) 2016-2019 LaTeX3 Project % % %<TUlmr>\ProvidesFile{tulmr.fd} diff --git a/Master/texmf-dist/source/latex-dev/base/tulm.ins b/Master/texmf-dist/source/latex-dev/base/tulm.ins index 1a48c866b4c..d3079568309 100644 --- a/Master/texmf-dist/source/latex-dev/base/tulm.ins +++ b/Master/texmf-dist/source/latex-dev/base/tulm.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 2016-2017 +%% Copyright (C) 2016-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -11,12 +11,12 @@ %% ------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3b +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt -%% and version 1.3b or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% @@ -48,7 +48,7 @@ reports for it can be opened at https://latex-project.org/bugs.html (but please observe conditions on bug reports sent to that address!) -Copyright 2016-2017 +Copyright (C) 2016-2019 The LaTeX3 Project and any individual authors listed elsewhere in this file. @@ -61,7 +61,7 @@ of this license or (at your option) any later version. The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX -version 2005/12/01 or later. +version 2008 or later. This file may only be distributed together with a copy of the LaTeX base system. You may however distribute the LaTeX base system without diff --git a/Master/texmf-dist/source/latex-dev/base/unpack.ins b/Master/texmf-dist/source/latex-dev/base/unpack.ins index 969028edfe0..5e6f36ca9dd 100644 --- a/Master/texmf-dist/source/latex-dev/base/unpack.ins +++ b/Master/texmf-dist/source/latex-dev/base/unpack.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 1993-2017 +%% Copyright (C) 1993-2019 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -16,7 +16,7 @@ %% The latest version of this license is in %% https://www.latex-project.org/lppl.txt %% and version 1.3c or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. +%% version 2008 or later. %% %% This file has the LPPL maintenance status "maintained". %% diff --git a/Master/texmf-dist/source/latex-dev/base/utf8ienc.dtx b/Master/texmf-dist/source/latex-dev/base/utf8ienc.dtx index d6c8f82f407..ea377297a58 100644 --- a/Master/texmf-dist/source/latex-dev/base/utf8ienc.dtx +++ b/Master/texmf-dist/source/latex-dev/base/utf8ienc.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993-2019 +% Copyright (C) 1993-2019 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -13,7 +13,7 @@ % The latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX -% version 2005/12/01 or later. +% version 2008 or later. % % This file has the LPPL maintenance status "maintained". % diff --git a/Master/texmf-dist/source/latex-dev/graphics/color.dtx b/Master/texmf-dist/source/latex-dev/graphics/color.dtx index d85b78349d8..8de7d013a37 100644 --- a/Master/texmf-dist/source/latex-dev/graphics/color.dtx +++ b/Master/texmf-dist/source/latex-dev/graphics/color.dtx @@ -2,7 +2,7 @@ % \iffalse % %% color.dtx Copyright (C) 1994--1999 David Carlisle -%% Copyright (C) 2005--2016 David Carlisle, LaTeX3 Project +%% Copyright (C) 2005-2019 David Carlisle, LaTeX3 Project %% %% This file is part of the Standard LaTeX `Graphics Bundle'. %% It may be distributed under the terms of the LaTeX Project Public diff --git a/Master/texmf-dist/source/latex-dev/graphics/drivers.dtx b/Master/texmf-dist/source/latex-dev/graphics/drivers.dtx index 07c201cf873..d693ebd27b0 100644 --- a/Master/texmf-dist/source/latex-dev/graphics/drivers.dtx +++ b/Master/texmf-dist/source/latex-dev/graphics/drivers.dtx @@ -3,7 +3,7 @@ % %% drivers.dtx Copyright (C) 1994 David Carlisle Sebastian Rahtz %% Copyright (C) 1995 1996 1997 1998 1999 David Carlisle -%% Copyright (C) 2000--2016 David Carlisle, LaTeX3 Project +%% Copyright (C) 2000-2019 David Carlisle, LaTeX3 Project %% %% This file is part of the Standard LaTeX `Graphics Bundle'. %% It may be distributed under the terms of the LaTeX Project Public diff --git a/Master/texmf-dist/source/latex-dev/graphics/epsfig.dtx b/Master/texmf-dist/source/latex-dev/graphics/epsfig.dtx index ba37d771cc2..f9197c7b1c9 100644 --- a/Master/texmf-dist/source/latex-dev/graphics/epsfig.dtx +++ b/Master/texmf-dist/source/latex-dev/graphics/epsfig.dtx @@ -2,7 +2,7 @@ % \iffalse % %% epsfig.dtx Copyright (C) 1994-1996 1999 Sebastian Rahtz -%% Copyright (C) 2000--2015,2017 David Carlisle, LaTeX3 Project +%% Copyright (C) 2000-2019 David Carlisle, LaTeX3 Project %% %% This file is part of the Standard LaTeX `Graphics Bundle'. %% It may be distributed under the terms of the LaTeX Project Public diff --git a/Master/texmf-dist/source/latex-dev/graphics/graphicx.dtx b/Master/texmf-dist/source/latex-dev/graphics/graphicx.dtx index aad8460ac5a..4134c4eed1f 100644 --- a/Master/texmf-dist/source/latex-dev/graphics/graphicx.dtx +++ b/Master/texmf-dist/source/latex-dev/graphics/graphicx.dtx @@ -2,7 +2,7 @@ % \iffalse % %% graphicx.dtx Copyright (C) 1994 David Carlisle Sebastian Rahtz -%% Copyright (C) 1995--2015,2017 David Carlisle, LaTeX3 Project +%% Copyright (C) 1995-2019 David Carlisle, LaTeX3 Project %% %% This file is part of the Standard LaTeX `Graphics Bundle'. %% It may be distributed under the terms of the LaTeX Project Public diff --git a/Master/texmf-dist/source/latex-dev/graphics/keyval.dtx b/Master/texmf-dist/source/latex-dev/graphics/keyval.dtx index f656961d0b4..1e1581eee36 100644 --- a/Master/texmf-dist/source/latex-dev/graphics/keyval.dtx +++ b/Master/texmf-dist/source/latex-dev/graphics/keyval.dtx @@ -1,7 +1,7 @@ % % \iffalse %% keyval.dtx Copyright (C) 1993 1994 1995 1997 1998 1999 David Carlisle -%% Copyright (C) 2000--2015 David Carlisle, LaTeX3 Project +%% Copyright (C) 2000-2019 David Carlisle, LaTeX3 Project %% %% This file is part of the Standard LaTeX `Graphics Bundle'. %% It may be distributed under the terms of the LaTeX Project Public diff --git a/Master/texmf-dist/source/latex-dev/graphics/lscape.dtx b/Master/texmf-dist/source/latex-dev/graphics/lscape.dtx index 733e183ee6c..a5a3dc3220f 100644 --- a/Master/texmf-dist/source/latex-dev/graphics/lscape.dtx +++ b/Master/texmf-dist/source/latex-dev/graphics/lscape.dtx @@ -2,7 +2,7 @@ % \iffalse % %% lscape.dtx Copyright (C) 1994 1999-2000 David Carlisle -%% Copyright (C) 2000--2015 David Carlisle, LaTeX3 Project +%% Copyright (C) 2000-2019 David Carlisle, LaTeX3 Project %% %% This file is part of the Standard LaTeX `Graphics Bundle'. %% It may be distributed under the terms of the LaTeX Project Public diff --git a/Master/texmf-dist/source/latex-dev/graphics/rotating.dtx b/Master/texmf-dist/source/latex-dev/graphics/rotating.dtx index 41bd399d4ed..149c19d049d 100644 --- a/Master/texmf-dist/source/latex-dev/graphics/rotating.dtx +++ b/Master/texmf-dist/source/latex-dev/graphics/rotating.dtx @@ -3,9 +3,9 @@ % % % File: rotating.dtx -%% Copyright 1995--1999 Sebastian Rahtz and Leonor Barroca -%% Copyright 2001--2003,2007--2009 Robin Fairbairns -%% Copyright 2016 LaTeX3 Project +%% Copyright (C) 1995--1999 Sebastian Rahtz and Leonor Barroca +%% Copyright (C) 2001--2003,2007--2009 Robin Fairbairns +%% Copyright (C) 2016-2019 LaTeX3 Project % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3c diff --git a/Master/texmf-dist/source/latex-dev/graphics/trig.dtx b/Master/texmf-dist/source/latex-dev/graphics/trig.dtx index 712db13ba2a..2b152578ad7 100644 --- a/Master/texmf-dist/source/latex-dev/graphics/trig.dtx +++ b/Master/texmf-dist/source/latex-dev/graphics/trig.dtx @@ -1,6 +1,6 @@ % \iffalse %% File: trig.dtx Copyright (C) 1993 1994 1995 1996 1997 1999 David Carlisle -%% Copyright (C) 2000--2015 David Carlisle, LaTeX3 Project +%% Copyright (C) 2000-2019 David Carlisle, LaTeX3 Project %% %% This file is part of the Standard LaTeX `Graphics Bundle'. %% It may be distributed under the terms of the LaTeX Project Public diff --git a/Master/texmf-dist/source/latex-dev/tools/afterpage.dtx b/Master/texmf-dist/source/latex-dev/tools/afterpage.dtx new file mode 100644 index 00000000000..3fa341aa531 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/afterpage.dtx @@ -0,0 +1,385 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% File: afterpage.dtx Copyright (C) 1994 1994 1995 David Carlisle +% +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{afterpage} +%<package> [2014/10/28 v1.08 After-Page Package (DPC)] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{afterpage} +\GetFileInfo{afterpage.sty} +\begin{document} +\title{The \textsf{afterpage} package\thanks{This file + has version number \fileversion, last + revised \filedate.}} +\author{David Carlisle} +\date{\filedate} +\MaintainedByLaTeXTeam{tools} +\maketitle +\DocInput{afterpage.dtx} +\end{document} +%</driver> +% \fi +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \changes{v1.00}{1993/01/25}{Initial version} +% \changes{v1.05}{1993/07/14}{First public version} +% \changes{v1.06}{1994/02/01}{Update for LaTeX2e} +% \changes{v1.07}{1994/05/23}{Documentation Changes} +% \changes{v1.08}{1995/10/27} +% {Use \cs{par} not \cs{endgraf}, for tools/1579} +% \changes{v1.08}{1995/10/27} +% {Try and do something sensible with nested \cs{clearpage}, +% for tools/1880} +% \changes{v1.08}{1995/10/27} +% {Try and do something sensible with footnotes, for tools/1884} +% +% +% This package implements a command, |\afterpage|, that causes the +% commands specified in its argument to be expanded after the current +% page is output.\footnote{This is really a pre-release, to see whether +% people like the idea of a command like this. This implementation is +% \emph{not} particularly robust. This implementation does not work in +% two column mode, and can get `confused' by \LaTeX's floating +% environments.} +% +% \begin{enumerate} +% \item Sometimes \LaTeX's float positioning mechanism gets overloaded, +% and all floating |figure|s and |table|s drift to the end of the +% document. One may flush out all the unprocessed floats by issuing a +% |\clearpage| command, but this has the effect of making the current +% page end prematurely. Now you can issue |\afterpage{\clearpage}| and +% the current page will be filled up with text as usual, but then a +% |\clearpage| command will flush out all the floats before the next +% text page begins. +% \item An earlier mechanism to help with float placement was the +% optional argument |[H]| (meaning {\bf HERE!}) which was originally +% added to the standard floating environments by |here.sty|, and is now +% provided by |float.sty|. However some |[H]| users have commented that +% they did not really mean `Here!' They actually wanted `Somewhere +% close'. This can now be achieved by\\ +% |\afterpage{\clearpage\begin{figure}[H] |\ldots +% |\end{figure}}|\\ +% This ensures that the figure is at the top of the next page. (The +% |\clearpage| stops any other figures drifting past the |[H]| figure.) +% \item Floating longtables. |longtable.sty| provides the |longtable| +% environment, a multi-page version of |tabular|. Many |longtable| users +% have told me that it is difficult to set the text surrounding the long +% table, and that they wanted a `floating' version. As, presumably, +% |longtable|s are long, they are probably too large to hold in memory, +% and float in the way that the |table| environment is floated, however +% if the table is in a separate file, say |ltfile.tex|, you can now +% use one of:\\ +% |\afterpage{\clearpage\input{ltfile}}|\\ +% |\afterpage{\clearpage\input{ltfile}\clearpage}|.\\ +% The first form lets text appear on the same page as the end of the +% longtable, the second ensures that the surrounding text starts again +% on a new page. +% \end{enumerate} +% +% \StopEventually{} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macro}{\afterpage} +% The token register used to save the old output routine. +% \begin{macrocode} +\newtoks\AP@output +\global\AP@output\expandafter{\the\output} +% \end{macrocode} +% +% A box register used to save any part of the next page which has +% already been processed. +% \begin{macrocode} +\newbox\AP@partial +% \end{macrocode} +% +% A box register used to save any footnote texts that are `tied' to +% the text that gets saved in |\AP@partial|. +% \begin{macrocode} +\newbox\AP@footins +% \end{macrocode} +% +% The following macro attempts to get safely into vertical mode, and +% then invokes a special output routine to grab the current page into +% |\AP@partial|. +% \begin{macrocode} +\def\AP@savetop{% +% \end{macrocode} +% Now begins a test to see what state we are in. |\AP@noindent| will +% be defined so as to return to this state (well, almost!) after +% afterpage has finished. +% \begin{macrocode} + \ifvmode +% \end{macrocode} +% Vertical mode. This is the simplest case, do nothing. +% \begin{macrocode} + \let\AP@noindent\empty + \else\ifhmode +% \end{macrocode} +% Horizontal mode. +% `Back out' into vertical mode, removing the indentation box as we go. +% If in fact there was no indentation box, the output routine was +% invoked by |\noindent| (what bad luck!) so we have to remember to +% re-insert the |\noindent| before the paragraph is seen again. +% |\everypar| tokens have already been inserted, so don't insert them +% again. +% \begin{macrocode} + \setbox\z@\lastbox + \edef\AP@noindent + {{\everypar{}\ifvoid\z@\noindent\else\indent\fi}}% + \par + \else +% \end{macrocode} +% The remaining (even worse) possibility that the output routine +% was triggered by the start of displaymath within a paragraph. +% +% Come out of displaymath with |$$|, then adjust the spacing (getting +% into vmode at the same time). |\AP@noindent| will restart display math +% later. |\everydisplay| tokens have already been inserted (they apply +% to the math list that will be started by |\AP@noindent|, even though +% they were triggered by the display math that was closed by the lines +% below!). Save the values |\prevgraf| and |\predisplaysize| for use in +% the re-started math list. +% \begin{macrocode} + \abovedisplayshortskip\z@\abovedisplayskip\z@ + \belowdisplayshortskip\z@\belowdisplayskip\z@ + \xdef\AP@disp{% + \predisplaysize\the\predisplaysize + \prevgraf\the\prevgraf\relax}% + $$\vskip-\baselineskip\vskip-\parskip + \edef\AP@noindent{% +% \end{macrocode} +% Do not insert |\everydisplay| tokens again. +% \begin{macrocode} + \toks@{\the\everydisplay}\everydisplay{}% +% \end{macrocode} +% Start displaymath mode with no spurious paragraph line above it. +% Restore |\prevgraf| and |\predisplaysize|. Use |\aftergroup| to +% restore the correct setting for |\everydisplay| after this display +% has finished. +% \begin{macrocode} + {\everypar{}\noindent}$$\AP@disp\aftergroup\noexpand\AP@ed}% + \fi\fi +% \end{macrocode} +% Now switch the output routine and remove everything from the current +% page into the box |\AP@partial|. +% \begin{macrocode} + \begingroup + \nointerlineskip\null + \output{% + \global\setbox\AP@partial\vbox{% + \unvbox\@cclv + \global\setbox\@ne\lastbox}% +% \end{macrocode} +% If the text that is saved in |\AP@partial| had footnotes, we'd +% better grab them as well otherwise they may come out on a page +% with the `afterpage' text, before the page that has the +% footnote mark! (Added at v1.08.) +% \begin{macrocode} + \global\setbox\AP@footins\box\footins}% +% \end{macrocode} +% Having defined the output routine, trigger it\ldots +% \begin{macrocode} + \eject + \endgroup} +% \end{macrocode} +% +% |\AP@| stores all the commands that must be executed after the page +% break. +% \begin{macrocode} +\let\AP@\relax +% \end{macrocode} +% +% Restore the |\everydisplay| register. |\ignorespaces| prevents a space +% or newline after |$$| creating rogue a indentation or paragraph. +% \begin{macrocode} +\def\AP@ed{\everydisplay\expandafter{\the\toks@}\ignorespaces} +% \end{macrocode} +% +% Remove the current vertical list, insert the commands |\AP@| +% at the top of the page, and then re-insert the saved text. +% \begin{macrocode} +\def\AP@@{% + \AP@savetop + \global\expandafter\let\expandafter\AP@\expandafter\relax\AP@ + \par +% \end{macrocode} +% The text originally at the top of this page is now stored in the box +% |\AP@partial|, including |\topskip| glue. Now we want to unbox +% |\AP@partial|, placing the baseline of the first row |\baselineskip| +% below the baseline of the last line coming from the afterpage text. +% If we assumed nothing has too much height or depth (and |\topskip| is +% rigid), it would be fairly trivial to position the contents of +% |\AP@partial| so that the baseline of the first row was +% |\baselineskip| below the last row just added. +% +% In this version, I thought it might be fun to try to exactly achieve +% the |\baselineskip|--or--|\lineskip| calculation that \TeX\ normally +% does internally. The call to |\addboxcontents| does the right thing +% (I hope). +% \begin{macrocode} + \addboxcontents\AP@partial +% \end{macrocode} +% Now re-insert any footnote text. This may not be quite the right +% place, as the text that has just been unboxed may break over a page +% in its new position. Also it may not be the right number if the text +% from |\afterpage| itself contains footnotes. Too bad! +% \begin{macrocode} + \ifvoid\AP@footins\else + \insert\footins{\unvbox\AP@footins}\fi +% \end{macrocode} +% Now repair things if we started off in horizontal mode. +% \begin{macrocode} + \AP@noindent} +% \end{macrocode} +% +% If |\AP@| is not |\relax| then the current page already has some +% `afterpage' commands, so just add the new commands to the end of the +% list. Otherwise save the commands in |\AP@|. (within a local group), +% and switch the output routine. (The new output routine just calls the +% old one if it is invoked by a \LaTeX{} float. +% \begin{macrocode} +\long\def\afterpage#1{% + \ifx\AP@\relax + \gdef\AP@{{#1\par}}% + \global\output{% + \the\AP@output + \ifnum\outputpenalty>-\@Mi + \global\output\expandafter{\the\AP@output}% + \aftergroup\AP@@ + \fi}% + \else + \expandafter\gdef\expandafter\AP@\expandafter{\AP@{#1\par}}% + \fi} +% \end{macrocode} +% +% If we have got to the end of the document or clearpage +% just put the stuff out without any trickery. +% \begin{macrocode} +\let\AP@clearpage\clearpage +\def\clearpage{% + \ifx\AP@\relax + \AP@clearpage + \else + \global\output\expandafter{\the\AP@output}% + \AP@clearpage +% \end{macrocode} +% At this point (since v1.08) Need to clear |\AP@| \emph{before} +% using its expansion, as otherwise hit an infinite loop. Sigh. +% \begin{macrocode} + \global\expandafter\let\expandafter\AP@\expandafter\relax + \expandafter\expandafter\AP@ + \fi} +\let\AP@enddocument\enddocument +\def\enddocument{% + \ifx\AP@\relax\else + \global\output\expandafter{\the\AP@output}% + \AP@clearpage + \global\expandafter\let\expandafter\AP@\expandafter\relax + \expandafter\expandafter\AP@ + \fi + \AP@enddocument} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\addboxcontents} +% Given a vbox |#1|, add to the current vertical list such that the end +% result is equivalent to the list that \TeX\ would have built had the +% contents of |#1| (apart from any initial glue) been added individually +% to the current list. + +% So essentially, the problem is that of unboxing |#1|, but replacing +% the glue at the top of |#1| with (something equivalent to) the +% |\baselineskip| or |\lineskip| glue that \TeX\ would normally have +% placed before the first box in |#1|. Also |\prevdepth| must be set at +% the end. +% \begin{macrocode} +\def\addboxcontents#1{{% +% \end{macrocode} +% Perhaps I shouldn't use grouping here, as I probably don't really want +% to save |#1|. If it is removed, |\splittopskip| and |\splitmaxdepth| +% would need to be restored by hand. +% +% First replace any glue at the top by |\vskip 0pt|. +% \begin{macrocode} + \splittopskip\z@ + \splitmaxdepth\maxdimen + \setbox#1\vbox{\break\unvbox#1}% + \setbox\z@\vsplit#1to\z@ +% \end{macrocode} +% Put the breakpoint back. +% \begin{macrocode} + \setbox#1\vbox{\break\unvbox#1}% +% \end{macrocode} +% Set |\skip@| to be height of |#1| (without top glue) +% \begin{macrocode} + \skip@\ht#1% +% \end{macrocode} +% Now make the first baseline of the first row be |\vsize| from the top. +% (This assumes that the first row has height less than |\vsize|.) +% \begin{macrocode} + \splittopskip\vsize + \setbox\z@\vsplit#1to\z@ +% \end{macrocode} +% Subtract the new height of |#1| from |\skip@|, and add back on +% |\splittopskip|, so |\skip@| is now the height of the first row of +% |#1| This may still be 0pt if (eg) a mark or whatsit is between the +% top glue and the first box. Save (this height${}-{}$|\splittopskip|) +% in |\skip\tw@|. +% \begin{macrocode} + \advance\skip@-\ht#1% + \skip\tw@\skip@ + \advance\skip@\splittopskip +% \end{macrocode} +% Now fake \TeX's |\baselineskip| calculation. +% \begin{macrocode} + \advance\skip@\prevdepth + \advance\skip@-\baselineskip + \advance\skip\tw@\ifdim-\skip@<\lineskiplimit\lineskip\else-\skip@\fi +% \end{macrocode} +% Finally add the glue. +% \begin{macrocode} + \vskip\skip\tw@ +% \end{macrocode} +% Now unbox the box, setting |\prevdepth| by hand, as |\unvbox| (unlike +% |\box|) does not automatically set it. +% \begin{macrocode} + \global\dimen@i\dp#1% + \unvbox#1}% + \prevdepth\dimen@i} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex-dev/tools/afterpage.ins b/Master/texmf-dist/source/latex-dev/tools/afterpage.ins new file mode 100644 index 00000000000..9764bdac6d8 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/afterpage.ins @@ -0,0 +1,75 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright (C) 1993-2019 +%% The LaTeX3 Project and any individual authors listed elsewhere +%% in this file. +%% +%% This file is part of the Standard LaTeX `Tools Bundle'. +%% ------------------------------------------------------- +%% +%% It may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% As this file contains legal notices, it is NOT PERMITTED to modify +%% this file in any way that the legal information placed into +%% generated files is changed (i.e., the files generated when the +%% original file is executed). This restriction does not apply if +%% (parts of) the content is reused in a different WORK producing its +%% own generated files. +%% +%% The list of all files belonging to the `Tools Bundle' is +%% given in the file `manifest.txt'. +%% +%% +%% --------------- start of docstrip commands ------------------ +%% +\input docstrip + +\keepsilent + +\usedir{tex/latex/tools} + +\preamble + +This is a generated file. + +The source is maintained by the LaTeX Project team and bug +reports for it can be opened at https://latex-project.org/bugs/ +(but please observe conditions on bug reports sent to that address!) + +Copyright (C) 1993-2019 +The LaTeX3 Project and any individual authors listed elsewhere +in this file. + +This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. +-------------------------------------------------------------------------- + +It may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This file may only be distributed together with a copy of the LaTeX +`Tools Bundle'. You may however distribute the LaTeX `Tools Bundle' +without such generated files. + +The list of all files belonging to the LaTeX `Tools Bundle' is +given in the file `manifest.txt'. + +\endpreamble + + +\generate{\file{afterpage.sty}{\from{afterpage.dtx}{package}}} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex-dev/tools/array.dtx b/Master/texmf-dist/source/latex-dev/tools/array.dtx new file mode 100644 index 00000000000..5590b0a1369 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/array.dtx @@ -0,0 +1,3092 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +%\iffalse % this is a METACOMMENT ! +% +%% Package `array' to use with LaTeX 2e +%% Copyright (C) 1989-1998 Frank Mittelbach, all rights reserved. +%<+package>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<+package>\providecommand\DeclareRelease[3]{} +%<+package>\providecommand\DeclareCurrentRelease[2]{} +%<+package> +%<+package>\DeclareRelease{}{2016-10-06}{array-2016-10-06.sty} +%<+package>\DeclareCurrentRelease{}{2019-10-01} +%<+package> +%<+package>\ProvidesPackage{array} +%<+package> [2019/08/31 v2.4l Tabular extension package (FMi)] +% +% \fi +% +%% +% +% +% \changes{v2.4g}{2018/04/07}{Renamed internal \cs{mcell@box} to +% \cs{ar@mcellbox} and \cs{align@mcell} to \cs{ar@align@mcell} +% to avoid conflict with makecell package} +% +% \changes{v2.4c}{2008/09/09}{(WR) Typo fix in documentation} +% +% \changes{v2.3c}{1995/11/02}{(DPC) minor doc changes} +% +% \changes{v2.3a}{1994/10/16}{Added code for \cs{firsthline} and +% friends} +% +% \changes{v2.2c}{1994/03/14}{removed check for \cs{@tfor} bug} +% +% \changes{v1.0b}{1987/06/04}{`@classi (faster), +% `@classvi (new) A in preamble means +% \&\& in `halign.} +% +% \changes{v1.1a}{1987/07/05}{New concept: +% preamblechar: c,l,r,C,L,R,A,p,t,{\tt !|},@,!!} +% \changes{v1.1b}{1987/09/21}{Again p like original \LaTeX{} and z for +% centered `parbox.} +% +% \changes{v1.2a}{1987/09/27}{Completely new implementation.} +% \changes{v1.2b}{1987/10/06}{{\tt !|} does no longer generate space at +% start or end of the preamble. Otherwise `hline +% is too long.} +% \changes{v1.2b}{1987/10/06}{Enlarged `@arstrutbox by 1pt (Test-Impl) +% with dimen `@strutheight.} +% \changes{v1.2c}{1987/10/22}{New dimen parameter `extrarowheight +% (default: 0pt).} +% \changes{v1.2c}{1987/10/22}{Enlarged `@arstrutbox by `extrarowheight. +% Thus you may avoid large characters to +% overprint a `hline.} +% \changes{v1.2c}{1987/10/22}{Introduced `m@th in `@array to allow +% non-zero values of `mathsurround.} +% \changes{v1.2d}{1987/11/02}{Completed the documentation.} +% \changes{v1.2e}{1987/11/03}{Bug fixed: A at start of preamble resulted +% in an error since `@mkpream generated +% `@arstrut \& ... as a preamble.} +% \changes{v1.2f}{1987/11/09}{`@testpach documented.} +% +% \changes{v1.3a}{1987/11/11}{Again a new implementation, with a new +% concept (cf. the documentation).} +% \changes{v1.3b}{1988/03/17}{`@decl expands now into `@empty, i.e., it +% disappears when the preamble is generated, +% except when the user specifies A\{\} or +% B\{\}.} +% +% \changes{v1.4a}{1988/03/18}{Test implementation of use of token +% registers in order to do without `protect.} +% \changes{v1.4b}{1988/03/19}{Changed erroneous class numbers: +% 5 -!> 6 +% 6 -!> 7 +% 7 -!> 5 +% Corresponding changes in the macros.} +% \changes{v1.4c}{1988/03/19}{Everything except p,z now works with token +% registers.} +% +% \changes{v1.9a}{1988/03/20}{Last (so I hope) major change: 1) Options +% B,A now called !>,<. These options now point +% to the column they modify.} +% \changes{v1.9a}{1988/03/20}{2) `protect is no longer necessary. But +% still the macro `@expast needs top be +% modified. `multicolumn still does not work.} +% \changes{v1.9b}{1988/04/29}{inserted missing `fi in `@testpach. +% Corrected \LaTeX bug in `@tfor.} +% \changes{v1.9c}{1988/05/07}{Re-introduced `@endpbox. +% `multicolumn now works!! Version number still +% 1.9 since the documentation is still not +% finished.} +% \changes{v1.9c}{1988/05/07}{1) `def `the@toks \{`the ...\} remaining +% only in `@mkpream. 2) Removed `@classiii and +% replaced by `save@decl.} +% \changes{v1.9c}{1988/05/07}{3) `insert@column contains only `@tempcnta +% and `count@ counters. 4) `@@startpbox and +% `@@endpbox now totally obsolete.} +% \changes{v1.9d}{1988/05/10}{Replaced `number by `the where the `toks +% registers' contents are used.} +% \changes{v1.9e}{1988/05/11}{Re-introduced `@xargarraycr and +% `@yargarraycr, since `endtemplate seems to +% be `outer.} +% \changes{v1.9f}{1988/05/20}{Small changes finally carried out: +% 1) `par!=`@empty. +% 2) \{..ifnum0!=!`\}... $\to$ `bgroup and +% analogously `egroup.} +% \changes{v1.9g}{1988/02/24}{Inserted again \{..ifnum0!=!`\}.., +% c.f. Appendix D of the \protect\TeX{}book.} +% \changes{v1.9h}{1988/06/28}{No longer necessary to read in the file +% twice.} +% \changes{v1.9i}{1988/06/28}{Corrected typo in german version.} +% \changes{v1.9j}{1988/11/23}{In a `r' column an extra `kern`z@ is +% needed.} +% \changes{v1.9j}{1988/11/23}{Otherwise the `hfil on the left side +% will be removed by the `unskip in +% `insert@column if the entry is empty.} +% \changes{v1.9k}{1988/06/28}{Corrected typo in german version.} +% \changes{v1.9k}{1989/01/16}{`begin{Macro} changed to `begin{macro} in +% documentation.} +% +% \changes{v2.0a}{1989/05/12}{{\tt\textbackslash @thetoks} changed to +% {\tt\textbackslash the@toks}.} +% \changes{v2.0a}{1989/05/12}{source changed to reflect new doc.sty +% conventions.} +% \changes{v2.0a}{1989/05/12}{t option renamed to p to be compatible to +% the original.} +% \changes{v2.0a}{1989/05/12}{File renamed from arraye.sty to +% array.sty.} +% \changes{v2.0b}{1989/05/17}{Three forgotten end macro added.} +% \changes{v2.0b}{1989/05/17}{All lines shortened to 72 or less.} +% \changes{v2.2a}{1994/02/03}{Upgrade to \LaTeXe} +% +% \DoNotIndex{\@depth,\@ehc,\@fortmp,\@height,\@ifnextchar,\@ifstar} +% \DoNotIndex{\@ifundefined,\@ne,\@nil,\@tempa,\@tempb} +% \DoNotIndex{\@tempcnta,\@tempd,\@tempdima,\@whilenum,\@width,\\} +% \DoNotIndex{\@tforloop} +% \DoNotIndex{\advance} +% \DoNotIndex{\baselineskip,\begingroup,\bgroup} +% \DoNotIndex{\cr,\crcr,\csname} +% \DoNotIndex{\def,\do,\docdate,\dp} +% \DoNotIndex{\edef,\egroup,\else,\endcsname,\endinput,\expandafter} +% \DoNotIndex{\fi,\filedate,\fileversion} +% \DoNotIndex{\gdef} +% \DoNotIndex{\hbox,\hfil,\hsize,\hskip,\ht} +% \DoNotIndex{\if,\ifcase,\ifdim,\ifnum,\ifx,\ignorespaces} +% \DoNotIndex{\kern} +% \DoNotIndex{\leavevmode,\let,\lineskip} +% \DoNotIndex{\m@ne,\multispan} +% \DoNotIndex{\newcount,\newdimen,\noalign} +% \DoNotIndex{\or} +% \DoNotIndex{\relax} +% \DoNotIndex{\setbox,\space,\strutbox} +% \DoNotIndex{\tabskip,\thr@@,\the,\toks,\toks@,\tw@,\typeout} +% \DoNotIndex{\unhcopy,\unskip} +% \DoNotIndex{\vbox,\vcenter,\vline,\vrule,\vtop,\vskip} +% \DoNotIndex{\xdef} +% \DoNotIndex{\z@} +% +% \GetFileInfo{array.sty} +% +% \title{A new implementation of \LaTeX's \textsf{tabular} +% and \textsf{array} environment\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{Frank Mittelbach +% \and +% David Carlisle\thanks{David kindly agreed on the inclusion +% of the \texttt{\textbackslash{}newcolumntype} implementation, +% formerly in +% \texttt{newarray.sty} into this package }} +% +% \date{Printed \today} +% +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% \MakeShortVerb{\=} +% +% \begin{abstract} +% This article describes an extended implementation of the \LaTeX\ +% \textsf{array}-- and \textsf{tabular}--environments. The special +% merits of this implementation are further options to format columns +% and the fact that fragile \LaTeX--commands don't have to be +% =\protect='ed any more within those environments. +% +% The major part of the code for this package dates back to 1988---so +% does some of its documentation. +% \end{abstract} +% +% +% +% \section{Introduction} +% +% This new implementation of the \textsf{array}-- and +% \textsf{tabular}--environments is part of a larger project in which +% we are trying to improve the \LaTeX\--code in some aspects and to +% make \LaTeX\ even easier to handle. +% +% The reader should be familiar with the general structure of the +% environments +% mentioned above. Further information can be found in +% \cite{bk:lamport} and \cite{bk:GMS94}. +% The additional options which can be used in the +% preamble as well as those which now have a slightly different meaning +% are described in table~\ref{tab:opt}. +% +% \DescribeMacro\extrarowheight +% Additionally we introduce a new +% parameter called =\extrarowheight=. If it takes a positive +% length, the value of the parameter is added to the normal height of +% every row of the table, while +% the depth will remain the same. This is important for tables +% with horizontal lines because those lines normally touch the +% capital letters. +% For example, we used =\setlength{\extrarowheight}{1pt}= +% in table~\ref{tab:opt}. +% +% \begin{table}[!t] +% \begin{center} +% \setlength{\extrarowheight}{1pt} +% \begin{tabular}{|>{\tt}c|m{9cm}|} +% \hline +% \multicolumn{2}{|c|}{Unchanged options}\\ +% \hline +% l & Left adjusted column. \\ +% c & Centered adjusted column. \\ +% r & Right adjusted column. \\ +% p\{width\} & Equivalent to =\parbox[t]{width}=. \\ +% @\{decl.\} & Suppresses inter-column space and inserts +% \texttt{decl.}\ instead. \\ +% \hline +% \multicolumn{2}{|c|}{New options}\\ +% \hline +% m\{width\} & Defines a column of width \texttt{width}. +% Every entry will be centered in proportion to +% the rest of the line. It is somewhat like +% =\parbox{width}=. \\ +% \hline +% b\{width\} & Coincides with =\parbox[b]{width}=. \\ +% \hline +% >\{decl.\} & Can be used before an \texttt{l}, \texttt{r}, +% \texttt{c}, \texttt{p}, \texttt{m} or a +% \texttt{b} option. It inserts \texttt{decl.}\ +% directly in front of the entry of the column. +% \\ +% \hline +% <\{decl.\} & Can be used after an \texttt{l}, \texttt{r}, +% \texttt{c}, =p{..}=, =m{..}= or a =b{..}= +% option. It inserts \texttt{decl.}\ right +% after the entry of the column. \\ +% \hline +% | & Inserts a vertical line. The distance between +% two columns will be enlarged by the width of +% the line +% in contrast to the original definition of +% \LaTeX. \\ +% \hline +% !\{decl.\} & Can be used anywhere and corresponds with the +% \texttt{|} option. The difference is that +% \texttt{decl.} is inserted instead of a +% vertical line, so this option doesn't +% suppress the normally inserted space between +% columns in contrast to =@{...}=.\\ +% \hline\hline +% w\{align\}\{width\} & Sets the cell content in a box of the +% specified \texttt{width} aligned according to +% the \texttt{align} parameter which could be +% either \texttt{l}, \texttt{c} or +% \texttt{r}. Works essentially like +% =\makebox[=width=][=align=]{=cell=}= so +% silently overprints if the cell content is +% wider than the specified width. If that is +% not desired use \texttt{W} instead.\\ +% \hline +% W\{align\}\{width\} & Like \texttt{w} but spits out an overfull +% box warning (and an overfullrule marker in +% draft mode) when the cell content is too wide +% to fit. This also means that the alignment is +% different if there is too much material, +% because it then always protrudes to the right!\\ +% \hline +% \end{tabular} +% \end{center} +% \caption{The preamble options.} \label{tab:opt} +% \end{table} +% +% +% We will discuss a few examples using the new preamble options before +% dealing with the implementation. +% \begin{itemize} +% \item +% If you want to use a special font (for example =\bfseries=) in a +% flushed left column, this can be done with =>{\bfseries}l=. You +% do not have to begin every entry of the column with =\bfseries= +% any more. +% \item +% In columns which have been generated with \texttt{p}, \texttt{m} +% or \texttt{b}, the default value of =\parindent= is +% \textsf{0pt}. +% This can be changed with \\ +% =>{\setlength{\parindent}{1cm}}p=. +% \item +% The \texttt{>}-- and \texttt{<}--options were originally +% developed for the following application: +% =>{$}c<{$}= generates a column in math +% mode in a \textsf{tabular}--environment. If you use this type +% of a preamble in an \textsf{array}--environment, you get a +% column in LR mode because the additional \$'s cancel the +% existing \$'s. +% \item +% One can also think of more complex applications. A problem +% which has +% been mentioned several times in \TeX{}hax can be solved with +% =>{\centerdots}c=\linebreak[0]=<{\endcenterdots}=. +% To center decimals at their +% decimal points you (only?) have to define the following macros: +% \begin{verbatim} +%{\catcode`\.\active\gdef.{\egroup\setbox2\hbox\bgroup}} +%\def\centerdots{\catcode`\.\active\setbox0\hbox\bgroup} +%\def\endcenterdots{\egroup\ifvoid2 \setbox2\hbox{0}\fi +% \ifdim \wd0>\wd2 \setbox2\hbox to\wd0{\unhbox2\hfill}\else +% \setbox0\hbox to\wd2{\hfill\unhbox0}\fi +% \catcode`\.12 \box0.\box2} +%\end{verbatim} +% Warning: The code is bad, it doesn't work with more than one +% dot in a cell and doesn't work when the tabular is used in the +% argument of some other command. A much better version is +% provided in the \texttt{dcolumn.sty} by David Carlisle. +% \item +% Using =c!{\hspace{1cm}}c= you get space between two +% columns which is enlarged by one centimeter, while +% =c@{\hspace{1cm}}c= gives you exactly one centimeter +% space between two columns. +% +% \item +% A declaration like =w{l}{3cm}= (or even shorter =wl{3cm}=) +% works like an =l= column except that the width will always be +% =3cm= regardless of the cell content. Same with =w{c}= or +% =w{r}=. This means that it is easy to set up tables in which all +% columns have predefined widths. +% \end{itemize} +% +% \subsection{Defining new column specifiers} +% +% \DeleteShortVerb{\=} +% \MakeShortVerb{\"} +% \DescribeMacro{\newcolumntype} +% Whilst it is handy to be able to type +% \begin{quote} +% ">{"\meta{some declarations}"}{c}<{"\meta{some more +% declarations}"}" +% \end{quote} +% if you have a one-off column in a table, it is rather inconvenient +% if you often use columns of this form. The new version allows you +% to define a new column specifier, say \texttt{x}, which will expand to +% the primitives column specifiers.\footnote{This command was named +% \texttt{\textbackslash{}newcolumn} in the \texttt{newarray.sty}. +% At the moment \texttt{\textbackslash{}newcolumn} is still supported +% (but gives a warning). In later releases it will vanish.} Thus we +% may define +% \begin{quote} +% "\newcolumntype{x}{>{"\meta{some declarations}"}{c}<{"\meta{some +% more declarations}"}}"\hspace*{-3cm} ^^A no overfull from this line +% \end{quote} +% One can then use the \texttt{x} column specifier in the preamble +% arguments of all \texttt{array} or \texttt{tabular} environments in +% which you want columns of this form. +% +% It is common to need math-mode and LR-mode columns in the same +% alignment. If we define: +% \begin{quote} +% "\newcolumntype{C}{>{$}c<{$}}" \\ +% "\newcolumntype{L}{>{$}l<{$}}" \\ +% "\newcolumntype{R}{>{$}r<{$}}" +% \end{quote} +% Then we can use \texttt{C} to get centred LR-mode in an +% \texttt{array}, or centred math-mode in a \texttt{tabular}. +% +% The example given above for `centred decimal points' could be +% assigned to a \texttt{d} specifier with the following command. +% \begin{quote} +% "\newcolumntype{d}{>{\centerdots}c<{\endcenterdots}}" +% \end{quote} +% +% The above solution always centres the dot in the +% column. This does not look too good if the column consists of large +% numbers, but to only a few decimal places. An alternative definition +% of a \texttt{d} column is +% \begin{quote} +% "\newcolumntype{d}[1]{>{\rightdots{#1}}r<{\endrightdots}}" +% \end{quote} +% where the appropriate macros in this case are:\footnote{The package +% \texttt{dcolumn.sty} contains more robust macros based on these +% ideas.} +% \begin{verbatim} +% \def\coldot{.}% Or if you prefer, \def\coldot{\cdot} +% {\catcode`\.=\active +% \gdef.{$\egroup\setbox2=\hbox to \dimen0 \bgroup$\coldot}} +% \def\rightdots#1{% +% \setbox0=\hbox{$1$}\dimen0=#1\wd0 +% \setbox0=\hbox{$\coldot$}\advance\dimen0 \wd0 +% \setbox2=\hbox to \dimen0 {}% +% \setbox0=\hbox\bgroup\mathcode`\.="8000 $} +% \def\endrightdots{$\hfil\egroup\box0\box2} +%\end{verbatim} +% Note that "\newcolumntype" takes the same optional argument as +% "\newcommand" which declares the number of arguments of the column +% specifier being defined. Now we can specify "d{2}" in our preamble +% for a column of figures to at most two decimal places. +% +% A rather different use of the "\newcolumntype" system takes +% advantage of the fact that the replacement text in the +% "\newcolumntype" command may refer to more than one column. Suppose +% that a document contains a lot of \texttt{tabular} environments that +% require the same preamble, but you wish to experiment with different +% preambles. Lamport's original definition allowed you to do the +% following (although it was probably a mis-use of the system). +% \begin{quote} +% "\newcommand{\X}{clr}"\\ +% "\begin{tabular}{\X}" \ldots +% \end{quote} +% \texttt{array.sty} takes great care \textbf{not} to expand the +% preamble, and so the above does not work with the new scheme. With +% the new version this functionality is returned: +% \begin{quote} +% "\newcolumntype{X}{clr}"\\ +% "\begin{tabular}{X}" \ldots +% \end{quote} +% +% The replacement text in a "\newcolumntype" command may refer to any of +% the primitives of \texttt{array.sty} see table \ref{tab:opt} on page +% \pageref{tab:opt}, or to any new letters defined in other +% "\newcolumntype" commands. +% +% +% \DescribeMacro{\showcols}A list of all the currently active +% "\newcolumntype" definitions is sent to the terminal and log file if +% the "\showcols" command is given. +% +% +% \subsection{Special variations of \texttt{\textbackslash hline}} +% +% The family of \texttt{tabular} environments allows +% vertical positioning with respect to the baseline of +% the text in which the environment appears. By default the +% environment appears centered, but this can be changed to +% align with the first or last line in the environment by +% supplying a \texttt{t} or \texttt{b} value to the +% optional position argument. However, this does not work +% when the first or last element in the environment is a +% "\hline" command---in that case the environment is +% aligned at the horizontal rule. +% +% \pagebreak[3] +% +% Here is an example: +% \begin{center} +% \begin{minipage}[t]{.4\linewidth} +% Tables +% \begin{tabular}[t]{l} +% with no\\ hline \\ commands \\ used +% \end{tabular} versus \\ tables +% \begin{tabular}[t]{|l|} +% \hline +% with some \\ hline \\ commands \\ +% \hline +% \end{tabular} used. +% \end{minipage} +% \begin{minipage}[t]{.5\linewidth} +% \begin{verbatim} +% Tables +% \begin{tabular}[t]{l} +% with no\\ hline \\ commands \\ used +% \end{tabular} versus tables +% \begin{tabular}[t]{|l|} +% \hline +% with some \\ hline \\ commands \\ +% \hline +% \end{tabular} used. +% \end{verbatim} +% \end{minipage} +% \end{center} +% +% \DescribeMacro\firsthline +% \DescribeMacro\lasthline +% Using "\firsthline" and "\lasthline" will +% cure the problem, and the tables will align properly as long +% as their first or last line does not contain extremely large +% objects. +% \begin{center} +% \begin{minipage}[t]{.4\linewidth} +% Tables +% \begin{tabular}[t]{l} +% with no\\ line \\ commands \\ used +% \end{tabular} versus \\ tables +% \begin{tabular}[t]{|l|} +% \firsthline +% with some \\ line \\ commands \\ +% \lasthline +% \end{tabular} used. +% \end{minipage} +% \begin{minipage}[t]{.5\linewidth} +% \begin{verbatim} +% Tables +% \begin{tabular}[t]{l} +% with no\\ line \\ commands \\ used +% \end{tabular} versus tables +% \begin{tabular}[t]{|l|} +% \firsthline +% with some \\ line \\ commands \\ +% \lasthline +% \end{tabular} used. +% \end{verbatim} +% \end{minipage} +% \end{center} +% \DescribeMacro\extratabsurround +% The implementation of these two commands contains an extra +% dimension, which is called "\extratabsurround", to add some +% additional space at the top and the bottom of such an environment. +% This is useful if such tables are nested. +% +% \section{Final Comments} +% +% \subsection{Handling of rules} +% +% There are two possible approaches to the handling of horizontal and +% vertical rules in tables: +% \begin{enumerate} +% \item rules can be placed into the available space without +% enlarging the table, or +% \item rules can be placed between columns or rows thereby enlarging +% the table. +% \end{enumerate} +% \texttt{array.sty} implements the second possibility while the +% default implementation in the \LaTeX{} kernel implements the first +% concept. Both concepts have their merits but one has to be aware of +% the individual implications. +% \begin{itemize} +% \item +% With standard \LaTeX{} adding rules to a table will not affect the +% width or height of the table (unless double rules are used), e.g., +% changing a preamble from \verb=lll= to \verb=l|l|l= does not +% affect the document other than adding rules to the table. In +% contrast, with \texttt{array.sty} a table that just fit the +% \verb=\textwidth= might now produce an overfull box. +% \item +% With standard \LaTeX{} modifying the width of rules could result +% in ugly looking tables because without adjusting the +% \verb=\tabcolsep=, etc.\ the space between rule and column could +% get too small (or too large). In fact even overprinting of text is +% possible. In contrast, with \texttt{array.sty} modifying any such +% length usually works well as the actual visual white space (from +% \verb=\tabcolsep=, etc.) does not depend on the width of the +% rules. +% \item +% With standard \LaTeX{} boxed tabulars actually have strange +% corners because the horizontal rules end in the middle of the +% vertical ones. This looks very unpleasant when a large +% \verb=\arrayrulewidth= is chosen. In that case a simple table like +%\begin{verbatim} +%\setlength{\arrayrulewidth}{5pt} +%\begin{tabular}{|l|} +% \hline A \\ \hline +%\end{tabular} +%\end{verbatim} +% will produce something like +% \begin{center} +%\setlength{\arrayrulewidth}{5pt} +%\begin{tabular}{@{}l@{}} +% \hline \null\hskip-.5\arrayrulewidth\vline +% \hskip\tabcolsep +% A\hskip\tabcolsep +% \vline\hskip-.5\arrayrulewidth\null \\ \hline +%\end{tabular} +% \quad +% instead of +% \quad +%\begin{tabular}{|l|} +% \hline A \\ \hline +%\end{tabular} +% \end{center} +% \end{itemize} +% +% \subsection{Comparisons with older versions of \texttt{array.sty}} +% +% There are some differences in the way version 2.1 treats incorrect +% input, even if the source file does not appear to use any of the +% extra features of the new version. +% \begin{itemize} +% \item A preamble of the form "{wx*{0}{abc}yz}" was treated by +% versions prior to 2.1 as "{wx}". Version 2.1 treats it as "{wxyz}" +% \item An incorrect positional argument such as \texttt{[Q]} was +% treated as \texttt{[c]} by \texttt{array.sty}, but is now treated as +% \texttt{[t]}. +% \item A preamble such as "{cc*{2}}" with an error in +% a $*$-form will generate different errors in the new version. In +% both cases the error message is not particularly helpful to the +% casual user. +% \item Repeated \texttt{<} or \texttt{>} constructions +% generated an error in earlier versions, but are now allowed in +% this package. ">{"\meta{decs1}"}>{"\meta{decs2}"}" is treated the +% same as ">{"\meta{decs2}\meta{decs1}"}". +% \item The "\extracolsep" +% command does not work with the old versions of \texttt{array.sty}, +% see the comments in \texttt{array.bug}. With version 2.1 +% "\extracolsep" may again be used in \texttt{@}-expressions as in +% standard \LaTeX, and also in \texttt{!}-expressions (but see the +% note below). +% \end{itemize} +% +% Prior to version 2.4f the space added by the optional argument to "\\" +% was added inside an m-cell if the last column was of type +% \texttt{m}. As a result that cell was vertically centered with that +% space inside, resulting in a strange offset. Since 2.4f, this space +% is now added after centering the cell. +% +% A similar problem happened when "\extrarowheight" was used. For that +% reason m-cells now manually position the cell content which +% allows to ignore this extra space request during the vertical aligment. +% +% +% \subsection{Bugs and Features} +% +% \begin{itemize} +% \item Error messages generated when parsing the column specification +% refer to the preamble argument \textbf{after} it has been re-written +% by the "\newcolumntype" system, not to the preamble entered by the +% user. This seems inevitable with any system based on +% pre-processing and so is classed as a \textbf{feature}. +% +% \item The treatment of multiple \texttt{<} or \texttt{>} +% declarations may seem strange at first. Earlier implementations +% treated ">{"\meta{decs1}"}>{"\meta{decs2}"}" the same as +% ">{"\meta{decs1}\meta{decs2}"}". However this did not give the +% user the opportunity of overriding the settings of a +% "\newcolumntype" defined using these declarations. For example, +% suppose in an \texttt{array} environment we use a \texttt{C} +% column defined as above. The \texttt{C} specifies a centred text +% column, however ">{\bfseries}C", which re-writes to +% ">{\bfseries}>{$}c<{$}" would not specify a bold column as might +% be expected, as the preamble would essentially expand to +% "\hfil$\bfseries$#$ $\hfil" and so the column entry would not be in the +% scope of the "\bfseries"\,! The present version switches the order +% of repeated declarations, and so the above example now produces a +% preamble of the form "\hfil$" "$\bfseries#$" "$\hfil", and the +% dollars cancel each other out without limiting the scope of the +% "\bfseries". +% +% \item The use of "\extracolsep" has been subject to the following +% two restrictions. There must be at most one "\extracolsep" +% command per "@", or "!" expression and the command must be +% directly entered into the "@" expression, not as part of a macro +% definition. Thus "\newcommand{\ef}{\extracolsep{\fill}}" \ldots +% "@{\ef}" does not work with this package. However you can use +% something like +% "\newcolumntype{e}{@{\extracolsep{\fill}}" instead. +% +% \item As noted by the \LaTeX{} book, for the purpose of +% "\multicolumn" each column with the exception of the first one +% consists of the entry and the \emph{following} inter-column +% material. This means that in a tabular with the preamble +% "|l|l|l|l|" input such as "\multicolumn{2}{|c|}" in +% anything other than the first column is incorrect. + +% In the standard array/tabular implementation this error is not so +% noticeable as that version contains negative spacing so that each +% "|" takes up no horizontal space. But since in this package the +% vertical lines take up their natural width one sees two lines if +% two are specified. +% +% \end{itemize} +% +% +% +% \changes{v2.2b}{1994/02/04}{Removed interactive prompt} +% +% \StopEventually{ +% +% +% \begin{thebibliography}{1} +% \bibitem{bk:GMS94} \textsc{M.~Goossens}, \textsc{F.~Mittelbach} +% and \textsc{A.~Samarin}. +% \newblock The \LaTeX{} Companion. +% \newblock +% Addison-Wesley, Reading, Massachusetts, 1994. +% \bibitem{bk:knuth} \textsc{D. E. Knuth}. +% \newblock The \TeX{}book (Computers \& Typesetting Volume A). +% \newblock +% Addison-Wesley, Reading, Massachusetts, 1986. +% \bibitem{bk:lamport} \textsc{L. Lamport}. +% \newblock +% \LaTeX\ --- A Document Preparation System. +% \newblock +% Addison-Wesley, Reading, Massachusetts, 1986. +% \end{thebibliography} +% +% } ^^A end of \StopEventually +% +% +% +% +% \section{The documentation driver file} +% +% The first bit of code contains the documentation driver file for +% \TeX{}, i.e., the file that will produce the documentation you are +% currently reading. It will be extracted from this file by the +% \texttt{docstrip} program. +% \begin{macrocode} +%<*driver> +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\documentclass{ltxdoc} + +\AtBeginDocument{\DeleteShortVerb{\|}} % undo the default is not used + + \usepackage{array} + + % Allow large table at bottom + \renewcommand{\bottomfraction}{0.7} + +\EnableCrossrefs + %\DisableCrossrefs % Say \DisableCrossrefs if index is ready + +\RecordChanges % Gather update information + +\CodelineIndex % Index code by line number + + %\OnlyDescription % comment out for implementation details + %\OldMakeindex % use if your MakeIndex is pre-v2.9 +\begin{document} + \DocInput{array.dtx} +\end{document} +%</driver> +% \end{macrocode} +% +% +% \section{The construction of the preamble} +% +% \DeleteShortVerb{\"} +% \MakeShortVerb{\=} +% +% It is obvious that those environments will consist mainly of an +% =\halign=, because \TeX\ typesets tables using this primitive. +% That is why we will now take a look at the algorithm which determines +% a preamble for a =\halign= starting with a given user preamble +% using the options mentioned above. +% +% +% The current version is defined at the top of the file looking +% something like this +% \begin{macrocode} +%<*package> +%\NeedsTeXFormat{LaTeX2e}[1994/05/13] +%\ProvidesPackage{array}[\filedate\space version\fileversion] +% \end{macrocode} +% +% The most interesting macros of this implementation are without doubt +% those which are responsible for the construction of the preamble for +% the =\halign=. The underlying algorithm was developed by +% \textsc{Lamport} (resp.\ \textsc{Knuth}, see texhax V87\#??), and it +% has been extended and improved. +% +% The user preamble will be read \textsf{token} by \textsf{token}. A +% \textsf{token} is a single character like \texttt{c} or a block +% enclosed in ={...}=. For example the preamble of +% =\begin{tabular}=\linebreak[0]={lc||c@{\hspace{1cm}}}= consists of +% the \textsf{token} \texttt{l}, \texttt{c}, \texttt{|}, \texttt{|}, +% \texttt{@} and =\hspace{1cm}=. +% +% The currently used \textsf{token} and the one, used before, are needed +% to decide on how the construction of the preamble has to be +% continued. +% In the example mentioned above the \texttt{l} causes the preamble +% to begin with =\hskip\tabcolsep=. Furthermore +% =# \hfil= would be appended to define a flush left column. +% The next \textsf{token} is a \texttt{c}. Because it was preceded by an +% \texttt{l} it generates a new column. This is done with +% =\hskip \tabcolsep & \hskip \tabcolsep=. The column which is to +% be centered will be appended with =\hfil # \hfil=. +% The \textsf{token} \texttt{|} would then add a space of +% =\hskip \tabcolsep= +% and a vertical line because the last +% \textsf{tokens} was a \texttt{c}. +% The following \textsf{token} \texttt{|} would only add a space +% =\hskip \doublerulesep= because it was preceded by the +% \textsf{token} \texttt{|}. We will not discuss our example further but +% rather take a look at the general case of constructing preambles. +% +% The example shows that the desired preamble for the +% =\halign= can be constructed as soon as the action of all +% combinations +% of the preamble \textsf{tokens} are specified. There are 18 such +% \textsf{tokens} +% so we have $19 \cdot 18 \string= 342$ combinations if we count the +% beginning of +% the preamble as a special \textsf{token}. Fortunately, there are many +% combinations which generate the same spaces, so we can define +% \textsf{token} classes. We will identify a +% \textsf{token} within a class with a number, so we can insert the +% formatting (for example of a column). +% Table~\ref{tab:Klassen} lists all \textsf{token} classes and +% their corresponding numbers. +% \begin{table}[ht] +% \begin{center} +% \begin{tabular}[t]{>{\ttfamily}ccc} +% \textsf{token} & =\@chclass= & =\@chnum= \\[2mm] +% c & 0 & 0 \\ +% l & 0 & 1 \\ +% r & 0 & 2 \\ +% p-arg & 0 & 3 \\ +% t-arg & 0 & 4 \\ +% b-arg & 0 & 5 \\ +% | & 1 & 0 \\ +% !-arg & 1 & 1 \\ +% <-arg & 2 & --- \\ +% >-arg & 3 & --- +% \end{tabular} +% \kern3mm \vrule \kern3mm% +% \begin{tabular}[t]{>{\ttfamily}ccc} +% \textsf{token} & =\@chclass= & =\@chnum= \\[2mm] +% Start & 4 & --- \\ +% @-arg & 5 & --- \\ +% ! & 6 & --- \\ +% @ & 7 & --- \\ +% < & 8 & --- \\ +% > & 9 & --- \\ +% p & 10 & 3 \\ +% t & 10 & 4 \\ +% b & 10 & 5 +% \end{tabular} +% \end{center} +% \caption{Classes of preamble \textsf{tokens}} +% \label{tab:Klassen} +% \end{table} +% +% +% \begin{macro}{\@chclass} +% \begin{macro}{\@chnum} +% \begin{macro}{\@lastchclass} +% The class and the number of the current \textsf{token} are saved in +% the +% \textsf{count} registers =\@chclass= +% and =\@chnum=, while the class of the previous +% \textsf{token} is stored in the +% \textsf{count} register =\@lastchclass=. +% All of the mentioned registers are already allocated in +% \texttt{latex.tex}, +% which is the reason why the following three lines of code are +% commented out. +% Later throughout the text I will not mention it again explicitly +% whenever I use a =%= sign. These parts are already defined in +% \texttt{latex.tex}. +% \begin{macrocode} +% \newcount \@chclass +% \newcount \@chnum +% \newcount \@lastchclass +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% +% \begin{macro}{\@addtopreamble} +% We will save the already constructed preamble for +% the =\halign= +% in the global macro =\@preamble=. This will then be +% enlarged with +% the command =\@addtopreamble=. +% \begin{macrocode} +\def\@addtopreamble#1{\xdef\@preamble{\@preamble #1}} +% \end{macrocode} +% \end{macro} +% +% +% +% +% +% \subsection{The character class of a \textsf{token}} +% +% \begin{macro}{\@testpach} +% \changes{v2.0a}{1989/05/12}{p option renamed to m (middle).} +% \changes{v2.0a}{1989/05/12}{t option renamed to p to be compatible to +% the original.} +% With the help of =\@lastchclass= we can now define a macro +% which determines the class and the number of a given preamble +% \textsf{token} +% and assigns them to the registers +% =\@chclass= and =\@chnum=. +% \changes{v2.0f}{1992/02/29}{Argument removed since implicitly known} +% \begin{macrocode} +\def\@testpach{\@chclass +% \end{macrocode} +% First we deal with the cases in which the \textsf{token} +% (=#1=) is the argument of \texttt{!}, \texttt{@}, \texttt{<} or +% \texttt{>}. We can see this from the value of =\@lastchclass=: +% \begin{macrocode} + \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else + \ifnum \@lastchclass=7 5 \else + \ifnum \@lastchclass=8 \tw@ \else + \ifnum \@lastchclass=9 \thr@@ +% \end{macrocode} +% Otherwise we will assume that the \textsf{token} belongs to the +% class $0$ +% and assign the corresponding number to =\@chnum= if our +% assumption is correct. +% \begin{macrocode} + \else \z@ +% \end{macrocode} +% If the last \textsf{token} was a \texttt{p}, \texttt{m} or a +% \texttt{b}, =\@chnum= already has the right value. This is the +% reason for the somewhat curious choice of the \textsf{token} +% numbers in class $10$. +% \begin{macrocode} + \ifnum \@lastchclass = 10 \else +% \end{macrocode} +% Otherwise we will check if =\@nextchar= is either a \texttt{c}, +% \texttt{l} or an \texttt{r}. Some applications change the +% catcodes of certain characters like ``\texttt{@}'' in +% \texttt{amstex.sty}. As a result the tests below would fail since +% they assume non-active character tokens. Therefore we evaluate +% =\@nextchar= once thereby turning the first token of its +% replacement text into a char. At this point here this should have +% been the only char present in =\@nextchar= which put into via a +% =\def=. +% \changes{v2.0f}{1992/02/29}{Ensure to test a char which is not active} +% \begin{macrocode} + \edef\@nextchar{\expandafter\string\@nextchar}% + \@chnum + \if \@nextchar c\z@ \else + \if \@nextchar l\@ne \else + \if \@nextchar r\tw@ \else +% \end{macrocode} +% If it is a different \textsf{token}, we know that the class was +% not $0$. We assign the value $0$ to =\@chnum= because this value +% is needed for the \texttt{|}--\textsf{token}. Now we must check +% the remaining classes. Note that the value of =\@chnum= is +% insignificant here for most classes. +% \begin{macrocode} + \z@ \@chclass + \if\@nextchar |\@ne \else + \if \@nextchar !6 \else + \if \@nextchar @7 \else + \if \@nextchar <8 \else + \if \@nextchar >9 \else +% \end{macrocode} +% The remaining permitted \textsf{tokens} are \texttt{p}, +% \texttt{m} and \texttt{b} (class $10$). +% \begin{macrocode} + 10 + \@chnum + \if \@nextchar m\thr@@\else + \if \@nextchar p4 \else + \if \@nextchar b5 \else +% \end{macrocode} +% Now the only remaining possibility is a forbidden \textsf{token}, +% so we choose class $0$ and number $0$ and give an error message. +% Then we finish the macro by closing all =\if='s. +% \begin{macrocode} + \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi + \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi} +% \end{macrocode} +% \end{macro} +% +% +% +% +% +% \subsection{Multiple columns ($*$--form)} +% +% \begin{macro}{\@xexpast} +% \begin{macro}{\the@toks} +% \begin{macro}{\the@toksz} +% \label{@xexpast} Now we discuss the macro that deletes all forms +% of type =*{=\textit{N\/}=}{=\textit{String\/}=}= from a user +% preamble and replaces them with \textit{N} copies of +% \textit{String}. Nested $*$--expressions are dealt with +% correctly, that means $*$--expressions are not substituted if +% they are in explicit braces, as in =@{*}=. +% +% This macro is called via +% =\@xexpast=\meta{preamble}=*0x\@@=. +% The $*$--expression =*0x= is being used to terminate the +% recursion, +% as we shall see later, and =\@@= serves as an argument +% delimiter. =\@xexpast= has four arguments. The first +% one is the part of the +% user preamble before the first $*$--expression while the second +% and third ones are the arguments of the first $*$--expression +% (that is \textit{N} and \textit{String} in the notation mentioned +% above). +% The fourth argument is the rest of the preamble. +% \begin{macrocode} +\def\@xexpast#1*#2#3#4\@@{% +% \end{macrocode} +% The number of copies of \textit{String} (=#2=) that are to be +% produced will be saved in a \textsf{count} register. +% \begin{macrocode} + \@tempcnta #2 +% \end{macrocode} +% We save the part of the preamble which does not +% contain a $*$--form (=#1=) +% in a \PlainTeX\ \textsf{token} register. +% We also save \textit{String} (=#3=) using a \LaTeX\ +% \textsf{token} register. +% \begin{macrocode} + \toks@={#1}\@temptokena={#3}% +% \end{macrocode} +% Now we have to use a little trick to produce \textit{N} copies of +% \textit{String}. +% We could try =\def\@tempa{#1}= and then +% \textit{N} times =\edef\@tempa{\@tempa#3}=. This would have the +% undesired effect that all macros within =#1= and =#3= +% would be expanded, although, for example, constructions like +% =@{..}= are not supposed to be changed. +% That is why we =\let= two control sequences to +% be equivalent to =\relax=. +% \begin{macrocode} + \let\the@toksz\relax \let\the@toks\relax +% \end{macrocode} +% Then we ensure that =\@tempa= contains +% ={\the@toksz\the@toks...\the@toks}= (the macro +% =\the@toks= exactly \textit{N\/} times) as substitution text. +% \begin{macrocode} + \def\@tempa{\the@toksz}% + \ifnum\@tempcnta >0 \@whilenum\@tempcnta >0\do + {\edef\@tempa{\@tempa\the@toks}\advance \@tempcnta \m@ne}% +% \end{macrocode} +% If \textit{N\/} was greater than zero we prepare for another call +% of =\@xexpast=. Otherwise we assume we have reached the end of +% the user preamble, because we had appended =*0x\@@= when we first +% called =\@xexpast=. In other words: if the user inserts +% =*{0}{..}= in his preamble, \LaTeX\ ignores the rest of it. +% \begin{macrocode} + \let \@tempb \@xexpast \else + \let \@tempb \@xexnoop \fi +% \end{macrocode} +% Now we will make sure that the part of the user preamble, which +% was already dealt with, will be saved again in =\@tempa=. +% \begin{macrocode} + \def\the@toksz{\the\toks@}\def\the@toks{\the\@temptokena}% + \edef\@tempa{\@tempa}% +% \end{macrocode} +% We have now evaluated the first $*$--expression, and the user +% preamble up to this point +% is saved in =\@tempa=. We will put the contents of +% =\@tempa= and the rest of the user preamble together and work +% on the result with =\@tempb=. This macro either corresponds +% to =\@xexpast=, so that the next +% $*$--expression is handled, or to the macro =\@xexnoop=, +% which only ends the recursion by deleting its argument. +% \begin{macrocode} + \expandafter \@tempb \@tempa #4\@@} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@xexnoop} +% So the first big problem is solved. Now it is easy to +% specify =\@xexnoop=. +% Its argument is delimited by =\@@= and it simply expands to +% nothing. +% \begin{macrocode} +% \def\@xexnoop#1\@@{} +% \end{macrocode} +% \end{macro} +% +% +% +% +% \section{The insertion of declarations +% (\texttt{>}, \texttt{<}, \texttt{!}, \texttt{@})} +% +% +% The preamble will be enlarged with the help of =\xdef=, but the +% arguments of \texttt{>}, \texttt{<},~\texttt{!}\ and \texttt{@} are +% not supposed to be expanded during the construction (we want an +% implementation that doesn't need a =\protect=). So we have to find a +% way to inhibit the expansion of those arguments. +% +% We will solve this problem with \textsf{token} registers. We need +% one register for every \texttt{!}\ and \texttt{@}, while we need two +% for every \texttt{c}, \texttt{l}, \texttt{r}, \texttt{m}, \texttt{p} +% or \texttt{b}. This limits the number of columns of a table because +% there are only 256 \textsf{token} registers. But then, who needs +% tables with more than 100 columns? +% +% One could also find a solution which only needs two or three +% \textsf{token} registers by proceeding similarly as in the macro +% =\@xexpast= (see page \pageref{@xexpast}). The advantage of our +% approach is the fact that we avoid some of the problems that arise +% with the other method\footnote{Maybe there are also historical +% reasons.}. +% +% So how do we proceed? Let us assume that we had =!{foo}= in the +% user preamble and say we saved \texttt{foo} in +% \textsf{token} register $5$. Then we call +% =\@addtopreamble{\the@toks5}= where +% =\the@toks= is defined in a way that it does not expand +% (for example it could be equivalent to =\relax=). Every +% following call +% of =\@addtopreamble= leaves =\the@toks5= unchanged in +% =\@preamble=. If the construction of the preamble is completed +% we change the definition of =\the@toks= to +% =\the\toks= and expand =\@preamble= for the last time. +% During this process all parts of the form +% =\the@toks=\meta{Number} +% will be substituted by the contents of the respective \textsf{token} +% registers. +% +% As we can see from this informal discussion the construction of the +% preamble has to take place within a group, so that the +% \textsf{token} registers we use will be freed later on. For that +% reason we keep all assignments to =\@preamble= global; therefore the +% replacement text of this macro will remain the same after we leave +% the group. +% +% \begin{macro}{\count@} +% We further need a \textsf{count} register to remember which +% \textsf{token} register is to be used next. This will be +% initialized with $-1$ if we want to begin with the \textsf{token} +% register $0$. We use the \PlainTeX\ scratch register =\count@= +% because everything takes place locally. All we have to do is +% insert =\the@toks= =\the= =\count@= into the preamble. +% =\the@toks= will remain unchanged and =\the\count@= expands into +% the saved number. +% \end{macro} +% +% \begin{macro}{\prepnext@tok} +% The macro =\prepnext@tok= is in charge of preparing the next +% \textsf{token} register. For that purpose we increase +% =\count@= by $1$: +% \begin{macrocode} +\def\prepnext@tok{\advance \count@ \@ne +% \end{macrocode} +% Then we locally delete any contents the +% \textsf{token} register might have. +% \begin{macrocode} + \toks\count@{}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\save@decl} +% During the construction of the preamble the current +% \textsf{token} is always saved in the macro =\@nextchar= (see the +% definition of =\@mkpream= on page \pageref{@mkpream}). The macro +% =\save@decl= saves it into the next free \textsf{token} register, +% i.e.\ in =\toks\count@=. +% \changes{v2.0c}{1990/08/14}{\cs{relax} removed and added elsewhere.} +% \begin{macrocode} +\def\save@decl{\toks\count@ \expandafter{\@nextchar}} +% \end{macrocode} +% The reason for the use of =\relax= is the following +% hypothetical situation in the preamble: +% \quad =..\the\toks1\the\toks2..= \quad \TeX\ expands +% =\the\toks2= first in order to find out if the digit =1= +% is followed by other digits. E.g.\ a =5= saved in the +% \textsf{token} register $2$ would lead \TeX\ to insert the contents +% of \textsf{token} register $15$ instead of $1$ later on. +% +% The example above referred to an older version of =\save@decl= which +% inserted a =\relex= inside the token register. This is now moved to +% the places where the actual token registers are inserted (look for +% =\the@toks=) because the old version would still make =@= +% expressions to moving arguments since after expanding the second +% register while looking for the end of the number the contents of the +% token register is added so that later on the whole register will be +% expanded. This serious bug was found after nearly two years +% international use of this package by Johannes Braams. +% \end{macro} +% +% +% +% How does the situation look like, if we want to add another column +% to the preamble, i.e.\ if we have found a \texttt{c}, \texttt{l}, +% \texttt{r}, \texttt{p}, \texttt{m} or \texttt{b} in the user +% preamble? In this case we have the problem of the \textsf{token} +% register from =>{..}= and =<{..}= having to be inserted at this +% moment because formatting instructions like =\hfil= have to be set +% around them. On the other hand it is not known yet, if any =<{..}= +% instruction will appear in the user preamble at all. +% +% We solve this problem by adding two \textsf{token} registers at a +% time. This explains, why we have freed the \textsf{token} registers +% in =\prepnext@tok=. +% +% \begin{macro}{\insert@column} +% \begin{macro}{\@sharp} +% We now define the macro =\insert@column= which will do +% this work for us. +% \begin{macrocode} +\def\insert@column{% +% \end{macrocode} +% Here, we assume that the \textsf{count} register +% =\@tempcnta= has saved the value $=\count@= - 1$. +% \begin{macrocode} + \the@toks \the \@tempcnta +% \end{macrocode} +% Next follows the =#= sign which specifies the place +% where the text of the column shall be inserted. To avoid +% errors during the expansions in +% =\@addtopreamble= we hide this sign in the command +% =\@sharp= which is temporarily occupied with +% =\relax= during the build-up of the preamble. +% To remove unwanted spaces before and after the column text, we set +% an =\ignorespaces= in front and a =\unskip= afterwards. +% \changes{v2.0e}{1991/02/07}{Added \{\} around \cs{@sharp} for new ftsel} +% \changes{v2.0h}{1992/06/22}{Removed \{\} again in favour of +% \cs{d@llarbegin}} +% \begin{macrocode} + \ignorespaces \@sharp \unskip +% \end{macrocode} +% Then the second \textsf{token} register follows whose number should +% be saved in =\count@=. +% We make sure that there will be no further expansion after reading +% the number, by finishing with =\relax=. The case above is not +% critical since it is ended by =\ignorespaces=. +% \changes{v2.0c}{1990/08/14}{\cs{relax} added to avoid problem +% \cs{the}\cs{toks0}\cs{the}\cs{toks1}.} +% \begin{macrocode} + \the@toks \the \count@ \relax} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% +% \subsection{The separation of columns} +% +% \begin{macro}{\@addamp} +% In the preamble a =&= has to be inserted between any two columns; +% before the first column there should not be a =&=. As the user +% preamble may start with a \texttt{|} we have to remember somehow +% if we have already inserted a =#= (i.e.\ a column). This is done +% with the boolean variable =\if@firstamp= that we test in +% =\@addamp=, the macro that inserts the =&=. +% \begin{macrocode} +% \newif \@iffirstamp +% \def\@addamp{\if@firstamp \@firstampfalse +% \else \@addtopreamble &\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@acol} +% \begin{macro}{\@acolampacol} +% \begin{macro}{\col@sep} +% We will now define some abbreviations for the extensions, +% appearing most often in the preamble build-up. +% Here =\col@sep= is a \textsf{dimen} register which is set +% equivalent to =\arraycolsep= in an \textsf{array}--environment, +% otherwise it is set equivalent to =\tabcolsep=. +% \begin{macrocode} +\newdimen\col@sep +\def\@acol{\@addtopreamble{\hskip\col@sep}} +% \def\@acolampacol{\@acol\@addamp\@acol} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsection{The macro \texttt{\textbackslash @mkpream}} +% +% \begin{macro}{\@mkpream} +% \emph{The code below has been replaced long time ago by an +% extended version further down but the code and its documentation +% was left here for reference. It is now commented out to avoid +% confusion.} +% \begin{macro}{\the@toks} +% \label{@mkpream} +% Now we can define the macro which builds up the preamble for the +% =\halign=. +% First we initialize =\@preamble=, =\@lastchclass= +% and the boolean variable =\if@firstamp=. +% \begin{macrocode} +%\def\@mkpream#1{\gdef\@preamble{}\@lastchclass 4 \@firstamptrue +% \end{macrocode} +% During the build-up of the preamble we cannot directly use the +% =#= sign; this would lead to an error message in the next +% =\@addtopreamble= call. +% Instead, we use the command =\@sharp= at places where later +% a =#= will be. +% This command is at first given the meaning =\relax=; +% therefore it will not be expanded when the preamble +% is extended. +% In the macro =\@array=, shortly before the =\halign= +% is carried out, =\@sharp= is given its final meaning. +% +% In a similar way, +% we deal with the commands =\@startpbox= and +% =\@endpbox=, although the reason is different here: these +% macros expand in many \textsf{tokens} which would delay the +% build-up of the preamble. +% \begin{macrocode} +% \let\@sharp\relax\let\@startpbox\relax\let\@endpbox\relax +% \end{macrocode} +% Two more are needed to deal with the code that handles struts +% for extra space after a row from =\\[<space>]= +% (=\do@row@strut=) and code that manages m-cells depending on +% their heights (=\ar@align@mcell=). +% \changes{v2.4e}{2016/10/07}{Fixing SX68732} +% \changes{v2.4f}{2017/11/04}{Managing m-cells without \cs{vcenter}} +% \begin{macrocode} +% \let\do@row@strut\relax +% \let\ar@align@mcell\relax +% \end{macrocode} +% Now we remove possible $*$-forms in the user preamble with the +% command =\@xexpast=. As we already know, this command saves +% its result in the macro =\@tempa=. +% \begin{macrocode} +% \@xexpast #1*0x\@@ +% \end{macrocode} +% Afterwards we initialize all registers and macros, that we need +% for the build-up of the preamble. +% Since we want to start with the \textsf{token} register $0$, +% =\count@= has to contain the value $-1$. +% \begin{macrocode} +% \count@\m@ne +% \let\the@toks\relax +% \end{macrocode} +% Then we call up =\prepnext@tok= in order to prepare the +% \textsf{token} register $0$ for use. +% \begin{macrocode} +% \prepnext@tok +% \end{macrocode} +% To evaluate the user preamble (without stars) saved in +% =\@tempa= we use the \LaTeX--macro =\@tfor=. +% The strange appearing construction with =\expandafter= is +% based on the fact that we have to put the replacement text of +% =\@tempa= and not the macro =\@tempa= to this +% \LaTeX--macro. +% \begin{macrocode} +% \expandafter \@tfor \expandafter \@nextchar +% \expandafter :\expandafter =\@tempa \do +% \end{macrocode} +% The body of this loop (the group after the =\do=) +% is executed for one \textsf{token} at a time, whereas +% the current \textsf{token} is saved in =\@nextchar=. +% At first we evaluate the current \textsf{token} with the already +% defined macro =\@testpach=, i.e.\ we assign to +% =\@chclass= the character class and to =\@chnum= +% the character number of this \textsf{token}. +% \changes{v2.0f}{1992/02/29}{\cs{@testpach} now without arg} +% \begin{macrocode} +% {\@testpach +% \end{macrocode} +% Then we branch out depending on the value of =\@chclass= into +% different macros that extend the preamble respectively. +% \begin{macrocode} +% \ifcase \@chclass \@classz \or \@classi \or \@classii +% \or \save@decl \or \or \@classv \or \@classvi +% \or \@classvii \or \@classviii \or \@classix +% \or \@classx \fi +% \end{macrocode} +% Two cases deserve our special attention: Since the current +% \textsf{token} cannot have the character class $4$ (start) we +% have skipped this possibility. If the character class is $3$, +% only the content of =\@nextchar= has to be saved into the current +% \textsf{token} register; therefore we call up =\save@decl= +% directly and save a macro name. After the preamble has been +% extended we assign the value of =\@chclass= to the counter +% =\@lastchclass= to assure that this information will be available +% during the next run of the loop. +% \begin{macrocode} +% \@lastchclass\@chclass}% +% \end{macrocode} +% After the loop has been finished space must still be added to +% the created preamble, depending on the last \textsf{token}. +% Depending on the value of =\@lastchclass= we perform +% the necessary operations. +% \begin{macrocode} +% \ifcase\@lastchclass +% \end{macrocode} +% If the last class equals $0$ we add a +% =\hskip \col@sep=. +% \begin{macrocode} +% \@acol \or +% \end{macrocode} +% If it equals $1$ we do not add any additional space so that the +% horizontal lines do not exceed the vertical ones. +% \begin{macrocode} +% \or +% \end{macrocode} +% Class $2$ is treated like class $0$ because a =<{...}= can +% only directly follow after class $0$. +% \begin{macrocode} +% \@acol \or +% \end{macrocode} +% Most of the other possibilities can only appear if the user +% preamble was defective. Class $3$ is not allowed since after a +% =>{..}= there must always follow a \texttt{c}, \texttt{l}, +% \texttt{r}, \texttt{p},\texttt{m} or \texttt{b}. We report an +% error and ignore the declaration given by ={..}=. +% \begin{macrocode} +% \@preamerr \thr@@ \or +% \end{macrocode} +% If =\@lastchclass= is $4$ the user preamble has been empty. +% To continue, we insert a =#= in the preamble. +% \begin{macrocode} +% \@preamerr \tw@ \@addtopreamble\@sharp \or +% \end{macrocode} +% Class $5$ is allowed again. In this case +% (the user preamble ends with =@{..}=) we need not +% do anything. +% \begin{macrocode} +% \or +% \end{macrocode} +% Any other case means that the arguments to =@=, \texttt{!}, +% \texttt{<}, \texttt{>}, \texttt{p}, \texttt{m} or \texttt{b} have +% been forgotten. So we report an error and ignore the last +% \textsf{token}. +% \begin{macrocode} +% \else \@preamerr \@ne \fi +% \end{macrocode} +% Now that the build-up of the preamble is almost finished we can +% insert the \textsf{token} registers and therefore redefine +% =\the@toks=. The actual insertion, though, is performed +% later. +% \begin{macrocode} +% \def\the@toks{\the\toks}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% \section{The macros \texttt{\textbackslash @classz} +% to \texttt{\textbackslash @classx}} +% +% The preamble is extended by the macros =\@classz= to +% =\@classx= which are called by =\@mkpream= +% depending on =\@lastchclass= +% (i.e. the character class of the last \textsf{token}). +% \begin{macro}{\@classx} +% First we define =\@classx= because of its important r\^ole. +% When it is called we find that the current +% \textsf{token} is \texttt{p}, \texttt{m} or \texttt{b}. +% That means that a new column has to start. +% \begin{macrocode} +\def\@classx{% +% \end{macrocode} +% Depending on the value of =\@lastchclass= different actions +% must take place: +% \begin{macrocode} + \ifcase \@lastchclass +% \end{macrocode} +% If the last character class was $0$ we separate the columns by +% =\hskip\col@sep= followed by =&= and another +% =\hskip\col@sep=. +% \begin{macrocode} + \@acolampacol \or +% \end{macrocode} +% If the last class was class $1$ --- that means that a vertical +% line was +% drawn, --- before this line a =\hskip\col@sep= was inserted. +% Therefore there has to be only a =&= followed by +% =\hskip\col@sep=. But this =&= may be inserted only +% if this is not the first column. This process is controlled +% by =\if@firstamp= in the macro =\addamp=. +% \begin{macrocode} + \@addamp \@acol \or +% \end{macrocode} +% Class $2$ is treated like class $0$ because =<{...}= can only +% follow after class $0$. +% \begin{macrocode} + \@acolampacol \or +% \end{macrocode} +% Class $3$ requires no actions because all things necessary have +% been done by the preamble \textsf{token} \texttt{>}. +% \begin{macrocode} + \or +% \end{macrocode} +% Class $4$ means that we are at the beginning of the preamble. +% Therefore we start the preamble with =\hskip\col@sep= and +% then call =\@firstampfalse=. This makes sure that a later +% =\@addamp= inserts the character +% =&= into the preamble. +% \begin{macrocode} + \@acol \@firstampfalse \or +% \end{macrocode} +% For class $5$ \textsf{tokens} only the character =&= is inserted +% as a column separator. Therefore we call =\@addamp=. +% \begin{macrocode} + \@addamp +% \end{macrocode} +% Other cases are impossible. For an example +% $=\@lastchclass= \string= 6$---as it might appear in a +% preamble of the form =...!p...=---\texttt{p} would have +% been taken as an argument of \texttt{!}\ by =\@testpach=. +% \begin{macrocode} + \fi} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@classz} +% If the character class of the last \textsf{token} is $0$ we have +% \texttt{c}, \texttt{l}, \texttt{r} or an argument of \texttt{m}, +% \texttt{b} or\ \texttt{p}. In the first three cases the preamble +% must be extended the same way as if we had class $10$. The +% remaining two cases do not require any action because the space +% needed was generated by the last \textsf{token} (i.e.\ +% \texttt{m}, \texttt{b} or \texttt{p}). Since =\@lastchclass= has +% the value $10$ at this point nothing happens when =\@classx= is +% called. So the macro =\@chlassz= may start like this: +% \begin{macrocode} +\def\@classz{\@classx +% \end{macrocode} +% According to the definition of =\insert@column= we must store +% the number of the \textsf{token} register in which a preceding +% =>{..}= might have stored its argument into +% =\@tempcnta=. +% \begin{macrocode} + \@tempcnta \count@ +% \end{macrocode} +% To have $=\count@= \string= =\@tmpcnta= + 1$ we prepare +% the next \textsf{token} register. +% \begin{macrocode} + \prepnext@tok +% \end{macrocode} +% Now the preamble must be extended with the column whose format +% can be determined by =\@chnum=. +% \begin{macrocode} + \@addtopreamble{\ifcase \@chnum +% \end{macrocode} +% If =\@chnum= has the value $0$ a centered column has to be +% generated. +% So we begin with stretchable space. +% \begin{macrocode} + \hfil +% \end{macrocode} +% We also add a space of 1sp just in case the first thing in the +% cell is a command doing an =\unskip=. +% \changes{v2.4k}{2018/12/30}{Add extra \cs{hskip} to guard against an +% \cs{unskip} at the start of a c-column cell (gh/102)} +% \begin{macrocode} + \hskip1sp% +% \end{macrocode} +% The command =\d@llarbegin= follows expanding into =\begingroup= +% (in the \textsf{tabular}--environment) or into =$=. Doing this +% (provided an appropriate setting of =\d@llarbegin=) we achieve +% that the contents of the columns of an \textsf{array}--environment +% are set in math mode while those of a \textsf{tabular}--environment +% are set in LR mode. +% \begin{macrocode} + \d@llarbegin +% \end{macrocode} +% Now we insert the contents of the two \textsf{token} registers +% and the symbol +% for the column entry (i.e.\ =#= or +% more precise =\@sharp=) using =\insert@column=. +% \begin{macrocode} + \insert@column +% \end{macrocode} +% We end this case with =\d@llarend= and =\hfil= where =\d@llarend= +% again is either =$= or =\endgroup=. +% The strut to enforce a regular row height is placed between the two. +% \changes{v2.4e}{2016/10/07}{Fixing SX68732} +% \begin{macrocode} + \d@llarend \do@row@strut \hfil \or +% \end{macrocode} +% The templates for \texttt{l} and \texttt{r} (i.e.\ =\@chnum= $1$ +% or $2$) are generated the same way. Since one =\hfil= is +% missing the text is moved to the relevant side. +% The =\kern\z@= is needed in case of an empty column +% entry. Otherwise +% the =\unskip= in =\insert@column= removes the +% =\hfil=. Changed to =\hskip1sp= so that it interacts better with +% =\@bsphack=. +% \changes{v2.3f}{1996/04/22} +% {(DPC) Extra \cs{kern} keeps tabcolsep in empty l columns +% internal/2122} +% \changes{v2.3i}{1996/06/14} +% {Change both \cs{kern}\cs{z@} to \cs{hskip}1sp for latex/2160} +% \changes{v2.4e}{2016/10/07}{Fixing SX68732} +% \begin{macrocode} + \hskip1sp\d@llarbegin \insert@column \d@llarend \do@row@strut \hfil \or + \hfil\hskip1sp\d@llarbegin \insert@column \d@llarend \do@row@strut \or +% \end{macrocode} +% The templates for \texttt{p}, \texttt{m} and \texttt{b} mainly +% consist of a \textsf{box}. In case of \texttt{m} it is generated +% by =\vcenter=. This command is allowed only in math +% mode. Therefore we start with a~=$=. +% \changes{v2.4f}{2017/11/04}{Managing m-cells without \cs{vcenter}} +% \begin{macrocode} + \setbox\ar@mcellbox\vbox +% \end{macrocode} +% The part of the templates which is the same in all three cases +% (\texttt{p}, \texttt{m} and \texttt{b}) +% is built by the macros =\@startpbox= and +% =\@endpbox=. =\@startpbox= has an argument: +% the width of the column which is stored in the current +% \textsf{token} (i.e.\ =\@nextchar=). +% Between these two macros we find the well known +% =\insert@column=. +% The strut is places after the box +% \changes{v2.4e}{2016/10/07}{Fixing SX68732} +% \changes{v2.4f}{2017/11/04}{Managing m-cells without \cs{vcenter}} +% \begin{macrocode} + \@startpbox{\@nextchar}\insert@column \@endpbox + \ar@align@mcell + \do@row@strut \or +% \end{macrocode} +% The templates for \texttt{p} and \texttt{b} are generated in the +% same way though we do not need the =$= characters because we use +% =\vtop= or =\vbox=. +% \changes{v2.4e}{2016/10/07}{Fixing SX68732} +% \begin{macrocode} + \vtop \@startpbox{\@nextchar}\insert@column \@endpbox\do@row@strut \or + \vbox \@startpbox{\@nextchar}\insert@column \@endpbox\do@row@strut +% \end{macrocode} +% Other values for =\@chnum= are impossible. Therefore we +% end the arguments to =\@addtopreamble= and =\ifcase=. +% Before we come to the end of =\@classz= we have to +% prepare the next \textsf{token} register. +% \begin{macrocode} + \fi}\prepnext@tok} +% \end{macrocode} +% \end{macro} +% + +% +% \begin{macro}{\ar@mcellbox} +% When dealing with m-cells we need a box to measure the cell +% height. +% \changes{v2.4f}{2017/11/04}{Managing m-cells without \cs{vcenter}} +% \begin{macrocode} +\newbox\ar@mcellbox +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\ar@align@mcell} +% M-cells are supposed to be vertically centered within the table +% row. In the original implementation that was done using +% =\vcenter= but the issue with that approach is that it centers +% the material based on the math-axis. In most situations that +% comes out quit right, but if, for example, an m-cell has only a +% single line worth of material inside it will be positioned +% differently to a =l=, =c= or =r= cell or to a =p= or =b= cell +% with the same content. +% +% For that reason the new implementation does the centering +% manually: First we check the height of the cell and if that is +% less or equal to =\ht\@arstrutbox= we assume that this is a +% single line cell. In that case we don't do any vertical maneuvre +% and simply output the box, i.e., make it behave like a single +% line p-cell. +% \changes{v2.4f}{2017/11/04}{Managing m-cells without \cs{vcenter}} +% \begin{macrocode} +\def\ar@align@mcell{% + \ifdim \ht\ar@mcellbox > \ht\@arstrutbox +% \end{macrocode} +% Otherwise we realign vertically by lowering the box. The question +% is how much do we need to move down? If there is any +% =\arraystretch= in place then the first line will have some +% unusual height and we don't want to consider that when finding +% the middle point. So we substract from the cell height the height +% of that strut. But of course we want to include the normal height +% of the first line (which would be something like =\ht\strutbox=) +% so we need to add that. On the other hand, when centering around +% the mid-point of the cell, we also need to account for the depth +% of the last line (which is nominally something like +% =\dp\strutbox=). Both together equals =\baselineskip= so that is +% what we add and then lower the cell by half of the resulting value. +% \begin{macrocode} + \begingroup + \dimen@\ht\ar@mcellbox + \advance\dimen@-\ht\@arstrutbox + \advance\dimen@\baselineskip + \lower.5\dimen@\box\ar@mcellbox + \endgroup + \else % assume one line and align at baseline + \box\ar@mcellbox + \fi} +% \end{macrocode} +% \end{macro} +% + +% +% \begin{macro}{\@classix} +% \emph{The code below has been replaced long time ago by an +% extended version further down but the code and its documentation +% was left here for reference. It is now commented out to avoid +% confusion.} +% +% In case of class $9$ (\texttt{>}--\textsf{token}) we first check +% if the character class of the last +% \textsf{token} was $3$. In this case we have a +% user preamble of the form =..>{...}>{...}..= which +% is not allowed. We only give an error message and continue. +% So the declarations defined by the first =>{...}= +% are ignored. +% \begin{macrocode} +%\def\@classix{\ifnum \@lastchclass = \thr@@ +% \@preamerr \thr@@ \fi +% \end{macrocode} +% Furthermore, we call up =\@class10= because afterwards always a +% new column is started by \texttt{c}, \texttt{l}, \texttt{r}, +% \texttt{p}, \texttt{m} or \texttt{b}. +% \begin{macrocode} +% \@classx} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@classviii} +% \emph{The code below has been replaced long time ago by an +% extended version further down but the code and its documentation +% was left here for reference. It is now commented out to avoid +% confusion.} +% +% If the current \textsf{token} is a \texttt{<} the last character +% class must be $0$. In this case it is not necessary to extend the +% preamble. Otherwise we output an error message, set =\@chclass= +% to $6$ and call =\@classvi=. By doing this we achieve that +% \texttt{<} is treated like \texttt{!}. +% \begin{macrocode} +%\def\@classviii{\ifnum \@lastchclass >\z@ +% \@preamerr 4\@chclass 6 \@classvi \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@arrayrule} +% There is only one incompatibility with the original definition: +% the definition of =\@arrayrule=. In the original a line without +% width\footnote{So the space between \texttt{cc} and \texttt{c|c} +% is equal.} is created by multiple insertions of +% =\hskip .5\arrayrulewidth=. +% We only insert a vertical line into the +% preamble. This is done to prevent problems with \TeX's main +% memory when generating tables with many vertical lines in them +% (especially in the case of \textsf{floats}). +% \begin{macrocode} +\def\@arrayrule{\@addtopreamble \vline} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@classvii} +% As a consequence it follows that in case of class $7$ +% (=@= \textsf{token}) the preamble need not to be extended. +% In the original definition $=\@lastchclass= \string= 1$ +% is treated by inserting =\hskip .5\arrayrulewidth=. +% We only check if the last \textsf{token} was of class $3$ which is +% forbidden. +% \begin{macrocode} +\def\@classvii{\ifnum \@lastchclass = \thr@@ +% \end{macrocode} +% If this is true we output an error message and +% ignore the declarations stored +% by the last =>{...}=, because these are overwritten +% by the argument of \texttt{@}. +% \begin{macrocode} + \@preamerr \thr@@ \fi} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@classvi} +% If the current \textsf{token} is a regular \texttt{!}\ and the +% last class was $0$ or $2$ we extend the preamble with +% =\hskip\col@sep=. If the last \textsf{token} was of class $1$ +% (for instance \texttt{|}) we extend with =\hskip \doublerulesep= +% because the construction =!{...}= has to be treated like +% \texttt{|}. +% \begin{macrocode} +\def\@classvi{\ifcase \@lastchclass + \@acol \or + \@addtopreamble{\hskip \doublerulesep}\or + \@acol \or +% \end{macrocode} +% Now =\@preamerr...= should follow because a +% user preamble of the form =..>{..}!.= is not allowed. +% To save memory we call =\@classvii= instead which also +% does what we want. +% \begin{macrocode} + \@classvii +% \end{macrocode} +% If =\@lastchclass= is $4$ or $5$ nothing has to be done. +% Class $6$ to $10$ are not possible. +% So we finish the macro. +% \begin{macrocode} + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@classii} +% \begin{macro}{\@classiii} +% In the case of character classes $2$ and $3$ (i.e.\ the argument +% of \texttt{<} or \texttt{>}) we only have to store the current +% \textsf{token} (=\@nextchar=) into the corresponding +% \textsf{token} register since the preparation and +% insertion of these registers +% are done by the macro =\@classz=. +% This is equivalent to calling =\save@decl= in the case of +% class $3$. To save command identifiers we do this call up +% in the macro =\@mkpream=. +% +% Class $2$ exhibits a more complicated situation: the +% \textsf{token} registers have already been inserted by +% =\@classz=. So the value of =\count@= is too high +% by one. Therefore we decrease =\count@= by $1$. +% \begin{macrocode} +\def\@classii{\advance \count@ \m@ne +% \end{macrocode} +% Next we store the current \textsf{token} into the correct +% \textsf{token} register by calling =\save@decl= and then +% increase the value of =\count@= again. At this point we +% can save memory once more (at the cost of time) if we use the +% macro =\prepnext@tok=. +% \begin{macrocode} + \save@decl\prepnext@tok} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\@classv} +% \emph{The code below has been replaced long time ago by an +% extended version further down but the code and its documentation +% was left here for reference. It is now commented out to avoid +% confusion.} +% +% If the current \textsf{token} is of class $5$ then it is an +% argument of a \texttt{@} \textsf{token}. It must be stored into a +% \textsf{token} register. +% \begin{macrocode} +%\def\@classv{\save@decl +% \end{macrocode} +% We extend the preamble with a command which inserts this +% \textsf{token} register into the preamble when its construction +% is finished. The user expects that this argument is worked out in +% math mode if it was used in an +% \textsf{array}--environment. Therefore we surround it with +% =\d@llar...='s. +% \changes{v2.0c}{1990/08/14}{\cs{relax} added to avoid problem +% `the`toks0`the`toks1.} +% \begin{macrocode} +% \@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}% +% \end{macrocode} +% Finally we must prepare the next \textsf{token} register. +% \begin{macrocode} +% \prepnext@tok} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@classi} +% In the case of class $0$ we were able to generate the necessary +% space between columns by using the macro =\@classx=. +% Analogously the macro =\@classvi= can be used for class $1$. +% \begin{macrocode} +\def\@classi{\@classvi +% \end{macrocode} +% Depending on =\@chnum= a vertical line +% \begin{macrocode} + \ifcase \@chnum \@arrayrule \or +% \end{macrocode} +% or (in case of =!{...}=) the current \textsf{token} --- stored +% in =\@nextchar= --- has to be inserted into the preamble. +% This corresponds to calling =\@classv=. +% \begin{macrocode} + \@classv \fi} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@startpbox} +% In =\@classz= the macro =\@startpbox= is used. +% The width of the \textsf{parbox} is passed as an argument. +% =\vcenter=, =\vtop= or =\vbox= are already in the +% preamble. So we start with the braces for the wanted box. +% \changes{v2.4i}{2018/09/13}{Add group to prevent color leak (gh/72)} +% \begin{macrocode} +\def\@startpbox#1{\bgroup + \color@begingroup +% \end{macrocode} +% The argument is the width of the box. This information has to be +% assigned to =\hsize=. +% Then we assign default values to several parameters used in a +% \textsf{parbox}. +% \changes{v2.3k}{1998/05/12}{Use \cs{setlength} to set \cs{hsize}, +% so that the calc package can be applied here (pr/2793)} +% \begin{macrocode} + \setlength\hsize{#1}\@arrayparboxrestore +% \end{macrocode} +% Our main problem is to obtain the same distance between succeeding +% lines of the \textsf{parbox}. +% We have to remember that the distance between two \textsf{parboxes} +% should be defined by =\@arstrut=. That means that it can be +% greater than the distance in a \textsf{parbox}. +% Therefore it is not enough to set a =\@arstrut= at the +% beginning and at the end of the \textsf{parbox}. This would +% dimension the distance +% between first and second line and the distance between the two +% last lines of the \textsf{parbox} wrongly. +% To prevent this we set an invisible rule of height +% =\@arstrutbox= +% at the beginning of the \textsf{parbox}. This has no effect on the +% depth of the first line. At the end of the \textsf{parbox} we set +% analogously another invisible rule which only affects the depth +% of the last line. It is necessary to wait inserting this strut +% until the paragraph actually starts to allow for things like +% =\parindent= changes via =>{...}=. +% \changes{v2.1c}{1992/12/14}{Use `everypar to insert strut} +% \begin{macrocode} + \everypar{% + \vrule \@height \ht\@arstrutbox \@width \z@ + \everypar{}}% + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@endpbox} +% If there are any declarations defined by =>{...}= +% and =<{...}= +% they now follow in the macro =\@classz= --- the contents +% of the column in between. +% So the macro =\@endpbox= must insert the \textsf{specialstrut} +% mentioned earlier and then close the group opened by +% =\@startpbox=. +% \changes{v2.2d}{1994/05/16}{Use \LaTeXe \cs{@finalstrut}} +% \changes{v2.3g}{1996/05/07}{Add \cs{hfil} for tools/2120} +% \changes{v2.4i}{2018/09/13}{Add group to prevent color leak (gh/72)} +% \begin{macrocode} +\def\@endpbox{\@finalstrut\@arstrutbox \color@endgroup \egroup\hfil} +% \end{macrocode} +% \end{macro} +% +% +% \section{Building and calling \texttt{\textbackslash halign}} +% +% \begin{macro}{\@array} +% After we have discussed the macros needed for the evaluation +% of the user preamble we can define the macro =\@array= +% which uses these macros to create a =\halign=. +% It has two arguments. The first one is a position argument +% which can be \texttt{t}, \texttt{b} or \texttt{c}; the +% second one describes the wanted preamble, +% e.g.\ it has the form =|c|c|c|=. +% \begin{macrocode} +\def\@array[#1]#2{% +% \end{macrocode} +% First we define a \textsf{strut} whose size basically corresponds +% to a normal \textsf{strut} multiplied by the factor +% =\arraystretch=. +% This \textsf{strut} is then inserted into every row and enforces +% a minimal distance between two rows. +% Nevertheless, when using horizontal lines, large letters +% (like accented capital letters) still collide with such lines. +% Therefore at first we add to the height of a normal \textsf{strut} +% the value of the parameter =\extrarowheight=. +% \begin{macrocode} + \@tempdima \ht \strutbox + \advance \@tempdima by\extrarowheight + \setbox \@arstrutbox \hbox{\vrule + \@height \arraystretch \@tempdima + \@depth \arraystretch \dp \strutbox + \@width \z@}% +% \end{macrocode} +% Then we open a group, in which the user preamble is evaluated by +% the macro =\@mkpream=. As we know this must happen locally. +% This macro creates a preamble for a =\halign= and saves +% its result globally in the control sequence =\@preamble=. +% \begin{macrocode} + \begingroup + \@mkpream{#2}% +% \end{macrocode} +% We again redefine =\@preamble= so that a call up of =\@preamble= +% now starts the =\halign=. Thus also the arguments of \texttt{>}, +% \texttt{<}, \texttt{@} and \texttt{!}, saved in the +% \textsf{token} registers are inserted into the preamble. The +% =\tabskip= at the beginning and end of the preamble is set to +% \textsf{0pt} (in the beginning by the use of =\ialign=). Also the +% command =\@arstrut= is build in, which inserts the +% =\@arstrutbox=, defined above. Of course, the opening brace after +% =\ialign= has to be implicit as it will be closed in =\endarray= +% or another macro. +% \changes{v2.3m}{1998/12/31}{Added \cs{noexpand} in front of \cs{ialign} +% to guard against interesting :-) changes to \cs{halign} done to support +% text glyphs in math} +% +% The =\noexpand= in front of =\ialign= does no harm in standard \LaTeX{} +% and was added since some experimental support for using text glyphs in math +% redefines =\halign= with the result that is becomes expandable with +% disastrous results in cases like this. +% In the kernel definition for this macro the problem does +% not surface because there =\protect= is set (which is not necessary in this +% implementation as there is no arbitrary user input that can get expanded) and +% the experimental code made the redefinition robust. Whether this is the right +% approach is open to question; consider the =\noexpand= a courtesy to allow an +% unsupported redefinition of a \TeX{} primitive for the moment (as people rely +% on that experimental code). +% \begin{macrocode} + \xdef\@preamble{\noexpand \ialign \@halignto + \bgroup \@arstrut \@preamble + \tabskip \z@ \cr}% +% \end{macrocode} +% What we have not explained yet is the macro =\@halignto= +% that was just used. Depending on its replacement text the +% =\halign= becomes a =\halign= \texttt{to} \meta{dimen}. +% Now we close the group again. Thus +% =\@startpbox= and =\@endpbox= as well as all +% \textsf{token} registers get their former meaning back. +% \begin{macrocode} + \endgroup +% \end{macrocode} +% To support the \texttt{delarray.sty} package we include a hook +% into this part of the code which is a no-op in the main package. +% \changes{v2.1a}{1992/07/03}{Hook for delarray added} +% \begin{macrocode} + \@arrayleft +% \end{macrocode} +% Now we decide depending on the position argument in which +% \textsf{box} the =\halign= is to be put. (=\vcenter= may be used +% because we are in math mode.) +% \changes{v2.1a}{1992/07/03}{Wrong spec is now equiv to [t]} +% \begin{macrocode} + \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi +% \end{macrocode} +% Now another implicit opening brace appears; then definitions +% which shall stay local follow. While constructing the +% =\@preamble= in =\@mkpream= the =#= sign must be +% hidden in the macro =\@sharp= which is =\let= to +% =\relax= at that moment (see definition of =\@mkpream= +% on page~\pageref{@mkpream}). +% All these now get their actual meaning. +% \begin{macrocode} + \bgroup + \let \@sharp ##\let \protect \relax +% \end{macrocode} +% With the above defined \textsf{struts} we fix down the distance +% between rows by setting =\lineskip= and =\baselineskip= +% to \textsf{0pt}. Since there have to be set =$='s +% around every column in the \textsf{array}--environment +% the parameter =\mathsurround= should +% also be set to \textsf{0pt}. This prevents additional space between +% the rows. The +% \PlainTeX--macro =\m@th= does this. +% \begin{macrocode} + \lineskip \z@ + \baselineskip \z@ + \m@th +% \end{macrocode} +% Beside, we have to assign a special meaning (which we still have +% to specify) to the line separator =\\=. We also have to +% redefine the command =\par= in such a way that empty lines in +% =\halign= cannot do any damage. We succeed in doing so +% by choosing something that will disappear when expanding. +% After that we only have to call up =\@preamble= to +% start the wanted =\halign=. +% \changes{1994/12/08}{v2.3b}{add \cs{tabularnewline}} +% \begin{macrocode} + \let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\arraybackslash} +% \changes{v2.4a}{2003/12/17}{(DPC) Macro added (from tabularx)} +% Restore =\\= for use in array and tabular environment (after +% =\raggedright= etc.). +% \begin{macrocode} +\def\arraybackslash{\let\\\tabularnewline} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\extrarowheight} +% The \textsf{dimen} parameter used above also needs to be +% allocated. As a default value we use \textsf{0pt}, to ensure +% compatibility with standard \LaTeX. +% \begin{macrocode} +\newdimen \extrarowheight +\extrarowheight=0pt +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@arstrut} +% Now the insertion of =\@arstrutbox= through =\@arstut= +% is easy since we know exactly in which mode \TeX\ is while working +% on the =\halign= preamble. +% \begin{macrocode} +\def\@arstrut{\unhcopy\@arstrutbox} +% \end{macrocode} +% \end{macro} +% +% +% \section{The line separator \texttt{\textbackslash\textbackslash}} +% +% \begin{macro}{\@arraycr} +% In the macro =\@array= the line separator =\\= is +% =\let= to the command =\@arraycr=. +% Its definition starts with a special brace which I have directly +% copied from the original definition. It is +% necessary, because the =\futurlet= in =\@ifnextchar= +% might +% expand a following =&= \textsf{token} in a construction like +% =\\ &=. This would otherwise end the alignment template at a +% wrong time. On the other hand we have to be careful to avoid +% producing a real group, i.e.\ ={}=, because the command will also +% be used for the array environment, i.e.\ in math mode. In that +% case an extra ={}= would produce an ord atom which could mess up +% the spacing. For this reason we use a combination that does not +% really produce a group at all but modifies the master counter so +% that a =&= will not be considered belonging to the current +% =\halign= while we are looking for a =*= or =[=. +% For further information see +% \cite[Appendix D]{bk:knuth}. +% \changes{v2.3c}{1995/04/23}{Avoid adding an ord atom in math} +% \begin{macrocode} +\def\@arraycr{\relax\iffalse{\fi\ifnum 0=`}\fi +% \end{macrocode} +% Then we test whether the user is using the star form and ignore +% a possible star (I also disagree with this procedure, because a +% star does not make any sense here). +% \begin{macrocode} + \@ifstar \@xarraycr \@xarraycr} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xarraycr} +% In the command =\@xarraycr= we test if an optional argument +% exists. +% \begin{macrocode} +\def\@xarraycr{\@ifnextchar [% +% \end{macrocode} +% If it does, we branch out into the macro =\@argarraycr= if +% not we close the special brace (mentioned above) and end the row +% of the =\halign= with a =\cr=. +% \changes{v2.3c}{1995/04/23}{Avoid adding an ord atom in math} +% \begin{macrocode} + \@argarraycr {\ifnum 0=`{}\fi\cr}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@argarraycr} +% If additional space is requested by the user this case is treated +% in the macro =\@argarraycr=. First we close the special brace +% and then we test if the additional space is positive. +% \changes{v2.3c}{1995/04/23}{Avoid adding an ord atom in math} +% \begin{macrocode} +\def\@argarraycr[#1]{\ifnum0=`{}\fi\ifdim #1>\z@ +% \end{macrocode} +% If this is the case we create an invisible vertical rule with +% depth =\dp\@arstutbox=${}+{}$\meta{wanted\ space}. +% Thus we achieve that all vertical lines specified +% in the user preamble by a \texttt{|} are now +% generally drawn. +% Then the row ends with a =\cr=. +% +% If the space is negative we end the row at once with a =\cr= +% and move back up with a =\vskip=. +% +% While testing these macros I found out that the +% =\endtemplate= +% created by =\cr= and =&= is something like an +% =\outer= primitive and therefore it should not appear in +% incomplete =\if= statements. Thus the following solution was +% chosen which hides the =\cr= in other macros when \TeX\ +% is skipping conditional text. +% \changes{v2.3c}{1995/04/23}{Use \cs{expandafter}'s in conditional} +% \begin{macrocode} + \expandafter\@xargarraycr\else + \expandafter\@yargarraycr\fi{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xargarraycr} +% \begin{macro}{\@yargarraycr} +% The following macros were already explained above. +% \changes{v2.4e}{2016/10/07}{Fixing SX68732} +% \begin{macrocode} +\def\@xargarraycr#1{\unskip\gdef\do@row@strut + {\@tempdima #1\advance\@tempdima \dp\@arstrutbox + \vrule \@depth\@tempdima \@width\z@\global\let\do@row@strut\relax}% +% \end{macrocode} +% If the last column is a =\multicolumn= cell then we need to +% insert the row strut now as it isn't inside the template (as that +% got =\omit=ted). +% \changes{v2.4h}{2018/04/30}{Fixing issue 42} + % \begin{macrocode} + \ifnum\@multicnt >\z@ \do@row@strut \fi + \cr} +\let\do@row@strut\relax +% \end{macrocode} +% +% \begin{macrocode} +\def\@yargarraycr#1{\cr\noalign{\vskip #1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% +% \section{Spanning several columns} +% +% \begin{macro}{\multicolumn} +% If several columns should be held together with a special format +% the command =\multicolumn= must be used. It has three +% arguments: the number of columns to be covered; the format for +% the result column and the actual column entry. +% \changes{v2.3j}{1998/01/29}{Command made \cs{long} to match +% kernel change for pr/2180} +% \begin{macrocode} +\long\def\multicolumn#1#2#3{% +% \end{macrocode} +% First we combine the given number of columns into a single one; +% then we start a new block so that the following definition is kept +% local. +% \begin{macrocode} + \multispan{#1}\begingroup +% \end{macrocode} +% Since a =\multicolumn= should only describe the format of a +% result column, we redefine =\@addamp= in such a way that one gets +% an error message if one uses more than one \texttt{c}, +% \texttt{l}, \texttt{r}, \texttt{p}, \texttt{m} or \texttt{b} in +% the second argument. One should consider that this definition is +% local to the build-up of the preamble; an \textsf{array}-- or +% \textsf{tabular}--environment in the third argument of the +% =\multicolumn= is therefore worked through correctly as well. +% \begin{macrocode} + \def\@addamp{\if@firstamp \@firstampfalse \else + \@preamerr 5\fi}% +% \end{macrocode} +% Then we evaluate the second argument with the help of +% =\@mkpream=. +% Now we still have to insert the contents of the \textsf{token} +% register into the =\@preamble=, i.e.\ we have to say +% =\xdef\@preamble{\@preamble}=. This is achieved shorter by +% writing: +% \begin{macrocode} + \@mkpream{#2}\@addtopreamble\@empty +% \end{macrocode} +% After the =\@preamble= is created we forget all local +% definitions and occupations of the \textsf{token} registers. +% \begin{macrocode} + \endgroup +% \end{macrocode} +% In the special situation of =\multicolumn= =\@preamble= +% is not needed as preamble for a =\halign= but it is directly +% inserted into our table. Thus instead of =\sharp= +% there has to be the column entry (=#3=) wanted by the user. +% \begin{macrocode} + \def\@sharp{#3}% +% \end{macrocode} +% Now we can pass the =\@preamble= to \TeX\ . For safety +% we start with an =\@arstrut=. This should usually be in the +% template for the first column however we do not know if this +% template was overwritten by our =\multicolumn=. +% We also add a =\null= at the right end to prevent any following +% =\unskip= (for example from =\\[..]=) to remove the =\tabcolsep=. +% \changes{v2.2e}{1994/06/01}{Added \cs{null}} +% \begin{macrocode} + \@arstrut \@preamble + \null + \ignorespaces} +% \end{macrocode} +% \end{macro} +% +% +% +% \section{The Environment Definitions} +% +% After these preparations we are able to define the environments. They +% only differ in the initialisations of =\d@llar...=, =\col@sep= +% and =\@halignto=. +% +% \begin{macro}{\@halignto} +% \begin{macro}{\d@llarbegin} +% \begin{macro}{\d@llarend} +% =\d@llar= has to be +% locally asigned since otherwise nested \textsf{tabular} and \textsf{array} +% environments (via =\multicolumn=) are impossible. +% For 25 years or so =\@halignto= was set globally (to save space on the +% save stack, but that was a mistake: if there is a tabular in the +% output routine (e.g., in the running header) then that tabular is +% able overwrite the =\@halignto= +% setting of a tabular in the main text resulting in a very weird error. +% \changes{v2.4d}{2016/10/06}{\cs{@halignto} set locally (pr/4488)} +% \changes{v2.0g}{1992/06/18}{`d@llarbegin defined on toplevel.} +% When the new font selection scheme is in force we have to +% we surround all =\halign= entries +% with braces. See remarks in TUGboat 10\#2. Actually we are going +% to use =\begingroup= and =\endgroup=. However, this is only +% necessary when we are in text mode. In math the surrounding +% dollar signs will already serve as the necessary extra grouping +% level. Therefore we switch the settings of =\d@llarbegin= and +% =\d@llarend= between groups and dollar signs. +% \begin{macrocode} +\let\d@llarbegin\begingroup +\let\d@llarend\endgroup +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\array} +% Our new definition of =\array= then reads: +% \changes{v2.0d}{1990/08/20}{`d@llar local to preamble.} +% \changes{v2.4d}{2016/10/06}{\cs{@halignto} set locally (pr/4488)} +% \begin{macrocode} +\def\array{\col@sep\arraycolsep + \def\d@llarbegin{$}\let\d@llarend\d@llarbegin\def\@halignto{}% +% \end{macrocode} +% Since there might be an optional argument we call another +% macro which is also used by the other environments. +% \begin{macrocode} + \@tabarray} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@tabarray} +% \emph{The code below has been replaced long time ago by an +% extended version further down but the code and its documentation +% was left here for reference. It is now commented out to avoid +% confusion.} +% +% This macro tests for a optional bracket and then calls up +% =\@array= or =\@array[c]= (as default). +% \begin{macrocode} +%\def\@tabarray{\@ifnextchar[{\@array}{\@array[c]}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tabular} +% \begin{macro}{\tabular*} +% The environments \textsf{tabular} and \textsf{tabular$*$} differ +% only in the initialisation of the command =\@halignto=. Therefore +% we define +% \changes{v2.4d}{2016/10/06}{\cs{@halignto} set locally (pr/4488)} +% \begin{macrocode} +\def\tabular{\def\@halignto{}\@tabular} +% \end{macrocode} +% and analogously for the star form. We evaluate the argument first +% using =\setlength= so that users of the \texttt{calc} package can +% write code like\\ =\begin{tabular*}{(\columnwidth-1cm)/2}...= +% \changes{v2.3l}{1998/05/13}{Use \cs{setlength} evaluate arg +% so that the calc package can be applied here (pr/2793)} +% \changes{v2.4d}{2016/10/06}{\cs{@halignto} set locally (pr/4488)} +% \begin{macrocode} +\expandafter\def\csname tabular*\endcsname#1{% + \setlength\dimen@{#1}% + \edef\@halignto{to\the\dimen@}\@tabular} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@tabular} +% The rest of the job is carried out by the =\@tabular= macro: +% \begin{macrocode} +\def\@tabular{% +% \end{macrocode} +% First of all we have to make sure that we start out in +% \textsf{hmode}. Otherwise we might find our table dangling by +% itself on a line. +% \begin{macrocode} + \leavevmode +% \end{macrocode} +% It should be taken into consideration that the macro =\@array= +% must be called in math mode. Therefore we open a \textsf{box}, +% insert a =$= and then assign the correct values to =\col@sep= and +% =\d@llar...=. +% \changes{v2.0d}{1990/08/20}{`d@llar local to preamble.} +% \begin{macrocode} + \hbox \bgroup $\col@sep\tabcolsep \let\d@llarbegin\begingroup + \let\d@llarend\endgroup +% \end{macrocode} +% Now everything \textsf{tabular} specific is done and we are able to +% call the =\@tabarray= macro. +% \begin{macrocode} + \@tabarray} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endarray} +% \emph{The code below has been replaced long time ago by an +% extended version further down but the code and its documentation +% was left here for reference. It is now commented out to avoid +% confusion.} +% +% When the processing of \textsf{array} is finished we have to +% close the =\halign= +% and afterwards the surrounding \textsf{box} selected by +% =\@array=. To save \textsf{token} space we then redefine +% =\@preamble= +% because its replacement text isn't longer needed. +% \begin{macrocode} +%\def\endarray{\crcr \egroup \egroup \gdef\@preamble{}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endtabular} +% \begin{macro}{\endtabular*} +% To end a \textsf{tabular} or \textsf{tabular$*$} environment we +% call up =\endarray=, close the math mode and then the surrounding +% =\hbox=. +% \begin{macrocode} +\def\endtabular{\endarray $\egroup} +\expandafter\let\csname endtabular*\endcsname=\endtabular +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% \section{Last minute definitions} +% +% +% If this file is used as a package file we should =\let= all macros +% to =\relax= that were used in the original but are no longer +% necessary. +% \begin{macrocode} +\let\@ampacol=\relax \let\@expast=\relax +\let\@arrayclassiv=\relax \let\@arrayclassz=\relax +\let\@tabclassiv=\relax \let\@tabclassz=\relax +\let\@arrayacol=\relax \let\@tabacol=\relax +\let\@tabularcr=\relax \let\@@endpbox=\relax +\let\@argtabularcr=\relax \let\@xtabularcr=\relax +% \end{macrocode} +% +% \begin{macro}{\@preamerr} +% We also have to redefine the error routine =\@preamerr= since +% new kind of errors are possible. +% The code for this macro is not perfect yet; +% it still needs too much memory. +% \begin{macrocode} +\def\@preamerr#1{\def\@tempd{{..} at wrong position: }% + \PackageError{array}{% + \ifcase #1 Illegal pream-token (\@nextchar): `c' used\or %0 + Missing arg: token ignored\or %1 + Empty preamble: `l' used\or %2 + >\@tempd token ignored\or %3 + <\@tempd changed to !{..}\or %4 + Only one column-spec. allowed.\fi}\@ehc} %5 +% \end{macrocode} +% \end{macro} +% +% +% +% \section +% [Defining your own column specifiers] +% {Defining your own column specifiers\footnotemark} +% +% \footnotetext{The code and the documentation in this section was +% written by David. So far only the code from newarray was plugged +% into array so that some parts of the documentation still claim +% that this is newarray and even worse, some parts of the code are +% unnecessarily doubled. This will go away in a future release. For +% the moment we thought it would be more important to bring both +% packages together.} +% \changes{v2.1a}{1992/07/03}{Newcolumn stuff added} +% +% \DeleteShortVerb{\=} +% \MakeShortVerb{\"} +% +% \begin{macro}{\newcolumn} +% In \texttt{newarray.sty} the macro for specifying new columns was +% named "\newcolumn". When the functionality was added to +% \texttt{array.sty} the command was renamed "\newcolumntype". +% Initially both names were supported, but now (In versions of this +% package distributed for \LaTeXe) the old name is not defined. +% \changes{v2.2a}{1994/02/03}{Now made `newcolumn an error} +% \changes{v2.2a}{1994/02/04}{Removed `newcolumn} +% \begin{macrocode} +%<*ncols> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newcolumntype} +% \changes{v2.1b}{1992/06/07}{Macro renamed from `newcolumn} As +% described above, the "\newcolumntype" macro gives users the chance +% to define letters, to be used in the same way as the primitive +% column specifiers, `c' `p' etc. +% \begin{macrocode} +\def\newcolumntype#1{% +% \end{macrocode} +% "\NC@char" was added in V2.01 so that active characters, like "@" in +% AMS\LaTeX\ may be used. This trick was stolen from \texttt{array.sty} +% 2.0h. Note that we need to use the possibly active token, +% "#1", in several places, as that is the token that actually +% appears in the preamble argument. +% \begin{macrocode} + \edef\NC@char{\string#1}% +% \end{macrocode} +% First we check whether there is already a definition for this column. +% Unlike "\newcommand" we give a warning rather than an error if it is +% defined. If it is a new column, add "\NC@do" \meta{column} to +% the list "\NC@list". +% \begin{macrocode} + \@ifundefined{NC@find@\NC@char}% + {\@tfor\next:=<>clrmbp@!|\do + {% +% \end{macrocode} +% We use \cs{noexpand} on the tokens from the list in case one or +% the other (typically \texttt{@}, \texttt{!} or \texttt{|}) has +% been made active. +% \changes{v2.4l}{2019/08/31}{Add a necessary \cs{expandafter} (github/148)} +% \begin{macrocode} + \if\expandafter\noexpand\next\NC@char + \PackageWarning{array}% + {Redefining primitive column \NC@char}\fi}% + \NC@list\expandafter{\the\NC@list\NC@do#1}}% + {\PackageWarning{array}{Column \NC@char\space is already defined}}% +% \end{macrocode} +% Now we define a macro with an argument delimited by the new column +% specifier, this is used to find occurrences of this specifier in the +% user preamble. +% \begin{macrocode} + \@namedef{NC@find@\NC@char}##1#1{\NC@{##1}}% +% \end{macrocode} +% If an optional argument was not given, give a default argument of 0. +% \begin{macrocode} + \@ifnextchar[{\newcol@{\NC@char}}{\newcol@{\NC@char}[0]}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\newcol@} +% We can now define the macro which does the rewriting, +% "\@reargdef" takes the same arguments as "\newcommand", but +% does not check that the command is new. For a column, say `D' with +% one argument, define a command "\NC@rewrite@D" with one +% argument, which recursively calls "\NC@find" on the user preamble +% after replacing the first token or group with the replacement text +% specified in the "\newcolumntype" command. "\NC@find" will find the +% next occurrence of `D' as it will be "\let" equal to +% "\NC@find@D" by "\NC@do". +% \begin{macrocode} +\def\newcol@#1[#2]#3{\expandafter\@reargdef + \csname NC@rewrite@#1\endcsname[#2]{\NC@find#3}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\NC@} +% Having found an occurrence of the new column, save the preamble +% before the column in "\@temptokena", then check to see if we +% are at the end of the preamble. (A dummy occurrence of the column +% specifier will be placed at the end of the preamble by "\NC@do". +% \begin{macrocode} +\def\NC@#1{% + \@temptokena\expandafter{\the\@temptokena#1}\futurelet\next\NC@ifend} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\NC@ifend} +% We can tell that we are at the end as "\NC@do" will place a "\relax" +% after the dummy column. +% \begin{macrocode} +\def\NC@ifend{% +% \end{macrocode} +% If we are at the end, do nothing. (The whole preamble will now be in +% "\@temptokena".) +% \begin{macrocode} + \ifx\next\relax +% \end{macrocode} +% Otherwise set the flag "\if@tempswa", and rewrite the column. +% "\expandafter" introduced 1n V2.01 +% \begin{macrocode} + \else\@tempswatrue\expandafter\NC@rewrite\fi} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\NC@do} +% If the user has specified `C' and `L' as new columns, the list of +% rewrites (in the token register "\NC@list") will look like +% "\NC@do *" "\NC@do C" "\NC@do L". +% So we need to define "\NC@do" as a one argument macro which +% initialises the rewriting of the specified column. Let us assume that +% `C' is the argument. +% \begin{macrocode} +\def\NC@do#1{% +% \end{macrocode} +% First we let "\NC@rewrite" and "\NC@find" be +% "\NC@rewrite@C" and "\NC@find@C" respectively. +% \begin{macrocode} + \expandafter\let\expandafter\NC@rewrite + \csname NC@rewrite@\string#1\endcsname + \expandafter\let\expandafter\NC@find + \csname NC@find@\string#1\endcsname +% \end{macrocode} +% Clear the token register "\@temptokena" after putting the present +% contents of the register in front of the token "\NC@find". At the +% end we place the tokens `"C\relax"' which "\NC@ifend" will use +% to detect the end of the user preamble. +% \begin{macrocode} + \expandafter\@temptokena\expandafter{\expandafter}% + \expandafter\NC@find\the\@temptokena#1\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\showcols} +% This macro is useful for debugging "\newcolumntype" specifications, +% it is the equivalent of the primitive "\show" command for macro +% definitions. All we need to do is locally redefine "\NC@do" to take +% its argument (say `C') and then "\show" the (slightly modified) +% definition of "\NC@rewrite@C". Actually as the the list always +% starts off with "\NC@do *" and we do not want to print the +% definition of the $*$-form, define "\NC@do" to throw away the first +% item in the list, and then redefine itself to print the rest of the +% definitions. +% \begin{macrocode} +\def\showcols{{\def\NC@do##1{\let\NC@do\NC@show}\the\NC@list}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\NC@show} +% If the column `C' is defined as above, then +% "\show\NC@rewrite@C" would output\\ +% "\long macro: ->\NC@find >{$}c<{$}". +% We want to strip the "long macro: ->" and the "\NC@find". So first we +% use "\meaning" and then apply the macro "\NC@strip" to the tokens so +% produced and then "\typeout" the required string. +% \begin{macrocode} +\def\NC@show#1{% + \typeout{Column #1\expandafter\expandafter\expandafter\NC@strip + \expandafter\meaning\csname NC@rewrite@#1\endcsname\@@}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\NC@strip} +% Delimit the arguments to "\NC@strip" with `\texttt{:}', `\texttt{->}', +% a space, and "\@@" to pull out the required parts of the output from +% "\meaning". +% \begin{macrocode} +\def\NC@strip#1:#2->#3 #4\@@{#2 -> #4} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\NC@list} +% Allocate the token register used for the rewrite list. +% \begin{macrocode} +\newtoks\NC@list +% \end{macrocode} +% \end{macro} +% +% \subsection{The $*$--form} +% We view the $*$-form as a slight generalisation of the system +% described in the previous subsection. The idea is to define a $*$ +% column by a command of the form: +% \begin{verbatim} +% \newcolumntype{*}[2]{% +% \count@=#1\ifnum\count@>0 +% \advance\count@ by -1 #2*{\count@}{#2}\fi} +% \end{verbatim} +% \begin{macro}{\NC@rewrite@*}\label{NC@rewrite@*} +% \changes{v2.4b}{2005/08/23}{Fix occasional spurious space (PR/3755)} +% This does not work however as "\newcolumntype" takes great care not +% to expand anything in the preamble, and so the "\if" is never +% expanded. "\newcolumntype" sets up various other parts of the +% rewrite correctly though so we can define: +% \begin{macrocode} +\newcolumntype{*}[2]{} +% \end{macrocode} +% Now we must correct the definition of "\NC@rewrite@*". The +% following is probably more efficient than a direct translation of +% the idea sketched above, we do not need to put a $*$ in the preamble +% and call the rewrite recursively, we can just put "#1" copies of +% "#2" into "\@temptokena". (Nested $*$ forms will be expanded +% when the whole rewrite list is expanded again, see "\@mkpream") +% \begin{macrocode} +\long\@namedef{NC@rewrite@*}#1#2{% +% \end{macrocode} +% Store the number. +% \begin{macrocode} + \count@#1\relax +% \end{macrocode} +% Put "#1" copies of "#2" in the token register. +% \begin{macrocode} + \loop + \ifnum\count@>\z@ + \advance\count@\m@ne + \@temptokena\expandafter{\the\@temptokena#2}% + \repeat +% \end{macrocode} +% "\NC@do" will ensure that "\NC@find" is "\let" equal +% to "\NC@find@*". +% \begin{macrocode} + \NC@find} +% \end{macrocode} +% \end{macro} +% +% \subsection{Modifications to internal macros of \texttt{array.sty}} +% +% \begin{macro}{\@xexpast} +% \begin{macro}{\@xexnoop} +% These macros are used to expand $*$-forms in +% \texttt{array.sty}. "\let" them to "\relax" to save space. +% \begin{macrocode} +\let\@xexpast\relax +\let\@xexnoop\relax +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\save@decl} +% We do not assume that the token register is free, we add the new +% declarations to the front of the register. This is to allow user +% preambles of the form, ">{foo}>{bar}..". Users are not encouraged to +% enter such expressions directly, but they may result from the +% rewriting of "\newcolumntype"'s. +% \begin{macrocode} +\def\save@decl{\toks \count@ = \expandafter\expandafter\expandafter + {\expandafter\@nextchar\the\toks\count@}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@mkpream} +% The main modification to "\@mkpream" is to replace the call to +% "\@xexpast" (which expanded $*$-forms) by a loop which expands +% all "\newcolumntype" specifiers. +% \changes{v2.4e}{2016/10/07}{Fixing SX68732} +% \changes{v2.4f}{2017/11/04}{Managing m-cells without \cs{vcenter}} +% \begin{macrocode} +\def\@mkpream#1{\gdef\@preamble{}\@lastchclass 4 \@firstamptrue + \let\@sharp\relax +% \end{macrocode} +% +% \changes{v2.4j}{2018/11/13}{Do not expand argument of +% \cs{@startpbox} while building the tabular preamble (sx/459285)} +% The "\@startpbox" (which is called for "p", "m" or "b" columns) +% receives a user supplied argument: the width of the +% paragraph-column. Normally that is something harmless like a length or a +% simple length expression, but with the calc package involved it +% could break under an "\edef" operation, which is how the preamble +% is constructed. We now make use of "\unexpanded" here to prevent that. The +% "\expandafter" gymnastics is necessary to expand the "#1" at least +% once (since it will get "\@nextchar" as its value and need its +% content! +% \begin{macrocode} + \def\@startpbox##1{\unexpanded\expandafter{\expandafter + \@startpbox\expandafter{##1}}}\let\@endpbox\relax + \let\do@row@strut\relax + \let\ar@align@mcell\relax +% \end{macrocode} +% Now we remove possible $*$-forms and user-defined column +% specifiers in the user preamble by repeatedly executing the list +% "\NC@list" until the re-writes have no more effect. The +% expanded preamble will then be in the token register +% "\@temptokena". Actually we need to know at this point that +% this is not "\toks0". +% \begin{macrocode} + \@temptokena{#1}\@tempswatrue + \@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}% +% \end{macrocode} +% Afterwards we initialize all registers and macros, that we need +% for the build-up of the preamble. +% \begin{macrocode} + \count@\m@ne + \let\the@toks\relax + \prepnext@tok +% \end{macrocode} +% Having expanded all tokens defined using "\newcolumntype" (including +% "*"), we evaluate the remaining tokens, which are saved in +% "\@temptokena". We use the \LaTeX--macro "\@tfor" to inspect each +% token in turn. +% \begin{macrocode} + \expandafter \@tfor \expandafter \@nextchar + \expandafter :\expandafter =\the\@temptokena \do +% \end{macrocode} +% "\@testpatch" does not take an argument since \texttt{array.sty} 2.0h. +% \begin{macrocode} + {\@testpach + \ifcase \@chclass \@classz \or \@classi \or \@classii + \or \save@decl \or \or \@classv \or \@classvi + \or \@classvii \or \@classviii +% \end{macrocode} +% In \texttt{newarray.sty} class 9 is equivalent to class 10. +% \begin{macrocode} + \or \@classx + \or \@classx \fi + \@lastchclass\@chclass}% + \ifcase\@lastchclass + \@acol \or + \or + \@acol \or + \@preamerr \thr@@ \or + \@preamerr \tw@ \@addtopreamble\@sharp \or + \or + \else \@preamerr \@ne \fi + \def\the@toks{\the\toks}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@classix} +% \texttt{array.sty} does not allow repeated \texttt{>} +% declarations for the same column. This is allowed in +% \texttt{newarray.sty} as documented in the introduction. Removing +% the test for this case makes class 9 equivalent to class 10, and +% so this macro is redundant. It is "\let" to "\relax" to save +% space. +% \begin{macrocode} +\let\@classix\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@classviii} +% In \texttt{newarray.sty} explicitly allow class 2, as repeated +% \texttt{<} expressions are accepted by this package. +% \begin{macrocode} +\def\@classviii{\ifnum \@lastchclass >\z@\ifnum\@lastchclass=\tw@\else + \@preamerr 4\@chclass 6 \@classvi \fi\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@classv} +% Class 5 is \texttt{@}-expressions (and is also called by class 1) +% This macro was incorrect in Version~1. Now we do not expand the +% "@"-expression, but instead explicitly replace an +% "\extracolsep" command by an assignment to "\tabskip" by a +% method similar to the "\newcolumntype" system described above. +% "\d@llarbegin" "\d@llarend" were introduced in V2.01 to match +% \texttt{array.sty} 2.0h. +% \begin{macrocode} +\def\@classv{\save@decl + \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@ + \@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}% + \prepnext@tok} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\NC@ecs} +% Rewrite the first occurrence of "\extracolsep{1in}" to +% "\tabskip1in\relax". As a side effect discard any tokens after a +% second "\extracolsep", there is no point in the user entering two of +% these commands anyway, so this is not really a restriction. +% \begin{macrocode} +\def\NC@ecs#1\extracolsep#2#3\extracolsep#4\@@@{\def\@tempa{#2}% + \ifx\@tempa\@empty\else\toks\count@={#1\tabskip#2\relax#3}\fi} +%</ncols> +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Support for the \texttt{delarray.sty}} +% +% The \texttt{delarray.sty} package extends the array syntax by +% supporting the notation of delimiters. To this end we extend the +% array parsing mechanism to include a hook which can be used by this +% (or another) package to do some additional parsing. +% +% \begin{macro}{\@tabarray} +% This macro tests for an optional bracket and then calls up +% "\@@array" or "\@@array[c]" (as default). +% \begin{macrocode} +%<*package> +\def\@tabarray{\@ifnextchar[{\@@array}{\@@array[c]}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@@array} +% This macro tests could then test an optional delimiter before the +% left brace of the main preamble argument. Here in the main package +% it simply is let to be "\@array". +% \begin{macrocode} +\let\@@array\@array +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endarray} +% \begin{macro}{\@arrayright} +% We have to declare the hook we put into "\@array" above. +% A similar hook `"\@arrayright"' will be inserted into the +% "\endarray" to gain control. Both defaults to empty. +% \begin{macrocode} +\def\endarray{\crcr \egroup \egroup \@arrayright \gdef\@preamble{}} +\let\@arrayleft\@empty +\let\@arrayright\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Support for \texttt{\textbackslash firsthline} and +% \texttt{\textbackslash lasthline}} +% +% The Companion~\cite[p.137]{bk:GMS94} suggests two additional +% commands to control the alignments in case of tabulars with +% horizontal lines. They are now added to this package. +% +% \begin{macro}{\extratabsurround} +% The extra space around a table when "\firsthline" or "\lasthline" +% are used. +% \begin{macrocode} +\newlength{\extratabsurround} +\setlength{\extratabsurround}{2pt} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\backup@length} +% This register will be used internally by "\firsthline" and +% "\lasthline". +% \begin{macrocode} +\newlength{\backup@length} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\firsthline} +% \changes{v2.3h}{1996/05/25}{Complete reimplementation} +% This code can probably be improved but for the moment it should +% serve. +% +% We start by producing a single tabular row without any visible +% content that will produce the external reference point in case +% "[t]" is used. +% \begin{macrocode} +\newcommand{\firsthline}{% + \multicolumn1c{% +% \end{macrocode} +% Within this row we calculate "\backup@length" to be the height +% plus depth of a standard line. In addition we have to add the +% width of the "\hline", something that was forgotten in the +% original definition. +% \begin{macrocode} + \global\backup@length\ht\@arstrutbox + \global\advance\backup@length\dp\@arstrutbox + \global\advance\backup@length\arrayrulewidth +% \end{macrocode} +% Finally we do want to make the height of this first line be a bit +% larger than usual, for this we place the standard array strut +% into it but raised by "\extratabsurround" +% \begin{macrocode} + \raise\extratabsurround\copy\@arstrutbox +% \end{macrocode} +% Having done all this we end the line and back up by the value of +% "\backup@length" and then finally place our "\hline". This should +% place the line exactly at the right place but keep the reference +% point of the whole tabular at the baseline of the first row. +% \begin{macrocode} + }\\[-\backup@length]\hline +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\lasthline} +% \changes{v2.3h}{1996/05/25}{Complete reimplementation} +% For "\lasthline" the situation is even worse and I got it +% completely wrong initially. +% +% The problem in this case is that if the optional argument "[b]" +% is used we do want the reference point of the tabular be at the +% baseline of the last row but at the same time do want the the +% depth of this last line increased by "\extratabsurround" without +% changing the placement "\hline". +% +% We start by placing the rule followed by an invisible row. +% \begin{macrocode} +\newcommand{\lasthline}{\hline\multicolumn1c{% +% \end{macrocode} +% We now calculate "\backup@length" to be the height and depth of +% two lines plus the width of the rule. +% \begin{macrocode} + \global\backup@length2\ht\@arstrutbox + \global\advance\backup@length2\dp\@arstrutbox + \global\advance\backup@length\arrayrulewidth +% \end{macrocode} +% This will bring us back to the baseline of the second last row: +% \begin{macrocode} + }\\[-\backup@length]% +% \end{macrocode} +% Thus if we now add another invisible row the reference point of +% that row will be at the baseline of the last row (and will be the +% reference for the whole tabular). Since this row is invisible we +% can enlarge its depth by the desired amount. +% \begin{macrocode} + \multicolumn1c{% + \lower\extratabsurround\copy\@arstrutbox + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Getting the spacing around rules right} +% +% Beside a larger functionality \texttt{array.sty} has one +% important difference to the standard \texttt{tabular} and +% \texttt{array} environments: horizontal and vertical rules make a +% table larger or wider, e.g., \verb=\doublerulesep= really denotes +% the space between two rules and isn't measured from the middle of +% the rules. +% +% \begin{macro}{\@xhline} +% For vertical rules this is implemented by the definitions above, +% for horizontal rules we have to take out the backspace. +% \changes{v2.3d}{1995/11/19}{fix space between double rules pr/1945} +% \begin{macrocode} +\CheckCommand*\@xhline{\ifx\reserved@a\hline + \vskip\doublerulesep + \vskip-\arrayrulewidth + \fi + \ifnum0=`{\fi}} +\renewcommand*\@xhline{\ifx\reserved@a\hline + \vskip\doublerulesep + \fi + \ifnum0=`{\fi}} +%</package> +% \end{macrocode} +% \end{macro} + +% \subsection{Implementing column types \texttt{w} and \texttt{W}} +% +% In TugBoat 38/2 an extension was presented that implemented two +% aditional column types \texttt{w} and \texttt{W}. These have now +% been added to the package itself. +% +% +% \begin{macro}{\ar@cellbox} +% For \texttt{w} and \texttt{W} column types we need a box to +% temporarily hold the cell content. +% \changes{v2.4f}{2017/11/07}{Macro added} +% \begin{macrocode} +\newsavebox\ar@cellbox +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\newcolumntype w} +% The \texttt{w} column type has two arguments: the first holds the +% alignment which is either "l", "c", or "r" and the second is the +% nominal width of the column. +% \changes{v2.4f}{2017/11/07}{Column type added} +% \begin{macrocode} +\newcolumntype{w}[2]{% +% \end{macrocode} +% Before the cell content we start an "lrbox"-environment to +% collect the cell material into the previously allocated box +% "\ar@cellbox". +% \begin{macrocode} + >{\begin{lrbox}\ar@cellbox}% +% \end{macrocode} +% Then comes a specifier for the cell content. We use "c", but +% that doesn't matter as in the end we will always put a box of a +% specific width ("#2") into the cells of that column, so "l" or +% "r" would give the same result. There is only a difference if +% there are also very wide "\multicolumn" rows overwriting the +% setting in which case "c" seems to be slightly better. +% \begin{macrocode} + c% +% \end{macrocode} +% At the end of the cell we end the "lrbox" environment so that all +% of the cell content is now in box "\ar@cellbox". As a final step we +% put that box into a "\makebox" using the optional arguments of +% that command to achieve the correct width and the desired +% alignment within that width. +% \begin{macrocode} + <{\end{lrbox}% + \makebox[#2][#1]{\usebox\ar@cellbox}}} +% \end{macrocode} +% \end{macro} + +% +% +% \begin{macro}{\newcolumntype W} +% The \texttt{W} is similar but in this case we want a warning if +% the cell content is too wide. +% \changes{v2.4f}{2017/11/07}{Column type added} +% \begin{macrocode} +\newcolumntype{W}[2] + {>{\begin{lrbox}\ar@cellbox}% + c% + <{\end{lrbox}% + \let\hss\hfil + \makebox[#2][#1]{\unhbox\ar@cellbox}}} +% \end{macrocode} +% This is a bit sneaky, as it temporarily disables "\hss", but +% given that we know what goes into that box it should be +% sufficient. +% \end{macro} +% +% +% \PrintIndex +% \PrintChanges +% +% \Finale +% +\endinput + diff --git a/Master/texmf-dist/source/latex-dev/tools/bm.dtx b/Master/texmf-dist/source/latex-dev/tools/bm.dtx new file mode 100644 index 00000000000..2216dcea077 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/bm.dtx @@ -0,0 +1,1705 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% +% \iffalse +%% Copyright 1996 1997 1998 1999 2002 2003 2004 2016 2017 2019 +%% David Carlisle Frank Mittelbach +%% +%% Development of this package was commissioned by Y&Y Inc. +% +% +%<*dtx> + \ProvidesFile{bm.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{bm} +%<driver>\ProvidesFile{bm.drv} +% \fi +% \ProvidesFile{bm.dtx} + [2019/07/24 v1.2d Bold Symbol Support (DPC/FMi)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage{bm} +\begin{document} +\DocInput{bm.dtx} +\end{document} +%</driver> +% \fi +% +% +% \GetFileInfo{bm.dtx} +% +% \title{The \textsf{bm} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}\ \thanks{Development of this package +% was commissioned by Y\&Y.}} +% +% \date{\filedate} +% \author{David Carlisle with support by Frank Mittelbach} +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% \section{Introduction} +% +% This package defines commands to access bold math +% symbols. The basic command is |\bm| which may be used to make the +% math expression in its argument be typeset using bold fonts. +% +% The syntax of |\bm| is:\\ +% |\bm|\marg{math expression}\\ +% So |$\alpha \not= \bm{\alpha}$| produces $\alpha \not= \bm{\alpha}$. +% +% |\bm| goes to some trouble to preserve the spacing, so that for +% instance |\bm<| is a bold $\bm<$ but with the correct |\mathrel| +% spacing that \TeX\ gives to $<$. The calculations that \TeX\ needs to +% do for |\bm| can be quite involved and so a definition form is +% provided. +% +% |\DeclareBoldMathCommand|%^^A +% \oarg{math version}\marg{cmd}\marg{math expression} +% +% Defines |\cmd| to be the bold form of the math expression. +% The \meta{math version} defaults to `bold' (i.e., |\boldmath|). +% +% For relatively simple expressions, the resulting definitions are very +% efficient, for instance after:\\ +% |\DeclareBoldMathCommand\balpha{\alpha}|\\ +% |\balpha| is a single `mathchardef' token producing a bold alpha, +% and so is just as fast to execute as |\alpha|. +% +% The above command is mainly intended for use in packages. +% For occasional use in \LaTeX\ documents, and for compatibility +% with the plain \TeX\ support for the mathtime fonts, a `user-level' +% version, |\bmdefine| is provided that is equivalent to:\\ +% |\DeclareBoldMathCommand[bold]|. +% +% If there is a `heavy' math version defined (usually accessed by a +% user-command |\heavymath|) then a similar command |\hm| +% is defined which access these `ultra bold' fonts. Currently this is +% probably only useful with the `mathtime plus' font collection. +% Definitions of commands that use these fonts may be made by +% specifying the optional argument `heavy' to |\DeclareBoldMathCommand|. +% Again an abbreviation, |\hmdefine|, is provided, equivalent to:\\ +% |\DeclareBoldMathCommand[heavy]|. +% +% The command names (but not the implementation) are taken from Michael +% Spivak's macros to support the mathtime fonts for plain \TeX. In those +% original macros, the syntax for |\bmdefine| was +% |\bmdefine\balpha{\bm\alpha}| (with a nested |\bm|). This syntax also +% works with this package. +% +% \section{Font allocation} +% In order to access bold fonts in the simplest and quickest possible +% manner, the package normally allocates symbol fonts for bold +% (and possibly heavy) fonts into the `normal' math version. +% By default it allocates at most four fonts for |\bm| and at most +% three fonts for |\hm|. This means that if the mathtime plus font set +% is being used, seven additional symbol fonts will be used, in addition +% to the basic four that \LaTeX\ already declares. The mathtime +% package also declares an extra symbol font, bringing the total to +% twelve. The maximum number of symbol \emph{and} math alphabet fonts +% that can be used in a math version is sixteen. So the above allocation +% scheme does not leave room for many extra math symbols (such as the +% AMS symbols) or math alphabets (such as |\mathit|). +% +% Before loading the \textsf{bm} package you may define |\bmmax| +% and |\hmmax| to be suitable values, for instance you may want +% to set |\newcommand\hmmax{0}| if you will not be using |\hm| +% much, but you do have a heavy math version defined. +% +% Even if |\bmmax| is set to zero, |\bm| will still access the correct +% bold fonts (by accessing the fonts via |\boldmath|) but this method +% is slower, and does not work with delimiters. Delimiters can only be +% made bold if the bold font has been allocated. +% +% Conversely if you have a non standard font set that makes available +% extra math delimiters and accents in bold and medium weights you may +% want to \emph{increase} |\bmmax| so that fonts are allocated for +% your font set. +% +% \section{Features} +% In most cases this package should work in a fairly self explanatory +% way, but there are some things that might not be obvious. +% +% \subsection{Interaction with Math Alphabet Commands} +% +% As mentioned above, |\bm| goes to some trouble to try to make a +% command that is just like its argument, but using a bold font. +% This does not always produce the effect that you might expect. +%\begin{verbatim} +% $1 g \bm{g}$ +% $2 \mathrm{g \bm{g}}$ +% $3 {g} \bm{{g}}$ +% $4 \mathrm{{g} \bm{{g}}}$ +% $5 \mathrm{g} \bm{\mathrm{g}}$ +%\end{verbatim} +% produces the following: +% \begin{flushleft} +% $1 g \bm{g}$ +% $2 \mathrm{g \bm{g}}$ +% $3 {g} \bm{{g}}$ +% $4 \mathrm{{g} \bm{{g}}}$ +% $5 \mathrm{g} \bm{\mathrm{g}}$ +% \end{flushleft} +% In math mode `g' is effectively a command that produces the letter `g' +% from the `letters' alphabet, unless a Math Alphabet command is in +% effect, in which case the `g' comes from the specified alphabet. +% |\bm{g}| makes an equivalent command, but which defaults to a bold +% letter alphabet. So in the first example |\bm{g}| is bold math italic, +% but in the second example the |\mathrm| applies to both |g| and +% |\bm{g}| in the same way, and so they are both roman. +% +% |\bm| only inspects the `top level' definition of a command, for more +% complicated expressions, and anything inside a |{ }| group, |\bm| +% forces bold fonts by essentially the same (slow) technique used by the +% AMS |\boldsymbol| command (but |\bm| still takes more care of the +% spacing). So the third example produces identical output to the first +% (but \TeX\ takes more time producing it). +% +% In the fourth example the |\mathrm{\bm{g}}| is essentially +% equivalent to |\mathrm{\mbox{\boldmath$g$}}|. Currently math alphabet +% settings are not passed down to `nested' math lists, and so in this +% example, the |\mathrm| has no effect, and a bold math italic $\bm g$ +% is obtained. +% +% Similarly the last example is equivalent to +% |$\mbox{\boldmath$\mathrm{g}$}}| and so in this case, one obtains a +% bold roman \textbf{g}. +% +% \subsection{Delimiters} +% \TeX\ can treat character tokens in two\footnote +% {Well more than two really.} +% ways. If there is a preceding +% |\left| or |\right| it can treat them as a delimiter, otherwise it can +% treat them as a standard character. For example |\left<\right>| +% produces $\left<\right>$, which is totally different from |<>|, which +% produces $<>$. +% +% \TeX\ can only do this for character tokens. Commands such as +% |\langle| do not act in this way. This means that |\bm| has to decide +% whether to treat a character as a delimiter or not. The rule it uses +% is, it makes a delimiter command for a character if the previous +% token in the argument was |\left| or |\right|. So |\left\bm{<}| does +% not work, but |\bm{\left<}| does. +% +% \subsection{Command Arguments} +% +% Normally if a command takes arguments the full command, including +% any arguments, should be included in |\bm|. +% +% So |\bm{\overbrace{abc}}| (producing \smash{$\bm{\overbrace{abc}}$}) +% not +% |\bm{\overbrace}{abc}|. If you do not include all the arguments you +% will typically get the error message:\\ +% |Runaway argument?|\\ +% |! Forbidden control sequence found while scanning use of| +% \texttt{\ldots} +% +% However commands defined in terms of the \TeX\ accent and +% radical primitives \emph{may} be used without their arguments. +% So |\bm{\hat}{a}| produces $\bm{\hat}{a}$, a bold accent over a +% non-bold $a$ (compare $\hat{a}$) +% whereas |\bm{\hat{a}}| makes both the $a$ and the accent bold, +% $\bm{\hat{a}}$. +% Similarly, although the \LaTeX\ command |\sqrt| must be used with its +% arguments, |\sqrtsign| may be used as in |\bm\sqrtsign{abc}| to +% produce $\bm\sqrtsign{abc}$ rather than $\sqrtsign{abc}$ or +% $\bm{\sqrtsign{abc}}$ +% +% If you really need to make a command with arguments use bold fonts +% without making all of the arguments bold, you can explicitly +% reset the math version in the argument, eg:\\ +% $\begin{array}{ccc} +% |\sqrt{xyz}|&|\bm{\sqrt{xyz}}|&|\bm{\sqrt{\mbox{\unboldmath$xyz$}}}|\\ +% \sqrt{xyz}& \bm{\sqrt{xyz}}& \bm{\sqrt{\mbox{\unboldmath$xyz$}}} +% \end{array}$ +% +% \subsection{Bold fonts} +% This package interrogates the font allocations of the bold and heavy +% math versions, to determine which bold fonts are available. +% This means that it is best to load the package \emph{after} +% any packages that define new symbol fonts, or (like the +% \textsf{mathtime} package) completely change the symbol font +% allocations. +% +% If no bold font appears to be available for a particular symbol, +% |\bm| will use `poor man's bold' that is, overprinting the same +% character in slightly offset +% positions to give an appearance of boldness. +% +% In the standard Computer Modern font set, there is no bold +% `large symbols' font. In the `mathptm' and (standard) mathtime +% font sets there are no bold math fonts. In the `mathtime plus' +% font set there are suitable fonts for bold and heavy math setting, +% and so |\bm| and |\hm| work well. Similarly in the basic Lucida +% New Math font set there are no bold math fonts, so |\bm| will +% use `poor man's bold. However if the Lucida Expert set is used, +% Then |\bm| will detect, and use the bold math fonts that are +% available. +% +% As discussed above, one may set |\bmmax| higher or lower than its +% default value of four to control the font allocation system. Finer +% control may be gained by explicitly declaring bold symbol fonts. +% Suppose you have a symbol font `xyz' that is available in medium and +% bold weights, then you would declare this to \LaTeX\ via:\\ +% |\DeclareSymbolFont{extras} {OMS}{xyz}{m}{n}|\\ +% |\SetSymbolFont{extras}{bold}{OMS}{xyz}{bx}{n}|\\ +% At this point the symbols will be available in the normal math +% version, and their bold variants in |\boldmath|. If you also +% declare:\\ +% |\DeclareSymbolFont{boldextras}{OMS}{xyz}{bx}{n}|\\ +% That is, declare a symbol font whose name is formed by prefixing +% `bold' (or `heavy') to an existing symbol font, then |\bm| (or +% |\hm|) will use this font directly, rather then accessing the +% `extras' symbol font via |\boldmath|. +% +% \subsection{Strange failures} +% In order to get the correct spacing, |\bm| has to `investigate' the +% definition of the commands in its argument. It is possible that +% some strange constructions could `confuse' this investigation. +% If this happens then \LaTeX\ will almost certainly stop with a strange +% error. This should not happen with any of the math symbols +% defined in the base \LaTeX\ or AMS distributions, or any commands +% defined in terms of those symbols using normal \LaTeX\ math +% constructs. However if some command does fail to work inside |\bm| +% you should always be able to surround it with an extra set of braces +% |\bm{{\cmd}}| rather than |\bm{\cmd}|. |\bm| will not then attempt +% to set the correct spacing, so you may need to set it explicitly, +% for instance, for a relation, |\bm{\mathrel{\cmd}}|. +% +% \subsection{AMS package \textsf{amsbsy}} +% The |\bm| command shares some functionality with the |\boldsymbol| +% command from the AMS \LaTeX\ collection. To aid in moving documents +% between these two packages, this package defines |\boldsymbol| and +% |\heavysymbol| as alternative names for |\bm| and |\hm|. +% +% \StopEventually{} +% +% \section{Implementation} +% +% \changes{v0.01}{1996/12/01} +% {Initial DPC attempt, +% remove all assumptions about mathtime encoding} +% \changes{v0.02}{1996/12/02} +% {Add \cs{mathchoice} stuff} +% \changes{v0.03}{1996/12/12} +% {Completely reimplement (again). Add \cs{bmdefine}.} +% \changes{v0.04}{1996/12/12} +% {Add \cs{hm} and support for special active mathcode.} +% \changes{v0.05}{1996/12/12} +% {Assorted fixes} +% \changes{v0.99}{1997/01/16} +% {First public version} +% \changes{v1.0a}{1997/02/14} +% {First ctan version (same as 0.99b)} +% \changes{v1.0b}{1997/04/14} +% {Add to tools bundle.} +% \changes{v1.0g}{1999/07/05} +% {minor doc changes latex/3058} +% +% +% +% The commands |\bm| and |\hm| work by defining a number of additional +% symbol fonts corresponding to the standard ones +% `operators', `letters', `symbols', and `largesymbols'. +% The names for these symbols fonts are produced by prefixing the usual +% name with `bold' or `heavy'. +% +% For maximum flexibility we get the font definitions by looking in the +% corresponding math versions, i.e., into |\mv@bold| and if defined into +% |\mv@heavy|. +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% \changes{v0.09}{1996/12/19} +% {Always define \cs{bm} even if no bold math} +% +% \begin{macro}{\bm@table} +% \changes{v0.10}{1997/01/04} +% {Macro added} +% \changes{v0.12}{1997/01/10} +% {Ensure do not allocate too many math group slots.} +% \changes{v0.99a}{1997/01/17} +% {Let \cs{hm} use font allocated for \cs{bm}} +% \changes{v0.99b}{1997/01/19} +% {Restore NFSS internals} +% \begin{macro}{\bm@boldtable} +% \begin{macro}{\bm@heavytable} +% The table, |\bm@table|, (which is locally |\let| to either the bold +% or heavy version) defines, for each \meta{math group} (\meta{fam}), +% the `offset' to the bold version of the specified symbol font. +% If there is no bold symbol font defined, the offset will be +% set to zero if there is a bold font assigned to this slot in the +% bold math version, or $-1$ if the font in the bold math version +% is the same as the one in the normal math version. In this case +% a `poor man's bold' system of overprinting is used to achieve +% boldness where this is possible. +% +% The settings are made at the time this package is read, and so +% it is best to load this package late, after any font loading packages +% have been loaded. Symbol fonts loaded after this package will get the +% offset of zero, so they will still be made bold by |\bm| as long as an +% appropriate font is declared for the bold math version. +% +% |\bm@boldtable| and |\bm@heavytable| are set up using very similar +% code, which is temporarily defined to |\bm|, to save wasting a csname. +% Similarly |\bm@pmb|\ldots\ (which will be defined later) are used +% as scratch macros. +% +% The general plan. Run through the fonts allocated to the normal math +% version. Ignore \meta{math alphabet} allocations\footnote{For now?} +% but for each math symbol font, look in the math version specified by +% |#1| (bold or heavy). If the font there is different, then allocate +% a new symbol font in the normal math version to access that bold font +% and place the numerical difference between the allocations of the bold +% and normal font into the table being built (|\bm@boldtable|, if |#1| +% is bold). If the symbol allocation is already greater than |\bmmax| +% do not allocate a new symbol font, but rather set the offset in the +% table to zero. |\bm| will detect this, and use |\boldmath| on its +% argument in this case, so the bold font will be accessed but more +% slowly than using a direct access to a bold font allocated into the +% normal math version. If the font allocated in the bold math version is +% the same as the font in the normal math version, set the offset to +% $-1$, which is a flag value that causes |\bm| to use `poor man's bold' +% overprinting three copies of the symbol, offset slightly to give an +% appearance of boldness. +% +% Fonts containing delimiters and math accents \emph{must} be allocated +% into the normal math version if they are to be used with |\bm|. (In +% these cases |\bm| will produce the normal weight symbol, rather than +% using |\boldmath| or poor man's bold.) +% +% \begin{macrocode} +\def\bm#1#2{% +% \end{macrocode} +% This code can not work inside a group, as that would affect any symbol +% font allocations, so instead use some scratch macros to save and +% restore the definitions of commands we need to change locally. +% \begin{macrocode} + \let\bm@pmb\install@mathalphabet + \let\bm@pmb@\getanddefine@fonts + \let\bm@pmb@@\or + \edef\bm@general{\f@encoding/\f@family/\f@series/\f@shape/\f@size}% +% \end{macrocode} +% +% |#2| specifies the maximum number of fonts to allocate +% (either |\bmmax| or |\hmmax|). First check against |\count18| +% that there are that many slots left, and if not reduce accordingly. +% Put the resulting value in |\@tempcnta|. +% \begin{macrocode} + \@tempcnta#2% + \count@-\count18% + \advance\count@-\@tempcnta + \advance\count@15\relax + \ifnum\count@<\z@ + \advance\@tempcnta\count@ + \fi +% \end{macrocode} +% Make |\or| non-expandable, so we can build an |\ifcase| bit-by-bit +% in a sequence of |\edef|s. +% \begin{macrocode} + \let\or\relax +% \end{macrocode} +% +% Initialise the table (to |\@gobble| to remove the first |\or|). +% \begin{macrocode} + \expandafter\let\csname bm@#1table\endcsname\@gobble +% \end{macrocode} +% +% Helper macro that adds the next entry to the table being built. +% \begin{macrocode} + \def\bm@define##1{% + \expandafter\xdef\csname bm@#1table\endcsname{% + \csname bm@#1table\endcsname\or##1}}% +% \end{macrocode} +% +% Each symbol font is recorded in the math version list by a sequence +% such as:\\ +% | \getanddefine@fonts \symsymbols \OMS/cmsy/m/n|\\ +% Where the first argument is a chardef token carrying the number +% allocated (to symbols, in this example), and the second argument is a +% csname whose \emph{name} denotes the font used. +% So locally redefine |\getanddefine@fonts| to compare |#2| with +% the name in the appropriate slot in the bold math version. +% \begin{macrocode} + \def\getanddefine@fonts##1##2{% + \def\@tempa{##2}% +% \end{macrocode} +% +% \begin{macrocode} + \def\@tempb####1##1####2####3\@nil{\def\@tempb{####2}}% +% \end{macrocode} +% +% \begin{macrocode} + \expandafter\expandafter\expandafter + \@tempb\csname mv@#1\endcsname\@nil +% \end{macrocode} +% +% Now |\@tempa| and |\@tempb| contain the names of the fonts allocated +% to this slot in the two math versions. +% \begin{macrocode} + \ifx\@tempa\@tempb +% \end{macrocode} +% If they are the same, set this offset to $-1$, as a flag to use +% poor man's bold. +% \begin{macrocode} + \bm@define\m@ne + \else +% \end{macrocode} +% Else make a new name by adjoining |#1| to the name of the symbol font +% eg, |\symboldsymbols| to match |\symsymbols|. If that font has already +% been allocated, or if |\@tempcnta| is positive so we can allocate a +% new slot for this font, then the table will be +% set with the offset between the two fonts. otherwise set the offset to +% zero (so |\boldmath| will be used to access the font). +% \begin{macrocode} + \edef\@tempa{sym#1\expandafter\@gobblefour\string##1}% + \ifnum\@tempcnta<% + \expandafter\ifx\csname\@tempa\endcsname\relax + \@ne + \else + \m@ne + \fi +% \end{macrocode} +% +% \begin{macrocode} + \bm@define\z@ + \else +% \end{macrocode} +% +% If the font is not yet allocated, allocate it now, using +% an internal hack into |\DeclareMathSymbolFont|. +% +% However before allocating it look in the bold math version +% to see if it is the same, and if so use that. For example +% with Mathtime the `operators' font in the `heavy' math version +% is different from that in `normal', but it is the same as +% the font in `bold' (Times bold). So rather than allocate +% |\symheavyoperators| just set it equal to |\symboldoperators|. +% \begin{macrocode} + \expandafter\ifx\csname\@tempa\endcsname\relax + \begingroup + \escapechar\m@ne + \edef\@tempb{\endgroup + \noexpand\split@name + \expandafter\string\@tempb}% + \@tempb/\@nil +% \end{macrocode} +% +% \begin{macrocode} + \expandafter\ifx + \csname symbold\expandafter\@gobblefour\string##1\endcsname + \relax +% \end{macrocode} +% If no font has been allocated for |\bm| yet, then allocate it now. +% \begin{macrocode} + \expandafter\new@mathgroup\csname\@tempa\endcsname + \expandafter\new@symbolfont\csname\@tempa\endcsname + \f@encoding\f@family\f@series\f@shape +% \end{macrocode} +% Reduce by one the number of fonts we can still allocate. +% \begin{macrocode} + \advance\@tempcnta\m@ne +% \end{macrocode} +% +% \begin{macrocode} + \else +% \end{macrocode} +% Else do a similar look into the bold mathgroup. +% Use |\bm@expand| as a scratch macro to save on string space. +% \begin{macrocode} + \def\bm@expand####1##1####2####3\@nil{\def\bm@expand{####2}}% + \expandafter\expandafter\expandafter + \bm@expand\csname mv@bold\endcsname\@nil +% \end{macrocode} +% +% \begin{macrocode} + \ifx\bm@expand\@tempb +% \end{macrocode} +% If the font just found (in heavy) is the same as the font in bold +% use the slot (in normal) previously allocated for the bold font. +% (That clear?) +% \begin{macrocode} + \expandafter\let\csname\@tempa\expandafter\endcsname + \csname symbold\expandafter + \@gobblefour\string##1\endcsname +% \end{macrocode} +% +% \begin{macrocode} + \else +% \end{macrocode} +% Otherwise allocate a new slot for it. +% \begin{macrocode} + \expandafter\new@mathgroup\csname\@tempa\endcsname + \expandafter\new@symbolfont\csname\@tempa\endcsname + \f@encoding\f@family\f@series\f@shape + \advance\@tempcnta\m@ne +% \end{macrocode} +% +% \begin{macrocode} + \fi + \fi +% \end{macrocode} +% +% \begin{macrocode} + \else +% \end{macrocode} +% If the font has been allocated already, use the existing allocation. +% \begin{macrocode} + \PackageInfo{bm}% + {Symbol font \@tempa\space already defined.\MessageBreak + Not overwriting it}% + \fi +% \end{macrocode} +% Whether the font has just been allocated, or whether it was previously +% allocated, compute the offset and add it to the table. +% \begin{macrocode} + \count@\csname\@tempa\endcsname + \advance\count@-##1% + \bm@define{\the\count@\relax}% + \fi + \fi}% +% \end{macrocode} +% +% The math version list also contains information about math alphabet +% commands, but we want to ignore those here, so \ldots +% \begin{macrocode} + \let\install@mathalphabet\@gobbletwo +% \end{macrocode} +% +% Having set up the local definitions, execute the list for the normal +% math version. +% \begin{macrocode} + \mv@normal +% \end{macrocode} +% +% So now the offsets are all entered into the table, separated by +% |\or|. +% Finish off the definition by making this an |\ifcase|. Add a default +% value of zero, so that any symbol fonts declared later will also +% work, as long as a bold version is assigned to the bold math version. +% \begin{macrocode} + \expandafter\xdef\csname bm@#1table\endcsname{% + \noexpand\ifcase\@tempcnta + \csname bm@#1table\endcsname + \noexpand\else + \z@ + \noexpand\fi}% +% \end{macrocode} +% +% Put things back as they were. +% \begin{macrocode} + \expandafter\split@name\bm@general\@nil + \let\install@mathalphabet\bm@pmb + \let\getanddefine@fonts\bm@pmb@ + \let\or\bm@pmb@@} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bmmax} +% To save declaring too many symbol fonts, do not auto-declare +% any more than |\bmmax| bold symbol fonts into the normal math +% version. Any bold fonts not so allocated will be accessed via +% |\boldmath| which is slower and doesn't work for delimiters +% and accents. It may be set in the preamble with |\newcommand| +% but use |\chardef| here for a slight efficiency gain. +% +% If this is set to a higher value before this +% package is loaded, keep that value. +% \begin{macrocode} +\ifx\bmmax\@undefined + \chardef\bmmax=4 +\fi +% \end{macrocode} +% +% If there is no bold math version, It is very easy to set up +% the table, no need to use all the tricky code above. +% Also, at the end of the package redefine the internal macro +% that |\bm| uses to call |\boldmath|, to use poor man's bold +% instead. +% \begin{macrocode} +\ifx\mv@bold\@undefined + \def\bm@boldtable{\m@ne} + \AtEndOfPackage{% + \def\bm@gr@up#1#2{% + \bm@pmb{#2}}} +\else +% \end{macrocode} +% Otherwise use the definition of |\bm| above to set up |\bm@boldtable| +% by comparing the fonts available in the normal and bold math versions. +% \begin{macrocode} + \bm{bold}\bmmax +% \end{macrocode} +% +% \begin{macro}{\mathbf} +% As the bold font has been defined as a symbol font, make |\mathbf| +% access that rather than have it allocate a new math group for the +% same font. (Just in case there were no free slots wrap this +% in an extra test.) +% \begin{macrocode} + \@ifundefined{symboldoperators} + {} + {\DeclareSymbolFontAlphabet\mathbf{boldoperators}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hmmax} +% +% Same for heavy (but default to three this time (enough for mathtime +% plus, as no heavy operators font). +% \begin{macrocode} +\ifx\hmmax\@undefined + \chardef\hmmax=3 +\fi +% \end{macrocode} +% +% Similarly if there is a heavy math version, set up |\bm@heavytable|. +% (If there is no heavy math version, do nothing here, as |\hm| will be +% set to |\bm| later, once that is defined.) +% \begin{macrocode} +\ifx\mv@heavy\@undefined +\else + \bm{heavy}\hmmax +\fi +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\bm@general} +% \changes{v1.0d}{1997/11/15} +% {extra code to support prime lookahead and breqn} +% \changes{v1.0h}{2002/11/22}{Pass math version as third (new) argument} +% \changes{v1.2d}{2019/07/24} +% {guard against active underscore} +% +% |\bm| is pretty much |\bmdefine\bm@command| followed by executing +% |\bm@command|. It would in principle be possible to execute the +% emboldened tokens directly, rather than building up a macro first, +% but (as I learned the hard way) it's difficult to do this in the midst +% of all these nested |\if| constructs. +% First extract the central bit of code for |\hm| |\bm| |\hmdefine| and +% |\bmdefine|. Note that in the case of the inline versions they take +% an argument and brace it, rather than relying on |\bm@general| to pick +% up the argument. This makes the code robust with respect to premature +% expansion. +% \begin{macrocode} +\begingroup +\catcode`\'=\active +\catcode`\_=\active +\@firstofone{\endgroup +\def\bm@general#1#2#3#4#5{% + \begingroup +% \end{macrocode} +% \changes{v1.0d}{1997/11/15} +% {make nested \cs{bm} vanish completely, not leave a brace group} +% First locally disable |\bm| and |\hm|, as they would mess things +% up terribly, and the original Spivak versions used the syntax +% |\bmdefine\balpha{\bm\alpha}|. +% \begin{macrocode} + \let\bm\@firstofone + \let\hm\@firstofone +% \end{macrocode} +% Now initialise the commands used to save the tokens constructed. +% \begin{macrocode} + \global\let\bm@command\@empty + \let\@let@token\@empty +% \end{macrocode} +% As we want to expand the macros to look at their definition +% turn off protection. Otherwise the |\protect| will be carried over +% and apply to the wrong token, eg |{|. +% \begin{macrocode} + \let\protect\@empty + \let\@typeset@protect\@empty +% \end{macrocode} +% Set up either bold or heavy +% \begin{macrocode} + \def\bm@mathchoice{\bm@m@thchoice#1}% + \def\bm@group{\bm@gr@up#1}% + \let\bm@table#2% +% \end{macrocode} +% Make sure |\left| and |\right| are really non expandable, +% and not |\ifx| equal to anything else. +% \changes{v1.0d}{1997/11/15} +% {make sure \cs{left} is primitive} +% \begin{macrocode} + \let\left\holdinginserts +% \end{macrocode} +% These three save on the number of |\ifx| tests below. +% \changes{v1.1a}{2003/09/01}{Forgotten to check for \cs{hskip} (pr/3572)} +% \begin{macrocode} + \let\right\left + \let\mskip\mkern + \let\hskip\kern +% \end{macrocode} +% Definition of |'| locally modified so as not to use |\futurelet| +% in the look ahead, but to make the |\prime| available at the top level +% to be made bold, or heavy or whatever. +% |'| is locally active for this definition. +% \changes{v1.0d}{1997/11/15} +% {prime code added} +% \changes{v1.0d}{1997/11/15} +% {prime code added} +% \changes{v1.2d}{2019/07/24} +% {guard against active underscore} +% \begin{macrocode} + \let\bm@prime\copy + \let_\relax + \def'{\bm@prime\prime\relax}% +% \end{macrocode} +% For optional argument commands. This expandable version of +% |\@ifnextchar| is not 100\% safe, but works for |\sqrt| unless +% you put something really strange in the arguments. +% \changes{v0.11}{1997/01/06} +% {\cs{@ifnextchar} made safe.} +% \begin{macrocode} + \def\@ifnextchar##1##2##3##4{% + \if##1##4% + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {##2##4}{##3{##4}}}% +% \end{macrocode} +% For Vladimir Volovich\ldots +% \changes{v1.0f}{1998/12/10} +% {Errors and warnings made safe. tools/2917} +% \begin{macrocode} + \def\GenericWarning##1##2{% + \unvcopy{\GenericWarning{##1}{##2}}}% + \def\GenericError##1##2##3##4{% + \unvcopy{\GenericError{##1}{##2}{##3}{##4}}}% +% \end{macrocode} +% For AMS definitions. +% \begin{macrocode} + \let\DN@\copy + \let\FN@\copy + \let\next@\copy + \global\let\bm@first\@empty +% \end{macrocode} +% For AMS version of |\sqrt|: don't expand just wrap in brace group +% so that it can be made bold in a safe but slow way. Do the same for +% internal accent command +% \changes{v1.1b}{2003/10/05}{AMS \cs{sqrt} not working} +% +% \changes{v1.1c}{2004/02/26}{\cs{accentV} made safe (pr/3625)} +% Code for AMS accent allows bm to be used (just) with accent +% but stops the nested accents stacking correctly, this can be +% corrected by using an extra brace group as usual. +% |\bm{{\hat{\hat{F}}}}| +% \begin{macrocode} + \ifx\uproot@\undefined\else + \def\root##1\of##2{{\root##1\of{##2}}}% + \fi + \def\mathaccentV##1{\mathaccent"\accentclass@}% +% \end{macrocode} +% For breqn definitions. +% \begin{macrocode} + \let\@ifnext\@ifnextchar + \let\measure@lhs\copy + \let \rel@break\copy + \let \bin@break\copy + \let \after@open\copy + \let \after@close\copy +% \end{macrocode} +% Make sure things like |\pounds| take the `math branch' even +% in |\bmdefine| (which is not executed in math mode). +% \begin{macrocode} + \let\ifmmode\iftrue +% \end{macrocode} +% We have to ensure that the math alphabets have definitions that +% correspond the the ``bold'' math version we are going to switch +% to. As these definitions are globally assigned when a math +% version is changed it is likely that right now we have those of +% the normal math version active. Argument |#3| holds either +% |\mv@bold| or |\mv@heavy| and we execute that after redefining +% |\install@mathalphabet| and |\getanddefine@fonts| suitably. +% The definitions are reverted back to their original the moment +% the scanning is done +% \changes{v1.0h}{2002/11/22}{Get math alphabets right (pr/3476)} +% \begin{macrocode} + \let\install@mathalphabet\def + \let\getanddefine@fonts\@gobbletwo + #3% +% \end{macrocode} +% The last redefinition just makes |\mathit| type commands re-insert +% themselves (more or less) as if they are allowed to expand +% they die horribly if the expansions are put into |\mathchoice| +% and so executed more than once. +% \begin{macrocode} + \def\select@group##1##2##3##4{{% + \protect##1{##4}}}% + \def\use@mathgroup##1##2##3{{% + \protect\use@mathgroup##1{##2}{##3}}}% +% \end{macrocode} +% +% So now start looking at the argument. +% \changes{v0.10}{1997/01/04} +% {Use \cs{bm@end}} +% \begin{macrocode} + \bm@expand#5\bm@end + \endgroup +% \end{macrocode} +% +% Finally outside the group either execute |\bm@command| (for |\bm|) +% or save its definition (for |\bmdefine|). +% \begin{macrocode} + #4} +% \end{macrocode} +% End of the |\@firstofone| above, and the scope of the active |'|. +% \begin{macrocode} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm} +% \changes{v1.0d}{1997/11/15} +% {Make \cs{bm} grab its argument even when protected} +% Set up the bold (rather than heavy) version, and run |\bm@command| +% right at the end, to execute the emboldened argument. +% The argument is grabbed by the top level function, and explicitly +% braced, so that |\bm| works even if the braces are omitted round +% its argument in a `moving argument'. +% \changes{v1.0h}{2002/11/22}{Pass math version as third (new) argument} +% \begin{macrocode} +\DeclareRobustCommand\bm{% + \bm@general\boldmath\bm@boldtable\mv@bold\bm@command} +\protected@edef\bm#1{\bm{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DeclareBoldMathCommand} +% \changes{v0.07}{1996/12/14} +% {Macro added} +% \begin{macro}{\bm@declare} +% \changes{v0.07}{1996/12/14} +% {Macro added} +% |DeclareBoldMathCommand|%^^A +% \oarg{mathversion}\marg{command}\marg{math expression}\\ +% looks like |\bm| except at the end the specified command is +% globally defined to be |\bm@command|. +% The \meta{mathversion} defaults to `bold'. +% \begin{macrocode} +\def\DeclareBoldMathCommand{\@testopt\bm@declare{bold}} +% \end{macrocode} +% +% \changes{v1.0h}{2002/11/22}{Pass math version as third (new) argument} +% \begin{macrocode} +\def\bm@declare[#1]#2{% + \expandafter\bm@general + \csname #1math\expandafter\endcsname + \csname bm@#1table\expandafter\endcsname + \csname mv@#1\endcsname + {\bm@define#2}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bmdefine} +% |\bmdefine| Shorthand for |\DeclareBoldMathCommand[bold]|. +% +% |\bm| is empty within the definition, so that either\\ +% |\bmdefine\balpha{\bm\alpha}| or |\bmdefine\balpha{\alpha}| \\ +% may be used. (The former just for compatibility with the original +% version for plain \TeX). +% \begin{macrocode} +\def\bmdefine{\DeclareBoldMathCommand[bold]} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hm} +% \changes{v1.0d}{1997/11/15} +% {Make \cs{hm} grab its argument even when protected} +% \begin{macro}{\hmdefine} +% Same again for |\hm|. +% \begin{macrocode} +\ifx\mv@heavy\@undefined +% \end{macrocode} +% +% If there is no heavy math version defined, let |\hm| be defined +% as |\bm|. Currently there is no warning given, perhaps there should +% be, or even an error? +% \begin{macrocode} + \let\hm\bm + \let\heavymath\boldmath + \let\bm@heavytable\bm@boldtable +% \end{macrocode} +% +% \begin{macrocode} +\else +% \end{macrocode} +% +% Otherwise define |\hm| and |\hmdefine| in direct analogy with the +% above. +% \changes{v1.0h}{2002/11/22}{Pass math version as third (new) argument} +% \begin{macrocode} + \DeclareRobustCommand\hm{% + \bm@general\heavymath\bm@heavytable\mv@heavy\bm@command} + \protected@edef\hm#1{\hm{#1}} +% \end{macrocode} +% +% \begin{macrocode} + \def\hmdefine{\DeclareBoldMathCommand[heavy]} +% \end{macrocode} +% +% \begin{macrocode} +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bm@end} +% \changes{v0.10}{1997/01/04} +% {Macro added} +% Normally speaking |\outer| declarations should be avoided at all +% costs. (\LaTeX\ redefines all of plain \TeX's allocation macros +% to be non-outer.) However this is one place where it seems like a +% good idea. If a command taking an argument is put in |\bm| without +% its argument, then the |\@@end| terminating token would be taken as +% the argument, and so the rest of the paragraph would be gobbled up +% and the \LaTeX\ would die horribly. So make the internal terminating +% token |\outer|. (The actual test for termination is made against +% |\@@end| not |\bm@end| as this macro will be expanded by the look-ahead +% system.) +% \begin{macrocode} +\outer\def\bm@end{\@@end} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@expand} +% \changes{v0.11}{1997/01/06} +% {Double up.} +% \begin{macro}{\bm@exp@nd} +% \changes{v0.11}{1997/01/06} +% {Macro added} +% |\afterassignment| trick to fully expand the following tokens until +% the first non-expandable token is revealed. This may discard a space +% token (which is what \TeX\ is looking for) but that doesn't matter in +% math mode. The expansion lookahead is done twice in case any stray +% space tokens have crept in.\footnote{The need for this was noticed +% while testing \cs{sqrt}. The definition of \cs{root} inherited from +% plain \TeX\ has an anomalous space token, that is normally harmless +% (just wastes memory), but which killed earlier versions of this +% package.} +% \begin{macrocode} +\def\bm@expand{\afterassignment\bm@exp@nd\count@`\a} +% \end{macrocode} +% +% \begin{macrocode} +\def\bm@exp@nd{\afterassignment\bm@test\count@`\a} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bm@test} +% Normally we will grab the non-expandable token as a macro argument +% but better check it is not |{| first. Save the previous token +% so we can check later if it was |\left|, in which case use the delcode +% rather than the mathcode if the current token is a character. +% \begin{macrocode} +\def\bm@test{% + \let\bm@previous\@let@token + \futurelet\@let@token\bm@test@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@test@} +% If looking at a single token, switch to |\bm@test@token|, else if +% looking at a |{ }| group, grab the whole group with |\bm@group|. +% A |\bgroup| token will take the wrong branch here (currently not +% trapped). +% \begin{macrocode} +\def\bm@test@{% + \ifx\@let@token\bgroup + \expandafter\bm@group + \else + \expandafter\bm@test@token + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@gr@up} +% \changes{v1.0c}{1997/10/09} +% {Extra brace around argument for \cs{over}} +% If faced with a group, +% If we are in math mode, stick it in a |\boldsymbol| like construct +% and then recurse on |\bm@expand|. +% Otherwise just use |\bfseries\boldmath|. +% The actual test is deferred till `run time'. +% Here and elsewhere could deal with the inner list with an inner call +% to |\bm|, but that doesn't seem to gain very much, and complicates the +% code quite a bit. +% +% |#1| is either |\boldmath| or |\heavymath|. +% Need to add an extra set of explicit braces around |#2| as otherwise +% the math style commands applied in |\mathchoice| might only apply +% to the first half of an |\over| construction. +% \begin{macrocode} +\def\bm@gr@up#1#2{% + \bm@add{{\bm@gr@@p#1{{#2}}}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@gr@@p} +% |#1| is either |\boldmath| or |\heavymath|. +% \begin{macrocode} +\def\bm@gr@@p#1#2{% + \ifmmode + \bm@mchoice#1{#2}{#2}{#2}{#2}% + \else + \bfseries#1#2% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@test@token} +% If not facing a |{ }| group then test to see what we have. +% Basic idea: Trap |\mathchardef| tokens, character tokens, and calls to +% |\mathchar|, |\mathaccent|, etc, and change the \emph{math-group} +% (fam) to point at the bold version. +% Other things just copy straight over to the command being built. +% (Anything inside a |\mathop| or similar will end up being made bold +% as the |\mathop| will be copied over, but its argument will be made +% bold by the group code above. +% \begin{macrocode} +\def\bm@test@token#1{% + \let\bm@next\@empty +% \end{macrocode} +% +% Stop here. Note that it is vital that the terminating token +% is non-expandable and defined, rather than the usual \LaTeX\ +% terminators |\@nil| or |\@@|. (Worse still would be a `quark' +% like |docstrip|'s |\qStop|.) +% \begin{macrocode} + \ifx#1\@@end +% \end{macrocode} +% +% |\bm@mathchoice| uses macro arguments, so need to make the tail +% recursion explicit here. All the other cases recurse by way of +% |\afterassignment| which means all the trailing |\fi| are eaten +% while making the assignment. +% \begin{macrocode} + \else\ifx#1\mathchoice + \let\bm@next\bm@mathchoice +% \end{macrocode} +% +% The main point: Find these expressions, and change the mathgroup. +% \begin{macrocode} + \else\ifx#1\mathchar + \afterassignment\bm@mathchar\count@ + \else\ifx#1\mathaccent + \afterassignment\bm@mathaccent\count@ + \else\ifx#1\delimiter + \afterassignment\bm@delimiter\count@ + \else\ifx#1\radical + \afterassignment\bm@radical\count@ +% \end{macrocode} +% +% Need to trap spaces otherwise digits will get turned to bold +% mathchars. +% \changes{v1.1a}{2003/09/01}{Forgotten to check for \cs{hskip} (pr/3572)} +% \begin{macrocode} + \else\ifx#1\mkern + \bm@register#1{\muskip\z@}% + \else\ifx#1\kern + \bm@register#1\skip@ + \else\ifx#1\penalty + \bm@register#1\count@ +% \end{macrocode} +% +% \changes{v1.0f}{1998/12/10} +% {Add possibility to copy brace group unmodified. tools/2917} +% |\vcopy| is a flag to copy the next group unchanged to the +% result command. +% \begin{macrocode} + \else\ifx#1\unvcopy + \let\bm@next\bm@add +% \end{macrocode} +% +% \begin{macrocode} + \else\ifcat\noexpand#1\relax +% \end{macrocode} +% Other command, look if it's a mathchardef token (otherwise just add +% it). +% \changes{v1.2a}{2016/02/27} +% {Additional quotes for testing \cs{Umathchar}} +% \begin{macrocode} + \xdef\meaning@{\meaning#1}% + \expandafter\bm@mchar@test\meaning@""""\@nil#1% +% \end{macrocode} +% \changes{v1.0d}{1997/11/15} +% {New active \cs{mathcode} code.} +% Character token. +% If it is of catcode 11 or 12, get its mathcode. +% If that is |"8000| replace the token by its active version, and then +% let bm expansion look again at the character. Being really active +% this time, it will expand away (probably). +% +% If the previous token was |\left| or |\right|, get the delcode +% instead of the mathcode. +% \begin{macrocode} + \else\ifcat.\ifcat a#1.\else#1\fi + \count@\mathcode`#1\relax + \ifnum\count@=\mathcode`\'% + \begingroup\uccode`\~`#1\uppercase{\endgroup + \def\bm@next{\bm@expand~}}% + \else + \ifx\bm@previous\left + \count@\delcode`#1\relax + \bm@delimiter + \else +% \end{macrocode} +% \changes{v1.2b}{2016/07/07} +% {Check for mathchar values being reported as if via \cs{Umathchar}} +% Here we need to check for LuaTeX merging mathchar values with Umathchar. +% \begin{macrocode} + \ifnum\count@>"8000 + \Umathcharnumdef\@tempa\count@ + \xdef\meaning@{\meaning\@tempa}% + \expandafter\bm@mchar@test\meaning@""""\@nil\@tempa + \else + \bm@mathchar + \fi +% \end{macrocode} +% +% \begin{macrocode} + \fi + \fi + \else +% \end{macrocode} +% And final possibility: +% a character token of catcode other than 11 or 12. +% \begin{macrocode} + \bm@add{#1}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \bm@next} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\bm@define} +% \changes{v0.08}{1996/12/18} +% {Defined commands now always robust} +% End code for |\bmdefine|. Define the given command name to the +% robust form of the accumulated code. +% +% If |\bm@command| is equal to |\@gtempa| then it is a macro whose +% expansion is a single call to |\mathchar|, so that can be optimised +% with a |\mathchardef|. +% \begin{macrocode} +\def\bm@define#1{% + \begingroup + \ifx\bm@command\@gtempa + \def\mathchar{\global\mathchardef#1}% + \bm@command + \else +% \end{macrocode} +% Rather than simply |\let#1\bm@command|, make the defined command +% robust. |\bm@first| is normally empty, but might be something like +% |\DOTSI| which needs to be lifted to the top level, in front +% of any |\protect| because of the lookahead mechanism used +% in the \textsf{amsmath} package. +% \begin{macrocode} + \toks@\expandafter{\bm@command}% + \xdef#1{\bm@first\noexpand\bm@protect\noexpand#1{\the\toks@}}% + \fi + \endgroup} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\bm@protect} +% \changes{v0.08}{1996/12/18} +% {macro added} +% Commands defined by |\bmdefine| re-insert themselves +% if protection is enabled. +% \begin{macrocode} +\def\bm@protect#1{% + \ifx\protect\@typeset@protect + \expandafter\@firstofone + \else + \protect#1\expandafter\@gobble + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@mchoice} +% |\boldsymbol|, more or less. +% |#1| is either |\boldmath| or |\heavymath|. +% \begin{macrocode} +\def\bm@mchoice#1#2#3#4#5{% + \mathchoice{\hbox{#1$\displaystyle\m@th#2$}}% + {\hbox{#1$\textstyle\m@th#3$}}% + {\hbox{#1$\scriptstyle\m@th#4$}}% + {\hbox{#1$\scriptscriptstyle\m@th#5$}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@m@thchoice} +% Action if you find a |\mathchoice|. Add the bold version to +% |\bm@command| then recurse. +% +% |#1| is either |\boldmath| or |\heavymath|. +% \begin{macrocode} +\def\bm@m@thchoice#1#2#3#4#5{% + \bm@add{\bm@mchoice#1{#2}{#3}{#4}{#5}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@register} +% \changes{v0.07}{1996/12/14} +% {Macro added} +% Combined code for setting up |\bm@r@gister| with the correct +% register type. +% \begin{macrocode} +\def\bm@register#1#2{% + \def\@tempa{#1\the#2}% + \afterassignment\bm@r@gister#2} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@r@gister} +% \changes{v0.06}{1996/12/12} +% {Support \cs{mskip}} +% \changes{v0.07}{1996/12/14} +% {Combine all register macros} +% |\mkern| itself would transfer to |\bm@command| without any special +% test, but any explicit dimension following would be converted to +% |\mathchar|. So trap this and grab the muskip as a muskip. +% This is used in |\iiint|. |\penalty| was needed for the +% AMS version of |\colon|, and so do most of the others as well. +% \begin{macrocode} +\def\bm@r@gister{% + \bm@xadd{\@tempa\space}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\bm@mathchar} +% \changes{v0.10}{1997/01/04} +% {Modify to use \cs{boldmath} or \cs{pmb} if needed.} +% Change the family (math group) of a mathcode and then +% use the modified code with |\mathchar|. If there is no +% suitable bold font in the current math version, use the original +% unmodified mathcode, but switch to |\boldmath| (if there is a bold +% font there) or use `poor man's bold'. Note that these other +% possibilities are only possible here, not for the otherwise similar +% code for |\delimiter| or |\mathaccent|, as those commands +% must work with fonts from the same math version. +% +% Finally recurse down the list. +% \begin{macrocode} +\def\bm@mathchar{% +% \end{macrocode} +% +% \begin{macrocode} + \@tempcntb\count@ + \let\@tempa\bm@group +% \end{macrocode} +% +% |\bm@changefam| will isolate the math group from the mathcode +% and look up the offset in the current table. +% \begin{macrocode} + \bm@changefam{}% +% \end{macrocode} +% +% If the mathcode has changed, then just add the new |\mathchar| +% (saving |\@gtempa| allows |\bmdefine| to optimise this to a +% mathchardef if it turns out to be the only symbol in the argument). +% \begin{macrocode} + \ifnum\count@>\@tempcntb +% \end{macrocode} +% +% \begin{macrocode} + \ifx\bm@command\@empty + \xdef\@gtempa{\mathchar\the\count@\space}% + \fi + \bm@xadd{\mathchar\the\count@\space}% + \else +% \end{macrocode} +% +% Otherwise grab the math class from the math code +% and add that (locally zapping |\bm@expand| as we don't want +% to recurse at this point). +% \begin{macrocode} + \begingroup + \divide\count@"1000 + \let\bm@expand\relax + \bm@xadd\bm@class + \endgroup +% \end{macrocode} +% |\@tempa| will be |\bm@group| (which applies |\boldmath| and +% |\mathchoice|) unless it was changed by |\bm@changefam| to |\bm@pmb| +% (which applies a `poor man's bold' construction in a |\mathchoice|). +% \begin{macrocode} + \edef\@tempb{% + \noexpand\@tempa{\mathchar\the\count@\space}}% + \@tempb + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@umathchar} +% \changes{v1.2a}{2016/02/27} +% {Macro added} +% \changes{v1.2a}{2017/01/16} +% {Test for zero table entry (\cs{boldmath}) added} +% Version of \verb|\bm@mathchar| for \verb|\Umathchar|, this is easier +% as no need to take apart the number, the match class and fam are provided +% as distinct arguments. +% \begin{macrocode} +\def\bm@umathchar#1#2#3{% +\@tempcnta#2\relax +\count@\bm@table +\ifnum\count@=\z@ + \bm@gr@up\boldmath{\Umathchar#1 #2 #3 }% +\else + \ifnum\count@=\m@ne + \else + \advance\@tempcnta\count@ + \fi + \bm@xadd{\Umathchar#1\space + \the\@tempcnta\space\space + #3\space}% +\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@pmb} +% \changes{v0.10}{1997/01/04} +% {Macro added} +% Add a poor man's bold construction to the list being built. +% \begin{macrocode} +\def\bm@pmb#1{% + \bm@add{\bm@pmb@{#1}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@pmb@} +% \changes{v0.10}{1997/01/04} +% {Macro added} +% |\pmb| variant. (See \TeX{}Book, or AMS \textsf{amsbsy} package). +% This one takes a bit more care to use smaller offsets in subscripts. +% \begin{macrocode} +\def\bm@pmb@#1{{% + \setbox\tw@\hbox{$\m@th\mkern.4mu$}% + \mathchoice + \bm@pmb@@\displaystyle\@empty{#1}% + \bm@pmb@@\textstyle\@empty{#1}% + \bm@pmb@@\scriptstyle\defaultscriptratio{#1}% + \bm@pmb@@\scriptscriptstyle\defaultscriptscriptratio{#1}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@pmb@@} +% \changes{v0.10}{1997/01/04} +% {Macro added} +% Helper macro. Box |#3| and set it three times in the style |#1|, +% offset by an amount reduced by the ratio specified in |#2|. +% \begin{macrocode} +\def\bm@pmb@@#1#2#3{{% + \setbox\z@\hbox{$\m@th#1#3$}% + \dimen@#2\wd\tw@ + \rlap{\copy\z@}% + \kern\dimen@ + \raise1.5\dimen@\rlap{\copy\z@}% + \kern\dimen@ + \box\z@}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@class} +% \changes{v0.10}{1997/01/04} +% {Macro added} +% Convert a numeric math class back to a math class command. +% |\mathord| is omitted in class $0$ and $7$ to save space and so +% things work out right in constructions such as |x^a| where +% |x^\mathord{a}| would not work. +% \begin{macrocode} +\def\bm@class{% + \ifcase\count@ + \or + \mathop\or + \mathbin\or + \mathrel\or + \mathopen\or + \mathclose\or + \mathpunct\or + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@add} +% \changes{v0.07}{1996/12/14} +% {macro added} +% A version of |\g@addto@macro| that internally uses a |\begingroup| +% rather than a brace group\footnote{This bug is fixed in the \LaTeX\ +% kernel of 1996/12/01}, to save creating a mathord. +% +% As need to redefine it anyway, save some tokens by making +% it specific to |\bm@command|, and to execute |\bm@expand| +% to continue the loop. +% \begin{macrocode} +\def\bm@add#1{% + \begingroup + \toks@\expandafter{\bm@command#1}% + \xdef\bm@command{\the\toks@}% + \endgroup + \bm@expand} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@xadd} +% An |\xdef| version of |\bm@add|. +% \begin{macrocode} +\def\bm@xadd#1{% + \begingroup + \toks@\expandafter{\bm@command}% + \xdef\bm@command{\the\toks@#1}% + \endgroup + \bm@expand} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@mathaccent} +% \changes{v1.0e}{1997/11/21} +% {Use bm on argument group, as spotted on c.t.t.} +% |\mathaccent| version of |\bm@mathchar|. +% \begin{macrocode} +\def\bm@mathaccent{% + \bm@changefam{}% +% \end{macrocode} +% The next four lines were added a v1.0e. Without them |\bm{\hat{A}}| +% makes the accent bold using |\bm| but the group |{A}| is made bold +% via a |\mathchoice| construction as for any other group, as |\bm| +% does not attempt to parse inside brace groups. While that produces +% something acceptable for lower case letters, it produces +% $\bm{\hat{{A}}}$ which is not too good. The braces may simply be +% omitted: +% |\bm{\hat A}| would work, producing $\bm{\hat A}$, however I did not +% want to document such a restriction, so now modify bm so that such +% brace groups are handled gracefully. +% +% It would be possible to locally make mathaccents take an argument +% during the bm look-ahead, so the brace groups would then vanish +% during expansion, however I would then need to explicitly skip past +% \meta{filler} and also make sure that the end of parse token +% was not gobbled in marginal cases like |$\bm\hat$|. +% +% So instead do the following which gets rid of \meta{filler} +% with a redefinition of |\relax|, and just locally changes +% |\bm@group| so that instead of doing a |\mathchoice| it simply adds +% |\bgroup| and |\egroup| around the tokens, and lets bm modify the +% tokens of the `argument'. This means that |\bm{\hat{A}}| now produces +%\begin{verbatim} +% \mathaccent 29790 \bgroup \mathchar 30017 \egroup +%\end{verbatim} +% The inner math list is a single mathchar, and so \TeX\ will not box +% it, and the math accent will correctly position, taking into account +% the skewchar information. +% +% As the normal bm lookahead is used, it is automatic that the parse +% will end without trying to go past |\bm@end|. +% +% One disadvantage is that the group will mean that |\bm@previous| +% will not be correctly updated. However that is only used for +% delimiter checking, so can not matter here. +% \begin{macrocode} + \begingroup + \def\bm@group##1{\endgroup\bm@xadd{\bgroup}##1\egroup}% + \def\bm@test@token{\endgroup\bm@test@token}% + \let\relax\@empty +% \end{macrocode} +% +% \begin{macrocode} + \bm@xadd{\mathaccent\the\count@\space}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@delimiter} +% \changes{v1.0d}{1997/11/15} +% {Support \cs{left}. null delimiter.} +% Change both families (math groups) of a delcode and then +% use the modified code with |\delimiter|. Don't change code `0' +% as that denotes a null delimiter. +% \begin{macrocode} +\def\bm@delimiter{% + \ifnum\count@>\z@ + \bm@changefam{}% + \bm@changefam{000}% + \fi + \bm@xadd{\delimiter\the\count@\space}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@radical} +% Same for |\radical|. +% \begin{macrocode} +\def\bm@radical{% + \bm@changefam{}% + \bm@changefam{000}% + \bm@xadd{\radical\the\count@\space}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@mchar@} +% Catcode 12 |\mathchar|, for |\ifx| tests. +% \begin{macrocode} +\edef\bm@mchar@{\meaning\mathchar} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@umchar@} +% \changes{v1.2a}{2016/02/27} +% {Macro added} +% Catcode 12 |\Umathchar|, for |\ifx| tests. +% \begin{macrocode} +\edef\bm@umchar@{\string\U\expandafter\@gobble\meaning\mathchar} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@mchar@test} +% Test if the |\meaning| starts with |\mathchar|. If it does, grab the +% value into |\count@| and call |\bm@mathchar|, else just copy the +% command into the accumulated tokens. +% |#1|, |#2|, |#3| are all |\meaning| produced tokens, or `dummy tokens' +% added at the time this is called. |#4| is the original token, in case +% decide not to use the |\meaning|. +% \changes{v1.2a}{2016/02/27} +% {Additional arguments added} +% \begin{macrocode} +\def\bm@mchar@test#1"#2"#3"#4"#5\@nil#6{% + \xdef\meaning@{#1}% + \ifx\meaning@\bm@mchar@ + \count@"#2\relax + \bm@mathchar + \else +% \end{macrocode} +% Test for \verb|\Umathchar|. +% \begin{macrocode} + \ifx\meaning@\bm@umchar@ + \bm@umathchar{"#2}{"#3}{"#4}% + \else +% \end{macrocode} +% Some other command: copy it straight over. If it is the first thing +% added, and it is a |\relax| token, save it in |\bm@first| for use +% in |\bm@define|. +% \begin{macrocode} + \ifx\bm@previous\@empty + \ifx\relax#6% + \gdef\bm@first{#6}% + \fi + \fi + \bm@add{#6}% + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@changefam} +% \changes{v0.10}{1997/01/04} +% {Rewrite for new \cs{bm@table} system} +% Pull out one specified hex digit and passes +% it to |\bm@modify| to change. argument is empty normally but |000| to +% access the second math group in a delimiter code. +% \begin{macrocode} +\def\bm@changefam#1{% + \@tempcnta\count@ + \divide\@tempcnta"1000#1 % + \multiply\@tempcnta"1000#1 % + \advance\@tempcnta-\count@ + \divide\@tempcnta-"100#1 % +% \end{macrocode} +% Having isolated the required math group (fam), look up +% the offset in the current table. +% \begin{macrocode} + \@tempcnta\bm@table +% \end{macrocode} +% If the offset is $-1$, keep |\count@| unchanged, but set |\@tempa| +% to use poor man's bold. Otherwise increment |\count@| to change the +% math group specified. +% \begin{macrocode} + \ifnum\@tempcnta=\m@ne + \let\@tempa\bm@pmb + \else + \multiply\@tempcnta"100#1 % + \advance\count@\@tempcnta + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm@prime} +% \changes{v1.0d}{1997/11/15} +% {Macro added} +% Support |'|. Earlier versions did not make the prime bold in a'. +% +% |\bm{a''}| will now produce (with the normal encodings) +%\begin{verbatim} +% \mathchar 30049 +% \bm@prime \mathchar 1584 \relax +% \bm@prime \mathchar 1584 \relax +%\end{verbatim} +% So |\bm@prime| does essentially the same as the active definition of +% |'|, which is to start a superscript group then keep adding |\prime| +% for each |'| (or |\bm@prime|) following. Here modified to grab a +% |\relax| delimited argument and use that instead of |\prime|. +% |\bm@prime| is locally |\let| to |'| so the |\ifx| tests in |\pr@m@s| +% don't need changing. +% \begin{macrocode} +\def\bm@prime{^\bgroup + \let\bm@prime'% + \def\prim@s##1\relax{##1\futurelet\@let@token\pr@m@s}% + \prim@s} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\boldsymbol} +% \changes{v1.0b}{1997/04/14} +% {Macro added} +% \begin{macro}{\heavysymbol} +% Finally, to ease conversion of documents between this package and +% the \textsf{amsbsy} package: +% \begin{macrocode} +\let\boldsymbol\bm +% \end{macrocode} +% +% \begin{macrocode} +\let\heavysymbol\hm +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex-dev/tools/bm.ins b/Master/texmf-dist/source/latex-dev/tools/bm.ins new file mode 100644 index 00000000000..a148cb93efa --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/bm.ins @@ -0,0 +1,75 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright (C) 1993-2019 +%% The LaTeX3 Project and any individual authors listed elsewhere +%% in this file. +%% +%% This file is part of the Standard LaTeX `Tools Bundle'. +%% ------------------------------------------------------- +%% +%% It may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% As this file contains legal notices, it is NOT PERMITTED to modify +%% this file in any way that the legal information placed into +%% generated files is changed (i.e., the files generated when the +%% original file is executed). This restriction does not apply if +%% (parts of) the content is reused in a different WORK producing its +%% own generated files. +%% +%% The list of all files belonging to the `Tools Bundle' is +%% given in the file `manifest.txt'. +%% +%% +%% --------------- start of docstrip commands ------------------ +%% +\input docstrip + +\keepsilent + +\usedir{tex/latex/tools} + +\preamble + +This is a generated file. + +The source is maintained by the LaTeX Project team and bug +reports for it can be opened at https://latex-project.org/bugs/ +(but please observe conditions on bug reports sent to that address!) + +Copyright (C) 1993-2019 +The LaTeX3 Project and any individual authors listed elsewhere +in this file. + +This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. +-------------------------------------------------------------------------- + +It may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This file may only be distributed together with a copy of the LaTeX +`Tools Bundle'. You may however distribute the LaTeX `Tools Bundle' +without such generated files. + +The list of all files belonging to the LaTeX `Tools Bundle' is +given in the file `manifest.txt'. + +\endpreamble + + +\generate{\file{bm.sty}{\from{bm.dtx}{package}}} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex-dev/tools/calc.dtx b/Master/texmf-dist/source/latex-dev/tools/calc.dtx new file mode 100644 index 00000000000..0bc90f736ba --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/calc.dtx @@ -0,0 +1,1357 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% File `calc.dtx'. +%% Copyright (C) 1992--1995 +%% Kresten Krab Thorup and Frank Jensen. +%% Copyright (C) 1997--2007 +%% Kresten Krab Thorup, Frank Jensen and the LaTeX3 Project. +%% +%% The original authors (fj@hugin.dk and krab@daimi.aau.dk) have +%% contributed this package to the LaTeX distribution. +%% Problems with this package should now be sent using latexbug.tex to +%% the normal LaTeX bug report address. +% +%<*dtx> + \ProvidesFile{calc.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{calc} +%<driver> \ProvidesFile{calc.drv} +% \fi +% \ProvidesFile{calc.dtx} + [2017/05/25 v4.3 Infix arithmetic (KKT,FJ)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\EnableCrossrefs +\RecordChanges +\usepackage{calc} +\begin{document} +\DocInput{calc.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{calc.dtx} +% +% \title{The \texttt{calc} package\\Infix notation +% arithmetic in \LaTeX\thanks{We thank Frank Mittelbach for his +% valuable comments and suggestions which have greatly improved +% this package.}} +% \author{Kresten Krab Thorup, Frank Jensen (and Chris Rowley)} +% \date{\filedate} +% +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% \changes{v4.0d}{1997/11/08} +% {Contributed to tools distribution} +% \changes{v4.1a}{1998/06/07} +% {Added text sizes: CAR} +% \changes{v4.1a}{1998/06/07} +% {Attempt to make user-syntax robust: CAR} +% +% \newenvironment{calc-syntax} +% {\par +% \parskip\medskipamount +% \def\is{\ \hangindent3\parindent$\longrightarrow$~}% +% \def\alt{\ $\vert$~}% +% \rightskip 0pt plus 1fil +% \def\<##1>{\mbox{\NormalSpaces$\langle$##1\/$\rangle$}}% +% \IgnoreSpaces\obeyspaces% +% }{\par\vskip\parskip} +% {\obeyspaces\gdef\NormalSpaces{\let =\space}\gdef\IgnoreSpaces{\def {}}} +% +% \def\<#1>{$\langle$#1\/$\rangle$}% +% \def\s#1{\ensuremath{[\![#1]\!]}} +% \def\savecode#1{\hbox{${}_{\hookrightarrow[#1]}$}} +% \def\gassign{\Leftarrow} +% \def\lassign{\leftarrow} +% +% \begin{abstract} +% The \texttt{calc} package reimplements the \LaTeX\ commands +% |\setcounter|, |\addtocounter|, |\setlength|, and |\addtolength|. +% Instead of a simple value, these commands now accept an infix +% notation expression. +% \end{abstract} +% +% \section{Introduction} +% +% Arithmetic in \TeX\ is done using low-level operations such as +% |\advance| and |\multiply|. This may be acceptable when developing +% a macro package, but it is not an acceptable interface for the +% end-user. +% +% This package introduces proper infix notation arithmetic which is +% much more familiar to most people. The infix notation is more +% readable and easier to modify than the alternative: a sequence of +% assignment and arithmetic instructions. One of the arithmetic +% instructions (|\divide|) does not even have an equivalent in +% standard \LaTeX. +% +% The infix expressions can be used in arguments to macros (the +% \texttt{calc} package doesn't employ category code changes to +% achieve its goals).\footnote{However, it therefore assumes that the +% category codes of the special characters, such as \texttt{(*/)} +% in its syntax do not change.} +% +% \section{Informal description} +% +% Standard \LaTeX\ provides the following set of commands to +% manipulate counters and lengths \cite[pages 194 and~216]{latexman}. +% \begin{itemize} +% \item[]\hskip-\leftmargin +% |\setcounter{|\textit{ctr}|}{|\textit{num}|}| sets the +% value of the counter \textit{ctr} equal to (the value of) +% \textit{num}. (Fragile) +% \item[]\hskip-\leftmargin +% |\addtocounter{|\textit{ctr}|}{|\textit{num}|}| +% increments the value of the counter \textit{ctr} by (the +% value of) \textit{num}. (Fragile) +% +% \item[]\hskip-\leftmargin +% |\setlength{|\textit{cmd}|}{|\textit{len}|}| sets the value of +% the length command \textit{cmd} equal to (the value of) \textit{len}. +% (Robust) +% \item[]\hskip-\leftmargin +% |\addtolength{|\textit{cmd}|}{|\textit{len}|}| sets the value of +% the length command \textit{cmd} equal to its current value plus +% (the value of) \textit{len}. (Robust) +% \end{itemize} +% (The |\setcounter| and |\addtocounter| commands have global effect, +% while the |\setlength| and |\addtolength| commands obey the normal +% scoping rules.) In standard \LaTeX, the arguments to these commands +% must be simple values. The \texttt{calc} package extends these +% commands to accept infix notation expressions, denoting values of +% appropriate types. Using the \texttt{calc} package, \textit{num} is +% replaced by \<integer expression>, and \textit{len} is replaced by +% \<glue expression>. The formal syntax of \<integer expression> and +% \<glue expression> is given below. +% +% In addition to these commands to explicitly set a length, many \LaTeX\ +% commands take a length argument. After loading this package, most of +% these commands will accept a \<glue expression>. This includes +% the optional width argument of |\makebox|, the width argument of +% |\parbox|, |minipage|, and a |tabular| |p|-column, and many similar +% constructions. (This package does not redefine any of these commands, +% but they are defined by default to read their arguments by |\setlength| +% and so automatically benefit from the enhanced |\setlength| command +% provided by this package.) +% +% In the following, we shall use standard \TeX\ terminology. The +% correspondence between \TeX\ and \LaTeX\ terminology is as follows: +% \LaTeX\ counters correspond to \TeX's count registers; they hold +% quantities of type \<number>. \LaTeX\ length commands correspond to +% \TeX's dimen (for rigid lengths) and skip (for rubber lengths) +% registers; they hold quantities of types \<dimen> and \<glue>, +% respectively. +% +% \TeX\ gives us primitive operations to perform arithmetic on registers as +% follows: +% \begin{itemize} +% \item addition and subtraction on all types of quantities without +% restrictions; +% \item multiplication and division by an \emph{integer} can be +% performed on a register of any type; +% \item multiplication by a \emph{real} number (i.e., a number with a +% fractional part) can be performed on a register of any type, +% but the stretch and shrink components of a glue quantity are +% discarded. +% \end{itemize} +% The \texttt{calc} package uses these \TeX\ primitives but provides a +% more user-friendly notation for expressing the arithmetic. +% +% An expression is formed of numerical quantities (such as explicit +% constants and \LaTeX\ counters and length commands) and binary +% operators (the tokens `\texttt{+}', `\texttt{-}', `\texttt{*}', and +% `\texttt{/}' with their usual meaning) using the familiar infix +% notation; parentheses may be used to override the usual precedences +% (that multiplication/division have higher precedence than +% addition/subtraction). +% +% Expressions must be properly typed. This means, e.g., that a dimen +% expression must be a sum of dimen terms: i.e., you cannot say +% `\texttt{2cm+4}' but `\texttt{2cm+4pt}' is valid. +% +% In a dimen term, the dimension part must come first; the same holds +% for glue terms. Also, multiplication and division by non-integer +% quantities require a special syntax; see below. +% +% Evaluation of subexpressions at the same level of precedence +% proceeds from left to right. Consider a dimen term such as +% ``\texttt{4cm*3*4}''. First, the value of the factor \texttt{4cm} is +% assigned to a dimen register, then this register is multiplied +% by~$3$ (using |\multiply|), and, finally, the register is multiplied +% by~$4$ (again using |\multiply|). This also explains why the +% dimension part (i.e., the part with the unit designation) must come +% first; \TeX\ simply doesn't allow untyped constants to be assigned +% to a dimen register. +% +% The \texttt{calc} package also allows multiplication and division by +% real numbers. However, a special syntax is required: you must use +% |\real{|\<decimal constant>|}|\footnote{Actually, instead of +% \<decimal constant>, the more general \<optional signs>\<factor> can +% be used. However, that doesn't add any extra expressive power to +% the language of infix expressions.} or +% |\ratio{|\<dimen expression>|}{|\<dimen expression>|}| to denote a +% real value to be used for multiplication/division. The first form has +% the obvious meaning, and the second form denotes the number obtained +% by dividing the value of the first expression by the value of the +% second expression. +% +% A later addition to the package (in June 1998) allows an additional +% method of specifying a factor of type dimen by setting some text +% (in LR-mode) and measuring its dimensions: these are denoted as +% follows. +%\begin{quote} +% |\widthof{|\<text>|}|\quad +% |\heightof{|\<text>|}|\quad +% |\depthof{|\<text>|}| +%\end{quote} +% These calculate the natural sizes of the \<text> in exactly the +% same way as is done for the commands |\settowidth| etc.~on +% Page~216 of the manual~\cite{latexman}. +% In August 2005 the package was further extended to provide the command +%\begin{quote} +% |\totalheightof{|\<text>|}| +%\end{quote} +% This command does exactly what you'd expect from its name. +% Additionally the package also provides the command +%\begin{quote} +% |\settototalheight{|\<cmd>|}{|\<text>|}| +%\end{quote} +% +% +% Note that there is a small difference in the usage of these two +% methods of accessing text dimensions. After +% |\settowidth{\txtwd}{Some text}| you can use: +%\begin{verbatim} +% \setlength{\parskip}{0.68\txtwd} +%\end{verbatim} +% whereas using the more direct access to the width of the text +% requires the longer form for multiplication, thus: +%\begin{verbatim} +% \setlength{\parskip}{\widthof{Some text} * \real{0.68}} +%\end{verbatim} +% +% \TeX\ discards the stretch and shrink components of glue when glue +% is multiplied by a real number. So, for example, +%\begin{verbatim} +% \setlength{\parskip}{3pt plus 3pt * \real{1.5}} +%\end{verbatim} +% will set the paragraph separation to 4.5pt with no stretch or +% shrink. Incidentally, note how spaces can be used to enhance +% readability. When \TeX\ is scanning for a \<number> etc.\ it is +% common to terminate the scanning with a space token or by inserting +% \cs{relax}. As of version~4.3 \textsf{calc} allows \cs{relax} tokens +% to appear in places where they would usually be used for terminating +% \TeX's scanning. In short this is just before any of \texttt{+-*/)} +% or at the end of the expression being evaluated. +% +% When \TeX\ performs arithmetic on integers, any fractional part of +% the results are discarded. For example, +%\begin{verbatim} +% \setcounter{x}{7/2} +% \setcounter{y}{3*\real{1.6}} +% \setcounter{z}{3*\real{1.7}} +%\end{verbatim} +% will assign the value~$3$ to the counter~\texttt{x}, the value~$4$ +% to~\texttt{y}, and the value~$5$ to~\texttt{z}. This truncation +% also applies to \emph{intermediate} results in the sequential +% computation of a composite expression; thus, the following command +%\begin{verbatim} +% \setcounter{x}{3 * \real{1.6} * \real{1.7}} +%\end{verbatim} +% will assign~$6$ to~\texttt{x}. +% +% As an example of the use of |\ratio|, consider the problem of +% scaling a figure to occupy the full width (i.e., |\textwidth|) of +% the body of a page. Assume that the original dimensions of the +% figure are given by the dimen (length) variables, |\Xsize| and +% |\Ysize|. The height of the scaled figure can then be expressed by +%\begin{verbatim} +% \setlength{\newYsize}{\Ysize*\ratio{\textwidth}{\Xsize}} +%\end{verbatim} +% +% +% +% Another new feature introduced in August 2005 was $\max$ and $\min$ +% operations with associated macros +%\begin{quote} +% |\maxof{|\<\textit{type} expression>|}{|\<\textit{type} expression>|}| +% \\ +% |\minof{|\<\textit{type} expression>|}{|\<\textit{type} expression>|}| +%\end{quote} +% When \textit{type} is either \meta{glue} or \meta{dimen} these macros +% are allowed only as part of addition or subtraction but when +% \textit{type} is \meta{integer} they can also be used when +% multiplying and dividing. In the latter case they follow the +% same syntax rules as |\ratio| and |\real| which means they must come +% after the |*| or the |/|. Thus +%\begin{verbatim} +% \setcounter{x}{3*\maxof{4+5}{3*4}+\minof{2*\real{1.6}}{5-1}} +%\end{verbatim} +% will assign $3\times\max(9,12)+\min(3,4)=39$ to |x|. Similarly +%\begin{verbatim} +% \setlength{\parindent}{% +% \minof{3pt}{\parskip}*\real{1.5}*\maxof{2*\real{1.6}}{2-1}} +%\end{verbatim} +% will assign $\min(13.5\textrm{pt},4.5\cs{parskip})$ to \cs{parindent} +% +% +% +% \section{Formal syntax} +% +% The syntax is described by the following set of rules. +% Note that the definitions of \<number>, \<dimen>, \<glue>, +% \<decimal constant>, and \<plus or minus> are +% as in Chapter~24 of The \TeX book~\cite{texbook}; and \<text> +% is LR-mode material, as in the manual~\cite{latexman}. +% We use \textit{type} as a meta-variable, standing for +% `integer', `dimen', and `glue'.\footnote{This version of the +% \texttt{calc} package doesn't support evaluation of muglue expressions.} +% +% \begin{calc-syntax} +% \<\textit{type} expression>^^A +% \is \<\textit{type} term>^^A +% \alt \<\textit{type} expression> \<plus or minus> \<\textit{type} term> +% +% \<\textit{type} term>^^A +% \is \<\textit{type} term> \<\textit{type} scan stop> +% \alt \<\textit{type} factor>^^A +% \alt \<\textit{type} term> \<multiply or divide> \<integer>^^A +% \alt \<\textit{type} term> \<multiply or divide> \<real number>^^A +% \alt \<\textit{type} term> \<multiply or divide>^^A +% \<$\max$ or $\min$ integer>^^A +% +% \<\textit{type} scan stop>^^A +% \is \<empty>^^A +% \alt \<optional space>^^A +% \alt |\relax| +% +% \<\textit{type} factor>^^A +% \is \<\textit{type}>^^A +% \alt \<text dimen factor>^^A +% \alt \<$\max$ or $\min$ \textit{type}>^^A +% \alt |(|$_{12}$ \<\textit{type} expression> |)|$_{12}$ +% +% \<integer> \is \<number> +% +% \<$\max$ or $\min$ \textit{type}> \is \<$\max$ or $\min$ command>^^A +% |{| \<\textit{type} expression> |}|^^A +% |{| \<\textit{type} expression> |}| +% +% \<$\max$ or $\min$ command> \is |\maxof|^^A +% \alt |\minof| +% +% \<text dimen factor>^^A +% \is \<text dimen command>|{| \<text> |}| +% +% \<text dimen command>^^A +% \is |\widthof|^^A +% \alt |\heightof|^^A +% \alt |\depthof|^^A +% \alt |\totalheightof|^^A +% +% \<multiply or divide>^^A +% \is |*|$_{12}$^^A +% \alt |/|$_{12}$ +% +% \<real number>^^A +% \is |\ratio{| \<dimen expression> |}{| \<dimen expression> |}|^^A +% \alt |\real{| \<optional signs> \<decimal constant> |}| +% +% \<plus or minus>^^A +% \is |+|$_{12}$^^A +% \alt |-|$_{12}$ +% +% \<decimal constant>^^A +% \is |.|$_{12}$^^A +% \alt |,|$_{12}$^^A +% \alt \<digit> \<decimal constant>^^A +% \alt \<decimal constant> \<digit> +% +% \<digit>^^A +% \is |0|$_{12}$^^A +% \alt |1|$_{12}$^^A +% \alt |2|$_{12}$^^A +% \alt |3|$_{12}$^^A +% \alt |4|$_{12}$^^A +% \alt |5|$_{12}$^^A +% \alt |6|$_{12}$^^A +% \alt |7|$_{12}$^^A +% \alt |8|$_{12}$^^A +% \alt |9|$_{12}$ +% +% \<optional signs>^^A +% \is \<optional spaces>^^A +% \alt \<optional signs> \<plus or minus> \<optional spaces> +% +% \end{calc-syntax} +% +% +% Relying heavily on \TeX\ to do the underlying assignments, it is +% only natural for \texttt{calc} to simulate \TeX's parsing machinery +% for these quantities. Therefore it a)~imposes the same restrictions +% on the catcode of syntax characters as \TeX\ and b)~tries to expand +% its argument fully. a)~means that implicit characters for the tokens +% |*|$_{12}$, |/|$_{12}$, |(|$_{12}$, and |)|$_{12}$ will not +% work\footnote{e\TeX\ also assumes these catcodes when parsing a +% \cs{numexpr}, \cs{dimexpr}, \cs{glueexpr}, or \cs{muglueexpr} and +% does not allow implicit characters.} but because of~b), the +% expansion should allow you to use macros that expand to explicit +% syntax characters. +% +% +% \StopEventually{ +% \begin{thebibliography}{1} +% \bibitem{texbook} +% \textsc{D. E. Knuth}. +% \newblock \textit{The \TeX{}book} (Computers \& Typesetting Volume A). +% \newblock Addison-Wesley, Reading, Massachusetts, 1986. +% \bibitem{latexman} +% \textsc{L. Lamport}. +% \newblock \textit{\LaTeX, A Document Preparation System.} +% \newblock Addison-Wesley, Reading, Massachusetts, Second +% edition 1994/1985. +% \end{thebibliography} +% \PrintChanges +% } +% +% \section{The evaluation scheme} +% \label{evaluation:scheme} +% +% In this section, we shall for simplicity consider only expressions +% containing `$+$' (addition) and `$*$' (multiplication) operators. +% It is trivial to add subtraction and division. +% +% An expression $E$ is a sum of terms: $T_1+\cdots+T_n$; a term is a +% product of factors: $F_1*\cdots*F_m$; a factor is either a simple +% numeric quantity~$f$ (like \<number> as described in the \TeX book), +% or a parenthesized expression~$(E')$. +% +% Since the \TeX\ engine can only execute arithmetic operations in a +% machine-code like manner, we have to find a way to translate the +% infix notation into this `instruction set'. +% +% Our goal is to design a translation scheme that translates~$X$ (an +% expression, a term, or a factor) into a sequence of \TeX\ instructions +% that does the following [Invariance Property]: correctly +% evaluates~$X$, leaves the result in a global register~$A$ (using a +% global assignment), and does not perform global assignments to the +% scratch register~$B$; moreover, the code sequence must be balanced +% with respect to \TeX\ groups. We shall denote the code sequence +% corresponding to~$X$ by \s{X}. +% +% In the replacement code specified below, we use the following +% conventions: +% \begin{itemize} +% \item $A$ and $B$ denote registers; all assignments to~$A$ will +% be global, and all assignments to~$B$ will be local. +% \item ``$\gassign$'' means global assignment to the register on +% the lhs. +% \item ``$\lassign $'' means local assignment to the register on +% the lhs. +% \item ``\savecode C'' means ``save the code~$C$ until the current +% group (scope) ends, then execute it.'' This corresponds to +% the \TeX-primitive |\aftergroup|. +% \item ``$\{$'' denotes the start of a new group, and ``$\}$'' +% denotes the end of a group. +% \end{itemize} +% +% Let us consider an expression $T_1+T_2+\cdots+T_n$. Assuming that +% \s{T_k} ($1\le k\le n$) attains the stated goal, the following code +% clearly attains the stated goal for their sum: +% \begin{eqnarray*} +% \s{T_1+T_2+\cdots+T_n}&\Longrightarrow& +% \{\,\s{T_1}\,\} \; B\lassign A \quad +% \{\,\s{T_2}\,\} \; B\lassign B+A \\ +% &&\qquad \ldots \quad \{\,\s{T_n}\,\} \; B\lassign B+A +% \quad A\gassign B +% \end{eqnarray*} +% Note the extra level of grouping enclosing each of \s{T_1}, \s{T_2}, +% \ldots,~\s{T_n}. This will ensure that register~$B$, used to +% compute the sum of the terms, is not clobbered by the intermediate +% computations of the individual terms. Actually, the group +% enclosing~\s{T_1} is unnecessary, but it turns out to be simpler if +% all terms are treated the same way. +% +% The code sequence ``$\{\,\s{T_2}\,\}\;B\lassign B+A$'' can be translated +% into the following equivalent code sequence: +% ``$\{\savecode{B\lassign B+A}\,\s{T_2}\,\}$''. This observation turns +% out to be the key to the implementation: The ``$\savecode{B\lassign +% B+A}$'' is generated \emph{before} $T_2$ is translated, at the same +% time as the `$+$' operator between $T_1$ and~$T_2$ is seen. +% +% Now, the specification of the translation scheme is straightforward: +% \begin{eqnarray*} +% \s{f}&\Longrightarrow&A\gassign f\\[\smallskipamount] +% \s{(E')}&\Longrightarrow&\s{E'}\\[\smallskipamount] +% \s{T_1+T_2+\cdots+T_n}&\Longrightarrow& +% \{\savecode{B\lassign A}\,\s{T_1}\,\} \quad +% \{\savecode{B\lassign B+A}\,\s{T_2}\,\} \\ +% &&\qquad \ldots \quad \{\savecode{B\lassign B+A}\,\s{T_n}\,\} +% \quad A\gassign B +% \\[\smallskipamount] +% \s{F_1*F_2*\cdots*F_m}&\Longrightarrow& +% \{\savecode{B\lassign A}\,\s{F_1}\,\} \quad +% \{\savecode{B\lassign B*A}\,\s{F_2}\,\}\\ +% &&\qquad \ldots \quad \{\savecode{B\lassign B*A}\,\s{F_m}\,\} +% \quad A\gassign B +% \end{eqnarray*} +% By structural induction, it is easily seen that the stated property +% is attained. +% +% By inspection of this translation scheme, we see that we have to +% generate the following code: +% \begin{itemize} +% \item we must generate ``$\{\savecode{B\lassign +% A}\{\savecode{B\lassign A}$'' at the left border of an +% expression (i.e., for each left parenthesis and the implicit +% left parenthesis at the beginning of the whole expression); +% \item we must generate ``$\}A\gassign B\}A\gassign B$'' at the +% right border of an expression (i.e., each right parenthesis +% and the implicit right parenthesis at the end of the full +% expression); +% \item `\texttt{*}' is replaced by ``$\}\{\savecode{B\lassign +% B*A}$''; +% \item `\texttt{+}' is replaced by +% ``$\}A\gassign B\}\{\savecode{B\lassign +% B+A}\{\savecode{B\lassign A}$''; +% \item when we see (expect) a numeric quantity, we insert the +% assignment code ``$A\gassign$'' in front of the quantity and let +% \TeX\ parse it. +% \end{itemize} +% +% \section{Implementation} +% +% For brevity define +% \begin{calc-syntax} +% \<numeric> \is \<number> \alt \<dimen> \alt \<glue> \alt \<muglue> +% \end{calc-syntax} +% So far we have ignored the question of how to determine the type of +% register to be used in the code. However, it is easy to see that +% (1)~`$*$' always initiates an \<integer factor>, (2)~all +% \<numeric>s in an expression, except those which are part of an +% \<integer factor>, are of the same type as the whole expression, and +% all \<numeric>s in an \<integer factor> are \<number>s. +% +% We have to ensure that $A$ and~$B$ always have an appropriate type +% for the \<numeric>s they manipulate. We can achieve this by having +% an instance of $A$ and~$B$ for each type. Initially, $A$~and~$B$ +% refer to registers of the proper type for the whole expression. +% When an \<integer factor> is expected, we must change $A$ and~$B$ to +% refer to integer type registers. We can accomplish this by +% including instructions to change the type of $A$ and~$B$ to integer +% type as part of the replacement code for~`$*$; if we append such +% instructions to the replacement code described above, we also ensure +% that the type-change is local (provided that the type-changing +% instructions only have local effect). However, note that the +% instance of~$A$ referred to in $\savecode{B\lassign B*A}$ is the +% integer instance of~$A$. +% +% We shall use |\begingroup| and |\endgroup| for the open-group and +% close-group characters. This avoids problems with spacing in math +% (as pointed out to us by Frank Mittelbach). +% +% \subsection{Getting started} +% +% Now we have enough insight to do the actual implementation in \TeX. +% First, we announce the macro package.\footnote{Code moved to top of file} +% \begin{macrocode} +%<*package> +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{calc}[\filedate\space\fileversion] +% \end{macrocode} +% +% \subsection{Assignment macros} +% +% \begin{macro}{\calc@assign@generic} +% \changes{v4.2}{2005/08/06}{Removed a few redundant \cs{expandafter}s} +% The |\calc@assign@generic| macro takes four arguments: (1~and~2) the +% registers to be used +% for global and local manipulations, respectively; (3)~the lvalue +% part; (4)~the expression to be evaluated. +% +% The third argument (the lvalue) will be used as a prefix to a +% register that contains the value of the specified expression (the +% fourth argument). +% +% In general, an lvalue is anything that may be followed by a variable +% of the appropriate type. As an example, |\linepenalty| and +% |\global\advance\linepenalty| may both be followed by an \<integer +% variable>. +% +% The macros described below refer to the registers by the names +% |\calc@A| and |\calc@B|; this is accomplished by +% |\let|-assignments. +% +% As discovered in Section~\ref{evaluation:scheme}, we have to +% generate code as +% if the expression is parenthesized. As described below, +% |\calc@open| is the macro that replaces a left parenthesis by its +% corresponding \TeX\ code sequence. When the scanning process sees +% the exclamation point, it generates an |\endgroup| and stops. As we +% recall from Section~\ref{evaluation:scheme}, the correct expansion +% of a right +% parenthesis is ``$\}A\gassign B\}A\gassign B$''. The remaining +% tokens of this expansion are inserted explicitly, except that the +% last assignment has been replaced by the lvalue part (i.e., +% argument~|#3| of |\calc@assign@generic|) followed by |\calc@B|. +% \begin{macrocode} +\def\calc@assign@generic#1#2#3#4{\let\calc@A#1\let\calc@B#2% + \calc@open(#4!% + \global\calc@A\calc@B\endgroup#3\calc@B} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\calc@assign@count} +% \begin{macro}{\calc@assign@dimen} +% \begin{macro}{\calc@assign@skip} +% We need three instances of the |\calc@assign@generic| macro, +% corresponding to the types \<integer>, \<dimen>, and \<glue>. +% \begin{macrocode} +\def\calc@assign@count{\calc@assign@generic\calc@Acount\calc@Bcount} +\def\calc@assign@dimen{\calc@assign@generic\calc@Adimen\calc@Bdimen} +\def\calc@assign@skip{\calc@assign@generic\calc@Askip\calc@Bskip} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% These macros each refer to two registers, one +% to be used globally and one to be used locally. +% We must allocate these registers. +% \begin{macrocode} +\newcount\calc@Acount \newcount\calc@Bcount +\newdimen\calc@Adimen \newdimen\calc@Bdimen +\newskip\calc@Askip \newskip\calc@Bskip +% \end{macrocode} +% +% \subsection{The \LaTeX\ interface} +% +% \begin{macro}{\setcounter} +% \begin{macro}{\addtocounter} +% \changes{v4.2}{2005/08/06} +% {Fix to make \cs{addtocounter} work with \texttt{amstext}} +% \begin{macro}{\steptocounter} +% \changes{v4.2}{2005/08/06} +% {Avoid redundant processing. PR/3795} +% \begin{macro}{\setlength} +% \begin{macro}{\addtolength} +% As promised, we redefine the following standard \LaTeX\ commands: +% |\setcounter|, +% |\addtocounter|, |\setlength|, and |\addtolength|. +% \begin{macrocode} +\def\setcounter#1#2{\@ifundefined{c@#1}{\@nocounterr{#1}}% + {\calc@assign@count{\global\csname c@#1\endcsname}{#2}}} +% \end{macrocode} +% \begin{macrocode} + \def\addtocounter#1#2{\@ifundefined{c@#1}{\@nocounterr{#1}}% + {\calc@assign@count{\global\advance\csname c@#1\endcsname}{#2}}}% +% \end{macrocode} +% We also fix \cs{stepcounter} to not go through the whole \texttt{calc} +% process. +% \begin{macrocode} + \def\stepcounter#1{\@ifundefined {c@#1}% + {\@nocounterr {#1}}% + {\global\advance\csname c@#1\endcsname \@ne + \begingroup + \let\@elt\@stpelt \csname cl@#1\endcsname + \endgroup}}% +% \end{macrocode} +% If the \texttt{amstext} package is loaded we must add the +% |\iffirstchoice@| switch as well. We patch the commands this +% way since it's good practice when we know how many arguments they take. +% \begin{macrocode} +\@ifpackageloaded{amstext}{% + \expandafter\def\expandafter\stepcounter + \expandafter#\expandafter1\expandafter{% + \expandafter\iffirstchoice@\stepcounter{#1}\fi + } + \expandafter\def\expandafter\addtocounter + \expandafter#\expandafter1\expandafter#\expandafter2\expandafter{% + \expandafter\iffirstchoice@\addtocounter{#1}{#2}\fi + } +}{} +% \end{macrocode} +% \begin{macrocode} +\DeclareRobustCommand\setlength{\calc@assign@skip} +\DeclareRobustCommand\addtolength[1]{\calc@assign@skip{\advance#1}} +% \end{macrocode} +% (|\setlength| and |\addtolength| are robust according to +% \cite{latexman}.) +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{The scanner} +% +% We evaluate expressions by explicit scanning of characters. We do +% not rely on active characters for this. +% +% The scanner consists of two parts, |\calc@pre@scan| and +% |\calc@post@scan|; |\calc@pre@scan| consumes left parentheses, and +% |\calc@post@scan| consumes binary operator, |\real|, |\ratio|, and +% right parenthesis tokens. +% +% \begin{macro}{\calc@pre@scan} +% \begin{macro}{\@calc@pre@scan} +% \changes{v4.2}{2005/08/06} +% {Added macro and force expansion} +% +% Note that this is called at least once on every use of calc +% processing, even when none of the extended syntax is present; it +% therefore needs to be made very efficient. +% +% It reads the initial part of expressions, until some \<text dimen +% factor> or \<numeric> is seen; in fact, anything not explicitly +% recognized here is taken to be a \<numeric> of some sort as this +% allows unary +% `\texttt{+}' and unary `\texttt{-}' to be treated easily and +% correctly\footnote{In the few contexts where signs are allowed: +% this could, I think, be extended (CAR).} but means that anything +% illegal will simply generate a \TeX-level error, often a +% reasonably comprehensible one! +% +% The |\romannumeral-`\a| part is a little trick which forces expansion +% in case |#1| is a normal macro, something that occurs from time to +% time. A conditional test inside will possibly leave a trailing +% \cs{fi} but this remnant is removed later when \cs{calc@post@scan} +% performs the same trick. +% +% The many |\expandafter|s are needed to efficiently end the nested +% conditionals so that |\calc@textsize| and |\calc@maxmin@addsub| can +% process their argument. +% \changes{v4.1a}{1998/06/07} +% {Added code for text sizes: CAR} +% \changes{v4.1b}{1998/07/07} +% {Correction to ifx true case} +% \changes{v4.2}{2005/08/06} +% {Added \cs{maxof} and \cs{minof} operations} +% \begin{macrocode} +\def\calc@pre@scan#1{% + \expandafter\@calc@pre@scan\romannumeral-`\a#1} +\def\@calc@pre@scan#1{% + \ifx(#1% + \expandafter\calc@open + \else + \ifx\widthof#1% + \expandafter\expandafter\expandafter\calc@textsize + \else + \ifx\maxof#1% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\calc@maxmin@addsub + \else + \calc@numeric% no \expandafter needed for this one. + \fi + \fi + \fi + #1} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\calc@open} +% \begin{macro}{\calc@initB} +% |\calc@open| is used when there is a left parenthesis right ahead. +% This parenthesis is replaced by \TeX\ code corresponding to the code +% sequence ``$\{\savecode{B\lassign A}\{\savecode{B\lassign A}$'' +% derived in Section~\ref{evaluation:scheme}. Finally, +% |\calc@pre@scan| is +% called again. +% \begin{macrocode} +\def\calc@open({\begingroup\aftergroup\calc@initB + \begingroup\aftergroup\calc@initB + \calc@pre@scan} +\def\calc@initB{\calc@B\calc@A} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macro}{\calc@numeric} +% |\calc@numeric| assigns the following value to |\calc@A| and then +% transfers control to |\calc@post@scan|. +% \begin{macrocode} +\def\calc@numeric{\afterassignment\calc@post@scan \global\calc@A} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\widthof} +% \begin{macro}{\heightof} +% \begin{macro}{\depthof} +% \changes{v4.1a}{1998/06/07} +% {Added macros: CAR} +% \begin{macro}{\totalheightof} +% \changes{v4.2}{2005/08/06} +% {Added macro} +% \changes{v4.2}{2005/08/06} +% {Added informative message for reserved macros} +% +% These do not need any particular definition when they are scanned +% so, for efficiency and robustness, we make them all equivalent to +% the same harmless (I hope) unexpandable command.\footnote{If this +% level of safety is not needed then the code can be sped up: +% CAR.} Thus the test in |\@calc@pre@scan| finds any of them. +% +% As we have to check for these commands explicitly we must ensure +% that our definition wins. Using \cs{newcommand} gives an error when +% loading \texttt{calc} and may be mildly surprising. This should be +% a little more informative. +% \begin{macrocode} +\@for\reserved@a:=widthof,heightof,depthof,totalheightof,maxof,minof\do +{\@ifundefined{\reserved@a}{}{% + \PackageError{calc}{% + The\space calc\space package\space reserves\space the\space + command\space name\space `\@backslashchar\reserved@a'\MessageBreak + but\space it\space has\space already\space been\space defined\space + with\space the\space meaning\MessageBreak + `\expandafter\meaning\csname\reserved@a\endcsname'.\MessageBreak + This\space original\space definition\space will\space be\space lost}% + {If\space you\space need\space a\space command\space with\space + this\space definition,\space you\space must\space use\space a\space + different\space name.}}% +} +\let\widthof\ignorespaces +\let\heightof\ignorespaces +\let\depthof\ignorespaces +\let\totalheightof\ignorespaces +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\calc@textsize} +% \changes{v4.1a}{1998/06/07} +% {Added macro: CAR} +% \changes{v4.1a}{1998/06/07} +% {Added macro: CAR} +% \changes{v4.2}{2005/08/06} +% {Extended macro with \cs{totalheightof}} +% The presence of the above four commands invokes this code, where +% we must distinguish them from each other. +% This implementation is somewhat optimized by using low-level +% code from the commands |\settowidth|, etc.\footnote{It is based on +% suggestions by Donald Arseneau and David Carlisle.} +% +% Within the text argument we must restore the normal meanings of +% the four user-level commands since arbitrary material can appear +% in here, including further uses of calc. +% \begin{macrocode} +\def\calc@textsize #1#2{% + \begingroup + \let\widthof\wd + \let\heightof\ht + \let\depthof\dp + \def\totalheightof{\ht\dp}% +% \end{macrocode} +% We must expand the argument one level if it's \cs{totalheightof} +% and it doesn't hurt the other three. +% \begin{macrocode} + \expandafter\@settodim\expandafter{#1}% + {\global\calc@A}% + {% + \let\widthof\ignorespaces + \let\heightof\ignorespaces + \let\depthof\ignorespaces + \let\totalheightof\ignorespaces + #2}% + \endgroup + \calc@post@scan} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\calc@post@scan} +% \begin{macro}{\@calc@post@scan} +% \changes{v4.2}{2005/08/06}{Added macro and force expansion} +% \changes{v4.3}{2007/08/22}{Discard terminating \cs{relax} tokens and +% avoid extra error message from \cs{calc@next}} +% The macro |\calc@post@scan| is called right after a value has been +% read. At this point, a binary operator, a sequence of right +% parentheses, an optional \cs{relax}, and the end-of-expression mark +% (`|!|') is allowed.\footnote{Is \texttt{!} a good choice, CAR?} +% Depending on our findings, we call a suitable macro to generate the +% corresponding \TeX\ code (except when we detect the +% end-of-expression marker: then scanning ends, and control is +% returned to |\calc@assign@generic|). +% +% This macro may be optimized by selecting a different order of +% |\ifx|-tests. The test for `\texttt{!}' (end-of-expression) is +% placed first as it will always be performed: this is the only test +% to be performed if the expression consists of a single \<numeric>. +% This ensures that documents that do not use the extra expressive +% power provided by the \texttt{calc} package only suffer a minimum +% slowdown in processing time. +% \begin{macrocode} +\def\calc@post@scan#1{% + \expandafter\@calc@post@scan\romannumeral-`\a#1} +\def\@calc@post@scan#1{% + \ifx#1!\let\calc@next\endgroup \else + \ifx#1+\let\calc@next\calc@add \else + \ifx#1-\let\calc@next\calc@subtract \else + \ifx#1*\let\calc@next\calc@multiplyx \else + \ifx#1/\let\calc@next\calc@dividex \else + \ifx#1)\let\calc@next\calc@close \else + \ifx#1\relax\let\calc@next\calc@post@scan \else + \def\calc@next{\calc@error#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \calc@next} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\calc@add} +% \begin{macro}{\calc@subtract} +% \begin{macro}{\calc@generic@add} +% \begin{macro}{\calc@addAtoB} +% \begin{macro}{\calc@subtractAfromB} +% The replacement code for the binary operators `\texttt{+}' and +% `\texttt{-}' follow a common pattern; the only difference is the +% token that is stored away by |\aftergroup|. After this replacement +% code, control is transferred to |\calc@pre@scan|. +% \begin{macrocode} +\def\calc@add{\calc@generic@add\calc@addAtoB} +\def\calc@subtract{\calc@generic@add\calc@subtractAfromB} +\def\calc@generic@add#1{\endgroup\global\calc@A\calc@B\endgroup + \begingroup\aftergroup#1\begingroup\aftergroup\calc@initB + \calc@pre@scan} +\def\calc@addAtoB{\advance\calc@B\calc@A} +\def\calc@subtractAfromB{\advance\calc@B-\calc@A} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\real} +% \begin{macro}{\ratio} +% \begin{macro}{\calc@ratio@x} +% \begin{macro}{\calc@real@x} +% The multiplicative operators, `\texttt{*}' and `\texttt{/}', may be +% followed by a |\real|, |\ratio|, |\minof|, or |\maxof| token. The +% last two of these control sequences are defined by \texttt{calc} as +% they are needed by the scanner for addition or subtraction while the +% first two are not defined (at least not by the \texttt{calc} +% package); this, +% unfortunately, leaves them highly non-robust. We therefore +% equate them to |\relax| but only if they have not already been +% defined\footnote{Suggested code from David Carlisle.} +% (by some other package: dangerous but possible!); this +% will also make them appear to be undefined to a \LaTeX{} user +% (also possibly dangerous). +% \changes{v4.1a}{1998/06/07} +% {Added macro set-ups to make them robust but undefined: CAR} +% \begin{macrocode} +\ifx\real\@undefined\let\real\relax\fi +\ifx\ratio\@undefined\let\ratio\relax\fi +% \end{macrocode} +% In order to test for |\real| or |\ratio|, we define these +% two.\footnote{May not need the extra names, CAR?} +% \begin{macrocode} +\def\calc@ratio@x{\ratio} +\def\calc@real@x{\real} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\calc@multiplyx} +% \changes{v4.2}{2005/08/06} +% {Added $\protect\max$ and $\protect\min$ operations} +% \begin{macro}{\calc@dividex} +% \changes{v4.2}{2005/08/06} +% {Added $\protect\max$ and $\protect\min$ operations} +% Test which operator followed |*| or |/|. If none followed it's just +% a standard multiplication or division. +% \begin{macrocode} +\def\calc@multiplyx#1{\def\calc@tmp{#1}% + \ifx\calc@tmp\calc@ratio@x \let\calc@next\calc@ratio@multiply \else + \ifx\calc@tmp\calc@real@x \let\calc@next\calc@real@multiply \else + \ifx\maxof#1\let\calc@next\calc@maxmin@multiply \else + \let\calc@next\calc@multiply + \fi + \fi + \fi + \calc@next#1} +\def\calc@dividex#1{\def\calc@tmp{#1}% + \ifx\calc@tmp\calc@ratio@x \let\calc@next\calc@ratio@divide \else + \ifx\calc@tmp\calc@real@x \let\calc@next\calc@real@divide \else + \ifx\maxof#1\let\calc@next\calc@maxmin@divide \else + \let\calc@next\calc@divide + \fi + \fi + \fi + \calc@next#1} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\calc@multiply} +% \begin{macro}{\calc@divide} +% \begin{macro}{\calc@generic@multiply} +% \begin{macro}{\calc@multiplyBbyA} +% \begin{macro}{\calc@divideBbyA} +% The binary operators `\texttt{*}' and `\texttt{/}' also insert code +% as determined above. Moreover, the meaning of |\calc@A| and +% |\calc@B| is changed as factors following a multiplication and +% division operator always have integer type; the original meaning of +% these macros will be restored when the factor has been read and +% evaluated. +% \begin{macrocode} +\def\calc@multiply{\calc@generic@multiply\calc@multiplyBbyA} +\def\calc@divide{\calc@generic@multiply\calc@divideBbyA} +\def\calc@generic@multiply#1{\endgroup\begingroup + \let\calc@A\calc@Acount \let\calc@B\calc@Bcount + \aftergroup#1\calc@pre@scan} +\def\calc@multiplyBbyA{\multiply\calc@B\calc@Acount} +\def\calc@divideBbyA{\divide\calc@B\calc@Acount} +% \end{macrocode} +% Since the value to use in the multiplication/division operation is +% stored in the |\calc@Acount| register, the |\calc@multiplyBbyA| and +% |\calc@divideBbyA| macros use this register. +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\calc@close} +% |\calc@close| generates code for a right parenthesis (which was +% derived to be ``$\}A\gassign B\}A\gassign B$'' in +% Section~\ref{evaluation:scheme}). After this code, the control is +% returned to +% |\calc@post@scan| in order to look for another right parenthesis or +% a binary operator. +% \begin{macrocode} +\def\calc@close + {\endgroup\global\calc@A\calc@B + \endgroup\global\calc@A\calc@B + \calc@post@scan} +% \end{macrocode} +% \end{macro} +% +% \subsection{Calculating a ratio} +% +% \begin{macro}{\calc@ratio@multiply} +% \begin{macro}{\calc@ratio@divide} +% When |\calc@post@scan| encounters a |\ratio| control sequence, it hands +% control to one of the macros |\calc@ratio@multiply| or |\calc@ratio@divide|, +% depending on the preceding character. Those macros both forward the +% control to the macro |\calc@ratio@evaluate|, which performs two steps: (1) it +% calculates the ratio, which is saved in the global macro token +% |\calc@the@ratio|; (2) it makes sure that the value of |\calc@B| will be +% multiplied by the ratio as soon as the current group ends. +% +% The following macros call |\calc@ratio@evaluate| which multiplies +% |\calc@B| by the ratio, but |\calc@ratio@divide| flips the arguments +% so that the `opposite' fraction is actually evaluated. +% \begin{macrocode} +\def\calc@ratio@multiply\ratio{\calc@ratio@evaluate} +\def\calc@ratio@divide\ratio#1#2{\calc@ratio@evaluate{#2}{#1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macro}{\calc@Ccount} +% \begin{macro}{\calc@numerator} +% \begin{macro}{\calc@denominator} +% We shall need two registers for temporary usage in the +% calculations. We can save one register since we can reuse +% |\calc@Bcount|. +% \begin{macrocode} +\newcount\calc@Ccount +\let\calc@numerator=\calc@Bcount +\let\calc@denominator=\calc@Ccount +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\calc@ratio@evaluate} +% Here is the macro that handles the actual evaluation of ratios. The +% procedure is +% this: First, the two expressions are evaluated and coerced to +% integers. The whole procedure is enclosed in a group to be able to +% use the registers |\calc@numerator| and |\calc@denominator| for temporary +% manipulations. +% \begin{macrocode} +\def\calc@ratio@evaluate#1#2{% + \endgroup\begingroup + \calc@assign@dimen\calc@numerator{#1}% + \calc@assign@dimen\calc@denominator{#2}% +% \end{macrocode} +% Here we calculate the ratio. First, we check for negative numerator +% and/or denominator; note that \TeX\ interprets two minus signs the +% same as a plus sign. Then, we calculate the integer part. +% The minus sign(s), the integer part, and a decimal point, form the +% initial expansion of the |\calc@the@ratio| macro. +% \begin{macrocode} + \gdef\calc@the@ratio{}% + \ifnum\calc@numerator<0 \calc@numerator-\calc@numerator + \gdef\calc@the@ratio{-}% + \fi + \ifnum\calc@denominator<0 \calc@denominator-\calc@denominator + \xdef\calc@the@ratio{\calc@the@ratio-}% + \fi + \calc@Acount\calc@numerator + \divide\calc@Acount\calc@denominator + \xdef\calc@the@ratio{\calc@the@ratio\number\calc@Acount.}% +% \end{macrocode} +% Now we generate the digits after the decimal point, one at a time. +% When \TeX\ scans these digits (in the actual multiplication +% operation), it forms a fixed-point number with 16~bits for +% the fractional part. We hope that six digits is sufficient, even +% though the last digit may not be rounded correctly. +% \begin{macrocode} + \calc@next@digit \calc@next@digit \calc@next@digit + \calc@next@digit \calc@next@digit \calc@next@digit + \endgroup +% \end{macrocode} +% Now we have the ratio represented (as the expansion of the global +% macro |\calc@the@ratio|) in the syntax \<decimal constant> +% \cite[page~270]{texbook}. This is fed to |\calc@multiply@by@real| +% that will +% perform the actual multiplication. It is important that the +% multiplication takes place at the correct grouping level so that the +% correct instance of the $B$ register will be used. Also note that +% we do not need the |\aftergroup| mechanism in this case. +% \begin{macrocode} + \calc@multiply@by@real\calc@the@ratio + \begingroup + \calc@post@scan} +% \end{macrocode} +% \end{macro} +% The |\begingroup| inserted before the |\calc@post@scan| will be +% matched by the |\endgroup| generated as part of the replacement of a +% subsequent binary operator or right parenthesis. +% \begin{macro}{\calc@next@digit} +% \begin{macrocode} +\def\calc@next@digit{% + \multiply\calc@Acount\calc@denominator + \advance\calc@numerator -\calc@Acount + \multiply\calc@numerator 10 + \calc@Acount\calc@numerator + \divide\calc@Acount\calc@denominator + \xdef\calc@the@ratio{\calc@the@ratio\number\calc@Acount}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\calc@multiply@by@real} +% In the following code, it is important that we first assign the +% result to a dimen register. Otherwise, \TeX\ won't allow us to +% multiply with a real number. +% \begin{macrocode} +\def\calc@multiply@by@real#1{\calc@Bdimen #1\calc@B \calc@B\calc@Bdimen} +% \end{macrocode} +% (Note that this code wouldn't work if |\calc@B| were a muglue +% register. This is the real reason why the \texttt{calc} package +% doesn't support muglue expressions. To support muglue expressions +% in full, the |\calc@multiply@by@real| macro must use a muglue register +% instead of |\calc@Bdimen| when |\calc@B| is a muglue register; +% otherwise, a dimen register should be used. Since integer +% expressions can appear as part of a muglue expression, it would be +% necessary to determine the correct register to use each time a +% multiplication is made.) +% \end{macro} +% +% \subsection{Multiplication by real numbers} +% +% \begin{macro}{\calc@real@multiply} +% \begin{macro}{\calc@real@divide} +% This is similar to the |\calc@ratio@evaluate| macro above, except that +% it is considerably simplified since we don't need to calculate the +% factor explicitly. +% \begin{macrocode} +\def\calc@real@multiply\real#1{\endgroup + \calc@multiply@by@real{#1}\begingroup + \calc@post@scan} +\def\calc@real@divide\real#1{\calc@ratio@evaluate{1pt}{#1pt}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{$\max$ and $\min$ operations} +% +% \begin{macro}{\maxof} +% \begin{macro}{\minof} +% \changes{v4.2}{2005/08/06} +% {Added macros} +% With version 4.2, the $\max$ and $\min$ operators were +% added to \texttt{calc}. The user functions for them are \cs{maxof} and +% \cs{minof} respectively. +% These macros are internally similar to \cs{widthof} etc.\ in that they +% are unexpandable and easily recognizable by the scanner. +% \begin{macrocode} +\let\maxof\@@italiccorr +\let\minof\@@italiccorr +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\calc@Cskip} +% \begin{macro}{\ifcalc@count@} +% The $\max$ and $\min$ operations take two arguments so we need an extra +% \<skip> register. We also add a switch for determining when to perform +% a \<skip> or a \<count> assignment. +% \begin{macrocode} +\newskip\calc@Cskip +\newif\ifcalc@count@ +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macro}{\calc@maxmin@addsub} +% \begin{macro}{\calc@maxmin@generic} +% \changes{v4.2}{2005/08/06}{Macros added} +% When doing addition or subtraction with a $\max$ or $\min$ operator, we +% first check if |\calc@A| is a \<count> register or not and then set the +% switch. Then call the real function which sets |\calc@A| to the desired +% value and continue as usual with |\calc@post@scan|. +% \begin{macrocode} +\def\calc@maxmin@addsub#1#2#3{\begingroup + \ifx\calc@A\calc@Acount% + \calc@count@true + \else + \calc@count@false + \fi + \calc@maxmin@generic#1{#2}{#3}% + \endgroup + \calc@post@scan +} +% \end{macrocode} +% Check the switch and do either \<count> or \<skip> assignments. Note that +% |\maxof| and |\minof| are not set to |>| and |<| until after the +% assignments, which ensures we can nest them without problems. Then set +% |\calc@A| to the correct one. +% \begin{macrocode} +\def\calc@maxmin@generic#1#2#3{% + \begingroup + \ifcalc@count@ + \calc@assign@count\calc@Ccount{#2}% + \calc@assign@count\calc@Bcount{#3}% + \def\minof{<}\def\maxof{>}% + \global\calc@A\ifnum\calc@Ccount#1\calc@Bcount + \calc@Ccount\else\calc@Bcount\fi + \else + \calc@assign@skip\calc@Cskip{#2}% + \calc@assign@skip\calc@Bskip{#3}% + \def\minof{<}\def\maxof{>}% + \global\calc@A\ifdim\calc@Cskip#1\calc@Bskip + \calc@Cskip\else\calc@Bskip\fi + \fi + \endgroup +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\calc@maxmin@divmul} +% \begin{macro}{\calc@maxmin@multiply} +% \begin{macro}{\calc@maxmin@divide} +% \changes{v4.2}{2005/08/06}{Macros added} +% When doing division or multiplication we must be using \<count> registers +% so we set the switch. Other than that it is almost business as usual when +% multiplying or dividing. |#1| is the instruction to either multiply or +% divide |\calc@B| by |\calc@A|, |#2| is either |\maxof| or |\minof| which +% is waiting in the input stream and |#3| and |#4| are the calc expressions. +% We end it all as usual by calling |\calc@post@scan|. +% \begin{macrocode} +\def\calc@maxmin@divmul#1#2#3#4{% + \endgroup\begingroup + \calc@count@true + \aftergroup#1% + \calc@maxmin@generic#2{#3}{#4}% + \endgroup\begingroup + \calc@post@scan +} +% \end{macrocode} +% The two functions called when seeing a |*| or a |/|. +% \begin{macrocode} +\def\calc@maxmin@multiply{\calc@maxmin@divmul\calc@multiplyBbyA} +\def\calc@maxmin@divide {\calc@maxmin@divmul\calc@divideBbyA} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \section{Reporting errors} +% \begin{macro}{\calc@error} +% \changes{v4.0d}{1997/11/08} +% {Use \cs{PackageError} for error messages (DPC)} +% \changes{v4.0e}{1997/11/11} +% {typo fixed} +% If |\calc@post@scan| reads a character that is not one of `\texttt{+}', +% `\texttt{-}', `\texttt{*}', `\texttt{/}', or `\texttt{)}', an error +% has occurred, and this is reported to the user. Violations in the +% syntax of \<numeric>s will be detected and reported by \TeX. +% \changes{v4.1a}{1998/06/07} +% {Improved, I hope, error message: CAR} +% \begin{macrocode} +\def\calc@error#1{% + \PackageError{calc}% + {`#1' invalid at this point}% + {I expected to see one of: + - * / )}} +% \end{macrocode} +% \end{macro} +% +% \section{Other additions} +% \begin{macro}{\@settodim} +% \changes{v4.2}{2005/08/06} +% {Changed kernel macro} +% \begin{macro}{\settototalheight} +% \changes{v4.2}{2005/08/06} +% {Added macro} +% The kernel macro \cs{@settodim} is changed so that it runs through a list +% containing \cs{ht}, \cs{wd}, and \cs{dp} and than advance the length +% one step at a time. We just have to use a scratch register in case the +% user decides to put in a \cs{global} prefix on the length register. +% A search on the internet confirmed that some people do that kind of thing. +% \begin{macrocode} +\def\@settodim#1#2#3{% + \setbox\@tempboxa\hbox{{#3}}% + \dimen@ii=\z@ + \@tf@r\reserved@a #1\do{% + \advance\dimen@ii\reserved@a\@tempboxa}% + #2=\dimen@ii + \setbox\@tempboxa\box\voidb@x} +% \end{macrocode} +% Now the user level macro is straightforward. +% \begin{macrocode} +\def\settototalheight{\@settodim{\ht\dp}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% That's the end of the package. +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +\endinput + diff --git a/Master/texmf-dist/source/latex-dev/tools/dcolumn.dtx b/Master/texmf-dist/source/latex-dev/tools/dcolumn.dtx new file mode 100644 index 00000000000..38a4ab0da2c --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/dcolumn.dtx @@ -0,0 +1,361 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% File: dcolumn.dtx Copyright (C) 1992-1996 1999-2001 David Carlisle +% +%<*dtx> + \ProvidesFile{dcolumn.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{dcolumn} +%<driver>\ProvidesFile{dcolumn.drv} +% \fi +% \ProvidesFile{dcolumn.dtx} + [2014/10/28 v1.06 decimal alignment package (DPC)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} + \usepackage{dcolumn} + \DeleteShortVerb{\|} +\begin{document} + \DocInput{dcolumn.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{dcolumn.dtx} +% +% \title{The \textsf{dcolumn} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{David Carlisle} +% \date{\filedate} +% \author{David Carlisle} +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% +% \changes{v1.00}{1992/02/17}{Initial version} +% \changes{v1.01}{1992/06/12}{Re-issue for the new doc and docstrip.} +% \changes{v1.02}{1994/03/14}{Re-issue for LaTeX2e} +% \changes{v1.03}{1996/02/28}{New feature, after tools/2093} +% \changes{v1.05}{1999/07/05} +% {Minor doc changes latex/3058} +% \changes{v1.06}{2001/05/28} +% {More doc changes (suggested by BNB, done by CAR) latex/3315} +% +% +% +% \begin{abstract} +% This package defines a system for defining columns of entries in an +% \texttt{array} or \texttt{tabular} which are to be aligned on a +% `decimal point'. +% \end{abstract} +% +% \MakeShortVerb{\"} +% +% This package defines {\tt D} to be a column specifier with three +% arguments.\\ +% "D{"\meta{sep.tex}"}{"\meta{sep.dvi}"}{"\meta{decimal +% places}"}" +% +% \meta{sep.tex} should be a single character, this is used as the +% separator in the {\tt .tex} file. Thus it will usually be `{\tt.}' or +% `{\tt,}'. +% +% \mbox{\meta{sep.dvi}} is used as the separator in the output, this may +% be the same as the first argument, but may be any math-mode +% expression, such as "\cdot". It should be noted that \texttt{dcolumn} +% always uses math mode for the digits as well as the separator. +% +% \meta{decimal places} should be the maximum number of decimal places +% in the column. If this is negative, any number of decimal places can +% be used in the column, and all entries will be centred on +% (the leading edge of) the +% separator. Note that this can cause a column to be too wide, compare +% the first two columns in the example below. If this argument is +% positive, the column uses macros equivalent to "\rightdots" +% "\endrightdots" of {\tt array.sty}, otherwise the macros are +% essentially equivalent to "\centerdots" "\endcenterdots". +% +% You may not want to use all three entries in the {\tt array} or {\tt +% tabular} preamble, so you may define your own preamble specifiers +% using "\newcolumntype". +% +% For example we may say: +% +% \noindent"\newcolumntype{d}[1]{D{.}{\cdot}{#1}}" +% +% {\tt d} takes a single argument specifying the number of decimal +% places, and the {\tt .tex} file should use {\tt.}, with $\cdot$ being +% used in the output. +% +% \noindent"\newcolumntype{.}{D{.}{.}{-1}}" +% +% {\tt .} specifies a column of entries to be centred on the~$.$. +% +% \noindent"\newcolumntype{,}{D{,}{,}{2}}" +% +% {\tt ,} specifies takes a column of entries with at most two decimal +% places after a~$,$. +% +% \newcolumntype{d}[1]{D{.}{\cdot}{#1}} +% \newcolumntype{.}{D{.}{.}{-1}} +% \newcolumntype{,}{D{,}{,}{2}} +% +% The following table begins "\begin{tabular}{|d{-1}|d{2}|.|,|}" +% +% \begin{center} +% \begin{tabular}{|d{-1}|d{2}|.|,|} +% 1.2 & 1.2 &1.2 &1,2 \\ +% 1.23 & 1.23 &12.5 &300,2 \\ +% 1121.2& 1121.2&861.20 &674,29 \\ +% 184 & 184 &10 &69 \\ +% .4 & .4 & &,4 \\ +% & &.4 & +% \end{tabular} +% \end{center} +% +% Note that the first column, which had a negative \meta{decimal places} +% argument is wider than the second column, so that the decimal point +% appears in the middle of the column. +% Also note that this package deals correctly with entries with no +% decimal part, no integer part, and blank entries. +% +% If you have table headings (inserted with "\multicolumn{1}{c}{..}" +% to over-ride the "D" column type) then it may be that neither of the +% above `centred' or `right aligned' forms is quite what you want. +% \begin{center}\small +% \begin{tabular}[t]{|D..{-1}|D..{1}|D..{5.1}|} +%\multicolumn{1}{|c|}{head}& +%\multicolumn{1}{c|}{head}& +%\multicolumn{1}{c|}{head}\\[3pt] +% 1.2 & 1.2 &1.2 \\ +% 11212.2& 11212.2&11212.2 \\ +% .4 & .4 &.4 +% \end{tabular} +% \hfill +% \begin{tabular}[t]{|D..{-1}|D..{1}|D..{1.1}|} +%\multicolumn{1}{|c|}{wide heading}& +%\multicolumn{1}{c|}{wide heading}& +%\multicolumn{1}{c|}{wide heading}\\[3pt] +% 1.2 & 1.2 &1.2 \\ +% .4 & .4 &.4 +% \end{tabular} +% \end{center} +% +% In both of these tables the first column is set with "D{.}{.}{-1}" +% to produce a column centered on the ".", and the second column is +% set with "D{.}{.}{1}" to produce a right aligned column. +% +% The centered column produces columns that are wider than necessary +% to fit in the numbers under a heading as it has to ensure that the +% decimal point is centred. The right aligned column two does not have +% this drawback, but under a wide heading a column of small right +% aligned figures looks a bit odd. +% +% In version v1.03 a third possibility is introduced. The third +% \meta{decimal places} argument may specify \emph{both} the number of +% digits to the left and to the right of the decimal place. The third +% column in the first table above is set with "D{.}{.}{5.1}" and in the +% second table, "D{.}{.}{1.1}", to specify +% `five places to the left and one to the right' and `one place to the +% left and% one to the right' respectively. (You may use `,' or other +% tokens, not necessarily `.' in this argument.) The column of figures +% is then positioned such that a number with the specified numbers of +% digits is centred in the column. +% +% This notation also enables columns that are centred on the mid-point +% of the separator, rather than its leading edge; for example +% "D{+}{\,\pm\,}{3,3}" will give nice, symmetric layout of up to three +% digits on either side of a $\pm$ sign. +% +% \StopEventually{} +% +% +% \section{The Macros} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% First we load {\tt array.sty} if it not already loaded. +% \begin{macrocode} +\RequirePackage{array} +% \end{macrocode} +% +% The basic ideas behind these macros are explained in the documentation +% for {\tt array.sty}. However they use three +% tricks which may be useful in other contexts. +% \begin{itemize} +% \item The separator is surrounded in extra "{ }", so that it is set +% with "\mathord" spacing, otherwise, for instance a `,' would have +% extra space after it. +% \item The separator is not given its special definition by making it +% active, as this would not work for an entry such as "& .5 &", as the +% first token of an alignment entry is read {\em before\/} the preamble +% part, in case it is an "\omit", in which case the preamble is to be +% omitted. Instead we switch the mathcode to (hex) 8000, which makes the +% token act as if it were active. +% \item Although \verb|\mathcode`.="8000| makes {\tt.} act as if it +% were active, it is still not allowed in constructions such as +% "\def.{}", even in math-mode, so we have to construct an active +% version of the separator, this is done by making it the uppercase of +% "~", and then using the construct\\ +% "\uppercase{\def~}{"\meta{definition}"}".\\ +% Note that the \meta{definition} is not uppercased, so the definition +% can refer to the standard, non-active use of the separator. +% \end{itemize} +% +% \begin{macro}{\DC@} +% \changes{v1.03}{1996/02/28}{New feature, after tools/2093} +% Set up uppercase tables as required, and then grab the first part of +% the numerical argument into "\count@". +% \begin{macrocode} +\def\DC@#1#2#3{% + \uccode`\~=`#1\relax + \m@th + \afterassignment\DC@x\count@#3\relax{#1}{#2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DC@x} +% \changes{v1.03}{1996/02/28}{Macro added} +% If "\count@" is negative, centre on the decimal point. If it is +% positive either "#1" will be empty in which case bad out decimal +% part to the number of digits specified by "\count@" or (new feature +% in v1.03) it is none empty in which case "\count@" contains the +% number of digits to the left of the point, and "#1" contains a junk +% token (probably ".") followed by the number of digits to the right +% of the point. In either of these latter cases, "\DC@right" is used. +% \begin{macrocode} +\def\DC@x#1\relax#2#3{% + \ifnum\z@>\count@ + \expandafter\DC@centre + \else + \expandafter\DC@right + \fi + {#2}{#3}{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DC@centre} +% If centering on the decimal point, just need to box up the two halves. +% \begin{macrocode} +\def\DC@centre#1#2#3{% + \let\DC@end\DC@endcentre + \uppercase{\def~}{$\egroup\setbox\tw@=\hbox\bgroup${#2}}% + \setbox\tw@=\hbox{${\phantom{{#2}}}$}% + \setbox\z@=\hbox\bgroup$\mathcode`#1="8000 } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DC@endcentre} +% and then pad out the smaller of the two boxes so there is the same +% amount of stuff either side of the point. +% \begin{macrocode} +\def\DC@endcentre{$\egroup + \ifdim \wd\z@>\wd\tw@ + \setbox\tw@=\hbox to\wd\z@{\unhbox\tw@\hfill}% + \else + \setbox\z@=\hbox to\wd\tw@{\hfill\unhbox\z@}\fi + \box\z@\box\tw@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DC@right} +% \changes{v1.03}{1996/02/28}{Re-implemented, after tools/2093} +% This deals with both the cases where a specified number of decimal +% places is given. +% \begin{macrocode} +\def\DC@right#1#2#3{% + \ifx\relax#3\relax +% \end{macrocode} +% If "#3" is empty, add "\hfill" to right align the column, and +% Just set "\DC@rl" to begin a group, so nothing fancy is done with +% the whole number part. +% \begin{macrocode} + \hfill + \let\DC@rl\bgroup + \else +% \end{macrocode} +% Otherwise set "\DC@rl" so that the whole number part is put in a +% box "\count@" times as wide as a digit. +% In order to share code with the other branch, then move "#3" (the +% number of decimal places) into "\count@" throwing away the `.' from +% the user syntax. +% \changes{v1.04}{1996/09/23}{Add \cs{hfill} so integer part +% is still flush right if no decimal point used.} +% \begin{macrocode} + \edef\DC@rl{to\the\count@\dimen@ii\bgroup\hss\hfill}% + \count@\@gobble#3\relax + \fi +% \end{macrocode} +% +% \begin{macrocode} + \let\DC@end\DC@endright +% \end{macrocode} +% Box 2 contains the decimal part, set to "\dimen@" which is +% calculated below to be "\count@" times the width of a digit, plus +% the with of the `decimal point'. +% \begin{macrocode} + \uppercase{\def~}{$\egroup\setbox\tw@\hbox to\dimen@\bgroup${#2}}% + \setbox\z@\hbox{$1$}\dimen@ii\wd\z@ + \dimen@\count@\dimen@ii + \setbox\z@\hbox{${#2}$}\advance\dimen@\wd\z@ + \setbox\tw@\hbox to\dimen@{}% +% \end{macrocode} +% Box 0 contains the whole number part, either just at its natural +% size for right aligned columns, or set to (the old value of) +% "\count@" times the width of a digit. "\DC@rl" defined above +% determines the two cases. +% \begin{macrocode} + \setbox\z@\hbox\DC@rl$\mathcode`#1="8000 } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DC@endright} +% \changes{v1.03}{1996/02/28}{Re-implemented, after tools/2093} +% Just finish off the second box, and then put out both boxes. +% \begin{macrocode} +\def\DC@endright{$\hfil\egroup\box\z@\box\tw@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{D} +% The user interface, define the {\tt D} column to take three arguments. +% For special purposes, you may need to directly access "\DC@" rather +% than the "D" column, eg to get a bold version you could use +%\begin{verbatim} +% \newcolumntype{E}[3]{>{\boldmath\DC@{#1}{#2}{#3}}c<{\DC@end}} +%\end{verbatim} +% \begin{macrocode} +\newcolumntype{D}[3]{>{\DC@{#1}{#2}{#3}}c<{\DC@end}} +%</package> +% \end{macrocode} +% \end{macro} +% +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex-dev/tools/delarray.dtx b/Master/texmf-dist/source/latex-dev/tools/delarray.dtx new file mode 100644 index 00000000000..8814fc2a586 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/delarray.dtx @@ -0,0 +1,206 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% File: delarray.dtx Copyright (C) 1991-1994 David Carlisle +% +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{delarray} +%<package> [2014/10/28 v1.01 array delimiter package (DPC)] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{delarray} +\GetFileInfo{delarray.sty} +\begin{document} +\title{The \textsf{delarray} package\thanks{This file + has version number \fileversion, last + revised \filedate.}} +\author{David Carlisle} +\date{\filedate} + \MaintainedByLaTeXTeam{tools} + \maketitle + \DocInput{delarray.dtx} +\end{document} +%</driver> +% \fi +% +% +% \changes{v1.00}{1992/07/06} +% {Initial version after merging of newarray.sty to array.sty} +% +% \changes{v1.01}{1994/03/14} +% {Update to LaTeX2e} +% +% +% \section{Examples} +% +% +% The addition to {\tt array.sty} added in {\tt delarray.sty} is +% a system of implicit |\left| |\right| pairs. If you want an array +% surrounded by parentheses, you can enter:\\ +% |\begin{array}({cc})| \ldots +% \[ \begin{array}({cc})a&b\\c&d\end{array} \] +% +% Similarly if an environment equivalent to \PlainTeX's |\cases| could +% be defined by:\\ +% |\begin{array}\{{lL}.| \ldots +% +% \newcolumntype{L}{>{$}l<{$}} +% \[ f(x)=\begin{array}\{{lL}. +% 0 &if $x=0$\\ +% \sin(x)/x&otherwise +% \end{array} \] +% Here |L| is supposed to denote a column of left aligned L-R text. It +% may be defined via: |\newcolumntype{L}{>{$}l<{$}}|, as discussed in +% {\tt array.sty}. +% Note that as the delimiters must always be used in pairs, the `|.|' +% must be used to denote a `null delimiter'. +% +% This feature is especially useful if the |[t]| or |[b]| +% arguments are also used. In these cases the result is not equivalent +% to surrounding the environment by |\left|\ldots|\right|, as +% can be seen from the following example: +% \[ +% \begin{array}[t]({c}) 1\\2\\3 \end{array} +% \begin{array}[c]({c}) 1\\2\\3 \end{array} +% \begin{array}[b]({c}) 1\\2\\3 \end{array} +% \quad\mbox{not}\quad +% \left(\begin{array}[t]{c} 1\\2\\3 \end{array}\right) +% \left(\begin{array}[c]{c} 1\\2\\3 \end{array}\right) +% \left(\begin{array}[b]{c} 1\\2\\3 \end{array}\right) +% \] +% \begin{verbatim} +% \begin{array}[t]({c}) 1\\2\\3 \end{array} +% \begin{array}[c]({c}) 1\\2\\3 \end{array} +% \begin{array}[b]({c}) 1\\2\\3 \end{array} +% \quad\mbox{not}\quad +% \left(\begin{array}[t]{c} 1\\2\\3 \end{array}\right) +% \left(\begin{array}[c]{c} 1\\2\\3 \end{array}\right) +% \left(\begin{array}[b]{c} 1\\2\\3 \end{array}\right) +% \end{verbatim} +% +% +% \StopEventually{} +% +% \section{The Macros} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macrocode} +\RequirePackage{array}[1994/02/03] +% \end{macrocode} +% +% \begin{macro}{\@tabarray} +% This macro tests for an optional bracket and then calls up +% |\@@array| or |\@@array[c]| (as default). +% \begin{macrocode} +\def\@tabarray{\@ifnextchar[{\@@array}{\@@array[c]}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@@array} +% This macro tests for an optional delimiter before the left brace +% of the main preamble argument. If there is no delimiter, +% |\@arrayleft| and |\@arrayright| are made a no-ops, and +% |\@array| is called with the positional argument. Otherwise +% call |\@del@array|. +% \begin{macrocode} +\def\@@array[#1]{\@ifnextchar\bgroup + {\let\@arrayleft\relax\let\@arrayright\relax\@array[#1]}% + {\@del@array[#1]}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@del@array} +% We now know that we have an {\tt array} (or {\tt tabular}) with +% delimiters. +% \begin{macrocode} +\def\@del@array[#1]#2#3#4{% +% \end{macrocode} +% The following line is completely redundant but it does catch errors +% involving delimiters before the processing of the alignment begins. +% A common error is likely to be omitting the `.' in a +% |\cases|-type construction. This causes the first token of the +% alignment to be gobbled, possibly causing lots of spurious errors +% before the cause of the error, the missing delimiter, is discovered as +% |\@arrayright| puts the alignment and the delimiters together. +% \begin{macrocode} + \setbox\z@\hbox{$\left#2\right#4$}% +% \end{macrocode} +% In the case of a `c' argument we do not need to rebox the alignment, +% so we can define |\@arrayleft| and |\@arrayright| just to +% insert the delimiters. +% \begin{macrocode} + \if#1c\def\@arrayleft{\left#2}\def\@arrayright{\right#4}% +% \end{macrocode} +% Otherwise we (should) have a {\tt[t]} or {\tt[b]} argument, so first we +% store the alignment, without delimiters in box0. +% \begin{macrocode} + \else\def\@arrayleft{\setbox\z@}% +% \end{macrocode} +% Then after the alignment is finished: +% \begin{macrocode} + \def\@arrayright{% +% \end{macrocode} +% Calculate the amount the box needs to be lowered (this will be +% negative in the case of |[b]|). A little bit of arithmetic cf.\ +% the \TeX{}Book, Appendix G, rule 8. We calculate the amount this +% way, rather than just taking the difference between the depth of box0 +% and the depth of the box defined below, as the depth of that box may +% be affected by the delimiters if |\delimitershortfall| or +% |\delimiterfactor| have non-standard values. +% \begin{macrocode} + \dimen@=\dp\z@ + \advance\dimen@-\ht\z@ + \divide \dimen@ by \tw@ + \advance\dimen@ by\fontdimen22 \textfont\tw@ +% \end{macrocode} +% Now lower the alignment and the delimiters into place. +% \begin{macrocode} + \lower\dimen@\hbox{$\left#2\vcenter{\unvbox\z@}\right#4$}}% +% \end{macrocode} +% End the |\if#1c| +% \begin{macrocode} + \fi +% \end{macrocode} +% Now that we have defined |\@arrayleft| and |\@arrayright|, call +% |\@array|. +% \begin{macrocode} + \@array[#1]{#3}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% +% \subsection{newarray.sty} +% All the features of the old {\tt newarray} style option have been +% merged into the {\tt array} or {\tt delarray} options. +% \changes{v1.00}{1992/07/06} +% {Stop generating a `shell' newarray.sty} +% +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex-dev/tools/enumerate.dtx b/Master/texmf-dist/source/latex-dev/tools/enumerate.dtx new file mode 100644 index 00000000000..984d36d4157 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/enumerate.dtx @@ -0,0 +1,335 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% File: enumerate.dtx Copyright 1993 1994 1999 David Carlisle +% +%<*dtx> + \ProvidesFile{enumerate.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{enumerate} +%<driver> \ProvidesFile{enumerate.drv} +% \fi +% \ProvidesFile{enumerate.dtx} + [2015/07/23 v3.00 enumerate extensions (DPC)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage{enumerate} +\begin{document} +\DocInput{enumerate.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{enumerate.dtx} +% \title{The \textsf{enumerate} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{David Carlisle} +% \date{\filedate} +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% \changes{v1.00}{1990/00/00}{First version (since lost)} +% \changes{v2.00}{1991/07/25}{New Algorithm} +% \changes{v2.01}{1992/06/26}{Re-issue for the new doc and docstrip.} +% \changes{v2.02}{1994/01/31}{Update for LaTeX2e} +% \changes{v3.00}{1999/03/05}{Add extension hook for tools/2916} +% \changes{v3.00}{2015/07/23}{Documentation fixes tools/2916} +% +% \begin{abstract} +% This package gives the enumerate environment an optional argument +% which determines the style in which the counter is printed. +% +% An occurrence of one of the tokens |A a I i| or |1| produces the value +% of the counter printed with (respectively) |\Alph \alph \Roman \roman| +% or |\arabic|. +% +% These letters may be surrounded by any strings involving any other +% \TeX\ expressions, however the tokens |A a I i 1| must be inside a +% |{ }| group if they are not to be taken as special. +% \end{abstract} +% +% \section{Examples} +%\showboxdepth=10 +% \showboxbreadth=10 +% \[ +% \parbox{2.2in}{\hbadness2000 +% \begin{enumerate}[EX i.] +% \item one one one one one one one +% one one one one one\label{LA} +% \item two +% \begin{enumerate}[{example} a)] +% \item one of two one of two one of two\label{LB} +% \item two of two +% \end{enumerate} +% \end{enumerate} +% \begin{enumerate}[{A}-1] +% \item one\label{LC} +% \item two +% \end{enumerate}} +% \hspace{20pt} +% \vcenter{\hsize=2.4in +% \begin{verbatim} +% \begin{enumerate}[EX i.] +% \item one one one one one one one +% one one one one\label{LA} +% \item two +% \begin{enumerate}[{example} a)] +% \item one of two one of two +% one of two\label{LB} +% \item two of two +% \end{enumerate} +% \end{enumerate} +% +% \begin{enumerate}[{A}-1] +% \item one\label{LC} +% \item two +% \end{enumerate} +% \end{verbatim} +% }\] +% +% |\label| and |\ref| may be used as with the standard {\tt +% enumerate} environment. |\ref| only produces the counter value, +% not the whole label. |\ref| prints the value in the same style +% as |\item|, as determined by the presence of one of the tokens +% |A a I i 1| in the optional argument. In the above example +% |\ref{LA}|, |\ref{LB}| and |\ref{LC}| produce +% `\ref{LA}', `\ref{LB}' and `\ref{LC}' respectively. +% +% \StopEventually{} +% +%\section{Macros} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macro}{\@enlab} +% Internal token register used to build up the label command from the +% optional argument. +% \begin{macrocode} +\newtoks\@enLab +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@enQmark} +% This just expands to a `?'. |\ref| will produce this, if no counter +% is printed. +% \begin{macrocode} +\def\@enQmark{?} +% \end{macrocode} +% \end{macro} +% +% The next four macros build up the command that will print the item +% label. They each gobble one token or group from the optional argument, +% and add corresponding tokens to the register |\@enLab|. They each end +% with a call to |\@enloop|, which starts the processing of the next +% token. +% \begin{macro}{\@enLabel} +% Add the counter to the label. |#2| will be one of the `special' +% tokens |A a I i 1|, and is thrown away. |#1| will be a command +% like |\Roman|. +% \begin{macrocode} +\def\@enLabel#1#2{% + \edef\@enThe{\noexpand#1{\@enumctr}}% + \@enLab\expandafter{\the\@enLab\csname the\@enumctr\endcsname}% + \@enloop} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@enSpace} +% \begin{macro}{\@enSp@ce} +% Add a space to the label. The tricky bit is to gobble the space token, +% as you can not do this with a macro argument. +% \begin{macrocode} +\def\@enSpace{\afterassignment\@enSp@ce\let\@tempa= } +\def\@enSp@ce{\@enLab\expandafter{\the\@enLab\space}\@enloop} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@enGroup} +% Add a |{ }| group to the label. +% \begin{macrocode} +\def\@enGroup#1{\@enLab\expandafter{\the\@enLab{#1}}\@enloop} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@enOther} +% Add anything else to the label +% \begin{macrocode} +\def\@enOther#1{\@enLab\expandafter{\the\@enLab#1}\@enloop} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@enloop} +% \begin{macro}{\@enloop@} +% The body of the main loop. +% Eating tokens this way instead of using |\@tfor| lets you see +% spaces and {\bf all} braces. |\@tfor| would treat {\tt a} and +% |{a}| as special, but not |{{a}}|. +% \begin{macrocode} +\def\@enloop{\futurelet\@entemp\@enloop@} +% \end{macrocode} +% \begin{macrocode} +\def\@enloop@{% + \ifx A\@entemp \def\@tempa{\@enLabel\Alph }\else + \ifx a\@entemp \def\@tempa{\@enLabel\alph }\else + \ifx i\@entemp \def\@tempa{\@enLabel\roman }\else + \ifx I\@entemp \def\@tempa{\@enLabel\Roman }\else + \ifx 1\@entemp \def\@tempa{\@enLabel\arabic}\else + \ifx \@sptoken\@entemp \let\@tempa\@enSpace \else + \ifx \bgroup\@entemp \let\@tempa\@enGroup \else + \ifx \@enum@\@entemp \let\@tempa\@gobble \else + \let\@tempa\@enOther +% \end{macrocode} +% Hook for possible extensions +% \begin{macrocode} + \@enhook +% \end{macrocode} +% +% \begin{macrocode} + \fi\fi\fi\fi\fi\fi\fi\fi +% \end{macrocode} +% \end{macro} +% Process the current token, then look at the next. +% \begin{macrocode} + \@tempa} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@enhook} +% Hook for possible extensions. +% Some packages may want to extend the number of special characters +% that are associated with counter representations. This feature +% was requested to enable Russian alphabetic counting, but here +% I give an example of a footnote symbol counter, triggered by |*|. +% +% To enable a new counter type based on a letter, you just need +% to add a new |\ifx| clause by analogy with the code above. +% So for example to make |*| trigger footnote symbol counting. +% a package should do the following. +% +% Initialise the hook, in case the package is loaded before +% \textsf{enumerate}. +%\begin{verbatim} +% \providecommand\@enhook{} +%\end{verbatim} +% +% Add to the hook a new |\ifx| clause that associates |*| with the +% |\fnsymbol| counter command. +%\begin{verbatim} +% \g@addto@macro\@enhook{% +% \ifx *\@entemp +% \def\@tempa{\@enLabel\fnsymbol}% +% \fi} +%\end{verbatim} +% This code sequence should work whether it is loaded before or after +% this enumerate package. Any number of new counter types may be added +% in this way. +% +% At this point we just need initialise the hook, taking care not +% to over write any definitions another package may already have added. +% \begin{macrocode} +\providecommand\@enhook{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\enumerate} +% The new {\tt enumerate} environment. This is the first half of the +% original enumerate environment. If there is an optional argument, call +% |\@@enum@| to define the label commands, otherwise call +% |\@enum@| which is the second half of the original definition. +% \begin{macrocode} +\def\enumerate{% + \ifnum \@enumdepth >3 \@toodeep\else + \advance\@enumdepth \@ne + \edef\@enumctr{enum\romannumeral\the\@enumdepth}\fi + \@ifnextchar[{\@@enum@}{\@enum@}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@enum@} +% Handle the optional argument.. +% \begin{macrocode} +\def\@@enum@[#1]{% +% \end{macrocode} +% Initialise the loop which will break apart the optional argument. +% The command to print the label is built up in |\@enlab|. +% |\@enThe| will be used to define |\theenum|\,$n$. +% \begin{macrocode} + \@enLab{}\let\@enThe\@enQmark +% \end{macrocode} +% The |\@enum@| below is never expanded, it is used to detect the end +% of the token list. +% \begin{macrocode} + \@enloop#1\@enum@ +% \end{macrocode} +% Issue a warning if we did not find one of the `special' tokens. +% \begin{macrocode} + \ifx\@enThe\@enQmark\@warning{The counter will not be printed.% + ^^J\space\@spaces\@spaces\@spaces The label is: \the\@enLab}\fi +% \end{macrocode} +% Define |\labelenum|$\,n$ and |\theenum|$\,n$. +% \begin{macrocode} + \expandafter\edef\csname label\@enumctr\endcsname{\the\@enLab}% + \expandafter\let\csname the\@enumctr\endcsname\@enThe +% \end{macrocode} +% Set the counter to 7 so that we get the width of `vii' if roman +% numbering is in force then set |\leftmargin|$\,n$. to the width of the +% label plus |\labelsep|. +% \begin{macrocode} + \csname c@\@enumctr\endcsname7 + \expandafter\settowidth + \csname leftmargin\romannumeral\@enumdepth\endcsname + {\the\@enLab\hspace{\labelsep}}% +% \end{macrocode} +% Finally call |\@enum@| which is the second half of the original +% definition. +% \begin{macrocode} + \@enum@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@enum@} +% All the list parameters have now been defined, so call |\list|. This +% is taken straight from the original definition of |\enumerate|. +% \begin{macrocode} +\def\@enum@{\list{\csname label\@enumctr\endcsname}% + {\usecounter{\@enumctr}\def\makelabel##1{\hss\llap{##1}}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% +\endinput diff --git a/Master/texmf-dist/source/latex-dev/tools/fileerr.dtx b/Master/texmf-dist/source/latex-dev/tools/fileerr.dtx new file mode 100644 index 00000000000..3b5895a5f61 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/fileerr.dtx @@ -0,0 +1,123 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \def\fileversion{v1.1a} \def\filedate{2003/12/28} +% \iffalse This is a METACOMMENT +% Doc-Source file to use with LaTeX2e +% Copyright (C) 1994-2004 Frank Mittelbach, all rights reserved. +% \fi +% \title{File not found error\thanks{This file has version +% \fileversion\ last revised \filedate}} +% \author{Frank Mittelbach} +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% \changes{v1.0e}{97/07/07}{Added q and r replies (PR/2525).} +% +% \section{Introduction} +% When \LaTeXe{} is unable to find a file it will ask for an +% alternative file name. However, sometimes the problem is +% only noticed by \TeX{}, and in that case \TeX{} insists on +% getting a valid file name; any other attempt to leave this +% error loop will fail.\footnote{On some systems, \TeX{} +% accepts a special character denoting the end of file to +% return from this loop, e.g.\ Control-D on UNIX or Control-Z +% on DOS.} Many users try to respond in the same way as to +% normal error messages, e.g.\ by typing \meta{return}, or |s| +% or |x|, but \TeX{} will interpret this as a file name and +% will ask again. +% \par To provide a graceful exit out of this loop, we define +% a number of files which emulate the normal behavior of +% \TeX{} in the error loop as far as possible. +% \par After installing these files the user can respond with +% |h|, |q|, |r|, |s|, |e|, |x|, and on some systems also with +% \meta{return} to \TeX's missing file name question. +% \StopEventually{} +% +% \section{The documentation driver} +% This code will generate the documentation. Since it is the +% first piece of code in the file, the documentation can be +% obtained by simply processing this file with \LaTeXe. +% \begin{macrocode} +%<*driver> +\documentclass{ltxdoc} +\begin{document} \DocInput{fileerr.dtx} \end{document} +%</driver> +% \end{macrocode} +% \section{The files} +% +% \subsection{Asking for help with {\tt h}} +% When the user types |h| in the file error loop \TeX{} will +% look for the file |h.tex|. In this file we put a message +% informing the user about the situation (we use |^^J| to +% start new lines in the message) and then finish with a +% normal |\errmessage| command thereby bringing up \TeX's +% normal error mechanism. +% \begin{macrocode} +%<*help> +\newlinechar=`\^^J +\message{! The file name provided could not be found.^^J% +Use `<enter>' to continue processing,^^J% +`S' to scroll future errors^^J% +`R' to run without stopping,^^J% +`Q' to run quietly,^^J% +or `X' to terminate TeX} +\errmessage{} +%</help> +% \end{macrocode} +% +% \subsection{Scrolling this and further errors with {\tt s}} +% For the response |s| we put a message into the file |s.tex| +% and start |\scrollmode| to scroll further error messages in +% this run. On systems that allow |.tex| as a file name we +% can also trap a single \meta{return} from the user. +% \begin{macrocode} +%<+scroll|return|run,batch> \message{File ignored} +%<+scroll> \scrollmode +%<+run> \nonstopmode +%<+batch> \batchmode +% \end{macrocode} +% +% \subsection{Exiting the run with {\tt x} or {\tt e}} +% +% If the user enters |x| or |e| to stop \TeX{}, we need to put +% something into the corresponding file which will force \TeX{} to +% give up. We achieve this by turning off terminal output and then +% asking \TeX{} to stop: first by using the internal \LaTeX{} name +% |\@@end|, and if that doesn't work because something other than +% \LaTeX{} is used, by trying the \TeX{} primitive |\end|. The +% |\errmessage| is there to ensure that \TeX{}'s internal "history" +% variable is set to |error_message_issued|. This in turn will +% hopefully set the exit code on those operating systems that +% implement return codes (though there is no guarantee for this). +% \changes{v1.1a}{2003/12/28}{Attempt to set exit code (pr/3538).} +% \begin{macrocode} +%<+edit|exit> \batchmode \errmessage{}\csname @@end\endcsname \end +% \end{macrocode} +% We end every file with an explicit |\endinput| which prevents +% the docstrip program from putting the character table into +% the generated files. +% \begin{macrocode} +\endinput +% \end{macrocode} +%% +% \Finale diff --git a/Master/texmf-dist/source/latex-dev/tools/fontsmpl.dtx b/Master/texmf-dist/source/latex-dev/tools/fontsmpl.dtx new file mode 100644 index 00000000000..961bdda71fc --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/fontsmpl.dtx @@ -0,0 +1,338 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \title{A font sampler} +% \author{Alan Jeffrey} +% \date{v0.11} +% +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% +%% +% +% \changes{v0.01}{1994/05/01}{Created this test document as part of +% accents.dtx.} +% \changes{v0.02}{1994/05/12}{Added the t1enc and ot1enc packages.} +% \changes{v0.03}{1994/05/14}{Moved fontsmpl to its own dtx file.} +% \changes{v0.03}{1994/05/14}{Removed the t1enc and ot1enc packages.} +% \changes{v0.04}{1994/05/14}{Removed some debugging code, improved +% documentation.} +% \changes{v0.05}{1994/05/14}{Tidied up some more. Removed the fontenc +% package.} +% \changes{v0.06}{1994/10/27}{Added testing for all the commands in +% ltoutenc.} +% \changes{v0.06}{1994/10/27}{Switched off error for `commands not +% defined in this encoding'.} +% \changes{v0.07}{1994/10/29}{Added testing for \cs{dots}, +% \cs{copyright} and \cs{textregistered}.} +% \changes{v0.07}{1994/10/29}{Replaced ??? for missing characters by +% \textbf{?}.} +% \changes{v0.08}{1994/10/30}{Added testing for \cs{k} and \cs{t}.} +% \changes{v0.08}{1994/10/30}{Removed testing for any glyphs not in +% usrguide.} +% \changes{v0.08}{1994/10/30}{Allowed overfull boxes in the accent test +% to extend out into the right margin.} +% \changes{v0.10}{1995/09/19}{Corrected placement of docstrip guard.} +% \changes{v0.11}{1997/05/13}{Replaced \cs{@changed@x@err} by +% \cs{TextSymbolUnavailable}, according to the change in +% \texttt{ltoutenc.dtx}.} +% +% \section{Introduction} +% +% This document describes the font test document |fontsmpl.tex| and the +% accompanying package |fontsmpl.sty|. This produces a test of a font +% family, printing a sample text, a table of accents, and a sample of +% commands such as |\pounds|. +% +% It can be used in two ways. The |fontsmpl| package provides the +% command |\fontsample|, which produces a sample of the current font. +% +% The |fontsmpl| document prompts interactively for a font family (for +% example `|cmr|') and produces a sample of that family. +% +% \StopEventually{} +% +% \section{Documentation} +% +% This docstrip document has three docstrip options: +% \begin{itemize} +% \item |document| the code for |fontsmpl.tex|. +% \item |package| the code for |fontsmpl.sty|. +% \item |driver| this documentation. +% \end{itemize} +% The code for the driver is: +% \begin{macrocode} +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\documentclass{ltxdoc} +\begin{document} + \DocInput{fontsmpl.dtx} +\end{document} +%</driver> +% \end{macrocode} +% +% \section{Font sample document} +% +% The sample document prompts for a family, and uses the |fontsmpl| +% package. If there is a file |fontsmpl.cfg|, this is loaded. +% \changes{v0.9}{1995/05/07}{Removed \cs{pagestyle} empty} +% \begin{macrocode} +%<*document> +\NeedsTeXFormat{LaTeX2e} +\documentclass{article} +\usepackage{fontsmpl} +\makeatletter +\InputIfFileExists{fontsmpl.cfg}{}{} +\makeatother +\typein[\family]{Please enter a family name (for example `cmr').} +\title{Test of \LaTeX{} font family `\family'} +\author{Font sample produced with `fontsmpl'} +\raggedright +\begin{document} +\maketitle +\fontfamily{\family}\selectfont +\fontencoding{T1}\selectfont\fontsample +\fontencoding{OT1}\selectfont\fontsample +\itshape +\fontencoding{T1}\selectfont\fontsample +\fontencoding{OT1}\selectfont\fontsample +\slshape +\fontencoding{T1}\selectfont\fontsample +\fontencoding{OT1}\selectfont\fontsample +\scshape +\fontencoding{T1}\selectfont\fontsample +\fontencoding{OT1}\selectfont\fontsample +\upshape\bfseries +\fontencoding{T1}\selectfont\fontsample +\fontencoding{OT1}\selectfont\fontsample +\itshape +\fontencoding{T1}\selectfont\fontsample +\fontencoding{OT1}\selectfont\fontsample +\slshape +\fontencoding{T1}\selectfont\fontsample +\fontencoding{OT1}\selectfont\fontsample +\scshape +\fontencoding{T1}\selectfont\fontsample +\fontencoding{OT1}\selectfont\fontsample +\end{document} +%</document> +% \end{macrocode} +% +% \section{Font sample package} +% +% The |fontsmpl| package is a \LaTeXe{} package. +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{fontsmpl}[1994/10/29 Font sample package] +% \end{macrocode} +% +% \begin{macro}{\fontsample} +% The |\fontsample| command prints out a sample text, a +% selection of glyphs, and a table of accents. +% \begin{macrocode} +\newcommand{\fontsample}{% + Test of font \f@encoding/\f@family/\f@series/\f@shape. + \fontsampletext + \fontsampleglyphs + \fontsampleaccents +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fontsampletext} +% A sample text, taken from Knuth's |testfont.tex|. +% \begin{macrocode} +\newcommand{\fontsampletext}{% + Some text: + \begin{quote}\begin{flushleft} + On November 14, 1885, Senator \& Mrs.~Leland Stanford called + together at their San Francisco mansion the 24~prominent men who + had been chosen as the first trustees of The Leland Stanford + Junior University. They handed to the board the Founding Grant + of the University, which they had executed three days before. + This document---with various amendments, legislative acts, and + court decrees---remains as the University's charter. In bold, + sweeping language it stipulates that the objectives of the + University are ``to qualify students for personal success and + direct usefulness in life; and to promote the publick welfare by + exercising an influence in behalf of humanity and civilization, + teaching the blessings of liberty regulated by law, and + inculcating love and reverence for the great principles of + government as derived from the inalienable rights of man to life, + liberty, and the pursuit of happiness.'' + \\ + (!`THE DAZED BROWN FOX QUICKLY GAVE 12345--67890 JUMPS!) + \\ + ?`But aren't Kafka's Schlo\ss\ + and \AE sop's \OE uvres often na\"\i ve vis-\`a-vis the + d\ae monic ph\oe nix's official r\^ole in fluffy s\t ouffl\'es? + \\ + + \end{flushleft}\end{quote} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fontsampleglyphs} +% \begin{macro}{\fontsampleglyph} +% A list of sample glyph commands. +% \begin{macrocode} +\newcommand{\fontsampleglyphs}{% + Some glyphs: + \begin{quote}\begin{flushleft} + \fontsampleglyph{\#} + \fontsampleglyph{\$} + \fontsampleglyph{\%} + \fontsampleglyph{\&} + \fontsampleglyph{\AA} + \fontsampleglyph{\AE} + \fontsampleglyph{\DH} + \fontsampleglyph{\DJ} + \fontsampleglyph{\L} + \fontsampleglyph{\NG} + \fontsampleglyph{\OE} + \fontsampleglyph{\O} + \fontsampleglyph{\P} + \fontsampleglyph{\SS} + \fontsampleglyph{\S} + \fontsampleglyph{\TH} + \fontsampleglyph{\_} + \fontsampleglyph{\aa} + \fontsampleglyph{\ae} + \fontsampleglyph{\copyright} + \fontsampleglyph{\dag} + \fontsampleglyph{\ddag} + \fontsampleglyph{\dh} + \fontsampleglyph{\dj} + \fontsampleglyph{\dots} + \fontsampleglyph{\guillemotleft} + \fontsampleglyph{\guillemotright} + \fontsampleglyph{\guilsinglleft} + \fontsampleglyph{\guilsinglright} + \fontsampleglyph{\i} + \fontsampleglyph{\j} + \fontsampleglyph{\l} + \fontsampleglyph{\ng} + \fontsampleglyph{\oe} + \fontsampleglyph{\o} + \fontsampleglyph{\pounds} + \fontsampleglyph{\quotedblbase} + \fontsampleglyph{\quotesinglbase} + \fontsampleglyph{\ss} + \fontsampleglyph{\textasciicircum} + \fontsampleglyph{\textasciitilde} + \fontsampleglyph{\textbackslash} + \fontsampleglyph{\textbar} + \fontsampleglyph{\textbullet} + \fontsampleglyph{\textcompwordmark} + \fontsampleglyph{\textemdash} + \fontsampleglyph{\textendash} + \fontsampleglyph{\textexclamdown} + \fontsampleglyph{\textgreater} + \fontsampleglyph{\texthyphenchar} + \fontsampleglyph{\textless} + \fontsampleglyph{\textperiodcentered} + \fontsampleglyph{\textquestiondown} + \fontsampleglyph{\textquotedblleft} + \fontsampleglyph{\textquotedblright} + \fontsampleglyph{\textquotedbl} + \fontsampleglyph{\textquoteleft} + \fontsampleglyph{\textquoteright} + \fontsampleglyph{\textvisiblespace} + \fontsampleglyph{\th} + \fontsampleglyph{\{} + \fontsampleglyph{\}} + \end{flushleft}\end{quote} +} +\newcommand{\fontsampleglyph}[1]{% + \ifx#1\@undefined + {\typewriterfont\string#1}~is~undefined + \else + {\typewriterfont\string#1}~is~`#1' + \fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\fontsampleaccents} +% \begin{macro}{\fontsampleaccent} +% A sample of accents. +% \begin{macrocode} +\newcommand{\fontsampleaccents}{% + Some accents: + \begin{quote}\begin{flushleft} + \fontsampleaccent{\"} \\ + \fontsampleaccent{\'} \\ + \fontsampleaccent{\.} \\ + \fontsampleaccent{\=} \\ + \fontsampleaccent{\H} \\ + \fontsampleaccent{\^} \\ + \fontsampleaccent{\`} \\ + \fontsampleaccent{\b} \\ + \fontsampleaccent{\c} \\ + \fontsampleaccent{\d} \\ + \fontsampleaccent{\k} \\ + \fontsampleaccent{\u} \\ + \fontsampleaccent{\v} \\ + \fontsampleaccent{\~} + \end{flushleft}\end{quote} +} +\newcommand{\fontsampleaccent}[1]{% + \makebox[1em][r]{\typewriterfont\string#1} + \makebox[15em][l]{% + #1A#1C#1D#1E#1G#1I#1L#1N% + #1O#1R#1S#1T#1U#1Y#1Z% + #1a#1c#1d#1e#1g#1\i#1i#1l#1n% + #1o#1r#1s#1t#1u#1y#1z% + } +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\typewriterfont} +% Not all sites have the T1 typewriter fonts, so we set the +% typewriter font to be a fixed font. +% \begin{macrocode} +\DeclareFixedFont{\typewriterfont} + {\encodingdefault}{\ttdefault}{\mddefault}{\updefault}{10} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TextSymbolUnavailable} +% Switch off the error message from missing glyphs. +% \begin{macrocode} +\def\TextSymbolUnavailable#1{% + \textbf{?}\PackageInfo{fontsmpl}{% + Command \protect#1 undefined in encoding \f@encoding% + }% +} +%</package> +% \end{macrocode} +% \end{macro} +%\Finale +\endinput + + diff --git a/Master/texmf-dist/source/latex-dev/tools/ftnright.dtx b/Master/texmf-dist/source/latex-dev/tools/ftnright.dtx new file mode 100644 index 00000000000..5739172f85d --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/ftnright.dtx @@ -0,0 +1,1018 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +%\iffalse % this is a METACOMMENT ! +% +%% Package `ftnright' to use with LaTeX 2e +%% Copyright (C) 1989-2004 Frank Mittelbach, all rights reserved. +%<+package>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<+package>\ProvidesPackage{ftnright} +%<+package> [2014/10/28 v1.1f footnote layout package (FMi)] +% +% \fi +%% +%% +% +% +% \DoNotIndex{\;} +%^^A \DoNotIndex{\@cclv} +%^^A \DoNotIndex{\@colht} +%^^A \DoNotIndex{\@colroom} +% \DoNotIndex{\@combinedblfloats} +% \DoNotIndex{\@combinefloats} +% \DoNotIndex{\@dblfloatplacement} +% \DoNotIndex{\@deferlist} +% \DoNotIndex{\@empty} +%^^A \DoNotIndex{\@fcolmadefalse} +%^^A \DoNotIndex{\@firstcolumnfalse} +%^^A \DoNotIndex{\@firstcolumntrue} +% \DoNotIndex{\@freelist} +% \DoNotIndex{\@ixpt} +%^^A \DoNotIndex{\@leftcolumn} +%^^A \DoNotIndex{\@m} +%^^A \DoNotIndex{\@makecol} +%^^A \DoNotIndex{\@makefntext} +%^^A \DoNotIndex{\@maxdepth} +% \DoNotIndex{\@midlist} +%^^A \DoNotIndex{\@outputbox} +%^^A \DoNotIndex{\@outputdblcol} +%^^A \DoNotIndex{\@outputpage} +% \DoNotIndex{\@ptsize} +%^^A \DoNotIndex{\@setsize} +% \DoNotIndex{\@spaces} +%^^A \DoNotIndex{\@startcolumn} +%^^A \DoNotIndex{\@startdblcolumn} +% \DoNotIndex{\@tempdima} +% \DoNotIndex{\@textbottom} +% \DoNotIndex{\@texttop} +%^^A \DoNotIndex{\@thefnmark} +% \DoNotIndex{\@viiipt} +% \DoNotIndex{\@whilesw} +% \DoNotIndex{\@width} +%^^A \DoNotIndex{\@xstartcol} +% \DoNotIndex{\@xpt} +% \DoNotIndex{\advance} +% \DoNotIndex{\begingroup} +% \DoNotIndex{\box} +%^^A \DoNotIndex{\boxmaxdepth} +%^^A \DoNotIndex{\columnseprule} +%^^A \DoNotIndex{\columnwidth} +% \DoNotIndex{\count} +% \DoNotIndex{\def} +% \DoNotIndex{\dimen} +% \DoNotIndex{\dp} +% \DoNotIndex{\else} +% \DoNotIndex{\endgroup} +% \DoNotIndex{\fi} +% \DoNotIndex{\filedate} +% \DoNotIndex{\filename} +% \DoNotIndex{\fileversion} +%^^A \DoNotIndex{\footins} +%^^A \DoNotIndex{\footnoterule} +%^^A \DoNotIndex{\footnotesep} +%^^A \DoNotIndex{\footnotesize} +%^^A \DoNotIndex{\ftn@amount} +% \DoNotIndex{\gdef} +% \DoNotIndex{\global} +% \DoNotIndex{\hbox} +% \DoNotIndex{\hfil} +% \DoNotIndex{\hss} +% \DoNotIndex{\ht} +%^^A \DoNotIndex{\if@fcolmade} +%^^A \DoNotIndex{\if@firstcolumn} +% \DoNotIndex{\ifcase} +%^^A \DoNotIndex{\ifvoid} +% \DoNotIndex{\ifx} +%^^A \DoNotIndex{\insert} +% \DoNotIndex{\ixpt} +% \DoNotIndex{\let} +% \DoNotIndex{\llap} +% \DoNotIndex{\long} +%^^A \DoNotIndex{\maxdepth} +%^^A \DoNotIndex{\newdimen} +%^^A \DoNotIndex{\newskip} +% \DoNotIndex{\noindent} +% \DoNotIndex{\normalsize} +% \DoNotIndex{\or} +%^^A \DoNotIndex{\parindent} +%^^A \DoNotIndex{\preparefootins} +%^^A \DoNotIndex{\rcol@footinsskip} +%^^A \DoNotIndex{\saved@footinsskip} +% \DoNotIndex{\setbox} +% \DoNotIndex{\skip} +% \DoNotIndex{\space} +%^^A \DoNotIndex{\strutbox} +%^^A \DoNotIndex{\textheight} +%^^A \DoNotIndex{\textwidth} +% \DoNotIndex{\unvbox} +% \DoNotIndex{\vbox} +% \DoNotIndex{\viiipt} +% \DoNotIndex{\vrule} +% \DoNotIndex{\vskip} +%^^A \DoNotIndex{\wlog} +% \DoNotIndex{\xdef} +% \DoNotIndex{\xpt} +% \DoNotIndex{\z@} +% +% \changes{v1.1a}{1994/01/24}{Upgrades for LaTeX2e} +% \changes{v1.1b}{1994/01/24}{Driver moved in front} +% \changes{v1.1c}{1996/01/01}{Use article.cls for documentation} +% +% \renewcommand{\.}{\penalty500} %^^A for certain breaks +% +% \setlength{\hfuzz}{2pt} ^^A allow small overshot in verbatim +% +% \GetFileInfo{ftnright.sty} +% +% \title{Footnotes in a multi-column layout\thanks +% {The \LaTeX{} package {\tt \filename} which is described +% in this article has the version number \fileversion{} dated +% \filedate.}} +% \author{Frank Mittelbach} +% +% +% \maketitle +% +% \pageshrink 1pt %^^A compensate for the \thanks marker +% +% +% \section{Preface to version 1.1} +% +% The new release is a basically unchanged version of the original. I +% upgraded the macros so that they work with \LaTeXe{} and used some +% of the additional flexibility introduced therein. For example, the +% command |\preparefootins| is now automatically called at +% |\begin{document}|, thus allowing the user to adjust the +% |\textheight| in the preamble. +% +% It is not surprisingly that I was forced to change some of the +% macros because they dig deep into \LaTeX{}'s output routines. +% Fortunately this is something normally not necessary when upgrading +% other \LaTeX~2.09 styles to \LaTeXe{} packages. +% +% I also upgraded the documentation to conform to the \LaTeXe{} +% terminology, e.g., this is a package since document classes will not +% know about it. However it is very likely that i have missed some +% necessary corrections. +% +% \section{Introduction} +% +% +% The placement of footnotes in a multicolumn layout always bothered +% me. The approach taken by \LaTeX{} (i.e., placing the footnotes +% separately under each column) might be all right if nearly no +% footnotes are present. But it looks clumsy when both columns contain +% footnotes, especially when they occupy different amounts of space. +% +% In the multicolumn package~\cite{art:FMi89b}, I used page-wide +% footnotes at the bottom of the page, but again the result doesn't +% look very pleasant since short footnotes produce undesired gaps of +% white space. Of course, the main goal of this package was a +% balancing algorithm for columns which would allow switching between +% different numbers of columns on the same page. With this feature, +% the natural place for footnotes seems to be the bottom of the +% page\footnote{You cannot use column footnotes at the bottom, since +% the number of columns can differ on one page.} but looking at some +% of the results it seems best to avoid footnotes in such a layout +% entirely. +% +% +% Another possibility is to turn footnotes into endnotes, i.e., +% printing them at the end of every chapter or the end of the entire +% document. But I assume everyone who has ever read a book using such +% a layout will agree with me, that it is a pain to search back and +% forth, so that the reader is tempted to ignore the endnotes +% entirely. +% +% When I wrote the article about ``Future extensions of +% \TeX{}''~\cite{inproc:FMi90} I was again dissatisfied with the +% outcome of the footnotes, and since this article should show certain +% aspects of high quality typesetting, I decided to give the footnote +% problem a try and modified the \LaTeX{} output routine for this +% purpose. The layout I used was inspired by the yearbook of the +% Gutenberg Gesellschaft Mainz \cite{book:GG}. Later on, I found that +% it is also recommended by Jan White \cite{book:JWh88}. On the layout +% of footnotes I also consulted books by Jan Tschichold +% \cite{book:JTs87} and Manfred Simoneit \cite{book:MSi89}, books I +% would recommend to everyone being able to read German texts. +% +% +% \subsection{Description of the new layout} +% +% The result of this effort is presented in this paper and the reader +% can judge for himself whether it was successful or +% not.\footnote{Please note, that this option only changed the +% placement of footnotes. Since this article also makes use of the +% {\tt doc} package \cite{bk:GMS94}, that assigns tiny numbers to +% code lines sprinkled throughout the text, the resulting design is +% not perfect. This package is now a standard part of \LaTeXe.} +% The main idea for this layout is to assemble the +% footnotes of all columns on a page and place them all together at +% the bottom of the right column. Allowing for enough space between +% footnotes and text, and in addition, setting the footnotes in +% smaller type\footnote{The standard layout in \TUB{} uses the same +% size for footnotes and text, giving the footnotes, in my opinion, +% much too much prominence.} I decided that one could omit the +% footnote separator rule which is used in most publications prepared +% with \TeX{}.\footnote{People who prefer the rule can add it by +% redefining the command {\tt\bslash footnoterule} +% \cite[p.~156]{book:LLa86}. Please, note, that this command should +% occupy no space, so that a negative space should be used to +% compensate for the width of the rule used.} Furthermore, I decided +% to place the footnote markers\footnote{\label{thisftn}The tiny +% numbers or symbols, e.g., the `\ref{thisftn}' in front of this +% footnote.} at the baseline instead of raising them as +% superscripts.\footnote{Of course, this is done only for the mark +% preceding the footnote text and not the one used within the main +% text where a raised number or symbol set in smaller type will help +% to keep the flow of thoughts, uninterrupted.} +% +% All in all, I think this generates a neat layout, and surprisingly +% enough, the necessary changes to the \LaTeX{} output routine are +% nevertheless astonishingly simple. +% +% \subsection{The use of the package} +% +% This package might be used together with any other package +% for \LaTeX{} which does not change the three internals changed by +% {\tt \filename}.\footnote{These are the macros {\tt\bslash +% @startcolumn}, {\tt\bslash @makecol}, and {\tt\bslash @outputdblcol}, +% as we will see below. Of course, the package will take only effect +% with a document class using a two-column layout (like {\tt ltugboat}) +% or when the user additionally specifies {\tt twocolumn} as a +% document class option in the {\tt\bslash documentclass} command.} In +% most cases, it is best to use this package as the very last +% package in the preamble to make sure that its +% settings are not overwritten by other packages. +% +% It is unfortunate that the current \LaTeX{} has nearly no provisions +% to make such changes without overwriting the internal routines. In +% the \LaTeX3 implementation, we will certainly add some hooks that +% will make such changes more easy. +% +% +% \subsection{Limitations} +% +% If in the first column there is more than a full column worth of footnote +% material the material will be split resulting in footnotes out of +% order. This issue is now detected and generates an error but the package is +% unable to gracefully handle it. This gives you two options: either rearrange +% your input so that it will use less footnotes in the first column (or add +% some pagebreaks at suitable places) or allow explicitly for more material to +% be gathered. The latter can be achieved by adding +%\begin{verbatim} +%\makeatletter +%\def\preparefootins{% +% \global\rcol@footinsskip\skip\footins +% \global\skip\footins\z@ +% \global\count\footins\z@ +% \global\dimen\footins2\textheight} +%\makeatother +%\end{verbatim} +% to the preamble of your document. However, with this you allow two columns +% worth of footnote material and that means that some of your footnotes are +% likely to be detached from their reference and show up on a later page! +% +% \StopEventually{ +% +% \begin{small} +% \begin{thebibliography}{1} +% +% \bibitem{bk:GMS94} \textsc{M.~Goossens}, \textsc{F.~Mittelbach} +% and \textsc{A.~Samarin}. +% \newblock The \LaTeX{} Companion. +% \newblock +% Addison-Wesley, Reading, Massachusetts, 1994. +% +% \bibitem{book:GG} +% Hans-Joachim Koppitz, editor. +% \newblock {\em {Gutenberg Jahrbuch}}. +% \newblock Gutenberg-Gesellschaft, Mainz. +% +% \bibitem{book:LLa86} +% Leslie Lamport. +% \newblock {\em {\LaTeX:} A Document Preparation System}. +% \newblock Addison-Wesley, Reading, Massachusetts, 1986. +% +% \bibitem{src:ltxiii94} +% \LaTeX3 project. +% \newblock \LaTeXe distribution, 1994. +% \newblock Sources for {\LaTeXe} the successor to \LaTeX~2.09. +% +% \bibitem{art:FMi89b} +% Frank Mittelbach +% \newblock An environment for multi-column output. +% \newblock {\em TUGboat}, 10(3):407--415, November 1989. +% +% \bibitem{inproc:FMi90} +% Frank Mittelbach +% \newblock E-{\TeX}: Guidelines to future {\TeX} extensions. +% \newblock In Lincoln K. Durst, editor, {\em \TUB}, 11(3): +% {\em 1990 TUG Annual Meeting Proceedings}, pages +% 337--345, September 1990. +% +% \bibitem{book:MSi89} +% Manfred Siemoneit. +% \newblock {\em Typographisches {G}estalten}. +% \newblock Polygraph Verlag, Frankfurt am Main, second edition, 1989. +% +% \bibitem{book:JTs87} +% Jan Tschichold. +% \newblock {\em {Ausgew\"ahlte Aufs\"atze \"uber Fragen der Gestalt des +% Buches}}. +% \newblock Birkh\"auser Verlag, Basel, 1987. +% \newblock Second printing. +% +% \bibitem{book:JWh88} +% Jan White. +% \newblock {\em Graphic Design for the Electronic Age}. +% \newblock Watson Guptill, Xerox Press, New York, 1988. +% +% \end{thebibliography} +% \end{small} +% +% \onecolumn +% \PrintIndex +% \PrintChanges +% } +% +% +% +% \section{The documentation driver} +% +% The first bit of code contains the documentation driver file for +% \TeX{}, i.e., the file that will produce the documentation you are +% currently reading. It will be extracted from this file by the {\tt +% docstrip} program. If you don't want to make any changes to the +% presentation you can alternatively process the \texttt{.dtx} file +% directly with \LaTeXe{} to obtain the documentation. +% \changes{v1.0d}{1992/04/19}{Added driver file to source} +% \changes{v1.0e}{1993/05/13}{Added history generation} +% \begin{macrocode} +%<*driver> +\documentclass[twocolumn]{article} + +\usepackage{ftnright} +\usepackage{doc} +\AtBeginDocument{\MakeShortVerb{\|}} + +\newcommand{\TUB}{{\sl TUGboat\/}} +\renewcommand\DescribeMacro[1]{\fbox + {\PrintDescribeMacro{#1}}} +\renewcommand\DescribeEnv[1]{\fbox + {\PrintDescribeEnv{#1}}} +\renewcommand\PrintMacroName[1]{} + +\setlength{\parindent}{1em} +\setlength{\parskip} + {2pt plus1pt minus1pt} +\setlength{\headsep}{20pt} +\setlength{\columnsep}{1.5pc} +\renewcommand{\bottomfraction}{.4} + +\flushbottom +\CodelineIndex +\RecordChanges % produce history +\EnableCrossrefs + +\setcounter{IndexColumns}{2} +\IndexPrologue{\section{Index} + All numbers denote code lines where + the corresponding entry is used, + underlined entries point to the + definition.} + +\begin{document} + \DocInput{ftnright.dtx} +\end{document} +%</driver> +% \end{macrocode} +% +% \section{The Implementation} +% +% +% As usual, we start by identifying the current version of this package +% file in the transcript file.\footnote{Nico Poppelier suggested +% omitting the {\tt\bslash typeout} statements in the production +% version of the files to avoid showing all that unnecessary +% information to the user. While I accept his criticism as valid, I +% decided that this information should at least be placed into the +% transcript file to make it easier to detect problems arising from +% the use of older versions. This happens now automatically as the command +% \texttt{\string\ProvidesPackage} will only write to the transcript file.} +% This actually happens at the very top of this file so it is commented out +% here. +%\begin{verbatim} +%\ProvidesPackage{ftnright}[\filedate\space +% LaTeX2e package \fileversion] +%\end{verbatim} +% +% To implement the layout described, above we have to distinguish +% between the left and the right column on a page. For this purpose +% \LaTeX{} maintains the switch |\if@firstcolumn|. When assembling +% material for the left (i.e., the first) column, footnotes should +% take up no space, since they are held over for the second column. In +% the second column these footnotes are combined with the ones found +% there and placed a suitable distance from the main text at the +% bottom of this column. +% +% This means that we have to change certain parameters for the +% insertion |\footins| when we construct the second column. The right +% place to do this is in the \LaTeX{} macro |\@outputdblcol| which we +% are going to change later on. What settings for the insertion +% parameters are appropriate? For setting the first column +% |\count|\.|\footins| and |\skip|\.|\footins| should both be zero +% since footnotes are held over while for the second column +% |\count|\.|\footins| should be $1000$ and the |\skip|\.|\footins| +% has to be set to the desired separation between main text and +% footnotes.\footnote{A value of $1000$ means that there is a +% one-to-one relationship between the real size of the footnote and +% the size finally occupied by the footnote on the current page.} +% +% +% We will allow one column of footnotes (i.e., the right column) at +% most, so that |\dimen|\.|\footins| has to equal |\textheight|. In +% principle, it would be possible to allow for even more footnotes, +% but this would complicate matters enormously.\footnote{It is not +% possible to make {\tt\bslash dimen\bslash footins} larger than +% {\tt\bslash textheight} directly, because this would result in a +% full left column (with text) and more than one column of footnotes. +% Instead, one has to make footnotes visible to the page generation +% algorithm again at the moment when a full column of footnotes is +% assembled, but we still have some space left in the first column. It +% is a nice enhancement, and, I suppose, it is of some value for +% preparing publications in certain disciplines, so here is the +% challenge~\ldots} +% +% +% \begin{macro}{\preparefootins} +% \begin{macro}{\saved@footinsskip} +% Since a document usually starts with a left column, we have to +% set |\count| and |\skip|\.|\footins| on top-level to zero. For +% this purpose, we define a macro |\preparefootins| which will +% first save the current value of |\skip|\.|\footins| in a safe +% place. This saved value will be used later for the second column. +% In this way, it is possible for the user or a designer of a +% document class to adjust this parameter without fiddling with the +% code of this package file. +% \begin{macrocode} +%<*package> +\def\preparefootins{% + \global\rcol@footinsskip\skip\footins + \global\skip\footins\z@ + \global\count\footins\z@ +% \end{macrocode} +% We will also assign |\textheight| to |\dimen|\.|\footins| to +% allow the user to change this parameter in the preamble. +% \begin{macrocode} + \global\dimen\footins\textheight} +% \end{macrocode} +% It is necessary to make the assignments above |\global| because +% we are going to use this macro in the output routine which has an +% implicit grouping level to keep the changes made by it local. +% \end{macro} +% Of course, we have to allocate the {\sf skip} register that we +% used above: +% \begin{macrocode} +\newskip\rcol@footinsskip +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@outputdblcol} +% Now we have all the necessary tools available to tackle +% |\@outputdblcol|. We have to remember that when +% |\if@firstcolumn| equals |\iftrue|, we are currently starting to +% build the second column, i.e., that the first column is already +% assembled. Therefore, the macro will start with the following +% code: +% \begin{macrocode} +\def\@outputdblcol{\if@firstcolumn + \global\@firstcolumnfalse +% \end{macrocode} +% After changing the switch, we save the first column (which was +% placed by preceding macros in |\@outputbox|) in the box register +% |\@leftcolumn|. Since we are inside the output routine, all those +% assignments have to be |\global| to take any effect. +% \begin{macrocode} + \global\setbox\@leftcolumn\box\@outputbox +% \end{macrocode} +% Then, we make the footnotes visible to the page generation +% algorithm by setting |\count\footins| to $1000$ (|\@m| is an +% abbreviation for this number) and |\skip\footins| to its saved +% value (i.e., |\rcol@footinsskip|). +% \begin{macrocode} + \global\count\footins\@m + \global\skip\footins\rcol@footinsskip +% \end{macrocode} +% We also have to reinsert all footnotes left over from the first +% column to make sure that they are reconsidered by the page +% generation algorithm of \TeX{} using the new values for |\count| +% and |\skip|\.|\footins|. But this will be done later in the +% macro |\@startcolumn|. +% +% If we have just finished the right column, i.e., when +% |\if@firstcolumn| equals |\iffalse|, we will reset the |\footins| +% parameters as explained above using the utility macro +% |\preparefootins|. +% \begin{macrocode} + \else \preparefootins +% \end{macrocode} +% Then, we compose both columns in |\@outputbox|, combine them with +% all page-wide floats for this page (|\@combinedblfloats|), attach +% header and footer, and ship out the result (|\@outputpage|). +% Finally we look to see whether it is possible to generate +% following pages consisting only of page-wide +% floats.\footnote{This part is copied directly from the original +% \LaTeX{} macro. Details about the used macros, their interfaces +% and meanings can be found in the \LaTeXe{} source +% code~\cite{src:ltxiii94}.} +% \begin{macrocode} + \global\@firstcolumntrue + \setbox\@outputbox\vbox{\hbox to\textwidth + {\hbox to\columnwidth + {\box\@leftcolumn\hss}% + \hfil\vrule\@width\columnseprule\hfil + \hbox to\columnwidth + {\box\@outputbox\hss}}}% + \@combinedblfloats\@outputpage + \begingroup + \@dblfloatplacement\@startdblcolumn + \@whilesw\if@fcolmade\fi + {\@outputpage\@startdblcolumn}% + \endgroup + \fi} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@startcolumn} +% \changes{v1.0b}{1990/08/11}{Macro added to correct float problems} +% There is a fundamental flaw in \LaTeX's output routine for float +% columns and float pages: split footnotes, i.e., footnotes which +% are only partly typeset on the preceding page are not resolved. +% They are held over until \LaTeX{} starts a page (or column) +% containing text besides floats again. For our current layout, +% this would mean, that if \LaTeX{} decided to make the right +% column of a page a float column, footnotes from the left column +% would appear on a later page. A real cure for this problem would +% be to rewrite two-thirds of \LaTeX{}'s output routine, so I am +% leaving this open for the interested reader. +% +% \begin{figure}[b] +% \fbox{%^^A +% \newlength{\puzzlewd}%^^A +% \setlength{\puzzlewd}{\columnwidth}%^^A +% \addtolength{\puzzlewd}{-2.1\fboxsep}%^^A +% \begin{minipage}{\puzzlewd} +% \vspace{17pt} +% \begin{center} +% \bf Puzzle: +% \end{center} +% \vspace{-3pt} +% \small +% \begin{quote} +% \rightskip \leftmargini plus 2.5em +% Given a simple \TeX{} document containing only straight text, is +% it possible for the editor, after +% deleting one sentence, to end up with a document +% producing an extra page? +% +% We assume that the deleted text contains no \TeX{} macros and +% that the document was prepared +% with a standard macro package like the one used for \TUB\/ production. +% \end{quote} +% \vspace{7pt} +% \begin{flushright} +% The answer will be given in the next issue. +% \end{flushright} +% \vspace{7pt} +% \end{minipage}} +% \end{figure} +% +% But the problem shows up even if only one float is contributed to +% the right column since \LaTeX{} assumes that the whole column is +% usable, whereas some of it might actually be already devoted to +% footnotes from the left column. So we have to change the output +% routine at least in the part that contributes floats to the next +% column. The macro involved is called |\@startcolumn|. The first +% thing we do is to check and see whether any deferred floats +% exists. +% \begin{macrocode} +\def\@startcolumn{% + \ifx\@deferlist\@empty +% \end{macrocode} +% If not, we set the switch |\if@fcolmade| to {\tt false} which +% says that we did not succeed in making a float column. Then, we +% set |\@colroom| to |\@colht|. The register |\@colht| holds the +% amount of space that is available for floats, text, and footnotes +% in one column, i.e., it equals |\textheight| minus the space +% devoted to page-wide floats. |\@colroom| is a similar register +% which holds the value |\@colht| minus space for column floats +% that are already contributed to the current column. Of course, +% both values should be equal when we start a new column. +% \begin{macrocode} + \global\@fcolmadefalse + \global\@colroom\@colht + \else +% \end{macrocode} +% If there are floats waiting for a change to be processed, the +% situation is more difficult. In this case, we have to reduce both +% |\@colht| and |\@colroom| by the amount of space that will be +% needed for the footnotes from the left column. So we must check +% whether such footnotes are present. As we have not reinserted +% them in |\@outputdblcol|, we can check the |\footins| box. +% \begin{macrocode} + \ifvoid\footins\else +% \end{macrocode} +% If there are some, we measure the space that will be occupied by +% them. This measurement is not really exact. If we have a full +% column of footnotes, it will be too high, but this does matter +% since we need it only for an upper bound on the free space +% available for floats. +% \begin{macrocode} + \ftn@amount\ht\footins + \advance\ftn@amount\dp\footins + \advance\ftn@amount\skip\footins + \fi +% \end{macrocode} +% We then reduce the |\@colht| by this amount and again assign +% |\@colroom| the value of |\@colht|. If no footnotes are present, +% we subtract zero, so there is no harm in doing this operation +% all the time. +% \begin{macrocode} + \global\advance\@colht-\ftn@amount + \global\@colroom\@colht +% \end{macrocode} +% Now, we call another internal \LaTeX{} macro that will try to +% contribute floats to the next column. It will use the register +% |\@colht| when trying to build up a float column, which is the +% reason for reducing this register. If it succeeds, it will set the +% switch |\if@fcolmade| to {\tt true}, otherwise, to {\tt false}. If +% no float column is possible, it will try to place some or all of +% the deferred floats to the top or the bottom of the next column, +% thereby, using and reducing the value of the register |\@colroom|. +% \begin{macrocode} + \@xstartcol +% \end{macrocode} +% Afterwards, we have to restore the correct values for |\@colht| +% and |\@colroom| again, but this time, they may differ, so that we +% have to |\advance| both registers separately by |\ftn@amount|. +% \begin{macrocode} + \global\advance\@colht\ftn@amount + \global\advance\@colroom\ftn@amount + \fi +% \end{macrocode} +% Now, after doing the things depending on the status of the +% |\@deferlist|, we have to incorporate the left over footnotes in +% the new column. First we check whether a float column was +% produced by |\@xstartcol| or not. +% \begin{macrocode} + \if@fcolmade +% \end{macrocode} +% If so, we do something awful. To make use of the |\@makecol| +% macro, which attaches footnotes to |\box| $255$ and places the +% result in the box register |\@outputbox|, we have to assign +% |\@outputbox| (i.e., the result of |\@xstartcol|) to |\box| +% $255$.\footnote{In German, we call this ``from the back through +% the chest into the eyes''.} +% \begin{macrocode} + \setbox\@cclv\box\@outputbox + \@makecol + \else +% \end{macrocode} +% If no float column was produced, we reinsert the held over +% footnotes so that they can be reconsidered by the page generation +% algorithm of \TeX. But it is necessary to ensure that this +% operation is done only when footnotes are actually +% present.\footnote{Otherwise, we might get an undesired extra +% vertical space coming from {\tt\bslash skip\bslash footins}, even +% if there are no footnotes on the page.} +% \begin{macrocode} + \ifvoid\footins\else + \insert\footins{\unvbox\footins}\fi + \fi} +% \end{macrocode} +% \begin{macro}{\ftn@amount} +% Of course, we also have to allocate the {\sf dimen} register. It +% will be automatically initialized to zero. +% \begin{macrocode} +\newdimen\ftn@amount +% \end{macrocode} +% \end{macro} +% \end{macro} + + +% \begin{macro}{\@xstartcol} +% \changes{v1.1a}{1994/01/24}{Macro reintroduced} +% The macro |\@xtsartcol| was removed in \LaTeXe{} but we introduce +% it here again for the moment. +% \begin{macrocode} +\def\@xstartcol{% + \@tryfcolumn \@deferlist + \if@fcolmade + \else + \begingroup + \let \@tempb \@deferlist + \global \let \@deferlist \@empty + \let \@elt \@scolelt + \@tempb + \endgroup + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@makecol} +% The other internal macro that we have to change is |\@makecol|, a +% macro that is called whenever one column of material is assembled +% and column floats and footnotes have to be added. Again, we have +% to distinguish between actions for the first and the second +% column. +% \begin{macrocode} +\def\@makecol{\if@firstcolumn +% \end{macrocode} +% For the first column, we leave the footnotes in their box and +% simply save the contents of box $255$ in the |\box| register +% |\@outputbox|. +% \begin{macrocode} + \setbox\@outputbox\box\@cclv +% \end{macrocode} +% +% But if the user erroneously forgot to specify a twocolumn layout, we +% will always typeset the first column, so that the footnotes are +% never printed. Therefore we better check for this special case +% and output the footnotes on a separate page in an +% emergency.\footnote{Otherwise, the footnotes are held over for +% ever, preventing \TeX{} from finishing the document successfully. +% Instead, \TeX{} will produce infinity many empty pages at the end +% of the document, trying in vain to output the held over +% footnotes. This problem was found by Rainer Sch\"opf when we +% prepared the paper for the Cork conference.} +% \changes{v1.0c}{1990/08/24}{Introduced crude recovery if +% twocolumn false.} +% \changes{v1.0d}{1992/06/19}{Better help message} +% \begin{macrocode} + \if@twocolumn \else + \ifvoid\footins \else + \@latexerr{ftnright package + used in one-column mode}% + {The ftnright package was designed to + work with LaTeX's standard^^Jtwocolumn + option. It does *not* work with the + multicol package.^^JSo please specify + `twocolumn' in the + \noexpand\documentclass command.}% + \shipout\box\footins \fi\fi +% \end{macrocode} +% What we also need to check is if there is so much footnote material that +% it resulted in a footnote being split. If that happens the whole +% algorithm falls apart and the footnotes get out of sync. For the +% moment we simply detect it here, perhaps some better scheme can be +% implemented. One way to avoid this is to allow more than |\textheight| of +% footnotes in |\preparefootins|. However, that isn't such a good idea +% either as that means that a footnote from column one, might end up +% completely on a later page. +% \changes{v1.1f}{2010/02/25}{Check for split footnotes (pr/4099)} +% \begin{macrocode} + \ifnum\insertpenalties>\z@ + \@latexerr{ftnright package + scrambled footnotes}% + {There is too much footnote material in + the first column and ftnright^^Jis + unable to cope with this.^^JYou need + to reduce the amount to get a properly + formatted page.}% + \fi + \else +% \end{macrocode} +% When we construct the second column, we must first check whether +% footnotes are actually present. If not, we perform the same +% actions as before. +% \begin{macrocode} + \ifvoid\footins + \setbox\@outputbox\box\@cclv + \else +% \end{macrocode} +% But, if footnotes are present, it may be possible that the whole +% column consists of footnotes, i.e., |\box| $255$ is empty. In +% this case, there is no use in placing any glue (|\skip\footins|) +% in front,\footnote{In fact, it would be a mistake since this glue +% was not taken into account when the footnotes where assembled, so +% it would produce an overfull box.} so we have to check for this +% possibility. +% \begin{macrocode} + \setbox\@outputbox\vbox + {\ifvoid\@cclv \else + \unvbox\@cclv + \vskip\skip\footins\fi +% \end{macrocode} +% But in any case, we place the |\footnoterule| in front of the +% footnotes even if this macro is not used by this +% package.\footnote{This decision is certainly open to criticism, +% since there is nothing to separate. On the other hand, a rule or +% some other ornament in front of the footnotes is part of the +% design which should be used consistently throughout a document. +% As a last argument in favor of the rule, consider the situation +% where \LaTeX{} decided to place only floats and footnotes into +% the right hand column. In this case a separator again seems +% adequate. In this situation one can even argue that it is +% necessary to put in the {\tt \bslash skip\.\bslash footins}.} +% This ends the if-statement testing whether footnotes are present +% or not. It also ends the code which differs depending on the +% column number. +% \changes{v1.1d}{1998/12/02}{Added the color@group macros and +% \texttt{\protect\bslash normalcolor} to make this colorsafe} +% \begin{macrocode} + \color@begingroup + \normalcolor + \footnoterule\unvbox\footins + \color@endgroup}\fi + \fi +% \end{macrocode} +% Now the column floats are added at the top and the bottom, and +% the |\@outputbox| is adjusted to the full column height so that +% the glue inside will stretch in certain situations.\footnote{It +% is an interesting question as to whether the current layout works +% well with bottom floats or not. Actually, I would prefer to place +% the footnotes below the bottom floats instead of above, as it is +% done here. At least when the floats are part of the document and +% not puzzles thrown in. But I was too lazy to implement it +% because I seldom use floats. If somebody implements this layout +% (some parts of this macro have to be changed) I would be +% interested in seeing the code and some sample results.} Again, +% this code is copied verbatim from the original source, so I won't +% dwell on details.\footnote{I only changed {\tt\bslash dimen128} +% into {\tt\bslash @tempdima} which is, besides being faster and +% shorter, only a cosmetic change. The use of this hardwired {\sf +% dimen} register seems to indicate that this part of \LaTeX{} was +% written very early and left unchanged since then: an interesting +% fact for software archaeologists.}\footnote{For the \LaTeXe{} +% upgrade I had to add the support for the +% {\tt\string\enlargethispage} command---let's hope I did it in the +% correct way.} +% \changes{v1.1a}{1994/01/24}{Upgrades for LaTeX2e} +% \begin{macrocode} + \xdef\@freelist{\@freelist\@midlist}% + \global \let \@midlist \@empty + \@combinefloats + \ifvbox\@kludgeins + \@makespecialcolbox + \else + \setbox\@outputbox\vbox to\@colht + {\boxmaxdepth\maxdepth + \@texttop + \@tempdima\dp\@outputbox + \unvbox\@outputbox + \vskip-\@tempdima + \@textbottom}% + \fi + \global\maxdepth\@maxdepth} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\footnotesize} +% \changes{v1.1a}{1994/01/24}{Upgrades for LaTeX2e} +% Now we can tackle the remaining small changes to the standard +% layout. I decided to use a smaller size for footnotes but with a +% slightly larger leading than usual. This means that we have to +% redefine the |\footnotesize| macro which depends on options like +% {\tt 11pt} etc. Fortunately, there is a simple way to find out +% the main size of the document: the macro |\@ptsize| contains $0$, +% $1$, or $2$ standing for $10$, $11$, or $12$ points document text +% size.\footnote{In the new release I used the definitions from the +% class option files \texttt{size1?.clo} and modified them +% slightly. In the previous release there was no correction for the +% list parameters etc., thus giving you incorrect spacing if +% somebody used display lists in footnotes.} +% \begin{macrocode} +\ifcase \@ptsize +\renewcommand\footnotesize{% + \@setfontsize\footnotesize\@viiipt{9.9}% + \abovedisplayskip 6\p@\@plus2\p@\@minus4\p@ + \abovedisplayshortskip \z@ \@plus\p@ + \belowdisplayshortskip + 3\p@\@plus\p@\@minus2\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 3\p@ \@plus\p@ \@minus\p@ + \parsep 2\p@ \@plus\p@ \@minus\p@ + \itemsep \parsep}% + \belowdisplayskip \abovedisplayskip +} +\or +\renewcommand\footnotesize{% + \@setfontsize\footnotesize\@ixpt{11.1}% + \abovedisplayskip 8\p@\@plus2\p@\@minus4\p@ + \abovedisplayshortskip \z@ \@plus\p@ + \belowdisplayshortskip + 4\p@ \@plus2\p@ \@minus2\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 4\p@ \@plus2\p@\@minus2\p@ + \parsep 2\p@ \@plus\p@ \@minus\p@ + \itemsep \parsep}% + \belowdisplayskip \abovedisplayskip +} +\or +\renewcommand\footnotesize{% + \@setfontsize\footnotesize\@xpt{12.3}% + \abovedisplayskip10\p@\@plus2\p@\@minus5\p@ + \abovedisplayshortskip \z@ \@plus3\p@ + \belowdisplayshortskip + 6\p@ \@plus3\p@ \@minus3\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 6\p@ \@plus2\p@ \@minus2\p@ + \parsep 3\p@ \@plus2\p@ \@minus\p@ + \itemsep \parsep}% + \belowdisplayskip \abovedisplayskip +} +\fi +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\footnoterule} +% Setting footnotes in smaller type and separating them with +% sufficient space from the main text allow us to omit the +% |\footnoterule| normally used. +% \begin{macrocode} +\let\footnoterule\@empty +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\footnotesep} +% \changes{v1.1a}{1994/01/24}{Upgrades for LaTeX2e} +% Individual footnotes are separated from each other by a more or +% less baseline skip of the text size. This can be specified with +% the following code: +% \begin{macrocode} +\AtBeginDocument + {\global\footnotesep\ht\strutbox} +% \end{macrocode} +% The use of the \LaTeXe{} hook |\AtBeginDocument| is a big help +% since it allows us to defer everything that might depend on user +% setting inside the preamble to the |\begin{document}| environment +% start. +% \end{macro} +% +% +% +% \begin{macro}{\@makefntext} +% And finally, a small but nice change, to the mark at the +% beginning of the footnote text. We will place it at the baseline +% instead of raising it as a superscript. Additionally, it will get +% a dot as punctuation. +% \changes{v1.0c}{1990/08/24}{Added dot as recommended by Tschichold.} +% \changes{v1.1e}{2000/04/14}{Don't use math mode for footnote symbol +% (pr/3172)} +% \begin{macrocode} +\long\def\@makefntext#1{\parindent 1em + \noindent\hbox to 2em{}% + \llap{\@thefnmark.\,\,}#1} +% \end{macrocode} +% \end{macro} +% +% +% \section{Initialisation} +% +% We defined the macro |\preparefootins| above, but we also have to use +% it to prepare typesetting the first column. As a default for the +% separation of footnotes and text on the second column, we use the +% following: +% \begin{macrocode} +\setlength{\skip\footins} + {10pt plus 5pt minus 3pt} +\AtBeginDocument{\preparefootins} +%</package> +% \end{macrocode} +% Of course, this value can be changed by the user as +% described in the introduction. +% +% \Finale +% +% +% + +\endinput diff --git a/Master/texmf-dist/source/latex-dev/tools/hhline.dtx b/Master/texmf-dist/source/latex-dev/tools/hhline.dtx new file mode 100644 index 00000000000..1da01d757b4 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/hhline.dtx @@ -0,0 +1,322 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% File: hhline.dtx Copyright (C) 1991-1994 David Carlisle +% +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{hhline} +%<package> [2014/10/28 v2.03 Table rule package (DPC)] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{hhline} +\GetFileInfo{hhline.sty} +\begin{document} +\title{The \textsf{hhline} package\thanks{This file + has version number \fileversion, last + revised \filedate.}} +\author{David Carlisle} +\date{\filedate} + \MaintainedByLaTeXTeam{tools} + \maketitle + \DeleteShortVerb{\|} + \DocInput{hhline.dtx} +\end{document} +%</driver> +% \fi +% +% +% \changes{v1.00}{1991/06/04}{Initial Version} +% \changes{v2.00}{1991/11/06} +% {Add tilde which allows \cmd\cline-like constructions.} +% \changes{v2.01}{1992/06/26} +% {Re-issue for the new doc and docstrip.} +% \changes{v2.02}{1994/03/14} +% {Update for LaTeX2e.} +% \changes{v2.03}{1994/05/23} +% {New style warning.} +% +% +% +% \MakeShortVerb{\"} +% +% \begin{abstract} +% "\hhline" produces a line like "\hline", or a double line like +% "\hline\hline", except for its interaction with vertical lines. +% \end{abstract} +% +% \arrayrulewidth=1pt +% \doublerulesep=3pt +% +% \section{Introduction} +% The argument to "\hhline" is similar to the preamble of an {\tt +% array} or {\tt tabular}. It consists of a list of tokens with the +% following meanings: +% \[ +% \begin{tabular}{cl} +% "=" & A double hline the width of a column.\\ +% "-" & A single hline the width of a column.\\[10pt] +% "~" & A column with no hline.\\[10pt] +% +% "|" & A vline which `cuts' through a double (or single) hline.\\ +% ":" & A vline which is broken by a double hline.\\[10pt] +% +% "#" & A double hline segment between two vlines.\\ +% "t" & The top half of a double hline segment.\\ +% "b" & The bottom half of a double hline segment.\\ +% +% "*" & "*{3}{==#}" expands to "==#==#==#", +% as in the {\tt*}-form for the preamble. +% \end{tabular} +% \] +% If a double vline is specified ("||" or "::") then the hlines +% produced by "\hhline" are broken. To obtain the effect of an hline +% `cutting through' the double vline, use a "#" or omit the vline +% specifiers, depending on whether or not you wish the double vline to +% break. +% +% The tokens {\tt t} and {\tt b} must be used between two vertical +% rules. "|tb|" produces the same lines as "#", but is much less +% efficient. The main use for these are to make constructions like +% "|t:" (top left corner) and ":b|" (bottom right corner). +% +% If "\hhline" is used to make a single hline, then the argument +% should only contain the tokens "-", "~" and "|" (and +% {\tt*}-expressions). +% +% An example using most of these features is: +% \[ +% \vcenter{\hsize=2in\begin{verbatim} +% \begin{tabular}{||cc||c|c||} +% \hhline{|t:==:t:==:t|} +% a&b&c&d\\ +% \hhline{|:==:|~|~||} +% 1&2&3&4\\ +% \hhline{#==#~|=#} +% i&j&k&l\\ +% \hhline{||--||--||} +% w&x&y&z\\ +% \hhline{|b:==:b:==:b|} +% \end{tabular} +% \end{verbatim} +% } +% \qquad +% \begin{tabular}{||cc||c|c||} +% \hhline{|t:==:t:==:t|} +% a&b&c&d\\ +% \hhline{|:==:|~|~||} +% 1&2&3&4\\ +% \hhline{#==#~|=#} +% i&j&k&l\\ +% \hhline{||--||--||} +% w&x&y&z\\ +% \hhline{|b:==:b:==:b|} +% \end{tabular} +% \] +% +% The lines produced by \LaTeX's "\hline" consist of a single (\TeX\ +% primitive) "\hrule". The lines produced by "\hhline" are made +% up of lots of small line segments. \TeX\ will place these very +% accurately in the {\tt .dvi} file, but the program that you use to +% print the {\tt .dvi} file may not line up these segments exactly. (A +% similar problem can occur with diagonal lines in the {\tt picture} +% environment.) +% +% If this effect causes a problem, you could try a different driver +% program, or if this is not possible, increasing "\arrayrulewidth" +% may help to reduce the effect. +% +% \StopEventually{} +% +% \section{The Macros} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macro}{\HH@box} +% Makes a box containing a double hline segment. The most common case, +% both rules of length "\doublerulesep" will be stored in "\box1", this +% is not initialised until "\hhline" is called as the user may change +% the parameters "\doublerulesep" and "\arrayrulewidth". The two +% arguments to "\HH@box" are the widths (ie lengths) of the top and +% bottom rules. +% \begin{macrocode} +\def\HH@box#1#2{\vbox{% + \hrule \@height \arrayrulewidth \@width #1 + \vskip \doublerulesep + \hrule \@height \arrayrulewidth \@width #2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HH@add} +% Build up the preamble in the register "\toks@". +% \begin{macrocode} +\def\HH@add#1{\toks@\expandafter{\the\toks@#1}} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\HH@xexpast} +% \begin{macro}{\HH@xexnoop} +% We `borrow' the version of "\@xexpast" from Mittelbach's array.sty, +% as this allows "#" to appear in the argument list. +% \begin{macrocode} +\def\HH@xexpast#1*#2#3#4\@@{% + \@tempcnta #2 + \toks@={#1}\@temptokena={#3}% + \let\the@toksz\relax \let\the@toks\relax + \def\@tempa{\the@toksz}% + \ifnum\@tempcnta >0 \@whilenum\@tempcnta >0\do + {\edef\@tempa{\@tempa\the@toks}\advance \@tempcnta \m@ne}% + \let \@tempb \HH@xexpast \else + \let \@tempb \HH@xexnoop \fi + \def\the@toksz{\the\toks@}\def\the@toks{\the\@temptokena}% + \edef\@tempa{\@tempa}% + \expandafter \@tempb \@tempa #4\@@} + +\def\HH@xexnoop#1\@@{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\hhline} +% Use a simplified version of "\@mkpream" to break apart the argument +% to "\hhline". Actually it is oversimplified, It assumes that the +% vertical rules are at the end of the column. If you were to specify +% "c|@{xx}|" in the array argument, then "\hhline" would not be +% able to access the first vertical rule. (It ought to have an "@" +% option, and add "\leaders" up to the width of a box containing the +% "@"-expression. We use a loop made with "\futurelet" rather +% than "\@tfor" so that we can use "#" to denote the crossing of +% a double hline with a double vline.\\ +% "\if@firstamp" is true in the first column and false otherwise.\\ +% "\if@tempswa" is true if the previous entry was a vline +% (":", "|" or "#"). +% \begin{macrocode} +\def\hhline#1{\omit\@firstamptrue\@tempswafalse +% \end{macrocode} +% Put two rules of width "\doublerulesep" in "\box1" +% \begin{macrocode} +\global\setbox\@ne\HH@box\doublerulesep\doublerulesep +% \end{macrocode} +% If Mittelbach's {\tt array.sty} is loaded, we do not need the negative +% "\hskip"'s around vertical rules. +% \begin{macrocode} + \xdef\@tempc{\ifx\extrarowheight\HH@undef\hskip-.5\arrayrulewidth\fi}% +% \end{macrocode} +% Now expand the {\tt*}-forms and add dummy tokens ( "\relax" and +% "`" ) to either end of the token list. Call "\HH@let" to start +% processing the token list. +% \begin{macrocode} + \HH@xexpast\relax#1*0x\@@\toks@{}\expandafter\HH@let\@tempa`} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\HH@let} +% Discard the last token, look at the next one. +% \begin{macrocode} +\def\HH@let#1{\futurelet\@tempb\HH@loop} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\HH@loop} +% The main loop. Note we use "\ifx" rather than "\if" in +% version~2 as the new token "~" is active. +% \begin{macrocode} +\def\HH@loop{% +% \end{macrocode} +% If next token is "`", stop the loop and put the lines into this row +% of the alignment. +% \begin{macrocode} + \ifx\@tempb`\def\next##1{\the\toks@\cr}\else\let\next\HH@let +% \end{macrocode} +% "|", add a vertical rule (across either a double or +% single hline). +% \begin{macrocode} + \ifx\@tempb|\if@tempswa\HH@add{\hskip\doublerulesep}\fi\@tempswatrue + \HH@add{\@tempc\vline\@tempc}\else +% \end{macrocode} +% ":", add a broken vertical rule (across a double hline). +% \begin{macrocode} + \ifx\@tempb:\if@tempswa\HH@add{\hskip\doublerulesep}\fi\@tempswatrue + \HH@add{\@tempc\HH@box\arrayrulewidth\arrayrulewidth\@tempc}\else +% \end{macrocode} +% "#", add a double hline segment between two vlines. +% \begin{macrocode} + \ifx\@tempb##\if@tempswa\HH@add{\hskip\doublerulesep}\fi\@tempswatrue + \HH@add{\@tempc\vline\@tempc\copy\@ne\@tempc\vline\@tempc}\else +% \end{macrocode} +% "~", A column with no hline (this gives an effect similar to +% \verb+\cline+). +% \begin{macrocode} + \ifx\@tempb~\@tempswafalse + \if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi + \HH@add{\hfil}\else +% \end{macrocode} +% "-", add a single hline across the column. +% \begin{macrocode} + \ifx\@tempb-\@tempswafalse + \if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi + \HH@add{\leaders\hrule\@height\arrayrulewidth\hfil}\else +% \end{macrocode} +% "=", add a double hline across the column. +% \begin{macrocode} + \ifx\@tempb=\@tempswafalse + \if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi +% \end{macrocode} +% Put in as many copies of "\box1" as possible with +% "\leaders", this may leave gaps at the ends, so put an extra box +% at each end, overlapping the "\leaders". +% \begin{macrocode} + \HH@add + {\rlap{\copy\@ne}\leaders\copy\@ne\hfil\llap{\copy\@ne}}\else +% \end{macrocode} +% "t", add the top half of a double hline segment, in a "\rlap" +% so that it may be used with {\tt b}. +% \begin{macrocode} + \ifx\@tempb t\HH@add{\rlap{\HH@box\doublerulesep\z@}}\else +% \end{macrocode} +% "b", add the bottom half of a double hline segment in a "\rlap" +% so that it may be used with {\tt t}. +% \begin{macrocode} + \ifx\@tempb b\HH@add{\rlap{\HH@box\z@\doublerulesep}}\else +% \end{macrocode} +% Otherwise ignore the token, with a warning. +% \begin{macrocode} + \PackageWarning{hhline}% + {\meaning\@tempb\space ignored in \noexpand\hhline argument% + \MessageBreak}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi +% \end{macrocode} +% Go around the loop again. +% \begin{macrocode} + \next} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex-dev/tools/indentfirst.dtx b/Master/texmf-dist/source/latex-dev/tools/indentfirst.dtx new file mode 100644 index 00000000000..16b99653cd7 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/indentfirst.dtx @@ -0,0 +1,77 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% File: indent.dtx Copyright (C) 1991-1994 David Carlisle +% +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{indentfirst} +%<package> [1995/11/23 v1.03 Indent first paragraph (DPC)] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{indentfirst} +\GetFileInfo{indentfirst.sty} +\begin{document} +\title{The \textsf{indentfirst} package\thanks{This file + has version number \fileversion, last + revised \filedate.}} +\author{David Carlisle} +\date{\filedate} +\MaintainedByLaTeXTeam{tools} +\maketitle +\DocInput{indentfirst.dtx} +\end{document} +%</driver> +% \fi +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \changes{v1.00}{1991/01/02}{Initial version} +% \changes{v1.01}{1992/06/26}{Re-issue for the new doc and docstrip} +% \changes{v1.02}{1994/01/31}{Re-issue for LaTeX2e} +% \changes{v1.03}{1995/11/23}{Typo fixes in documentation} +% +% \begin{abstract} +% Make the first line of all sections etc., be indented by the usual +% paragraph indentation. This should work with all the standard document +% classes. +% \end{abstract} +% +% \CheckSum{4}^^A Still I think a record:-) +% +% \StopEventually{} +% +% \begin{macro}{\if@afterindent} +% \LaTeX\ uses the switch |\if@afterindent| to decide whether to indent +% after a section heading. We just need to make sure that this is always +% true. +% \begin{macrocode} +%<*package> +\let\@afterindentfalse\@afterindenttrue +\@afterindenttrue +%</package> +% \end{macrocode} +% \end{macro} +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex-dev/tools/layout.dtx b/Master/texmf-dist/source/latex-dev/tools/layout.dtx new file mode 100644 index 00000000000..848eb54fb25 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/layout.dtx @@ -0,0 +1,1025 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +%\iffalse +% This file is built for \LaTeXe, so we make sure an error is +% generated when it is used with another format +%<*dtx> +\ProvidesFile{layout.dtx} +%</dtx> +%<+package>\NeedsTeXFormat{LaTeX2e} +%<+package>\ProvidesPackage{layout} +%<+driver>\ProvidesFile{layout.drv} +%\ProvidesFile{layout.dtx} + [2014/10/28 v1.2c Show layout parameters] +% +% A short driver is provided that can be extracted if necessary by +% the \textsf{DocStrip} program provided with \LaTeXe. +% \begin{macrocode} +%<*driver> +\documentclass{ltxdoc} + +\usepackage{layout} + +\newcommand\Lopt[1]{\textsf{#1}} +\pagestyle{myheadings} +\DisableCrossrefs +\begin{document} +\DocInput{layout.dtx} +\end{document} +%</driver> +% \end{macrocode} +%\fi +% \changes{v1.1c}{1994/07/13}{Moved Identification code to the front +% and removed the permanent use of \cs{filedate} and friends} +% \changes{v1.1d}{1994/09/08}{Stored texts in control sequences to +% allow other languages} +% +% \GetFileInfo{layout.dtx} +% \title{Displaying page layout variables} +% \author{Kent McPherson a.o.\thanks{Converted for \LaTeXe\ by +% Johannes Braams and modified by Hideo Umeki}} +% \date{\filedate} +% +% \markboth{layout package version \fileversion\space as of \filedate} +% {layout package version \fileversion\space as of \filedate} +% +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% \section{Introduction} +% +% This \LaTeXe\ package is a reimplementation of +% \texttt{layout.sty} by Kent McPherson. It defines the command +% |\layout| which produces an overview of the layout of the current +% document. The command |\layout*| recomputes the values it uses to +% produce the overview. +% +% The figure on the next page shows the output of the |\layout| +% command for this document. +% +% \begin{figure}[p] +% \layout +% \end{figure} +% +% \StopEventually{} +% +% \section{The implementation} +% +% \changes{v1.1b}{1994/03/23}{removed the \cs{wlog} as +% \cs{ProvidesPackage} does that now} +% \changes{v1.1d}{1994/09/08}{Added language options dutch and +% english} +% +% This package prints a figure to illustrate the layout that is +% implemented by the document class. In the figure several words +% appear. They are stored in control sequences to be able to select +% a different language. +% \changes{v1.1e}{1994/10/29}{The dutch texts should be one word.} +% \changes{v1.1f}{1995/03/14}{Added \cs{notshown}} +% \changes{v1.1f}{1995/03/14}{Added option french} +% \changes{v1.1j}{1995/10/29}{Added the options spanish, brazilian and +% portuguese} +% \changes{v1.1k}{1995/11/23}{Documentation fixes} +% \changes{v1.2}{1998/04/13}{Redesign of the output by Hideo Umeki} +% \changes{v1.2c}{2000/09/21}{Added option german} +% \changes{v1.2c}{2000/09/25}{Added option for italian by Claudio Beccari} +% \begin{macrocode} +%<*package> +\DeclareOption{dutch}{% + \def\Headertext{Kopregel} + \def\Bodytext{Broodtekst} + \def\Footertext{Voetregel} + \def\MarginNotestext{Marge\\Notities} + \def\oneinchtext{een inch} + \def\notshown{niet getoond} + } +\DeclareOption{german}{% + \def\Headertext{Kopfzeile} + \def\Bodytext{Haupttext} + \def\Footertext{Fu{\ss}zeile} + \def\MarginNotestext{Rand-\\ notizen} + \def\oneinchtext{ein Zoll} + \def\notshown{ohne Abbildung} + } +\DeclareOption{ngerman}{\ExecuteOptions{german}} +\DeclareOption{english}{% + \def\Headertext{Header} + \def\Bodytext{Body} + \def\Footertext{Footer} + \def\MarginNotestext{Margin\\Notes} + \def\oneinchtext{one inch} + \def\notshown{not shown} + } +\DeclareOption{french}{% + \def\Headertext{Ent\^{e}te} + \def\Bodytext{Corps} + \def\Footertext{Pied de page} + \def\MarginNotestext{Marge\\Notes} + \def\oneinchtext{un pouce} + \def\notshown{non affich\'{e}} + } +\DeclareOption{francais}{\ExecuteOptions{french}} +\DeclareOption{spanish}{% + \def\Headertext{Encabezamiento} + \def\Bodytext{Cuerpo} + \def\Footertext{Pie de p\'agina} + \def\MarginNotestext{Notas\\ Marginales} + \def\oneinchtext{una pulgada} + \def\notshown{no mostradas} + } +\DeclareOption{portuguese}{% + \def\Headertext{Cabe\c{c}alho} + \def\Bodytext{Corpo} + \def\Footertext{Rodap\'e} + \def\MarginNotestext{Notas\\ Marginais} + \def\oneinchtext{uma polegada} + \def\notshown{n\~ao mostradas} + } +\DeclareOption{brazilian}{% + \def\Headertext{Cabe\c{c}alho} + \def\Bodytext{Corpo} + \def\Footertext{Rodap\'e} + \def\MarginNotestext{Notas\\ Marginais} + \def\oneinchtext{uma polegada} + \def\notshown{n\~ao mostradas} + } +\DeclareOption{italian}{% + \def\Headertext{Testatina} + \def\Bodytext{Corpo} + \def\Footertext{Piedino} + \def\MarginNotestext{Note\\ Marginali} + \def\oneinchtext{un pollice} + \def\notshown{non mostrato} + } +% \end{macrocode} +% +% This package has an option \Lopt{verbose}. Using it will make the +% command |\layout| type some of the parameters on the terminal. +% \begin{macrocode} +\DeclareOption{verbose}{\let\LayOuttype\typeout} +\DeclareOption{silent}{\let\LayOuttype\@gobble} +% \end{macrocode} +% +% \changes{v1.1h}{1995/04/07}{Added the options \Lopt{integers} +% (default) and \Lopt{reals}} +% +% The normal behaviour of this package when showing the values of +% the parameters is to truncate them. However, if you want to see +% the real parameter values you can use the option \Lopt{reals} to +% get that effect. +% \changes{v1.1i}{1995/06/25}{\LaTeX\ release 1995/06/01 no longer +% needs double hashmarks in the argument of \cs{DeclareOption}} +% \begin{macrocode} +\def\lay@value{} +\DeclareOption{integers}{% + \renewcommand*{\lay@value}[2]{% + \expandafter\number\csname #1@#2\endcsname pt}} +\DeclareOption{reals}{% + \renewcommand*{\lay@value}[2]{\the\csname #2\endcsname}} +% \end{macrocode} +% +% The default language is English, the default mode is +% \Lopt{silent} and the default way of showing parameter values is +% to use integers. +% \begin{macrocode} +\ExecuteOptions{english,silent,integers} +\ProcessOptions +% \end{macrocode} +% +% \begin{macro}{\LayOutbs} +% Define |\LayOutbs| to produce a backslash. We use a definition +% which also works with OT1 fonts. +% \changes{v1.2b}{1998/06/21}{Renamed \cs{bs} to avoid possible conflicts +% with other packages} +% \begin{macrocode} +\newcommand\LayOutbs{} +\chardef\LayOutbs`\\ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ConvertToCount} +% This macro stores the value of a \emph{length} register in a +% \emph{count} register. +% \begin{macrocode} +\def\ConvertToCount#1#2{% +% \end{macrocode} +% First copy the value +% \begin{macrocode} + #1=#2 +% \end{macrocode} +% Then divide it by 65536. +% \begin{macrocode} + \divide #1 by 65536} +% \end{macrocode} +% The result of this is that the \emph{count} register holds the +% value of the \emph{length} register in points. +% \end{macro} +% +% \begin{macro}{\SetToHalf} +% \begin{macro}{\SetToQuart} +% Small macros used in computing positions. +% \begin{macrocode} +\def\SetToHalf#1#2{#1=#2\relax\divide#1by\tw@} +\def\SetToQuart#1#2{#1=#2\relax\divide#1by4} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Identify} +% A small macro used in identifying dimensions. +% \begin{macrocode} +\def\Identify#1{% + \put(\PositionX,\PositionY){\circle{20}} + \put(\PositionX,\PositionY){\makebox(0,0){\tiny #1}} +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\InsideHArrow} +% This macro is used to produce two horizontal arrows inside a box. +% The argument gives the width of the box. +% \changes{v1.1c}{1994/07/14}{Added check for a negative arrow length} +% \begin{macrocode} +\def\InsideHArrow#1{{% + \ArrowLength = #1 + \divide\ArrowLength by \tw@ + \advance\ArrowLength by -10 + \advance\PositionX by -10 + \ifnum\ArrowLength<\z@ + \put(\PositionX,\PositionY){\vector(1,0){-\ArrowLength}} + \advance\PositionX by 20 + \put(\PositionX,\PositionY){\vector(-1,0){-\ArrowLength}} + \else + \put(\PositionX,\PositionY){\vector(-1,0){\ArrowLength}} + \advance\PositionX by 20 + \put(\PositionX,\PositionY){\vector(+1,0){\ArrowLength}} + \fi +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\InsideVArrow} +% This macro is used to produce two vertical arrows inside a box. +% The argument gives the height of the box. +% \begin{macrocode} +\def\InsideVArrow#1{{% + \ArrowLength = #1 + \divide\ArrowLength by \tw@ + \advance\ArrowLength by -10 + \advance\PositionY by -10 + \put(\PositionX,\PositionY){\vector(0,-1){\ArrowLength}} + \advance\PositionY by 20 + \put(\PositionX,\PositionY){\vector(0,+1){\ArrowLength}} +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\OutsideHArrow} +% This macro is used to produce two horizontal arrows to delimit a +% length. The first argument is the position for the right arrow, +% the second argument gives the length and the third specifies the +% length of the arrows. +% \begin{macrocode} +\def\OutsideHArrow#1#2#3{{% + \PositionX = #1 + \advance\PositionX by #3 + \put(\PositionX,\PositionY){\vector(-1,0){#3}} + \PositionX = #1 \advance\PositionX-#2 + \advance\PositionX by -#3 + \put(\PositionX,\PositionY){\vector(+1,0){#3}} +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\OutsideVArrow} +% This macro is used to produce two vertical arrows to delimit a +% length. The first argument is the position for the lower arrow, +% the second argument gives the length and the third and fourth +% specify the lenghts of the lower and upper arrow. +% \begin{macrocode} +\def\OutsideVArrow#1#2#3#4{{% + \PositionY = #1 + \advance\PositionY by -#3 + \put(\PositionX,\PositionY){\vector(0,+1){#3}} + \PositionY = #1 + \advance\PositionY#2 + \advance\PositionY#4 + \put(\PositionX,\PositionY){\vector(0,-1){#4}} +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Show} +% \changes{v1.1g}{1995/04/03}{Simplified the definition, now show +% complete value} +% \changes{v1.1h}{1995/04/07}{Use \cs{lay@value} to show the value +% because of the option which decides which of two ways of doing it +% should be used} +% +% Macro used in the table that shows the setting of the parameters. +% \begin{macrocode} +\def\Show#1#2{\LayOutbs #2 = \lay@value{#1}{#2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Type} +% \changes{v1.1g}{1995/04/03}{Simplified the definition, now show +% complete value} +% \changes{v1.1h}{1995/04/07}{Use \cs{lay@value} to show the value +% because of the option which decides which of two ways of doing it +% should be used} +% \changes{v1.2b}{1998/06/21}{Renamed \cs{type} to \cs{LayOuttype} +% to avoid possible conflicts with other packages} +% +% Macro used to show a setting of a parameter on the terminal. +% \begin{macrocode} +\def\Type#1#2{% + \LayOuttype{#2 = \lay@value{#1}{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\oneinch} +% A constant, giving the length of an inch in points (approximately) +% \begin{macrocode} +\newcount\oneinch +\oneinch=72 +% \end{macrocode} +% \end{macro} +% +% Because the overview of the layout is produced in a figure +% environment we need to allocate a number of counters that are +% used to store the values of various dimensions. +% +% \begin{macro}{\cnt@paperwidth} +% \begin{macro}{\cnt@paperheight} +% The dimensions of the paper +% \begin{macrocode} +\newcount\cnt@paperwidth +\newcount\cnt@paperheight +\ConvertToCount\cnt@paperwidth\paperwidth +\ConvertToCount\cnt@paperheight\paperheight +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cnt@hoffset} +% \begin{macro}{\cnt@voffset} +% the offsets, +% \begin{macrocode} +\newcount\cnt@hoffset +\newcount\cnt@voffset +\ConvertToCount\cnt@hoffset\hoffset +\ConvertToCount\cnt@voffset\voffset +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cnt@textheight} +% \begin{macro}{\cnt@textwidth} +% dimensions of the text area, +% \begin{macrocode} +\newcount\cnt@textheight +\newcount\cnt@textwidth +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cnt@topmargin} +% \begin{macro}{\cnt@oddsidemargin} +% \begin{macro}{\cnt@evensidemargin} +% margins, +% \begin{macrocode} +\newcount\cnt@topmargin +\newcount\cnt@oddsidemargin +\newcount\cnt@evensidemargin +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cnt@headheight} +% \begin{macro}{\cnt@headsep} +% dimensions of the running heads, +% \begin{macrocode} +\newcount\cnt@headheight +\newcount\cnt@headsep +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cnt@marginparsep} +% \begin{macro}{\cnt@marginparwidth} +% \begin{macro}{\cnt@marginparpush} +% marginal paragraphs, +% \begin{macrocode} +\newcount\cnt@marginparsep +\newcount\cnt@marginparwidth +\newcount\cnt@marginparpush +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cnt@footskip} +% the distance between the running footers and the text, +% \begin{macrocode} +\newcount\cnt@footskip +% \end{macrocode} +% \end{macro} +% and the height of the footers, which is needed here to display a +% box, but which isn't used by \LaTeX. +% \begin{macro}{\fheight} +% \begin{macrocode} +\newcount\fheight +\fheight=12 +% \end{macrocode} +% \end{macro} +% +% Apart from integer representations of the page layout parameters +% we also need registers to store reference values in. +% +% \begin{macro}{\ref@top} +% The position of the top of the `printable area' is +% one inch below the top of the paper by default. The value of +% |\ref@top| is relative to the lower left corner of the picture +% environment that will be used. +% +% \begin{macrocode} +\newcount\ref@top +\ref@top=\cnt@paperheight \advance\ref@top by -\oneinch +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ref@hoffset} +% \begin{macro}{\ref@voffset} +% For the offsets, +% \begin{macrocode} +\newcount\ref@hoffset +\newcount\ref@voffset +% \end{macrocode} +% The |\hoffset| and |\voffset| values are added to the default +% offset of one inch. +% \begin{macrocode} +\ref@hoffset=\cnt@hoffset \advance\cnt@hoffset by \oneinch +\ref@voffset=\cnt@voffset +% \end{macrocode} +% +% |\cnt@voffset| is converted to be relative to the origin of the +% picture. +% \begin{macrocode} +\cnt@voffset=\ref@top +\advance\cnt@voffset by -\ref@voffset +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\ref@head} +% and the text areas, running heads, +% \begin{macrocode} +\newcount\ref@head +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ref@body} +% body of the text +% \begin{macrocode} +\newcount\ref@body +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ref@foot} +% and running footers. +% \begin{macrocode} +\newcount\ref@foot +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ref@margin} +% \begin{macro}{\ref@marginwidth} +% \begin{macro}{\ref@marginpar} +% These are different for even and odd pages, so they are computed +% by |\layout|. +% \begin{macrocode} +\newcount\ref@margin +\newcount\ref@marginwidth +\newcount\ref@marginpar +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% The following are a number of scratch registers, used in the +% positioning of the various pices of the picture. +% \begin{macrocode} +\newcount\Interval +\newcount\ExtraYPos +\newcount\PositionX +\newcount\PositionY +\newcount\ArrowLength +% \end{macrocode} +% +% \begin{macro}{\lay@getvalues} +% \changes{v1.1j}{1995/10/30}{Added macro to compute values at later +% time} +% All values that might change during the document are computed by +% calling the macro |\lay@getvalues|. By default this macro is +% executed at |\begin{document}|. +% \begin{macrocode} +\def\lay@getvalues{% + \ConvertToCount\cnt@textheight\textheight + \ConvertToCount\cnt@textwidth\textwidth + \ConvertToCount\cnt@topmargin\topmargin + \ConvertToCount\cnt@oddsidemargin\oddsidemargin + \ConvertToCount\cnt@evensidemargin\evensidemargin + \ConvertToCount\cnt@headheight\headheight + \ConvertToCount\cnt@headsep\headsep + \ConvertToCount\cnt@marginparsep\marginparsep + \ConvertToCount\cnt@marginparwidth\marginparwidth + \ConvertToCount\cnt@marginparpush\marginparpush + \ConvertToCount\cnt@footskip\footskip + \ref@head=\ref@top + \advance\ref@head by -\ref@voffset + \advance\ref@head by -\cnt@topmargin + \advance\ref@head by -\cnt@headheight + \ref@body=\ref@head + \advance\ref@body by -\cnt@headsep + \advance\ref@body by -\cnt@textheight + \ref@foot=\ref@body + \advance\ref@foot by -\cnt@footskip + } +\AtBeginDocument{\lay@getvalues} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\computevalues} +% +% \begin{macro}{\layout} +% \begin{macro}{\layout*} +% The command |\layout| makes the picture and table that display +% the current settings of the layout parameters. +% +% \changes{v1.1b}{1994/03/23}{Produce two pages in twoside mode} +% \changes{v1.1j}{1995/10/30}{Added \cs{layout*}} +% \begin{macrocode} +\newcommand\layout{% + \@ifstar{\lay@getvalues\lay@xlayout}{\lay@xlayout}} +\def\lay@xlayout{% + \lay@layout + \if@twoside + \lay@layout + \fi} +% \end{macrocode} +% +% \begin{macro}{\lay@layout} +% The internal macro |\lay@layout| does all the dirty work. +% \begin{macrocode} +\newcommand\lay@layout{% + \thispagestyle{empty} +% \end{macrocode} +% +% The actions of |\layout| depend on the pagestyle. +% \begin{macrocode} + \if@twoside + \ifodd\count\z@ +% \end{macrocode} +% +% Here we deal with an odd page in the twosided case. +% +% \begin{macrocode} + \typeout{Two-sided document style, odd page.} +% \end{macrocode} +% +% So we compute |\ref@marginwidth|, |\ref@marginpar| and +% |\ref@margin|. +% \changes{v1.1}{1994/02/23}{Added check for reversemargin} +% \begin{macrocode} + \ref@marginwidth=\cnt@oddsidemargin + \ref@marginpar=\oneinch + \advance\ref@marginpar by \ref@hoffset + \advance\ref@marginpar by \cnt@oddsidemargin + \ref@margin\ref@marginpar + \if@reversemargin + \advance\ref@marginpar by -\cnt@marginparsep + \advance\ref@marginpar by -\cnt@marginparwidth + \else + \advance\ref@marginpar by \cnt@textwidth + \advance\ref@marginpar by \cnt@marginparsep + \fi +% \end{macrocode} +% +% \begin{macrocode} + \else +% \end{macrocode} +% +% Here we deal with an even page in the twosided case. +% +% \begin{macrocode} + \typeout{Two-sided document style, even page.} +% \end{macrocode} +% +% So we compute |\ref@marginwidth|, |\ref@marginpar| and +% |\ref@margin|. +% \changes{v1.1}{1994/02/23}{Added check for reversemargin} +% \begin{macrocode} + \ref@marginwidth=\cnt@evensidemargin + \ref@marginpar=\oneinch + \advance\ref@marginpar by \ref@hoffset + \advance\ref@marginpar by \cnt@evensidemargin + \ref@margin\ref@marginpar + \if@reversemargin + \advance\ref@marginpar by \cnt@textwidth + \advance\ref@marginpar by \cnt@marginparsep + \else + \advance\ref@marginpar by -\cnt@marginparsep + \advance\ref@marginpar by -\cnt@marginparwidth + \fi +% \end{macrocode} +% +% \begin{macrocode} + \fi + \else +% \end{macrocode} +% +% Finally we the case for single sided printing. +% +% \changes{v1.1}{1994/02/23}{Added check for reversemargin} +% \begin{macrocode} + \typeout{One-sided document style.} + \ref@marginwidth=\cnt@oddsidemargin + \ref@marginpar=\oneinch + \advance\ref@marginpar by \ref@hoffset + \advance\ref@marginpar by \cnt@oddsidemargin + \ref@margin\ref@marginpar + \if@reversemargin + \advance\ref@marginpar by -\cnt@marginparsep + \advance\ref@marginpar by -\cnt@marginparwidth + \else + \advance\ref@marginpar by \cnt@textwidth + \advance\ref@marginpar by \cnt@marginparsep + \fi + \fi +% \end{macrocode} +% +% +% Now we begin the picture environment; dividing all the lengths by +% two is done by setting |\unitlength| to \texttt{0.5pt} +% \begin{macrocode} + \setlength{\unitlength}{.5pt} + \begin{picture}(\cnt@paperwidth,\cnt@paperheight) + \centering + \thicklines +% \end{macrocode} +% +% First we have the pagebox and reference lines, +% +% \begin{macrocode} + \put(0,0){\framebox(\cnt@paperwidth,\cnt@paperheight){\mbox{}}} + \put(0,\cnt@voffset){\dashbox{10}(\cnt@paperwidth,0){\mbox{}}} + \put(\cnt@hoffset,0){\dashbox{10}(0,\cnt@paperheight){\mbox{}}} +% \end{macrocode} +% +% then the header, +% +% \begin{macrocode} + \put(\ref@margin,\ref@head){% + \framebox(\cnt@textwidth,\cnt@headheight)% + {\footnotesize\Headertext}} +% \end{macrocode} +% +% the body of the text area, +% +% \begin{macrocode} + \put(\ref@margin,\ref@body){% + \framebox(\cnt@textwidth,\cnt@textheight){\Bodytext}} +% \end{macrocode} +% +% the footer +% +% \begin{macrocode} + \put(\ref@margin,\ref@foot){% + \framebox(\cnt@textwidth,\fheight){\footnotesize\Footertext}} +% \end{macrocode} +% +% and the space for marginal notes. +% +% \begin{macrocode} + \put(\ref@marginpar,\ref@body){% + \framebox(\cnt@marginparwidth,\cnt@textheight)% + {\footnotesize\shortstack{\MarginNotestext}}} +% \end{macrocode} +% +% Then we start putting in `arrows' to mark the various parameters. +% From here we use |\thinlines|. +% \begin{macrocode} + \thinlines +% \end{macrocode} +% +% |\PositionX| and |\PositionY| will be the coordinates of the center of +% the arrow displaying |\textwidth|. +% \begin{macrocode} + \SetToHalf\PositionX\cnt@textwidth + \advance\PositionX by \ref@margin +% \end{macrocode} +% The arrow should be a bit above the bottom of the `body box'. +% \begin{macrocode} + \PositionY = \ref@body + \advance\PositionY by 50 +% \end{macrocode} +% An identifying number is put here, in a circle. +% \begin{macrocode} + \Identify{8} +% \end{macrocode} +% Then the arrow is drawn. +% \begin{macrocode} + \InsideHArrow\cnt@textwidth +% \end{macrocode} +% +% Now the |\textheight| +% \begin{macrocode} + \SetToHalf\PositionY\cnt@textheight + \advance\PositionY by \ref@body +% \end{macrocode} +% +% The x-position of the arrow is at $4/5$ of the width of the `body +% box'. +% \begin{macrocode} + \PositionX = \cnt@textwidth + \divide\PositionX by 5 + \multiply \PositionX by 4 + \advance\PositionX by \ref@margin +% \end{macrocode} +% +% An identifying number is put here, in a circle. +% \begin{macrocode} + \Identify{7} + \InsideVArrow\cnt@textheight +% \end{macrocode} +% +% +% The |\hoffset|, +% \changes{v1.2}{1998/04/13}{\cs{PositionY} for label 1 is +% fixed at 50} +% \begin{macrocode} + \PositionY = 50 + \SetToHalf\PositionX\cnt@hoffset + \Identify{1} + \InsideHArrow\cnt@hoffset +% \end{macrocode} +% +% +% The width of the margin. +% \changes{v1.2}{1998/04/13}{The direction of the arrows should be +% switched by the sign of \cs{oddsidemargin}} +% \begin{macrocode} + \SetToQuart\PositionY\cnt@textheight + \advance\PositionY by \ref@body + \ifnum\ref@marginwidth > 0 + \OutsideHArrow\ref@margin\ref@marginwidth{20} + \PositionX = \cnt@hoffset + \else + \OutsideHArrow\cnt@hoffset{-\ref@marginwidth}{20} + \PositionX = \ref@margin + \fi + \advance\PositionX by -30 + \Identify{3} +% \end{macrocode} +% +% the |\marginparwidth|, +% \begin{macrocode} + \SetToQuart\PositionY\cnt@textheight + \advance\PositionY by \ref@body +% \end{macrocode} +% This arrow has to be bit below the one for the |\oddsidemargin| +% or\\ |\evensidemargin|. +% \begin{macrocode} + \advance\PositionY by 30 + \SetToHalf\PositionX\cnt@marginparwidth + \advance\PositionX by \ref@marginpar + \Identify{10} + \InsideHArrow\cnt@marginparwidth +% \end{macrocode} +% +% +% The |\marginparsep|, this depends on single or double sided +% printing. +% \begin{macrocode} + \advance\PositionY by 30 + \if@twoside +% \end{macrocode} +% +% Twosided mode, reversemargin; +% \changes{v1.1b}{1994/03/23}{\cs{OutSideHArrow} should be +% \cs{OutsideHArrow}} +% \changes{v1.2}{1998/04/13}{Added check for reversemargin} +% \begin{macrocode} + \if@reversemargin + \ifodd\count\z@ + \OutsideHArrow\ref@margin\cnt@marginparsep{20} + \PositionX = \ref@margin + \else + \OutsideHArrow\ref@marginpar\cnt@marginparsep{20} + \PositionX = \ref@marginpar + \fi + \else +% \end{macrocode} +% Not reversemargin; +% \begin{macrocode} + \ifodd\count\z@ + \OutsideHArrow\ref@marginpar\cnt@marginparsep{20} + \PositionX = \ref@marginpar + \else + \OutsideHArrow\ref@margin\cnt@marginparsep{20} + \PositionX = \ref@margin + \fi + \fi + \else +% \end{macrocode} +% +% Single sided mode. +% \changes{v1.2}{1998/04/13}{Added check for reversemargin} +% \begin{macrocode} + \if@reversemargin + \OutsideHArrow\ref@margin\cnt@marginparsep{20} + \PositionX = \ref@margin + \else + \OutsideHArrow\ref@marginpar\cnt@marginparsep{20} + \PositionX = \ref@marginpar + \fi + \fi +% \end{macrocode} +% \changes{v1.2}{1998/04/13}{The \cs{PositionX} of the label 9 is +% changed to the left side of the arrows} +% \begin{macrocode} + \advance\PositionX by -\cnt@marginparsep + \advance\PositionX by -30 + \Identify{9} +% \end{macrocode} +% +% Identify the |\footskip|. The arrow will be located on $1/8$th of +% the |\textwidth|. +% \changes{v1.2}{1998/04/13}{The \cs{PositionY} of the label 11 is +% changed to the upper side of the arrows} +% \begin{macrocode} + \PositionX = \cnt@textwidth + \divide\PositionX by 8 + \advance\PositionX by \ref@margin + \OutsideVArrow\ref@foot\cnt@footskip{20}{20} + \PositionY = \ref@foot + \advance\PositionY by \cnt@footskip + \advance\PositionY by 30 + \Identify{11} +% \end{macrocode} +% +% Identify the |\voffset|. The arrow will be located a bit to the +% left of the edge of the paper. +% \begin{macrocode} + \PositionX = \cnt@paperwidth + \advance\PositionX by -50 + \PositionY = \cnt@paperheight + \ExtraYPos = \PositionY + \advance\ExtraYPos by -\cnt@voffset + \advance\PositionY by \cnt@voffset + \divide\PositionY by \tw@ + \Identify{2} + \InsideVArrow\ExtraYPos +% \end{macrocode} +% +% Identify |\topmargin|, |\headheight| and |\headsep|. +% +% The arrows will be located on $1/8$th of the |\textwidth|, with +% intervals of the same size, stored in |\Interval|. +% \begin{macrocode} + \Interval = \cnt@textwidth + \divide\Interval by 8 + \PositionX = \ref@margin + \advance\PositionX by \Interval +% \end{macrocode} +% First the |\topmargin|. If |\topmargin| has a positive value, the +% arrow is upward. Otherwise, it is downward. The number label is +% always placed at the base of the arrow. +% \changes{v1.2}{1998/04/13}{The direction of the arrows should be +% switched by the sign of \cs{topmargin}} +% \begin{macrocode} + \ifnum\cnt@topmargin > \z@ + \ExtraYPos = \ref@head + \advance\ExtraYPos\cnt@headheight + \OutsideVArrow\ExtraYPos\cnt@topmargin{20}{20} + \PositionY = \ExtraYPos + \advance\PositionY by \cnt@topmargin + \else + \ExtraYPos = \cnt@voffset + \OutsideVArrow\ExtraYPos{-\cnt@topmargin}{20}{20} + \PositionY = \ExtraYPos + \advance\PositionY by -\cnt@topmargin + \fi + \advance\PositionY by 30 + \Identify{4} + \advance\PositionX by \Interval +% \end{macrocode} +% Then the |\headheight| +% \changes{v1.2}{1998/04/13}{The \cs{PositionY} of the label 5 is +% fixed} +% \begin{macrocode} + \OutsideVArrow\ref@head\cnt@headheight{20}{20} + \PositionY = \ref@head + \advance\PositionY by \cnt@headheight + \advance\PositionY by 30 + \Identify{5} + \advance\PositionX by \Interval +% \end{macrocode} +% and finally the |\headsep| +% \changes{v1.2}{1998/04/13}{The \cs{PositionY} of the label 6 is +% fixed} +% \begin{macrocode} + \ExtraYPos=\ref@body + \advance\ExtraYPos\cnt@textheight + \OutsideVArrow\ExtraYPos\cnt@headsep{20}{20} + \PositionY = \ref@body + \advance\PositionY by \cnt@textheight + \advance\PositionY by -30 + \Identify{6} +% \end{macrocode} +% +% Here we can end the picture environment and insert a little +% space. +% \begin{macrocode} + \end{picture} + + \medskip +% \end{macrocode} +% +% Below the picture we put a table to show the actual values of the +% parameters. Note that fractional points are truncated, i.e., +% \texttt{72.27pt} is displayed as \texttt{72pt} +% +% The table is typeset inside a box with a depth of 0 to always +% keep it on the same page as the picture. +% \changes{v1.1b}{1994/03/23}{Showing oddside and evenside margins was +% defective} +% \changes{v1.1c}{1994/07/14}{in compatibility mode \cs{footnotesize} +% calls \cs{normalfont}; therefore we need to switch to a tt font +% later} +% \changes{v1.1f}{1995/03/14}{introduced \cs{notshown}} +% \begin{macrocode} + \vtop to 0pt{% + \@minipagerestore\footnotesize\ttfamily + \begin{tabular}{@{}rl@{\hspace{20pt}}rl} + 1 & \oneinchtext\ + \LayOutbs\texttt{hoffset} + & 2 & \oneinchtext\ + \LayOutbs\texttt{voffset} \\ + 3 & \if@twoside + \ifodd\count\z@ \Show{cnt}{oddsidemargin} + \else \Show{cnt}{evensidemargin} + \fi + \else + \Show{cnt}{oddsidemargin} + \fi & 4 & \Show{cnt}{topmargin} \\ + 5 & \Show{cnt}{headheight} & 6 & \Show{cnt}{headsep} \\ + 7 & \Show{cnt}{textheight} & 8 & \Show{cnt}{textwidth} \\ + 9 & \Show{cnt}{marginparsep}&10& \Show{cnt}{marginparwidth} \\ + 11& \Show{cnt}{footskip} & & \Show{cnt}{marginparpush} + \rlap{(\notshown)}\\ + & \Show{ref}{hoffset} & & \Show{ref}{voffset} \\ + & \Show{cnt}{paperwidth} & & \Show{cnt}{paperheight} \\ + + \end{tabular}\vss} +% \end{macrocode} +% When the option \Lopt{verbose} was used the following lines will +% show dimensions on the terminal. +% \begin{macrocode} + \Type{ref}{hoffset} + \Type{ref}{voffset} + \Type{cnt}{textheight} + \Type{cnt}{textwidth} +% \end{macrocode} +% Finally we start a new page. +% \begin{macrocode} + \newpage +} +%</package> +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex-dev/tools/longtable.dtx b/Master/texmf-dist/source/latex-dev/tools/longtable.dtx new file mode 100644 index 00000000000..9a3b5c03b87 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/longtable.dtx @@ -0,0 +1,2154 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% File: longtable.dtx Copyright (C) 1990-2019 David Carlisle +% +%<*dtx> + \ProvidesFile{longtable.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<package>\ProvidesPackage{longtable} +%<driver> \ProvidesFile{longtable.drv} +% \fi +% \ProvidesFile{longtable.dtx} + [2019/02/06 v4.12 Multi-page Table package (DPC)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage{longtable} +\begin{document} +\DocInput{longtable.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{longtable.dtx} +% \title{The \textsf{longtable} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{David Carlisle\thanks{The new algorithm for aligning `chunks' +% of a table used in version 4 of this package was devised coded +% and documented by David Kastrup.}} +% \date{\filedate} +% +% \let\package\textsf +% \let\env\textsf +% \providecommand\finalclearpage{\clearpage} +% +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% \begin{abstract} +% This package defines the \env{longtable} environment, a multi-page +% version of \env{tabular}. +% \end{abstract} +% +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \changes{v0.00}{1989/11/06} +% {`Version 0' distributed as longtab.sty +% always used just one chunk for the whole table} +% +% \changes{v1.00}{1990/12/20} +% {Initial version} +% +% \changes{v2.00}{1991/06/17} +% {Support NFSS and array.sty} +% +% \changes{v3.00}{1992/03/16} +% {New implementation. tables may now start anywhere on the page.} +% +% \changes{v3.01}{1992/04/06} +% {(Michel Goossens) If a chunk ends on a line in which the first +% entry is empty, weird errors occur. Added special begin and end +% groups, (\cs{ifnum}0 ) stuff as explained in Appendix D.} +% +% \changes{v3.02}{1992/04/09} +% {(Michel Goossens) Longtable fails if the table counter is reset +% during a document. Now use an internal counter, but still +% increment table so \cs{caption} and \cs{label} work out right.} +% +% \changes{v3.03}{1992/06/25} +% {Add \cs{@ifundefined\{reset@font\}} so that the documentation may +% be processed with old versions of \LaTeX.} +% \changes{v3.03}{1992/06/25} +% {Modify the treatment of \cs{d@llar} to match the new versions of +% Mittelbach's array.sty (array.sty v2.0h)} +% +% \changes{v3.04}{1992/11/12} +% {(Jean-Pierre Drucbert) Longtable failed when used with +% \cs{includeonly}.} +% \changes{v3.04}{1992/11/12} +% {Fix bug which stopped \cs{kill} working correctly in headings.} +% \changes{v3.04}{1992/11/12} +% {(Graham Gough) Made \cs{setlongtables} issue a warning message.} +% \changes{v3.04}{1992/11/12} +% {(Sebastian Rahtz) longtable ran out of memory on really long +% tables. Another bug introduced in V3.} +% +% \changes{v3.05}{1992/11/20} +% {(Juergen Peus) Table was hard coded into the captions, Now the +% captions use \cs{fnum@table}, so \cs{tablename} will be used.} +% +% \changes{v3.06}{1993/01/21} +% {(Ingo Hoffmann) longtable fails with letter style. +% The table counter is not defined, and the .aux file is not used in +% the same way. This version will use a .lta file for letter style.} +% +% \changes{v3.07}{1993/06/09} +% {Allow the \LaTeX\ syntax \cs{setcounter}\{LTchunksize\}\{10\}} +% +% \changes{v3.08}{1993/06/09} +% {Update for \LaTeXe} +% +% \changes{v3.09}{1994/03/15} +% {New ltxdoc style} +% +% \changes{v3.11}{1994/05/22} +% {Option handling added, new style errors and warnings} +% +% \changes{v3.12}{1994/06/30} +% {Remove special letter class handling from v3.06, not needed for +% new letter class} +% +% \changes{v4.00}{1996/04/08} +% {(DK) New algorithm to align chunks devised and coded by David +% Kastrup} +% +% \changes{v4.02}{1996/04/16} +% {(DPC/DK) documentation improvements} +% +% \changes{v4.06}{1997/06/28} +% {(DK) new email address} +% +% +% +% \makeatletter +% \def\@oddfoot{\normalfont\rmfamily\dotfill Page \thepage\dotfill} +% \def\@oddhead{\dotfill{\normalfont\ttfamily longtable.sty}\dotfill} +% \def\ps@titlepage{\let\@oddhead\@empty} +% \makeatother +% +% +% \setlength\LTleft\parindent +% \setlength\LTright\fill +% \setcounter{LTchunksize}{10} +% +% \def\v{\char`} +% +% ^^A \vbox to 100pt makes the page breaks the same on the first run. +% \changes{v3.08}{1993/06/09} +% {No need to use \cs{vbox} with \LaTeXe\ minipage} +% \noindent\begin{minipage}[t][130pt]{\textwidth} +% \listoftables +% \end{minipage} +% +% \section{Introduction} +% +% The \package{longtable} package defines a new environment, +% \DescribeEnv{longtable} +% \env{longtable}, which has most of the features of the \env{tabular} +% environment, but produces tables which may be broken by \TeX's +% standard page-breaking algorithm. It also shares some features with +% the \env{table} environment. In particular it uses the same counter, +% \texttt{table}, and has a similar "\caption" command. Also, the +% standard "\listoftables" command lists tables produced by either the +% \env{table} or \env{longtable} environments. +% +% The following example uses most of the features of the \env{longtable} +% environment. An edited listing of the input for this example appears +% in Section~\ref{listing}. +% +% \textbf{Note:} Various parts of the following table will +% \textbf{not} line up correctly until this document has been run +% through \LaTeX\ several times. This is a characteristic feature of +% this package, as described below. +% +% \begin{longtable}{@{*}r||p{1in}@{*}} +% KILLED & LINE!!!! \kill +% \caption +% [An optional table caption (used in the list of tables)] +% {A long table\label{long}}\\ +% \hline\hline +% \multicolumn{2}{@{*}c@{*}}% +% {This part appears at the top of the table}\\ +% \textsc{First}&\textsc{Second}\\ +% \hline\hline +% \endfirsthead +% \caption[]{(continued)}\\ +% \hline\hline +% \multicolumn{2}{@{*}c@{*}}% +% {This part appears at the top of every other page}\\ +% \textbf{First}&\textbf{Second}\\ +% \hline\hline +% \endhead +% \hline +% This goes at the&bottom.\\ +% \hline +% \endfoot +% \hline +% These lines will&appear\\ +% in place of the & usual foot\\ +% at the end& of the table\\ +% \hline +% \endlastfoot +% \env{longtable} columns are specified& in the \\ +% same way as in the \env{tabular}& environment.\\ +% "@{*}r||p{1in}@{*}"& in this case.\\ +% Each row ends with a& "\\" command.\\ +% The "\\" command has an& optional\\ +% argument, just as in& the\\ +% \env{tabular}&environment.\\[10pt] +% See the effect of "\\[10pt]"&?\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Also "\hline" may be used,& as in \env{tabular}.\\ +% \hline +% That was a "\hline"&.\\ +% \hline\hline +% That was "\hline\hline"&.\\ +% \multicolumn{2}{||c||}% +% {This is a \ttfamily\v\\multicolumn\v{2\v}\v{||c||\v}}\\ +% If a page break occurs at a "\hline" then& a line is drawn\\ +% at the bottom of one page and at the& top of the next.\\ +% \hline +% The "[t] [b] [c]" argument of \env{tabular}& can not be used.\\ +% The optional argument may be one of& "[l] [r] [c]"\\ +% to specify whether the table should be& adjusted\\ +% to the left, right& or centrally.\\ +% \hline\hline +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Some lines may take up a lot of space, like this: & +% \raggedleft This last column is a ``p'' column so this +% ``row'' of the table can take up several lines. Note however that +% \TeX\ will never break a page within such a row. Page breaks only +% occur between rows of the table or at "\hline" commands. +% \tabularnewline +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% Lots of lines& like this.\\ +% \hline +% Lots\footnote{This is a footnote.} of lines& like this.\\ +% Lots of lines& like this\footnote{\env{longtable} takes special +% precautions, so that footnotes may also be used in `p' columns.}\\ +% \hline +% Lots of lines& like this.\\ +% Lots of lines& like this. +% \end{longtable} +% +% \section{Chunk Size} +% +% \DescribeMacro{LTchunksize} +% In order to \TeX\ multi-page tables, it is necessary to break up the +% table into smaller chunks, so that \TeX\ does not have to keep +% everything in memory at one time. By default \env{longtable} uses 20 +% rows per chunk, but this can be set by the user, with e.g., +% "\setcounter{LTchunksize}{10}".\footnote +% {You can also use the plain \TeX\ syntax +% {\ttfamily\v\\LTchunksize=10.}} +% These chunks do not affect page breaking, +% thus if you are using a \TeX\ with a lot of memory, you can set +% "LTchunksize" to be several pages of the table. \TeX\ will run +% faster with a large "LTchunksize". However, if necessary, +% \env{longtable} can work with "LTchunksize" set to 1, in which case +% the memory taken up is negligible. +% Note that if you use the commands for setting the table head or foot +% (see below), the "LTchunksize" must be at least as large as the +% number of rows in each of the head or foot sections. +% +% This document specifies "\setcounter{LTchunksize}{10}". If you look +% at the previous table, after the \emph{first} run of \LaTeX\ you will +% see that various parts of the table do not line up. +% \LaTeX\ will also have printed a warning that the column +% widths had changed. \env{longtable} writes information onto the +% ".aux" file, so that it can line up the different chunks. +% Prior to version~4 of this package, this information was not used +% unless a "\setlongtables" command was issued, however, now the +% information is always used, using a new algorithm\footnote{Due to +% David Kastrup.} and so "\setlongtables" is no longer needed. It is +% defined (but does nothing) for the benefit of old documents that +% use it. +% +% \begin{table} +% \centering +% \begin{tabular}{||l|l|l||} +% \hline\hline +% A&\env{tabular}& environment\\ +% \hline +% within&a floating&\env{table}\\ +% \hline\hline +% \end{tabular} +% \caption{A floating table} +% \end{table} +% +% \section{Captions and Headings} +% +% At the start of the table one may specify lines which are to appear at +% the top of every page (under the headline, but before the other lines +% of the table). +% \DescribeMacro{\endhead} +% The lines are entered as normal, but the last "\\" command is +% replaced by a "\endhead" command. +% \DescribeMacro{\endfirsthead} +% If the first page should have a different heading, then this should be +% entered in the same way, and terminated with the "\endfirsthead" +% command. The "LTchunksize" should be at least as large as the +% number of rows in the heading. +% \DescribeMacro{\endfoot} +% There are also "\endfoot" and "\endlastfoot" +%\DescribeMacro{\endlastfoot} +% commands which are used in the same way (at the \emph{start} of the +% table) to specify rows (or an "\hline") to appear at the bottom of +% each page. In certain situations, you may want to place lines which +% logically belong in the table body at the end of the \env{firsthead}, +% or the beginning of the \env{lastfoot}. This helps to control which +% lines appear on the first and last page of the table. +% +% \DescribeMacro{\caption}% +% The "\caption{...}" command is essentially equivalent to\\ +% "\multicolumn{n}{c}{\parbox{\LTcapwidth}{...}}"\\ +% where \texttt{n} is the number of columns of the table. You may set +% the width of the caption with a command such as +% "\setlength{\LTcapwidth}{2in}" +% in the preamble of your document. The default is 4in. "\caption" also +% writes the information to produce an entry in the list of tables. As +% with the "\caption" command in the \env{figure} and \env{table} +% environments, an optional argument specifies the text to appear in the +% list of tables if this is different from the text to appear in the +% caption. Thus the caption for table \ref{long} was specified as +% {\ttfamily +% "\caption"[An optional table caption +% (used in the list of tables)]\v{A long +% table"\label{long}"\v}}. +% +% You may wish the caption on later pages to be different to that on the +% first page. In this case put the "\caption" command in the first +% heading, and put a subsidiary caption in a "\caption[]" command in +% the main heading. If the optional argument to "\caption" is empty, +% no entry is made in the list of tables. Alternatively, if you do not +% want the table number to be printed each time, use the "\caption*" +% command. +% +% The captions are set based on the code for the \package{article} +% class. +% If you have redefined the standard "\@makecaption" command to produce +% a different format for the captions, you may +% need to make similar changes to the \package{longtable} version, +% "\LT@makecaption". See the code section for more details. +% +% A more convenient method of customising captions is given by the +% \package{caption(2)} package, which provides commands for customising +% captions, and arranges that the captions in standard environments, and +% many environments provided by packages (including \package{longtable}) +% are modified in a compatible manner. +% +% You may use the "\label" command so that you can cross reference +% \env{longtable}s with "\ref". Note however, that the "\label" command +% should not be used in a heading that may appear more than once. Place +% it either in the \env{firsthead}, or in the body of the table. It +% should not be the \emph{first} command in any entry. +% +% \section{Multicolumn entries} +% +% The "\multicolumn" command may be used in \env{longtable} in exactly +% the same way as for \env{tabular}. So you may want to skip this +% section, which is rather technical, however coping with "\multicolumn" +% is one of the main problems for an environment such as +% \env{longtable}. The main effect that a user will see is that +% certain combinations of "\multicolumn" entries will result in a +% document needing more runs of \LaTeX\ before the various `chunks' of +% a table align. +% +% The examples in this section are set with "LTchunksize" set to the +% minimum value of one, to demonstrate the effects when "\multicolumn" +% entries occur in different chunks. +% +% \begin{table}[!htp] +% \begin{center} +% \LTchunksize=1 +% \makeatletter +% +% \global\let\LT@save@row\relax +% \let\LT@warn\@gobble +% \let\LT@final@warn\relax +% +% \newcommand\ltexample[1]{ +% \stepcounter{LT@tables} +% \expandafter\let\csname LT@\romannumeral\c@LT@tables\endcsname +% \LT@save@row +% \addtocounter{LT@tables}{-1} +% \begin{longtable}{|c|c|c|} +% \caption{A difficult {\cs{multicolumn}} combination: +% pass #1\label{pass#1}}\\ +% \hline +% 1&2&3\\ +% \multicolumn{3}{|c|}{wide multicolumn spanning 1--3}\\ +% \multicolumn{2}{|c|}{multicolumn 1--2}&3\\ +% wide 1&2&3\\ +% \hline +% \end{longtable} +% } +% +% \ltexample{1} +% +% \ltexample{2} +% +% \ltexample{3} +% +% \ltexample{4} +% +% \end{center} +% \end{table} +% +% Consider Table~\ref{pass1}. +% In the second chunk, \env{longtable} sees the wide +% multicolumn entry. At this point it thinks that the first two +% columns are very narrow. All +% the width of the multicolumn entry is assumed to be in the +% third column. (This is a `feature' of \TeX's primitive "\halign" +% command.) \env{longtable} then passes the information that there +% is a wide third column to the later chunks, with the result that the +% first pass over the table is too wide. +% +% If the `saved row' from this first pass was re-inserted into the +% table on the next pass, the table would line up in two passes, but +% would be much two wide. +% +% \DescribeMacro{\kill}% +% The solution to this problem used in Versions 1~and~2, was to use a +% "\kill" line. If a line is "\kill"ed, by using "\kill" rather than +% "\\" at the end of the line, it is used in calculating +% column widths, but removed from the final table. Thus entering +% "\kill"ed copies of the last two rows before the wide multicolumn +% entry would mean that "\halign" `saw' the wide entries in the first +% two columns, and so would not widen the third column by so much to +% make room for the multicolumn entry. +% +% In Version~3, a new solution was introduced. If the saved row in +% the ".aux" file was not being used, \env{longtable} used a special +% `draft' form of "\multicolumn", this modified the definition, so the +% spanning entry was never considered to be wider than the columns it +% spanned. So after the first pass, the ".aux" file stored the +% widest normal entry for each column, no column was widened due to +% "\span"ned columns. By default \env{longtable} ignored the ".aux" +% file, and so each run of \LaTeX\ was considered a first pass. Once the +% "\setlongtables" declaration was given, the saved row in the ".aux" +% file, and the proper definition of "\multicolumn" were used. If any +% "\multicolumn" entry caused one of the columns to be widened, this +% information could not be passed back to earlier chunks, and so the +% table would not correctly line up until the third pass. This algorithm +% always converged in three passes as described above, but in examples +% such as the ones in Tables \ref{pass1}--\ref{pass4}, the final +% widths were not optimal as the width of column~2, which is +% determined by a "\multicolumn" entry was not known when the final +% width for column~3 was fixed, due to the fact that \emph{both} +% "\multicolumn" commands were switched from `draft' mode to `normal' +% mode at the same time. +% +% Version~4 alleviates the problem considerably. +% The first pass of the table will +% indeed have the third column much too wide. However, on the next pass +% \env{longtable} will notice the error and reduce the column width +% accordingly. If this has to propagate to chunks before the +% "\multicolumn" one, an additional pass will, of course, be +% needed. It is possible to construct tables where this rippling up of +% the correct widths takes several passes to `converge' and produce a +% table with all chunks aligned. However in +% order to need many passes one needs to construct a table with +% many overlapping "\multicolumn" entries, all being wider than the +% natural widths of the columns they span, and all occurring in +% different chunks. In the typical case the algorithm will converge +% after three or four passes, and, the benefits of not needing to edit +% the document before the final run to add "\setlongtables", and the +% better choice of final column widths in the case of multiple +% "\multicolumn" entries will hopefully more than pay for the extra +% passes that may possibly be needed. +% +% So Table~\ref{pass1} converges after 4~passes, as seen in +% Table~\ref{pass4}. +% +% You can still speed the convergence by introducing judicious "\kill" +% lines, if you happen to have constellations like the above. +% +% If you object even to \LaTeX-ing a file twice, you should +% make the first line of +% every \env{longtable} a "\kill" line that contains the widest entry +% to be used in each column. All chunks will then line up on the first +% pass. +% +% \section{Adjustment} +% +% The optional argument of \env{longtable} controls the +% horizontal alignment of the table. The possible options are "[c]", +% "[r]" and "[l]", for centring, +% right and left adjustment, respectively. +% \DescribeMacro{\LTleft} +% Normally centring is the default, but this document specifies +% \DescribeMacro{\LTright} +%\begin{verbatim} +% \setlength\LTleft\parindent +% \setlength\LTright\fill +%\end{verbatim} +% in the preamble, +% which means that the tables are set flush left, but +% indented by the usual paragraph indentation. Any lengths can be +% specified for these two parameters, but at least one of them should be +% a rubber length so that it fills up the width of the page, unless +% rubber lengths are added between the columns using the +% "\extracolsep" command. +% For instance +%\begin{verbatim} +% \begin{tabular*}{\textwidth}{@{\extracolsep{...}}...} +%\end{verbatim} +% produces a full width table, to get a similar effect with +% \env{longtable} specify +%\begin{verbatim} +% \setlength\LTleft{0pt} +% \setlength\LTright{0pt} +% \begin{longtable}{@{\extracolsep{...}}...} +%\end{verbatim} +% +% \section{Changes} +% +% This section highlights the major changes since version~2. A more +% detailed change log may be produced at the end of the code listing +% if the "ltxdoc.cfg" file specifies +%\begin{verbatim} +% \AtBeginDocument{\RecordChanges} +% \AtEndDocument{\PrintChanges} +%\end{verbatim} +% +% Changes made between versions 2 and 3. +% \begin{itemize} +% \item The mechanism for adding the head and foot of the table has been +% completely rewritten. With this new mechanism, \env{longtable} does +% not need to issue a "\clearpage" at the start of the table, and so the +% table may start half way down a page. Also the "\endlastfoot" command +% which could not safely be implemented under the old scheme, has been +% added. +% \item \env{longtable} now issues an error if started in the scope of +% "\twocolumn", or the \env{multicols} environment. +% \item The separate documentation file "longtable.tex" has been +% merged with the package file, "longtable.dtx" using Mittelbach's +% \package{doc} package. +% \item Support for footnotes has been added. Note however that +% "\footnote" will not work in the `head' or `foot' sections of the +% table. In order to put a footnote in those sections (e.g., inside a +% caption), use "\footnotemark" at that point, and "\footnotetext" +% anywhere in the table \emph{body} that will fall on the same page. +% \item The treatment of "\multicolumn" has changed, making +% "\kill" lines unnecessary, at the price of sometimes requiring a +% third pass through \LaTeX. +% \item The "\newpage" command now works inside a \env{longtable}. +% \end{itemize} +% +% Changes made between versions 3 and 4. +% \begin{itemize} +% \item A new algorithm is used for aligning chunks. As well as the +% widest width in each column, \package{longtable} remembers which +% chunk produced this maximum. This allows it to check that the +% maximum is still achieved in later runs. As \package{longtable} can +% now deal with columns shrinking as the file is edited, the +% "\setlongtables" system is no longer needed and is disabled. +% +% \item An extra benefit of the new algorithm's ability to deal with +% `shrinking' columns is that it can give better (narrower) column +% widths in the case of overlapping "\multicolumn" entries in +% different chunks than the previous algorithm produced. +% +% \item The `draft' multicolumn system has been removed, along with +% related commands such as "\LTmulticolumn". +% +% \item The disadvantage of the new algorithm is that it can take more +% passes. The theoretical maximum is approximately twice the length +% of a `chain' of columns with overlapping "\multicolumn" entries, +% although in practice it usually converges as fast as the old +% version. (Which always converged in three passes once +% "\setlongtables" was activated.) +% +% \item "\\*" and "\nopagebreak" commands may be used to control page +% breaking. +% +% \end{itemize} +% +% +% \section{Summary} +% +% ^^A Allow the table to stick into the left margin. +% \setlength{\LTleft}{0pt plus 1fill minus 1fill} +% \setlength{\LTright}{0pt} +% +% \begin{longtable}{@{}l@{\hspace{10pt}}p{.8\linewidth}@{}} +% \caption[A summary of \env{longtable} commands]% +% {\normalsize A summary of \env{longtable} commands}\\ +% \multicolumn{2}{c}{\textbf{Parameters}}\\* +% \hline +% "\LTleft"& +% Glue to the left of the table. \hfill("\fill")\\ +% "\LTright"& +% Glue to the right of the table. \hfill("\fill")\\ +% "\LTpre"& +% Glue before the the table. \hfill("\bigskipamount")\\ +% "\LTpost"& +% Glue after the the table. \hfill("\bigskipamount")\\ +% "\LTcapwidth"& +% The width of a parbox containing the caption.\hfill(4in)\\ +% "LTchunksize"& +% The number of rows per chunk. \hfill(20)\\[5pt] +% \multicolumn{2}{c}{\textbf{Optional +% arguments to} \ttfamily\v\\begin\v{longtable\v}}\\* +% \hline +% \it none& Position as specified by "\LTleft" and "\LTright".\\ +% "[c]"& Centre the table.\\ +% "[l]"& Place the table flush left.\\ +% "[r]"& Place the table flush right.\\[5pt] +% \pagebreak[2] +% \multicolumn{2}{c}{\textbf{Commands +% to end table rows}}\\* +% \hline +% "\\"& +% Specifies the end of a row\\ +% "\\"\oarg{dim}& Ends row, then adds vertical space +% (as in the \env{tabular} environment).\\ +% "\\*"& +% The same as "\\" but disallows a page break after the row.\\ +% "\tabularnewline"& +% Alternative to "\\" for use in the scope of "\raggedright" and +% similar commands that redefine "\\".\\ +% "\kill"& +% Row is `killed', but is used in calculating widths.\\ +% "\endhead"& +% Specifies rows to appear at the top of every page.\\ +% "\endfirsthead"& +% Specifies rows to appear at the top the first page.\\ +% "\endfoot"& +% Specifies rows to appear at the bottom of every page.\\ +% "\endlastfoot"& +% Specifies rows to appear at the bottom of the last page.\\[5pt] +% \multicolumn{2}{c}{\textbf{\env{longtable} caption commands}}\\* +% \hline +% "\caption"\marg{caption}& +% Caption `Table ?: \meta{caption}', and a `\meta{caption}' +% entry in the list of tables.\\ +% "\caption"\oarg{lot}\marg{caption}& +% Caption `Table ?: \meta{caption}', and a `\meta{lot}' +% entry in the list of tables.\\ +% "\caption[]"\marg{caption}& +% Caption `Table ?: \meta{caption}', +% but no entry in the list of tables.\\ +% "\caption*"\marg{caption}& +% Caption `\meta{caption}', but no entry in the list of tables.\\[5pt] +% \multicolumn{2}{c}{%^^A +% \textbf{Commands available at the start of a row}}\\* +% \hline +% "\pagebreak"& +% Force a page break.\\* +% "\pagebreak"\oarg{val}& A `hint' between 0 and 4 +% of the desirability of a break.\\ +% "\nopagebreak"& Prohibit a page break.\\* +% "\nopagebreak"\oarg{val}& A `hint' between 0 and 4 of the undesirability +% of a break.\\ +% "\newpage"& +% Force a page break.\\[5pt] +% \multicolumn{2}{c}{\textbf{Footnote commands +% available inside \env{longtable}}}\\* +% \hline +% "\footnote"& +% Footnotes, but may not be used in the table head \& foot.\\* +% "\footnotemark"& +% Footnotemark, may be used in the table head \& foot.\\* +% "\footnotetext"& +% Footnote text, use in the table body.\\[5pt] +% \multicolumn{2}{c}{\textbf{Setlongtables}}\\ +% \hline +% "\setlongtables"& Obsolete command. Does nothing now. +% \end{longtable} +% +% +% \finalclearpage +% \section{Verbatim highlights from Table \protect\ref{long}} +% \label{listing} +% \begingroup\catcode`\/=0 +% \begin{verbatim} +% \begin{longtable}{@{*}r||p{1in}@{*}} +% KILLED & LINE!!!! \kill +% \caption[An optional table caption /ldots]{A long table\label{long}}\\ +% \hline\hline +% \multicolumn{2}{@{*}c@{*}}% +% {This part appears at the top of the table}\\ +% \textsc{First}&\textsc{Second}\\ +% \hline\hline +% \endfirsthead +% \caption[]{(continued)}\\ +% \hline\hline +% \multicolumn{2}{@{*}c@{*}}% +% {This part appears at the top of every other page}\\ +% \textbf{First}&\textbf{Second}\\ +% \hline\hline +% \endhead +% \hline +% This goes at the&bottom.\\ +% \hline +% \endfoot +% \hline +% These lines will&appear\\ +% in place of the & usual foot\\ +% at the end& of the table\\ +% \hline +% \endlastfoot +% \env{longtable} columns are specified& in the \\ +% same way as in the \env{tabular}& environment.\\ +% /ldots +% \multicolumn{2}{||c||}{This is a /ldots}\\ +% /ldots +% Some lines may take/ldots& +% \raggedleft This last column is a ``p'' column/ldots +% \tabularnewline +% /ldots +% Lots of lines& like this.\\ +% /ldots +% \hline +% Lots\footnote{/ldots} of lines& like this.\\ +% Lots of lines& like this\footnote{/ldots}\\ +% \hline +% Lots of lines& like this.\\ +% /ldots +% \end{longtable} +% \end{verbatim} +% \endgroup +% +% \StopEventually{} +% +% \finalclearpage +% \section{The Macros} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \subsection{Initial code} +% +% Before declaring the package options, we must define some defaults +% here. +% +% \begin{macro}{\LT@err} +% The error generating command +% \begin{macrocode} +\def\LT@err{\PackageError{longtable}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@warn} +% The warning generating command +% \begin{macrocode} +\def\LT@warn{\PackageWarning{longtable}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@final@warn} +% \changes{v4.04}{1996/05/24} +% {Macro added} +% If any \env{longtable}s have not aligned, generate a warning at the +% end of the run at "\AtEndDocument". +% \begin{macrocode} +\def\LT@final@warn{% + \AtEndDocument{% + \LT@warn{Table \@width s have changed. Rerun LaTeX.\@gobbletwo}}% + \global\let\LT@final@warn\relax} +% \end{macrocode} +% \end{macro} +% +% \subsection{Options} +% +% The first two options deal with error handling. They are compatible +% with the options used by the \texttt{tracefnt} package. +% +% \begin{macro}{errorshow} +% \emph{Only} show errors on the terminal. `warnings' are just sent to +% the log file. +% \changes{v3.14}{1995/04/25} +% {Change string from LT to longtable} +% \begin{macrocode} +\DeclareOption{errorshow}{% + \def\LT@warn{\PackageInfo{longtable}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{pausing} +% \changes{v3.14}{1995/04/25} +% {Change string from LT to longtable} +% \changes{v3.15}{1995/06/15} +% {Use single hash for latex/1557} +% Make every warning message into an error so \TeX\ stops. +% May be useful for debugging. +% \begin{macrocode} +\DeclareOption{pausing}{% + \def\LT@warn#1{% + \LT@err{#1}{This is not really an error}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{set} +% \begin{macro}{final} +% \changes{v4.01}{1996/04/11} +% {(DPC) make set and final options no op} +% The next options are just alternative syntax for the +% "\setlongtables" declaration. +% \begin{macrocode} +\DeclareOption{set}{} +\DeclareOption{final}{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% +% \subsection{User Settable Parameters} +% +% \begin{macro}{\LTleft} +% \begin{macro}{\LTright} +% Glue to the left and right of the table, default "\fill" (ie +% centred). +% \begin{macrocode} +\newskip\LTleft \LTleft=\fill +\newskip\LTright \LTright=\fill +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\LTpre} +% \begin{macro}{\LTpost} +% Glue before and after the \env{longtable}. "\bigskip" by default. +% \begin{macrocode} +\newskip\LTpre \LTpre=\bigskipamount +\newskip\LTpost \LTpost=\bigskipamount +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\LTchunksize} +% Chunk size (The number of rows taken per "\halign"). Default 20. +% \begin{macrocode} +\newcount\LTchunksize \LTchunksize=20 +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\c@LTchunksize} +% Added in V3.07 to allow the \LaTeX\ syntax +% "\setcounter{LTchunksize}{10}". +% \begin{macrocode} +\let\c@LTchunksize\LTchunksize +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LTcapwidth} +% Width of the "\parbox" containing the caption. Default 4in. +% \begin{macrocode} +\newdimen\LTcapwidth \LTcapwidth=4in +% \end{macrocode} +% \end{macro} +% +% \subsection{Internal Parameters} +% +% \begin{macro}{\LT@head} +% \begin{macro}{\LT@firsthead} +% \begin{macro}{\LT@foot} +% \begin{macro}{\LT@lastfoot} +% Boxes for the table head and foot. +% \begin{macrocode} +\newbox\LT@head +\newbox\LT@firsthead +\newbox\LT@foot +\newbox\LT@lastfoot +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\LT@cols} +% Counter for number of columns. +% \begin{macrocode} +\newcount\LT@cols +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@rows} +% Counter for rows up to chunksize. +% \begin{macrocode} +\newcount\LT@rows +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\c@LT@tables} +% Counter for the tables, added in V3.02. Previous versions just used +% the \LaTeX\ counter "table", but this fails if "table" is +% reset during a document, eg \package{report} class resets it every +% chapter. +% +% This was changed from "\newcount\LT@tables" in V3.04. \LaTeX\ counters +% are preserved correctly when "\includeonly" is used. In the rest of +% the file "\LT@tables" has been replaced by "\c@LT@tables" without +% further comment. +% \begin{macrocode} +\newcounter{LT@tables} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\c@LT@chunks} +% \changes{v4.00}{1996/04/08} +% {(DK) Chunk counter added} +% We need to count through the chunks of our tables from Version~4 on. +% \begin{macrocode} +\newcounter{LT@chunks}[LT@tables] +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\c@table} +% \begin{macro}{\fnum@table} +% \begin{macro}{\tablename} +% If the "table" counter is not defined (eg in "letter" style), define +% it. (Added in V3.06.) +% \begin{macrocode} +\ifx\c@table\undefined + \newcounter{table} + \def\fnum@table{\tablename~\thetable} +\fi +\ifx\tablename\undefined + \def\tablename{Table} +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\LT@out} +% In a normal style, "longtable" uses the ".aux" file to record the +% column widths. With "letter.sty", use a separate ".lta" file. +% (Added in V3.06.) +% +% Not needed for new letter class. +%\begin{verbatim} +%\ifx\startlabels\undefined +% \let\@auxout\@auxout +%\else +% {\@input{\jobname.lta}}% +% \newwrite\@auxout +% \immediate\openout\@auxout=\jobname.lta +%\fi +%\end{verbatim} +% \end{macro} +% +% \begin{macro}{\LT@p@ftn} +% Temporary storage for footnote text in a `p' column. +% \begin{macrocode} +\newtoks\LT@p@ftn +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@end@pen} +% Special penalty for the end of the table. Done this way to save using +% up a count register. +% \begin{macrocode} +\mathchardef\LT@end@pen=30000 +% \end{macrocode} +% \end{macro} +% +% \subsection{The \env{longtable} environment} +% +% \begin{macro}{\longtable} +% Called by "\begin{longtable}". This implementation does not work in +% multiple column formats. "\par" added at V3.04. +% \begin{macrocode} +\def\longtable{% + \par + \ifx\multicols\@undefined + \else + \ifnum\col@number>\@ne + \@twocolumntrue + \fi + \fi + \if@twocolumn + \LT@err{longtable not in 1-column mode}\@ehc + \fi + \begingroup +% \end{macrocode} +% Check for an optional argument. +% \begin{macrocode} + \@ifnextchar[\LT@array{\LT@array[x]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@array} +% Start setting the alignment. +% Based on "\@array" from the \LaTeX\ kernel +% and the \package{array} package. +% +% Since Version 3.02, \package{longtable} has used the internal counter +% "\c@LT@tables". The \LaTeX\ counter "table" is still incremented +% so that "\caption" works correctly. +% \begin{macrocode} +\def\LT@array[#1]#2{% + \refstepcounter{table}\stepcounter{LT@tables}% +% \end{macrocode} +% Set up the glue around the table if an optional argument given. +% \begin{macrocode} + \if l#1% + \LTleft\z@ \LTright\fill + \else\if r#1% + \LTleft\fill \LTright\z@ + \else\if c#1% + \LTleft\fill \LTright\fill + \fi\fi\fi +% \end{macrocode} +% Set up these internal commands for \env{longtable}. +% \changes{v3.13}{1994/12/08} +% {add \cs{tabularnewline}} +% \changes{v3.14}{1995/04/25} +% {(Mike Van Geest) rename \cs{LT@mc} to +% \cs{LT@mcol} to allow 1100 tables} +% \changes{v4.01}{1996/04/11} +% {(DPC) don't need multicolumn warning} +%\begin{verbatim} +% \global\let\LT@mcw@rn\relax +%\end{verbatim} +% \begin{macrocode} + \let\LT@mcol\multicolumn +% \end{macrocode} +% \changes{v3.17}{1996/01/31} +% {Reset \cs{hline} and \cs{multicolumn} in nested tabular +% and array, for tools/2068} +% Now redefine "\@tabarray" to restore "\hline" and "\multicolumn" so +% that arrays and tabulars nested in longtable (or in page headings on +% longtable pages) work out OK. Saving the original definitions done +% here so that you can load the \package{array} package before or after +% \package{longtable}. +% \begin{macrocode} + \let\LT@@tabarray\@tabarray + \let\LT@@hl\hline + \def\@tabarray{% + \let\hline\LT@@hl +% \end{macrocode} +%\begin{verbatim} +% \let\multicolumn\LT@mcol +%\end{verbatim} +% \begin{macrocode} + \LT@@tabarray}% + \let\\\LT@tabularcr\let\tabularnewline\\% + \def\newpage{\noalign{\break}}% +% \end{macrocode} +% \changes{v4.05}{1996/11/12} +% {\cs{nopagebreak} and \cs{pagebreak} added} +% More or less standard definitions, but first start a "\noalign". +% \begin{macrocode} + \def\pagebreak{\noalign{\ifnum`}=0\fi\@testopt{\LT@no@pgbk-}4}% + \def\nopagebreak{\noalign{\ifnum`}=0\fi\@testopt\LT@no@pgbk4}% +% \end{macrocode} +% +% \begin{macrocode} + \let\hline\LT@hline \let\kill\LT@kill\let\caption\LT@caption + \@tempdima\ht\strutbox +% \end{macrocode} +% +% \changes{v4.08}{1998/01/20} +% {Move \cs{@endpbox} definition earlier and define \cs{@@endpbox} +% and \cs{@@startpbox} for non-array case. tools/2736} +% \begin{macrocode} + \let\@endpbox\LT@endpbox +% \end{macrocode} +% Set up internal commands according to Lamport or Mittelbach. +% \begin{macrocode} + \ifx\extrarowheight\@undefined +% \end{macrocode} +% Initialise these commands as in \env{tabular} from the \LaTeX\ kernel. +% \begin{macrocode} + \let\@acol\@tabacol + \let\@classz\@tabclassz \let\@classiv\@tabclassiv + \def\@startpbox{\vtop\LT@startpbox}% + \let\@@startpbox\@startpbox + \let\@@endpbox\@endpbox + \let\LT@LL@FM@cr\@tabularcr + \else +% \end{macrocode} +% Initialise these commands as in \package{array}. "\d@llar" +% replaced by "\d@llarbegin" "\d@llarend" in V3.03 to match +% \package{array} V2.0h. We do not need to set "\d@llarbegin" and +% "\d@llarend" as the \package{array} package gives them the correct +% values at the top level. +% \begin{macrocode} + \advance\@tempdima\extrarowheight + \col@sep\tabcolsep + \let\@startpbox\LT@startpbox\let\LT@LL@FM@cr\@arraycr + \fi +% \end{macrocode} +% The rest of this macro is mainly based on \package{array} package, but +% should work for the standard \env{tabular} too. +% \begin{macrocode} + \setbox\@arstrutbox\hbox{\vrule + \@height \arraystretch \@tempdima + \@depth \arraystretch \dp \strutbox + \@width \z@}% + \let\@sharp##\let\protect\relax +% \end{macrocode} +% Interpret the preamble argument. +% \begin{macrocode} + \begingroup + \@mkpream{#2}% +% \end{macrocode} +% We need to rename "\@preamble" here as F.M.'s scheme uses +% "\global", and we may need to nest "\@mkpream", eg for +% "\multicolumn" +% or an \env{array}. +% We do not need to worry about nested \env{longtable}s though! +% \begin{macrocode} + \xdef\LT@bchunk{% +% \end{macrocode} +% \changes{v4.00}{1996/04/08} +% {(DK) Increment Chunk counter} +% \begin{macrocode} + \global\advance\c@LT@chunks\@ne + \global\LT@rows\z@\setbox\z@\vbox\bgroup +% \end{macrocode} +% \changes{v4.05}{1996/11/12} +% {\cs{LT@setprevdepth} added} +% The following line was added in v4.05. +% In order to get the "\penalties" to work at chunk boundaries +% Need to take more care about where and when "\lineskip" glue +% is added. The following does nothing at top of table, and in +% header chunks, but in normal body chunks it sets "\prevdepth" +% (to 0pt, but any value would do) so that "\lineskip" glue will +% be added. the important thing to note is that the glue will be +% added \emph{after} any vertical material coming from "\noalign". +% \begin{macrocode} + \LT@setprevdepth +% \end{macrocode} +% +% \changes{v4.10}{2000/10/22} +% {\cs{noexpand} added (as in array.sty) for mathtext.sty, CAR} +% \begin{macrocode} + \tabskip\LTleft \noexpand\halign to\hsize\bgroup +% \tabskip\LTleft\halign to\hsize\bgroup + \tabskip\z@ \@arstrut \@preamble \tabskip\LTright \cr}% + \endgroup +% \end{macrocode} +% Find out how many columns we have (store in "\LT@cols"). +% \begin{macrocode} + \expandafter\LT@nofcols\LT@bchunk&\LT@nofcols +% \end{macrocode} +% Get the saved row from "\LT@i"\ldots"\LT@ix" (from the +% ".aux" file), or make a new blank row. +% \begin{macrocode} + \LT@make@row +% \end{macrocode} +% A few more internal commands for \env{longtable}. +% \begin{macrocode} + \m@th\let\par\@empty + \everycr{}\lineskip\z@\baselineskip\z@ +% \end{macrocode} +% Start the first chunk. +% \begin{macrocode} + \LT@bchunk} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@no@pgbk} +% \changes{v4.05}{1996/11/12} +% {Macro added} +% Can simplify the standard "\@no@pgbk" as this is vmode only +% but then need to close the "\noalign". +% \begin{macrocode} +\def\LT@no@pgbk#1[#2]{\penalty #1\@getpen{#2}\ifnum`{=0\fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@start} +% This macro starts the process of putting the table on the current +% page. It is not called until either a "\\" or "\endlongtable" command +% ends a chunk, as we do not know until that point which of the four +% possible head or foot sections have been specified. +% +% It begins by redefining itself, so that the table is only started +% once! Until V3.04, was redefined to "\relax", now use "\endgraf" to +% force the page-breaker to wake up. +% \begin{macrocode} +\def\LT@start{% + \let\LT@start\endgraf + \endgraf\penalty\z@\vskip\LTpre +% \end{macrocode} +% Start a new page if there is not enough room for the table head, foot, +% and one extra line. +% \begin{macrocode} + \dimen@\pagetotal + \advance\dimen@ \ht\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi + \advance\dimen@ \dp\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi + \advance\dimen@ \ht\LT@foot +% \end{macrocode} +% \changes{v3.16}{1995/11/09} +% {Measure the first line of the table} +% At this point I used to add "\ht\@arstrutbox" and "\dp\@arstrutbox" +% as a measure of a row size. However this can fail spectacularly +% for "p" columns which might be much larger. Previous versions could +% end up with the table starting with a foot, then a page break then +% a head \emph{then} a `first head'! So now measure the first line of +% the table accurately by "\vsplit"ting it out of the first chunk. +% \begin{macrocode} + \dimen@ii\vfuzz + \vfuzz\maxdimen + \setbox\tw@\copy\z@ + \setbox\tw@\vsplit\tw@ to \ht\@arstrutbox + \setbox\tw@\vbox{\unvbox\tw@}% + \vfuzz\dimen@ii + \advance\dimen@ \ht + \ifdim\ht\@arstrutbox>\ht\tw@\@arstrutbox\else\tw@\fi + \advance\dimen@\dp + \ifdim\dp\@arstrutbox>\dp\tw@\@arstrutbox\else\tw@\fi +% \end{macrocode} +% +% \begin{macrocode} + \advance\dimen@ -\pagegoal + \ifdim \dimen@>\z@\vfil\break\fi +% \end{macrocode} +% Store height of page minus table foot in "\@colroom". +% \changes{v3.14}{1995/05/02} +% {Set \cs{@colroom}, for tools/1584} +% \begin{macrocode} + \global\@colroom\@colht +% \end{macrocode} +% If the foot is non empty, reduce the "\vsize" and "\@colroom" +% accordingly. +% \begin{macrocode} + \ifvoid\LT@foot\else + \advance\vsize-\ht\LT@foot + \global\advance\@colroom-\ht\LT@foot + \dimen@\pagegoal\advance\dimen@-\ht\LT@foot\pagegoal\dimen@ + \maxdepth\z@ + \fi +% \end{macrocode} +% Put the table head on the page, and then switch to the new output +% routine. +% \changes{v4.11}{2004/02/01} +% {\cs{nobreak}, for tools/3484} +% \begin{macrocode} + \ifvoid\LT@firsthead\copy\LT@head\else\box\LT@firsthead\fi\nobreak + \output{\LT@output}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endlongtable} +% Called by "\end{longtable}". +% \begin{macrocode} +\def\endlongtable{% +% \end{macrocode} +% Essentially add a final "\\". But as we now know the number of +% actual chunks, we first strip away all entries referring to a +% maximum entry beyond the table (this can only happen if a table has +% been shortened, or the table numbering has gone awry). In that case +% we at least start collecting valid new information with the last +% chunk of this table, by removing the width constraint. +% \changes{v4.01}{1996/04/11} +% {(DPC) use \cs{noalign} to sneak in \cs{LT@entry@chop}} +% \begin{macrocode} + \crcr + \noalign{% + \let\LT@entry\LT@entry@chop + \xdef\LT@save@row{\LT@save@row}}% + \LT@echunk + \LT@start + \unvbox\z@ + \LT@get@widths +% \end{macrocode} +% Write the dummy row to the ".aux" file. +% Since V3.06, use ".lta" for "letter.sty". +% \changes{v3.12}{1994/06/30} +% {Do not write if \cs{nofiles} in operation.} +% \begin{macrocode} + \if@filesw + {\let\LT@entry\LT@entry@write\immediate\write\@auxout{% +% \end{macrocode} +% Since Version 3.02, \package{longtable} has used the internal counter +% "\c@LT@tables" rather than the \LaTeX\ counter \textsf{table}. This +% information looks entirely different from version~3 +% information. Still, we don't need to rename the macro name because +% later code will consider the information to have no columns, and +% thus will throw the old data away. +% \begin{macrocode} + \gdef\expandafter\noexpand + \csname LT@\romannumeral\c@LT@tables\endcsname + {\LT@save@row}}}% + \fi +% \end{macrocode} +% At this point used to +% issue a warning if a "\multicolumn" has been set in draft mode. +% \changes{v4.01}{1996/04/11} +% {(DPC) No need for multicolumn warnings} +%\begin{verbatim} +% \LT@mcw@rn +%\end{verbatim} +% If the last chunk has different widths than the first, warn the user. +% Also trigger a warning to rerun \LaTeX\ at the end of the document. +% \changes{v4.04}{1996/05/24} +% {Use \cs{LT@final@warn}} +% \begin{macrocode} + \ifx\LT@save@row\LT@@save@row + \else + \LT@warn{Column \@width s have changed\MessageBreak + in table \thetable}% + \LT@final@warn + \fi +% \end{macrocode} +% Force one more go with the \env{longtable} output routine. +% \begin{macrocode} + \endgraf\penalty -\LT@end@pen +% \end{macrocode} +% Now close the group to return to the standard routine. +% \begin{macrocode} + \endgroup +% \end{macrocode} +% Reset "\@mparbottom" to allow marginpars close to the end of the +% table.\footnote{This can not be the correct. However if it is omitted, +% there is a problem with marginpars, for example on page~3 of this +% document. Any Output Routine Gurus out there?} +% \begin{macrocode} + \global\@mparbottom\z@ + \pagegoal\vsize + \endgraf\penalty\z@\addvspace\LTpost +% \end{macrocode} +% Footnotes. As done in the \package{multicol} package. +% \begin{macrocode} + \ifvoid\footins\else\insert\footins{}\fi} +% \end{macrocode} +% \end{macro} +% +% \subsection{Counting Columns} +% +% Columns are counted by examining "\@preamble", rather than simply +% getting "\@mkpream" to increment the counter as it builds the +% preamble so that this package works with many of the packages which +% add extra column specifiers to \LaTeX's standard ones. +% +% Version~1 counted "\@sharp"'s to calculate the number of columns, +% this was changed for Version~2 as it does not work with the NFSS. Now +% count "&"'s. ("lfonts.new" (and now the Standard \LaTeX\ definition) +% defines "\@tabclassz" so that "\@sharp" is inside a group.) +% +% \begin{macro}{\LT@nofcols} +% Find the next "&", then look ahead to see what is next. +% \begin{macrocode} +\def\LT@nofcols#1&{% + \futurelet\@let@token\LT@n@fcols} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@n@fcols} +% Add one, then stop at an "\LT@nofcols" or look for the next +% "&". The "\expandafter" trick was added in Version~3, also the +% name changed from "\@LT@nofcols" to preserve the "\LT@" naming +% convention. +% \begin{macrocode} +\def\LT@n@fcols{% + \advance\LT@cols\@ne + \ifx\@let@token\LT@nofcols + \expandafter\@gobble + \else + \expandafter\LT@nofcols + \fi} +% \end{macrocode} +% \end{macro} +% +% \subsection{The {\ttfamily\bslash\bslash} and \cs{kill} Commands} +% +% \begin{macro}{\LT@tabularcr} +% \changes{v4.05}{1996/11/12} +% {Code re-organised for the *-form processing.} +% The internal definition of "\\". +% In the "*" form, insert a "\nobreak" after the next "\cr" (or "\crcr"). +% +% This star form processing was finally added in v4.05. For the previous +% six or seven years the comment at this point said +% \begin{quote}\small +% This definition also accepts "\\*", which acts in the same way as +% "\\". \env{tabular} does this, but \env{longtable} probably ought to +% make "\\*" prevent page breaking. +% \end{quote} +% +% "{\ifnum0=`}\fi" added in version 3.01, required if the first entry +% is empty. +% The above in fact is not good enough, as with \package{array} package +% it can introduce a "{}" group in math mode, which changes the spacing. +% So use the following variant. Added in v3.14. +% \changes{v3.14}{1995/04/25} +% {More fun with \cs{ifnum} cf tools/1571} +% \begin{macrocode} +\def\LT@tabularcr{% + \relax\iffalse{\fi\ifnum0=`}\fi + \@ifstar + {\def\crcr{\LT@crcr\noalign{\nobreak}}\let\cr\crcr + \LT@t@bularcr}% + {\LT@t@bularcr}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@crcr} +% \changes{v4.05}{1996/11/12} +% {Macro added} +% \begin{macrocode} +\let\LT@crcr\crcr +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@setprevdepth} +% \changes{v4.05}{1996/11/12} +% {Macro added} +% This will be redefined to set the "\prevdepth" +% at the start of a chunk. +% \begin{macrocode} +\let\LT@setprevdepth\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@t@bularcr} +% \begin{macrocode} +\def\LT@t@bularcr{% +% \end{macrocode} +% Increment the counter, and do \env{tabular}'s "\\" or finish the +% chunk.\\ The "\expandafter" trick was added in Version~3. +% Set the "\prevdepth" at the start of a new chunk. (Done here +% so not set in header chunks). +% \begin{macrocode} + \global\advance\LT@rows\@ne + \ifnum\LT@rows=\LTchunksize + \gdef\LT@setprevdepth{% + \prevdepth\z@\global + \global\let\LT@setprevdepth\relax}% + \expandafter\LT@xtabularcr + \else + \ifnum0=`{}\fi + \expandafter\LT@LL@FM@cr + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@xtabularcr} +% This just looks for an optional argument. +% \begin{macrocode} +\def\LT@xtabularcr{% + \@ifnextchar[\LT@argtabularcr\LT@ntabularcr} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@ntabularcr} +% The version with no optional argument. +% "\ifnum0=`{\fi}" added in version 3.01. Changed in 3.14. +% \begin{macrocode} +\def\LT@ntabularcr{% + \ifnum0=`{}\fi + \LT@echunk + \LT@start + \unvbox\z@ + \LT@get@widths + \LT@bchunk} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@argtabularcr} +% The version with an optional argument. +% "\ifnum0=`{\fi}" added in version 3.01. Changed in 3.14. +% \begin{macrocode} +\def\LT@argtabularcr[#1]{% + \ifnum0=`{}\fi + \ifdim #1>\z@ + \unskip\@xargarraycr{#1}% + \else + \@yargarraycr{#1}% + \fi +% \end{macrocode} +% Add the dummy row, and finish the "\halign". +% \begin{macrocode} + \LT@echunk + \LT@start + \unvbox\z@ + \LT@get@widths + \LT@bchunk} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@echunk} +% \changes{v4.05}{1996/11/12} +% {\cs{unskip} added for pagebreak support} +% This ends the current chunk, and removes the dummy row. +% \begin{macrocode} +\def\LT@echunk{% + \crcr\LT@save@row\cr\egroup + \global\setbox\@ne\lastbox +% \end{macrocode} +% The following line was added in v4.05. +% \package{longtable} relies on "\lineskip" glue (which is 0pt) to +% provide break points between each row so the table may be split +% into pages. +% +% Previous releases left the "\lineskip" glue at the end of each chunk +% that had been added when the dummy row was added. There was no glue +% at the start of the next chunk as \TeX\ normally does not put +% "\lineskip" glue at the top of a box. This meant that normally the +% chunks fitted together perfectly, however "\noalign" material at a +% chunk boundary came before the first row of the next chunk +% but after the lineskip glue at the end of this chunk. This is the +% wrong place, e.g., it means even a "\penalty10000" does not stop a +% break as the "\lineskip" glue in the previous item on the list +% provides a legal breakpoint. So now remove the "\lineskip" glue that +% was before the dummy row and introduce "\LT@setprevdepth" to set the +% "\prevdepth" at the start of the next chunk, to make sure "\lineskip" +% glue is added later. +% \begin{macrocode} + \unskip + \egroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@entry} +% \changes{v4.00}{1996/04/08} +% {(DK) Macro added} +% \changes{v4.01}{1996/04/11} +% {(DPC) Use \cs{ifhmode} trick to determine first entry} +% We here give the `basic' definition of "\LT@entry", namely that used +% in alignment templates. It has a "\kern" only if the maximum is +% imposed from a different chunk. +% The "\ifhmode" test reveals the first entry, when we don't want to add +% an "&". +% \begin{macrocode} +\def\LT@entry#1#2{% + \ifhmode\@firstofone{&}\fi\omit + \ifnum#1=\c@LT@chunks + \else + \kern#2\relax + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@entry@chop} +% \changes{v4.00}{1996/04/08} +% {(DK) Macro added} +% This definition for the argument of "\LT@save@row" is used to scrap +% all those maxima which could not be verified because they occur +% after the end of the table. This can happen only if a table has been +% shortened (or the sequencing got mixed up) since the +% previous run. +% Note that this is premature: the last chunk still is going to be +% set, and with the chopped limits. +% \begin{macrocode} +\def\LT@entry@chop#1#2{% + \noexpand\LT@entry + {\ifnum#1>\c@LT@chunks + 1}{0pt% + \else + #1}{#2% + \fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@entry@write} +% \changes{v4.07}{1997/10/16} +% {Avoid use of percent. tools/2631} +% To write an entry for the "aux" file, we use a slightly +% surprising definition which has the sole purpose of avoiding +% overfull lines (which might break \TeX{}'s limits when reading the +% "aux" file, probably you'd need to have a few hundred columns before +% this happened but\ldots). +% \begin{macrocode} +\def\LT@entry@write{% + \noexpand\LT@entry^^J% + \@spaces} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@kill} +% This ends the current chunk as above, but strips off two rows, the +% `dummy row' and the `killed row' before starting the next chunk. +% Since V3.04, the old chunk is reboxed at the start of the box +% containing the next chunk. This allows "\kill" to be used in headers, +% which must be processed in a single box. +% \begin{macrocode} +\def\LT@kill{% + \LT@echunk + \LT@get@widths + \expandafter\LT@rebox\LT@bchunk} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@rebox} +% Drop the old chunk (box0) back at the top of the new chunk, removing +% the killed row. This macro added at V3.04. +% \begin{macrocode} +\def\LT@rebox#1\bgroup{% + #1\bgroup + \unvbox\z@ + \unskip + \setbox\z@\lastbox} +% \end{macrocode} +% \end{macro} +% +% \subsection{The Dummy Row} +% +% The dummy row is kept inside of the macro "\LT@save@row". +% +% \begin{macro}{\LT@blank@row} +% \begin{macro}{\LT@build@blank} +% \changes{v4.00}{1996/04/08} +% {(DK) Macro added} +% \changes{v4.01}{1996/04/11} +% {(DPC) Don't mess with \cs{multicolumn} on draft passes} +% Create a blank row if we are not using the info in the ".aux" file. +% \begin{macrocode} +\def\LT@blank@row{% + \xdef\LT@save@row{\expandafter\LT@build@blank + \romannumeral\number\LT@cols 001 }} +% \end{macrocode} +% Whoops! What's that supposed to be? A drop-in replacement for the +% first task of Appendix~D in the \TeX book. The "\romannumeral" +% produces "\LT@cols" instances of "m" followed by "i". The below +% macro then replaces the "m"s by appropriate entries. +% \begin{macrocode} +\def\LT@build@blank#1{% + \if#1m% + \noexpand\LT@entry{1}{0pt}% + \expandafter\LT@build@blank + \fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\LT@make@row} +% \changes{v4.00}{1996/04/08} +% {(DK) New implementation} +% \changes{v4.01}{1996/04/11} +% {(DPC) Make this the default behaviour, not needing +% \cs{setlongtables}} +% +% Prior to version 4, by default did not use information in the +% ".aux" file but now we can define "\LT@make@row" to use the ".aux" +% file, even on the `draft' passes. +% \begin{macrocode} +\def\LT@make@row{% + \global\expandafter\let\expandafter\LT@save@row + \csname LT@\romannumeral\c@LT@tables\endcsname + \ifx\LT@save@row\relax + \LT@blank@row +% \end{macrocode} +% Now a slightly difficult part comes. Before we decide making the +% template from the ".aux" file info we check that the number of +% fields has remained the same. If it hasn't, either the table format +% has changed, or we have the wrong table altogether. In both cases, +% we decide to better drop all gathered information and start over. +% \changes{v4.01}{1996/04/11} +% {(DPC) Use \cs{if} test rather than \cs{ifx}\cs{@empty}} +% +% The expansion between "!"\ldots"!" below will be empty if the number +% of "\LT@entry" macros +% including arguments in "\LT@save@row" is equal to "\LT@cols". If it +% is not empty, we throw the row away and start from scratch. +% \begin{macrocode} + \else + {\let\LT@entry\or + \if!% + \ifcase\expandafter\expandafter\expandafter\LT@cols + \expandafter\@gobble\LT@save@row + \or + \else + \relax + \fi + !% + \else + \aftergroup\LT@blank@row + \fi}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setlongtables} +% Redefine "\LT@make@row" to use information in the ".aux" file, +% if there is a saved row for this table with the right number of +% columns. +% +% Since Version 3.02, \package{longtable} has used the internal counter +% "\c@LT@tables" rather than the \LaTeX\ counter \textsf{table}. +% The warning message was added at V3.04, as was the "\global", to stop +% save-stack overflow. +% +% Since Version 4.01 "\setlongtables" does nothing as it is not +% needed, but is defined as "\relax" for the benefit of old documents. +% \changes{v3.12}{1994/06/30} +% {Warning altered to fit line on terminal.} +% \changes{v4.01}{1996/04/11} +% {(DPC) make into no op} +% \begin{macrocode} +\let\setlongtables\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@get@widths} +% This is the heart of \package{longtable}. If it were not for the table +% head and foot, this macro together with the modified "\\" command +% would form the basis of quite a simple little package file for long +% tables. It is closely modelled on the "\endvrulealign" macro of +% appendix D of the \TeX book. +% \begin{macrocode} +\def\LT@get@widths{% +% \end{macrocode} +% "\global" added at V3.04, to stop save-stack overflow. +% \begin{macrocode} +% \end{macrocode} +% Loop through the last row, discarding glue, and saving box widths. At +% V3.04 changed the scratch box to 2, as the new "\kill" requires that +% "\box0" be preserved. +% \begin{macrocode} + \setbox\tw@\hbox{% + \unhbox\@ne + \let\LT@old@row\LT@save@row + \global\let\LT@save@row\@empty + \count@\LT@cols + \loop + \unskip + \setbox\tw@\lastbox + \ifhbox\tw@ + \LT@def@row + \advance\count@\m@ne + \repeat}% +% \end{macrocode} +% Remember the widths if we are in the first chunk. +% \begin{macrocode} + \ifx\LT@@save@row\@undefined + \let\LT@@save@row\LT@save@row + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@def@row} +% \changes{v4.00}{1996/04/08} +% {(DK) New implementation} +% Add a column to the dummy row. Name changed from "\defLT@save@row" +% in Version~3, to preserve the "\LT@" naming convention. +% \begin{macrocode} +\def\LT@def@row{% +% \end{macrocode} +% We start by picking the respective entry from our old row. +% These redefinitions of "\LT@entry" are local to the group started +% in "\LT@get@widths". +% \begin{macrocode} + \let\LT@entry\or + \edef\@tempa{% + \ifcase\expandafter\count@\LT@old@row + \else + {1}{0pt}% + \fi}% +% \end{macrocode} +% Now we tack the right combination in front of "\LT@save@row": +% \begin{macrocode} + \let\LT@entry\relax + \xdef\LT@save@row{% + \LT@entry + \expandafter\LT@max@sel\@tempa + \LT@save@row}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@max@sel} +% \changes{v4.00}{1996/04/08} +% {(DK) macro added} +% \changes{v4.01}{1996/04/11} +% {(DPC) minor modifications} +% And this is how to select the right combination. Note that we take +% the old maximum information only if the size does not change in +% \emph{either} direction. If the size has grown, we of course have a +% new maximum. If the size has shrunk, the old maximum (which was +% explicitly not enforced because of being in the current chunk) is +% invalid, and we start with this chunk as the new size. Note that +% even in the case of equality we \emph{must} use the "\the\wd\tw@" +% construct instead of "#2" because "#2" might be read in from the +% file, and so could have "\catcode"~11 versions of "p" and~"t" in~it +% which we want to be replaced by their `proper' "\catcode"~12 versions. +% \begin{macrocode} +\def\LT@max@sel#1#2{% + {\ifdim#2=\wd\tw@ + #1% + \else + \number\c@LT@chunks + \fi}% + {\the\wd\tw@}} +% \end{macrocode} +% \end{macro} +% +% \subsection{The \cs{hline} Command} +% +% \begin{macro}{\LT@hline} +% "\hline" and "\hline\hline" both produce \emph{two} lines. +% The only difference being the glue and penalties between them. +% This is so that a page break at a "\hline" produces a line on both +% pages.\footnote +% {\env{longtable} has always done this, but perhaps it would be +% better if hlines were \emph{omitted} at a page break, as the head and +% foot usually put a hline here anyway.} +% Also this "\hline" is more like a "\cline{1-\LT@cols}". +% \env{tabular}'s "\hline" would draw lines the full width of the page. +% \begin{macrocode} +\def\LT@hline{% + \noalign{\ifnum0=`}\fi + \penalty\@M + \futurelet\@let@token\LT@@hline} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@@hline} +% This code is based on "\cline". Two copies of the line are produced, +% as described above. +% \begin{macrocode} +\def\LT@@hline{% + \ifx\@let@token\hline + \global\let\@gtempa\@gobble + \gdef\LT@sep{\penalty-\@medpenalty\vskip\doublerulesep}% + \else + \global\let\@gtempa\@empty + \gdef\LT@sep{\penalty-\@lowpenalty\vskip-\arrayrulewidth}% + \fi + \ifnum0=`{\fi}% + \multispan\LT@cols + \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr + \noalign{\LT@sep}% + \multispan\LT@cols + \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr + \noalign{\penalty\@M}% + \@gtempa} +% \end{macrocode} +% \end{macro} +% +% \subsection{Captions} +% +% \begin{macro}{\LT@caption} +% The caption is "\multicolumn{\LT@cols}{c}{"\meta{a parbox with the +% table's caption}"}" +% \begin{macrocode} +\def\LT@caption{% + \noalign\bgroup + \@ifnextchar[{\egroup\LT@c@ption\@firstofone}\LT@capti@n} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@c@ption} +% Caption command (with [optional argument]). "\protect" added in +% Version~3. "\fnum@table" added at V3.05. +% \changes{v3.14}{1995/05/02} +% {Call \cs{LT@makecaption} not \cs{LT@mkcaption}} +% \changes{v3.14}{1995/05/24} +% {Add new control argument} +% \begin{macrocode} +\def\LT@c@ption#1[#2]#3{% + \LT@makecaption#1\fnum@table{#3}% + \def\@tempa{#2}% + \ifx\@tempa\@empty\else + {\let\\\space + \addcontentsline{lot}{table}{\protect\numberline{\thetable}{#2}}}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@capti@n} +% Caption command (no [optional argument]) +% \changes{v3.14}{1995/05/02} +% {Call \cs{LT@makecaptionx} not \cs{LT@mkcaption}} +% \changes{v3.14}{1995/05/24} +% {Call \cs{LT@makecaption} with \cs{@gobble} or \cs{@firstofone}} +% \begin{macrocode} +\def\LT@capti@n{% + \@ifstar + {\egroup\LT@c@ption\@gobble[]}% + {\egroup\@xdblarg{\LT@c@ption\@firstofone}}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\LT@makecaption} +% Put the caption in a box of width 0pt, so that it never affects the +% column widths. Inside that is a "\parbox" of width +% "\LTcapwidth". +% \changes{v3.14}{1995/05/02} +% {Renamed from \cs{LT@mkcaption}, +% and modified to call \cs{@makecaption}} +% \changes{v3.14}{1995/05/02} +% {Use the first arg to remove counter for star form} +% \begin{macrocode} +\def\LT@makecaption#1#2#3{% + \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{% +% \end{macrocode} +% Based on article class "\@makecaption", "#1" is "\@gobble" in star +% form, and "\@firstofone" otherwise. +% \begin{macrocode} + \sbox\@tempboxa{#1{#2: }#3}% + \ifdim\wd\@tempboxa>\hsize + #1{#2: }#3% + \else + \hbox to\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \endgraf\vskip\baselineskip}% + \hss}}} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{The Output Routine} +% +% The method used here for interfacing a special purpose output routine +% to the standard \LaTeX\ routine is lifted straight out of +% F.~Mittelbach's \package{multicol} package. +% +% \begin{macro}{\LT@output} +% Actually this is not so bad, with FM leading the way. +% \begin{macrocode} +\def\LT@output{% + \ifnum\outputpenalty <-\@Mi + \ifnum\outputpenalty > -\LT@end@pen +% \end{macrocode} +% If this was a float or a marginpar we complain. +% \begin{macrocode} + \LT@err{floats and marginpars not allowed in a longtable}\@ehc + \else +% \end{macrocode} +% We have reached the end of the table, on the scroll at least, +% \begin{macrocode} + \setbox\z@\vbox{\unvbox\@cclv}% + \ifdim \ht\LT@lastfoot>\ht\LT@foot +% \end{macrocode} +% The last foot might not fit, so:\footnote{An alternative would be to +% vsplit off a bit of the last chunk, so that the last page did not just +% have head and foot sections, but it is hard to do this in a consistent +% manner.} +% \begin{macrocode} + \dimen@\pagegoal + \advance\dimen@-\ht\LT@lastfoot + \ifdim\dimen@<\ht\z@ + \setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot\vss}% + \@makecol + \@outputpage + \setbox\z@\vbox{\box\LT@head}% +% \end{macrocode} +% End of "\ifdim\dimen@<\ht\@cclc". +% \begin{macrocode} + \fi +% \end{macrocode} +% End of "\ifdim \ht\LT@lastfoot > \ht\LT@foot". +% \begin{macrocode} + \fi +% \end{macrocode} +% Reset "\@colroom". +% \changes{v3.14}{1995/05/02} +% {Reset \cs{@colroom}, for tools/1584} +% \begin{macrocode} + \global\@colroom\@colht + \global\vsize\@colht +% \end{macrocode} +% Put the last page of the table on to the main vertical list. +% \begin{macrocode} + \vbox + {\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}% +% \end{macrocode} +% End of "\ifnum\outputpenalty > -\LT@end@pen". +% \begin{macrocode} + \fi +% \end{macrocode} +% Else "\outputpenalty > -\@Mi". +% \begin{macrocode} + \else +% \end{macrocode} +% If we have not reached the end of the table, +% \begin{macrocode} + \setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot\vss}% + \@makecol + \@outputpage +% \end{macrocode} +% Reset "\vsize". +% \changes{v3.14}{1995/05/02} +% {Reset \cs{vsize}, for tools/1584} +% \begin{macrocode} + \global\vsize\@colroom +% \end{macrocode} +% Put the head at the top of the next page. +% \changes{v4.11}{2004/02/01} +% {\cs{nobreak}, for tools/3484} +% \begin{macrocode} + \copy\LT@head\nobreak +% \end{macrocode} +% End of "\ifnum\outputpenalty <-\@Mi". +% \begin{macrocode} + \fi} +% \end{macrocode} +% \end{macro} +% +% \subsection{Commands for the the table head and foot} +% +% \begin{macro}{\LT@end@hd@ft} +% The core of "\endhead" and friends. Store the current chunk in the +% box specified by "#1". Issue an error if the table has already +% started. Then start a new chunk. +% \begin{macrocode} +\def\LT@end@hd@ft#1{% + \LT@echunk +% \end{macrocode} +% Changed from "\relax" to "\endgraf" at V3.04, see "\LT@start". +% \begin{macrocode} + \ifx\LT@start\endgraf + \LT@err + {Longtable head or foot not at start of table}% + {Increase LTchunksize}% + \fi + \setbox#1\box\z@ + \LT@get@widths + \LT@bchunk} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endfirsthead} +% \begin{macro}{\endhead} +% \begin{macro}{\endfoot} +% \begin{macro}{\endlastfoot} +% Call "\LT@end@hd@ft" with the appropriate box. +% \begin{macrocode} +\def\endfirsthead{\LT@end@hd@ft\LT@firsthead} +\def\endhead{\LT@end@hd@ft\LT@head} +\def\endfoot{\LT@end@hd@ft\LT@foot} +\def\endlastfoot{\LT@end@hd@ft\LT@lastfoot} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{The \cs{multicolumn} command} +% +% Earlier versions needed a special `draft' form of "\multicolumn". +% This is not needed in version~4, and so these commands have been +% removed. +% +% \begin{macro}{\LTmulticolumn} +% \changes{v4.01}{1996/04/11} +% {(DPC) macro removed} +% \end{macro} +% +% \begin{macro}{\LT@mcwarn} +% \changes{v4.01}{1996/04/11} +% {(DPC) macro removed} +% \end{macro} +% +% \subsection{Footnotes} +% +% The standard "\footnote" command works in a "c" column, but we +% need to modify the definition in a "p" column to overcome the +% extra level of boxing. These macros are based on the \package{array} +% package, but should be OK for the standard \env{tabular}. +% +% \begin{macro}{\LT@startpbox} +% \changes{v4.09}{1998/05/13} +% {Use \cs{setlength}, so that calc extensions apply. tools/2793} +% Add extra code to switch the definition of "\@footnotetext". +% \begin{macrocode} +\def\LT@startpbox#1{% + \bgroup +% \end{macrocode} +% \changes{v4.12}{2019/02/06}{Color group to match array package} +% \begin{macrocode} + \color@begingroup + \let\@footnotetext\LT@p@ftntext + \setlength\hsize{#1}% + \@arrayparboxrestore + \vrule \@height \ht\@arstrutbox \@width \z@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@endpbox} +% After the parbox is closed, expand "\LT@p@ftn" which will execute a +% series of\\ +% "\footnotetext["\meta{num}"]{"\meta{note}"}"\\ +% commands. After being lifted out of the parbox, they can migrate on +% their own from here. +% \changes{v3.10}{1994/05/15} +% {Use \cs{@finalstrut}} +% \changes{v4.03}{1996/05/07} +% {Use \cs{hfil} for tools/2120} +% \begin{macrocode} +\def\LT@endpbox{% + \@finalstrut\@arstrutbox +% \end{macrocode} +% \changes{v4.12}{2019/02/06}{Color group to match array package} +% \begin{macrocode} + \color@endgroup + \egroup + \the\LT@p@ftn + \global\LT@p@ftn{}% + \hfil} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LT@p@ftntext} +% Inside the `p' column, just save up the footnote text in a token +% register. +% \begin{macrocode} +\def\LT@p@ftntext#1{% + \edef\@tempa{\the\LT@p@ftn\noexpand\footnotetext[\the\c@footnote]}% + \global\LT@p@ftn\expandafter{\@tempa{#1}}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +\endinput + diff --git a/Master/texmf-dist/source/latex-dev/tools/longtable.ins b/Master/texmf-dist/source/latex-dev/tools/longtable.ins new file mode 100644 index 00000000000..1fc3c12dfaa --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/longtable.ins @@ -0,0 +1,75 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright (C) 1993-2019 +%% The LaTeX3 Project and any individual authors listed elsewhere +%% in this file. +%% +%% This file is part of the Standard LaTeX `Tools Bundle'. +%% ------------------------------------------------------- +%% +%% It may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% As this file contains legal notices, it is NOT PERMITTED to modify +%% this file in any way that the legal information placed into +%% generated files is changed (i.e., the files generated when the +%% original file is executed). This restriction does not apply if +%% (parts of) the content is reused in a different WORK producing its +%% own generated files. +%% +%% The list of all files belonging to the `Tools Bundle' is +%% given in the file `manifest.txt'. +%% +%% +%% --------------- start of docstrip commands ------------------ +%% +\input docstrip + +\keepsilent + +\usedir{tex/latex/tools} + +\preamble + +This is a generated file. + +The source is maintained by the LaTeX Project team and bug +reports for it can be opened at https://latex-project.org/bugs/ +(but please observe conditions on bug reports sent to that address!) + +Copyright (C) 1993-2019 +The LaTeX3 Project and any individual authors listed elsewhere +in this file. + +This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. +-------------------------------------------------------------------------- + +It may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This file may only be distributed together with a copy of the LaTeX +`Tools Bundle'. You may however distribute the LaTeX `Tools Bundle' +without such generated files. + +The list of all files belonging to the LaTeX `Tools Bundle' is +given in the file `manifest.txt'. + +\endpreamble + + +\generate{\file{longtable.sty}{\from{longtable.dtx}{package}}} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex-dev/tools/multicol.dtx b/Master/texmf-dist/source/latex-dev/tools/multicol.dtx new file mode 100644 index 00000000000..d68f471fcd4 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/multicol.dtx @@ -0,0 +1,4450 @@ +% \iffalse meta-comment +% +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% +% \iffalse This is a METACOMMENT +% +%% Package `multicol' to use with LaTeX2e +%% Copyright 1989-2019 Frank Mittelbach +%% +%% In addition to the terms of LPPL any distributed version +%% (unchanged or modified) of multicol has to keep the statement +%% about the moral obligation for using multicol. In case of major +%% changes where this would not be appropriate the author of the +%% changed version should contact the copyright holder. +%% +%% +%% Moral obligation for using multicol: +%% ------------------------------------ +%% +%% Users of multicol who wish to include or use multicol or a modified +%% version in a proprietary and commercially market product are asked +%% under certain conditions (see below) for the payment of a license +%% fee. The size of this fee is to be determined, in each instance, +%% by the commercial user, depending on his/her judgment of the value of +%% multicol for his/her product. +%% +%% +%% The conditions for this are as follows: +%% +%% The producer of a proprietary and commercially market product +%% that involves typesetting using multicol is asked to determine +%% the value of a license fee for using multicol if +%% +%% - the product is a document and the producer has decided to +%% include multicol to typeset (parts of) the document or has +%% directed the author of the document to include multicol (for +%% example, by providing a class file to be used by the author) +%% +%% - the product is a LaTeX class or package that includes multicol +%% +%% +%% There is no moral obligation in case +%% +%% - the product is a document but producer has not directed +%% the author to include multicol (in that case the moral obligation +%% lies with the author of the document) +%% +%% - the product does not involve typesetting, e.g., consists, for +%% example, of distributing multicol and its documentation. +%% +%% - the product is not proprietary, i.e., is made available as free +%% software itself (which doesn't prohibit its commercial marketing) +%% +%% - multicol is used for non-commercial purposes +%% +%% +%% Determining a license fee might result in a license fee of zero +%% (i.e., no payment) in case a producer has determined that the use +%% of multicol has no enhancing effect on the product. This is a +%% plausible scenario, i.e., in the above two cases the producer is +%% only asked to evaluate the value of multicol for the product +%% not for the payment of a license fee per se (which might or might +%% not follow from this evaluation). +%% +%% The license fee, if any, can be payed either to the LaTeX3 fund +%% (see ltx3info.txt in the base LaTeX distribution) or to the author of +%% the program who can be contacted at +%% +%% Frank.Mittelbach@latex-project.org +%% +%<*dtx> + \ProvidesFile{multicol.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e}[2018-04-01] +%<package> +%<package>\providecommand\DeclareRelease[3]{} +%<package>\providecommand\DeclareCurrentRelease[2]{} +%<package> +%<package>\DeclareRelease{}{2017-04-11}{multicol-2017-04-11.sty} +%<package>\DeclareCurrentRelease{}{2018-04-01} +%<package> +%<package>\ProvidesPackage{multicol} +%<driver> \ProvidesFile{multicol.drv} +% \fi +% \ProvidesFile{multicol.dtx} + [2019/03/01 v1.8w multicolumn formatting (FMi)] +% +% +%% +% +% \changes{v1.5n}{1997/06/05}{Applied improvement of documentation, +% kindly done by Robin Fairbairns.} +% \changes{v1.4h}{1992/06/04}{Added mark tracing with +% tracingmulticols$\ge2$} +% \changes{v1.4a}{1992/02/11}{Added support for multicol in inner mode} +% \changes{v1.0d}{1989/05/17}{All lines shortened to 72 or less.} +% \changes{v1.0e}{1989/06/21}{Redefinition of description env. to use +% \cs{descriptionmargin}\quotechar=5pt +% in documentation.} +% \changes{v1.0f}{1989/07/11}{Changed \cs{z@} to 0pt in redefinition of +% description.} +% \changes{v1.1a}{1989/09/20}{\cs{multicolssep} changed to \cs{multicolsep}.} +% +% \def\description{\list{}{\labelwidth 0pt \leftmargin\descriptionmargin +% \itemindent-\leftmargin \let\makelabel\descriptionlabel}} +% \newdimen\descriptionmargin \descriptionmargin=5pt +% +% \DoNotIndex{\@M,\@Mi,\@bsphack,\@cclv,\@colht,\@currlist,\@deferlist} +% \DoNotIndex{\@elt,\@esphack,\@floatplacement} +% \DoNotIndex{\@ifundefined,\@ifnextchar,\@makecol} +% \DoNotIndex{\@ne,\@outputpage,\@scolelt,\@spaces,\@tempb,\@tempcnta} +% \DoNotIndex{\@width} +% \DoNotIndex{\addvspace,\advance,\allowbreak} +% \DoNotIndex{\baselineskip,\begingroup,\box,\columnsep,\copy,\count} +% \DoNotIndex{\count@,\def,\dimen@,\divide,\docdate} +% \DoNotIndex{\edef,\eject,\egroup,\else,\endgroup,\endinput} +% \DoNotIndex{\fi,\fileversion,\filedate} +% \DoNotIndex{\gdef,\global} +% \DoNotIndex{\hbox,\hfil,\hrule,\ht,\hss} +% \DoNotIndex{\ifdim,\ifnum,\ifvoid,\ignorespaces,\insert,\immediate} +% \DoNotIndex{\let,\loop} +% \DoNotIndex{\maxdepth,\message,\multiply} +% \DoNotIndex{\newbox,\newcount,\newdimen,\newskip,\number,\newpage} +% \DoNotIndex{\outputpenalty,\p@,\penalty} +% \DoNotIndex{\relax,\repeat,\setbox,\skip,\space,\splitmaxdepth} +% \DoNotIndex{\splittopskip,\string,\sixt@@n} +% \DoNotIndex{\the,\thepage,\thr@@,\topskip,\tw@,\typeout} +% \DoNotIndex{\unvbox,\vbox,\vfill,\vsplit,\voidb@x,\vrule} +% \DoNotIndex{\write,\wd} +% \DoNotIndex{\z@} +% +% \MakeShortVerb{\|} +% \newcommand{\mc}{\textsf{multicols}} +% \newcommand{\TUB}{{\sl TUGboat\/}} +% \newcommand{\TB}{{\sl\TeX book\/}} +% +% +% \setcounter{StandardModuleDepth}{2} +% \setcounter{collectmore}{3} +% +% \GetFileInfo{multicol.dtx} +% \title{An environment for multicolumn output\thanks{This file +% has version number \fileversion, last +% revised \filedate.}% +% \thanks{Note: This package is released under terms which affect +% its use in commercial applications. Please see the details at +% the top of the source file.}} +% \author{Frank Mittelbach\\ +% {\rm Email:} see top of the source file} +% \date{Printed \today} +% +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% \begin{abstract} +% This article describes the use and the implementation of the \mc{} +% environment. This environment allows switching between +% one and multicolumn format on the same page. Footnotes are handled +% correctly (for the most part), but will be placed at the bottom of +% the page and not under each column. \LaTeX{}'s float mechanism, +% however, is partly disabled in this implementation. At the +% moment only page-wide floats (i.e., star-forms) can be used within +% the scope of the environment. +% \end{abstract} +% +% \begin{multicols}{3}[\section*{Preface to version 1.8}] +% The 1.8 release improves on the balancing approach. If due to a +% limited number of break points (e.g., due to large objects) the +% balanced columns exceed the available vertical space, then +% balancing is canceled and a normal page is produced first. Some +% overflow is allowed (controlled by the parameter +% |\maxbalancingoverflow| which defaults to 12pt). This ensures +% that we only cut a normal page if we get enough material carried +% over to next page. +% +% Also added was support for |\enlargethispage|. This means it is +% now possible to request a page to be artificially enlarged or +% shortened. Note that if you enlarge pages by more than one line +% you may have to increase the \textsf{collectmore} counter value to +% ensure that enough material is being picked up. +% +% This command was used on the second page of this manual to shorten +% it by one line, in order to get rid of a number of widow lines on +% the following pages. +% +% There are also some small enhancements to the balancing algorithm +% including a ways to require a minimum number of rows in the result. +% +% Finally, version 1.8 adds the command |\docolaction| to help with +% more complicated actions that depend on the current column. This +% command expects 3 arguments: code that is executed if we are in +% the ``first'' column, code to execute if we end up in any +% ``middle'' column (if there are more than two) and finally code to +% execute if we are in the ``last'' column. Thus +%\begin{verbatim} +% \docolaction{first} +% {middle}{last} +%\end{verbatim} +% would typeset a different word depending the type of column this +% code is executed. Using it like this is probably pointless, but +% you can imagine applications like writing something into the +% nearest margin, etc. +% +% As this feature needs at least two \LaTeX{} runs to produce correct +% results and as it adds to the processing complexity it is only +% made available if one add the option \texttt{colaction} when +% loading the package. +% +% \end{multicols} +% +% +% \begin{multicols}{3}[\section*{Preface to version 1.7 +% (right to left support)}] +% The 1.7 release adds support for languages that are typeset +% right-to-left. For those languages the order of the columns on the page +% also need to be reversed---something that wasn't supported before. The next +% paragraph demonstrates the result (as it is typeset as if we are writing +% in a left-to-right language--- so read the rightmost column +% first). The change is initialized via +% |\RLmulticolcolumns| and returning to left-right (default) +% is done via |\LRmulticolcolumns|. +% \end{multicols} +% +% \RLmulticolcolumns +% +% \begin{multicols}{3} +% Right-to-left typesetting will only reverse the column orders. Any +% other support needed will have to be provided by other means, +% e.g., using appropriate fonts and reversing the writing directions +% within the columns. As footnotes are typeset in full measure the +% footnote rule needs to be redefined as if they are below a single +% column, i.e., using |\textwidth| not |\columnwidth|. For example: +%\begin{verbatim} +%\renewcommand \footnoterule{% +% \kern-3pt\hbox to\textwidth +% {\hskip .6\textwidth +% \hrulefill }% +% \kern2.6pt} +%\end{verbatim} +% \end{multicols} +% +% \LRmulticolcolumns +% +% \begin{multicols}{3}[\section*{Preface to version 1.5 + 1.6}] +% \hbadness=10000 +% The 1.5 release contains two major changes: \mc{} will now +% support up to 10 columns and two more tuning possibilities have +% been added to the balancing routine. The balancing routine now +% checks the badness +% of the resulting columns and rejects solutions that are larger +% than a certain threshold. +% At the same time \mc{} has been upgraded to run under \LaTeXe{}. +% +% Later changes to 1.5 include |\columnbreak| and |multicols*|. +% +% For version 1.6 micro-spacing around the boxes produced by \mc{} +% has been improved to allow for baseline-grid typesetting. +% \end{multicols} +% +% +% \setcounter{collectmore}{2} +% \begin{multicols}{3}[\section{Introduction}] +% \hbadness=10000 +% Switching between two-column and one-column layout is possible in +% \LaTeX{}, but every use of |\twocolumn| or |\onecolumn| +% starts a new page. Moreover, the last page of two-column output +% isn't balanced and this often results in an empty, or nearly +% empty, right column. When I started to write macros for +% \textsf{doc.sty} (see ``The \texttt{doc}--Option'', \TUB\ +% volume 10~\#2, pp.~245--273) I thought that it would be nice to +% place the index +% on the same page as the bibliography. And balancing the last page +% would not only look better, it also would save space; provided of +% course that it is also possible to start the next article on the +% same page. Rewriting the index environment was comparatively easy, +% but the next goal, designing an environment which takes care of +% footnotes, floats, etc., was a harder task. It took me a whole +% weekend\footnote{I started with the algorithm given in the \TeX +% book on page 417. Without this help a weekend would not have been +% enough. (This remark was made in the documentation of the initial +% release, since then several hundreds more hours went into +% improving the original code.)} to get together the few lines of +% code below and there is +% still a good chance that I missed something after all. +% +% Try it and, hopefully, enjoy it; and {\em please\/} direct bug +% reports and suggestions back to Mainz. +% \end{multicols} +% +% +% \setcounter{collectmore}{0} +% \begin{multicols}{3}[\section{The User Interface}] +% \hbadness=10000 +% To use the environment one simply says\\*[2mm] +% \hspace*{2mm}|\begin{multicols}{|\meta{number}|}| +% \hspace*{12mm}\meta{multicolumn text}\\ +% \hspace*{2mm}|\end{multicols}|\\[2mm] +% where \meta{number} is the required number of columns and +%^^A\meta{multicolumn text} +% $\langle${\it multi\-column text\/}$\rangle$ may contain arbitrary +% \LaTeX{} commands, except that floats and marginpars are not +% allowed in the current implementation\footnote{This is dictated by +% lack of time. To implement floats one has to reimplement the +% whole \LaTeX{} output routine.}. +% +% \enlargethispage{-1\baselineskip} +% +% \DescribeMacro\premulticols +% As its first action, the \textsf{multicols} environment measures the +% current page to determine whether there is enough room for some +% portion of multicolumn output. This is controlled by the +% \meta{dimen} variable |\premulticols| which can be changed by +% the user with ordinary \LaTeX{} commands. +% \DescribeMacro\multicolsep +% If the space is less than |\premulticols|, a new page is +% started. Otherwise, a |\vskip| of |\multicolsep| is +% added.\footnote{Actually the added space may be less because we use +% \cs{addvspace} (see the \LaTeX{} manual for further +% information about this command).} +% +% \DescribeMacro\postmulticols +% When the end of the \mc{} environment is encountered, an +% analogous mechanism is employed, but now we test whether there is a +% space larger than |\postmulticols| available. Again we add +% |\multicolsep| or start a new page. +% +% It is often convenient to spread some text over all columns, just +% before the multicolumn output, without any page break in between. To +% achieve this the \mc{} environment has an optional second +% argument which can be used for this purpose. For example, the text +% you are now reading was started with +% \begin{verbatim} +% \begin{multicols}{3} +% [\section{The User +% Interface}] ... +%\end{verbatim} +% If such text is unusually long (or short) the value of +% |\premulticols| might need adjusting to prevent a bad page +% break. We therefore provide a third argument which can be used to +% overwrite the default value of |\premulticols| just for this +% occasion. So if you want to combine some longer single column text +% with a multicols environment you could write +% \begin{verbatim} +% \begin{multicols}{3} +% [\section{Index} +% This index contains ...] +% [6cm] +% ... +%\end{verbatim} +% +% +% \DescribeMacro\columnsep +% The space between columns is controlled by the length parameter +% |\columnsep|. The width for the individual columns is automatically +% calculated from this parameter and the current |\linewidth|. In this +% article a value of \textsf{\the\columnsep} was used. +% +% +% \DescribeMacro\columnseprule +% Separation of columns with vertical rules is achieved by setting the +% parameter |\columnseprule| to some positive value. In this +% article a value of \textsf{.4pt} was used. +% +% \DescribeMacro\columnseprulecolor +% The color of the rules separating the columns can be specified through +% |\columnseprulecolor|. The default value is |\normalcolor|. +% +% \DescribeMacro\multicolbaselineskip +% Since narrow columns tend to need adjustments in interline spacing +% we also provide a \meta{skip} parameter called +% |\multicolbaselineskip| which is added to the +% |\baselineskip| parameter inside the \mc{} +% environment. Please use this parameter with care or leave it alone; +% it is intended only for package file designers since even small +% changes might produce totally unexpected changes to your document. +% +% +% \subsection{Balancing columns} +% +% +% Besides the previously mentioned parameters, some others are +% provided to influence the layout of the columns generated. +% +% Paragraphing in \TeX{} is controlled by several parameters. One of +% the most important is called |\tolerance|: this controls the +% allowed `looseness' (i.e.\ the amount of blank space between words). +% Its default value is 200 (the \LaTeX{} |\fussy|) which is too +% small for narrow columns. On the other hand the |\sloppy| +% declaration (which sets |\tolerance| to $10000=\infty$) is too +% large, allowing really bad spacing.\footnote{Look at the next +% paragraph, it was set with the \cs{sloppy} declaration.} +% +% \begin{sloppypar} +% \DescribeMacro\multicoltolerance \DescribeMacro\multicolpretolerance +% We therefore use a |\multicoltolerance| parameter for the +% |\tolerance| value inside the \mc{} environment. Its default value +% is 9999 which is less than infinity but `bad' enough for most +% paragraphs in a multicolumn environment. Changing its value should +% be done outside the \mc{} environment. Since |\tolerance| is set +% to |\multicoltolerance| at the beginning of every \textsf{multicols} +% environment one can locally overwrite this default by assigning +% \verb*+\tolerance = +\meta{desired value}. There also exists a +% |\multicolpretolerance| parameter holding the value for +% |\pretolerance| within a \mc{} environment. Both parameters are +% usually used only by package designers. +% \end{sloppypar} +% +% Generation of multicolumn output can be divided into two parts. In +% the first part we are collecting material for a page, shipping it +% out, collecting material for the next page, and so on. As a second +% step, balancing will be done when the end of the \mc{} environment +% is reached. +% In the first step \TeX{} might consider more material whilst +% finding the final column content than it actually uses when shipping out the +% page. This might cause a problem if a footnote is encountered in +% the part of the input considered, but not used, on the current page. +% In this case the footnote might show up on the current page, while the +% footnotemark corresponding to this footnote might be set on the next +% one.\footnote{The reason behind this behavior is the asynchronous +% character of the \TeX{} {\it page\_builder}. +% However, this +% could be avoided by defining very complicated output +% routines which don't use \TeX{} primitives like +% \cs{insert} but do everything by hand. +% This is clearly beyond the scope of a weekend problem.} +% Therefore the \mc{} environment gives a warning +% message\footnote{This message will be generated even if there are no +% footnotes in this part of the text.} whenever it is unable to use +% all the material considered so far. +% +% If you don't use footnotes too often the chances of something +% actually going wrong are very slim, but if this happens you can help +% \TeX{} by using a |\pagebreak| command in the final document. +% Another way to influence the behavior of \TeX{} in this respect is +% given by the counter variable `\textsf{collectmore}'. If you use the +% |\setcounter| declaration to set this counter to \meta{number}, +% \TeX{} will consider \meta{number} more (or less) lines before +% making its final decision. So a value of $-1$ may solve all your +% problems at the cost of slightly less optimal columns. +% +% +% In the second step (balancing columns) we have other bells and +% whistles. First of all you can say |\raggedcolumns| if you +% don't want the bottom lines to be aligned. +% The default is |\flushcolumns|, so \TeX{} will normally try to +% make both +% the top and bottom baselines of all columns align. +% +% If there is only a small amount of material available for balancing +% then you may end up with very few lines per column. In an extreme +% case there may be only one line which looks distinctly odd. In that +% case it might be better to have more material distributed to the +% earlier columns even if that means that later columns are empty or +% partially empty. This is controlled through the counter +% `\textsf{minrows}' (default 1). If set to a higher value then the +% balancing will have at least that many rows in the first column (and +% also all further columns until it runs outs of material). +% +% Additionally you can set another counter, the `\textsf{unbalance}' +% counter, to some positive \meta{number}. This will make all but the +% right-most column \meta{number} of lines longer than they would +% normally have been. `Lines' in this context refer to normal text +% lines (i.e.\ one |\baselineskip| apart); thus, if your columns +% contain displays, +% for example, you may need a higher \meta{number} +% to shift something from one column into another. A negative value can make sense if +% you have set \textsf{minrows} and want to locally adjust that. +% +% Unlike `\textsf{collectmore},' the `\textsf{unbalance}' counter is reset +% to zero at the end of the environment so it only applies to one +% \mc{} environment. +% +% The two methods may be combined but I suggest using these features +% only when fine tuning important publications. +% +% Two more general tuning possibilities were added with version~1.5. +% \TeX{} allows to measure the badness of a column in terms of an +% integer value, where 0 means optimal and any higher value means a +% certain amount of extra white space. 10000 is considered to be +% infinitely bad (\TeX{} does not distinguish any further). In addition +% the special value 100000 means overfull (i.e., the column contains +% more text than could possibly fit into it). +% +% The new release now measures every generated column and ignores +% solutions where at least one column has a badness being larger than +% the value of the counter \textsf{columnbadness}. The default value for +% this counter is 10000, thus \TeX{} will accept all solutions except +% those being overfull. +% By setting the counter to a smaller value you can force the algorithm +% to search for solutions that do not have columns with a lot of white +% space. +% +% However, if the setting is too low, the algorithm may not find any +% acceptable solution at all and will then finally choose the extreme +% solution of placing all text into the first column. +% +% Often, when columns are balanced, it is impossible to find a solution +% that distributes the text evenly over all columns. If that is the case +% the last column usually has less text than the others. In the earlier +% releases this text was stretched to produce a column with the same +% height as all others, sometimes resulting in really ugly looking +% columns. +% +% In the new release this stretching is only done if the badness of +% the final column is not larger than the value of the counter +% \textsf{finalcolumnbadness}. The default setting is 9999, thus preventing +% the stretching for all columns that \TeX{} would consider infinitely +% bad. In that case the final column is allowed to run short which gives +% a much better result. +% +% And there are two more parameters of some experimental nature, one +% called |\multicolovershoot| the other |\multicolundershoot|. They +% control the amount of space a column within the \mc{} environment is +% allowed to be ``too full'' or ``too short'' without affecting the +% column badness. They are set to 0pt and 2pt, respectively. +% +% Finally, when doing the balancing at the end, columns may become +% higher than the remaining available space. In that case the +% algorithm aborts and instead generates a normal page. However, if the +% amount is not too large, e.g., a line or so, then it might be better to +% keep everything on the same page instead of starting a new page with +% just one line after balancing. So the parameter +% |\maxbalancingoverflow| governs this process: only when the excess +% gets larger than its value balancing is aborted. +% +% \subsection{Not balancing the columns} +% +% Although this package was written to solve the problem of balancing +% columns, I got repeated requests to provide a version where all +% white space is automatically placed in the last column or +% columns. Since version v1.5q this now exists: if you use +% \texttt{multicols*} instead of the usual environment the columns on +% the last page are not balanced. Of course, this environment only +% works on top-level, e.g., inside a box one has to balance to +% determine a column height in absence of a fixed value. +% +% +% \subsection{Manually breaking columns} +% +% Another request often voiced was: ``How do I tell \LaTeX{} that it +% should break the first column after this particular line?''. The +% |\pagebreak| command (which works with the two-column option of +% \LaTeX{}) is of no use here since it would end the collection phase +% of \mc{} and thus all columns on that page. So with version 1.5u +% the |\columnbreak| command was added. If used within a paragraph it +% marks the end of the current line as the desired breakpoint. You can +% observe its effect on +% the previous page where three lines of text have been artificially +% forced into the second column (resulting in some white +% space between paragraphs in the first column). +% +% \subsection{Floats inside a \mc{} environment} +% +% Within the \mc{} environment the usual star float commands are +% available but their function is somewhat different as in the +% two-column mode of standard \LaTeX. Stared floats, e.g., +% \texttt{figure*}, denote page wide floats that are handled in a similar +% fashion as normal floats outside the \mc{} environment. However, +% they will never show up on the page where they are encountered. In +% other words, one can influence their placement by specifying a +% combination of \texttt{t}, \texttt{b}, and/or \texttt{p} in their optional +% argument, but \texttt{h} doesn't work because the first possible place +% is the top of the next page. One should also note, that this means +% that their placement behavior is determined by the values of +% |\topfraction|, etc.\ rather than by |\dbl...|. +% +% +% \subsection{Support for right-to-left typesetting} +% +% In right-to-left typesetting the order of the columns on the page +% also need to be reversed, i.e., the first column has to appear on the far +% right and the last column on the left. This is supported through the +% commands |\RLmulticolcolumns| (switching to right-to-left typesetting) +% and |\LRmulticolcolumns| (switching to left-to-right typesetting) the +% latter being the default. +% +% \subsection{Warnings} +% +% Under certain circumstances the use of the \mc{} environment may +% result in some +% warnings from \TeX{} or \LaTeX{}. Here is a list +% of the important ones and the possible cause: +% \begin{description} +% +% \item[] {\hspace*{-\labelsep}\tt Underfull \string\hbox\space +% (badness ...)} +% +% As the columns are often very narrow \TeX{} wasn't able to find a +% good way to break the paragraph. Underfull denotes a loose line but +% as long as the badness value is below $10000$ the result is probably +% acceptable. +% +% \item[] +% {\hspace*{-\labelsep}\tt Underfull \string\vbox\space ... while +% \string\output\space is active} +% +% If a column contains a character with an unusual depth, for +% example a `(', in the bottom line then this message may show up. It +% usually has no significance as long as the value is not more than a +% few points. +% +% \item[] {\hspace*{-\labelsep}\tt LaTeX Warning: I moved some lines +% to the next page} +% +% As mentioned above, \mc{} sometimes screws up the footnote +% numbering. As a precaution, whenever there is a footnote on a +% page where \mc{} had to leave a remainder for the following +% page this warning appears. Check the footnote numbering on this +% page. If it turns out that it is wrong, you have to manually break +% the page using |\newpage| or |\pagebreak[..]|. +% +% \item[] {\hspace*{-\labelsep}\tt Floats and marginpars not allowed +% inside `multicols' environment!} +% +% This message appears if you try to use the |\marginpar| command or +% an unstarred version of the \textsf{figure} or \textsf{table} environment. +% Such floats will disappear! +% +% \item[] {\hspace*{-\labelsep}\tt Very deep columns! +% Grid alignment might be broken} +% +% This message can only appear if the option \texttt{grid} was +% chosen. In that case it will show up if a column has a very large +% depth so that \mc{} is unable to back up to its baseline. This +% is only relevant if one tries to produce a document where all +% text lines are aligned at an invisible grid, something that +% requires careful adjustment of many parameters and macros, e.g., +% heading definitions. +% +% \end{description} +% +% +% \subsection{Tracing the output} +% +% To understand the reasoning behind the decisions \TeX{} makes when +% processing a \mc{} environment, a tracing mechanism is provided. +% If you set the counter `\texttt{tracingmulticols}' +% to a positive \meta{number} you then +% will get some tracing information on the terminal and in the +% transcript file: +% \begin{description} +% \item[$\meta{number}=1$.] \TeX{} will now tell you, whenever it +% enters or leaves a \mc{} environment, the number of columns it +% is working on and its decision about starting a new page before +% or after the environment. +% \item[$\meta{number}=2$.] +% In this case you also get information from the balancing routine: +% the heights tried for the left and right-most columns, +% information about shrinking if the |\raggedcolumns| +% declaration is in force and the value of the `\textsf{unbalance}' +% counter if positive. +% \item[$\meta{number}= 3$.] Setting \meta{number}\pagebreak[2] to +% this value will additionally trace the mark handling +% algorithm. It will show what marks are found, what marks are +% considered, etc. To fully understand this information you will +% probably have to read carefully trough the implementation. +% \item[$\meta{number}\geq 4$.] Setting \meta{number}\pagebreak[2] to +% such a high value will additionally place an |\hrule| into your +% output, separating the part of text which had already been +% considered on the previous page from the rest. Clearly this +% setting should {\em not\/} be used for the final output. It will +% also activate even more debugging code for mark handling. +% \end{description} +% +% +% \end{multicols} +% +% \begin{multicols}{3}[\section{Prefaces to older versions} +% \subsection{Preface to version 1.4}] +% \hbadness=10000 +% Beside fixing some bugs as mentioned in the \textsf{multicol.bug} file +% this new release enhances the \mc{} environment by allowing for +% balancing in arbitrary contexts. It is now, for example, possible +% to balance text within a \mc{} or a \textsf{minipage} as shown in +% \ref{tab:newcmds} where a \textsf{multicols} environment within a +% \textsf{quote} environment was used. It is now even possible to nest +% \mc{} environments. +% +% The only restriction to such inner \mc{} environments (nested, or +% within \TeX's internal vertical mode) is that such variants will +% produce a box with the balanced material in it, so that they can +% not be broken across pages or columns. +% +% Additionally I rewrote the algorithm for balancing so that it will +% now produce slightly better results. +% +% I updated the source documentation but like to apologize in +% advance for some `left over' parts that slipped through the +% revision. +% +% A note to people who like to improve the balancing algorithm of +% \mc{}: The balancing routine is now placed into a single macro +% which is called |\balance@columns|. This means that one can easily +% try different balancing routines by rewriting this macro. The +% interface for it is explained in table \ref{tab:balance}. There are +% several improvements possible, one can think of integrating the +% |\badness| function of \TeX3, define a faster algorithm for finding +% the right column height, etc. If somebody thinks he/she has an +% enhancement I would be pleased to learn about it. But please obey +% the copyright notice and don't change \textsf{multicol.dtx} directly! +% \begin{table*} +% \begin{quote} +% \begin{multicols}{2} +% \raggedcolumns +% The macro |\balance@columns| that contains the code for balancing +% gathered material is a macro without parameters. It assumes that +% the material for balancing is stored in the box |\mult@box| which +% is a |\vbox|. It also ``knows'' about all parameters set up by the +% \mc{} environment, like |\col@number|, etc. It can also assume +% that |\@colroom| is the still available space on the current page. +% +% When it finishes it must return the individual columns in boxes +% suitable for further processing with |\page@sofar|. This means +% that the left column should be stored in box register +% |\mult@gfirstbox|, the next +% in register |\mult@firstbox|${}+2$, \ldots, +% only the last one as an exception in +% register |\mult@grightbox|. Furthermore it has to set up +% the two macros +% |\kept@firstmark| and |\kept@botmark| to hold the values for the +% first and bottom mark as found in the individual columns. There +% are some helper functions defined in section \ref{sec:v14} which +% may be used for this. Getting the marks right ``by hand'' is +% non-trivial and it may pay off to first take a look at the +% documentation and implementation of |\balance@columns| below +% before trying anew. +% \end{multicols} +% \end{quote} +% \vspace*{-3ex} +% \vspace*{-0ex} +% \caption{Interface description for \cs{balance@columns}} +% \label{tab:balance} +% \end{table*} +% \end{multicols} +% +% \begin{multicols}{3}[\subsection{Preface to version 1.2}] +% \hbadness=10000 +% After the article about the \mc{} environment was published in +% \TUB\ 10\#3, I got numerous requests for these macros. However, I +% also got a changed version of my style file, together with a +% letter asking me if I would include the changes to get better +% paragraphing results in the case of narrow lines. The main +% differences to my original style option were additional parameters +% (like |\multicoladjdemerits| to be used for |\adjdemerits|, etc.) +% which would influence the line breaking algorithm. +% +% But actually resetting such parameters to zero or even worse to a +% negative value won't give better line breaks inside the \mc{} +% environment. \TeX{}s line breaking algorithm will only look at +% those possible line breaks which can be reached without a badness +% higher than the current value of |\tolerance| (or |\pretolerance| +% in the first pass). If this isn't possible, then, as a last +% resort, \TeX{} will produce overfull boxes. All those (and only +% those) possible break points will be considered and finally the +% sequence which results in the fewest demerits will be chosen. This +% means that a value of $-1000$ for |\adjdemerits| instructs \TeX{} +% to prefer visibly incompatible lines instead of producing better +% line breaks. +% +% However, with \TeX{} 3.0 it is possible to get decent line breaks +% even in small columns by setting |\emergencystretch| to an +% appropriate value. I implemented a version which is capable of +% running both in the old and the new \TeX{} (actually it will +% simply ignore the new feature if it is not available). The +% calculation of |\emergencystretch| is probably incorrect. I +% made a few tests but of course one has to have much more experience +% with the new possibilities to achieve the maximum quality. +% +% Version 1.1a had a nice `feature': the penalty for using the +% forbidden floats was their ultimate removal from \LaTeX{}s +% |\@freelist| so that after a few |\marginpar|s inside the \mc{} +% environment floats where disabled forever. (Thanks to Chris +% Rowley for pointing this out.) I removed this misbehavior and at +% the same time decided to allow at least floats spanning all +% columns, e.g., generated by the |figure*| environment. You can +% see the new functionality in table~\ref{tab:newcmds} which was +% inserted at this very point. +% \begin{table*} +% \small +% \setlength{\multicolsep}{0pt} +% \begin{quote} +% \begin{multicols}{2} +% |\setemergencystretch|: This is a hook for people who like +% to play around. It is supposed to set the +% |\emergencystretch| \meta{dimen} register provided in the +% new \TeX{} 3.0. The first argument is the number of columns and +% the second one is the current |\hsize|. At the moment the +% default definition is $4\texttt{pt} \times |#1|$, i.e.\ the +% |\hsize| isn't used at all. But maybe there are better +% formulae. +% +% \setlength{\emergencystretch}{20pt} |\set@floatcmds|: This is +% the hook for the experts who like to implement a full float +% mechanism for the \mc{} environment. The |@| in the name +% should signal that this might not be easy. +% \end{multicols} +% \end{quote} +% \vspace*{-1ex} +% \vspace*{-0ex} +% \caption[]{The new commands of \textsf{multicol.sty} version 1.2. +% Both commands might be removed if good solutions to these +% open problems are found. I hope that these commands will +% prevent that nearly identical style files derived from +% this one are floating around.} +% \label{tab:newcmds} +% \end{table*} +% However single column floats are still forbidden and I don't think +% I will have time to tackle this problem in the near future. As an +% advice for all who want to try: wait for \TeX{} 3.0. It has a few +% features which will make life much easier in multi-column +% surroundings. Nevertheless we are working here at the edge of +% \TeX{}s capabilities, really perfect solutions would need a +% different approach than it was done in \TeX{}s page builder. +% +% The text below is nearly unchanged, I only added documentation at +% places where new code was added. +% \end{multicols} +% +% \changes{v1.5l}{1996/01/13}{Try hard to explain unresolved reference +% that happens if \cs{OnlyDescription} is used} +% +% \StopEventually{\PrintIndex \PrintChanges +% \ifx\Finale\relax +% \typeout{**********************************} +% \typeout{* Info: Typesetting this document with +% \protect\OnlyDescription\space will} +% \typeout{* Info: result in one unresolved +% reference to `sec:v14'.} +% \typeout{* Info: --- tough, it's just not there in this case!} +% \typeout{**********************************} +% \fi +% } +% +% +% \begin{multicols}{2}[\section{The Implementation} +% We are now switching to two-column output to show the +% abilities of this environment (and bad layout decisions). +% \subsection{The documentation driver file} +% ][10\baselineskip] +% +% \hbadness=10000 +% +% +% The next bit of code contains the documentation driver file for +% \TeX{}, i.e., the file that will produce the documentation you are +% currently reading. It will be extracted from this file by the \texttt{docstrip} program. +% Since this is the first code in this file one can produce the +% documentation +% simply by running \LaTeX{} on the \texttt{.dtx} file. +% \begin{macrocode} +%<*driver> +\documentclass{ltxdoc} +% \end{macrocode} +% We use the \texttt{balancingshow} option when loading \mc{} so +% that full tracing is produced. This has to be done before the +% \texttt{doc} package is loaded, since \texttt{doc} otherwise +% requires \mc{} without any options. +% \begin{macrocode} +\usepackage{multicol}[1999/05/25] +\usepackage{doc} +% \end{macrocode} +% First we set up the page layout suitable for +% this article. +% \begin{macrocode} +\setlength{\textwidth}{39pc} +\setlength{\textheight}{54pc} +\setlength{\parindent}{1em} +\setlength{\parskip}{0pt plus 1pt} +\setlength{\oddsidemargin}{0pc} +\setlength{\marginparwidth}{0pc} +\setlength{\topmargin}{-2.5pc} +\setlength{\headsep}{20pt} +\setlength{\columnsep}{1.5pc} +% \end{macrocode} +% We want a rule between columns. +% \begin{macrocode} +\setlength\columnseprule{.4pt} +% \end{macrocode} +% We also want to ensure that a new \mc{} environment finds enough +% space at the bottom of the page. +% \begin{macrocode} +\setlength\premulticols{6\baselineskip} +% \end{macrocode} +% When balancing columns we disregard solutions that +% are too bad. Also, if the last column is too bad +% we typeset it without stretch. +% \begin{macrocode} +\setcounter{columnbadness}{7000} +\setcounter{finalcolumnbadness}{7000} +% \end{macrocode} +% The index is supposed to come out in four columns. +% And we don't show macro names in the margin. +% \begin{macrocode} +\setcounter{IndexColumns}{4} +\let\DescribeMacro\SpecialUsageIndex +\let\DescribeEnv\SpecialEnvIndex +\renewcommand\PrintMacroName[1]{} +\CodelineIndex +%\DisableCrossrefs % Partial index +\RecordChanges % Change log +% \end{macrocode} +% Line numbers are very small for this article. +% \begin{macrocode} +\renewcommand{\theCodelineNo} + {\scriptsize\rm\arabic{CodelineNo}} +\settowidth\MacroIndent{\scriptsize\rm 00\ } + +\begin{document} + \typeout + {**************************************** + ^^J* Expect some Under- and overfull boxes. + ^^J****************************************} + \DocInput{multicol.dtx} +\end{document} +%</driver> +% \end{macrocode} +% +% +% \end{multicols} +% +% \begin{multicols}{2}[\subsection{Identification and +% option processing}] +% +% +% We start by identifying the package. Since it makes use of features +% only available in \LaTeXe{} we ensure that this format is available. +% (Now this is done earlier in the file.) +% \begin{macrocode} +%<*package> +% \NeedsTeXFormat{LaTeX2e} +% \ProvidesPackage{multicol}[..../../.. +% v... multicolumn formatting] +% \end{macrocode} +% +%^^A \subsection{Option processing} +% +% Next we declare options supported by \mc{}. Two-column mode +% and \mc{} do not work together so we warn about possible +% problems. However, since you can revert to |\onecolumn| +% in which case \mc{} does work, we don't make this an error. +% \begin{macrocode} +\DeclareOption{twocolumn} + {\PackageWarning{multicol}{May not work + with the twocolumn option}} +% \end{macrocode} +% Tracing is done using a counter. However +% it is also possible to invoke the tracing +% using the options declared below. +% \begin{macrocode} +\newcount\c@tracingmulticols +\DeclareOption{errorshow} + {\c@tracingmulticols\z@} +\DeclareOption{infoshow} + {\c@tracingmulticols\@ne} +\DeclareOption{balancingshow} + {\c@tracingmulticols\tw@} +\DeclareOption{markshow} + {\c@tracingmulticols\thr@@} +\DeclareOption{debugshow} + {\c@tracingmulticols5\relax} +% \end{macrocode} +% The next option is intended for typesetting on a |\baselineskip| +% grid. Right now it doesn't do anything other than warning if it +% thinks that the grid got lost. +% \changes{v1.6a}{2003/03/15}{New option grid} +% \begin{macrocode} +\let\mc@gridwarn\maxdimen +\DeclareOption{grid}{\def\mc@gridwarn{\maxdepth}} +% \end{macrocode} +% +% \changes{v1.8e}{2014/04/23}{Support \cs{docolaction}} +% Next option enables the |\docolaction| command. As this changes +% the \texttt{.aux} file content this is not automatically enabled. +% \begin{macrocode} +\DeclareOption{colaction}{% + \def\mc@col@status@write{% + \protected@write\@auxout{}% + {\string\mc@col@status + {\ifmc@firstcol 1\else 2\fi}}% + \mc@firstcolfalse}% + \def\mc@lastcol@status@write{% + \protected@write\@auxout{}% + {\string\mc@col@status{3}}}% +} +\let\mc@col@status@write\relax +\let\mc@lastcol@status@write\relax +% \end{macrocode} +% +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% +% +% \end{multicols} +% +% \begin{multicols}{2}[\subsection{Starting and +% Ending the \mc{} Environment}] +% +% \begin{macro}{\multicols} +% As mentioned before, the \mc{} environment has one mandatory +% argument (the number of columns) and up to two optional ones. We +% start by reading the number of columns into the |\col@number| +% register. +% \begin{macrocode} +\def\multicols#1{\col@number#1\relax +% \end{macrocode} +% If the user forgot the argument, \TeX{} will complain about a +% missing number at this point. The error recovery mechanism will +% then use zero, which isn't a good choice in this case. So we +% should now test whether everything is okay. The minimum is two +% columns at the moment. +% \changes{v1.3b}{1990/10/09}{Minimum of two columns} +% \begin{macrocode} + \ifnum\col@number<\tw@ + \PackageWarning{multicol}% + {Using `\number\col@number' + columns doesn't seem a good idea.^^J + I therefore use two columns instead}% + \col@number\tw@ \fi +% \end{macrocode} +% We have only enough box registers for ten columns, so we need to +% check that the user hasn't asked for more. +% \changes{v1.4k}{1992/06/27}{Maximum of 5 columns (temp)} +% \changes{v1.5a}{1992/11/04}{Allow 10 columns again} +% \begin{macrocode} + \ifnum\col@number>10 + \PackageError{multicol}% + {Too many columns}% + {Current implementation doesn't + support more than 10 columns.% + \MessageBreak + I therefore use 10 columns instead}% + \col@number10 \fi +% \end{macrocode} +% Within the environment we need a special version of the +% kernel |\@footnotetext| command since the original sets the +% the |\hsize| to |\columnwidth| which is not correct in the +% multicol environment. Here |\columnwidth| refers to the width of +% the individual column and the footnote should be in |\textwidth|. +% Since |\@footnotetext| has a different definition inside a +% minipage environment we do not redefine it directly. Instead we +% locally set |\columnwidth| to |\textwidth| and call the original +% (current) definition stored in |\orig@footnotetext|. +% \changes{v1.5p}{1997/12/14}{Redefinition of \cs{@footnotetext} +% only within env pr/2689.} +% \changes{v1.5r}{1998/08/17}{Use \cs{@footnotetext} but with +% local change to \cs{columnwidth}.} +% \changes{v1.5w}{1999/10/21}{Make \cs{@footnotetext} long to allow +% multi-paragraph footnotes.} +% If the \mc{} environment is nested inside another \mc{} +% environment then the redefinition has already happened. So be +% better test for this situation. Otherwise, we will get a \TeX{} +% stack overflow as this would generate a self-referencing definition. +% \changes{v1.6e}{2004/02/14}{Avoid self-referencing definition of +% \cs{@footnotetext} (pr/3618)}. +% \begin{macrocode} + \ifx\@footnotetext\mult@footnotetext\else + \let\orig@footnotetext\@footnotetext + \let\@footnotetext\mult@footnotetext + \fi +% \end{macrocode} +% Now we can safely look for the optional arguments. +% \begin{macrocode} + \@ifnextchar[\mult@cols{\mult@cols[]}} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\mult@footnotetext} +% +% \begin{macrocode} +\long\def\mult@footnotetext#1{\begingroup + \columnwidth\textwidth + \orig@footnotetext{#1}\endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mult@cols} +% The |\mult@cols| macro grabs the first optional argument +% (if any) and looks for the second one. +% \begin{macrocode} +\def\mult@cols[#1]{\@ifnextchar[% +% \end{macrocode} +% This argument should be a \meta{dimen} denoting the minimum free +% space needed on the current page to start the environment. If the +% user didn't supply one, we use |\premulticols| as a +% default. +% \begin{macrocode} + {\mult@@cols{#1}}% + {\mult@@cols{#1}[\premulticols]}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\mult@@cols} +% After removing all arguments from the input we are able +% to start with |\mult@@cols|. +% \begin{macrocode} +\def\mult@@cols#1[#2]{% +% \end{macrocode} +% First thing we do is to decide whether or not this is an +% unbounded multicols environment, i.e. one that may split across +% pages, or one that has to be typeset into a box. If we are in +% \TeX's ``inner'' mode (e.g., inside a box already) then we have a +% boxed version of multicols therefore we set the |@boxedmulticols| +% switch to true. The \mc{} should start in vertical mode. If we +% are not already there we now force it with |\par| since otherwise +% the test for ``inner'' mode wouldn't show if we are in a box. +% \changes{v1.4f}{1992/04/28}{\cs{par} added to allow for correct inner test} +% \begin{macrocode} + \par + \ifinner \@boxedmulticolstrue +% \end{macrocode} +% Otherwise we check |\doublecol@number|. This counter is zero +% outside a multicols environment but positive inside (this happens +% a little later on). In the second case we need to process the +% current multicols also in ``boxed mode'' and so change the switch +% accordingly. +% \begin{macrocode} + \else + \ifnum \doublecol@number>\z@ + \@boxedmulticolstrue + \fi + \fi +% \end{macrocode} +% Then we look to see if statistics are requested: +% \begin{macrocode} + \mult@info\z@ + {Starting environment with + \the\col@number\space columns% +% \end{macrocode} +% In boxed mode we add some more info. +% \changes{v1.4f}{1992/04/28}{\cs{on@line} added to tracing info} +% \begin{macrocode} + \if@boxedmulticols\MessageBreak + (boxed mode)\fi + }% +% \end{macrocode} +% Then we measure the current page to see whether a useful portion +% of the multicolumn environment can be typeset. This routine +% might start a new page. +% \changes{v1.4a}{1992/02/14}{Forgotten braces added} +% \begin{macrocode} + \enough@room{#2}% +% \end{macrocode} +% Now we output the first argument and produce vertical space +% above the columns. (Note that this argument corresponds to the +% first optional argument of the \textsf{multicols} environment.) +% For many releases this argument was typeset in a group to get +% a similar effect as |\twocolumn[..]| where the argument is +% also implicitly surrounded by braces. However, this conflicts +% with local changes done by things like sectioning commands (which +% account for the majority of commands used in that argument) +% messing up vertical spacing etc.\ later in the document so that +% from version v1.5q on this argument is again typeset at the outer +% level. +% \changes{v1.4e}{1992/03/16}{Typeset optional arg inside group} +% \changes{v1.5q}{1998/01/19}{And removed the group again six years later} +% \begin{macrocode} + #1\par\addvspace\multicolsep +% \end{macrocode} +% When the last line of a paragraph had a positive depth then this +% depth normally taken into account by the baselineskip calculation +% for the next line. However, the columns produced by a following +% \texttt{multicol} are rigid and thus the distance from the +% baseline of a previous text line to the first line in a +% \texttt{multicol} would differ depending on the depth of the +% previous line. To account for this we add a negative space unless +% the depth is \texttt{-1000pt} which signals something special to +% \TeX and is not supposed to be a real depth. +% \changes{v1.5z1}{2003/02/17}{Add a kern to cancel potential depth of +% previous line} +% \begin{macrocode} + \ifdim \prevdepth = -\@m\p@ + \else +% \end{macrocode} +% The actual generation of this corrective space is a little bit +% more complicated as it doesn't make sense to always back up to +% the previous baseline (in case an object with a very large depth +% was placed there, e.g., a centered tabular). So we only back up +% to the extend that we are within the |\baselineskip| grid. We +% know that the box produced by \mc{} has |\topskip| at its top so +% that also needs to be taken into account. +% \changes{v1.6a}{2003/03/15}{Adjust spacing} +% \begin{macrocode} + \@tempcnta\prevdepth + \@tempcntb\baselineskip + \divide\@tempcnta\@tempcntb + \advance\@tempcnta\@ne + \dimen@\prevdepth + \advance\dimen@ -\@tempcnta\baselineskip + \advance\dimen@ \topskip + \kern-\dimen@ + \fi +% \end{macrocode} +% We start a new grouping level to hide all subsequent changes +% (done in |\prepare@multicols| for example). +% \begin{macrocode} + \begingroup + \prepare@multicols +% \end{macrocode} +% If we are in boxed mode we now open a box to typeset all material +% from the multicols body into it, otherwise we simply go ahead. +% \changes{v1.4g}{1992/05/07}{\cs{global} was probably wrong but at least +% unnecessary} +% \begin{macrocode} + \if@boxedmulticols + \setbox\mult@box\vbox\bgroup +% \end{macrocode} +% +% \changes{v1.8c}{2013/11/03}{Add \cs{color@setgroup} to prevent color leak} +% \begin{macrocode} + \color@setgroup +% \end{macrocode} +% \changes{v1.5?}{1994/?/?}{Penalty moved to later point} +% We may have to reset some parameters at this point, +% perhaps |\@parboxrestore| +% would be the right action but I leave it for the moment. +% \changes{v1.4l}{1992/08/17}{\cs{@totalleftmargin} now in +% \cs{prepare@multicols}} +% \begin{macrocode} + \fi +% \end{macrocode} +% We finish by suppressing initial spaces. +% \begin{macrocode} + \ignorespaces} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\if@boxedmulticols} +% Here is the switch and the box for ``boxed'' multicols code. +% \begin{macrocode} +\newif\if@boxedmulticols +\@boxedmulticolsfalse +\newbox\mult@box +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\enough@room} +% \changes{v1.0c}{1989/05/12}{Penalty 0 added to empty the contribution +% list.} +% The |\enough@room| macro used +% above isn't perfect but works reasonably well in this context. We +% measure the free space on the current page by subtracting +% |\pagetotal| from |\pagegoal|. This isn't entirely +% correct since it doesn't take the `shrinking' (i.e.\ +% |\pageshrink|) into account. The `recent contribution list' +% might be nonempty so we start with |\par| and an explicit +% |\penalty|.\footnote{See the documentation of +% \cs{endmulticols} for further details.} +% Actually, we use |\addpenalty| to ensure that a following +% |\addvspace| will `see' the vertical space that might be +% present. +% The use of |\addpenalty| will have the effect that all items from +% the recent contributions will be moved to the main vertical list +% and the |\pagetotal| value will be updated correctly. However, +% the penalty will be placed in front of any dangling glue item +% with the result that the main vertical list may already be +% overfull even if \TeX{} is not invoking the output routine. +% \changes{v1.3b}{1990/10/09}{Do \cs{penalty} with \cs{addpenalty}} +% \changes{v1.4e}{1992/03/16}{But ignore \cs{@nobreak} in \cs{addpenalty}} +% \begin{macrocode} +\def\enough@room#1{% +% \end{macrocode} +% Measuring makes only sense when we are not in ``boxed mode'' so +% the routine does nothing if the switch is true. +% \begin{macrocode} + \if@boxedmulticols\else + \par +% \end{macrocode} +% \label{mac:enoughroom} +% To empty the contribution list the first release contained a +% penalty zero but this had the result that |\addvspace| couldn't +% detect preceding glue. So this was changed to |\addpenalty|. But +% this turned out to be not enough as |\addpenalty| will not add a +% penalty when |@nobreak| is true. Therefore we force this switch +% locally to false. As a result there may be a break between +% preceding text and the start of a multicols environment, but this +% seems acceptable since there is the optional argument for exactly +% this reason. +% \begin{macrocode} + \bgroup\@nobreakfalse\addpenalty\z@\egroup + \page@free \pagegoal + \advance \page@free -\pagetotal +% \end{macrocode} +% To be able to output the value we need to assign it to a register +% first since it might be a register (default) in which case we +% need to use |\the| or it might be a plain value in which case +% |\the| would be wrong. +% \changes{v1.5e}{1994/05/26}{Assign arg to skip register to be able +% to output value} +% \begin{macrocode} + \@tempskipa#1\relax +% \end{macrocode} +% Now we test whether tracing information is required: +% \begin{macrocode} + \mult@info\z@ + {Current page:\MessageBreak + height=% + \the\pagegoal: used \the\pagetotal + \space -> free=\the\page@free + \MessageBreak + needed \the\@tempskipa + \space(for #1)}% +% \end{macrocode} +% Our last action is to force a page break if there isn't enough +% room left. +% \begin{macrocode} + \ifdim \page@free <#1\newpage \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\prepare@multicols} +% When preparing for multicolumn output several things must +% be done. +% \begin{macrocode} +\def\prepare@multicols{% +% \end{macrocode} +% We start saving the current |\@totalleftmargin| and then +% resetting the |\parshape| in case we are inside some list +% environment. The correct indentation for the \mc{} environment in +% such a case will be produced by moving the result to the right by +% |\multicol@leftmargin| later on. If we would use the value of of +% |\@totalleftmargin| directly then lists inside the \mc{} +% environment could cause a shift of the output. +% \changes{v1.4l}{1992/08/17}{saved \cs{@totalleftmargin}} +% \begin{macrocode} + \multicol@leftmargin\@totalleftmargin + \@totalleftmargin\z@ + \parshape\z@ +% \end{macrocode} +% We also set the register |\doublecol@number| for later use. This +% register should contain $2\times |\col@number|$. This is also an +% indicator that we are within a \mc{} environment as mentioned +% above. +% \changes{v1.5a}{1992/11/04}{Add offset to \cs{doublecolnumber}} +% \begin{macrocode} + \doublecol@number\col@number + \multiply\doublecol@number\tw@ + \advance\doublecol@number\mult@rightbox +% \end{macrocode} +% +% \begin{macrocode} + \if@boxedmulticols + \let\l@kept@firstmark\kept@firstmark + \let\l@kept@botmark\kept@botmark + \global\let\kept@firstmark\@empty + \global\let\kept@botmark\@empty + \else +% \end{macrocode} +% We add an empty box to the main vertical list to ensure that we +% catch any insertions (held over or inserted at the top of the +% page). Otherwise it might happen that the |\eject| is discarded +% without calling the output routine. Inside the output routine we +% remove this box again. Again this code applies only if we are on +% the main vertical list and not within a box. +% However, it is not enough to turn off interline spacing, we also +% have to clear |\topskip| before adding this box, since |\topskip| +% is always inserted before the first box on a page which would +% leave us with an extra space of |\topskip| if \mc{} start on a +% fresh sheet. +% \changes{v1.3c}{1991/03/03}{\cs{null} inserted and removed in output} +% \changes{v1.4a}{1992/02/11}{Conditional code for boxed mode added.} +% \changes{v1.4o}{1992/11/22}{\cs{topskip} locally zeroed.} +% \begin{macrocode} + \nointerlineskip {\topskip\z@\null}% + \output{% + \global\setbox\partial@page\vbox + {% +% \end{macrocode} +% Now we have to make sure that we catch one special situation which +% may result in loss of text! If the user has a huge amount of +% vertical material within the first optional argument that is larger +% then |\premulticols| and we are near the bottom of the page then it +% can happen that not the |\eject| is triggering this special output +% routine but rather the overfull main vertical list. In that case +% we get another breakpoint through the |\eject| penalty. As a result +% this special output routine would be called twice and the contents +% of |\partial@page|, i.e.\ the material before the \mc{} +% environment gets lost. There are several solutions to avoid this +% problem, but for now we will simply detect this and inform the user +% that he/she has to enlarge the |\premulticols| by using a suitable +% value for the second argument. +% \changes{v1.4a}{1992/02/11}{Checking for text losses.} +% \begin{macrocode} +%<*check> + \ifvoid\partial@page\else + \PackageError{multicol}% + {Error saving partial page}% + {The part of the page before + the multicols environment was + nearly full with^^Jthe result + that starting the environment + will produce an overfull + page. Some^^Jtext may be lost! + Please increase \premulticols + either generally or for this% + ^^Jenvironment by specifying a + suitable value in the second + optional argument to^^Jthe + multicols environment.} + \unvbox\partial@page + \box\last@line + \fi +%</check> + \unvbox\@cclv + \global\setbox\last@line\lastbox + }% +% \end{macrocode} +% Finally we need to record the marks that are present within the +% |\partial@page| so that we can construct correct first and bottom +% marks later on. This is done by the following code. +% \changes{v1.4a}{1992/02/14}{kept marks initiated} +% \begin{macrocode} + \prep@keptmarks +% \end{macrocode} +% Finally we have to initialize |\kept@topmark| which should +% ideally be initialized with the mark that is current on ``top'' +% of this page. Unfortunately we can't use |\topmark| because this +% register will not always contain what its name promises because +% \LaTeX{} sometimes calls the output routine for float +% management.\footnote{During such a call the \cs{botmark} +% gets globally copied to \cs{topmark} by the \TeX{} +% program.} Therefore we use the second best solution by +% initializing it with |\firstmark|. In fact, for our purpose this +% doesn't matter as we use |\kept@topmark| only to initialize +% |\firstmark| and |\botmark| of a following page if we don't find +% any marks on the current one. +% \changes{v1.4i}{1992/06/18}{\cs{kept@topmark} initialized.} +% \begin{macrocode} + \global\let\kept@topmark\firstmark + }\eject +% \end{macrocode} +% The next thing to do is to assign a new value to |\vsize|. +% \LaTeX{} maintains the free room on the page (i.e.\ the page +% height without the space for already contributed floats) in the +% register |\@colroom|. We must subtract the height of +% |\partial@page| to put the actual free room into this +% variable. +% \begin{macrocode} + \advance\@colroom-\ht\partial@page +% \end{macrocode} +% Then we have to calculate the |\vsize| value to use during column +% assembly. |\set@mult@vsize| takes an argument which allows to +% make the setting local (|\relax|) or global (|\global|). The +% latter variant is used inside the output routine below. At this +% point here we have to make a local change to |\vsize| because we +% want to get the original value for |\vsize| restored in case +% this \mc{} environment ends on the same page where it has started. +% \changes{v1.4p}{1992/11/26}{Use different \cs{vsize} setting} +% \changes{v1.4p}{1992/11/26}{Code moved to \cs{set@mult@vsize}} +% \begin{macrocode} + \set@mult@vsize\relax +% \end{macrocode} +% Now we switch to a new |\output| routine which will be used +% to put the gathered column material together. +% \begin{macrocode} + \output{\multi@column@out}% +% \end{macrocode} +% Finally we handle the footnote insertions. We have to multiply +% the magnification factor and the extra skip by the number of +% columns since each footnote reduces the space for every column +% (remember that we have page-wide footnotes). If, on the other +% hand, footnotes are typeset at the very end of the document, our +% scheme still works since |\count\footins| is zero then, so it +% will not change. +% To allow even further customization the setting of the |\footins| +% parameters is done in a separate macro. +% \changes{v1.5?}{1994/?/?}{Use \cs{init@mult@footins}} +% \begin{macrocode} + \init@mult@footins +% \end{macrocode} +% For the same reason (page-wide footnotes), the \meta{dimen} +% register controlling the maximum space used for footnotes isn't +% changed. Having done this, we must reinsert all the footnotes +% which are already present (i.e.\ those encountered when the +% material saved in |\partial@page| was first processed). This +% will reduce the free space (i.e.\ |\pagetotal|) by the +% appropriate amount since we have changed the magnification +% factor, etc.\ above. +% \begin{macrocode} + \reinsert@footnotes +% \end{macrocode} +% Inside \mc{} a |\clearpage| is fairly useless as we aren't supporting +% floats. In fact, it can cause harm as it doesn't know about the +% |\partial@page| and may therefore result in making columns too long. +% So we change that to behave like |\newpage| but also check if there +% are any deferred floats. If so, perhaps the user tried to place them through +% that |\clearpage| (but that needs to be done before starting the \mc{} +% environment. +% \changes{v1.8q}{2017/04/11}{Make \cs{clearpage} behave like \cs{newpage} (pr/4511)} +% \begin{macrocode} + \def\clearpage{% + \ifx\@deferlist\@empty\else + \PackageError{multicol}% + {Deferred floats not cleared}% + {A \string\clearpage\space inside multicols acts like + \string\newpage\space and doesn't clear floats.\MessageBreak + Move it before the multicols environment if you need it.}% + \fi + \newpage}% +% \end{macrocode} +% All the code above was only necessary for the unrestricted \mc{} +% version, i.e.\ the one that allows page breaks. If we are within +% a box there is no point in setting up special output routines or +% |\vsize|, etc. +% \begin{macrocode} + \fi +% \end{macrocode} +% But now we are coming to code that is necessary in all cases. We +% assign new values to |\vbadness|, |\hbadness| and |\tolerance| +% since it's rather hard for \TeX{} to produce `good' paragraphs +% within narrow columns. +% \changes{v1.2a}{1990/02/05}{\cs{vbadness} 10001 now.} +% \begin{macrocode} + \vbadness\@Mi \hbadness5000 + \tolerance\multicoltolerance +% \end{macrocode} +% Since nearly always the first pass will fail we ignore it +% completely telling \TeX{} to hyphenate directly. In fact, we now +% use another register to keep the value for the multicol +% pre-tolerance, so that a designer may allow to use +% |\pretolerance|. +% \changes{v1.2a}{1990/02/05}{\cs{pretolerance} -1 because it nearly never +% succeeds.} +% \changes{v1.4e}{1992/03/20}{Using} +% \begin{macrocode} + \pretolerance\multicolpretolerance +% \end{macrocode} +% For use with the new \TeX{} we set |\emergencystretch| to +% $|\col@number| \times 4pt$. However this is only a guess +% so at the moment this is done in a macro +% |\setemergencystretch| which gets the current |\hsize| +% and the number of columns as arguments. Therefore users are able +% to figure out their own formula. +% \changes{v1.2a}{1990/02/05}{\cs{setemergencystretch} added.} +% \begin{macrocode} + \setemergencystretch\col@number\hsize +% \end{macrocode} +% Another hook to allow people adding their own extensions without +% making a new package is |\set@floatcmds| which handles any +% redefinitions of \LaTeX{}s internal float commands to work with +% the \mc{} environment. At the moment it is only used to redefine +% |\@dblfloat| and |\end@dblfloat|. +% \changes{v1.2a}{1990/02/05}{\cs{set@floatcmds} added.} +% \begin{macrocode} + \set@floatcmds +% \end{macrocode} +% Additionally, we advance |\baselineskip| by +% |\multicolbaselineskip| to allow corrections for narrow +% columns. +% \begin{macrocode} + \advance\baselineskip\multicolbaselineskip +% \end{macrocode} +% \changes{v1.0e}{1989/06/21}{\cs{textwidth} changed to \cs{linewidth}.} +% \changes{v1.0e}{1989/06/21}{So this file will +% work with the `twocolumn' command.} +% The |\hsize| of the columns is given by the formula: +% \[ +% { |\linewidth| - (|\col@number|-1) +% \times +% |\columnsep| +% \over +% |\col@number|} +% \] +% The formula above has changed from release to release. We now +% start with the current value of |\linewidth| so that the column +% width is properly calculated when we are inside a minipage or a +% list or some other environment. +% This will be achieved with: +% \begin{macrocode} + \hsize\linewidth \advance\hsize\columnsep + \advance\hsize-\col@number\columnsep + \divide\hsize\col@number +% \end{macrocode} +% We also set |\linewidth| and |\columnwidth| to |\hsize| In the past +% |\columnwidth| was left unchanged. This is inconsistent, +% but |\columnwidth| is used only by floats (which +% aren't allowed in their current implementation) and by the +% |\footnote| macro. Since we want page-wide +% footnotes\footnote{I'm not sure that I really want page-wide +% footnotes. But balancing of the last page can +% only be achieved with this approach or with a +% multi-path algorithm which is complicated and +% slow. But it's a challenge to everybody to +% prove me wrong! Another possibility is to +% reimplement a small part of the {\it +% fire\_up\/} procedure in \TeX{} (the program). +% I think that this is the best solution if you +% are interested in complex page makeup, but it +% has the disadvantage that the resulting +% program cannot be called \TeX{} thereafter.} +% this simple trick saved us from rewriting the |\footnote| +% macros. However, some applications referred to |\columnwidth| as +% the ``width of the current column'' to typeset displays +% (the \texttt{amsmath} package, for example) and to allow the use +% of such applications together with \texttt{multicol} this is now +% changed. +% +% Before we change |\linewidth| to the new value we record its old +% value in some register called |\full@width|. This value is +% used later on when we package all columns together. +% \changes{v1.0e}{1989/06/21}{Setting of \cs{columnwidth} removed.} +% \changes{v1.5o}{1997/11/16}{Setting of \cs{columnwidth} added again +% pr/2664.} +% \begin{macrocode} + \full@width\linewidth + \linewidth\hsize + \columnwidth\hsize +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\init@mult@footins} +% This macro is used to set up the parameters associated +% with footnote floats. It can be redefined by applications that +% require different amount of spaces when typesetting footnotes. +% \begin{macrocode} +\def\init@mult@footins{% + \multiply\count\footins\col@number + \multiply\skip \footins\col@number +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\set@mult@vsize} +% +% Since we have to set |\col@umber| columns on one page, +% each with a height of |\@colroom|, we have to assign +% $ +% |\vsize| = |\col@number| \times |\@colroom| +% $ +% in order to collect enough material before entering the +% |\output| routine again. In fact we have to add another +% $ +% (|\col@number|-1) \times (|\baselineskip|-|\topskip|) +% $ +% if you think about it. +% \changes{v1.4p}{1992/11/26}{Macro added.} +% \begin{macrocode} +\def\set@mult@vsize#1{% + \vsize\@colroom + \@tempdima\baselineskip + \advance\@tempdima-\topskip + \advance\vsize\@tempdima + \vsize\col@number\vsize + \advance\vsize-\@tempdima +% \end{macrocode} +% But this might not be enough since we use |\vsplit| later to +% extract the columns from the gathered material. Therefore we add +% some `extra lines,' one for each column plus a corrective action +% depending on the value of the `\texttt{collectmore}' counter. +% The final value is assigned globally if |#1| is |\global| because +% we want to use this macro later inside the output routine too. +% \changes{v1.6c}{2003/04/08}{Collect one line per column more} +% \begin{macrocode} + \advance\vsize\col@number\baselineskip + #1\advance\vsize + \c@collectmore\baselineskip} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\multicol@leftmargin} +% Here is the dimen register we need for saving away the outer +% value of |\@totalleftmargin|. +% \begin{macrocode} +\newdimen\multicol@leftmargin +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@Mvi} +% In versions prior to 1.8r the balancing at the end of the +% environment was done by changing the output routine from +% |\multi@column@out| to |\balance@column@out|. As it turned out +% that this has a couple of issues when the last columns should not +% be balanced after all (for example because they contained several +% |\columnbreak| commands we now stay with one output routine for +% the environment and only signal that we reached the end of the +% environment by marking it with a special penalty that we can check +% for later. +% \changes{v1.8r}{2018/01/28}{Macro added} +% \begin{macrocode} +\mathchardef\@Mvi=10006 % 10005 is \columnbreak +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\endmulticols} +% When the end of the \mc{} environment is sensed we have to +% balance the gathered material. Depending on whether or not we are +% inside a boxed multicol different things must happen. But first +% we end the current paragraph with a |\par| command. +% \begin{macrocode} +\def\endmulticols{\par + \if@boxedmulticols +% \end{macrocode} +% In boxed mode we have to close the box in which we have gathered +% all material for the columns. But before we do this we need to +% remove any space at the end of the box as we don't want to use +% this in balancing. Because of the |\color@endgroup| this can't be +% done later in |\balance@columns| as the color command will hide +% it. +% \changes{v1.8c}{2013/11/03}{Add \cs{color@endgroup} to prevent color leak} +% \changes{v1.8f}{2014/06/19}{Discard spaces before adding \cs{color@endgroup}} +% \begin{macrocode} + \remove@discardable@items\color@endgroup\egroup +% \end{macrocode} +% Now we call |\balance@columns| the routine that balances material +% stored in the box |\mult@box|. +% \changes{v1.5?}{1994/?/?}{Splitting off zero box moved to +% \cs{balance@columns}} +% \begin{macrocode} + \balance@columns +% \end{macrocode} +% After balancing the result has to be returned by the command +% |\page@sofar|. But before we do this we reinsert any marks found +% in box |\mult@box|. +% \begin{macrocode} + \return@nonemptymark{first}% + \kept@firstmark + \return@nonemptymark{bot}% + \kept@botmark + \page@sofar +% \end{macrocode} +% +% \begin{macrocode} + \global\let\kept@firstmark + \l@kept@firstmark + \global\let\kept@botmark + \l@kept@botmark +%<*marktrace> + \mult@info\tw@ + {Restore kept marks to\MessageBreak + first: \meaning\kept@firstmark + \MessageBreak bot\space\space: + \meaning\kept@botmark }% +%</marktrace> +% \end{macrocode} +% This finishes the code for the ``boxed'' case. +% \begin{macrocode} + \else +% \end{macrocode} +% If there was a |\columnbreak| on the very last line all material +% will have been moved to the |\colbreak@box|. Thus the the galley +% will be empty and no output routine gets called so that the text +% is lost. To avoid this problem (though unlikely) we check if the +% current galley is empty and the |\colbreak@box| contains text and +% if so return that to the galley. If the galley is non-empty any +% material in |\colbreak@box| is added in the output routine since +% it needs to be put in front. +% \changes{v1.6d}{2003/04/17}{Catch problem with \cs{columnbreak} in +% last line} +% \begin{macrocode} + \ifdim\pagegoal=\maxdimen + \ifvoid\colbreak@box\else + \mult@info\@ne{Re-adding forced + break(s) for splitting}% + \unvbox\colbreak@box\fi + \fi +% \end{macrocode} +% If we are in an unrestricted \mc{} environment we end the current +% paragraph above with |\par| but this isn't sufficient since \TeX{}s +% {\it page\_builder} will not totally empty the contribution +% list.\footnote{This once caused a puzzling bug where some of the +% material was balanced twice, resulting in some overprints. The +% reason was the \cs{eject} which was placed at the end of +% the contribution list. Then the {\it page\_builder} was called +% (an explicit \cs{penalty} will empty the contribution +% list), but the line with the \cs{eject} didn't fit onto +% the current page. It was then reconsidered after the output +% routine had ended, causing a second break after one line.} +% Therefore we must also add an explicit |\penalty|. Now the +% contribution list will be emptied and, if its material doesn't +% all fit onto the current page then the output routine will be +% called before we change it. +% \changes{v1.3b}{1990/10/09}{Do \cs{penalty} with \cs{addpenalty}} +% \changes{v1.4e}{1992/03/16}{But ignore \cs{@nobreak} in \cs{addpenalty}} +% \changes{v1.5c}{1993/04/18}{Again use \cs{penalty}} +% At this point we need to use |\penalty| not |\addpenalty| to +% ensure that a) the recent contributions are emptied and b) that +% the very last item on the main vertical list is a valid break +% point so that \TeX{} breaks the page in case it is overfull. +% \begin{macrocode} + \penalty\z@ +% \end{macrocode} +% Now it's safe to call the output routine in order to balance +% the columns. We do this by calling it with a special penalty. +% \changes{v1.8r}{2018/01/28}{Use special penalty to signal end of environment} +% \begin{macrocode} + \penalty-\@Mvi +% \end{macrocode} +% If the \mc{} environment body was completely empty or if a +% multi-page \mc{} just ends at a page boundary we have the unusual +% case that the |\eject| will have no effect (since the main +% vertical list is empty)---thus no output routine is called at +% all. As a result the material preceding the \mc{} (stored in +% |\partial@page| will get lost if we don't put this back by hand. +% \changes{v1.4m}{1992/09/04}{Check \cs{partial@page} being emptied} +% \begin{macrocode} + \ifvbox\partial@page + \unvbox\partial@page\fi +% \end{macrocode} +% After the output routine has acted we restore +% the kept marks to their initial value. +% \begin{macrocode} + \global\let\kept@firstmark\@empty + \global\let\kept@botmark\@empty +%<*marktrace> + \mult@info\tw@ + {Make kept marks empty}% +%</marktrace> + \fi +% \end{macrocode} +% The output routine above will take care of the |\vsize| and +% reinsert the balanced columns, etc. But it can't reinsert the +% |\footnotes| because we first have to restore the +% |\footins| parameter since we are returning to one column +% mode. This will be done in the next line of code; we simply close +% the group started in |\multicols|. +% +% To fix an obscure bug which is the result of the current +% definition of the |\begin| \ldots\ |\end| macros, we check that +% we are still (logically speaking) in the \mc{} environment. If, +% for example, we forget to close some environment inside the +% \mc{} environment, the following |\endgroup| would be +% incorrectly considered to be the closing of this environment. +% \changes{v1.3c}{1991/03/14}{Check closing env.} +% \begin{macrocode} + \@checkend{multicols}% + \endgroup +% \end{macrocode} +% We also set the `\textsf{unbalance}' counter to its default. This is +% done globally since \LaTeX{} counters are always changed this +% way.\footnote{Actually, we are still in a group started by the +% \cs{begin} macro, so \cs{global} must be used +% anyway.} +% \begin{macrocode} + \global\c@unbalance\z@ +% \end{macrocode} +% Now it's time to return any footnotes if we are in unrestricted +% mode. In boxed mode footnotes are kept inside, but in that case +% we have to write another column status into the \texttt{.aux} +% file to support \cs{docolaction} in case we have nested +% environments. +% \changes{v1.8s}{2018/04/20}{Support for \cs{docolaction} (issue/39)} +% \begin{macrocode} + \if@boxedmulticols + \mc@col@status@write + \else + \reinsert@footnotes +% \end{macrocode} +% We also take a look at the amount of free space on the current +% page to see if it's time for a page break. The vertical space +% added thereafter will vanish if |\enough@room| starts a new +% page. +% +% But there is one catch. If the |\end{multicols}| is at the top of +% which can happen if there is a break point just before it (such +% as end ending environment) which was chosen. In that case we +% would do the next page using the internal |\vsize| for multicol +% collection which is a disaster. So we better catch this +% case. Fortunately we can detect it by looking at |\pagegoal|. +% \changes{v1.5x}{2000/05/05}{Detect and fix problem if a multicols +% ends at the top of a page} +% \begin{macrocode} + \ifdim \pagegoal=\maxdimen + \global\vsize\@colroom + \else + \enough@room\postmulticols + \fi + \fi + \addvspace\multicolsep +% \end{macrocode} +% There is one more thing to do: the balanced result of the +% environment is supposed to have a |\prevdepth| of zero as we +% backed up by its real prevdepth within |\page@sofar|. However if +% the balancing happened in the output routine then \TeX{} reverts +% to the |\prevdepth| that was current before the OR once the OR has +% finished. In short |\prevdepth| is something you can't set +% globally it is alway local to the current list being built. Thus +% we need to set it back to zero here to avoid incorrect spacing. +% \changes{v1.8h}{2014/09/12}{Set \cs{prevdepdth} for current vlist +% when returning from multicols environment} +% \begin{macrocode} + \prevdepth\z@ +% \end{macrocode} +% If statistics are required we finally report that we have +% finished everything. +% \begin{macrocode} + \mult@info\z@ + {Ending environment + \if@boxedmulticols + \space(boxed mode)\fi + }} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\c@unbalance} +% \SpecialMainIndex{\c@collectmore} +% \SpecialMainIndex{\col@number} +% \SpecialMainIndex{\doublecol@number} +% \SpecialMainIndex{\premulticols} +% \SpecialMainIndex{\multicoltolerance} +% \SpecialMainIndex{\multicolpretolerance} +% \SpecialMainIndex{\page@free} +% \SpecialMainIndex{\premulticols} +% \SpecialMainIndex{\postmulticols} +% \SpecialMainIndex{\multicolsep} +% \SpecialMainIndex{\multicolbaselineskip} +% \SpecialMainIndex{\partial@page} +% Let us end this section by allocating all the registers used so +% far. +% \begin{macrocode} +\newcount\c@unbalance +\newcount\c@collectmore +% \end{macrocode} +% In the new \LaTeX{} release |\col@number| is already allocated by +% the kernel, so we don't allocate it again. +% \begin{macrocode} +%\newcount\col@number +\newcount\doublecol@number +\newcount\multicoltolerance +\newcount\multicolpretolerance +\newdimen\full@width +\newdimen\page@free +\newdimen\premulticols +\newdimen\postmulticols +\newskip\multicolsep +\newskip\multicolbaselineskip +\newbox\partial@page +\newbox\last@line +% \end{macrocode} +% And here are their default values: +% \begin{macrocode} +\c@unbalance = 0 +\c@collectmore = 0 +% \end{macrocode} +% To allow checking whether some macro is used within the \mc{} +% environment the counter |\col@number| gets a default of |1| +% outside the the environment. +% \changes{v1.3d}{1991/10/23}{\cs{col@number} set to one} +% \changes{v1.8o}{2016/02/08}{\cs{col@number} already initialized in the +% kernel, so not initializing it in the package +% in case the document is in two-column (pr/4435)} +% \begin{macrocode} +%\col@number = 1 +\multicoltolerance = 9999 +\multicolpretolerance = -1 +\premulticols = 50pt +\postmulticols= 20pt +\multicolsep = 12pt plus 4pt minus 3pt +\multicolbaselineskip=0pt +% \end{macrocode} +% \end{macro} +% +% \end{multicols} +% +% \begin{multicols}{2}[\subsection{The output routines}] +% +% We first start with some simple macros. When typesetting the page we +% save the columns either in the box registers 0, 2, 4,\ldots\ +% (locally) or 1, 3, 5,\ldots\ (globally). This is \PlainTeX{} policy +% to avoid an overflow of the save stack. +% +% \begin{macro}{\process@cols} +% Therefore we define a |\process@cols| macro to help us in +% using these registers in the output routines below. It has two +% arguments: the first one is a number; the second one is the +% processing information. It loops starting with |\count@=#1| +% (|\count@| is a scratch register defined in \PlainTeX), +% processes argument |#2|, adds two to |\count@|, +% processes argument |#2| again, etc.\ until |\count@| is +% higher than |\doublecol@number|. It might be easier to +% understand it through an example, so we define it now and +% explain its usage afterwards. +% \begin{macrocode} +\def\process@cols#1#2{\count@#1\relax + \loop +%<*debug> + \typeout{Looking at box \the\count@} +%</debug> + #2% + \advance\count@\tw@ + \ifnum\count@<\doublecol@number + \repeat} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\page@sofar} +% We now define |\page@sofar| to give an example of the +% |\process@cols| macro. |\page@sofar| should output everything +% prepared by the balancing routine |\balance@columns|. +% \begin{macrocode} +\def\page@sofar{% +% \end{macrocode} +% |\balance@columns| prepares its output in the even numbered +% scratch box registers. +% Now we output the columns gathered assuming that they are saved +% in the box registers 2 (left column), 4 (second column), \ldots\ +% However, the last column (i.e.\ the right-most) should be saved in +% box register 0.\footnote{You will see the reason for this numbering +% when we look at the output routines +% \cs{multi@column@out} and +% \cs{balance@columns@out}.} +% First we ensure that the columns have equal width. We use +% |\process@cols| for this purpose, starting with +% $|\count@|=|\mult@rightbox|$. Therefore |\count@| loops through +% |\mult@rightbox|, $|\mult@rightbox| + 2$,\ldots +% (to |\doublecol@number|). +% \changes{v1.5a}{1992/11/04}{New box mechanism} +% \begin{macrocode} + \process@cols\mult@rightbox +% \end{macrocode} +% We have to check if the box in question is void, because the +% operation |\wd|\meta{number} on a void box will \emph{not} change +% its dimension (sigh). +% \changes{v1.5h}{1994/08/26}{Check for void boxes} +% \changes{v1.5i}{1994/10/02}{But don't remove original code.} +% \begin{macrocode} + {\ifvoid\count@ + \setbox\count@\hbox to\hsize{}% + \else + \wd\count@\hsize + \fi}% +% \end{macrocode} +% Now we give some tracing information. +% \changes{v1.4l}{1992/08/17}{use \cs{multicol@leftmargin} instead of +% \cs{@totalleftmargin}} +% \changes{v1.6b}{2003/03/15}{Different info display} +% \begin{macrocode} + \count@\col@number \advance\count@\m@ne + \mult@info\z@ + {Column spec: \the\full@width\space = indent + + columns + sep =\MessageBreak + \the\multicol@leftmargin\space + + \the\col@number\space + x \the\hsize\space + + \the\count@\space + x \the\columnsep + }% +% \end{macrocode} +% At this point we should always be in vertical mode. +% \begin{macrocode} +\ifvmode\else\errmessage{Multicol Error}\fi +% \end{macrocode} +% Now we put all columns together in an |\hbox| of width +% |\full@width| (shifting it by |\multicol@leftmargin| to the right +% so that it will be placed correctly if we are within a list +% environment) +% and separating the columns with a rule if desired. +% \changes{v1.5a}{1992/11/04}{New box mechanism} +% \changes{v1.5z}{2000/07/10}{Ensure that column rule has always +% \cs{normalcolor}} +% \changes{v1.6f}{2006/09/19}{Make the color of the rule a hook} +% \changes{v1.4l}{1992/08/17}{use \cs{multicol@leftmargin} instead of +% \cs{@totalleftmargin}} +% +% The box containing the columns has a large height and thus will +% always result in using |\lineskip| if the normal |\baselineskip| +% calculations are used. We therefore better cancel that process. +% \changes{v1.5z1}{2003/02/17}{Suppress interline glue at this point} +% \begin{macrocode} + \nointerlineskip +% \end{macrocode} +% As mentioned earlier we want to have the reference point of the +% box we put on the page being at the baseline of the last line of +% the columns but we also want to ensure that the box has no depth +% so that any following skip is automatically starting from that +% baseline. +% We achieve this by recording the depths of all columns and then +% finally backing up by the maximum. (perhaps a simpler method +% would be to assemble the box in a register and set the depth of +% that box to zero (not checked). +% +% We need a global scratch register for this; using standard \TeX{} +% conventions we choose |\dimen2| and initialize it with the depth +% of the character ``p'' since that is one of the depths that +% compete for the maximum. +% \changes{v1.6a}{2003/03/15}{Preparing for adjusting \cs{prevdepth}} +% \begin{macrocode} + \setbox\z@\hbox{p}\global\dimen\tw@\dp\z@ + \moveright\multicol@leftmargin + \hbox to\full@width{% +% \end{macrocode} +% If the document is written in a language that is typeset right-to-left +% then, of course, the multicol columns should be also typeset +% right-to-left. To support this we call |\mc@align@columns| which +% with execute different code depending on the typesetting direction. +% \changes{v1.7b}{2011/12/18}{RL language support fixed} +% \begin{macrocode} + \mc@align@columns +% \end{macrocode} +% The depths of the columns depend on their last lines. To ensure +% that we will always get a similar look as far as the rules are +% concerned we force the depth to be at least the depth of a +% letter~`p' (which is what we set |\dimen2| to above). +% \begin{macrocode} + \rlap{\phantom p}% + }% +% \end{macrocode} +% The processed material might consist of a last line with a +% descender in which case the |\prevdepth| will be +% non-zero. However, this material is getting reformatted now so +% that this value is likely to be wrong. We therefore normalize the +% situation by pretending that the depth is zero. However, if |\page@sofar| +% is being called inside the OR then setting |\prevdepth| here has +% no long-lasting effect, we therefore have to repeat this once we +% return to the main vertical list. Here we set it only for those +% cases where the command is used within a list and then followed by +% something else. +% \changes{v1.8g}{2014/08/24}{Resetting \cs{prevdepth} in the right place} +% \begin{macrocode} + \prevdepth\z@ +% \end{macrocode} +% Now after typesetting the box we back up to its baseline by using +% the value stored in |\dimen2| (which will hold the largest depth +% found on any column). +% \changes{v1.8g}{2003/03/15}{Now adjusting \cs{prevdepth}} +% \begin{macrocode} + \kern-\dimen\tw@ +% \end{macrocode} +% However, in case one of the columns was unusually deep \TeX{} may +% have tried some corrective actions in which case backing up by +% the saved value will not bring us back to the baseline. A good +% indication for this is a depth of |\maxdepth| though it is not an +% absolute proof. If the option \texttt{grid} is used +% |\mc@gridwarn| will expand to this, otherwise to |\maxdimen| in +% which case this warning will not show up. +% \changes{v1.8g}{2014/08/24}{Warn if value is exceeded not when equal} +% \begin{macrocode} + \ifdim\dimen\tw@ > \mc@gridwarn + \PackageWarning{multicol}% + {Very deep columns!\MessageBreak + Grid alignment might be broken}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\columnseprulecolor} +% \changes{v1.6f}{2006/09/19}{Make the color of the rule a hook} +% By default the vertical rule between columns will be in |\normalcolor|. +% \begin{macrocode} +\def\columnseprulecolor{\normalcolor} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\reinsert@footnotes} +% Before we tackle the bigger output routines we define just one +% more macro which will help us to find our way through the +% mysteries later. |\reinsert@footnotes| will do what its name +% indicates: it reinserts the footnotes present in +% |\footinbox| so that they will be reprocessed by \TeX{}'s +% {\it page\_builder}. +% +% Instead of actually reinserting the footnotes we insert an empty +% footnote. This will trigger insertion mechanism as well and since +% the old footnotes are still in their box and we are on a fresh page +% |\skip| |footins| should be correctly taken into account. +% \changes{v1.3c}{1990/03/03}{\cs{unbox}ing avoided.} +% \begin{macrocode} +\def\reinsert@footnotes{\ifvoid\footins\else + \insert\footins{}\fi} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\vfilmaxdepth} +% This curious definition is used as the space at the bottom of a +% column if we implement |\raggedcolumns|. Normally one only appends +% |\vfill| in that case but this is actually wrong for columns that +% are more or less full: by adding a glue at the bottom such a +% column doesn't have any depth any more but without it the material +% would be allowed a depth of |\maxdepth|. So we allow shrinking by +% that amount. This only makes a difference if the box would +% otherwise become overfull and shrinking never exceeds the +% specified value, so we should be fine. +% \changes{v1.8h}{2014/09/12}{Macro added (pr/4395)} +% \changes{v1.8j}{2015/03/07}{Use only `0.0001fil' for stretching} +% \begin{macrocode} +\def\vfilmaxdepth{\vskip \z@ \@plus .0001fil + \@minus \maxdepth} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\multi@column@out} +% Now we can't postpone the difficulties any longer. The +% |\multi@column@out| routine will be called in two situations. +% Either the page is full (i.e., we have collected enough material +% to generate all the required columns) or a float or marginpar or +% a |\clearpage| is +% sensed. In the latter case the |\outputpenalty| is less +% than $-10000$, otherwise the penalty which triggered the output +% routine is higher. Therefore it's easy to distinguish both +% cases: we simply test this register. +% \changes{v1.5c}{1993/04/18}{Support \cs{clearpage}} +% \begin{macrocode} +\def\multi@column@out{% + \ifnum\outputpenalty <-\@M +% \end{macrocode} +% If this was a |\clearpage|, a float or a marginpar we call +% |\speci@ls| +% \begin{macrocode} + \speci@ls \else +% \end{macrocode} +% otherwise we construct the final page. +% \changes{v1.5u}{1999/05/25}{Support \cs{columnbreak}} +% \changes{v1.5v}{1999/07/18}{Added debug statements for +% column break support} +% For the next block of code see comments in section~\ref{sec:colbreak}. +% \begin{macrocode} + \ifvoid\colbreak@box\else + \mult@info\@ne{Re-adding forced + break(s) for splitting}% + \setbox\@cclv\vbox{% + \unvbox\colbreak@box + \penalty-\@Mv + \unvbox\@cclv}% + \fi +% \end{macrocode} +% Let us now consider the +% normal case. We have to |\vsplit| the columns from the +% accumulated material in box 255. Therefore we first assign +% appropriate values to |\splittopskip| and |\splitmaxdepth|. +% \begin{macrocode} + \splittopskip\topskip + \splitmaxdepth\maxdepth +% \end{macrocode} +% We also need to restrict |\boxmaxdepth| so that re-boxing is not +% generating boxes with arbitrary depth. +% \changes{v1.8j}{2015/03/07}{Set \cs{boxmaxdepth}} +% \begin{macrocode} + \boxmaxdepth\maxdepth +% \end{macrocode} +% Then we calculate the current column height (in |\dimen@|). +% Note that the height of |\partial@page| is already +% subtracted from |\@colroom| so we can use its value as a +% starter. +% \begin{macrocode} + \dimen@\@colroom +% \end{macrocode} +% But we must also subtract the space occupied by footnotes on the +% current page. Note that we first have to reset the skip register +% to its normal value. +% Again, the actual action is carried out in a utility macro, so that +% other applications can modify it. +% \changes{v1.5?}{1994/?/?}{Use \cs{leave@mult@footins}} +% \begin{macrocode} + \divide\skip\footins\col@number + \ifvoid\footins \else + \leave@mult@footins + \fi +% \end{macrocode} +% And there is one more adjustment that we have to make: if the +% user has issue a |\enlargethispage| command then the height the +% |\@kludgeins| box will be the negation of the size by which the +% page should be enlarged. If the star form of this command has +% been used then we also need to shrink the resulting column. + +% That local change will be reverted at the end of the output +% routine So for the next page the original state will be +% reestablished. However, in theory there is a possibility to sneak +% in a whole multicols environment into the running header +% definition. If that happens then it will also be affected by this +% change---too bad I think. +% \changes{v1.8a}{2011/12/20}{Support for \cs{enlargethispage}} +% \changes{v1.8v}{2018/12/27}{Removed dead code, the case where this +% can go wrong is too obscure to worry about it (gh/101)} +% \begin{macrocode} + \ifvbox \@kludgeins + \advance \dimen@ -\ht\@kludgeins +% \end{macrocode} +% The star form of |\enlargethispage| makes the width of the box +% greater than zero (sneaky isn't it?). +% \begin{macrocode} + \ifdim \wd\@kludgeins>\z@ + \shr@nkingtrue + \fi + \fi +% \end{macrocode} +% Now we are able to |\vsplit| off all but the last column. +% Recall that these columns should be saved in the box registers 2, +% 4,\ldots\ (plus offset). +% \changes{v1.5a}{1992/11/04}{New box mechanism} +% \begin{macrocode} + \process@cols\mult@gfirstbox{% + \setbox\count@ + \vsplit\@cclv to\dimen@ +% \end{macrocode} +% After splitting we update the kept marks. +% \begin{macrocode} + \set@keptmarks +% \end{macrocode} +% If |\raggedcolumns| is in force we add a |vfill| at the bottom by +% unboxing the split box. +% But we need to unbox anyway to ensure that at the end of the box +% we do not have unwanted space. This can sneak in in certain +% situations, for example, if two lists follow each other and we +% break between them. While such space is usually zero it still has +% an effect because it hides depth of the last line in the column +% and that will result in incorrect placement. +% \changes{v1.3c}{1990/03/03}{\cs{unbox}ing avoided.} +% \changes{v1.8b}{2013/08/28}{And 20odd years later conclude that +% this was wrong and unboxing is always needed.} +% \changes{v1.8b}{2013/08/28}{Remove discardable items at the +% end of split boxes} +% \changes{v1.8h}{2014/09/12}{Use \cs{vfilmaxdepth}} +% \changes{v1.8k}{2015/03/22}{\cs{remove@discardable@items} removed} +% \begin{macrocode} + \setbox\count@ + \vbox to\dimen@ + {\unvbox\count@ + \ifshr@nking\vfilmaxdepth\fi}% + }% +% \end{macrocode} +% Then the last column follows. +% \changes{v1.5a}{1992/11/04}{New box mechanism} +% \changes{v1.8b}{2013/08/28}{Remove discardable items at the +% end of split boxes} +% \changes{v1.8h}{2014/09/12}{Use \cs{vfilmaxdepth}} +% \changes{v1.8k}{2015/03/22}{\cs{remove@discardable@items} removed} +% \begin{macrocode} + \setbox\mult@rightbox + \vsplit\@cclv to\dimen@ + \set@keptmarks + \setbox\mult@rightbox\vbox to\dimen@ + {\unvbox\mult@rightbox + \ifshr@nking\vfilmaxdepth\fi}% +% \end{macrocode} +% Having done this we hope that box 255 is emptied. If not, we +% reinsert its contents. +% \changes{v1.8a}{2011/12/20}{Only re-add output penalty if it was +% explicitly set} +% \begin{macrocode} + \ifvoid\@cclv \else + \unvbox\@cclv + \ifnum\outputpenalty=\@M + \else + \penalty\outputpenalty + \fi +% \end{macrocode} +% In this case a footnote that happens to fall into the leftover +% bit will be typeset on the wrong page. Therefore we warn the user +% if the current page contains footnotes. The older versions of +% \mc{} produced this warning regardless of whether or not +% footnotes were present, resulting in many unnecessary warnings. +% \changes{v1.3c}{1991/02/17}{Check if footnotes are actually present +% before issuing a warning.} +% \begin{macrocode} + \ifvoid\footins\else + \PackageWarning{multicol}% + {I moved some lines to + the next page.\MessageBreak + Footnotes on page + \thepage\space might be wrong}% + \fi +% \end{macrocode} +% If the `\textsf{tracingmulticols}' counter is 4 or higher we also +% add a rule. +% \begin{macrocode} + \ifnum \c@tracingmulticols>\thr@@ + \hrule\allowbreak \fi + \fi +% \end{macrocode} +% To get a correct marks for the current page we have to (locally) +% redefine |\firstmark| and |\botmark|. +% If |\kept@firstmark| is non-empty then |\kept@botmark| must be +% non-empty too so we can use their values. Otherwise we use the +% value of |\kept@topmark| which was first initialized when we +% gathered the |\partical@page| and later on was updated to the +% |\botmark| for the preceding page. +% +% \changes{v1.4a}{1992/02/14}{\cs{botmark} set to \cs{splitbotmark}} +% \begin{macrocode} + \ifx\@empty\kept@firstmark + \let\firstmark\kept@topmark + \let\botmark\kept@topmark + \else + \let\firstmark\kept@firstmark + \let\botmark\kept@botmark + \fi +% \end{macrocode} +% We also initialize |\topmark| with |\kept@topmark|. This will make +% this mark okay for all middle pages of the \mc{} environment. +% \changes{v1.5d}{1993/09/15}{reinit \cs{topmark}} +% \begin{macrocode} + \let\topmark\kept@topmark +%<*marktrace> + \mult@info\tw@ + {Use kept top mark:\MessageBreak + \meaning\kept@topmark + \MessageBreak + Use kept first mark:\MessageBreak + \meaning\kept@firstmark + \MessageBreak + Use kept bot mark:\MessageBreak + \meaning\kept@botmark + \MessageBreak + Produce first mark:\MessageBreak + \meaning\firstmark + \MessageBreak + Produce bot mark:\MessageBreak + \meaning\botmark + \@gobbletwo}% +%</marktrace> +% \end{macrocode} +% With a little more effort we could have done better. If we had, +% for example, recorded the shrinkage of the material in +% |\partial@page| it would be now possible to try higher +% values for |\dimen@| (i.e.\ the column height) to overcome +% the problem with the nonempty box 255. But this would make the +% code even more complex so I skipped it in the current +% implementation. +% +% Now we use \LaTeX{}'s standard output +% mechanism.\footnote{This will produce a lot of overhead since both +% output routines are held in memory. The correct +% solution would be to redesign the whole output +% routine used in \LaTeX.} +% Admittedly this is a funny way to do it. +% +% Within the OR |\boxmaxdepth| needs to be unrestricted so we set it back +% now as it was changed above. +% \changes{v1.8p}{2016/04/07}{Reset \cs{boxmaxdepth}} +% \begin{macrocode} + \boxmaxdepth\maxdimen + \setbox\@cclv\vbox{\unvbox\partial@page + \page@sofar}% +% \end{macrocode} +% The macro |\@makecol| adds all floats assigned for the current +% page to this page. |\@outputpage| ships out the resulting box. +% Note that it is just possible that such floats are present even +% if we do not allow any inside a \mc{} environment. +% \begin{macrocode} + \@makecol\@outputpage +% \end{macrocode} +% After the page is shipped out we have to prepare the kept marks +% for the following page. |\kept@firstmark| and |\kept@botmark| +% reinitialized by setting them to |\@empty|. The value of +% |\botmark| is then assigned to |\kept@topmark|. +% \changes{v1.4g}{1992/06/03}{Only change \cs{kept@topmark} if +% \cs{kept@botmark} non-empty} +% \changes{v1.4i}{1992/06/18}{Set \cs{kept@topmark} to \cs{botmark}} +% \begin{macrocode} + \global\let\kept@topmark\botmark + \global\let\kept@firstmark\@empty + \global\let\kept@botmark\@empty +%<*marktrace> + \mult@info\tw@ + {(Re)Init top mark:\MessageBreak + \meaning\kept@topmark + \@gobbletwo}% +%</marktrace> +% \end{macrocode} +% Now we reset |\@colroom| to |\@colht| which is \LaTeX's +% saved value of |\textheight|. +% We also have to reset the recorded position of the last +% |\marginpar| as well as the recorded size of in-text floats +% as we are now on a new page. +% \changes{v1.8d}{2014/04/23}{Reset \cs{@mparbottom} after page finishes} +% \changes{v1.8n}{2015/08/19}{Reset \cs{@textfloatsheight} after page finishes} +% \begin{macrocode} + \global\@colroom\@colht + \global \@mparbottom \z@ + \global \@textfloatsheight \z@ +% \end{macrocode} +% Then we process deferred floats waiting for their chance to be +% placed on the next page. +% \begin{macrocode} + \process@deferreds + \@whilesw\if@fcolmade\fi{\@outputpage + \global\@colroom\@colht + \process@deferreds}% +% \end{macrocode} +% If the user is interested in statistics we inform him about the +% amount of space reserved for floats. +% \begin{macrocode} + \mult@info\@ne + {Colroom:\MessageBreak + \the\@colht\space + after float space removed + = \the\@colroom \@gobble}% +% \end{macrocode} +% Having done all this we must prepare to tackle the next page. +% Therefore we assign a new value to |\vsize|. New, because +% |\partial@page| is now empty and |\@colroom| might be +% reduced by the space reserved for floats. +% \changes{v1.4p}{1992/11/26}{Use different \cs{vsize} setting} +% \begin{macrocode} + \set@mult@vsize \global +% \end{macrocode} +% The |\footins| skip register will be adjusted when the output +% group is closed. +% \changes{v1.3c}{1991/03/03}{Unnecessary code removed} +% \begin{macrocode} + \fi} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\leave@mult@footins} +% This macro is used to subtract the amount of space +% occupied by footnotes for the current space from the +% space available for the current column. The space current column +% is stored in |\dimen@|. See above for the description of the default +% action. +% \changes{v1.5?}{1994/?/?}{Macro added} +% \begin{macrocode} +\def\leave@mult@footins{% + \advance\dimen@-\skip\footins + \advance\dimen@-\ht\footins +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\speci@ls} +% We left out two macros: |\process@deferreds| and +% |\speci@ls|. +% \changes{v1.5c}{1993/04/18}{Support \cs{clearpage}} +% \begin{macrocode} +\def\speci@ls{% + \ifnum\outputpenalty <-\@Mi +% \end{macrocode} +% If the document ends in the middle of a multicols environment, e.g., +% if the user forgot the |\end{multicols}|, \TeX{} adds a very +% negative penalty to the end of the galley which is intended to signal +% the output routine that it is time to prepare for shipping out +% everything remaining. Since inside multicols the output routine of +% \LaTeX{} is disabled sometimes we better check for this case: if we +% find a very negative penalty we produce an error message and run +% the default output routine for this case. +% \changes{v1.5s}{1998/09/10}{check for \cs{stop} penalty pr/2873} +% \begin{macrocode} + \ifnum \outputpenalty<-\@MM + \PackageError{multicol}{Document end + inside multicols environment}\@ehd + \@specialoutput + \else +% \end{macrocode} +% \changes{v1.5u}{1999/05/25}{Support \cs{columnbreak}} +% \changes{v1.5v}{1999/07/18}{Added debug statements for +% column break support} +% For the next block of code see comments in section~\ref{sec:colbreak}. +% \begin{macrocode} + \ifnum\outputpenalty = -\@Mv + \mult@info\@ne{Forced column + break seen}% + \global\advance\vsize-\pagetotal + \global\setbox\colbreak@box + \vbox{% + \ifvoid\colbreak@box + \else + \unvbox\colbreak@box + \penalty-\@Mv + \fi +% \end{macrocode} +% As this is the place of a forced break we now remove vertical +% white space just in front of it (or some of it at least) as it is +% quite likely that the break is not exactly in the right place, +% e.g., after a display environment (if LaTeX would break here by +% its own it would break before the space following the display). +% +% Thus we rebox box 255 once (using |\maxdepth| and calling +% |\remove@discardable@items| inside). The depth of 255 will then +% give us the depth the box would have had if it would have been a +% natural break. We then unbox 255 to get it into the +% |\colbreak@box| and then back up by this depth. This will position +% the bottom of the box at its natural baseline which is useful for +% balancing later on. +% \changes{v1.8k}{2015/03/21}{Remove discardable items just before a +% forced break} +% \begin{macrocode} + \boxmaxdepth\maxdepth + \setbox\@cclv\vbox{% + \unvbox\@cclv + \remove@discardable@items}% + \dimen@\dp\@cclv + \unvbox\@cclv + \kern-\dimen@ + }% + \reinsert@footnotes + \else +% \end{macrocode} +% Another special case is reaching the end of the \mc{} +% environment which is signaled by |-\@Mvi|. +% \changes{v1.8r}{2018/01/28}{Handling end of env through special penalty} +% \begin{macrocode} + \ifnum\outputpenalty = -\@Mvi + \mult@info\@ne{End penalty of multicols seen}% +% \end{macrocode} +% If we are at this point then have have to run the balancing code +% (which was previously its own output routine). First we pretend +% that we had a normal forced breakpoint and then call +% |\balance@column@out|. The latter may be let to |\multi@column@out| +% if we are inside \texttt{multicols*} in which case we would get a loop +% if the |\outputpenalty| is not changed---this could be cleaned up +% in a better way; basically it is like this, because of the older +% code was using different ORs and I simply reused most of it. +% \begin{macrocode} + \outputpenalty\@M % pretend we had a natural forced break + \balance@columns@out + \else +% \end{macrocode} +% If we encounter a float or a marginpar in the current +% implementation we simply warn the user that this is not allowed. +% Then we reinsert the page and its footnotes. +% \begin{macrocode} + \PackageWarningNoLine{multicol}% + {Floats and marginpars not + allowed inside `multicols' + environment!}% + \unvbox\@cclv\reinsert@footnotes +% \end{macrocode} +% Additionally we empty the |\@currlist| to avoid later error +% messages when the \LaTeX{} output routine is again in force. +% But first we have to place the boxes back onto the +% |\@freelist|. (|\@elt|s default is |\relax| so +% this is possible with |\xdef|.) +% \changes{v1.2a}{1990/02/05}{Float boxes freed.} +% \begin{macrocode} + \xdef\@freelist{\@freelist\@currlist}% + \gdef\@currlist{}% + \fi + \fi + \fi +% \end{macrocode} +% If the penalty is $-10001$ it will come from a |\clearpage| and +% we will execute |\@doclearpage| to get rid of any deferred +% floats. +% \begin{macrocode} + \else \@doclearpage \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\process@deferreds} +% |\process@deferreds| is a simplified version of \LaTeX{}'s +% |\@startpage|. We first call the macro +% |\@floatplacement| to save the current user parameters in +% internal registers. Then we start a new group and save the +% |\@deferlist| temporarily in the macro |\@tempb|. +% \begin{macrocode} +\def\process@deferreds{% + \@floatplacement + \@tryfcolumn\@deferlist + \if@fcolmade\else + \begingroup + \let\@tempb\@deferlist +% \end{macrocode} +% Our next action is to (globally) empty |\@deferlist| and +% assign a new meaning to |\@elt|. Here |\@scolelt| is a +% macro that looks at the boxes in a list to decide whether they +% should be placed on the next page (i.e.\ on |\@toplist| or +% |\@botlist|) or should wait for further processing. +% \begin{macrocode} + \gdef\@deferlist{}% + \let\@elt\@scolelt +% \end{macrocode} +% Now we call |\@tempb| which has the form +% \begin{center} +% |\@elt|\meta{box register}|\@elt|^^A +% \meta{box register}\ldots{} +% \end{center} +% So |\@elt| (i.e.\ |\@scolelt|) will distribute the +% boxes to the three lists. +% \begin{macrocode} + \@tempb \endgroup + \fi} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{ifshr@nking} +% \begin{macro}{\raggedcolumns} +% \begin{macro}{\flushcolumns} +% \changes{v1.1a}{1989/09/20}{\cs{flushedcolumns} renamed to \cs{flushcolumns}.} +% The |\raggedcolumns| and |\flushcolumns| +% declarations are defined with the help of a new |\if...| +% macro. +% \begin{macrocode} +\newif\ifshr@nking +% \end{macrocode} +% The actual definitions are simple: we just switch to \textsf{true} +% or \textsf{false} depending on the desired action. To avoid extra +% spaces in the output we enclose these changes in +% |\@bsphack|\ldots{}\allowbreak|\@esphack|. +% \begin{macrocode} +\def\raggedcolumns{% + \@bsphack\shr@nkingtrue\@esphack} +\def\flushcolumns{% + \@bsphack\shr@nkingfalse\@esphack} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\balance@columns@out} +% Now for the last part of the show: the column balancing output +% routine. Since this code is called with an explicit penalty +% (|\eject|) there is no need to check for something special (eg +% floats). We start by balancing the material gathered. +% \begin{macrocode} +\def\balance@columns@out{% +% \end{macrocode} +% For this we need to put the contents of box 255 into |\mult@box|. +% \changes{v1.5u}{1999/05/25}{Support \cs{columnbreak}} +% \changes{v1.5v}{1999/07/18}{Added debug statements for column break +% support} For the next block of code see also comments in +% section~\ref{sec:colbreak}. All forced breaks except the last are +% inside |\colbreak@box| so all we have to do is to concatenate this +% box with box |\@cclv| and put a penalty in between. Here we test if +% |\colbreak@box| is void so that the message is only generated if +% we really add forced breaks and the penalty. +% \changes{v1.8k}{2015/03/21}{Use \cs{@Mv} and not \cs{break} in case +% this forced break is not used on this page} +% \begin{macrocode} + \setbox\mult@box\vbox{% + \ifvoid\colbreak@box\else + \unvbox\colbreak@box + \penalty-\@Mv + \mult@info\@ne{Re-adding + forced break(s) in balancing}% + \fi + \unvbox\@cclv +% \end{macrocode} +% The last column again is a forced break, so here we discard white +% space as well as that is normally unwanted. +% \changes{v1.8k}{2015/03/21}{Add \cs{remove@discardable@items} at the +% end of the last column when balancing.} +% \begin{macrocode} + \remove@discardable@items + }% + \balance@columns +% \end{macrocode} +% If during balancing the columns got too long the flag +% |\iftoo@bad| is set to true. +% \changes{v1.8a}{2011/12/20}{Balancing concept improved} +% \begin{macrocode} + \iftoo@bad + \mult@info\@ne + {Balancing failed ... + cut a normal page}% +% \end{macrocode} +% In that case we put the material back in box 255 so that we can +% cut a normal page. The curious set of +% |\vskip|s we add is necessary to cancel out the |\splittopskip| +% that got added for balancing. +% \begin{macrocode} + \setbox\@cclv\vbox + {\vskip\topskip + \vskip-\splittopskip + \unvbox\mult@box +% \end{macrocode} +% We also have to re-add the end of environment penalty since after +% this page we may want balance the remaining material. +% \changes{v1.8r}{2018/01/28}{Re-add the final penalty} +% \begin{macrocode} + \penalty-\@Mvi + }% +% \end{macrocode} +% We then call the standard multicol output routine which will +% produce a normal page for us (remember we are still within the +% OR so some part of the code in |\multi@column@out| is actually not +% doing anything---perhaps this should be cleaned up at some point). +% This also means that if there was an |\enlargethispage| present +% it will apply to this page as |\multi@column@out| will look at +% the status of |\@kludgeins|. +% \begin{macrocode} + \multi@column@out +% \end{macrocode} +% Because balancing made the columns too long we are sure that there +% will be some material remaining which was put back onto the main +% vertical list by |\multi@column@out|. This will also put the +% explicit |\eject| penalty back so the current +% |\balance@columns@out| output routine will be called again (so we +% better do not add another penalty or else the OR will be called +% twice and we may get scrambled results). +% \changes{v1.8k}{2015/03/21}{No additional penalty here} +% \begin{macrocode} + \else +% \end{macrocode} +% If the balancing went ok, we are in the position +% to apply |\page@sofar|. But first we have to set |\vsize| to a +% value suitable for one column output. +% \begin{macrocode} + \global\vsize\@colroom + \global\advance\vsize\ht\partial@page +% \end{macrocode} +% We also have to look at |\@kludgeins| and generate a new +% |\insert| in case there was one present due to an +% |\enlargethispage| command. +% \changes{v1.8a}{2011/12/20}{Support for \cs{enlargethispage}} +% \begin{macrocode} + \ifvbox\@kludgeins\insert\@kludgeins + {\unvbox\@kludgeins}\fi +% \end{macrocode} +% Then we |\unvbox| the |\partial@page| (which may be void if we +% are not processing the first page of this \mc{} environment. +% \begin{macrocode} + \unvbox\partial@page +% \end{macrocode} +% Then we return the first and bottom mark and the gathered +% material to the main vertical list. +% \begin{macrocode} + \return@nonemptymark{first}\kept@firstmark + \return@nonemptymark{bot}\kept@botmark + \page@sofar +% \end{macrocode} +% We need to add a penalty at this point which allows to break at +% this point since calling the output routine may have removed the +% only permissible break point thereby ``glueing'' any following +% skip to the balanced box. In case there are any weird settings +% for |\multicolsep| etc. this could produce funny results. +% \changes{v1.5c}{1993/04/18}{added penalty at output routine exit} +% \begin{macrocode} + \penalty\z@ + \fi +} +% \end{macrocode} +% As we already know, reinserting of footnotes will be done in the +% macro |\endmulticols|. +% \end{macro} +% +% +% \begin{macro}{\balance@columns} +% This macro now does the actual balancing. +% \begin{macrocode} +\def\balance@columns{% +% \end{macrocode} +% We start by setting the kept marks by updating them with any +% marks from this box. This has to be done \emph{before} we add a +% penalty of $-10000$ to the top of the box, otherwise only an +% empty box will be considered. +% \changes{v1.5h}{1994/08/26}{Get kept marks first} +% \begin{macrocode} + \get@keptmarks\mult@box +% \end{macrocode} +% We then continue by resetting trying to remove any discardable +% stuff at the end of |\mult@box|. This is rather experimental. We +% also add a forced break point at the very beginning, so that we +% can split the box to height zero later on, thereby adding a known +% |\splittopskip| glue at the beginning. +% \changes{v1.8k}{2015/03/21}{\cs{remove@discardable@items} removed} +% \begin{macrocode} + \setbox\mult@box\vbox{% + \penalty-\@M + \unvbox\mult@box + }% +% \end{macrocode} +% Then follow values assignments to get the |\vsplit|ting right. +% We use the natural part of |\topskip| as the natural part for +% |\splittopskip| and allow for a bit of undershoot and overshoot +% by adding some stretch and shrink. +% \changes{v1.5?}{1994/?/?}{Allow columns to come out a bit long or short} +% \begin{macrocode} + \@tempdima\topskip + \splittopskip\@tempdima + \@plus\multicolundershoot + \@minus\multicolovershoot + \splitmaxdepth\maxdepth +% \end{macrocode} +% We also have to set |\boxmaxdepth| which normally allows to +% build boxes with arbitrary depth, but as we are building text +% columns we really want to restrict the depth. This is necessary as +% we sometimes rebox the boxes generated by |\vsplit| and then the +% restriction posed by |\splitmaxdepth| gets lost. +% \changes{v1.8h}{2014/09/12}{All column boxes should obey +% \cs{maxdepth} (pr/4395)} +% \begin{macrocode} + \boxmaxdepth\maxdepth +% \end{macrocode} +% The next step is a bit tricky: when \TeX{} assembles material in +% a box, the first line isn't preceded by interline glue, i.e. +% there is no parameter like |\boxtopskip| in \TeX{}. This means +% that the baseline of the first line in our box is at some +% unpredictable point depending on the height of the largest +% character in this line. But of course we want all columns to +% align properly at the baselines of their first lines. For this +% reason we have opened |\mult@box| with a |\penalty| \textsf{-10000}. +% This will now allow us to split off from |\mult@box| a tiny bit +% (in fact nothing since the first possible break-point is the +% first item in the box). The result is that |\splittopskip| is +% inserted at the top of |\mult@box| which is exactly what we like +% to achieve. +% \changes{v1.5?}{1994/?/?}{Do splitting to zero here} +% \begin{macrocode} + \setbox\@tempboxa\vsplit\mult@box to\z@ +% \end{macrocode} +% Next we try to find a suitable starting point for the calculation +% of the column height. It should be less than the height finally +% chosen, but large enough to reach this final value in only a few +% iterations. The formula which is now implemented will try to +% start with the nearest value which is a multiple of +% |\baselineskip|. The coding is slightly tricky in \TeX{} and +% there are perhaps better ways \ldots +% \changes{v1.4d}{1992/03/04}{New algorithm for start height} +% \begin{macrocode} + \@tempdima\ht\mult@box + \advance\@tempdima\dp\mult@box + \divide\@tempdima\col@number +% \end{macrocode} +% The code above sets |\@tempdima| to the length of a column if we +% simply divide the whole box into equal pieces. To get to the next +% lower multiple of |\baselineskip| we convert this dimen to a +% number (the number of scaled points) then divide this by +% |\baselineskip| (also in scaled points) and then multiply this +% result with |\baselineskip| assigning the result to |\dimen@|. +% This makes |\dimen@| $\leq$ to |\@tempdimena|. +% \begin{macrocode} + \count@\@tempdima + \divide\count@\baselineskip + \dimen@\count@\baselineskip +% \end{macrocode} +% Next step is to correct our result by taking into account the +% difference between |\topskip| and |\baselineskip|. We start by +% adding |\topskip|; if this makes the result too large then we +% have to subtract one |\baselineskip|. +% \begin{macrocode} + \advance\dimen@\topskip + \ifdim \dimen@ >\@tempdima + \advance\dimen@-\baselineskip + \fi +% \end{macrocode} +% As a further restriction we want to see a minimum number of +% rows in the balanced result based on the setting of the counter +% |minrows|. If the starting value is lower we adjust. +% \changes{v1.8w}{2019/03/01}{Provide minrows counter for balancing} +% \begin{macrocode} + \@tempdima\dimexpr + \topskip +\c@minrows\baselineskip-\baselineskip\relax + \ifnum\dimen@<\@tempdima + \mult@info\@ne + {Start value + \the\dimen@ \space -> + \the\@tempdima \space (corrected for minrows)}% + \dimen@\@tempdima + \fi +% \end{macrocode} +% At the user's request we start with a higher value (or lower, but +% this usually only increases the number of tries). +% \begin{macrocode} + \advance\dimen@\c@unbalance\baselineskip +% \end{macrocode} +% We type out statistics if we were asked to do so. +% \changes{v1.4f}{1992/04/28}{\cs{on@line} added to tracing info} +% \begin{macrocode} + \mult@info\@ne + {Balance columns\on@line: + \ifnum\c@unbalance=\z@\else + (off balance=\number\c@unbalance)\fi + \@gobbletwo}% +% \end{macrocode} +% But we don't allow nonsense values for a start. +% \begin{macrocode} + \ifnum\dimen@<\topskip + \mult@info\@ne + {Start value + \the\dimen@ \space -> + \the\topskip \space (corrected)}% + \dimen@\topskip + \fi +% \end{macrocode} +% Now we try to find the final column height. We start by setting +% |\vbadness| to infinity (i.e.\ $10000$) to suppress +% underfull box reports while we are trying to find an acceptable +% solution. We do not need to do it in a group since at the end of +% the output routine everything will be restored. The setting of +% the final columns will nearly always produce underfull boxes with +% badness $10000$ so there is no point in warning the user about +% it. +% \changes{v1.2a}{1990/02/05}{Group around main loop removed.} +% \begin{macrocode} + \vbadness\@M +% \end{macrocode} +% We also allow for overfull boxes while we trying to split the +% columns. They can easily happen if we have objects with unusual depth. +% \changes{v1.8h}{2014/09/12}{Do not report overfull} +% \begin{macrocode} + \vfuzz \maxdimen +% \end{macrocode} +% The variable |\last@try| will hold the dimension used in the +% previous trial splitting. We initialize it with a negative value. +% \changes{v1.5?}{1994/?/?}{Initialize \cs{last@try}} +% \begin{macrocode} + \last@try-\p@ + \loop +% \end{macrocode} +% In order not to clutter up \TeX{}'s valuable main memory with +% things that are no longer needed, we empty all globally used box +% registers. This is necessary if we return to this point after an +% unsuccessful trial. We use |\process@cols| for this purpose, +% starting with |\mult@grightbox|. Note the extra braces around +% this macro call. They are needed since \PlainTeX{}'s +% |\loop|\ldots{}\allowbreak|\repeat| mechanism cannot be nested on +% the same level of grouping. +% \changes{v1.5a}{1992/11/04}{New box mechanism} +% \begin{macrocode} + {\process@cols\mult@grightbox + {\global\setbox\count@ + \box\voidb@x}}% +% \end{macrocode} +% The contents of box |\mult@box| are now copied globally to +% box~|\mult@grightbox|. (This will be the right-most column, as +% we shall see later.) +% \begin{macrocode} + \global\setbox\mult@grightbox + \copy\mult@box +% \end{macrocode} +% We start with the assumption that the trial will be successful. +% If we end up with a solution that is too bad we set +% |too@bad| to \texttt{true}. We also assume that all forced breaks +% (if any) will be used during balancing. If this is not the case +% we record this in |forcedbreak@leftover|. +% \changes{v1.5b}{1992/11/05}{New badness mechanism} +% \changes{v1.8k}{2015/03/21}{Init \cs{ifforcedbreak@leftover}} +% \begin{macrocode} +%<*badness> + \too@badfalse + \forcedbreak@leftoverfalse +%</badness> +% \end{macrocode} +% Using |\vsplit| we extract the other columns from box register +% |\mult@grightbox|. This leaves box register |\mult@box| +% untouched so that we can start over again if this trial was +% unsuccessful. +% \begin{macrocode} + {\process@cols\mult@firstbox{% + \global\setbox\count@ + \vsplit\mult@grightbox to\dimen@ +% \end{macrocode} +% After splitting we need to ensure that there isn't any space at +% the bottom, so we rebox once more. +% \changes{v1.8b}{2013/08/28}{Remove discardable items at the +% end of split boxes} +% \changes{v1.8k}{2015/03/21}{Do not use \cs{remove@discardable@items} +% here} +% \begin{macrocode} + \global\setbox\count@ + \vbox to\dimen@ + {\unvbox\count@}% +% \end{macrocode} +% After every split we check the badness of the resulting column, +% normally the amount of extra white in the column. +% \begin{macrocode} +%<*badness> + \ifnum\c@tracingmulticols>\@ne + \@tempcnta\count@ + \advance\@tempcnta-\mult@grightbox + \divide\@tempcnta \tw@ + \message{^^JColumn + \number\@tempcnta\space + badness: \the\badness\space}% + \fi +% \end{macrocode} +% If this badness is larger than the allowed column badness +% we reject this solution by setting |too@bad| to \texttt{true}. +% \begin{macrocode} + \ifnum\badness>\c@columnbadness + \ifnum\c@tracingmulticols>\@ne + \message{too bad + (>\the\c@columnbadness)}% + \fi + \too@badtrue + \fi +%</badness> + }}% +% \end{macrocode} +% There is one subtle point here: while all other constructed boxes +% have a depth that is determined by |\splitmaxdepth| and/or +% |\boxmaxdepth| the last box +% will get a natural depth disregarding the original setting and +% the value of |\splitmaxdepth| or |\boxmaxdepth|. This means that +% we may end up with a very large depth in box |\mult@grightbox| +% which would +% make the result of the testing incorrect. So we change the value +% by unboxing the box into itself. +% \begin{macrocode} + \global\setbox\mult@grightbox + \vbox{\unvbox\mult@grightbox}% +% \end{macrocode} +% We also save a copy |\mult@firstbox| at its ``natural'' size +% for later use. +% \begin{macrocode} + \setbox\mult@nat@firstbox + \vbox{\unvcopy\mult@firstbox}% +% \end{macrocode} +% After |\process@cols| has done its job we have the following +% situation: +% \begin{center} +% \begin{tabular}{r@{$\:\:\longleftarrow\:\:$}l} +% box |\mult@rightbox| & all material \\ +% box |\mult@gfirstbox| & first column \\ +% box |\mult@gfirstbox|${}+2$ & second column \\ +% \multicolumn{1}{c}{$\vdots$} & +% \multicolumn{1}{c}{$\vdots$} \\ +% box |\mult@grightbox| & last column +% \end{tabular} +% \end{center} +% We report the height of the first column, in brackets +% the natural size is given. +% \changes{v1.5?}{1994/?/?}{Show natural size} +% \begin{macrocode} + \ifnum\c@tracingmulticols>\@ne + \message{^^JFirst column + = \the\dimen@\space + (\the\ht\mult@nat@firstbox)}\fi +% \end{macrocode} +% If |\raggedcolumns| is in force older releases of this file also +% shrank the first column to its natural height at this point. +% This was done so that the first column doesn't run short compared +% to later columns but it is actually producing incorrect results +% (overprinting of text) in boundary cases, so since version v1.5q +% |\raggedcolumns| means allows for all columns to run slightly short. +% \changes{v1.5q}{1998/01/19}{Do not reset \cs{mult@firstbox} (pr2739)} +% \begin{macrocode} +% \ifshr@nking +% \global\setbox\mult@firstbox +% \copy\mult@nat@firstbox +% \fi +% \end{macrocode} +% Then we give information about the last column.\footnote{With +% \TeX{} version 3.141 it is now possible to use \LaTeX's +% \cs{newlinechar} in the \cs{message} command, but +% people with older \TeX{} versions will now get +% \texttt{\string^\string^J} instead of a new line on the screen.} +% \changes{v1.4a}{1992/02/12}{Changed to proper \cs{endlinechar} in\cs{message}} +% \begin{macrocode} + \ifnum\c@tracingmulticols>\@ne + \message{<> last column = + \the\ht\mult@grightbox^^J}% +% \end{macrocode} +% Some tracing code that we don't compile into the production version +% unless asked for. It will produce huge listings of the boxes +% involved in balancing in the transcript file. +% \changes{v1.6f}{2004/07/03}{need to use \cs{mult@grightbox} in the loop} +% \begin{macrocode} +%<*debug> + \ifnum\c@tracingmulticols>4 + {\showoutput + \batchmode + \process@cols\mult@grightbox + {\showbox\count@}}% + \errorstopmode + \fi +%</debug> + \fi +% \end{macrocode} +% We check whether our trial was successful. The test used is very +% simple: we merely compare the first and the last column. Thus +% the intermediate columns may be longer than the first if +% |\raggedcolumns| is used. If the right-most column is +% longer than the first then we start over with a larger value for +% |\dimen@|. +% \changes{v1.3c}{1991/03/03}{\cs{global}\cs{advance} left over from older code} +% \begin{macrocode} + \ifdim\ht\mult@grightbox >\dimen@ +% \end{macrocode} +% If the height of the last box is too large we mark this trial as +% unsuccessful. +% \changes{v1.5v}{1999/07/18}{Added tracing statements for +% trial unsuccessful} +% \begin{macrocode} +%<*badness> + \too@badtrue + \ifnum\c@tracingmulticols>\@ne + \typeout{Rejected: last + column too large!}% + \fi + \else +% \end{macrocode} +% \changes{v1.5v}{1999/07/18}{Check last column if it contains forced +% break and reject trial if that is the case} +% +% To ensure that there isn't a forced break in the last column we +% try to split off a box of size |\maxdimen| from |\mult@grightbox| +% (or rather from a copy of it). This should result in a void box +% after the split, unless there was a forced break somewhere within +% the column in which case the material after the break would have +% stayed in the box. +% \begin{macrocode} + \setbox\@tempboxa + \copy\mult@grightbox + \setbox\z@\vsplit\@tempboxa to\maxdimen + \ifvoid\@tempboxa +% \end{macrocode} +% Thus if |\@tempboxa| is void we have a valid solution. +% In this case we take a closer +% look at the last column to decide if this column should be made +% as long as all other columns or if it should be allowed to be +% shorter. +% For this we first have to rebox the column into a box of the +% appropriate height. If tracing is enabled we then display the +% badness for this box. +% \begin{macrocode} + \global\setbox\mult@grightbox + \vbox to\dimen@ + {\unvbox\mult@grightbox}% + \ifnum\c@tracingmulticols>\@ne + \message{Final badness: + \the\badness}% + \fi +% \end{macrocode} +% We then compare this badness with the allowed badness for the final +% column. If it does not exceed this value we use the box, otherwise +% we rebox it once more and add some glue at the bottom. +% \changes{v1.8h}{2014/09/12}{Use \cs{vfilmaxdepth}} +% \changes{v1.8j}{2015/03/07}{Use \cs{vfil} in this case} +% \begin{macrocode} + \ifnum\badness>\c@finalcolumnbadness + \global\setbox\mult@grightbox + \vbox to\dimen@ + {\unvbox\mult@grightbox\vfil}% + \ifnum\c@tracingmulticols>\@ne + \message{ setting natural + (> \the\c@finalcolumnbadness)}% + \fi + \fi +% \end{macrocode} +% If |\@tempboxa| above was not void our trial was unsuccessful and +% we report this fact and try again. +% \changes{v1.6f}{2004/07/03}{\texttt{/colbreak} guard in the wrong position} +% \begin{macrocode} + \else +% \end{macrocode} +% If we have unprocessed forced breaks we normally reiterate with a +% larger column size to fit them in eventually. However, if there +% are simply too many of them (e.g., 3 forced breaks but only 2 +% columns to balance) then this will never succeed and and we would +% continue growing the columns until we hit the largest possible +% column size. So in addition we check how big the column size is +% compared to available room and if we exceed this by +% |\maxbalancingoverflow| we give up and instead of balancing cut +% another normal page. To be indicate this case we set +% |forcedbreak@leftover| to true. +% \changes{v1.8k}{2015/03/21}{Watch out for columns growing too far in +% case of forced breaks} +% \changes{v1.8l}{2015/03/25}{Added additional tracing if column overflows} +% \begin{macrocode} + \@tempdima\@colroom + \advance\@tempdima \maxbalancingoverflow + \ifdim \dimen@ < \@tempdima + \too@badtrue + \ifnum\c@tracingmulticols>\@ne + \typeout{Rejected: unprocessed + forced break(s) in last column!}% + \fi + \else + \forcedbreak@leftovertrue + \ifnum\c@tracingmulticols>\@ne + \typeout{Failed: columns too large + with unprocessed forced break(s)!}% + \fi + \fi + \fi + \fi +% \end{macrocode} +% If the natural height of the first box is smaller than the +% current trial size but is larger than the previous trial size it +% is likely that we have missed a potentially better +% solution. (This could have happened if for some reason our first +% trial size was too high.) In that case we dismiss this trial and +% restart using the natural height for the next trial. +% \begin{macrocode} + \ifdim\ht\mult@nat@firstbox<\dimen@ + \ifdim\ht\mult@nat@firstbox>\last@try + \too@badtrue + \ifnum\c@tracingmulticols>\@ne + \typeout{Retry: using natural + height of first column!}% + \fi + \dimen@\ht\mult@nat@firstbox + \last@try\dimen@ + \advance\dimen@-\p@ + \fi + \fi +% \end{macrocode} +% Finally the switch |too@bad| is tested. If it was made true +% either earlier on or due to a rightmost column being too large +% we try again with a slightly larger value for |\dimen@|. +% \begin{macrocode} + \iftoo@bad +%</badness> + \advance\dimen@\p@ + \repeat +% \end{macrocode} +% If we come out of the loop with the switch |forcedbreak@leftover| +% set to true then balancing has failed and we should cut a normal +% page. We indicate this below with |\too@badtrue| when any of the +% columns get too high, so we set this flag here too in order to +% get the same processing logic.\footnote{Should get cleaned up as +% we now have two different routes to reach this part of the +% processing.} +% \changes{v1.8k}{2015/03/21}{} +% \begin{macrocode} + \ifforcedbreak@leftover + \too@badtrue + \else +% \end{macrocode} +% At that point |\dimen@| holds the height that was determined by +% the balancing loop. +% If that height for the columns turns out to be larger +% than the available space (which is |\@colroom|) we squeeze the +% columns into the space assuming that they will have enough +% shrinkability to allow this.\footnote{This might be wrong, since +% the shrinkability that accounts for the amount of material might +% be present only in some columns. But it is better to try then to +% give up directly.} +% However, this squeezing should only be done if we are balancing +% columns on the main galley and \emph{not} if we are building a +% boxed multicol (in the latter case the current |\@colroom| is +% irrelevant since the produced box might be moved anywhere at a +% later stage). +% \changes{v1.3c}{1991/03/03}{Limit column height to \cs{@colroom}} +% \changes{v1.5q}{1998/01/19}{Removed setting \cs{dimen@} (pr2739)} +% \changes{v1.5y}{2000/06/10}{Limit column height only in unrestricted +% mode (pr/3212)} +% \begin{macrocode} + \if@boxedmulticols\else + \ifdim\dimen@>\@colroom + \dimen@\@colroom + \fi + \fi +% \end{macrocode} +% Then we move the contents of the odd-numbered box registers to +% the even-numbered ones, shrinking them if requested. +% We have to use |\vbox| not |\vtop| (as it was done in +% the first versions) since otherwise the resulting boxes will have +% no height (\TB\/ page 81). This would mean that extra +% |\topskip| is added when the boxes are returned to the +% page-builder via |\page@sofar|. +% \changes{v1.3a}{1990/05/20}{Changed \cs{vtop} to \cs{vbox}.} +% \begin{macrocode} + \process@cols\mult@rightbox + {\@tempcnta\count@ + \advance\@tempcnta\@ne +% \end{macrocode} +% when putting the final column together we want overfull +% information: +% \begin{macrocode} + \vfuzz\z@ + \setbox\count@\vbox to\dimen@ + {% +% \end{macrocode} +% +% \changes{v1.8h}{2014/09/12}{Use \cs{vfilmaxdepth}} +% \begin{macrocode} + \vskip \z@ + \@plus-\multicolundershoot + \@minus-\multicolovershoot + \unvbox\@tempcnta + \ifshr@nking\vfilmaxdepth\fi + }% +% \end{macrocode} +% If the resulting box is overfull there was too much material to +% fit into the available space. The question though is how much? If +% it wasn't more than |\maxbalancingoverflow| we accept it still to +% avoid getting very little material for the next page (which we +% would then have difficulties to balance). +% \changes{v1.8a}{2011/12/20}{Balancing concept improved} +% \begin{macrocode} + \ifnum\badness>\@M + \vfuzz\maxdimen % no overfull warning + \setbox\@tempboxa \vbox to\dimen@ + {\vskip-\maxbalancingoverflow + \unvcopy\count@}% + \ifnum\badness>\@M + \mult@info\@ne + {Balanced column more than + \the\maxbalancingoverflow\space + too large}% +% \end{macrocode} +% Fail the balancing attempt: +% \begin{macrocode} + \too@badtrue + \else +% \end{macrocode} +% Otherwise report that there is a problem but within the accepted +% boundary. +% \begin{macrocode} + \mult@info\@ne + {Balanced column + too large, but less than + \the\maxbalancingoverflow}% + \fi + \fi + }% +% \end{macrocode} +% Finally end the |\ifforcedbreak@leftover| conditional. +% \changes{v1.8k}{2015/03/21}{Finish the new conditional} +% \begin{macrocode} + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\maxbalancingoverflow} +% Amount that balancing is allowed to overflow the available column +% space. We default to 12pt which means about one line in most +% layouts. +% \changes{v1.8a}{2011/12/20}{\cs{maxbalancingoverflow} parameter added} +% \begin{macrocode} +\newdimen\maxbalancingoverflow +\maxbalancingoverflow=12pt +% \end{macrocode} +% \end{macro} + +% \end{multicols} +% +% \begin{multicols}{2}[\subsection{The box allocations}] +% +% \begin{macro}{\mult@rightbox} +% \begin{macro}{\mult@grightbox} +% \begin{macro}{\mult@firstbox} +% \begin{macro}{\mult@gfirstbox} +% Early releases of these macros used the first box registers +% 0, 2, 4,\ldots\ for global boxes and 1, 3, 5,\ldots\ for the +% corresponding local boxes. (You might still find some traces +% of this setup in the documentation, sigh.) This produced a problem +% at the moment we had more than 5 columns because then officially +% allocated boxes were overwritten by the algorithm. +% The new release now uses private box registers +% \begin{macrocode} +\newbox\mult@rightbox +\newbox\mult@grightbox +\newbox\mult@gfirstbox +\newbox\mult@firstbox +\newbox\@tempa\newbox\@tempa +\newbox\@tempa\newbox\@tempa +\newbox\@tempa\newbox\@tempa +\newbox\@tempa\newbox\@tempa +\newbox\@tempa\newbox\@tempa +\newbox\@tempa\newbox\@tempa +\newbox\@tempa\newbox\@tempa +\newbox\@tempa\newbox\@tempa +\newbox\@tempa +\let\@tempa\relax +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \end{multicols} +% +% +% \begin{multicols}{2}[\section{New macros and hacks for version 1.2}] +% +% \begin{macro}{\emergencystretch} +% \begin{macro}{\setemergencystretch} +% If we don't use \TeX{} 3.0 |\emergencystretch| is undefined +% so in this case we simply add it as an unused \meta{dimen} +% register. +% \changes{v1.4j}{1992/06/25}{Setting of \cs{emergencystretch} on top +% removed.} +% \begin{macrocode} +\@ifundefined{emergencystretch} + {\newdimen\emergencystretch}{} +% \end{macrocode} +% \changes{v1.2a}{1990/02/05}{Macro added.} +% My tests showed that the following formula worked pretty well. +% Nevertheless the |\setemergencystretch| macro also gets +% |\hsize| as second argument to enable the user to try +% different formulae. +% \begin{macrocode} +\def\setemergencystretch#1#2{% + \emergencystretch 4pt + \multiply\emergencystretch#1} +% \end{macrocode} +% \end{macro} +% \end{macro} + + +% \begin{macro}{\set@floatcmds} +% \changes{v1.2a}{1990/02/05}{Macro added.} +% \changes{v1.5g}{1994/06/07}{Updated since floats have changed} +% \changes{v1.5j}{1994/06/07}{Updated since floats have changed again} +% \changes{v1.5l}{1995/10/19}{Added \cs{@largefloatcheck}} +% \changes{v1.6g}{2006/02/23}{Added \cs{@minipagefalse}} +% \changes{v1.6h}{2008/12/05}{Use \cs{@endfloatbox} to better support +% the modifications done by the float package} +% Even if this should be used as a hook we use a |@| in the +% name since it is more for experts. +% \begin{macrocode} +\def\set@floatcmds{% + \let\@dblfloat\@dbflt + \def\end@dblfloat{\@endfloatbox + \@largefloatcheck + \outer@nobreak +% \end{macrocode} +% This is cheap (deferring the floats until after the current page) +% but any other solution would go deep into \LaTeX's output +% routine and I don't like to work on it until I know which parts +% of the output routine have to be reimplemented anyway for +% \LaTeX3. +% \begin{macrocode} + \ifnum\@floatpenalty<\z@ +% \end{macrocode} +% We have to add the float to the |\@deferlist| because we assume +% that outside the \mc{} environment we are in one column mode. +% This is not entirely correct, I already used the \mc{} +% environment inside of \LaTeX{}s |\twocolumn| declaration but it +% will do for most applications. +% \begin{macrocode} + \@cons\@deferlist\@currbox + \fi + \ifnum\@floatpenalty=-\@Mii + \@Esphack + \fi}} +% \end{macrocode} +% \end{macro} +% +% \end{multicols} +% +% \begin{multicols}{2}[\subsection{Maintaining the mark registers}] +% \label{sec:v14} +% +% This section contains the routines that set the marks so that they +% will be handled correctly. They have been introduced with version~1.4. +% +% \begin{macro}{\kept@topmark} +% \changes{v1.4h}{1992/06/04}{Init to double brace pair} +% \begin{macro}{\kept@firstmark} +% \begin{macro}{\kept@botmark} +% First thing we do is to reserve three macro names to hold the +% replacement text for \TeX's primitives |\firstmark|, |\botmark| and +% |\topmark|. We initialize the first two to be empty and +% |\kept@topmark| to contain two empty pair of braces. This is +% necessary since |\kept@topmark| is supposed to contain the last +% mark from a preceding page and in \LaTeX{} any ``real'' mark must +% contain two parts representing left and right mark information. +% \begin{macrocode} +\def\kept@topmark{{}{}} +\let\kept@firstmark\@empty +\let\kept@botmark\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\return@nonemptymark} +% Sometimes we want to return the value of a ``kept'' mark into a +% |\mark| node on the main vertical list. This is done by the +% function |\return@nonemptymark|. As the name suggests it only acts +% if the replacement text of the kept mark is non-empty. This is done +% to avoid adding an empty mark when no mark was actually present. If +% we would nevertheless add such a mark it would be regarded as a +% valid |\firstmark| later on. +% \begin{macrocode} +\def\return@nonemptymark#1#2{% + \ifx#2\@empty + \else +% \end{macrocode} +% For debugging purposes we take a look at the value of the kept mark +% that we are about to return. This code will get stripped out for +% production. +% \begin{macrocode} +%<*marktrace> + \mult@info\tw@ + {Returned #1 mark:\MessageBreak + \meaning#2}% +% \nobreak +% \fi +%</marktrace> +% \end{macrocode} +% Since the contents of the mark may be arbitrary \LaTeX{} code we +% better make sure that it doesn't get expanded any further. (Some +% expansion have been done already during the execution of +% |\markright| or |\markboth|.) We therefore use the usual mechanism +% of a toks register to prohibit expansion.\footnote{Due to the +% current definition of \cs{markright} etc.\ it wouldn't +% help to define the \cs{protect} command to prohibit +% expansion as any \cs{protect} has already vanished due to +% earlier expansions.} +% \changes{v1.4n}{1992/09/10}{Make marks robust} +% \changes{v1.5t}{1999/03/22}{re-add \cs{mark} command which was commented out +% by mistake at some point in 1998 (pr/2978)} +% \begin{macrocode} + \toks@\expandafter{#2}% + \mark{\the\toks@}% +% \end{macrocode} +% We don't want any breakpoint between such a returned mark and the +% following material (which is usually just the box where the mark +% came from). +% \begin{macrocode} + \nobreak + \fi} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\get@keptmarks} +% If we have some material in a box register we may want to get the +% first and the last mark out of this box. This can be done with +% |\get@keptmarks| which takes one argument: the box register number +% or its nick name defined by |\newbox|. +% \begin{macrocode} +\def\get@keptmarks#1{% +% \end{macrocode} +% For debugging purposes we take a look at the current dimensions +% of the box since in earlier versions of the code I made some +% mistakes in this area. +% \begin{macrocode} +%<*debug> + \typeout{Mark box #1 before: + ht \the\ht#1, dp \the\dp#1}% +%</debug> +% \end{macrocode} +% Now we open a new group and locally copy the box to itself. As a +% result any operation, i.e.\ |\vsplit|, will only have a local +% effect. Without this trick the box content would get lost up to +% the level where the last assignment to the box register was done. +% \begin{macrocode} + \begingroup + \vbadness\@M + \setbox#1\copy#1% +% \end{macrocode} +% Now we split the box to the maximal possible dimension. This +% should split off the full contents of the box so that effectively +% everything is split off. As a result |\splitfirstmark| and +% |\splitbotmark| will contain the first and last mark in the box +% respectively. +% \begin{macrocode} + \setbox#1\vsplit#1to\maxdimen +% \end{macrocode} +% Therefore we can now set the kept marks which is a global +% operation and afterwards close the group. This will restore the +% original box contents. +% \begin{macrocode} + \set@keptmarks + \endgroup +% \end{macrocode} +% For debugging we take again a look at the box dimension which +% shouldn't have changed. +% \begin{macrocode} +%<*debug> + \typeout{Mark box #1 \space after: + ht \the\ht#1, dp \the\dp#1}% +%</debug> +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\set@keptmarks} +% The macro |\set@keptmarks| is responsible for setting +% |\kept@firstmark| and |\kept@botmark|, by checking the current +% values for |\splitfirstmark| and |\splitbotmark|. +% \begin{macrocode} +\def\set@keptmarks{% +% \end{macrocode} +% If |\kept@firstmark| is empty we assume that it isn't set. This +% is strictly speaking not correct as we loose the ability to have +% marks that are explicitly empty, but for standard \LaTeX{} +% application it is sufficient. If it is non-empty we don't change +% the value---within the output routines it will then be restored +% to |\@empty|. +% \begin{macrocode} + \ifx\kept@firstmark\@empty +% \end{macrocode} +% We now put the contents of |\splitfirstmark| into +% |\kept@firstmark|. In the case that there wasn't any mark at all +% |\kept@firstmark| will not change by that operation. +% \begin{macrocode} + \expandafter\gdef\expandafter + \kept@firstmark + \expandafter{\splitfirstmark}% +% \end{macrocode} +% When debugging we show the assignment but only when something +% actually happened. +% \begin{macrocode} +%<*marktrace> + \ifx\kept@firstmark\@empty\else + \mult@info\tw@ + {Set kept first mark:\MessageBreak + \meaning\kept@firstmark% + \@gobbletwo}% + \fi +%</marktrace> + \fi +% \end{macrocode} +% We always try to set the bottom mark to the |\splitbotmark| but +% of course only when there has been a |\splitbotmark| at all. +% Again, we assume that an empty |\splitbotmark| means that the +% split off box part didn't contain any marks at all. +% \begin{macrocode} + \expandafter\def\expandafter\@tempa + \expandafter{\splitbotmark}% + \ifx\@tempa\@empty\else + \global\let\kept@botmark\@tempa +%<*marktrace> + \mult@info\tw@ + {Set kept bot mark:\MessageBreak + \meaning\kept@botmark% + \@gobbletwo}% +%</marktrace> + \fi}% +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\prep@keptmarks} +% The |\prep@keptmarks| function is used to initialize the kept +% marks from the contents of |\partial@page|, i.e.\ the box that +% holds everything from the top of the current page prior to +% starting the \mc{} environment. However, such a box is only +% available if we are not producing a boxed \mc{}. +% \begin{macrocode} +\def\prep@keptmarks{% + \if@boxedmulticols \else + \get@keptmarks\partial@page + \fi} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\remove@discardable@items} +% There are situations when we may have some space at the end of a +% column and this macro here will attempt to get rid of it. The +% typical \LaTeX{} sequence is a series of self-canceling glues so +% if we remove them recursively we are usually fine. +% +% Special care is needed with handling |\vspace*| as that +% corresponds to |\penalty10000|, |\vskip <skip>|, followed by +% |\vskip 0pt|. If we see this sequence going backwards in the the +% vertical list we assume that this is a ``desired'' space. We +% therefore stop the recursion and reinsert the spaces. +% +% As the multicol code sometimes add an explicit penalty at the end +% of a column we first attempt to remove it in case it is there. +% \changes{v1.8m}{2015/03/31}{Another rewrite of +% \cs{remove@discardable@items} hopefully okay now} +% \begin{macrocode} +\skip0=0pt +\edef\the@zero@skip{\the\skip0} +\def\remove@discardable@items{% + \unpenalty +% \end{macrocode} +% Save a previous skip (if there) and then remove it, we can't +% really tell the difference between no skip an a skip of zero but +% that's life. +% \begin{macrocode} + \edef\@tempa{\the\lastskip}% +%\typeout{s1=\@tempa}% + \unskip +% \end{macrocode} +% If it was a zero skip (or none) we save the next previous skip +% (if any). +% \begin{macrocode} + \ifx\@tempa\the@zero@skip + \edef\@tempb{\the\lastskip}% +%\typeout{s2=\@tempb}% +% \end{macrocode} +% If this one again was zero (or more likely not there in the first +% place) we stop. +% \begin{macrocode} + \ifx\@tempb\the@zero@skip + \else +% \end{macrocode} +% Otherwise we remove this ``real'' skip. Then we look if it was +% preceded by a penalty of 10000 (i.e., a |\nobreak|) +% \begin{macrocode} + \unskip +%\typeout{p=\lastpenalty}% + \ifnum \lastpenalty=\@M +% \end{macrocode} +% If so this was a |\vspace*| or something equivalent to +% it. Therefore we reintroduce the skips and stop. Otherwise we +% recurse. +% \begin{macrocode} + \vskip\@tempb\vskip\@tempa\relax + \else + \remove@discardable@items + \fi + \fi + \else +% \end{macrocode} +% If the first skip was a non-zero skip we recurse as well. +% \begin{macrocode} + \remove@discardable@items + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%<*badness> +\newif\iftoo@bad +\def\too@badtrue{\global\let\iftoo@bad\iftrue} +\def\too@badfalse{\global\let\iftoo@bad\iffalse} +% \end{macrocode} +% +% \changes{v1.8k}{2015/03/21}{The new switch} +% \begin{macrocode} +\newif\ifforcedbreak@leftover +% \end{macrocode} +% +% \begin{macro}{\c@minrows} +% \changes{v1.8w}{2019/03/01}{Provide minrows counter for balancing} +% \begin{macrocode} +\newcount\c@minrows +\c@minrows=1 +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\c@columnbadness} +% \begin{macro}{\c@finalcolumnbadness} +% \begin{macrocode} +\newcount\c@columnbadness +\c@columnbadness=10000 +\newcount\c@finalcolumnbadness +\c@finalcolumnbadness=9999 + +\newdimen\last@try + +% \end{macrocode} +% +% \changes{v1.5z1}{2003/02/17}{Change wrong default for +% \cs{multicolovershoot} to zero (pr/3465).} +% \begin{macrocode} +\newdimen\multicolovershoot +\newdimen\multicolundershoot +\multicolovershoot=0pt +\multicolundershoot=2pt +\newbox\mult@nat@firstbox +%</badness> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\mult@info} +% A helper for producing info messages +% \begin{macrocode} +\def\mult@info#1#2{% + \ifnum\c@tracingmulticols>#1% + \GenericWarning + {(multicol)\@spaces\@spaces}% + {Package multicol: #2}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \end{multicols} +% +% +% \begin{multicols}{2}[\section{Fixing the +% \cs{columnwidth}}] +% +% \begin{macro}{\@footnotetext} +% \changes{v1.5o}{1997/11/16}{Redefinition added pr/2664.} +% \changes{v1.5r}{1998/08/17}{Use \cs{@footnotetext} but with +% local change to \cs{columnwidth}.} +% \begin{macro}{\mult@footnotetext} +% \changes{v1.5r}{1998/08/17}{Macro removed again.} +% If we store the current column width in |\columnwidth| we have +% to redefine the internal |\@footnotetext| macro to use |\textwidth| +% for the width of the footnotes rather than using the original +% definition. +% +% Starting with version v1.5r this is now done in a way that the original +% definition is still used, except that locally |\columnwidth| is set to +% |\textwidth|. +% +% This solves two problems: first redefinitions of |\@footnotetext| +% done by a class will correctly survive and second if multicols is +% used inside a minipage environment the special definition of +% |\@footnotetext| in that environment will be picked up and not the +% one for the main galley (the latter would result in all footnotes +% getting lost in that case). +% +% See the definition of the |\multicols| command further up for the exact +% code. +% \end{macro} +% \end{macro} +% \end{multicols} +% +% +% \begin{multicols*}{2}[\section{Further extensions}] +% +% This section does contain code for extensions added to this package +% over time. Not all of them may be active, some might sit dormant and +% wait for being activated in some later release. +% +% \subsection{Not balancing the columns} +% +% This is fairly trivial to implement. we just have to disable the +% balancing output routine and replace it by the one that ships out +% the other pages. +% +% \begin{macro}{\multicols*} +% \changes{v1.5q}{1998/01/19}{Macro added} +% The code for this environment was suggested by Matthias Clasen. +% \begin{macrocode} +%<*nobalance> + \@namedef{multicols*}{% +% \end{macrocode} +% If we are not on the main galley, i.e., inside a box of some +% sort, that approach will not work since we don't have a vertical +% size for the box so we better warn that we balance anyway. +% \begin{macrocode} + \ifinner + \PackageWarning{multicol}% + {multicols* inside a box does + not make sense.\MessageBreak + Going to balance anyway}% + \else +% \end{macrocode} +% If we aren't balancing we change the |\balance@columns@out| to +% work like the normal output routine that cuts normal +% pages. However, there is a catch: In case the last page we cut +% (after seeing the end of the environment) is actually larger than +% a page (for example, if it contains more |\columnbreak| commands +% than columns) we end up with some leftover material that is +% returned to the main galley, but now the environment end penalty +% is missing. So we add another one here too. Of course that +% shouldn't be done if there is really only a single final page, +% but fortunately in that case we have just finished a page and any +% penalty on the recent contributions will be discarded, thus the +% extra one is harmless---puh. +% \changes{v1.8t}{2018/06/26}{Re-add end penalty for +% \texttt{multicols*} environment to guard against leftovers (git/53)} +% \begin{macrocode} + \def\balance@columns@out + {\multi@column@out \penalty-\@Mvi }% + \fi + \begin{multicols} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endmulticols*} +% When ending the environment we simply end the inner +% \texttt{multicols} environment, except that we better also stick +% in some stretchable vertical glue so that the last column still +% containing text is not vertically stretched out. +% +% We do this as follows: first we ensure that we are back in vertical mode +% and then we cancel out |\lastskip| if it was +% positive (in case of a negative glue we assume that it was +% deliberate, for a deliberate positive glue one needs to use +% |\vspace*|). We can't simply use |\remove@discardable@items| here +% as this only works inside boxes but we are here on the main +% vertical list. +% +% Then we back up by |\prevdepth| but not more than |\boxmaxdepth| +% so that a baseline of the last box is now at the bottom. This way +% the material will align properly in case something like |\vfill| +% spreads it out after all. +% Finally we append |\vfil| to put white space at the bottom of the +% column, but we only do this if we aren't anyway doing |\raggedcolumns|. +% \changes{v1.5q}{1998/01/19}{Macro added} +% \changes{v1.8h}{2014/09/12}{Use \cs{vfilmaxdepth}} +% \changes{v1.8i}{2014/10/28}{Add \cs{null} to hide the final fill and only add +% vertical space if not doing \cs{raggedcolumns}} +% \changes{v1.8j}{2015/03/07}{Redesign the whole approach.} +% \changes{v1.8k}{2015/03/21}{And a bit more redesign because of the +% change in \cs{remove@discardable@items}} +% \changes{v1.8o}{2016/02/08}{Ensure we are back in vmode before using +% \cs{prevdepth} (pr/4448)} +% \begin{macrocode} +\@namedef{endmulticols*}{% + \par + \ifdim\lastskip>\z@ \vskip-\lastskip \fi + \ifdim \prevdepth>\z@ + \vskip-\ifdim\prevdepth>\boxmaxdepth + \boxmaxdepth + \else \prevdepth \fi + \fi + \ifshr@nking\else + \vfil + \fi + \end{multicols}} +%</nobalance> +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Manual column breaking} \label{sec:colbreak} +% +% The problem with manual page breaks within \mc{} is the fact that +% during collection of material for all columns a page-forcing penalty +% (i.e. -10000 or higher) would stop the collecting pass which is not +% quite what is desired. On the other hand, using a penalty like -9999 +% would mean that there would be occasions where the |\vsplit|ing +% operations within \mc{} would ignore that penalty and still choose a +% different break point. +% +% For this reason the current implementation +% uses a completely different approach. In a nutshell it extends the \LaTeX{} +% output routine handling by introducing an additional penalty flag +% (i.e., a penalty which is forcing but higher than -10000 so that the +% output routine can look at this value and thus knows why it has been +% called). +% +% Inside the output routine we test for this value and if it appears +% we do two things: save the galley up to this point in a special box +% for later use and reduce the |\vsize| by the height of the material +% seen. This way the forcing penalty is now hidden in that box and we +% can restart the collection process for the remaining +% columns. (This is done in |\speci@ls| above.) +% +% In the output routines that do the |\vsplit|ting either for +% balancing or for a full page we simply combine box~255 with the +% saved box thus getting a single box for splitting which now +% contains forcing breaks in the right positions. +% +% +% \begin{macro}{\columnbreak} +% \changes{v1.5u}{1999/05/25}{Macro added} +% |\columnbreak| is modeled after |\pagebreak| except that we +% generate a penalty -10005. +% \begin{macrocode} +\mathchardef\@Mv=10005 +\def\columnbreak{% +% \end{macrocode} +% We have to ensure that it is only used within a \mc{} +% environment since if that penalty would be seen by the unmodified +% \LaTeX{} output routine strange things would happen. +% \begin{macrocode} + \ifnum\col@number<\tw@ + \PackageError{multicol}% + {\noexpand\columnbreak outside multicols}% + {This command can only be used within + a multicols or multicols* environment.}% + \else + \ifvmode + \penalty -\@Mv\relax + \else + \@bsphack + \vadjust{\penalty -\@Mv\relax}% + \@esphack + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\colbreak@box} +% \changes{v1.5u}{1999/05/25}{Macro added} +% Need a box to collect the galley up to the column break. +% \begin{macrocode} +\newbox\colbreak@box +%</package> +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Supporting right-to-left languages} \label{sec:RL} +% +% +% \changes{v1.7a}{2010/10/24}{RL language support added} +% \changes{v1.7b}{2011/12/18}{RL language support fixed} +% +% \begin{macro}{\LR@column@boxes} +% |\LR@column@boxes| is called when we are assembling the columns for left +% to right typesetting. When we start we are inside an |\hbox| of +% full width. +% Left to right typesetting is fairly easy, we basically output +% each column box intermixed with vertical rules and proper +% spacing. As this happens inside a box of a defined width the +% rules and the columns automatically get into the right positions. +% \begin{macrocode} +\def\LR@column@boxes{% +% \end{macrocode} +% We loop through the columns with |\process@cols| +% \begin{macrocode} + \process@cols\mult@gfirstbox{% +% \end{macrocode} +% If the depth of the current box is larger than the maximum found +% so far in |\dimen2| we update that register for later use. +% \changes{v1.6a}{2003/03/15}{Preparing for adjusting \cs{prevdepth}} +% \begin{macrocode} + \ifdim\dp\count@>\dimen\tw@ + \global\dimen\tw@\dp\count@ \fi +% \end{macrocode} +% If the \texttt{colaction} option is given we write out status +% information about the current column, otherwise the next command +% does nothing. +% \changes{v1.8e}{2014/04/23}{Support \cs{docolaction}} +% \begin{macrocode} + \mc@col@status@write +% \end{macrocode} +% The typeset box followed by the column rule material +% \begin{macrocode} + \box\count@ + \hss{\columnseprulecolor\vrule + \@width\columnseprule}\hss}% +% \end{macrocode} +% As you will have noticed, we started with box register +% |\mult@gfirstbox| (i.e.\ +% the left column). So this time |\count@| looped through 2, +% 4,\ldots\ (plus the appropriate offset). +% Finally we add box |\mult@rightbox| and we are done. +% \changes{v1.5a}{1992/11/04}{New box mechanism} +% \changes{v1.6a}{2003/03/15}{Preparing for adjusting \cs{prevdepth}} +% Again we may have to update |\dimen\tw@|. +% \begin{macrocode} + \ifdim\dp\mult@rightbox>\dimen\tw@ + \global\dimen\tw@\dp\mult@rightbox \fi +% \end{macrocode} +% If the \texttt{colaction} option is given we write out status +% information about the last column, otherwise the next command +% does nothing. +% \changes{v1.8e}{2014/04/23}{Support \cs{docolaction}} +% \begin{macrocode} + \mc@lastcol@status@write + \box\mult@rightbox +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\RL@column@boxes} +% Assembling the boxes for right to left typesetting is far more +% complicated. When I first tried to build a solution for this my +% thinking was that all that is necessary to do is to reverse the +% order of the columns. But such an approach produces a subtle bug: +% If we work this way then the first column put on the page will be +% the last column of the text to read. and this means that the +% order in which \TeX{} executes write statements or assembles mark +% material will not happen in the order of the textual flow. So if, +% for example each column contains a section command then these +% sections will appear in reverse order in the table of content. +% +% For this reason some amount of gymnastics is needed to add the +% columns in their natural flow. +% \begin{macrocode} +\def\RL@column@boxes{% +% \end{macrocode} +% First step is to put all rules in the right place (without adding +% the comes which are instead represented by a space of |\hsize|. +% \begin{macrocode} + \process@cols\mult@gfirstbox{% + \hskip\hsize + \hss{\columnseprulecolor\vrule + \@width\columnseprule}\hss + }% + \hskip\hsize +% \end{macrocode} +% At this point in the code our typesetting reference point is at +% the right end of the rightmost column (or rather where that column +% should appear). +% +% We are now typesetting all columns by first backing up by their +% width (which is |\hsize|) then typesetting the box and then +% backing up again, but this time further, i.e., also across the +% column separation. That will then enable us to typeset the next +% column using the same approach until we are done with all but the +% final column. +% \begin{macrocode} + \process@cols\mult@gfirstbox{% + \ifdim\dp\count@>\dimen\tw@ + \global\dimen\tw@\dp\count@ \fi + \hskip-\hsize +% \end{macrocode} +% +% \changes{v1.8e}{2014/04/23}{Support \cs{docolaction}} +% \begin{macrocode} + \mc@col@status@write + \box\count@ + \hskip-\hsize + \hskip-\columnsep + }% +% \end{macrocode} +% The approach for the final column is similar only that we do not +% have to back up over any column gap. +% \begin{macrocode} + \ifdim\dp\mult@rightbox>\dimen\tw@ + \global\dimen\tw@\dp\mult@rightbox \fi + \hskip-\hsize +% \end{macrocode} +% +% \changes{v1.8e}{2014/04/23}{Support \cs{docolaction}} +% \begin{macrocode} + \mc@lastcol@status@write + \box\mult@rightbox + \hskip-\hsize +% \end{macrocode} +% However we do have to move the reference point to its right +% place: to make the rules appear at the expected places, we should +% get the typesetting position to the far right again. As we at the +% moment at the far left we skip to the far right like this: +% \begin{macrocode} + \hskip\full@width + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\RLmulticolcolumns} +% \begin{macro}{\LRmulticolcolumns} +% \begin{macro}{\mc@align@columns} +% Macros to switch between left-right and right-left typesetting. In LR +% typesetting the |\LR@column@boxes| is used to combine +% the columns. When typesetting right to left the |\RL@column@boxes| +% is used instead. +% \begin{macrocode} +\newcommand\RLmulticolcolumns + {\let\mc@align@columns + \RL@column@boxes} +\newcommand\LRmulticolcolumns + {\let\mc@align@columns + \LR@column@boxes} +% \end{macrocode} +% The default is left-to-right: +% \begin{macrocode} +\LRmulticolcolumns +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsection{Supporting \texttt{\textbackslash docolaction}} +% +% \changes{v1.8e}{2014/04/23}{Support \cs{docolaction}} +% +% Whenever we want to do something that depends on the current +% column we execute \verb=\docolaction=. This command takes one +% optional and three mandatory arguments. The mandatory ones denote +% what to do if this is a ``left'', ``middle'', or ``right'' column +% and the optional one is simply there to say what to do if we don't +% know (default is to use the ``left'' column action in that case). +% +% \begin{macro}{\mc@col@check@num} +% We use one counter \verb=\mc@col@check@num= to generate us unique +% label names. Each time we execute \verb=\docolaction= we increment +% this counter to get a new name. +% \begin{macrocode} +\newcount\mc@col@check@num +% \end{macrocode} +% \end{macro} +% +% The generated ``labels'' are named +%\begin{verbatim} +%\mc@col-\the\mc@col@check@num +%\end{verbatim} +% and they hold as values the +% numbers 1, 2, or 3 denoting the current column type. + +% \begin{macro}{\docolaction} +% +% The \verb=\docolaction= scans for a star and optional argument +% and 3 mandatory ones, but we do this in chunks (not having xparse +% available). +% +% \changes{v1.8u}{2018/11/09}{Support star with \cs{docolaction}} +% \begin{macrocode} +\newcommand\docolaction{% +% \end{macrocode} +% First check is the support is enabled. +% \begin{macrocode} + \ifx\mc@col@status@write\relax + \PackageError{multicol}% + {Option 'colaction' not selected}% + {\string\docolaction\space + requires the use of the 'colaction' + option on the package}% + \fi +% \end{macrocode} +% Then prepare \verb=\mc@col@type=. +% \begin{macrocode} + \global\advance\mc@col@check@num\@ne + \edef\mc@col@type{\expandafter\ifx + \csname mc@col-\the\mc@col@check@num + \endcsname\relax + 0\else + \csname mc@col-\the\mc@col@check@num + \endcsname + \fi}% +% \end{macrocode} +% Finally check for a star, record this information and then call +% \verb=\@docolaction= to do the rest. +% \begin{macrocode} + \@ifstar + {\@docolactionstartrue \@docolaction}% + {\@docolactionstarfalse\@docolaction}% +} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand\@docolaction[4][1]{% +% \end{macrocode} +% +% How does the column number get associated with our label? We +% do do this by writing another line into the aux file. Here are the +% preparations. +% \begin{macrocode} + \edef\@docolactioncheck{\write\@auxout + {\string\mc@set@col@status + {mc@col-\the\mc@col@check@num}% + {\mc@col@type}}}% +% \end{macrocode} +% Where we do the actual \verb=\write= depends on the whether or +% not we gave seen a \texttt{*}. If yes, we do it first and then +% execute the code argument, otherwise we execute that code first +% and check at the point after that. +% \begin{macrocode} + \if@docolactionstar \@docolactioncheck \fi +% \end{macrocode} +% We prefix with 0 so that an unknown label (that returns +% \verb=\relax=) will result in case 0 +% \begin{macrocode} + \ifcase \mc@col@type\relax +% \end{macrocode} +% If column is unknown we use the default action or the action +% denoted by the optional argument (so that arg can take the value +% 1, 2, 3). +% \begin{macrocode} + \ifcase #1\or #2\or#3\or#4\fi + \or +% \end{macrocode} +% Otherwise we know (or think we know) that this is a first, middle, +% or last column: +% \begin{macrocode} + #2% % 1 First col + \or + #3% % 2 any middle col + \or + #4% % 3 last col + \else + \ERRORwrongdefaultgiven + \fi +% \end{macrocode} +% \begin{macrocode} + \if@docolactionstar \else \@docolactioncheck \fi +} +% \end{macrocode} +% \end{macro} +% +% Here is the if used above: +% \begin{macrocode} +\newif\if@docolactionstar +% \end{macrocode} +% +% Because of extra data writing to the aux file the aux file will +% now contain something like the following after the document is +% processed the first time: +%\begin{verbatim} +%\relax +%\mc@col@status{1} +%\mc@set@col@status{lcol-1}{0} +%\mc@col@status{2} +%\mc@set@col@status{lcol-2}{0} +%\mc@col@status{3} +%\mc@set@col@status{lcol-3}{0} +%\mc@col@status{1} +%\mc@col@status{2} +%\mc@col@status{3} +%\mc@set@col@status{lcol-4}{0} +%\end{verbatim} +% The \verb=\mc@col@status= line denotes the column type and has been +% written out just before corresponding the column box was placed +% onto the page. +% The\verb=\mc@set@col@status= lines have been written out as part +% of shipping the column boxes out, e.g., +% \verb=\mc@set@col@status{lcol-1}{0}= was therefore somewhere within +% the first column as it appears between \verb=\mc@col@status{1}= +% and \verb=\mc@col@status{2}= +% The second argument in that line is the value used in the previous +% run (or zero if there was no previous run. We can use this to +% determine if a rerun is necessary. +% +% Thus with this knowledge we can set things up to get the labels +% working. +% +% +% \begin{macro}{\mc@col@status} +% +% When the aux file is read in \verb=\mc@col@status= is used to set +% \verb=\mc@curr@col@status=: +% \begin{macrocode} +\def\mc@col@status#1{% + \gdef\mc@curr@col@status{#1}} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\mc@set@col@status} +% +% And when \verb=\mc@set@col@status= is executed we can simply set +% up the label by associating it with the \verb=\mc@curr@col@status= +% and ignore the second argument: +% \begin{macrocode} +\def\mc@set@col@status#1#2{% + \global\expandafter\let\csname #1\endcsname + \mc@curr@col@status} +% \end{macrocode} +% The above definition is being used when the \texttt{.aux} file is +% read in at the beginning. At the end we need a different +% definition to test if another typesetting run is needed. There we +% compare the value used in the current run (stored in the second +% argument) with the value used on the next run. If those two values +% differ we set \verb=@tempswa= to false which will trigger the +% ``Label(s) may have changed'' warning. +% \begin{macrocode} +\AtEndDocument{\def\mc@set@col@status#1#2{% + \ifnum #2=\mc@curr@col@status\else + \@tempswatrue + \fi}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{mc@firstcol} +% Finally, as part of determining in which column we are, we used a +% switch inside |\mc@col@status@write| to determine if we are in the +% first column or not. +% \begin{macrocode} +\newif\ifmc@firstcol +\mc@firstcoltrue +% \end{macrocode} +% \end{macro} +% \end{multicols*} +% +% \Finale +% +\endinput + + diff --git a/Master/texmf-dist/source/latex-dev/tools/multicol.ins b/Master/texmf-dist/source/latex-dev/tools/multicol.ins new file mode 100644 index 00000000000..9fd6cbe6e9f --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/multicol.ins @@ -0,0 +1,77 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright (C) 1993-2019 +%% The LaTeX3 Project and any individual authors listed elsewhere +%% in this file. +%% +%% This file is part of the Standard LaTeX `Tools Bundle'. +%% ------------------------------------------------------- +%% +%% It may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% As this file contains legal notices, it is NOT PERMITTED to modify +%% this file in any way that the legal information placed into +%% generated files is changed (i.e., the files generated when the +%% original file is executed). This restriction does not apply if +%% (parts of) the content is reused in a different WORK producing its +%% own generated files. +%% +%% The list of all files belonging to the `Tools Bundle' is +%% given in the file `manifest.txt'. +%% +%% +%% --------------- start of docstrip commands ------------------ +%% +\input docstrip + +\keepsilent + +\usedir{tex/latex/tools} + +\preamble + +This is a generated file. + +The source is maintained by the LaTeX Project team and bug +reports for it can be opened at https://latex-project.org/bugs/ +(but please observe conditions on bug reports sent to that address!) + +Copyright (C) 1993-2019 +The LaTeX3 Project and any individual authors listed elsewhere +in this file. + +This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. +-------------------------------------------------------------------------- + +It may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This file may only be distributed together with a copy of the LaTeX +`Tools Bundle'. You may however distribute the LaTeX `Tools Bundle' +without such generated files. + +The list of all files belonging to the LaTeX `Tools Bundle' is +given in the file `manifest.txt'. + +\endpreamble + + +\generateFile{multicol.sty}{t}{% + \from{multicol.dtx}{package,badness,check,marktrace,nobalance}} + + +\endbatchfile diff --git a/Master/texmf-dist/source/latex-dev/tools/rawfonts.dtx b/Master/texmf-dist/source/latex-dev/tools/rawfonts.dtx new file mode 100644 index 00000000000..0fd7dd5006e --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/rawfonts.dtx @@ -0,0 +1,219 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \title{The \textsf{rawfonts} package} +% \date{v0.01} +% \author{Alan Jeffrey} +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% +% \section*{Overview} +% +% The |rawfonts| \LaTeXe{} package is used to provide emulation +% of \LaTeX~2.09 documents which used low-level commands such as +% |\tenrm|. If you say: +% \begin{verbatim} +% \usepackage{rawfonts} +% \end{verbatim} +% then over sixty fonts such as |\tenrm| will be loaded into \LaTeX. +% This has a large overhead, for example this document uses: +% \begin{verbatim} +% 8221 words of font info for 30 fonts +% \end{verbatim} +% but when run with the |rawfonts| package it uses: +% \begin{verbatim} +% 19294 words of font info for 73 fonts +% \end{verbatim} +% That is |rawfonts| can cause your document to load twice as many +% fonts. (This overhead is why \LaTeXe{} does not define |\tenrm| and +% friends by default.) +% +% If you want to only load a small +% number of fonts, you can use the |only| +% option, for example to only load |\tenrm| and |\tensf|: +% \begin{verbatim} +% \usepackage[only,tenrm,tensf]{rawfonts} +% \end{verbatim} +% The |rawfonts| package is intended mainly for use with \LaTeX~2.09 +% documents, and you might want to have the package loaded every time +% you use \LaTeXe{} in compatibility mode. In this case, you should add +% the line: +% \begin{verbatim} +% \RequirePackage{rawfonts} +% \end{verbatim} +% to your |latex209.cfg| \LaTeX~2.09 compatibility configuration file. +% +% \StopEventually{} +% +% \section*{Implementation} +% +% The driver for the documentation you're now reading. +% \begin{macrocode} +%<*driver> +\documentclass{ltxdoc} +\begin{document} +\DocInput{rawfonts.dtx} +\end{document} +%</driver> +% \end{macrocode} +% This is a \LaTeXe{} package. +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{rawfonts} + [1994/05/08 Low-level LaTeX 2.09 font compatibility] +% \end{macrocode} +% The |rawfonts| package uses the |somedefs| package. +% \begin{macrocode} +\RequirePackage{somedefs} +% \end{macrocode} +% By default, all the fonts are loaded, but the |only| option says +% that only the ones specified as options should be. +% \begin{macrocode} +\UseAllDefinitions +\DeclareOption{only}{\UseSomeDefinitions} +\DeclareOption*{\UseDefinition{\CurrentOption}} +\ProcessOptions +% \end{macrocode} +% The rest of the code loads fonts. Five point: +% \begin{macrocode} +\ProvidesDefinition{\DeclareFixedFont{\fivrm}{OT1}{cmr}{m}{n}{\@vpt}} +\ProvidesDefinition{\DeclareFixedFont{\fivmi}{OML}{cmm}{m}{it}{\@vpt}} +\ProvidesDefinition{\DeclareFixedFont{\fivsy}{OMS}{cmsy}{m}{n}{\@vpt}} +\ProvidesDefinition{\DeclareFixedFont{\fivly}{U}{lasy}{m}{n}{\@vpt}} +% \end{macrocode} +% Six point: +% \begin{macrocode} +\ProvidesDefinition{\DeclareFixedFont{\sixrm}{OT1}{cmr}{m}{n}{\@vipt}} +\ProvidesDefinition{\DeclareFixedFont{\sixmi}{OML}{cmm}{m}{it}{\@vipt}} +\ProvidesDefinition{\DeclareFixedFont{\sixsy}{OMS}{cmsy}{m}{n}{\@vipt}} +\ProvidesDefinition{\DeclareFixedFont{\sixly}{U}{lasy}{m}{n}{\@vipt}} +% \end{macrocode} +% Seven point: +% \begin{macrocode} +\ProvidesDefinition{\DeclareFixedFont{\sevrm}{OT1}{cmr}{m}{n}{\@viipt}} +\ProvidesDefinition{\DeclareFixedFont{\sevmi}{OML}{cmm}{m}{it}{\@viipt}} +\ProvidesDefinition{\DeclareFixedFont{\sevsy}{OMS}{cmsy}{m}{n}{\@viipt}} +\ProvidesDefinition{\DeclareFixedFont{\sevit}{OT1}{cmr}{m}{it}{\@viipt}} +\ProvidesDefinition{\DeclareFixedFont{\sevly}{U}{lasy}{m}{n}{\@viipt}} +% \end{macrocode} +% Eight point: +% \begin{macrocode} +\ProvidesDefinition{\DeclareFixedFont{\egtrm}{OT1}{cmr}{m}{n}{\@viiipt}} +\ProvidesDefinition{% + \DeclareFixedFont{\egtmi}{OML}{cmm}{m}{it}{\@viiipt}} +\ProvidesDefinition{% + \DeclareFixedFont{\egtsy}{OMS}{cmsy}{m}{n}{\@viiipt}} +\ProvidesDefinition{% + \DeclareFixedFont{\egtit}{OT1}{cmr}{m}{it}{\@viiipt}} +\ProvidesDefinition{\DeclareFixedFont{\egtly}{U}{lasy}{m}{n}{\@viiipt}} +% \end{macrocode} +% Nine point: +% \begin{macrocode} +\ProvidesDefinition{\DeclareFixedFont{\ninrm}{OT1}{cmr}{m}{n}{\@ixpt}} +\ProvidesDefinition{\DeclareFixedFont{\ninmi}{OML}{cmm}{m}{it}{\@ixpt}} +\ProvidesDefinition{\DeclareFixedFont{\ninsy}{OMS}{cmsy}{m}{n}{\@ixpt}} +\ProvidesDefinition{\DeclareFixedFont{\ninit}{OT1}{cmr}{m}{it}{\@ixpt}} +\ProvidesDefinition{\DeclareFixedFont{\ninbf}{OT1}{cmr}{bx}{n}{\@ixpt}} +\ProvidesDefinition{\DeclareFixedFont{\nintt}{OT1}{cmtt}{m}{n}{\@ixpt}} +\ProvidesDefinition{\DeclareFixedFont{\ninly}{U}{lasy}{m}{n}{\@ixpt}} +% \end{macrocode} +% Ten point: +% \begin{macrocode} +\ProvidesDefinition{\DeclareFixedFont{\tenrm}{OT1}{cmr}{m}{n}{\@xpt}} +\ProvidesDefinition{\DeclareFixedFont{\tenmi}{OML}{cmm}{m}{it}{\@xpt}} +\ProvidesDefinition{\DeclareFixedFont{\tensy}{OMS}{cmsy}{m}{n}{\@xpt}} +\ProvidesDefinition{\DeclareFixedFont{\tenit}{OT1}{cmr}{m}{it}{\@xpt}} +\ProvidesDefinition{\DeclareFixedFont{\tensl}{OT1}{cmr}{m}{sl}{\@xpt}} +\ProvidesDefinition{\DeclareFixedFont{\tenbf}{OT1}{cmr}{bx}{n}{\@xpt}} +\ProvidesDefinition{\DeclareFixedFont{\tentt}{OT1}{cmtt}{m}{n}{\@xpt}} +\ProvidesDefinition{\DeclareFixedFont{\tensf}{OT1}{cmss}{m}{n}{\@xpt}} +\ProvidesDefinition{\DeclareFixedFont{\tenly}{U}{lasy}{m}{n}{\@xpt}} +\ProvidesDefinition{\DeclareFixedFont{\tenex}{OMX}{cmex}{m}{n}{\@xpt}} +% \end{macrocode} +% Eleven point: +% \begin{macrocode} +\ProvidesDefinition{\DeclareFixedFont{\elvrm}{OT1}{cmr}{m}{n}{\@xipt}} +\ProvidesDefinition{\DeclareFixedFont{\elvmi}{OML}{cmm}{m}{it}{\@xipt}} +\ProvidesDefinition{\DeclareFixedFont{\elvsy}{OMS}{cmsy}{m}{n}{\@xipt}} +\ProvidesDefinition{\DeclareFixedFont{\elvit}{OT1}{cmr}{m}{it}{\@xipt}} +\ProvidesDefinition{\DeclareFixedFont{\elvsl}{OT1}{cmr}{m}{sl}{\@xipt}} +\ProvidesDefinition{\DeclareFixedFont{\elvbf}{OT1}{cmr}{bx}{n}{\@xipt}} +\ProvidesDefinition{\DeclareFixedFont{\elvtt}{OT1}{cmtt}{m}{n}{\@xipt}} +\ProvidesDefinition{\DeclareFixedFont{\elvsf}{OT1}{cmss}{m}{n}{\@xipt}} +\ProvidesDefinition{\DeclareFixedFont{\elvly}{U}{lasy}{m}{n}{\@xipt}} +% \end{macrocode} +% Twelve point: +% \begin{macrocode} +\ProvidesDefinition{\DeclareFixedFont{\twlrm}{OT1}{cmr}{m}{n}{\@xiipt}} +\ProvidesDefinition{\DeclareFixedFont{\twlmi}{OML}{cmm}{m}{it}{\@xiipt}} +\ProvidesDefinition{\DeclareFixedFont{\twlsy}{OMS}{cmsy}{m}{n}{\@xiipt}} +\ProvidesDefinition{\DeclareFixedFont{\twlit}{OT1}{cmr}{m}{it}{\@xiipt}} +\ProvidesDefinition{\DeclareFixedFont{\twlsl}{OT1}{cmr}{m}{sl}{\@xiipt}} +\ProvidesDefinition{\DeclareFixedFont{\twlbf}{OT1}{cmr}{bx}{n}{\@xiipt}} +\ProvidesDefinition{\DeclareFixedFont{\twltt}{OT1}{cmtt}{m}{n}{\@xiipt}} +\ProvidesDefinition{\DeclareFixedFont{\twlsf}{OT1}{cmss}{m}{n}{\@xiipt}} +\ProvidesDefinition{\DeclareFixedFont{\twlly}{U}{lasy}{m}{n}{\@xiipt}} +% \end{macrocode} +% Fourteen point: +% \begin{macrocode} +\ProvidesDefinition{\DeclareFixedFont{\frtnrm}{OT1}{cmr}{m}{n}{\@xivpt}} +\ProvidesDefinition{% + \DeclareFixedFont{\frtnmi}{OML}{cmm}{m}{it}{\@xivpt}} +\ProvidesDefinition{% + \DeclareFixedFont{\frtnsy}{OMS}{cmsy}{m}{n}{\@xivpt}} +\ProvidesDefinition{% + \DeclareFixedFont{\frtnbf}{OT1}{cmr}{bx}{n}{\@xivpt}} +\ProvidesDefinition{\DeclareFixedFont{\frtnly}{U}{lasy}{m}{n}{\@xivpt}} +% \end{macrocode} +% Seventeen point: +% \begin{macrocode} +\ProvidesDefinition{% + \DeclareFixedFont{\svtnrm}{OT1}{cmr}{m}{n}{\@xviipt}} +\ProvidesDefinition{% + \DeclareFixedFont{\svtnmi}{OML}{cmm}{m}{it}{\@xviipt}} +\ProvidesDefinition{% + \DeclareFixedFont{\svtnsy}{OMS}{cmsy}{m}{n}{\@xviipt}} +\ProvidesDefinition{% + \DeclareFixedFont{\svtnbf}{OT1}{cmr}{bx}{n}{\@xviipt}} +\ProvidesDefinition{\DeclareFixedFont{\svtnly}{U}{lasy}{m}{n}{\@xviipt}} +% \end{macrocode} +% Twenty point: +% \begin{macrocode} +\ProvidesDefinition{\DeclareFixedFont{\twtyrm}{OT1}{cmr}{m}{n}{\@xxpt}} +\ProvidesDefinition{\DeclareFixedFont{\twtymi}{OML}{cmm}{m}{it}{\@xxpt}} +\ProvidesDefinition{\DeclareFixedFont{\twtysy}{OMS}{cmsy}{m}{n}{\@xxpt}} +\ProvidesDefinition{\DeclareFixedFont{\twtyly}{U}{lasy}{m}{n}{\@xxpt}} +% \end{macrocode} +% Twenty-five point: +% \begin{macrocode} +\ProvidesDefinition{\DeclareFixedFont{\twfvrm}{OT1}{cmr}{m}{n}{\@xxvpt}} +% \end{macrocode} +% That's it. +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% +% \endinput diff --git a/Master/texmf-dist/source/latex-dev/tools/shellesc.dtx b/Master/texmf-dist/source/latex-dev/tools/shellesc.dtx new file mode 100644 index 00000000000..061ea4457ca --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/shellesc.dtx @@ -0,0 +1,243 @@ +% \iffalse +%% Source File: shellesc.dtx +%% Copyright (C) 2015-2019 +%% +%% The LaTeX3 Project and any individual authors listed elsewhere +%% in this file. +%% +%% This file may be distributed under the terms of the LPPL. +%% See README for details. +% +%<*dtx> + \ProvidesFile{shellesc.dtx} +%</dtx> +%<package>\ifx\ProvidesPackage\undefined +%<package>\def\next#1#2[#3]{\wlog{#2 #3}} +%<package>\ifx\PackageInfo\undefined\def\PackageInfo#1#2{\wlog{#1: #2}}\fi +%<package>\ifx\PackageWarning\undefined\def\PackageWarning#1#2{\wlog{#1: #2}}\fi +%<package>\expandafter\next\fi +%<package>\ProvidesPackage{shellesc} +%<driver> \ProvidesFile{shellesc.drv} +% \fi +% \ProvidesFile{shellesc.dtx} + [2016/06/07 v0.02b unified shell escape interface for LaTeX] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\begin{document} +\DocInput{shellesc.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{shellesc.dtx} +% +% \title{The \textsf{shellesc} Package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{LaTeX3 project} +% \date{\filedate} +% \maketitle +% +% \changes{v0.1b}{2016/02/02}{Doc typo fixes (JB)} +% \changes{v0.2a}{2016/06/07}{Improve use with plain TeX} +% \section{Introduction} +% +% +% For many years web2c based \TeX\ implementations have used the syntax +% of the \verb|\write| command to access system commands by using a +% special stream 18 (streams above 15 can not be allocated to files in +% classical \TeX\ so stream 18 would otherwise just print to the +% terminal). +% +% This is a useful extension that did not break the strict rules on +% extensions in classical \TeX. This package provides a simple +% macro level interface hiding the \verb|write18| implementation +% so a command to remove a file on a unix-like system could be +% specified using \verb|\ShellEscape{rm file.txt}| (or \verb|del| in +% windows). Note that by default system access is not allowed and +% latex will typically need to be called with the \verb|--shell-escape| +% command line option. +% +% The package may be used with standard \texttt{latex} or +% \texttt{pdflatex} or \texttt{xetex}, however it is mostly motivated by +% \texttt{lualatex} as from Lua\TeX~0.87 onwards Lua\TeX\ does \emph{not} +% support the \verb|\write18| syntax to access system commands: it has +% 256 write streams and stream 18 can be associated to a file and +% (without this package) has no special significance. This packge +% defines the same \verb|\ShellEscape| syntax in Lua\LaTeX, but the +% implementation is via Lua and the \verb|os.execute| function. +% +% \verb|\ShellEscape| in fact corresponds to \verb|\immediate\write18| +% (or \verb|\directlua|). Very rarely you may need to delay a system +% command until the current page is output (when page numbers are +% known) for this classically you could use \verb|\write18| (or +% (\verb|\latelua|). This package provides \verb|\DelayedShellEscape| +% as a common syntax for this use. +% +% To aid porting existing documents to Lua\TeX~0.87 this package does +% overload the \verb|\write| command so that +% \verb|\write18{rm file.txt}| +% will work with Lua\TeX. Note that the redefinition of \verb|\write| +% can not detect whether \verb|\immediate| has been used, +% \verb|\immediate| will work as normal when writing to file streams +% or the terminal but the special case of stream 18 which is defined to +% use \verb|os.execute| always uses \verb|\directlua| (so corresponds +% to \verb|\immediate\write18|. In the rare situations that you need +% non-immediate \verb|\write18| in a document being ported to current +% Lua\TeX, you will need to change to use the +% \verb|\DelayedShellEscape| command. +% +% \section{Implementation} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \subsection{Status Check} +% +% +% \changes{v0.2a}{2016/06/07}{spelling in messages} +% \begin{macrocode} +\ifcase + \ifx\pdfshellescape\@undefined + \ifx\shellescape\@undefined + \ifx\directlua\@undefined + \z@ + \else + \directlua{% + tex.sprint((status.shell_escape or os.execute()) .. " ")} + \fi + \else + \shellescape + \fi + \else + \pdfshellescape + \fi + \PackageWarning{shellesc}{Shell escape disabled} +\or + \PackageInfo {shellesc}{Unrestricted shell escape enabled} +\else + \PackageInfo {shellesc}{Restricted shell escape enabled} +\fi +% \end{macrocode} +% +% \subsection{The shellesc package interface} +% +% \begin{macro}{\ShellEscape} +% Execute the supplied tokens as a system dependent command, assuming +% such execution is allowed. +% \begin{macrocode} +\ifx\lastsavedimageresourcepages\@undefined + \protected\def\ShellEscape{\immediate\write18 } +% \end{macrocode} +% +% \begin{macrocode} +\else + \protected\def\ShellEscape#1{% + \directlua{os.execute("\luaescapestring{#1}")}} +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DelayedShellEscape} +% \changes{v0.1c}{2016/04/29}{Define \cs{DelayedShellEscape} not \cs{ShellEscape}(UF)} +% Execute the supplied tokens as a system dependent command, when this +% node is shipped out with the completed page, assuming +% such execution is allowed. +% \begin{macrocode} +\ifx\lastsavedimageresourcepages\@undefined + \protected\def\DelayedShellEscape{\relax\write18 } +% \end{macrocode} +% +% \begin{macrocode} +\else + \protected\def\DelayedShellEscape#1{% + \latelua{os.execute("\luaescapestring{#1}")}} +\fi +% \end{macrocode} +% \end{macro} +% +% +% +% \subsection{The write18 package interface} +% +% In web2c based engines other than Lua\TeX, |\write18| may be used +% directly. The same was true in older LuaTeX, but from version 0.85 +% onwards that is not available. +% +% The above |shellesc| package interface is recommended for new code, +% however for ease of porting existing documents and packages to newer +% Lua\TeX\ releases, a |\write18| interface is provided here via a +% call to Lua's |os.execute|. +% +% Note that as currently written this always does an \emph{immediate} +% call to the system. +% +% |\immediate| is supported but ignored, |\immediate\write18| and +% |\write18| both execute immediately. To use a delayed execution at +% the next shipout, use the |\DelayedShellEscape| command defined +% above. +% +% Note that it would be easy to make |\wriete18| defined here use +% delayed execution, just use |\DelayedShellEscape| instead of +% |ShellEscape| in the definition below. However detecting +% |\immediate| is tricky so the choice here is to always use the +% immediate form, which is overwhelmingly more commonly used with +% |\write18|. +% +% Stop at this point if not a recent Lua\TeX. +% \begin{macrocode} +\ifx\lastsavedimageresourcepages\@undefined\expandafter\endinput\fi +% \end{macrocode} +% +% \begin{macrocode} +\directlua{% +% \end{macrocode} +% +% \begin{macrocode} +shellesc = shellesc or {} +% \end{macrocode} +% +% Lua function to use the token scanner to grab the following \TeX\ +% number, and then test if stream 18 is being used, and then insert an +% appropriate \TeX\ command to handle the following brace group in +% each case. +% \begin{macrocode} +local function write_or_execute() + local s = token.scan_int() + if (s==18) then + tex.sprint(\the\numexpr\catcodetable@atletter\relax, + "\string\\ShellEscape ") + else + tex.sprint(\the\numexpr\catcodetable@atletter\relax, + "\string\\shellesc@write " .. s) + end +end +% \end{macrocode} +% +% \begin{macrocode} +shellesc.write_or_execute=write_or_execute +% \end{macrocode} +% +% \begin{macrocode} +} +% \end{macrocode} +% +% \begin{macrocode} +\let\shellesc@write\write +% \end{macrocode} +% +% \begin{macrocode} +\protected\def\write{\directlua{shellesc.write_or_execute()}} +% \end{macrocode} +% +% +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex-dev/tools/showkeys.dtx b/Master/texmf-dist/source/latex-dev/tools/showkeys.dtx new file mode 100644 index 00000000000..6e2516856d5 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/showkeys.dtx @@ -0,0 +1,905 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% File: showkeys.dtx Copyright (C) 1992-1997 David Carlisle +%% File: showkeys.dtx Copyright (C) 2006-2019 David Carlisle, LaTeX3 Project +% +%<*dtx> + \ProvidesFile{showkeys.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{showkeys} +%<driver> \ProvidesFile{showkeys.drv} +% \fi +% \ProvidesFile{showkeys.dtx} + [2014/10/28 v3.17 Show cite and label keys (DPC, MH)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage +% [notcite,notref,color] + {showkeys} +\setlength{\belowcaptionskip}{\baselineskip} +\setlength{\abovecaptionskip}{0pt} +\begin{document} +\DocInput{showkeys.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{showkeys.dtx} +% \title{The \textsf{showkeys} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{David Carlisle \and Morten H\o gholm} +% \date{\filedate} +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% \changes{v1.01}{1992/08/25}{Initial version} +% \changes{v1.02}{1994/01/05} +% {Fix incorrect initialisation (FGBDA19@CC1.KULEUVEN.AC.BE)} +% \changes{v2.00}{1994/01/31}{new version for LaTeX2e} +% \changes{v2.01}{1994/06/30}{Fix \cs{ProvidesPackage} usage.} +% \changes{v3.00}{1994/09/07} +% {Support harvard, varioref and natbib packages,} +% \changes{v3.02}{1995/03/17} +% {Support new AMS files} +% +% \section{Introduction}\label{sec:intro} +% +% |showkeys.sty| modifies the |\label|, |\ref|, |\pageref|, |\cite|, and +% |\bibitem| commands so that the `internal' key is printed. The package +% tries hard to position these labels so that the formatting of the rest +% of the document is unchanged. |\label| and |\bibitem| cause the +% key to appear in a box either in the margin, or in a \TeX\ box of zero +% width, which may possibly over-print other text. The |\ref|, +% |\pageref| and |\cite| commands print their arguments in small type, +% raised just above the line, like this: \ref{sec:intro}. +% This package works with the \textsf{fleqn} option, the packages +% in the AMS-\LaTeX\ collection, and the \textsf{varioref}, +% \textsf{natbib} and \textsf{harvard} packages. +% +% \changes{v2.00}{1992/01/31} +% {leqno or ams* may now be loaded after showkeys} +% +% \section{Package Options}\label{options} +% Some people have commented that the printing of the |\ref| and +% |\cite| keys is less useful than the printing of the |\label| keys +% and so \textsf{showkeys} now supports two options that can be given +% in the |\usepackage| command: +% \begin{description} +% \item[notref] to stop the redefinition of |\ref| and |\pageref|, +% and related commands from the \textsf{varioref} package. +% \item[notcite] to stop the redefinition of |\cite| and related +% commands from the \textsf{harvard} and \textsf{natbib} packages. +% \end{description} +% So if the package is loaded with |\usepackage[notref]{showkeys}| +% then |\ref| will have its standard definition, but |\label| will +% print its key argument (usually in the margin). +% +% If you find the printed keys distracting, but don't want to use the +% above options to stop them altogether you may use: +% \begin{description} +% \item[color] Print the keys in a distinguishing colour. The default +% value is a light grey. +% \end{description} +% The colours may be changed by redefining the following two colours +% after the package is loaded. +% |refkey| (also used for |\cite|) and +% |labelkey| (also used for |\bibitem|). +% The defaults are: +%\begin{verbatim} +% \definecolor{refkey}{gray}{.75} +% \definecolor{labelkey}{gray}{.75} +%\end{verbatim} +% +% If this option is used the \textsf{color} package will be loaded. +% +% The package accepts two further options. +% \begin{description} +% \item[final] to suporess the action of this package, for `final' +% versions. +% \item[draft] the normal behaviour of this package. +% \end{description} +% Clearly there is not much point in entering the |final| option +% directly in the |\usepackage| command, as just not loading this +% package would have the same effect, and execute more quickly, +% however the |final| option may be useful as it may be used once in +% the |documentclass| command to affect any number of packages that +% may be loaded. The |draft| option does not do anything, but is there +% to honour an informal convention that packages have these options in +% pairs. +% +% You can also control the appearance of the typeset label with the +% command |\showkeyslabelformat|, which takes one argument. The default is +% \begin{verbatim} +% \providecommand*\showkeyslabelformat[1]{% +% \fbox{\normalfont\small\ttfamily#1}} +% \end{verbatim} +% The command is called inside a group so you can put in local +% modifications of |\fboxsep|, for instance, without them leaking to +% the rest of the document. +% +% +% \section{More Examples}\label{examples} +% The only other similar package that I could find in the macro index, +% \cite{DMJ:mi}, was |showlabels.sty|, \cite{GN:sl}. After the first +% draft of this package was written, I found \cite{anon:sk} on my local +% installation! I think the current package is more robust than +% \cite{anon:sk}, but I thought that |showkeys| was rather a good name, +% so I have stolen it for this file. +% +% \begin{enumerate} +% \item \label{e^1}This has |\label| immediately after |\item|. +% \item This has the |\label| at the end.\label{e^2} +% \end{enumerate} +% +% \[ +% \mbox{A minipage :- }\left\{ +% \begin{minipage}{3in} +% Within environments like this |minipage|, we cannot use +% |\marginpar|\footnotemark, +% so the appearance is slightly different. Here is that |enumerate| +% environment again: +% +% \begin{enumerate} +% \item \label{m&e^1}This has |\label| immediately after |\item|. +% \item This has the |\label| at the end.\label{m&e^2} +% \end{enumerate} +% \end{minipage} +% \right. +% \] +% +% Displayed math (without |equation| counter). +% \[0=0\label{disp}\] +% +% Some text referring to the maths on page~\pageref{disp}, and the +% item~\ref{e^1}.\footnotetext{Actually \texttt{\string\marginpar} is +% not used at all in this package now.} +% +% If |showkeys| thinks that the current environment is going to produce +% an ``equation number'', then it does not show the label where the +% |\label| command occurs, but tries to put it in the margin, as shown +% with equation~\ref{eq:xx}. +% The package `knows' about the standard |equation| and |eqnarray| +% environments, and also all the numbered alignment environments offered +% by the AMS\LaTeX\ package, |amsmath|. +% +% ^^A (|amstex.sty| must be loaded before |showkeys.sty| +% ^^A for this to work.) +% \changes{v2.00}{1992/01/31} +% {leqno or ams* may now be loaded after showkeys} +% +% \begin{equation} +% 1=1\label{eq:xx} +% \end{equation} +% +% \begin{eqnarray} +% 2&=&2\label{eqnar:a}\\ +% 3&=&3\nonumber\\ +% 4&=&4\label{eqnar:b} +% \end{eqnarray} +% +% +% \begin{figure}[ht] +% Within a |figure| environment, the |\label| must not come before the +% |\caption| command. If you place |\label| inside the argument of +% |\caption| the label will be shown like this: +% +% \caption{Within the caption argument.\label{cap:a}} +% +% If you place |\label| immediately after the |\caption| command it will +% be shown like this: +% +% \caption{Immediately after the caption argument.}\label{cap:b} +% +% If you place the |\label| command at some random point after the +% |\caption| command, it may be shown like: +% +% \caption{In vertical mode not immediately after a box.} +% \vspace{2pt} +% +% \label{cap:c} +% \end{figure} +% +% +% \begin{thebibliography}{9} +% +% \bibitem{GN:sl} +% Gil Neiger, \emph{showlabels.sty}, +% Undated package, similar to this one, but shows labels +% inline, affecting the formatting of the document. +% +% \bibitem{anon:sk} +% Anonymous, \emph{showkeys.sty}, +% Package, dated 14 May 1988. Very similar to this one, +% also uses |\marginpar| in outer vertical mode. +% +% \bibitem{DMJ:mi} +% David M. Jones, \emph{\TeX\ Macro Index}, +% A catalogue of \TeX\ macros, including \LaTeX\ packages, +% available from all good \TeX\ archives. +% +% \end{thebibliography} +% +% \StopEventually{} +% +% \section{The Macros} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% +% First we handle the options. Normally all related commands are +% defined to show their `keys'. But since v3.03 one can specify: +% +% \texttt{notref} to stop the redefinition of |\ref| (and |\pageref|, +% and related commands from \textsf{varioref} package), +% +% \texttt{notcite} to stop the redefinition of |\cite| and related +% commands from the \textsf{harvard} and \textsf{natbib} packages. +% +% \changes{v3.03}{1995/04/25} +% {Add option handling.} +% \begin{macrocode} +\DeclareOption{notref}{\let\SK@ref\@empty} +\DeclareOption{notcite}{\let\SK@cite\@empty} +% \end{macrocode} +% +% \begin{macro}{\SK@refcolor} +% \begin{macro}{\SK@labelcolor} +% Colour commands. Normally no-op. +% \begin{macrocode} +\let\SK@refcolor\relax +\let\SK@labelcolor\relax +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \changes{v3.11}{1996/11/01} +% {Colour support added, inspired by tools/2297} +% |color| option loads the \textsf{color} package and defines the +% colours. Delayed to the end of the package as package loading not +% allowed in this option section. +% \begin{macrocode} +\DeclareOption{color}{\AtEndOfPackage{% + \RequirePackage{color}% + \definecolor{refkey}{gray}{.75}% + \definecolor{labelkey}{gray}{.75}% + \def\SK@refcolor{\color{refkey}}% + \def\SK@labelcolor{\color{labelkey}}}} +% \end{macrocode} +% +% \changes{v3.04}{1995/10/30} +% {final and draft options handling.} +% \changes{v3.15}{2007/08/07} +% {Fix \cs{showkeyslabelformat} for final option PR/3918.} +% Allow |final| to be specified in the document class options +% to suppress the loading of this package. +% \begin{macrocode} +\DeclareOption{final}{% + \providecommand*\showkeyslabelformat[1]{}% + \endinput} +\DeclareOption{draft}{} +% \end{macrocode} +% +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% +% \changes{v2.00}{1992/01/31} +% {\cmd{reset@font} is now standard} +% +% \begin{macro}{\SK@label} +% \begin{macro}{\SK@bibitem} +% \begin{macro}{\SK@lbibitem} +% The saved original definitions +% \begin{macrocode} +\let\SK@label\label +\let\SK@bibitem\@bibitem +\let\SK@lbibitem\@lbibitem +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\label} +% \changes{v3.09}{1996/08/30} +% {Add extra group so brace hack works. Donald Arseneau tools/2147} +% The new definition, print the argument, and then do the old +% definition. +% \begin{macrocode} +\def\label#1{% + \@bsphack + \SK@\SK@@label{#1}% + \begingroup + \SK@label{#1}% + \endgroup + \@esphack} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@bibitem} +% \begin{macro}{\@lbibitem} +% \changes{v3.02}{1995/03/17} +% {New label code.} +% For |\bibitem|, position the \textsf{showkeys} code as for a standard +% list with |\item| and |\label|. +% \begin{macrocode} +\def\@bibitem#1{% + \SK@bibitem{#1}\SK@\SK@@label{#1}\ignorespaces} +% \end{macrocode} +% +% \begin{macrocode} +\def\@lbibitem[#1]#2{% + \SK@lbibitem[{#1}]{#2}\SK@\SK@@label{#2}\ignorespaces} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\SK@} +% \changes{v3.07}{1996/05/17} +% {use \cs{protected@edef} for tools/2147} +% Grab hold of |#2| via |\meaning| so characters like |&| and +% |^| do not cause problems later, and pass the result on to the command +% |#1|. +% \begin{macrocode} +\def\SK@#1#2{% + \protected@edef\@tempa{#2}% + \expandafter#1\meaning\@tempa\SK@} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\showkeyslabelformat} +% \changes{v3.13}{2006/01/09}{Added command} +% \begin{macrocode} +\providecommand*\showkeyslabelformat[1]{% + \fbox{\normalfont\small\ttfamily#1}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SK@@label} +% \changes{v3.13}{2006/01/09}{Do not hardwire label format} +% Strip off the initial segment of the |\meaning| output, and then put +% the rest either in a |\marginpar| or in a box of size 0pt, +% hopefully not disturbing the surrounding text. +% \begin{macrocode} +\def\SK@@label#1>#2\SK@{% +% \end{macrocode} +% Need to work globally as in some cases like alignments, and |fleqn|, +% the counter will be printed in a different group to the |\label| +% command. +% \begin{macrocode} + \gdef\SK@lab{\smash{\SK@labelcolor\showkeyslabelformat{#2}}}% + \ifvmode + \if@inlabel +% \end{macrocode} +% \changes{v3.02}{1995/03/17} +% {New code for `in label' case.} +% If the |\label| is straight after |\item| (|\bibitem| is handled by +% this case as well) then the item label has not been added to the page +% yet. It is hanging around in the box |\@labels| waiting for the +% paragraph to start. So just need to attach the label to this box. +% \begin{macrocode} + \global\setbox\@labels\hbox{% + \llap{\SK@lab\SK@lab@relax + \kern\@totalleftmargin\kern\marginparsep}% + \box\@labels}% +% \end{macrocode} +% +% \begin{macrocode} + \else +% \end{macrocode} +% \changes{v3.10}{1996/09/06} +% {Save prevdepth and restore later} +% If we insert a box into the main vertical list, do not want to +% change |\prevdepth| as that would affect vertical spacing in the +% document. (The box itself should not cause any difference in break +% points as there is a node there anyway coming from the |\write| to +% the aux file. +% \begin{macrocode} + \dimen@\prevdepth + \nointerlineskip +% \end{macrocode} +% The inner vertical mode cases are mainly designed to do the right +% thing with float captions, but seem to work OK in other cases as well. +% \begin{macrocode} + \ifinner + \skip@\lastskip\unskip +% \end{macrocode} +% In inner vertical mode, attach the label to the right of the +% immediately preceding box, if it is a box before the current point. +% Otherwise just put it in a box of zero dimensions, with no interline +% skip. (This may slightly move the surrounding text (but perhaps not +% now that |\prevdepth| is restored.) +% \changes{v3.00}{1994/09/07} +% {Back up over a previous skip because of the new +% \cs{belowcaptionskip}} +% \changes{v3.04}{1995/10/30} +% {\cs{advance} added, to total two successive skips.} +% \changes{v3.04}{1995/10/30} +% {\cs{nointerlineskip} called before \cs{ifvoid} test, not just +% void case} +% \changes{v3.04}{1995/10/30} +% {\cs{marginparskip} added in inner vmode case} +% \begin{macrocode} + \advance\skip@\lastskip\unskip + \setbox\z@\lastbox +% \end{macrocode} +% \changes{v3.10}{1996/09/06} +% {Inner vertical mode case, put it in the margin.} +% \changes{v3.14}{2006/09/25} +% {The label put in the margin shouldn't make box 255 wider (PR/3884).} +% \begin{macrocode} + \ifvoid\z@ + \llap{\SK@lab\SK@lab@relax\kern\marginparsep}% + \else + \hbox{\box\z@\rlap{\kern\marginparsep\SK@labx}}% + \fi + \vskip\skip@ + \else +% \end{macrocode} +% In outer vertical mode, previously used a |\vadjust| at the start of +% the next paragraph (and before that used |\marginpar|). These +% methods sometimes cause extra space, eg if paragraph starts with a +% math display, so now just insert the box directly, taking care not +% to change |\prevdepth|. +% \changes{v3.02}{1995/03/17} +% {Use \cs{vadjust} instead of \cs{marginpar}} +% \changes{v3.10}{1996/09/06} +% {Insert the box directly} +% \begin{macrocode} + \llap{\SK@lab\SK@lab@relax\kern\marginparsep}% + \fi +% \end{macrocode} +% Restore |\prevdepth|. +% \begin{macrocode} + \prevdepth\dimen@ +% \end{macrocode} +% +% \begin{macrocode} + \fi + \else +% \end{macrocode} +% If we are in an numbered equation-style environment, do nothing as the +% code to print the number will also print the label, otherwise just +% stick the label at the current point, in a box of zero dimensions. +% \changes{v3.02}{1995/03/17} +% {Add \cs{ifmmode} test} +% \begin{macrocode} + \csname SK@\@currenvir\endcsname + \ifSK@equation\else + \ifmmode + \SK@labx + \else +% \end{macrocode} +% Inner horizontal mode. Not much we can do, just stick it here. +% \changes{v3.03}{1995/04/25} +% {Fix inner horizontal mode case (broken in 3.02)} +% \begin{macrocode} + \ifinner + \rlap\SK@lab + \else +% \end{macrocode} +% In outer horizontal mode use |\vadjust| to get to the margin. +% \changes{v3.02}{1995/03/17} +% {Use \cs{vadjust} in horizontal mode} +% \begin{macrocode} + \vadjust{\llap{\SK@lab\kern\marginparsep}}% + \fi + \SK@lab@relax + \fi + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tagform@} +% \changes{v2.00}{1992/01/31} +% {Defer tests to begin document} +% \changes{v3.02}{1995/03/17} +% {Support new AMS files} +% \begin{macro}{\@eqnnum} +% \changes{v3.13}{2006/01/09} +% {Change to also work correctly for \texttt{leqno} option.} +% \begin{macro}{\maketag@@@} +% \changes{v3.13}{2006/01/09} +% {Support for \cs{tag*} tools/3693.} +% Firstly we grab |\@eqnnum|. +% \begin{macrocode} +\AtBeginDocument{% + \let\SK@eqnnum\@eqnnum +% \end{macrocode} +% Then check for \textsf{amsmath} where we grab the internal commands +% |\tagform@| and |\maketag@@@|. Redefine them and redefine |\@eqnnum| +% as well. +% \begin{macrocode} + \@ifpackageloaded{amsmath}{% + \let\SK@tagform@\tagform@ + \let\SK@maketag@@@\maketag@@@ + \iftagsleft@ + \def\tagform@#1{% + \ifx\df@label\@empty + \SK@lab@relax + \else + \expandafter\SK@@label\meaning\df@label\SK@ + \fi + \llap{\SK@lab\kern\marginparsep}% + \SK@lab@relax\SK@tagform@{#1}}% + \def\maketag@@@#1{% + \ifx\df@label\@empty + \SK@lab@relax + \else + \expandafter\SK@@label\meaning\df@label\SK@ + \fi + \llap{\SK@lab\kern\marginparsep}\SK@lab@relax + \SK@maketag@@@{#1}% + }% + \def\@eqnnum{% + \llap{\SK@lab\kern\displaywidth\kern\marginparsep}% + \SK@lab@relax\SK@eqnnum}% + \else +% \end{macrocode} +% Almost the same for tags on the right, except we use |\rlap| and +% typeset it after the tag. +% \begin{macrocode} + \def\tagform@#1{% + \ifx\df@label\@empty + \SK@lab@relax + \else + \expandafter\SK@@label\meaning\df@label\SK@ + \fi +% \end{macrocode} +% \changes{v3.08}{1996/07/10}{Missing percent added. /2215} +% \begin{macrocode} + \SK@tagform@{#1}% + \rlap{\kern\marginparsep\SK@lab}\SK@lab@relax}% + \def\maketag@@@#1{% + \ifx\df@label\@empty + \SK@lab@relax + \else + \expandafter\SK@@label\meaning\df@label\SK@ + \fi + \SK@maketag@@@{#1}% + \rlap{\kern\marginparsep\SK@lab}\SK@lab@relax + }% + \def\@eqnnum{\SK@eqnnum\rlap{\kern\marginparsep\SK@lab}% + \SK@lab@relax}% + \fi + }% +% \end{macrocode} +% If \textsf{amsmath} wasn't loaded we check explicitly if the +% \texttt{leqno} option was used in |\documentclass| and redefine +% accordingly. +% \begin{macrocode} + {% + \@ifundefined{ver@leqno.clo}{% + \def\@eqnnum{\SK@eqnnum\rlap{\kern\marginparsep\SK@lab}% + \SK@lab@relax}% + }{% + \def\@eqnnum{% + \llap{\SK@lab\kern\displaywidth\kern\marginparsep}% + \SK@lab@relax\SK@eqnnum}% + }% + }% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\SK@labx} +% Print the label, and then globally reset the print command to +% |\relax|. +% \begin{macrocode} +\def\SK@labx{\rlap\SK@lab\global\let\SK@lab\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SK@lab@relax} +% Clear the label. +% \changes{v1.02}{1994/01/05}{Execute to initialise correctly} +% \begin{macrocode} +\def\SK@lab@relax{\global\let\SK@lab\relax}\SK@lab@relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SK@equation} +% \begin{macro}{\SK@eqnarray} +% The following environments print an equation number, so |\label| +% should not print its argument at the point where it appears. +% Note this will fail to show the label if you are in an |eqnarray| +% environment, and use |\label| together with |\nonumber| This might +% just about make sense if you are going to use |\pageref|, but that is +% too bad\ldots +% \begin{macrocode} +\newif\ifSK@equation +\let\SK@equation\SK@equationtrue +\let\SK@eqnarray\SK@equationtrue +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\eqnarray} +% \changes{v3.09}{1996/08/30} +% {Fix eqnarray AMS incompatibility. tools/2252} +% When the AMS packages are loaded |showkeys| assumes environments +% work `The AMS way' However |eqnarray| (unlike |equation|) is not +% redefined, so here we need to remove some of the AMS hacks. +% \begin{macrocode} +\toks@\expandafter{\eqnarray} +\edef\eqnarray{\let\noexpand\tagform@\noexpand\SK@tagform@\the\toks@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SK@align} +% \begin{macro}{\SK@alignat} +% \begin{macro}{\SK@xalignat} +% \begin{macro}{\SK@xxalignat} +% \begin{macro}{\SK@gather} +% \begin{macro}{\SK@multline} +% \begin{macro}{\SK@flalign} +% \changes{v3.02}{1995/03/17} +% {Add \cs{SK@flalign}} +% The AMS environments +% \begin{macrocode} +\let\SK@align\SK@equationtrue +\let\SK@alignat\SK@equationtrue +\let\SK@xalignat\SK@equationtrue +\let\SK@xxalignat\SK@equationtrue +\let\SK@gather\SK@equationtrue +\let\SK@multline\SK@equationtrue +\let\SK@flalign\SK@equationtrue +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\SK@align*} +% \begin{macro}{\SK@alignat*} +% \begin{macro}{\SK@flalign*} +% \begin{macro}{\SK@gather*} +% \begin{macro}{\SK@multline*} +% \begin{macro}{\SK@equation*} +% \changes{v3.13}{2006/01/09} +% {Add the starred AMS environments for tools/3697.} +% Starred versions of the AMS environments. +% \begin{macrocode} +\expandafter\let\csname SK@align*\endcsname\SK@equationtrue +\expandafter\let\csname SK@alignat*\endcsname\SK@equationtrue +\expandafter\let\csname SK@flalign*\endcsname\SK@equationtrue +\expandafter\let\csname SK@gather*\endcsname\SK@equationtrue +\expandafter\let\csname SK@multline*\endcsname\SK@equationtrue +\expandafter\let\csname SK@equation*\endcsname\SK@equationtrue +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\SK@def} +% \changes{v3.05}{1995/11/09} +% {Macro added} +% This macro redefines a command |#1|. The new definition can make use +% of the old definition as |\SK@|\emph{old name}. If |#1| is really a +% |\protect|'ed command with the real definition in a `\emph{space}' +% command then the `space' version is used as the old definition. +% Need to test this for each command as some package may have changed +% the status of a command to being `protected'. +% The new definition is made as if with |\DeclareRobustCommand|, but +% with |\def| syntax for the argument specification. +% \begin{macrocode} +\def\SK@def#1{% + \edef\@tempa{\expandafter\@gobble\string#1}% + \@ifundefined{\@tempa\space}% + {\expandafter\let\csname SK@\@tempa\endcsname#1}% + {\expandafter\let\csname SK@\@tempa\expandafter\endcsname + \csname\@tempa\space\endcsname}% + \expandafter\def\expandafter#1\expandafter{% + \expandafter\protect\csname\@tempa\space\endcsname}% + \expandafter\def\csname\@tempa\space\endcsname} +% \end{macrocode} +% \end{macro} +% +% The next section redefines |\ref| and |\pageref| (unless the +% \texttt{notref} option was given). +% \begin{macrocode} +\ifx\SK@ref\@empty +% \end{macrocode} +% Even if \texttt{notref} option is used, need to fudge the +% \textsf{varioref} commands as they use |\label| internally. +% \changes{v3.04}{1995/10/30} +% {improve varioref support in notref option case, for +% tools/1744} +% \changes{v3.13}{2006/01/09}{Updated varioref support, for latex/3373} +% \changes{v3.15}{2006/06/19} +% {Prevent loss of brackets} +% \begin{macrocode} +\AtBeginDocument{% + \@ifpackageloaded{varioref}{% + \SK@def\@@vpageref#1[#2]#3{{% + \let\label\SK@label + \SK@@@vpageref{#1}[{#2}]{#3}}}% + \def\vr@f#1{% + \leavevmode\unskip\vref@space + \ref{#1}% + {\let\label\SK@label + \vpageref[\unskip]{#1}}}% + }{}} +\else +% \end{macrocode} +% +% \begin{macro}{\ref} +% \begin{macro}{\pageref} +% Save the redefinition to |\begin{document}| so that this package can +% work with packages that redefine |\cite|. Tested with harvard and +% natbib packages. Also add code at this point to support varioref. +% \changes{v3.00}{1994/09/07} +% {Delay \cs{ref} redefinition.} +% \changes{v3.03}{1995/04/25} +% {Make redefinition conditional on notref option} +% \changes{v3.15}{2006/06/19} +% {Prevent loss of brackets} +% \begin{macrocode} +\AtBeginDocument{% + \SK@def\ref#1{\SK@\SK@@ref{#1}\SK@ref{#1}}% + \SK@def\pageref#1{\SK@\SK@@ref{#1}\SK@pageref{#1}}% +% \end{macrocode} +% varioref support. +% \begin{macrocode} + \@ifpackageloaded{varioref}{% + \SK@def\@@vpageref#1[#2]#3{{% + \let\label\SK@label\let\ref\SK@ref\let\pageref\SK@pageref + \leavevmode\unskip\SK@\SK@@ref{#3}\SK@@@vpageref{#1}[{#2}]{#3}}}% + \def\vr@f#1{% + \leavevmode\unskip\vref@space + \ref{#1}% + \let\label\SK@label\let\ref\SK@ref\let\pageref\SK@pageref + \vpageref[\unskip]{#1}}% + }{}} +% \end{macrocode} +% +% \begin{macrocode} +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Now redefine |\cite| unless \texttt{notcite} option given. +% \begin{macrocode} +\ifx\SK@cite\@empty +% \end{macrocode} +% \changes{v3.06}{1995/11/22} +% {Fix \cs{harvarditem} support} +% \begin{macrocode} +\AtBeginDocument{% + \ifx\HAR@checkdef\@undefined\else + \expandafter\let\expandafter + \SK@HAR@bi\csname\string\harvarditem\endcsname + \expandafter\def\csname\string\harvarditem\endcsname[#1]#2#3#4{% + \SK@HAR@bi[{#1}]{#2}{#3}{#4}\SK@\SK@@label{#4}}% + \fi} +\else +% \end{macrocode} +% +% \begin{macro}{\cite} +% \changes{v3.00}{1994/09/07} +% {Delay \cs{cite} redefinition.} +% \changes{v3.03}{1995/04/25} +% {Make redefinition conditional on notcite option} +% \begin{macrocode} +\AtBeginDocument{% + \ifx\HAR@checkdef\@undefined +% \end{macrocode} +% Standard (non-harvard) support, including extra cite commands from +% \textsf{natbib} and \textsf{cite}. +% \changes{v3.01}{1994/09/09} +% {Add \cs{citefullauthor}} +% \changes{v3.12}{1997/06/12} +% {Support cite package. tools/2490} +% \changes{v3.17}{2014/04/24} +% {redefine \cs{@citex} rather than \cs{cite} for tools/4162} +% +% If \textsf{cite} or \textsf{overcite} is being used, redefine |\citen| +% rather than |\cite| so as not to spoil the space and punctuation +% calculations done by those packages. +% \begin{macrocode} + \ifx\citen\@undefined + \SK@def\@citex[#1]#2{\SK@citex[{#1}]{#2}}% + \else + \SK@def\citen#1{\SK@\SK@@ref{#1}\SK@citen{#1}}% + \fi + \SK@def\citeauthor#1{\SK@\SK@@ref{#1}\SK@citeauthor{#1}}% + \SK@def\citefullauthor#1{\SK@\SK@@ref{#1}\SK@citefullauthor{#1}}% + \SK@def\citeyear#1{\SK@\SK@@ref{#1}\SK@citeyear{#1}}% + \else +% \end{macrocode} +% In the \textsf{harvard} style do \emph{not} redefine individual cite +% commands. Just redefine one internal command that is used in all the +% citation forms. +% \begin{macrocode} + \SK@def\HAR@checkdef#1#2{% + \expandafter\SK@\expandafter\SK@@ref\expandafter{#1}% + \SK@HAR@checkdef{#1}{#2}}% + \expandafter\let\expandafter + \SK@HAR@bi\csname\string\harvarditem\endcsname +% \end{macrocode} +% \changes{v3.06}{1995/11/22} +% {Fix \cs{harvarditem} support} +% \begin{macrocode} + \expandafter\def\csname\string\harvarditem\endcsname[#1]#2#3#4{% + \SK@HAR@bi[{#1}]{#2}{#3}{#4}\SK@\SK@@label{#4}}% + \fi} +% \end{macrocode} +% +% \changes{v3.17}{2014/04/24} +% {Change name, redefine \cs{@citex} rather than \cs{cite} for tools/4162} +% \begin{macrocode} +\def\SK@citex[#1]#2{% + \SK@\SK@@ref{#2}\SK@@citex[{#1}]{#2}} +% \end{macrocode} +% +% \begin{macrocode} +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SK@@ref} +% This is much simpler than the printing of the label, as we know +% that we can be in horizontal mode. +% Note extra group for colour safety. +% \changes{v3.14}{2006/09/25} +% {Add fix for pdf\TeX.} +% \changes{v3.16}{2011/11/24} +% {revert change made at v3.14 because of tools/4173} +% \begin{macrocode} +\def\SK@@ref#1>#2\SK@{% + \leavevmode\vbox to\z@{{% + \vss + \SK@refcolor + \rlap{\vrule\raise .75em% + \hbox{\underbar{\normalfont\footnotesize\ttfamily#2}}}}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex-dev/tools/somedefs.dtx b/Master/texmf-dist/source/latex-dev/tools/somedefs.dtx new file mode 100644 index 00000000000..f73a45b7871 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/somedefs.dtx @@ -0,0 +1,172 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \title{The \textsf{somedefs} toolkit package} +% \date{long time ago in a different century\ldots} +% \author{Alan Jeffrey} +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% +% \changes{v0.03}{1994/06/01}{Use new style error commands. DPC} +% \changes{v0.02}{1994/05/10}{Added a \cmd\relax, to stop arguments to +% \cmd\newcommand\ being unbraced by \cmd\ProvidesCommand. Added +% an error message for commands which are requested but never +% defined. Spotted by DPC.} +% +% \section*{Overview} +% +% This is an example `programmers toolkit' package, for use by package +% writers. It allows package writers to provide options which switch +% definitions on and off. For example, a package |fred| might define a +% large number of commands, including |\foo| and |\baz|, so: +% \begin{verbatim} +% \usepackage{fred} +% \end{verbatim} +% would use a lot of memory, even if |\foo| and |\baz| were the only +% commands needed. However, if the author of |fred| used the |somedefs| +% package, then the user would be able to say: +% \begin{verbatim} +% \usepackage[only,foo,baz]{fred} +% \end{verbatim} +% and only the commands |\foo| and |\baz| would be defined. +% +% To use the |somedefs| package in your own packages or classes, you +% say: +% \begin{verbatim} +% \RequirePackage{somedefs} +% \end{verbatim} +% You can then use four new commands: +% \begin{flushleft}\begin{itemize} +% \item |\UseAllDefinitions| which says that all the commands in the +% file should be defined. +% \item |\UseSomeDefinitions| which says that only the commands +% specified by |\UseDefinition| should be defined. +% \item |\UseDefinition{|\meta{name}|}| which says that the command +% |\name| should be defined. +% \item |\ProvidesDefinition{|\meta{definition}|}| which provides one +% definition, of the form |\definingcommand{\command}...| +% \end{itemize}\end{flushleft} +% For example, the package |fred| could say: +% \begin{verbatim} +% \RequirePackage{somedefs} +% \UseAllDefinitions +% \DeclareOption{only}{\UseSomeDefinitions} +% \DeclareOption*{\UseDefinition{\CurrentOption}} +% \ProcessOptions +% \ProvidesDefinition{\newcommand{\foo}{...}} +% \ProvidesDefinition{\newcommand{\baz}{...}} +% \end{verbatim} +% One of the commands |\UseAllDefinitions| or |\UseSomeDefinitions| +% should always be used. You may have some commands which need other +% commands, in which case you have to declare the options by hand. For +% example, if the command |\bar| needs the command |\foo|, you could +% say: +% \begin{verbatim} +% \DeclareOption{bar}{\UseDefinition{bar}\UseDefinition{foo}} +% \end{verbatim} +% For a longer example of the use of the |somedefs| package, look at the +% |rawfonts| package. +% +% \StopEventually{} +% +% \section*{Implementation} +% +% The driver for the documentation you're now reading. +% \begin{macrocode} +%<*driver> +\documentclass{ltxdoc} +\begin{document} +\DocInput{somedefs.dtx} +\end{document} +%</driver> +% \end{macrocode} +% This is a \LaTeXe{} package. +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{somedefs}[1994/06/01 v0.03 Toolkit for optional definitions] +% \end{macrocode} +% \begin{macro}{\UseSomeDefinitions} +% \begin{macro}{\UseAllDefinitions} +% \begin{macro}{\UseDefinition} +% \begin{macro}{\ProvidesDefinition} +% \begin{macro}{\@providesdefinition} +% \begin{macro}{\@provides@definition} +% \begin{macro}{\@unprovided@definition} +% The package works by having |\UseDefinition{|\meta{name}|}| define +% |\name| to be |\@unprovided@definition|. +% If |\UseSomeDefinitions| has been called, +% then |\ProvidesDefinition| looks to see if |\name| +% is |\@unprovided@definition|. If +% |\UseAllDefinitions| has been called, then |\ProvidesDefinition| +% does nothing. If neither has been called, then +% |\ProvidesDefinition| produces an error message. +% \begin{macrocode} +\def\UseSomeDefinitions{% + \let\ProvidesDefinition\@providesdefinition +} +\def\UseAllDefinitions{% + \let\ProvidesDefinition\@firstofone +} +\def\UseDefinition#1{% + \expandafter\let\csname#1\endcsname\@unprovided@definition +} +\def\ProvidesDefinition#1{% + \PackageError{somedefs}% + {No \noexpand\UseSomeDefinitions or \string\UseAllDefinitions}% + {The package which used the `somedefs' package has an error.}% +} +\def\@providesdefinition#1{\@provides@definition#1\relax + \@provides@definition} +\def\@provides@definition#1#2#3\@provides@definition{% + \ifx#2\@unprovided@definition + #1#2#3% + \fi +} +\def\@unprovided@definition{% + \PackageError{somedefs}% + {Package `somedefs' error: this command was never defined}% + {You have requested a command which does not exist.}% +} +\@onlypreamble\UseSomeDefinitions +\@onlypreamble\UseAllDefinitions +\@onlypreamble\UseDefinition +\@onlypreamble\ProvidesDefinition +\@onlypreamble\@providesdefinition +\@onlypreamble\@provides@definition +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% That's it! +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% +% \endinput diff --git a/Master/texmf-dist/source/latex-dev/tools/tabularx.dtx b/Master/texmf-dist/source/latex-dev/tools/tabularx.dtx new file mode 100644 index 00000000000..ff8f3cec9a5 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/tabularx.dtx @@ -0,0 +1,968 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% File: tabularx.dtx Copyright (C) 1991-1999 2012 2014 2016 2017 David Carlisle +% +%<*dtx> + \ProvidesFile{tabularx.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{tabularx} +%<driver> \ProvidesFile{tabularx.drv} +% \fi +% \ProvidesFile{tabularx.dtx} + [2016/02/03 v2.11b `tabularx' package (DPC)] +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage[infoshow]{tabularx} +\begin{document} + \DocInput{tabularx.dtx} +\end{document} +%</driver> +% \fi +% +% \changes{v1.00}{1992/01/30}{Initial version.} +% \changes{v1.01}{1992/07/07}{Re-issue for the new doc and docstrip.} +% \changes{v1.02}{1992/07/17}{Added some support for \cmd\verb} +% \changes{v1.03}{1992/08/17} +% {Added \cs{ifnum0}!=`\{\cs{fi}\} brackets after report by +% Andreas Maassen} +% \changes{v1.04}{1992/09/02} +% {fixed \cmd\verb, and support footnotes.} +% \changes{v1.05}{1992/11/06} +% {preserve all LaTeX counters} +% \changes{v1.06}{1993/08/02} +% {(Martin Schroeder) Support the optional [t] or [b] argument. +% Also now works with delarray.sty.} +% \changes{v1.07}{1993/08/27} +% {Modifications to make this style compatible with calc.sty.} +% \changes{v2.00}{1994/03/14} +% {Update to LaTeX2e} +% \changes{v2.01}{1994/05/22} +% {New Tracing format.} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% \GetFileInfo{tabularx.dtx} +% \title{The \textsf{tabularx} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{David Carlisle} +% \date{\filedate} +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \begin{abstract} +% A new environment, {\ttfamily tabularx}, is defined, which takes the +% same arguments as {\ttfamily tabular*}, but modifies the widths of +% certain columns, rather than the inter column space, to set a table +% with the requested total width. The columns that may stretch are +% marked with the new token {\ttfamily X} in the preamble argument. +% +% This package requires the {\ttfamily array} package. +% \end{abstract} +% +% \section{Introduction} +% This package implements a version of the {\ttfamily tabular} +% environment in which the widths of certain columns are calculated so +% that the table is a specified width. Requests for such an +% environment seem to occur quite regularly in {\ttfamily +% comp.text.tex}. +% +% \DescribeEnv{tabularx} +% "\begin{tabularx}{"\meta{width}"}["\meta{pos}"]{"\meta{preamble}"}"\\ +% The arguments of "tabularx" are essentially the same as those of +% the standard "tabular*" environment. However rather than adding space +% between the columns to achieve the desired width, it adjusts the +% widths of some of the columns. The columns which are affected by the +% {\ttfamily tabularx} environment should be denoted with the letter +% {\ttfamily X} in the preamble argument. The {\ttfamily X} column +% specification will be converted to "p{"\meta{some value}"}" once the +% correct column width has been calculated. +% +% \section{Examples} +% +% The following table is set with +% "\begin{tabularx}{250pt}{|c|X|c|X|} ...". +% +% \begin{center} +% \begin{tabularx}{250pt}{|c|X|c|X|} +% \hline +% \multicolumn{2}{|c|}{Multicolumn entry!}& +% THREE& +% FOUR\\ +% \hline +% one& +% \raggedright\arraybackslash The width of this column depends on the +% width of the table.\footnote +% {You can now use {\ttfamily \bslash footnote} inside {\ttfamily +% tabularx}!}& +% three& +% \raggedright\arraybackslash Column four will act in the same way as +% column two, with the same width.\\ +% \hline +% \end{tabularx} +% \end{center} +% If we change the first line to "\begin{tabularx}{300pt}{|c|X|c|X|}" we +% get: +% \begin{center} +% \begin{tabularx}{300pt}{|c|X|c|X|} +% \hline +% \multicolumn{2}{|c|}{Multicolumn entry!}& +% THREE& +% FOUR\\ +% \hline +% one& +% \raggedright\arraybackslash The width of this column depends on the +% width of the table.& +% three& +% \raggedright\arraybackslash Column four will act in the same way as +% column two, with the same width.\\ +% \hline +% \end{tabularx} +% \end{center} +% +% \edef\mytt{\expandafter\noexpand\csname +% mdseries\endcsname\noexpand\ttfamily} +% \section{Differences between {\mytt tabularx} and {\mytt tabular*}} +% These two environments take the same arguments, to produce a table of +% a specified width. The main differences between them are: +% \begin{itemize} +% \item {\ttfamily tabularx} modifies the widths of the \emph{columns}, +% whereas {\ttfamily tabular*} modifies the widths of the inter-column +% \emph{spaces}. +% \item {\ttfamily tabular} and {\ttfamily tabular*} environments may be +% nested with no restriction, however if one {\ttfamily tabularx} +% environment occurs inside another, then the inner one {\em must\/} be +% enclosed by "{ }". +% \item The body of the {\ttfamily tabularx} environment is in fact the +% argument to a command, and so certain constructions which are not +% allowed in command arguments (like "\verb") may not be used.\footnote +% {Since Version 1.02, {\ttfamily\bslash verb and \ttfamily\bslash +% verb*} may be used, but they may treat spaces incorrectly, and the +% argument can not contain an unmatched {\ttfamily\char`\{} or +% {\ttfamily\char`\}}, or a {\ttfamily\char`\%} character.} +% \item {\ttfamily tabular*} uses a primitive capability of \TeX\ to +% modify the inter column space of an alignment. {\ttfamily tabularx} +% has to set the table several times as it searches for the best column +% widths, and is therefore much slower. Also the fact that the body is +% expanded several times may break certain \TeX\ constructs. +% \end{itemize} +% +% \section{Customising the behaviour of {\mytt tabularx}} +% +% \subsection{Terminal output} +% \DescribeMacro{\tracingtabularx} +% If this declaration is made, say in the document preamble, then all +% following {\ttfamily tabularx} environments will print information +% about column widths as they repeatedly re-set the tables to find the +% correct widths. +% +% As an alternative to using the "\tracingtabularx" declaration, either +% of the options "infoshow" or "debugshow" may be given, either in the +% "\usepackage" command that loads "tabularx", or as a global option +% in the "\documentclass" command. +% +% \subsection{The environment used to typeset the {\mytt X} columns} +% By default the {\ttfamily X} specification is turned into +% "p{"\meta{some value}"}". Such narrow columns often +% require a special format, this may be achieved using the ">" syntax +% of {\ttfamily array.sty}. So for example you may give a specification +% of ">{\small}X". Another format which is useful in narrow columns is +% ragged right, however \LaTeX's "\raggedright" macro redefines +% "\\" in a way which conflicts with its use in a tabular or array +% environments. +%\DescribeMacro{\arraybackslash} +% For this reason this package introduces the command "\arraybackslash", +% this may be used after a "\raggedright", "\raggedleft" or +% "\centering" declaration. Thus a {\ttfamily tabularx} preamble may +% specify\\ +% ">{\raggedright\arraybackslash}X". +% +% \DescribeMacro{\newcolumntype} +% These preamble specifications may of course be saved using the +% command, "\newcolumntype", defined in {\ttfamily array.sty}. Thus we +% may say\\ +% "\newcolumntype{Y}{>{\small\raggedright\arraybackslash}X}"\\ +% and then use {\ttfamily Y} in the {\ttfamily tabularx} preamble +% argument. +% +% \DescribeMacro{\tabularxcolumn} +% The {\ttfamily X} columns are set using the {\ttfamily p} column which +% corresponds to "\parbox[t]". You may want them set using, say, the +% {\ttfamily m} column, which corresponds to "\parbox[c]". It is not +% possible to change the column type using the ">" syntax, so another +% system is provided. "\tabularxcolumn" should be defined to be a macro +% with one argument, which expands to the {\ttfamily tabular} preamble +% specification that you want to correspond to {\ttfamily X}. The +% argument will be replaced by the calculated width of a column. +% +% The default is "\newcommand{\tabularxcolumn}[1]{p{#1}}". So we may +% change this with a command such as:\\ +% "\renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}" +% +% \subsection{Column widths} +% Normally all {\ttfamily X} columns in a single table are set to the +% same width, however it is possible to make {\ttfamily tabularx} set +% them to different widths. +% A preamble argument of +% "{>{\hsize=.5\hsize\linewidth=\hsize}X"\\ +% " >{\hsize=1.5\hsize\linewidth=\hsize}X}"\\ +% specifies two columns, the second will be three times as wide as the +% first. However if you want to play games like this you should follow +% the following two rules. +% \begin{itemize} +% \item Make sure that the sum of the widths of all the {\ttfamily X} +% columns is unchanged. (In the above example, the new widths still add +% up to twice the default width, the same as two standard {\ttfamily X} +% columns.) +% \item Do not use "\multicolumn" entries which cross any {\ttfamily X} +% column. +% \end{itemize} +% As with most rules, these may be broken if you know what you are +% doing. +% +% \subsection{If the algorithm fails\ldots} +% It may be that the widths of the `normal' columns of the table +% already total more than the requested total +% width. \textsf{tabularx} refuses to set the +% \texttt{X} columns to a negative width, so in this case you get a +% warning ``X Columns too narrow (table too wide)''. +% +% The \texttt{X} columns will in this case be set to a width of 1em +% and so the table itself will be wider than the requested total width +% given in the argument to the environment. +% This behaviour of the package can be customised slightly +% as noted in the documentation of the code section. +% +% \StopEventually{} +% +% \section{The Macros} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \changes{v2.00}{1994/02/07} +% {New Option Handling} +% \begin{macrocode} +\DeclareOption{infoshow}{\AtEndOfPackage\tracingtabularx} +\DeclareOption{debugshow}{\AtEndOfPackage\tracingtabularx} +\ProcessOptions +% \end{macrocode} +% +% This requires {\ttfamily array.sty}. +% \changes{v2.00}{1994/02/07} +% {Use LaTeX2e's \cmd{\RequirePackage} to load array} +% \begin{macrocode} +\RequirePackage{array}[1994/02/03] +% \end{macrocode} +% +% First some registers etc.\ that we need. +% \begin{macrocode} +\newdimen\TX@col@width +\newdimen\TX@old@table +\newdimen\TX@old@col +\newdimen\TX@target +\newdimen\TX@delta +\newcount\TX@cols +\newif\ifTX@ +% \end{macrocode} +% +% Now a trick to get the body of an environment into a token register, +% without doing any expansion. This does not do any real checking of +% nested environments, so if you should need to nest one {\ttfamily +% tabularx} inside another, the inner one must be surrounded by "{ }". +% +% \begin{macro}{\tabularx} +% Prior to v1.06, this macro took two arguments, which were saved in +% separate registers before the table body was saved by "\TX@get@body". +% Unfortunately this disables the "[t]" optional argument. Now just save +% the width specification separately, then clear the token register +% "\toks@". +% Finally call "\TX@get@body" to begin saving the body of the table. +% The "{\ifnum0=`}\fi" was added at v1.03, to allow "tabularx" to appear +% inside a "\halign".^^A +% \setbox0=\hbox{\footnotesize"\iffalse{\fi\ifnum0=`}\fi"}^^A +% \setbox2=\hbox{\footnotesize"\ifnum0=`{}\fi"}^^A +% \footnote{This adds an extra level of grouping, +% which is not really needed. Instead, I could use \box0\ here, and +% \box2\ below, however the code here would then have to be moved after +% the first line, because of the footnote to page 386 of the \TeX{}Book, +% and I do not think I should be writing code that is so obscure as to +% be documented in a footnote in an appendix called ``Dirty Tricks''!} +% +% This mechanism of grabbing an environment body does have the +% disadvantage (shared with the AMS alignment environments) that you +% can not make extension environments by code such as +%\begin{verbatim} +%\newenvironment{foo}{\begin{tabularx}{XX}}{\end{tabularx}} +%\end{verbatim} +% as the code is looking for a literal string "\end{tabularx}" to stop +% scanning. Since version 2.02, one may avoid this problem by using +% "\tabularx" and "\endtabularx" directly in the definition: +%\begin{verbatim} +%\newenvironment{foo}{\tabularx{XX}}{\endtabularx} +%\end{verbatim} +% The scanner now looks for the end of the current environment ("foo" in +% this example.) There are some restrictions on this usage, the +% principal one being that "\endtabularx" must not be inside any "{ }" pairs +% ao that the code before "\endtabularx" may be extracted and added to the table body +% (prior to version 2.09 "\endtabularx" had to be +% the \emph{first} token of the `end code' of the environment). +% \begin{macrocode} +\def\tabularx#1{% +% \end{macrocode} +% \changes{v2.02}{1995/03/20} +% {New local setting of \cs{TX@}} +% \changes{v4.09}{1998/05/13} +% {Use \cs{setlength}, so that calc extensions apply. tools/2793} +% Allow "\tabularx" "\endtabularx" (but not "\begin{tabularx}" +% "\end{tabularx}") to be used in "\newenvironment" definitions. +% \begin{macrocode} +\edef\TX@{\@currenvir}% + {\ifnum0=`}\fi +% \end{macrocode} +% "\relax" added at v1.05 so that non-expandable length tokens, like +% "\textwidth" do not generate an extra space, and an overfull box. +% "\relax" removed again at v4.09 in favour of "\setlength" so if you +% use the calc package you can use a width of "(\textwidth-12pt)/2". +% \begin{macrocode} + \setlength\TX@target{#1}% + \TX@typeout{Target width: #1 = \the\TX@target.}% + \toks@{}\TX@get@body} +% \end{macrocode} +% \end{macro} +% + +% \begin{macro}{\endtabularx} +% This does not do very much\ldots +% \changes{v2.02}{1995/03/20} +% {Macro added} +% \begin{macrocode} +\let\endtabularx\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@get@body} +% Place all tokens as far as the first "\end" into a token register. +% Then call "\TX@find@end" to see if we are at "\end{tabularx}". +% \begin{macrocode} +\long\def\TX@get@body#1\end + {\toks@\expandafter{\the\toks@#1}\TX@find@end} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@find@end} +% If we are at "\end{tabularx}", call "\TX@endtabularx", otherwise +% add "\end{...}" to the register, and call "\TX@get@body" again. +% \begin{macrocode} +\def\TX@find@end#1{% + \def\@tempa{#1}% + \ifx\@tempa\TX@\expandafter\TX@endtabularx + \else\toks@\expandafter + {\the\toks@\end{#1}}\expandafter\TX@get@body\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@find@endtabularxa} +% \changes{v2.09}{2014/04/22}{macro added} +% \changes{v2.10}{2014/05/13}{macro modified to test for missing \cs{endtabularx}} +% \changes{v2.11}{2016/01/03}{Fix to previous change to guard against empty arg 2. (Ulrike Fischer)} +% split up the end code, and extract the part that lives in the table body. +% \begin{macrocode} +\long\def\TX@find@endtabularxa + #1\endtabularx#2\endtabularx#3\TX@find@endtabularxa{% + \ifx\TX@#2\relax\else + \toks@\expandafter{\the\toks@#1}% + \fi} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TX@find@endtabularxb} +% \changes{v2.09}{2014/04/22}{macro added} +% \changes{v2.10}{2014/05/13}{macro modified to test for missing \cs{endtabularx}} +% split up the end code, and extract the part that lives outside the table body. +% \begin{macrocode} +\long\def\TX@find@endtabularxb + #1\endtabularx#2\endtabularx#3\TX@find@endtabularxb{% + \ifx\TX@#2% + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {#1}{#2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@find@endtabularxbb} +% \changes{v2.10}{2014/05/13}{macro added} +% Helper to avoid needing 15 consecutive "expandafter" +% \begin{macrocode} +\def\TX@find@endtabularxbb{% + \expandafter\expandafter\expandafter + \TX@find@endtabularxb +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@} +% The string {\ttfamily tabularx} as a macro for testing with "\ifx". +% \begin{macrocode} +\def\TX@{tabularx} +% \end{macrocode} +% \end{macro} +% +% Now that all the parts of the table specification are stored in +% registers, we can begin the work of setting the table. +% +% The algorithm for finding the correct column widths is as follows. +% Firstly set the table with each {\ttfamily X} column the width of the +% final table. Assuming that there is at least one {\ttfamily X} column, +% this will produce a table that is too wide. Divide the excess width by +% the number of {\ttfamily X} columns, and reduce the column width by +% this amount. Reset the table. If the table is not now the correct +% width, a "\multicolumn" entry must be `hiding' one of the {\ttfamily +% X} columns, and so there is one less {\ttfamily X} column affecting +% the width of the table. So we reduce by 1 the number of X columns and +% repeat the process. +% +% \begin{macro}{\TX@endtabularx} +% Although I have tried to make {\ttfamily tabularx} look like an +% environment, it is in fact a command, all the work is done by this +% macro. +% \begin{macrocode} +\def\TX@endtabularx{% +% \end{macrocode} +% \changes{v2.09}{2014/04/22}{call to \cs{TX@find@endtabularxa} added} +% \changes{v2.10}{2014/05/13}{macro modified to test for missing \cs{endtabularx}} +% \begin{macrocode} + \expandafter\expandafter\expandafter + \TX@find@endtabularxa\csname end\TX@\endcsname + \endtabularx\TX@\endtabularx\TX@find@endtabularxa +% \end{macrocode} +% Define the {\ttfamily X} column, with an internal version of the +% "\newcolumntype" command. The "\expandafter" commands enable +% "\NC@newcol" to get the {\em expansion} of\\ +% "\tabularxcolumn{\TX@col@width}" as its +% argument. This will be the definition of an {\ttfamily X} column, as +% discussed in section 4. +% \begin{macrocode} + \expandafter\TX@newcol\expandafter{\tabularxcolumn{\TX@col@width}}% +% \end{macrocode} +% Initialise the column width, and the number of {\ttfamily X} columns. +% The number of {\ttfamily X} columns is set to one, which means that +% the initial count will be one too high, but this value is decremented +% before it is used in the main loop. +% +% Since v1.02, switch the definition of "\verb". +% \begin{macrocode} + \let\verb\TX@verb +% \end{macrocode} +% Since v1.05, save the values of all \LaTeX\ counters, the list +% "\cl@@ckpt" contains the names of all the \LaTeX\ counters that have +% been defined so far. We expand "\setcounter" at this point, as it +% results in fewer tokens being stored in "\TX@ckpt", but the actual +% resetting of the counters occurs when "\TX@ckpt" is expanded after +% each trial run. +% Actually since v1.07, use something equivalent to the expansion of the +% original definition of "\setcounter", so that "tabularx" works in +% conjunction with "calc.sty". +% \begin{macrocode} + \def\@elt##1{\global\value{##1}\the\value{##1}\relax}% + \edef\TX@ckpt{\cl@@ckpt}% + \let\@elt\relax + \TX@old@table\maxdimen + \TX@col@width\TX@target + \global\TX@cols\@ne +% \end{macrocode} +% Typeout some headings (unless this is disabled). +% \begin{macrocode} + \TX@typeout@ + {\@spaces Table Width\@spaces Column Width\@spaces X Columns}% +% \end{macrocode}% +% First attempt. Modify the {\ttfamily X} definition to count {\ttfamily +% X} columns. +% \begin{macrocode} + \TX@trial{\def\NC@rewrite@X{% + \global\advance\TX@cols\@ne\NC@find p{\TX@col@width}}}% +% \end{macrocode} +% Repeatedly decrease column width until table is the correct width, +% or stops shrinking, or the columns become two narrow. +% If there are no multicolumn entries, this will only take one attempt. +% \begin{macrocode} + \loop + \TX@arith + \ifTX@ + \TX@trial{}% + \repeat +% \end{macrocode} +% One last time, with warnings back on (see appendix D) +% use {\ttfamily tabular*} to put it in a box of the right size, in case +% the algorithm failed to find the correct size. +% +% Since v1.04, locally make "\footnotetext" save its argument in a token +% register. +% Since v1.06, "\toks@" contains the preamble specification, +% and possible optional argument, as well as the table body. +% \begin{macrocode} + {\let\@footnotetext\TX@ftntext\let\@xfootnotenext\TX@xftntext + \csname tabular*\expandafter\endcsname\expandafter\TX@target + \the\toks@ + \csname endtabular*\endcsname}% +% \end{macrocode} +% Now the alignment is finished, and the "}" has restored the original +% meaning of "\@footnotetext" expand the register "\TX@ftn" which will +% execute a series of\\ +% "\footnotetext["\meta{num}"]{"\meta{note}"}"\\ +% commands. We need to be careful about clearing the register as we may +% be inside a nested {\ttfamily tabularx}. +% \begin{macrocode} + \global\TX@ftn\expandafter{\expandafter}\the\TX@ftn +% \end{macrocode} +% Now finish off the {\ttfamily tabularx} environment. Note that we need +% "\end{tabularx}" here as the "\end{tabularx}" in the user's +% file is never expanded. Now use "\TX@" rather than "tabularx". +% \changes{v2.02}{1995/03/20} +% {Close the environment \cs{TX@} rather than `tabularx'} +% +% We also need to finish off the group started by "{\ifnum0=`}\fi" in +% the macro "\tabularx". +% \begin{macrocode} + \ifnum0=`{\fi}% +% \end{macrocode} +% \changes{v2.09}{2014/04/22}{call to \cs{TX@find@endtabularxb} added} +% \changes{v2.10}{2014/05/13}{macro modified to test for missing \cs{endtabularx}} +% \begin{macrocode} + \expandafter\expandafter\expandafter + \TX@find@endtabularxbb + \expandafter\end\expandafter{\TX@}% + \endtabularx\TX@\endtabularx\TX@find@endtabularxb +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\TX@arith} +% Calculate the column width for the next try, setting the flag +% "\ifTX@" to false if the loop should be aborted. +% \begin{macrocode} +\def\TX@arith{% + \TX@false +% \end{macrocode} +% \changes{v2.08}{2012/02/06}{Avoid exceeding maxdimen during trials} +% \begin{macrocode} + \@tempdimb\maxdimen + \divide\@tempdimb\TX@cols + \ifdim\TX@col@width>\@tempdimb + \TX@typeout@{Don't exceed \maxdimen}% + \wd\@tempboxa\maxdimen + \fi + \ifdim\TX@old@table=\wd\@tempboxa +% \end{macrocode} +% If we have reduced the column width, but the table width has not +% changed, we stop the loop, and output the table (which will cause an +% over-full alignment) with the previous value of "\TX@col@width". +% \begin{macrocode} + \TX@col@width\TX@old@col + \TX@typeout@{Reached minimum width, backing up.}% + \else +% \end{macrocode} +% Otherwise calculate the amount by which the current table is too wide. +% \begin{macrocode} + \dimen@\wd\@tempboxa + \advance\dimen@ -\TX@target + \ifdim\dimen@<\TX@delta +% \end{macrocode} +% If this amount is less than "\TX@delta", stop. ("\TX@delta" +% should be non-zero otherwise we may miss the target due to rounding +% error.) +% \begin{macrocode} + \TX@typeout@{Reached target.}% + \else +% \end{macrocode} +% Reduce the number of effective {\ttfamily X} columns by one. (Checking +% that we do not get 0, as this would produce an error later.) Then +% divide excess width by the number of effective columns, and calculate +% the new column width. Temporarily store this value (times $-1$) in +% "\dimen@". +% \begin{macrocode} + \ifnum\TX@cols>\@ne + \advance\TX@cols\m@ne + \fi + \divide\dimen@\TX@cols + \advance\dimen@ -\TX@col@width + \ifdim \dimen@ >\z@ +% \end{macrocode} +% If the new width would be too narrow, abort the loop. At the moment +% too narrow, means less than 0\,pt! +% +% Prior to v2.03, if the loop was aborted here, the X columns were left +% with the width of the previous run, but this may make the table far +% too wide as initial guesses are always too big. Now force to +% "\TX@error@width" which defaults to be 1em. If you want to +% get the old behaviour stick\\ +% "\renewcommand\TX@error@width{\TX@col@width}"\\ +% in a package file loaded after \textsf{tabularx}. +% \changes{v2.03}{1997/02/20}{Improve warning message and force to 1em.} +% \begin{macrocode} + \PackageWarning{tabularx}% + {X Columns too narrow (table too wide)\MessageBreak}% + \TX@col@width\TX@error@width\relax + \else +% \end{macrocode} +% Otherwise save the old settings, and set the new column width. Set the +% flag to true so that the table will be set, and the loop will be +% executed again. +% \begin{macrocode} + \TX@old@col\TX@col@width + \TX@old@table\wd\@tempboxa + \TX@col@width-\dimen@ + \TX@true + \fi + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@error@width} +% \changes{v2.03}{1997/02/20}{macro added.} +% \changes{v2.04}{1997/02/26}{spurious brace removed.} +% If the calculated width is negative, use this instead. +% \begin{macrocode} +\def\TX@error@width{1em} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@delta} +% Accept a table that is within "\hfuzz" of the correct width. +% \begin{macrocode} +\TX@delta\hfuzz +% \end{macrocode} +% \end{macro} +% +% Initialise the {\ttfamily X} column. The definition can be empty here, +% as it is set for each {\ttfamily tabularx} environment. +% \begin{macrocode} +\newcolumntype{X}{} +% \end{macrocode} +% +% \begin{macro}{\tabularxcolumn} +% The default definition of {\ttfamily X} is "p{#1}". +% \begin{macrocode} +\def\tabularxcolumn#1{p{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@newcol} +% A little macro just used to cut down the number of "\expandafter" +% commands needed. +% \begin{macrocode} +\def\TX@newcol{\newcol@{X}[0]} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@trial} +% Make a test run. +% \begin{macrocode} +\def\TX@trial#1{% + \setbox\@tempboxa\hbox{% +% \end{macrocode} +% Any extra commands. This is used on the first run to count the number +% of {\ttfamily X} columns. +% \begin{macrocode} + #1\relax +% \end{macrocode} +% Since v1.04, make "\footnotetext" gobble its arguments. Also locally +% clear "\TX@vwarn" so that the warning is generated by the {\ttfamily +% final} run, and does not appear in the middle of the table if +% "\tracingtabularx". +% \begin{macrocode} + \let\@footnotetext\TX@trial@ftn + \let\TX@vwarn\@empty +% \end{macrocode} +% Do not nest {\ttfamily tabularx} environments during trial runs. This +% would waste time, and the global setting of "\TX@cols" would break the +% algorithm. +% \begin{macrocode} + \expandafter\let\expandafter\tabularx\csname tabular*\endcsname + \expandafter\let\expandafter\endtabularx\csname endtabular*\endcsname +% \end{macrocode} +% Added at v1.05: disable "\write"s during a trial run. This trick is +% from the \TeX{}Book.\footnote{Actually the \TeX{}Book trick does +% not work correctly, so changed for v2.05.} +% \changes{v2.05}{1997/09/18} +% {New \cs{write} trick. tools/2607} +% \changes{v2.07}{1999/01/07} +% {Newer \cs{write} trick. tools/2792} +% \begin{macrocode} + \def\write{\begingroup + \def\let{\afterassignment\endgroup\toks@}% + \afterassignment\let\count@}% +% \end{macrocode} +% Turn off warnings (see appendix D). Also prevent them being turned +% back on by setting the parameter names to be registers. +% \begin{macrocode} + \hbadness\@M + \hfuzz\maxdimen + \let\hbadness\@tempcnta + \let\hfuzz\@tempdima +% \end{macrocode} +% Make the table, and finish the hbox. +% Since v1.06, "\toks@" contains the preamble specification, +% and possible optional argument, as well as the table body. +% \begin{macrocode} + \expandafter\tabular\the\toks@ + \endtabular}% +% \end{macrocode} +% Since v1.05 reset all \LaTeX\ counters, by executing "\TX@ckpt". +% \begin{macrocode} + \TX@ckpt +% \end{macrocode} +% Print some statistics. +% Added "\TX@align" in v1.05, to line up the columns. +% \begin{macrocode} + \TX@typeout@{\@spaces + \expandafter\TX@align + \the\wd\@tempboxa\space\space\space\space\space\@@ + \expandafter\TX@align + \the\TX@col@width\space\space\space\space\space\@@ + \@spaces\the\TX@cols}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@align} +% Macro added at v1.05, to improve the printing of the tracing info. +% \begin{macrocode} +\def\TX@align#1.#2#3#4#5#6#7#8#9\@@{% + \ifnum#1<10 \space\fi + \ifnum#1<100 \space\fi + \ifnum#1<\@m\space\fi + \ifnum#1<\@M\space\fi + #1.#2#3#4#5#6#7#8\space\space} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\arraybackslash} +% "\\" hack. +% \changes{v2.08}{2012/02/06}{Don't define this if already defined by newer array package and use tabularnewline now this is in 2e.} +% \begin{macrocode} +\ifx\arraybackslash\@undefined +\def\arraybackslash{\let\\\tabularnewline} +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tracingtabularx} +% Print statistics on column and table widths. +% \begin{macrocode} +\def\tracingtabularx{% + \def\TX@typeout{\PackageWarningNoLine{tabularx}}% + \def\TX@typeout@##1{\typeout{(tabularx) ##1}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@typeout} +% The default is to be to be quiet +% \begin{macrocode} +\let\TX@typeout\@gobble +\let\TX@typeout@\@gobble +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@ftn} +% A token register for saving footnote texts. +% \begin{macrocode} +\newtoks\TX@ftn +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@ftntext} +% \begin{macro}{\TX@xftntext} +% Inside the alignment just save up the footnote text in a token +% register. +% \begin{macrocode} +\long\def\TX@ftntext#1{% + \edef\@tempa{\the\TX@ftn\noexpand\footnotetext + [\the\csname c@\@mpfn\endcsname]}% + \global\TX@ftn\expandafter{\@tempa{#1}}}% +\long\def\TX@xftntext[#1]#2{% + \global\TX@ftn\expandafter{\the\TX@ftn\footnotetext[#1]{#2}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\TX@trial@ftn} +% On trial runs, gobble footnote texts. +% \begin{macrocode} +\long\def\TX@trial@ftn#1{} +% \end{macrocode} +% \end{macro} +% +% This last section was added at Version 1.02. Previous versions +% documented the fact that "\verb" did not work inside {\ttfamily +% tabularx}, but that did not stop people using it! This usually put +% \LaTeX\ into an irrecoverable error position, with error messages that +% did not mention the cause of the error. The `poor man's "\verb"' (and +% "\verb*") defined here is based on page 382 of the \TeX{}Book. As +% explained there, doing verbatim this way means that spaces are not +% treated correctly, and so "\verb*" may well be useless, however I +% consider this section of code to be error-recovery, rather than a real +% implementation of verbatim. +% +% The mechanism is quite general, and any macro which wants to allow a +% form of "\verb" to be used within its argument may +% "\let\verb=\TX@verb". (Making sure to restore the real definition +% later!) +% +% "\verb" and "\verb*" are subject to the following restrictions: +% \begin{enumerate} +% \item Spaces in the argument are not read verbatim, but may be skipped +% according to \TeX's usual rules. +% \item Spaces will be added to the output after control words, even if +% they were not present in the input. +% \item Unless the argument is a single space, any trailing space, +% whether in the original argument, or added as in (2), +% will be omitted. +% \item The argument must not end with "\", so "\verb|\|" is not +% allowed, however, because of (3), "\verb|\ |" produces +% "\". +% \item The argument must be balanced with respect to "{" and "}". So +% "\verb|{|" is not allowed. +% \item A comment character like "%" will not appear verbatim. It will +% act as usual, commenting out the rest of the input line! +% \item The combinations "?`" and "!`" will appear as +% {\ttfamily?`} and {\ttfamily!`} if the {\ttfamily cmtt} font is +% being used. +% \end{enumerate} +% +% \begin{macro}{\TX@verb} +% The internal definition of "\verb". Spaces will be replaced by "~", so +% for the star-form, "\let" "~" be \verb*| |, which we obtain as +% "\uppercase{*}". Use "{\ifnum0=`}\fi" rather than "\bgroup" to allow +% "&" to appear in the argument. +% \begin{macrocode} +{\uccode`\*=`\ % +\uppercase{\gdef\TX@verb{% + \leavevmode\null\TX@vwarn + {\ifnum0=`}\fi\ttfamily\let\\\ignorespaces + \@ifstar{\let~*\TX@vb}{\TX@vb}}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@vb} +% Get the `almost verbatim' text using "\meaning". The `"!"' is added to +% the front of the user supplied text, to ensure that the whole argument +% does not consist of a single "{ }" group. \TeX\ would strip the outer +% braces from such a group. The `"!"' will be removed later. +% +% Originally I followed Knuth, and had "\def\@tempa{##1}", however this +% did not allow "#" to appear in the argument. So in v1.04, I changed +% this to to use a token register, and "\edef". This allows "#" appear, +% but makes each one appear twice!, so later we loop through, replacing +% "##" by "#". +% \begin{macrocode} +\def\TX@vb#1{\def\@tempa##1#1{\toks@{##1}\edef\@tempa{\the\toks@}% + \expandafter\TX@v\meaning\@tempa\\ \\\ifnum0=`{\fi}}\@tempa!} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@v} +% Strip the initial segment of the "\meaning", including the `"!"' +% added earlier. +% \begin{macrocode} +\def\TX@v#1!{\afterassignment\TX@vfirst\let\@tempa= } +% \end{macrocode} +% \end{macro} +% +% As explained above we are going to replace "##" pairs by "#". To do +% this we need non-special "#" tokens. Make "*" into a parameter +% token so that we can define macros with arguments. The normal meanings +% will be restored by the "\endgroup" later. +% \begin{macrocode} +\begingroup +\catcode`\*=\catcode`\# +\catcode`\#=12 +% \end{macrocode} +% +% \begin{macro}{\TX@vfirst} +% As a special case, prevent the first character from being dropped. +% This makes "\verb*| |" produce \verb*| |. Then call "\TX@v@". +% This is slightly tricky since v1.04, as I have to ensure that an +% actual "#" rather than a command "\let" to "#" is passed on if the +% first character is "#". +% \begin{macrocode} +\gdef\TX@vfirst{% + \if\@tempa#% + \def\@tempb{\TX@v@#}% + \else + \let\@tempb\TX@v@ + \if\@tempa\space~\else\@tempa\fi + \fi + \@tempb} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@v@} +% Loop through the "\meaning", replacing all spaces by "~". If the last +% character is a space it is dropped, so that "\verb*|\LaTeX|" produces +% "\LaTeX" not \verb*|\LaTeX |. The rewritten tokens are then further +% processed to replace "##" pairs. +% \begin{macrocode} +\gdef\TX@v@*1 *2{% + \TX@v@hash*1##\relax\if*2\\\else~\expandafter\TX@v@\fi*2} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TX@v@hash} +% The inner loop, replacing "##" by "#". +% \begin{macrocode} +\gdef\TX@v@hash*1##*2{*1\ifx*2\relax\else#\expandafter\TX@v@hash\fi*2} +% \end{macrocode} +% \end{macro} +% +% As promised, we now restore the normal meanings of "#" and "*". +% \begin{macrocode} +\endgroup +% \end{macrocode} +% +% \begin{macro}{\TX@vwarn} +% Warn the user the first time this "\verb" is used. +% \begin{macrocode} +\def\TX@vwarn{% + \@warning{\noexpand\verb may be unreliable inside tabularx}% + \global\let\TX@vwarn\@empty} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex-dev/tools/tabularx.ins b/Master/texmf-dist/source/latex-dev/tools/tabularx.ins new file mode 100644 index 00000000000..06308d77359 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/tabularx.ins @@ -0,0 +1,74 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright (C) 1993-2019 +%% The LaTeX3 Project and any individual authors listed elsewhere +%% in this file. +%% +%% This file is part of the Standard LaTeX `Tools Bundle'. +%% ------------------------------------------------------- +%% +%% It may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% As this file contains legal notices, it is NOT PERMITTED to modify +%% this file in any way that the legal information placed into +%% generated files is changed (i.e., the files generated when the +%% original file is executed). This restriction does not apply if +%% (parts of) the content is reused in a different WORK producing its +%% own generated files. +%% +%% The list of all files belonging to the `Tools Bundle' is +%% given in the file `manifest.txt'. +%% +%% +%% --------------- start of docstrip commands ------------------ +%% +\input docstrip + +\keepsilent + +\usedir{tex/latex/tools} + +\preamble + +This is a generated file. + +The source is maintained by the LaTeX Project team and bug +reports for it can be opened at https://latex-project.org/bugs/ +(but please observe conditions on bug reports sent to that address!) + +Copyright (C) 1993-2019 +The LaTeX3 Project and any individual authors listed elsewhere +in this file. + +This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. +-------------------------------------------------------------------------- + +It may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This file may only be distributed together with a copy of the LaTeX +`Tools Bundle'. You may however distribute the LaTeX `Tools Bundle' +without such generated files. + +The list of all files belonging to the LaTeX `Tools Bundle' is +given in the file `manifest.txt'. + +\endpreamble + +\generate{\file{tabularx.sty}{\from{tabularx.dtx}{package}}} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex-dev/tools/theorem.dtx b/Master/texmf-dist/source/latex-dev/tools/theorem.dtx new file mode 100644 index 00000000000..6f745d016ef --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/theorem.dtx @@ -0,0 +1,1144 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% +%% +% +% +\def\FMithmInfo{2014/10/28 v2.2c Theorem extension package (FMi)} +% +% \ProvidesFile{theorem.dtx}[\FMithmInfo] +%\iffalse % this is a METACOMMENT ! +%% +%% Package `theorem' to use with LaTeX2e +%% Copyright (C) 1989-1995 Frank Mittelbach, all rights reserved. +%<+package>\@ifundefined{theorem@style}{}{\endinput} +%<+package>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<+package>\ProvidesPackage{theorem} +%<+package> [\FMithmInfo] +% +% \fi +% +% \changes{v1.0}{87/05/07}{First draft.} +% \changes{v1.0a}{87/05/07}{`thistheoremstyle' added.} +% \changes{v1.1a}{87/07/29}{New concept: redefine the internal +% \protect\LaTeX{} commands `@xnthm' etc.} +% \changes{v1.1b}{87/07/31}{`theoremfont' used to specify font.} +% \changes{v1.2a}{88/01/08}{`@endtheorem' now globally defined.} +% \changes{v1.2b}{88/01/11}{`newtheorem' only allowed in the preamble.} +% \changes{v1.3a}{88/02/14}{`theoremfont' now a toks register.} +% +% \changes{v2.0a}{88/11/16}{New implementation and new documentation.} +% \changes{v2.0a}{88/11/16}{No layout changes but internal modifications +% old substyles won't work.} +% \changes{v2.0b}{89/01/30}{`global' used for all definitions.} +% \changes{v2.0c}{89/06/15}{Documentation translated to English. +% Thanks to LLL and Nina} +% \changes{v2.1a}{90/02/15}{Support for new font selection.} +% \changes{v2.2a}{94/02/03}{Cleanup for LaTeX2e} +% +% \DoNotIndex{\@endparenv,\@ifdefinable,\@ifnextchar,\@ifundefined} +% \DoNotIndex{\@namedef,\@nameuse,\@spaces,\@tempa,\@warning} +% \DoNotIndex{\ } +% \DoNotIndex{\begingroup,\bfseries} +% \DoNotIndex{\csname} +% \DoNotIndex{\def,\do,\docdate} +% \DoNotIndex{\endcsname,\endgroup,\endinput,\endtrivlist,\expandafter} +% \DoNotIndex{\filedate,\fileversion} +% \DoNotIndex{\gdef,\global} +% \DoNotIndex{\hbox,\hskip} +% \DoNotIndex{\ignorespaces,\input,\itshape,\item} +% \DoNotIndex{\labelsep,\let,\llap} +% \DoNotIndex{\makeatletter} +% \DoNotIndex{\noexpand} +% \DoNotIndex{\refstepcounter,\relax,\rlap} +% \DoNotIndex{\setlength,\slshape,\space,\string,\strut} +% \DoNotIndex{\the,\trivlist,\typeout} +% \DoNotIndex{\vbox} +% \DoNotIndex{\xdef} +% +% \def\deflabel#1{\ttfamily #1\hfill} +% \def\deflist#1{\begin{list}{}{\settowidth\labelwidth{\ttfamily #1}% +% \setlength\leftmargin\labelwidth +% \addtolength\leftmargin\labelsep +% \let\makelabel\deflabel}} +% \def\enddeflist{\end{list}} +% \def\envfont{\normalfont\ttfamily} +% +% \MakeShortVerb{\|} +% +% \newcommand{\TUB}{{\sl TUGboat\/}} +% +% \GetFileInfo{theorem.dtx} +% \title{An Extension of the +% \LaTeX{} theorem environment\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{Frank Mittelbach} +% +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% \begin{abstract} +% The macros described in this paper yield an extension of the +% \LaTeX{} theorem mechanism. It is designed is to satisfy the +% different requirements of various journals. Thus, the +% layout of the ``theorems'' can be manipulated by determining a +% ``style''. This article describes not only the use, but +% also the definition, of the necessary macros. +% \end{abstract} +% +% \section*{Preface to version 2.2} +% +% For \LaTeXe{} this package did not need any fundamental changes. I +% only modified the messages generated so that theorem layout styles +% will show up with the |\listfiles| command and cleaned the section +% on the New Font Selection Scheme since this is now included in +% \LaTeX. +% +% \section*{Preface to version 2.1} +% +% This version is identical to 2.0g described in \TUB\ 10\#3 except +% for some internal defaults which are now set depending on the used +% font selection scheme. +% +% This was done to avoid unpleasant surprises if the new font selection +% scheme is in force. For further details see +% section~\ref{sec:newfonts} and \cite{bk:GMS94}. +% +% \section{Introduction} +% +% For our purposes here, ``theorems'' are labelled enunciations, +% often set off from the main text by extra space and a font change. +% Theorems, corollaries, conjectures, definitions, and remarks +% are all instances of ``theorems''. The ``header'' of these structures +% is composed of a label (such as \textsc{Theorem} or \textsc{Remark}) +% and a number which serializes an item in the sequence of items +% with the same label. +% +% Shortly after the introduction of \LaTeX{} at the Fachbereich +% Mathematik in Mainz, the desire to manipulate the layout of +% ``theorems'' arose. In Mainz, the following two conventions came +% into general use: +% \begin{enumerate} +% \item The number of the theorem is shown in the margin. +% \item There is a line break at +% the end of the theorem header. +% \end{enumerate} +% +% Additionally, some journals require different formats which depend on +% the ``sort of theorem'': e.g.\ often remarks and definitions are set +% in |\upshape|, while |\itshape| is employed for main theorems. +% +% Confronted with these requirements, a theorem environment was +% developed in Mainz which allows separate determination of the +% layout of the ``theorems sets'', comparable to |\pagestyle|. +% +% +% \section{The user interface} +% \subsection{Defining new theorem sets} +% +% \DescribeMacro\newtheorem +% As in the original \LaTeX{} version, the command |\newtheorem| +% defines a new ``theorem set'' or ``theorem-like structure''. +% Two required arguments name the new environment and give the text +% to be typeset with each instance of the new ``set'', while +% an optional argument determines how +% the ``set'' is enumerated: +% \begin{description} +% \item[\ttfamily \bslash newtheorem\{foo\}\{bar\}] +% The theorem set {\envfont foo} (whose name is \texttt{bar}) +% uses its own counter. +% \item[\ttfamily \bslash newtheorem\{foo2\}{[foo]}\{bar2\}] +% The theorem set {\envfont foo2} (printed name \texttt{bar2}) +% uses the same counter as the theorem set \texttt{foo}. +% \item[\ttfamily \bslash newtheorem\{foo3\}\{bar3\}{[section]}] +% The theorem set {\envfont foo3} (printed name \texttt{bar3}) is +% enumerated within the counter \texttt{section}, i.e.\ with every +% new |\section| the enumeration begins again with 1, and +% the enumeration is composed from the section-number and the +% theorem counter itself. +% \end{description} +% +% \DescribeMacro\theoremstyle +% Additionally, the command |\theoremstyle| can define the layout +% of various, or all, theorem sets. It should be noted that any +% theorem set defined by |\newtheorem| is typeset in the +% |\theoremstyle| that is current at the time of the definition. +% Thus, the following +% \begin{verbatim} +% \theoremstyle{break} \newtheorem{Cor}{Corollary} +% \theoremstyle{plain} \newtheorem{Exa}{Example}[section] +%\end{verbatim} ^^A No blank at line start +% leads to the result that the set {\envfont Cor} is formatted in the +% style \texttt{break}, while the set {\envfont Exa} and all the +% following ones are formatted in the style \texttt{plain}, unless +% another |\theoremstyle| follows. Since the definitions installed by +% |\newtheorem| are global, one also can limit |\theoremstyle| locally +% by grouping braces. +% +% \DescribeMacro\theorembodyfont +% The choice of the font for the theorem body is completely +% independent of the chosen |\theoremstyle|; this has proven to +% be very advantageous. For example, +% \begin{verbatim} +% {\theorembodyfont{\upshape} \newtheorem{Rem}{Remark}} +%\end{verbatim} +% defines a theorem set {\envfont Rem}, which will be set in +% |\upshape| in the current layout (which in our example is +% \texttt{plain}). As with |\theoremstyle|, the |\theorembodyfont| +% chosen is that current at the time of |\newtheorem|. If +% |\theorembodyfont| is not specified or one defines +% |\theorembodyfont{}|, then the font used will be that defined by the +% |\theoremstyle|. +% +% \DescribeMacro\theoremheaderfont It is also possible to customize +% the font used for the theorem headers. This is, however, a global +% declaration, and therefore there should be at most one +% |\theoremheaderfont| declaration in the preamble.\footnote{If it is +% actually necessary to have different header fonts, one has to define +% new theorem styles (substituting the desired font) or specify the +% information directly in the \texttt{\bslash newtheorem} declaration +% (the unclean variant).} +% +% \DescribeMacro\theorempreskipamount +% \DescribeMacro\theorempostskipamount Two additional parameters +% affect the vertical space around the theorem environments: +% |\theorempreskipamount| and |\theorempostskipamount| define, +% respectively, the spacing before and after such an environment. +% These parameters apply for all theorem sets and can be manipulated +% with the ordinary length macros. They are rubber lengths, +% (`\textsf{skips}'), and therefore can contain \texttt{plus} and +% \texttt{minus} parts. +% +% Since the definition of theorem sets should---most sensibly---be +% placed in the preamble, we only allow installation there. +% It is therefore possible to release the memory used here after +% |\begin{document}|, in order to make room for other +% applications. +% +% +% \subsection{Existing theorem styles} +% +% The following theorem styles exist to date: +% \begin{deflist}{marginbreak} +% \item[plain] +% This theorem style emulates the original \LaTeX{} definition, +% except that additionally the parameters +% |\theorem...skipamount| are used. +% \item[break] +% In this style, the theorem header is followed by a line +% break. +% \item[marginbreak] +% The theorem number is set in the margin, and there is a line +% break as in \texttt{break}. +% \item[changebreak] +% Like \texttt{break}, but with header number and text +% interchanged. +% \item[change] +% Header number and text are interchanged, without a line break. +% \item[margin] +% The number is set in the left margin, without a line break. +% \end{deflist} +% All styles (except \texttt{plain}) select |\slshape| as the default +% |\theorembodyfont|. +% +% +% \subsection{Examples} +% +% Given the above theorem sets {\envfont Cor}, {\envfont Exa} +% and {\envfont Rem}, +% suppose that the preamble also contains the declarations: +% \begin{verbatim} +% \theoremstyle{marginbreak} \newtheorem{Lem}[Cor]{Lemma} +% \theoremstyle{change} +% \theorembodyfont{\itshape} \newtheorem{Def}[Cor]{Definition} +% +% \theoremheaderfont{\scshape} +%\end{verbatim} +% Then the following are some typical examples of the typeset output +% resulting from their use. +% +% \begin{Cor} +% This is a sentence typeset in the theorem environment {\envfont +% Cor}. +% \end{Cor} +% +% \begin{Exa} +% This is a sentence typeset in the theorem environment {\envfont +% Exa}. +% \end{Exa} +% +% \begin{Rem} +% This is a sentence typeset in the theorem environment {\envfont +% Rem}. +% \end{Rem} +% +% \begin{Lem}[Ben User] +% This is a sentence typeset in the theorem environment {\envfont +% Lem}. +% \end{Lem} +% +% \begin{Def}[Very impressive Definition] +% This is a sentence typeset in the theorem environment {\envfont +% Def}. +% \end{Def} +% +% The last two examples show the effect of the optional argument to +% a theorem environment (it is the text typeset in parentheses). +% +% +% \section{Special Considerations} +% \label{sec:newfonts} +% +% Theoremheader and body are implemented as a unit. This means that +% the |\theoremheaderfont| will inherit characteristics of the +% |\theorembodyfont| in \LaTeXe. Thus, if for example +% |\theorembodyfont| is |\itshape| and |\theoremheaderfont| +% is |\bfseries| the font selected for the header will have the +% characteristics `bold extended italic'. If this is not desired one +% should set the |\theoremheaderfont| to something like +% \begin{verbatim} +% \theoremheaderfont{\normalfont\bfseries} +%\end{verbatim} +% i.e.\ supplying all necessary font information explicitly. +% +% +% +% \section{Acknowledgements} +% +% The publication of this set of macros was only possible with the +% help of Christina Busse (translating the manuscript into English), +% Joachim Pense (playing the r\^ole of typist), Chris Rowley +% (looking everything over) and many others providing useful +% suggestions. +% +% \StopEventually{% +% \begin{thebibliography}{9} +% \bibitem{bk:GMS94} \textsc{M.~Goossens}, \textsc{F.~Mittelbach} +% and \textsc{A.~Samarin}. +% \newblock The \LaTeX{} Companion. +% \newblock +% Addison-Wesley, Reading, Massachusetts, 1994. +% \bibitem{latex:source} \textsc{Lamport, Leslie.} \newblock +% \texttt{latex.tex}, version 2.09, date +% Feb. 1990. +% \end{thebibliography} +% \PrintIndex +% \PrintChanges} +% +% +% \section{The documentation driver file} +% +% The next bit of code contains the documentation driver file for +% \TeX{}, i.e., the file that will produce the documentation you are +% currently reading. It will be extracted from this file by the +% \texttt{docstrip} program. Since it is the first code in the file +% one can alternatively process this file directly with \LaTeXe{} to +% obtain the documentation. +% +% \begin{macrocode} +%<*driver> +\documentclass{ltxdoc} + +\usepackage{theorem} + +%<+driver>% The next few lines define theorem sets which are used +%<+driver>% in the example section of the documentation. + +\theoremstyle{break} \newtheorem{Cor}{Corollary} +\theoremstyle{plain} \newtheorem{Exa}{Example}[section] +{\theorembodyfont{\upshape}\newtheorem{Rem}{Remark}} +\theoremstyle{marginbreak} \newtheorem{Lem}[Cor]{Lemma} +\theoremstyle{change} +\theorembodyfont{\itshape} \newtheorem{Def}[Cor]{Definition} + +\theoremheaderfont{\scshape} + +\RecordChanges + +\begin{document} + \DocInput{theorem.dtx} +\end{document} +%</driver> +% \end{macrocode} +% +% \section{Definition of the Macros} +% +% If the file has been loaded before, we abort immediately. If not the +% package announces itself (this is actually done at the very top if +% the file---the way it is done isn't good style so don't copy it). +% \changes{v2.0e}{89/07/19}{Spaces removed from `typeout'.} +% \changes{v2.2b}{95/11/19}{Announce moved to top of file} +% \begin{macrocode} +%<*package> +%\@ifundefined{theorem@style}{}{\endinput} +%\def\FMithmInfo{1995/11/19 v2.2b Theorem extension package (FMi)} +%\ProvidesPackage{theorem}[\FMithmInfo] +% \end{macrocode} +% +% +% \subsection{Definition of theorem styles and fonts} +% +% All the definitions in this file are done globally to allow +% inputting this file inside a group. +% +% \begin{macro}{\theoremstyle} +% Before a theorem style can be installed, the chosen style must be +% known. For that reason, we must test to see that +% |\th@|\meta{style} is known or, more precisely, that it is +% different from |\relax|. If the style is not known then +% |\th@plain| is used. +% \begin{macrocode} +\gdef\theoremstyle#1{% + \@ifundefined{th@#1}{\@warning + {Unknown theoremstyle `#1'. Using `plain'}% + \theorem@style{plain}}% +% \end{macrocode} +% We save the theorem style to be used in the token register +% |\theorem@style|. +% \begin{macrocode} + {\theorem@style{#1}}% +% \end{macrocode} +% Now we ``evaluate'' the theorem style: this means, we call the +% macro |\th@|\meta{style} which will activate the relevant +% definitions which are contained in a separate file. This is done +% in a group to suppress changes to the current font. This could +% otherwise pose problems together with the new font selection +% scheme\footnote{When I printed the original article using the new +% font selection scheme I ended with a document with slanted +% typefaces (text headings and all) simply because one of the +% theorem styles used \texttt{\bslash sl} at toplevel.} if the +% |\th@|\meta{style} is evaluated a second time. +% \changes{v2.1a}{90/02/15}{Group added around `th@..} +% \changes{v2.1a}{90/02/15}{Reseting of `..@begintheorem removed.} +% \begin{macrocode} + \begingroup + \csname th@\the\theorem@style \endcsname + \endgroup} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@begintheorem} +% \changes{v2.1a}{90/02/15}{Relaxed at toplevel.} +% \begin{macro}{\@opargbegintheorem} +% \changes{v2.1a}{90/02/15}{Relaxed at toplevel.} +% We reset |\@begintheorem| and |\@opargbegintheorem| to +% |\relax| since these commands are no longer necessary at +% toplevel. This will save a few tokens. +% \begin{macrocode} +\global\let\@begintheorem\relax +\global\let\@opargbegintheorem\relax +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\theorem@style} +% Obviously the \textsf{token} register used above has to be +% allocated. To assure the utmost compatibility with the +% original \LaTeX{} definition, we set the default theorem style to +% \texttt{plain}, which implements the usual \LaTeX{} convention. +% \changes{v2.0f}{89/07/20}{Unnecessary `global' removed.} +% \begin{macrocode} +\newtoks\theorem@style +\global\theorem@style{plain} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\theorembodyfont} +% \begin{macro}{\theorem@bodyfont} +% If the |\theorembodyfont| is set by the user then it should not +% interact with the default font set in the theorem style. When the +% new font selection is in force this may happen if, for example, +% the default is |\itshape| and the new |\theorembodyfont| is +% |\sffamily|. So we add a |\reset@font| command in front of the +% user definition. +% \changes{v2.0f}{89/07/20}{Unnecessary `global' removed.} +% \changes{v2.0g}{89/09/19}{`theoremfont to `theorembodyfont.} +% \changes{v2.1c}{92/06/22}{`reset@font added and logic changed.} +% \changes{v2.1d}{92/10/28}{Reset to empty if arg is empty} +% \begin{macrocode} +\gdef\theorembodyfont#1{% +% \end{macrocode} +% We check if the argument supplied is empty and if so put nothing +% into the |\theorem@bodyfont| token register to allow for +% |\theorembodyfont{}| as a mean of using the default of the +% current |\theoremstyle|. +% \begin{macrocode} + \def\@tempa{#1}% + \ifx\@tempa\@empty + \theorem@bodyfont{}% + \else + \theorem@bodyfont{\reset@font#1}% + \fi + } +\newtoks\theorem@bodyfont +\global\theorem@bodyfont{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\theoremheaderfont} +% \changes{v2.0g}{89/09/19}{Macro added.} +% The font for the theorem headers is handled differently because +% this definition applies to all theorem styles. +% \begin{macrocode} +\gdef\theoremheaderfont#1{\gdef\theorem@headerfont{#1}% +% \end{macrocode} +% After using the macro once it is redefined to produce an error +% message. +% \begin{macrocode} + \gdef\theoremheaderfont##1{% + \typeout{\string\theoremheaderfont\space should be used + only once.}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\theorem@headerfont} +% \changes{v2.0g}{89/09/19}{Macro added.} +% To set the |\theorem@headerfont| default we first test if +% the new fontselection scheme is in force. +% \changes{v2.1a}{90/02/15}{Support for new font selection.} +% \begin{macrocode} +\ifx\upshape\undefined +% \end{macrocode} +% If not we define it to expand into |\bfseries|. We don't use +% |\let| just in case a following style option redefines this +% macro. +% \begin{macrocode} +\gdef\theorem@headerfont{\bfseries} +% \end{macrocode} +% Otherwise we reset the current shape before calling |\bfseries|. +% \begin{macrocode} +\else \gdef\theorem@headerfont{\normalfont\bfseries}\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\th@plain} +% \begin{macro}{\th@break} +% \begin{macro}{\th@marginbreak} +% \begin{macro}{\th@changebreak} +% \begin{macro}{\th@change} +% \begin{macro}{\th@margin} +% The different styles are defined in macros such as +% |\th@plain|. Since memory space is precious in +% ``non-Big-versions'', we have to avoid offering too many unused +% definitions. Therefore we define these styles in separate files +% that can be loaded on demand. Thus the commands themselves only +% load these files. We use |\@input@| a \LaTeXe{} internal command +% that ensures that the file will be listed with |\listfiles| +% \changes{v2.2a}{94/02/02}{Use `@input@ to load theorem layout files} +% \begin{macrocode} +\gdef\th@plain{\@input@{thp.sty}} +\gdef\th@break{\@input@{thb.sty}} +\gdef\th@marginbreak{\@input@{thmb.sty}} +\gdef\th@changebreak{\@input@{thcb.sty}} +\gdef\th@change{\@input@{thc.sty}} +\gdef\th@margin{\@input@{thm.sty}} +% \end{macrocode} +% This list will be expanded when new styles become +% available. For testing, just append new theorem substyles +% as document options. +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% +% \subsection{Definition of a new theorem set} +% +% As already pointed out, a new theorem environment can be defined in +% three different ways: +% \begin{verbatim} +% \newtheorem{Lem}{Lemma} +% \newtheorem{Lem}{Lemma}[section] +% \newtheorem{Lem}[Theorem]{Lemma} +%\end{verbatim} +% The function of the macro |\newtheorem| is to recognize these cases +% and then to branch into one of the three macros |\@ynthm|, |\@xnthm| +% or |\@othm|. This mechanism is adopted unchanged from +% \cite{latex:source}; the essential point here is that, for example, +% in the second case, the arguments \texttt{Lem}, \texttt{Lemma} and +% \texttt{section} are passed over to the macro |\@xnthm|. +% +% We inspect this case first because the others present fewer problems, +% and thus are easily derived from this one. +% +% \begin{macro}{\@xnthm} +% For our example arguments, the macro |\@xnthm| must fulfill +% the following: +% \begin{itemize} +% \item +% Define a new \LaTeX-counter `Lem' +% \item +% reset this counter within a |\section| +% \item +% define the macro |\theLem| +% \item +% define the environment macros |\Lem| and +% |\endLem| using the current +% |\theoremstyle| and |\theorem@bodyfont|. +% \end{itemize} +% Obviously, all this should happen only if the first argument +% of |\@xnthm| (i.e.\ \texttt{Lem} in our example) is chosen so +% as not to conflict with any previously defined commands or +% environments. This test is performed by the \LaTeX{} macro +% |\@ifdefinable|. +% \begin{macrocode} +\gdef\@xnthm#1#2[#3]{\expandafter\@ifdefinable\csname #1\endcsname +% \end{macrocode} +% Therefore, the first argument of |\@ifdefinable| is the +% expansion (in the example, |\Lem|) of +% |\csname||#1\endcsname|. The second argument is +% executed only if the test has been completed successfully. +% \begin{macrocode} + {% +% \end{macrocode} +% Now we define the new counter. The names of the \LaTeX{} +% macros employed should speak for themselves: +% \changes{v2.2b}{1995/10/07}{Use \cs{@newctr}} +% \changes{v2.2c}{1995/11/23}{Use \cs{@newctr} properly.} +% \begin{macrocode} + \@definecounter{#1}\@newctr{#1}[#3]% +% \end{macrocode} +% Using |\@newctr| will give a proper error message if the counter +% in |#3| is not defined. +% In defining `|\theLem|' we must generate the desired macro +% name by use of |\expandafter| and |\csname|. +% \begin{macrocode} + \expandafter\xdef\csname the#1\endcsname +% \end{macrocode} +% An |\xdef| is used in order to make the definition global, +% and to ensure that it contains the replacement texts of +% |\@thmcountersep| and |\@thmcounter|.\footnote{These +% two macros can be defined by the document style. Their default +% values produce a `\texttt{.}' as separation and an arabic +% representation of the number.} However, not everything should be +% expanded. For example, it saves space to use |\thesection| +% instead of its---at times---lengthy expansion. +% \begin{macrocode} + {\expandafter \noexpand \csname the#3\endcsname + \@thmcountersep \@thmcounter{#1}}% +% \end{macrocode} +% Thus with the defaults of \LaTeX{}, |\theLem| would be +% replaced by the command sequence |\thesection.\arabic{Lem}|. +% +% We will now look at the definition of the macro which is executed +% at the beginning of the actual environment (in our example this +% macro is |\Lem|). It should be noted that we use an +% ``|\expandafter| trick'' to expand only certain parts of the +% replacement text at the time of the definition. +% \begin{macrocode} + \def\@tempa{\global\@namedef{#1}}% + \expandafter \@tempa \expandafter{% +% \end{macrocode} +% First, the macro that contains the current definitions of +% |\@begintheorem| and |\@opargtheorem| should be called +% up. The name of this macro---as is already known---has the form +% |\th@|\meta{theorem\ style}; therefore, it must be called by +% \begin{macrocode} + \csname th@\the \theorem@style +% \end{macrocode} +% In addition the default theorem font should be changeable, i.e.\ +% we have to insert the contents of |\theorem@bodyfont|. For +% that reason, we expand even further, beyond |\endcsname|, +% and thus insert the contents of the \textsf{token} register +% |\theorem@bodyfont| in the replacement text. +% \begin{macrocode} + \expandafter \endcsname \the \theorem@bodyfont +% \end{macrocode} +% Now it is time to call the macro |\@thm| which takes over +% the further processing. It has two arguments: the current +% counter name (in our example, \texttt{Lem}), and the text of the +% label (in our example, \texttt{Lemma}). +% \begin{macrocode} + \@thm{#1}{#2}}% +% \end{macrocode} +% With this, the `sub-definition' is complete. The macro +% |\@endtheorem| ends a theorem environment and is, so far, nothing +% but an |\endtrivlist|. (Hence it is defined globally, and not +% within the theorem styles.\footnote{This has to be changed as +% soon as theorem styles that change \texttt{\bslash @endtheorem} +% exist. In such a case, all existing styles must be changed as +% well since they will have to reset the macro.}) Therefore, we can +% set it equivalent to the macro that ends the theorem set (in our +% example, |\endLem|). However, if some day theorem styles exist +% that do change |\@endtheorem|, we would have to use the +% commented-out line instead. +% \begin{macrocode} + \global \expandafter \let \csname end#1\endcsname \@endtheorem +% \global\@namedef{end#1}{\@endtheorem}% +% \end{macrocode} +% With these commands all the required definitions are employed, +% unless the test |\@ifdefinable| has failed. Therefore, we +% end the second argument of this macro and with it the definition +% of |\@xnthm|. +% \begin{macrocode} + }} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@ynthm} +% The definition of |\@ynthm| is completely analogous. In +% this case the new counter that is defined is not reset within +% another counter; thus the definition of |\the...| +% is simplified: +% \begin{macrocode} +\gdef\@ynthm#1#2{\expandafter\@ifdefinable\csname #1\endcsname + {\@definecounter{#1}% + \expandafter\xdef\csname the#1\endcsname{\@thmcounter{#1}}% +% \end{macrocode} +% The rest of the definition corresponds literally to that of +% |\@xnthm|: +% \begin{macrocode} + \def\@tempa{\global\@namedef{#1}}\expandafter \@tempa + \expandafter{\csname th@\the \theorem@style \expandafter + \endcsname \the\theorem@bodyfont \@thm{#1}{#2}}% + \global \expandafter \let \csname end#1\endcsname \@endtheorem}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@othm} +% The definition of |\@othm| does not contain anything new. +% \begin{macrocode} +\gdef\@othm#1[#2]#3{% +% \end{macrocode} +% \changes{v2.2b}{95/10/07}{Build in check for counter defined} +% We do not define a new counter but instead use one that has +% already been defined. Thus the only definition we need is that +% of this pseudo-counter (i.e.\ |\the|\meta{env.\ name}). +% First we check if |#2| corresponds to a known counter name. +% \begin{macrocode} + \expandafter\ifx\csname c@#2\endcsname\relax + \@nocounterr{#2}% + \else + \expandafter\@ifdefinable\csname #1\endcsname + {\expandafter \xdef \csname the#1\endcsname + {\expandafter \noexpand \csname the#2\endcsname}% +% \end{macrocode} +% All other parts of the definition can be adopted from +% |\@xnthm|. We have to remember, though, that in this case +% the name of the current counter and the theorem label have moved +% to the second and third arguments. +% \begin{macrocode} + \def\@tempa{\global\@namedef{#1}}\expandafter \@tempa + \expandafter{\csname th@\the \theorem@style \expandafter + \endcsname \the\theorem@bodyfont \@thm{#2}{#3}}% + \global \expandafter \let \csname end#1\endcsname \@endtheorem}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \subsection{Macros that are employed in a {\envfont theorem} +% environment} +% +% \begin{macro}{\@thm} +% The macro |\@thm| has to increase the current counter. Then, +% depending on whether the environment has (or does not have) an +% optional argument, it has to branch into either |\@begintheorem| +% or |\@opargtheorem|. +% \begin{macrocode} +\gdef\@thm#1#2{\refstepcounter{#1}% +% \end{macrocode} +% Now we start a {\envfont trivlist} environment, and give +% |\@topsep| and |\@topsepadd| the values of the \textsf{skip} +% registers |\theorempreskipamount| and |\theorempostskipamount|. +% The value in |\@topsep| is the vertical space that is inserted by +% the first (and only) |\item| in our |\trivlist| whilst +% |\@topsepadd| is inserted by |\@endparenv| at the end of that +% {\envfont trivlist} environment. By using these registers, we +% obtain the desired space around a {\envfont theorem} environment. +% \begin{macrocode} + \trivlist + \@topsep \theorempreskipamount % used by first \item + \@topsepadd \theorempostskipamount % used by \@endparenv +% \end{macrocode} +% Now we have to test whether an optional argument has been given. +% \changes{v2.0d}{89/07/18}{Forgotten percent added.} +% \begin{macrocode} + \@ifnextchar [% +% \end{macrocode} +% If there is an optional argument, we will call |\@ythm|, and +% move the arguments read back into the input stream. +% \begin{macrocode} + {\@ythm{#1}{#2}}% +% \end{macrocode} +% If not, we call |\@begintheorem|. Its first argument is the +% name of the theorem set (hence the second argument of +% |\@thm|). Its second argument is the macro that produces the +% current number. +% \begin{macrocode} + {\@begintheorem{#2}{\csname the#1\endcsname}\ignorespaces}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xthm} +% \begin{macro}{\@ythm} +% Both these macros were originally called by |\@thm|. We do +% not need |\@xthm| anymore, hence we reset it to +% |\relax|. The definition of |\@ythm| has not changed at +% all from its definition in \LaTeX. In order to make the macros +% easier to understand, we will +% nevertheless present it (commented out). +% \begin{macrocode} +\global\let\@xthm\relax +% \def\@ythm#1#2[#3]{\@opargbegintheorem{#2}{\csname +% the#1\endcsname}{#3}\ignorespaces} +%</package> +% \end{macrocode} +% The primitive |\ignorespaces| in |\@ythm| and +% |\@thm| is needed to remove the spaces between the +% |\begin{...}| and the actual text. +% \end{macro} +% \end{macro} +% +% +% \subsection{Definition of the theorem substyles} +% +% As already pointed out, the theorem substyles, defined below, are +% only loaded when necessary. Note that all these substyles, except +% \texttt{plain}, have |\slshape| as the default body font. +% +% \subsubsection{The \texttt{plain} style} +% +% \label{dok:th@plain} As the following macros use |@|, we have +% to locally set the |\catcode| of this symbol to ``letter''. +% This happens within a group, so that we do not have to worry about +% which |\catcode| that symbol had before. +% \begin{macrocode} +%<*thp> +\begingroup \makeatletter +% \end{macrocode} +% Since we are now within a group, we must make all definitions +% globally. First we make sure that \texttt{theorem.sty} is loaded. +% This will allow us to use this file as a document style option +% without having to call \texttt{theorem} itself as an option. At the +% same time, we assure that at least version 2 is loaded, since +% |\theorem@style| was not defined in earlier versions. +% \begin{macrocode} +\@ifundefined{theorem@style}{\input{theorem.sty}}{} +\ProvidesFile{thp.sty} + [\FMithmInfo] +% \end{macrocode} +% +% +% \begin{macro}{\th@plain} +% \begin{macro}{\@begintheorem} +% \begin{macro}{\@opargbegintheorem} +% |\theoremstyle{plain}| corresponds to the original +% definition, except that the distances to the surrounding text are +% determined by the parameters |\theorempreskipamount| and +% |\theorempostskipamount|. +% First we set the default body font. +% \begin{macrocode} +\gdef\th@plain{\normalfont\itshape +% \end{macrocode} +% Then we define |\@begintheorem| and +% |\@opargbegintheorem|. These two macros define how the +% header of a theorem is typeset. |\@opargbegintheorem| will +% be called if a \textsf{theorem} environment with an optional +% argument is encountered; otherwise, the header is constructed by +% calling |\@begintheorem|. If one of these macros is +% executed, we are within a \textsf{trivlist} environment started by +% |\@thm|. So the theorem header is produced with an +% |\item| command. +% +% Instead of specifying the header font directly, all standard +% theorem styles use the |\theorem@headerfont| macro to allow +% customization. The extra space (|\labelsep|) is necessary +% because of problems in the \textsf{trivlist} environment. +% \begin{macrocode} + \def\@begintheorem##1##2{% + \item[\hskip\labelsep \theorem@headerfont ##1\ ##2]}% +% \end{macrocode} +% The definition of |\@opargbegintheorem| is completely +% analogous. The only difference is the fact that there exists a +% third argument (which is the optional parameter of the +% environment and contains additional information about the +% theorem). Customarily we enclose it in parentheses. +% \begin{macrocode} +\def\@opargbegintheorem##1##2##3{% + \item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ (##3)]}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \noindent +% We conclude with an |\endgroup| to restore the +% |\catcode| of |@|. +% \begin{macrocode} +\endgroup +%</thp> +% \end{macrocode} +% +% +% \subsubsection{The \texttt{break} style} +% +% This style option is stored in the file |thb.sty|. +% For the next two lines see the documentation for |\th@plain| on +% page~\pageref{dok:th@plain}. +% \begin{macrocode} +%<*thb> +\begingroup \makeatletter +\@ifundefined{theorem@style}{\input{theorem.sty}}{} +\ProvidesFile{thb.sty} + [\FMithmInfo] +% \end{macrocode} +% +% \begin{macro}{\th@break} +% |\theoremstyle{break}| produces a line break after the name +% of the theorem. The font is |\slshape|. Hence, we define +% |\th@break| as follows: +% \begin{macrocode} +\gdef\th@break{\normalfont\slshape + \def\@begintheorem##1##2{\item[% +% \end{macrocode} +% We run into the following problem: it is not possible to create +% the header with |\item[|\meta{title}|]| and then start +% a new line by, for example, |\mbox{}\\|. Such a definition +% will fail whenever a list environment follows immediately. With +% the above construction, the |\mbox{}| causes the switch +% |@inlabel| (cf.\ definition of |\list| and +% |\trivlist| in \cite{latex:source}) to be set to \texttt{false} +% and so the following list will insert additional vertical +% space (|\topskip|). This is quite annoying. Therefore, we +% create the line break within the |\item|. In order to ensure +% that the text will begin at the proper position in the following +% line, we simply pretend that the label does not take any +% room.\footnote{This will lead to problems whenever very high +% symbols occurring in the line tower into the +% heading. So, something else has to be done here sometime.} +% \begin{macrocode} + \rlap{\vbox{\hbox{\hskip \labelsep\theorem@headerfont ##1\ ##2}% + \hbox{\strut}}}]}% +% \end{macrocode} +% Again, the definition of |\@opargbegintheorem| is +% completely analogous. +% \begin{macrocode} +\def\@opargbegintheorem##1##2##3{% + \item[\rlap{\vbox{\hbox{\hskip \labelsep \theorem@headerfont + ##1\ ##2\ (##3)}% + \hbox{\strut}}}]}} +\endgroup +%</thb> +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{The \texttt{changebreak} style} +% +% \begin{macrocode} +% This style option is stored in the file |thcb.sty|. +% \begin{macrocode} +%<*thcb> +\begingroup \makeatletter +\@ifundefined{theorem@style}{\input{theorem.sty}}{} +\ProvidesFile{thcb.sty} + [\FMithmInfo] +% \end{macrocode} +% +% \begin{macro}{\th@changebreak} +% The \texttt{change-break} theorem style is like \texttt{break} +% but with interchange of theorem name and theorem number. Thus we +% define |\th@changebreak| as follows: +% \begin{macrocode} +\gdef\th@changebreak{\normalfont\slshape + \def\@begintheorem##1##2{\item + [\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont ##2\ ##1}% + \hbox{\strut}}}]}% +\def\@opargbegintheorem##1##2##3{% + \item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont + ##2\ ##1\ (##3)}% + \hbox{\strut}}}]}} +\endgroup +%</thcb> +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{The \texttt{change} style} +% +% This style option is stored in the file |thc.sty|. +% \begin{macrocode} +%<*thc> +\begingroup \makeatletter +\@ifundefined{theorem@style}{\input{theorem.sty}}{} +\ProvidesFile{thc.sty} + [\FMithmInfo] +% \end{macrocode} +% +% \begin{macro}{\th@change} +% The \texttt{change} theorem style corresponds to the +% \texttt{change break} style without a linebreak after the header. +% To say it in another way, it's the same as the \texttt{plain} +% style but with number and name interchanged and |\slshape| as the +% default font. +% \begin{macrocode} +\gdef\th@change{\normalfont\slshape + \def\@begintheorem##1##2{\item + [\hskip\labelsep \theorem@headerfont ##2\ ##1]}% +\def\@opargbegintheorem##1##2##3{% + \item[\hskip\labelsep \theorem@headerfont ##2\ ##1\ (##3)]}} +\endgroup +%</thc> +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{The \texttt{marginbreak} style} +% +% This style option is the one used most often at Mainz. It is saved +% in the file |thmb.sty|. +% \begin{macrocode} +%<*thmb> +\begingroup \makeatletter +\@ifundefined{theorem@style}{\input{theorem.sty}}{} +\ProvidesFile{thmb.sty} + [\FMithmInfo] +% \end{macrocode} +% +% \begin{macro}{\th@marginbreak} +% The \texttt{margin break} style is nearly the same as the +% \texttt{change break} style. The only difference is the placement +% of the theorem number. We use |\llap| to place it in the left +% margin. +% +% In this style |\labelsep| denotes the separation between the +% number and the text. +% \begin{macrocode} +\gdef\th@marginbreak{\normalfont\slshape + \def\@begintheorem##1##2{\item + [\rlap{\vbox{\theorem@headerfont + \hbox{\llap{##2}\hskip\labelsep ##1}% + \hbox{\strut}}}]}% +\def\@opargbegintheorem##1##2##3{% + \item[\rlap{\vbox{\theorem@headerfont + \hbox{\llap{##2}\hskip\labelsep ##1\ (##3)}% + \hbox{\strut}}}]}} +\endgroup +%</thmb> +% \end{macrocode} +% \changes{v2.1c}{90/02/17}{`endgroup outside macrocode env.} +% \end{macro} +% +% +% +% \subsubsection{The \texttt{margin} style} +% +% This style option is stored in the file |thm.sty|. +% \begin{macrocode} +%<*thm> +\begingroup \makeatletter +\@ifundefined{theorem@style}{\input{theorem.sty}}{} +\ProvidesFile{thm.sty} + [\FMithmInfo] +% \end{macrocode} +% +% \begin{macro}{\th@margin} +% Again this is only a variant of the theorem styles described +% above without any new ideas. +% \begin{macrocode} +\gdef\th@margin{\normalfont\slshape + \def\@begintheorem##1##2{\item + [\theorem@headerfont \llap{##2}\hskip\labelsep ##1]}% +\def\@opargbegintheorem##1##2##3{% + \item[\theorem@headerfont \llap{##2}\hskip\labelsep ##1\ (##3)]}} +\endgroup +%</thm> +% \end{macrocode} +% \end{macro} +% +% +% +% +% \subsection{Final Definitions} +% +% \begin{macro}{\theorempreskipamount} +% \begin{macro}{\theorempostskipamount} +% The \textsf{skip} parameters that regulate the vertical empty space +% before and after the {\envfont theorem} environment have +% to be allocated as well. +% \changes{v2.0f}{89/07/20}{Unnecessary `global' removed.} +% \begin{macrocode} +%<*package> +\newskip\theorempreskipamount +\newskip\theorempostskipamount +% \end{macrocode} +% Since we have used the same values for all theorem sets, we now can +% assign them. +% \begin{macrocode} +\global\setlength\theorempreskipamount{12pt plus 5pt minus 3pt} +\global\setlength\theorempostskipamount{8pt plus 3pt minus 1.5pt} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\@endtheorem} +% The same holds for the macro |\@endtheorem|, which ends a +% {\envfont theorem} environment. Since it is the same for all +% theorem sets, it is removed from the macros |\th@|\meta{style}. +% It simply ends the {\envfont trivlist} environment, which was +% begun in |\@thm|. +% \begin{macrocode} +\global\let\@endtheorem=\endtrivlist +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@preamblecmds} +% All macros defined above are to be used only in the preamble. +% Therefore, we insert them in |\@preamblecmds| which will disable +% them at begin document. This is done by the internal \LaTeXe{} +% command |\@onlypreamble|. +% \changes{v2.0g}{89/09/19}{`theoremheaderfont and `theorembodyfont +% added.} +% \changes{v2.2a}{94/02/03}{Use \LaTeXe{} interface} +% \begin{macrocode} +\@onlypreamble\@xnthm +\@onlypreamble\@ynthm +\@onlypreamble\@othm +\@onlypreamble\newtheorem +\@onlypreamble\theoremstyle +\@onlypreamble\theorembodyfont +\@onlypreamble\theoremheaderfont +% \end{macrocode} +% \end{macro} +% +% Finally we declare the \texttt{plain} theorem style to be the default. +% \changes{v2.1b}{90/06/04}{Fixed missing `item by declaring default +% style.} +% \begin{macrocode} +\theoremstyle{plain} +%</package> +% \end{macrocode} +% +% \Finale + +\endinput diff --git a/Master/texmf-dist/source/latex-dev/tools/tools.ins b/Master/texmf-dist/source/latex-dev/tools/tools.ins new file mode 100644 index 00000000000..12625e81662 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/tools.ins @@ -0,0 +1,217 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright (C) 1993-2019 +%% The LaTeX3 Project and any individual authors listed elsewhere +%% in this file. +%% +%% This file is part of the Standard LaTeX `Tools Bundle'. +%% ------------------------------------------------------- +%% +%% It may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% As this file contains legal notices, it is NOT PERMITTED to modify +%% this file in any way that the legal information placed into +%% generated files is changed (i.e., the files generated when the +%% original file is executed). This restriction does not apply if +%% (parts of) the content is reused in a different WORK producing its +%% own generated files. +%% +%% The list of all files belonging to the `Tools Bundle' is +%% given in the file `manifest.txt'. +%% +%% +%% --------------- start of docstrip commands ------------------ +%% +\input docstrip + +\def\SimplePackage#1{% + \generate{\file{#1.sty}{\from{#1.dtx}{package}}}} + +\keepsilent + +\usedir{tex/latex/tools} + +\preamble + +This is a generated file. + +The source is maintained by the LaTeX Project team and bug +reports for it can be opened at https://latex-project.org/bugs/ +(but please observe conditions on bug reports sent to that address!) + + +Copyright (C) 1993-2019 +The LaTeX3 Project and any individual authors listed elsewhere +in this file. + +This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. +-------------------------------------------------------------------------- + +It may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This file may only be distributed together with a copy of the LaTeX +`Tools Bundle'. You may however distribute the LaTeX `Tools Bundle' +without such generated files. + +The list of all files belonging to the LaTeX `Tools Bundle' is +given in the file `manifest.txt'. + +\endpreamble + +% Array files +%%%%%%%%%%%%% +\generate{\file{array.sty}{\from{array.dtx}{package,ncols}}} + +\SimplePackage{delarray} + +\batchinput{tabularx.ins} + +\SimplePackage{dcolumn} + +\SimplePackage{hhline} + +\batchinput{longtable.ins} + +% Multicolumn +%%%%%%%%%%%%% +\batchinput{multicol.ins} + +% Bold Math Symbols +%%%%%%%%%%%%%%%%%%% +\batchinput{bm.ins} + +% Footnote Right +%%%%%%%%%%%%%%% +\SimplePackage{ftnright} + +% Theorem files +%%%%%%%%%%%%%%% +\generate{% + \file{theorem.sty}{\from{theorem.dtx}{package}} + \file{thb.sty}{\from{theorem.dtx}{thb}} + \file{thcb.sty}{\from{theorem.dtx}{thcb}} + \file{thc.sty}{\from{theorem.dtx}{thc}} + \file{thp.sty}{\from{theorem.dtx}{thp}} + \file{thmb.sty}{\from{theorem.dtx}{thmb}} + \file{thm.sty}{\from{theorem.dtx}{thm}}} + +% Verbatim +%%%%%%%%%% +\generate{% + \file{verbatim.sty}{\from{verbatim.dtx}{package}} + \file{verbtest.tex}{\from{verbatim.dtx}{testdriver}}} + +% Smart Page references +%%%%%%%%%%%%%%%%%%%%%%% +\batchinput{varioref.ins} + +% External references +%%%%%%%%%%%%%%%%%%%%% +\SimplePackage{xr} + +% Smart Space command +%%%%%%%%%%%%%%%%%%%%% +\SimplePackage{xspace} + +% Show \label \ref keys +%%%%%%%%%%%%%%%%%%%%%%% +\SimplePackage{showkeys} + +% Load fonts under old names +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\SimplePackage{rawfonts} + +% Selective Option handling +%%%%%%%%%%%%%%%%%%%%%%%%%%% +\SimplePackage{somedefs} + + +% Font sample +%%%%%%%%%%%%% +\generate{% + \file{fontsmpl.sty}{\from{fontsmpl.dtx}{package}} + \file{fontsmpl.tex}{\from{fontsmpl.dtx}{document}}} + +% After Page Package +%%%%%%%%%%%%%%%%%%%% +\batchinput{afterpage.ins} + +% Enumerate Package +%%%%%%%%%%%%%%%%%%%% +\SimplePackage{enumerate} + + +% Indent first paragraphs +%%%%%%%%%%%%%%%%%%% +\SimplePackage{indentfirst} + + +% Show the layout of a document class +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\SimplePackage{layout} + + +% Infix Arithmetic +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\SimplePackage{calc} + +% Debugging +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\SimplePackage{trace} + +% Shell Escape +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\SimplePackage{shellesc} + +% File-Error files +%%%%%%%%%%%%%%%%%% +\generate{% + \file{h.tex}{\from{fileerr.dtx}{help}} + \file{s.tex}{\from{fileerr.dtx}{scroll}} + \file{e.tex}{\from{fileerr.dtx}{edit}} + \file{q.tex}{\from{fileerr.dtx}{batch}} + \file{r.tex}{\from{fileerr.dtx}{run}} + \file{x.tex}{\from{fileerr.dtx}{exit}}} + + +\Msg{***********************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* files into a directory searched by TeX:} +\Msg{*} +\Msg{* All the files with extension `.sty' and `.tex'} +\Msg{* Note there also may be a file .tex which is `invisible'} +\Msg{* on some operating systems.} +\Msg{*} +\Msg{* To produce the documentation run the .dtx files through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing} +\Msg{***********************************************************} + + +\Msg{} +\Msg{* Finally trying to make a file `.tex'.} +\Msg{* (Placed at the end of this run, as this} +\Msg{* may fail on some operating systems.)} + +\let\oldopenout\openout +\def\openout{\batchmode\immediate\oldopenout} + +\generate{\file{.tex}{\from{fileerr.dtx}{return}}} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex-dev/tools/trace.dtx b/Master/texmf-dist/source/latex-dev/tools/trace.dtx new file mode 100644 index 00000000000..e808fdd4317 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/trace.dtx @@ -0,0 +1,733 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% +%% (C) Copyright (C) 1999-2019 Frank Mittelbach +%% All rights reserved. +%% +%<*dtx> + \ProvidesFile{trace.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{trace} +%<driver>\ProvidesFile{trace.drv} +% \fi +% \ProvidesFile{trace.dtx} + [2018/10/13 v1.1e trace LaTeX code] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage{doc} +\setcounter{StandardModuleDepth}{1} + +\usepackage{shortvrb} +\MakeShortVerb\| + +\DeclareRobustCommand\eTeX{\ensuremath{\varepsilon}-\kern-.125em\TeX} + +\begin{document} +\DocInput{trace.dtx} +\end{document} +%</driver> +% \fi +% +% +% \GetFileInfo{trace.dtx} +% +% \title{The \textsf{trace} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{Frank Mittelbach} +% \date{\filedate} +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% +% +% \section{Introduction} +% +% When writing new macros one often finds that they do not work as +% expected (at least I do :-). If this happens and one can't +% immediately figure out why there is a problem one has to start doing +% some serious debugging. \TeX{} offers a lot of bells and whistles to +% control what is being traced but often enough I find myself applying +% the crude command |\tracingall| which essentially means ``give me +% whatever tracing information is available''. +% +% In fact I normally use \eTeX{} in such a case, since that \TeX{} +% extension offers me a number of additional tracing possibilities +% which I find extremely helpful. The most important ones are +% |\tracingassigns|, which will show you changes to register values +% and changes to control sequences when they happen, and +% |\tracinggroups|, which will tell you what groups are entered +% or left (very useful if your grouping got out of sync). +% +% So what I really write is +%\begin{verbatim} +% \tracingassigns=1\tracinggroups=1\tracingall +%\end{verbatim} +% That in itself is already a nuisance (since it is a mouthful) but +% there is a worse catch: when using |\tracingall| you do get a awful +% lot of information and some of it is really useless. +% +% For example, if \LaTeX{} has to load a new font it enters some +% internal routines of NFSS which scan font definition tables etc. +% And 99.9\% of the time you are not at all interested in that part of the +% processing but in the two lines before and the five lines +% after. However, you have to scan through a few hundred lines of +% output to find the lines you need. +% +% Another example is the \texttt{calc} package. A simple statement +% like |\setlength| |\linewidth| |{1cm}| inside your macro will result +% in +% +% \renewcommand\MacroFont{\fontencoding\encodingdefault +% \fontfamily\ttdefault +% \fontseries\mddefault +% \fontshape\updefault +% \footnotesize}% +%\begin{verbatim} +% \setlength ->\protect \setlength +% {\relax} +% +% \setlength ->\calc@assign@skip +% +% \calc@assign@skip ->\calc@assign@generic \calc@Askip \calc@Bskip +% +% \calc@assign@generic #1#2#3#4->\let \calc@A #1\let \calc@B #2\expandafter \calc +% @open \expandafter (#4!\global \calc@A \calc@B \endgroup #3\calc@B +% #1<-\calc@Askip +% #2<-\calc@Bskip +% #3<-\linewidth +% #4<-1cm +% {\let} +% {\let} +% {\expandafter} +% {\expandafter} +% +% \calc@open (->\begingroup \aftergroup \calc@initB \begingroup \aftergroup \calc +% @initB \calc@pre@scan +% {\begingroup} +% {\aftergroup} +% {\begingroup} +% {\aftergroup} +% +% \calc@pre@scan #1->\ifx (#1\expandafter \calc@open \else \ifx \widthof #1\expan +% dafter \expandafter \expandafter \calc@textsize \else \calc@numeric \fi \fi #1 +% #1<-1 +% {\ifx} +% {false} +% {\ifx} +% {false} +% +% \calc@numeric ->\afterassignment \calc@post@scan \global \calc@A +% {\afterassignment} +% {\global} +% {\fi} +% {\fi} +% +% \calc@post@scan #1->\ifx #1!\let \calc@next \endgroup \else \ifx #1+\let \calc@ +% next \calc@add \else \ifx #1-\let \calc@next \calc@subtract \else \ifx #1*\let +% \calc@next \calc@multiplyx \else \ifx #1/\let \calc@next \calc@dividex \else \i +% fx #1)\let \calc@next \calc@close \else \calc@error #1\fi \fi \fi \fi \fi \fi \ +% calc@next +% #1<-! +% {\ifx} +% {true} +% {\let} +% {\else} +% {\endgroup} +% {restoring \calc@next=undefined} +% +% \calc@initB ->\calc@B \calc@A +% {\skip44} +% {\global} +% {\endgroup} +% {restoring \skip44=0.0pt} +% +% \calc@initB ->\calc@B \calc@A +% {\skip44} +% {\dimen27} +%\end{verbatim} +% +% \noindent Do you still remember what I was talking about? +% +% No? We're trying to find a problem in macro code without having to scan +% too many uninteresting lines. To make this possible we have to +% redefine a number of key commands to turn tracing off temporarily in +% the hope that this will reduce the amount of noise during the +% trace. For example, if we change one of the \texttt{calc} internals +% slightly, the above tracing output can be reduced to: +% +%\begin{verbatim} +% \setlength ->\protect \setlength +% {\relax} +% +% \setlength ->\calc@assign@skip +% +% \calc@assign@skip ->\calc@assign@generic \calc@Askip \calc@Bskip +% +% \calc@assign@generic #1#2#3#4->\let \calc@A #1\let \calc@B #2\expandafter \calc +% @open \expandafter (#4!\global \calc@A \calc@B \endgroup #3\calc@B +% #1<-\calc@Askip +% #2<-\calc@Bskip +% #3<-\linewidth +% #4<-1cm +% {\let} +% {\let} +% {\expandafter} +% {\expandafter} +% +% \calc@open (->\begingroup \conditionally@traceoff \aftergroup \calc@initB \begi +% ngroup \aftergroup \calc@initB \calc@pre@scan +% {\begingroup} +% +% \conditionally@traceoff ->\tracingrestores \z@ \tracingcommands \z@ \tracingpag +% es \z@ \tracingmacros \z@ \tracingparagraphs \z@ +% {\tracingrestores} +% {\tracingcommands} +% {restoring \tracingrestores=1} +% +% \calc@initB ->\calc@B \calc@A +% {\skip44} +% {\dimen27} +%\end{verbatim} +% +% \noindent\label{conttraceoffexample} +% Still a lot of noise but definitely preferable to the +% original case. +% +% I redefined those internals that I found most annoyingly +% noisy. There are probably many others that could be treated in a +% similar fashion, so if you think you found one worth adding please +% drop me a short note. +% +% \[ * \quad * \quad * \] +% +% \DescribeMacro\traceon +% \DescribeMacro\traceoff +% The package defines the two macros |\traceon| and |\traceoff| to +% unconditionally turn tracing on or off, respectively. |\traceon| is +% like |\tracingall| but additionally adds |\tracingassigns| and +% |\tracinggroups| if the \eTeX{} program (in extended mode) is +% used. And |\traceoff| will turn tracing off again, a command which +% is already badly missing in plain \TeX{}, since it is often not +% desirable to restrict the tracing using extra groups in the +% document. +% +% \DescribeMacro\conditionally@traceon +% \DescribeMacro\conditionally@traceoff +% There are also two internal macros that turn tracing on and off, but +% only if the user requested tracing in the first place. These are the +% ones that are used internally within the code below. +% +% Since the package overwrites some internals of other packages you +% should load it as the last package in your preamble using +% |\usepackage{trace}|. +% +% The package offers the option \texttt{logonly} that suppresses +% terminal output during tracing (unless |\tracingall| is used). This +% is useful if the \TeX{} implementation used gets rather slow when +% writing a lot of information to the terminal. +% +% It also offers the option \texttt{full} in which case |\traceon| +% will trace all parts of the code, i.e., essentially work like +% |\tracingall|. +% +% \section{A sample file} +% +% The following small test file shows the benefits of the +% \texttt{trace} package. If one uncomments the line loading the +% package, the amount of tracing data will be drastically reduced. +% Without the \texttt{trace} package we get 6594 lines in the log +% file; adding the package will reduce this to 1618 lines. +% +%\begin{verbatim} +% \documentclass{article} +% \usepackage{calc} +% %\usepackage{trace} % uncomment to see difference +% +% \begin{document} +% \ifx\traceon\undefined \tracingall \else \traceon \fi +% +% \setlength\linewidth{1cm} +% +% $foo=\bar a$ +% +% \small \texttt{\$} \stop +%\end{verbatim} +% +% \StopEventually{} +% +% \section{Implementation} +% +% \renewcommand\MacroFont{\fontencoding\encodingdefault +% \fontfamily\ttdefault +% \fontseries\mddefault +% \fontshape\updefault +% \small} +% +% This package is for use with \LaTeX{} (though something similar +% could be produced for other formats). +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e}[1998/12/01] +% \end{macrocode} +% +% The package has a option that suppresses tracing on the +% terminal, i.e., if used will not set |\tracingonline| to +% one. This has been added in version 1.1a since some \TeX{} +% implementations get rather slow when outputting to a terminal. +% \begin{macrocode} +\DeclareOption{logonly} + {\let\tracingonline@p\z@} +% \end{macrocode} +% The default is showing the tracing information on the terminal. +% \begin{macrocode} +\let\tracingonline@p\@ne +% \end{macrocode} +% +% If the option |full| is selected then all code should be traced, +% i.e., the commands |\conditionally@traceoff| and +% |\conditionally@traceon| should do nothing. We set them to +% |\@empty| not |\relax| since the latter might produce a math ord +% in certain circumstances. We also have to make sure that +% |\traceon| (as defined further down) is not redefining +% |\conditionally@traceoff| again. To make this all work these +% redefinitions have to wait until the end of the package. +% \changes{v1.1c}{2003/04/30}{Option ``full'' added} +% \begin{macrocode} +\DeclareOption{full} + {\AtEndOfPackage{\let\conditionally@traceoff\@empty + \let\conditionally@traceon\@empty + \let\traceon\tr@ce@n + }} +% \end{macrocode} +% +% \begin{macrocode} +\ProcessOptions\relax +% \end{macrocode} +% +% +% +% \begin{macro}{\if@tracing} +% We need a switch to determine if we want any tracing at +% all. Otherwise, if we use |\traceoff|\ldots|\traceon| +% internally, we would unconditionally turn on tracing even when no +% tracing was asked for in the first place. +% \begin{macrocode} +\newif\if@tracing +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\traceon} +% This macro ensures that |\conditionally@traceoff| is actually +% turning off switches (since |\tracinall| might have disabled it) +% and then calls |\tr@ce@n| to setup tracing. +% \begin{macrocode} +\def\traceon{\let\conditionally@traceoff\unconditionally@traceoff + \tr@ce@n} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\tr@ce@n} +% \changes{v1.1c}{2003/04/30}{Macro added} +% \begin{macro}{\conditionally@traceoff} +% As stated in the introduction, the amount of tracing being done +% should depend on the formatter we use. Initially first test if we are +% running with \eTeX{} in extended mode. In the latter case the command +% |\tracinggroups| is defined. +% But for a number of years now \LaTeX{} only works with \eTeX{} so +% we drop that part of the code. For now I leave it in the file +% together with its documentation, but commented out. +% \begin{macrocode} +%\ifx\tracinggroups\undefined +% \end{macrocode} +% +% If we are using standard \TeX{} then |\tr@ce@n| is more or less +% another name for |\tracingall|. The only differences are that we +% set the above |@tracing| switch to true and reorder the +% assignments within it somewhat so that it will output no tracing +% information about itself. In contrast, |\tracingall| itself produces +% +%\begingroup +% \renewcommand\MacroFont{\fontencoding\encodingdefault +% \fontfamily\ttdefault +% \fontseries\mddefault +% \fontshape\updefault +% \footnotesize}% +%\begin{verbatim} +% {vertical mode: \tracingstats} +% {\tracingpages} +% {\tracinglostchars} +% {\tracingmacros} +% {\tracingparagraphs} +% {\tracingrestores} +% {\errorcontextlines} +% +% \showoutput ->\tracingoutput \@ne \showboxbreadth \maxdimen \showboxdepth \maxd +% imen \errorstopmode \showoverfull +% {\tracingoutput} +% {\showboxbreadth} +% {\showboxdepth} +% {\errorstopmode} +% +% \showoverfull ->\tracingonline \@ne +% {\tracingonline} +%\end{verbatim} +%\endgroup +% +% \noindent Which is quite a lot given that none of it is of any +% help to the task at hand. In contrast |\tr@ce@n| will produce +% nothing whatsoever since the noise generating switches are set at +% the very end. +% \begin{macrocode} +% \def\tr@ce@n{% +% \end{macrocode} +% We start by setting the |@tracing| switch to signal that tracing +% is asked for. This is then followed by setting the various +% tracing primitives of \TeX. +% \begin{macrocode} +% \@tracingtrue +% \tracingstats\tw@ +% \tracingpages\@ne +% \tracinglostchars\@ne +% \tracingparagraphs\@ne +% \errorcontextlines\maxdimen +% \tracingoutput\@ne +% \showboxbreadth\maxdimen +% \showboxdepth\maxdimen +% \errorstopmode +% \tracingmacros\tw@ +% \tracingrestores\@ne +% \tracingcommands\tw@ +% \end{macrocode} +% The setting of |\tracingonline| depends on the option +% \texttt{logonly}: +% \begin{macrocode} +% \tracingonline\tracingonline@p +% } +% \end{macrocode} +% +% Now what should |\conditionally@traceoff| do in this case? Should +% it revert all settings changed by |\tr@ce@n|? It should not, since +% our goal is to shorten the trace output, thus setting all of the +% uninteresting values back makes the output unnecessarily +% longer. Therefore we restrict ourselves to those |\tracing...| +% internals that really contribute to listings like the above. +% +% And one additional point is worth mentioning. The order in which +% we turn the tracing internals off has effects on the output we +% see. So what needs to be turned off first? Either +% |\tracingrestores| or |\tracingcommands|; it makes no difference +% which, as long as they both come first. This is because those two +% are the only tracing switches that produce output while tracing +% the command |\conditionally@traceoff| itself (see example on +% page~\pageref{conttraceoffexample}). +% +% In principle we would need to test the |@tracing| switch to see +% if there is anything to turn off; after all, this is the +% conditional trace off. However this would lead to +% extra output if we are currently tracing so we skip the test and +% instead accept that in case we are not doing any tracing we +% unnecessarily set the tracing primitives back to zero (i.e., the +% value they already have). +% \changes{v1.1c}{2003/04/30}{Turn off \cs{tracingoutput}} +% \begin{macrocode} +% \def\conditionally@traceoff{% +% \tracingrestores\z@ +% \tracingcommands\z@ +% \tracingpages\z@ +% \tracingmacros\z@ +% \tracingparagraphs\z@ +% \tracingoutput\z@ +% \showboxbreadth\m@ne +% \showboxdepth\m@ne +% \end{macrocode} +% +% As remarked above there are more tracing switches set by +% |\tr@ce@n|, however there is no point in resetting +% |\tracinglostchars| so we leave it alone. +% \changes{v1.1c}{2003/04/30}{Reset \cs{tracingstats} to one} +% \begin{macrocode} +% \tracingstats\@ne +%% \tracinglostchars\z@ +% \end{macrocode} +% Since this is the command that only conditionally turns off +% tracing we do not touch the |@tracing| switch. This way a +% |\conditionally@traceon| will be able to turn the tracing on +% again. +% \begin{macrocode} +% } +% \end{macrocode} +% +% That covers the case for the standard \TeX{} program. If +% |\tracingsgroups| was defined we assume that we are running with +% \eTeX{} in extended mode. +% \begin{macrocode} +%\else +% \end{macrocode} +% +% In that case |\tr@ce@n| does more than |\tracingall|: it also +% turns on tracing of assignments and tracing of +% grouping.\footnote{These are my personal preference settings; +% \eTeX{} does in fact offer some more tracing switches and perhaps +% one or or more of them should be added here as well.} +% To keep tracing at a minimum |\tracingassigns| should be turned +% on last (in fact like before we disassemble |\tracingall| +% and reorder it partially). +% \begin{macrocode} + \def\tr@ce@n{% + \@tracingtrue + \tracingstats\tw@ + \tracingpages\@ne + \tracinglostchars\@ne + \tracingparagraphs\@ne + \errorcontextlines\maxdimen +% \end{macrocode} +% We only change |\tracingoutput| if it hasn't already been enabled by +% |\showoutput|. If that's not the case, we set it to 2 so that we +% can distingush the two cases. +% \changes{v1.1e}{2018/10/13}{Only reset \cs{tracingoutput} if not +% set by \cs{showoutput} earlier} +% \begin{macrocode} + \ifnum\tracingoutput=\@ne + \else + \tracingoutput\tw@ + \showboxbreadth\maxdimen + \showboxdepth\maxdimen + \fi +% \end{macrocode} +% +% \begin{macrocode} + \errorstopmode + \tracingmacros\tw@ + \tracinggroups\@ne + \tracingrestores\@ne + \tracingcommands\tw@ + \tracingassigns\@ne + \tracingonline\tracingonline@p + } +% \end{macrocode} +% +% When turning tracing off again we now also have to turn off those +% additional tracing switches. But what to turn off in what order? +% Since |\tracingassigns| is quite noisy (two lines of output per +% assignment) and the whole command expansion consists of +% assignments, we had best start with this switch and follow it again +% by |\tracingrestores| and |\tracingcommands|. The rest can be in +% any order, it doesn't make a difference. +% +% With the same reasoning as before we omit testing for the +% |@tracing| switch and always set the primitives back to zero. +% \changes{v1.1c}{2003/04/30}{Turn off \cs{tracingoutput}} +% \changes{v1.1c}{2003/04/30}{Reset \cs{tracingstats} to one} +% \begin{macrocode} + \def\conditionally@traceoff{% + \tracingassigns\z@ + \tracingrestores\z@ + \tracingcommands\z@ + \tracingpages\z@ + \tracingmacros\z@ +% \end{macrocode} +% If |\tracingoutput| is 2 it was set above, if it is 1 it was set +% by |\showoutput| and we leave it alone and if it is 0 there is +% nothing to do as well. +% \changes{v1.1e}{2018/10/13}{Only reset \cs{tracingoutput} if not +% set by \cs{showoutput} earlier} +% \begin{macrocode} + \ifnum\tracingoutput=\tw@ + \tracingoutput\z@ + \showboxbreadth\m@ne + \showboxdepth\m@ne + \fi +% \end{macrocode} +% +% \begin{macrocode} + \tracingstats\@ne + \tracingparagraphs\z@ + \tracinggroups\z@ + } +% \end{macrocode} +% +% This concludes the part that depends on the formatter being +% used. +% \begin{macrocode} +%\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\unconditionally@traceoff} +% \changes{v1.1c}{2003/04/30}{Macro added} +% A saved version of whatever |\conditionally@traceoff| was defined +% to be. We need this since the latter might get disabled by +% |\tracingall| or by the \texttt{full} option. +% \begin{macrocode} +\let\unconditionally@traceoff\conditionally@traceoff +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tracingall} +% \changes{v1.1c}{2003/04/30}{Macro added} +% We redefine |\tracingall| to trace the same stuff than |\tr@ce@n| (i.e., +% more when \eTeX{} is being used) and ensure that everything gets +% traced by disabling |\conditionally@traceoff|. And, of course, +% |\tracingall| should always report on the terminal. +% \begin{macrocode} +\def\tracingall{\let\conditionally@traceoff\@empty + \let\tracingonline@p\@ne + \tr@ce@n +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\traceoff} +% \begin{macro}{\conditionally@traceon} +% Above we have defined |\conditionally@traceoff| and |\traceon| so +% now we have to define their counterparts. +% +% To stop tracing unconditionally we call +% |\unconditionally@traceoff| and then reset the |@tracing| switch +% to false. +% \begin{macrocode} +\def\traceoff{\unconditionally@traceoff \@tracingfalse} +% \end{macrocode} +% +% Now the |\conditionally@traceon| command will look at the +% |@tracing| switch and if it is true it will call |\traceon| to +% restart tracing (note that the latter command unnecessarily sets +% the switch to true as well). The reason for the |\expandafter| is +% to get rid of the |\fi| primitive which would otherwise show up in +% the tracing output (and perhaps puzzle somebody). +% \begin{macrocode} +\def\conditionally@traceon{\if@tracing \expandafter \traceon \fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% The rest of the package now consists of redefinitions of certain +% commands to make use of |\conditionally@traceoff|. +% +% \subsection{Taming \texttt{calc}} +% +% \begin{macro}{\calc@open} +% Near the start of parsing a calc expression the macro |\calc@open| +% is called. Since it already involves a group it is perfectly +% suitable for our task---we don't even have to restart the tracing as +% this is done automatically for us. +% \begin{macrocode} +\def\calc@open({\begingroup + \conditionally@traceoff + \aftergroup\calc@initB + \begingroup\aftergroup\calc@initB + \calc@pre@scan} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Making NFSS less noisy} +% +% \begin{macro}{\define@newfont} +% Whenever NFSS determines that the font currently asked for is not +% already loaded, it will start looking through font definition +% files and then load the font. This results in a very large number +% of tracing lines which are not normally of interest (unless there +% is a bug in that area---something we hope should have been found +% by now). Again the code already contains its own group so we only +% have to turn the tracing off. +% \begin{macrocode} +\def\define@newfont{% + \begingroup + \conditionally@traceoff + \let\typeout\@font@info + \escapechar\m@ne + \expandafter\expandafter\expandafter + \split@name\expandafter\string\font@name\@nil + \try@load@fontshape % try always + \expandafter\ifx + \csname\curr@fontshape\endcsname \relax + \wrong@fontshape\else + \extract@font\fi + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\frozen@everymath} +% \begin{macro}{\frozen@everydisplay} +% At the beginning of every math formula NFSS will check whether or +% not the math fonts are properly set up and if not will load +% whatever is needed. So we surround that part of the code +% with |\conditionally@traceoff| and |\conditionally@traceon| +% thereby avoiding all this uninteresting output. +% \begin{macrocode} +\frozen@everymath = + {\conditionally@traceoff \check@mathfonts \conditionally@traceon + \the\everymath} +\frozen@everydisplay = + {\conditionally@traceoff \check@mathfonts \conditionally@traceon + \the\everydisplay} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% \section{Checking for italic corrections} +% +% \begin{macro}{\maybe@ic@} +% When executing |\textit| or its friends, \LaTeX{} looks ahead to +% determine whether or not to add an italic correction at the +% end. This involves looping through the |\nocorrlist| which +% outputs a lot of tracing lines we are normally not interested +% in. So we disable tracing for this part of the processing. +% \changes{v1.1d}{2014/04/21}{Use \cs{ifmaybe@ic} not +% \cs{if@tempswa} as the kernel does (pr/4200)} +% \begin{macrocode} +\def \maybe@ic@ {% + \ifdim \fontdimen\@ne\font>\z@ + \else + \conditionally@traceoff + \maybe@ictrue + \expandafter\@tfor\expandafter\reserved@a\expandafter:\expandafter=% + \nocorrlist + \do \t@st@ic + \ifmaybe@ic \sw@slant \fi + \conditionally@traceon + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% +% \Finale +% +% \endinput diff --git a/Master/texmf-dist/source/latex-dev/tools/varioref.dtx b/Master/texmf-dist/source/latex-dev/tools/varioref.dtx new file mode 100644 index 00000000000..049bd0d55ea --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/varioref.dtx @@ -0,0 +1,2447 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% Package varioref to use with LaTeX2e +%% Copyright (C) 1992-2019 Frank Mittelbach, all rights reserved. +%% +%% For additions or updates to the language options please contact +%% the author at +%% +%% frank.mittelbach@latex-project.org +%% +%% or open an issue at https://github.com/latex3/latex2e. +%% +% +%<package>\NeedsTeXFormat{LaTeX2e}[1995/05/16] +%<package>\providecommand\DeclareRelease[3]{} +%<package>\providecommand\DeclareCurrentRelease[2]{} +%<package> +%<package>\DeclareRelease{}{2016-02-16}{varioref-2016-02-16.sty} +%<package>\DeclareCurrentRelease{}{2019-10-01} +%<package> +%<package>\ProvidesPackage{varioref} +%<package> [2019/09/08 v1.6b package for extended references (FMi)] +% \fi +% +%% +% +% +% \changes{v1.0a}{1993/12/06}{Upgrade to LaTeX2e} +% \changes{v1.0g}{1994/05/27}{Use \cmd\DeclareRobustCommand} +% \changes{v1.5c}{2016/02/09}{Revamped some of the documentation to better +% explain how varioref could be used in a multi-lingual context} +% \changes{v1.6a}{2019/08/25}{\cs{labelformat} and \cs{Ref} now available in the kernel +% so removed from this package but only in new kernel} +% +% +% \newcommand\NewIn[1]{\marginpar{\fbox{\fbox{\sffamily\tabular{l}New +% in\\#1\endtabular}}}} +% \newcommand\ChangedIn[1]{\marginpar{\fbox{\fbox{\sffamily\tabular{l}Changed +% in\\#1\endtabular}}}} +% +% \providecommand\pkg[1]{\texttt{#1}} +% \providecommand\option[1]{\texttt{#1}} +% \providecommand\meta[1]{$\langle§\textit{#1}$\rangle$} +% +% +% \makeatletter +% \def\allowtofu{^^A +%\def\UTFviii@undefined@err##1{^^A +% \PackageWarning{inputenc}{Unicode character \expandafter +% \UTFviii@splitcsname\string##1\relax +% \MessageBreak +% not set up for use with LaTeX}^^A +% \raisebox{.8pt}{\fboxsep1pt\kern.1pt\fbox{$\cdot$}\kern.1pt}^^A +% }} +% \makeatother +% +% \title{The \pkg{varioref} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{Frank Mittelbach} +% \date{\filedate} +% +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% +% \begin{abstract} +% This package defines the commands |\vref|, |\vpageref|, +% |\vrefrange|, and |\vpagerefrange| for +% \LaTeXe. |\vref| is similar to |\ref| but adds an additional +% page reference, like `on the facing page' or `on page 27' whenever +% the corresponding |\label| is not on the same page. The command +% |\vpageref| is a variation to |\pageref| with a similar +% functionality. The |\v...range| commands take two labels as arguments +% and produce strings which depend on whether or not these labels +% fall onto a single page or on different pages. +% Generated strings are customizable so that these +% commands are usable with various languages. +% \end{abstract} +% +% +% \columnsep=2\columnsep +% \begin{multicols}{2} +% \tableofcontents +% \end{multicols} +% +% \section{Introduction} +% +% In many cases it is helpful when referring to a figure or table to +% put both a |\ref| and a |\pageref| command into the document +% especially when there are one or more pages between the reference +% and the object. Therefore some people use a command like +% \begin{verbatim} +% \newcommand{\fullref}[1]{\ref{#1} on page~\pageref{#1}} +%\end{verbatim} +% which reduces the number of key strokes, necessary to make such a +% complete reference. But since one never knows where the referenced +% object finally falls, using such a device may result in a page +% reference to the current page which is disturbing and therefore +% should be avoided. +% +% +% +% \section{Loading the package} +% +% +% The suggested way of loading the package these days is by +% \emph{always} using +% the package option \option{nospace}, +% \NewIn{2019} +% i.e., +% \begin{verbatim} +% \usepackage[nospace]{varioref} +%\end{verbatim} +% See below for an explanation of why this is needed. There are some +% other options that you may want to use additionally; they are +% explained \vpageref{options}. +% +% +% +% \section{The user interface} +% +%\DescribeMacro\vref The implementation of |\vref| below produces only +% a |\ref| when reference and |\label| are on the same page. It will +% additionally produce one of the strings `on the facing page', `on +% the preceding page', or `on the following page', if label and +% reference differ by one and it will produce both |\ref| and +% |\pageref| when the difference is larger. The word `facing' is used +% when label and reference both fall onto a double spread. However, +% if a special page numbering scheme is used instead of the usual +% arabic numbering (e.g., |\pagenumbering{roman}|) then there will be +% no distinction between one or many pages off. +% +%\DescribeMacro\vpageref Sometimes one wants to refer only to page +% number and again such a reference should normally be suppressed if +% we are referring to the current page. For this purpose the package +% defines the |\vpageref| command. It will produce the same strings as +% |\vref| except that it doesn't start with the |\ref|. A further +% difference is that +% it will produce the string that is saved in |\reftextcurrent| if +% label and reference fall onto the same page (and no optional +% argument is used). By defining +% |\reftextcurrent| to produce ``on this page'' or something similar, +% we can avoid that +% \begin{verbatim} +% ... see the example \vpageref{ex:foo} which shows ... +%\end{verbatim} +% comes out as ``\ldots~see the example which shows~\ldots'', which +% could be misleading. +% +% A space in front of |\vpageref| it will be ignored if +% the command doesn't produce any text at all. +% +% But in fact |\vpageref| allows even more control. If has two +% optional arguments. With the first one, one can specify the text +% that should be used if label and reference fall on the same page. +% This is very helpful if both are near to each other, so that they +% may or may not be separated by a page break. In such a case we +% usually know (!) whether the reference is before or after the label +% so that we can say something like +% \begin{verbatim} +% ... see the example \vpageref[above]{ex:foo} which shows ... +%\end{verbatim} +% which will then come out as ``\ldots~see the example above which +% shows~\ldots'' if we are still on the same page, but as ``\ldots~see +% the example on the page before which shows~\ldots'' (or something +% similar depending on the settings of the |\reftext..before| +% commands) when there was a page break in the meantime. One warning +% however, if you use |\vpageref| with the optional argument to refer +% to a figure or table, keep in mind that depending on the float +% placement parameters the float may show up on top of the current +% page and therefore before the reference even if it came after it in +% the source file. +% +% But maybe you prefer to say ``\ldots~see the above example'' if +% example and reference fall onto the same page, i.e., reverse the +% word order. In fact, in some languages the word order automatically +% changes in that case. To allow for this variation the second +% optional argument can be used. It specifies the text preceding the +% generated reference if object and reference do not fall onto the +% same page. Thus one would write +% \begin{verbatim} +% ... see the \vpageref[above example][example]{ex:foo} +% which shows ... +%\end{verbatim} +% to achieve the desired effect. +% +% +% \DescribeMacro\vrefrange +% This command is similar to |\vref| but it +% takes two mandatory arguments denoting a range to refer to (e.g., a +% sequences of figures or a sequence of equations, etc.). So if +% |fig:a| is your first figure in the sequence and |fig:c| your last +% you can write +%\begin{verbatim} +% ... see figures \vrefrange{fig:a}{fig:c} ... +%\end{verbatim} +% which would then be formatted as +% \begin{quote} +% \ldots\ see figures 3.4 to 3.6 on pages 23--24 \ldots +% \end{quote} +% or, if they happen to all fall onto the next page, as +% \begin{quote} +% \ldots\ see figures 3.4 to 3.6 on the following page \ldots +% \end{quote} +% i.e., the command is deciding what to say depending on where the two +% labels are placed in relation to each other; it is essentially +% implemented using |\vpagerefrange| described below. +% The optional argument the command may take is the text to use in case +% both labels are placed on the current page. +% +% +% \DescribeMacro\vpagerefrange This command is similar to |\vpageref| +% but takes two mandatory arguments which are two labels denoting a +% range. If both labels fall onto the same page, the command acts +% exactly like |\vpageref| (with a single label), otherwise it produces +% something like ``on pages~15--18'' (see customization possibilities +% below). The optional argument it may take is the text to use in case +% both labels are placed on the current page. + +% \DescribeMacro\vrefpagenum This macro is provided to allow the user +% to write their own small commands which implement functions similar +% to those provided by the two previous commands. It takes two +% arguments: the second is a label (i.e., as used in |\label| or +% |\ref|) and the first is an arbitrary command name (make sure you +% use our own) that receives the page number related to this label. +% So if you have two (or more) labels you could retrieve their page +% numbers, compare them and then decide what to print. For example, +% the following not very serious definition (also using the +% \pkg{ifthen} package) +%\begin{verbatim} +% \newcommand\amusingversion[2]{the definition% +% \vrefpagenum\firstnum{#1}% +% \vrefpagenum\secondnum{#2}% +% \ifthenelse{\equal\firstnum\secondnum}% +% {s of \ref{#1} and \ref{#2} \vpageref{#1}}% +% { of \ref{#1} \vpageref{#1} and of \ref{#2} \vpageref{#2}}% +% } +% +% ...\amusingversion{foo}{bar} +%\end{verbatim} +% will print something like +% \begin{quote} +% \ldots the definitions of 3 and 4 on the previous page +% \end{quote} +% in the case both labels are on the same page but something like +% \begin{quote} +% \ldots the definition of 3 on the next page and of 4 on page~13 +% \end{quote} +% in case they are on different pages. +% +% \DescribeMacro\vpagerefcompare +% \NewIn{2019} +% For this kind of application the package also provides +% |\vpagerefcompare| as a command that takes four argument: two labels for +% comparison and a \meta{true} and \meta{false} argument. One of them +% is executed depending on whether the two labels are on the same page +% or on different pages. With its help the above definition could be +% shortened to +%\begin{verbatim} +% \newcommand\amusingversion[2]{the definition% +% \vpagerefcompare{#1}{#2}% +% {s of \ref{#1} and \ref{#2} \vpageref{#1}}% +% { of \ref{#1} \vpageref{#1} and of \ref{#2} \vpageref{#2}}% +% } +%\end{verbatim} +% and you don't have to load the \pkg{ifthen} package any longer to +% make it work. +% +% \DescribeMacro\vpagerefnearby +% \NewIn{2019} +% Another command for conditional processing is |\vpagerefnearby|. It +% takes three arguments: a label and a \meta{true} and \meta{false} +% argument. It compares the page reference to the label with the +% current page number and if both are arabic number and only differ by +% $\pm1$ the \meta{true} argument is executed otherwise the +% \meta{false} argument. In other words it tells you if a |\vpageref| +% to the label would result in a textual reference to the previous, +% current or next page.\footnote{There is also a +% \cs{vpagerefcomparenearby} but this is only meant for package +% writers, so it is only documented in the implementation section.} + +% +% +% If you don't use the \texttt{nospace} option the user commands +% |\vref|, |\vpageref|, and |\vpagerefrange| all work by first +% removing any space on their left and then inserting some space of +% their own (|\vref|, for example, a nonbreakable space). That seemed +% like a good idea back then, but it has the disadvantage that you +% can't use these macros in situations where you definitely do not +% want any space before the generated text. E.g., in situations like +% |(\vref{foo} ...)| you end up with a space after the open +% parenthesis. +% +% \DescribeMacro{\vref*} +% \DescribeMacro{\vpageref*} +% \DescribeMacro{\vpagerefrange*} +% Since it was too late to change the default in 2001 I added star +% versions of the macros which do not add any space before the +% generated text (they do nevertheless remove space at the left). +% +% However, that too has problems (one is that \pkg{hyperref} +% \ChangedIn{2019} +% introduced the star forms as a means to generating references +% without hyperlinks (which is clearly the more important +% application). +% So these days I recommend to always call the package with the option +% \option{nospace} which prevents \pkg{varioref} from messing with the +% space in front. Of course you are then responsible to always add it +% when necessary, but that does make the source more readable so it is +% a good thing. This also has the advantage that the star forms are +% now unnecessary again and can be used in the way implemeented by +% \pkg{hyperref} if both packages are used together. +% +% In fact it would be much nicer to make that the +% default but the package has been used by many people for so many +% years that changing the default would break way to many older documents. +% +% +% \DescribeMacro\labelformat +% A reference via |\ref| produces by default the data associated with +% the corresponding |\label| command (typically a number); any +% additional formatting has to be provided by the user. With +% |\labelformat| it is possible to declare scuch formatting for each +% ``reference'' counter, e.g., +%\begin{verbatim} +% \labelformat{section}{section~#1} +% \labelformat{equation}{equation~(#1)}} +%\end{verbatim} +% +% +% \DescribeMacro\Vref +% \DescribeMacro\Ref +% A side effect of using |\labelformat| is that, depending on the +% defined formatting, it becomes impossible to use |\ref| at the +% beginning of a sentence (if its replacement text starts with a +% lowercase letter). +% \ChangedIn{2019} +% For that reason \pkg{varioref} provided the commands |\Ref| and +% |\Vref|. They behave like |\ref| and |\vref| except that they +% uppercase the first token of the generated string. These days +% |\labelformat| and |\Ref| are already provided by the \LaTeX{} +% kernel; only |\Vref| is still defined within the \pkg{varioref} +% package. +% +% To make |\Ref| or |\Vref| work properly the very first token in the +% second argument of |\labelformat| has to be a simple \textsc{ascii} +% or UTF-8 letter, otherwise the capitalization will fail or worse, +% you will end up with some error messages. If you actually need +% something more complicated in this place (e.g., an accented letter +% not written as a UTF-8 character) you have to explicitly surround it +% with braces, to identify the part that needs to be capitalized. For +% example, for figure references in the Hungarian language you might +% want to write |\labelformat{figure}{{\'a}bra~\thefigure}| or use +% |\labelformat{figure}{ábra~\thefigure}| which avoids the brace +% problem. +% +% \DescribeMacro\thevpagerefnum +% If you like to have |\vref| suppress the page number on pages where +% label and reference fall onto the same page, but prefer reference to +% page numbers otherwise then |\thevpagerefnum| can be used. This macro +% hold the current page ``number'' when |\vpageref| and friends are +% executed. Thus, by defining, for example +%\begin{verbatim} +%\renewcommand\reftextfaceafter {on page~\thevpagerefnum} +%\renewcommand\reftextfacebefore{on page~\thevpagerefnum} +%\renewcommand\reftextafter {on page~\thevpagerefnum} +%\renewcommand\reftextbefore {on page~\thevpagerefnum} +%\end{verbatim} +% textual references can be suppressed. +% +% \section{Multi-lingual usage} +% +% The package works well together with the babel system if it is +% loaded \textit{after} the babel package, e.g., a document in English +% (default), French and German text could load the packages as +% follows: +%\begin{verbatim} +% \usepackage[ngerman,french,english]{babel,varioref} +%\end{verbatim} +% (or in two separate lines if you prefer one |\usepackage| line per +% package). Depending on the current babel language |\vref| and +% friends would then generate strings in different languages. If the +% language options are given as global options to the document class +% then it is enough to use +%\begin{verbatim} +% \usepackage{babel,varioref} +%\end{verbatim} +% to achieve the same effect. +% +% If more than one language is specified with \pkg{varioref} then +% it will start using the last language selected. Switching of +% languages is managed through Babel; nevertheless all languages of +% interest need to be specified when \pkg{varioref} is loaded so +% that it can integrate their strings into the Babel system. +% +% +% \section{Customization} +% +% The package supports all options defined by the babel package to +% translate the fixed strings into other languages than English. +% (Some languages need updating, however---help is appreciated.) It +% also supports languages currently not in babel (those can only be +% used standalone, obviously); check the section on options later~on. +% +% +% \pagebreak[3] +% +% You can also modify some or all of the strings by redefining the +% following commands after the package has been loaded. +%\DescribeMacro\reftextbefore +%\DescribeMacro\reftextfacebefore +%\DescribeMacro\reftextafter +%\DescribeMacro\reftextfaceafter Backward references use +% |\reftextbefore| if the label is on the preceding page but invisible +% and |\reftextfacebefore| if it is one the facing page (i.e., if the +% current page number is odd). Similarly |\reftextafter| is used +% when the label comes on the next page but one has to turn the page +% and |\reftextfaceafter| if it is on the following but facing page. +% +% In fact, |\reftextface...| is used only if the user or the document +% class specified two-sided printing. +% +%\DescribeMacro\reftextfaraway Finally we have |\reftextfaraway| which +% is used whenever label and reference differ by more than one or when +% they aren't numeric. This macro is a bit different because it takes +% one argument, the symbolic reference string so that one cane make +% use of |\pageref| in its replacement text. +% +% +%\DescribeMacro\reftextvario To allow a bit random variation in the +% generated strings one can use the command |\reftextvario| inside the +% string macros. It takes two arguments and selects one or the other +% for printing depending on the number of already seens |\vref| or +% |\vpageref| commands. As an example see the definitions of +% |\reftextbefore| etc.\ \vpageref[below]{reftextbefore}. +% +% The commands |\vrefrange| and |\vpagerefrange| produce their text +% \NewIn{1998} +% using two macros described below. By redefining them one can modify +% the results to accommodate special requirements. +% +% +% They both take two mandatory arguments denoting the first and the +% last label of the range. +% +% +% \DescribeMacro\reftextpagerange This macro produces text that +% describes the page range of the two labels, e.g., the default +% for English is ``|on pages~\pageref{#1}--\pageref{#2}}|''. +% +% +% \DescribeMacro\reftextlabelrange This macro produces text that +% describes the range of figures, tables, or whatever the labels refer +% to, the default for English is ``|\ref{#1} to~\ref{#2}|''. +% +% \subsection{\ldots\ if Babel is used} +% +% \begin{itshape} If babel is being used then the above commands need to be +% changed using the Babel mechanism, e.g., +%\begin{verbatim} +% \addto\extrasngerman{% +% \renewcommand\reftextfaceafter {auf der n\"achsten Seite}% +% ... } +%\end{verbatim} +% Otherwise babel will reintroduce its own defaults whenever the language is +% changed (which happens in particular during |\begin{document}| where the +% main language is selected). +% \end{itshape} +% +% +% +% +% \section{Options} \label{options} +% +% As mentioned above the package supports all standard options offered +% by the Babel system to customize the strings produced, it may also +% have a few not supported by babel, for a full list look +% in section\vref{sec:impoptions}. In addition it offers the option +% \texttt{draft} to turn error messages into warnings during +% development. The default \texttt{final} produces error message when +% a generated string falls onto a page boundary (see next section). +% +% Newly introduced in 2019 are the options \option{space} (default) +% and \option{nospace}. While the former is the default to allow +% \NewIn{2019} +% documents written in the last twenty years to continue to work +% correctly, I nowadays, suggest that you always use the package with +% the option \option{nospace}. This will stop \pkg{varioref} from +% meddling with the spaces preceding commands and thus make the star +% forms |\vref*| and |\vpageref*| unnecessary. +% +% This means that the star forms can then be used as defined by +% \pkg{hyperref} for suppressing a hyperlink when both packages are +% used together (which is a rather typical scenario these days). +% +% +% \section{A few warnings} +% +% Defining commands like the ones described above poses some +% interesting problems. Suppose, for example, that a generated text +% like `on the next page' gets broken across pages. If this happens it +% is very difficult to find an acceptable solution and in fact can +% even result in a document that will always change from one state to +% another (i.e., inserting one string, finding that this is wrong, +% inserting another string on the next run which makes the first +% string correct again, inserting \ldots). The current implementation +% of \pkg{varioref} therefore issues an error message whenever the +% generated text is broken across page boundaries, e.g., +% \begin{quote} +% table 5 on the current \meta{page break} page +% \end{quote} +% would would result in an error, which needs to be resolved by the +% user by replacing the |\vref| command with an ordinary |\ref| just +% before the final run. This is not +% completely satisfactory but in such case no solution really is. +% \DescribeMacro\vrefwarning +% During document preparation, while one is still changing the text, +% such error messages can be turned into warnings by placing a +% |\vrefwarning| command in the preamble. This is equivalent to +% specifying ``draft'' as an option to the package. +% \DescribeMacro\vrefshowerrors +% |\vrefshowerrors| ensures that varioref stops when detecting a +% possible loop. This is the default and equivalent to specifying +% ``final'' as an option. +% +% At the end final a warning: every use of |\vref| will internally +% generate two macro names to keep track of the string positions +% within the document. As a result you may run out of name space or +% main memory\footnote{Not really that likely these days, but one +% never knows \ldots. In any case \TeX{} will process your document a +% tiny bit faster.} if you make heavy use of this macro on a small +% \TeX{} installation. +%\DescribeMacro\fullref For this reason the primitive command +% |\fullref| is also provided. This command can be used whenever you +% know for sure that label and reference can't fall onto nearby pages. +% +% \StopEventually{\PrintIndex\PrintChanges} +% +% +% \section{The documentation driver file} +% +% The next bit of code contains the documentation driver file for +% \TeX{}, i.e., the file that will produce the documentation you are +% currently reading. It will be extracted from this file by the +% \pkg{docstrip} program. +% \begin{macrocode} +%<*driver> +\documentclass{ltxdoc} +\usepackage{multicol,varioref} +\GetFileInfo{varioref.sty} +\setlength\hfuzz{1pt} % ignore slight overfulls +\EnableCrossrefs +%\DisableCrossrefs % Say \DisableCrossrefs if index is ready + +\RecordChanges % Gather update information +%\OnlyDescription % comment out for implementation details +\begin{document} + \DocInput{varioref.dtx} +\end{document} +%</driver> +% \end{macrocode} +% +% +% \section{The implementation} +% +% The main implementation idea is to generate an internal label +% command for every |\vpageref| and compare the page reference of this +% label with the page reference of the user-requested label. Since +% this means one additional macro name for each use of |\vpageref| or +% |vref| (which is implemented in terms of |\vpageref|) the memory +% requirements of this package may be high in terms of main and macro +% name memory. Since the information held in the internal labels is +% used only once one could envision a different scheme if suitable +% primitives for this kind of ``one place information'' would be +% provided by \LaTeX. This type of data structure is planned for +% \LaTeX3 but for the moment we have to live with the memory +% restrictions. +% +% We start by checking if this file was already loaded. If not we +% identify the current version. This is actually done at the top +% of the file, so we comment it out here +% \changes{v0.1h}{1993/08/15}{Small documentation changes} +% \begin{macrocode} +%<*package> +%\NeedsTeXFormat{LaTeX2e}[1994/06/01] +%\ProvidesPackage{varioref}[\filedate\space\fileversion\space +% LaTeX2e package for extended references (FMi)] +% \end{macrocode} +% +% +% \begin{macro}{\vref@addto} +% \changes{v1.0b}{1994/01/31}{Avoid using babel `addto} +% \changes{v1.0b}{1994/01/31}{The babel commands are starting +% with extras} +% To support the use of babel we want to add the additional strings +% to the |\extras|\meta{language} commands. Since |\addto| in the +% current implementation of babel has a bug that does not allow to +% use arguments containing hashmarks we do this by hand. +% \begin{macrocode} +\def\vref@addto#1#2{% + #2% + \@temptokena{#2}% + \ifx#1\undefined + \edef#1{\the\@temptokena}% + \else + \toks@\expandafter{#1}% + \edef#1{\the\toks@\the\@temptokena}% + \fi + \@temptokena{}\toks@\@temptokena +} +\@onlypreamble\vref@addto +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Options}\label{sec:impoptions} +% +% \begin{macro}{\vref@excuse} +% Excuse that we don't know the strings for a certain language. +% \changes{v1.0q}{1995/04/06}{Use `PackageWarning} +% \begin{macrocode} +\def\vref@excuse#1{% + \PackageWarningNoLine{varioref}{Sorry, language `#1' + not supported% + \MessageBreak + in this version. + English strings used by default. + \MessageBreak + Please modify \protect\reftext... commands manually.% + \MessageBreak\MessageBreak + If you can suggest translations for + this language,% + \MessageBreak + please mail them + to the author of this package}} +\@onlypreamble\vref@excuse +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vref@stringwarning} +% And we sometimes just don't know some strings~\ldots +% \changes{v1.2a}{1998/08/01}{Macro added} +% \begin{macrocode} +\def\vref@stringwarning#1{% + \PackageWarningNoLine{varioref}{Sorry, there is no proper + translation for the string\MessageBreak + produced by \protect#1\on@line.\MessageBreak + English string used instead.\MessageBreak + \MessageBreak + If you can suggest translations for + the current\MessageBreak + language, please mail them + to the author of this\MessageBreak package}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\reftextfaceafter} +% \begin{macro}{\reftextfacebefore} +% \begin{macro}{\reftextafter} +% \begin{macro}{\reftextbefore} +% \begin{macro}{\reftextcurrent} +% \label{reftextbefore} The options do set the macros that +% generate the textual strings. Note, that they do not start with a +% space, the space is already added in the main macro below. +% \changes{v1.2a}{1998/08/22}{Added american defaults for +% \cs{reftextpagerange} and \cs{reftextlabelrange}} +% \changes{v1.4d}{2002/11/11}{Changed default for \cs{reftextbefore}} +% +% Afrikaans option contributed by Danie Els +% (\texttt{dnjels@sun.ac.za}). +% \changes{v1.4g}{2003/03/29}{Added afrikaans option} +% \begin{macrocode} +\DeclareOption{afrikaans} + {\vref@addto\extrasafrikaans{% + \def\reftextfaceafter {op die \reftextvario{regterbladsy}% + {bladsy langsaan}}% + \def\reftextfacebefore{op die \reftextvario{linkerbladsy}% + {bladsy langsaan}}% + \def\reftextafter {op die \reftextvario{volgende bladsy}% + {bladsy hierna}}% + \def\reftextbefore {op die \reftextvario{vorige bladsy}% + {bladsy hiervoor}}% + \def\reftextcurrent {op \reftextvario{hierdie}% + {die huidige} bladsy}% + \def\reftextfaraway#1{op bladsy~\pageref{#1}}% + \def\reftextpagerange#1#2{op bladsye~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} tot~\ref{#2}}% + }} +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{american} + {\vref@addto\extrasamerican{% + \def\reftextfaceafter {on the \reftextvario{facing}{next} page}% + \def\reftextfacebefore{on the \reftextvario{facing}{preceding} + page}% + \def\reftextafter {on the \reftextvario{following}{next} page}% + \def\reftextbefore {on the \reftextvario{preceding}{previous} page}% + \def\reftextcurrent {on \reftextvario{this}{the current} page}% + \def\reftextfaraway#1{on page~\pageref{#1}}% + \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}% + }} +% \end{macrocode} +% Arabic option text was contributed by Ihab Samir Mattar +% (\texttt{dr\_kremlin@hotmail.com}). As our standard documentation +% workflow uses pdf\TeX{} the Arabic letters can't be displayed +% easily, so you will see missing glyphs below. To see the real +% letters you have to look at the source or package file. +% \changes{v1.6b}{2019/09/8}{Option arabic added} +% \begin{allowtofu} +% \begin{macrocode} +\DeclareOption{arabic} + {\vref@addto\extrasarabic{% + \def\reftextfaceafter {بالصفحة \reftextvario{المقابلة}{اللاحقة}}% + \def\reftextfacebefore{بالصفحة \reftextvario{المقابلة}{المُنْصَرِمَةٌ}}% + \def\reftextafter {بالصفحة \reftextvario{اللاحقة}{التالية}}% + \def\reftextbefore {بالصفحة \reftextvario{السابقة}{المُنْصَرِمَةٌ}}% + \def\reftextcurrent {ب\reftextvario{الصفحة الحالية}{هذه الصفحة}}% + \def\reftextfaraway#1{بالصفحة رقم~\pageref{#1}}% + \def\reftextpagerange#1#2{بالصفحات~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} حتى~\ref{#2}}% + }} +% \end{macrocode} +% \end{allowtofu} +% \changes{v1.2a}{1998/11/27}{Added austrian defaults (identical to german)} +% The austrian defaults are the same as the german ones. +% \begin{macrocode} +\DeclareOption{austrian} + {\vref@addto\extrasaustrian{% + \def\reftextfaceafter {auf der n\"achsten Seite}% + \def\reftextfacebefore{auf der vorherigen Seite}% + \let\reftextafter \reftextfaceafter + \let\reftextbefore \reftextfacebefore + \def\reftextcurrent {auf dieser Seite}% + \def\reftextfaraway#1{auf Seite~\pageref{#1}}% + \def\reftextpagerange#1#2{auf Seiten~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}% + }} +% \end{macrocode} +% \changes{v1.2d}{2000/01/11}{Added naustrian defaults (identical to german)} +% The naustrian defaults are the same but needed for ``Neue Rechtschreibung''. +% \begin{macrocode} +\DeclareOption{naustrian} + {\vref@addto\extrasnaustrian{% + \def\reftextfaceafter {auf der n\"achsten Seite}% + \def\reftextfacebefore{auf der vorherigen Seite}% + \let\reftextafter \reftextfaceafter + \let\reftextbefore \reftextfacebefore + \def\reftextcurrent {auf dieser Seite}% + \def\reftextfaraway#1{auf Seite~\pageref{#1}}% + \def\reftextpagerange#1#2{auf Seiten~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}% + }} +% \end{macrocode} +% Text for basque defaults was contributed by +% I\~naki Larra\~naga Murgoitio (aka dooteo) +% (|<dooteo@euskalgnu.org>|). +% \changes{v1.4k}{2005/04/09}{Basque defaults added.} +% \begin{macrocode} +\DeclareOption{basque} + {\vref@addto\extrasbasque{% + \def\reftextfaceafter {hurrengo orrialdean}% + \def\reftextfacebefore{aurreko orrialdean}% + \let\reftextafter \reftextfaceafter + \let\reftextbefore \reftextfacebefore + \def\reftextcurrent {uneko orrialdean}% + \def\reftextfaraway#1{~\pageref{#1}. orrialdean}% + \def\reftextpagerange#1#2{~\pageref{#1}--\pageref{#2} orrialdeetan}% + \def\reftextlabelrange#1#2{\ref{#1}.etik \ref{#2}.eraino}% + }} +% \end{macrocode} +% Text for the Bahasa Malaysia defaults was contributed by +% Bob Margolis 2005-12-02. +% +% Notes: pada muka surat translates as ``on the page'' though BM has no +% definite (or indefinite) article; adjectives and other modifiers follow +% the noun (clause); bertentangan is ``opposite'' in the sense of +% ``facing''; berikutnya is ``next'' (in this context - actually +% next-to-this, literally); berikutnya also translates as ``following +% this'' sebelumnya is ``preceding''; also ``previous'' ``ini'' translates, +% literally, as ``this'' but is also used in the sense of current page. +% \changes{v1.4o}{2005/12/02}{Bahasa Malaysia defaults added.} +% \begin{macrocode} +\DeclareOption{bahasam} + {\vref@addto\extrasbahasam{% + \def\reftextfaceafter {pada muka surat \reftextvario{bertentangan}{berikutnya}}% + \def\reftextfacebefore{pada muka surat \reftextvario{bertentangan}{sebelumnya} }% + \def\reftextafter {pada muka surat berikutnya}% + \def\reftextbefore {pada muka surat sebelumnya}% + \def\reftextcurrent {pada muka surat ini}% + \def\reftextfaraway#1{pada muka surat~\pageref{#1}}% + \def\reftextpagerange#1#2{pada muka surat~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}% + }} +% \end{macrocode} +% Text for brazil defaults was contributed by +% Alcino Dall Igna Junior\\ +% (|adij@di.ufpe.br|). +% \changes{v1.0g}{1994/05/18}{Brazil defaults added.} +% \changes{v1.4o}{2005/11/07}{Added a few more brazil strings} +% \changes{v1.4r}{2007/05/26}{Misspelling of \cs{extrasbrazil}} +% \begin{macrocode} +\DeclareOption{brazil} + {\vref@addto\extrasbrazil{% + \def\reftextfaceafter {na \reftextvario{p\'agina oposta}{pr\'oxima + p\'agina}}% + \def\reftextfacebefore{na p\'agina \reftextvario{oposta}{anterior}}% + \def\reftextafter {na \reftextvario{p\'agina seguinte}{pr\'oxima + p\'agina}}% + \def\reftextbefore{na p\'agina \reftextvario{anterior}{precedente}}% + \def\reftextcurrent {\reftextvario{nesta p\'agina}{na p\'agina + corrente}}% + \def\reftextfaraway#1{na p\'agina~\pageref{#1}}% + \def\reftextpagerange#1#2{nas p\'aginas~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}% + }} +% \end{macrocode} +% Text for Breton defaults was contributed by +% Christian ROLLAND\\ +% (|Christian.Rolland@univ-brest.fr|). +% \changes{v1.0o}{1994/09/27}{Added defaults for breton} +% \begin{macrocode} +\DeclareOption{breton} + {\vref@excuse{breton}% + \vref@addto\extrasbreton{% + \def\reftextfaceafter {war ar bajenn \reftextvario{a-dal}{da heul}}% + \def\reftextfacebefore{war ar bajenn \reftextvario{a-dal}{a-raok}}% + \def\reftextafter {war ar bajenn da heul}% + \def\reftextbefore {war ar bajenn a-raok}% + \def\reftextcurrent {war ar \reftextvario{bajenn-ma\~n}% + {bajenn war-wel}}% + \def\reftextfaraway#1{war ar bajenn~\pageref{#1}}% + \def\reftextpagerange#1#2{\vref@stringwarning\reftextpagerange + on pages~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\vref@stringwarning\reflabelpagerange + \ref{#1} to~\ref{#2}}% + }} +% \end{macrocode} +% Text for Bulgarian defaults was contributed by +% Georgi Boshnakov\\ (|georgi.boshnakov@gmail.com|). +% \changes{v1.4q}{2006/05/23}{Added defaults for bulgarian} +% \begin{macrocode} +\DeclareOption{bulgarian}% + {\vref@addto\extrasbulgarian{% + \def\reftextfaceafter{\cyrn\cyra\ + \reftextvario{\cyrs\cyrery\cyrs\cyre\cyrd\cyrn\cyra\cyrt\cyra}% + {\cyrs\cyrl\cyre\cyrd\cyrv\cyra\cyrshch\cyra\cyrt\cyra} + \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}% + \def\reftextfacebefore{\cyrn\cyra\ + \reftextvario{\cyrs\cyrery\cyrs\cyre\cyrd\cyrn\cyra\cyrt\cyra}% + {\cyrp\cyrr\cyre\cyrd\cyrn\cyra\cyrt\cyra} + \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}% + \def\reftextafter{\cyrn\cyra\ + \reftextvario{\cyrs\cyrl\cyre\cyrd\cyrv\cyra\cyrshch\cyra\cyrt\cyra}% + {\cyrs\cyrl\cyre\cyrd\cyrv\cyra\cyrshch\cyra\cyrt\cyra} + \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}% + \def\reftextbefore{\cyrn\cyra\ + \reftextvario{\cyrp\cyrr\cyre\cyrd\cyrn\cyra\cyrt\cyra}% + {\cyrp\cyrr\cyre\cyrd\cyri\cyrsh\cyrn\cyra\cyrt\cyra} + \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}% + \def\reftextcurrent{\cyrn\cyra\ + \reftextvario{\cyrt\cyra\cyrz\cyri}% + {\cyrt\cyre\cyrk\cyru\cyrshch\cyra\cyrt\cyra} + \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra}% + \def\reftextfaraway#1{\cyrn\cyra\ \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyra + ~\pageref{#1}}% + \def\reftextpagerange#1#2{\cyrn\cyra\ + \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyri + ~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} \cyrd\cyro~\ref{#2}}% + }} +% \end{macrocode} +% Text for catalan defaults was contributed by Robert Fuster\\ +% (\verb=rfuster@mat.upv.es=). +% \changes{v1.1c}{1997/06/12}{Added defaults for catalan} +% \changes{v1.2g}{2000/08/22}{Updated defaults for catalan} +% \begin{macrocode} +\DeclareOption{catalan} + {\vref@addto\extrascatalan{% + \def\reftextfaceafter {a la p\`agina seg\"uent}% + \def\reftextfacebefore{a la p\`agina anterior}% + \let\reftextafter \reftextfaceafter + \let\reftextbefore \reftextfacebefore + \def\reftextcurrent {en aquesta p\`agina}% + \def\reftextfaraway#1{a la p\`agina~\pageref{#1}}% + \def\reftextpagerange#1#2{a les + p\`agines~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}% + }} +% \end{macrocode} +% Text for croatian defaults was contributed by \v{S}ime Ungar +% (\verb=ungar@math.hr=). +% \changes{v1.4p}{2006/05/13}{Added defaults for croatian} +% \begin{macrocode} +\DeclareOption{croatian} + {\vref@addto\extrascroatian{% + \def\reftextfaceafter {na sljede\'coj stranici}% + \def\reftextfacebefore{na prethodnoj stranici}% + \let\reftextafter \reftextfaceafter + \let\reftextbefore \reftextfacebefore + \def\reftextcurrent {na ovoj stranici}% + \def\reftextfaraway#1{na stranici~\pageref{#1}}% + \def\reftextpagerange#1#2{na stranicama~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} do~\ref{#2}}% + }} +% \end{macrocode} +% Defaults for the Czech option provided by Milan Vancura +% \verb=<milan@suse.cz>=. +% \changes{v1.2e}{2000/04/04}{Added czech defaults} +% \begin{macrocode} +\DeclareOption{czech} + {%\vref@excuse{czech}% + \vref@addto\extrasczech{% + \def\reftextfaceafter {na n\'a\-sle\-du\-j\'\i c\'\i\ stran\v{e}}% + \def\reftextfacebefore{na p\v{r}ed\-choz\'\i\ stran\v{e}}% + \def\reftextafter {na n\'a\-sle\-du\-j\'\i c\'\i\ stran\v{e}}% + \def\reftextbefore {na p\v{r}ed\-choz\'\i\ stran\v{e}}% + \def\reftextcurrent {na t\'eto stran\v{e}}% + \def\reftextfaraway#1{na stran\v{e}~\pageref{#1}}% + \def\reftextpagerange#1#2{na stran\'ach~\pageref{#1}\--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} a\v{z}~\ref{#2}}% + }} +% \end{macrocode} +% Defaults for Danish provided by Torsten Martinsen +% (\verb=tmar91@kom.auc.dk=). Further defaults by Ole Laursen +% (\verb=olau@hardworking.dk=). +% \changes{v1.0n}{1994/09/25}{Added Danish defaults} +% \changes{v1.2h}{2000/12/30}{Updates to Danish defaults} +% \begin{macrocode} +\DeclareOption{danish} + {\vref@addto\extrasdanish{% + \def\reftextfaceafter {p\aa{} \reftextvario{modst\aa ende}% + {n\ae ste} side}% + \def\reftextfacebefore{p\aa{} \reftextvario{modst\aa ende}% + {forrige} side}% + \def\reftextafter {p\aa{} \reftextvario{den f\o lgende}% + {n\ae ste} side}% + \def\reftextbefore {p\aa{} \reftextvario{forrige side} + {foreg\aa ende side}}% + \def\reftextcurrent {p\aa{} denne side}% + \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}% + \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}% + }} +% \end{macrocode} +% Default string for dutch have been contributed by Frank Poppe +% (\verb=POPPE@SWOV.NL=). +% This option currently supports one additional string macro +% |\refpagename| so that you can easily change to |bladzijde| +% instead of |pagina| if you prefer this word for ``page''. +% However, I will not guarantee that this will survive future +% versions of this package, so use it on your own risk (you can +% always update the full strings to be on the safe side). +% \changes{v1.0l}{1994/07/07}{Added dutch defaults} +% \changes{v1.2a}{1998/08/22}{Added dutch defaults for +% \cs{reftextpagerange} and \cs{reftextlabelrange}} +% \begin{macrocode} +\DeclareOption{dutch} + {\vref@addto\extrasdutch{% + \def\refpagename{pagina}% + \def\reftextfaceafter {op de \reftextvario{rechter \refpagename}% + {\refpagename\ hiernaast}}% + \def\reftextfacebefore{op de \reftextvario{linker \refpagename}% + {\refpagename\ hiernaast}}% + \def\reftextafter {op de \reftextvario{volgende \refpagename}% + {\refpagename\ hierna}}% + \def\reftextbefore {op de \reftextvario{vorige \refpagename}% + {\refpagename\ hiervoor}}% + \def\reftextcurrent {op deze \refpagename}% + \def\reftextfaraway#1{op \refpagename~\pageref{#1}}% +% \end{macrocode} +% Concerning the next defaults I received the following comment by +% Frederik Fouvry \texttt{<fouvry@coli.uni-sb.de>}: +% ``In the Dutch options (where I can exert a proper language +% judgement ;-), `t/m' is not used in formal (scientific) texts. I +% would either use `--' or `tot en met' (the abbreviation written +% out). '' +% \changes{v1.4d}{2002/11/11}{Changed default for \cs{reftextlabelrange}} +% \changes{v1.4m}{2005/06/09}{Fixed \cs{reftextlabelrange} (pr/3791)} +% \begin{macrocode} + \def\reftextpagerange#1#2{op pagina's~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}% + }} +% \end{macrocode} +% \changes{v1.2a}{1998/08/22}{Added english defaults for +% \cs{reftextpagerange} and \cs{reftextlabelrange}} +% \changes{v1.4d}{2002/11/11}{Changed default for \cs{reftextbefore}} +% \begin{macrocode} +\DeclareOption{english} + {\vref@addto\extrasenglish{% + \def\reftextfaceafter {on the \reftextvario{facing}{next} page}% + \def\reftextfacebefore{on the \reftextvario{facing}{preceding} + page}% + \def\reftextafter {on the \reftextvario{following}{next} page}% + \def\reftextbefore {on the \reftextvario{preceding}{previous} page}% + \def\reftextcurrent {on \reftextvario{this}{the current} page}% + \def\reftextfaraway#1{on page~\pageref{#1}}% + \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}% + }} +% \end{macrocode} +% +% The esperanto strings were suggested by Albert Reiner +% (\verb=areiner@tph.tuwien.ac.at=). +% \changes{v1.4x}{2010/08/04}{Defaults for esperanto added} +% \begin{macrocode} +\DeclareOption{esperanto} + {\vref@addto\extrasesperanto{% + \def\reftextfaceafter{en la + \reftextvario{flanka}{sekva} pa\^go}% + \def\reftextfacebefore{en la + \reftextvario{flanka}{anta\u ua} pa\^go}% + \def\reftextafter{en la sekva pa\^go}% + \def\reftextbefore{en la anta\u ua pa\^go}% + \def\reftextcurrent{\reftextvario{\^ci-pa\^ge}% + {en \^ci tiu pa\^go}}% + \def\reftextfaraway#1{en pa\^go~\pageref{#1}}% + \def\reftextpagerange#1#2{en pa\^goj~\pageref{#1} \^gis \pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} \^gis~\ref{#2}}% + }} +% \end{macrocode} +% The finnish strings were suggested by Matti Rintala +% (\verb=bitti@cs.tut.fi=) and Hillevi Gavel +% \verb=Hillevi.Gavel@mdh.se=. +% \changes{v1.0m}{1994/09/23}{Added finnish strings} +% \changes{v1.4o}{2005/11/07}{Added a few more finnish strings} +% \begin{macrocode} +\DeclareOption{finnish} + {\vref@addto\extrasfinnish{% + \def\reftextfaceafter {\reftextvario{viereisell\"a}% + {seuraavalla} sivulla}% + \def\reftextfacebefore{\reftextvario{viereisell\"a}% + {edellisell\"a} sivulla}% + \def\reftextafter {seuraavalla sivulla}% + \def\reftextbefore {edellisell\"a sivulla}% + \def\reftextcurrent {t\"all\"a sivulla}% + \def\reftextfaraway#1{sivulla~\pageref{#1}}% + \def\reftextpagerange#1#2{sivuilla~\pageref{#1}--\pageref{#2}}% +% \end{macrocode} +% Can't combine numbers with the necessary suffix well. +% \begin{macrocode} + \def\reftextlabelrange#1#2{\ref{#1}--\ref{#2}}% + }} +% \end{macrocode} +% French defaults are provided by Daniel Flippo +% (\verb=Daniel.Flipo@univ-lille1.fr=). +% \changes{v1.0j}{1994/06/21}{Added french defaults} +% \changes{v1.2a}{1998/08/22}{Added french defaults for +% \cs{reftextpagerange} and \cs{reftextlabelrange}} +% \begin{macrocode} +\DeclareOption{french} + {\vref@addto\extrasfrench{% + \def\reftextfaceafter {page \reftextvario{ci-contre}{suivante}}% + \def\reftextfacebefore{page \reftextvario{ci-contre}% + {pr\'ec\'edente}}% + \def\reftextafter {page suivante}% + \def\reftextbefore {page pr\'ec\'edente}% + \def\reftextcurrent {de la pr\'esente page}% + \def\reftextfaraway#1{page~\pageref{#1}}% + \def\reftextpagerange#1#2{pages~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} \`a~\ref{#2}}% + }} +% \end{macrocode} +% Galician defaults are provided by Matthias Moebius\\ +% (\texttt{Matthias.Moebius@uni-konstanz.de}). +% \changes{v1.1f}{1998/04/25}{Added galician defaults} +% \changes{v1.4o}{2005/11/10}{Added further galician defaults} +% \changes{v1.4o}{2005/11/26}{Some further corrections} +% \changes{v1.5b}{2015/09/22}{Fixed blunder from 2005 - +% galician option clearly never used} +% \begin{macrocode} +\DeclareOption{galician} + {\vref@addto\extrasgalician{% + \def\reftextfaceafter {na p\'axina oposta}% + \def\reftextfacebefore\reftextfaceafter + \def\reftextafter {na p\'axina seguinte}% + \def\reftextbefore {na p\'axina anterior}% + \def\reftextcurrent {nesta p\'axina}% + \def\reftextfaraway#1{na p\'axina~\pageref{#1}}% + \def\reftextpagerange#1#2{% + nas p\'axinas~\pageref{#1}-\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}% + }} +% \end{macrocode} +% There are no good variants for German (I think and still think but +% this is a matter of taste :-). +% \changes{v1.0b}{1994/01/31}{Replace in incorrect `def by `let} +% The following definitions were recently suggested to me but since +% the original are in for a long time i don't want to change them +% now since that could make a lot of documents change their formatting. +% If you fancy them, add a redefinition of the corresponding macro(s) +% to the preamble of your document. +%\begin{verbatim} +% \def\reftextfaceafter {auf der \reftextvario +% {gegen\"uberliegenden}{anderen} Seite}% +% \def\reftextfacebefore {auf der \reftextvario +% {gegen\"uberliegenden}{anderen} Seite}% +% \def\reftextafter {auf der \reftextvario +% {n\"achsten}{folgenden} Seite}% +% \def\reftextbefore {auf der \reftextvario +% {vorigen}{vorhergehenden} Seite}% +% \def\reftextcurrent {\reftextvario +% {auf dieser}{diese} Seite}% +%\end{verbatim} +% \changes{v1.4n}{2005/07/24}{Small change} +% \begin{macrocode} +\DeclareOption{german} + {\vref@addto\extrasgerman{% + \def\reftextfaceafter {auf der n\"achsten Seite}% + \def\reftextfacebefore{auf der vorherigen Seite}% + \let\reftextafter \reftextfaceafter + \let\reftextbefore \reftextfacebefore + \def\reftextcurrent {auf dieser Seite}% + \def\reftextfaraway#1{auf Seite~\pageref{#1}}% + \def\reftextpagerange#1#2{auf den Seiten~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}% + }} +% \end{macrocode} +% \changes{v1.2d}{2000/01/11}{Added ngerman defaults (identical to german)} +% \changes{v1.4n}{2005/07/24}{Small change} +% The ngerman defaults are the same but needed for ``Neue Rechtschreibung'' +% (i.e., a different set of hyphenation patterns). +% \begin{macrocode} +\DeclareOption{ngerman} + {\vref@addto\extrasngerman{% + \def\reftextfaceafter {auf der n\"achsten Seite}% + \def\reftextfacebefore{auf der vorherigen Seite}% + \let\reftextafter \reftextfaceafter + \let\reftextbefore \reftextfacebefore + \def\reftextcurrent {auf dieser Seite}% + \def\reftextfaraway#1{auf Seite~\pageref{#1}}% + \def\reftextpagerange#1#2{auf den Seiten~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} bis~\ref{#2}}% + }} +% \end{macrocode} +% Defaults for greek suggested by Apostolos Syropoulos\\ +% (\verb=apostolo@obelix.ee.duth.gr=). +% \changes{v1.2a}{1998/08/22}{Added defaults for greek} +% \begin{macrocode} +\DeclareOption{greek} + {\vref@addto\extrasgreek{% + \def\reftextfaceafter {sthn \reftextvario{paro'usa}% + {ep'omenh} sel'ida}% + \def\reftextfacebefore{sthn \reftextvario{paro'usa}{prohgo'umenh} + sel'ida}% + \def\reftextafter {sthn ep'omenh sel'ida}% + \def\reftextbefore {sthn prohgo'umenh sel'ida}% + \def\reftextcurrent {s'' aut'h th sel'ida}% + \def\reftextfaraway#1{sth sel'ida\nobreakspace\pageref{#1}}% + \def\reftextpagerange#1#2{stis sel'ides\nobreakspace + \pageref{#1}---\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} ws\nobreakspace\ref{#2}}% + }} +% \end{macrocode} +% Icelandic defaults suggested by Thorhallur Sverrisson +% (\verb=thorhs@basis.is=). +% \changes{v1.4t}{2007/09/07}{Added defaults for icelandic} +% \begin{macrocode} +\DeclareOption{icelandic} + {\vref@addto\extrasicelandic{% + \def\reftextfaceafter {\'{a} \reftextvario{n{\ae}stu}% + {n{\ae}stu} s\'{i}{\dh}u}% + \def\reftextfacebefore{\'{a} \reftextvario{fyrri}% + {fyrri} s\'{i}{\dh}u}% + \def\reftextafter {\'{a} \reftextvario{n{\ae}stu}% + {n{\ae}stu} s\'{i}{\dh}u}% + \def\reftextbefore {\'{a} \reftextvario{fyrri}{fyrri} s\'{i}{\dh}u}% + \def\reftextcurrent {\'{a} \reftextvario{{\th}essari}% + {{\th}essari} s\'{i}{\dh}u}% + \def\reftextfaraway#1{\'{a} s\'{i}{\dh}u~\pageref{#1}}% + \def\reftextpagerange#1#2{\'{a} s\'{i}{\dh}um~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}% + }} +% \end{macrocode} +% Defaults for Italian suggested by Giovanni Pensa +% (\verb=pensa@dsi.unimi.it=) with i{\TeX}nici. +% \changes{v1.1b}{1995/10/19}{Added defaults for Italian} +% \changes{v1.2a}{1998/08/22}{Removed incorrect warning} +% \changes{v1.4k}{2004/10/30}{Added missing defaults supplied by Lapo Mori} +% \changes{v1.4n}{2005/07/24}{Small change} +% \changes{v1.4u}{2009/03/21}{Correction for \cs{reftextfaraway} suggested +% by Lorenzo Pantieri} +% \begin{macrocode} +\DeclareOption{italian} + {\vref@addto\extrasitalian{% + \def\reftextfaceafter {\reftextvario{a fronte}% + {nella pagina successiva}}% + \def\reftextfacebefore{\reftextvario{a fronte}% + {nella pagina precedente}}% + \def\reftextafter {nella pagina \reftextvario{seguente}% + {successiva}}% + \def\reftextbefore {nella pagina precedente}% + \def\reftextcurrent {in questa pagina}% + \def\reftextfaraway#1{a pagina~\pageref{#1}}% + \def\reftextpagerange#1#2{nelle pagine~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{da~\ref{#1} a~\ref{#2}}% + }} +% \end{macrocode} +% Defaults for Hungarian by Jeff Goldberg +% (\verb=jeffrey@goldmark.org=). +% There is a problem with the use of the definite article +% \textit{a} or \textit{az} in Hungarian before expansions +% of |\vref| or |\ref|. The problem is that the word +% should be \textit{az} if the number following would begin with +% a vowel if spelled out, and \textit{a} if the number would begin +% with a consonant. +% +% The option assumes that there is a command |\aza| defined which +% helps resolving this problem.\footnote{This information is actually quite +% old but unfortunately never made it into varioref. In case any work +% has been undertaken to resolve this please inform the author about it.} +% \changes{v1.2a}{1998/08/22}{Added defaults for magyar} +% \changes{v1.4j}{2005/01/22}{Defined \cs{reftextfaceafter} and +% \cs{reftextfacebefore} instead of \cs{reftextafter} and \cs{reftextbefore}} +% \begin{macrocode} +\DeclareOption{magyar} + {\vref@addto\extrasmagyar{% + \def\reftextafter {a k\"o\-vet\-kez\H{o} ol\-da\-lon}% + \def\reftextbefore{az el\H{o}\-z\H{o} ol\-da\-lon}% + \def\reftextfaceafter {\reftextvario{a t\'ul\-ol\-da\-lon}% + {a k\"o\-vet\-kez\H{o} ol\-da\-lon}}% + \def\reftextfacebefore{\reftextvario{a t\'ul\-ol\-da\-lon}% + {az el\H{o}\-z\H{o} ol\-da\-lon}}% + \def\reftextcurrent {ezen az ol\-da\-lon}% +% \end{macrocode} +% The following suggested patch has not been added yet (pending changes +% in babel system). +%\begin{verbatim} +% \def\reftextfaraway#1{a~\csname @@magyar@az@lowxu\endcsname +% {\pageref{#1}}.~ol\-da\-lon}% +% \def\reftextpagerange#1#2{a~\csname @@magyar@az@lowxu\endcsname +% {\pageref{#1}}% +% --\pageref{#2}.~ol\-da\-la\-kon}% +% \def\reftextlabelrange#1#2{{}\csname @@magyar@told\endcsname\ref{#1}+tol +% \ref{#2}-ig}% Dat: `{}' is here for anti-\capitalize +%\end{verbatim} +% \begin{macrocode} + \def\reftextfaraway#1{\aza{\pageref{#1}} \pageref{#1}.~ol\-da\-lon}% + \def\reftextpagerange#1#2{\vref@stringwarning\reftextpagerange + on pages~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\vref@stringwarning\reflabelpagerange + \ref{#1} to~\ref{#2}}% + }% +% \end{macrocode} +% The |\AtBeginDocument| needs to be executed when the option is +% processed and not inside the babel interface. +% \changes{v1.4i}{2004/02/27}{Moved \cs{AtBeginDocument}} +% \begin{macrocode} + \AtBeginDocument{\providecommand\aza[1]{a/az% + \PackageError{varioref}{% + Proper definition for command \noexpand\aza missing}% + {You need to (re)define the command \noexpand\aza that + takes one argument (a number or a \noexpand\pageref command) + and produces the string `a' or `az' depending on the argument + value. It should also accept an optional argument (default `l') + to denote whether or not the string should be lowercase or + uppercase.}}}% + } +% \end{macrocode} +% The Norwegian and `nynorsk' translations have been provided by +% Dag F Langmyhr \verb=<dag@ifi.uio.no>= and Karl Ove Hufthammer +% \verb=<huftis@bigfoot.com>=. +% \changes{v1.0q}{1995/04/06}{Added defaults for norsk} +% \changes{v1.0q}{1995/04/06}{Added defaults for nynorsk} +% \changes{v1.2a}{1998/08/22}{Updated defaults for norsk} +% \changes{v1.2a}{1998/08/22}{Updated defaults for nynorsk} +% \changes{v1.2a}{1998/08/22}{Added norsk defaults for +% \cs{reftextpagerange} and \cs{reftextlabelrange}} +% \changes{v1.2a}{1998/08/22}{Added nynorsk defaults for +% \cs{reftextpagerange} and \cs{reftextlabelrange}} +% \changes{v1.2i}{2001/01/12}{Updated nynorsk defaults} +% \begin{macrocode} +\DeclareOption{norsk} + {\vref@addto\extrasnorsk{% + \def\reftextfaceafter {p\aa{} neste side}% + \def\reftextfacebefore{p\aa{} forrige side}% + \def\reftextafter {p\aa{} neste side}% + \def\reftextbefore {p\aa{} forrige side}% + \def\reftextcurrent {p\aa{} denne siden}% + \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}% + \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}% + }} +\DeclareOption{nynorsk} + {\vref@addto\extrasnynorsk{% + \def\reftextfaceafter {p\aa{} neste side}% + \def\reftextfacebefore{p\aa{} f\o{}rre side}% + \def\reftextafter {p\aa{} neste side}% + \def\reftextbefore {p\aa{} f\o{}rre side}% + \def\reftextcurrent {p\aa{} denne sida}% + \def\reftextfaraway#1{p\aa{} side~\pageref{#1}}% + \def\reftextpagerange#1#2{p\aa{} side~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} til~\ref{#2}}% + }} +% \end{macrocode} +% The polish translations have been provided by +% Tomasz Michniewski \\ +% \verb=<tomekm@ias.wat.waw.pl>=. +% The use of the command \verb=\eob= and \verb=aob= etc.\ +% requires appropriate definitions as provided, for example, by +% the babel system. This should probably be handled differently +% but it would require modifications in babel's language support. +% \changes{v1.1d}{1997/12/06}{Added defaults for polish} +% \changes{v1.2a}{1998/08/22}{Added polish defaults for +% \cs{reftextpagerange} and \cs{reftextlabelrange}} +% \changes{v1.4n}{2005/09/14}{Changed default for \cs{reftextfaraway}} +% \begin{macrocode} +\DeclareOption{polish} + {\vref@addto\extraspolish{% + \def\reftextfaceafter {na \reftextvario{s\aob{}siedniej}% + {nast\eob{}pnej} stronie}% + \def\reftextfacebefore{na \reftextvario{s\aob{}siedniej}% + {poprzedniej} stronie}% + \def\reftextafter {na nast\eob{}pnej stronie}% + \def\reftextbefore {na poprzedniej stronie}% + \def\reftextcurrent {na \reftextvario{tej + samej}{bie\zkb{}\aob{}cej} stronie}% + \def\reftextfaraway#1{na stronie~\pageref{#1}}% + \def\reftextpagerange#1#2{na stronach~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{od~\ref{#1} do~\ref{#2}}% + }} +% \end{macrocode} +% The portuguese default text has been provided by +% Jos\'e Carlos Oliveira Santos \verb=jcsantos@fc.up.pt=. +% \changes{v1.2b}{1999/11/25}{Added portuguese defaults} +% \changes{v1.2c}{1999/12/02}{Added more portuguese defaults} +% \changes{v1.4r}{2007/05/26}{Misspelling of \cs{extrasportuges}} +% \begin{macrocode} +\DeclareOption{portuges} + {\vref@addto\extrasportuges{% + \def\reftextfaceafter {na \reftextvario{p\'agina ao lado}{pr\'oxima + p\'agina}}% + \def\reftextfacebefore{na p\'agina \reftextvario{ao lado}{anterior}}% + \def\reftextafter {na \reftextvario{p\'agina seguinte}{pr\'oxima + p\'agina}}% + \def\reftextbefore{na p\'agina \reftextvario{anterior}{precedente}}% + \def\reftextcurrent {nesta p\'agina}% + \def\reftextfaraway#1{na p\'agina~\pageref{#1}}% + \def\reftextpagerange#1#2{nas p\'aginas~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}% + }} +% \end{macrocode} +% Updates to the default text for Romanian have been suggested by Florin Oprina +% (\verb=<florin.oprina@gmail.com>=). +% \changes{v1.4v}{2009/06/13}{Incorrect text in \cs{reftextafter} (pr/4070)} +% \changes{v1.5a}{2014/07/03}{Correct text in \cs{reftextbefore}} +% \begin{macrocode} +\DeclareOption{romanian} + {\vref@addto\extrasromanian{% + \def\reftextfaceafter {pe pagina \reftextvario{opus\u{a}}{urm\u{a}toarei}}% + \def\reftextfacebefore{pe pagina \reftextvario{opus\u{a}}{precedentei}}% + \def\reftextafter {\reftextvario{pe pagina urm\u{a}toare}% + {pe urm\u{a}toarea pagin\u{a}}}% + \def\reftextbefore {pe pagina \reftextvario{precedent\u{a}}% + {precedentei}}% + \def\reftextcurrent {pe aceast\u{a} pagin\u{a}}% + \def\reftextfaraway#1{pe pagina~\pageref{#1}}% + \def\reftextpagerange#1#2{pe paginile~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} la~\ref{#2}}% + }} +% \end{macrocode} +% The text for russian was taken from the book in Russian by +% I.~A.~Kotelnikov and P.~Z.~Chebotaev, and adapted +% to the encoding-independent form by Vladimir Volovich +% (\verb=vvv@vsu.ru=). +% \changes{v1.2a}{1998/11/23}{Added russian strings} +% \changes{v1.2a}{1998/11/24}{Added defaults for +% \cs{reftextpagerange} and \cs{reftextlabelrange}} +% \begin{macrocode} +\DeclareOption{russian} + {\vref@addto\extrasrussian{% + \def\reftextfaceafter{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro + \cyrt\cyri\cyrv\cyro\cyrp\cyro\cyrl\cyro\cyrzh\cyrn\cyro\cyrishrt}% + {\cyrs\cyrl\cyre\cyrd\cyru\cyryu\cyrshch\cyre\cyrishrt}\ \cyrs\cyrt + \cyrr\cyra\cyrn\cyri\cyrc\cyre}% + \def\reftextfacebefore{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro + \cyrt\cyri\cyrv\cyro\cyrp\cyro\cyrl\cyro\cyrzh\cyrn\cyro\cyrishrt}% + {\cyrp\cyrr\cyre\cyrd\cyrery\cyrd\cyru\cyrshch\cyre\cyrishrt}\ + \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}% + \def\reftextafter{\cyrn\cyra\ \cyrs\cyrl\cyre\cyrd\cyru\cyryu\cyrshch + \cyre\cyrishrt\ \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}% + \def\reftextbefore{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyre\cyrd + \cyrsh\cyre\cyrs\cyrt\cyrv\cyru\cyryu\cyrshch\cyre\cyrishrt}% + {\cyrp\cyrr\cyre\cyrd\cyrery\cyrd\cyru\cyrshch\cyre\cyrishrt}% + \ \cyrs\cyrt\cyrr\cyra\cyrn\cyri\cyrc\cyre}% + \def\reftextcurrent{\cyrn\cyra\ \reftextvario{\cyrerev\cyrt\cyro + \cyrishrt}{\cyrd\cyra\cyrn\cyrn\cyro\cyrishrt}\ \cyrs\cyrt\cyrr + \cyra\cyrn\cyri\cyrc\cyre}% + \def\reftextfaraway#1{\cyrn\cyra\ \cyrs.~\pageref{#1}}% + \def\reftextpagerange#1#2{\cyrn\cyra\ \cyrs\cyrt\cyrr\cyra\cyrn + \cyri\cyrc\cyra\cyrh~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\cyrs~\ref{#1}\ \cyrp\cyro~\ref{#2}}% + }} +% \end{macrocode} +% The text for slovak defaults was contributed by Miroslav Sedivy\\ +% (\verb=<miro@slovensko.com>=). +% \changes{v1.4b}{2002/03/11}{Contributed defaults added} +% \begin{macrocode} +\DeclareOption{slovak} + {\vref@addto\extrasslovak{% + \def\reftextfaceafter {na \reftextvario{proti\v lahlej}% + {nasleduj\'ucej} strane}% + \def\reftextfacebefore{na \reftextvario{proti\v lahlej}% + {predch\'adzaj\'ucej} strane}% + \def\reftextafter {na \reftextvario{nasleduj\'ucej}% + {\v dal\v sej} strane}% + \def\reftextbefore {na \reftextvario{predch\'adzaj\'ucej}% + {predo\v slej} strane}% + \def\reftextcurrent {na tejto strane}% + \def\reftextfaraway#1{na strane~\pageref{#1}}% + \def\reftextpagerange#1#2{na stran\'ach~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} a\v z~\ref{#2}}% + }} +% \end{macrocode} +% The text for slovene defaults was contributed by Roman Maurer\\ +% (\verb=<roman.maurer@amis.net>=). +% \changes{v1.4a}{2002/03/05}{Contributed defaults added} +% \begin{macrocode} +\DeclareOption{slovene} + {\vref@addto\extrasslovene{% + \def\reftextfaceafter {na naslednji strani}% + \def\reftextfacebefore{na prej\v{s}nji strani}% + \let\reftextafter \reftextfaceafter + \let\reftextbefore \reftextfacebefore + \def\reftextcurrent {na \reftextvario{tej}{trenutni} strani}% + \def\reftextfaraway#1{na strani~\pageref{#1}}% + \def\reftextpagerange#1#2{na straneh~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{od~\ref{#1} do~\ref{#2}}% + }} +% \end{macrocode} +% Text for spanish defaults was contributed by Julio Sanchez +% (\verb=jsanchez@gmv.es=) and Fernando Dobladez (\verb=<ferd@fuego.com>=). +% \changes{v1.0f}{1994/03/16}{Inserted missing hash mark} +% \changes{v1.0k}{1994/06/05}{Corrected misspelled cmd `extrasspanish} +% \changes{v1.4a}{2002/03/05}{Missing defaults added} +% \changes{v1.4o}{2005/11/26}{Single hyphen in range} +% \begin{macrocode} +\DeclareOption{spanish} + {\vref@addto\extrasspanish{% + \def\reftextfaceafter {en la p\'agina siguiente}% + \def\reftextfacebefore{en la p\'agina anterior}% + \let\reftextafter \reftextfaceafter + \let\reftextbefore \reftextfacebefore + \def\reftextcurrent {en esta p\'agina}% + \def\reftextfaraway#1{en la p\'agina~\pageref{#1}}% + \def\reftextpagerange#1#2{en las p\'aginas~\pageref{#1}% + -\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} a~\ref{#2}}% + }} +% \end{macrocode} +% The text for swedish was contributed by Mats Dahlgren +% (\verb=matsd@sssk.se=). +% \changes{v1.0p}{1995/01/10}{Added swedish strings} +% \changes{v1.2a}{1998/08/22}{Added swedish defaults for +% \cs{reftextpagerange} and \cs{reftextlabelrange}} +% \begin{macrocode} +\DeclareOption{swedish} + {\vref@addto\extrasswedish{% + \def\reftextfaceafter {p\aa\ \reftextvario{motst\aa ende}% + {n\"{a}sta} sida}% + \def\reftextfacebefore{p\aa\ \reftextvario{motst\aa ende}% + {f\"{o}reg\aa ende} sida}% + \def\reftextafter {p\aa\ \reftextvario{f\"{o}ljande}% + {n\"{a}sta} sida}% + \def\reftextbefore {p\aa\ f\"{o}reg\aa ende sida}% + \def\reftextcurrent {p\aa\ denna sida}% + \def\reftextfaraway#1{p\aa\ sidan~\pageref{#1}}% + \def\reftextpagerange#1#2{p\aa\ + sidorna~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} till~\ref{#2}}% + }} +\DeclareOption{turkish} + {\vref@excuse{turkish}% + \vref@addto\extrasturkish{% + \def\reftextfaceafter {on the \reftextvario{facing}{next} page}% + \def\reftextfacebefore{on the \reftextvario{facing}{preceding} + page}% + \def\reftextafter {on the \reftextvario{following}{next} page}% + \def\reftextbefore {on the \reftextvario{preceding}{previous} page}% + \def\reftextcurrent {on \reftextvario{this}{the current} page}% + \def\reftextfaraway#1{on page~\pageref{#1}}% + \def\reftextpagerange#1#2{on pages~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\ref{#1} to~\ref{#2}}% + }} +% \end{macrocode} +% The text for Ukrainian defaults was contributed by Mykola Lyakhovych\\ +% (\verb=<lyakhovych@mail.ru>=). +% \changes{v1.4l}{2005/04/24}{Contributed defaults added} +% \begin{macrocode} +\DeclareOption{ukrainian} + {\vref@addto\extrasukrainian{% + \def\reftextfaceafter{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro + \cyrt\cyri\cyrl\cyre\cyrzh\cyrn\cyrii\cyrishrt}% + {\cyrn\cyra\cyrs\cyrt\cyru\cyrp\cyrn\cyrii\cyrishrt}\ \cyrs\cyrt + \cyro\cyrr\cyri\cyrn\cyrc\cyrii}% + \def\reftextfacebefore{\cyrn\cyra\ \reftextvario{\cyrp\cyrr\cyro + \cyrt\cyri\cyrl\cyre\cyrzh\cyrn\cyrii\cyrishrt}% + {\cyrp\cyro\cyrp\cyre\cyrr\cyre\cyrd\cyrn\cyrii\cyrishrt}\ + \cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrc\cyrii}% + \def\reftextafter{\cyrn\cyra\ \cyrn\cyra\cyrs\cyrt\cyru\cyrp\cyrn + \cyrii\cyrishrt\ \cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrc\cyrii}% + \def\reftextbefore{\cyrn\cyra\ \cyrp\cyro\cyrp\cyre\cyrr\cyre\cyrd + \cyrn\cyrii\cyrishrt\ \cyrs\cyrt\cyro\cyrr\cyrii\cyrn\cyrc\cyrii}% + \def\reftextcurrent{\cyrn\cyra\ \reftextvario{\cyrc\cyrii\cyrishrt}% + {\cyrd\cyra\cyrn\cyrii\cyrishrt}\ \cyrs\cyrt\cyro\cyrr\cyrii\cyrn + \cyrc\cyrii}% + \def\reftextfaraway#1{\cyrn\cyra\ \cyrs.~\pageref{#1}}% + \def\reftextpagerange#1#2{\cyrn\cyra\ \cyrs\cyrt\cyro\cyrr\cyrii + \cyrn\cyrk\cyra\cyrh~\pageref{#1}--\pageref{#2}}% + \def\reftextlabelrange#1#2{\cyrz~\ref{#1}\ \cyrd\cyro~\ref{#2}}% + }} +% \end{macrocode} +% We support francais as an alternative to french since people +% might be used to it, but we discurrage it. +% \begin{macrocode} +\DeclareOption{francais}{% + \typeout{Please use `french' instead of `francais'}% + \ExecuteOptions{french}} +\DeclareOption{germanb}{% + \typeout{Please use `german' instead of `germanb'}% + \ExecuteOptions{german}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% During document preparation errors due to |\vref| are usually of +% not much interest. For this reason the draft option turns them into +% warnings by issuing a |\vrefwarning| command. The final option +% (default) stops with an error message when varioref detects a possible +% loop. +% \changes{v1.1h}{1998/08/01}{Added draft and final options} +% \begin{macrocode} +\DeclareOption{draft}{\AtEndOfPackage\vrefwarning} +\DeclareOption{final}{\AtEndOfPackage\vrefshowerrors} % the default +% \end{macrocode} +% +% +% Whether or not \pkg{varioref} uses its own white space and +% removes the one in the source document is handeled by the +% following two options. For historical reasons the default is to +% handle the space, but the recommendation these days is to use +% \texttt{nospace}. +% \changes{v1.6a}{2019/08/25}{Provide options \texttt{space} and \texttt{nospace}} +% \begin{macrocode} +\newif\if@vrefhandlespace +\DeclareOption{space} {\@vrefhandlespacetrue} +\DeclareOption{nospace}{\@vrefhandlespacefalse} +% \end{macrocode} +% +% +% +% +% After all options are declared we execute the default option +% \texttt{english} to set up the defaults and then call +% |\ProcessOptions*| to handle any option passed to the package. +% The star form is used since we want to execute the options in the +% order they are given (in case this isn't used together with the +% \pkg{babel} package). +% \begin{macrocode} +\ExecuteOptions{english,final,space} +\ProcessOptions* +% \end{macrocode} +% +% +% \subsection{Defining the main macros} +% +% \begin{macro}{\vr@cnt} +% To generate new labels we use a counter and construct the +% internal label names by prefixing the current counter value with +% the string |vr@|. We need a \LaTeX{} counter to get |\include|s +% handled correctly. +% \changes{v0.1e}{1992/11/15}{use LaTeX counter} +% \begin{macrocode} +\newcounter{vrcnt} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vpageref} +% \changes{v1.3a}{2001/04/12}{Scan for star form} +% \begin{macro}{\vp@geref} +% The command |\vpageref| generates the appropriate string by first +% parsing the optional arguments (if any) and then compares the +% internal and the user label. This command should be robust since +% the user might put it anywhere. +% +% We now start by scanning for a star and then call either +% |\vp@gerefstar| or |\vp@geref|. +% The space handling logic is a bit twisted these days: if the +% option \texttt{space} is +% in force then preceding spaces in the document are removed and +% the star means that the command should not add its own +% space. However, with option \texttt{nospace} any space already in the +% source will be left alone and the command doesn't add its own +% space either. Thus in this case the star form doesn't +% have any effect and below |\vp@gerefstar| is let to +% |\vp@geref|. This allows a package like \pkg{hyperef} to redefine +% it and useit for its own tasks (like denoting that no link should +% be produced). +% \begin{macrocode} +\DeclareRobustCommand\vpageref{\@ifstar + {\let\vref@maybe@space\@empty\vp@gerefstar}% + {\let\vref@maybe@space\space \vp@geref}} +% \end{macrocode} +% +% \begin{macrocode} +\def\vp@geref{\@ifnextchar[% +% \end{macrocode} +% The default for the first optional argument is the string hidden +% in the macro |\reftextcurrent|. +% \begin{macrocode} + \@vpageref{\@vpageref[\reftextcurrent]}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\vref@space} +% \changes{v1.4a}{2002/03/06}{Default added} +% A default for |\vref@space|. This isn't really needed except in +% the case that somebody has hooked into the \pkg{varioref} +% interfaces at a lower level (which isn't really supported, +% but\ldots). So giving a default will prevent an error message in +% that case (and should hopefully produce the same behavior as before). +% \begin{macrocode} +\let\vref@space\space +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@vpageref} +% More parsing\ldots +% \begin{macrocode} +\def\@vpageref[#1]{\@ifnextchar[% +% \end{macrocode} +% By default the second optional argument is empty. +% \changes{v1.0h}{1994/06/11}{Pass first argument in both cases} +% \changes{v1.0i}{1994/06/20}{Do it correctly} +% \changes{v1.6a}{2019/08/25}{Default for optional argumet changed} +% \begin{macrocode} + {\@@vpageref{#1}}{\@@vpageref{#1}[]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@vpageref} +% The |\@@vpageref| macro finally generates the references by +% comparing the value of an internal label with the value of the +% user label. +% \changes{v1.0h}{1994/06/11}{Change internal interface} +% \begin{macrocode} +\def\@@vpageref#1[#2]#3{% +% \end{macrocode} +% First it switches to horizontal mode if necessary. If there was a +% preceding space we remember its size in |\@tempskipa| and then remove it for +% reinsertion later. +% \changes{v1.6a}{2019/08/25}{Don't drop a preceding space completely +% but reinsert it later after setting a label} +% \begin{macrocode} + \leavevmode + \@tempskipa\lastskip \unskip +% \end{macrocode} +% Then it advances the counter |\c@vrcnt| by one which is used to +% generate internal label names. +% \begin{macrocode} + \global\advance\c@vrcnt\@ne +% \end{macrocode} +% Then it checks if for the current value of |\c@vrcnt| a label +% command was issued in the last run. If not it pretends that there +% was one with the value |{??}{??}|. Thereafter it stores the +% pageref value for this label in the macro |\@tempa|. +% \begin{macrocode} + \vref@pagenum\@tempa{\the\c@vrcnt @vr}% +% \end{macrocode} +% Here we check that the generated text is not going across a page +% boundary. +% \changes{v0.1f}{1993/01/01}{Add another label to catch cross-overs} +% \begin{macrocode} + \vref@pagenum\@tempb{\the\c@vrcnt @xvr}% +% \end{macrocode} +% \changes{v1.0l}{1994/07/07}{Explicitly expand `label argument for +% babel} +% In version 1.0l the label string has been turned around so that +% the number comes first. This was done to allow easy explicit +% expansion of the number before it is passed to the |\label| +% command. In the babel system the argument of |label| was not +% expanded with the result that wrong label strings have been +% generated. This is a general problem that might need a completely +% different solution in babel but for now the change below (and in +% some other places in the code) should solve the problem for this +% special combination of packages. +% +% These days we actually use |\vref@label| instead of |\label| as +% this avoids problems with Babel or \pkg{amsmath} redefining +% the latter command. +% \changes{v1.4e}{2003/01/08}{Use \cs{vref@label} instead of +% \cs{label} (pr/3489)} +% \begin{macrocode} + \vref@label{\the\c@vrcnt @xvr}% +% \end{macrocode} +% Since we have removed +% any leading space above we now insert a space here after the +% label. It is done here so that it is still visible from following +% code---the space before the label would be hidden. +% What kind of space depends on the options to the +% package. If \texttt{space} was specified, we insert our own +% space, namely |\vref@maybe@space|. This will typeset a space +% unless the star form of the current command was used. +% \begin{macrocode} + \if@vrefhandlespace + \vref@maybe@space + \else +% \end{macrocode} +% But if \texttt{nospace} is in force we simply use the same space +% value that was used in the source document (unless that was zero +% or non-existent. +% \begin{macrocode} + \ifdim\@tempskipa=\z@ \else + \hskip\@tempskipa + \fi + \fi +% \end{macrocode} +% \changes{v1.1g}{1998/05/10}{Test if inside AMS display (pr2175)} +% Inside displays of the \pkg{amsmath} package the |\label| command +% is redefined which makes the test for loops incorrect if a |\vref| +% is used in, say, |\intertext|. So we test this condition first and +% only do the test if |\label| doesn't have a special meaning. +% [This is no longer necessary as |\label| isn't used any more] +% \begin{macrocode} +% \ifx\label\label@in@display\else + \ifx\@tempa\@tempb + \let\vref@may@loop\relax + \else +% \end{macrocode} +% If both points do not fall onto the same page with either issue +% an error or a warning message. +% However, we do no longer issue that warning now but wait until we +% are sure that both labels aren't ``far away'' because in that +% case it doesn't matter. So we just save that info in a macro now. +% \changes{v1.0g}{1994/05/27}{Looping pages shown in wrong order} +% \changes{v1.5c}{2016/02/16}{Delay generating the looping warning +% until we know more} +% \begin{macrocode} + \edef\vref@may@loop{% + \noexpand\vref@err{\noexpand\vref or \noexpand\vpageref + at page boundary + \@tempb-\@tempa\space (may loop)% + }% + }% + \fi +% \fi +% \end{macrocode} +% Same game for the user requested label; this time the page +% reference is saved in |\thevpagerefnum|. +% \changes{v1.4c}{2002/06/14}{Use \cs{thevpagerefnum} instead of \cs{@tempb}} +% \begin{macrocode} + \vrefpagenum\thevpagerefnum{#3}% +% \end{macrocode} +% Now after the internal label has served its purpose if would be +% nice to free the memory it occupies by using something like +% \begin{verbatim} +% \global\expandafter\let +% \csname r@\the\c@vrcnt @vr\endcsname\@empty +%\end{verbatim} +% But this is not possible because it would result in getting +% `Labels may have changed\ldots' warnings for every run. Now we +% are ready to produce the textual strings. +% \begin{macrocode} + \ifx\@tempa\thevpagerefnum +% \end{macrocode} +% If they are the same we insert the first argument into the input +% stream. Otherwise we insert the second argument. Recall that +% those are the two optional arguments of |...|. However, if the +% user explicitly requested an empty text string using the optional +% argument we cancel any preceding space since in this case we are +% otherwise likely to end up with spaces one before and one after +% |\vpageref|. +% \changes{v1.2f}{2000/07/07}{Don't output space if optional argument +% empty (pr/3230)} +% \begin{macrocode} + \def\@tempc{#1}% + \ifx\@tempc\@empty + \unskip + \else + #1% + \fi + \else +% \end{macrocode} +% If |#2| is empty we do nothing otherwise we insert it followed by +% a space. +% \begin{macrocode} + \def\@tempc{#2}% + \ifx\@tempc\@empty \else + #2\vref@space + \fi +% \end{macrocode} +% Now we check if the page number of the referenced object (stored +% in |\thevpagerefnum| is a single positive number. +% \begin{macrocode} + \is@pos@number\thevpagerefnum + {% +% \end{macrocode} +% If so, we check if the current position (stored in |\@tempa|) is +% a positive number. If this is the case we assign this number to +% the counter register |\@tempcnta| and add one to it. +% \begin{macrocode} + \is@pos@number\@tempa + {\@tempcnta\@tempa + \advance\@tempcnta\@ne + }% +% \end{macrocode} +% If it is not a positive number we assign the largest possible +% number to |\@tempcnta| and thereby pretending that label and +% reference are miles away from each other. +% \begin{macrocode} + {\@tempcnta\maxdimen}% +% \end{macrocode} +% Now we are ready to check if reference and object are on nearby +% pages. |\thevpagerefnum| will expand to the page number of the object +% (and we know that this is a number) and |\@tempcnta| is either +% one higher than the reference page or completely out of bounds. +% So if both represent the same value then the object lies one page +% after its reference. +% \begin{macrocode} + \ifnum \thevpagerefnum =\@tempcnta +% \end{macrocode} +% Thus if the object falls onto an odd page then the reference is +% on the facing even page (and so we insert |\reftextfaceafter|), +% otherwise the object can not be seen from the reference (and we +% in insert |\reftextafter|). Don't be surprised if we are not +% using |\thevpagerefnum| in the check. Since |\@tempcnta| has the same +% value it is faster to use the register instead of parsing the +% macro contents anew. +% \begin{macrocode} + \ifodd\@tempcnta +% \end{macrocode} +% In fact we are going to use |\reftextfaceafter| only if we are +% doing two-sided printing, otherwise |\reftextafter| is always +% used. +% Since the value of |\if@twoside| is evaluated before reading in +% packages we could do better (saving some tokens) by defining +% the current macro in dependence of this boolean. +% \begin{macrocode} + \if@twoside + \reftextfaceafter + \else + \reftextafter + \fi + \else + \reftextafter + \fi +% \end{macrocode} +% If the object is not on the page following the reference we check +% if it is on the page before the reference. In \LaTeX{} this +% situation is not too common, for example with floats it normally +% does not occur, but of course it isn't impossible if you more +% than one reference to the same object, or if you have back +% references to sections, theorems, etc. To test this we now +% subtract two from the current value of |\@tempcnta| (which was +% set to one higher as the reference page number). Note, that +% subtraction is also possible if the value was |\maxdimen| --- we +% still get something that is much larger than any sensible page +% number. +% \begin{macrocode} + \else + \advance\@tempcnta-2 +% \end{macrocode} +% If now |\thevpagerefnum| and |\@tempcnta| have the same value then the +% object lies one page before the reference. +% \begin{macrocode} + \ifnum \thevpagerefnum =\@tempcnta +% \end{macrocode} +% Again we have to check for odd or even pages to distinguish +% between the facing and the non-facing situation. +% \begin{macrocode} + \ifodd\@tempcnta + \reftextbefore + \else +% \end{macrocode} +% Again the |\reftextfacebefore| only if |@twoside| evaluates to +% true. +% \begin{macrocode} + \if@twoside + \reftextfacebefore + \else + \reftextbefore + \fi + \fi +% \end{macrocode} +% If the above test also returns false then we have object and +% references on pages which are far away or don't contain simple +% page numbers. Therefore we generate the |\reftextfaraway| string +% and drop any possible ``looping warning'' in |\vref@may@loop|. +% Recall that this is a macro which has the user label as an +% argument. +% \begin{macrocode} + \else + \let\vref@may@loop\relax % added + \reftextfaraway{#3}% + \fi + \fi + }% +% \end{macrocode} +% We do the same if our first test (that the page with the object +% has a positive page number) turns out to be false. +% \begin{macrocode} + {% + \let\vref@may@loop\relax %added + \reftextfaraway{#3}}% + \fi +% \end{macrocode} +% Finally we generate the internal label so that it can be check on +% the next run. This means that we compare the position after the +% string with the position of the referenced object. There is one +% thing to note: to conserve space we locally make |\@currentlabel| +% empty since we are only interested in the page number value of +% this internal label. +% \changes{v1.0l}{1994/07/07}{Explicitly expand \cs{label} argument for babel} +% +% These days we actually use |\vref@label| instead of |\label| as +% this avoids problems with Babel or \pkg{amsmath} redefining +% the latter command. +% \changes{v1.4e}{2003/01/08}{Use \cs{vref@label} instead of +% \cs{label} (pr/3489)} +% \changes{v1.5c}{2016/02/16}{} +% \begin{macrocode} + \vref@label{\the\c@vrcnt @vr}% +% \end{macrocode} +% Finally we run |\vref@may@loop| which is either |\relax| or generates +% a ``may loop'' warning or error as appropriate. +% \begin{macrocode} + \vref@may@loop +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\vp@gerefstar} +% The default code for the star form is identical to the previous +% macro |\vp@geref|. It only produces a different result because +% before calling it we set |\vref@maybe@space| to do nothing. +% +% The \pkg{hyperref} package can then change the meaning of this +% command to suppress a hyperlink. +% +% It is is also a good way to check if we are running with a new +% \pkg{varioref} by testing +%\begin{verbatim} +% \ifdefined\vp@gerefstar +% ... code fore noew varioref +% \else +% ... code for old varioref +% \fi +%\end{verbatim} +% +% \changes{v1.6a}{2019/08/25}{Command added to support hyperref better} +% \begin{macrocode} +\let\vp@gerefstar\vp@geref +% \end{macrocode} +% \end{macro} +% +% + +% \begin{macro}{\vref@label} +% \changes{v1.4e}{2003/01/08}{Macro added (pr/3489)} +% This macro is like |\label| in the kernel but without passing on +% |\@currentlabel|, ie useful if all we are interested in is the +% page number. It also has the effect that it is unaffected by +% \pkg{amsmath} or Babel redefining the |\label| command. +% \begin{macrocode} +\def\vref@label#1{\@bsphack + \protected@write\@auxout{}% + {\string\newlabel{#1}{{}{\thepage}}}% + \@esphack} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\vpagerefnum} +% \changes{v1.4c}{2002/06/14}{Macro added} +% This macro allows to define |\reftextafter| and friends to refer +% to the page number rather than producing a textual reference. +% \begin{macrocode} +\let\thevpagerefnum\@empty +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\vrefwarning} +% \changes{v0.1g}{1993/02/14}{Macro added} +% \begin{macro}{\vrefshowerrors} +% \changes{v1.1h}{1998/08/01}{Macro added} +% \begin{macro}{\vref@err} +% \changes{v0.1g}{1993/02/14}{Macro added} +% When the |\vref| command detects a possible crossing over a page +% boundary it will call |\vref@err| to generate an error message. +% During document preparation one can turn such errors into +% warnings by issuing a |\vrefwarning| declaration. +% \changes{v1.0g}{1993/02/14}{Macro added} +% \begin{macrocode} +\def\vrefwarning{\def\vref@err{\PackageWarning{varioref}}} +% \end{macrocode} +% \begin{macrocode} +\def\vrefshowerrors{\def\vref@err##1{\PackageError{varioref}{##1}% + {Please check the pages in question. You might need to replace + the \string\vref\MessageBreak + or \noexpand\vpageref by a normal \noexpand\(page)ref to + stop LaTeX running forever.}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\vref} +% We start by scanning for a star form and then continue in a +% different macro depending on the result. +% \changes{v1.3a}{2001/04/12}{Scan for star form} +% \changes{v1.6a}{2019/08/25}{Adjusted for new spacing regime} +% \begin{macrocode} +\DeclareRobustCommand\vref{\@ifstar + {\vref@star}{\vr@f}} +% \end{macrocode} +% \end{macro} + + + +% \begin{macro}{\vref@star} +% +% The star form is easy (and just a convenient shortcut), just call +% |\ref| followed by |\vpageref| and pass the optional argument to +% the latter. We don't support the second optional argument of +% |\vpageref|, it that is needed one has to call both commands +% explicitly +% \changes{v1.6a}{2019/08/25}{Command added to support hyperref better} +% \begin{macrocode} +\newcommand\vref@star[2][]{% + \ref{#2} + \vpageref[#1]{#2}} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\vr@f} +% The normal case is a little bit more elaborated \ldots +% \changes{v1.3c}{2001/09/04}{Correct typo in name} +% \changes{v1.6a}{2019/08/25}{Adjusted for new spacing regime} +% \begin{macrocode} +\def\vr@f{% + \leavevmode +% \end{macrocode} +% If option \texttt{space} is used then we remove a preceding space +% and add our own unbreakable space instead. Otherwise we don't do +% any space-handling. +% \begin{macrocode} + \if@vrefhandlespace + \unskip \nobreakspace + \fi +% \end{macrocode} +% The use of|\nobreakspace| or |~| after the |\unskip| means that +% this command will always produce a normal space while +% something like |\nobreak\space| will +% react to settings of |\nonfrenchspacing|. +% Unfortunately the latter will also act in cases where one really +% wants a normal space, e.g., in |Fig.~\vref{..}|, resulting in +% a large extra space after the dot. For this reason the first solution +% is used. +% \changes{v1.1e}{1998/03/09}{Don't use \cs{nobreakspace} (pr/1866)} +% \changes{v1.2a}{1998/11/27}{Use \cs{nobreakspace} (pr/2909)} +% \changes{v1.2a}{1998/11/27}{Add \cs{leavevmode}} +% +% After having handled (or not handled) the spacing we call +% |\vref@star| to scan the optional arguments and do the rest. +% If that command has been altered by \pkg{hyperref} then the +% current one needs altering too and does the argument scanning explicitly. +% \begin{macrocode} + \vref@star % in hyperref this needs to be explicit +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\is@pos@number} +% The utility macro |\is@pos@number| takes three arguments: a +% string that is tested for being a valid non-negative integer and the +% actions to be taken in case the test comes out true or false. +% +% We start by passing the string to the macro |\is@pos@num| after +% prefixing it with a \texttt{0} and adding a space after it. To have +% a well-defined ending point we also add |\@nil| at the end. +%\label{isposnumber} +% \begin{macrocode} +\def\is@pos@number#1{\is@pos@num0#1\space\@nil} +% \end{macrocode} +% Now we parse the enlarged string into a counter register. To get +% control back after everything that is regarded by \TeX{} as a +% number is put into that register we assign |\is@pos@num@| to the +% |\afterassignment| token. Since the string started with 0, we +% can be sure that the register assignment will be carried out +% without an error message. In case of counter assignments leading +% zeros are discarded. +% \begin{macrocode} +\def\is@pos@num{\afterassignment\is@pos@num@ \count@} +% \end{macrocode} +% Now we have to check whether or not the whole string was parsed +% into that register or some remainder was left over. Since we have +% added a |\@nil| token at the very end we can use that to delimit +% the argument of |\is@pos@num@|. Note, that the added space in +% |\is@pos@number| \vpageref[above]{isposnumber} gets parsed away +% by the counter assignment. If it would be missing, and the full +% string would consist of a number, \TeX{}would try to replace +% |\@nil| by its definition to see if it would contain additional +% digits and thus we would be in trouble at this point. +% \begin{macrocode} +\def\is@pos@num@#1\@nil{% +% \end{macrocode} +% Now we have to check if the argument is empty. We can do this +% with an |\ifx| (i.e., in an expandable way) since we know for +% sure that it can not start with |\@nil|. +% \changes{v1.4j}{2004/05/08}{Use \cs{@nil} for testing} +% \begin{macrocode} + \ifx\@nil#1\@nil +% \end{macrocode} +% Depending on the result we execute the second or third argument +% of the command |\is@pos@number| using a technique that removes +% the |\else| or |\fi| from the input stream first, so that in +% principle input stream parsing could be done from within the +% arguments. +% \begin{macrocode} + \expandafter\@firstoftwo \else + \expandafter\@secondoftwo \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\reftextvario} +% This macro gives a little bit of random variation in the text +% because the outcome depends on the number of |\vref| commands +% seen before. +% \begin{macrocode} +\def\reftextvario#1#2{\ifodd\c@vrcnt #1\else#2\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fullref} +% And here is the primitive command that always produces a |\ref| +% and a |\pageref|. +% \begin{macrocode} +\def\fullref#1{\ref{#1} \reftextfaraway{#1}} +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{Supporting ranges} +% +% \begin{macro}{\vref@pagenum} +% \changes{v1.2a}{1998/08/01}{Macro added} +% This command takes a label as |#1| extracts the page number +% associated with it and saves the result in a csname which is +% passed as |#1|. If the label isn't associated with a page number +% it essentially associates it with |??| for both the label number +% and the page, thus defining the label this way. This means that +% no label warning is generated for this label in case it is +% undefined. +% \begin{macrocode} +\def\vref@pagenum#1#2{% + \@ifundefined{r@#2}{\@namedef{r@#2}{{??}{??}}}{}% +% \end{macrocode} +% Extracting and saving the page number turned out to be a source of subtle +% bugs. Initially it was done through an |\edef| with a bunch of +% |\expandafter| commands inside. This posed a problem if the page number +% itself contained code which needed protection (e.g., pr/4080) so this got +% changed to use |\protected@edef|. However, that in turn failed with Babel +% (pr/4093) +% if the label contained active characters, e.g., a ``:'' in French. So now +% we use even more |\expandafter| commands to avoid any expansion other +% than what is absolutely required---I'm sure there is now a simpler way +% to code this, but \ldots\ in fact we didn't use enough initially resulting in another +% bug (pr/4159): +% \changes{v1.4w}{2009/09/13}{Use \cs{protected@edef} to avoid problems +% in complicated setups, e.g., microtype (pr/4080)} +% \changes{v1.4y}{2010/11/12}{Avoid even \cs{protected@edef} to pacify french +% babel (pr/4093)} +% \changes{v1.4z}{2011/10/02}{Previous fix need one more expansion +% (pr/4159,pr/4171)} +% \begin{macrocode} + \expandafter\expandafter\expandafter\vref@@pagenum + \csname r@#2\endcsname{}{}\@nil#1% +} +\def\vref@@pagenum#1#2#3\@nil#4{% + \def#4{#2}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vrefpagenum} +% \changes{v1.2a}{1998/08/01}{Macro added} +% Same as the above but this time we generate a warning for +% undefined labels. +% \begin{macrocode} +\def\vrefpagenum#1#2{% + \@ifundefined{r@#2}% + {\G@refundefinedtrue + \@latex@warning{Reference `#2' on page \thepage \space + undefined}}{}% + \vref@pagenum{#1}{#2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vpagerefrange} +% \begin{macro}{\@vpagerefrange} +% \begin{macro}{\@svpagerefrange} +% \changes{v1.2a}{1998/08/01}{Macro added} +% \changes{v1.3b}{2001/04/14}{Scan for star form} +% \changes{v1.4s}{2007/08/07} +% {Prevent loss of brackets} +% If both labels refer to the same page then we produce a +% |\vpageref|. Otherwise we produce the result of +% |\reftextpagerange|. +% +% One could think of making this command even more clever by +% producing a special string if the difference between the two page +% number is one (but this is not done). +% +% We need two versions to implement a star form: +% \begin{macrocode} +\newcommand\@svpagerefrange[3][\reftextcurrent]{% + \vrefpagenum\@tempa{#2}% + \vrefpagenum\@tempb{#3}% + \ifx\@tempa\@tempb + \vpageref*[{#1}]{#2}% + \else + \reftextpagerange{#2}{#3}% + \fi +} +% \end{macrocode} +% And the same but using |\vpageref|: +% \begin{macrocode} +\newcommand\@vpagerefrange[3][\reftextcurrent]{% + \vrefpagenum\@tempa{#2}% + \vrefpagenum\@tempb{#3}% + \ifx\@tempa\@tempb + \vpageref[{#1}]{#2}% + \else + \reftextpagerange{#2}{#3}% + \fi +} +% \end{macrocode} +% And here we put things together. +% \begin{macrocode} +\newcommand\vpagerefrange{\@ifstar\@svpagerefrange\@vpagerefrange} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\vrefrange} +% \changes{v1.2a}{1998/08/01}{Macro added} +% \changes{v1.4s}{2006/08/07} +% {Prevent loss of brackets} +% \begin{macrocode} +\newcommand\vrefrange[3][\reftextcurrent] + {\reftextlabelrange{#2}{#3} \vpagerefrange[{#1}]{#2}{#3}} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\Vref} +% \changes{v1.4a}{2002/02/24}{Macro added} +% |\Vref| is the counterpart to |\vref| with |\ref| replaced by +% |\Ref| in its definition. +% \changes{v1.6a}{2019/08/25}{Adjusted for new spacing regime} +% \begin{macrocode} +\DeclareRobustCommand\Vref{\@ifstar + {\Vref@star}% + {\Vr@f}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Vref@star} +% \changes{v1.6a}{2019/08/25}{Command added to support hyperref better} +% \begin{macrocode} +\newcommand\Vref@star[2][]{% + \Ref{#2} + \vpageref[#1]{#2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Vr@f} +% \changes{v1.4a}{2002/02/24}{Macro added} +% \changes{v1.4x}{2010/08/04}{Correct spacing -- same mistake as in \cs{vref} +% (pr/4123)} +% \changes{v1.6a}{2019/08/25}{Adjusted for new spacing regime} +% \begin{macrocode} +\def\Vr@f{% + \if@vrefhandlespace + \unskip \vref@space + \fi + \Vref@star % in hyperref this needs to be explicit +} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\vpagerefcompare} +% +% \changes{v1.6a}{2019/08/25}{Macro added} +% \begin{macrocode} +\DeclareRobustCommand\vpagerefcompare[2]{% label1, label2, TRUE, FALSE + \vrefpagenum\@tempa{#1}% + \vrefpagenum\@tempb{#2}% + \ifx\@tempa\@tempb + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\vpagerefnearby} +% \changes{v1.6a}{2019/08/25}{Macro added} +% Test if |\vpageref| is going to be at most $\pm1$ off from +% current page. +% \begin{macrocode} +\DeclareRobustCommand\vpagerefnearby[1]{% label, TRUE, FALSE + \leavevmode + \@tempskipa\lastskip \unskip + \global\advance\c@vrcnt\tw@ % keep oddness to not disturb \vrefvario + \vref@label{\the\c@vrcnt @vn}% + \ifdim\@tempskipa=\z@ \else + \hskip\@tempskipa + \fi + \vref@pagenum\@tempa{\the\c@vrcnt @vn}% + \is@pos@number\@tempa + {% + \vrefpagenum\@tempb{#1}% + \is@pos@number\@tempb + {% + \ifcase\numexpr \@tempa -\@tempb+1\relax + \or \or \else \expandafter \@thirdofthree \fi + \@firstoftwo + }% + {\@secondoftwo}% + }% + {\@secondoftwo}% +} +% \end{macrocode} +% \end{macro} +% + +% \begin{macro}{\vpagerefcomparenearby} +% \changes{v1.6a}{2019/08/25}{Macro added} +% True if the two pages have arabic page numbers are at most off by +% one so that |\vpageref| would produce a special string. +% +% This is n some sense a general version of |\vpagerefnearby| for +% use in more complex situations. I.e., if you try to determine if +% a larger set of references would be close to the current page and +% you use each time |\vpagerefnearby| then you generate a lot of +% internal labels for the current point. Thus by setting the label +% yourself you can save processing time and space. On the other +% hand you have to be careful to place the label into the right +% place which can be a bit complicated if you look at the +% definition of |\vpagerefnearby| that does all this automatically +% for you. This is why the current macro is not discussed in the +% user interface section as it is really just for package +% developers. +% \begin{macrocode} +\DeclareRobustCommand\vpagerefcomparenearby[2]{% label1, label2, TRUE, FALSE + \vrefpagenum\@tempa{#1}% + \is@pos@number\@tempa + {% + \vrefpagenum\@tempb{#2}% + \is@pos@number\@tempb + {% + \ifcase\numexpr \@tempa -\@tempb+1\relax + \or \or \else \expandafter \@thirdofthree \fi + \@firstoftwo + }% + {\@secondoftwo}% + }% + {\@secondoftwo}% +} +% \end{macrocode} +% \end{macro} + +% +% +% \subsubsection{Compatibility with older \LaTeX{} formats} +% +% +% \begin{macro}{\labelformat} +% \begin{macro}{\Ref} +% \begin{macro}{\refstepcounter} +% We don't need to define \cs{labelformat} and \cs{Ref} or change the +% definition of \cs{refstepcounter} any longer because this is now +% done in the \LaTeX{} kernel. However, if this package is used +% together with an older kernel, this is not true, so for this +% special case we keep the definitions. +% \begin{macrocode} +\ifx\labelformat\@undefined % assume we are in an older kernel + \def\labelformat#1{\expandafter\def\csname p@#1\endcsname##1} + \DeclareRobustCommand\Ref[1]{\protected@edef\@tempa{\ref{#1}}% + \expandafter\MakeUppercase\@tempa} + \def\refstepcounter#1{\stepcounter{#1}% + \protected@edef\@currentlabel + {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}} +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% \Finale +% +\endinput + diff --git a/Master/texmf-dist/source/latex-dev/tools/varioref.ins b/Master/texmf-dist/source/latex-dev/tools/varioref.ins new file mode 100644 index 00000000000..e436202e4d0 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/varioref.ins @@ -0,0 +1,76 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright (C) 1993-2019 +%% The LaTeX3 Project and any individual authors listed elsewhere +%% in this file. +%% +%% This file is part of the Standard LaTeX `Tools Bundle'. +%% ------------------------------------------------------- +%% +%% It may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. +%% +%% As this file contains legal notices, it is NOT PERMITTED to modify +%% this file in any way that the legal information placed into +%% generated files is changed (i.e., the files generated when the +%% original file is executed). This restriction does not apply if +%% (parts of) the content is reused in a different WORK producing its +%% own generated files. +%% +%% The list of all files belonging to the `Tools Bundle' is +%% given in the file `manifest.txt'. +%% +%% +%% --------------- start of docstrip commands ------------------ +%% +\input docstrip + +\keepsilent + +\usedir{tex/latex/tools} + +\preamble + +This is a generated file. + +The source is maintained by the LaTeX Project team and bug +reports for it can be opened at https://latex-project.org/bugs/ +(but please observe conditions on bug reports sent to that address!) + +Copyright (C) 1993-2019 +The LaTeX3 Project and any individual authors listed elsewhere +in this file. + +This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. +-------------------------------------------------------------------------- + +It may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in + https://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This file may only be distributed together with a copy of the LaTeX +`Tools Bundle'. You may however distribute the LaTeX `Tools Bundle' +without such generated files. + +The list of all files belonging to the LaTeX `Tools Bundle' is +given in the file `manifest.txt'. + +\endpreamble + + +\generateFile{varioref.sty}{t}{\from{varioref.dtx}{package}} + + +\endbatchfile diff --git a/Master/texmf-dist/source/latex-dev/tools/verbatim.dtx b/Master/texmf-dist/source/latex-dev/tools/verbatim.dtx new file mode 100644 index 00000000000..1dc8682f798 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/verbatim.dtx @@ -0,0 +1,1858 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% +%\iffalse % this is a METACOMMENT ! +% +% +%% Package `verbatim' to use with LaTeX2e +%% Copyright (C) 1989--2003 by Rainer Sch\"opf. All rights reserved. +% +% Copying of this file is authorized only if either +% (1) you make absolutely no changes to your copy, including name, or +% (2) if you do make changes, you name it something other than +% verbatim.dtx. +% This restriction helps ensure that all styles developed here +% remain identical. +% +% +% +% \section{Producing the documentation} +% +% We provide a short driver file that can be extracted by the +% \textsf{DocStrip} program using the conditional `\textsf{driver}'. +% +% \begin{macrocode} +%<*driver> +\documentclass{ltxdoc} + +\pagestyle{myheadings} + +\title{A New Implementation of \LaTeX{}'s \\ \texttt{verbatim} + and \texttt{verbatim*} Environments.} +\author{Rainer Sch\"opf\\ + \and + Bernd Raichle\\ + \and + Chris Rowley} + +\date{2001/03/12} +\begin{document} +\markboth{Verbatim style option}{Verbatim style option} +\MaintainedByLaTeXTeam{tools} +\maketitle + \DocInput{verbatim.dtx} +\end{document} +%</driver> +% \end{macrocode} +% +% +%\fi +% +% +% \changes{v1.5q}{2003/08/22}{Reintroduced \cs{@noligs}, by popular +% request.} +% \changes{v1.5i}{1996/06/04}{Move setting of verbatim font and +% \cs{@noligs}.} +% \changes{v1.5g}{1995/04/26}{Removed \cs{fileversion} and +% \cs{filedate} from running head in +% driver file, as these are no longer +% defined.} +% \changes{v1.5f}{1994/10/25}{Removed extra \cs{typeout} commands.} +% \changes{v1.5e}{1994/06/10}{Added missing closing verbtest guard.} +% \changes{v1.5d}{1994/05/30}{\cs{NeedsTeXFormat} and +% \cs{ProvidesPackage} added.} +% \changes{v1.5d}{1994/05/30}{\cs{addto@hook} removed, now in kernel.} +% \changes{v1.5a}{1993/10/12}{Included \cs{newverbtext} command, as +% written by Chris Rowley.} +% \changes{v1.5}{1993/10/11}{Included vrbinput style option by Bernd +% Raichle.} +% +% \changes{v1.4j}{1992/06/30}{Used \cs{lowercase}\{\cs{endgroup} +% \ldots\} trick proposed by Bernd Raichle; changed all \cs{gdef} +% to \cs{def} since no longer necessary.} +% \changes{v1.4g}{1991/11/21}{Several improvements in the +% documentation.} +% \changes{v1.4f}{1991/08/05}{Corrected bug in documentation. +% Found by Bernd Raichle.} +% \changes{v1.4e}{1991/07/24}{Avoid reading this file twice.} +% \changes{v1.4d}{1991/04/24}{\cs{penalty}\cs{interlinepenalty} added to +% definition of \cs{par} in \cs{@verbatim}. +% Necessary to avoid page breaks in +% the scope of a \cs{samepage} declaration.} +% \changes{v1.4c}{1990/10/18}{Added \cs{leavevmode} to definition of +% backquote macro.} +% \changes{v1.4b}{1990/07/14}{Converted nearly all \cs{verb}'s to +% \texttt{\protect\string!|\ldots\protect\string!|}.} +% \changes{v1.4a}{1990/04/04}{Added a number of percent characters +% to suppress blank space at the end of some code lines.} +% \changes{v1.4}{1990/03/07}{\cs{verb} rewritten.} +% +% \changes{v1.3a}{1990/02/04}{Removed \texttt{verbatimwrite} environment +% from the code. Now only shown as an example.} +% +% \changes{v1.2g}{1990/02/01}{Revised documentation.} +% \changes{v1.2e}{1990/01/15}{Added \cs{every@verbatim} hook.} +% \changes{v1.2d}{1989/11/29}{Use token register \cs{@temptokena} +% instead of macro \cs{@tempb}.} +% \changes{v1.2d}{1989/11/29}{Use token register \cs{verbatim@line} +% instead of macro \cs{@tempd}.} +% \changes{v1.2b}{1989/10/25}{\cs{verbatimfile} renamed to +% \cs{verbatiminput}. Suggested by Reinhard Wonneberger.} +% +% \changes{v1.1a}{1989/10/16}{\cs{verb} added.} +% \changes{v1.1}{1989/10/09}{Made the code more modular (as suggested by +% Chris Rowley): introduced +% \cs{verbatim@addtoline}, etc. Added +% \cs{verbatimwrite} environment.} +% +% \changes{v1.0e}{1989/07/17}{Fixed bug in \cs{verbatimfile} (*-form +% handling, discovered by Dirk Kreimer).} +% \changes{v1.0d}{1989/05/16}{Revised documentation, fixed silly bug +% in \cs{verbatim@@@}.} +% \changes{v1.0c}{1989/05/12}{Added redefinition of \cs{@sverb}, change +% in end-of-line handling.} +% \changes{v1.0b}{1989/05/09}{Change in \cs{verbatim@rescan}.} +% \changes{v1.0a}{1989/05/07}{Change in \cs{verbatim@@testend}.} +% +% +% \DoNotIndex{\ ,\!,\C,\[,\\,\],\^,\`,\{,\},\~} +% \DoNotIndex{\@M,\@empty,\@flushglue,\@gobble,\@ifstar,\@ifundefined} +% \DoNotIndex{\@namedef,\@spaces,\@tempa,\@tempb,\@tempc,\@tempd} +% \DoNotIndex{\@temptokena,\@totalleftmargin,\@warning,\active} +% \DoNotIndex{\aftergroup,\arabic,\begingroup,\catcode,\char,\closein} +% \DoNotIndex{\csname,\def,\do,\docdate,\dospecials,\edef,\else} +% \DoNotIndex{\endcsname,\endgraf,\endgroup,\endinput,\endlinechar} +% \DoNotIndex{\endtrivlist,\expandafter,\fi,\filedate,\fileversion} +% \DoNotIndex{\frenchspacing,\futurelet,\if,\ifcat,\ifeof,\ifnum} +% \DoNotIndex{\ifx,\immediate,\item,\kern,\lccode,\leftskip,\let} +% \DoNotIndex{\lowercase,\m@ne,\makeatletter,\makeatother,\newread} +% \DoNotIndex{\newread,\next,\noexpand,\noindent,\openin,\parfillskip} +% \DoNotIndex{\parindent,\parskip,\penalty,\read,\relax,\rightskip} +% \DoNotIndex{\sloppy,\space,\string,\the,\toks@,\trivlist,\tt,\typeout} +% \DoNotIndex{\vskip,\write,\z@} +% +% \begin{abstract} +% This package reimplements the \LaTeX{} \texttt{verbatim} and +% \texttt{verbatim*} environments. +% In addition it provides a \texttt{comment} environment +% that skips any commands or text between +% |\begin{comment}| +% and the next |\end{comment}|. +% It also defines the command \texttt{verbatiminput} to input a whole +% file verbatim. +% \end{abstract} +% +% \section{Usage notes} +% +% \let\docDescribeMacro\DescribeMacro +% \let\docDescribeEnv\DescribeEnv +% \def\DescribeMacro#1{} +% \def\DescribeEnv#1{} +% \LaTeX's \texttt{verbatim} and \texttt{verbatim*} environments +% have a few features that may give rise to problems. These are: +% \begin{itemize} +% \item +% Due to the method used to detect the closing |\end{verbatim}| +% (i.e.\ macro parameter delimiting) you cannot leave spaces +% between the |\end| token and |{verbatim}|. +% \item +% Since \TeX{} has to read all the text between the +% |\begin{verbatim}| and the |\end{verbatim}| before it can output +% anything, long verbatim listings may overflow \TeX's memory. +% \end{itemize} +% Whereas the first of these points can be considered +% only a minor nuisance the other one is a real limitation. +% +% +% \DescribeEnv{verbatim} +% \DescribeEnv{verbatim*} +% This package file contains a reimplementation of the \texttt{verbatim} +% and \texttt{verbatim*} environments which overcomes these +% restrictions. +% There is, however, one incompatibility between the old and the +% new implementations of these environments: the old version +% would treat text on the same line as the |\end{verbatim}| +% command as if it were on a line by itself. +% \begin{center} +% \bf This new version will simply ignore it. +% \end{center} +% (This is the price one has to pay for the removal of the old +% \texttt{verbatim} environment's size limitations.) +% It will, however, issue a warning message of the form +% \begin{verbatim} +%LaTeX warning: Characters dropped after \end{verbatim*}! +%\end{verbatim} +% This is not a real problem since this text can easily be put +% on the next line without affecting the output. +% +% This new implementation also solves the second problem mentioned +% above: it is possible to leave spaces (but \emph{not} begin a new +% line) between the |\end| and the |{verbatim}| or |{verbatim*}|: +% \begin{verbatim} +%\begin {verbatim*} +% test +% test +%\end {verbatim*} +%\end{verbatim} +% +% \DescribeEnv{comment} +% Additionally we introduce a \texttt{comment} environment, with the +% effect that the text between |\begin{comment}| and |\end{comment}| +% is simply ignored, regardless of what it looks like. +% At first sight this seems to be quite different from the purpose +% of verbatim listing, but actually the implementation of these two +% concepts turns out to be very similar. +% Both rely on the fact that the text between |\begin{...}| and +% |\end{...}| is read by \TeX{} without interpreting any commands or +% special characters. +% The remaining difference between \texttt{verbatim} and +% \texttt{comment} is only that the text is to be typeset in the +% first case and to be thrown away in the latter. Note that these +% environments cannot be nested. +% +% \DescribeMacro{\verbatiminput} +% |\verbatiminput| is a command with one argument that inputs a file +% verbatim, i.e.\ the command |verbatiminput{xx.yy}| +% has the same effect as\\[2pt] +% \hspace*{\MacroIndent}|\begin{verbatim}|\\ +% \hspace*{\MacroIndent}\meta{Contents of the file \texttt{xx.yy}}\\ +% \hspace*{\MacroIndent}|\end{verbatim}|\\[2pt] +% This command has also a |*|-variant that prints spaces as \verb*+ +. +% +% +% \StopEventually{} +% +% +% \section{Interfaces for package writers} +% +% The \texttt{verbatim} environment of \LaTeXe{} does not +% offer a good interface to programmers. +% In contrast, this package provides a simple mechanism to +% implement similar features, the \texttt{comment} environment +% implemented here being an example of what can be done and how. +% +% +% \subsection{Simple examples} +% +% It is now possible to use the \texttt{verbatim} environment to define +% environments of your own. +% E.g., +%\begin{verbatim} +% \newenvironment{myverbatim}% +% {\endgraf\noindent MYVERBATIM:% +% \endgraf\verbatim}% +% {\endverbatim} +%\end{verbatim} +% can be used afterwards like the \texttt{verbatim} environment, i.e. +% \begin{verbatim} +%\begin {myverbatim} +% test +% test +%\end {myverbatim} +%\end{verbatim} +% Another way to use it is to write +% \begin{verbatim} +%\let\foo=\comment +%\let\endfoo=\endcomment +%\end{verbatim} +% and from that point on environment \texttt{foo} is the same as the +% comment environment, i.e.\ everything inside its body is ignored. +% +% You may also add special commands after the |\verbatim| macro is +% invoked, e.g. +%\begin{verbatim} +%\newenvironment{myverbatim}% +% {\verbatim\myspecialverbatimsetup}% +% {\endverbatim} +%\end{verbatim} +% though you may want to learn about the hook |\every@verbatim| at +% this point. +% \changes{v1.5h}{1995/09/21}{Clarified documentation on use of other +% environments to define new verbatim-type ones.} +% However, there are still a number of restrictions: +% \begin{enumerate} +% \item +% You must not use the |\begin| or the |\end| command inside a +% definition, e.g.~the following two examples will \emph{not} work: +%\begin{verbatim*} +%\newenvironment{myverbatim}% +%{\endgraf\noindent MYVERBATIM:% +% \endgraf\begin{verbatim}}% +%{\end{verbatim}} +%\newenvironment{fred} +%{\begin{minipage}{30mm}\verbatim} +%{\endverbatim\end{minipage}} +%\end{verbatim*} +% If you try these examples, \TeX{} will report a +% ``runaway argument'' error. +% More generally, it is not possible to use +% |\begin|\ldots\allowbreak|\end| +% or the related environments in the definition of the new +% environment. Instead, the correct way to define this environment +% would be +% \begin{verbatim*} +%\newenvironment{fred} +%{\minipage{30mm}\verbatim} +%{\endverbatim\endminipage} +%\end{verbatim*} +% \item +% You can\emph{not} use the \texttt{verbatim} environment inside +% user defined \emph{commands}; e.g., +% \changes{v1.4g}{1991/11/21}{Corrected wrong position of optional +% argument to \cs{newcommand}. Discovered by Piet van Oostrum.} +% \begin{verbatim*} +%\newcommand{\verbatimfile}[1]% +% {\begin{verbatim}\input{#1}\end{verbatim}} +%\end{verbatim*} +% does \emph{not} work; nor does +% \begin{verbatim} +%\newcommand{\verbatimfile}[1]{\verbatim\input{#1}\endverbatim} +%\end{verbatim} +% \item The name of the newly defined environment must not contain +% characters with category code other than $11$ (letter) or +% $12$ (other), or this will not work. +% \end{enumerate} +% +% +% \subsection{The interfaces} +% +% \DescribeMacro{\verbatim@font} +% Let us start with the simple things. +% Sometimes it may be necessary to use a special typeface for your +% verbatim text, or perhaps the usual computer modern typewriter shape +% in a reduced size. +% +% You may select this by redefining the macro |\verbatim@font|. +% This macro is executed at the beginning of every verbatim text to +% select the font shape. +% Do not use it for other purposes; if you find yourself abusing this +% you may want to read about the |\every@verbatim| hook below. +% +% By default, |\verbatim@font| switches to the typewriter font and +% disables the ligatures contained therein. +% +% +% \DescribeMacro{\every@verbatim} +% \DescribeMacro{\addto@hook} +% There is a hook (i.e.\ a token register) called |\every@verbatim| +% whose contents are inserted into \TeX's mouth just before every +% verbatim text. +% Please use the |\addto@hook| macro to add something to this hook. +% It is used as follows:\\[2pt] +% \hspace*{\MacroIndent}|\addto@hook|\meta{name of the hook}^^A +% |{|\meta{commands to be added}|}| +% \vspace*{2pt} +% +% +% +% \DescribeMacro{\verbatim@start} +% After all specific setup, like switching of category codes, has been +% done, the |\verbatim@start| macro is called. +% This starts the main loop of the scanning mechanism implemented here. +% Any other environment that wants to make use of this feature should +% execute this macro as its last action. +% +% +% \DescribeMacro{\verbatim@startline} +% \DescribeMacro{\verbatim@addtoline} +% \DescribeMacro{\verbatim@processline} +% \DescribeMacro{\verbatim@finish} +% These are the things that concern the start of a verbatim +% environment. +% Once this (and other) setup has been done, the code in this package +% reads and processes characters from the input stream in the +% following way: +% \begin{enumerate} +% \item Before the first character of an input line is read, it +% executes the macro |\verbatim@startline|. +% \item After some characters have been read, the macro +% |\verbatim@addtoline| is called with these characters as its only +% argument. +% This may happen several times per line (when an |\end| command is +% present on the line in question). +% \item When the end of the line is reached, the macro +% |\verbatim@processline| is called to process the characters that +% |\verbatim@addtoline| has accumulated. +% \item Finally, there is the macro |\verbatim@finish| that is called +% just before the environment is ended by a call to the |\end| +% macro. +% \end{enumerate} +% +% +% To make this clear let us consider the standard \texttt{verbatim} +% environment. +% In this case the three macros above are defined as follows: +% \begin{enumerate} +% \item |\verbatim@startline| clears the character buffer +% (a token register). +% \item |\verbatim@addtoline| adds its argument to the character +% buffer. +% \item |\verbatim@processline| typesets the characters accumulated +% in the buffer. +% \end{enumerate} +% With this it is very simple to implement the \texttt{comment} +% environment: +% in this case |\verbatim@startline| and |\verbatim@processline| are +% defined to be +% no-ops whereas |\verbatim@addtoline| discards its argument. +% +% +% Let's use this to define a variant of the |verbatim| +% environment that prints line numbers in the left margin. +% Assume that this would be done by a counter called |VerbatimLineNo|. +% Assuming that this counter was initialized properly by the +% environment, |\verbatim@processline| would be defined in this case as +% \begin{verbatim} +%\def\verbatim@processline{% +% \addtocounter{VerbatimLineNo}{1}% +% \leavevmode +% \llap{\theVerbatimLineNo\ \hskip\@totalleftmargin}% +% \the\verbatim@line\par} +%\end{verbatim} +% +% A further possibility is to define a variant of the |verbatim| +% environment that boxes and centers the whole verbatim text. +% Note that the boxed text should be less than a page otherwise you +% have to change this example. +% +%\begin{verbatim} +%\def\verbatimboxed#1{\begingroup +% \def\verbatim@processline{% +% {\setbox0=\hbox{\the\verbatim@line}% +% \hsize=\wd0 +% \the\verbatim@line\par}}% +% \setbox0=\vbox{\parskip=0pt\topsep=0pt\partopsep=0pt +% \verbatiminput{#1}}% +% \begin{center}\fbox{\box0}\end{center}% +% \endgroup} +%\end{verbatim} +% +% As a final nontrivial example we describe the definition of an +% environment called \texttt{verbatimwrite}. +% It writes all text in its body to a file whose name is +% given as an argument. +% We assume that a stream number called |\verbatim@out| has already +% been reserved by means of the |\newwrite| macro. +% +% Let's begin with the definition of the macro |\verbatimwrite|. +% \begin{verbatim} +%\def\verbatimwrite#1{% +%\end{verbatim} +% First we call |\@bsphack| so that this environment does not influence +% the spacing. +% Then we open the file and set the category codes of all special +% characters: +% \begin{verbatim} +% \@bsphack +% \immediate\openout \verbatim@out #1 +% \let\do\@makeother\dospecials +% \catcode`\^^M\active +%\end{verbatim} +% The default definitions of the macros +% \begin{verbatim} +% \verbatim@startline +% \verbatim@addtoline +% \verbatim@finish +%\end{verbatim} +% are also used in this environment. +% Only the macro |\verbatim@processline| has to be changed before +% |\verbatim@start| is called: +% \begin{verbatim} +% \def\verbatim@processline{% +% \immediate\write\verbatim@out{\the\verbatim@line}}% +% \verbatim@start} +%\end{verbatim} +% The definition of |\endverbatimwrite| is very simple: +% we close the stream and call |\@esphack| to get the spacing right. +% \begin{verbatim} +%\def\endverbatimwrite{\immediate\closeout\verbatim@out\@esphack} +%\end{verbatim} +% +% \section{The implementation} +% +% \let\DescribeMacro\docDescribeMacro +% \let\DescribeEnv\docDescribeEnv +% +% \changes{v1.4e}{1991/07/24}{Avoid reading this file twice.} +% The very first thing we do is to ensure that this file is not read +% in twice. To this end we check whether the macro |\verbatim@@@| is +% defined. If so, we just stop reading this file. The `package' +% guard here allows most of the code to be excluded when extracting +% the driver file for testing this package. +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{verbatim} + [2014/10/28 v1.5q LaTeX2e package for verbatim enhancements] +\@ifundefined{verbatim@@@}{}{\endinput} +% \end{macrocode} +% +% We use a mechanism similar to the one implemented for the +% |\comment|\ldots\allowbreak|\endcomment| macro in \AmSTeX: +% We input one line at a time and check if it contains the |\end{...}| +% tokens. +% Then we can decide whether we have reached the end of the verbatim +% text, or must continue. +% +% +% \subsection{Preliminaries} +% +% \begin{macro}{\every@verbatim} +% The hook (i.e.\ token register) |\every@verbatim| +% is initialized to \meta{empty}. +% \begin{macrocode} +\newtoks\every@verbatim +\every@verbatim={} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@makeother} +% \changes{v1.1a}{1989/10/16}{\cs{@makeother} added.} +% |\@makeother| takes as argument a character and changes +% its category code to $12$ (other). +% \begin{macrocode} +\def\@makeother#1{\catcode`#112\relax} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@vobeyspaces} +% \changes{v1.5}{1993/10/11}{Changed definition to not use \cs{gdef}.} +% \changes{v1.1a}{1989/10/16}{\cs{@vobeyspaces} added.} +% The macro |\@vobeyspaces| causes spaces in the input +% to be printed as spaces in the output. +% \begin{macrocode} +\begingroup + \catcode`\ =\active% + \def\x{\def\@vobeyspaces{\catcode`\ \active\let \@xobeysp}} + \expandafter\endgroup\x +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@xobeysp} +% \changes{v1.1a}{1989/10/16}{\cs{@xobeysp} added.} +% The macro |\@xobeysp| produces exactly one space in +% the output, protected against breaking just before it. +% (|\@M| is an abbreviation for the number $10000$.) +% \begin{macrocode} +\def\@xobeysp{\leavevmode\penalty\@M\ } +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\verbatim@line} +% \changes{v1.2d}{1989/11/29}{Introduced token register +% \cs{verbatim@line}.} +% We use a newly defined token register called |\verbatim@line| +% that will be used as the character buffer. +% \begin{macrocode} +\newtoks\verbatim@line +% \end{macrocode} +% \end{macro} +% +% The following four macros are defined globally in a way suitable for +% the \texttt{verbatim} and \texttt{verbatim*} environments. +% \begin{macro}{\verbatim@startline} +% \begin{macro}{\verbatim@addtoline} +% \begin{macro}{\verbatim@processline} +% |\verbatim@startline| initializes processing of a line +% by emptying the character buffer (|\verbatim@line|). +% \begin{macrocode} +\def\verbatim@startline{\verbatim@line{}} +% \end{macrocode} +% |\verbatim@addtoline| adds the tokens in its argument +% to our buffer register |\verbatim@line| without expanding +% them. +% \begin{macrocode} +\def\verbatim@addtoline#1{% + \verbatim@line\expandafter{\the\verbatim@line#1}} +% \end{macrocode} +% Processing a line inside a \texttt{verbatim} or \texttt{verbatim*} +% environment means printing it. +% \changes{v1.2c}{1989/10/31}{Changed \cs{@@par} to \cs{par} in +% \cs{verbatim@processline}. Removed \cs{leavevmode} and \cs{null} +% (i.e.\ the empty \cs{hbox}).} +% Ending the line means that we have to begin a new paragraph. +% We use |\par| for this purpose. Note that |\par| +% is redefined in |\@verbatim| to force \TeX{} into horizontal +% mode and to insert an empty box so that empty lines in the input +% do appear in the output. +% \changes{v1.2f}{1990/01/31}{\cs{verbatim@startline} removed.} +% \begin{macrocode} +\def\verbatim@processline{\the\verbatim@line\par} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\verbatim@finish} +% As a default, |\verbatim@finish| processes the remaining +% characters. +% When this macro is called we are facing the following problem: +% when the |\end{verbatim}| +% command is encountered |\verbatim@processline| is called +% to process the characters preceding the command on the same +% line. If there are none, an empty line would be output if we +% did not check for this case. +% +% If the line is empty |\the\verbatim@line| expands to +% nothing. To test this we use a trick similar to that on p.\ 376 +% of the \TeX{}book, but with |$|\ldots|$| instead of +% the |!| tokens. These |$| tokens can never have the same +% category code as a |$| token that might possibly appear in the +% token register |\verbatim@line|, as such a token will always have +% been read with category code $12$ (other). +% Note that |\ifcat| expands the following tokens so that +% |\the\verbatim@line| is replaced by the accumulated +% characters +% \changes{v1.2d}{1989/11/29}{Changed \cs{ifx} to \cs{ifcat} test.} +% \changes{v1.1b}{1989/10/18}{Corrected bug in if test (found by CRo).} +% \begin{macrocode} +\def\verbatim@finish{\ifcat$\the\verbatim@line$\else + \verbatim@processline\fi} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{The \texttt{verbatim} and \texttt{verbatim*} environments} +% +% \begin{macro}{\verbatim@font} +% \changes{v1.2f}{1990/01/31}{\cs{@lquote} macro removed.} +% \changes{v1.1b}{1989/10/18}{\cs{@noligs} removed. Code inserted +% directly into \cs{verbatim@font}.} +% \changes{v1.1a}{1989/10/16}{\cs{verbatim@font} added.} +% \changes{v1.1a}{1989/10/16}{\cs{@noligs} added.} +% \changes{v1.1a}{1989/10/16}{\cs{@lquote} added.} +% We start by defining the macro |\verbatim@font| that is +% to select the font and to set font-dependent parameters. +% Then we expand |\@noligs| (defined in the \LaTeXe{} kernel). Among +% possibly other things, it will go through |\verbatim@nolig@list| +% to avoid certain ligatures. +% |\verbatim@nolig@list| is a macro defined in the \LaTeXe{} kernel +% to expand to +% \begin{verbatim} +% \do\`\do\<\do\>\do\,\do\'\do\- +%\end{verbatim} +% All the characters in this list can be part of a ligature in some +% font or other. +% \changes{v1.2f}{1990/01/31}{\cs{@lquote} macro removed.} +% \changes{v1.4c}{1990/10/18}{Added \cs{leavevmode}.} +% \changes{v1.4k}{1992/07/13}{Replaced Blank after $96$ by \cs{relax}. +% (Proposed by Dan Dill.)} +% \changes{v1.5}{1993/10/11}{Definition changed according to new code +% in latex.tex and to avoid global definition.} +% \changes{v1.5c}{1994/02/07}{Changed to use new font switching +% commands.} +% \changes{v1.5m}{2000/01/07}{Disable hyphenation even if the font +% allows it.} +% \changes{v1.5q}{2003/08/22}{Use \cs{@noligs}, as it is by now properly +% defined in the \LaTeXe{} kernel.} +% \begin{macrocode} +\def\verbatim@font{\normalfont\ttfamily + \hyphenchar\font\m@ne + \@noligs} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@verbatim} +% \changes{v1.1a}{1989/10/16}{\cs{@verbatim} added.} +% The macro |\@verbatim| sets up things properly. +% First of all, the tokens of the |\every@verbatim| hook +% are inserted. +% Then a \texttt{trivlist} environment is started and its first +% |\item| command inserted. +% Each line of the \texttt{verbatim} or \texttt{verbatim*} +% environment will be treated as a separate paragraph. +% \changes{v1.2e}{1990/01/15}{Added \cs{every@verbatim} hook.} +% \changes{v1.5b}{1994/01/24}{Removed optional argument of \cs{item}.} +% \begin{macrocode} +\def\@verbatim{\the\every@verbatim + \trivlist \item \relax +% \end{macrocode} +% \changes{v1.5b}{1994/01/24}{Set \texttt{@inlabel} switch to false.} +% \changes{v1.5f}{1994/10/25}{Removed setting of \texttt{@inlabel} +% switch again.} +% \changes{v1.3c}{1990/02/26}{Removed extra vertical space. +% Suggested by Frank Mittelbach.} +% \changes{v1.5h}{1995/09/21}{Added the space again, since it is +% necessary for correct vertical spacing if \texttt{verbatim} +% is nested inside \texttt{quote}.} +% The following extra vertical space is for compatibility with the +% \LaTeX kernel: otherwise, using the |verbatim| package changes +% the vertical spacing of a |verbatim| environment nested within a +% |quote| environment. +% \begin{macrocode} + \if@minipage\else\vskip\parskip\fi +% \end{macrocode} +% \changes{v1.4k}{1992/07/13}{Added setting for +% \cs{@beginparpenalty}. Suggested by Frank Mittelbach.} +% The paragraph parameters are set appropriately: +% the penalty at the beginning of the environment, +% left and right margins, paragraph indentation, the glue to +% fill the last line, and the vertical space between paragraphs. +% The latter space has to be zero since we do not want to add +% extra space between lines. +% \begin{macrocode} + \@beginparpenalty \predisplaypenalty + \leftskip\@totalleftmargin\rightskip\z@ + \parindent\z@\parfillskip\@flushglue\parskip\z@ +% \end{macrocode} +% \changes{v1.1b}{1989/10/18}{Added resetting of \cs{parshape} +% if at beginning of a list. +% (Problem pointed out by Chris Rowley.)} +% There's one point to make here: +% the \texttt{list} environment uses \TeX's |\parshape| +% primitive to get a special indentation for the first line +% of the list. +% If the list begins with a \texttt{verbatim} environment +% this |\parshape| is still in effect. +% Therefore we have to reset this internal parameter explicitly. +% We could do this by assigning $0$ to |\parshape|. +% However, there is a simpler way to achieve this: +% we simply tell \TeX{} to start a new paragraph. +% As is explained on p.~103 of the \TeX{}book, this resets +% |\parshape| to zero. +% \changes{v1.1c}{1989/10/19}{Replaced explicit resetting of +% \cs{parshape} by \cs{@@par}.} +% \begin{macrocode} + \@@par +% \end{macrocode} +% We now ensure that |\par| has the correct definition, +% namely to force \TeX{} into horizontal mode +% and to include an empty box. +% This is to ensure that empty lines do appear in the output. +% Afterwards, we insert the |\interlinepenalty| since \TeX{} +% does not add a penalty between paragraphs (here: lines) +% by its own initiative. Otherwise a |verbatim| environment +% could be broken across pages even if a |\samepage| +% declaration were present. +% +% However, in a top-aligned minipage, this will result in an extra +% empty line added at the top. Therefore, a slightly more +% complicated construct is necessary. +% One of the important things here is the inclusion of +% |\leavevmode| as the first macro in the first line, for example, +% a blank verbatim line is the first thing in a list item. +% \changes{v1.2c}{1989/10/31}{Definition of \cs{par} added. +% Ensures identical behaviour for +% verbatim and \cs{verbatiminput}. +% Problem pointed out by Chris.} +% \changes{v1.4d}{1991/04/24}{\cs{penalty}\cs{interlinepenalty} added. +% Necessary to avoid page breaks in +% the scope of a \cs{samepage} declaration.} +% \changes{v1.5b}{1994/01/24}{Improved definition of \cs{par} to work +% under all circumstances.} +% \changes{v1.5f}{1994/10/25}{\cs{leavevmode} added for first line.} +% \begin{macrocode} + \def\par{% + \if@tempswa + \leavevmode\null\@@par\penalty\interlinepenalty + \else + \@tempswatrue + \ifhmode\@@par\penalty\interlinepenalty\fi + \fi}% +% \end{macrocode} +% But to avoid an error message when the environment +% doesn't contain any text, we redefine |\@noitemerr| +% which will in this case be called by |\endtrivlist|. +% \changes{v1.4j}{1992/06/30}{Introduced warning instead of error +% for empty body of verbatim text. +% Suggested by Nelson Beebe.} +% \begin{macrocode} + \def\@noitemerr{\@warning{No verbatim text}}% +% \end{macrocode} +% Now we call |\obeylines| to make the end of line character +% active, +% \begin{macrocode} + \obeylines +% \end{macrocode} +% change the category code of all special characters, +% to $12$ (other). +% \changes{v1.5i}{1996/06/04}{Moved \cs{verbatim@font} after +% \cs{dospecials}.} +% \begin{macrocode} + \let\do\@makeother \dospecials +% \end{macrocode} +% and switch to the font to be used. +% \begin{macrocode} + \verbatim@font +% \end{macrocode} +% To avoid a breakpoint after the labels box, we remove the penalty +% put there by the list macros: another use of |\unpenalty|! +% \changes{v1.5f}{1994/10/25}{Change to \cs{everypar} added.} +% \begin{macrocode} + \everypar \expandafter{\the\everypar \unpenalty}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\verbatim} +% \begin{macro}{\verbatim*} +% Now we define the toplevel macros. +% |\verbatim| is slightly changed: +% after setting up things properly it calls +% |\verbatim@start|. +% \changes{v1.5l}{1999/12/14}{Added \cs{begingroup} for cases where +% \cs{verbatim} is used directly, rather than in \cs{begin}: see +% pr/3115.} +% This is done inside a group, so that |\verbatim| can be used +% directly, without |\begin|. +% \begin{macrocode} +\def\verbatim{\begingroup\@verbatim \frenchspacing\@vobeyspaces + \verbatim@start} +% \end{macrocode} +% |\verbatim*| is defined accordingly. +% \begin{macrocode} +\@namedef{verbatim*}{\begingroup\@verbatim\verbatim@start} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\endverbatim} +% \begin{macro}{\endverbatim*} +% To end the \texttt{verbatim} and \texttt{verbatim*} +% environments it is only necessary to finish the +% \texttt{trivlist} environment started in |\@verbatim| and +% close the corresponding group. +% \changes{v1.5l}{1999/12/14}{Added \cs{endgroup} for cases where +% \cs{endverbatim} is used directly, rather than in \cs{end}: see +% pr/3115.} +% \changes{v1.5n}{2000/08/03}{Added \cs{@endpetrue}: needed when +% faking such a \cs{end} (pr/3234).} +% \changes{v1.5o}{2000/08/23}{Changed \cs{@endpetrue} to \cs{@doendpe}: +% see (pr/3234).} +% \begin{macrocode} +\def\endverbatim{\endtrivlist\endgroup\@doendpe} +\expandafter\let\csname endverbatim*\endcsname =\endverbatim +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \subsection{The \texttt{comment} environment} +% +% \begin{macro}{\comment} +% \begin{macro}{\endcomment} +% \changes{v1.1c}{1989/10/19}{Added \cs{@bsphack}/\cs{@esphack} to the +% \texttt{comment} environment. Suggested by Chris Rowley.} +% The |\comment| macro is similar to |\verbatim*|. +% However, we do not need to switch fonts or set special +% formatting parameters such as |\parindent| or |\parskip|. +% We need only set the category code of all special characters +% to $12$ (other) and that of |^^M| (the end of line character) +% to $13$ (active). +% The latter is needed for macro parameter delimiter matching in +% the internal macros defined below. +% In contrast to the default definitions used by the +% |\verbatim| and |\verbatim*| macros, +% we define |\verbatim@addtoline| to throw away its argument +% and |\verbatim@processline|, |\verbatim@startline|, +% and |\verbatim@finish| to act as no-ops. +% Then we call |\verbatim@|. +% But the first thing we do is to call |\@bsphack| so that +% this environment has no influence whatsoever upon the spacing. +% \changes{v1.1c}{1989/10/19}{Changed \cs{verbatim@start} to +% \cs{verbatim@}. Suggested by Chris Rowley.} +% \changes{v1.1c}{1989/10/19}{\cs{verbatim@startline} and +% \cs{verbatim@finish} are now +% also redefined to do nothing.} +% \begin{macrocode} +\def\comment{\@bsphack + \let\do\@makeother\dospecials\catcode`\^^M\active + \let\verbatim@startline\relax + \let\verbatim@addtoline\@gobble + \let\verbatim@processline\relax + \let\verbatim@finish\relax + \verbatim@} +% \end{macrocode} +% |\endcomment| is very simple: it only calls +% |\@esphack| to take care of the spacing. +% The |\end| macro closes the group and therefore takes care +% of restoring everything we changed. +% \begin{macrocode} +\let\endcomment=\@esphack +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% \subsection{The main loop} +% +% Here comes the tricky part: +% During the definition of the macros we need to use the special +% characters |\|, |{|, and |}| not only with their +% normal category codes, +% but also with category code $12$ (other). +% We achieve this by the following trick: +% first we tell \TeX{} that |\|, |{|, and |}| +% are the lowercase versions of |!|, |[|, and |]|. +% Then we replace every occurrence of |\|, |{|, and |}| +% that should be read with category code $12$ by |!|, |[|, +% and |]|, respectively, +% and give the whole list of tokens to |\lowercase|, +% knowing that category codes are not altered by this primitive! +% +% But first we have ensure that +% |!|, |[|, and |]| themselves have +% the correct category code! +% \changes{v1.3b}{1990/02/07}{Introduced \cs{vrb@catcodes} instead +% of explicit setting of category codes.} +% To allow special settings of these codes we hide their setting in +% the macro |\vrb@catcodes|. If it is already defined our new +% definition is skipped. +% \begin{macrocode} +\@ifundefined{vrb@catcodes}% + {\def\vrb@catcodes{% + \catcode`\!12\catcode`\[12\catcode`\]12}}{} +% \end{macrocode} +% This trick allows us to use this code for applications where other +% category codes are in effect. +% +% We start a group to keep the category code changes local. +% \begin{macrocode} +\begingroup + \vrb@catcodes + \lccode`\!=`\\ \lccode`\[=`\{ \lccode`\]=`\} +% \end{macrocode} +% \changes{v1.2f}{1990/01/31}{Code for TABs removed.} +% We also need the end-of-line character |^^M|, +% as an active character. +% If we were to simply write |\catcode`\^^M=\active| +% then we would get an unwanted active end of line character +% at the end of every line of the following macro definitions. +% Therefore we use the same trick as above: +% we write a tilde |~| instead of |^^M| and +% pretend that the +% latter is the lowercase variant of the former. +% Thus we have to ensure now that the tilde character has +% category code $13$ (active). +% \begin{macrocode} + \catcode`\~=\active \lccode`\~=`\^^M +% \end{macrocode} +% The use of the |\lowercase| primitive leads to one problem: +% the uppercase character `|C|' needs to be used in the +% code below and its case must be preserved. +% So we add the command: +% \begin{macrocode} + \lccode`\C=`\C +% \end{macrocode} +% Now we start the token list passed to |\lowercase|. +% We use the following little trick (proposed by Bernd Raichle): +% The very first token in the token list we give to |\lowercase| is +% the |\endgroup| primitive. This means that it is processed by +% \TeX{} immediately after |\lowercase| has finished its operation, +% thus ending the group started by |\begingroup| above. This avoids +% the global definition of all macros. +% \begin{macrocode} + \lowercase{\endgroup +% \end{macrocode} +% \begin{macro}{\verbatim@start} +% The purpose of |\verbatim@start| is to check whether there +% are any characters on the same line as the |\begin{verbatim}| +% and to pretend that they were on a line by themselves. +% On the other hand, if there are no characters remaining +% on the current line we shall just find an end of line character. +% |\verbatim@start| performs its task by first grabbing the +% following character (its argument). +% This argument is then compared to an active |^^M|, +% the end of line character. +% \begin{macrocode} + \def\verbatim@start#1{% + \verbatim@startline + \if\noexpand#1\noexpand~% +% \end{macrocode} +% If this is true we transfer control to |\verbatim@| +% to process the next line. We use +% |\next| as the macro which will continue the work. +% \begin{macrocode} + \let\next\verbatim@ +% \end{macrocode} +% Otherwise, we define |\next| to expand to a call +% to |\verbatim@| followed by the character just +% read so that it is reinserted into the text. +% This means that those characters remaining on this line +% are handled as if they formed a line by themselves. +% \begin{macrocode} + \else \def\next{\verbatim@#1}\fi +% \end{macrocode} +% Finally we call |\next|. +% \begin{macrocode} + \next}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\verbatim@} +% The three macros |\verbatim@|, |\verbatim@@|, +% and |\verbatim@@@| form the ``main loop'' of the +% \texttt{verbatim} environment. +% The purpose of |\verbatim@| is to read exactly one line +% of input. +% |\verbatim@@| and |\verbatim@@@| work together to +% find out whether the four characters +% |\end| (all with category code $12$ (other)) occur in that +% line. +% If so, |\verbatim@@@| will call +% |\verbatim@test| to check whether this |\end| is +% part of |\end{verbatim}| and will terminate the environment +% if this is the case. +% Otherwise we continue as if nothing had happened. +% So let's have a look at the definition of |\verbatim@|: +% \changes{v1.1a}{1989/10/16}{Replaced \cs{verbatim@@@} by \cs{@nil}.} +% \begin{macrocode} + \def\verbatim@#1~{\verbatim@@#1!end\@nil}% +% \end{macrocode} +% Note that the |!| character will have been replaced by a +% |\| with category code $12$ (other) by the |\lowercase| +% primitive governing this code before the definition of this +% macro actually takes place. +% That means that +% it takes the line, puts |\end| (four character tokens) +% and |\@nil| (one control sequence token) as a +% delimiter behind it, and +% then calls |\verbatim@@|. +% \end{macro} +% +% \begin{macro}{\verbatim@@} +% |\verbatim@@| takes everything up to the next occurrence of +% the four characters |\end| as its argument. +% \begin{macrocode} + \def\verbatim@@#1!end{% +% \end{macrocode} +% That means: if they do not occur in the original line, then +% argument |#1| is the +% whole input line, and |\@nil| is the next token +% to be processed. +% However, if the four characters |\end| are part of the +% original line, then +% |#1| consists of the characters in front of |\end|, +% and the next token is the following character (always remember +% that the line was lengthened by five tokens). +% Whatever |#1| may be, it is verbatim text, +% so |#1| is added to the line currently built. +% \begin{macrocode} + \verbatim@addtoline{#1}% +% \end{macrocode} +% The next token in the input stream +% is of special interest to us. +% Therefore |\futurelet| defines |\next| to be equal +% to it before calling |\verbatim@@@|. +% \begin{macrocode} + \futurelet\next\verbatim@@@}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\verbatim@@@} +% \changes{v1.1a}{1989/10/16}{Replaced \cs{verbatim@@@} by +% \cs{@nil} where used as delimiter.} +% |\verbatim@@@| will now read the rest of the tokens on +% the current line, +% up to the final |\@nil| token. +% \begin{macrocode} + \def\verbatim@@@#1\@nil{% +% \end{macrocode} +% If the first of the above two cases occurred, i.e.\ no +% |\end| characters were on that line, |#1| is empty +% and |\next| is equal to |\@nil|. +% This is easily checked. +% \begin{macrocode} + \ifx\next\@nil +% \end{macrocode} +% If so, this was a simple line. +% We finish it by processing the line we accumulated so far. +% Then we prepare to read the next line. +% \changes{v1.2f}{1990/01/31}{Added \cs{verbatim@startline}.} +% \begin{macrocode} + \verbatim@processline + \verbatim@startline + \let\next\verbatim@ +% \end{macrocode} +% Otherwise we have to check what follows these |\end| +% tokens. +% \begin{macrocode} + \else +% \end{macrocode} +% Before we continue, it's a good idea to stop for a moment +% and remember where we are: +% We have just read the four character tokens |\end| +% and must now check whether the name of the environment (surrounded +% by braces) follows. +% To this end we define a macro called |\@tempa| +% that reads exactly one character and decides what to do next. +% This macro should do the following: skip spaces until +% it encounters either a left brace or the end of the line. +% But it is important to remember which characters are skipped. +% The |\end|\meta{optional spaces}|{| characters +% may be part of the verbatim text, i.e.\ these characters +% must be printed. +% +% Assume for example that the current line contains +% \begin{verbatim*} +% \end {AVeryLongEnvironmentName} +%\end{verbatim*} +% As we shall soon see, the scanning mechanism implemented here +% will not find out that this is text to be printed until +% it has read the right brace. +% Therefore we need a way to accumulate the characters read +% so that we can reinsert them if necessary. +% The token register |\@temptokena| is used for this purpose. +% +% Before we do this we have to get rid of the superfluous +% |\end| tokens at the end of the line. +% \changes{v1.4j}{1992/06/30}{Removed use of \cs{toks@}. Suggested by +% Bernd Raichle.} +% To this end we define a temporary macro whose argument +% is delimited by |\end\@nil| (four character tokens +% and one control sequence token) to be used below +% on the rest of the line, after appending a |\@nil| token to it. +% (Note that this token can never appear in |#1|.) +% We use the following definition of +% |\@tempa| to get the rest of the line (after the first +% |\end|). +% \begin{macrocode} + \def\@tempa##1!end\@nil{##1}% +% \end{macrocode} +% We mentioned already that we use token register +% |\@temptokena| +% to remember the characters we skip, in case we need them again. +% We initialize this with the |\end| we have thrown away +% in the call to |\@tempa|. +% \begin{macrocode} + \@temptokena{!end}% +% \end{macrocode} +% We shall now call |\verbatim@test| +% to process the characters +% remaining on the current line. +% But wait a moment: we cannot simply call this macro +% since we have already read the whole line. +% Therefore we have to first expand the macro |\@tempa| to insert +% them again after the |\verbatim@test| token. +% A |^^M| character is appended to denote the end of the line. +% (Remember that this character comes disguised as a tilde.) +% \changes{v1.2}{1989/10/20}{Taken local definition of \cs{@tempa} out +% of \cs{verbatim@@@} and introduced +% \cs{verbatim@test} instead.} +% \begin{macrocode} + \def\next{\expandafter\verbatim@test\@tempa#1\@nil~}% +% \end{macrocode} +% That's almost all, but we still have to +% now call |\next| to do the work. +% \begin{macrocode} + \fi \next}% +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\verbatim@test} +% \changes{v1.2}{1989/10/20}{Introduced \cs{verbatim@test}.} +% We define |\verbatim@test| to investigate every token +% in turn. +% \begin{macrocode} + \def\verbatim@test#1{% +% \end{macrocode} +% First of all we set |\next| equal to |\verbatim@test| +% in case this macro must call itself recursively in order to +% skip spaces. +% \begin{macrocode} + \let\next\verbatim@test +% \end{macrocode} +% We have to distinguish four cases: +% \begin{enumerate} +% \item The next token is a |^^M|, i.e.\ we reached +% the end of the line. That means that nothing +% special was found. +% Note that we use |\if| for the following +% comparisons so that the category code of the +% characters is irrelevant. +% \begin{macrocode} + \if\noexpand#1\noexpand~% +% \end{macrocode} +% We add the characters accumulated in token register +% |\@temptokena| to the current line. Since +% |\verbatim@addtoline| does not expand its argument, +% we have to do the expansion at this point. Then we +% |\let| |\next| equal to |\verbatim@| +% to prepare to read the next line. +% \changes{v1.2f}{1990/01/31}{Added \cs{verbatim@startline}.} +% \begin{macrocode} + \expandafter\verbatim@addtoline + \expandafter{\the\@temptokena}% + \verbatim@processline + \verbatim@startline + \let\next\verbatim@ +% \end{macrocode} +% \item A space character follows. +% This is allowed, so we add it to |\@temptokena| +% and continue. +% \begin{macrocode} + \else \if\noexpand#1 + \@temptokena\expandafter{\the\@temptokena#1}% +% \end{macrocode} +% \changes{v1.2f}{1990/01/31}{Code for TABs removed.} +% \item An open brace follows. +% This is the most interesting case. +% We must now collect characters until we read the closing +% brace and check whether they form the environment name. +% This will be done by |\verbatim@testend|, so here +% we let |\next| equal this macro. +% Again we will process the rest of the line, character +% by character. +% \changes{v1.2}{1989/10/20}{Moved the initialization of +% \cs{@tempc} from \cs{verbatim@testend} into +% \cs{verbatim@test}.} +% The characters forming the name of the environment will +% be accumulated in |\@tempc|. +% We initialize this macro to expand to nothing. +% \changes{v1.3b}{1990/02/07}{\cs{noexpand} added.} +% \begin{macrocode} + \else \if\noexpand#1\noexpand[% + \let\@tempc\@empty + \let\next\verbatim@testend +% \end{macrocode} +% Note that the |[| character will be a |{| when +% this macro is defined. +% \item Any other character means that the |\end| was part +% of the verbatim text. +% Add the characters to the current line and prepare to call +% |\verbatim@| to process the rest of the line. +% \changes{v1.0f}{1989/10/09}{Fixed \cs{end} \cs{end} bug +% found by Chris Rowley} +% \begin{macrocode} + \else + \expandafter\verbatim@addtoline + \expandafter{\the\@temptokena}% + \def\next{\verbatim@#1}% + \fi\fi\fi +% \end{macrocode} +% \end{enumerate} +% The last thing this macro does is to call |\next| +% to continue processing. +% \begin{macrocode} + \next}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\verbatim@testend} +% |\verbatim@testend| is called when +% |\end|\meta{optional spaces}|{| was seen. +% Its task is to scan everything up to the next |}| +% and to call |\verbatim@@testend|. +% If no |}| is found it must reinsert the characters it read +% and return to |\verbatim@|. +% The following definition is similar to that of +% |\verbatim@test|: +% it takes the next character and decides what to do. +% \changes{v1.2}{1989/10/20}{Removed local definition of \cs{@tempa} +% from \cs{verbatim@testend} which now +% does the work itself.} +% \begin{macrocode} + \def\verbatim@testend#1{% +% \end{macrocode} +% Again, we have four cases: +% \begin{enumerate} +% \item |^^M|: As no |}| is found in the current line, +% add the characters to the buffer. To avoid a +% complicated construction for expanding +% |\@temptokena| +% and |\@tempc| we do it in two steps. Then we +% continue with |\verbatim@| to process the +% next line. +% \changes{v1.2f}{1990/01/31}{Added \cs{verbatim@startline}.} +% \begin{macrocode} + \if\noexpand#1\noexpand~% + \expandafter\verbatim@addtoline + \expandafter{\the\@temptokena[}% + \expandafter\verbatim@addtoline + \expandafter{\@tempc}% + \verbatim@processline + \verbatim@startline + \let\next\verbatim@ +% \end{macrocode} +% \item |}|: Call |\verbatim@@testend| to check +% if this is the right environment name. +% \changes{v1.3b}{1990/02/07}{\cs{noexpand} added.} +% \begin{macrocode} + \else\if\noexpand#1\noexpand]% + \let\next\verbatim@@testend +% \end{macrocode} +% \changes{v1.0f}{1989/10/09}{Introduced check for +% {\tt\string\verb!\string|!\string\!\string|} to fix +% single brace bug found by Chris Rowley} +% \item |\|: This character must not occur in the name of +% an environment. Thus we stop collecting characters. +% In principle, the same argument would apply to other +% characters as well, e.g., |{|. +% However, |\| is a special case, since it may be +% the first character of |\end|. This means that +% we have to look again for +% |\end{|\meta{environment name}|}|. +% Note that we prefixed the |!| by a |\noexpand| +% primitive, to protect ourselves against it being an +% active character. +% \changes{v1.3b}{1990/02/07}{\cs{noexpand} added.} +% \begin{macrocode} + \else\if\noexpand#1\noexpand!% + \expandafter\verbatim@addtoline + \expandafter{\the\@temptokena[}% + \expandafter\verbatim@addtoline + \expandafter{\@tempc}% + \def\next{\verbatim@!}% +% \end{macrocode} +% \item Any other character: collect it and continue. +% We cannot use |\edef| to define |\@tempc| +% since its replacement text might contain active +% character tokens. +% \begin{macrocode} + \else \expandafter\def\expandafter\@tempc\expandafter + {\@tempc#1}\fi\fi\fi +% \end{macrocode} +% \end{enumerate} +% As before, the macro ends by calling itself, to +% process the next character if appropriate. +% \begin{macrocode} + \next}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\verbatim@@testend} +% Unlike the previous macros |\verbatim@@testend| is simple: +% it has only to check if the |\end{|\ldots|}| +% matches the corresponding |\begin{|\ldots|}|. +% \begin{macrocode} + \def\verbatim@@testend{% +% \end{macrocode} +% We use |\next| again to define the things that are +% to be done. +% Remember that the name of the current environment is +% held in |\@currenvir|, the characters accumulated +% by |\verbatim@testend| are in |\@tempc|. +% So we simply compare these and prepare to execute +% |\end{|\meta{current environment}|}| +% macro if they match. +% Before we do this we call |\verbatim@finish| to process +% the last line. +% We define |\next| via |\edef| so that +% |\@currenvir| is replaced by its expansion. +% Therefore we need |\noexpand| to inhibit the expansion +% of |\end| at this point. +% \begin{macrocode} + \ifx\@tempc\@currenvir + \verbatim@finish + \edef\next{\noexpand\end{\@currenvir}% +% \end{macrocode} +% Without this trick the |\end| command would not be able +% to correctly check whether its argument matches the name of +% the current environment and you'd get an +% interesting \LaTeX{} error message such as: +% \begin{verbatim} +%! \begin{verbatim*} ended by \end{verbatim*}. +%\end{verbatim} +% But what do we do with the rest of the characters, those +% that remain on that line? +% We call |\verbatim@rescan| to take care of that. +% Its first argument is the name of the environment just +% ended, in case we need it again. +% |\verbatim@rescan| takes the list of characters to be +% reprocessed as its second argument. +% (This token list was inserted after the current macro +% by |\verbatim@@@|.) +% Since we are still in an |\edef| we protect it +% by means of|\noexpand|. +% \begin{macrocode} + \noexpand\verbatim@rescan{\@currenvir}}% +% \end{macrocode} +% If the names do not match, we reinsert everything read up +% to now and prepare to call |\verbatim@| to process +% the rest of the line. +% \begin{macrocode} + \else + \expandafter\verbatim@addtoline + \expandafter{\the\@temptokena[}% + \expandafter\verbatim@addtoline + \expandafter{\@tempc]}% + \let\next\verbatim@ + \fi +% \end{macrocode} +% Finally we call |\next|. +% \begin{macrocode} + \next}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\verbatim@rescan} +% In principle |\verbatim@rescan| could be used to +% analyse the characters remaining after the |\end{...}| +% command and pretend that these were read +% ``properly'', assuming ``standard'' category codes are in +% force.\footnote{Remember that they were all read with +% category codes $11$ (letter) and $12$ (other) so +% that control sequences are not recognized as such.} +% But this is not always possible (when there are unmatched +% curly braces in the rest of the line). +% Besides, we think that this is not worth the effort: +% After a \texttt{verbatim} or \texttt{verbatim*} environment +% a new line in the output is begun anyway, +% and an |\end{comment}| can easily be put on a line by itself. +% So there is no reason why there should be any text here. +% For the benefit of the user who did put something there +% (a comment, perhaps) +% we simply issue a warning and drop them. +% The method of testing is explained in Appendix~D, p.\ 376 of +% the \TeX{}book. We use |^^M| instead of the |!| +% character used there +% since this is a character that cannot appear in |#1|. +% The two |\noexpand| primitives are necessary to avoid +% expansion of active characters and macros. +% +% One extra subtlety should be noted here: remember that +% the token list we are currently building will first be +% processed by the |\lowercase| primitive before \TeX{} +% carries out the definitions. +% This means that the `|C|' character in the +% argument to the |\@warning| macro must be protected against +% being changed to `|c|'. That's the reason why we added the +% |\lccode`\C=`\C| assignment above. +% We can now finish the argument to |\lowercase| as well as the +% group in which the category codes were changed. +% \begin{macrocode} + \def\verbatim@rescan#1#2~{\if\noexpand~\noexpand#2~\else + \@warning{Characters dropped after `\string\end{#1}'}\fi}} +% \end{macrocode} +% \end{macro} +% +% \subsection{The \cs{verbatiminput} command} +% +% \begin{macro}{\verbatim@in@stream} +% We begin by allocating an input stream (out of the 16 available +% input streams). +%\iffalse +% Vorstellbar ist auch der Aufruf von |`verbatiminput| innerhalb eines +% |`verbatiminput| (z.B: wenn man |`input|-Anweisungen im zu lesenden +% File hat und auch diese Files automatisch lesen will). Dies kann +% man jedoch nur ermoeglichen, wenn man einen besseren Mechanismus +% verwendet als es das simple, statische |`newread| darstellt. +% Vorstellbar fuer eine neuere \LaTeX-Version ist eine (lokale) +% Allokation des Streams durch ein |`open| und eine Freigabe des +% Streams durch |`close| oder Verlassen der Gruppe. +%\fi +% \begin{macrocode} +\newread\verbatim@in@stream +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\verbatim@readfile} +% The macro |\verbatim@readfile| encloses the main loop by calls to +% the macros |\verbatim@startline| and |\verbatim@finish|, +% respectively. This makes sure +% that the user can initialize and finish the command when the file +% is empty or doesn't exist. The \texttt{verbatim} environment has a +% similar behaviour when called with an empty text. +% \begin{macrocode} +\def\verbatim@readfile#1{% + \verbatim@startline +% \end{macrocode} +% When the file is not found we issue a warning. +% \begin{macrocode} + \openin\verbatim@in@stream #1\relax + \ifeof\verbatim@in@stream + \typeout{No file #1.}% + \else +% \end{macrocode} +% At this point we pass the name of the file to |\@addtofilelist| +% so that its appears appears in the output of a |\listfiles| +% command. +% \changes{v1.5j}{1996/09/25}{Add \cs{@addtofilelist} and +% \cs{ProvidesFile} so that the name of the file +% read in appears in the \cs{listfiles} output (Omission pointed +% out by Patrick W.~Daly).} +% In addition, we use |\ProvidesFile| to make a log entry in the +% transcript file and to distinguish files read in via +% |\verbatiminput| from others. +% \begin{macrocode} + \@addtofilelist{#1}% + \ProvidesFile{#1}[(verbatim)]% +% \end{macrocode} +% While reading from the file it is useful to switch off the +% recognition of the end-of-line character. This saves us stripping +% off spaces from the contents of the line. +% \begin{macrocode} + \expandafter\endlinechar\expandafter\m@ne + \expandafter\verbatim@read@file + \expandafter\endlinechar\the\endlinechar\relax + \closein\verbatim@in@stream + \fi + \verbatim@finish +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\verbatim@read@file} +% All the work is done in |\verbatim@read@file|. It reads the input +% file line by line and recursively calls itself until the end of +% the file. +% \begin{macrocode} +\def\verbatim@read@file{% + \read\verbatim@in@stream to\next + \ifeof\verbatim@in@stream + \else +% \end{macrocode} +% For each line we call |\verbatim@addtoline| with the contents of +% the line. \hskip0pt plus 3cm\penalty0\hskip0pt plus -3cm +% |\verbatim@processline| is called next. +% \begin{macrocode} + \expandafter\verbatim@addtoline\expandafter{\next}% + \verbatim@processline +% \end{macrocode} +% After processing the line we call |\verbatim@startline| to +% initialize all before we read the next line. +% \begin{macrocode} + \verbatim@startline +% \end{macrocode} +% Without |\expandafter| each call of |\verbatim@read@file| uses +% space in \TeX's input stack.\footnote{A standard \TeX\ would +% report an overflow error if you try to read a file with more than +% ca.\ 200~lines. The same error occurs if the first line of code +% in \S 390 of \textsl{``TeX: The Program''\/} is missing.} +% \begin{macrocode} + \expandafter\verbatim@read@file + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\verbatiminput} +% |\verbatiminput| first starts a group to keep font and category +% changes local. +% Then it calls the macro |\verbatim@input| with additional +% arguments, depending on whether an asterisk follows. +% \begin{macrocode} +\def\verbatiminput{\begingroup + \@ifstar{\verbatim@input\relax}% + {\verbatim@input{\frenchspacing\@vobeyspaces}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\verbatim@input} +% \changes{1.5k}{1997/04/30}{Have \cs{verbatim@input} check for +% existence of file.} +% |\verbatim@input| first checks whether the file exists, using +% the standard macro |\IfFileExists| which leaves the name of the +% file found in |\@filef@und|. +% Then everything is set up as in the |\verbatim| macro. +% \begin{macrocode} +\def\verbatim@input#1#2{% + \IfFileExists {#2}{\@verbatim #1\relax +% \end{macrocode} +% Then it reads in the file, finishes off the \texttt{trivlist} +% environment started by |\@verbatim| and closes the group. +% This restores everything to its normal settings. +% \begin{macrocode} + \verbatim@readfile{\@filef@und}\endtrivlist\endgroup\@doendpe}% +% \end{macrocode} +% If the file is not found a more or less helpful message is +% printed. The final |\endgroup| is needed to close the group +% started in |\verbatiminput| above. +% \begin{macrocode} + {\typeout {No file #2.}\endgroup}} +%</package> +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Getting verbatim text into arguments.} +% +% One way of achieving this is to define a macro (command) whose +% expansion is the required verbatim text. This command can then be +% used anywhere that the verbatim text is required. It can be used in +% arguments, even moving ones, but it is fragile (at least, the +% version here is). +% +% Here is some code which claims to provide this. It is a much revised +% version of something I (Chris) did about 2 years ago. Maybe it needs +% further revision. +% +% It is only intended as an extension to |\verb|, not to the +% \texttt{verbatim} environment. It should therefore, perhaps, treat +% line-ends similarly to whatever is best for |\verb|. +% +% \begin{macro}{\newverbtext} +% This is the command to produce a new macro whose expansion is +% verbatim text. This command itself cannot be used in arguments, +% of course! It is used as follows: +% +% \begin{verbatim} +% \newverbtext{\myverb}"^%{ &~_\}}@ #" +% \end{verbatim} +% +% The rules for delimiting the verbatim text are the same as those for +% |\verb|. +% +% \begin{macrocode} +%<*verbtext> +\def \newverbtext {% + \@ifstar {\@tempswatrue \@verbtext }{\@tempswafalse \@verbtext *}% +} +% \end{macrocode} +% \end{macro} +% I think that a temporary switch is safe here: if not, then +% suitable |\let|s can be used. +% \changes{v1.5i}{1996/06/04}{Moved processing of +% \cs{verbatim@nolig@list} after \cs{dospecials}.} +% \changes{v1.5p}{2001/03/12}{Added missing right brace in +% definition of \cs{@verbtext} (PR 3314).} +% \begin{macrocode} +\def \@verbtext *#1#2{% + \begingroup + \let\do\@makeother \dospecials + \let\do\do@noligs \verbatim@nolig@list + \@vobeyspaces + \catcode`#2\active + \catcode`~\active + \lccode`\~`#2% + \lowercase +% \end{macrocode} +% We use a temporary macro here and a trick so that the definition of +% the command itself can be done inside the group and be a local +% definition (there may be better ways to achieve this). +% \begin{macrocode} + {\def \@tempa ##1~% + {\whitespaces +% \end{macrocode} +% If these |\noexpand|s were |\noexpand\protect\noexpand|, would +% this make these things robust? +% \begin{macrocode} + \edef #1{\noexpand \@verbtextmcheck + \bgroup + \if@tempswa + \noexpand \visiblespaces + \fi + \noexpand \@verbtextsetup + ##1% + \egroup}% + }% + \expandafter\endgroup\@tempa + } +} +% \end{macrocode} +% This sets up the correct type of group for the mode: it must not +% be expanded at define time! +% \begin{macrocode} +\def \@verbtextmcheck {% + \relax\ifmmode + \hbox + \else + \leavevmode + \null + \fi +} +% \end{macrocode} +% This contains other things which should not be expanded during the +% definition. +% \begin{macrocode} +\def \@verbtextsetup {% + \frenchspacing + \verbatim@font + \verbtextstyle +} +% \end{macrocode} +% The command |\verbtextstyle| is a document-level hook which can be +% used to override the predefined typographic treatment of commands +% defined with |\newverbtext| commands. +% +% |\visiblespaces| and |\whitespaces| are examples of possible values +% of this hook. +% \begin{macrocode} +\let \verbtextstyle \relax +\def \visiblespaces {\chardef \ 32\relax} +\def \whitespaces {\let \ \@@space} +\let \@@space \ % +%</verbtext> +% \end{macrocode} +% +% +% \section{Testing the implementation} +% +% For testing the implementation and for demonstration we provide +% an extra file. It can be extracted by using the conditional +% `\textsf{testdriver}'. It uses a small input file called +% `\texttt{verbtest.tst}' that is distributed separately. +% Again, we use individual `+' guards. +% \begin{macrocode} +%<*testdriver> +\documentclass{article} + +\usepackage{verbatim} + +\newenvironment{myverbatim}% + {\endgraf\noindent MYVERBATIM:\endgraf\verbatim}% + {\endverbatim} + +\makeatletter + +\newenvironment{verbatimlisting}[1]% + {\def\verbatim@startline{\input{#1}% + \def\verbatim@startline{\verbatim@line{}}% + \verbatim@startline}% + \verbatim}{\endverbatim} + +\newwrite\verbatim@out + +\newenvironment{verbatimwrite}[1]% + {\@bsphack + \immediate\openout \verbatim@out #1 + \let\do\@makeother\dospecials\catcode`\^^M\active + \def\verbatim@processline{% + \immediate\write\verbatim@out{\the\verbatim@line}}% + \verbatim@start}% + {\immediate\closeout\verbatim@out\@esphack} + +\makeatother + +\addtolength{\textwidth}{30pt} + +\begin{document} + +\typeout{} +\typeout{===> Expect ``characters dropped'' + warning messages in this test! <====} +\typeout{} + +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text + \begin{verbatim} + test + \end{verbatim*} + test + \end{verbatim + test of ligatures: <`!`?`> + \endverbatim + test + \end verbatim + test + test of end of line: + \end + {verbatim} + \end{verbatim} Further text to be typeset: $\alpha$. +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text + \begin{verbatim*} + test + test + \end {verbatim*} +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text + \begin{verbatim*} bla bla + test + test + \end {verbatim*} +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text + +First of Chris Rowley's fiendish tests: +\begin{verbatim} +the double end test<text> +\end\end{verbatim} or even \end \end{verbatim} +% +%not \end\ended?? +%\end{verbatim} + +Another of Chris' devils: +\begin{verbatim} +the single brace test<text> +\end{not the end\end{verbatim} +% +%not \end}ed?? +%\end{verbatim} +Back to my own tests: + \begin{myverbatim} + test + test + \end {myverbatim} rest of line +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text + +Test of empty verbatim: +\begin{verbatim} +\end{verbatim} +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text + \begin {verbatimlisting}{verbtest.tex} + Additional verbatim text + ... + \end{verbatimlisting} +And here for listing a file: + \verbatiminput{verbtest.tex} +And again, with explicit spaces: + \verbatiminput*{verbtest.tex} +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text + \begin{comment} + test + \end{verbatim*} + test + \end {comment + test + \endverbatim + test + \end verbatim + test + \end {comment} Further text to be typeset: $\alpha$. +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text + \begin{comment} bla bla + test + test + \end {comment} +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text +Text Text Text Text Text Text Text Text Text Text Text + +\begin{verbatimwrite}{verbtest.txt} +asfa<fa<df +sdfsdfasd +asdfa<fsa +\end{verbatimwrite} + +\end{document} +%</testdriver> +% \end{macrocode} +% +% +% \Finale +% +\endinput +%% diff --git a/Master/texmf-dist/source/latex-dev/tools/xr.dtx b/Master/texmf-dist/source/latex-dev/tools/xr.dtx new file mode 100644 index 00000000000..417a98c1c1e --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/xr.dtx @@ -0,0 +1,186 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% File: xr.dtx Copyright (C) 1993-2019 David Carlisle +% +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{xr} +%<package> [2019/07/22 v5.05 eXternal References (DPC)] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{xr} +\GetFileInfo{xr.sty} +\begin{document} +\title{The \textsf{xr} package\thanks{This file + has version number \fileversion, last + revised \filedate.}} +\author{David Carlisle\thanks{% + The Author of Versions 1--4 was Jean-Pierre Drucbert}} +\date{\filedate} +\MaintainedByLaTeXTeam{tools} +\maketitle +\DocInput{xr.dtx} +\end{document} +%</driver> +% \fi +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% \changes{v5.00}{1993/07/07} +% {First DPC version (by agreement with J-PD). New mechanism +% (\cmd{\read} instead of \cmd\input).} +% +% \changes{v5.01}{1993/07/20}{Fix bug added by DPC, v5.00 did not import +% aux files of \cmd\include'ed files. (Reported by J-PD)} +% +% \changes{v5.02}{1994/05/28}{Update for LaTeX2e} +% \changes{v5.03}{2018/10/01}{Fix for conditionals in aux file} +% \changes{v5.05}{2019/07/20}{include xcite} +% +% +% This package implements a system for eXternal References. +% +% If one document needs to refer to sections of another, say |aaa.tex|, +% then this package may be loaded in the main file, and the command\\ +% |\externaldocument{aaa}|\\ +% given in the preamble. +% +% Then you may use |\ref| and |\pageref| to refer to anything which has +% been given a |\label| in either |aaa.tex| or the main document. +% You may declare any number of such external documents. +% +% If any of the external documents, or the main document, use the same +% |\label| then an error will occur as the label will be multiply +% defined. To overcome this problem |\externaldocument| has an optional +% argument. If you declare |\externaldocument[A-]{aaa}| Then all +% references from |aaa| are prefixed by |A-|. So for instance, if a +% section of |aaa| had |\label{intro}|, then this could be referenced +% with |\ref{A-intro}|. The prefix need not be |A-|, it can be any +% string chosen to ensure that all the labels imported from external +% files are unique. Note however that if your style declares certain +% active characters (|:| in French, |"| in German) then these +% characters can not usually be used in |\label|, and similarly may not +% be used in the optional argument to |\externaldocument|. +% +% As first suggested in Enrico Gregorio's |xcite| package, the current version +% also allows |\cite| to reference |\bibitem| in the external document. +% For fcompatibility with |xcite|, |\externalcitedocument| is made available +% as an alias for |\externaldocument| +% +% \StopEventually{} +% +% \section{The macros} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% Check for the optional argument. +% \begin{macrocode} +\def\externaldocument{\@ifnextchar[\XR@{\XR@[]}} +\let\externalcitedocument\externaldocument +% \end{macrocode} +% +% Save the optional prefix. Start processing the first |aux| file. +% \begin{macrocode} +\def\XR@[#1]#2{{% + \makeatletter + \def\XR@prefix{#1}% + \XR@next#2.aux\relax\\}} +% \end{macrocode} +% +% Process the next |aux| file in the list and remove it from the head of +% the list of files to process. +% \begin{macrocode} +\def\XR@next#1\relax#2\\{% + \edef\XR@list{#2}% + \XR@loop{#1}} +% \end{macrocode} +% +% Check whether the list of |aux| files is empty. +% \begin{macrocode} +\def\XR@aux{% + \ifx\XR@list\@empty\else\expandafter\XR@explist\fi} +% \end{macrocode} +% + +% Expand the list of aux files, and call |\XR@next| to process the first +% one. +% \begin{macrocode} +\def\XR@explist{\expandafter\XR@next\XR@list\\} +% \end{macrocode} +% +% If the |aux| file exists, loop through line by line, looking for +% |\newlabel| and |\@input|. Otherwise process the next file in the +% list. +% \begin{macrocode} +\def\XR@loop#1{\openin\@inputcheck#1\relax + \ifeof\@inputcheck + \PackageWarning{xr}{^^JNo file #1^^JLABELS NOT IMPORTED.^^J}% + \expandafter\XR@aux + \else + \PackageInfo{xr}{IMPORTING LABELS FROM #1}% + \expandafter\XR@read\fi} +% \end{macrocode} +% +% Read the next line of the aux file. +% \begin{macrocode} +\def\XR@read{% + \read\@inputcheck to\XR@line +% \end{macrocode} +% The |...| make sure that |\XR@test| always has sufficient arguments. +% \begin{macrocode} + \expandafter\XR@test\XR@line...\XR@} +% \end{macrocode} +% +% Look at the first token of the line. +% If it is |\newlabel|, do the |\newlabel|. If it is |\@input|, add the +% filename to the list of files to process. Otherwise ignore. +% Go around the loop if not at end of file. Finally process the next +% file in the list. +% +% 2018 update: make sure the arguments are handled outside the |\ifx| test, +% \begin{macrocode} +\long\def\XR@test#1#2#3#4\XR@{% + \let\XR@tempa\@gobbletwo + \ifx#1\newlabel + \let\XR@tempa\@firstoftwo + \else\ifx#1\bibcite + \let\XR@tempa\@firstoftwo + \else\ifx#1\@input + \let\XR@tempa\@secondoftwo + \fi\fi\fi + \XR@tempa{#1{\XR@prefix#2}{#3}}{\edef\XR@list{\XR@list#2\relax}}% + \ifeof\@inputcheck\expandafter\XR@aux + \else\expandafter\XR@read\fi} +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% + diff --git a/Master/texmf-dist/source/latex-dev/tools/xspace.dtx b/Master/texmf-dist/source/latex-dev/tools/xspace.dtx new file mode 100644 index 00000000000..0745caf5071 --- /dev/null +++ b/Master/texmf-dist/source/latex-dev/tools/xspace.dtx @@ -0,0 +1,507 @@ +% \iffalse meta-comment +% +% Copyright (C) 1993-2019 +% +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This file is part of the Standard LaTeX `Tools Bundle'. +% ------------------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% https://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% The list of all files belonging to the LaTeX `Tools Bundle' is +% given in the file `manifest.txt'. +% +% \fi +% \iffalse +%% File: xspace.dtx Copyright (C) 1991-1997 David Carlisle +%% File: xspace.dtx Copyright (C) 2004-2006 David Carlisle, +%% Morten H\o gholm +% +%<*dtx> + \ProvidesFile{xspace.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{xspace} +%<driver>\ProvidesFile{xspace.drv} +% \fi +% \ProvidesFile{xspace.dtx} + [2014/10/28 v1.13 Space after command names (DPC,MH)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\makeatletter +\providecommand*\eTeX{{% + \if b\expandafter\@car\f@series\@nil\boldmath\fi$\m@th + \varepsilon$-\TeX}} +\makeatother +\usepackage{xspace}[2006/05/08] +\begin{document} +\DocInput{xspace.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{xspace.dtx} +% \title{The \textsf{xspace} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{David Carlisle \and Morten H\o gholm} +% \date{\filedate} +% \MaintainedByLaTeXTeam{tools} +% \maketitle +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% \changes{v1.00}{1991/08/30}{Initial version} +% \changes{v1.01}{1992/06/26}{Re-issue for the new doc and docstrip} +% \changes{v1.02}{1994/01/31}{Re-issue for LaTeX2e (no change to +% code)} +% \changes{v1.07}{2004/12/07}{Make extensible. tools/3712} +% \changes{v1.07}{2004/12/07}{Fix active characters. tools/3747} +% \changes{v1.07}{2004/12/07}{Update documentation} +% \changes{v1.08}{2005/05/07}{Better fix for active characters} +% \changes{v1.09}{2005/07/26}{Improve test by exiting if +% \cs{@let@token} is a letter} +% \changes{v1.10}{2005/10/04}{Use higher level functions for +% conditional processing} +% \changes{v1.10}{2005/10/04}{Improve expansion method} +% +% \begin{abstract} +% |\xspace| should be used at the end of a macro designed to +% be used mainly in text. It adds a space unless the macro is +% followed by certain punctuation characters. +% \end{abstract} +% +% \section{Introduction} +% \newcommand{\gb}{Great Britain\xspace}\DescribeMacro{\xspace} +% After defining |\newcommand{\gb}{Great Britain\xspace}|, +% the command |\gb| will determine when to insert a space +% after itself and when not. Thus the input +% \begin{quote} +% |\gb is a very nice place to live.\\| \\ +% |\gb, a small island off the coast of France.\\|\\ +% |\gb\footnote{The small island off the coast of France.}|\\ +% |is a very nice place to live.| +% \end{quote} +% results in the output +% \begin{quote} +% \gb is a very nice place to live. \\ +% \gb, a small island off the coast of France.\\ +% \gb\footnote{The small island off the coast of France.} +% is a very nice place to live. +% \end{quote} +% |\xspace| saves the user from having to type \verb*+\ + or +% |{}| after most occurrences of a macro name in text. +% However if either of these constructions follows |\xspace|, +% a space is not added by |\xspace|. This means that it is +% safe to add |\xspace| to the end of an existing macro +% without making too many changes in your document. In particular, +% |\xspace| will always insert a space if the thing following it is +% a normal letter which is the usual case. +% +% Sometimes |\xspace| may make the wrong decision, and add a +% space when it is not required. There may be different +% reasons for this behavior but it can always be handled by +% following the macro with |{}|, as this has the effect of +% suppressing the space. +% +% +% \subsection{Adding new exceptions} +% +% One of the most common reasons for |\xspace| to add an +% unwanted space is when it is followed by a macro not on its +% list of exceptions. +% \DescribeMacro{\xspaceaddexceptions}% +% With |\xspaceaddexceptions| you can add new commands or +% characters to be recognized by |\xspace|'s scanning +% mechanism. Users of advanced footnote packages like +% \textsf{manyfoot} will often define new footnote macros +% that should not cause a command ``enhanced'' with |\xspace| +% to insert a space. If you define the additional footnote +% macros |\footnoteA| and |\footnoteB|, simply add the +% following line to your preamble: +% \begin{quote} +% |\xspaceaddexceptions{\footnoteA \footnoteB}| +% \end{quote} +% +% +% \subsection{Support for active characters} +% +% +% The other common instance of |\xspace| not working quite right +% happens with active characters. Generally this package must be +% loaded \emph{after} any language (or other) packages that make +% punctuation characters `active'. This makes it difficult for +% \textsf{xspace} to work flawlessly with the popular \textsf{babel} +% package especially since the punctuation characters can switch +% between being `active' and `other'. Starting at \textsf{xspace} +% version~1.08 there are two different ways to handle this depending +% on which engine your \LaTeX-format uses: +% \begin{description} +% \item[\TeX] The punctuation characters are added to the +% exception list in both their normal and active states thus +% ensuring that they are always recognized. +% \item[\eTeX] The characters are re-read when going through +% the exception list which means the internal comparison will test +% against the current state of the character. This works for +% whatever category code tricks some packages may use. +% \end{description} +% +% At the time of writing all major \TeX\ distributions are using +% \eTeX\ as engine for \LaTeX\ so usually everything should work out +% of the box. If you find that you're running normal \TeX\ and +% |\xspace| seems to be making the wrong choice then either use |{}| +% as described above to fix it or add the character to the list but +% with the desired category code. See the implementation for an example +% of how to do that. +% +% \subsection{Still not satisfied?} +% +% Some people don't like the default list of exceptions so they can +% remove one item at a time with the command +% \DescribeMacro{\xspaceremoveexception}^^A +% \cs{xspaceremoveexception}\marg{token}. Furthermore the command +% \DescribeMacro{\@xspace@hook}\cs{@xspace@hook} can be redefined to +% scan forward in the input stream in case you want to check more +% tokens. It is called after \cs{xspace} has determined if it needed +% to insert a space or if an exception was found (the default +% definition is for \cs{@xspace@hook} to be empty). Hence you can use +% \cs{unskip} to remove the space inserted if \cs{@let@token} matches +% something special. Below is an example of how one can make sure an +% endash gets a space inserted before it but a single dash not. +% \begin{verbatim} +% \xspaceremoveexception{-} +% \makeatletter +% \renewcommand*\@xspace@hook{% +% \ifx\@let@token-% +% \expandafter\@xspace@dash@i +% \fi +% } +% \def\@xspace@dash@i-{\futurelet\@let@token\@xspace@dash@ii} +% \def\@xspace@dash@ii{% +% \ifx\@let@token-% +% \else +% \unskip +% \fi +% -% +% } +% \makeatother +% \end{verbatim} +% +% +% \StopEventually{} +% +% \section{The Macros} +% +% |\xspace| peeks ahead for the next token. If the token is in our +% exception list we break the loop and do nothing; else we try to +% expand the token once and start over again. If this leads us to an +% unexpandable token without finding one of the exceptions we insert a +% space. +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macro}{\xspace} +% |\xspace| just looks ahead, and then calls |\@xspace|. +% \changes{v1.03}{1994/11/15}{Make robust} +% \begin{macrocode} +\DeclareRobustCommand\xspace{\@xspace@firsttrue + \futurelet\@let@token\@xspace} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\if@xspace@first} +% \changes{v1.11}{2006/02/12}{Added macro} +% \begin{macro}{\@xspace@simple} +% \changes{v1.11}{2006/02/12}{Added macro} +% Some helpers to avoid multiple calls of |\@xspace@eTeX@setup|. +% \begin{macrocode} +\newif\if@xspace@first +\def\@xspace@simple{\futurelet\@let@token\@xspace} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@xspace@exceptions@tlp} +% \changes{v1.07}{2004/12/07}{Added macro} +% The exception list. If the scanning mechanism finds one of +% these, it won't insert a space after the command. The +% \texttt{tlp} in the name means `token list pointer.' +% \begin{macrocode} +\def\@xspace@exceptions@tlp{% + ,.'/?;:!~-)\ \/\bgroup\egroup\@sptoken\space\@xobeysp + \footnote\footnotemark + \xspace@check@icr +} +% \end{macrocode} +% And here we get the non-empty definition of \cs{check@icr}. +% \changes{v1.13}{2009/10/20}{fix for "tools/3895": `text font commands fool xspace'} +% \begin{macrocode} +\begingroup + \text@command\relax + \global\let\xspace@check@icr\check@icr +\endgroup +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\xspaceaddexceptions} +% \changes{v1.07}{2004/12/07}{Added macro} +% The user command, which just adds tokens to the list. +% \begin{macrocode} +\newcommand*\xspaceaddexceptions{% + \g@addto@macro\@xspace@exceptions@tlp +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\xspaceremoveexception} +% \changes{v1.10}{2005/10/04}{Use higher level functions for +% conditional processing} +% This command removes an exception globally. +% \begin{macrocode} +\newcommand*\xspaceremoveexception[1]{% +% \end{macrocode} +% First check that it is in the list at all. +% \begin{macrocode} + \def\reserved@a##1#1##2##3\@@{% + \@xspace@if@q@nil@NF##2{% +% \end{macrocode} +% It's in the list, remove it. +% \begin{macrocode} + \def\reserved@a####1#1####2\@@{% + \gdef\@xspace@exceptions@tlp{####1####2}}% + \expandafter\reserved@a\@xspace@exceptions@tlp\@@ + }% + }% + \expandafter\reserved@a\@xspace@exceptions@tlp#1\@xspace@q@nil\@@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xspace@break@loop} +% \changes{v1.08}{2005/04/28}{Added macro} +% \changes{v1.10}{2005/10/04}{Use quark instead} +% To stop the loop. +% \begin{macrocode} +\def\@xspace@break@loop#1\@nil{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xspace@hook} +% \changes{v1.09}{2005/07/26}{Added macro} +% A hook for users with special needs. +% \begin{macrocode} +\providecommand*\@xspace@hook{} +% \end{macrocode} +% \end{macro} +% +% Now we check if we're running \eTeX. We can't use \cs{@ifundefined} +% as that will lock catcodes and we need to change some of those. +% As there is a small risk that someone already set \cs{eTeXversion} +% to \cs{relax} by accident we make sure we check for that case but +% without setting it to \cs{relax} if it wasn't already. +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname eTeXversion\endcsname\relax +% \end{macrocode} +% If we are running normal \TeX\ we add the most common cases of active +% punctuation characters. First we make them active. +% \begin{macrocode} + \begingroup + \catcode`\;=\active \catcode`\:=\active + \catcode`\?=\active \catcode`\!=\active +% \end{macrocode} +% The \texttt{alltt} environment also makes |,|, |'|, and |-| active +% so we add them as well. +% \begin{macrocode} + \catcode`\,=\active \catcode`\'=\active \catcode`\-=\active + \xspaceaddexceptions{;:?!,'-} + \endgroup + \let\@xspace@eTeX@setup\relax +% \end{macrocode} +% \begin{macro}{\@xspace@eTeX@setup} +% \changes{v1.10}{2005/10/04}{Added macro} +% \changes{v1.12}{2006/05/08}{Bug fix for verbatim in output routine} +% When we're running \eTeX, we have the advantage of \cs{scantokens} +% which will rescan tokens with current catcodes. This little +% expansion trick makes sure that the exception list is redefined to +% itself but with the contents of it exposed to the current catcode +% regime. That is why we must make sure the catcode of space is 10, +% since we have a \verb*|\ | inside the list. +% \begin{macrocode} +\else + \def\@xspace@eTeX@setup{% + \begingroup + \everyeof{}% + \endlinechar=-1\relax + \catcode`\ =10\relax + \makeatletter +% \end{macrocode} +% We may also be so unfortunate that the re-reading of the list takes +% place when the catcodes of |\|, |{| and |}| are ``other,'' e.g., if +% it takes place in a header and the output routine was called in the +% middle of a \texttt{verbatim} environment. +% \begin{macrocode} + \catcode`\\\z@ + \catcode`\{\@ne + \catcode`\}\tw@ + \scantokens\expandafter{\expandafter\gdef + \expandafter\@xspace@exceptions@tlp + \expandafter{\@xspace@exceptions@tlp}}% + \endgroup + } +\fi +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@xspace} +% \changes{v1.03}{1994/11/15}{Add exclamation mark} +% \changes{v1.04}{1996/05/17}{Add slash} +% \changes{v1.05}{1996/12/06}{Add space for alltt etc. tools/2322} +% \changes{v1.06}{1997/10/13}{Add normal space. tools/2632} +% \changes{v1.07}{2004/12/07}{Now runs through a list of exceptions} +% \changes{v1.07}{2004/12/07}{Added \cs{footnote} and +% \cs{footnotemark}} +% \changes{v1.08}{2005/05/07}{Use recursive loop instead of \cs{@tfor}} +% \changes{v1.09}{2005/07/26}{Only check non-letters and add hook} +% \changes{v1.10}{2005/10/04}{Use higher level functions for +% conditional processing} +% \changes{v1.10}{2005/10/04}{Improve expansion method} +% If the next token is one of a specified list of characters, +% do nothing, otherwise add a space. With version~1.07 the +% approach was altered dramatically to run through the +% exception list |\@xspace@exceptions@tlp| and check each +% token one at a time. +% \begin{macrocode} +\def\@xspace{% +% \end{macrocode} +% Before we start checking the exception list it makes sense to +% perform a quick check on the token in question. Most of the time +% \cs{xspace} is used in regular text so \cs{@let@token} is set equal +% to a letter. In that case there is no point in checking the list +% because it will definitely not contain any tokens with catcode~11. +% +% You may wonder why there are special functions here instead of +% simpler \cs{ifx} conditionals. The reason is that a)~this way we +% don't have to add many, many \cs{expandafter}s to get the nesting +% right and b)~we don't get into trouble when \cs{@let@token} has been +% let equal to \cs{if} etc. +% \begin{macrocode} + \@xspace@lettoken@if@letter@TF \space{% +% \end{macrocode} +% Otherwise we start testing after setting up a few things. If running +% \eTeX{} we rescan the catcodes but only the first time around. +% \begin{macrocode} + \if@xspace@first + \@xspace@firstfalse + \let\@xspace@maybespace\space + \@xspace@eTeX@setup + \fi + \expandafter\@xspace@check@token + \@xspace@exceptions@tlp\@xspace@q@nil\@nil +% \end{macrocode} +% If an exception was found \cs{@xspace@maybespace} is let to +% \cs{relax} and we do nothing. +% \begin{macrocode} + \@xspace@token@if@equal@NNT \space \@xspace@maybespace +% \end{macrocode} +% Otherwise we check to see if we found something expandable and try +% again with that token one level expanded. If no expandable token is +% found we insert a space and then execute the hook. +% \begin{macrocode} + {% + \@xspace@lettoken@if@expandable@TF + {\expandafter\@xspace@simple}% + {\@xspace@maybespace\@xspace@hook}% + }% + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xspace@check@token} +% \changes{v1.07}{2004/12/07}{Added macro} +% \changes{v1.08}{2005/05/07}{Made function recursive} +% \changes{v1.10}{2005/10/04}{Use higher level functions for +% conditional processing} +% \changes{v1.11}{2006/02/12}{Modified so the \cs{@let@token} can be +% \cs{outer}} +% This macro just checks the current item in the exception list +% against the \cs{@let@token}. If they are equal we make sure that no +% space is inserted and break the loop. +% \begin{macrocode} +\def\@xspace@check@token #1{% + \ifx\@xspace@q@nil#1% + \expandafter\@xspace@break@loop + \fi + \expandafter\ifx\csname @let@token\endcsname#1% + \let\@xspace@maybespace\relax + \expandafter\@xspace@break@loop + \fi + \@xspace@check@token +} +% \end{macrocode} +% \end{macro} +% +% That's all, folks! That is, if we were running \LaTeX3. In that case +% we would have had nice functions for all the conditionals but here +% we must define them ourselves. We also optimize them here as +% \cs{@let@token} will always be the argument in some cases. +% +% \begin{macro}{\@xspace@if@lettoken@letter@TF} +% \begin{macro}{\@xspace@if@lettoken@expandable@TF} +% \begin{macro}{\@xspace@cs@if@equal@NNF} +% First a few comparisons. +% \begin{macrocode} +\def\@xspace@lettoken@if@letter@TF{% + \ifcat\noexpand\@let@token @% letter + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +\def\@xspace@lettoken@if@expandable@TF{% + \expandafter\ifx\noexpand\@let@token\@let@token% + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi +} +\def\@xspace@token@if@equal@NNT#1#2{% + \ifx#1#2% + \expandafter\@firstofone + \else + \expandafter\@gobble + \fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\@xspace@q@nil} +% \begin{macro}{\@xspace@if@q@nil@NF} +% Some macros dealing with quarks. +% \begin{macrocode} +\def\@xspace@q@nil{\@xspace@q@nil} +\def\@xspace@if@q@nil@NF#1{% + \ifx\@xspace@q@nil#1% + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale |