diff options
author | Karl Berry <karl@freefriends.org> | 2018-04-05 21:10:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-04-05 21:10:27 +0000 |
commit | 2534e37457206c5394c4902839bf656c211154d7 (patch) | |
tree | 2a947cac9bb720de10ccad6f9ae5197f9f8b8974 /Master/texmf-dist/source/latex/memoir/memoir.dtx | |
parent | ca6f70c9dba74f8a8593e1ecfbbe7d187907d78c (diff) |
memoir (5apr18)
git-svn-id: svn://tug.org/texlive/trunk@47305 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/memoir/memoir.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/memoir/memoir.dtx | 2479 |
1 files changed, 1486 insertions, 993 deletions
diff --git a/Master/texmf-dist/source/latex/memoir/memoir.dtx b/Master/texmf-dist/source/latex/memoir/memoir.dtx index 7780157dded..3bf13b2e751 100644 --- a/Master/texmf-dist/source/latex/memoir/memoir.dtx +++ b/Master/texmf-dist/source/latex/memoir/memoir.dtx @@ -20,7 +20,7 @@ % This work consists of the files listed in the README file. % % \fi -% \CheckSum{30773} +% \CheckSum{31006} % % \changes{v0.1}{2001/05/20}{First public alpha release} % \changes{v0.2}{2001/06/03}{First beta release} @@ -169,6 +169,7 @@ % \def\fileversion{v3.7d} \def\filedate{2015/04/23} % \def\fileversion{v3.7e} \def\filedate{2015/07/08} % \def\fileversion{v3.7f} \def\filedate{2016/05/16} +% \def\fileversion{v3.7g} \def\filedate{2018/04/04} ^^A remember to fix % \title{The LaTeX \Lpack{memoir} class for configurable book % typesetting: Source code\thanks{This % file (\texttt{\dtxfile}) has version number \fileversion, last revised @@ -275,7 +276,7 @@ %<*driver> \documentclass[twoside]{ltxdoc} \usepackage[T1]{fontenc} -\usepackage{url} +\usepackage{url,array} %%\usepackage[draft=false, %% plainpages=false, %% pdfpagelabels, @@ -315,6 +316,7 @@ \newcommand*{\Lpack}[1]{\textsf {#1}} % typeset a package \newcommand*{\ctt}{\textsc{ctt}} % comp.text.tex \newenvironment{PW}{\em}{} +\newenvironment{dlf}{\em}{} \newcommand*{\theTeXbook}{\textit{The \TeX book}} \let\oldllap\llap \def\llap#1{\oldllap{#1\quad}} % might be evil @@ -398,11 +400,11 @@ % Announce the name, option files and version for LaTeX2e files: % \begin{macrocode} %<class>\ProvidesClass{memoir}% -%<class> [2016/05/16 v3.7f configurable book, report, article document class] +%<class> [2018/04/04 v3.7g configurable book, report, article document class] % \end{macrocode} % In the manual it is useful to know the current version. % \begin{macrocode} -%<class>\newcommand\memversion{v3.7f, 2016/05/16} +%<class>\newcommand\memversion{v3.7g, 2018/04/04} %<9pt>\ProvidesFile{mem9.clo}% %<9pt> [2008/01/30 v0.4 memoir class 9pt size option] %<10pt>\ProvidesFile{mem10.clo}% @@ -1141,27 +1143,28 @@ % senseless for a class to attempt to take account of everything that might % be used with it. % -% Note (2016/05/16): Due to recent changes in Luatex, most notably the -% removal of several \cs{pdf...} macro, several PDF tests fail with -% LuaLaTeX. As a temporary measure the following is used to restore -% the old functionality when a newer LuaLaTeX is used. Code courtesy -% of David Carlisle. At some point we will include some of this into -% the class. +% ^^A % Note (2016/05/16): Due to recent changes in Luatex, most notably the +% ^^A % removal of several \cs{pdf...} macro, several PDF tests fail with +% ^^A % LuaLaTeX. As a temporary measure the following is used to restore +% ^^A % the old functionality when a newer LuaLaTeX is used. Code courtesy +% ^^A % of David Carlisle. At some point we will include some of this into +% ^^A % the class. % \changes{v3.7f}{2016/05/16}{Temp measure to make the class work with % updated luatex} -% \begin{macrocode} -\ifx\pdfextension\@undefined\else - \RequirePackage{luatex85} -\fi - -% \end{macrocode} +% \changes{v3.7g}{2018/03/09}{\Lpack{luatex85} removed again, now +% relying on external \cs{if<engine>} packages and have rewritten the +% macros that use \cs{pdf...}} +% ^^A % \begin{macrocode} +% ^^A \ifx\pdfextension\@undefined\else +% ^^A \RequirePackage{luatex85} +% ^^A \fi +% ^^A +% ^^A % \end{macrocode} % % % \begin{macro}{\ifpdf} -% \begin{macro}{\pdftrue} -% \begin{macro}{\pdffalse} % This can be used to check whether or not a document is being processed -% by \LaTeX{} or pdf\LaTeX. +% by \LaTeX{} or pdf\LaTeX. We will simply require the \Lpack{ifpdf} package. % \changes{v1.0}{2001/09/21}{Made checking of \cs{pdfouput} more robust} % \changes{v1.618}{2005/09/03}{Prohibit loading the ifpdf package (mempatch v3.9)} % \changes{v1.618033}{2008/06/02}{Further improved pdf checking} @@ -1170,126 +1173,48 @@ % defined, e.g. using \cs{RequirePackage} before \cs{documentclass}, % then using \cs{newif}\cs{ifpdf} will cause TeX to eat up a lot of % code. We fix this using a hint by Will Robertson.} +% \changes{v3.7g}{2018/03/08}{As of 2018, we will no longer be +% emulating \cs{if}\meta{engine} packages, you'll get an error if you +% do not have them} % \begin{macrocode} -\newif\ifm@mifpdf - \m@mifpdffalse -\IfFileExists{ifpdf.sty}{\RequirePackage{ifpdf}\relax}{% - \ClassWarningNoLine{memoir}{% - Package `ifpdf' is not installed.\MessageBreak - The package is being emulated}% -\m@mifpdftrue -\expandafter\newif\csname ifpdf\endcsname - \pdffalse -\ifx\pdfoutput\undefined -\else - \ifx\pdfoutput\@undefined - \else - \ifx\pdfoutput\relax - \else - \ifnum\pdfoutput>0\relax - \pdftrue - \fi - \fi - \fi -\fi -%%\EmulatedPackage{ifpdf}[2008/07/23] -} - +\RequirePackage{ifpdf}[2017/03/15] % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro}{\ifetex} -% \begin{macro}{\etextrue} -% \begin{macro}{\etexfalse} -% Check if \texttt{etex} is being used. This is based on the check for -% \texttt{pdf(latex)}. Someone may have created a package for this, -% or perhaps not. +% Check if \texttt{etex} is being used. We will simply require the \Lpack{ifetex} package. % \changes{v1.61803}{2008/01/30}{Added check for etex (mempatch v4.9)} % \changes{v1.618033}{2008/06/02}{Improved check for etex} % \changes{v1.6180339}{2008/07/23}{Use an ifetex package if available} % \changes{v1.6180339c}{2008/12/27}{Changed ifetex message from Warning to Info} +% \changes{v3.7g}{2018/03/08}{As of 2018, we will no longer be +% emulating \cs{if}\meta{engine} packages, you'll get an error if you +% do not have them} % \begin{macrocode} -\newif\ifm@mifetex - \m@mifetexfalse -\IfFileExists{ifetex.sty}{\RequirePackage{ifetex}\relax}{% - \ClassInfo{memoir}{% - An `ifetex' package is being emulated}% -\m@mifetextrue -\newif\ifetex - \etexfalse -\ifx\eTeXversion\undefined -\else - \ifx\eTeXversion\@undefined - \else - \ifx\eTeXversion\relax - \else - \ifnum\eTeXversion>0\relax - \etextrue - \fi - \fi - \fi -\fi -%%\EmulatedPackage{ifetex}[2008/07/23] -} - +\RequirePackage{ifetex} % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% -% Having supplied an \cs{ifpdf} to check if pdfLaTeX is being used, +% Having supplied an \cs{ifpdf} to check if pdfLaTeX is being used, % here's one for XeTeX. % % \begin{macro}{\ifxetex} -% \begin{macro}{\xetextrue} -% \begin{macro}{\xetexfalse} -% \begin{macro}{\RequireXeTeX} -% Checks if XeTeX is being used. +% Checks if XeTeX is being used. We will simply require the \Lpack{ifxetex} package. % \changes{v1.61803}{2008/01/30}{Added checks for XeTeX (mempatch v4.9)} % \changes{v1.6180339}{2008/07/23}{Use ifxetex package if available} % \changes{v1.61803398d}{2009/12/01}{if \cs{ifxetex} is already % defined, e.g. using \cs{RequirePackage} before \cs{documentclass}, % then using \cs{newif}\cs{ifxetex} will cause TeX to eat up a lot of % code. We fix this using a hint by Will Robertson.} +% \changes{v3.7g}{2018/03/08}{As of 2018, we will no longer be +% emulating \cs{if}\meta{engine} packages, you'll get an error if you +% do not have them} % \begin{macrocode} -\newif\ifm@mifxetex - \m@mifxetexfalse -\IfFileExists{ifxetex.sty}{\RequirePackage{ifxetex}\relax}{% - \ClassWarningNoLine{memoir}{% - The `ifxetex' package is not installed.\MessageBreak - The package is being emulated}% -\expandafter\newif\csname ifxetex\endcsname -\@ifundefined{XeTeXrevision}{\xetexfalse}{\xetextrue} -\m@mifxetextrue% +\RequirePackage{ifxetex}[2010/09/12] % \end{macrocode} -% Check for XeTeX from the \Lpack{ifxetex} package. -% \begin{macrocode} -%%\EmulatedPackage{ifxetex}[2008/07/23] -} -\ifm@mifxetex% -% ifxetex package not found, emulate \RequireXeTeX -\def\RequireXeTeX{% - \ifxetex\else - \@memerror{XeTeX is required to process this document}% - {Try again with xelatex, not (pdf)latex.\MessageBreak - Or try removing any XeTeX package(s).} - \fi} -\fi - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} % \end{macro} % % \begin{macro}{\ifluatex} -% \begin{macro}{\luatextrue} -% \begin{macro}{\luatexfalse} -% Check if \texttt{luatex} is being used. This is based on the check for -% \texttt{pdf(latex)}. Someone may have created a package for this, or -% perhaps not. +% Check if \texttt{luatex} is being used. We will simply require the \Lpack{ifluatex} package. % \changes{v1.61803}{2008/01/30}{Added check for luatex} % \changes{v1.6180339}{2008/07/23}{Use an ifluatex package if available} % \changes{v1.6180339c}{2008/12/31}{It seems that Heiko Oberdiek has created an @@ -1298,33 +1223,14 @@ % defined, e.g. using \cs{RequirePackage} before \cs{documentclass}, % then using \cs{newif}\cs{ifluatex} will cause TeX to eat up a lot of % code. We fix this using a hint by Will Robertson.} +% \changes{v3.7g}{2018/03/08}{As of 2018, we will no longer be +% emulating \cs{if}\meta{engine} packages, you'll get an error if you +% do not have them} % \begin{macrocode} -\newif\ifm@mifluatex - \m@mifluatexfalse -\IfFileExists{ifluatex.sty}{\RequirePackage{ifluatex}\relax}{% - \ClassWarningNoLine{memoir}{% - The `ifluatex' package is not installed.\MessageBreak - The package is being emulated}% -\m@mifluatextrue -\expandafter\newif\csname ifluatex\endcsname - \luatexfalse -\ifx\luatexversion\@undefined -\else - \ifx\luatexversion\undefined - \else - \ifx\luatexversion\relax - \else - \luatextrue - \fi - \fi -\fi -%%\EmulatedPackage{ifluatex}[2008/07/23] -} +\RequirePackage{ifluatex}[2016/05/16] % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % % \subsection{Extending an existing macro} % @@ -2407,6 +2313,20 @@ % \end{macrocode} % +% \subsection{The \Lopt{fullptlayout} option} +% \changes{v3.7g}{2018/03/09}{Added the \Lopt{fullptlayout} option} +% \begin{macro}{\mem@settopoint} +% By default the class will truncate some layout lengths to a whole +% number of points.\footnote{Presumably because it looks better when +% the layout is written to the log.} This might not be desirable, so the +% \Lopt{fullptlayout} class option disables this truncation. +% \begin{macrocode} +\newcommand\mem@settopoint[1]{\@settopoint{#1}} +\DeclareOption{fullptlayout}{\renewcommand\mem@settopoint{\@gobble}} + +% \end{macrocode} +% \end{macro} +% % % \changes{v1.6180339f}{2009/07/12}{Added dead man switch for etex} % \subsection{ETeX} @@ -4556,8 +4476,10 @@ \fi % \end{macrocode} % Adjust the width to be a whole number of points. +% \changes{v3.7g}{2018/03/09}{Switch to private truncating macro so we +% can disable truncation via class option} % \begin{macrocode} -\@settopoint\textwidth +\mem@settopoint\textwidth % \end{macrocode} % \end{macro} @@ -4618,16 +4540,18 @@ % geometry through \cs{setsidebars}. % \changes{v1.618033}{2008/06/02}{Ensured initial value of \cs{marginparwidth} % was positive} +% \changes{v3.7g}{2018/03/09}{Switch to private truncating macro so we +% can disable truncation via class option} % \begin{macrocode} -\@settopoint\oddsidemargin -\@settopoint\marginparwidth +\mem@settopoint\oddsidemargin +\mem@settopoint\marginparwidth \ifdim\marginparwidth<1pt \setlength\marginparwidth{1pt}\fi \setlength\evensidemargin {\paperwidth} \addtolength\evensidemargin{-2in} \addtolength\evensidemargin{-\textwidth} \addtolength\evensidemargin{-\oddsidemargin} -\@settopoint\evensidemargin +\mem@settopoint\evensidemargin % \end{macrocode} % \end{macro} % \end{macro} @@ -4637,6 +4561,8 @@ % The \cs{topmargin} is the distance below the top of the printable % area (1in below the top of the paper) and the top of the box % containing the running head. +% \changes{v3.7g}{2018/03/09}{Switch to private truncating macro so we +% can disable truncation via class option} % \begin{macrocode} \setlength\topmargin {\paperheight} \addtolength\topmargin{-2in} @@ -4645,7 +4571,7 @@ \addtolength\topmargin{-\textheight} \addtolength\topmargin{-\footskip} \addtolength\topmargin{-.5\topmargin} -\@settopoint\topmargin +\mem@settopoint\topmargin % \end{macrocode} % \end{macro} @@ -4995,10 +4921,12 @@ % % % Set the values to the nearest whole point. +% \changes{v3.7g}{2018/03/09}{Switch to private truncating macro so we +% can disable truncation via class option} % \begin{macrocode} - \@settopoint\textwidth - \@settopoint\oddsidemargin - \@settopoint\evensidemargin + \mem@settopoint\textwidth + \mem@settopoint\oddsidemargin + \mem@settopoint\evensidemargin % \end{macrocode} % Fix standard page layouts after possible change of \cs{textwidth}. % \changes{v1.6180339f}{2009/03/16}{Added \cs{fixheaderwidths} to \cs{fixthelayout}} @@ -5180,7 +5108,6 @@ % same optional argument as \cs{checkthelayout}. % \changes{v0.2}{2001/06/03}{Replaced \cs{fixpagelayout} by \cs{checkandfixthelayout}} % \changes{v1.0a}{2002/01/18}{Partitioned \cs{checkandfixthelayout}} -% \begin{macrocode} % \changes{v1.61803}{2008/01/30}{Changed \cs{checkandfixthelayout} % for the extended \cs{checkthelayout} (mempatch v4.5)} % \begin{macrocode} @@ -5192,14 +5119,60 @@ % \end{macrocode} % \end{macro} % +% +% \begin{macro}{\mem@fixpagelayout} +% \changes{v3.7g}{2018/03/09}{Changed to use this instead of +% \cs{fixpdflayout} and \cs{fixdvipslayout}, then we no longer need \Lpack{luatex85}} +% Outputting the size of the output document. This is a little tricky as +% the various engines do not quite agree on which variables to use. As +% of 2018 we will be using this: First of \cs{pdfpageheight/width} is +% used by pdf(e)tex based enginges. We set them if they are +% defined. Just incase someone need to be able to patch this, we make +% it into a macro and just run it at the start of the cocument +% \begin{macrocode} +\newcommand\mem@fixpagelayout{% + \@ifundefined{pdfpageheight}{}{\pdfpageheight=\the\stockheight} + \@ifundefined{pdfpagewidth}{}{\pdfpagewidth=\the\stockwidth} +% \end{macrocode} +% Next comes the two macros that recent luaTeX versions use instead of +% the \cs{pdf...} equivalents. +% \begin{macrocode} + \@ifundefined{pageheight}{}{\pageheight=\the\stockheight} + \@ifundefined{pagewidth}{}{\pagewidth=\the\stockwidth} +% \end{macrocode} +% If is unclear why these were added to the class sources in the first +% place, we'll just leave them. +% \begin{macrocode} + \@ifundefined{pdfvorigin}{}{\ifdim\pdfvorigin=0pt\pdfvorigin=1in\fi} + \@ifundefined{pdfhorigin}{}{\ifdim\pdfhorigin=0pt\pdfhorigin=1in\fi} +% \end{macrocode} +% Lastly we need to output a special to the DVI, but other engines can +% also understand specials, so to not end up getting those pesky +% non-PDF special warnings, we need some engine tests before emiting +% the data to the DVI. +% \begin{macrocode} + \ifluatex\else + \ifxetex\else + \ifpdf\else + \AtBeginDvi{\special{papersize=\the\stockwidth,\the\stockheight}} + \fi + \fi + \fi +} + +\AtBeginDocument{\mem@fixpagelayout} + +% \end{macrocode} +% \end{macro} % % \begin{macro}{\fixpdflayout} % \begin{macro}{\fixdvipslayout} -% Page layout with pdf\LaTeX{} seems a bit iffy. -% At the suggestion of Lars Madsen, help with -% setting viewer (e.g., ghostview) -% window sizes for dvi/ps. \cs{fixdvipslayout} does for \file{dvi} output -% as \cs{fixpdflayout} does for \file{pdf} output. +% As of 2018 these are disabled +% ^^A % Page layout with pdf\LaTeX{} seems a bit iffy. +% ^^A % At the suggestion of Lars Madsen, help with +% ^^A % setting viewer (e.g., ghostview) +% ^^A % window sizes for dvi/ps. \cs{fixdvipslayout} does for \file{dvi} output +% ^^A % as \cs{fixpdflayout} does for \file{pdf} output. % \changes{v1.4}{2003/11/22}{Added \cs{fixpdflayout} (from patch v1.6)} % \changes{v1.4}{2003/12/01}{Added \cs{fixdvipslayout} } % \changes{v1.61803398}{2009/08/17}{on ctt dynamotwain suggested a @@ -5207,51 +5180,55 @@ % such that the \cs{special} is not outputtet when running xelatex} % \begin{macrocode} \newcommand*{\fixpdflayout}{% - \pdfpageheight=\the\stockheight - \pdfpagewidth=\the\stockwidth - \ifxetex\else - \ifdim\pdfvorigin=0pt\pdfvorigin=1in\fi - \ifdim\pdfhorigin=0pt\pdfhorigin=1in\fi - \fi} + \ClassWarning{memoir}{As of 2018, \string\fixpdflayout\ is no longer used} + % \pdfpageheight=\the\stockheight + % \pdfpagewidth=\the\stockwidth + % \ifxetex\else + % \ifdim\pdfvorigin=0pt\pdfvorigin=1in\fi + % \ifdim\pdfhorigin=0pt\pdfhorigin=1in\fi + % \fi +} \newcommand*{\fixdvipslayout}{% - \AtBeginDvi{\special{papersize=\the\stockwidth,\the\stockheight}}} - -\AtBeginDocument{% - \ifxetex - \fixpdflayout - \else - \ifpdf - \ifnum\pdfoutput<\@ne - \fixdvipslayout - \else - \fixpdflayout - \fi - \else - \fixdvipslayout - \fi - \fi} - + \ClassWarning{memoir}{As of 2018, \string\fixdvipslayout\ is no longer used} + %\AtBeginDvi{\special{papersize=\the\stockwidth,\the\stockheight}} +} % \end{macrocode} -% -% With a landscape document when going \texttt{latex -> dvips} the -% resulting \file{.ps} file -% may apear upside down in \texttt{ghostview}. If this happens, try putting -% the following in the document preamble: -% \begin{verbatim} -% \addtodef{\fixdvipslayout}{}{% -% \special{!TeXDict begin /landplus90{true}store end }} -% \end{verbatim} -% See \texttt{http://www.radicaleye.com.dvips.html} (DVIPS Home Page) for -% an explanation. -% -% Some other potential specials for PostScript printing may be -% (at least for an HP 5SiMx LaserJet duplex printer): -% \begin{verbatim} -% \special{!TeXDict begin <</Duplex true>> -% setpagedevice end} % duplex -% \special{!TeXDict begin <</Tumble true>> -% setpagedevice end} % short side binding -% \end{verbatim} + +% ^^A % \AtBeginDocument{% +% ^^A % \ifxetex +% ^^A % \fixpdflayout +% ^^A % \else +% ^^A % \ifpdf +% ^^A % \ifnum\pdfoutput<\@ne +% ^^A % \fixdvipslayout +% ^^A % \else +% ^^A % \fixpdflayout +% ^^A % \fi +% ^^A % \else +% ^^A % \fixdvipslayout +% ^^A % \fi +% ^^A % \fi} + +% +% ^^A % With a landscape document when going \texttt{latex -> dvips} the +% ^^A % resulting \file{.ps} file +% ^^A % may apear upside down in \texttt{ghostview}. If this happens, try putting +% ^^A % the following in the document preamble: +% ^^A % \begin{verbatim} +% ^^A % \addtodef{\fixdvipslayout}{}{% +% ^^A % \special{!TeXDict begin /landplus90{true}store end }} +% ^^A % \end{verbatim} +% ^^A % See \texttt{http://www.radicaleye.com.dvips.html} (DVIPS Home Page) for +% ^^A % an explanation. +% ^^A % +% ^^A % Some other potential specials for PostScript printing may be +% ^^A % (at least for an HP 5SiMx LaserJet duplex printer): +% ^^A % \begin{verbatim} +% ^^A % \special{!TeXDict begin <</Duplex true>> +% ^^A % setpagedevice end} % duplex +% ^^A % \special{!TeXDict begin <</Tumble true>> +% ^^A % setpagedevice end} % short side binding +% ^^A % \end{verbatim} % \end{macro} % \end{macro} % @@ -7456,13 +7433,17 @@ % addition. % \changes{v3.7d}{2014/07/28}{Delayed addition to % \cs{@xfloat}. Reported by Ulrike Fischer}. +% \changes{v3.7g}{2017/05/08}{Delayed the addition of the adjustment +% to the float until after \cs{normalsize}. Reported at \protect\url{https://tex.stackexchange.com/q/368422/3929}} % \begin{macrocode} \AtBeginDocument{ \let\m@m@xfloat\@xfloat \def\@xfloat #1[#2]{% \m@m@xfloat #1[#2]% \def\baselinestretch{\m@m@float@spacing}% - \normalsize} + \normalsize% + \@nameuse{#1adjustment}% + } } % \end{macrocode} @@ -7926,13 +7907,30 @@ % \begin{environment}{mem@titlingpage} % \begin{environment}{titlingpage} % \begin{environment}{titlingpage*} -% The \Lenv{titlingpage} environment sets the pagestyle to be \pstyle{titlingpage}, +% \begin{macro}{\titlingpageend} +% The \Lenv{titlingpage} environment sets the pagestyle to be \pstyle{titlingpage}, % disables the footnote rule and ensures that the page is single % column. At the end it switches back to twocolumn if neccessary, % and then starts a new page as number 1. On the other hand % \Lenv{titlingpage*}, does \emph{not} reset the page counter. +% +% At the end of the titlingpage we clear the page to let the next data +% start on a new page. However there is a slight complication +% here. Should we clear to next page or to next righthand page. One +% could argue that under \Lopt{twoside} going to next right hand page +% would be best, but then there is also \Lopt{openany}. In order to +% make this configurable we will factor this out in a configurable +% macro, and leave the defaults as they are so not to mess with +% existing documents. % \changes{v3.6k}{2012/12/24}{Added \Lenv{titlingpage*} env} +% \changes{v3.7g}{2018/03/06}{Added \cs{titlingpageend}} % \begin{macrocode} +\newcommand\titlingpageend[2]{% + \def\mem@titlingpage@clear@for@twoside{#1}% + \def\mem@titlingpage@clear@for@oneside{#2}% +} + % default +\titlingpageend{\cleardoublepage}{\clearpage} \newenvironment{mem@titlingpage}% {\let\footnoterule\relax \let\footnotesize\small @@ -7946,7 +7944,8 @@ }{% \thispagestyle{titlingpage}% \if@restonecol \twocolumn \fi - \if@twoside \cleardoublepage \else \clearpage \fi + % \if@twoside \cleardoublepage \else \clearpage \fi + \if@twoside \mem@titlingpage@clear@for@twoside \else \mem@titlingpage@clear@for@oneside \fi \if\mem@titlpg@reset\setcounter{page}{\@ne}\fi} \newenvironment{titlingpage}{% \def\mem@titlpg@reset{00}% @@ -7959,6 +7958,7 @@ \aliaspagestyle{titlingpage}{empty} % \end{macrocode} +% \end{macro} % \end{environment} % \end{environment} % \end{environment} @@ -12709,7 +12709,11 @@ \advance\labelwidth-\labelsep \topsep\topsepii \parsep\parsepii - \itemsep\parsepii} +% \end{macrocode} +% \changes{v3.7g}{2016/11/22}{Typo: \cs{itemsep} should here point at +% \cs{itemsepii}, reported by Thomas Koeppe, private email} +% \begin{macrocode} + \itemsep\itemsepii} \def\@listiii{\leftmargin\leftmarginiii \labelwidth\leftmarginiii @@ -13844,13 +13848,19 @@ % \begin{macro}{\@vslnumleft} % Internal code for right/left line numbers. % \changes{v1.61803398}{2009/07/17}{Added bidi support to \cs{@vslnumright} -% and \cs{@vslnumleft}} +% and \cs{@vslnumleft}} +% \changes{v3.7g}{2018/02/28}{Added \cs{nobreak} to both +% \cs{@vslnumright} and \cs{@vslnumleft}, reported on +% \protect\url{https://tex.stackexchange.com/a/415939/3929}, to avoid strange +% double line breaks} % \begin{macrocode} \newcommand*{\@vslnumright}{% + \nobreak% \hfill\rlap{%\kern\vrightskip\kern\rightmargin% \kern\memRTLvrightskip\kern\rightmargin% \vlvnumfont\getthelinenumber{poemline}{memfvsline}}} \newcommand*{\@vslnumleft}{% + \nobreak% \hfill\rlap{%\kern-\textwidth\kern-\vrightskip% \kern-\textwidth\kern-\memRTLvrightskip% \vlvnumfont\getthelinenumber{poemline}{memfvsline}}} @@ -14818,57 +14828,68 @@ %%%%%%%%%% With acknowledgements to %%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% Frank Mittelbach & David Carlisle %%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%% Copy corresponds to array.sty 2016/10/06 v2.4d %%%%%%%%% % \end{macrocode} +% \changes{v3.7g}{2018/03/05}{Updated the embedded copy of the +% \Lpack{array} package to version 2.4d, 2016/10/06} +% \begin{dlf} +% dlf: The \Lpack{array} package has redundant code (caused by a +% quick mashing of and earlier \Lpack{array} version and the +% \Lpack{newaray} package). In thus update (2018/03/05) this +% redundant code is \emph{not} removed as it makes it very hard to +% see where there are class changes to the \Lpack{array} code, and +% when stuff is simply removed. We'll leave it up to the LaTeXteam to +% clean up the \Lpack{array} code at some point. % +% The following is a carbon copy of the DTX code from +% \verb|array.dtx|, package specific \cs{changes} lines have been +% removed, and we have made any error/warning messages class specific, +% instead of package specific. +% \end{dlf} % + % \subsubsection{The construction of the preamble} % -% \begin{PW} -% PW: The original \Lpack{array} package has redundant code (caused by a quick -% mashing of an early \Lpack{array} and the \Lpack{newarray} packages). I -% have tried to remove the redundancies and overlaps. -% \end{PW} -% % It is obvious that those environments will consist mainly of an -% \cs{halign}, because \TeX\ typesets tables using this primitive. +% \verb=\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 \cs{halign} starting with a given user preamble +% a preamble for a \verb=\halign= starting with a given user preamble % using the options mentioned above. % % The most interesting macros of this implementation are without doubt % those which are responsible for the construction of the preamble for -% the \cs{halign}. The underlying algorithm was developed by +% the \verb=\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 \verb?{...}?. For example the preamble of -% \verb?\begin{tabular}?\linebreak[0]\verb?{lc||c@{\hspace{1cm}}}? consists of -% the \textsf{token} \texttt{l}, \texttt{c}, \verb?|?, \verb?|?, -% \texttt{@} and \verb?\hspace{1cm}?. +% enclosed in \verb={...}=. For example the preamble of +% \verb=\begin{tabular}=\linebreak[0]\verb={lc||c@{\hspace{1cm}}}= consists of +% the \textsf{token} \texttt{l}, \texttt{c}, \texttt{|}, \texttt{|}, +% \texttt{@} and \verb=\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 \verb?\hskip\tabcolsep?. Furthermore -% \verb?# \hfil? would be appended to define a flush left column. +% to begin with \verb=\hskip\tabcolsep=. Furthermore +% \verb=# \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 -% \verb?\hskip \tabcolsep & \hskip \tabcolsep?. The column which is to -% be centered will be appended with \verb?\hfil # \hfil?. -% The \textsf{token} \verb?|? would then add a space of -% \verb?\hskip \tabcolsep? +% \verb=\hskip \tabcolsep & \hskip \tabcolsep=. The column which is to +% be centered will be appended with \verb=\hfil # \hfil=. +% The \textsf{token} \texttt{|} would then add a space of +% \verb=\hskip \tabcolsep= % and a vertical line because the last % \textsf{tokens} was a \texttt{c}. -% The following \textsf{token} \verb?|? would only add a space -% \verb?\hskip \doublerulesep? because it was preceded by the -% \textsf{token} \verb?|?. We will not discuss our example further but +% The following \textsf{token} \texttt{|} would only add a space +% \verb=\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 -% \cs{halign} can be constructed as soon as the action of all +% \verb=\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} @@ -14882,25 +14903,23 @@ % Table~\ref{tab:Klassen} lists all \textsf{token} classes and % their corresponding numbers. % \begin{table}[ht] -% \begin{center} \ttfamily -% ^^A \begin{tabular}[t]{>{\ttfamily}ccc} -% \begin{tabular}[t]{ccc} -% \textsf{token} & \cs{@chclass} & \cs{@chnum} \\[2mm] +% \begin{center} +% \begin{tabular}[t]{>{\ttfamily}ccc} +% \textsf{token} & \verb=\@chclass= & \verb=\@chnum= \\[2mm] % c & 0 & 0 \\ % l & 0 & 1 \\ % r & 0 & 2 \\ % p-arg & 0 & 3 \\ % t-arg & 0 & 4 \\ % b-arg & 0 & 5 \\ -% \verb?|? & 1 & 0 \\ +% | & 1 & 0 \\ % !-arg & 1 & 1 \\ % <-arg & 2 & --- \\ % >-arg & 3 & --- % \end{tabular} % \kern3mm \vrule \kern3mm% -% ^^A \begin{tabular}[t]{>{\ttfamily}ccc} -% \begin{tabular}[t]{ccc} -% \textsf{token} & \cs{@chclass} & \cs{@chnum} \\[2mm] +% \begin{tabular}[t]{>{\ttfamily}ccc} +% \textsf{token} & \verb=\@chclass= & \verb=\@chnum= \\[2mm] % Start & 4 & --- \\ % @-arg & 5 & --- \\ % ! & 6 & --- \\ @@ -14922,16 +14941,16 @@ % \begin{macro}{\@lastchclass} % The class and the number of the current \textsf{token} are saved in % the -% \textsf{count} registers \cs{@chclass} -% and \cs{@chnum}, while the class of the previous +% \textsf{count} registers \verb=\@chclass= +% and \verb=\@chnum=, while the class of the previous % \textsf{token} is stored in the -% \textsf{count} register \cs{lastchclass}. +% \textsf{count} register \verb=\@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 explicitely -% whenever I use a \verb?%? sign. These parts are already defined in +% Later throughout the text I will not mention it again explicitly +% whenever I use a \verb=%= sign. These parts are already defined in % \texttt{latex.tex}. % \begin{macrocode} % \newcount \@chclass @@ -14946,28 +14965,33 @@ % % \begin{macro}{\@addtopreamble} % We will save the already constructed preamble for -% the \cs{halign} -% in the global macro \cs{@preamble}. This will then be +% the \verb=\halign= +% in the global macro \verb=\@preamble=. This will then be % enlarged with -% the command \cs{@addtopreamble}. +% the command \verb=\@addtopreamble=. % \begin{macrocode} \def\@addtopreamble#1{\xdef\@preamble{\@preamble #1}} % \end{macrocode} % \end{macro} % % +% +% +% +% \subsubsection{The character class of a \textsf{token}} +% % \begin{macro}{\@testpach} -% With the help of \cs{@lastchclass} we can now define a macro +% With the help of \verb=\@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 -% \cs{@chclass} and \cs{@chnum}. +% \verb=\@chclass= and \verb=\@chnum=. % \begin{macrocode} \def\@testpach{\@chclass % \end{macrocode} % First we deal with the cases in which the \textsf{token} -% (\verb?#1?) is the argument of \texttt{!}, \texttt{@}, \texttt{<} or -% \texttt{>}. We can see this from the value of \cs{@lastchclass}: +% (\verb=#1=) is the argument of \texttt{!}, \texttt{@}, \texttt{<} or +% \texttt{>}. We can see this from the value of \verb=\@lastchclass=: % \begin{macrocode} \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else \ifnum \@lastchclass=7 5 \else @@ -14975,28 +14999,28 @@ \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 \cs{@chnum} if our +% class $0$ +% and assign the corresponding number to \verb=\@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}, \cs{@chnum} already has the right value. This is the +% \texttt{b}, \verb=\@chnum= already has the right value. This is the % reason for the somewhat curious choice of the \textsf{token} -% numbers in class 10. +% numbers in class $10$. % \begin{macrocode} \ifnum \@lastchclass = 10 \else % \end{macrocode} -% Otherwise we will check if \cs{@nextchar} is either a \texttt{c}, +% Otherwise we will check if \verb=\@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 -% \cs{@nextchar} once thereby turning the first token of its +% \verb=\@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 \cs{@nextchar} which put into via a -% \cs{def}. +% been the only char present in \verb=\@nextchar= which put into via a +% \verb=\def=. % \begin{macrocode} \edef\@nextchar{\expandafter\string\@nextchar}% \@chnum @@ -15005,20 +15029,20 @@ \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 \cs{@chnum} because this value -% is needed for the \verb?|?--\textsf{token}. Now we must check -% the remaining classes. Note that the value of \cs{@chnum} is +% not $0$. We assign the value $0$ to \verb=\@chnum= because this value +% is needed for the \texttt{|}--\textsf{token}. Now we must check +% the remaining classes. Note that the value of \verb=\@chnum= is % insignificant here for most classes. % \begin{macrocode} \z@ \@chclass - \if\@nextchar |\@ne \else%| emacs + \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). +% \texttt{m} and \texttt{b} (class $10$). % \begin{macrocode} 10 \@chnum @@ -15027,18 +15051,129 @@ \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 \cs{if}'s. +% so we choose class $0$ and number $0$ and give an error message. +% Then we finish the macro by closing all \verb=\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} % -% The preamble will be enlarged with the help of \cs{xdef}, but the +% +% +% +% +% \subsubsection{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 \verb=*{=\textit{N\/}\verb=}{=\textit{String\/}\verb=}= 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 \verb=@{*}=. +% +% This macro is called via +% \verb=\@xexpast=\meta{preamble}\verb=*0x\@@=. +% The $*$--expression \verb=*0x= is being used to terminate the +% recursion, +% as we shall see later, and \verb=\@@= serves as an argument +% delimiter. \verb=\@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} (\verb=#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 (\verb=#1=) +% in a \PlainTeX\ \textsf{token} register. +% We also save \textit{String} (\verb=#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 \verb=\def\@tempa{#1}= and then +% \textit{N} times \verb=\edef\@tempa{\@tempa#3}=. This would have the +% undesired effect that all macros within \verb=#1= and \verb=#3= +% would be expanded, although, for example, constructions like +% \verb=@{..}= are not supposed to be changed. +% That is why we \verb=\let= two control sequences to +% be equivalent to \verb=\relax=. +% \begin{macrocode} + \let\the@toksz\relax \let\the@toks\relax +% \end{macrocode} +% Then we ensure that \verb=\@tempa= contains +% \verb={\the@toksz\the@toks...\the@toks}= (the macro +% \verb=\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 \verb=\@xexpast=. Otherwise we assume we have reached the end of +% the user preamble, because we had appended \verb=*0x\@@= when we first +% called \verb=\@xexpast=. In other words: if the user inserts +% \verb=*{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 \verb=\@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 \verb=\@tempa=. We will put the contents of +% \verb=\@tempa= and the rest of the user preamble together and work +% on the result with \verb=\@tempb=. This macro either corresponds +% to \verb=\@xexpast=, so that the next +% $*$--expression is handled, or to the macro \verb=\@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 \verb=\@xexnoop=. +% Its argument is delimited by \verb=\@@= and it simply expands to +% nothing. +% \begin{macrocode} +% \def\@xexnoop#1\@@{} +% \end{macrocode} +% \end{macro} +% +% +% +% +% \subsubsection{The insertion of declarations +% (\texttt{>}, \texttt{<}, \texttt{!}, \texttt{@})} +% +% +% The preamble will be enlarged with the help of \verb=\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 \cs{protect}). So we have to find a +% implementation that doesn't need a \verb=\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 @@ -15048,44 +15183,51 @@ % there are only 256 \textsf{token} registers. But then, who needs % tables with more than 100 columns? % -% So how do we proceed? Let us assume that we had \verb?!{foo}? in the +% One could also find a solution which only needs two or three +% \textsf{token} registers by proceeding similarly as in the macro +% \verb=\@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 \verb=!{foo}= in the % user preamble and say we saved \texttt{foo} in -% \textsf{token} register 5. Then we call -% \verb?\@addtopreamble{\the@toks5}? where -% \cs{the@toks} is defined in a way that it does not expand -% (for example it could be equivalent to \cs{relax}). Every +% \textsf{token} register $5$. Then we call +% \verb=\@addtopreamble{\the@toks5}= where +% \verb=\the@toks= is defined in a way that it does not expand +% (for example it could be equivalent to \verb=\relax=). Every % following call -% of \cs{@addtopreamble} leaves \cs{the@toks5} unchanged in -% \cs{@preamble}. If the construction of the preamble is completed -% we change the definition of \cs{the@toks} to -% \verb?\the\toks? and expand \cs{@preamble} for the last time. +% of \verb=\@addtopreamble= leaves \verb=\the@toks5= unchanged in +% \verb=\@preamble=. If the construction of the preamble is completed +% we change the definition of \verb=\the@toks= to +% \verb=\the\toks= and expand \verb=\@preamble= for the last time. % During this process all parts of the form -% \cs{the@toks}\meta{Number} +% \verb=\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 \cs{@preamble} global; therefore the +% reason we keep all assignments to \verb=\@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 \cs{count@} +% initialized with $-1$ if we want to begin with the \textsf{token} +% register $0$. We use the \PlainTeX\ scratch register \verb=\count@= % because everything takes place locally. All we have to do is -% insert \cs{the@toks} \cs{the} \cs{count@} into the preamble. -% \cs{the@toks} will remain unchanged and \verb?\the\count@? expands into +% insert \verb=\the@toks= \verb=\the= \verb=\count@= into the preamble. +% \verb=\the@toks= will remain unchanged and \verb=\the\count@= expands into % the saved number. % \end{macro} % % \begin{macro}{\prepnext@tok} -% The macro \cs{prepnext@tok} is in charge of preparing the next +% The macro \verb=\prepnext@tok= is in charge of preparing the next % \textsf{token} register. For that purpose we increase -% \cs{count@} by 1: +% \verb=\count@= by $1$: % \begin{macrocode} \def\prepnext@tok{\advance \count@ \@ne % \end{macrocode} @@ -15093,69 +15235,80 @@ % \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 \cs{@nextchar} (see the -% definition of \cs{@mkpream}). The macro -% \cs{save@decl} saves it into the next free \textsf{token} register, -% i.e.\ in \verb?\toks\count@?. -% 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, \verb?>{foo}>{bar}..?. Users are not encouraged to -% enter such expressions directly, but they may result from the -% rewriting of \cs{newcolumntype}'s. +% \textsf{token} is always saved in the macro \verb=\@nextchar= (see the +% definition of \verb=\@mkpream= on page \pageref{@mkpream}). The macro +% \verb=\save@decl= saves it into the next free \textsf{token} register, +% i.e.\ in \verb=\toks\count@=. % \begin{macrocode} -\def\save@decl{\toks \count@ = \expandafter\expandafter\expandafter - {\expandafter\@nextchar\the\toks\count@}} - +\def\save@decl{\toks\count@ \expandafter{\@nextchar}} % \end{macrocode} +% The reason for the use of \verb=\relax= is the following +% hypothetical situation in the preamble: +% \quad \verb=..\the\toks1\the\toks2..= \quad \TeX\ expands +% \verb=\the\toks2= first in order to find out if the digit \verb=1= +% is followed by other digits. E.g.\ a \verb=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 \verb=\save@decl= which +% inserted a \verb=\relex= inside the token register. This is now moved to +% the places where the actual token registers are inserted (look for +% \verb=\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 \verb?>{..}? and \verb?<{..}? having to be inserted at this -% moment because formating instructions like \cs{hfil} have to be set -% around them. On the other hand it is not known yet, if any \verb?<{..}? +% register from \verb=>{..}= and \verb=<{..}= having to be inserted at this +% moment because formatting instructions like \verb=\hfil= have to be set +% around them. On the other hand it is not known yet, if any \verb=<{..}= % 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 \cs{prepnext@tok}. +% in \verb=\prepnext@tok=. % % \begin{macro}{\insert@column} % \begin{macro}{\@sharp} -% We now define the macro \cs{insert@column} which will do +% We now define the macro \verb=\insert@column= which will do % this work for us. % \begin{macrocode} \def\insert@column{% % \end{macrocode} % Here, we assume that the \textsf{count} register -% \cs{@tempcnta} has saved the value \verb?\count@?-1. +% \verb=\@tempcnta= has saved the value $\verb=\count@= - 1$. % \begin{macrocode} \the@toks \the \@tempcnta % \end{macrocode} -% Next follows the \verb?#? sign which specifies the place +% Next follows the \verb=#= sign which specifies the place % where the text of the column shall be inserted. To avoid % errors during the expansions in -% \cs{@addtopreamble} we hide this sign in the command -% \cs{@sharp} which is temporarily occupied with -% \cs{relax} during the build-up of the preamble. +% \verb=\@addtopreamble= we hide this sign in the command +% \verb=\@sharp= which is temporarily occupied with +% \verb=\relax= during the build-up of the preamble. % To remove unwanted spaces before and after the column text, we set -% an \cs{ignorespaces} in front and a \cs{unskip} afterwards. +% an \verb=\ignorespaces= in front and a \verb=\unskip= afterwards. % \begin{macrocode} \ignorespaces \@sharp \unskip % \end{macrocode} % Then the second \textsf{token} register follows whose number should -% be saved in \cs{count@}. +% be saved in \verb=\count@=. % We make sure that there will be no further expansion after reading -% the number, by finishing with \cs{relax}. The case above is not -% critical since it is ended by \cs{ignorespaces}. +% the number, by finishing with \verb=\relax=. The case above is not +% critical since it is ended by \verb=\ignorespaces=. % \begin{macrocode} \the@toks \the \count@ \relax} % \end{macrocode} @@ -15163,53 +15316,32 @@ % \end{macro} % % -% \begin{macro}{\m@mold@addamp} -% \begin{macro}{\m@m@addamp} -% \begin{macro}{\@addamp} % -% In the preamble a \verb?&? has to be inserted between any two columns; -% before the first column there should not be a \verb?&?. As the user -% preamble may start with a \verb?|? we have to remember somehow -% if we have already inserted a \verb?#? (i.e.\ a column). This is done -% with the boolean variable \cs{if@firstamp} that we test in -% \cs{@addamp}, the macro that inserts the \verb?&?. % -% \begin{PW} -% PW: Later on, for horizontal lines in `continuous' tabulars, -% I need to know how many columns there are in a tabular. I need a modified -% kernel's \cs{@addamp} to do this and use the kernel's \cs{@curtab} -% (a counter used in tabbing) to store the number of columns. -% -% \cs{m@mold@addamp} stores the kernel's definition of \cs{@addamp}, and -% \cs{m@m@addamp} is the revised definition. -% \end{PW} +% \subsubsection{The separation of columns} % +% \begin{macro}{\@addamp} +% In the preamble a \verb=&= has to be inserted between any two columns; +% before the first column there should not be a \verb=&=. As the user +% preamble may start with a \texttt{|} we have to remember somehow +% if we have already inserted a \verb=#= (i.e.\ a column). This is done +% with the boolean variable \verb=\if@firstamp= that we test in +% \verb=\@addamp=, the macro that inserts the \verb=&=. % \begin{macrocode} % \newif \@iffirstamp -\let\m@mold@addamp\@addamp -\newcommand*{\m@m@addamp}{% - \if@firstamp - \@firstampfalse - \global\@curtab\@ne - \else - \@addtopreamble{&} - \global\advance\@curtab\@ne - \fi} -\let\@addamp\m@m@addamp - +% \def\@addamp{\if@firstamp \@firstampfalse +% \else \@addtopreamble &\fi} % \end{macrocode} % \end{macro} -% \end{macro} -% \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 \cs{col@sep} is a \textsf{dimen} register which is set -% equivalent to \cs{arraycolsep} in an \textsf{array}--environment, -% otherwise it is set equivalent to \cs{tabcolsep}. +% Here \verb=\col@sep= is a \textsf{dimen} register which is set +% equivalent to \verb=\arraycolsep= in an \textsf{array}--environment, +% otherwise it is set equivalent to \verb=\tabcolsep=. % \begin{macrocode} \newdimen\col@sep \def\@acol{\@addtopreamble{\hskip\col@sep}} @@ -15219,145 +15351,139 @@ % \end{macro} % \end{macro} % +% +% \subsubsection{The macro \texttt{\textbackslash @mkpream}} +% % \begin{macro}{\@mkpream} % \begin{macro}{\the@toks} +% \label{@mkpream} % Now we can define the macro which builds up the preamble for the -% \cs{halign}. -% First we initialize \cs{@preamble}, \cs{@lastchclass} -% and the boolean variable \cs{if@firstamp}. +% \verb=\halign=. +% First we initialize \verb=\@preamble=, \verb=\@lastchclass= +% and the boolean variable \verb=\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 -% \verb?#? sign; this would lead to an error message in the next -% \cs{@addtopreamble} call. -% Instead, we use the command \cs{@sharp} at places where later -% a \verb?#? will be. -% This command is at first given the meaning \cs{relax}; +% \verb=#= sign; this would lead to an error message in the next +% \verb=\@addtopreamble= call. +% Instead, we use the command \verb=\@sharp= at places where later +% a \verb=#= will be. +% This command is at first given the meaning \verb=\relax=; % therefore it will not be expanded when the preamble % is extended. -% In the macro \cs{@array}, shortly before the \cs{halign} -% is carried out, \cs{@sharp} is given its final meaning. +% In the macro \verb=\@array=, shortly before the \verb=\halign= +% is carried out, \verb=\@sharp= is given its final meaning. % % In a similar way, -% we deal with the commands \cs{@startpbox} and -% \cs{@endpbox}, although the reason is different here: these +% we deal with the commands \verb=\@startpbox= and +% \verb=\@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} -% Now we remove possible \verb?*?-forms and user-defined column -% specifiers in the user preamble by repeatedly executing the list -% \cs{NC@list} until the re-writes have no more effect. The -% expanded preamble will then be in the token register -% \cs{@temptokena}. Actually we need to know at this point that -% this is not \cs{toks0}. +% Now we remove possible $*$-forms in the user preamble with the +% command \verb=\@xexpast=. As we already know, this command saves +% its result in the macro \verb=\@tempa=. % \begin{macrocode} - \@temptokena{#1}\@tempswatrue - \@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}% + \@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, -% \cs{count@} has to contain the value -1. +% Since we want to start with the \textsf{token} register $0$, +% \verb=\count@= has to contain the value $-1$. % \begin{macrocode} \count@\m@ne \let\the@toks\relax % \end{macrocode} -% Then we call up \cs{prepnext@tok} in order to prepare the -% \textsf{token} register 0 for use. +% Then we call up \verb=\prepnext@tok= in order to prepare the +% \textsf{token} register $0$ for use. % \begin{macrocode} \prepnext@tok % \end{macrocode} -% Having expanded all tokens defined using \cs{newcolumntype} (including -% \verb?*?), we evaluate the remaining tokens, which are saved in -% \cs{@temptokena}. We use the \LaTeX--macro \cs{@tfor} to inspect each -% token in turn. -% The strange appearing construction with \cs{expandafter} is +% To evaluate the user preamble (without stars) saved in +% \verb=\@tempa= we use the \LaTeX--macro \verb=\@tfor=. +% The strange appearing construction with \verb=\expandafter= is % based on the fact that we have to put the replacement text of -% \cs{@tempa} and not the macro \cs{@tempa} to this +% \verb=\@tempa= and not the macro \verb=\@tempa= to this % \LaTeX--macro. % \begin{macrocode} \expandafter \@tfor \expandafter \@nextchar - \expandafter :\expandafter =\the\@temptokena \do + \expandafter :\expandafter =\@tempa \do % \end{macrocode} -% The body of this loop (the group after the \cs{do}) +% The body of this loop (the group after the \verb=\do=) % is executed for one \textsf{token} at a time, whereas -% the current \textsf{token} is saved in \cs{@nextchar}. +% the current \textsf{token} is saved in \verb=\@nextchar=. % At first we evaluate the current \textsf{token} with the already -% defined macro \cs{@testpach}, i.e.\ we assign to -% \cs{@chclass} the character class and to \cs{@chnum} +% defined macro \verb=\@testpach=, i.e.\ we assign to +% \verb=\@chclass= the character class and to \verb=\@chnum= % the character number of this \textsf{token}. % \begin{macrocode} {\@testpach % \end{macrocode} -% Then we branch out depending on the value of \cs{@chclass} into +% Then we branch out depending on the value of \verb=\@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 -% \end{macrocode} -% Class 9 is equivalent to class 10. -% \begin{macrocode} - \or \@classx + \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 \cs{@nextchar} has to be saved into the current -% \textsf{token} register; therefore we call up \cs{save@decl} +% \textsf{token} cannot have the character class $4$ (start) we +% have skipped this possibility. If the character class is $3$, +% only the content of \verb=\@nextchar= has to be saved into the current +% \textsf{token} register; therefore we call up \verb=\save@decl= % directly and save a macro name. After the preamble has been -% extended we assign the value of \cs{@chclass} to the counter -% \cs{@lastchclass} to assure that this information will be available +% extended we assign the value of \verb=\@chclass= to the counter +% \verb=\@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 \cs{@lastchclass} we perform +% Depending on the value of \verb=\@lastchclass= we perform % the necessary operations. % \begin{macrocode} \ifcase\@lastchclass % \end{macrocode} -% If the last class equals 0 we add a -% \verb?\hskip \col@sep?. +% If the last class equals $0$ we add a +% \verb=\hskip \col@sep=. % \begin{macrocode} \@acol \or % \end{macrocode} -% If it equals 1 we do not add any additional space so that the +% 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 \verb?<{...}? can -% only directly follow after class 0. +% Class $2$ is treated like class $0$ because a \verb=<{...}= 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 -% \verb?>{..}? there must always follow a \texttt{c}, \texttt{l}, +% preamble was defective. Class $3$ is not allowed since after a +% \verb=>{..}= 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 \verb?{..}?. +% error and ignore the declaration given by \verb={..}=. % \begin{macrocode} \@preamerr \thr@@ \or % \end{macrocode} -% If \cs{@lastchclass} is 4 the user preamble has been empty. -% To continue, we insert a \verb?#? in the preamble. +% If \verb=\@lastchclass= is $4$ the user preamble has been empty. +% To continue, we insert a \verb=#= 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 \verb?@{..}?) we need not +% Class $5$ is allowed again. In this case +% (the user preamble ends with \verb=@{..}=) we need not % do anything. % \begin{macrocode} \or % \end{macrocode} -% Any other case means that the arguments to \verb?@?, \texttt{!}, +% Any other case means that the arguments to \verb=@=, \texttt{!}, % \texttt{<}, \texttt{>}, \texttt{p}, \texttt{m} or \texttt{b} have % been forgotten. So we report an error and ignore the last % \textsf{token}. @@ -15366,7 +15492,7 @@ % \end{macrocode} % Now that the build-up of the preamble is almost finished we can % insert the \textsf{token} registers and therefore redefine -% \cs{the@toks}. The actual insertion, though, is performed +% \verb=\the@toks=. The actual insertion, though, is performed % later. % \begin{macrocode} \def\the@toks{\the\toks}} @@ -15374,66 +15500,71 @@ % \end{macro} % \end{macro} % -% The preamble is extended by the macros \cs{@classz} to -% \cs{@classx} which are called by \cs{@mkpream} -% depending on \cs{@lastchclass} +% +% +% \subsubsection{The macros \texttt{\textbackslash @classz} +% to \texttt{\textbackslash @classx}} +% +% The preamble is extended by the macros \verb=\@classz= to +% \verb=\@classx= which are called by \verb=\@mkpream= +% depending on \verb=\@lastchclass= % (i.e. the character class of the last \textsf{token}). % \begin{macro}{\@classx} -% First we define \cs{@classx} because of its important r\^ole. +% 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 \cs{@lastchclass} different actions +% Depending on the value of \verb=\@lastchclass= different actions % must take place: % \begin{macrocode} \ifcase \@lastchclass % \end{macrocode} -% If the last character class was 0 we separate the columns by -% \verb?\hskip\col@sep? followed by \verb?&? and another -% \verb?\hskip\col@sep?. +% If the last character class was $0$ we separate the columns by +% \verb=\hskip\col@sep= followed by \verb=&= and another +% \verb=\hskip\col@sep=. % \begin{macrocode} \@acolampacol \or % \end{macrocode} -% If the last class was class 1 --- that means that a vertical +% If the last class was class $1$ --- that means that a vertical % line was -% drawn, --- before this line a \verb?\hskip\col@sep? was inserted. -% Therefore there has to be only a \verb?&? followed by -% \verb?\hskip\col@sep?. But this \verb?&? may be inserted only +% drawn, --- before this line a \verb=\hskip\col@sep= was inserted. +% Therefore there has to be only a \verb=&= followed by +% \verb=\hskip\col@sep=. But this \verb=&= may be inserted only % if this is not the first column. This process is controlled -% by \cs{if@firstamp} in the macro \cs{addamp}. +% by \verb=\if@firstamp= in the macro \verb=\addamp=. % \begin{macrocode} \@addamp \@acol \or % \end{macrocode} -% Class 2 is treated like class 0 because \verb?<{...}? can only -% follow after class 0. +% Class $2$ is treated like class $0$ because \verb=<{...}= can only +% follow after class $0$. % \begin{macrocode} \@acolampacol \or % \end{macrocode} -% Class 3 requires no actions because all things necessary have +% 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 \verb?\hskip\col@sep? and -% then call \cs{@firstampfalse}. This makes sure that a later -% \cs{@addamp} inserts the character -% \verb?&? into the preamble. +% Class $4$ means that we are at the beginning of the preamble. +% Therefore we start the preamble with \verb=\hskip\col@sep= and +% then call \verb=\@firstampfalse=. This makes sure that a later +% \verb=\@addamp= inserts the character +% \verb=&= into the preamble. % \begin{macrocode} \@acol \@firstampfalse \or % \end{macrocode} -% For class 5 \textsf{tokens} only the character \verb?&? is inserted -% as a column separator. Therefore we call \cs{@addamp}. +% For class $5$ \textsf{tokens} only the character \verb=&= is inserted +% as a column separator. Therefore we call \verb=\@addamp=. % \begin{macrocode} \@addamp % \end{macrocode} % Other cases are impossible. For an example -% \verb?\@lastchclass = 6? ---a s it might appear in a -% preamble of the form \verb?...!p...? --- \texttt{p} would have -% been taken as an argument of \texttt{!} by \cs{@testpach}. +% $\verb=\@lastchclass= = 6$---as it might appear in a +% preamble of the form \verb=...!p...=---\texttt{p} would have +% been taken as an argument of \texttt{!}\ by \verb=\@testpach=. % \begin{macrocode} \fi} % \end{macrocode} @@ -15441,44 +15572,44 @@ % % % \begin{macro}{\@classz} -% If the character class of the last \textsf{token} is 0 we have +% 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 +% 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 \cs{@lastchclass} has -% the value 10 at this point nothing happens when \cs{@classx} is -% called. So the macro \cs{@chlassz} may start like this: +% \texttt{m}, \texttt{b} or \texttt{p}). Since \verb=\@lastchclass= has +% the value $10$ at this point nothing happens when \verb=\@classx= is +% called. So the macro \verb=\@chlassz= may start like this: % \begin{macrocode} \def\@classz{\@classx % \end{macrocode} -% According to the definition of \cs{insert@column} we must store +% According to the definition of \verb=\insert@column= we must store % the number of the \textsf{token} register in which a preceding -% \verb?>{..}? might have stored its argument into -% \cs{@tempcnta}. +% \verb=>{..}= might have stored its argument into +% \verb=\@tempcnta=. % \begin{macrocode} \@tempcnta \count@ % \end{macrocode} -% To have \verb?\count@ = \@tmpcnta + 1? we prepare +% To have $\verb=\count@= = \verb=\@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 determinated by \cs{@chnum}. +% can be determined by \verb=\@chnum=. % \begin{macrocode} \@addtopreamble{\ifcase \@chnum % \end{macrocode} -% If \cs{@chnum} has the value 0 a centered column has to be +% If \verb=\@chnum= has the value $0$ a centered column has to be % generated. % So we begin with stretchable space. % \begin{macrocode} \hfil % \end{macrocode} -% The command \cs{d@llarbegin} follows expanding into \cs{begingroup} -% (in the \textsf{tabular}--environment) or into \verb?$?. Doing this -% (provided an appropriate setting of \cs{d@llarbegin}) we achieve +% The command \verb=\d@llarbegin= follows expanding into \verb=\begingroup= +% (in the \textsf{tabular}--environment) or into \verb=$=. Doing this +% (provided an appropriate setting of \verb=\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. @@ -15487,245 +15618,245 @@ % \end{macrocode} % Now we insert the contents of the two \textsf{token} registers % and the symbol -% for the column entry (i.e.\ \verb?#? or -% more precise \cs{@sharp}) using \cs{insert@column}. +% for the column entry (i.e.\ \verb=#= or +% more precise \verb=\@sharp=) using \verb=\insert@column=. % \begin{macrocode} \insert@column % \end{macrocode} -% We end this case with \cs{d@llarend} and \cs{hfil} where \cs{d@llarend} -% again is either \verb?$? or \cs{endgroup}. +% We end this case with \verb=\d@llarend= and \verb=\hfil= where \verb=\d@llarend= +% again is either \verb=$= or \verb=\endgroup=. % \begin{macrocode} \d@llarend \hfil \or % \end{macrocode} -% The templates for \texttt{l} and \texttt{r} (i.e.\ \cs{@chnum} 1 -% or 2) are generated the same way. Since one \cs{hfil} is +% The templates for \texttt{l} and \texttt{r} (i.e.\ \verb=\@chnum= $1$ +% or $2$) are generated the same way. Since one \verb=\hfil= is % missing the text is moved to the relevant side. -% The \verb?\kern\z@? is needed in case of an empty column +% The \verb=\kern\z@= is needed in case of an empty column % entry. Otherwise -% the \cs{unskip} in \cs{insert@column} removes the -% \cs{hfil}. Changed to \verb?\hskip1sp? so that it interacts better with -% \cs{@bsphack}. +% the \verb=\unskip= in \verb=\insert@column= removes the +% \verb=\hfil=. Changed to \verb=\hskip1sp= so that it interacts better with +% \verb=\@bsphack=. % \begin{macrocode} \hskip1sp\d@llarbegin \insert@column \d@llarend \hfil \or \hfil\hskip1sp\d@llarbegin \insert@column \d@llarend \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 \cs{vcenter}. This command is allowed only in math -% mode. Therefore we start with a~\verb?$?. +% by \verb=\vcenter=. This command is allowed only in math +% mode. Therefore we start with a~\verb=$=. % \begin{macrocode} - $\vcenter%$ + $\vcenter%$ emacs % \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 \cs{@startpbox} and -% \cs{@endpbox}. \cs{@startpbox} has an argument: +% is built by the macros \verb=\@startpbox= and +% \verb=\@endpbox=. \verb=\@startpbox= has an argument: % the width of the column which is stored in the current -% \textsf{token} (i.e.\ \cs{@nextchar}). +% \textsf{token} (i.e.\ \verb=\@nextchar=). % Between these two macros we find the well known -% \cs{insert@column}. +% \verb=\insert@column=. % \begin{macrocode} - \@startpbox{\@nextchar}\insert@column \@endpbox $\or%$ + \@startpbox{\@nextchar}\insert@column \@endpbox $\or%$ emacs % \end{macrocode} % The templates for \texttt{p} and \texttt{b} are generated in the -% same way though we do not need the \verb?$? characters because we use -% \cs{vtop} or \cs{vbox}. +% same way though we do not need the \verb=$= characters because we use +% \verb=\vtop= or \verb=\vbox=. % \begin{macrocode} \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or \vbox \@startpbox{\@nextchar}\insert@column \@endpbox % \end{macrocode} -% Other values for \cs{@chnum} are impossible. Therefore we -% end the arguments to \cs{@addtopreamble} and \cs{ifcase}. -% Before we come to the end of \cs{@classz} we have to +% Other values for \verb=\@chnum= are impossible. Therefore we +% end the arguments to \verb=\@addtopreamble= and \verb=\ifcase=. +% Before we come to the end of \verb=\@classz= we have to % prepare the next \textsf{token} register. % \begin{macrocode} \fi}\prepnext@tok} - % \end{macrocode} % \end{macro} % +% % \begin{macro}{\@classix} -% Class 9 (\texttt{>}--\textsf{token}) prevented repeated -% \verb?>? declarations for the same column. This restriction has been eased, -% making class 9 equivalent to class 10. -% \changes{v1.618}{2005/09/03}{Let \cs{@classix} to \cs{relax} (mempatch v3.10)} +% 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 \verb=..>{...}>{...}..= which +% is not allowed. We only give an error message and continue. +% So the declarations defined by the first \verb=>{...}= +% are ignored. % \begin{macrocode} -\let\@classix\relax - +\def\@classix{\ifnum \@lastchclass = \thr@@ + \@preamerr \thr@@ \fi +% \end{macrocode} +% Furthermore, we call up \verb=\@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} % If the current \textsf{token} is a \texttt{<} the last character -% class must be 0, or 2 (as repeated \verb?<? expressions are allowed). -% In this case it is not necessary to extend the -% preamble. Otherwise we output an error message, set \cs{@chclass} -% to 6 and call \cs{@classvi}. By doing this we achieve that +% class must be $0$. In this case it is not necessary to extend the +% preamble. Otherwise we output an error message, set \verb=\@chclass= +% to $6$ and call \verb=\@classvi=. By doing this we achieve that % \texttt{<} is treated like \texttt{!}. % \begin{macrocode} -\def\@classviii{\ifnum \@lastchclass >\z@\ifnum\@lastchclass=\tw@\else - \@preamerr 4\@chclass 6 \@classvi \fi\fi} - +\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 \cs{@arrayrule}. In the original a line without -% width (e.g., the space between \verb?cc? and \verb?c|c? -% is equal) is created by multiple insertions of -% \verb?\hskip .5\arrayrulewidth?. +% the definition of \verb=\@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 +% \verb=\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 -% (\verb?@? \textsf{token}) the preamble need not to be extended. -% In the original definition \verb?\@lastchclass = 1? -% is treated by inserting \verb?\hskip .5\arrayrulewidth?. -% We only check if the last \textsf{token} was of class 3 which is +% As a consequence it follows that in case of class $7$ +% (\verb=@= \textsf{token}) the preamble need not to be extended. +% In the original definition $\verb=\@lastchclass= = 1$ +% is treated by inserting \verb=\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 \verb?>{...}?, because these are overwritten +% by the last \verb=>{...}=, 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 -% \verb?\hskip\col@sep?. If the last \textsf{token} was of class 1 -% (for instance \verb?|?) we extend with \verb?\hskip \doublerulesep? -% because the construction \verb?!{...}? has to be treated like -% \verb?|?. +% last class was $0$ or $2$ we extend the preamble with +% \verb=\hskip\col@sep=. If the last \textsf{token} was of class $1$ +% (for instance \texttt{|}) we extend with \verb=\hskip \doublerulesep= +% because the construction \verb=!{...}= has to be treated like +% \texttt{|}. % \begin{macrocode} \def\@classvi{\ifcase \@lastchclass \@acol \or \@addtopreamble{\hskip \doublerulesep}\or \@acol \or % \end{macrocode} -% Now \verb?\@preamerr...? should follow because a -% user preamble of the form \verb?..>{..}!.? is not allowed. -% To save memory we call \cs{@classvii} instead which also +% Now \verb=\@preamerr...= should follow because a +% user preamble of the form \verb=..>{..}!.= is not allowed. +% To save memory we call \verb=\@classvii= instead which also % does what we want. % \begin{macrocode} \@classvii % \end{macrocode} -% If \cs{@lastchclass} is 4 or 5 nothing has to be done. -% Class 6 to 10 are not possible. +% If \verb=\@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 +% 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} (\cs{@nextchar}) into the corresponding +% \textsf{token} (\verb=\@nextchar=) into the corresponding % \textsf{token} register since the preparation and % insertion of these registers -% are done by the macro \cs{@classz}. -% This is equivalent to calling \cs{save@decl} in the case of -% class 3. To save command identifiers we do this call up -% in the macro \cs{@mkpream}. +% are done by the macro \verb=\@classz=. +% This is equivalent to calling \verb=\save@decl= in the case of +% class $3$. To save command identifiers we do this call up +% in the macro \verb=\@mkpream=. % -% Class 2 exhibits a more complicated situation: the +% Class $2$ exhibits a more complicated situation: the % \textsf{token} registers have already been inserted by -% \cs{@classz}. So the value of \cs{count@} is too high -% by one. Therefore we decrease \cs{count@} by 1. +% \verb=\@classz=. So the value of \verb=\count@= is too high +% by one. Therefore we decrease \verb=\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 \cs{save@decl} and then -% increase the value of \cs{count@} again. At this point we +% Next we store the current \textsf{token} into the correct +% \textsf{token} register by calling \verb=\save@decl= and then +% increase the value of \verb=\count@= again. At this point we % can save memory once more (at the cost of time) if we use the -% macro \cs{prepnext@tok}. +% macro \verb=\prepnext@tok=. % \begin{macrocode} \save@decl\prepnext@tok} - % \end{macrocode} % \end{macro} % \end{macro} % +% % \begin{macro}{\@classv} -% Class 5 is \texttt{@}-expressions (and is also called by class 1) -% We do not expand the -% \verb?@?-expression, but instead explicitly replace an -% \cs{extracolsep} command by an assignment to \cs{tabskip} by a -% method similar to the \cs{newcolumntype} system described later. +% 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 - \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@ +% \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 +% \verb=\d@llar...='s. +% \begin{macrocode} \@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 \verb?\extracolsep{1in}? to -% \verb?\tabskip1in\relax?. As a side effect discard any tokens after a -% second \cs{extracolsep}, there is no point in the user entering two of -% these commands anyway, so this is not really a restriction. +% Finally we must prepare the next \textsf{token} register. % \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} - + \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 \cs{@classx}. -% Analogously the macro \cs{@classvi} can be used for class 1. +% In the case of class $0$ we were able to generate the necessary +% space between columns by using the macro \verb=\@classx=. +% Analogously the macro \verb=\@classvi= can be used for class $1$. % \begin{macrocode} \def\@classi{\@classvi % \end{macrocode} -% Depending on \cs{@chnum} a vertical line +% Depending on \verb=\@chnum= a vertical line % \begin{macrocode} \ifcase \@chnum \@arrayrule \or % \end{macrocode} -% or (in case of \verb?!{...}?) the current \textsf{token} --- stored -% in \cs{@nextchar} --- has to be inserted into the preamble. -% This corresponds to calling \cs{@classv}. +% or (in case of \verb=!{...}=) the current \textsf{token} --- stored +% in \verb=\@nextchar= --- has to be inserted into the preamble. +% This corresponds to calling \verb=\@classv=. % \begin{macrocode} \@classv \fi} - % \end{macrocode} % \end{macro} % % % % \begin{macro}{\@startpbox} -% In \cs{@classz} the macro \cs{@startpbox} is used. +% In \verb=\@classz= the macro \verb=\@startpbox= is used. % The width of the \textsf{parbox} is passed as an argument. -% \cs{vcenter}, \cs{vtop} or \cs{vbox} are already in the +% \verb=\vcenter=, \verb=\vtop= or \verb=\vbox= are already in the % preamble. So we start with the braces for the wanted box. % \begin{macrocode} \def\@startpbox#1{\bgroup % \end{macrocode} % The argument is the width of the box. This information has to be -% assigned to \cs{hsize}. -% Then we assain default values to several parameters used in a +% assigned to \verb=\hsize=. +% Then we assign default values to several parameters used in a % \textsf{parbox}. % \begin{macrocode} \setlength\hsize{#1}\@arrayparboxrestore @@ -15733,21 +15864,21 @@ % 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 \cs{@arstrut}. That means that it can be +% should be defined by \verb=\@arstrut=. That means that it can be % greater than the distance in a \textsf{parbox}. -% Therefore it is not enough to set a \cs{@arstrut} at the +% Therefore it is not enough to set a \verb=\@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 -% \cs{@arstrutbox} +% \verb=\@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 -% \cs{parindent} changes via \verb?>{...}?. +% \verb=\parindent= changes via \verb=>{...}=. % \begin{macrocode} \everypar{% \vrule \@height \ht\@arstrutbox \@width \z@ @@ -15757,13 +15888,13 @@ % \end{macro} % % \begin{macro}{\@endpbox} -% If there are any declarations defined by \verb?>{...}? -% and \verb?<{...}? -% they now follow in the macro \cs{@classz} --- the contents +% If there are any declarations defined by \verb=>{...}= +% and \verb=<{...}= +% they now follow in the macro \verb=\@classz= --- the contents % of the column in between. -% So the macro \cs{@endpbox} must insert the \textsf{specialstrut} +% So the macro \verb=\@endpbox= must insert the \textsf{specialstrut} % mentioned earlier and then close the group opened by -% \cs{@startpbox}. +% \verb=\@startpbox=. % \begin{macrocode} \def\@endpbox{\@finalstrut\@arstrutbox \egroup\hfil} % \end{macrocode} @@ -15774,24 +15905,24 @@ % % \begin{macro}{\@array} % After we have discussed the macros needed for the evaluation -% of the user preamble we can define the macro \cs{@array} -% which uses these macros to create a \cs{halign}. +% of the user preamble we can define the macro \verb=\@array= +% which uses these macros to create a \verb=\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 \verb?|c|c|c|?. +% e.g.\ it has the form \verb=|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 -% \cs{arraystretch}. +% \verb=\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 \cs{extrarowheight}. +% the value of the parameter \verb=\extrarowheight=. % \begin{macrocode} \@tempdima \ht \strutbox \advance \@tempdima by\extrarowheight @@ -15801,33 +15932,33 @@ \@width \z@}% % \end{macrocode} % Then we open a group, in which the user preamble is evaluated by -% the macro \cs{@mkpream}. As we know this must happen locally. -% This macro creates a preamble for a \cs{halign} and saves -% its result globally in the control sequence \cs{@preamble}. +% the macro \verb=\@mkpream=. As we know this must happen locally. +% This macro creates a preamble for a \verb=\halign= and saves +% its result globally in the control sequence \verb=\@preamble=. % \begin{macrocode} \begingroup \@mkpream{#2}% % \end{macrocode} -% We again redefine \cs{@preamble} so that a call up of \cs{@preamble} -% now starts the \cs{halign}. Thus also the arguments of \texttt{>}, +% We again redefine \verb=\@preamble= so that a call up of \verb=\@preamble= +% now starts the \verb=\halign=. Thus also the arguments of \texttt{>}, % \texttt{<}, \texttt{@} and \texttt{!}, saved in the % \textsf{token} registers are inserted into the preamble. The -% \cs{tabskip} at the beginning and end of the preamble is set to -% \textsf{0pt} (in the beginning by the use of \cs{ialign}). Also the -% command \cs{@arstrut} is build in, which inserts the -% \cs{@arstrutbox}, defined above. Of course, the opening brace after -% \cs{ialign} has to be implicit as it will be closed in \cs{endarray} +% \verb=\tabskip= at the beginning and end of the preamble is set to +% \textsf{0pt} (in the beginning by the use of \verb=\ialign=). Also the +% command \verb=\@arstrut= is build in, which inserts the +% \verb=\@arstrutbox=, defined above. Of course, the opening brace after +% \verb=\ialign= has to be implicit as it will be closed in \verb=\endarray= % or another macro. % -% The \cs{noexpand} in front of \cs{ialign} does no harm in standard \LaTeX{} +% The \verb=\noexpand= in front of \verb=\ialign= does no harm in standard \LaTeX{} % and was added since some experimental support for using text glyphs in math -% redefines \cs{halign} with the result that is becomes expandable with -% disastrous results in cases like this. +% redefines \verb=\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 \cs{protect} is set (which is not necessary in this +% not surface because there \verb=\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 \cs{noexpand} a curtesy to allow an +% approach is open to question; consider the \verb=\noexpand= a courtesy to allow an % unsupported redefinition of a \TeX{} primitive for the moment (as people rely % on that experimental code). % \begin{macrocode} @@ -15835,61 +15966,69 @@ \bgroup \@arstrut \@preamble \tabskip \z@ \cr}% % \end{macrocode} -% What we have not explained yet is the macro \cs{@halignto} +% What we have not explained yet is the macro \verb=\@halignto= % that was just used. Depending on its replacement text the -% \cs{halign} becomes a \cs{halign} \texttt{to} \meta{dimen}. +% \verb=\halign= becomes a \verb=\halign= \texttt{to} \meta{dimen}. % Now we close the group again. Thus -% \cs{@startpbox} and \cs{@endpbox} as well as all +% \verb=\@startpbox= and \verb=\@endpbox= as well as all % \textsf{token} registers get their former meaning back. % \begin{macrocode} \endgroup % \end{macrocode} -% To support other packages we include a hook +% 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. % \begin{macrocode} \@arrayleft % \end{macrocode} % Now we decide depending on the position argument in which -% \textsf{box} the \cs{halign} is to be put. (\cs{vcenter} may be used +% \textsf{box} the \verb=\halign= is to be put. (\verb=\vcenter= may be used % because we are in math mode.) % \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 -% \cs{@preamble} in \cs{@mkpream} the \verb?#? sign must be -% hidden in the macro \cs{@sharp} which is \cs{let} to -% \cs{relax} at that moment (see definition of \cs{@mkpream}). +% \verb=\@preamble= in \verb=\@mkpream= the \verb=#= sign must be +% hidden in the macro \verb=\@sharp= which is \verb=\let= to +% \verb=\relax= at that moment (see definition of \verb=\@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 \cs{lineskip} and \cs{baselineskip} -% to \textsf{0pt}. Since there have to be set \verb?$?'s +% between rows by setting \verb=\lineskip= and \verb=\baselineskip= +% to \textsf{0pt}. Since there have to be set \verb=$='s % around every column in the \textsf{array}--environment -% the parameter \cs{mathsurround} should +% the parameter \verb=\mathsurround= should % also be set to \textsf{0pt}. This prevents additional space between % the rows. The -% \PlainTeX--macro \cs{m@th} does this. +% \PlainTeX--macro \verb=\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 \verb?\\?. We also have to -% redefine the command \cs{par} in such a way that empty lines in -% \cs{halign} cannot do any damage. We succeed in doing so +% to specify) to the line separator \verb=\\=. We also have to +% redefine the command \verb=\par= in such a way that empty lines in +% \verb=\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 \cs{@preamble} to -% start the wanted \cs{halign}. +% After that we only have to call up \verb=\@preamble= to +% start the wanted \verb=\halign=. % \begin{macrocode} \let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble} % \end{macrocode} % \end{macro} % +% \begin{macro}{\arraybackslash} +% Restore \verb=\\= for use in array and tabular environment (after +% \verb=\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 @@ -15902,9 +16041,9 @@ % \end{macro} % % \begin{macro}{\@arstrut} -% Now the insertion of \cs{@arstrutbox} through \cs{@arstut} +% Now the insertion of \verb=\@arstrutbox= through \verb=\@arstut= % is easy since we know exactly in which mode \TeX\ is while working -% on the \cs{halign} preamble. +% on the \verb=\halign= preamble. % \begin{macrocode} \def\@arstrut{\unhcopy\@arstrutbox} % \end{macrocode} @@ -15914,22 +16053,22 @@ % \subsubsection{The line separator \texttt{\textbackslash\textbackslash}} % % \begin{macro}{\@arraycr} -% In the macro \cs{@array} the line separator \verb?\\? is -% \cs{let} to the command \cs{@arraycr}. +% In the macro \verb=\@array= the line separator \verb=\\= is +% \verb=\let= to the command \verb=\@arraycr=. % Its definition starts with a special brace which I have directly % copied from the original definition. It is -% necessary, because the \cs{futurlet} in \cs{@ifnextchar} +% necessary, because the \verb=\futurlet= in \verb=\@ifnextchar= % might -% expand a following \verb?&? \textsf{token} in a construction like -% \verb?\\ &?. This would otherwise end the alignment template at a +% expand a following \verb=&= \textsf{token} in a construction like +% \verb=\\ &=. 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., \verb?{}?, because the command will also -% be used for the array environment, i.e., in math mode. In that -% case an extra \verb?{}? would produce an ord atom which could mess up +% producing a real group, i.e.\ \verb={}=, because the command will also +% be used for the array environment, i.e.\ in math mode. In that +% case an extra \verb={}= 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 \verb?&? will not be considered belonging to the current -% \cs{halign} while we are looking for a \verb?*? or \verb?[?. +% that a \verb=&= will not be considered belonging to the current +% \verb=\halign= while we are looking for a \verb=*= or \verb=[=. % For further information see % \cite[Appendix D]{bk:knuth}. % \begin{macrocode} @@ -15944,14 +16083,14 @@ % \end{macro} % % \begin{macro}{\@xarraycr} -% In the command \cs{@xarraycr} we test if an optional argument +% In the command \verb=\@xarraycr= we test if an optional argument % exists. % \begin{macrocode} \def\@xarraycr{\@ifnextchar [% % \end{macrocode} -% If it does, we branch out into the macro \cs{@argarraycr} if +% If it does, we branch out into the macro \verb=\@argarraycr= if % not we close the special brace (mentioned above) and end the row -% of the \cs{halign} with a \cs{cr}. +% of the \verb=\halign= with a \verb=\cr=. % \begin{macrocode} \@argarraycr {\ifnum 0=`{}\fi\cr}} % \end{macrocode} @@ -15960,30 +16099,30 @@ % % \begin{macro}{\@argarraycr} % If additional space is requested by the user this case is treated -% in the macro \cs{@argarraycr}. First we close the special brace +% in the macro \verb=\@argarraycr=. First we close the special brace % and then we test if the additional space is positive. % \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 \verb?\dp\@arstutbox?${}+{}$\meta{wanted\ space}. +% depth \verb=\dp\@arstutbox=${}+{}$\meta{wanted\ space}. % Thus we achieve that all vertical lines specified -% in the user preamble by a \verb?|? are now +% in the user preamble by a \texttt{|} are now % generally drawn. -% Then the row ends with a \cs{cr}. +% Then the row ends with a \verb=\cr=. % -% If the space is negative we end the row at once with a \cs{cr} -% and move back up with a \cs{vskip}. +% If the space is negative we end the row at once with a \verb=\cr= +% and move back up with a \verb=\vskip=. % % While testing these macros I found out that the -% \cs{endtemplate} -% created by \cs{cr} and \verb?&? is something like an -% \cs{outer} primitive and therefore it should not appear in -% incomplete \cs{if} statements. Thus the following solution was -% chosen which hides the \cs{cr} in other macros when \TeX\ +% \verb=\endtemplate= +% created by \verb=\cr= and \verb=&= is something like an +% \verb=\outer= primitive and therefore it should not appear in +% incomplete \verb=\if= statements. Thus the following solution was +% chosen which hides the \verb=\cr= in other macros when \TeX\ % is skipping conditional text. % \begin{macrocode} - \expandafter\@xargarraycr\else + \expandafter\@xargarraycr\else \expandafter\@yargarraycr\fi{#1}} % \end{macrocode} % \end{macro} @@ -16007,7 +16146,7 @@ % % \begin{macro}{\multicolumn} % If several columns should be held together with a special format -% the command \cs{multicolumn} must be used. It has three +% the command \verb=\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. % \begin{macrocode} @@ -16019,45 +16158,45 @@ % \begin{macrocode} \multispan{#1}\begingroup % \end{macrocode} -% Since a \cs{multicolumn} should only describe the format of a -% result column, we redefine \cs{@addamp} in such a way that one gets +% Since a \verb=\multicolumn= should only describe the format of a +% result column, we redefine \verb=\@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 -% \cs{multicolumn} is therefore worked through correctly as well. +% \verb=\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 -% \cs{@mkpream}. +% \verb=\@mkpream=. % Now we still have to insert the contents of the \textsf{token} -% register into the \cs{@preamble}, i.e.\ we have to say -% \verb?\xdef\@preamble{\@preamble}?. This is achieved shorter by +% register into the \verb=\@preamble=, i.e.\ we have to say +% \verb=\xdef\@preamble{\@preamble}=. This is achieved shorter by % writing: % \begin{macrocode} \@mkpream{#2}\@addtopreamble\@empty % \end{macrocode} -% After the \cs{@preamble} is created we forget all local +% After the \verb=\@preamble= is created we forget all local % definitions and occupations of the \textsf{token} registers. -% \begin{macrocode} +% \begin{macrocode} \endgroup % \end{macrocode} -% In the special situation of \cs{multicolumn} \cs{@preamble} -% is not needed as preamble for a \cs{halign} but it is directly -% inserted into our table. Thus instead of \cs{sharp} -% there has to be the column entry (\verb?#3?) wanted by the user. +% In the special situation of \verb=\multicolumn= \verb=\@preamble= +% is not needed as preamble for a \verb=\halign= but it is directly +% inserted into our table. Thus instead of \verb=\sharp= +% there has to be the column entry (\verb=#3=) wanted by the user. % \begin{macrocode} \def\@sharp{#3}% % \end{macrocode} -% Now we can pass the \cs{@preamble} to \TeX\ . For safety -% we start with an \cs{@arstrut}. This should usually be in the +% Now we can pass the \verb=\@preamble= to \TeX\ . For safety +% we start with an \verb=\@arstrut=. This should usually be in the % template for the first column however we do not know if this -% template was overwritten by our \cs{multicolumn}. -% We also add a \cs{null} at the right end to prevent any following -% \cs{unskip} (for example from \verb?\\[..]?) to remove the \cs{tabcolsep}. +% template was overwritten by our \verb=\multicolumn=. +% We also add a \verb=\null= at the right end to prevent any following +% \verb=\unskip= (for example from \verb=\\[..]=) to remove the \verb=\tabcolsep=. % \begin{macrocode} \@arstrut \@preamble \null @@ -16067,27 +16206,31 @@ % % % -% \subsubsection{The environment definitions} +% \subsubsection{The Environment Definitions} % % After these preparations we are able to define the environments. They -% only differ in the initialisations of \cs{d@llar...}, \cs{col@sep} -% and \cs{@halignto}. +% only differ in the initialisations of \verb=\d@llar...=, \verb=\col@sep= +% and \verb=\@halignto=. % % \begin{macro}{\@halignto} % \begin{macro}{\d@llarbegin} % \begin{macro}{\d@llarend} -% In order to relieve the \textsf{save stack} we assign the -% replacement texts for \cs{@halignto} globally. \cs{d@llar} has to be -% local since otherwise nested \textsf{tabular} and \textsf{array} -% environments (via \cs{multicolumn}) are impossible. -% When the new font selection scheme is in force we have to -% we surround all \cs{halign} entries +% \verb=\d@llar= has to be +% locally asigned since otherwise nested \textsf{tabular} and \textsf{array} +% environments (via \verb=\multicolumn=) are impossible. +% For 25 years or so \verb=\@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 \verb=\@halignto= +% setting of a tabular in the main text resulting in a very weird error. +% When the new font selection scheme is in force we have to +% we surround all \verb=\halign= entries % with braces. See remarks in TUGboat 10\#2. Actually we are going -% to use \cs{begingroup} and \cs{endgroup}. However, this is only +% to use \verb=\begingroup= and \verb=\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 \cs{d@llarbegin} and -% \cs{d@llarend} between groups and dollar signs. +% level. Therefore we switch the settings of \verb=\d@llarbegin= and +% \verb=\d@llarend= between groups and dollar signs. % \begin{macrocode} \let\d@llarbegin\begingroup \let\d@llarend\endgroup @@ -16098,10 +16241,10 @@ % % % \begin{macro}{\array} -% Our new definition of \cs{array} then reads: +% Our new definition of \verb=\array= then reads: % \begin{macrocode} \def\array{\col@sep\arraycolsep - \def\d@llarbegin{$}\let\d@llarend\d@llarbegin\gdef\@halignto{}%$ + \def\d@llarbegin{$}\let\d@llarend\d@llarbegin\def\@halignto{}%$ emacs % \end{macrocode} % Since there might be an optional argument we call another % macro which is also used by the other environments. @@ -16110,45 +16253,36 @@ % \end{macrocode} % \end{macro} % -% % \begin{macro}{\@tabarray} -% This macro tests for an optional bracket and then calls up -% \cs{@@array} or \verb?\@@array[c]? (as default). +% This macro tests for a optional bracket and then calls up +% \verb=\@array= or \verb=\@array[c]= (as default). % \begin{macrocode} -\def\@tabarray{\@ifnextchar[{\@@array}{\@@array[c]}} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\@@array} -% This macro could then test an optional delimiter before the -% left brace of the main preamble argument. At this point -% it simply is let to be \cs{@array}. -% \begin{macrocode} -\let\@@array\@array +\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 \cs{@halignto}. Therefore +% The environments \textsf{tabular} and \textsf{tabular$*$} differ +% only in the initialisation of the command \verb=\@halignto=. Therefore % we define % \begin{macrocode} -\def\tabular{\gdef\@halignto{}\@tabular} +\def\tabular{\def\@halignto{}\@tabular} % \end{macrocode} -% and analoguesly for the star form. We evalute the argument first -% using \cs{setlength} so that users of the \texttt{calc} package can -% write code like\\ \verb?\begin{tabular*}{(\columnwidth-1cm)/2}...? +% 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\\ \verb=\begin{tabular*}{(\columnwidth-1cm)/2}...= % \begin{macrocode} \expandafter\def\csname tabular*\endcsname#1{% \setlength\dimen@{#1}% - \xdef\@halignto{to\the\dimen@}\@tabular} + \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 \cs{@tabular} macro: +% The rest of the job is carried out by the \verb=\@tabular= macro: % \begin{macrocode} \def\@tabular{% % \end{macrocode} @@ -16158,57 +16292,52 @@ % \begin{macrocode} \leavevmode % \end{macrocode} -% It should be taken into consideration that the macro \cs{@array} +% It should be taken into consideration that the macro \verb=\@array= % must be called in math mode. Therefore we open a \textsf{box}, -% insert a \verb?$? and then assign the correct values to \cs{col@sep} and -% \cs{d@llar...}. +% insert a \verb=$= and then assign the correct values to \verb=\col@sep= and +% \verb=\d@llar...=. % \begin{macrocode} - \hbox \bgroup $\col@sep\tabcolsep \let\d@llarbegin\begingroup%$ + \hbox \bgroup $\col@sep\tabcolsep \let\d@llarbegin\begingroup% $ emacs \let\d@llarend\endgroup % \end{macrocode} % Now everything \textsf{tabular} specific is done and we are able to -% call the \cs{@tabarray} macro. +% call the \verb=\@tabarray= macro. % \begin{macrocode} \@tabarray} % \end{macrocode} % \end{macro} % -% % \begin{macro}{\endarray} -% \begin{macro}{\@arrayleft} -% \begin{macro}{\@arrayright} % When the processing of \textsf{array} is finished we have to -% close the \cs{halign} +% close the \verb=\halign= % and afterwards the surrounding \textsf{box} selected by -% \cs{@array}. To save \textsf{token} space we then redefine -% \cs{@preamble} +% \verb=\@array=. To save \textsf{token} space we then redefine +% \verb=\@preamble= % because its replacement text isn't longer needed. -% We have to declare the hook, \cs{@arrayleft}, we put into \cs{@array} above. -% A similar hook `\cs{@arrayright}' is inserted into the -% \cs{endarray} to gain control. Both defaults to empty. % \begin{macrocode} -\def\endarray{\crcr \egroup \egroup \@arrayright \gdef\@preamble{}} -\let\@arrayleft\@empty -\let\@arrayright\@empty +\def\endarray{\crcr \egroup \egroup \gdef\@preamble{}} % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro}{\endtabular} % \begin{macro}{\endtabular*} -% To end a \textsf{tabular} or \textsf{tabular*} environment we -% call up \cs{endarray}, close the math mode and then the surrounding -% \cs{hbox}. +% To end a \textsf{tabular} or \textsf{tabular$*$} environment we +% call up \verb=\endarray=, close the math mode and then the surrounding +% \verb=\hbox=. % \begin{macrocode} -\def\endtabular{\endarray $\egroup}%$ +\def\endtabular{\endarray $\egroup}%$ emacs \expandafter\let\csname endtabular*\endcsname=\endtabular % \end{macrocode} % \end{macro} % \end{macro} % -% We should \cs{let} all macros -% to \cs{relax} that were used in the kernel but are no longer +% +% +% \subsubsection{Last minute definitions} +% +% +% If this file is used as a package file we should \verb=\let= all macros +% to \verb=\relax= that were used in the original but are no longer % necessary. % \begin{macrocode} \let\@ampacol=\relax \let\@expast=\relax @@ -16220,58 +16349,76 @@ % \end{macrocode} % % \begin{macro}{\@preamerr} -% We also have to redefine the error routine \cs{@preamerr} since +% We also have to redefine the error routine \verb=\@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: }% - \ClassError{memoir}{% + %\PackageError{array}{% + \ClassError{memoir}{% changed in menoir \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} % % % -% \subsubsection{Defining your own column specifiers} +% \subsubsection +% [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.} % -% \begin{macro}{\newcolumntype} +% \begin{macro}{\newcolumn} % In \texttt{newarray.sty} the macro for specifying new columns was -% named \cs{newcolumn}. When the functionality was added to -% \texttt{array.sty} the command was renamed \cs{newcolumntype}. -% The \cs{newcolumntype} macro gives users the chance +% named \verb"\newcolumn". When the functionality was added to +% \texttt{array.sty} the command was renamed \verb"\newcolumntype". +% Initially both names were supported, but now (In versions of this +% package distributed for \LaTeXe) the old name is not defined. +% \end{macro} +% +% \begin{macro}{\newcolumntype} +% As +% described above, the \verb"\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} -% \cs{NC@char} is so that active characters, like \verb?@? in -% AMS\LaTeX\ may be used. Note that we need to use the possibly active token, -% \verb?#1?, in several places, as that is the token that actually +% \verb"\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, +% \verb"#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 \cs{newcommand} we give a warning rather than an error if it is -% defined. If it is a new column, add \cs{NC@do} \meta{column} to -% the list \cs{NC@list}. +% Unlike \verb"\newcommand" we give a warning rather than an error if it is +% defined. If it is a new column, add \verb"\NC@do" \meta{column} to +% the list \verb"\NC@list". % \begin{macrocode} \@ifundefined{NC@find@\NC@char}% - {\@tfor\next:=<>clrmbp@!|\do{\if\noexpand\next\NC@char%|emacs - \@memwarn{Redefining primitive column \NC@char}\fi}% + {\@tfor\next:=<>clrmbp@!|\do{\if\noexpand\next\NC@char + %\PackageWarning{array}% + \@memwarn{Redefining primitive column \NC@char}\fi}% memoir change \NC@list\expandafter{\the\NC@list\NC@do#1}}% - {\@memwarn{Column \NC@char\space is already defined}}% + {%\PackageWarning{array} + \@memwarn{Column \NC@char\space is already defined}}% memoir change % \end{macrocode} % Now we define a macro with an argument delimited by the new column -% specifier, this is used to find occurences of this specifier in the +% 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}}% @@ -16283,66 +16430,67 @@ % \end{macro} % \begin{macro}{\newcol@} % We can now define the macro which does the rewriting, -% \cs{@reargdef} takes the same arguments as \cs{newcommand}, but +% \verb"\@reargdef" takes the same arguments as \verb"\newcommand", but % does not check that the command is new. For a column, say `D' with -% one argument, define a command \cs{NC@rewrite@D} with one -% argument, which recursively calls \cs{NC@find} on the user preamble +% one argument, define a command \verb"\NC@rewrite@D" with one +% argument, which recursively calls \verb"\NC@find" on the user preamble % after replacing the first token or group with the replacement text -% specified in the \cs{newcolumntype} command. \cs{NC@find} will find the -% next occurrence of `D' as it will be \cs{let} equal to -% \cs{NC@find@D} by \cs{NC@do}. +% specified in the \verb"\newcolumntype" command. \verb"\NC@find" will find the +% next occurrence of `D' as it will be \verb"\let" equal to +% \verb"\NC@find@D" by \verb"\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 occurence of the new column, save the preamble -% before the column in \cs{@temptokena}, then check to see if we +% Having found an occurrence of the new column, save the preamble +% before the column in \verb"\@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 \cs{NC@do}). +% specifier will be placed at the end of the preamble by \verb"\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 \cs{NC@do} will place a \cs{relax} +% We can tell that we are at the end as \verb"\NC@do" will place a \verb"\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 -% \cs{@temptokena}.) +% \verb"\@temptokena".) % \begin{macrocode} \ifx\next\relax % \end{macrocode} -% Otherwise set the flag \cs{if@tempswa}, and rewrite the column. +% Otherwise set the flag \verb"\if@tempswa", and rewrite the column. +% \verb"\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 \cs{NC@list}) will look like -% \verb?\NC@do *? \verb?\NC@do C? \verb?\NC@do L?. -% So we need to define \cs{NC@do} as a one argument macro which +% rewrites (in the token register \verb"\NC@list") will look like +% \verb"\NC@do *" \verb"\NC@do C" \verb"\NC@do L". +% So we need to define \verb"\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 \cs{NC@rewrite} and \cs{NC@find} be -% \cs{NC@rewrite@C} and \cs{NC@find@C} respectively. +% First we let \verb"\NC@rewrite" and \verb"\NC@find" be +% \verb"\NC@rewrite@C" and \verb"\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 \cs{@temptokena} after putting the present -% contents of the register in front of the token \cs{NC@find}. At the -% end we place the tokens `\verb?C\relax?' which \cs{NC@ifend} will use +% Clear the token register \verb"\@temptokena" after putting the present +% contents of the register in front of the token \verb"\NC@find". At the +% end we place the tokens `\verb"C\relax"' which \verb"\NC@ifend" will use % to detect the end of the user preamble. % \begin{macrocode} \expandafter\@temptokena\expandafter{\expandafter}% @@ -16351,14 +16499,14 @@ % \end{macro} % % \begin{macro}{\showcols} -% This macro is useful for debugging \cs{newcolumntype} specifications, -% it is the equivalent of the primitive \cs{show} command for macro -% definitions. All we need to do is locally redefine \cs{NC@do} to take -% its argument (say `C') and then \cs{show} the (slightly modified) -% definition of \cs{NC@rewrite@C}. Actually as the the list always -% starts off with \verb?\NC@do *? and we do not want to print the -% definition of the *-form, define \cs{NC@do} to throw away the first -% item in the list, and then redefine itsef to print the rest of the +% This macro is useful for debugging \verb"\newcolumntype" specifications, +% it is the equivalent of the primitive \verb"\show" command for macro +% definitions. All we need to do is locally redefine \verb"\NC@do" to take +% its argument (say `C') and then \verb"\show" the (slightly modified) +% definition of \verb"\NC@rewrite@C". Actually as the the list always +% starts off with \verb"\NC@do *" and we do not want to print the +% definition of the $*$-form, define \verb"\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}} @@ -16366,11 +16514,11 @@ % \end{macro} % \begin{macro}{\NC@show} % If the column `C' is defined as above, then -% \verb?\show\NC@rewrite@C? would output\\ -% \verb?\long macro: ->\NC@find >{$}c<{$}?. -% We want to strip the \verb?\long macro: ->? and the \cs{NC@find}. So first we -% use \cs{meaning} and then apply the macro \cs{NC@strip} to the tokens so -% produced and then \cs{typeout} the required string. +% \verb"\show\NC@rewrite@C" would output\\ +% \verb"\long macro: ->\NC@find >{$}c<{$}". +% We want to strip the \verb"long macro: ->" and the \verb"\NC@find". So first we +% use \verb"\meaning" and then apply the macro \verb"\NC@strip" to the tokens so +% produced and then \verb"\typeout" the required string. % \begin{macrocode} \def\NC@show#1{% \typeout{Column #1\expandafter\expandafter\expandafter\NC@strip @@ -16378,9 +16526,9 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\NC@strip} -% Delimit the arguments to \cs{NC@strip} with `\texttt{:}', `\texttt{->}', -% a space, and \cs{@@} to pull out the required parts of the output from -% \cs{meaning}. +% Delimit the arguments to \verb"\NC@strip" with `\texttt{:}', `\texttt{->}', +% a space, and \verb"\@@" to pull out the required parts of the output from +% \verb"\meaning". % \begin{macrocode} \def\NC@strip#1:#2->#3 #4\@@{#2 -> #4} % \end{macrocode} @@ -16392,9 +16540,9 @@ % \end{macrocode} % \end{macro} % -% \subsubsection{The *--form} -% We view the *-form as a slight generalisation of the system -% described in the previous subsection. The idea is to define a * +% \subsubsection{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]{% @@ -16402,20 +16550,19 @@ % \advance\count@ by -1 #2*{\count@}{#2}\fi} % \end{verbatim} % \begin{macro}{\NC@rewrite@*}\label{NC@rewrite@*} -% This does not work however as \cs{newcolumntype} takes great care not -% to expand anything in the preamble, and so the \cs{if} is never -% expanded. \cs{newcolumntype} sets up various other parts of the +% This does not work however as \verb"\newcolumntype" takes great care not +% to expand anything in the preamble, and so the \verb"\if" is never +% expanded. \verb"\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 \cs{NC@rewrite@*}. The +% Now we must correct the definition of \verb"\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 \verb?#1? copies of -% \verb?#2? into \cs{@temptokena}. (Nested * forms will be expanded -% when the whole rewrite list is expanded again, see \cs{@mkpream}) -% \changes{v1.618}{2005/09/03}{Fixed original bug in \cs{NC@rewrite@*} (mempatch v3.3)} +% the idea sketched above, we do not need to put a $*$ in the preamble +% and call the rewrite recursively, we can just put \verb"#1" copies of +% \verb"#2" into \verb"\@temptokena". (Nested $*$ forms will be expanded +% when the whole rewrite list is expanded again, see \verb"\@mkpream") % \begin{macrocode} \long\@namedef{NC@rewrite@*}#1#2{% % \end{macrocode} @@ -16423,31 +16570,196 @@ % \begin{macrocode} \count@#1\relax % \end{macrocode} -% Put \verb?#1? copies of \verb?#2? in the token register. +% Put \verb"#1" copies of \verb"#2" in the token register. % \begin{macrocode} \loop \ifnum\count@>\z@ - \advance\count@\m@ne - \@temptokena\expandafter{\the\@temptokena#2}% + \advance\count@\m@ne + \@temptokena\expandafter{\the\@temptokena#2}% \repeat % \end{macrocode} -% \cs{NC@do} will ensure that \cs{NC@find} is \cs{let} equal -% to \cs{NC@find@*}. +% \verb"\NC@do" will ensure that \verb"\NC@find" is \verb"\let" equal +% to \verb"\NC@find@*". % \begin{macrocode} \NC@find} - % \end{macrocode} % \end{macro} % +% \subsubsection{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}. \verb"\let" them to \verb"\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, \verb">{foo}>{bar}..". Users are not encouraged to +% enter such expressions directly, but they may result from the +% rewriting of \verb"\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 \verb"\@mkpream" is to replace the call to +% \verb"\@xexpast" (which expanded $*$-forms) by a loop which expands +% all \verb"\newcolumntype" specifiers. +% \begin{macrocode} +\def\@mkpream#1{\gdef\@preamble{}\@lastchclass 4 \@firstamptrue + \let\@sharp\relax \let\@startpbox\relax \let\@endpbox\relax +% \end{macrocode} +% Now we remove possible $*$-forms and user-defined column +% specifiers in the user preamble by repeatedly executing the list +% \verb"\NC@list" until the re-writes have no more effect. The +% expanded preamble will then be in the token register +% \verb"\@temptokena". Actually we need to know at this point that +% this is not \verb"\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 \verb"\newcolumntype" (including +% \verb"*"), we evaluate the remaining tokens, which are saved in +% \verb"\@temptokena". We use the \LaTeX--macro \verb"\@tfor" to inspect each +% token in turn. +% \begin{macrocode} + \expandafter \@tfor \expandafter \@nextchar + \expandafter :\expandafter =\the\@temptokena \do +% \end{macrocode} +% \verb"\@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 \verb"\let" to \verb"\relax" to save +% space. +% \begin{macrocode} +\let\@classix\relax +% \end{macrocode} +% \end{macro} % -% \subsection{Getting the spacing around rules right} +% \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 +% \verb"@"-expression, but instead explicitly replace an +% \verb"\extracolsep" command by an assignment to \verb"\tabskip" by a +% method similar to the \verb"\newcolumntype" system described above. +% \verb"\d@llarbegin" \verb"\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 \verb"\extracolsep{1in}" to +% \verb"\tabskip1in\relax". As a side effect discard any tokens after a +% second \verb"\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} +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{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 +% \verb"\@@array" or \verb"\@@array[c]" (as default). +% \begin{macrocode} +\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 \verb"\@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 \verb"\@array" above. +% A similar hook `\verb"\@arrayright"' will be inserted into the +% \verb"\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} +% +% \subsubsection{Support for \texttt{\textbackslash firsthline} and +% \texttt{\textbackslash lasthline}} % % The Companion~\cite[p.137]{GOOSSENS94} suggests two additional -% commands to control the allignments in case of tabulars with +% 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 \cs{firsthline} or \cs{lasthline} +% The extra space around a table when \verb"\firsthline" or \verb"\lasthline" % are used. % \begin{macrocode} \newlength{\extratabsurround} @@ -16456,8 +16768,8 @@ % \end{macro} % % \begin{macro}{\backup@length} -% This register will be used internally by \cs{firsthline} and -% \cs{lasthline}. +% This register will be used internally by \verb"\firsthline" and +% \verb"\lasthline". % \begin{macrocode} \newlength{\backup@length} % \end{macrocode} @@ -16469,14 +16781,14 @@ % % We start by producing a single tabular row without any visible % content that will produce the external reference point in case -% \verb?[t]? is used. +% \verb"[t]" is used. % \begin{macrocode} -\newcommand{\firsthline}{% - \multicolumn1c{% +\newcommand{\firsthline}{%}} emacs + \multicolumn1c{% % \end{macrocode} -% Within this row we calculate \cs{backup@length} to be the height +% Within this row we calculate \verb"\backup@length" to be the height % plus depth of a standard line. In addition we have to add the -% width of the \cs{hline}, something that was forgotten in the +% width of the \verb"\hline", something that was forgotten in the % original definition. % \begin{macrocode} \global\backup@length\ht\@arstrutbox @@ -16485,12 +16797,12 @@ % \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 \cs{extratabsurround} +% into it but raised by \verb"\extratabsurround" % \begin{macrocode} \raise\extratabsurround\copy\@arstrutbox % \end{macrocode} % Having done all this we end the line and back up by the value of -% \cs{backup@length} and then finally place our \cs{hline}. This should +% \verb"\backup@length" and then finally place our \verb"\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} @@ -16500,20 +16812,20 @@ % \end{macro} % % \begin{macro}{\lasthline} -% For \cs{lasthline} the situation is even worse and I got it +% For \verb"\lasthline" the situation is even worse and I got it % completely wrong initially. % -% The problem in this case is that if the optional argument \verb?[b]? +% The problem in this case is that if the optional argument \verb"[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 \cs{extratabsurround} without -% changing the placement \cs{hline}. +% depth of this last line increased by \verb"\extratabsurround" without +% changing the placement \verb"\hline". % % We start by placing the rule followed by an invisible row. % \begin{macrocode} -\newcommand{\lasthline}{\hline\multicolumn1c{% +\newcommand{\lasthline}{\hline\multicolumn1c{%}} emacs % \end{macrocode} -% We now calculate \cs{backup@length} to be the height and depth of +% We now calculate \verb"\backup@length" to be the height and depth of % two lines plus the width of the rule. % \begin{macrocode} \global\backup@length2\ht\@arstrutbox @@ -16537,10 +16849,12 @@ % \end{macro} % % -% Beside a larger functionality \file{array.sty} has one +% \subsubsection{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., \cs{doublerulesep} really denotes +% 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. % @@ -16557,17 +16871,58 @@ \vskip\doublerulesep \fi \ifnum0=`{\fi}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macrocode} +%%%%%%%%%% end array.sty 2016/10/06 v2.4d %%%%%%%%% % \end{macrocode} -% \end{macro} % % +% \begin{macro}{\m@mold@addamp} +% \begin{macro}{\m@m@addamp} +% \begin{macro}{\@addamp} +% +% In the preamble a \verb?&? has to be inserted between any two columns; +% before the first column there should not be a \verb?&?. As the user +% preamble may start with a \verb?|? we have to remember somehow +% if we have already inserted a \verb?#? (i.e.\ a column). This is done +% with the boolean variable \cs{if@firstamp} that we test in +% \cs{@addamp}, the macro that inserts the \verb?&?. +% +% \begin{PW} +% PW: Later on, for horizontal lines in `continuous' tabulars, +% I need to know how many columns there are in a tabular. I need a modified +% kernel's \cs{@addamp} to do this and use the kernel's \cs{@curtab} +% (a counter used in tabbing) to store the number of columns. +% +% \cs{m@mold@addamp} stores the kernel's definition of \cs{@addamp}, and +% \cs{m@m@addamp} is the revised definition. +% \end{PW} % % \begin{macrocode} -%%%%%%%%%%% end Array package code %%%%%%%%%%%%%%%%%%%%% +\newif \@iffirstamp +\let\m@mold@addamp\@addamp +\newcommand*{\m@m@addamp}{% + \if@firstamp + \@firstampfalse + \global\@curtab\@ne + \else + \@addtopreamble{&} + \global\advance\@curtab\@ne + \fi} +\let\@addamp\m@m@addamp % \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} % + + + % \subsection{D column specifiers} \label{sec:dcolumns} % % The description and code are essentially copied from the @@ -16841,14 +17196,24 @@ %%%%%%%%%% Tabularx package code %%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% With acknowledgements to David Carlisle %%%%%%%%%%%%%%%%%%%%% +%%% This is a carbon copy of the tabularx dtx sources for v2.11, +%%% 2016/02/03 with two changes: error messages mention the class +%%% instead of tabularx. + +%%%%%%%%%% Tabularx package code v2.11 2016/02/03 %%%%%%%%%%%%%%%%%%%%% + % \end{macrocode} % % +% % The \Lpack{tabularx} package~\cite{TABULARX} implements a version of the \texttt{tabular} % environment in which the widths of certain columns are calculated so % that the table is is a specified width. The columns that may stretch are % marked by an \texttt{X} in the preamble argument. % +% What follows is a carbon copy of the contents of \texttt{tabularx.dtx} with small changes: (1) We make errors/warnings +% mention the class instead of \texttt{tabularx}, (2) we strip \texttt{tabularx} related \cs{changes} macros, (3) we +% remove loading the \Lpack{array} package, as we already come with a copy. % % First some registers etc.\ that we need. % \begin{macrocode} @@ -16861,24 +17226,25 @@ \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 \verb?{ }?. +% 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 \verb+{ }+. % % \begin{macro}{\tabularx} -% Just save +% Prior to (\texttt{tabularx}) v1.06, this macro took two arguments, which were saved in +% separate registers before the table body was saved by \verb+\TX@get@body+. +% Unfortunately this disables the \verb|[t]| optional argument. Now just save % the width specification separately, then clear the token register -% \cs{toks@}. -% Finally call \cs{TX@get@body} to begin saving the body of the table. -% The \verb?{\ifnum0=`}\fi? allows \verb?tabularx? to appear -% inside a \cs{halign}.^^A -% \setbox0=\hbox{\footnotesize\verb?\iffalse{\fi\ifnum0=`}\fi?}^^A -% \setbox2=\hbox{\footnotesize\verb?\ifnum0=`{}\fi?}^^A +% \verb|\toks@|. +% Finally call \verb|\TX@get@body| to begin saving the body of the table. +% The \verb|{\ifnum0=`}\fi| was added at (tabularx) v1.03, to allow \Lenv{tabularx} to appear +% inside a \verb|\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 \theTeXbook, +% 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''!} % @@ -16888,28 +17254,31 @@ %\begin{verbatim} %\newenvironment{foo}{\begin{tabularx}{XX}}{\end{tabularx}} %\end{verbatim} -% as the code is looking for a literal string \verb?\end{tabularx}? to stop -% scanning. One may avoid this problem by using -% \cs{tabularx} and \cs{endtabularx} directly in the definition: +% as the code is looking for a literal string \verb"\end{tabularx}" to stop +% scanning. Since version (tabularx) 2.02, one may avoid this problem by using +% \verb|\tabularx| and \verb|\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 (\verb?foo? in +% The scanner now looks for the end of the current environment (\verb|foo| in % this example.) There are some restrictions on this usage, the -% principal one being that \cs{endtabularx} is the \emph{first} token of -% the `end code' of the environment. +% principal one being that \verb|\endtabularx| must not be inside any \verb"{ }" pairs +% ao that the code before \verb"\endtabularx" may be extracted and added to the table body +% (prior to version (tabularx) 2.09 \verb"\endtabularx" had to be +% the \emph{first} token of the `end code' of the environment). % \begin{macrocode} \def\tabularx#1{% % \end{macrocode} -% Allow \cs{tabularx} \cs{endtabularx} (but not \verb?\begin{tabularx}? -% \verb?\end{tabularx}?) to be used in \cs{newenvironment} definitions. +% Allow \verb"\tabularx" \verb"\endtabularx" (but not \verb"\begin{tabularx}" +% \verb"\end{tabularx}") to be used in \verb"\newenvironment" definitions. % \begin{macrocode} \edef\TX@{\@currenvir}% {\ifnum0=`}\fi % \end{macrocode} -% \cs{setlength} lets you -% use the \Lpack{calc} package so you could use a width of, say \\ -% \verb?(\textwidth-12pt)/2?. +% \verb"\relax" added at v1.05 so that non-expandable length tokens, like +% \verb"\textwidth" do not generate an extra space, and an overfull box. +% \verb"\relax" removed again at v4.09 in favour of \verb"\setlength" so if you +% use the calc package you can use a width of \verb"(\textwidth-12pt)/2". % \begin{macrocode} \setlength\TX@target{#1}% \TX@typeout{Target width: #1 = \the\TX@target.}% @@ -16926,8 +17295,8 @@ % \end{macro} % % \begin{macro}{\TX@get@body} -% Place all tokens as far as the first \cs{end} into a token register. -% Then call \cs{TX@find@end} to see if we are at \verb?\end{tabularx}?. +% Place all tokens as far as the first \verb"\end" into a token register. +% Then call \verb"\TX@find@end" to see if we are at \verb"\end{tabularx}". % \begin{macrocode} \long\def\TX@get@body#1\end {\toks@\expandafter{\the\toks@#1}\TX@find@end} @@ -16935,8 +17304,8 @@ % \end{macro} % % \begin{macro}{\TX@find@end} -% If we are at \verb?\end{tabularx}?, call \cs{TX@endtabularx}, otherwise -% add \verb?\end{...}? to the register, and call \cs{TX@get@body} again. +% If we are at \verb"\end{tabularx}", call \verb"\TX@endtabularx", otherwise +% add \verb"\end{...}" to the register, and call \verb"\TX@get@body" again. % \begin{macrocode} \def\TX@find@end#1{% \def\@tempa{#1}% @@ -16946,8 +17315,42 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\TX@find@endtabularxa} +% 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} +% 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} +% Helper to avoid needing 15 consecutive \verb"\expandafter" +% \begin{macrocode} +\def\TX@find@endtabularxbb{% + \expandafter\expandafter\expandafter + \TX@find@endtabularxb +} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\TX@} -% The string \texttt{tabularx} as a macro for testing with \cs{ifx}. +% The string {\ttfamily tabularx} as a macro for testing with \verb"\ifx". % \begin{macrocode} \def\TX@{tabularx} % \end{macrocode} @@ -16957,48 +17360,53 @@ % 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 \texttt{X} column the width of the -% final table. Assuming that there is at least one \texttt{X} column, +% 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 \texttt{X} columns, and reduce the column 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 \cs{multicolumn} entry must be `hiding' one of the {\ttfamily -% X} columns, and so there is one less \texttt{X} column affecting +% width, a \verb"\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 \texttt{tabularx} look like an +% 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{% + \expandafter\expandafter\expandafter + \TX@find@endtabularxa\csname end\TX@\endcsname + \endtabularx\TX@\endtabularx\TX@find@endtabularxa % \end{macrocode} -% Define the \texttt{X} column, with an internal version of the -% \cs{newcolumntype} command. The \cs{expandafter} commands enable -% \cs{NC@newcol} to get the \emph{expansion} of\\ -% \verb?\tabularxcolumn{\TX@col@width}? as its -% argument. This will be the definition of an \texttt{X} column. +% Define the {\ttfamily X} column, with an internal version of the +% \verb"\newcolumntype" command. The \verb"\expandafter" commands enable +% \verb"\NC@newcol" to get the {\em expansion} of\\ +% \verb"\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 \texttt{X} columns. -% The number of \texttt{X} columns is set to one, which means that +% 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"\verb". % \begin{macrocode} \let\verb\TX@verb % \end{macrocode} -% Save the values of all \LaTeX\ counters; the list -% \cs{cl@@ckpt} contains the names of all the \LaTeX\ counters that have -% been defined so far. We expand \cs{setcounter} at this point, as it -% results in fewer tokens being stored in \cs{TX@ckpt}, but the actual -% resetting of the counters occurs when \cs{TX@ckpt} is expanded after +% Since v1.05, save the values of all \LaTeX\ counters, the list +% \verb"\cl@@ckpt" contains the names of all the \LaTeX\ counters that have +% been defined so far. We expand \verb"\setcounter" at this point, as it +% results in fewer tokens being stored in \verb"\TX@ckpt", but the actual +% resetting of the counters occurs when \verb"\TX@ckpt" is expanded after % each trial run. -% Actually, use something equivalent to the expansion of the -% original definition of \cs{setcounter}, so that \verb?tabularx? works in -% conjunction with \file{calc.sty}. +% Actually since v1.07, use something equivalent to the expansion of the +% original definition of \verb"\setcounter", so that \verb"tabularx" works in +% conjunction with \verb"calc.sty". % \begin{macrocode} \def\@elt##1{\global\value{##1}\the\value{##1}\relax}% \edef\TX@ckpt{\cl@@ckpt}% @@ -17012,7 +17420,7 @@ \TX@typeout@ {\@spaces Table Width\@spaces Column Width\@spaces X Columns}% % \end{macrocode}% -% First attempt. Modify the \texttt{X} definition to count {\ttfamily +% First attempt. Modify the {\ttfamily X} definition to count {\ttfamily % X} columns. % \begin{macrocode} \TX@trial{\def\NC@rewrite@X{% @@ -17029,12 +17437,12 @@ \repeat % \end{macrocode} % One last time, with warnings back on (see appendix D) -% use \texttt{tabular*} to put it in a box of the right size, in case +% use {\ttfamily tabular*} to put it in a box of the right size, in case % the algorithm failed to find the correct size. % -% Locally make \cs{footnotetext} save its argument in a token +% Since v1.04, locally make \verb"\footnotetext" save its argument in a token % register. -% \cs{toks@} contains the preamble specification, +% Since v1.06, \verb"\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 @@ -17042,39 +17450,49 @@ \the\toks@ \csname endtabular*\endcsname}% % \end{macrocode} -% Now the alignment is finished, and the \verb?}? has restored the original -% meaning of \cs{@footnotetext} expand the register \cs{TX@ftn} which will +% Now the alignment is finished, and the \verb"}" has restored the original +% meaning of \verb"\@footnotetext" expand the register \verb"\TX@ftn" which will % execute a series of\\ -% \verb?\footnotetext[<num>]{<note>}? \\ +% \verb"\footnotetext["\meta{num}\verb"]{"\meta{note}\verb"}"\\ % commands. We need to be careful about clearing the register as we may -% be inside a nested \texttt{tabularx}. +% be inside a nested {\ttfamily tabularx}. % \begin{macrocode} \global\TX@ftn\expandafter{\expandafter}\the\TX@ftn % \end{macrocode} -% Now finish off the \texttt{tabularx} environment. Note that we need -% \verb?\end{tabularx}? here as the \verb?\end{tabularx}? in the user's -% file is never expanded. Now use \cs{TX@} rather than \verb?tabularx?. +% Now finish off the {\ttfamily tabularx} environment. Note that we need +% \verb"\end{tabularx}" here as the \verb"\end{tabularx}" in the user's +% file is never expanded. Now use \verb"\TX@" rather than \verb"tabularx". % -% We also need to finish off the group started by \verb?{\ifnum0=`}\fi? in -% the macro \cs{tabularx}. +% We also need to finish off the group started by \verb"{\ifnum0=`}\fi" in +% the macro \verb"\tabularx". % \begin{macrocode} \ifnum0=`{\fi}% - \expandafter\end\expandafter{\TX@}} + \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 -% \cs{ifTX@} to false if the loop should be aborted. +% \verb"\ifTX@" to false if the loop should be aborted. % \begin{macrocode} \def\TX@arith{% \TX@false + \@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 \cs{TX@col@width}. +% over-full alignment) with the previous value of \verb"\TX@col@width". % \begin{macrocode} \TX@col@width\TX@old@col \TX@typeout@{Reached minimum width, backing up.}% @@ -17086,18 +17504,18 @@ \advance\dimen@ -\TX@target \ifdim\dimen@<\TX@delta % \end{macrocode} -% If this amount is less than \cs{TX@delta}, stop. (\cs{TX@delta} +% If this amount is less than \verb"\TX@delta", stop. (\verb"\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 \texttt{X} columns by one. (Checking +% 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 -% \cs{dimen@}. +% the new column width. Temporarily store this value (times $-1$) in +% \verb"\dimen@". % \begin{macrocode} \ifnum\TX@cols>\@ne \advance\TX@cols\m@ne @@ -17109,12 +17527,16 @@ % If the new width would be too narrow, abort the loop. At the moment % too narrow, means less than 0\,pt! % -% If the loop was aborted here and the X columns were left -% with the width of the previous run it may make the table far -% too wide as initial guesses are always too big. Force to -% \cs{TX@error@width} which defaults to be 1em. +% 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 +% \verb"\TX@error@width" which defaults to be 1em. If you want to +% get the old behaviour stick\\ +% \verb"\renewcommand\TX@error@width{\TX@col@width}"\\ +% in a package file loaded after \textsf{tabularx}. % \begin{macrocode} - \@memwarn{X Columns too narrow (table too wide)\MessageBreak}% + %\PackageWarning{tabularx}% + \@memwarn{X Columns too narrow (table too wide)\MessageBreak}% <-- change here \TX@col@width\TX@error@width\relax \else % \end{macrocode} @@ -17140,27 +17562,27 @@ % \end{macro} % % \begin{macro}{\TX@delta} -% Accept a table that is within \cs{hfuzz} of the correct width. +% Accept a table that is within \verb"\hfuzz" of the correct width. % \begin{macrocode} \TX@delta\hfuzz % \end{macrocode} % \end{macro} % -% Initialise the \texttt{X} column. The definition can be empty here, -% as it is set for each \texttt{tabularx} environment. +% 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 \texttt{X} is \verb?p{#1}?. +% The default definition of {\ttfamily X} is \verb"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 \cs{expandafter} +% A little macro just used to cut down the number of \verb"\expandafter" % commands needed. % \begin{macrocode} \def\TX@newcol{\newcol@{X}[0]} @@ -17174,28 +17596,28 @@ \setbox\@tempboxa\hbox{% % \end{macrocode} % Any extra commands. This is used on the first run to count the number -% of \texttt{X} columns. +% of {\ttfamily X} columns. % \begin{macrocode} #1\relax % \end{macrocode} -% Make \cs{footnotetext} gobble its arguments. Also locally -% clear \cs{TX@vwarn} so that the warning is generated by the {\ttfamily +% Since v1.04, make \verb"\footnotetext" gobble its arguments. Also locally +% clear \verb"\TX@vwarn" so that the warning is generated by the {\ttfamily % final} run, and does not appear in the middle of the table if -% \cs{tracingtabularx}. +% \verb"\tracingtabularx". % \begin{macrocode} \let\@footnotetext\TX@trial@ftn \let\TX@vwarn\@empty % \end{macrocode} -% Do not nest \texttt{tabularx} environments during trial runs. This -% would waste time, and the global setting of \cs{TX@cols} would break the +% Do not nest {\ttfamily tabularx} environments during trial runs. This +% would waste time, and the global setting of \verb"\TX@cols" would break the % algorithm. % \begin{macrocode} \expandafter\let\expandafter\tabularx\csname tabular*\endcsname \expandafter\let\expandafter\endtabularx\csname endtabular*\endcsname % \end{macrocode} -% Dissable \cs{write}s during a trial run. This trick is -% from \theTeXbook.\footnote{Actually the trick does -% not work correctly, so it has been changed.} +% Added at v1.05: disable \verb"\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.} % \begin{macrocode} \def\write{\begingroup \def\let{\afterassignment\endgroup\toks@}% @@ -17210,17 +17632,18 @@ \let\hfuzz\@tempdima % \end{macrocode} % Make the table, and finish the hbox. -% \cs{toks@} contains the preamble specification, +% Since v1.06, \verb"\toks@" contains the preamble specification, % and possible optional argument, as well as the table body. % \begin{macrocode} \expandafter\tabular\the\toks@ \endtabular}% % \end{macrocode} -% Reset all \LaTeX\ counters, by executing \cs{TX@ckpt}. +% Since v1.05 reset all \LaTeX\ counters, by executing \verb"\TX@ckpt". % \begin{macrocode} \TX@ckpt % \end{macrocode} % Print some statistics. +% Added \verb"\TX@align" in v1.05, to line up the columns. % \begin{macrocode} \TX@typeout@{\@spaces \expandafter\TX@align @@ -17232,7 +17655,7 @@ % \end{macro} % % \begin{macro}{\TX@align} -% Macro to improve the printing of the tracing info. +% 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 @@ -17244,9 +17667,11 @@ % \end{macro} % % \begin{macro}{\arraybackslash} -% \verb?\\? hack. +% \verb"\\" hack. % \begin{macrocode} -\def\arraybackslash{\let\\\@arraycr} +\ifx\arraybackslash\@undefined +\def\arraybackslash{\let\\\tabularnewline} +\fi % \end{macrocode} % \end{macro} % @@ -17254,7 +17679,8 @@ % Print statistics on column and table widths. % \begin{macrocode} \def\tracingtabularx{% - \def\TX@typeout{\ClassWarningNoLine{memoir}}% + %\def\TX@typeout{\PackageWarningNoLine{tabularx}}% + \def\TX@typeout{\ClassWarningNoLine{memoir}}% <--- changed \def\TX@typeout@##1{\typeout{(tabularx) ##1}}} % \end{macrocode} % \end{macro} @@ -17297,22 +17723,22 @@ % \end{macro} % % This last section was added at Version 1.02. Previous versions -% documentented the fact that \cs{verb} did not work inside {\ttfamily +% documented the fact that \verb"\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 \cs{verb}' (and -% \cs{verb*}) defined here is based on page 382 of \theTeXbook. As +% did not mention the cause of the error. The `poor man's \verb"\verb"' (and +% \verb"\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 \cs{verb*} may well be useless, however I +% treated correctly, and so \verb"\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 \cs{verb} to be used within its argument may -% \verb?\let\verb=\TX@verb?. (Making sure to restore the real definition +% form of \verb"\verb" to be used within its argument may +% \verb"\let\verb=\TX@verb". (Making sure to restore the real definition % later!) % -% \cs{verb} and \cs{verb*} are subject to the following restictions: +% \verb"\verb" and \verb"\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. @@ -17321,23 +17747,23 @@ % \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 \verb?\?, so \verb?\verb|\|? is not -% allowed, however, because of (3), \verb?\verb|\ |? produces -% \verb?\?. -% \item The argument must be balanced with respect to \verb?{? and \verb?}?. So -% \verb?\verb|{|? is not allowed. -% \item A comment character like \verb?%? will not appear verbatim. It will +% \item The argument must not end with \verb"\", so \verb"\verb|\|" is not +% allowed, however, because of (3), \verb"\verb|\ |" produces +% \verb"\". +% \item The argument must be balanced with respect to \verb"{" and \verb"}". So +% \verb"\verb|{|" is not allowed. +% \item A comment character like \verb"%" will not appear verbatim. It will % act as usual, commenting out the rest of the input line! -% \item The combinations \verb=?`= and \verb?!`? will appear as -% {\ttfamily?`} and {\ttfamily!`} if the \texttt{cmtt} font is +% \item The combinations \verb"?`" and \verb"!`" will appear as +% {\ttfamily?`} and {\ttfamily!`} if the {\ttfamily cmtt} font is % being used. % \end{enumerate} % % \begin{macro}{\TX@verb} -% The internal definition of \cs{verb}. Spaces will be replaced by \verb?~?, so -% for the star-form, \cs{let} \verb?~? be \verb?\verb*| |?, which we obtain as -% \verb?\uppercase{*}?. Use \verb?{\ifnum0=`}\fi? rather than \cs{bgroup} to allow -% \verb?&? to appear in the argument. +% The internal definition of \verb"\verb". Spaces will be replaced by \verb"~", so +% for the star-form, \verb"\let" \verb"~" be \verb*| |, which we obtain as +% \verb"\uppercase{*}". Use \verb"{\ifnum0=`}\fi" rather than \verb"\bgroup" to allow +% \verb"&" to appear in the argument. % \begin{macrocode} {\uccode`\*=`\ % \uppercase{\gdef\TX@verb{% @@ -17348,16 +17774,16 @@ % \end{macro} % % \begin{macro}{\TX@vb} -% Get the `almost verbatim' text using \cs{meaning}. The `\verb?!?' is added to +% Get the `almost verbatim' text using \verb"\meaning". The `\verb"!"' is added to % the front of the user supplied text, to ensure that the whole argument -% does not consist of a single \verb?{ }? group. \TeX\ would strip the outer -% braces from such a group. The `\verb?!?' will be removed later. +% does not consist of a single \verb"{ }" group. \TeX\ would strip the outer +% braces from such a group. The `\verb"!"' will be removed later. % -% Originally I followed Knuth, and had \verb?\def\@tempa{##1}?, however this -% did not allow \verb?#? to appear in the argument. So I changed -% this to to use a token register, and \cs{edef}. This allows \verb?#? appear, +% Originally I followed Knuth, and had \verb"\def\@tempa{##1}", however this +% did not allow \verb"#" to appear in the argument. So in v1.04, I changed +% this to to use a token register, and \verb"\edef". This allows \verb"#" appear, % but makes each one appear twice!, so later we loop through, replacing -% \verb?##? by \verb?#?. +% \verb"##" by \verb"#". % \begin{macrocode} \def\TX@vb#1{\def\@tempa##1#1{\toks@{##1}\edef\@tempa{\the\toks@}% \expandafter\TX@v\meaning\@tempa\\ \\\ifnum0=`{\fi}}\@tempa!} @@ -17365,17 +17791,17 @@ % \end{macro} % % \begin{macro}{\TX@v} -% Strip the initial segment of the \cs{meaning}, including the `\verb?!?' +% Strip the initial segment of the \verb"\meaning", including the `\verb"!"' % 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 \verb?##? pairs by \verb?#?. To do -% this we need non-special \verb?#? tokens. Make \verb?*? into a parameter +% As explained above we are going to replace \verb"##" pairs by \verb"#". To do +% this we need non-special \verb"#" tokens. Make \verb"*" into a parameter % token so that we can define macros with arguments. The normal meanings -% will be restored by the \cs{endgroup} later. +% will be restored by the \verb"\endgroup" later. % \begin{macrocode} \begingroup \catcode`\*=\catcode`\# @@ -17384,10 +17810,10 @@ % % \begin{macro}{\TX@vfirst} % As a special case, prevent the first character from being dropped. -% This makes \verb?\verb*| |? produce \verb*? ?. Then call \cs{TX@v@}. -% This is slightly tricky as I have to ensure that an -% actual \verb?#? rather than a command \cs{let} to \verb?#? is passed on if the -% first character is \verb?#?. +% This makes \verb"\verb*| |" produce \verb*| |. Then call \verb"\TX@v@". +% This is slightly tricky since v1.04, as I have to ensure that an +% actual \verb"#" rather than a command \verb"\let" to \verb"#" is passed on if the +% first character is \verb"#". % \begin{macrocode} \gdef\TX@vfirst{% \if\@tempa#% @@ -17401,10 +17827,10 @@ % \end{macro} % % \begin{macro}{\TX@v@} -% Loop through the \cs{meaning}, replacing all spaces by \verb?~?. If the last -% character is a space it is dropped, so that \verb?\verb*|\LaTeX|? produces -% \verb?\LaTeX? not \verb*?\LaTeX ?. The rewritten tokens are then further -% processed to replace \verb?##? pairs. +% Loop through the \verb"\meaning", replacing all spaces by \verb"~". If the last +% character is a space it is dropped, so that \verb"\verb*|\LaTeX|" produces +% \verb"\LaTeX" not \verb*|\LaTeX |. The rewritten tokens are then further +% processed to replace \verb"##" pairs. % \begin{macrocode} \gdef\TX@v@*1 *2{% \TX@v@hash*1##\relax\if*2\\\else~\expandafter\TX@v@\fi*2} @@ -17412,29 +17838,31 @@ % \end{macro} % % \begin{macro}{\TX@v@hash} -% The inner loop, replacing \verb?##? by \verb?#?. +% The inner loop, replacing \verb"##" by \verb"#". % \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 \verb?#? and \verb?*?. +% As promised, we now restore the normal meanings of \verb"#" and \verb"*". % \begin{macrocode} \endgroup % \end{macrocode} % % \begin{macro}{\TX@vwarn} -% Warn the user the first time this \cs{verb} is used. +% Warn the user the first time this \verb"\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} -%%%%%%%%%% end Tabularx package code %%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%% end Tabularx package code v2.11 %%%%%%%%%%%%%%%%%%%%% + + + % \end{macrocode} % @@ -18761,12 +19189,14 @@ % % \changes{v3.6i}{2011/02/18}{Added this instead of inserting the % adjustment code directly into the environment definitions} +% \changes{v3.7g}{2017/05/08}{Moved into delayed \cs{@xfloat} redef as +% we need it to run after \cs{normalsize}} % \begin{macro}{\@xfloat} % In order to inject adjustment code into the core of the floats we % will need to patch the code float macros a little. % \begin{macrocode} -\let\mem@old@xfloat\@xfloat -\def\@xfloat#1[#2]{\mem@old@xfloat{#1}[#2]\@nameuse{#1adjustment}} + %\let\mem@old@xfloat\@xfloat + %\def\@xfloat#1[#2]{\mem@old@xfloat{#1}[#2]\@nameuse{#1adjustment}} % \end{macrocode} % % \end{macro} @@ -20324,7 +20754,16 @@ % \begin{macro}{\sf@@memsub@label} % This is an expanded copy of \cs{sf@@sub@label} processed after any packages may % have been loaded. +% An added complexity here is when \Lpack{showkeys} is used. It +% redefines \cs{label} to write it in the margins. But the +% \cs{sf@@memsub@label} writes the label to aux directly. So in order +% to support \Lpack{showkeys}, we add a hook, and define this hook if +% \Lpack{showkeys} is loaded. +% \changes{v3.7g}{2018/02/28}{Added hook into \cs{sf@@memsub@label}, +% issue reported via \texttt{https://tex.stackexchange.com/q/374301/3929}} % \begin{macrocode} +\newcommand\sf@@memsub@label@hook[1]{} + \AtBeginDocument{% \@ifpackageloaded{nameref}{% % \end{macrocode} @@ -20332,6 +20771,7 @@ % \begin{macrocode} \newcommand*{\sf@@memsub@label}[1]{% \@bsphack + \sf@@memsub@label@hook{#1}% \protected@write\@auxout{}{% \string\newlabel{#1}% {{\@nameuse{p@sub\@captype}\@nameuse{@@thesub\@captype}}% @@ -20345,42 +20785,56 @@ {\mem@currentlabelname\relax}% {\@currentHref}{}}}% \@esphack} - }{\@ifpackageloaded{hyperref}{% + }{% no nameref + \@ifpackageloaded{hyperref}{% % \end{macrocode} % The \Lpack{hyperref} package is loaded, but not \Lpack{nameref}. % \begin{macrocode} - \newcommand*{\sf@@memsub@label}[1]{% - \@bsphack - \protected@write\@auxout{}{% - \string\newlabel{#1}% - {{\@nameuse{p@sub\@captype}\@nameuse{@@thesub\@captype}}% - {\thepage}% - {\mem@currentlabelname\relax}% - {\@currentHref}{}}}% - \protected@write\@auxout{}{% - \string\newlabel{sub@#1}% - {{\@nameuse{@@thesub\@captype}}% - {\thepage}% - {\mem@currentlabelname\relax}% - {\@currentHref}{}}}% - \@esphack} - }{% + \newcommand*{\sf@@memsub@label}[1]{% + \@bsphack + \sf@@memsub@label@hook{#1}% + \protected@write\@auxout{}{% + \string\newlabel{#1}% + {{\@nameuse{p@sub\@captype}\@nameuse{@@thesub\@captype}}% + {\thepage}% + {\mem@currentlabelname\relax}% + {\@currentHref}{}}}% + \protected@write\@auxout{}{% + \string\newlabel{sub@#1}% + {{\@nameuse{@@thesub\@captype}}% + {\thepage}% + {\mem@currentlabelname\relax}% + {\@currentHref}{}}}% + \@esphack} + }{% no hyperref % \end{macrocode} % Neither the \Lpack{hyperref} nor the \Lpack{nameref} % package is loaded. % \begin{macrocode} - \let\@memoldlabel\label - \newcommand*{\sf@@memsub@label}[1]{% - \@bsphack - \@memoldlabel{#1}% - \protected@write\@auxout{}{% - \string\newlabel{sub@#1}% - {{\@nameuse{@@thesub\@captype}}% - {\thepage}}}% - \@esphack} - }{}% - } -} + \let\@memoldlabel\label + \newcommand*{\sf@@memsub@label}[1]{% + \@bsphack + \sf@@memsub@label@hook{#1}% + \@memoldlabel{#1}% + \protected@write\@auxout{}{% + \string\newlabel{sub@#1}% + {{\@nameuse{@@thesub\@captype}}% + {\thepage}}}% + \@esphack} + }{}% + }% end no nameref +% \end{macrocode} +% Next add the hook redefinition if \Lpack{showkeys} is loaded. Please +% note that the placement of the \Lpack{showkeys} label, might be a +% little strange. +% \changes{v3.7g}{2018/02/28}{added} +% \begin{macrocode} + \@ifpackageloaded{showkeys}{% + \renewcommand\sf@@memsub@label@hook[1]{% + \SK@\SK@@label{#1}% + } + }{} +} % end AtBeginDocument % \end{macrocode} % \end{macro} @@ -23754,12 +24208,16 @@ % title. \cs{@memb@bsec} is the much simpler version for a \cs{section} title. % \changes{v1.4}{2003/02/27}{Added support code for implementing \cs{bibsection} % (patch 1.3)} +% \changes{v3.7g}{2018/02/28}{Removeded \cs{phantomsection} before +% \cs{addcontentsline} as it is no longer needed, and causes the +% hyperlink target to the bibligraphy to be below the title, reported +% via \texttt{https://tex.stackexchange.com/a/396303/3929}} % \begin{macrocode} \newcommand{\@memb@bchap}{% \chapter*{\bibname}% \bibmark \ifnobibintoc\else - \phantomsection + % \phantomsection \addcontentsline{toc}{chapter}{\bibname}% \fi \prebibhook} @@ -24176,8 +24634,20 @@ \protected@write\@auxout{}% {\string\@@wrindexm@m{\@idxfile}{#1|#2hyperpage}{\thepage}}% \else - \protected@write\@auxout{}% - {\string\@@wrindexm@m{\@idxfile}{#1|#2}{\thepage}}% +% \end{macrocode} +% Add a corresponding test on \verb+|)+ to add \verb|hyperpage|. This +% is needed by the \verb|xindy| indexing programme. The standard +% \verb|makeindex| programme does not seem to mind. +% \changes{v3.7g}{2018/04/04}{Added test for \texttt{|)} and adding +% \texttt{hyperpage} accordingly.} +% \begin{macrocode} + \ifx\Hy@temp@A\HyInd@ParenRight + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|#2hyperpage}{\thepage}}% + \else + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|#2}{\thepage}}% + \fi \fi \fi \endgroup @@ -29297,12 +29767,14 @@ % Utility macros to handle page note formating and hyperlinks. % \changes{v3.6k}{2013/05/16}{altered to use four arguments instead of three} % \changes{v3.6k}{2013/05/16}{Added page note anchor} -% \changes{v3.6k}{2013/05/17}{Forgot about labels in the note text.} +% \changes{v3.6k}{2013/05/17}{Forgot about labels in the note text.} +% \changes{v3.7g}{2018/01/03}{Added \cs{phantomsection}, otherwise +% \cs{label} does not work correctly. Reported in \texttt{https://tex.stackexchange.com/q/408448/3929}} % \begin{macrocode} \newcommand\startnoteentrystart[4]{% \prenoteinnotes% \noteidinnotes{#1}{#2}% - \@ifmtarg{#2}{\def\@currentlabel{#1}}{}% + \@ifmtarg{#2}{\phantomsection\def\@currentlabel{#1}}{}% \pagenoteanchor{#4}% \pageinnotes{#3}% \prenotetext% @@ -33096,12 +33568,15 @@ % it also redefines the \cs{thectr} command so that it typesets values % in the style \verb?\thewithin.\arabic{ctr}?. The starred version of the % command suppresses the redefinition of \cs{thectr}. -% +% \changes{v3.7g}{2018/03/09}{As of TeXLive 2018 \cs{counterwithin} +% and \cs{counterwithout} will be moved into the kernel. We therefore +% change to using \cs{providecommand} instead of \cs{newcommand} to +% avoid colisions} % \begin{macrocode} -\newcommand{\counterwithin}{\@ifstar{\@csinstar}{\@csin}} -\newcommand{\@csinstar}[2]{% +\providecommand{\counterwithin}{\@ifstar{\@csinstar}{\@csin}} +\providecommand{\@csinstar}[2]{% \@ifbothcntrs{#1}{#2}{\@addtoreset{#1}{#2}}} -\newcommand{\@csin}[2]{% +\providecommand{\@csin}[2]{% \@ifbothcntrs{#1}{#2}{\@addtoreset{#1}{#2}% \@namedef{the#1}{\@nameuse{the#2}.\arabic{#1}}}} @@ -33122,11 +33597,15 @@ % numeral. The starred version of the command suppresses the redefinition % of \cs{thectr}. % \changes{v1.618}{2005/09/03}{Deleted chngctr from \cs{@csoutstar} (mempatch v3.4)} +% \changes{v3.7g}{2018/03/09}{As of TeXLive 2018 \cs{counterwithin} +% and \cs{counterwithout} will be moved into the kernel. We therefore +% change to using \cs{providecommand} instead of \cs{newcommand} to +% avoid colisions} % \begin{macrocode} -\newcommand{\counterwithout}{\@ifstar{\@csoutstar}{\@csout}} -\newcommand{\@csoutstar}[2]{% +\providecommand{\counterwithout}{\@ifstar{\@csoutstar}{\@csout}} +\providecommand{\@csoutstar}[2]{% \@ifbothcntrs{#1}{#2}{\@removefromreset{#1}{#2}}} -\newcommand{\@csout}[2]{% +\providecommand{\@csout}[2]{% \@ifbothcntrs{#1}{#2}{\@removefromreset{#1}{#2}% \@namedef{the#1}{\arabic{#1}}}} @@ -35579,8 +36058,10 @@ % \changes{v3.6k}{2012/07/19}{Changed the enumated date for the % \Lpack{array} package. Apparently the only thing changed between % v2.4b (2005) and c (2008) are some copyright years.} +% \changes{v3.7g}{2018/03/05}{Embedded the latest version of the +% \Lpack{array} package} % \begin{macrocode} -\EmulatedPackage{array}[2008/09/09] +\EmulatedPackage{array}[2016/10/06] \EmulatedPackage{booktabs}[2016/05/16] \EmulatedPackage{ccaption}[2008/07/23] \EmulatedPackage{changepage}[2008/07/23] @@ -35588,15 +36069,22 @@ \EmulatedPackage{chngpage}[2008/07/23] \EmulatedPackage{crop} \EmulatedPackage{dcolumn}[2008/07/23] -\EmulatedPackage{delarray}[2008/07/23] +% \end{macrocode} +% \changes{v3.7g}{2018/03/06}{Adjusted the date for \Lpack{delarray}, +% the code is the same} +% \begin{macrocode} +\EmulatedPackage{delarray}[2014/10/28] \EmulatedPackage{enumerate}[2008/07/23] \EmulatedPackage{epigraph}[2008/07/23] %%%%%\EmulatedPackage{framed}[2008/07/23] \EmulatedPackage{ifmtarg}[2008/07/23] -\ifm@mifetex\EmulatedPackage{ifetex}[2008/07/23]\fi -\ifm@mifluatex\EmulatedPackage{ifluatex}[2008/07/23]\fi -\ifm@mifpdf\EmulatedPackage{ifpdf}[2008/07/23]\fi -\ifm@mifxetex\EmulatedPackage{ifxetex}[2008/07/23]\fi +% \end{macrocode} +% \changes{v3.7g}{2018/03/08}{Removed if\meta{engine} emulation} +% \begin{macrocode} + %\ifm@mifetex\EmulatedPackage{ifetex}[2008/07/23]\fi + %\ifm@mifluatex\EmulatedPackage{ifluatex}[2008/07/23]\fi + %\ifm@mifpdf\EmulatedPackage{ifpdf}[2008/07/23]\fi + %\ifm@mifxetex\EmulatedPackage{ifxetex}[2008/07/23]\fi \EmulatedPackage{index}[2008/07/23] \EmulatedPackage{makeidx}[2008/07/23] \EmulatedPackage{moreverb}[2008/07/23] @@ -35610,7 +36098,10 @@ \EmulatedPackage{setspace}[2008/07/23] \EmulatedPackage{shortvrb}[2008/07/23] \EmulatedPackage{showidx}[2008/07/23] -\EmulatedPackage{tabularx}[2008/07/23] +% \end{macrocode} +% \changes{v3.7g}{2018/03/02}{Updated the embedded version of \Lpack{tabularx} to v2.11 2016/02/03} +% \begin{macrocode} +\EmulatedPackage{tabularx}[2016/02/03] \EmulatedPackage{titleref}[2008/07/23] \EmulatedPackage{titling}[2008/07/23] \EmulatedPackage{tocbibind}[2008/07/23] @@ -35720,23 +36211,25 @@ % \end{macrocode} % -% \subsection{Patch file} -% -% At the suggestion of Danie Els (\texttt{DanieEls@sun.ac.za}), Dan Leucking -% (\texttt{luecking@uark.edu}) and others, input a patch file, if one exists, -% as the final act. (This is preferable to my series of \file{memfixa.sty}, -% \file{memfixb.sty} packages, and so on, for each release of the class.) -% \changes{v1.3}{2002/11/14}{Added input of mempatch.sty} -% \changes{v1.6180339c}{2008/12/26}{Added the two missing arguments when inputting -% mempatch.sty (courtesy of Wilhelm Muller)} -% \changes{v1.61803398}{2009/07/27}{PW: changed call to mempatch, which I think -% restores Lars' v1.6180339h change} -% \begin{macrocode} -\IfFileExists{mempatch.sty}{% - \RequirePackage{mempatch}}{} - -% \end{macrocode} -% +% ^^A\subsection{Patch file} +% ^^A +% ^^A At the suggestion of Danie Els (\texttt{DanieEls@sun.ac.za}), Dan Leucking +% ^^A (\texttt{luecking@uark.edu}) and others, input a patch file, if one exists, +% ^^A as the final act. (This is preferable to my series of \file{memfixa.sty}, +% ^^A \file{memfixb.sty} packages, and so on, for each release of the class.) +% ^^A \changes{v1.3}{2002/11/14}{Added input of mempatch.sty} +% ^^A \changes{v1.6180339c}{2008/12/26}{Added the two missing arguments when inputting +% ^^A mempatch.sty (courtesy of Wilhelm Muller)} +% ^^A \changes{v1.61803398}{2009/07/27}{PW: changed call to mempatch, which I think +% ^^A restores Lars' v1.6180339h change} +% ^^A \changes{v3.7g}{2018/03/08}{mempatch have been empty for almost +% ^^A 10years, we will no longer load it.} +% ^^A \begin{macrocode} +% ^^A\IfFileExists{mempatch.sty}{% +% ^^A \RequirePackage{mempatch}}{} +% ^^A +% ^^A \end{macrocode} +% ^^A % The end of the class definitions. % \begin{macrocode} %</class> @@ -35841,7 +36334,7 @@ keyword "\\glossaryentry" % \bibitem[Car99]{TABULARX} % David Carlisle. % \newblock \emph{The \Lpack{tabularx} package}. -% \newblock January 1999. +% \newblock February 2016. % \newblock (Available from CTAN in % \texttt{/macros/latex/required/tools}) % @@ -35948,7 +36441,7 @@ keyword "\\glossaryentry" % Frank Mittelbach and David Carlisle. % \newblock \emph{A new implementation of LaTeX's tabular and array % environment} -% \newblock May 1998. +% \newblock April 2017. % \newblock (Available from CTAN in % \texttt{/macros/latex/required/tools}) % |