diff options
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/memoir/memoir.dtx | 12892 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/memoir/memoir.ins | 16 | ||||
-rwxr-xr-x | Master/texmf-dist/source/latex/memoir/mempatch.dtx | 6808 | ||||
-rwxr-xr-x | Master/texmf-dist/source/latex/memoir/mempatch.ins | 4 |
4 files changed, 9443 insertions, 10277 deletions
diff --git a/Master/texmf-dist/source/latex/memoir/memoir.dtx b/Master/texmf-dist/source/latex/memoir/memoir.dtx index 302c02f2c21..42c0f13726a 100644 --- a/Master/texmf-dist/source/latex/memoir/memoir.dtx +++ b/Master/texmf-dist/source/latex/memoir/memoir.dtx @@ -2,7 +2,7 @@ % % memoir.dtx % Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net -% Copyright 2001--2005 Peter R. Wilson +% Copyright 2001--2008 Peter R. Wilson % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -18,7 +18,7 @@ % This work consists of the files listed in the README file. % % \fi -% \CheckSum{20643} +% \CheckSum{27322} % % \changes{v0.1}{2001/05/20}{First public alpha release} % \changes{v0.2}{2001/06/03}{First beta release} @@ -56,13 +56,15 @@ % \changes{v1.4}{2003/11/30}{Added patches v1.8} % \changes{v1.4}{2003/11/30}{Added patches v1.9} % \changes{v1.6}{2004/01/31}{Decided to issue v1.4 as v1.6 on the way to -% the golden section} +% the golden section 1.6180339887...} % \changes{v1.61}{2004/03/14}{Changes to clo files, and footnotes} % \changes{v1.61}{2004/03/21}{Removed a potential problem with the % hangul package} % \changes{v1.618}{2005/09/02}{Folded in all v1.61 patches} % \changes{v1.618}{2005/09/15}{Some minor extensions} % \changes{v1.618}{2005/09/25}{Support for glossaries} +% \changes{v1.6180}{2006/06/12}{Footnote font fix} +% \changes{v1.61803}{2008/05/26}{Folded in all mempatch v4.9a patches} % % \def\dtxfile{memoir.dtx} % @@ -84,6 +86,8 @@ % \def\fileversion{v1.6} \def\filedate{2004/01/31} % \def\fileversion{v1.61} \def\filedate{2004/04/04} % \def\fileversion{v1.618} \def\filedate{2005/09/27} +% \def\fileversion{v1.6180} \def\filedate{2006/06/12} +% \def\fileversion{v1.61803} \def\filedate{2008/05/26} % \title{The LaTeX \Lpack{memoir} class for configurable book % typesetting: Source code\thanks{This % file (\texttt{\dtxfile}) has version number \fileversion, last revised @@ -143,7 +147,8 @@ % styles that you can choose from if you don't want to create your own. % % Documents can be typeset in 9pt, 10pt, 11pt, 12pt, 14pt or 17pt font -% sizes and there is a reasonably intuitive means of setting the margins +% sizes, and if you have scaleable fonts available they can be set at any size. +% There is a reasonably intuitive means of setting the margins % and placement of the text on a page. There is an option to put % trim marks on the printed pages if the stock sheets need to be trimmed % down to the final page size. For those whose publishers like a @@ -154,8 +159,8 @@ % % As this is a new class, by default it does not support the old % LaTeX v2.09 -% font commands, namely the |\bf|, |\sl|, |\it| and |\sc| commands; -% it warns about using the |\em| command but does support it. +% font commands, namely the \cs{bf}, \cs{sl}, \cs{it} and \cs{sc} commands; +% it warns about using the \cs{em} command but does support it. % % % I hope that apart from the font commands the class @@ -233,6 +238,7 @@ % We want the full details printed. % \begin{macrocode} \begin{document} +\DeleteShortVerb{\|} \raggedbottom \raggedright \DocInput{memoir.dtx} @@ -301,19 +307,31 @@ % Announce the name, option files and version for LaTeX2e files: % \begin{macrocode} %<class>\ProvidesClass{memoir}% -%<class> [2005/09/25 v1.618 configurable document class] +%<class> [2008/05/26 v1.61803 configurable book, report, article document class] %<9pt>\ProvidesFile{mem9.clo}% -%<9pt> [2004/03/12 v0.3 memoir class 9pt size option] +%<9pt> [2008/01/30 v0.4 memoir class 9pt size option] %<10pt>\ProvidesFile{mem10.clo}% -%<10pt> [2002/07/27 v0.2 memoir class 10pt size option] +%<10pt> [2008/01/30 v0.3 memoir class 10pt size option] %<11pt>\ProvidesFile{mem11.clo}% -%<11pt> [2002/07/27 v0.2 memoir class 11pt size option] +%<11pt> [2008/01/30 v0.3 memoir class 11pt size option] %<12pt>\ProvidesFile{mem12.clo}% -%<12pt> [2004/03/12 v0.3 memoir class 12pt size option] +%<12pt> [2008/01/30 v0.4 memoir class 12pt size option] %<14pt>\ProvidesFile{mem14.clo}% -%<14pt> [2004/03/12 v0.3 memoir class 14pt size option] +%<14pt> [2008/01/30 v0.4 memoir class 14pt size option] %<17pt>\ProvidesFile{mem17.clo}% -%<17pt> [2004/03/12 v0.2 memoir class 17pt size option] +%<17pt> [2008/01/30 v0.3 memoir class 17pt size option] +%<20pt>\ProvidesFile{mem20.clo}% +%<20pt> [2008/01/31 v0.1 memoir class 20pt size option] +%<25pt>\ProvidesFile{mem25.clo}% +%<25pt> [2008/01/31 v0.1 memoir class 25pt size option] +%<30pt>\ProvidesFile{mem30.clo}% +%<30pt> [2008/01/31 v0.1 memoir class 30pt size option] +%<36pt>\ProvidesFile{mem36.clo}% +%<36pt> [2008/01/31 v0.1 memoir class 36pt size option] +%<48pt>\ProvidesFile{mem48.clo}% +%<48pt> [2008/01/31 v0.1 memoir class 48pt size option] +%<60pt>\ProvidesFile{mem60.clo}% +%<60pt> [2008/01/31 v0.1 memoir class 60pt size option] % \end{macrocode} % % @@ -330,13 +348,20 @@ % In this part we define a few commands that are used later on. % % \begin{macro}{\@ptsize} -% This control sequence is used to store the second digit of the +% \begin{macro}{\@memptsize} +% The \cs{@ptsize} control sequence is normally used to store the +% second digit of the % pointsize we are typesetting in. So, normally, it's value is one % of 0, 1 or 2. +% +% \cs{@memptsize} stores the full pointsize. +% \changes{v1.61803}{2008/01/30}{Added \cs{@memptsize}} % \begin{macrocode} -\newcommand{\@ptsize}{} +\newcommand*{\@ptsize}{} +\newcommand*{\@memptsize}{} % \end{macrocode} % \end{macro} +% \end{macro} % % Any new lengths that depend on the point size option must be declared % before the options are executed. @@ -357,11 +382,15 @@ % \end{macro} % % \begin{macro}{\@memcnta} -% We need a scratch count register. +% \begin{macro}{\c@memmarkcntra} +% We need a scratch count register and a scratch counter. +% \changes{v1.61803}{2008/10/30}{Added @memmarkcntra scratch counter} % \begin{macrocode} \newcount\@memcnta +\newcounter{@memmarkcntra} % \end{macrocode} % \end{macro} +% \end{macro} % % \changes{v1.0a}{2001/11/28}{Deleted count register \cs{@memtempa}} % @@ -413,14 +442,24 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\ifextrafontsizes} +% This is TRUE if the \Lopt{extrafontsizes} option is used. +% \changes{v1.61803}{2008/01/30}{Added \cs{ifextrafontsizes}} +% \begin{macrocode} +\newif\ifextrafontsizes + \extrafontsizesfalse + +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@memerror} % \begin{macro}{\@memwarn} % Two macros to save some space when reporting errors or warnings. % The macros take the same arguments, ignoring the first in each case, -% as |\ClassError| and |\ClassWarning|, e.g., \\ -% |\@memwarn{Message}| \\ +% as \cs{ClassError} and \cs{ClassWarning}, e.g., \\ +% \verb?\@memwarn{Message}? \\ % instead of \\ -% |\ClassWarning{memoir}{Message}|. +% \verb?\ClassWarning{memoir}{Message}?. % \changes{v1.4}{2003/02/27}{Added \cs{@memerror} and \cs{@memwarn}} % \begin{macrocode} \newcommand*{\@memerror}{\ClassError{memoir}} @@ -432,11 +471,12 @@ % % \begin{macro}{\ifsamename} % \begin{macro}{\nametest} -% The macro |\nametest{|\meta{name1}|}{|\meta{name2}|}| tests whether the +% The macro \cs{nametest}\marg{name1}\marg{name2} tests whether the % characters forming the two arguments are the same or not. If they are the -% same then |\ifsamename| is set TRUE, otherwise it is set FALSE. \meta{name1} +% same then \cs{ifsamename} is set TRUE, otherwise it is set FALSE. \meta{name1} % and \meta{name2} must both be either macro names (including the backslash) -% or must both not be macro names. That is, you cannot do |\nametest{\cs}{cs}|. +% or must both not be macro names. That is, you cannot do +% \verb?\nametest{\cs}{cs}?. % \begin{macrocode} \newif\ifsamename \newcommand{\nametest}[2]{% @@ -521,7 +561,7 @@ % % % \begin{macro}{\kill@lastcounter} -% |\kill@lastcounter{|\meta{cntr}|}|\footnote{With thanks to Stefan Ulrich +% \cs{kill@lastcounter}\marg{cntr}\footnote{With thanks to Stefan Ulrich % (\texttt{ulrich@cis.uni-muenchen.de}) who answered a question on this % on \ctt, 2001/07/09. (Also answered by Heiko Oberdiek, % \texttt{oberdiek@ruf.uni-freiburg.de}).} @@ -530,14 +570,14 @@ % \emph{The macro must only be used when the last allocated counter is to % be killed.} % For example with:\\ -% |\newcounter{fred} \kill@lastcounter{fred} \newcounter{fred}| \\ -% there is no error with the second |\newcounter|. +% \verb?\newcounter{fred} \kill@lastcounter{fred} \newcounter{fred}? \\ +% there is no error with the second \cs{newcounter}. % \changes{v0.3}{2001/07/09}{Added \cs{kill@counter}} % \changes{v1.618}{2005/09/02}{Ensured \cs{kill@counter} zeroed the counter} % \begin{macrocode} \newcommand{\kill@lastcounter}[1]{% % \end{macrocode} -% Deallocate the last counter register. From \theTeXbook, |\count10| is +% Deallocate the last counter register. From \theTeXbook, \verb?\count10? is % the number of the last register. The counter should be zeroed before being % deallocated otherwise an immediatally following \cs{newcount} may not % be zero when allocated\footnote{Discovered and fix provided by Robert @@ -546,7 +586,7 @@ \count\count10 \z@ \advance\count10 \m@ne % \end{macrocode} -% Set the internal counter definition to |\relax|. +% Set the internal counter definition to \cs{relax}. % \begin{macrocode} \expandafter\let\csname c@#1\endcsname\relax} @@ -568,13 +608,22 @@ \expandafter\let\csname #1\endcsname} \newcommand{\@namelongdef}[1]{% \long\expandafter\def\csname #1\endcsname} - % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % +% \begin{macro}{\@nameedef} +% A shorthand for using \cs{protected@edef}. +% \begin{macrocode} +\newcommand{\@nameedef}[1]{% + \expandafter\protected@edef\csname #1\endcsname} + +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}{\memjustarg} % \begin{macro}{\memgobble} % Utility macros \emph{that are not to be changed by any user!} @@ -587,6 +636,8 @@ % \end{macro} % \end{macro} % +% \subsection{Classes, Packages and Files} +% % \begin{macro}{\@memfakeusepackage} % \cs{@memfakeusepackage}\marg{pack} fools \LaTeX{} into thinking % that the \meta{pack.sty} package has been loaded. @@ -643,32 +694,140 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\DisemulatePackage} +% \cs{DisemulatePackage}\marg{package} undoes a previous +% \cs{EmulatedPackage...} +% \changes{v1.61803}{2008/01/30}{Added \cs{DisemulatePackage} from memptach v4.5} +% \begin{macrocode} +\newcommand*{\DisemulatePackage}[1]{% + \@namelet{ver@#1.\pkgextension}\relax} +\@onlypreamble\DisemulatePackage + +% \end{macrocode} +% \end{macro} +% % -% \begin{macro}{\ifpdf} -% This can be used to check whether or not a document is being processed -% by \LaTeX{} or pdf\LaTeX. -% \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)} +% Code, based on a hint from Morten H{\o}gholm\footnote{CTT posting +% 2005/11/08, \textit{Re: Checking for packages froma class... +% revisited}} that the \Lpack{scrlfile} package from +% \Lpack{koma-script} includes commands such as \\ +% \cs{AfterFile}\marg{file}\marg{code} \\ +% plus before and after classes and packages. +% \changes{v1.16803}{2008/01/30}{Added various \cs{AtBegin...} and +% \cs{AtEnd...} macros (mempatch v4.2)} +% +% Extend the \cs{InputIfFileExists} macro to call hooks before and +% the actual inputting. The kernel version (as of 2005/11/21) is: +% \begin{verbatim} +% \newcommand{\InputIfFileExists}[2]{% +% \IfFileExists{#1}% +% {\#2\@addtofilelist{#1}\@@input \@filef@und}} +% \end{verbatim} +% +% \begin{macro}{\InputIfFileExists} +% Effectively all file input is handled by this macro. Extend it +% by adding pre- and post- input hooks. % \begin{macrocode} -\newif\ifpdf -\ifx\pdfoutput\undefined -\else - \ifx\pdfoutput\relax - \else - \ifcase\pdfoutput - \else - \pdftrue - \fi - \fi -\fi -%%\@memfakeusepackage{ifpdf} +\renewcommand{\InputIfFileExists}[2]{% + \IfFileExists{#1}% + {#2\@addtofilelist{#1}\m@matbeginf{#1}% + \@@input \@filef@und + \m@matendf{#1}% + \killm@matf{#1}}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@matbeginf} +% \begin{macro}{\m@matendf} +% \cs{m@matbeginf}\marg{file} calls macro \cs{file-m@mfb} if it +% is defined. Similarly \cs{m@matendf}\marg{file} calls +% \cs{file-m@mfe} if it is defined. +% \begin{macrocode} +\newcommand{\m@matbeginf}[1]{\@ifundefined{#1-m@mfb}{}% + {\@nameuse{#1-m@mfb}}} +\newcommand{\m@matendf}[1]{\@ifundefined{#1-m@mfe}{}% + {\@nameuse{#1-m@mfe}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\killm@matf} +% \cs{killm@matf}\marg{file} undefines the \cs{file-m@mfb} and +% \cs{file-m@mfe} macros. +% \begin{macrocode} +\newcommand*{\killm@matf}[1]{% + \@namelet{#1-m@mfb}\relax + \@namelet{#1-m@mfe}\relax} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\AtBeginFile} +% \begin{macro}{\AtEndFile} +% \cs{AtBeginFile}\marg{file}\marg{code} inserts \meta{code} +% just before \meta{file} is input. Similarly \cs{AtEndFile} inserts +% just after input. +% \begin{macrocode} +\newcommand{\AtBeginFile}[2]{\@ifundefined{#1-m@mfb}% + {\@namedef{#1-m@mfb}{#2}}% + {\expandafter\addtodef\csname #1-m@mfb\endcsname{}{#2}}} +\newcommand{\AtEndFile}[2]{\@ifundefined{#1-m@mfe}% + {\@namedef{#1-m@mfe}{#2}}% + {\expandafter\addtodef\csname #1-m@mfe\endcsname{}{#2}}} % \end{macrocode} % \end{macro} +% \end{macro} +% +% \begin{macro}{\AtBeginPackage} +% \begin{macro}{\AtEndPackage} +% \begin{macro}{\RequireAtEndPackage} +% \cs{AtBeginPackage}\marg{pack}\marg{code} inserts \meta{code} +% just before the \meta{pack} package is input, and \cs{AtEndPackage} +% is the equivalent for after input. \cs{RequireAtEndPackage} inserts +% \meta{code} either at the end of \meta{pack}, or immediately if +% \meta{pack} has already been input. +% \begin{macrocode} +\newcommand{\AtBeginPackage}[2]{% + \AtBeginFile{#1.\@pkgextension}{#2}} +\newcommand{\AtEndPackage}[2]{% + \AtEndFile{#1.\@pkgextension}{#2}} +\newcommand{\RequireAtEndPackage}[2]{% + \@ifpackageloaded{#1}{#2}% + {\AtEndFile{#1.\@pkgextension}{#2}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\AtBeginClass} +% \begin{macro}{\AtEndClass} +% \begin{macro}{\RequireAtEndClass} +% \cs{AtBeginClass}\marg{class}\marg{code} and friends are the class +% equivalents of \cs{AtBeginPackage} and friends. +% \begin{macrocode} +\newcommand{\AtBeginClass}[2]{% + \AtBeginFile{#1.\@clsextension}{#2}} +\newcommand{\AtEndClass}[2]{% + \AtEndFile{#1.\@clsextension}{#2}} +\newcommand{\RequireAtEndClass}[2]{% + \@ifclassloaded{#1}{#2}% + {\AtEndFile{#1.\@clsextension}{#2}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% % % \begin{macro}{\phantomsection} % A command needed if the \Lpack{hyperref} package is used, for putting -% before certain |\addcontentsline| commands. +% before certain \cs{addcontentsline} commands. % \begin{macrocode} \newcommand{\phantomsection}{} @@ -705,15 +864,208 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\memsetcounter} +% A wrapper round \cs{setcounter}. I want to use this in the \texttt{aux} file. +% \changes{v1.61803}{2008/01/30}{Added \cs{memsetcounter}} +% \begin{macrocode} +\newcommand*{\memsetcounter}[2]{\setcounter{#1}{#2}} +\AtBeginDocument{\immediate\write\@mainaux{% + \string\providecommand*{\string\memsetcounter}[2]{}}} + +% \end{macrocode} +% \end{macro} +% +% \subsection{For package documentation} +% +% Some macros that may be useful for documenting LaTeX code. These +% have principally come from \texttt{doc.dtx}. +% +% \begin{macro}{\bs} +% Prints \verb?\? +% \begin{macrocode} +\def\bs{\texttt{\char`\\}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\l@nohyphenation} +% \begin{macro}{\meta} +% \begin{macro}{\meta@font@select} +% From \texttt{doc.dtx} \\ +% \cs{meta}\marg{arg} prints \meta{arg}. +% \begin{macrocode} +\ifx\l@nohyphenation\undefined + \newlanguage\l@nohyphenation +\fi +\DeclareRobustCommand{\meta}[1]{% + \ensuremath\langle + \ifmmode \expandafter \nfss@text \fi + {% + \meta@font@select + \edef\meta@hyphen@restore + {\hyphenchar\the\font\the\hyphenchar\font}% + \hyphenchar\font\m@ne + \language\l@nohyphenation + #1\/% + \meta@hyphen@restore + }\ensuremath\rangle +} +\def\meta@font@select{\itshape} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\marg} +% \begin{macro}{\oarg} +% \begin{macro}{\parg} +% Robust versions of the \texttt{doc.dtx} macros. \\ +% \cs{marg}\marg{arg} prints \marg{arg} \\ +% \cs{oarg}\marg{arg} prints \oarg{arg} \\ +% \cs{parg}\marg{arg} prints \parg{arg} \\ +% \begin{macrocode} +\DeclareRobustCommand{\marg}[1]{% + {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} +\DeclareRobustCommand{\oarg}[1]{% + {\ttfamily\char`\[}\meta{#1}{\ttfamily\char`\]}} +\DeclareRobustCommand{\parg}[1]{% + {\ttfamily\char`\(}\meta{#1}{\ttfamily\char`\)}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cs} +% \verb?\cs{arg}? prints \cs{arg}. +% \begin{macrocode} +\DeclareRobustCommand{\cs}[1]{\texttt{\char`\\#1}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\cmdprint} +% \begin{macro}{\cmd} +% From Heiko Oberdiek CTT 2001/05/26 (print and index a command) \\ +% \verb?\cmdprint{\fred}? prints \verb?\fred? \\ +% \verb?\cmd{\fred}? prints and indexes \verb?\fred?. NOTE It assumes that +% \verb!?! is the `actual' character for MakeIndex (it is normally \verb!@! +% but that is not much use if a command includes \verb!@! as part of its name). +% \begin{macrocode} +\newcommand{\cmdprint}[1]{\texttt{\string#1}} +\newcommand{\cmd}[1]{\cmdprint{#1}% + \index{\expandafter\@gobble\string#1?\string\cmdprint{\string#1}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% +% \subsection{Checking the processor} +% +% \begin{macro}{\ifpdf} +% This can be used to check whether or not a document is being processed +% by \LaTeX{} or pdf\LaTeX. +% \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)} +% \begin{macrocode} +\newif\ifpdf +\ifx\pdfoutput\undefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi + +% \end{macrocode} +% \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)}. +% \changes{v1.61803}{2008/01/30}{Added check for etex (mempatch v4.9)} +% \begin{macrocode} +\newif\ifetex + \etexfalse +\ifx\eTeXversion\@undefined\else + \ifx\eTeXversion\relax\else + \ifnum\eTeXversion>0\relax + \etextrue + \fi + \fi +\fi + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% 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. +% \changes{v1.61803}{2008/01/30}{Added checks for XeTeX (mempatch v4.9)} +% \begin{macrocode} +\newif\ifxetex +\@ifundefined{XeTeXrevision}{\xetexfalse}{\xetextrue} +% \end{macrocode} +% Check for XeTeX from the \Lpack{ifxetex} package. +% \begin{macrocode} +\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} + +% \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)}. +% \changes{v1.61803}{2008/01/30}{Added check for luatex} +% \begin{macrocode} +\newif\ifluatex + \luatexfalse +\ifx\luatexversion\@undefined\else + \ifx\luatexversion\relax + \luatextrue + \fi +\fi + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \subsection{Extending an existing macro} % % % My usual technique for modifying the code of an existing -% macro was to use |\renewcommand|. However it slowly became apparent that +% macro was to use \cs{renewcommand}. However it slowly became apparent that % many of such modifications merely consisted of adding some code at % either the start or end of the existing definition. In June 2000 I % posed a question -% on the |comp.text.tex| newsgroup about this, and +% on the \texttt{comp.text.tex} newsgroup about this, and % Michael Downes\footnote{\texttt{epsmjd@ams.org}} and % Heiko Oberdiek\footnote{\texttt{oberdiek@ruf.uni-freiburg.de}} % were kind enough to respond. @@ -738,7 +1090,7 @@ % using the normal \LaTeX{} test against it being undefined. He supplied % the code for performing the macro name test. % -% |\wo@dmacro| is a helper for handling the string `macro:'. +% \cs{wo@dmacro} is a helper for handling the string `macro:'. % \begin{macrocode} \edef\wo@dmacro{% \string m\string a\string c\string r\string o\string :% @@ -760,7 +1112,7 @@ % \begin{macrocode} \begingroup % \end{macrocode} -% Test if |#1| is a defined macro; |\wo@dparsemacro| does most of the work. +% Test if \verb?#1? is a defined macro; \cs{wo@dparsemacro} does most of the work. % \begin{macrocode} \edef\x{% \noexpand\wo@dparsemacro\meaning#1\wo@dmacro\string -% @@ -772,9 +1124,9 @@ % \end{macro} % % \begin{macro}{\wo@dparsemacro} -% This is called by |\wo@difmacro@begingroup|. If \meta{macro} is not +% This is called by \cs{wo@difmacro@begingroup}. If \meta{macro} is not % a defined macro it prints a warning and closes the group begun by -% |\wo@difmacro@begingroup|. Otherwise it process the \meta{code} which +% \cs{wo@difmacro@begingroup}. Otherwise it process the \meta{code} which % \emph{must} close the group. % \begin{macrocode} \begingroup @@ -796,26 +1148,26 @@ % \begin{macro}{\addtodef} % \begin{macro}{\addtodef*} % \begin{macro}{\wo@daddtodef} -% The command |\addtodef{|\meta{macro}|}{|\meta{start-stuff}|}{|\meta{end-stuff}|}| +% The command \cs{addtodef}\marg{macro}\marg{start-stuff}\marg{end-stuff} % adds stuff at the start and/or end of an argumentless macro. % Initially the code for appending was a reimplementation of the -% kernel |\g@addto@macro| command (from \file{ltclass.dtx}). +% kernel \cs{g@addto@macro} command (from \file{ltclass.dtx}). % Later, at Michael Downes' suggestion, I combined % appending and prepending stuff into a single command. % Actually, there is no real need to have both -% |\addtodef| and |\addtodef*| as the body of the command +% \cs{addtodef} and \cs{addtodef*} as the body of the command % being amended has no argument, % but both versions are provided for consistency. % -% The kernel |\@star@or@long| and |\l@ngrel@x| commands +% The kernel \cs{@star@or@long} and \cs{l@ngrel@x} commands % (in \file{ltdefns.dtx}) are used to handle -% the potential |*| after the command name. +% the potential \verb?*? after the command name. % \begin{macrocode} \def\addtodef{\@star@or@long\wo@daddtodef} % \end{macrocode} -% The |\@star@or@long| command dealt with a possible |*| and now -% |\wo@daddtodef| does the work. It picks up the three arguments -% that the user thinks belong to |\addtodef|, namely \meta{macro}, +% The \cs{@star@or@long} command dealt with a possible \verb?*? and now +% \cs{wo@daddtodef} does the work. It picks up the three arguments +% that the user thinks belong to \cs{addtodef}, namely \meta{macro}, % \meta{start-stuff} and \meta{end-stuff}. % \begin{macrocode} \long\def\wo@daddtodef#1#2#3{% @@ -830,19 +1182,19 @@ \@temptokena{#2}% \toks@\expandafter{#1#3}% % \end{macrocode} -% Do an expanded definition for |\x|, so that calling |\x| -% will |\def| a new version of \meta{macro}, whose body consists of the +% Do an expanded definition for \cs{x}, so that calling \cs{x} +% will \cs{def} a new version of \meta{macro}, whose body consists of the % saved tokens (i.e., the orginal body plus the extra stuff). % As Michael Downes noted, single letter control sequences do not take any of % \TeX's hash table space. -% |\l@ngrel@x| -% has been previously set to either |\long| or |\relax| by |\@star@or@long|, -% and so may make the new definition of \meta{macro} to be |\long|. +% \cs{l@ngrel@x} +% has been previously set to either \cs{long} or \cs{relax} by \cs{@star@or@long}, +% and so may make the new definition of \meta{macro} to be \cs{long}. % \begin{macrocode} \edef\x{\endgroup \l@ngrel@x\def\noexpand#1{\the\@temptokena \the\toks@}}% % \end{macrocode} -% Finally, call |\x| to perform the new definition. +% Finally, call \cs{x} to perform the new definition. % \begin{macrocode} \x }% @@ -1048,7 +1400,7 @@ % % \subsection{Setting Paper Sizes} % -% The variables |\paperheight| and |\paperwidth| should reflect the +% The variables \cs{paperheight} and \cs{paperwidth} should reflect the % physical paper size after trimming. % % Option \Lopt{letterpaper} will be the default. @@ -1057,14 +1409,14 @@ % \begin{macro}{\stockwidth} % \begin{macro}{\trimtop} % \begin{macro}{\trimedge} -% The lengths |\stockheight| and |\stockwidth| should be the height and +% The lengths \cs{stockheight} and \cs{stockwidth} should be the height and % width of the stock sheet before trimming. For example, this is the % physical size -% of a single sheet that might be laser-printed. The lengths |\trimtop| -% and |\trimedge| are the amount that will be trimmed off the top and fore +% of a single sheet that might be laser-printed. The lengths \cs{trimtop} +% and \cs{trimedge} are the amount that will be trimmed off the top and fore % edge of the physical sheet. % For desk printer output the size of the trimmed sheet is often the -% same as the physical sheet. In other words the |\paper...| and |\stock...| +% same as the physical sheet. In other words the \cs{paper...} and \cs{stock...} % sizes are the same and the trims are zero. This class assumes that this % is the normal case. % \begin{macrocode} @@ -1079,44 +1431,320 @@ % \end{macro} % \end{macro} % +% The class provides an extended range of stock sizes. It may be useful at some +% point to have macros for these. +% +% \begin{macro}{\stockdbill} +% \begin{macro}{\stockstatement} +% \begin{macro}{\stockexecutive} +% \begin{macro}{\stockletter} +% \begin{macro}{\stockold} +% \begin{macro}{\stocklegal} +% \begin{macro}{\stockledger} +% \begin{macro}{\stockbroadsheet} +% US stock sizes. +% \changes{v1.61803}{2008/01/30}{Major expansion of stock size options} +% \begin{macrocode} +\newcommand*{\stockdbill} {\stockheight=7in \stockwidth=3in} +\newcommand*{\stockstatement} {\stockheight=8.5in \stockwidth=5.5in} +\newcommand*{\stockexecutive} {\stockheight=10.5in \stockwidth=7.25in} +\newcommand*{\stockletter} {\stockheight=11in \stockwidth=8.5in} +\newcommand*{\stockold} {\stockheight=12in \stockwidth=9in} +\newcommand*{\stocklegal} {\stockheight=14in \stockwidth=8.5in} +\newcommand*{\stockledger} {\stockheight=17in \stockwidth=11in} +\newcommand*{\stockbroadsheet}{\stockheight=22in \stockwidth=17in} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\stockpottvo} +% \begin{macro}{\stockfoolscapvo} +% \begin{macro}{\stockcrownvo} +% \begin{macro}{\stockpostvo} +% \begin{macro}{\stocklargecrownvo} +% \begin{macro}{\stocklargepostvo} +% \begin{macro}{\stocksmalldemyvo} +% Traditional British octavo sizes. +% \begin{macrocode} +\newcommand*{\stockpottvo} {\stockheight=6.25in \stockwidth=4in} +\newcommand*{\stockfoolscapvo} {\stockheight=6.75in \stockwidth=4.25in} +\newcommand*{\stockcrownvo} {\stockheight=7.5in \stockwidth=5in} +\newcommand*{\stockpostvo} {\stockheight=8in \stockwidth=5in} +\newcommand*{\stocklargecrownvo}{\stockheight=8in \stockwidth=5.25in} +\newcommand*{\stocklargepostvo} {\stockheight=8.25in \stockwidth=5.25in} +\newcommand*{\stocksmalldemyvo} {\stockheight=8.5in \stockwidth=5.675in} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\stockdemyvo} +% \begin{macro}{\stockmediumvo} +% \begin{macro}{\stocksmallroyalvo} +% \begin{macro}{\stockroyalvo} +% \begin{macro}{\stocksuperroyalvo} +% \begin{macro}{\stockimperialvo} +% \begin{macrocode} +\newcommand*{\stockdemyvo} {\stockheight=8.75in \stockwidth=5.675in} +\newcommand*{\stockmediumvo} {\stockheight=9in \stockwidth=5.75in} +\newcommand*{\stocksmallroyalvo}{\stockheight=9.25in \stockwidth=6.175in} +\newcommand*{\stockroyalvo} {\stockheight=10in \stockwidth=6.25in} +\newcommand*{\stocksuperroyalvo}{\stockheight=10.25in \stockwidth=6.75in} +\newcommand*{\stockimperialvo} {\stockheight=11in \stockwidth=7.5in} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\stockmcrownvo} +% \begin{macro}{\stockmlargecrownvo} +% \begin{macro}{\stockmdemyvo} +% \begin{macro}{\stockmsmallroyalvo} +% Metric stock sizes. +% \begin{macrocode} +\newcommand*{\stockmcrownvo} {\stockheight=186mm \stockwidth=123mm} +\newcommand*{\stockmlargecrownvo} {\stockheight=198mm \stockwidth=129mm} +\newcommand*{\stockmdemyvo} {\stockheight=216mm \stockwidth=138mm} +\newcommand*{\stockmsmallroyalvo} {\stockheight=234mm \stockwidth=156mm} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\stockaiii} +% \begin{macro}{\stockaiv} +% \begin{macro}{\stockav} +% \begin{macro}{\stockavi} +% The A series, A3 --- A6. +% \begin{macrocode} +\newcommand*{\stockaiii}{\stockheight=420mm \stockwidth=297mm} +\newcommand*{\stockaiv} {\stockheight=297mm \stockwidth=210mm} +\newcommand*{\stockav} {\stockheight=210mm \stockwidth=148mm} +\newcommand*{\stockavi} {\stockheight=148mm \stockwidth=105mm} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\stockbiii} +% \begin{macro}{\stockbiv} +% \begin{macro}{\stockbv} +% \begin{macro}{\stockbvi} +% The B series, B3 --- B6. +% \begin{macrocode} +\newcommand*{\stockbiii}{\stockheight=500mm \stockwidth=353mm} +\newcommand*{\stockbiv} {\stockheight=353mm \stockwidth=250mm} +\newcommand*{\stockbv} {\stockheight=250mm \stockwidth=176mm} +\newcommand*{\stockbvi} {\stockheight=176mm \stockwidth=125mm} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% It will be useful also to provide macros that set the page sizes. +% +% \begin{macro}{\pagedbill} +% \begin{macro}{\pagestatement} +% \begin{macro}{\pageexecutive} +% \begin{macro}{\pageletter} +% \begin{macro}{\pageold} +% \begin{macro}{\pagelegal} +% \begin{macro}{\pageledger} +% \begin{macro}{\pagebroadsheet} +% US page sizes. +% \begin{macrocode} +\newcommand*{\pagedbill} {\pageheight=7in \pagewidth=3in} +\newcommand*{\pagestatement} {\pageheight=8.5in \pagewidth=5.5in} +\newcommand*{\pageexecutive} {\pageheight=10.5in \pagewidth=7.25in} +\newcommand*{\pageletter} {\pageheight=11in \pagewidth=8.5in} +\newcommand*{\pageold} {\pageheight=12in \pagewidth=9in} +\newcommand*{\pagelegal} {\pageheight=14in \pagewidth=8.5in} +\newcommand*{\pageledger} {\pageheight=17in \pagewidth=11in} +\newcommand*{\pagebroadsheet}{\pageheight=22in \pagewidth=17in} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\pagepottvo} +% \begin{macro}{\pagefoolscapvo} +% \begin{macro}{\pagecrownvo} +% \begin{macro}{\pagepostvo} +% \begin{macro}{\pagelargecrownvo} +% \begin{macro}{\pagelargepostvo} +% \begin{macro}{\pagesmalldemyvo} +% British traditional page sizes, octavo. +% \begin{macrocode} +\newcommand*{\pagepottvo} {\pageheight=6.25in \pagewidth=4in} +\newcommand*{\pagefoolscapvo} {\pageheight=6.75in \pagewidth=4.25in} +\newcommand*{\pagecrownvo} {\pageheight=7.5in \pagewidth=5in} +\newcommand*{\pagepostvo} {\pageheight=8in \pagewidth=5in} +\newcommand*{\pagelargecrownvo}{\pageheight=8in \pagewidth=5.25in} +\newcommand*{\pagelargepostvo} {\pageheight=8.25in \pagewidth=5.25in} +\newcommand*{\pagesmalldemyvo} {\pageheight=8.5in \pagewidth=5.675in} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\pagedemyvo} +% \begin{macro}{\pagemediumvo} +% \begin{macro}{\pagesmallroyalvo} +% \begin{macro}{\pageroyalvo} +% \begin{macro}{\pagesuperroyalvo} +% \begin{macro}{\pageimperialvo} +% \begin{macrocode} +\newcommand*{\pagedemyvo} {\pageheight=8.75in \pagewidth=5.675in} +\newcommand*{\pagemediumvo} {\pageheight=9in \pagewidth=5.75in} +\newcommand*{\pagesmallroyalvo}{\pageheight=9.25in \pagewidth=6.175in} +\newcommand*{\pageroyalvo} {\pageheight=10in \pagewidth=6.25in} +\newcommand*{\pagesuperroyalvo}{\pageheight=10.25in \pagewidth=6.75in} +\newcommand*{\pageimperialvo} {\pageheight=11in \pagewidth=7.5in} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\pagemcrownvo} +% \begin{macro}{\pagemlargecrownvo} +% \begin{macro}{\pagemdemyvo} +% \begin{macro}{\pagemsmallroyalvo} +% Metric sizes. +% \begin{macrocode} +\newcommand*{\pagemcrownvo} {\pageheight=186mm \pagewidth=123mm} +\newcommand*{\pagemlargecrownvo} {\pageheight=198mm \pagewidth=129mm} +\newcommand*{\pagemdemyvo} {\pageheight=216mm \pagewidth=138mm} +\newcommand*{\pagemsmallroyalvo} {\pageheight=234mm \pagewidth=156mm} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\pageaiii} +% \begin{macro}{\pageaiv} +% \begin{macro}{\pageav} +% \begin{macro}{\pageavi} +% The A series, A3 --- A6. +% \begin{macrocode} +\newcommand*{\pageaiii}{\pageheight=420mm \pagewidth=297mm} +\newcommand*{\pageaiv} {\pageheight=297mm \pagewidth=210mm} +\newcommand*{\pageav} {\pageheight=210mm \pagewidth=148mm} +\newcommand*{\pageavi} {\pageheight=148mm \pagewidth=105mm} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\pagebiii} +% \begin{macro}{\pagebiv} +% \begin{macro}{\pagebv} +% \begin{macro}{\pagebvi} +% The B series, B3 --- B6. +% \begin{macrocode} +\newcommand*{\pagebiii}{\pageheight=500mm \pagewidth=353mm} +\newcommand*{\pagebiv} {\pageheight=353mm \pagewidth=250mm} +\newcommand*{\pagebv} {\pageheight=250mm \pagewidth=176mm} +\newcommand*{\pagebvi} {\pageheight=176mm \pagewidth=125mm} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % Declare the stock size options. +% +% Metric paper stock sizes. +% \begin{macrocode} +\DeclareOption{a3paper}{\stockaiii} +\DeclareOption{a4paper}{\stockaiv} +\DeclareOption{a5paper}{\stockav} +\DeclareOption{a6paper}{\stockavi} +\DeclareOption{b3paper}{\stockbiii} +\DeclareOption{b4paper}{\stockbiv} +\DeclareOption{b5paper}{\stockbv} +\DeclareOption{b6paper}{\stockbvi} +\DeclareOption{mcrownvopaper}{\stockmcrownvo} +\DeclareOption{mlargecrownvopaper}{\stockmlargecrownvo} +\DeclareOption{mdemyvopaper}{\stockmdemyvo} +\DeclareOption{msmallroyalvopaper}{\stockmsmallroyalvo} + +% \end{macrocode} +% US paper stock sizes. +% \begin{macrocode} +\DeclareOption{dbillpaper}{\stockdbill} +\DeclareOption{statementpaper}{\stockstatement} +\DeclareOption{executivepaper}{\stockexecutive} +\DeclareOption{letterpaper}{\stockletter} +\DeclareOption{oldpaper}{\stockold} +\DeclareOption{legalpaper}{\stocklegal} +\DeclareOption{ledgerpaper}{\stockledger} +\DeclareOption{broadsheetpaper}{\stockbroadsheet} + +% \end{macrocode} +% British octavo stock paper sizes. +% \begin{macrocode} +\DeclareOption{pottvopaper}{\stockpottvo} +\DeclareOption{foolscapvopaper}{\stockfoolscapvo} +\DeclareOption{crownvopaper}{\stockcrownvo} +\DeclareOption{postvopaper}{\stockpostvo} +\DeclareOption{largecrownvopaper}{\stocklargecrownvo} +\DeclareOption{largepostvopaper}{\stocklargepostvo} +\DeclareOption{smalldemyvopaper}{\stocksmalldemyvo} +\DeclareOption{demyvopaper}{\stockdemyvo} +\DeclareOption{mediumvopaper}{\stockmediumvo} +\DeclareOption{smallroyalvopaper}{\stocksmallroyalvo} +\DeclareOption{royalvopaper}{\stockroyalvo} +\DeclareOption{superroyalvopaper}{\stocksuperroyalvo} +\DeclareOption{imperialvopaper}{\stockimperialvo} + +% \end{macrocode} +% Ebook. % \begin{macrocode} -\DeclareOption{a3paper} - {\setlength\stockheight {420mm}% - \setlength\stockwidth {297mm}} -\DeclareOption{a4paper} - {\setlength\stockheight {297mm}% - \setlength\stockwidth {210mm}} -\DeclareOption{a5paper} - {\setlength\stockheight {210mm}% - \setlength\stockwidth {148mm}} -\DeclareOption{a6paper} - {\setlength\stockheight {148mm}% - \setlength\stockwidth {105mm}} -\DeclareOption{b3paper} - {\setlength\stockheight {500mm}% - \setlength\stockwidth {353mm}} -\DeclareOption{b4paper} - {\setlength\stockheight {353mm}% - \setlength\stockwidth {250mm}} -\DeclareOption{b5paper} - {\setlength\stockheight {250mm}% - \setlength\stockwidth {176mm}} -\DeclareOption{b6paper} - {\setlength\stockheight {176mm}% - \setlength\stockwidth {125mm}} -\DeclareOption{letterpaper} - {\setlength\stockheight {11in}% - \setlength\stockwidth {8.5in}} -\DeclareOption{legalpaper} - {\setlength\stockheight {14in}% - \setlength\stockwidth {8.5in}} -\DeclareOption{executivepaper} - {\setlength\stockheight {10.5in}% - \setlength\stockwidth {7.25in}} \DeclareOption{ebook} {\setlength\stockheight {9in}% \setlength\stockwidth {6in}} + % \end{macrocode} % % The \Lopt{landscape} option switches the values of the height and width, @@ -1133,32 +1761,66 @@ % % \subsection{Choosing the type size} % -% The type size options are handled by defining |\@ptsize| to contain -% the last digit of the size in question and branching on |\ifcase| +% The type size options are handled by defining \cs{@ptsize} to contain +% the last digit of the size in question and branching on \cs{ifcase} % statements. This is done for historical reasons to stay compatible -% with other packages that use the |\@ptsize| variable to select +% with other packages that use the \cs{@ptsize} variable to select % special actions. It makes the declarations of size options less -% than 10pt difficult. In this class \texttt{9} is used for the -% \Lopt{9pt} option, assuming that the class will never define a -% \Lopt{19pt} option. +% than 10pt or more than 20pt difficult. In this class \texttt{9} is used +% for the \Lopt{9pt} option, assuming that the class will never define a +% \Lopt{19pt} option. For larger options the full complement of digits +% are used. +% +% In any event, \cs{@memptsize} holds the complete size. % % Option \Lopt{10pt} will be the default. % \changes{v1.2}{2002/07/07}{Added 17pt option} +% \changes{v1.61803}{2008/01/30}{Added pt options 20 to 60.} +% \changes{v1.61803}{2008/01/30}{Used \cs{@memptsize}} % \begin{macrocode} -\renewcommand{\@ptsize}{0} -\DeclareOption{9pt}{\renewcommand{\@ptsize}{9}} -\DeclareOption{10pt}{\renewcommand{\@ptsize}{0}} -\DeclareOption{11pt}{\renewcommand{\@ptsize}{1}} -\DeclareOption{12pt}{\renewcommand{\@ptsize}{2}} -\DeclareOption{14pt}{\renewcommand{\@ptsize}{4}} -\DeclareOption{17pt}{\renewcommand{\@ptsize}{7}} +\renewcommand*{\@ptsize}{0} +\renewcommand*{\@memptsize}{10} +\DeclareOption{9pt}{\renewcommand*{\@ptsize}{9}\renewcommand*{\@memptsize}{9}} +\DeclareOption{10pt}{\renewcommand*{\@ptsize}{0}\renewcommand*{\@memptsize}{10}} +\DeclareOption{11pt}{\renewcommand*{\@ptsize}{1}\renewcommand*{\@memptsize}{11}} +\DeclareOption{12pt}{\renewcommand*{\@ptsize}{2}\renewcommand*{\@memptsize}{12}} +\DeclareOption{14pt}{\renewcommand*{\@ptsize}{4}\renewcommand*{\@memptsize}{14}} +\DeclareOption{17pt}{\renewcommand*{\@ptsize}{7}\renewcommand*{\@memptsize}{17}} +\DeclareOption{20pt}{\renewcommand*{\@ptsize}{20}\renewcommand*{\@memptsize}{20}} +\DeclareOption{25pt}{\renewcommand*{\@ptsize}{25}\renewcommand*{\@memptsize}{25}} +\DeclareOption{30pt}{\renewcommand*{\@ptsize}{30}\renewcommand*{\@memptsize}{30}} +\DeclareOption{36pt}{\renewcommand*{\@ptsize}{36}\renewcommand*{\@memptsize}{36}} +\DeclareOption{48pt}{\renewcommand*{\@ptsize}{48}\renewcommand*{\@memptsize}{48}} +\DeclareOption{60pt}{\renewcommand*{\@ptsize}{60}\renewcommand*{\@memptsize}{60}} + % \end{macrocode} % +% \begin{macro}{\if@nyptsizeopt} +% \begin{macro}{\@nyptsizeopttrue} +% \begin{macro}{\@nyptsizeoptfalse} +% \begin{macro}{\anyptfilebase} +% \begin{macro}{\anyptsize} +% For any point size: +% \changes{v1.61803}{2008/02/29}{Added *pt option} +% \begin{macrocode} +\newif\if@nyptsizeopt + \@nyptsizeoptfalse +\providecommand*{\anyptfilebase}{mem} +\providecommand*{\anyptsize}{10} +\DeclareOption{*pt}{\@nyptsizeopttrue} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % % \subsection{Two-side or one-side printing} % -% For two-sided printing we use the switch |\if@twoside|. In -% addition we have to set the |\if@mparswitch| to get any margin +% For two-sided printing we use the switch \cs{if@twoside}. In +% addition we have to set the \cs{if@mparswitch} to get any margin % paragraphs into the outside margin. The default is \Lopt{twoside}. % \begin{macro}{\if@twoside} % \begin{macro}{\if@mparswitch} @@ -1190,8 +1852,8 @@ % printed. For symmetry, we also define a \Lopt{final} option % which is the default. % -% The user can use the |\ifdraftdoc| flag to add additional effects: \\ -% |\ifdraftdoc <additional code> \fi| +% The user can use the \cs{ifdraftdoc} flag to add additional effects: \\ +% \verb?\ifdraftdoc <additional code> \fi? % \begin{macro}{\ifdraftdoc} % \begin{macrocode} \newif\ifdraftdoc\draftdocfalse @@ -1243,7 +1905,7 @@ % \Lpack{article} class. % \changes{v0.3}{2001/07/09}{Added article option} % \begin{macro}{\ifartopt} -% |\ifartopt| is a flag (TRUE) if the \Lopt{article} option is called. +% \cs{ifartopt} is a flag (TRUE) if the \Lopt{article} option is called. % \begin{macrocode} \newif\ifartopt \artoptfalse @@ -1254,15 +1916,15 @@ % % \subsection{The \Lopt{subfigure} option} % -% The \Lopt{subfigure} option has been made a no-op since version 1.1. +% The \Lopt{subfigure} option has been made a no-op since version 1.1 +% and finally removed in version 1.61803. It was: % \changes{v0.3}{2001/07/09}{Added subfigure option} % \changes{v1.1}{2002/03/10}{Effectively removed subfigure option} -% \begin{macrocode} -\DeclareOption{subfigure}{% - \ClassWarningNoLine{memoir}{The subfigure option is not required}} - -% \end{macrocode} -% +% \changes{v1.61803}{2008/01/30}{Removed subfigure option} +% \begin{verbatim} +% \DeclareOption{subfigure}{% +% \ClassWarningNoLine{memoir}{The subfigure option is not required}} +% \end{verbatim} % % \subsection{The openright, openleft and openany options} % @@ -1308,7 +1970,7 @@ % \subsection{Flush left math displays} % % The \Lopt{fleqn} option redefines the displayed math environments -% so that they are left adjusted with an indent of |\mathindent| +% so that they are left adjusted with an indent of \cs{mathindent} % from the current left margin. This % is implemented via an external class option file. % \begin{macrocode} @@ -1317,9 +1979,9 @@ % % \subsection{Open bibliography} % -% The \Lopt{openbib} option redefines the |thebibliography| so that each +% The \Lopt{openbib} option redefines the \verb?thebibliography? so that each % block starts on a new line, and succeeding lines in a block are -% indented by |\bibindent|. +% indented by \cs{bibindent}. % \changes{v1.0a}{2001/11/28}{Replaced \cs{AtEndOfPackage} with \cs{AtEndOfClass}} % \begin{macrocode} \DeclareOption{openbib}{% @@ -1330,18 +1992,25 @@ \listparindent \itemindent \parsep \z@ }% - \renewcommand\newblock{\par}}% -} + \renewcommand\newblock{\par}}} % \end{macrocode} % % \subsection{Old font commands} % -% The \Lopt{oldfontcommands} option enables commands like |\bf| and friends. +% The \Lopt{oldfontcommands} option enables commands like \cs{bf} and friends. % \changes{v1.0a}{2002/01/29}{Added the oldfontcommands option} % \begin{macrocode} -\DeclareOption{oldfontcommands}{% - \@memoldfonttrue} +\DeclareOption{oldfontcommands}{\@memoldfonttrue} +% \end{macrocode} +% +% \subsection{Extra font sizes} +% +% The \Lopt{extrafontsizes} options indicates that extended font sizes (above 25pt) +% are available. +% \changes{v1.61803}{2008/01/30}{Added extrafontsizes option.} +% \begin{macrocode} +\DeclareOption{extrafontsizes}{\extrafontsizestrue} % \end{macrocode} % @@ -1354,21 +2023,21 @@ \ExecuteOptions{final,letterpaper,10pt,onecolumn,openright,twoside} % \end{macrocode} % -% The |\ProcessOptions| command causes the execution of the code +% The \cs{ProcessOptions} command causes the execution of the code % for every option \Lopt{foo} % which is declared and for which the user typed % the \Lopt{foo} option in his -% |\documentclass| command. For every option \Lopt{bar} he typed, +% \cs{documentclass} command. For every option \Lopt{bar} he typed, % which is not declared, the option is assumed to be a global option. % All options will be passed as document options to any -% |\usepackage| command in the document preamble. +% \cs{usepackage} command in the document preamble. % \begin{macrocode} \ProcessOptions % \end{macrocode} % % \begin{macro}{\cleartorecto} -% A repeat of |\cleardoublepage|; clears to a recto (odd-numbered) page. +% A repeat of \cs{cleardoublepage}; clears to a recto (odd-numbered) page. % \begin{macrocode} \def\cleartorecto{\clearpage\if@twoside \ifodd\c@page\else \hbox{}\thispagestyle{cleared}% @@ -1388,7 +2057,7 @@ % \end{macro} % -% Set |\clearforchapter| according to the options. +% Set \cs{clearforchapter} according to the options. % \begin{macrocode} \if@openleft \openleft @@ -1402,14 +2071,114 @@ % \end{macrocode} % -% Now that all the options have been executed we can load the -% chosen class option file that contains all size dependent code. +% \begin{macro}{\@ivpt} +% \begin{macro}{\@xxxpt} +% \begin{macro}{\@xxxvipt} +% \begin{macro}{\@xlviiipt} +% \begin{macro}{\@lxpt} +% \begin{macro}{\@lxxiipt} +% \begin{macro}{\@lxxxivpt} +% \begin{macro}{\@xcvipt} +% \begin{macro}{\@cviiipt} +% \begin{macro}{\@cxxpt} +% \begin{macro}{\@cxxxiipt} +% \changes{v1.61803}{2008/01/30}{Added a bunch of \cs{@...pt} macros} +% \begin{macrocode} +\newcommand*{\@ivpt}{4} +\newcommand*{\@xxxpt}{30} +\newcommand*{\@xxxvipt}{36} +\newcommand*{\@xlviiipt}{48} +\newcommand*{\@lxpt}{60} +\newcommand*{\@lxxiipt}{72} +\newcommand*{\@lxxxivpt}{84} +\newcommand*{\@xcvipt}{96} +\newcommand*{\@cviiipt}{108} +\newcommand*{\@cxxpt}{120} +\newcommand*{\@cxxxiipt}{132} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% Now that all the options have been executed we can load the +% chosen class option file that contains all size dependent code. The +% larger sizes are only made available for the \Lopt{extrafontsizes} option. +% +% \begin{macro}{\memfontfamily} +% \begin{macro}{\memfontenc} +% \begin{macro}{\memfontpack} +% The default font and coding as set by the kernel is \texttt{cmr} and +% \texttt{OT1} respectively, giving Knuth's original Computer Modern Roman +% font at a set of fixed sizes (maximum of 24.88pt). If we are to have +% any size font we have to go to a scaleable font. As the Latin Modern font +% is a scaleable version of Computer Modern, and all modern LaTeX distributions +% include it, I am using this by default. +% +% By defining these three macros \emph{before} +% the \cs{documentclass} any other font and package can be used. % \begin{macrocode} -\ifnum\@ptsize = 9\relax - \input{mem\@ptsize.clo} +\providecommand*{\memfontfamily}{lmr} +\providecommand*{\memfontenc}{T1} +\providecommand*{\memfontpack}{lmodern} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% Deal with the `anyptsize' (\Lopt{*pt}) option first. In this case the macros +% \cs{anyptfilebase} and \cs{anyptsize} should have been defined by the +% author \emph{before} the \cs{documentclass} command, and a file \\ +% \verb?\anyptfilebase\anyptsize.clo? should exist (if not the file will +% default to \verb?mem10.clo?). +% \changes{v1.61803}{2008/01/30}{Extended the loading of \texttt{.clo} files.} +% \begin{macrocode} +\if@nyptsizeopt + \newcommand*{\@nyptclofile}{\anyptfilebase\anyptsize.clo} + \IfFileExists{\@nyptclofile}{\def\@memptsize{\anyptsize}}{% + \@memerror{You have used the `*pt' option but \MessageBreak + file \@nyptclofile\space can't be found}% + {I'll use mem10.clo instead} + \renewcommand*{\@nyptclofile}{mem10.clo}% + \def\@memptsize{10}% + } + \renewcommand*{\@ptsize}{\@memptsize} + \usefont{\memfontenc}{\memfontfamily}{m}{n} + \input{\@nyptclofile} + \usepackage{\memfontpack}\usepackage[\memfontenc]{fontenc} \else - \input{mem1\@ptsize.clo} +% \end{macrocode} +% Now for the fixed pt size options. +% \begin{macrocode} + \ifextrafontsizes + \usefont{\memfontenc}{\memfontfamily}{m}{n} + \input{mem\@memptsize.clo} + \usepackage{\memfontpack}\usepackage[\memfontenc]{fontenc} + \else + \ifnum\@memptsize > 17\relax + \@memerror{The `extrafontsizes' option is required to use \MessageBreak + the `\@memptsize pt' option}% + {The 17pt option will be used instead} + \input{mem17.clo} + \else + \ifnum\@ptsize = 9\relax + \input{mem\@ptsize.clo} + \else + \input{mem1\@ptsize.clo} + \fi + \fi + \fi \fi + %</class> % \end{macrocode} % @@ -1424,53 +2193,64 @@ % % \LaTeX\ offers the user commands to change the size of the font, % relative to the `main' size. Each relative size changing command -% |\size| executes the command -% |\@setfontsize||\size|\meta{font-size}\meta{baselineskip} where: +% \cs{size} executes the command +% \verb?\@setfontsize\size? \meta{font-size} \meta{baselineskip} where: % % \begin{description} % \item[\meta{font-size}] The absolute size of the font to use from % now on. % -% \item[\meta{baselineskip}] The normal value of |\baselineskip| +% \item[\meta{baselineskip}] The normal value of \cs{baselineskip} % for the size of the font selected. (The actual value will be -% |\baselinestretch| * \meta{baselineskip}.) +% \cs{baselinestretch} * \meta{baselineskip}.) % \end{description} % % A number of commands, defined in the \LaTeX\ kernel, shorten the % following definitions and are used throughout. They are listed in -% Table~\ref{tab:sh}. +% the first part of Table~\ref{tab:sh}. Those in the second part are introduced +% by the class. % % \begin{table} % \centering % \caption{Shorthand font point size commands}\label{tab:sh} -% \begin{tabular}{ll@{\qquad}ll@{\qquad}ll} -% \verb=\@vpt= & 5 & \verb=\@vipt= & 6 & \verb=\@viipt= & 7 \\ -% \verb=\@viiipt= & 8 & \verb=\@ixpt= & 9 & \verb=\@xpt= & 10 \\ -% \verb=\@xipt= & 10.95 & \verb=\@xiipt= & 12 & \verb=\@xivpt= & 14.4\\ -% \verb=\@xviipt= & 17.28 & \verb=\@xxpt= & 20.74 & \verb=\@xxvpt= & 24.88\\ +% \begin{tabular}{ll@{\qquad}ll@{\qquad}ll} \hline +% & & & & \cs{@ivpt} & 4 \\ +% \cs{@vpt} & 5 & \cs{@vipt} & 6 & \cs{@viipt} & 7 \\ +% \cs{@viiipt} & 8 & \cs{@ixpt} & 9 & \cs{@xpt} & 10 \\ +% \cs{@xipt} & 10.95 & \cs{@xiipt} & 12 & \cs{@xivpt} & 14.4\\ +% \cs{@xviipt} & 17.28 & \cs{@xxpt} & 20.74 & \cs{@xxvpt} & 24.88\\ \hline +% \cs{@xxxpt} & 30 & \cs{@xxxvipt} & 36 & \cs{@xlviiipt} & 48 \\ +% \cs{@lxpt} & 60 & \cs{@lxxiipt} & 72 & \cs{@lxxxivpt} & 84 \\ +% \cs{@xcvipt} & 96 & \cs{@cviiipt} & 108 & \cs{@cxxpt} & 120 \\ +% \cs{@cxxxiipt} & 132 \\ \hline % \end{tabular} % \end{table} % % \begin{macro}{\normalsize} % \begin{macro}{\@normalsize} % -% The user level command for the main size is |\normalsize|. -% Internally \LaTeX\ uses |\@normalsize| when it refers to the -% main size. |\@normalsize| will be defined to work like -% |\normalsize| if the latter is redefined from its default -% definition (that just issues an error message). Otherwise -% |\@normalsize| simply selects a 9pt/11pt size. +% The user level command for the main size is \cs{normalsize}. +% Internally \LaTeX\ uses \cs{@normalsize} when it refers to the +% main size. \cs{@normalsize} will be defined to work like +% \cs{normalsize} if the latter is redefined from its default +% definition (that just issues an error message). Otherwise, in the standard +% classes \cs{@normalsize} simply selects a 10pt/12pt size, but here +% it selects among the wider range. +% +% The \cs{normalsize} macro also sets new values for\\ +% \cs{abovedisplayskip}, \cs{abovedisplayshortskip} and +% \cs{belowdisplayshortskip}. % -% The |\normalsize| macro also sets new values for\\ -% |\abovedisplayskip|, |\abovedisplayshortskip| and -% |\belowdisplayshortskip|. +% For the larger sizes I have set \cs{abovedisplayskip} to the font size +% and \cs{belowdisplayshortskip} to 0.5\cs{onelineskip}. % % \begin{macrocode} -%<*9pt|10pt|11pt|12pt|14pt|17pt> +%<*9pt|10pt|11pt|12pt|14pt|17pt|20pt|25pt|30pt|36pt|48pt|60pt> % \end{macrocode} % \changes{v0.11 (mem14.clo)}{2001/10/30}{Changed baseline skip from 17.28pt to 17.5pt} +% \changes{v1.61803}{2008/01/30}{Added files mem20.clo through mem60.clo} +% \changes{v1.61803}{2008/01/30}{Changed .clo files to accomodate \cs{extrafontsizes}} % \begin{macrocode} - \renewcommand{\normalsize}{% %<*9pt> \@setfontsize\normalsize\@ixpt\@xpt @@ -1508,10 +2288,46 @@ \abovedisplayshortskip \z@ \@plus4\p@ \belowdisplayshortskip 8\p@ \@plus4\p@ \@minus3\p@ %</17pt> -% \end{macrocode} -% The |\belowdisplayskip| is always equal to the -% |\abovedisplayskip|. The parameters of the first level list are -% always given by |\@listI|. +%<*20pt> + \@setfontsize\normalsize\@xxpt{25}% + \abovedisplayskip 20\p@ \@plus5\p@ \@minus9\p@ + \abovedisplayshortskip \z@ \@plus5\p@ + \belowdisplayshortskip 12.5\p@ \@plus6\p@ \@minus3\p@ +%</20pt> +%<*25pt> + \@setfontsize\normalsize\@xxvpt{30}% + \abovedisplayskip 25\p@ \@plus6\p@ \@minus10\p@ + \abovedisplayshortskip \z@ \@plus6\p@ + \belowdisplayshortskip 15\p@ \@plus7.5\p@ \@minus4\p@ +%</25pt> +%<*30pt> + \@setfontsize\normalsize\@xxxpt{37}% + \abovedisplayskip 30\p@ \@plus7\p@ \@minus11\p@ + \abovedisplayshortskip \z@ \@plus7\p@ + \belowdisplayshortskip 18\p@ \@plus9\p@ \@minus4\p@ +%</30pt> +%<*36pt> + \@setfontsize\normalsize\@xxxvipt{45}% + \abovedisplayskip 36\p@ \@plus8\p@ \@minus12\p@ + \abovedisplayshortskip \z@ \@plus8\p@ + \belowdisplayshortskip 22\p@ \@plus11\p@ \@minus5\p@ +%</36pt> +%<*48pt> + \@setfontsize\normalsize\@xlviiipt{60}% + \abovedisplayskip 48\p@ \@plus9\p@ \@minus13\p@ + \abovedisplayshortskip \z@ \@plus9\p@ + \belowdisplayshortskip 30\p@ \@plus15\p@ \@minus7\p@ +%</48pt> +%<*60pt> + \@setfontsize\normalsize\@lxpt{72}% + \abovedisplayskip 60\p@ \@plus10\p@ \@minus14\p@ + \abovedisplayshortskip \z@ \@plus10\p@ + \belowdisplayshortskip 36\p@ \@plus18\p@ \@minus9\p@ +%</60pt> +% \end{macrocode} +% The \cs{belowdisplayskip} is always equal to the +% \cs{abovedisplayskip}. The parameters of the first level list are +% always given by \cs{@listI}. % \begin{macrocode} \belowdisplayskip \abovedisplayskip \let\@listi\@listI} @@ -1525,9 +2341,12 @@ % \end{macro} % % \begin{macro}{\small} -% This code is similar to that for |\normalsize|. +% This code is similar to that for \cs{normalsize}. % (Robert Schlicht\footnote{\texttt{w.m.l@gmx.net}, via email on 2004/03/11.} % noted that in some cases \% signs were missing after \verb?\@setfontsize?). +% +% For the larger sizes I have set \cs{topsep} to 2/3\cs{onelineskip} +% and \cs{parsep} to 1/2\cs{topsep}. % \changes{v1.61}{2004/03/12}{Added missing percent signs to some uses of % \cs{@setfontsize}} % \begin{macrocode} @@ -1604,13 +2423,73 @@ %% \itemindent\z@ }% %</17pt> +%<*20pt> + \@setfontsize\small\@xviipt{22}% + \abovedisplayskip 17\p@ \@plus4\p@ \@minus8\p@ + \abovedisplayshortskip \z@ \@plus4\p@ + \belowdisplayshortskip 11\p@ \@plus4\p@ \@minus3\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 14\p@ \@plus5\p@ \@minus7\p@ + \parsep 7\p@ \@plus2\p@ \@minus3\p@ + \itemsep \parsep}% +%</20pt> +%<*25pt> + \@setfontsize\small\@xxpt{25}% + \abovedisplayskip 20\p@ \@plus5\p@ \@minus9\p@ + \abovedisplayshortskip \z@ \@plus5\p@ + \belowdisplayshortskip 12.5\p@ \@plus6\p@ \@minus3\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 16\p@ \@plus5\p@ \@minus8\p@ + \parsep 8\p@ \@plus3\p@ \@minus4\p@ + \itemsep \parsep}% +%</25pt> +%<*30pt> + \@setfontsize\small\@xxvpt{30}% + \abovedisplayskip 25\p@ \@plus6\p@ \@minus10\p@ + \abovedisplayshortskip \z@ \@plus6\p@ + \belowdisplayshortskip 15\p@ \@plus7.5\p@ \@minus4\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 20\p@ \@plus7\p@ \@minus10\p@ + \parsep 10\p@ \@plus4\p@ \@minus5\p@ + \itemsep \parsep}% +%</30pt> +%<*36pt> + \@setfontsize\small\@xxxpt{37}% + \abovedisplayskip 30\p@ \@plus7\p@ \@minus11\p@ + \abovedisplayshortskip \z@ \@plus7\p@ + \belowdisplayshortskip 18\p@ \@plus9\p@ \@minus4\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 24\p@ \@plus8\p@ \@minus12\p@ + \parsep 12\p@ \@plus4\p@ \@minus6\p@ + \itemsep \parsep}% +%</36pt> +%<*48pt> + \@setfontsize\small\@xxxvipt{45}% + \abovedisplayskip 36\p@ \@plus8\p@ \@minus12\p@ + \abovedisplayshortskip \z@ \@plus8\p@ + \belowdisplayshortskip 22\p@ \@plus11\p@ \@minus5\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 30\p@ \@plus10\p@ \@minus15\p@ + \parsep 15\p@ \@plus5\p@ \@minus7\p@ + \itemsep \parsep}% +%</48pt> +%<*60pt> + \@setfontsize\small\@xlviiipt{60}% + \abovedisplayskip 48\p@ \@plus9\p@ \@minus13\p@ + \abovedisplayshortskip \z@ \@plus9\p@ + \belowdisplayshortskip 30\p@ \@plus15\p@ \@minus7\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 40\p@ \@plus13\p@ \@minus20\p@ + \parsep 20\p@ \@plus6\p@ \@minus10\p@ + \itemsep \parsep}% +%</60pt> \belowdisplayskip \abovedisplayskip } % \end{macrocode} % \end{macro} % % \begin{macro}{\footnotesize} -% This code is similar to that for |\normalsize|. +% This code is similar to that for \cs{small}. % \begin{macrocode} \newcommand{\footnotesize}{% %<*9pt> @@ -1685,6 +2564,66 @@ %% \itemindent\z@ }% %</17pt> +%<*20pt> + \@setfontsize\footnotesize\@xivpt{17.5}% + \abovedisplayskip 14\p@ \@plus3\p@ \@minus8\p@ + \abovedisplayshortskip \z@ \@plus3\p@ + \belowdisplayshortskip 7\p@ \@plus3.5\p@ \@minus3\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 12\p@ \@plus4\p@ \@minus6\p@ + \parsep 6\p@ \@plus2\p@ \@minus3\p@ + \itemsep \parsep}% +%</20pt> +%<*25pt> + \@setfontsize\footnotesize\@xviipt{22}% + \abovedisplayskip 17\p@ \@plus4\p@ \@minus8\p@ + \abovedisplayshortskip \z@ \@plus4\p@ + \belowdisplayshortskip 11\p@ \@plus4\p@ \@minus3\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 14\p@ \@plus5\p@ \@minus7\p@ + \parsep 7\p@ \@plus2\p@ \@minus3\p@ + \itemsep \parsep}% +%</25pt> +%<*30pt> + \@setfontsize\footnotesize\@xxpt{25}% + \abovedisplayskip 20\p@ \@plus5\p@ \@minus9\p@ + \abovedisplayshortskip \z@ \@plus5\p@ + \belowdisplayshortskip 12.5\p@ \@plus6\p@ \@minus3\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 16\p@ \@plus5\p@ \@minus8\p@ + \parsep 8\p@ \@plus3\p@ \@minus4\p@ + \itemsep \parsep}% +%</30pt> +%<*36pt> + \@setfontsize\footnotesize\@xxvpt{30}% + \abovedisplayskip 25\p@ \@plus6\p@ \@minus10\p@ + \abovedisplayshortskip \z@ \@plus6\p@ + \belowdisplayshortskip 15\p@ \@plus7.5\p@ \@minus4\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 20\p@ \@plus7\p@ \@minus10\p@ + \parsep 10\p@ \@plus4\p@ \@minus5\p@ + \itemsep \parsep}% +%</36pt> +%<*48pt> + \@setfontsize\footnotesize\@xxxpt{37}% + \abovedisplayskip 30\p@ \@plus7\p@ \@minus11\p@ + \abovedisplayshortskip \z@ \@plus7\p@ + \belowdisplayshortskip 18\p@ \@plus9\p@ \@minus4\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 24\p@ \@plus8\p@ \@minus12\p@ + \parsep 12\p@ \@plus4\p@ \@minus6\p@ + \itemsep \parsep}% +%</48pt> +%<*60pt> + \@setfontsize\footnotesize\@xxxvipt{45}% + \abovedisplayskip 36\p@ \@plus8\p@ \@minus12\p@ + \abovedisplayshortskip \z@ \@plus8\p@ + \belowdisplayshortskip 22\p@ \@plus11\p@ \@minus5\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 30\p@ \@plus10\p@ \@minus15\p@ + \parsep 15\p@ \@plus5\p@ \@minus7\p@ + \itemsep \parsep}% +%</60pt> \belowdisplayskip \abovedisplayskip } % \end{macrocode} @@ -1702,92 +2641,185 @@ % These are all much simpler than the previous macros, they just % select a new fontsize, but leave the parameters for displays and % lists alone. The class provides two additional sizes, \cs{miniscule} -% and \cs{HUGE}, with respect to the usual set. +% and \cs{HUGE}, with respect to the usual set. For the larger sizes (e.g., +% 72pt and above) I have +% made the \cs{baselineskip} approximately 20 precent larger than the pt size. % \changes{v1.2}{2002/07/27}{Added \cs{miniscule} and \cs{HUGE} font sizes} % \changes{v1.2}{2002/07/27}{Twiddled some font sizes to get regular steps} % \changes{v1.2a}{2002/08/27}{Fixed 12pt scriptsize bug} % \begin{macrocode} %<*9pt> -\newcommand{\miniscule}{\@setfontsize\miniscule\@vpt{6}} -\newcommand{\tiny}{\@setfontsize\tiny\@vpt{6}} -\newcommand{\scriptsize}{\@setfontsize\scriptsize\@vipt{7}} -\newcommand{\large}{\@setfontsize\large\@xpt{12}} -\newcommand{\Large}{\@setfontsize\Large\@xipt{13.6}} -\newcommand{\LARGE}{\@setfontsize\LARGE\@xiipt{14.5}} -\newcommand{\huge}{\@setfontsize\huge\@xivpt{18}} -\newcommand{\Huge}{\@setfontsize\Huge\@xviipt{22}} -\newcommand{\HUGE}{\@setfontsize\HUGE\@xxpt{25}} +\ifextrafontsizes + \newcommand*{\miniscule}{\@setfontsize\miniscule\@ivpt{5}} +\else + \newcommand*{\miniscule}{\@setfontsize\miniscule\@vpt{6}} +\fi +\newcommand*{\tiny}{\@setfontsize\tiny\@vpt{6}} +\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@vipt{7}} +\newcommand*{\large}{\@setfontsize\large\@xpt{12}} +\newcommand*{\Large}{\@setfontsize\Large\@xipt{13.6}} +\newcommand*{\LARGE}{\@setfontsize\LARGE\@xiipt{14.5}} +\newcommand*{\huge}{\@setfontsize\huge\@xivpt{18}} +\newcommand*{\Huge}{\@setfontsize\Huge\@xviipt{22}} +\newcommand*{\HUGE}{\@setfontsize\HUGE\@xxpt{25}} %</9pt> %<*10pt> -\newcommand{\miniscule}{\@setfontsize\miniscule\@vpt{6}} -\newcommand{\tiny}{\@setfontsize\tiny\@vipt{7}} -\newcommand{\scriptsize}{\@setfontsize\scriptsize\@viipt{8}} -\newcommand{\large}{\@setfontsize\large\@xipt{13.6}} -\newcommand{\Large}{\@setfontsize\Large\@xiipt{14.5}} -\newcommand{\LARGE}{\@setfontsize\LARGE\@xivpt{18}} -\newcommand{\huge}{\@setfontsize\huge\@xviipt{22}} -\newcommand{\Huge}{\@setfontsize\Huge\@xxpt{25}} -\newcommand{\HUGE}{\@setfontsize\HUGE\@xxvpt{30}} +\newcommand*{\miniscule}{\@setfontsize\miniscule\@vpt{6}} +\newcommand*{\tiny}{\@setfontsize\tiny\@vipt{7}} +\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@viipt{8}} +\newcommand*{\large}{\@setfontsize\large\@xipt{13.6}} +\newcommand*{\Large}{\@setfontsize\Large\@xiipt{14.5}} +\newcommand*{\LARGE}{\@setfontsize\LARGE\@xivpt{18}} +\newcommand*{\huge}{\@setfontsize\huge\@xviipt{22}} +\newcommand*{\Huge}{\@setfontsize\Huge\@xxpt{25}} +\newcommand*{\HUGE}{\@setfontsize\HUGE\@xxvpt{30}} %</10pt> %<*11pt> -\newcommand{\miniscule}{\@setfontsize\miniscule\@vipt{7}} -\newcommand{\tiny}{\@setfontsize\tiny\@viipt{8}} -\newcommand{\scriptsize}{\@setfontsize\scriptsize\@viiipt{9.5}} -\newcommand{\large}{\@setfontsize\large\@xiipt{14.5}} -\newcommand{\Large}{\@setfontsize\Large\@xivpt{18}} -\newcommand{\LARGE}{\@setfontsize\LARGE\@xviipt{22}} -\newcommand{\huge}{\@setfontsize\huge\@xxpt{25}} -\newcommand{\Huge}{\@setfontsize\Huge\@xxvpt{30}} -\let\HUGE=\Huge +\newcommand*{\miniscule}{\@setfontsize\miniscule\@vipt{7}} +\newcommand*{\tiny}{\@setfontsize\tiny\@viipt{8}} +\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@viiipt{9.5}} +\newcommand*{\large}{\@setfontsize\large\@xiipt{14.5}} +\newcommand*{\Large}{\@setfontsize\Large\@xivpt{18}} +\newcommand*{\LARGE}{\@setfontsize\LARGE\@xviipt{22}} +\newcommand*{\huge}{\@setfontsize\huge\@xxpt{25}} +\newcommand*{\Huge}{\@setfontsize\Huge\@xxvpt{30}} +\ifextrafontsizes + \newcommand*{\HUGE}{\@setfontsize\HUGE\@xxxpt{37}} +\else + \let\HUGE=\Huge +\fi %</11pt> %<*12pt> -\newcommand{\miniscule}{\@setfontsize\miniscule\@viipt{8}} -\newcommand{\tiny}{\@setfontsize\tiny\@viiipt{9.5}} -\newcommand{\scriptsize}{\@setfontsize\scriptsize\@ixpt\@xpt} -\newcommand{\large}{\@setfontsize\large\@xivpt{18}} -\newcommand{\Large}{\@setfontsize\Large\@xviipt{22}} -\newcommand{\LARGE}{\@setfontsize\LARGE\@xxpt{25}} -\newcommand{\huge}{\@setfontsize\huge\@xxvpt{30}} -\let\Huge=\huge -\let\HUGE=\huge +\newcommand*{\miniscule}{\@setfontsize\miniscule\@viipt{8}} +\newcommand*{\tiny}{\@setfontsize\tiny\@viiipt{9.5}} +\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@ixpt\@xpt} +\newcommand*{\large}{\@setfontsize\large\@xivpt{18}} +\newcommand*{\Large}{\@setfontsize\Large\@xviipt{22}} +\newcommand*{\LARGE}{\@setfontsize\LARGE\@xxpt{25}} +\newcommand*{\huge}{\@setfontsize\huge\@xxvpt{30}} +\ifextrafontsizes + \newcommand*{\Huge}{\@setfontsize\Huge\@xxxpt{37}} + \newcommand*{\HUGE}{\@setfontsize\HUGE\@xxxvipt{45}} +\else + \let\Huge=\huge + \let\HUGE=\huge +\fi %</12pt> %<*14pt> -\newcommand{\miniscule}{\@setfontsize\miniscule\@viiipt{9.5}} -\newcommand{\tiny}{\@setfontsize\tiny\@ixpt{10}} -\newcommand{\scriptsize}{\@setfontsize\scriptsize\@xpt{12}} -\newcommand{\large}{\@setfontsize\large\@xviipt{22}} -\newcommand{\Large}{\@setfontsize\Large\@xxpt{25}} -\newcommand{\LARGE}{\@setfontsize\LARGE\@xxvpt{30}} -\let\huge=\LARGE -\let\Huge=\LARGE -\let\HUGE=\LARGE +\newcommand*{\miniscule}{\@setfontsize\miniscule\@viiipt{9.5}} +\newcommand*{\tiny}{\@setfontsize\tiny\@ixpt{10}} +\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xpt{12}} +\newcommand*{\large}{\@setfontsize\large\@xviipt{22}} +\newcommand*{\Large}{\@setfontsize\Large\@xxpt{25}} +\newcommand*{\LARGE}{\@setfontsize\LARGE\@xxvpt{30}} +\ifextrafontsizes + \newcommand*{\huge}{\@setfontsize\Huge\@xxxpt{37}} + \newcommand*{\Huge}{\@setfontsize\Huge\@xxxvipt{45}} + \newcommand*{\HUGE}{\@setfontsize\HUGE\@xlviiipt{60}} +\else + \let\huge=\LARGE + \let\Huge=\LARGE + \let\HUGE=\LARGE +\fi %</14pt> %<*17pt> -\newcommand{\miniscule}{\@setfontsize\miniscule\@ixpt{10}} -\newcommand{\tiny}{\@setfontsize\tiny\@xpt{12}} -\newcommand{\scriptsize}{\@setfontsize\scriptsize\@xipt{13.6}} -\newcommand{\large}{\@setfontsize\large\@xxpt{25}} -\newcommand{\Large}{\@setfontsize\Large\@xxvpt{30}} -\newcommand{\LARGE}{\@setfontsize\LARGE\@xxvpt{30}} -\let\LARGE=\Large -\let\huge=\Large -\let\Huge=\Large -\let\HUGE=\Large +\newcommand*{\miniscule}{\@setfontsize\miniscule\@ixpt{10}} +\newcommand*{\tiny}{\@setfontsize\tiny\@xpt{12}} +\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xipt{13.6}} +\newcommand*{\large}{\@setfontsize\large\@xxpt{25}} +\newcommand*{\Large}{\@setfontsize\Large\@xxvpt{30}} +\ifextrafontsizes + \newcommand*{\LARGE}{\@setfontsize\LARGE\@xxxpt{37}} + \newcommand*{\huge}{\@setfontsize\huge\@xxxvipt{45}} + \newcommand*{\Huge}{\@setfontsize\Huge\@xlviiipt{60}} + \newcommand*{\HUGE}{\@setfontsize\HUGE\@lxpt{72}} +\else + \let\LARGE=\Large + \let\huge=\Large + \let\Huge=\Large + \let\HUGE=\Large +\fi %</17pt> -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% -% \begin{macrocode} -%</9pt|10pt|11pt|12pt|14pt|17pt> +%<*20pt> +\newcommand*{\miniscule}{\@setfontsize\miniscule\@xpt{12}} +\newcommand*{\tiny}{\@setfontsize\tiny\@xipt{13.6}} +\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xiipt{14.5}} +\newcommand*{\large}{\@setfontsize\large\@xxvpt{30}} +\newcommand*{\Large}{\@setfontsize\Large\@xxxpt{37}} +\newcommand*{\LARGE}{\@setfontsize\LARGE\@xxxvipt{45}} +\newcommand*{\huge}{\@setfontsize\huge\@xlviiipt{60}} +\newcommand*{\Huge}{\@setfontsize\Huge\@lxpt{72}} +\newcommand*{\HUGE}{\@setfontsize\HUGE\@lxxiipt{86}} +%</20pt> +%<*25pt> +\newcommand*{\miniscule}{\@setfontsize\miniscule\@xipt{13.6}} +\newcommand*{\tiny}{\@setfontsize\tiny\@xiipt{14.5}} +\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xivpt{17.5}} +\newcommand*{\large}{\@setfontsize\large\@xxxpt{37}} +\newcommand*{\Large}{\@setfontsize\Large\@xxxvipt{45}} +\newcommand*{\LARGE}{\@setfontsize\LARGE\@xlviiipt{60}} +\newcommand*{\huge}{\@setfontsize\huge\@lxpt{72}} +\newcommand*{\Huge}{\@setfontsize\Huge\@lxxiipt{86}} +\newcommand*{\HUGE}{\@setfontsize\HUGE\@lxxxivpt{100}} +%</25pt> +%<*30pt> +\newcommand*{\miniscule}{\@setfontsize\miniscule\@xiipt{14.5}} +\newcommand*{\tiny}{\@setfontsize\tiny\@xivpt{17.5}} +\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xviipt{22}} +\newcommand*{\large}{\@setfontsize\large\@xxxvipt{45}} +\newcommand*{\Large}{\@setfontsize\Large\@xlviiipt{60}} +\newcommand*{\LARGE}{\@setfontsize\LARGE\@lxpt{72}} +\newcommand*{\huge}{\@setfontsize\huge\@lxxiipt{86}} +\newcommand*{\Huge}{\@setfontsize\Huge\@lxxxivpt{100}} +\newcommand*{\HUGE}{\@setfontsize\HUGE\@xcvipt{116}} +%</30pt> +%<*36pt> +\newcommand*{\miniscule}{\@setfontsize\miniscule\@xivpt{17.5}} +\newcommand*{\tiny}{\@setfontsize\tiny\@xviipt{22}} +\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xxpt{25}} +\newcommand*{\large}{\@setfontsize\large\@xlviiipt{60}} +\newcommand*{\Large}{\@setfontsize\Large\@lxpt{72}} +\newcommand*{\LARGE}{\@setfontsize\LARGE\@lxxiipt{86}} +\newcommand*{\huge}{\@setfontsize\huge\@lxxxivpt{100}} +\newcommand*{\Huge}{\@setfontsize\Huge\@xcvipt{116}} +\newcommand*{\HUGE}{\@setfontsize\HUGE\@cviiipt{132}} +%</36pt> +%<*48pt> +\newcommand*{\miniscule}{\@setfontsize\miniscule\@xviipt{22}} +\newcommand*{\tiny}{\@setfontsize\tiny\@xxpt{25}} +\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xxvpt{30}} +\newcommand*{\large}{\@setfontsize\large\@lxpt{72}} +\newcommand*{\Large}{\@setfontsize\Large\@lxxiipt{86}} +\newcommand*{\LARGE}{\@setfontsize\LARGE\@lxxxivpt{100}} +\newcommand*{\huge}{\@setfontsize\huge\@xcvipt{116}} +\newcommand*{\Huge}{\@setfontsize\Huge\@cviiipt{132}} +\newcommand*{\HUGE}{\@setfontsize\HUGE\@cxxpt{144}} +%</48pt> +%<*60pt> +\newcommand*{\miniscule}{\@setfontsize\miniscule\@xxpt{25}} +\newcommand*{\tiny}{\@setfontsize\tiny\@xxvpt{30}} +\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xxxpt{37}} +\newcommand*{\large}{\@setfontsize\large\@lxxiipt{86}} +\newcommand*{\Large}{\@setfontsize\Large\@lxxxivpt{100}} +\newcommand*{\LARGE}{\@setfontsize\LARGE\@xcvipt{116}} +\newcommand*{\huge}{\@setfontsize\huge\@cviiipt{132}} +\newcommand*{\Huge}{\@setfontsize\Huge\@cxxpt{144}} +\newcommand*{\HUGE}{\@setfontsize\HUGE\@cxxxiipt{162}} +%</60pt> +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macrocode} +%</9pt|10pt|11pt|12pt|14pt|17pt|20pt|25pt|30pt|36pt|48pt|60pt> %<*class> % \end{macrocode} % @@ -1812,7 +2844,7 @@ % \end{macro} % % \begin{macro}{\baselinestretch} -% This is used as a multiplier for |\baselineskip|. The default is +% This is used as a multiplier for \cs{baselineskip}. The default is % to \emph{not} stretch the baselines. % \begin{macrocode} \renewcommand{\baselinestretch}{} @@ -1823,29 +2855,35 @@ % \begin{macro}{\parskip} % \begin{macro}{\onelineskip} % -% |\parskip| is additional vertical space between paragraphs; default +% \cs{parskip} is additional vertical space between paragraphs; default % is zero. % % -% |\onelineskip| is the default space between baselines. +% \cs{onelineskip} is the default space between baselines. % \changes{v0.11 (mem14.clo)}{2001/10/30}{Changed \cs{onelineskip} from 17.28pt to 17.5pt} % \begin{macrocode} \setlength\parskip{0\p@ \@plus \p@} %</class> -%<*9pt|10pt|11pt|12pt|14pt|17pt> +%<*9pt|10pt|11pt|12pt|14pt|17pt|20pt|25pt|30pt|36pt|48pt|60pt> %<9pt>\setlength{\onelineskip}{\@xpt\p@} %<10pt>\setlength{\onelineskip}{\@xiipt\p@} %<11pt>\setlength{\onelineskip}{13.6\p@} %<12pt>\setlength{\onelineskip}{14.5\p@} %<14pt>\setlength{\onelineskip}{17.5\p@} %<17pt>\setlength{\onelineskip}{22\p@} +%<20pt>\setlength{\onelineskip}{25\p@} +%<25pt>\setlength{\onelineskip}{30\p@} +%<30pt>\setlength{\onelineskip}{37\p@} +%<36pt>\setlength{\onelineskip}{45\p@} +%<48pt>\setlength{\onelineskip}{60\p@} +%<60pt>\setlength{\onelineskip}{72\p@} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\parindent} -% |\parskip| gives extra vertical space between paragraphs and -% |\parindent| is the width of the paragraph indentation. +% \cs{parskip} gives extra vertical space between paragraphs and +% \cs{parindent} is the width of the paragraph indentation. % \begin{macrocode} \if@twocolumn \setlength\parindent{1em} @@ -1856,7 +2894,14 @@ %<12pt> \setlength\parindent{1.5em} %<14pt> \setlength\parindent{1.5em} %<17pt> \setlength\parindent{1.5em} +%<20pt> \setlength\parindent{1.5em} +%<25pt> \setlength\parindent{1.5em} +%<30pt> \setlength\parindent{1.5em} +%<36pt> \setlength\parindent{1.5em} +%<48pt> \setlength\parindent{1.5em} +%<60pt> \setlength\parindent{1.5em} \fi +%</9pt|10pt|11pt|12pt|14pt|17pt|20pt|25pt|30pt|36pt|48pt|60pt> % \end{macrocode} % \end{macro} % @@ -1864,12 +2909,54 @@ % \begin{macro}{\medskipamount} % \begin{macro}{\bigskipamount} % The values for these three parameters are set in the LaTeX kernel. -% Historically they have been size invariant. +% Historically they have been size invariant, but I have changed them for +% the larger sizes (\cs{smallskipamount} is 1/4 the fontsize, and the others +% each double up on the next lower). +% \changes{v1.61803}{2008/01/30}{(small/med/big)skips not invraiant for larger font sizes.} +% \changes{v1.61803}{2008/01/30}{Changed (small/med/big)skips for 17pt} % \begin{macrocode} +%<*9pt|10pt|11pt|12pt|14pt> \setlength\smallskipamount{3\p@ \@plus 1\p@ \@minus 1\p@} \setlength\medskipamount{6\p@ \@plus 2\p@ \@minus 2\p@} \setlength\bigskipamount{12\p@ \@plus 4\p@ \@minus 4\p@} -%</9pt|10pt|11pt|12pt|14pt|17pt> +%</9pt|10pt|11pt|12pt|14pt> +%<*17pt|20pt|25pt|30pt|36pt|48pt|60pt> +%<*17pt> +\setlength\smallskipamount{4\p@ \@plus1\p@ \@minus1\p@} +\setlength\medskipamount{8\p@ \@plus2\p@ \@minus2\p@} +\setlength\bigskipamount{17\p@ \@plus4\p@ \@minus4\p@} +%</17pt> +%<*20pt> +\setlength\smallskipamount{5\p@ \@plus1\p@ \@minus1\p@} +\setlength\medskipamount{10\p@ \@plus2\p@ \@minus2\p@} +\setlength\bigskipamount{20\p@ \@plus4\p@ \@minus4\p@} +%</20pt> +%<*25pt> +\setlength\smallskipamount{6\p@ \@plus1\p@ \@minus1\p@} +\setlength\medskipamount{12\p@ \@plus2\p@ \@minus2\p@} +\setlength\bigskipamount{24\p@ \@plus4\p@ \@minus4\p@} +%</25pt> +%<*30pt> +\setlength\smallskipamount{5\p@ \@plus1\p@ \@minus1\p@} +\setlength\medskipamount{10\p@ \@plus2\p@ \@minus2\p@} +\setlength\bigskipamount{20\p@ \@plus4\p@ \@minus4\p@} +%</30pt> +%<*36pt> +\setlength\smallskipamount{9\p@ \@plus2\p@ \@minus2\p@} +\setlength\medskipamount{18\p@ \@plus4\p@ \@minus4\p@} +\setlength\bigskipamount{36\p@ \@plus8\p@ \@minus8\p@} +%</36pt> +%<*48pt> +\setlength\smallskipamount{12\p@ \@plus3\p@ \@minus3\p@} +\setlength\medskipamount{24\p@ \@plus6\p@ \@minus6\p@} +\setlength\bigskipamount{48\p@ \@plus12\p@ \@minus12\p@} +%</48pt> +%<*60pt> +\setlength\smallskipamount{15\p@ \@plus4\p@ \@minus4\p@} +\setlength\medskipamount{30\p@ \@plus8\p@ \@minus8\p@} +\setlength\bigskipamount{60\p@ \@plus16\p@ \@minus16\p@} +%</60pt> +%</17pt|20pt|25pt|30pt|36pt|48pt|60pt> % \end{macrocode} % \end{macro} % \end{macro} @@ -1879,9 +2966,9 @@ % \begin{macro}{\@lowpenalty} % \begin{macro}{\@medpenalty} % \begin{macro}{\@highpenalty}% -% The commands |\nopagebreak| and |\nolinebreak| put in penalties +% The commands \cs{nopagebreak} and \cs{nolinebreak} put in penalties % to discourage these breaks at the point they are put in. -% They use |\@lowpenalty|, |\@medpenalty| or |\@highpenalty|, +% They use \cs{@lowpenalty}, \cs{@medpenalty} or \cs{@highpenalty}, % dependent on their argument. % \begin{macrocode} %<*class> @@ -1944,26 +3031,27 @@ % \begin{macro}{\headsep} % \begin{macro}{\topskip} % \begin{macro}{\footskip} -% The |\headheight| is the height of the box that will contain the -% running head. In this class it is point size dependent (normally it -% is a constant 12pt). +% The \cs{headheight} is the height of the box that will contain the +% running head. In this class it is point size dependent --- +% \cs{onelineskip} (normally it is a constant 12pt). % -% The |\headsep| is the distance between the bottom -% of the running head and the top of the text. +% The \cs{headsep} is the distance between the bottom +% of the running head and the top of the text. For the larger sizes +% this is 1.8 times the fontsize. % -% The |\topskip| is the -% |\baselineskip| for the first line on a page; +% The \cs{topskip} is the \cs{baselineskip} for the first line on a page; % \LaTeX's output routine will not work properly if it has the -% value 0pt, so do not do that! +% value 0pt, so do not do that! For the lareger sizes this is the font size. % % The distance from the baseline of the box which contains the % running footer to the baseline of last line of text is controlled -% by the |\footskip|. +% by the \cs{footskip}. For the larger sizes this is 2.5 times the +% font size. % \changes{v0.11 (mem14.clo)}{2001/10/30}{Changed \cs{headheight} from 16pt to 17.5pt} % \changes{v0.11 (mem11.clo)}{2002/03/10}{Changed \cs{headheight} from 13pt to 13.6pt} % \begin{macrocode} %</class> -%<*9pt|10pt|11pt|12pt|14pt|17pt> +%<*9pt|10pt|11pt|12pt|14pt|17pt|20pt|25pt|30pt|36pt|48pt|60pt> %<*9pt> \setlength\headheight{11\p@} \setlength\headsep{.225in} @@ -2000,6 +3088,42 @@ \setlength\topskip{14.4\p@} \setlength\footskip{.4in} %</17pt> +%<*20pt> +\setlength\headheight{25\p@} +\setlength\headsep{36\p@} +\setlength\topskip{20\p@} +\setlength\footskip{50\p@} +%</20pt> +%<*25pt> +\setlength\headheight{30\p@} +\setlength\headsep{45\p@} +\setlength\topskip{25\p@} +\setlength\footskip{62\p@} +%</25pt> +%<*30pt> +\setlength\headheight{37\p@} +\setlength\headsep{54\p@} +\setlength\topskip{30\p@} +\setlength\footskip{75\p@} +%</30pt> +%<*36pt> +\setlength\headheight{45\p@} +\setlength\headsep{65\p@} +\setlength\topskip{36\p@} +\setlength\footskip{90\p@} +%</36pt> +%<*48pt> +\setlength\headheight{60\p@} +\setlength\headsep{86\p@} +\setlength\topskip{48\p@} +\setlength\footskip{120\p@} +%</48pt> +%<*60pt> +\setlength\headheight{72\p@} +\setlength\headsep{108\p@} +\setlength\topskip{60\p@} +\setlength\footskip{150\p@} +%</60pt> % \end{macrocode} % \end{macro} % \end{macro} @@ -2008,15 +3132,15 @@ % % \begin{macro}{\maxdepth} % \begin{macro}{\@maxdepth} -% The \TeX\ primitive register |\maxdepth| has a function that is -% similar to that of |\topskip|. The register |\@maxdepth| should -% always contain a copy of |\maxdepth|. In both plain \TeX\ and -% \LaTeX~2.09 |\maxdepth| had a fixed value of \texttt{4pt}; in +% The \TeX\ primitive register \cs{maxdepth} has a function that is +% similar to that of \cs{topskip}. The register \cs{@maxdepth} should +% always contain a copy of \cs{maxdepth}. In both plain \TeX\ and +% \LaTeX~2.09 \cs{maxdepth} had a fixed value of \texttt{4pt}; in % native \LaTeX 2e mode we let the value depend on the typesize. We -% set it so that |\maxdepth| $+$ |\topskip| $=$ typesize $\times -% 1.5$. As it happens, in these classes |\topskip| is equal to the -% typesize, therefor we set |\maxdepth| to half the value of -% |\topskip|. +% set it so that \cs{maxdepth} $+$ \cs{topskip} $=$ typesize $\times +% 1.5$. As it happens, in these classes \cs{topskip} is equal to the +% typesize, therefor we set \cs{maxdepth} to half the value of +% \cs{topskip}. % \begin{macrocode} \setlength\maxdepth{.5\topskip} \setlength\@maxdepth\maxdepth @@ -2029,21 +3153,28 @@ % \subsection{Footnotes} % % \begin{macro}{\footnotesep} -% |\footnotesep| is the height of the strut placed at the beginning -% of every footnote. It equals the height of a normal |\footnotesize| -% strut, so no extra space appears between footnotes +% \cs{footnotesep} is the height of the strut placed at the beginning +% of every footnote. It equals the height of a normal \cs{footnotesize} +% strut, so no extra space appears between footnotes. +% \changes{v1.61803}{2007/01/30}{Changed nearly all \cs{footnotesep}} % \begin{macrocode} -%<9pt>\setlength\footnotesep{6.0\p@} %% ???????? +%<9pt>\setlength\footnotesep{5.6\p@} %<10pt>\setlength\footnotesep{6.65\p@} %<11pt>\setlength\footnotesep{7.7\p@} %<12pt>\setlength\footnotesep{8.4\p@} -%<14pt>\setlength\footnotesep{10.0\p@} %% ???????? -%<17pt>\setlength\footnotesep{12\p@} %% ???????? +%<14pt>\setlength\footnotesep{9.5\p@} +%<17pt>\setlength\footnotesep{10.15\p@} +%<20pt>\setlength\footnotesep{12.6\p@} +%<25pt>\setlength\footnotesep{15.4\p@} +%<30pt>\setlength\footnotesep{17.5\p@} +%<36pt>\setlength\footnotesep{21\p@} +%<48pt>\setlength\footnotesep{25.9\p@} +%<60pt>\setlength\footnotesep{31.5\p@} % \end{macrocode} % \end{macro} % % \begin{macro}{\footins} -% |\skip\footins| is the space between the last line of the main +% \verb?\skip\footins? is the space between the last line of the main % text and the top of the first footnote. % \begin{macrocode} %<9pt>\setlength{\skip\footins}{8\p@ \@plus 2\p@ \@minus 2\p@} @@ -2051,7 +3182,13 @@ %<11pt>\setlength{\skip\footins}{10\p@ \@plus 4\p@ \@minus 2\p@} %<12pt>\setlength{\skip\footins}{10.8\p@ \@plus 4\p@ \@minus 2\p@} %<14pt>\setlength{\skip\footins}{13\p@ \@plus 4\p@ \@minus 2\p@} -%<17pt>\setlength{\skip\footins}{14\p@ \@plus 5\p@ \@minus 3\p@} +%<17pt>\setlength{\skip\footins}{16\p@ \@plus 5\p@ \@minus 3\p@} +%<20pt>\setlength{\skip\footins}{19\p@ \@plus 7\p@ \@minus 3\p@} +%<25pt>\setlength{\skip\footins}{24\p@ \@plus 8\p@ \@minus 4\p@} +%<30pt>\setlength{\skip\footins}{29\p@ \@plus 10\p@ \@minus 5\p@} +%<36pt>\setlength{\skip\footins}{35\p@ \@plus 12\p@ \@minus 6\p@} +%<48pt>\setlength{\skip\footins}{47\p@ \@plus 16\p@ \@minus 8\p@} +%<60pt>\setlength{\skip\footins}{59\p@ \@plus 20\p@ \@minus 10\p@} % \end{macrocode} % \end{macro} % @@ -2067,13 +3204,15 @@ % objects on the page. These parameters are used for both % one-column mode and single-column floats in two-column mode. % -% |\floatsep| is the space between adjacent floats that are moved -% to the top or bottom of the text page. +% \cs{floatsep} is the space between adjacent floats that are moved +% to the top or bottom of the text page. For the larger sizes this is +% \cs{bigskip}. % -% |\textfloatsep| is the space between the main text and floats -% at the top or bottom of the page. +% \cs{textfloatsep} is the space between the main text and floats +% at the top or bottom of the page. For the larger sizes this is +% 1.45\cs{onelineskip}. % -% |\intextsep| is the space between in-text floats and the text. +% \cs{intextsep} is the space between in-text floats and the text. % \begin{macrocode} %<*9pt> \setlength\floatsep {12\p@ \@plus 2\p@ \@minus 2\p@} @@ -2102,9 +3241,39 @@ %</14pt> %<*17pt> \setlength\floatsep {15\p@ \@plus 4\p@ \@minus 4\p@} -\setlength\textfloatsep{25\p@ \@plus 5\p@ \@minus 5\p@} -\setlength\intextsep {16\p@ \@plus 5\p@ \@minus 5\p@} +\setlength\textfloatsep{25\p@ \@plus 4\p@ \@minus 5\p@} +\intextsep \floatsep %</17pt> +%<*20pt> +\setlength\floatsep {20\p@ \@plus 4\p@ \@minus 4\p@} +\setlength\textfloatsep{36\p@ \@plus 4\p@ \@minus 8\p@} +\intextsep \floatsep +%</20pt> +%<*25pt> +\setlength\floatsep {24\p@ \@plus 4\p@ \@minus 4\p@} +\setlength\textfloatsep{43\p@ \@plus 4\p@ \@minus 8\p@} +\intextsep \floatsep +%</25pt> +%<*30pt> +\setlength\floatsep {30\p@ \@plus 6\p@ \@minus 6\p@} +\setlength\textfloatsep{54\p@ \@plus 6\p@ \@minus 12\p@} +\intextsep \floatsep +%</30pt> +%<*36pt> +\setlength\floatsep {36\p@ \@plus 8\p@ \@minus 8\p@} +\setlength\textfloatsep{65\p@ \@plus 8\p@ \@minus 16\p@} +\intextsep \floatsep +%</36pt> +%<*48pt> +\setlength\floatsep {48\p@ \@plus 12\p@ \@minus 12\p@} +\setlength\textfloatsep{87\p@ \@plus 12\p@ \@minus 24\p@} +\intextsep \floatsep +%</48pt> +%<*60pt> +\setlength\floatsep {60\p@ \@plus 16\p@ \@minus 16\p@} +\setlength\textfloatsep{104\p@ \@plus 16\p@ \@minus 32\p@} +\intextsep \floatsep +%</60pt> % \end{macrocode} % \end{macro} % \end{macro} @@ -2112,15 +3281,15 @@ % % \begin{macro}{\dblfloatsep} % \begin{macro}{\dbltextfloatsep} -% When floating objects that span the whole |\textwidth| are placed +% When floating objects that span the whole \cs{textwidth} are placed % on a text page and \LaTeX{} is in twocolumn mode the separation -% between the float and the text is controlled by |\dblfloatsep| -% and |\dbltextfloatsep|. +% between the float and the text is controlled by \cs{dblfloatsep} +% and \cs{dbltextfloatsep}. % -% |\dblfloatsep| is the space between adjacent floats that are moved +% \cs{dblfloatsep} is the space between adjacent floats that are moved % to the top or bottom of the text page. % -% |\dbltextfloatsep| is the space between the main text and floats +% \cs{dbltextfloatsep} is the space between the main text and floats % at the top or bottom of the page. % % \begin{macrocode} @@ -2148,6 +3317,30 @@ \setlength\dblfloatsep {15\p@ \@plus 4\p@ \@minus 4\p@} \setlength\dbltextfloatsep{25\p@ \@plus 5\p@ \@minus 5\p@} %</17pt> +%<*20pt> +\dblfloatsep \floatsep +\dbltextfloatsep \textfloatsep +%</20pt> +%<*25pt> +\dblfloatsep \floatsep +\dbltextfloatsep \textfloatsep +%</25pt> +%<*30pt> +\dblfloatsep \floatsep +\dbltextfloatsep \textfloatsep +%</30pt> +%<*36pt> +\dblfloatsep \floatsep +\dbltextfloatsep \textfloatsep +%</36pt> +%<*48pt> +\dblfloatsep \floatsep +\dbltextfloatsep \textfloatsep +%</48pt> +%<*60pt> +\dblfloatsep \floatsep +\dbltextfloatsep \textfloatsep +%</60pt> % \end{macrocode} % \end{macro} % \end{macro} @@ -2159,16 +3352,17 @@ % \begin{macro}{\@fpbot} % When floating objects are placed on separate pages the layout of % such pages is controlled by these parameters. At the top of the -% page |\@fptop| amount of stretchable whitespace is inserted, at -% the bottom of the page we get an |\@fpbot| amount of stretchable -% whitespace. Between adjacent floats the |\@fpsep| is inserted. +% page \cs{@fptop} amount of stretchable whitespace is inserted, at +% the bottom of the page we get an \cs{@fpbot} amount of stretchable +% whitespace. Between adjacent floats the \cs{@fpsep} is inserted. +% For the larger sizes \cs{@fpsep} is .7\cs{onelineskip}. % % These parameters are used for the placement of floating objects % in one column mode, or in single column floats in two column % mode. % -% Note that at least one of the two parameters |\@fptop| and -% |\@fpbot| should contain a |plus ...fil| to allow filling the +% Note that at least one of the two parameters \cs{@fptop} and +% \cs{@fpbot} should contain a \verb?plus ...fil? to allow filling the % remaining empty space. % \begin{macrocode} %<*9pt> @@ -2201,6 +3395,36 @@ \setlength\@fpsep{12\p@ \@plus 2fil} \setlength\@fpbot{0\p@ \@plus 1fil} %</17pt> +%<*20pt> +\setlength\@fptop{0\p@ \@plus 1fil} +\setlength\@fpsep{17\p@ \@plus 2fil} +\@fpbot \@fptop +%</20pt> +%<*25pt> +\setlength\@fptop{0\p@ \@plus 1fil} +\setlength\@fpsep{21\p@ \@plus 2fil} +\@fpbot \@fptop +%</25pt> +%<*30pt> +\setlength\@fptop{0\p@ \@plus 1fil} +\setlength\@fpsep{26\p@ \@plus 2fil} +\@fpbot \@fptop +%</30pt> +%<*36pt> +\setlength\@fptop{0\p@ \@plus 1fil} +\setlength\@fpsep{31\p@ \@plus 2fil} +\@fpbot \@fptop +%</36pt> +%<*48pt> +\setlength\@fptop{0\p@ \@plus 1fil} +\setlength\@fpsep{42\p@ \@plus 2fil} +\@fpbot \@fptop +%</48pt> +%<*60pt> +\setlength\@fptop{0\p@ \@plus 1fil} +\setlength\@fpsep{50\p@ \@plus 2fil} +\@fpbot \@fptop +%</60pt> % \end{macrocode} % \end{macro} % \end{macro} @@ -2242,6 +3466,36 @@ \setlength\@dblfpsep{12\p@ \@plus 2fil} \setlength\@dblfpbot{0\p@ \@plus 1fil} %</17pt> +%<*20pt> +\@dblfptop \@fptop +\@dblfpsep \@fpsep +\@dblfpbot \@dblfptop +%</20pt> +%<*25pt> +\@dblfptop \@fptop +\@dblfpsep \@fpsep +\@dblfpbot \@dblfptop +%</25pt> +%<*30pt> +\@dblfptop \@fptop +\@dblfpsep \@fpsep +\@dblfpbot \@dblfptop +%</30pt> +%<*36pt> +\@dblfptop \@fptop +\@dblfpsep \@fpsep +\@dblfpbot \@dblfptop +%</36pt> +%<*48pt> +\@dblfptop \@fptop +\@dblfpsep \@fpsep +\@dblfpbot \@dblfptop +%</48pt> +%<*60pt> +\@dblfptop \@fptop +\@dblfpsep \@fpsep +\@dblfpbot \@dblfptop +%</60pt> % \end{macrocode} % \end{macro} % \end{macro} @@ -2253,7 +3507,7 @@ % the \emph{measure}. % % \begin{macro}{\lxvchars} -% The length |\lxvchars| is the approximate length of a normal +% The length \cs{lxvchars} is the approximate length of a normal % text line containing 65 characters (a typesetters rule of thumb is % that there should be about 60--70 characters per line). % \begin{macrocode} @@ -2263,11 +3517,17 @@ %<12pt>\setlength\lxvchars{336\p@} % standard 390pt %<14pt>\setlength\lxvchars{408\p@} % %<17pt>\setlength\lxvchars{444\p@} % +%<20pt>\setlength\lxvchars{528\p@} % +%<25pt>\setlength\lxvchars{626\p@} % +%<30pt>\setlength\lxvchars{748\p@} % +%<36pt>\setlength\lxvchars{891\p@} % +%<48pt>\setlength\lxvchars{1177\p@} % +%<60pt>\setlength\lxvchars{1463\p@} % % \end{macrocode} % \end{macro} % % \begin{macro}{\xlvchars} -% The length |\xlvchars| is the approximate length of a normal +% The length \cs{xlvchars} is the approximate length of a normal % double column text line containing 45 characters % (a typesetters rule of thumb is % that there should be about 40--50 characters per column line). @@ -2278,29 +3538,47 @@ %<12pt>\setlength\xlvchars{240\p@} % %<14pt>\setlength\xlvchars{288\p@} % %<17pt>\setlength\xlvchars{312\p@} % +%<20pt>\setlength\xlvchars{365\p@} % +%<25pt>\setlength\xlvchars{438\p@} % +%<30pt>\setlength\xlvchars{518\p@} % +%<36pt>\setlength\xlvchars{617\p@} % +%<48pt>\setlength\xlvchars{815\p@} % +%<60pt>\setlength\xlvchars{1014\p@} % % \end{macrocode} % \end{macro} % % \begin{macro}{\marginparsep} % \begin{macro}{\marginparpush} -% |\marginparsep| is the horizontal space between the text block and -% marginal notes, while |\marginparpush| is the minimum vertical +% \cs{marginparsep} is the horizontal space between the text block and +% marginal notes, while \cs{marginparpush} is the minimum vertical % separation between the notes. % \begin{macrocode} \if@twocolumn +%<*9pt|10pt|11pt|12pt|14pt> \setlength\marginparsep{10\p@} +%</9pt|10pt|11pt|12pt|14pt> +%<*17pt|20pt|25pt|30pt|36pt|48pt|60pt> + \setlength\marginparsep{1em} +%</17pt|20pt|25pt|30pt|36pt|48pt|60pt> \else +%<*9pt|10pt|11pt|12pt|14pt> \setlength\marginparsep{7\p@} +%</9pt|10pt|11pt|12pt|14pt> +%<*17pt|20pt|25pt|30pt|36pt|48pt|60pt> + \setlength\marginparsep{0.7em} +%</17pt|20pt|25pt|30pt|36pt|48pt|60pt> \fi %<9pt|10pt|11pt>\setlength{\marginparpush}{5\p@} %<12pt|14pt>\setlength{\marginparpush}{7\p@} -%<17pt>\setlength{\marginparpush}{10\p@} +%<*17pt|20pt|25pt|30pt|36pt|48pt|60pt> + \setlength\marginparpush{0.5em} +%</17pt|20pt|25pt|30pt|36pt|48pt|60pt> % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macrocode} -%</9pt|10pt|11pt|12pt|14pt|17pt> +%</9pt|10pt|11pt|12pt|14pt|17pt|20pt|25pt|30pt|36pt|48pt|60pt> %<*class> % \end{macrocode} % @@ -2316,22 +3594,22 @@ % \begin{macro}{\setxlvchars} % These were suggested and supplied by Morten H{\o}gholm (18 May 2003). % -% |\setlxvchars|\oarg{fontspec} sets |\lxvchars| to the length of a line +% \cs{setlxvchars}\oarg{fontspec} sets \cs{lxvchars} to the length of a line % containing 65 characters in the \meta{fontspec}. % % Similarly -% |\setxlvchars|\oarg{fontspec} sets |\xlvchars| for 45 characters. +% \cs{setxlvchars}\oarg{fontspec} sets \cs{xlvchars} for 45 characters. % \changes{v1.4}{2003/11/22}{Added \cs{setlxvchars} and \cs{setxlvchars} % (from patch v1.6)} % \begin{macrocode} -\newcommand{\setlxvchars}[1][\normalfont]{\begingroup +\newcommand*{\setlxvchars}[1][\normalfont]{\begingroup #1 \settowidth{\lxvchars}{abcdefghijklmnopqrstuvwxyz}% \setlength{\lxvchars}{2.042\lxvchars}% \addtolength{\lxvchars}{33.41pt}% \global\lxvchars=\lxvchars \endgroup} -\newcommand{\setxlvchars}[1][\normalfont]{\begingroup +\newcommand*{\setxlvchars}[1][\normalfont]{\begingroup #1 \settowidth{\xlvchars}{abcdefghijklmnopqrstuvwxyz}% \setlength{\xlvchars}{1.415\xlvchars}% @@ -2344,14 +3622,13 @@ % \end{macro} % % \begin{macro}{\setrectanglesize} -% The macro |\setrectanglesize{|\meta{H}|}{|\meta{W}|}{|\meta{r}|}| +% The macro \cs{setrectanglesize}\marg{H}\marg{W}\marg{r} % calculates the height and width of a rectangle given any two out of -% the three arguments. An unvalued argument is denoted by |*|. +% the three arguments. An unvalued argument is denoted by \verb?*?. % % Table~\ref{tab:setrect} shows the argument combinations and the result % for each combination. % \begin{table} -% \DeleteShortVerb{\|} % \centering % \caption{Arguments and results for \cs{setrectanglesize}}\label{tab:setrect} % \begin{tabular}{ccc|l} \hline @@ -2366,31 +3643,32 @@ % H & * & * & $W = H$ \\ % \hline % \end{tabular} -% \MakeShortVerb{\|} % \end{table} % % The -% calculated height and width are stored in |\@tempdima| and |\@tempdimb| +% calculated height and width are stored in \cs{@tempdima} and \cs{@tempdimb} % respectively. Both lengths are set to zero if there is an error. +% \changes{v1.61803}{2008/01/30}{Used \cs{setlength} instead of TeX syntax so that the calc package +% can be used with page layout (Morten H{\o}gholm mempatch v4.5)} % \begin{macrocode} -\newcommand{\setrectanglesize}[3]{% +\newcommand*{\setrectanglesize}[3]{% \nametest{#1}{*}% \ifsamename % H = * \nametest{#2}{*}% \ifsamename % W = * \@memerror{% The combination of argument values is ambiguous.\MessageBreak - The lengths will be set to zero}{\@ehd} - \@tempdima = \z@ - \@tempdimb = \z@ + The lengths will be set to zero}{\@ehd}% + \setlength{\@tempdima}{0pt}% + \setlength{\@tempdimb}{0pt}% \else % W \nametest{#3}{*}% \ifsamename % r = * - \@tempdimb = #2\relax - \@tempdima = \@tempdimb + \setlength{\@tempdimb}{#2}% + \setlength{\@tempdima}{\@tempdimb}% \else % r - \@tempdimb = #2\relax - \@tempdima = #3\@tempdimb + \setlength{\@tempdimb}{#2}% + \setlength{\@tempdima}{#3\@tempdimb}% \fi \fi \else % H @@ -2398,18 +3676,17 @@ \ifsamename % W = * \nametest{#3}{*}% \ifsamename % r = * - \@tempdima = #1\relax - \@tempdimb = \@tempdima + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{\@tempdima}% \else % r - \@tempdima = #1\relax - \@tempdimb = #3\@tempdima + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{#3\@tempdima}% \fi \else % W - \@tempdima = #1\relax - \@tempdimb = #2\relax + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{#2}% \fi - \fi -} + \fi} % \end{macrocode} % \end{macro} @@ -2420,14 +3697,13 @@ % Also $L$ and $R$ may be specified independently of each other or as a % ratio (i.e., $L = rR$ or $R = rL$). % The macro -% |\setfillsize{|\meta{T}|}{|\meta{C}|}{|\meta{L}|}{|\meta{R}|}{|\meta{r}|}| +% \cs{setfillsize}\marg{T}\marg{C}\marg{L}\marg{R}\marg{r} % maintains these constraints among the variables, where an unvalued -% argument is denoted by |*|. +% argument is denoted by \verb?*?. % % Table~\ref{tab:setfill} shows the argument combinations and the result % for each combination. % \begin{table} -% \DeleteShortVerb{\|} % \centering % \caption{Arguments and results for \cs{setfillsize}}\label{tab:setfill} % \begin{tabular}{cccc|ll} \hline @@ -2450,16 +3726,17 @@ % C & L & * & * & $R = T - C - L$, & $C$ \\ % \hline % \end{tabular} -% \MakeShortVerb{\|} +% ^^A \MakeShortVerb{\|} % \end{table} % % % The -% calculated values of |C|, |L| and |R| are stored |\@tempdimc|, -% |\@tempdima| and |\@tempdimb| respectively. If there is an error +% calculated values of \texttt{C}, \texttt{L} and \texttt{R} are stored +% \cs{@tempdimc}, +% \cs{@tempdima} and \cs{@tempdimb} respectively. If there is an error % the lengths are set to zero. % \begin{macrocode} -\newcommand{\setfillsize}[5]{% +\newcommand*{\setfillsize}[5]{% \nametest{#2}{*}% \ifsamename % C = * \nametest{#3}{*}% @@ -2469,21 +3746,21 @@ \@memerror{% The combination of argument values is ambiguous.\MessageBreak The lengths will be set to zero}{\@ehd} - \@tempdima = \z@ - \@tempdimb = \z@ - \@tempdimc = \z@ + \setlength{\@tempdima}{0pt}% + \setlength{\@tempdimb}{0pt}% + \setlength{\@tempdimc}{0pt}% \else % R \nametest{#5}{*}% \ifsamename % r = * - \@tempdimb = #4\relax - \@tempdima = \@tempdimb - \@tempdimc = #1\relax + \setlength{\@tempdimb}{#4}% + \setlength{\@tempdima}{\@tempdimb}% + \setlength{\@tempdimc}{#1}% \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \else % r - \@tempdimb = #4\relax - \@tempdima = #5\@tempdimb - \@tempdimc = #1\relax + \setlength{\@tempdimb}{#4}% + \setlength{\@tempdima}{#5\@tempdimb}% + \setlength{\@tempdimc}{#1}% \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \fi @@ -2493,22 +3770,22 @@ \ifsamename % R = * \nametest{#5}{*}% \ifsamename % r = * - \@tempdima = #3\relax - \@tempdimb = \@tempdima - \@tempdimc = #1\relax + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{\@tempdima} + \setlength{\@tempdimc}{#1}% \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \else % r - \@tempdima = #3\relax - \@tempdimb = #5\@tempdima - \@tempdimc = #1\relax + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{#5\@tempdima} + \setlength{\@tempdimc}{#1}% \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \fi \else % R - \@tempdima = #3\relax - \@tempdimb = #4\relax - \@tempdimc = #1\relax + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{#4}% + \setlength{\@tempdimc}{#1}% \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \fi @@ -2520,17 +3797,17 @@ \ifsamename % R = * \nametest{#5}{*}% \ifsamename % r = * - \@tempdimc = #2\relax - \@tempdima = #1\relax + \setlength{\@tempdimc}{#2}% + \setlength{\@tempdima}{#1}% \advance\@tempdima -\@tempdimc \@tempdima = 0.5\@tempdima \@tempdimb = \@tempdima \else % r (CODE PERHAPS FIXED) - \@tempdimc = #2\relax % C - \@tempdimb = #1\relax % T + \setlength{\@tempdimc}{#2} % C + \setlength{\@tempdimb}{#1} % T \advance\@tempdimb -\@tempdimc % T - C \@tempdima = 1000sp - \@tempdima = #5\@tempdima % 1000r sp + \setlength{\@tempdima}{#5\@tempdima} % 1000r sp \advance\@tempdima by 1000sp % 1000(1+r)sp \@tempcnta = \@tempdima % 1000(1+r) \@tempdima = \@tempdimb % T - C @@ -2539,31 +3816,30 @@ \advance\@tempdimb by -\@tempdima % = R \fi \else % R - \@tempdimc = #2\relax - \@tempdimb = #4\relax - \@tempdima = #1\relax + \setlength{\@tempdimc}{#2}% + \setlength{\@tempdimb}{#4}% + \setlength{\@tempdima}{#1}% \advance\@tempdima -\@tempdimc \advance\@tempdima -\@tempdimb \fi \else % L \nametest{#4}{*}% \ifsamename % R = * - \@tempdimc = #2\relax - \@tempdima = #3\relax - \@tempdimb = #1\relax + \setlength{\@tempdimc}{#2}% + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{#1}% \advance\@tempdimb -\@tempdimc \advance\@tempdimb -\@tempdima \else % R \@memerror{% The combination of argument values is ambiguous.\MessageBreak The lengths will be set to zero}{\@ehd}% - \@tempdima = \z@ - \@tempdimb = \z@ - \@tempdimc = #2\relax + \setlength{\@tempdima}{0pt}% + \setlength{\@tempdimb}{0pt}% + \setlength{\@tempdimc}{#2}% \fi \fi - \fi -} + \fi} % \end{macrocode} % \end{macro} @@ -2571,12 +3847,12 @@ % \begin{macro}{\setstocksize} % \begin{macro}{\settrims} % \begin{macro}{\settrimmedsize} -% |\setstocksize{|\meta{height}|}{|\meta{width}|}| sets the height +% \cs{setstocksize}\marg{height}\marg{width} sets the height % and width of the stock material and -% |\settrims{|\meta{top}|}{|\meta{edge}|}| sets the trim lengths +% \cs{settrims}\marg{top}\marg{edge} sets the trim lengths % for the top and side (fore edge) of the stock. -% The macro |\settrimmedsize{|\meta{height}|}{|\meta{width}|}{|\meta{ratio}|}| -% sets the size for the trimmed page, based on |\setrectanglesize|. +% The macro \cs{settrimmedsize}\marg{height}\marg{width}\marg{ratio} +% sets the size for the trimmed page, based on \cs{setrectanglesize}. % \begin{macrocode} \newcommand{\setstocksize}[2]{% \setlength{\stockheight}{#1}% @@ -2596,8 +3872,8 @@ % % % \begin{macro}{\settypeblocksize} -% |\settypeblocksize{|\meta{height}|}{|\meta{width}|}{|\meta{ratio}|}| -% calulates the |\textheight| and |\textwidth| from two out of the +% \cs{settypeblocksize}\marg{height}\marg{width}\marg{ratio} +% calulates the \cs{textheight} and \cs{textwidth} from two out of the % three arguments. % \begin{macrocode} \newcommand{\settypeblocksize}[3]{% @@ -2611,7 +3887,7 @@ % \begin{macro}{\spinemargin} % \begin{macro}{\foremargin} % \begin{macro}{\setlrmargins} -% |\setlrmargins{|\meta{L}|}{|\meta{R}|}{|\meta{r}|}| sets the Left (spine) +% \cs{setlrmargins}\marg{L}\marg{R}\marg{r} sets the Left (spine) % and Right (fore edge) margins with constant typeblock. % \begin{macrocode} \newlength{\spinemargin} @@ -2628,7 +3904,7 @@ % \end{macro} % % \begin{macro}{\setlrmarginsandblock} -% |\setlrmarginsandblock{|\meta{L}|}{|\meta{R}|}{|\meta{r}|}| sets the Left (spine) +% \cs{setlrmarginsandblock}\marg{L}\marg{R}\marg{r} sets the Left (spine) % and Right (fore edge) margins with variable typeblock. % \begin{macrocode} \newcommand{\setlrmarginsandblock}[3]{% @@ -2643,7 +3919,7 @@ % \begin{macro}{\uppermargin} % \begin{macro}{\lowermargin} % \begin{macro}{\setulmargins} -% |\setulmargins{|\meta{L}|}{|\meta{R}|}{|\meta{r}|}| sets the Left (upper) +% \cs{setulmargins}\marg{L}\marg{R}\marg{r} sets the Left (upper) % and Right (lower) margins with constant typeblock. % \begin{macrocode} \newlength{\uppermargin} @@ -2660,7 +3936,7 @@ % \end{macro} % % \begin{macro}{\setulmarginsandblock} -% |\setulmarginsandblock{|\meta{L}|}{|\meta{R}|}{|\meta{r}|}| sets the Left (upper) +% \cs{setulmarginsandblock}\marg{L}\marg{R}\marg{r} sets the Left (upper) % and Right (lower) margins with variable typeblock. % \begin{macrocode} \newcommand{\setulmarginsandblock}[3]{% @@ -2674,7 +3950,7 @@ % % \begin{macro}{\headdrop} % \begin{macro}{\setheaderspaces} -% |\setheaderspaces{|\meta{L}|}{|\meta{R}|}{|\meta{r}|}| sets the Left (head margin) +% \cs{setheaderspaces}\marg{L}\marg{R}\marg{r} sets the Left (head margin) % and Right (headsep) spacing with constant headheight. % \begin{macrocode} \newlength{\headdrop} @@ -2689,7 +3965,7 @@ % \end{macro} % % \begin{macro}{\setheadfoot} -% |\setheadfoot{|\meta{headheight}|}{|\meta{footskip}|}| +% \cs{setheadfoot}\marg{headheight}\marg{footskip} % sets the headheight and the footskip. % \begin{macrocode} \newcommand{\setheadfoot}[2]{% @@ -2700,7 +3976,7 @@ % \end{macro} % % \begin{macro}{\setcolsepandrule} -% |\setcolsepandrule{|\meta{colsep}|}{|\meta{thickness}|}| +% \cs{setcolsepandrule}\marg{colsep}\marg{thickness} % sets the column separation and the rule thickness. % \changes{v1.0}{2001/09/20}{Changed \cs{setcolseprule} to % \cs{setcolsepandrule} to match the documentation.} @@ -2713,7 +3989,7 @@ % \end{macro} % % \begin{macro}{\setmarginnotes} -% |\setmarginnotes{|\meta{sep}|}{|\meta{width}|}{|\meta{push}|}| +% \cs{setmarginnotes}\marg{sep}\marg{width}\marg{push} % sets the marginpar parameters. % \begin{macrocode} \newcommand{\setmarginnotes}[3]{% @@ -2724,8 +4000,6 @@ % \end{macrocode} % \end{macro} % -% -% % Initialise the paper size and trimming to their default values. % \begin{macrocode} \settrimmedsize{\stockheight}{\stockwidth}{*} @@ -2733,15 +4007,13 @@ % \end{macrocode} % -% -% % What now follows is the standard class's method for setting up % the dimensions. % -% Set |\@tempdimb| to size-dependent initial line length and -% set |\@tempdima| to the maximum textwidth for the paper width, +% Set \cs{@tempdimb} to size-dependent initial line length and +% set \cs{@tempdima} to the maximum textwidth for the paper width, % an inch margin on either side. In the standard classes the initial -% line length is about 14\% greater than |\lxvchars|. +% line length is about 14\% greater than \cs{lxvchars}. % \begin{macrocode} \setlength{\@tempdimb}{1.14\lxvchars} \setlength\@tempdima{\paperwidth} @@ -2749,8 +4021,8 @@ % \end{macrocode} % % \begin{macro}{\textwidth} -% Now set the |\textwidth| depending on the number of columns. In twocolumn -% mode each column should be no wider than |\@tempdimb|. +% Now set the \cs{textwidth} depending on the number of columns. In twocolumn +% mode each column should be no wider than \cs{@tempdimb}. % \begin{macrocode} \if@twocolumn \ifdim\@tempdima>2\@tempdimb\relax @@ -2779,16 +4051,16 @@ % \end{macro} % % \begin{macro}{\textheight} -% The |\textheight| is the height of the text block, excluding -% headers and footers. This is set according to the |\paperheight|, +% The \cs{textheight} is the height of the text block, excluding +% headers and footers. This is set according to the \cs{paperheight}, % to an integral number of lines, and allowing a 1in margin at the % top and bottom and a further 1.5in for headers and footers. % \begin{macrocode} \setlength\@tempdima{\paperheight} \addtolength\@tempdima{-3.5in} % \end{macrocode} -% Divide this height by the |\baselineskip| to get the number of lines. -% Then (re)calculate the |\textheight| and finally add the |\topskip|. +% Divide this height by the \cs{baselineskip} to get the number of lines. +% Then (re)calculate the \cs{textheight} and finally add the \cs{topskip}. % \begin{macrocode} \divide\@tempdima\baselineskip \@tempcnta=\@tempdima @@ -2828,7 +4100,7 @@ \fi % \end{macrocode} % Set these values to integer numbers of points, and calculate the -% |\evensidemargin|. +% \cs{evensidemargin}. % \begin{macrocode} \@settopoint\oddsidemargin \@settopoint\marginparwidth @@ -2844,7 +4116,7 @@ % \end{macro} % % \begin{macro}{\topmargin} -% The |\topmargin| is the distance below the top of the printable +% 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. % \begin{macrocode} @@ -2862,11 +4134,11 @@ % % That is the end of the classical algorithm. Now calculate the % user-friendly dimensions. The calculations are simpler than in -% the general case as the |\paperwidth| and |\paperheight| is the -% same as the |\stockwidth| and |\stockheight|. +% the general case as the \cs{paperwidth} and \cs{paperheight} is the +% same as the \cs{stockwidth} and \cs{stockheight}. % % We can get the spine -% and edge margins from the |\oddsidemargin|. +% and edge margins from the \cs{oddsidemargin}. % \begin{macrocode} \setlength{\spinemargin}{\oddsidemargin} \addtolength{\spinemargin}{1in} @@ -2875,7 +4147,7 @@ % \end{macrocode} % % Similarly we can get the upper and lower margins from the -% |\topmargin|, |\headheight| and |\headskip|. +% \cs{topmargin}, \cs{headheight} and \cs{headskip}. % \begin{macrocode} \setlength{\uppermargin}{\topmargin} \addtolength{\uppermargin}{1in} @@ -2888,7 +4160,7 @@ % \begin{macro}{\@memznegtest} % DA suggested this in a private email (2003/002/13) to make error % checking and reporting a bit more (space) efficient. Use like \\ -% |\@memznegtest{\marginparsep}| instead of \\ +% \verb?\@memznegtest{\marginparsep}? instead of \\ % \begin{verbatim} % \ifdim\marginparsep>\z@\else % \@memerror{\protect\marginparsep\space is zero or negative}{\@ehd}% @@ -2917,49 +4189,127 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\checkthelayout} -% This macro checks that the current layout dimensions are sensible and -% checks the arithmetic. +% \begin{macro}{\m@mclassicht} +% The classic adjustment of the \cs{textheight} to get an integral number +% of lines (given an integral number of baselineskips returns a height +% giving one more line in the block). +% \changes{v1.61803}{2008/01/30}{Added \cs{m@mclassicht}, \cs{m@mlinesht} +% and \cs{m@mnearestht} (mempatch v4.5)} +% \begin{macrocode} +\newcommand*{\m@mclassicht}{% + \setlength{\@tempdima}{\textheight}% + \divide\@tempdima \baselineskip + \@tempcnta=\@tempdima + \setlength{\textheight}{\@tempcnta\baselineskip}% + \addtolength{\textheight}{\topskip}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mlinesht} +% The adjustment of the \cs{textheight} to get an integral number +% of lines (given an inegral number of baselineskips returns a height +% giving that number of lines). +% \begin{macrocode} +\newcommand*{\m@mlinesht}{% + \setlength{\@tempdima}{\textheight}% + \advance\@tempdima -\baselineskip + \divide\@tempdima \baselineskip + \@tempcnta=\@tempdima + \setlength{\textheight}{\@tempcnta\baselineskip}% + \addtolength{\textheight}{\topskip}} + +% \end{macrocode} +% \end{macro} % -% \changes{v1.0a}{2002/01/18}{Added \cs{checkthelayout}} +% \begin{macro}{\m@mnearestht} +% The adjustment of the \cs{textheight} to get an integral number +% of lines with the calculated height being as the closest to the given +% height. Algorithm supplied by Lars Madsen and Morten H{\o}gholm on +% 2006/07/27. +% \begin{macrocode} +\newcommand*{\m@mnearestht}{% + \setlength{\@tempdima}{\textheight}% + \advance\@tempdima -\topskip + \advance\@tempdima 0.5\baselineskip + \divide\@tempdima \baselineskip + \@tempcnta=\@tempdima + \setlength{\textheight}{\@tempcnta\baselineskip}% + \addtolength{\textheight}{\topskip}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\checkthelayout} +% \cs{checkthelayout}\oarg{text} is the user level macro for +% checking the layout. The \meta{text} argument controls which +% algorithm should be used to calculate the \cs{textheight}. +% \changes{v1.61803}{2008/01/30}{Extended \cs{checkthelayout} to include a choice +% of algorithms (mempatch v4.5)} +% \changes{v1.61803}{2008/01/30}{Changed some page layout tests to negative from zero or negative +% (mempatch v4.5)} % \begin{macrocode} -\newcommand{\checkthelayout}{% +\newcommand*{\checkthelayout}[1][classic]{% % \end{macrocode} -% First check the dimensions are not negative. +% First check the dimensions are not (zero or) negative. % \begin{macrocode} \@memnegtest{\trimedge} \@memnegtest{\trimtop} \@memznegtest{\stockwidth} \@memznegtest{\paperwidth} \@memznegtest{\textwidth} - \@memznegtest{\spinemargin} - \@memznegtest{\foremargin} +%%% \@memznegtest{\spinemargin} + \@memnegtest{\spinemargin} +%%% \@memznegtest{\foremargin} + \@memnegtest{\foremargin} \@memznegtest{\marginparsep} \@memznegtest{\marginparwidth} \@memznegtest{\stockheight} \@memznegtest{\paperheight} \@memznegtest{\textheight} - \@memznegtest{\uppermargin} - \@memznegtest{\lowermargin} - \@memznegtest{\headheight} - \@memznegtest{\headsep} - \@memznegtest{\footskip} - -% \end{macrocode} -% -% Carry on regardless. We need to adjust the |\textheight| and the -% |\lowermargin| to get an integral number of lines. -% \begin{macrocode} - \@tempdima = \textheight - \divide\@tempdima \baselineskip - \@tempcnta=\@tempdima - \setlength{\textheight}{\@tempcnta\baselineskip} - \addtolength{\textheight}{\topskip} +%%% \@memznegtest{\uppermargin} + \@memnegtest{\uppermargin} +%%% \@memznegtest{\lowermargin} + \@memnegtest{\lowermargin} +%%% \@memznegtest{\headheight} + \@memnegtest{\headheight} +%%% \@memznegtest{\headsep} + \@memnegtest{\headsep} +%%% \@memznegtest{\footskip} + \@memnegtest{\footskip} +% \end{macrocode} +% +% Carry on regardless. We may need to adjust the \cs{textheight} +% to get an integral number of lines. +% \begin{macrocode} + \nametest{#1}{classic}% + \ifsamename + \m@mclassicht + \else + \nametest{#1}{lines}% + \ifsamename + \m@mlinesht + \else + \nametest{#1}{nearest}% + \ifsamename + \m@mnearestht + \else + \nametest{#1}{fixed} + \ifsamename + \else% not classic, lines, nearest, or fixed + \@memerror{Optional argument is not one of:\MessageBreak + classic, fixed, lines, or nearest. \MessageBreak + I will assume the default}% + {\@ehc}% + \fi + \fi + \fi + \fi \setulmargins{\uppermargin}{*}{*} % \end{macrocode} % % Check that all the sums add up correctly, or -% at least to within a small (|\@tempdimb|) error. +% at least to within a small (\cs{@tempdimb}) error. % \begin{macrocode} \@tempdimb = -1pt \@tempdima=\stockwidth @@ -3029,18 +4379,19 @@ is too large for \protect\lowermargin\space by \the\@tempdima}% {\@ehd} - \fi -} + \fi} + % \end{macrocode} % \end{macro} % +% % \begin{macro}{\fixthelayout} % Calculate the normal % \LaTeX{} page layout parameter values. We'll do the heights first % as they are independent of the number of columns and the side printing. % \changes{v1.0a}{2002/01/18}{Added \cs{fixthelayout}} % \begin{macrocode} -\newcommand{\fixthelayout}{% +\newcommand*{\fixthelayout}{% \topmargin = \trimtop \advance\topmargin \uppermargin \advance\topmargin -\headsep @@ -3048,7 +4399,7 @@ \advance\topmargin -1in\relax % \end{macrocode} % -% Now the |\oddsidemargin|. +% Now the \cs{oddsidemargin}. % \begin{macrocode} \oddsidemargin = \stockwidth \advance\oddsidemargin -\trimedge @@ -3057,7 +4408,7 @@ \advance\oddsidemargin -1in\relax % \end{macrocode} % -% And the |\evensidemargin|. +% And the \cs{evensidemargin}. % \begin{macrocode} \evensidemargin = \trimedge \advance\evensidemargin \foremargin @@ -3069,8 +4420,7 @@ % \begin{macrocode} \@settopoint\textwidth \@settopoint\oddsidemargin - \@settopoint\evensidemargin -} + \@settopoint\evensidemargin} % \end{macrocode} % \end{macro} @@ -3079,8 +4429,10 @@ % Why not type out the calculated versions of the designed values? % \changes{v1.0a}{2002/01/18}{Added \cs{typeoutlayout}} % \changes{v1.0a}{2002/01/25}{Added column info to \cs{typeoutlayout}} +% \changes{v1.61803}{2008/01/30}{Added sidecap and sidebar data to \cs{typeoutlayout} +% (mempatch v4.6)} % \begin{macrocode} -\newcommand{\typeoutlayout}{% +\newcommand*{\typeoutlayout}{% \typeout{} \typeout{******************************************************} \typeout{Stock height and width: @@ -3103,26 +4455,38 @@ \the\columnsep\space and \the\columnseprule} \typeout{Marginparsep and marginparwidth: \the\marginparsep\space and \the\marginparwidth} + \typeout{Sidecapsep and sidecapwidth: + \the\sidecapsep\space and \the\sidecapwidth} + \typeout{Sidebarhsep and sidebarwidth: + \the\sidebarhsep\space and \the\sidebarwidth} + \typeout{Sidebarvsep and sidebartopsep: + \the\sidebarvsep\space and \the\sidebartopsep} + \typeout{Sidebarheight: + \the\dimen\sideins} \typeout{******************************************************} - \typeout{} -} + \typeout{}} % \end{macrocode} % \end{macro} % % \begin{macro}{\checkandfixthelayout} -% This macro checks and fixes the layout, and reports the result. +% This macro checks and fixes the layout, and reports the result. It takes the +% 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} -\newcommand{\checkandfixthelayout}{% - \checkthelayout +% \changes{v1.61803}{2008/01/30}{Changed \cs{checkandfixthelayout} +% for the extended \cs{checkthelayout} (mempatch v4.5)} +% \begin{macrocode} +\newcommand*{\checkandfixthelayout}[1][classic]{% + \checkthelayout[#1]% \fixthelayout \typeoutlayout} % \end{macrocode} % \end{macro} % +% % \begin{macro}{\fixpdflayout} % \begin{macro}{\fixdvipslayout} % Page layout with pdf\LaTeX{} seems a bit iffy. @@ -3206,6 +4570,107 @@ % \end{macro} % % +% \subsection{Some predefined layouts} +% +% A few predefined layouts for the textblock are presented. The \cs{checkandfixthelayout} +% macro \emph{must} be called afterwards. +% +% \begin{macro}{\medievalpage} +% This implements Jan Tschichold's reconstruction of the page and textblock +% layout used by medieval scribes and the early printers~\cite{}. +% The spine, top, edge and bottom margins are in the ratios 2:3:4:6. +% +% \cs{medievalpage}\oarg{num} positions the typeblock on the page with the +% margins in the above ratios. The spine margin is (page width)/\meta{num} +% (default 9). This must be an integer. +% \changes{v1.61803}{2008/01/30}{Added \cs{medievalpage}} +% \begin{macrocode} +%%%% s = w/#1, t = 1.5s, e = 2s, f = 3s +\newcommand*{\medievalpage}[1][9]{% + \spinemargin=\paperwidth + \divide\spinemargin #1\relax + \uppermargin = 1.5\spinemargin + \setlrmarginsandblock{\spinemargin}{*}{2} + \setulmarginsandblock{\uppermargin}{*}{2}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\isopage} +% An implementation of Bringhurst's layout for ISO proportioned pages. +% It works for any page though. The edge margin is twice the spine, +% and the bottom margin is twice the top. +% +% \cs{isopage}\oarg{num} positions and sizes the typeblock on the page +% according to the above ratios. The spine is (page width)/\meta{num} +% and the top margin id (page height)/\meta{num}. \meta{num} must be +% an integer. +% \changes{v1.61803}{2008/01/30}{Added \cs{isopage}} +% \begin{macrocode} +% s = w/#1, e = 2s, t = h/#1, f = 2h +\newcommand*{\isopage}[1][9]{% + \spinemargin=\paperwidth + \divide\spinemargin #1\relax + \uppermargin=\paperheight + \divide\uppermargin #1\relax + \setlrmarginsandblock{\spinemargin}{*}{2} + \setulmarginsandblock{\uppermargin}{*}{2}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\semiisopage} +% An variation on Bringhurst's layout for ISO proportioned pages. +% It works for any page though. The top margin is the same as the spine, +% and the edge and bottom margins are twice the spine. +% +% \cs{semiisopage}\oarg{num} positions and sizes the typeblock on the page +% according to the above ratios. The spine is (page width)/\meta{num}. +% \meta{num} must be an integer. +% \changes{v1.61803}{2008/01/30}{Added \cs{isopage}} +% \begin{macrocode} +%%% s = w/#1, t = s, e = 2s, f = e +\newcommand*{\semiisopage}[1][9]{% + \spinemargin=\paperwidth + \divide\spinemargin #1\relax + \uppermargin=\spinemargin + \setlrmarginsandblock{\spinemargin}{*}{2} + \setulmarginsandblock{\uppermargin}{*}{2}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setpagebl} +% \begin{macro}{\setpageml} +% \begin{macro}{\setpagetl} +% \cs{setpagebl}\marg{height}\marg{width}\marg{ratio} sets a page smaller than +% the stock size at the bottom left of the stock. The arguments are the +% the same as for \cs{settrimmedsize}; +% \meta{height}, \meta{width} and \meta{ratio} of height and width +% (choose any two) of the desired page size. The trims are adjusted to suit. +% \cs{setpagetl} puts the page at the top left, and \cs{setpageml} at the +% middle left. +% \changes{v1.61803}{2008/01/30}{Added \cs{setpagebl}, \cs{setpageml}, and +% \cs{setpagetl}} +% \begin{macrocode} +\newcommand*{\setpagebl}[3]{% + \settrimmedsize{#1}{#2}{#3} + \trimtop=\stockheight \advance\trimtop -\paperheight + \trimedge=\stockwidth \advance\trimedge -\paperwidth} +\newcommand*{\setpageml}[3]{% + \settrimmedsize{#1}{#2}{#3} + \trimtop=\stockheight \advance\trimtop -\paperheight + \advance\trimtop -0.5\trimtop + \trimedge=\stockwidth \advance\trimedge -\paperwidth} +\newcommand*{\setpagetl}[3]{% + \settrimmedsize{#1}{#2}{#3} + \trimtop=0pt + \trimedge=\stockwidth \advance\trimedge -\paperwidth} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} % % % \subsection{Float placement parameters} @@ -3213,7 +4678,7 @@ % % All float parameters are given default values in the \LaTeX{} % kernel. For this reason counters only need to be set with -% |\setcounter| and other parameters are set using |\renewcommand|. +% \cs{setcounter} and other parameters are set using \cs{renewcommand}. % % \paragraph{Limits for the placement of floating objects} % @@ -3307,7 +4772,7 @@ % \section{Page Styles} % % The page style \pstyle{foo} is defined by defining the command -% |\ps@foo|. This command should make only local definitions. +% \cs{ps@foo}. This command should make only local definitions. % There should be no stray spaces in the definition, since they % could lead to mysterious extra spaces in the output. % @@ -3315,11 +4780,11 @@ % \begin{macro}{\@oddhead} % \begin{macro}{\@evenfoot} % \begin{macro}{\@oddfoot} -% The |\ps@...| command defines the macros |\@oddhead|, -% |\@oddfoot|, |\@evenhead|, and |\@evenfoot| to define the running -% heads and feet---e.g., |\@oddhead| is the macro to produce the +% The \cs{ps@...} command defines the macros \cs{@oddhead}, +% \cs{@oddfoot}, \cs{@evenhead}, and \cs{@evenfoot} to define the running +% heads and feet---e.g., \cs{@oddhead} is the macro to produce the % contents of the heading box for odd-numbered pages. It is called -% inside an |\hbox| of width |\textwidth|. +% inside an \cs{hbox} of width \cs{textwidth}. % \end{macro} % \end{macro} % \end{macro} @@ -3328,45 +4793,45 @@ % \subsection{Marking conventions} % % To make headings determined by the sectioning commands, the page -% style defines the commands |\chaptermark|, |\sectionmark|, +% style defines the commands \cs{chaptermark}, \cs{sectionmark}, % \ldots,\\ -% where |\chaptermark{|\meta{TEXT}|}| is called by -% |\chapter| to set a mark, and so on. +% where \cs{chaptermark}\marg{TEXT} is called by +% \cs{chapter} to set a mark, and so on. % -% The |\...mark| commands and the |\...head| macros are defined -% with the help of the following macros. (All the |\...mark| +% The \cs{...mark} commands and the \cs{...head} macros are defined +% with the help of the following macros. (All the \cs{...mark} % commands should be initialized to no-ops.) % -% \LaTeX{} extends \TeX's |\mark| facility by producing two kinds +% \LaTeX{} extends \TeX's \cs{mark} facility by producing two kinds % of marks, a `left' and a `right' mark, using the following % commands: % \begin{flushleft} -% |\markboth{|\meta{LEFT}|}{|\meta{RIGHT}|}|: Adds both marks. +% \cs{markboth}\marg{LEFT}\marg{RIGHT}: Adds both marks. % -% |\markright{|\meta{RIGHT}|}|: Adds a `right' mark. +% \cs{markright}\marg{RIGHT}: Adds a `right' mark. % -% |\leftmark|: Used in the |\@oddhead|, |\@oddfoot|, |\@evenhead| -% or |\@evenfoot| macros, it gets the current `left' -% mark. |\leftmark| works like \TeX's |\botmark| +% \cs{leftmark}: Used in the \cs{@oddhead}, \cs{@oddfoot}, \cs{@evenhead} +% or \cs{@evenfoot} macros, it gets the current `left' +% mark. \cs{leftmark} works like \TeX's \cs{botmark} % command. % -% |\rightmark|: Used in the |\@oddhead|, |\@oddfoot|, |\@evenhead| -% or |\@evenfoot| macros, it gets the current -% `right' mark. |\rightmark| works like \TeX's -% |\firstmark| command. +% \cs{rightmark}: Used in the \cs{@oddhead}, \cs{@oddfoot}, \cs{@evenhead} +% or \cs{@evenfoot} macros, it gets the current +% `right' mark. \cs{rightmark} works like \TeX's +% \cs{firstmark} command. % \end{flushleft} % % The marking commands work reasonably well for right marks % `numbered within' left marks--e.g., the left mark is changed by a -% |\chapter| command and the right mark is changed by a |\section| +% \cs{chapter} command and the right mark is changed by a \cs{section} % command. However, it does produce somewhat anomalous results if -% two |\markboth|'s occur on the same page. +% two \cs{markboth}'s occur on the same page. % % -% Commands like |\tableofcontents| that should set the marks in some -% page styles use a |\@mkboth| command, which is |\let| by the -% pagestyle command (|\ps@...|) to |\markboth| for setting the -% heading or to |\@gobbletwo| to do nothing. +% Commands like \cs{tableofcontents} that should set the marks in some +% page styles use a \cs{@mkboth} command, which is \cs{let} by the +% pagestyle command (\cs{ps@...}) to \cs{markboth} for setting the +% heading or to \cs{@gobbletwo} to do nothing. % % % @@ -3374,7 +4839,7 @@ % % This class provides a set of commands for the user to define new % pagestyles. Essentially defining a pagestyle consists of defining the -% macros |\@evenhead{}|, |\@oddhead{}|, |\@evenfoot{}|, and |\@oddfoot{}|. +% macros \cs{@evenhead}, \cs{@oddhead}, \cs{@evenfoot}, and \cs{@oddfoot}. % For this class, each header and footer is treated as three parts: a left, % center, and right part. In this case, defining a pagestyle consists of % specifying these 12 portions of the running headers and footers. The @@ -3384,15 +4849,15 @@ % the same as the textwidth. % % In the following \meta{style} is the name of a pagestyle being defined -% (e.g., |ruled|). +% (e.g., \verb?ruled?). % % \begin{macro}{\makeevenhead} % The command -% |\makeevenhead{|\meta{style}|}{|\meta{left}|}{|\meta{center}|}{|\meta{right}|}| +% \cs{makeevenhead}\marg{style}\marg{left}\marg{center}\marg{right} % specifies that the left, center and right portions of the even header for % pagestyle \meta{style} are defined as the other thre arguments, respectiveley. -% Internally it defines the commands |\styleeheadl|, |\styleeheadc| and -% |\styleeheadr| to be \meta{left}, \meta{center} and \meta{right} respectively. +% Internally it defines the commands \cs{styleeheadl}, \cs{styleeheadc} and +% \cs{styleeheadr} to be \meta{left}, \meta{center} and \meta{right} respectively. % \begin{macrocode} \newcommand{\makeevenhead}[4]{% \@namedef{#1eheadl}{#2} @@ -3405,7 +4870,7 @@ % \begin{macro}{\makeoddhead} % \begin{macro}{\makeevenfoot} % \begin{macro}{\makeoddfoot} -% These three macros are similar to |\makeevenhead| except that they are +% These three macros are similar to \cs{makeevenhead} except that they are % for the oddhead, evenfoot and oddfoot. % \begin{macrocode} \newcommand{\makeoddhead}[4]{% @@ -3430,7 +4895,7 @@ % \end{macro} % % \begin{macro}{\makerunningwidth} -% The macro |\makerunningwidth{|\meta{style}|}{|\meta{length}|}| sets the +% The macro \cs{makerunningwidth}\marg{style}\marg{length} sets the % width of the headers and footers of pagestyle \meta{style} to be \meta{length}. % \begin{macrocode} \newcommand{\makerunningwidth}[2]{% @@ -3443,10 +4908,10 @@ % \begin{macro}{\footruleskip} % \begin{macro}{\makeheadrule} % \begin{macro}{\makefootrule} -% |\normalrulethickness| is the thickness of a normal horizontal +% \cs{normalrulethickness} is the thickness of a normal horizontal % or vertical rule. -% |\footruleheight| is the height of a normal rule above a footer (actually zero). -% |\footruleskip| is a distance sufficient to ensure that a foot rule +% \cs{footruleheight} is the height of a normal rule above a footer (actually zero). +% \cs{footruleskip} is a distance sufficient to ensure that a foot rule % will appear between the bottom of the textblock and above any actual footer. % % (There was a \ctt{} thread \textit{ngerman, fancyhdr and \cs{footrulewidth} --- bug?} @@ -3461,22 +4926,20 @@ \newcommand{\footruleheight}{0pt} \newcommand{\footruleskip}{0.3\normalbaselineskip} % \end{macrocode} -% The macro |\makeheadrule{|\meta{style}|}{|\meta{width}|}{|\meta{height}|}| +% The macro \cs{makeheadrule}\marg{style}\marg{width}\marg{height} % specifies the width and height of the header rule for \meta{style}. % % Similarly -% |\makefootrule{|\meta{style}|}{|\meta{width}|}{|\meta{height}|}{|\meta{skip}|}| +% \cs{makefootrule}\marg{style}\marg{width}\marg{height}\marg{skip} % specifies the width, height and skip for the footrule. % \begin{macrocode} \newcommand{\makeheadrule}[3]{% \@namedef{#1headrule}{% - \hrule\@width #2\@height #3 \vskip-#3} -} + \hrule\@width #2\@height #3 \vskip-#3}} \newcommand{\makefootrule}[4]{% \@namedef{#1footrule}{% \vskip-#4\vskip-#3 - \hrule\@width #2\@height #3 \vskip #4} -} + \hrule\@width #2\@height #3 \vskip #4}} % \end{macrocode} % \end{macro} @@ -3486,12 +4949,12 @@ % \end{macro} % % \begin{macro}{\makeheadposition} -% |\makeheadposition{|\meta{style}|}{|\meta{eheadpos}|}{|\meta{oheadpos}|}{|\meta{efootpos}|}{|\meta{ofootpos}|}| +% \cs{makeheadposition}\marg{style}\marg{eheadpos}\marg{oheadpos}\marg{efootpos}\marg{ofootpos} % specifies the horizontal positioning of the even and odd headers and footers, % respectively, % for the pagestyle \meta{style}. Each of the \meta{...pos} arguments may be -% either |flushleft|, |center| or |flushright|, with the obvious meanings. -% An empty argument (or an unrecognised one) is equivalent to |center|. +% either \verb?flushleft?, \verb?center? or \verb?flushright?, with the obvious meanings. +% An empty argument (or an unrecognised one) is equivalent to \verb?center?. % \begin{macrocode} \newcommand{\makeheadposition}[5]{% % \end{macrocode} @@ -3543,26 +5006,22 @@ \else \@namedef{#1oddfpl}{\hss} \@namedef{#1oddfpr}{\hss} \fi - \fi -} + \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\makepsmarks} % \begin{macro}{\makepshook} -% The macro |\makepsmarks{|\meta{style}|}{|\meta{code}|}| specifies that +% The macro \cs{makepsmarks}\marg{style}\marg{code} specifies that % \meta{code} is the definition of the hook for pagestyle \meta{style}. -% |\makepshook| is a deprecated version of |\makepsmarks|. +% \cs{makepshook} was a deprecated version of \cs{makepsmarks} and is +% now deleted. % \changes{v1.0}{2001/11/15}{Added \cs{makepsmarks} and deprecated % \cs{makepshook}} % \changes{v1.4}{2003/12/14}{Deleted \cs{makepshook}} % \begin{macrocode} \newcommand{\makepsmarks}[2]{\@namedef{#1pshook}{#2}} -%%%% \newcommand{\makepshook}[2]{% -%%%% \@memwarn{\protect\makepshook\space is deprecated.\MessageBreak -%%%% Use \protect\makepsmarks\space instead} -%%%% \@namedef{#1pshook}{#2}} % \end{macrocode} % \end{macro} @@ -3581,30 +5040,32 @@ % % \begin{macro}{\makepagestyle} % At last we can put everything together for defining a new pagestyle, -% via the macro |\makepagestyle{|\meta{style}|}| which initially sets up -% a new pagestyle \meta{style} corresponding the the \LaTeX{} |empty| +% via the macro \cs{makepagestyle}\marg{style} which initially sets up +% a new pagestyle \meta{style} corresponding the the \LaTeX{} \verb?empty? % pagestyle. The prior macros can then be used to make modifications % to the style. % \changes{v1.0}{2001/11/15}{Now 2 stage process for defining \cs{@evenhead} % and friends} % \changes{v1.61}{2004/03/14}{Added \cs{m@mhe@dreset} at several points in % \cs{makepagestyle} (from patch 2.1)} +% \changes{v1.61803}{2008/01/30}{Removed extraneous spaces from pagestyle code +% (mempatch v4.6)} % \begin{macrocode} \newcommand{\makepagestyle}[1]{% % \end{macrocode} -% First define the macro |\ps@style|, which in turn defines the macros -% |\@evenhead|, |\@oddhead|, |\@evenfoot| and |\@oddfoot|. +% First define the macro \cs{ps@style}, which in turn defines the macros +% \cs{@evenhead}, \cs{@oddhead}, \cs{@evenfoot} and \cs{@oddfoot}. % \begin{macrocode} \@namedef{ps@#1}{% \@namedef{#1@evenhead}{% % \end{macrocode} -% The code for the definition of |\@evenhead| and friends is based on code +% The code for the definition of \cs{@evenhead} and friends is based on code % from Piet van Oostrum's \Lpack{fancyhdr} package~\cite{FANCYHDR}. The three % parts of the header are put into parboxes, with fills between them, and % the whole lot is put into a box the width of the header. Fillers are put % before and after the main box which control the header position. % -% First the left filler which is either |\relax| or |\hss|, and then +% First the left filler which is either \cs{relax} or \cs{hss}, and then % start the main box. % \begin{macrocode} \@nameuse{#1evenhpl}\hb@xt@\@nameuse{#1runwidth}{\m@mhe@dreset% @@ -3626,12 +5087,12 @@ \raggedleft\@nameuse{#1eheadr}\strut}}}% % \end{macrocode} % Finally, the header rule and finish with the right filler, which -% is either |\relax| or |\hss|. +% is either \cs{relax} or \cs{hss}. % \begin{macrocode} - \@nameuse{#1headrule}}}\@nameuse{#1evenhpr}} + \@nameuse{#1headrule}}}\@nameuse{#1evenhpr}}% % \end{macrocode} -% The code for the |\@oddhead|, |\@evenfoot| and |\@oddfoot| follows -% a similar pattern. Here is |\@oddhead|. +% The code for the \cs{@oddhead}, \cs{@evenfoot} and \cs{@oddfoot} follows +% a similar pattern. Here is \cs{@oddhead}. % \begin{macrocode} \@namedef{#1@oddhead}{% \@nameuse{#1oddhpl}\hb@xt@\@nameuse{#1runwidth}{\m@mhe@dreset% @@ -3642,9 +5103,9 @@ \centering\@nameuse{#1oheadc}\strut}\hfill \llap{\parbox[b]{\@nameuse{#1runwidth}}{% \raggedleft\@nameuse{#1oheadr}\strut}}}% - \@nameuse{#1headrule}}}\@nameuse{#1oddhpr}} + \@nameuse{#1headrule}}}\@nameuse{#1oddhpr}}% % \end{macrocode} -% And |\@evenfoot|. For the footers the rules come \emph{before} any foot +% And \cs{@evenfoot}. For the footers the rules come \emph{before} any foot % entries. % \begin{macrocode} \@namedef{#1@evenfoot}{% @@ -3656,9 +5117,9 @@ \centering\@nameuse{#1efootc}\strut}\hfill \llap{\parbox[b]{\@nameuse{#1runwidth}}{% \raggedleft\@nameuse{#1efootr}\strut}}}% - }}\@nameuse{#1evenfpr}} + }}\@nameuse{#1evenfpr}}% % \end{macrocode} -% Lastly the |\@oddfoot|. +% Lastly the \cs{@oddfoot}. % \begin{macrocode} \@namedef{#1@oddfoot}{% \@nameuse{#1oddfpl}\hb@xt@\@nameuse{#1runwidth}{\m@mhe@dreset% @@ -3669,50 +5130,48 @@ \centering\@nameuse{#1ofootc}\strut}\hfill \llap{\parbox[b]{\@nameuse{#1runwidth}}{% \raggedleft\@nameuse{#1ofootr}\strut}}}% - }}\@nameuse{#1oddfpr}} + }}\@nameuse{#1oddfpr}}% % \end{macrocode} -% Now we define |\@evenhead| etc., in terms of |#1@evenhead|. +% Now we define \cs{@evenhead} etc., in terms of \verb?#1@evenhead?. % \begin{macrocode} - \def\@evenhead{\@nameuse{#1@evenhead}} - \def\@oddhead{\@nameuse{#1@oddhead}} - \def\@evenfoot{\@nameuse{#1@evenfoot}} - \def\@oddfoot{\@nameuse{#1@oddfoot}} + \def\@evenhead{\@nameuse{#1@evenhead}}% + \def\@oddhead{\@nameuse{#1@oddhead}}% + \def\@evenfoot{\@nameuse{#1@evenfoot}}% + \def\@oddfoot{\@nameuse{#1@oddfoot}}% % \end{macrocode} -% To finish off the definition of |\ps@style|, add in a hook which can be +% To finish off the definition of \cs{ps@style}, add in a hook which can be % defined so that it adds additional code, if required. % \begin{macrocode} - \@nameuse{#1pshook} - } + \@nameuse{#1pshook}}% % \end{macrocode} % The final part of setting up the new pagestyle is defining all the macros -% called by |\ps@style|, and giving them default values. Make the headers +% called by \cs{ps@style}, and giving them default values. Make the headers % and footers empty. % \begin{macrocode} - \makeevenhead{#1}{}{}{} - \makeoddhead{#1}{}{}{} - \makeevenfoot{#1}{}{}{} - \makeoddfoot{#1}{}{}{} + \makeevenhead{#1}{}{}{}% + \makeoddhead{#1}{}{}{}% + \makeevenfoot{#1}{}{}{}% + \makeoddfoot{#1}{}{}{}% % \end{macrocode} -% Make the headers/footers the same width as the |\textwidth|, center +% Make the headers/footers the same width as the \cs{textwidth}, center % them, and ensure % that the rules have zero height so that they will be invisible. % \begin{macrocode} - \makerunningwidth{#1}{\textwidth} - \makeheadposition{#1}{}{}{}{} - \makeheadrule{#1}{\textwidth}{0pt} - \makefootrule{#1}{\textwidth}{\footruleheight}{\footruleskip} + \makerunningwidth{#1}{\textwidth}% + \makeheadposition{#1}{}{}{}{}% + \makeheadrule{#1}{\textwidth}{0pt}% + \makefootrule{#1}{\textwidth}{\footruleheight}{\footruleskip}% % \end{macrocode} % Finally, there is no addtional code needed, so make the hook empty, and % we are done. % \begin{macrocode} - \makepsmarks{#1}{} -} + \makepsmarks{#1}{}} % \end{macrocode} % \end{macro} % % \begin{macro}{\aliaspagestyle} -% The command |\aliaspagestyle{|\meta{aliasl}|}{|\meta{original}|}| +% The command \cs{aliaspagestyle}\marg{alias}\marg{original} % defines the \meta{alias} pagestyle to be an alias for the % \meta{original} pagestyle. % \begin{macrocode} @@ -3723,13 +5182,15 @@ % \end{macro} % % \begin{macro}{\copypagestyle} -% The command |\copypagestyle{|\meta{new}|}{|\meta{original}|}| +% The command \cs{copypagestyle}\marg{new}\marg{original} % defines the \meta{new} pagestyle to be a copy of the % \meta{original} pagestyle. % % It first makes the \meta{new} (empty) pagestyle then defines the internals % in terms of the \meta{original} internals. % \changes{v1.2}{2002/08/10}{Added \cs{copypagestyle}} +% \changes{v1.61803}{2008/01/30}{Added missing elements to \cs{copypagestyle} +% (per Erik Quaeghebeur mempatch v4.9)} % \begin{macrocode} \newcommand{\copypagestyle}[2]{% \makepagestyle{#1}% @@ -3749,12 +5210,19 @@ % \begin{macrocode} \makerunningwidth{#1}{\@nameuse{#2runwidth}}% % \end{macrocode} -% Specify the |\headposition|. +% Specify the \cs{headposition}. % \begin{macrocode} \@namedef{#1evenhpl}{\@nameuse{#2evenhpl}}% \@namedef{#1oddhpl}{\@nameuse{#2oddhpl}}% + \@namedef{#1evenhpr}{\@nameuse{#2evenhpr}}% + \@namedef{#1oddhpr}{\@nameuse{#2oddhpr}}% +% \end{macrocode} +% Specify the feet +% \begin{macrocode} \@namedef{#1evenfpl}{\@nameuse{#2evenfpl}}% \@namedef{#1oddfpl}{\@nameuse{#2oddfpl}}% + \@namedef{#1evenfpr}{\@nameuse{#2evenfpr}}% + \@namedef{#1oddfpr}{\@nameuse{#2oddfpr}}% % \end{macrocode} % Specify the head and foot rules. % \begin{macrocode} @@ -3763,17 +5231,16 @@ % \end{macrocode} % And pick up the hook. % \begin{macrocode} - \makepsmarks{#1}{\@nameuse{#2pshook}}% -} + \makepsmarks{#1}{\@nameuse{#2pshook}}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\ifonlyfloats} -% |\ifonlyfloats|\marg{yes}\marg{no} processes \meta{yes} if the macro is +% \cs{ifonlyfloats}\marg{yes}\marg{no} processes \meta{yes} if the macro is % called on a page consisting only of floats, otherwise \meta{no} is -% processed. |\if@fcolmade| is specified in \file{ltoutput.dtx}. +% processed. \cs{if@fcolmade} is specified in \file{ltoutput.dtx}. % \changes{v1.0}{2001/11/14}{Added \cs{ifonlyfloats}} % \begin{macrocode} \newcommand{\ifonlyfloats}[2]{\if@fcolmade #1\else #2\fi} @@ -3782,7 +5249,7 @@ % \end{macro} % % \begin{macro}{\mergepagefloatstyle} -% |\mergepagefloatstyle|\marg{style}\marg{textstyle}\marg{floatstyle} +% \cs{mergepagefloatstyle}\marg{style}\marg{textstyle}\marg{floatstyle} % makes a new page style \meta{style} that is \meta{textstyle} on normal % pages but uses \meta{floatstyle} on float-only pages. Both \meta{textstyle} % and \meta{floatstyle} must have been previously defined. @@ -3793,28 +5260,29 @@ % Make sure that the two styles have been called, otherwise we get some % undefined errors. % \begin{macrocode} - \@nameuse{ps@#3} \@nameuse{ps@#2} + \@nameuse{ps@#3}\@nameuse{ps@#2}% % \end{macrocode} % Specify the pagestyle's headers and footers. % \begin{macrocode} - \@namedef{ps@#1}{ + \@namedef{ps@#1}{% \def\@evenhead{\ifonlyfloats{\@nameuse{#3@evenhead}}% - {\@nameuse{#2@evenhead}}} + {\@nameuse{#2@evenhead}}}% \def\@oddhead{\ifonlyfloats{\@nameuse{#3@oddhead}}% - {\@nameuse{#2@oddhead}}} + {\@nameuse{#2@oddhead}}}% \def\@evenfoot{\ifonlyfloats{\@nameuse{#3@evenfoot}}% - {\@nameuse{#2@evenfoot}}} + {\@nameuse{#2@evenfoot}}}% \def\@oddfoot{\ifonlyfloats{\@nameuse{#3@oddfoot}}% - {\@nameuse{#2@oddfoot}}} + {\@nameuse{#2@oddfoot}}}% % \end{macrocode} % Set the hook to the \meta{textstyle} on the assumption that that is % more complex that required for a float page. % \begin{macrocode} - \@namedef{#1pshook}{\@nameuse{#2pshook}} + \@namedef{#1pshook}{\@nameuse{#2pshook}}% % \end{macrocode} % That's it. % \begin{macrocode} }} + % \end{macrocode} % \end{macro} % @@ -3824,7 +5292,7 @@ % % \begin{macro}{\ps@empty} % The \pstyle{empty} pagestyle is simple, it's just what we get when -% we call |\makepagestyle|. +% we call \cs{makepagestyle}. % \begin{macrocode} \makepagestyle{empty} @@ -3834,7 +5302,7 @@ % \begin{macro}{\ps@plain} % The \pstyle{plain} pagestyle is also simple, it just puts the % page number at the bottom middle of the page. -% We call |\makepagestyle{plain}| and then adjust as required. +% We call \verb?\makepagestyle{plain}? and then adjust as required. % \begin{macrocode} \makepagestyle{plain} \makeevenfoot{plain}{}{\thepage}{} @@ -3843,11 +5311,170 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\nouppercaseheads} +% \begin{macro}{\uppercaseheads} +% \begin{macro}{\memUChead} +% Spurred by Lars Madsen's \Lpack{memexsupp} v0.5 package here is a +% way of switching uppercasing in the headings pagestyle. +% \changes{v1.61803}{2008/01/30}{Added \cs{(no)uppercaseheads} and +% \cs{memUChead} (mempatch v4.9)} +% \begin{macrocode} +\newcommand*{\nouppercaseheads}{\let\memUChead\relax} +\newcommand*{\uppercaseheads}{\let\memUChead\MakeUppercase} +\uppercaseheads + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% The macros \cs{createplainmark}, \cs{createmark} and \cs{addtopsmarks} +% are modified versions of code supplied by Lars Madsen. +% \changes{v1.61803}{2008/01/30}{Added, and used, \cs{createplainmark}, +% \cs{createmark} and \cs{addtopsmarks}} +% \begin{macro}{\createplainmark} +% \cs{createplainmark}\marg{type}\marg{marks}\marg{text} creates a +% \cs{typemark} (\meta{type} is \texttt{toc}, \texttt{bib}, etc) +% with \meta{marks} (left, both, right) whose contents are \meta{text}. +% For example \verb?\createplainmark{toc}{both}{\contentsname}?. +% \begin{macrocode} +\newcommand*{\createplainmark}[3]{% + \nametest{#2}{left}% + \ifsamename + \@namedef{#1mark}{\markboth{\memUChead{#3}}{}}% + \else + \nametest{#2}{right}% + \ifsamename + \@namedef{#1mark}{\markright{\memUChead{#3}}}% + \else + \nametest{#2}{both}% + \ifsamename\else + \@memerror{% + Unknown mark setting type `#2' for #1mark}{% + I expected `left', `both' or `right'. \MessageBreak + I will assume you meant `both'}% + \fi + \@namedef{#1mark}{\markboth{\memUChead{#3}}{\memUChead{#3}}}% + \fi + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\createmark} +% \cs{createmark}\marg{division}\marg{marks}\mark{show}\marg{prefix}\marg{postfix} +% creates a \cs{divisionmark} with \meta{marks} (= \texttt{left}, \texttt{both} +% or \texttt{right}) controlling which marks are set, +% \meta{show} (= \texttt{shownumber} or \texttt{nonumber}) controls the +% display of the divison number in \cs{mainmatter}, \meta{prefix} is text +% before the number and \meta{postfix} is text after the number. +% \begin{macrocode} +\newcommand\createmark[5]{% +% \end{macrocode} +% Handle \texttt{(show/no)number}, fails to \texttt{shownumber}. +% \begin{macrocode} + \def\@tempa{00} + \nametest{#3}{nonumber}% + \ifsamename + \def\@tempa{01}% + \else + \nametest{#3}{shownumber} + \ifsamename\else + \@memerror{Unknown numbering value `#3' for #1mark}% + {I expected `shownumber' or `nonumber'.\MessageBreak + I will assume you meant `shownumber'}% + \fi + \fi + \expandafter\if\@tempa% compares the two \@tempa digits + \@namedef{#1marksn}##1{##1}% + \else + \@namedef{#1marksn}{\@gobble}% + \fi +% \end{macrocode} +% The three \meta{marks} cases, \texttt{left}, \texttt{both} and +% \texttt{right}; fails to \texttt{both}. +% \begin{macrocode} + \nametest{#2}{left}% + \ifsamename + \@namedef{#1mark}##1{% + \@setclcnt{#1}{@memmarkcntra}% + \advance\c@@memmarkcntra\m@ne + \markboth{% + \memUChead{% + \ifnum \c@secnumdepth > \c@@memmarkcntra + \if@mainmatter + \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}% + \fi + \fi + ##1}}{}}% + \else + \nametest{#2}{right} + \ifsamename + \@namedef{#1mark}##1{% + \@setclcnt{#1}{@memmarkcntra} + \advance\c@@memmarkcntra\m@ne + \markright{% + \memUChead{% + \ifnum \c@secnumdepth > \c@@memmarkcntra + \if@mainmatter% + \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}% + \fi% + \fi% + ##1}}}% + \else + \nametest{#2}{both}% + \ifsamename\else + \@memerror{% + Unknown mark setting type `#2' for #1mark}{% + I expected `left', `both' or `right'. \MessageBreak + I will assume you meant `both'}% + \fi + \@namedef{#1mark}##1{% + \@setclcnt{#1}{@memmarkcntra} + \advance\c@@memmarkcntra\m@ne + \markboth{% + \memUChead{% + \ifnum \c@secnumdepth > \c@@memmarkcntra + \if@mainmatter + \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}% + \fi + \fi + ##1}}{% + \memUChead{% + \ifnum \c@secnumdepth > \c@@memmarkcntra + \if@mainmatter + \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}% + \fi + \fi + ##1}}}% + \fi + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\addtopsmarks} +% \cs{addtopsmarks}\marg{pagestyle}\marg{prepend}\marg{append} inserts +% \meta{prepend} and \meta{append} at the start and end of the current +% definition of \cs{pagestylepshook}. +% \begin{macrocode} +\newcommand\addtopsmarks[3]{% + \expandafter\addtodef\expandafter{\csname #1pshook\endcsname}{#2}{#3}} +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}{\ps@headings} % The \pstyle{headings} pagestyle behaves differently for % twosided and onesided printing. This is a rewrite of the % standard style. % \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@headings}} +% \changes{v1.61803}{2008/01/30}{Used \cs{memUChead} in \cs{ps@headings} +% (mempatch v4.9)} +% \changes{v1.61803}{2008/01/30}{For twosided docs set both marks for ToC, etc. (mempatch v4.9)} +% \changes{v1.61803}{2008/01/30}{Eliminated \cs{@mkboth} as never used +% (mempatch v4.9)} +% \changes{v1.61803}{2008/01/30}{Added \cs{glossarymark} to \cs{ps@headings}} % \begin{macrocode} \if@twoside % \end{macrocode} @@ -3856,26 +5483,38 @@ % \begin{macrocode} \makepagestyle{headings} \makepsmarks{headings}{% - \let\@mkboth\markboth \def\chaptermark##1{% - \markboth{\MakeUppercase{% + \markboth{\memUChead{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter \@chapapp\ \thechapter. \ % \fi \fi ##1}}{}}% - \def\tocmark{\markboth{\MakeUppercase{\contentsname}}{}}% - \def\lofmark{\markboth{\MakeUppercase{\listfigurename}}{}}% - \def\lotmark{\markboth{\MakeUppercase{\listtablename}}{}}% - \def\bibmark{\markboth{\MakeUppercase{\bibname}}{}}% - \def\indexmark{\markboth{\MakeUppercase{\indexname}}{}}% + \def\tocmark{\markboth{\memUChead{\contentsname}}{\memUChead{\contentsname}}}% + \def\lofmark{\markboth{\memUChead{\listfigurename}}{\memUChead{\listfigurename}}}% + \def\lotmark{\markboth{\memUChead{\listtablename}}{\memUChead{\listtablename}}}% + \def\bibmark{\markboth{\memUChead{\bibname}}{\memUChead{\bibname}}}% + \def\indexmark{\markboth{\memUChead{\indexname}}{\memUChead{\indexname}}}% \def\sectionmark##1{% - \markright{\MakeUppercase{% + \markright{\memUChead{% \ifnum \c@secnumdepth > \z@ \thesection. \ % \fi - ##1}}}% + ##1}}}} +% \end{macrocode} +% And here's a version of the above \cs{makepsmarks} using \cs{createmark} and +% \cs{createplainmark}. +% \begin{macrocode} + \makepsmarks{headings}{% + \createmark{chapter}{left}{shownumber}{\@chapapp\ }{. \ } + \createmark{section}{right}{shownumber}{}{. \ } + \createplainmark{toc}{both}{\contentsname} + \createplainmark{lof}{both}{\listfigurename} + \createplainmark{lot}{both}{\listtablename} + \createplainmark{bib}{both}{\bibname} + \createplainmark{index}{both}{\indexname} + \createplainmark{glossary}{both}{\glossaryname} } \makeevenhead{headings}{\thepage}{}{\slshape\leftmark} \makeoddhead{headings}{\slshape\rightmark}{}{\thepage} @@ -3883,24 +5522,35 @@ % \end{macrocode} % For one sided printing even and odd pages are treated the same, % so no need to bother with the evenhead, and -% just the |\rightmark| is used. +% just the \cs{rightmark} is used. % \begin{macrocode} \makepagestyle{headings} \makepsmarks{headings}{% - \let\@mkboth\markboth \def\chaptermark##1{% - \markright{\MakeUppercase{% + \markright{\memUChead{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter \@chapapp\ \thechapter. \ % \fi \fi ##1}}}% - \def\tocmark{\markright{\MakeUppercase{\contentsname}}}% - \def\lofmark{\markright{\MakeUppercase{\listfigurename}}}% - \def\lotmark{\markright{\MakeUppercase{\listtablename}}}% - \def\bibmark{\markright{\MakeUppercase{\bibname}}}% - \def\indexmark{\markright{\MakeUppercase{\indexname}}}% + \def\tocmark{\markright{\memUChead{\contentsname}}}% + \def\lofmark{\markright{\memUChead{\listfigurename}}}% + \def\lotmark{\markright{\memUChead{\listtablename}}}% + \def\bibmark{\markright{\memUChead{\bibname}}}% + \def\indexmark{\markright{\memUChead{\indexname}}}} +% \end{macrocode} +% And here's a version of the above \cs{makepsmarks} using \cs{createmark} and +% \cs{createplainmark}. +% \begin{macrocode} + \makepsmarks{headings}{% + \createmark{chapter}{right}{shownumber}{\@chapapp\ }{. \ } + \createplainmark{toc}{right}{\contentsname} + \createplainmark{lof}{right}{\listfigurename} + \createplainmark{lot}{right}{\listtablename} + \createplainmark{bib}{right}{\bibname} + \createplainmark{index}{right}{\indexname} + \createplainmark{glossary}{right}{\glossaryname} } \makeoddhead{headings}{\slshape\rightmark}{}{\thepage} \fi @@ -3910,7 +5560,7 @@ % % \begin{macro}{\ps@myheadings} % The \pstyle{myheadings} page style is simpler because the user -% has to specify the contents using |\markboth| and |\markright| +% has to specify the contents using \cs{markboth} and \cs{markright} % commands. This is the definition used in the standard classes. % \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@myheadings}} % \begin{verbatim}} @@ -3929,7 +5579,6 @@ % \begin{macrocode} \makepagestyle{myheadings} \makepsmarks{myheadings}{% - \let\@mkboth\@gobbletwo \let\chaptermark\@gobble \let\sectionmark\@gobble \def\tocmark{}% @@ -3937,15 +5586,15 @@ \def\lotmark{}% \def\bibmark{}% \def\indexmark{}% - } + \def\glossarymark{}} \makeevenhead{myheadings}{\thepage}{}{\slshape\leftmark} \makeoddhead{myheadings}{\slshape\rightmark}{}{\thepage} % \end{macrocode} % (Kai von Fintel (\texttt{fintel@mit.edu}) emailed me on 2003/02/24 -% saying that the original |\let\tocmark\@gobble| in the myheadings +% saying that the original \verb?\let\tocmark\@gobble? in the myheadings % pagestyle did nasty things -% to the ToC, etc. Now using |\def\tocmark{}|.) +% to the ToC, etc. Now using \verb?\def\tocmark{}?.) % \end{macro} % % \begin{macro}{\ps@chapter} @@ -3954,7 +5603,7 @@ % The standard classes use the \pstyle{plain} pagestyle for the first page % of a chapter. This class uses the \pstyle{chapter} instead, which is % aliased to \pstyle{plain}. Similarly for parts. -% Further, |\cleardoublepage| uses whatever +% Further, \cs{cleardoublepage} uses whatever % pagestyle is in effect for the empty verso page. I find that this % looks odd if the header contains a chapter name. This class uses % the \pstyle{cleared} pagestyle in this case. I have aliased this @@ -3992,7 +5641,7 @@ % \begin{macrocode} \makepagestyle{ruled} % \end{macrocode} -% There is no need to change the default width (which is the |\textwidth|), +% There is no need to change the default width (which is the \cs{textwidth}), % nor the default positions (centered), % nor to make the footrule visible. We do, though, have to put the page % numbers into the footers. @@ -4000,20 +5649,19 @@ \makeevenfoot{ruled}{\thepage}{}{} \makeoddfoot{ruled}{}{}{\thepage} % \end{macrocode} -% Make the header rule visible and equal to the |\textwidth|. +% Make the header rule visible and equal to the \cs{textwidth}. % \begin{macrocode} \makeheadrule{ruled}{\textwidth}{\normalrulethickness} % \end{macrocode} % % \begin{macro}{\@ruledmarks} -% We have to make sure that the |\chapter| and |\section| commands make +% We have to make sure that the \cs{chapter} and \cs{section} commands make % the appropriate marks for use in the headers. We use the hook for this. % Note that contrary to normal \LaTeX{} practice, the titles are not % automatically upper-cased. The marks for the tocbibinds also need adjusting. % \changes{v1.1}{2002/03/10}{Changed \cs{@ruledmarks} to cater for tocbibind} % \begin{macrocode} \newcommand{\@ruledmarks}{% - \let\@mkboth\markboth \def\chaptermark##1{% \markboth{% \ifnum \c@secnumdepth >\m@ne @@ -4028,7 +5676,21 @@ \def\lotmark{\markboth{\listtablename}{}} \def\bibmark{\markboth{\bibname}{}} \def\indexmark{\markboth{\indexname}{}} + \def\glossarymark{\markboth{\glossaryname}{}} } +% \end{macrocode} +% And here's a version using \cs{createmark} and friends. +% \begin{macrocode} +\renewcommand*{\@ruledmarks}{% + \nouppercaseheads + \createmark{chapter}{left}{shownumber}{}{. \space} + \createmark{section}{right}{shownumber}{}{. \space} + \createplainmark{toc}{both}{\contentsname} + \createplainmark{lof}{both}{\listfigurename} + \createplainmark{lot}{both}{\listtablename} + \createplainmark{bib}{both}{\bibname} + \createplainmark{index}{both}{\indexname} + \createplainmark{glossary}{both}{\glossaryname}} \makepsmarks{ruled}{\@ruledmarks} % \end{macrocode} % \end{macro} @@ -4067,7 +5729,7 @@ % \begin{macro}{\ps@companion} % A \pstyle{companion} pagestyle like the one in the % \textit{\LaTeX{} Companion} series. -% We need the |\headwidth| length for this. +% We need the \cs{headwidth} length for this. % \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@companion}} % \begin{macrocode} \newlength{\headwidth} @@ -4080,7 +5742,6 @@ \makeheadrule{companion}{\headwidth}{\normalrulethickness} \makeheadposition{companion}{flushright}{flushleft}{}{} \makepsmarks{companion}{% - \let\@mkboth\markboth \def\chaptermark##1{\markboth{##1}{##1}} % left mark & right marks \def\sectionmark##1{\markright{% \ifnum \c@secnumdepth>\z@ @@ -4091,8 +5752,21 @@ \def\lofmark{\markboth{\listfigurename}{\listfigurename}} \def\lotmark{\markboth{\listtablename}{\listtablename}} \def\bibmark{\markboth{\bibname}{\bibname}} - \def\indexmark{\markboth{\indexname}{\indexname}} -} + \def\indexmark{\markboth{\indexname}{\indexname}}} +% \end{macrocode} +% And here's a version of the above \cs{makepsmarks} using \cs{createmark} and +% \cs{createplainmark}. +% \begin{macrocode} +\makepsmarks{companion}{% + \nouppercaseheads + \createmark{chapter}{both}{nonumber}{}{} + \createmark{section}{right}{shownumber}{}{. \space} + \createplainmark{toc}{both}{\contentsname} + \createplainmark{lof}{both}{\listfigurename} + \createplainmark{lot}{both}{\listtablename} + \createplainmark{bib}{both}{\bibname} + \createplainmark{index}{both}{\indexname} + \createplainmark{glossary}{both}{\glossaryname}} \makeevenhead{companion}{\normalfont\bfseries\thepage}{}% {\normalfont\bfseries\leftmark} \makeoddhead{companion}{\normalfont\bfseries\rightmark}{}% @@ -4104,7 +5778,7 @@ % % \subsection{Page numbering} % -% The kernel includes the |\pagenumbering| command for setting the +% The kernel includes the \cs{pagenumbering} command for setting the % style (arabic, roman, etc.) of the page numbers, and at the same % time it resets the page counter. I want a version that resets the style % but not the number\footnote{Added to meet a request by Daniel Richard G. @@ -4112,7 +5786,7 @@ % % \begin{macro}{\pagenumbering} % \begin{macro}{\pagenumbering*} -% |\pagenumbering{|\meta{style}|}| is the normal version whereas +% \cs{pagenumbering}\marg{style} is the normal version whereas % the starred version does not reset the counter. % \changes{v1.0}{2001/09/21}{Added \cs{pagenumbering} and \cs{pagenumbering*} } % \begin{macrocode} @@ -4145,7 +5819,7 @@ % % \begin{macro}{\savepagenumber} % \begin{macro}{\restoregenumber} -% |\savepagenumber| saves the current page number and |\restorepagenumber| +% \cs{savepagenumber} saves the current page number and \cs{restorepagenumber} % sets the page number to the stored value. % \changes{v1.0}{2001/09/24}{Added \cs{savepagenumber} and \cs{restorepagenumber}} % \begin{macrocode} @@ -4156,14 +5830,348 @@ % \end{macro} % \end{macro} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% \section{Titles and abstracts} +% \section{Non-traditional spacing} +% \changes{v1.61803}{2008/01/30}{Added non-traditional spacing +% (mempatch v4.6)} % -% \subsection{Titles} +% \subsection{Double spacing} +% +% This is an embedding of the code from the \Lpack{setspace} package, with +% names changed. +% +% \begin{macro}{\setSpacing} +% \cs{setSpacing}\marg{num} effectively increases the \cs{baselineskip} to +% \meta{num}*\cs{baselineskip} +% \begin{macrocode} +\newcommand*{\setSpacing}[1]{% + \def\baselinestretch{#1}% + \@currsize} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setSingleSpace} +% \cs{setSingleSpace}\marg{num} effectively increases the \cs{baselineskip} for +% single spacing to \meta{num}*\cs{baselineskip} (\meta{num} should be +% close to 1.0). +% \begin{macrocode} +\newcommand*{\setSingleSpace}[1]{% + \def\m@m@singlespace{#1}} +\setSingleSpace{1} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SingleSpacing} +% \cs{SingleSpacing} starts single spacing. +% \begin{macrocode} +\newcommand*{\SingleSpacing}{% + \setSpacing{\m@m@singlespace}% + \vskip\baselineskip% correction for coming into single spacing +} +\SingleSpacing + +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\OnehalfSpacing} +% \cs{OnehalfSpacing} starts `one and a half' spacing, which to most +% thesis nitpickers will look like double spacing. +% \begin{macrocode} +\newcommand*{\OnehalfSpacing}{ + \setSpacing{1.25}% default (10pt) + \ifcase \@ptsize \relax % 10pt + \setSpacing{1.25}% + \or% 11pt + \setSpacing{1.213}% + \or% 12pt + \setSpacing{1.241}% + \or\or% 14pt + \setSpacing{1.20}% + \or\or\or% 17pt + \setSpacing{1.16}% + \or\or% 9pt + \setSpacing{1.35}% + \else% the extended sizes + \setSpacing{1.16}% + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DoubleSpacing} +% \cs{DoubleSpacing} starts double spacing, which to most thesis nitpickers +% will look far too spaced out. +% \begin{macrocode} +\newcommand*{\DoubleSpacing}{ + \setSpacing{1.667}% default (10pt) + \ifcase \@ptsize \relax % 10pt + \setSpacing{1.667}% + \or% 11pt + \setSpacing{1.618}% + \or% 12pt + \setSpacing{1.655}% + \or\or% 14pt + \setSpacing{1.60}% + \or\or\or% 17pt + \setSpacing{1.545}% + \or\or% 9pt + \setSpacing{1.8}% + \else% larger sizes + \setSpacing{1.5}% + \fi} + +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@setsize} +% Modify the kernel command. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% check what this does!!!!!!!! +% \begin{macrocode} +\renewcommand*{\@setsize}[4]{% + \@nomath#1% + \let\@currsize#1% + \baselineskip #2% + \baselineskip \baselinestretch\baselineskip + \parskip \baselinestretch\parskip + \setbox\strutbox \hbox{% + \vrule height.7\baselineskip + depth .3\baselineskip + width \z@}% + \skip\footins \baselinestretch\skip\footins + \normalbaselineskip\baselineskip#3#4} + +% \end{macrocode} +% \end{macro} +% +% +% \begin{environment}{SingleSpace} +% Environment form of \cs{SingleSpacing}. +% \begin{macrocode} +\newenvironment{SingleSpace}{% + \vskip\baselineskip + \setSpacing{\m@m@singlespace}% + \vskip -\baselineskip +}{\par} + +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{SingleSpace*} +% Don't use this; it's only here to match the \Lpack{setspace} package. +% \begin{macrocode} +\newenvironment{SingleSpace*}{% +%% \vskip\baselineskip + \setSpacing{\m@m@singlespace}% + \vskip 0.5\baselineskip +}{\vskip -0.5\baselineskip} + +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\m@mrestore@spacing} +% \begin{macrocode} +\newcommand*{\m@mrestore@spacing}{% + \par + \vskip \parskip + \vskip \baselineskip + \endgroup + \vskip -\parskip + \vskip -\baselineskip} + +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{Spacing} +% \verb?\begin{Spacing}{num}? increases the \cs{baselineskip} +% to \verb?num*\baselineskip?. +% \begin{macrocode} +\newenvironment{Spacing}[1]{% + \par + \begingroup + \setSpacing{#1}}{\m@mrestore@spacing} + +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{OnehalfSpace} +% Environment form of \cs{OnehalfSpacing}. +% \begin{macrocode} +\newenvironment{OnehalfSpace}{% + \begingroup + \OnehalfSpacing}{\m@mrestore@spacing} + +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{DoubleSpace} +% Environment form of \cs{DoubleSpacing}. +% \begin{macrocode} +\newenvironment{DoubleSpace}{% + \begingroup + \DoubleSpacing}{\m@mrestore@spacing} + +% \end{macrocode} +% \end{environment} +% +% +% Deal with spacing around displays. +% +% \begin{macro}{\memdskipstretch} +% \begin{macro}{\setDisplayskipStretch} +% \begin{macro}{\noDisplayskipStretch} +% \cs{setDisplayskipStretch}\marg{num} changes space around displays by the +% factor (1+\meta{num}). \cs{noDisplaydkipStretch} keeps the regular +% spacing around displays. +% \begin{macrocode} +\newcommand*{\memdskipstretch}{0.0} +\newcommand*{\setDisplayskipStretch}[1]{% + \renewcommand*{\memdskipstretch}{#1}} +\newcommand*{\noDisplayskipStretch}{\setDisplayskipStretch{0.0}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\memdskips} +% Macro added to the kernel hook \cs{everydisplay}, changing the settings +% of displayskips +% \begin{macrocode} +\newcommand*{\memdskips}{% + \advance\abovedisplayskip \memdskipstretch\abovedisplayskip + \advance\belowdisplayskip \memdskipstretch\belowdisplayskip + \advance\abovedisplayshortskip \memdskipstretch\abovedisplayshortskip + \advance\belowdisplayshortskip \memdskipstretch\belowdisplayshortskip} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\everydisplay} +% \begin{macrocode} +\everydisplay\expandafter{% + \the\everydisplay + \memdskips} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@xfloat} +% Reset \cs{baselinestretch} in floats. +% \begin{macrocode} +\let\m@m@xfloat\@xfloat +\def\@xfloat #1[#2]{% + \m@m@xfloat #1[#2]% + \def\baselinestretch{\m@m@singlespace}% + \normalsize} + +% \end{macrocode} +% \end{macro} +% +% The extra spacing does not add space before and after a minipage. +% The solution, hinted at by Donald Arseneau, is to create a new +% environment. I came up with a solution which DA then much improved upon +% (CTT \textit{setspace and minipages}, 2006/11/28). +% This is like minipage from an author's view, except that it is +% always top positioned and acts like a paragraph. +% \begin{macro}{\memPD} +% \begin{macrocode} +\newdimen\memPD +% \end{macrocode} +% \end{macro} +% \begin{environment}{vminipage} +% The user view, just as for \texttt{minipage}, but ensures the \texttt{t} +% position and as a new paragraph. It is like \texttt{minipage} but with +% better fore and aft spacing. +% \begin{macrocode} +\newenvironment{vminipage}{% + \par + \@ifnextchar[%] + \@ivminipage + {\@iiiminipage t\relax[s]} +}{% + \par\global\memPD=\prevdepth + \endminipage + \par + \kern-\memPD% no pagebreak allowed here + \hbox{\vrule depth \memPD width \z@}} + +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\@ivminipage} +% Deal with first optional argument to \texttt{vminipage}. +% \begin{macrocode} + \def\@ivminipage[#1]{% + \@ifnextchar[%] + {\@iiminipage{t}}{\@iiiminipage{t}\relax[s]}} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Abnormal parskips} +% +% Non-zero, positive \cs{parskip}, which is not to be encouraged. Code +% based on Robin Fairbairns \Lpack{parskip} package and the NTG classes. +% +% \begin{macro}{\ifm@mnzpskip} +% \begin{macro}{\m@mnzpskiptrue} +% \begin{macro}{\m@mnzpskipfalse} +% \cs{ifm@mnzpskip} is TRUE if \cs{parskip} set to anything but 0pt. +% \begin{macrocode} +\newif\ifm@mnzpskip +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\traditionalparskip} +% \begin{macro}{\m@mabparskip} +% \begin{macro}{\abnormalparskip} +% \begin{macro}{\nonzeroparskip} +% \cs{traditionalparskip} sets \cs{parskip} to 0pt. +% \cs{abnormalparskip}\marg{length} sets \cs{parskip} to \meta{length}. +% \cs{nonzeroparskip} sets \cs{parskip} to a non-zero value that might be +% not too bad (any non-zero \cs{parskip} is not good). +% \begin{macrocode} +\newcommand*{\traditionalparskip}{% + \parskip \z@ + \m@mnzpskipfalse} +\newskip\m@mabparskip +\newcommand*{\abnormalparskip}[1]{% + \setlength{\parskip}{#1}\m@mabparskip=#1\relax + \m@mnzpskiptrue} +\newcommand*{\nonzeroparskip}{\abnormalparskip{% + 0.5\baselineskip + \@plus .1\baselineskip \@minus .1\baselineskip% NTG +%% 0.5/baselineskip \@plus 2pt% RF +}} +\traditionalparskip + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\@minpagerestore} +% This needs extending: here's what NTG does, but I've put the +% appropriate code later. +% \begin{verbatim} +% \providecommand*{\@minipagerestore}{% +% \parskip=.5\baselineskip \@plus .1\baselineskip \@minus .1\baselineskip} +% \end{verbatim} +% \end{macro} +% +% \section{Titles} % % For books the title is usually designed specifically for the particular -% work, so originally the class did not provide a |\maketitle| command or -% any of the |\title| and other commands that normally go along with this. +% work, so originally the class did not provide a \cs{maketitle} command or +% any of the \cs{title} and other commands that normally go along with this. % After some thought I decided to add in the code from the % \Lpack{titling} package~\cite{TITLING}. However, in this case life % is a bit simpler as there is no pre-existing class code. @@ -4183,7 +6191,7 @@ % \begin{macro}{\@bspostdate} % To provide some flexibilty in the titling style of the document, % user level commands are provided that can be changed to reconfigure -% the appearance resulting from |\maketitle|. +% the appearance resulting from \cs{maketitle}. % \begin{macrocode} \newcommand{\pretitle}[1]{\def\@bspretitle{#1}} \newcommand{\posttitle}[1]{\def\@bsposttitle{#1}} @@ -4224,7 +6232,7 @@ % \begin{macro}{\maketitlehookb} % \begin{macro}{\maketitlehookc} % \begin{macro}{\maketitlehookd} -% The four hooks which will be called by |\maketitle|. These are initially +% The four hooks which will be called by \cs{maketitle}. These are initially % vacuous. % \begin{macrocode} \newcommand{\maketitlehooka}{} @@ -4276,24 +6284,12 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\thanksfootextra} -% These are for inserting stuff before and after a thanks mark in the -% footnoting. % \changes{v1.2}{2002/08/10}{Deprecated \cs{thanksfootextra}} % \changes{v1.2}{2002/08/10}{Removed \cs{thanksfootpre} and \cs{thanksfootpost}} % \changes{v1.4}{2003/12/14}{Removed \cs{thanksfootextra}} -% \begin{macrocode} -%%%% \newcommand{\thanksfootextra}[2]{% -%%%% \@memwarn{Use \protect\thanksmarkstyle\space instead of -%%%% \protect\thanksfootextra}% -%%%% \def\thanksfootpre{#1}% -%%%% \def\thanksfootpost{#2} - -% \end{macrocode} -% \end{macro} % % \begin{macro}{\thanksmark} -% This adds a thanks mark. The |\footnotemark| could have been used directly +% This adds a thanks mark. The \cs{footnotemark} could have been used directly % but it is fragile in a moving argument. % \begin{macrocode} \DeclareRobustCommand{\thanksmark}[1]{\footnotemark[#1]} @@ -4308,8 +6304,8 @@ % \end{macro} % % \begin{macro}{\tamark} -% This stores the current definition of |\@thefnmark|. For some reason -% using |\@thefnmark| directly only gave the last value. +% This stores the current definition of \cs{@thefnmark}. For some reason +% using \cs{@thefnmark} directly only gave the last value. % \begin{macrocode} \newcommand{\tamark}{\@thefnmark} @@ -4334,8 +6330,8 @@ % % \begin{macro}{\thanksmarkstyle} % \begin{macro}{\thanksscript} -% |\thanksscript| is a wrapper round the actual mark stuff to be typeset. -% The user can define this via |\thanksmarkstyle|\marg{code}. +% \cs{thanksscript} is a wrapper round the actual mark stuff to be typeset. +% The user can define this via \cs{thanksmarkstyle}\marg{code}. % The default is a superscript mark. % \changes{v1.2}{2002/08/10}{Added \cs{thanksmarkstyle}} % \begin{macrocode} @@ -4346,7 +6342,7 @@ % \end{macro} % % \begin{macro}{\makethanksmarkhook} -% A vacuous macro used as a hook into |\makethanksmark|. +% A vacuous macro used as a hook into \cs{makethanksmark}. % \begin{macrocode} \newcommand{\makethanksmarkhook}{} @@ -4401,7 +6397,7 @@ % % \begin{macro}{\usethanksrule} % \begin{macro}{\cancelhanksrule} -% Simple macros that let |\footnoterule| to another rule definition. +% Simple macros that let \cs{footnoterule} to another rule definition. % \begin{macrocode} \newcommand{\usethanksrule}{\let\footnoterule\thanksrule} \newcommand{\cancelthanksrule}{\let\footnoterule\@bsfootnoterule} @@ -4422,7 +6418,7 @@ % \end{macrocode} % \begin{macro}{\thanksrule} % \begin{macro}{\@bsfootnoterule} -% These are saved versions of the |\footnoterule| definition as it +% These are saved versions of the \cs{footnoterule} definition as it % is at the end of the preamble. % \begin{macrocode} \AtBeginDocument{% @@ -4435,7 +6431,7 @@ % \end{macro} % % \begin{macro}{\droptitle} -% A titling block has |\droptitle| amount of additional vertical space +% A titling block has \cs{droptitle} amount of additional vertical space % above it (normally zero). % \begin{macrocode} \newlength{\droptitle} @@ -4446,7 +6442,7 @@ % % \begin{macro}{\maketitle} % The following is a -% modification of |\maketitle| as in the \Lpack{article}, \Lpack{report}, +% modification of \cs{maketitle} as in the \Lpack{article}, \Lpack{report}, % and \Lpack{book} classes. It sets the pagestyle to \pstyle{title}. % \changes{v1.4}{2004/01/21}{Removed the \cs{rlap} from \cs{@makefnmark} % in \cs{maketitle} so multiple \cs{thanks} @@ -4484,7 +6480,7 @@ % \end{macro} % % \begin{macro}{\@mem@titlefootkill} -% |\@mem@titlefootkill|\marg{note} Warn about footnotes in titles. +% \cs{@mem@titlefootkill}\marg{note} Warn about footnotes in titles. % \begin{macrocode} \newcommand*{\@mem@titlefootkill}[1]{% \@memwarn{Do not use \string\footnote\space in @@ -4495,9 +6491,9 @@ % \end{macro} % % \begin{macro}{\@maketitle} -% Our version of |\@maketitle|. -% Footnotes are killed in the title; see the thread `|\title|, |\author| -% and |\footnote| feature in memoir class', February 2003. +% Our version of \cs{@maketitle}. +% Footnotes are killed in the title; see the thread `\cs{title}, \cs{author} +% and \cs{footnote} feature in memoir class', February 2003. % \changes{v1.4}{2003/11/16}{Killed footnote in titles (from patch v1.4)} % \begin{macrocode} \newcommand{\@maketitle}{% @@ -4522,7 +6518,7 @@ % \end{macro} % % \begin{environment}{titlingpage} -% The |titlingpage| environment sets the pagestyle to be \pstyle{titlingpage}, +% 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. @@ -4548,7 +6544,7 @@ % \end{environment} % % \begin{macro}{\emptythanks} -% This macro discards all prior |\thanks| texts. +% This macro discards all prior \cs{thanks} texts. % \begin{macrocode} \newcommand{\emptythanks}{\global\let\@thanks\@empty} @@ -4556,8 +6552,8 @@ % \end{macro} % % \begin{macro}{\andnext} -% The kernel |\and| macro puts space between author's names. The -% |\andnext| macro puts a newline between the names. +% The kernel \cs{and} macro puts space between author's names. The +% \cs{andnext} macro puts a newline between the names. % \changes{v1.6}{2004/01/28}{Added \cs{andnext}} % \begin{macrocode} \newcommand*{\andnext}{% @@ -4567,8 +6563,8 @@ % \end{macro} % % \begin{macro}{\@bsmtitlempty} -% |\@bsmtitlempty| is a helper macro to save some macro space. -% It empties some elements of |\maketitle|. +% \cs{@bsmtitlempty} is a helper macro to save some macro space. +% It empties some elements of \cs{maketitle}. % \begin{macrocode} \newcommand{\@bsmtitlempty}{% \global\let\maketitle\relax @@ -4580,16 +6576,15 @@ \global\let\thanksheadextra\relax \global\let\thanksfootextra\relax \global\let\thanksmark\relax - \global\let\thanksgap\relax -} + \global\let\thanksgap\relax} % \end{macrocode} % \end{macro} % % \begin{macro}{\keepthetitle} % This macro undefines all the titling commands except for -% |\thetitle|, |\theauthor| and |\thedate|. -% \changes{v1.6}{2004/01/28}{Xhanged \cs{keepthetitle} to cater for \cs{andnext}} +% \cs{thetitle}, \cs{theauthor} and \cs{thedate}. +% \changes{v1.6}{2004/01/28}{changed \cs{keepthetitle} to cater for \cs{andnext}} % \begin{macrocode} \newcommand{\keepthetitle}{% \@bsmtitlempty @@ -4599,21 +6594,19 @@ \global\let\@thanks\@empty \global\let\@title\@empty \global\let\@author\@empty - \global\let\@date\@empty -} + \global\let\@date\@empty} % \end{macrocode} % \end{macro} % % \begin{macro}{\killtitle} -% |\killtitle| undefines the remaining macros of |\maketitle|. +% \cs{killtitle} undefines the remaining macros of \cs{maketitle}. % \begin{macrocode} \newcommand{\killtitle}{% \keepthetitle \global\let\thetitle\relax \global\let\theauthor\relax - \global\let\thedate\relax -} + \global\let\thedate\relax} % \end{macrocode} % \end{macro} @@ -4622,10 +6615,10 @@ % \begin{macro}{\thetitle} % \begin{macro}{\theauthor} % \begin{macro}{\thedate} -% In order to make the |\title|, etc., values available for printing +% In order to make the \cs{title}, etc., values available for printing % their definitions (in \file{ltsect.dtx}) need extending to save their % arguments. We have to make sure that extraneous material, -% like |\thanks|, is excluded from the saved texts. +% like \cs{thanks}, is excluded from the saved texts. % \changes{v1.4}{2003/11/16}{Gobble footnotes in \cs{title}, \cs{author} % and \cs{date} (from patch v1.4)} % \changes{v1.6}{2004/01/28}{Added \cs{andnext} handling to \cs{author}} @@ -4662,308 +6655,24 @@ % \end{macro} % \end{macro} % -% \subsection{Abstracts} -% -% Books usually do not have abstracts, but I decided to add in the code -% from the \Lpack{abstract} -% package~\cite{ABSTRACT}. -% \changes{v0.3}{2001/07/09}{Added code for abstracts} -% -% -% We just have the \Lpack{report} or \Lpack{article} style for the -% abstract with no \Lopt{titlepage} option. The original code, -% from \file{classes.dtx} for this is: -% \begin{verbatim} -% \newenvironment{abstract}{% -% \if@twocolumn -% \section*{\abstractname} -% \else -% \small -% \begin{center}% -% {\bfseries \abstractname\vspace{-.5em}\vspace{\z@}}%% -% \end{center}% -% \quotation -% \fi}% -% {\if@twocolumn\else\endquotation\fi} -% \end{verbatim} -% -% -% The following |\if...| commands are for implementing various options. -% \begin{macro}{\if@bsonecol} -% \begin{macro}{\ifadd@bstotoc} -% \begin{macro}{\ifnumber@bs} -% \begin{macro}{\if@bsrunin} -% \begin{macrocode} -\newif\if@bsonecol - \@bsonecoltrue -\newif\ifadd@bstotoc - \add@bstotocfalse -\newif\ifnumber@bs - \number@bsfalse -\newif\if@bsrunin - \@bsruninfalse - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\abstractcol} -% \begin{macro}{\abstractintoc} -% \begin{macro}{\abstractnum} -% \begin{macro}{\abstractrunin} -% These are the use-level commands for setting the options. If -% the abstract is runin, then it must not be numbered otherwise -% adding it to the ToC might result in something peculiar. -% \begin{macrocode} -\newcommand{\abstractcol}{\@bsonecolfalse} -\newcommand{\abstractintoc}{\add@bstotoctrue} -\newcommand{\abstractnum}{\number@bstrue\@bsruninfalse} -\newcommand{\abstractrunin}{\@bsrunintrue\number@bsfalse} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% -% The next set of macros comprise the -% implementation of the |abstract| environment. -% -% \begin{macro}{\abstractnamefont} -% \begin{macro}{\abstracttextfont} -% These two macros are for specifying the fonts for typesetting the -% abstract's title and text. They are initialised for the default case -% (i.e., no class options). -% \begin{macrocode} -\newcommand{\abstractnamefont}{\normalfont\small\bfseries} -\newcommand{\abstracttextfont}{\normalfont\small} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\absnamepos} -% \begin{macro}{\abstitleskip} -% |\absnamepos| specifies the environment in which the abstract's title -% name will be typeset, and the length |\abstitleskip| is an adjustement -% to the vertical space between the title and the abstract's text. These -% are initialised for the default case. -% \begin{macrocode} -\newcommand{\absnamepos}{center} -\newlength{\abstitleskip} \setlength{\abstitleskip}{-0.5em} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\absleftindent} -% \begin{macro}{\abs@leftindent} -% \begin{macro}{\absrightindent} -% \begin{macro}{\absparindent} -% \begin{macro}{\absparsep} -% The abstract's text is typeset as a single item list, called -% |@bstr@ctlist|. These lengths set the left and right margin indents, the -% paragraph indentation, and the inter-paragraph vertical space. Their -% initial values are all class option-dependent. -% \changes{v1.618}{2005/09/03}{Added \cs{abs@leftindent} per Lars Madsen (mempatch v3.0)} -% \begin{macrocode} -\newlength{\absleftindent} -\newdimen\abs@leftindent - \abs@leftindent=\leftmargin -\newlength{\absrightindent} -\newlength{\absparindent} -\newlength{\absparsep} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\abslabeldelim} -% \begin{macro}{\@bslabeldelim} -% The contents of |\abslabeldelim| are typeset after a run-in heading. -% \begin{macrocode} -\newcommand{\abslabeldelim}[1]{\def\@bslabeldelim{#1}} -\abslabeldelim{} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@bsrunintitle} -% This macro typeset the run-in heading. -% \begin{macrocode} -\newcommand{\@bsrunintitle}{% - \hspace*{\abstitleskip}{\abstractnamefont\abstractname\@bslabeldelim}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\setup@bstract} -% Now arrange to set all the class option-dependent values. -% \changes{v1.618}{2005/09/03}{Used \cs{abs@leftindent} in \cs{setup@bstract} (mempatch v3.0)} -% \begin{macrocode} -\newcommand{\setup@bstract}{% - \if@twocolumn -% \end{macrocode} -% Values for the \Lopt{twocolumn} class option. -% \begin{macrocode} - \if@bsonecol - \abs@leftindent=\absleftindent - \else - \abs@leftindent=\z@ - \renewcommand{\abstractnamefont}{\normalfont\Large\bfseries} - \renewcommand{\abstracttextfont}{\normalfont} - \renewcommand{\absnamepos}{flushleft} - \setlength{\abstitleskip}{-2ex} - \fi - \else -% \end{macrocode} -% Values for the default, if not already initialised. -% \begin{macrocode} - \abs@leftindent=\absleftindent - \fi -% \end{macrocode} -% Finally, values that apply for all cases. -% \begin{macrocode} - \setlength{\absrightindent}{\absleftindent} -} - -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -\AtBeginDocument{\setlength{\absparindent}{\parindent} - \setlength{\absparsep}{\parskip}} - -% \end{macrocode} -% -% \begin{environment}{@bstr@ctlist} -% The abstract's text is typeset within the |@bstr@ctlist| list environment. -% \changes{v1.618}{2005/09/03}{Used \cs{abs@leftindent} in \cs{@bstr@ctlist} (mempatch v3.0)} -% \begin{macrocode} -\newenvironment{@bstr@ctlist}{% - \list{}{% - %%\topsep \z@ - \partopsep \z@ - \listparindent \absparindent - \itemindent \listparindent - \leftmargin \abs@leftindent - \rightmargin \absrightindent - \parsep \absparsep}% - \item\relax} - {\endlist} - -% \end{macrocode} -% \end{environment} -% -% \begin{macro}{\put@bsintoc} -% This macro adds the abstract's title to the ToC. It does nothing if -% the abstract is being numbered. -% \begin{macrocode} -\newcommand{\put@bsintoc}{% - \ifadd@bstotoc - \ifnumber@bs\else - \phantomsection - \addcontentsline{toc}{chapter}{\abstractname} - \fi - \fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\num@bs} -% This macro generates a numbered abstract heading. -% \begin{macrocode} -\newcommand{\num@bs}{\chapter{\abstractname}} - -% \end{macrocode} -% \end{macro} -% -% \begin{environment}{abstract} -% At last we are in position to define the |abstract| environment. This -% follows very much along the lines of the standard class definitions, but with -% macros inserted at strategic points. -% -% The \Lopt{twocolumn} option and the default case. These use the same code -% as any style differences are embedded in the new macros. -% \begin{macrocode} -\newenvironment{abstract}{% - \setup@bstract - \if@bsrunin\else - \ifnumber@bs \num@bs \else - \begin{\absnamepos}\abstractnamefont\abstractname\end\absnamepos% - \vspace{\abstitleskip}% - \fi - \fi - \put@bsintoc% - \begin{@bstr@ctlist}\if@bsrunin\@bsrunintitle\fi\abstracttextfont}% - {\par\end{@bstr@ctlist}} - -% \end{macrocode} -% \end{environment} -% -% \begin{environment}{onecolabstract} -% An environment for typesetting a single column abstract, -% particularly as the optional argument to the |\twocolumn| command. -% \begin{macrocode} -\newenvironment{onecolabstract}{% - \begin{@twocolumnfalse}\begin{abstract}}{% - \end{abstract}\end{@twocolumnfalse}} - -% \end{macrocode} -% \end{environment} -% -% \begin{macro}{\thanks} -% \begin{macro}{\@bs@thanks} -% We have to keep the contents of the |\thanks| commands as normally these -% are emptied by the |\maketitle| command. I do this by extending the definition -% of the |\thanks| (from \file{ltsect.dtx}) command, -% so that |\@bs@thanks| has a copy of the contents -% of |\@thanks|. -% \begin{macrocode} -\addtoiargdef{\thanks}{}{% - \protected@xdef\@bs@thanks{\@bs@thanks - \protect\footnotetext[\the\c@footnote]{#1}}% -} -\let\@bs@thanks\@empty - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\saythanks} -% This macro typesets any |\thanks| commands \emph{after} using -% |onecolabstract|. -% \begin{macrocode} -\newcommand{\saythanks}{\begingroup - \renewcommand{\thefootnote}{\fnsymbol{footnote}}\@bs@thanks - \endgroup\global\let\@bs@thanks\@empty} - -% \end{macrocode} -% \end{macro} -% % % % \section{Parts, chapters and other divisions} % % \subsection{Building blocks} The definitions in this part of a -% class file usually make use of two internal macros, |\@startsection| and -% |\secdef|. To understand +% class file usually make use of two internal macros, \cs{@startsection} and +% \cs{secdef}. To understand % what is going on here, we describe their syntax. % % \DescribeMacro{\@startsection} -% The macro |\@startsection| has 6 required arguments, optionally +% The macro \cs{@startsection} has 6 required arguments, optionally % followed by a $*$, an optional argument and a required argument: % -% |\@startsection|\meta{name}\meta{level}\meta{indent}^^A +% \cs{@startsection}\meta{name}\meta{level}\meta{indent}^^A % \meta{beforeskip}\meta{afterskip}\meta{style} -% optional *\\ +% optional * %\\ % \null\hphantom{\bslash @startsection}^^A -% |[|\meta{altheading}|]|\meta{heading} +% \oarg{altheading}\meta{heading} % % It is a generic command to start a section, the arguments have % the following meaning: @@ -4992,14 +6701,14 @@ % be present when the $*$ form is used. % \item[\meta{heading}] The heading of the new section. % \end{description} -% A sectioning command is normally defined to |\@startsection| and +% A sectioning command is normally defined to \cs{@startsection} and % its first six arguments. % % \DescribeMacro{\secdef} -% The macro |\secdef| can be used when a sectioning command is -% defined without using |\@startsection|. It has two arguments: +% The macro \cs{secdef} can be used when a sectioning command is +% defined without using \cs{@startsection}. It has two arguments: % -% |\secdef|\meta{unstarcmds}\meta{starcmds} +% \cs{secdef}\meta{unstarcmds}\meta{starcmds} % % \begin{description} % \item[\meta{unstarcmds}] Used for the normal form of a @@ -5008,7 +6717,7 @@ % sectioning command. % \end{description} % -% You can use |\secdef| as follows: +% You can use \cs{secdef} as follows: % \begin{verbatim} % \def\chapter { ... \secdef \CMDA \CMDB } % \def\CMDA [#1]#2{ ... } % Command to define @@ -5018,23 +6727,23 @@ % \end{verbatim} % % \DescribeMacro{\@hangfrom} -% Internally the |\@startsection| macro uses |\@hangfrom{NUM}|, where -% |NUM| is the sectional number, to produce a hanging paragraph. That is, +% Internally the \cs{@startsection} macro uses \verb?\@hangfrom{NUM}?, where +% \verb?NUM? is the sectional number, to produce a hanging paragraph. That is, % the second and later lines of a multiline title are indented from the % left margin by the width of the number. -% The definition of |\@hangfrom|, from \file{ltsect.dtx}, is: +% The definition of \cs{@hangfrom}, from \file{ltsect.dtx}, is: % \begin{verbatim} % \def\@hangfrom#1{\setbox\@tempboxa\hbox{{#1}}% % \hangindent \wd\@tempboxa\noindent\box\@tempboxa} % \end{verbatim} % % To get a normal paragraphed title you can do: \\ -% |\renewcommand{\@hangfrom}[1]{#1}| \\ +% \verb?\renewcommand{\@hangfrom}[1]{#1}? \\ % or as a block paragraph: \\ -% |\renewcommand{\@hangfrom}[1]{\noindent #1}| \\ +% \verb?\renewcommand{\@hangfrom}[1]{\noindent #1}}? \\ % % \DescribeMacro{\@seccntformat} -% The |\@startsection| macro also uses |\@seccntformat{NUM}| to format +% The \cs{@startsection} macro also uses \verb?\@seccntformat{NUM}? to format % the section number, including the space after it. Its definition, % from \file{ltsect.dtx}, is % \begin{verbatim} @@ -5053,6 +6762,7 @@ % \caption{Document division levels}\label{tab:levels} % \begin{tabular}{lr} \hline % Division & Level \\ \hline +% book & -2 \\ % part & -1 \\ % chapter & 0 \\ % section & 1 \\ @@ -5065,11 +6775,13 @@ % \end{table} % % The values used for the document division levels are the same -% as defined by the standard \LaTeX{} classes and are given in +% as defined by the standard \LaTeX{} classes, with the exception +% of the book division which is a memoir addition, and are given in % Table~\ref{tab:levels}. -% +% \changes{v1.61803}{2008/01/30}{Added book division (from mempatch v4.4)} % \subsection{Mark commands} % +% \begin{macro}{\bookpagemark} % \begin{macro}{\partmark} % \begin{macro}{\chaptermark} % \begin{macro}{\sectionmark} @@ -5077,10 +6789,11 @@ % \begin{macro}{\subsubsectionmark} % \begin{macro}{\paragraphmark} % \begin{macro}{\subparagraphmark} -% The default initialisations of the |\...mark| commands for use in +% The default initialisations of the \cs{...mark} commands for use in % the pagestyles. Most are already defined in the kernel but they are % all noted here. % \begin{macrocode} +\newcommand*{\bookpagemark}[1]{} \newcommand*{\partmark}[1]{} \newcommand*{\chaptermark}[1]{} % \newcommand*{\sectionmark}[1]{} @@ -5097,9 +6810,10 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\bibmark} -% Marks for the bibliography, which may be filled with |\bibname|. +% Marks for the bibliography, which may be filled with \cs{bibname}. % \changes{v1.1}{2002/03/10}{Added \cs{bibmark}} % \begin{macrocode} \newcommand*{\bibmark}{} @@ -5107,7 +6821,7 @@ % \end{macro} % % \begin{macro}{\indexmark} -% Marks for the index, which may be filled with |\indexname|. +% Marks for the index, which may be filled with \cs{indexname}. % \changes{v1.1}{2002/03/10}{Added \cs{indexmark}} % \begin{macrocode} \newcommand*{\indexmark}{} @@ -5135,6 +6849,7 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\c@book} % \begin{macro}{\c@part} % \begin{macro}{\c@chapter} % \begin{macro}{\c@section} @@ -5143,15 +6858,16 @@ % \begin{macro}{\c@paragraph} % \begin{macro}{\c@subparagraph} % These counters are used for the sectioning numbers. The macro\\ -% |\newcounter{|\meta{newctr}|}[|\meta{oldctr}|]|\\ +% \cs{newcounter}\marg{newctr}\oarg{oldctr}\\ % defines\meta{newctr} to be a counter, which is reset to zero when % counter \meta{oldctr} is stepped. Counter \meta{oldctr} must % already be defined. % -% Part and chapter are the top level document divisions. +% Book, part and chapter are the top level document divisions. % \begin{macrocode} -\newcounter{part} -\newcounter{chapter} +\newcounter{book} \setcounter{book}{0} +\newcounter{part} \setcounter{part}{0} +\newcounter{chapter} \setcounter{chapter}{0} % \end{macrocode} % The lower level divisions get reset by higher level divisions. % \begin{macrocode} @@ -5168,7 +6884,9 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % +% \begin{macro}{\thebook} % \begin{macro}{\thepart} % \begin{macro}{\thechapter} % \begin{macro}{\thesection} @@ -5176,36 +6894,37 @@ % \begin{macro}{\thesubsubsection} % \begin{macro}{\theparagraph} % \begin{macro}{\thesubparagraph} -% For any counter \Lcount{CTR}, |\theCTR| is a macro that defines +% For any counter \Lcount{CTR}, \cs{theCTR} is a macro that defines % the printed version of counter \Lcount{CTR}. It is defined in % terms of the following macros: % -% |\arabic{|\Lcount{COUNTER}|}| prints the value of -% \Lcount{COUNTER} as an arabic numeral. +% \cs{arabic}\marg{COUNTER} prints the value of +% \meta{COUNTER} as an arabic numeral. % -% |\roman{|\Lcount{COUNTER}|}| prints the value of -% \Lcount{COUNTER} as a lowercase roman numeral. +% \cs{roman}\marg{COUNTER} prints the value of +% \meta{COUNTER} as a lowercase roman numeral. % -% |\Roman{|\Lcount{COUNTER}|}| prints the value of -% \Lcount{COUNTER} as an uppercase roman numeral. +% \cs{Roman}\marg{COUNTER} prints the value of +% \meta{COUNTER} as an uppercase roman numeral. % -% |\alph{|\Lcount{COUNTER}|}| prints the value of \Lcount{COUNTER} +% \cs{alph}\marg{COUNTER} prints the value of \meta{COUNTER} % as a lowercase letter: $1 =$~a, $2 =$~ b, etc. % -% |\Alph{|\Lcount{COUNTER}|}| prints the value of \Lcount{COUNTER} +% \cs{Alph}\marg{COUNTER} prints the value of \meta{COUNTER} % as an uppercase letter: $1 =$~A, $2 =$~B, etc. % % \begin{macrocode} -\renewcommand{\thepart}{\@Roman\c@part} -\renewcommand{\thechapter}{\@arabic\c@chapter} -\renewcommand{\thesection}{\thechapter.\@arabic\c@section} -\renewcommand{\thesubsection}{% +\renewcommand*{\thebook}{\@Roman\c@book} +\renewcommand*{\thepart}{\@Roman\c@part} +\renewcommand*{\thechapter}{\@arabic\c@chapter} +\renewcommand*{\thesection}{\thechapter.\@arabic\c@section} +\renewcommand*{\thesubsection}{% \thesection.\@arabic\c@subsection} -\renewcommand{\thesubsubsection}{% +\renewcommand*{\thesubsubsection}{% \thesubsection.\@arabic\c@subsubsection} -\renewcommand{\theparagraph}{% +\renewcommand*{\theparagraph}{% \thesubsubsection.\@arabic\c@paragraph} -\renewcommand{\thesubparagraph}{% +\renewcommand*{\thesubparagraph}{% \theparagraph.\@arabic\c@subparagraph} % \end{macrocode} % \end{macro} @@ -5215,10 +6934,11 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\@chapapp} -% |\@chapapp| is initially defined as |\chaptername|. The |\appendix| -% command redfines it as |\appendixname|. +% \cs{@chapapp} is initially defined as \cs{chaptername}. The \cs{appendix} +% command redfines it as \cs{appendixname}. % \begin{macrocode} \newcommand{\@chapapp}{\chaptername} @@ -5228,12 +6948,12 @@ % \subsection{Front, main and back matter} % % These are the three main logical divisions in a book. As noted earlier, -% the boolean |\if@mainmatter| is TRUE iff the main matter is being -% processed. Chapters will be unnumbered when |\if@mainmatter| is FALSE. +% the boolean \cs{if@mainmatter} is TRUE iff the main matter is being +% processed. Chapters will be unnumbered when \cs{if@mainmatter} is FALSE. % % \begin{macro}{\frontmatter} % \begin{macro}{\frontmatter*} -% The |\frontmatter| command starts roman numbering and turns off +% The \cs{frontmatter} command starts roman numbering and turns off % chapter numbering. % It ensures that lower level divisions will not have chapter numbers, % nor will figures or tables. It @@ -5271,12 +6991,12 @@ % % \begin{macro}{\mainmatter} % \begin{macro}{\mainmatter*} -% The |\mainmatter| command starts arabic numbering and turns on chapter numbering. +% The \cs{mainmatter} command starts arabic numbering and turns on chapter numbering. % It sets numbering to the normal state. It % also ensures that the next page will be recto. The starred version does % not change the page numbering. % -% Romano Giannetti suggested that |\mainmatter| (and |\backmatter|) should +% Romano Giannetti suggested that \cs{mainmatter} (and \cs{backmatter}) should % be almost no-ops with the article option. % \changes{v0.3}{2001/07/09}{\cs{mainmatter} switches on section numbering % via the secnumdepth counter} @@ -5285,17 +7005,40 @@ \newcommand{\mainmatter}{% \@ifstar{\@smemmain}{\@memmain}} % \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\@smemmain} +% If \cs{frontmatter} and \cs{mainmatter} are used with the article option, +% then a page numbering / margin problem can occur if the frontmatter ends +% on an odd page --- the first mainmatter next page is odd as well which throws +% puts two odd-margined pages together. +% +% One fix from Morten is to always \cs{cleardoublepage} for twosided articles. +% +% One fix from me is for the ...matter macros to just switch on/off section +% numbering. +% +% Morten's is simpler to implement. +% % \changes{v1.1}{2002/03/10}{Modified \cs{@smemmain} to reset the secnumdepth % counter to maxsecnumdepth} % \changes{v1.4}{2003/11/22}{Included cognizance of article option in \cs{@smemmain} % (from patch v1.7)} +% \changes{v1.61803}{2008/01/30}{Changed timing of \cs{clear[double]page} in +% \cs{@smemmain} (David Wilson, mempatch v4.5)} +% \changes{v1.61803}{2008/01/30}{Changed clear pages in \cs{@smemmain} +% (mempatch v4.9)} % \begin{macrocode} -\newcommand{\@smemmain}{ +\newcommand*{\@smemmain}{% \@mainmattertrue \setcounter{secnumdepth}{\value{maxsecnumdepth}} \ifartopt - \clearpage + \if@twoside + \cleardoublepage + \else + \clearpage + \fi \else \cleardoublepage \counterwithin{figure}{chapter} @@ -5303,6 +7046,7 @@ \fi} % \end{macrocode} % \end{macro} +% % \begin{macro}{\@memmain} % \begin{macrocode} \newcommand{\@memmain}{% @@ -5310,8 +7054,6 @@ % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro}{\backmatter} % This command turns off chapter numbering but leaves the page numbering alone. @@ -5344,15 +7086,235 @@ % \end{macro} % % -% +% \subsection{Book} % -% \subsection{Part} +% This was added at the request of Frederic Connes who said that in +% Frency typography there was often a division above the \cs{part} level. +% +% \begin{macro}{\theHbook} +% \begin{macro}{\toclevel@book} +% These are needed if the \Lpack{hyperref} is used. +% \begin{macrocode} +\newcommand*{\theHbook}{\arabic{book}} +\newcommand*{\toclevel@book}{-2} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\book} +% \begin{macro}{\book*} +% \cs{book}\marg{title} starts a new book division called \meta{title}. +% The actual typesetting of the title is done by \cs{@book} or \cs{@sbook}. +% \changes{v1.61803}{2008/01/30}{Added \cs{book} and its entourage (mempatch v4.4)} +% \begin{macrocode} +\newcommand*{\book}{% + \@setupbook + \secdef\@book\@sbook} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\beforebookskip} +% \begin{macro}{\midbookskip} +% \begin{macro}{\afterbookskip} +% These three macros are the skips before, in the middle, and after the +% Book heading. +% \begin{macrocode} +\newcommand*{\beforebookskip}{\null\vfil} +\newcommand*{\midbookskip}{\par\vskip 2\onelineskip} +\newcommand*{\afterbookskip}{\vfil\newpage} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@setupbook} +% This macro does the work of setting up for the \cs{book} command. +% A single column page, normally recto, with a \pstyle{book} pagestyle is +% started. +% \begin{macrocode} +\newcommand{\@setupbook}{% + \if@openright + \cleardoublepage + \else + \clearpage + \fi + \thispagestyle{book}% + \if@twocolumn + \onecolumn + \@tempswatrue + \else + \@tempswafalse + \fi + \beforebookskip} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\booknamefont} +% \begin{macro}{\booknumfont} +% \begin{macro}{\booktitlefont} +% These three macros specify the fonts for the book name and number, and +% for the book title, respectively. +% \begin{macrocode} +\newcommand*{\booknamefont}{\normalfont\huge\bfseries} +\newcommand*{\booknumfont}{\normalfont\huge\bfseries} +\newcommand*{\booktitlefont}{\normalfont\Huge\bfseries} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} % +% \begin{macro}{\printbookname} +% \begin{macro}{\booknamenum} +% \begin{macro}{\printbooknum} +% \begin{macro}{\printbooktitle} +% Macros to print the various books of a Book heading. +% \begin{macrocode} +\newcommand*{\printbookname}{\booknamefont \bookname} +\newcommand*{\booknamenum}{\space} +\newcommand*{\printbooknum}{\booknumfont \thebook} +\newcommand*{\printbooktitle}[1]{\booktitlefont #1} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % +% \begin{macro}{\membookinfo} +% \begin{macro}{\membookstarinfo} +% \begin{macrocode} +\newcommand{\membookinfo}[3]{} +\newcommand{\membookstarinfo}[1]{} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\@book} +% \cs{@book}\oarg{short}\marg{long} typesets the title of a \cs{book} +% book. There is a number if \cs{secnumdepth} is greater than -3. +% \begin{macrocode} +\long\def\@book[#1]#2{% + \M@gettitle{#1}% + \phantomsection + \ifnum \c@secnumdepth >-3\relax + \refstepcounter{book}% + \addcontentsline{toc}{book}% + {\protect\booknumberline{\thebook}#1}% + \membookinfo{\thebook}{#1}{#2}% + \else + \addcontentsline{toc}{book}{#1}% + \membookinfo{}{#1}{#2}% + \fi +% \end{macrocode} +% Empty the marks, center the title on the page, and set the normal font. +% \begin{macrocode} + \bookpagemark{#1}% + {\centering + \interlinepenalty \@M + \normalfont +% \end{macrocode} +% Print the number, if there is one, then the title below. Macro \cs{@endbook} +% tidies everything up at the end. +% \begin{macrocode} + \ifnum \c@secnumdepth >-3\relax + \printbookname \booknamenum \printbooknum + \midbookskip + \fi + \printbooktitle{#2}\par}% + \@endbook} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@sbook} +% \cs{@sbook}\marg{long} formats the title of a \cs{book*} book. It is +% simpler than \cs{@book} because there is no number to print. +% \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{@sbook}} +% \begin{macrocode} +\long\def\@sbook#1{% + \M@gettitle{#1}% + \phantomsection + \membookstarinfo{#1}% + {\centering + \interlinepenalty \@M + \normalfont + \printbooktitle{#1}\par}% + \@endbook} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifm@mnobooknewpage} +% \begin{macro}{\m@mnobooknewpagetrue} +% \begin{macro}{\m@mnobooknewpagefalse} +% \begin{macro}{\bookblankpage} +% \begin{macro}{\nobookblankpage} +% The declaration \cs{nobookblankpage} prevents \cs{book} from +% outputting a further (blank) page when it finishes. The default is set by +% \cs{bookblankpage}. +% \begin{macrocode} +\newif\ifm@mnobooknewpage + \m@mnobooknewpagefalse +\newcommand*{\bookblankpage}{\m@mnobooknewpagefalse} +\newcommand*{\nobookblankpage}{\m@mnobooknewpagetrue} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@endbook} +% This finishes off both \cs{@book} and \cs{@sbook}. +% Following a \cs{nobookblankpage} nothing is done, otherwise +% (after \cs{bookblankpage}) the current page is flushed, +% and an extra blank page is created if both \Lopt{twoside} and +% \Lopt{openright} are in effect. +% At the end, if necessary, two column mode is switched back on. +% \begin{macrocode} +\def\@endbook{\afterbookskip + \ifm@mnobooknewpage + \else + \if@twoside + \if@openright + \null + \thispagestyle{afterbook}% + \newpage + \fi + \fi + \fi + \if@tempswa + \twocolumn + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ps@book} +% \begin{macro}{\ps@afterbook} +% Pagestyles for the book page and the (blank) page after a book page. +% \begin{macrocode} +\aliaspagestyle{book}{empty} +\aliaspagestyle{afterbook}{empty} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \subsection{Part} % % \begin{macro}{\part} -% |\part{|\meta{title}|}| starts a new Part called \meta{title}. -% The actual typesetting of the title is done by |\@part| or |\@spart|. +% \cs{part}\marg{title} starts a new Part called \meta{title}. +% The actual typesetting of the title is done by \cs{@part} or \cs{@spart}. % \begin{macrocode} \newcommand{\part}{% \@setuppart @@ -5365,9 +7327,10 @@ % \begin{macro}{\afterpartskip} % These three macros are the skips before, in the middle, and after the % Part heading. +% \changes{v1.61803}{2008/01/30}{Changed \cs{midpartskip} (mempatch v4.9)} % \begin{macrocode} \newcommand{\beforepartskip}{\null\vfil} -\newcommand{\midpartskip}{\par\vskip 20pt} +\newcommand{\midpartskip}{\par\vskip 2\onelineskip} \newcommand{\afterpartskip}{\vfil\newpage} % \end{macrocode} @@ -5376,7 +7339,7 @@ % \end{macro} % % \begin{macro}{\@setuppart} -% This macro does the work of setting up for the |\part| command. +% This macro does the work of setting up for the \cs{part} command. % A single column page, normally recto, with a \pstyle{part} pagestyle is started. % \begin{macrocode} \newcommand{\@setuppart}{% @@ -5434,17 +7397,18 @@ % \begin{macro}{\mempartstarinfo} % \verb?\mempartinfo{\thepart}{short}{long}? \\ % \verb?\mempartstarinfo{long}? \\ +% \changes{v1.61803}{2008/01/30}{Made \cs{mempartinfo} long (mempatch v4.9).} % \begin{macrocode} -\newcommand*{\mempartinfo}[3]{} -\newcommand*{\mempartstarinfo}[1]{} +\newcommand{\mempartinfo}[3]{} +\newcommand{\mempartstarinfo}[1]{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@part} -% |\@part{|\meta{short}|]{|\meta{long}|}| typesets the title of a |\part| -% part. There is a number if |\secnumdepth| is greater than -2. +% \cs{@part}\oarg{short}\marg{long} typesets the title of a \cs{part} +% part. There is a number if \cs{secnumdepth} is greater than -2. % \changes{v1.3}{2002/11/14}{Used \cs{partnumberline} in \cs{@part}} % \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{@part}} % \changes{v1.618}{2005/09/03}{Replaced \cs{markboth} by \cs{partmark} @@ -5452,6 +7416,7 @@ % \begin{macrocode} \long\def\@part[#1]#2{% \M@gettitle{#1}% + \phantomsection \ifnum \c@secnumdepth >-2\relax \refstepcounter{part}% \addcontentsline{toc}{part}% @@ -5469,7 +7434,7 @@ \interlinepenalty \@M \normalfont % \end{macrocode} -% Print the number, if there is one, then the title below. Macro |\@endpart| +% Print the number, if there is one, then the title below. Macro \cs{@endpart} % tidies everything up at the end. % \begin{macrocode} \ifnum \c@secnumdepth >-2\relax @@ -5483,12 +7448,13 @@ % \end{macro} % % \begin{macro}{\@spart} -% |\@spart{|\meta{long}|}| formats the title of a |\part*| part. It is -% simpler than |\@part| because there is no number to print. +% \cs{@spart}\marg{long} formats the title of a \cs{part*} part. It is +% simpler than \cs{@part} because there is no number to print. % \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{@spart}} % \begin{macrocode} -\def\@spart#1{% +\long\def\@spart#1{% \M@gettitle{#1}% + \phantomsection \mempartstarinfo{#1}% {\centering \interlinepenalty \@M @@ -5499,21 +7465,51 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\ifm@mnopartnewpage} +% \begin{macro}{\m@mnopartnewpagetrue} +% \begin{macro}{\m@mnopartnewpagefalse} +% \begin{macro}{\partblankpage} +% \begin{macro}{\nopartblankpage} +% The declaration \cs{nopartblankpage} prevents \cs{part} from +% outputting a blank page when it finishes. The default is set by +% \cs{partblankpage}. This code was originally supplied by Frederic Connes. +% \changes{v1.61803}{2008/01/30}{Added \cs{partblankpage} and +% \cs{nopartblankpage} (mempatch v v4.4).} +% \begin{macrocode} +\newif\ifm@mnopartnewpage + \m@mnopartnewpagefalse +\newcommand*{\partblankpage}{\m@mnopartnewpagefalse} +\newcommand*{\nopartblankpage}{\m@mnopartnewpagetrue} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\@endpart} -% This finishes off both |\@part| and |\@spart|. The current page is flushed. +% This finishes off both \cs{@part} and \cs{@spart}. +% Following a \cs{nopartblankpage} nothing is done, otherwise +% (after \cs{partblankpage}) the current page is flushed. % In the standard \Lpack{book} class if % two-sided mode is on a blank page is then produced. I think that this looks % odd when the \Lopt{openany} option is in force, so here it only produces % an extra blank page if both \Lopt{twoside} and \Lopt{openright} are -% in effect. If necessary, two -% column mode is switched back on. +% in effect. +% +% At the end, if necessary, two column mode is switched back on. +% \changes{v1.61803}{2008/01/30}{Used the afterpart pagestyle in \cs{@endpart}} % \begin{macrocode} \def\@endpart{\afterpartskip - \if@twoside - \if@openright - \null - \thispagestyle{empty}% - \newpage + \ifm@mnopartnewpage + \else + \if@twoside + \if@openright + \null + \thispagestyle{afterpart}% + \newpage + \fi \fi \fi \if@tempswa @@ -5523,6 +7519,15 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\ps@afterpart} +% Pagestyle for the (blank) page after a part page. +% \changes{v1.61803}{2008/01/30}{Added afterpart pagestyle (mempatch v4.4)} +% \begin{macrocode} +\aliaspagestyle{afterpart}{empty} + +% \end{macrocode} +% \end{macro} +% % \subsection{Chapter} % % \begin{macro}{\chapter} @@ -5575,12 +7580,12 @@ % \begin{macro}{\memappchapstarinfo} % \verb?\memchapinfo{num}{toc}{head}{full}? \\ % \verb?\memchapstarinfo{short}{full}? -% \changes{v1.618}{2005/09/06}{Added \cs{memchapterinfo}} +% \changes{v1.618}{2005/09/06}{Added \cs{memchapinfo}} % \begin{macrocode} -\newcommand*{\memchapinfo}[4]{} -\newcommand*{\memchapstarinfo}[2]{} -\newcommand*{\memappchapinfo}[4]{} -\newcommand*{\memappchapstarinfo}[2]{} +\newcommand{\memchapinfo}[4]{} +\newcommand{\memchapstarinfo}[2]{} +\newcommand{\memappchapinfo}[4]{} +\newcommand{\memappchapstarinfo}[2]{} % \end{macrocode} % \end{macro} @@ -5588,9 +7593,34 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\ifm@mpn@new@chap} +% \begin{macro}{\m@mpn@new@chapfalse} +% \begin{macro}{\m@mpn@new@chaptrue} +% \begin{macro}{\ifm@mpn@new@schap} +% \begin{macro}{\m@mpn@new@schapfalse} +% \begin{macro}{\m@mpn@new@schaptrue} +% These are for supporting the [age/end notes, flagging that a +% \verb?\chapter(*)? has been called. +% \changes{v1.61803}{2008/01/30}{Added \cs{ifm@mpn@new@chap} and +% \cs{ifm@mpn@new@chap} (mempatch v4.5)} +% \begin{macrocode} +\newif\ifm@mpn@new@chap + \m@mpn@new@chapfalse +\newif\ifm@mpn@new@schap + \m@mpn@new@schapfalse + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\@chapter} % \begin{macro}{\f@rtoc} % \begin{macro}{\f@rhdr} +% \begin{macro}{\f@rbody} % \cs{@chapter}\oarg{tocmark}\marg{title} % typesets the title of a \cs{chapter}. % There is a number if \cs{secnumdepth} is greater than -1 and \cs{@mainmatter} @@ -5599,8 +7629,12 @@ % \changes{v1.2}{2002/07/27}{Complete rewrite of \cs{@chapter}} % \changes{v1.3}{2002/11/14}{Changed \cs{numberline} to \cs{chapternumberline} % in \cs{@chapter}} +% \changes{v1.61803}{2008/01/30}{Added \cs{f@rbody} to \cs{@chapter}, +% plus newchapter flag (mempatch v4.5)} % \begin{macrocode} \def\@chapter[#1]#2{% + \m@mpn@new@chaptrue + \def\f@rbdy{#2}% \ifx\ch@pt@c\@empty % no optional args \def\f@rtoc{#2}% \def\f@rhdr{#2}% @@ -5622,16 +7656,20 @@ \refstepcounter{chapter}% \fi % \end{macrocode} -% Store the (short) title via |\chaptermark|, and add some whitespace to -% the LoF and LoT. Then fiddle when we are using two columns, calling -% |\@makechapterhead| to do the typesetting. -% \changes{v0.3}{2001/07/09}{Changed \cs{@chapter} for article option} +% Deal with the \Lopt{article} option. % \begin{macrocode} - \chaptermark{\f@rhdr} \ifartopt \@makechapterhead{#2}% \@afterheading + \chaptermark{\f@rhdr}% \else +% \end{macrocode} +% Store the (short) title via \cs{chaptermark}, and add some whitespace to +% the LoF and LoT. Then fiddle when we are using two columns, calling +% \cs{@makechapterhead} to do the typesetting. +% \changes{v0.3}{2001/07/09}{Changed \cs{@chapter} for article option} +% \begin{macrocode} + \chaptermark{\f@rhdr} \insertchapterspace \if@twocolumn \@topnewpage[\@makechapterhead{#2}]% @@ -5643,7 +7681,7 @@ % \end{macrocode} % Vittorio De Martino (\texttt{demartino.vittoria@grtn.it}) on % 31 March 2003 reported that for articled chapters, which do not do -% any |\clearpage|, |\addcontents| had to come after the title. +% any \cs{clearpage}, \cs{addcontents} had to come after the title. % \changes{v1.4}{2003/11/16}{Changed \cs{@chapter} to match patches v1.n} % \begin{macrocode} \ifm@m@And @@ -5668,18 +7706,18 @@ % Add hook for title referencing. % \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{@chapter}} % \begin{macrocode} - \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{\f@rtoc}\fi -} + \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{\f@rtoc}\fi} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % % \begin{macro}{\@makechapterhead} % This \emph{really} typesets a \cs{chapter}. Leave some whitespace and prepare to -% set |\raggedright|. +% set \cs{raggedright}. % \changes{v1.3}{2002/10/10}{Added \cs{printchapternonum} to % \cs{@makechapterhead}} % \begin{macrocode} @@ -5687,7 +7725,7 @@ \chapterheadstart% \vspace*{50\p@}% {\parindent \z@ \raggedright \normalfont % \end{macrocode} -% If there is a number, typeset it, otherwise call |\printchapternonum|.. +% If there is a number, typeset it, otherwise call \cs{printchapternonum}. % \begin{macrocode} \ifm@m@And \printchaptername \chapternamenum \printchapternum @@ -5711,20 +7749,33 @@ % The macro \cs{insertchapterspace} performs the insertion. % \changes{v0.33}{2001/08/31}{Added \cs{insertchapterspace}} % \begin{macrocode} -\newcommand{\insertchapterspace}{% +\newcommand*{\insertchapterspace}{% \addtocontents{lof}{\protect\addvspace{10pt}}% - \addtocontents{lot}{\protect\addvspace{10pt}}% -} + \addtocontents{lot}{\protect\addvspace{10pt}}} % \end{macrocode} % \end{macro} % +% \begin{macro}{\beforechapskip} +% \begin{macro}{\midchapskip} +% \begin{macro}{\afterchapskip} +% Lengths separating the various parts of a chapter heading. +% \begin{macrocode} +\newlength{\beforechapskip}\setlength{\beforechapskip}{50pt} +\newlength{\midchapskip}\setlength{\midchapskip}{20pt} +\newlength{\afterchapskip}\setlength{\afterchapskip}{40pt} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} % % % \begin{macro}{\@chs@def@ult} -% This sets up all the definitions used in \cs{@makechapterhead} +% This sets up all the definitions and defaults used in \cs{@makechapterhead} % and \cs{@makeschapterhead}. % \changes{v1.3}{2002/10/10}{Added \cs{printchapternonum} to \cs{@chs@def@ult}} +% \changes{v1.61803}{2008/01/30}{Made \cs{@chs@def@ult} set all default chapter values} % \begin{macro}{\chapterheadstart} % \begin{macro}{\printchaptername} % \begin{macro}{\chapternamenum} @@ -5736,16 +7787,14 @@ % \begin{macro}{\afterchaptertitle} % \begin{macrocode} \newcommand{\@chs@def@ult}{% - \def\chapterheadstart{\vspace*{\beforechapskip}} - \def\printchaptername{\chapnamefont \@chapapp} - \def\chapternamenum{\space} - \def\printchapternum{\chapnumfont \thechapter} - \def\afterchapternum{\par\nobreak\vskip \midchapskip} - \def\printchapternonum{} - \def\printchaptertitle##1{\chaptitlefont ##1} - \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip} -} - + \def\chapterheadstart{\vspace*{\beforechapskip}}% + \def\printchaptername{\chapnamefont \@chapapp}% + \def\chapternamenum{\space}% + \def\printchapternum{\chapnumfont \thechapter}% + \def\afterchapternum{\par\nobreak\vskip \midchapskip}% + \def\printchapternonum{}% + \def\printchaptertitle##1{\chaptitlefont ##1}% + \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}% % \end{macrocode} % \end{macro} % \end{macro} @@ -5755,37 +7804,26 @@ % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} -% % % \begin{macro}{\chapnamefont} % \begin{macro}{\chapnumfont} % \begin{macro}{\chaptitlefont} -% Fonts for setting the chapter number, name (e.g., Chapter) and title. +% Fonts for setting chapter name, number, and title. % \begin{macrocode} -\newcommand{\chapnamefont}{\normalfont\huge\bfseries} -\newcommand{\chapnumfont}{\normalfont\huge\bfseries} -\newcommand{\chaptitlefont}{\normalfont\Huge\bfseries} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\beforechapskip} -% \begin{macro}{\midchapskip} -% \begin{macro}{\afterchapskip} -% Lengths separating the various parts of a chapter heading. -% \begin{macrocode} -\newlength{\beforechapskip}\setlength{\beforechapskip}{50pt} -\newlength{\midchapskip}\setlength{\midchapskip}{20pt} -\newlength{\afterchapskip}\setlength{\afterchapskip}{40pt} + \def\chapnamefont{\normalfont\huge\bfseries}% + \def\chapnumfont{\normalfont\huge\bfseries}% + \def\chaptitlefont{\normalfont\Huge\bfseries}% + \setlength{\beforechapskip}{50pt}% + \setlength{\midchapskip}{20pt}% + \setlength{\afterchapskip}{40pt}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % +% % % \begin{macro}{\@m@mschapter} % This deals with the new optional argument for starred chapters. @@ -5794,7 +7832,7 @@ \@schapter{#2}% \ifx \@empty#1 \def\f@rhdr{#2}% - \else % opt arg + \else% opt arg \def\f@rhdr{#1}% \setcounter{secnumdepth}{-10}% \chaptermark{#1}% @@ -5804,35 +7842,40 @@ \memappchapstarinfo{\f@rhdr}{#2}% \else \memchapstarinfo{\f@rhdr}{#2}% - \fi} + \fi + \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{#2}\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@schapter} +% \begin{macro}{\f@rbdy} % \cs{@schapter}\marg{long} typesets the title of a % \cs{chapter*}. It is easier than the \cs{@chapter} as there is no number % to worry about. % \changes{v0.3}{2001/07/09}{Changed \cs{@schapter} for article option} % \changes{v1.2}{2002/07/27}{Major rewrite of \cs{@schapter}} % \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{@schapter}} +% \changes{v1.61803}{2008/01/30}{Changed \cs{@schapter} like +% \cs{@chapter} (mempatch v4.5)} % \begin{macrocode} \newcommand{\@schapter}[1]{% + \m@mpn@new@schaptrue + \def\f@rbdy{#1}% \ifartopt \@makeschapterhead{#1}% - \@afterheading \else \if@twocolumn \@topnewpage[\@makeschapterhead{#1}]% \else \@makeschapterhead{#1}% \fi - \@afterheading \fi - \M@gettitle{#1}} + \@afterheading} % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\@makeschapterhead} % This \emph{really} typesets a \cs{chapter*}, and is similar to \cs{@makechapterhead}. @@ -5844,9 +7887,8 @@ {\parindent \z@ \raggedright \normalfont \printchapternonum \interlinepenalty\@M - \printchaptertitle{#1} - \afterchaptertitle - } + \printchaptertitle{#1}% + \afterchaptertitle}% } % \end{macrocode} @@ -5877,15 +7919,23 @@ % % Set the \pstyle{default} chapter style. % \changes{v0.2}{2001/06/03}{Added code when making the default chapterstyle} -% \begin{macrocode} -\makechapterstyle{default}{% - \renewcommand{\chapnamefont}{\normalfont\huge\bfseries} - \renewcommand{\chapnumfont}{\normalfont\huge\bfseries} - \renewcommand{\chaptitlefont}{\normalfont\Huge\bfseries} - \setlength{\beforechapskip}{50pt} - \setlength{\midchapskip}{20pt} - \setlength{\afterchapskip}{40pt} -} +% \changes{v1.61803}{2008/01/30}{Simplified specification of the default chapterstyle} +% \begin{macrocode} +\makechapterstyle{default}{}% +%% \setlength{\beforechapskip}{50pt} +%% \def\chapterheadstart{\vspace*{\beforechapskip}} +%% \def\chapnamefont{\normalfont\huge\bfseries} +%% \def\printchaptername{\chapnamefont \@chapapp} +%% \def\chapternamenum{\space} +%% \def\chapnumfont{\normalfont\huge\bfseries} +%% \def\printchapternum{\chapnumfont \thechapter} +%% \setlength{\midchapskip}{20pt} +%% \def\afterchapternum{\par\nobreak\vskip \midchapskip} +%% \def\printchapternonum{} +%% \def\chaptitlefont{\normalfont\Huge\bfseries} +%% \def\printchaptertitle##1{\chaptitlefont ##1} +%% \setlength{\afterchapskip}{40pt} +%% \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}} \chapterstyle{default} % \end{macrocode} @@ -5893,15 +7943,16 @@ % \begin{macro}{\chs@section} % The \pstyle{section} chapter style. It prints the heading as though it % were a section. -% \changes{v1.0a}{2002/01/18}{Made \cs{chapnumfont} change in section chapterstyle explicit} +% \changes{v1.0a}{2002/01/18}{Made \cs{chapnumfont} change in section +% chapterstyle explicit} % \begin{macrocode} \makechapterstyle{section}{% + \chapterstyle{default} \renewcommand{\printchaptername}{} \renewcommand{\chapternamenum}{} \renewcommand{\chapnumfont}{\normalfont\Huge\bfseries} \renewcommand{\printchapternum}{\chapnumfont \thechapter\space} - \renewcommand{\afterchapternum}{} -} + \renewcommand{\afterchapternum}{}} % \end{macrocode} % \end{macro} @@ -5915,16 +7966,51 @@ % (from patch v1.7)} % \begin{macrocode} \makechapterstyle{article}{% - \renewcommand{\chapterheadstart}{\vspace{\beforechapskip}} + \chapterstyle{default} \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex} + \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}} \setlength{\afterchapskip}{2.3ex \@plus .2ex} \renewcommand{\printchaptername}{} \renewcommand{\chapternamenum}{} \renewcommand{\chaptitlefont}{\normalfont\Large\bfseries} - \renewcommand{\chapnumfont}{\normalfont\Large\bfseries} + \renewcommand{\chapnumfont}{\chaptitlefont} \renewcommand{\printchapternum}{\chapnumfont \thechapter\quad} - \renewcommand{\afterchapternum}{} -} + \renewcommand{\afterchapternum}{}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@reparticle} +% The \pstyle{reparticle} chapter style. It replicates the appearance +% of a \cs{section} in an \Lpack{article} class document. +% \changes{v1.61803}{2008/01/30}{Added reparticle chapterstyle (mempatch v4.3)} +% \begin{macrocode} +\makechapterstyle{reparticle}{% + \chapterstyle{default} + \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex} + \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}} + \setlength{\afterchapskip}{2.3ex \@plus .2ex} + \renewcommand*{\printchaptername}{} + \renewcommand*{\chapternamenum}{} + \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries} + \renewcommand*{\chapnumfont}{\chaptitlefont} + \renewcommand*{\printchapternum}{\@hangfrom{\chapnumfont \thechapter\quad}}% + \renewcommand*{\afterchapternum}{}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\reparticle} +% Call this to get division heads to replicate the \Lopt{article} class. +% For example: \\ +% \verb?\ifartopt \reparticle \fi? \\ +% The \cs{chapter} commands must still be used, though. +% \changes{v1.61803}{2008/01/30}{Added \cs{reparticle} (mempatch v4.3)} +% \begin{macrocode} +\newcommand*{\reparticle}{% + \chapterstyle{reparticle} + \setsecheadstyle{\normalfont\large\bfseries\raggedright} + \setsubsecheadstyle{\normalfont\bfseries\raggedright}} % \end{macrocode} % \end{macro} @@ -5933,14 +8019,14 @@ % The \pstyle{hangnum} style puts the chapter number in the margin. % \begin{macrocode} \makechapterstyle{hangnum}{% - \renewcommand{\chapnumfont}{\chaptitlefont} + \chapterstyle{default} + \renewcommand*{\chapnumfont}{\chaptitlefont} \settowidth{\chapindent}{\chapnumfont 999} - \renewcommand{\printchaptername}{} - \renewcommand{\chapternamenum}{} - \renewcommand{\printchapternum}{% + \renewcommand*{\printchaptername}{} + \renewcommand*{\chapternamenum}{} + \renewcommand*{\printchapternum}{% \noindent\llap{\makebox[\chapindent][l]{\chapnumfont \thechapter}}} - \renewcommand{\afterchapternum}{} -} + \renewcommand*{\afterchapternum}{}} % \end{macrocode} % \end{macro} @@ -5948,7 +8034,7 @@ % \begin{macro}{\chapindent} % \begin{macro}{\chs@companion} % The \pstyle{companion} style is like that in the \textit{\LaTeX{} Companion} -% series. It requires the |\chapindent| length. The user needs +% series. It requires the \cs{chapindent} length. The user needs % to be careful to have a wide enough spine margin on verso pages % if the title may appear on a verso page. % \changes{v0.31}{2001/07/24}{Changed adjustwidth* to adjustwidth in companion chapterstyle} @@ -5956,16 +8042,16 @@ \newlength{\chapindent} \makechapterstyle{companion}{% - \renewcommand{\chapnamefont}{\normalfont\LARGE\scshape} - \renewcommand{\printchaptername}{\raggedleft\chapnamefont \@chapapp} - \renewcommand{\chapnumfont}{\normalfont\Huge} + \chapterstyle{default} + \renewcommand*{\chapnamefont}{\normalfont\LARGE\scshape} + \renewcommand*{\printchaptername}{\raggedleft\chapnamefont \@chapapp} + \renewcommand*{\chapnumfont}{\normalfont\Huge} \setlength{\chapindent}{\marginparsep} \addtolength{\chapindent}{\marginparwidth} - \renewcommand{\printchaptertitle}[1]{% + \renewcommand*{\printchaptertitle}[1]{% \begin{adjustwidth}{}{-\chapindent} \raggedleft \chaptitlefont ##1\par\nobreak - \end{adjustwidth}} -} + \end{adjustwidth}}} % \end{macrocode} % \end{macro} @@ -5974,19 +8060,533 @@ % \begin{macro}{\chs@demo} % An exotic chapter style for demonstration purposes. % \begin{macrocode} -\makechapterstyle{demo}{ - \renewcommand{\printchaptername}{\centering} - \renewcommand{\printchapternum}{\chapnumfont \numtoName{\c@chapter}} - \renewcommand{\chaptitlefont}{\normalfont\Huge\sffamily} - \renewcommand{\printchaptertitle}[1]{% +\makechapterstyle{demo}{% + \chapterstyle{default} + \renewcommand*{\printchaptername}{\centering} + \renewcommand*{\printchapternum}{\chapnumfont \numtoName{\c@chapter}} + \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily} + \renewcommand*{\printchaptertitle}[1]{% \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1} - \renewcommand{\afterchaptertitle}% - {\vskip\onelineskip \hrule\vskip \afterchapskip} -} + \renewcommand*{\afterchaptertitle}% + {\vskip\onelineskip \hrule\vskip \afterchapskip}} + +% \end{macrocode} +% \end{macro} +% +% \changes{v1.61803}{2008/01/30}{Added chapterstyles: bianchi, bringhurst, +% brotherton, chappel, culver, dash, demo2, ell, Ger, +% lyhne, madsen, pedersen, southall, thatcher, veelo, +% verville, demo3 (mempatch v4.6)} +% \begin{macro}{\chs@bianchi} +% Posted to CTT on 2003/12/09, \textit{New chapter style: chapter vs chapter*} +% by Stefano Bianchi. +% \begin{macrocode} +\makechapterstyle{bianchi}{% + \chapterstyle{default} + \renewcommand*{\chapnamefont}{\normalfont\Large\sffamily\itshape} + \renewcommand*{\chapnumfont}{\normalfont\huge} + \renewcommand*{\printchaptername}{% + \chapnamefont\centering\@chapapp} + \renewcommand*{\printchapternum}{\chapnumfont \textit{\thechapter}} + \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily} + \renewcommand*{\printchaptertitle}[1]{% + \hrule\vskip\onelineskip \centering \chaptitlefont\textbf{##1}\par} + \renewcommand*{\afterchaptertitle}{\vskip\onelineskip \hrule\vskip + \afterchapskip} + \renewcommand*{\printchapternonum}{% + \vphantom{\chapnumfont \textit{9}}\afterchapternum}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@bringhurst} +% My bringhurst style. +% \begin{macrocode} +\makechapterstyle{bringhurst}{% + \chapterstyle{default} + \renewcommand*{\chapterheadstart}{} + \renewcommand*{\printchaptername}{} + \renewcommand*{\chapternamenum}{} + \renewcommand*{\printchapternum}{} + \renewcommand*{\afterchapternum}{} + \renewcommand*{\printchaptertitle}[1]{% + \raggedright\Large\scshape\MakeLowercase{##1}} + \renewcommand*{\afterchaptertitle}{% + \vskip\onelineskip \hrule\vskip\onelineskip}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@brotherton} +% An extremely simple chapterstyle created by William Adams for Mike +% Brotherton's science fiction novel \textit{Star Dragon}, posted to CTT +% 2006/12/09, \textit{An example of a novel?}. +% \begin{macrocode} +\makechapterstyle{brotherton}{% + \chapterstyle{default} + \renewcommand*{\printchapternum}{\chapnumfont + \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@chappell} +% My Chappell style +% \begin{macrocode} +\makechapterstyle{chappell}{% + \chapterstyle{default} + \setlength{\beforechapskip}{0pt} + \renewcommand*{\chapnamefont}{\large\centering} + \renewcommand*{\chapnumfont}{\large} + \renewcommand*{\printchapternonum}{% + \vphantom{\printchaptername \chapnumfont 1} + \afterchapternum + \vskip \onelineskip \vskip -\topskip} + \renewcommand*{\chaptitlefont}{\Large\itshape} + \renewcommand*{\printchaptertitle}[1]{% + \hrule\vskip\onelineskip \centering\chaptitlefont ##1}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@culver} +% By me in an answer to Christopher Culver on CTT, +% \textit{"Biblical" formatting, how?} on 2004/03/29,where I called it +% the `biblical' style. +% \begin{macrocode} +\makechapterstyle{culver}{% + \chapterstyle{default} + \chapterstyle{article}% + \renewcommand*{\thechapter}{\Roman{chapter}} + \renewcommand*{\printchapternum}{% center number/title + \centering\chapnumfont \thechapter\space\space}% + \renewcommand*{\printchapternonum}{\centering} + \renewcommand*{\clearforchapter}{}% no new page + \aliaspagestyle{chapter}{headings}}% no special pagestyle + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@dash} +% A very simple style of mine but I couldn't think of a good name for it. +% \begin{macrocode} +\makechapterstyle{dash}{% + \chapterstyle{default} + \setlength{\beforechapskip}{5\onelineskip} + \renewcommand*{\printchaptername}{} + \renewcommand*{\chapternamenum}{} + \renewcommand*{\chapnumfont}{\normalfont\large} + \settoheight{\midchapskip}{\chapnumfont 1} + \renewcommand*{\printchapternum}{\centering \chapnumfont + \rule[0.5\midchapskip]{1em}{0.4pt} \thechapter\ + \rule[0.5\midchapskip]{1em}{0.4pt}} + \renewcommand*{\afterchapternum}{\par\nobreak\vskip 0.5\onelineskip} + \renewcommand*{\printchapternonum}{\centering + \vphantom{\chapnumfont 1}\afterchapternum} + \renewcommand*{\chaptitlefont}{\normalfont\Large} + \renewcommand*{\printchaptertitle}[1]{\centering \chaptitlefont ##1} + \setlength{\afterchapskip}{2.5\onelineskip}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@demo2} +% My second version of the demo chapterstyle. +% \begin{macrocode} +\makechapterstyle{demo2}{% + \chapterstyle{default} + \renewcommand*{\printchaptername}{\centering} + \renewcommand*{\printchapternum}{\chapnumfont + \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi} + \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily} + \renewcommand*{\printchaptertitle}[1]{% + \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1} + \renewcommand*{\afterchaptertitle}{% + \vskip\onelineskip \hrule\vskip \afterchapskip} + \setlength{\beforechapskip}{3\baselineskip} + \renewcommand*{\printchapternonum}{% + \vphantom{\chapnumfont One} + \afterchapternum% + \vskip\topskip} + \setlength{\beforechapskip}{2\onelineskip}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@demo3} +% My third version of the demo chapterstyle. +% \begin{macrocode} +\makechapterstyle{demo3}{% + \chapterstyle{default} + \renewcommand*{\printchaptername}{\centering} + \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape} + \renewcommand*{\printchapternum}{\chapnumfont + \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi} + \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily} + \renewcommand*{\printchaptertitle}[1]{% + \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1} + \renewcommand*{\afterchaptertitle}{% + \vskip\onelineskip \hrule\vskip \afterchapskip} + \setlength{\beforechapskip}{0pt} + \setlength{\midchapskip}{2\onelineskip} + \setlength{\afterchapskip}{2\onelineskip} + \renewcommand*{\printchapternonum}{% + \vphantom{\chapnumfont One} + \afterchapternum% + \vskip\topskip}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@ell} +% Another of my styles which I'll probably use for my next book. +% \begin{macrocode} +\makechapterstyle{ell}{% + \chapterstyle{default} + \renewcommand*{\chapnumfont}{\normalfont\HUGE\sffamily} + \renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily} + \settowidth{\chapindent}{\chapnumfont 111} + \renewcommand*{\chapterheadstart}{\begingroup + \vspace*{\beforechapskip}% + \begin{adjustwidth}{}{-\chapindent}% + \hrulefill + \smash{\rule{0.4pt}{15mm}} + \end{adjustwidth}\endgroup} + \renewcommand*{\printchaptername}{} + \renewcommand*{\chapternamenum}{} + \renewcommand*{\printchapternum}{% + \begin{adjustwidth}{}{-\chapindent} + \hfill + \raisebox{10mm}[0pt][0pt]{\chapnumfont \thechapter}% + \hspace*{1em} + \end{adjustwidth}\vspace*{-3.0\onelineskip}} + \renewcommand*{\printchaptertitle}[1]{% + \vskip\onelineskip + \raggedleft {\chaptitlefont ##1}\par\nobreak}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@ger} +% Posted to CTT on 2002/04/12 \textit{Fancy Headings, Chapter Headings} by Gerardo Garcia. +% \begin{macrocode} +\makechapterstyle{ger}{% + \chapterstyle{default} + \renewcommand*{\chapterheadstart}{\vspace*{\beforechapskip} + \mbox{}\\\mbox{}\rule[0pt]{\textwidth}{0.4pt}\par} + \setlength{\midchapskip}{20pt} + \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1 + \\\mbox{}\rule[5pt]{\textwidth}{0.4pt}}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@lyhne} +% Posted to CTT 2006/02/09 \textit{Glossary}, by Anders Lyhne. +% It requires the \Lpack{graphicx} package. I have modified it to remove the +% new length and adjusted the unnumbered appearance. +% \begin{macrocode} +\makechapterstyle{lyhne}{% needs graphicx package + \chapterstyle{default} + \setlength{\beforechapskip}{1.5cm} + \setlength{\afterchapskip}{1cm} + \setlength{\midchapskip}{2cm} + \renewcommand*{\chapnamefont}{\normalfont\normalsize\scshape\raggedleft} + \renewcommand*{\chaptitlefont}{\normalfont\normalsize\bfseries\sffamily\raggedleft} + \renewcommand*{\chapternamenum}{} + \renewcommand*{\printchapternum}{\makebox[0pt][l]{\hspace{0.2em}% + \resizebox{!}{2ex}{\chapnamefont\bfseries\sffamily\thechapter}}} + \renewcommand*{\afterchapternum}{\par\hspace{1.5cm}\hrule\vspace{0.2cm}} + \renewcommand*{\printchapternonum}{\vphantom{\chapnamefont 1}\afterchapternum} + \renewcommand*{\afterchaptertitle}{\vskip 0.2cm + \hrule\vskip\afterchapskip}} + +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\chs@madsen} +% Posted to CTT on 2003/12/09, \textit{New chapter style: chapter vs chapter*} +% by Lars Madsen. +% This requires the \Lpack{graphicx} package, +% \begin{macrocode} +\makechapterstyle{madsen}{% requires graphicx package + \chapterstyle{default} + \renewcommand*{\chapnamefont}{% + \normalfont\Large\scshape\raggedleft} + \renewcommand*{\chaptitlefont}{% + \normalfont\Huge\bfseries\sffamily\raggedleft} + \renewcommand*{\chapternamenum}{} + \renewcommand*{\printchapternum}{% + \makebox[0pt][l]{\hspace{0.4em} + \resizebox{!}{4ex}{% + \chapnamefont\bfseries\sffamily\thechapter} + }% + }% + \renewcommand*{\afterchapternum}{% + \par\hspace{1.5cm}\hrule\vskip\midchapskip}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\colorchapnum} +% \begin{macro}{\colorchaptitle} +% \begin{macro}{\chs@pedersen} +% Posted to CTT 2006/01/31, \textit{Chapter style}, by Troels Pedersen. +% It requires the \Lpack{graphicx} package and possibly the \Lpack{color} +% package. I have used a \cs{sidebar} instead of the original \cs{marginpar}, +% and eliminated a new length. The original color specification, the same for +% the title and nunmber, can now be set via \cs{colorchapnum} and +% \cs{colorchaptitle}. +% \begin{macrocode} +\newcommand*{\colorchapnum}{} +\newcommand*{\colorchaptitle}{} +\makechapterstyle{pedersen}{% + \chapterstyle{default} + \setlength{\beforechapskip}{-20pt} + \setlength{\afterchapskip}{10pt} + \renewcommand*{\chapnamefont}{\normalfont\LARGE\itshape} + \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape\colorchapnum} + \renewcommand*{\chaptitlefont}{\normalfont\huge\itshape\colorchaptitle} + \renewcommand*{\afterchapternum}{} + \renewcommand*{\printchaptername}{} + \setlength{\midchapskip}{20mm}% was \numberheight + \renewcommand*{\chapternamenum}{} + \renewcommand*{\printchapternum}{% + \sidebar{\raisebox{0pt}[0pt][0pt]{\makebox[0pt][l]{% + \resizebox{!}{\midchapskip}{\chapnumfont\thechapter}}}}} + \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\chs@southall} +% Style provided by Thomas Dye. I have modified the original to eliminate +% the use of new lengths. +% \begin{macrocode} +%% Thomas Dye's southall chapter style +\makechapterstyle{southall}{% + \chapterstyle{default} + \setlength{\afterchapskip}{5\baselineskip} + \setlength{\beforechapskip}{36pt}% \headindent + \setlength{\midchapskip}{\textwidth}% \rightblock + \addtolength{\midchapskip}{-\beforechapskip} + \renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}} + \renewcommand*{\chaptitlefont}{\huge\rmfamily\raggedright} + \renewcommand*{\chapnumfont}{\chaptitlefont} + \renewcommand*{\printchaptername}{} + \renewcommand*{\chapternamenum}{} + \renewcommand*{\afterchapternum}{} + \renewcommand*{\printchapternum}{% + \begin{minipage}[t][\baselineskip][b]{\beforechapskip} + {\vspace{0pt}\chapnumfont%%%\figureversion{lining} + \thechapter} + \end{minipage}} + \renewcommand*{\printchaptertitle}[1]{% + \hfill\begin{minipage}[t]{\midchapskip} + {\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}} + \renewcommand*{\afterchaptertitle}{% + \par\vspace{\baselineskip}% + \hrulefill \par\nobreak\noindent \vskip \afterchapskip}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@thatcher} +% Original posted to CTT on 2006/01/18 by Scott Thatcher, +% \textit{memoir: chapter headings capitalize math symbols}. I have modified +% it to cater for multiline titles, appendices, and unnumbered chapters. +% \begin{macrocode} +\makechapterstyle{thatcher}{% + \chapterstyle{default} + \renewcommand*{\chapterheadstart}{} + \renewcommand*{\printchaptername}{% + \centerline{\chapnumfont{\@chapapp\ \thechapter}}} + \renewcommand*{\chapternamenum}{} + \renewcommand*{\chapnumfont}{\normalfont\scshape\MakeLowercase} + \renewcommand*{\printchapternum}{} + \renewcommand*{\afterchapternum}{% + \par\centerline{\parbox{0.5in}{\hrulefill}}\par} + \renewcommand*{\printchapternonum}{% + \vphantom{\chapnumfont \@chapapp 1}\par + \parbox{0.5in}{}\par} + \renewcommand*{\chaptitlefont}{\normalfont\large} + \renewcommand*{\printchaptertitle}[1]{% + \centering \chaptitlefont\MakeUppercase{##1}}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@veelo} +% This, from Baastian Veelo, has been noted in the documentation for +% quite a time. +% I have modified the original to eliminate the need for extra lengths. +% It well suits trimmed documents. +% We are scaling the chapter number, which most DVI viewers +% will not display accurately. It requires the graphicx package. +% \begin{macrocode} +\makechapterstyle{veelo}{% +% \chapterstyle{default} + \setlength{\afterchapskip}{40pt} + \renewcommand*{\chapterheadstart}{\vspace*{40pt}} + \renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt} + \renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright} + \renewcommand*{\chapnumfont}{\normalfont\HUGE} + \renewcommand*{\chaptitlefont}{\normalfont\HUGE\bfseries\flushright} + \renewcommand*{\printchaptername}{% + \chapnamefont\MakeUppercase{\@chapapp}} + \renewcommand*{\chapternamenum}{} +% \setlength{\numberheight}{18mm} +% \setlength{\barlength}{\paperwidth} +% \addtolength{\barlength}{-\textwidth} +% \addtolength{\barlength}{-\spinemargin} + \setlength{\beforechapskip}{18mm}% \numberheight + \setlength{\midchapskip}{\paperwidth}% \barlength + \addtolength{\midchapskip}{-\textwidth} + \addtolength{\midchapskip}{-\spinemargin} + \renewcommand*{\printchapternum}{% + \makebox[0pt][l]{% + \hspace{.8em}% + \resizebox{!}{\beforechapskip}{\chapnumfont \thechapter}% + \hspace{.8em}% + \rule{\midchapskip}{\beforechapskip}% + }% + }% + \makeoddfoot{plain}{}{}{\thepage}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@verville} +% I posted the original to CTT on 2005/01/18, \textit{Headers and special +% formatting of sections}, in answer to a question by +% Guy Verville. This version caters for unnumbered chapters. +% \begin{macrocode} +\makechapterstyle{verville}{% + % \chapterstyle{default} + \setlength{\beforechapskip}{0pt} + \renewcommand*{\printchaptername}{} + \renewcommand*{\printchapternum}{% + \hrule \vskip 0.5\onelineskip + \Huge \centering \thechapter.\ } + \renewcommand*{\printchapternonum}{% + \hrule \vskip 0.5\onelineskip + \Huge \centering} + \renewcommand*{\afterchapternum}{} + \setlength{\midchapskip}{0pt} + \renewcommand*{\printchaptertitle}[1]{% + ##1 \par + \vskip 0.5\onelineskip + \hrule}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@crosshead} +% A centered chapterstyle (from Bringhurst) +% \changes{v1.61803}{2008/01/30}{Added chapterstyles: crosshead, dowding, +% komalike, ntglike, tandh, and wilsondob} +% \begin{macrocode} +\makechapterstyle{crosshead}{% + \setlength{\beforechapskip}{2\onelineskip}% + \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}% + \setlength{\afterchapskip}{2\onelineskip \@plus .2\onelineskip + \@minus 0.2\onelineskip}% + \renewcommand*{\printchaptername}{}% + \renewcommand*{\chapternamenum}{}% + \renewcommand*{\chapnumfont}{\normalfont\LARGE\bfseries}% + \renewcommand*{\chaptitlefont}{\chapnumfont}% + \renewcommand*{\printchapternum}{% + \centering\chapnumfont \thechapter\quad}% + \renewcommand{\afterchapternum}{}% + \renewcommand*{\printchapternonum}{\centering}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@dowding} +% A centered chapterstyle (from Dowding's \textit{Finer Points}) +% \begin{macrocode} +\makechapterstyle{dowding}{% + \setlength{\beforechapskip}{2\onelineskip}% + \setlength{\afterchapskip}{1.5\onelineskip \@plus .1\onelineskip + \@minus 0.167\onelineskip}% + \renewcommand*{\chapnamefont}{\normalfont}% + \renewcommand*{\chapnumfont}{\chapnamefont}% + \renewcommand*{\printchapternum}{\centering\chapnumfont \ifanappendix \thechapter + \else \numtoName{\c@chapter}\fi}% + \renewcommand*{\chaptitlefont}{\normalfont\itshape\huge\centering}% + \renewcommand*{\printchapternonum}{% + \vphantom{\printchaptername}\vskip\midchapskip}} % \end{macrocode} % \end{macro} % +% \begin{macro}{\chs@komalike} +% A chapterstyle approximating the KOMA script style (\texttt{scrbook.cls}) +% \begin{macrocode} +\makechapterstyle{komalike}{% + \setlength{\beforechapskip}{2\onelineskip}% + \setlength{\afterchapskip}{1.5\onelineskip \@plus .1\onelineskip + \@minus 0.167\onelineskip}% + \renewcommand*{\printchaptername}{}% + \renewcommand*{\chapternamenum}{}% + \renewcommand*{\chapnumfont}{\normalfont\LARGE\sffamily\bfseries}% + \renewcommand*{\printchapternum}{\chapnumfont \thechapter\space}% + \renewcommand*{\afterchapternum}{}% + \renewcommand*{\chaptitlefont}{\normalfont\LARGE\sffamily\bfseries}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@ntglike} +% A chapterstyle approximating the NTG style (\texttt{boek.cls}) +% \begin{macrocode} +\makechapterstyle{ntglike}{% + \setlength{\beforechapskip}{50pt \@plus 20pt}% + \renewcommand*{\chapnamefont}{\normalfont\Large\bfseries}% + \renewcommand*{\chapnumfont}{\normalfont\Large\bfseries}% + \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@tandh} +% A chapterstyle based on Thames \& Hudson \textit{Typography}. +% \begin{macrocode} +\makechapterstyle{tandh}{% + \setlength{\beforechapskip}{1\onelineskip}% + \setlength{\afterchapskip}{2\onelineskip \@plus .1\onelineskip + \@minus 0.167\onelineskip}% + \renewcommand*{\printchaptername}{}% + \renewcommand*{\chapternamenum}{}% + \renewcommand*{\chapnumfont}{\normalfont\huge\bfseries}% + \renewcommand*{\printchapternum}{\chapnumfont \thechapter\quad}% + \renewcommand*{\afterchapternum}{}% + \renewcommand*{\chaptitlefont}{\chapnumfont\raggedright}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chs@wilsondob} +% A chapterstyle based on Adrian Wilson's \textit{Design of books}. +% \begin{macrocode} +\makechapterstyle{wilsondob}{% + \setlength{\beforechapskip}{2\onelineskip}% + \setlength{\afterchapskip}{4\onelineskip \@plus .1\onelineskip + \@minus 0.167\onelineskip}% + \renewcommand*{\printchaptername}{}% + \renewcommand*{\chapternamenum}{}% + \renewcommand*{\chapnumfont}{\normalfont\Huge\itshape}% + \renewcommand*{\printchapternum}{\raggedleft\chapnumfont \thechapter\quad}% + \renewcommand*{\afterchapternum}{}% + \renewcommand*{\chaptitlefont}{\chapnumfont}% + \renewcommand*{\printchapternonum}{\raggedleft}} + +% \end{macrocode} +% \end{macro} % % % \subsection{Lower level headings} @@ -6006,13 +8606,26 @@ % can be set \cs{raggedbottom}. % % \begin{macro}{\ifraggedbottomsection} -% |\raggedbottomsectiontrue| for ragged short pages. +% \begin{macro}{\raggedbottomsectiontrue} +% \begin{macro}{\raggedbottomsectionfalse} +% \begin{macro}{\raggedbottomsection} +% \begin{macro}{\normalbottomsection} +% \cs{raggedbottomsectiontrue} for ragged short pages. % \changes{v1.3}{2002/11/14}{Added \cs{ifraggedbottomsection}} +% \changes{v1.61803}{2008/01/30}{Added \cs{raggedbottomsection} and +% \cs{normalbottomsection}} % \begin{macrocode} \newif\ifraggedbottomsection \raggedbottomsectionfalse +\newcommand*{\raggedbottomsection}{\raggedbottomsectiontrue} +\newcommand*{\normalbottomsection}{\raggedbottomsectionfalse} + % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\bottomsectionskip} % Decreasing this length increases short page bottom flushness. @@ -6030,14 +8643,14 @@ % The kernel \cs{@dblarg} is used in situations where the default % value for an optional argument is the same as the required argument. % Schematically, \\ -% |\@dblarg -> Main, Main| \\ +% \verb?\@dblarg -> Main, Main? \\ % The macros \cs{@trplargomm} and \cs{@trplargoom} are extensions to this % idea for two optional arguments. % % \begin{macro}{\@trplargomm} % \begin{macro}{\@xtrplargomm} % \begin{macro}{\@xxtrplarg} -% |\@trplargomm -> Opt, Main, Main| +% \verb?\@trplargomm -> Opt, Main, Main? % \begin{macrocode} \newcommand{\@trplargomm}[1]{% \@ifnextchar[{\@xtrplargomm{#1}}% @@ -6051,7 +8664,7 @@ % % \begin{macro}{\@trplargoom} % \begin{macro}{\@xtrplargoom} -% |\@trplargoom -> Opt, Opt, Main| +% \verb?\@trplargoom -> Opt, Opt, Main? % \begin{macrocode} \newcommand{\@trplargoom}[1]{% \@ifnextchar[{\@xtrplargoom{#1}}% @@ -6069,8 +8682,8 @@ % \verb?\memsecinfo{secname}{\thenum}{toc}{head}{title}? \\ % \verb?\memsecstarinfo{secname}{title}? \\ % \begin{macrocode} -\newcommand*{\memsecinfo}[5]{} -\newcommand*{\memsecstarinfo}[2]{} +\newcommand{\memsecinfo}[5]{} +\newcommand{\memsecstarinfo}[2]{} % \end{macrocode} % \end{macro} @@ -6185,11 +8798,13 @@ % \begin{macro}{\@ssect} % Add hook for name reference to \cs{section*} etc. \\ % \cs{@ssect}\marg{indent}\marg{beforeskip}\marg{afterskip}\marg{style}\marg{title} +% \changes{v1.61803}{2008/01/30}{Used corrected number of arguments to +% \cs{memsecstarinfo} in \cs{@ssect} (Gabriel Guernik, mempatch v4.1)} % \begin{macrocode} \let\@mem@old@ssect\@ssect \def\@ssect#1#2#3#4#5{% \M@gettitle{#5}% - \memsecstarinfo{#1}{\m@msecn@me}{#5}% + \memsecstarinfo{\m@msecn@me}{#5}% \@mem@old@ssect{#1}{#2}{#3}{#4}{#5}} % \end{macrocode} @@ -6214,8 +8829,8 @@ % % \begin{macro}{\sechook} % \begin{macro}{\setsechook} -% |\sechook| is called at the start of a |\section| and -% |\setsechook{|\meta{code}|}| redefines it. +% \cs{sechook} is called at the start of a \cs{section} and +% \cs{setsechook}\marg{code} redefines it. % \begin{macrocode} \newcommand{\sechook}{} \newcommand{\setsechook}[1]{\renewcommand{\sechook}{#1}} @@ -6231,13 +8846,13 @@ % \begin{macro}{\setbeforesecskip} % \begin{macro}{\setaftersecskip} % \begin{macro}{\setsecheadstyle} -% |\secindent| is the indentation of the section heading from the left margin, -% |\beforesecskip| and |\aftersecskip| specify the white space before -% and after the heading, and |\secheadstyle| specifies the heading style. +% \cs{secindent} is the indentation of the section heading from the left margin, +% \cs{beforesecskip} and \cs{aftersecskip} specify the white space before +% and after the heading, and \cs{secheadstyle} specifies the heading style. % These are set to the default values for the \Lpack{book} class, -% except that the heading will be |\raggedright|, thus preventing +% except that the heading will be \cs{raggedright}, thus preventing % hyphenation. The -% |\set...| commands are for the user to change the values. +% \cs{set...} commands are for the user to change the values. % \begin{macrocode} \newlength{\secindent} \newcommand{\setsecindent}[1]{\setlength{\secindent}{#1}} @@ -6265,7 +8880,7 @@ % \begin{macro}{\subsection} % A normal heading with white space above and below and no indentation % of the first paragraph. -% By default the heading is set in a |\large\bfseries| font. +% By default the heading is set in a \verb?\large\bfseries? font. % \begin{macrocode} \newcommand{\subsection}{% \subsechook% @@ -6279,8 +8894,8 @@ % % \begin{macro}{\subsechook} % \begin{macro}{\setsubsechook} -% |\subsechook| is called at the start of a |\subsection| and -% |\setsubsechook{|\meta{code}|}| redefines it. +% \cs{subsechook} is called at the start of a \cs{subsection} and +% \cs{setsubsechook}\marg{code} redefines it. % \begin{macrocode} \newcommand{\subsechook}{} \newcommand{\setsubsechook}[1]{\renewcommand{\subsechook}{#1}} @@ -6297,7 +8912,7 @@ % \begin{macro}{\setbeforesubsecskip} % \begin{macro}{\setaftersubsecskip} % \begin{macro}{\setsubsecheadstyle} -% The macros for controlling |\subsection| headings. +% The macros for controlling \cs{subsection} headings. % \begin{macrocode} \newlength{\subsecindent} \newcommand{\setsubsecindent}[1]{\setlength{\subsecindent}{#1}} @@ -6326,7 +8941,7 @@ % \begin{macro}{\subsubsection} % A normal heading with white space above and below and no indentation % of the first paragraph. -% By default the heading is set in a |\normalsize\bfseries| font. +% By default the heading is set in a \verb?\normalsize\bfseries? font. % \begin{macrocode} \newcommand{\subsubsection}{% \subsubsechook% @@ -6340,8 +8955,8 @@ % % \begin{macro}{\subsubsechook} % \begin{macro}{\setsubsubsechook} -% |\subsubsechook| is called at the start of a |\subsubsection| and -% |\setsubsubsechook{|\meta{code}|}| redefines it. +% \cs{subsubsechook} is called at the start of a \cs{subsubsection} and +% \cs{setsubsubsechook}\marg{code} redefines it. % \begin{macrocode} \newcommand{\subsubsechook}{} \newcommand{\setsubsubsechook}[1]{\renewcommand{\subsubsechook}{#1}} @@ -6358,7 +8973,7 @@ % \begin{macro}{\setbeforesubsubsecskip} % \begin{macro}{\setaftersubsubsecskip} % \begin{macro}{\setsubsubsecheadstyle} -% The macros for controlling |\subsubsection| headings. +% The macros for controlling \cs{subsubsection} headings. % \begin{macrocode} \newlength{\subsubsecindent} \newcommand{\setsubsubsecindent}[1]{% @@ -6391,7 +9006,7 @@ % % \begin{macro}{\paragraph} % A runin heading with white space above and to the right of the heading. -% By default the heading is set in a |\normalsize\bfseries| font. +% By default the heading is set in a \verb?\normalsize\bfseries? font. % \begin{macrocode} \newcommand{\paragraph}{% \parahook% @@ -6405,8 +9020,8 @@ % % \begin{macro}{\parahook} % \begin{macro}{\setparahook} -% |\parahook| is called at the start of a |\paragraph| and -% |\setparahook{|\meta{code}|}| redefines it. +% \cs{parahook} is called at the start of a \cs{paragraph} and +% \cs{setparahook}\marg{code} redefines it. % \begin{macrocode} \newcommand{\parahook}{} \newcommand{\setparahook}[1]{\renewcommand{\parahook}{#1}} @@ -6423,7 +9038,7 @@ % \begin{macro}{\setbeforeparaskip} % \begin{macro}{\setafterparaskip} % \begin{macro}{\setparaheadstyle} -% The macros for controlling |\paragraph| headings. +% The macros for controlling \cs{paragraph} headings. % \begin{macrocode} \newlength{\paraindent} \newcommand{\setparaindent}[1]{\setlength{\paraindent}{#1}} @@ -6452,7 +9067,7 @@ % % \begin{macro}{\subparagraph} % A runin heading with white space above and to the right of the heading. -% By default the heading is set in a |\normalsize\bfseries| font. +% By default the heading is set in a \verb?\normalsize\bfseries? font. % \begin{macrocode} \newcommand{\subparagraph}{% \subparahook% @@ -6466,8 +9081,8 @@ % % \begin{macro}{\subparahook} % \begin{macro}{\setsubparahook} -% |\subparahook| is called at the start of a |\subparagraph| and -% |\setsubparahook{|\meta{code}|}| redefines it. +% \cs{subparahook} is called at the start of a \cs{subparagraph} and +% \cs{setsubparahook}\marg{code} redefines it. % \begin{macrocode} \newcommand{\subparahook}{} \newcommand{\setsubparahook}[1]{\renewcommand{\subparahook}{#1}} @@ -6484,7 +9099,7 @@ % \begin{macro}{\setbeforesubparaskip} % \begin{macro}{\setaftersubparaskip} % \begin{macro}{\setsubparaheadstyle} -% The macros for controlling |\subparagraph| headings. +% The macros for controlling \cs{subparagraph} headings. % \begin{macrocode} \newlength{\subparaindent} \newcommand{\setsubparaindent}[1]{% @@ -6514,9 +9129,9 @@ % \end{macro} % % \begin{macro}{\sethangfrom} -% The macro |\sethangfrom{|\meta{code}|}| is a user-level command -% for changing the definition of |\@hangfrom|. Use |#1| in \meta{code} -% for the argument to |\@hangfrom| (or |##1| if used inside another macro). +% The macro \cs{sethangfrom}\marg{code} is a user-level command +% for changing the definition of \cs{@hangfrom}. Use \verb?#1? in \meta{code} +% for the argument to \cs{@hangfrom} (or \verb?##1? if used inside another macro). % \changes{v0.2}{2001/06/03}{Added \cs{sethangfrom}} % \begin{macrocode} \newcommand{\sethangfrom}[1]{\renewcommand{\@hangfrom}[1]{#1}} @@ -6524,9 +9139,9 @@ % \end{macro} % % \begin{macro}{\setsecnumformat} -% The macro |\setsecnumformat{|\meta{code}|}| is a user-level command -% for changing the definition of |\@seccntformat|. Use |#1| in \meta{code} -% for the argument to |\@seccntformat| (or |##1| if used inside another macro). +% The macro \cs{setsecnumformat}\marg{code} is a user-level command +% for changing the definition of \cs{@seccntformat}. Use \verb?#1? in \meta{code} +% for the argument to \cs{@seccntformat} (or \verb?##1? if used inside another macro). % \changes{v0.2}{2001/06/03}{Added \cs{setsecnumformat}} % \begin{macrocode} \newcommand{\setsecnumformat}[1]{\renewcommand{\@seccntformat}[1]{#1}} @@ -6551,9 +9166,9 @@ % \subsubsection{Anonymous headings} % % \begin{macro}{\plainbreak} -% |\plainbreak{|\meta{num}|}| generates \meta{num} blanks lines and +% \cs{plainbreak}\marg{num} generates \meta{num} blanks lines and % suppresses the indentation of a following paragraph. The starred -% version, |\plainbreak*|, does not suppress paragraph indentation. +% version, \cs{plainbreak*}, does not suppress paragraph indentation. % \changes{v0.2}{2001/06/03}{Added starred version of \cs{plainbreak}} % \begin{macrocode} \newcommand{\plainbreak}{\@ifstar{\@spbreak}{\@pbreak}} @@ -6562,8 +9177,8 @@ % % \begin{macro}{\@pbreak} % \begin{macro}{\@spbreak} -% These are the internal forms for the two versions of |\plainbreak|. -% The code for |\@pbreak| is almost a straight copy of code posted to +% These are the internal forms for the two versions of \cs{plainbreak}. +% The code for \cs{@pbreak} is almost a straight copy of code posted to % \ctt{} by Donald Arseneau on 2001/03/26. % \begin{macrocode} \newcommand*{\@pbreak}[1]{\par @@ -6587,11 +9202,13 @@ % % % \begin{macro}{\fancybreak} -% |\fancybreak{|\meta{text}|}| typesets \meta{text} centered. For example, -% |\fancybreak{{*}\\{* * *}\\{*}}|. It suppresses indentation of the +% \cs{fancybreak}\marg{text} typesets \meta{text} centered. For example, +% \verb?\fancybreak{{*}\\{* * *}\\{*}}?. It suppresses indentation of the % following paragraph. The starred version leaves indentation as is. % \changes{v0.2}{2001/06/03}{Added starred version of \cs{fancybreak}} % \changes{v1.3}{2002/11/14}{Tweaked \cs{fancybreak} to remove underfull hbox} +% \changes{v1.61803}{2008/01/30}{Changed fancybreak code to end the paragraph +% it started (Dan Leucking mempatch v4.5)} % \begin{macrocode} \newcommand{\fancybreak}{\@ifstar{\@sfbreak}{\@fbreak}} % \end{macrocode} @@ -6599,19 +9216,21 @@ % % \begin{macro}{\@fbreak} % \begin{macro}{\@sfbreak} -% These are the internal forms for the two versions of |\fancybreak|. +% These are the internal forms for the two versions of \cs{fancybreak}. % \begin{macrocode} \newcommand{\@fbreak}[1]{\par \penalty -100 - \noindent\parbox{\linewidth}{\centering #1}\null - \penalty -20 + \noindent\parbox{\linewidth}{\centering #1}%%\null + \par +%% \penalty -20 %% \vskip -\onelineskip \@afterindentfalse \@afterheading} \newcommand{\@sfbreak}[1]{\par \penalty -100 - \noindent\parbox{\linewidth}{\centering #1}\null - \penalty -20 + \noindent\parbox{\linewidth}{\centering #1}%%\null + \par +%% \penalty -20 %% \vskip -\onelineskip \@afterindenttrue \@afterheading} @@ -6621,13 +9240,13 @@ % \end{macro} % % \begin{macro}{\plainfancybreak} -% The |\plainfancybreak{|\meta{space}|}{|\meta{num}|}{|\meta{text}|}| acts -% like |\plainbreak{|\meta{num}|}| in the middle of a page and like -% |\fancybreak{|\meta{text}|}| at the bottom of a page. The \meta{space} +% The \cs{plainfancybreak}\marg{space}\marg{num}\marg{text} acts +% like \cs{plainbreak}\marg{num} in the middle of a page and like +% \cs{fancybreak}\marg{text} at the bottom of a page. The \meta{space} % argument is the vertical space required for the \meta{num} blank lines % and some additional lines of text. From experiments, it seems that -% \meta{space} should be at least (3+\meta{num}) lines (|\onelineskip|). -% There is also a starred version, |\plainfancybreak*|, to match the other +% \meta{space} should be at least (3+\meta{num}) lines (\cs{onelineskip}). +% There is also a starred version, \cs{plainfancybreak*}, to match the other % starred break commands. % \changes{v0.2}{2001/06/03}{Added \cs{plainfancybreak} and supporting macros} % \begin{macrocode} @@ -6638,10 +9257,10 @@ % \begin{macro}{\@pfbreak} % \begin{macro}{\@spfbreak} % These are the internal macros for the unstarred and starred versions -% of |\plainfancybreak|. They essentially do the same thing, except they call, -% respectively, the unstarred and starred internal versions of |\plainbreak| -% and |\fancybreak|. The code for checking the amount of space left on the -% page is from an early, and abandoned, version of the code for |\needspace|. +% of \cs{plainfancybreak}. They essentially do the same thing, except they call, +% respectively, the unstarred and starred internal versions of \cs{plainbreak} +% and \cs{fancybreak}. The code for checking the amount of space left on the +% page is from an early, and abandoned, version of the code for \cs{needspace}. % \begin{macrocode} \newcommand{\@pfbreak}[3]{\par \@tempdimc\pagegoal \advance\@tempdimc-\pagetotal @@ -6655,8 +9274,8 @@ % \end{macro} % % From the thread \textit{Customizing section hooks in memoir.cls} on \ctt{} -% in October 2002 it appeared that |\plainfancybreak| may be fragile. -% Donald Arseneau said that |\plainfancybreak| guessed at the amount +% in October 2002 it appeared that \cs{plainfancybreak} may be fragile. +% Donald Arseneau said that \cs{plainfancybreak} guessed at the amount % of space available and gave code based on a modified output routine % to make it more robust. The following code is based on that thread. % \changes{v1.3}{2002/11/14}{Added lots of code for new \cs{fpbreak}} @@ -6681,7 +9300,7 @@ % \end{macro} % % \begin{macro}{\pfbreakdisplay} -% This is the fancybreak display, which must fit into |\pfbreakskip| +% This is the fancybreak display, which must fit into \cs{pfbreakskip} % vertical space. % \begin{macrocode} \newcommand{\pfbreakdisplay}{*\quad*\quad*} @@ -6690,7 +9309,7 @@ % \end{macro} % % \begin{macro}{\pfbre@kdispl@y} -% Typesets |\pfbreakdisplay| vertically and horizontally centered. +% Typesets \cs{pfbreakdisplay} vertically and horizontally centered. % \begin{macrocode} \def\pfbre@kdispl@y{\vbox to 1\pfbreakskip{\vss \hb@xt@ \columnwidth{\hss \pfbreakdisplay \hss}% @@ -6707,7 +9326,7 @@ % \end{macro} % % \begin{macro}{\pfbreakOutput} -% Special output to handle the |\pfbreak|. +% Special output to handle the \cs{pfbreak}. % \begin{macrocode} \def\pfbreakOutput{% \ifnum\outputpenalty=\pen@ltyabovepfbreak @@ -6729,7 +9348,7 @@ % \end{macro} % % \begin{macro}{\output} -% Use the new |\pfbreak| output routine. +% Use the new \cs{pfbreak} output routine. % \begin{macrocode} \output={\pfbreakOutput} @@ -6745,7 +9364,7 @@ % \end{macro} % % \begin{macro}{\@pfbreakgap} -% Unstarred version of |\pfbreak|. +% Unstarred version of \cs{pfbreak}. % \begin{macrocode} \newcommand{\@pfbreakgap}{% \par {% @@ -6771,7 +9390,7 @@ % \end{macro} % % \begin{macro}{\@spfbreakgap} -% Starred version of |\pfbreak|. +% Starred version of \cs{pfbreak}. % \begin{macrocode} \newcommand{\@spfbreakgap}{% \par {% @@ -6801,7 +9420,7 @@ % While on the subject of breaks\ldots % % \begin{macro}{\noprelistbreak} -% Putting this immediately before a list (e.g., |itemize|) should +% Putting this immediately before a list (e.g., \Lenv{itemize}) should % prevent a page break at that point. % \changes{v1.2}{2002/07/27}{Added \cs{noprelistbreak}} % \begin{macrocode} @@ -6810,6 +9429,423 @@ % \end{macrocode} % \end{macro} % +% \subsection{Division head styles} +% +% The styles of the division heads should go together. As an aid the +% class supplies some ready made collections. +% \changes{v1.6180}{2008/01/30}{Added division head styles} +% +% \begin{macro}{\makeheadstyles} +% \begin{macro}{\headstyles} +% \begin{macro}{\@hds@def@ult} +% \begin{macro}{\hds@default} +% \cs{makeheadstyles}\marg{name}\marg{code} creates the \meta{name} collection +% of division head styles, defined by \meta{code}. \cs{headstyles}\marg{name} +% makes the \meta{name} division head styles the current styles. +% \begin{macrocode} +\newcommand{\makeheadstyles}[2]{% + \@namedef{hds@#1}{\@hds@def@ult #2}} +\newcommand*{\headstyles}[1]{\@nameuse{hds@#1}} +% \end{macrocode} +% \cs{@hds@def@ult} is the default set of division head styles. +% \begin{macrocode} +\newcommand*{\@hds@def@ult}{% +% Default \cs{book} style +% \begin{macrocode} +% book + \renewcommand*{\beforebookskip}{\null\vfil}% + \renewcommand*{\midbookskip}{\par\vskip 20pt}% + \renewcommand*{\afterbookskip}{\vfil\newpage}% + \renewcommand*{\booknamefont}{\normalfont\huge\bfseries}% + \renewcommand*{\booknumfont}{\normalfont\huge\bfseries}% + \renewcommand*{\booktitlefont}{\normalfont\Huge\bfseries}% + \renewcommand*{\printbookname}{\booknamefont \bookname}% + \renewcommand*{\booknamenum}{\space}% + \renewcommand*{\printbooknum}{\booknumfont \thebook}% + \renewcommand*{\printbooktitle}[1]{\booktitlefont{##1}}% +% \end{macrocode} +% Default \cs{part} style +% \begin{macrocode} +% part + \renewcommand*{\beforepartskip}{\null\vfil}% + \renewcommand*{\midpartskip}{\par\vskip 20pt}% + \renewcommand*{\afterpartskip}{\vfil\newpage}% + \renewcommand*{\partnamefont}{\normalfont\huge\bfseries}% + \renewcommand*{\partnumfont}{\normalfont\huge\bfseries}% + \renewcommand*{\parttitlefont}{\normalfont\Huge\bfseries}% + \renewcommand*{\printpartname}{\partnamefont \partname}% + \renewcommand*{\partnamenum}{\space}% + \renewcommand*{\printpartnum}{\partnumfont \thepart}% + \renewcommand*{\printparttitle}[1]{\parttitlefont{##1}}% +% \end{macrocode} +% Default \cs{chapter} style. +% \begin{macrocode} + \@chs@def@ult% default chapterstyle +% \end{macrocode} +% Default \cs{section} style +% \begin{macrocode} +% section + \setsechook{} + \setsecindent{\z@}% + \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}% + \setaftersecskip{2.3ex \@plus .2ex}% + \setsecheadstyle{\Large\bfseries\raggedright}% +% \end{macrocode} +% Default \cs{section} style +% \begin{macrocode} +% subsection + \setsubsechook{}% + \setsubsecindent{\z@}% + \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}% + \setaftersubsecskip{1.5ex \@plus .2ex}% + \setsubsecheadstyle{\large\bfseries\raggedright}% +% \end{macrocode} +% Default \cs{section} style +% \begin{macrocode} +% subsubsection + \setsubsubsechook{}% + \setsubsubsecindent{\z@}% + \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}% + \setaftersubsubsecskip{1.5ex \@plus .2ex}% + \setsubsubsecheadstyle{\normalsize\bfseries\raggedright}% +% \end{macrocode} +% Default \cs{paragraph} style +% \begin{macrocode} +% paragraph + \setparahook{}% + \setparaindent{\z@}% + \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}% + \setafterparaskip{-1em}% + \setparaheadstyle{\normalsize\bfseries}% +% \end{macrocode} +% Default \cs{paragraph} style +% \begin{macrocode} +% subparagraph + \setsubparahook{}% + \setsubparaindent{\parindent}% + \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}% + \setaftersubparaskip{-1em}% + \setsubparaheadstyle{\normalsize\bfseries}} + +% \end{macrocode} +% Set up and use the default head styles +% \begin{macrocode} +\makeheadstyles{default}{} +\headstyles{default} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\addperiod} +% Puts a period at the end of its argument. +% \begin{macrocode} +\newcommand*{\addperiod}[1]{#1.} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hds@memman} +% Head styles used in the \textit{The Memoir Class} user guide. In this, +% as the later ones, only changes from the defaults need specifying. +% \begin{macrocode} +\makeheadstyles{memman}{% +% book changes + \renewcommand*{\booknamefont}{\normalfont\huge\sffamily} + \renewcommand*{\booknumfont}{\normalfont\huge\sffamily} + \renewcommand*{\booktitlefont}{\normalfont\Huge\sffamily} + \renewcommand*{\midbookskip}{\par\vskip 2\onelineskip}% +% part changes + \renewcommand*{\partnamefont}{\normalfont\huge\sffamily} + \renewcommand*{\partnumfont}{\normalfont\huge\sffamily} + \renewcommand*{\parttitlefont}{\normalfont\Huge\sffamily} + \renewcommand*{\midpartskip}{\par\vskip 2\onelineskip}% +% chapter + \chapterstyle{demo3} +% section + \setbeforesecskip{-1.333\onelineskip + \@plus -0.5\onelineskip \@minus -.5\onelineskip}% + \setaftersecskip{0.667\onelineskip \@plus 0.1\onelineskip}% + \setsecheadstyle{\normalfont\scshape\raggedright}% +% subsection + \setbeforesubsecskip{-0.667\onelineskip + \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% + \setaftersubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}% + \setsubsecheadstyle{\normalfont\bfseries\raggedright}% +% subsubsection + \setbeforesubsubsecskip{-0.667\onelineskip + \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% + \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}% + \setsubsubsecheadstyle{\normalfont\normalsize\itshape\raggedright}% +% paragraph + \setbeforeparaskip{1.0\onelineskip + \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% + \setafterparaskip{-1em}% + \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}% +% subparagraph + \setsubparaindent{\parindent}% + \setbeforesubparaskip{1.0\onelineskip + \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% + \setaftersubparaskip{-1em}% + \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hds@bringhurst} +% Head styles based on Bringhurst's book +% \begin{macrocode} +\makeheadstyles{bringhurst}{% +% chapter +\chapterstyle{bringhurst} +% section + \setbeforesecskip{-1\onelineskip + \@plus -0.5\onelineskip \@minus -.5\onelineskip}% + \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}% + \setsecheadstyle{\normalfont\raggedright\scshape\MakeLowercase}% +% subsection + \setbeforesubsecskip{-1.0\onelineskip + \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% + \setaftersubsecskip{1.0\onelineskip \@plus 0.1\onelineskip}% + \setsubsecheadstyle{\sethangfrom{\noindent ####1}\normalfont\itshape\raggedright}% +% subsubsection + \setbeforesubsubsecskip{1.0\onelineskip + \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% + \setaftersubsubsecskip{-1em}% + \setsubsubsecheadstyle{\normalfont\normalsize\scshape\MakeLowercase}% +% paragraph + \setbeforeparaskip{1.0\onelineskip + \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% + \setafterparaskip{-1em}% + \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}% +% subparagraph + \setsubparaindent{\parindent}% + \setbeforesubparaskip{1.0\onelineskip + \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% + \setaftersubparaskip{-1em}% + \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hds@crosshead} +% Head styles based on one of Bringhurst's suggestions. +% \begin{macrocode} +\makeheadstyles{crosshead}{% + \chapterstyle{crosshead} +% section + \setbeforesecskip{-1.25\onelineskip + \@plus -0.5\onelineskip \@minus -.5\onelineskip}% + \setaftersecskip{0.75\onelineskip \@plus 0.1\onelineskip}% + \setsecheadstyle{\normalfont\centering\MakeUppercase}% +% subsection + \setbeforesubsecskip{-1.25\onelineskip + \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% + \setaftersubsecskip{0.75\onelineskip \@plus 0.1\onelineskip}% + \setsubsecheadstyle{\normalfont\centering\bfseries}% +% subsubsection + \setbeforesubsubsecskip{-.667\onelineskip + \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% + \setaftersubsubsecskip{.333\onelineskip \@plus 0.1\onelineskip}% + \setsubsubsecheadstyle{\normalfont\normalsize\centering\scshape\MakeLowercase}% +% paragraph + \setbeforeparaskip{-.667\onelineskip + \@plus -02.5\onelineskip \@minus -0.25\onelineskip}% + \setafterparaskip{.333\onelineskip \@plus 0.1\onelineskip}% + \setparaheadstyle{\normalfont\normalsize\centering\itshape}% +% subparagraph + \setsubparaindent{\parindent}% + \setbeforesubparaskip{1.0\onelineskip + \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% + \setaftersubparaskip{-1em}% + \setsubparaheadstyle{\normalfont\normalsize\scshape\MakeLowercase}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hds@dowding} +% Head styles based on Dowding's \textit{Finer Points}. +% \begin{macrocode} +\makeheadstyles{dowding}{% +% chapter + \chapterstyle{dowding} +% section + \setbeforesecskip{-2\onelineskip + \@plus -0.5\onelineskip \@minus -.5\onelineskip}% + \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}% + \setsecheadstyle{\normalfont\centering\MakeUppercase}% +% subsection + \setbeforesubsecskip{-1.2\onelineskip + \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% + \setaftersubsecskip{0.8\onelineskip \@plus 0.1\onelineskip}% + \setsubsecheadstyle{\normalfont\scshape\centering\MakeLowercase}% +% subsubsection + \setbeforesubsubsecskip{-0.667\onelineskip + \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% + \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}% + \setsubsubsecheadstyle{\normalfont\normalsize\centering\itshape}% +% paragraph + \setbeforeparaskip{1.0\onelineskip + \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% + \setafterparaskip{-1em}% + \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}% +% subparagraph + \setsubparaindent{\parindent}% + \setbeforesubparaskip{1.0\onelineskip + \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% + \setaftersubparaskip{-1em}% + \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hds@komalike} +% Head styles based on KOMA script classes (\texttt{scrbook.cls}). +% \begin{macrocode} +\makeheadstyles{komalike}{% +% part + \renewcommand*{\partnamefont}{\huge\sffamily\bfseries}% + \renewcommand*{\partnumfont}{\huge\sffamily\bfseries}% + \renewcommand*{\parttitlefont}{\huge\sffamily\bfseries}% +% chapter + \chapterstyle{komalike} +% section + \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}% + \setaftersecskip{2.3ex \@plus .2ex}% + \setsecheadstyle{\normalfont\Large\sffamily\bfseries\raggedright}% +% subsection + \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}% + \setaftersubsecskip{1.5ex \@plus .2ex}% + \setsubsecheadstyle{\normalfont\large\sffamily\bfseries\raggedright}% +% subsubsection + \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}% + \setaftersubsubsecskip{1.5ex \@plus .2ex}% + \setsubsubsecheadstyle{\normalfont\normalsize\sffamily\bfseries\raggedright}% +% paragraph + \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}% + \setafterparaskip{-1em}% + \setparaheadstyle{\normalfont\normalsize\sffamily\bfseries}% +% subparagraph + \setsubparaindent{\parindent}% + \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}% + \setaftersubparaskip{-1em}% + \setsubparaheadstyle{\normalfont\normalsize\sffamily\bfseries}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hds@ntglike} +% Head styles based on the NTG classes (\texttt{boek.cls}). +% \begin{macrocode} +\makeheadstyles{ntglike}{% +% part + \renewcommand*{\partnamefont}{\Large\bfseries\MakeUppercase}% + \renewcommand*{\partnumfont}{\Large\bfseries}% + \renewcommand*{\parttitlefont}{\Large\MakeUppercase}% +% chapter + \chapterstyle{ntglike} +% section + \setbeforesecskip{-2\onelineskip + \@plus -1\onelineskip \@minus -.5\onelineskip}% + \setaftersecskip{0.5\onelineskip}% + \setsecheadstyle{\normalfont\large\bfseries}% +% subsection + \setbeforesubsecskip{-1\onelineskip + \@plus -.5\onelineskip \@minus -.25\onelineskip}% + \setaftersubsecskip{0.01\onelineskip}% + \setsubsecheadstyle{\normalfont\normalsize\bfseries}% +% subsubsection + \setbeforesubsubsecskip{-1\onelineskip + \@plus -.5\onelineskip \@minus -.25\onelineskip}% + \setaftersubsubsecskip{0.01\onelineskip}% + \setsubsubsecheadstyle{\normalfont\normalsize\slshape}% +% paragraph + \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}% + \setafterparaskip{-1em}% + \setparaheadstyle{\normalfont\normalsize\slshape}% +% subparagraph + \setsubparaindent{\parindent}% + \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}% + \setaftersubparaskip{-1em}% + \setsubparaheadstyle{\normalfont\normalsize\slshape}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hds@tandh} +% Head styles based on Thames \& Hudson \textit{Typography}. +% \begin{macrocode} +\makeheadstyles{tandh}{% +% chapter + \chapterstyle{tandh} +% section + \setbeforesecskip{-2\onelineskip + \@plus -0.5\onelineskip \@minus -.5\onelineskip}% + \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}% + \setsecheadstyle{\normalfont\raggedright\MakeUppercase}% +% subsection + \setbeforesubsecskip{-1.2\onelineskip + \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% + \setaftersubsecskip{0.8\onelineskip \@plus 0.1\onelineskip}% + \setsubsecheadstyle{\normalfont\Large\itshape\raggedright}% +% subsubsection + \setbeforesubsubsecskip{-0.667\onelineskip + \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% + \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}% + \setsubsubsecheadstyle{\normalfont\normalsize\bfseries\raggedright}% +% paragraph + \setbeforeparaskip{1.0\onelineskip + \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% + \setafterparaskip{-1em}% + \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}% +% subparagraph + \setsubparaindent{\parindent}% + \setbeforesubparaskip{1.0\onelineskip + \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% + \setaftersubparaskip{-1em}% + \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hds@wilsondob} +% Head styles based on Adrian Wilson's \textit{The Design of Books}. +% \begin{macrocode} +\makeheadstyles{wilsondob}{% +% chapter + \chapterstyle{wilsondob} +% section + \setbeforesecskip{-1.333\onelineskip + \@plus -0.5\onelineskip \@minus -.5\onelineskip}% + \setaftersecskip{0.667\onelineskip \@plus 0.1\onelineskip}% + \setsecheadstyle{\normalfont\raggedright\MakeUppercase}% +% subsection + \setbeforesubsecskip{-0.667\onelineskip + \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% + \setaftersubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}% + \setsubsecheadstyle{\normalfont\Large\itshape\raggedright}% +% subsubsection + \setbeforesubsubsecskip{-0.667\onelineskip + \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% + \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}% + \setsubsubsecheadstyle{\normalfont\normalsize\raggedright\scshape\MakeLowercase}% +% paragraph + \setbeforeparaskip{1.0\onelineskip + \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% + \setafterparaskip{-1em}% + \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}% +% subparagraph + \setsubparaindent{\parindent}% + \setbeforesubparaskip{1.0\onelineskip + \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% + \setaftersubparaskip{-1em}% + \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}} + +% \end{macrocode} +% \end{macro} +% % % \subsection{Appendices} % @@ -6817,12 +9853,12 @@ % \begin{macro}{\anappendixtrue} % \begin{macro}{\anappendixfalse} % \begin{macro}{\appendix} -% In the standard \Lpack{book} class the |\appendix| command does the +% In the standard \Lpack{book} class the \cs{appendix} command does the % following: % \begin{itemize} % \item Resets the chapter and section counters to zero -% \item Sets |\@chapapp| to |\appendixname|. -% \item Redefines |\thechapter| to produce alphabetic appendix numbers. +% \item Sets \cs{@chapapp} to \cs{appendixname}. +% \item Redefines \cs{thechapter} to produce alphabetic appendix numbers. % \end{itemize} % \changes{v1.618}{2005/09/03}{Added \cs{ifanappendix} (mempatch v3.12)} % \begin{macrocode} @@ -6848,7 +9884,7 @@ % \begin{macro}{\appendixpage} % \begin{macro}{\appendixpage*} % The command to typeset a page announcing the start of the appendices. -% It is based on the |\part| definition. The normal version +% It is based on the \cs{part} definition. The normal version % makes an entry in the ToC but the starred version does not. % \changes{v0.33}{2001/08/31}{Changed implementation of \cs{appendixpage}} % \begin{macrocode} @@ -6863,15 +9899,15 @@ % \verb?\memapppageinfo{\appendixpagename}? \\ % \verb?\memapppagestarinfo{\appendixpagename}? \\ % \begin{macrocode} -\newcommand*{\memapppageinfo}[1]{} -\newcommand*{\memapppagestarinfo}[1]{} +\newcommand{\memapppageinfo}[1]{} +\newcommand{\memapppagestarinfo}[1]{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@apppage} -% |\@apppage| typesets an appendix page and makes an entry in the ToC. +% \cs{@apppage} typesets an appendix page and makes an entry in the ToC. % \begin{macrocode} \def\@apppage{% \@setuppart @@ -6888,7 +9924,7 @@ % % % \begin{macro}{\@sapppage} -% |\@sapppage| typesets an appendix page and does not make an entry in the ToC. +% \cs{@sapppage} typesets an appendix page and does not make an entry in the ToC. % \begin{macrocode} \def\@sapppage{% \@setuppart @@ -6908,8 +9944,11 @@ % This command adds an `appendices' line to the ToC. The style is the same % as used in \Lpack{tocbibind} for the `List of figures' line. That is, % as a Chapter heading. +% \changes{v1.61803}{2008/01/30}{Added \cs{phantomsection} to \cs{addappheadtotoc} +% (mempatch v4.9)} % \begin{macrocode} -\def\addappheadtotoc{\addcontentsline{toc}{chapter}{\appendixtocname}} +\def\addappheadtotoc{% + \phantomsection\addcontentsline{toc}{chapter}{\appendixtocname}} % \end{macrocode} % \end{macro} % @@ -6917,8 +9956,8 @@ % \begin{macro}{\@pprestoresec} % \begin{macro}{\@ppsaveapp} % \begin{macro}{\restoreapp} -% For the |appendices| environment we need to save and restore the -% main document division number and the appendix number. The |\restoreapp| +% For the \Lenv{appendices} environment we need to save and restore the +% main document division number and the appendix number. The \cs{restoreapp} % command is the one for the user. % \begin{macrocode} \newcounter{@ppsavesec} @@ -6943,7 +9982,7 @@ % \begin{macro}{\@resets@pp} % Resets the appropriate sectioning counters and names. This does almost % exactly -% what the default |\appendix| command does, except that it saves and +% what the default \cs{appendix} command does, except that it saves and % restores sectional numbering. It saves the sectional number at the start % and restores the appendix number at the end. % \begin{macrocode} @@ -6962,7 +10001,7 @@ % % \begin{environment}{appendices} % This is the heart of the package. Start it off by doing the resetting -% done by the |\appendix| command but also save the main counters. At the +% done by the \cs{appendix} command but also save the main counters. At the % end of the environment save the appendix number and restore the main counters. % \begin{macrocode} \newenvironment{appendices}% @@ -6981,8 +10020,8 @@ % \end{macro} % % \begin{macro}{\@resets@ppsub} -% Similar to |\@resets@pp| except that it is for use within the -% |subappendices| envirionment; as such, it is a bit simpler. +% Similar to \cs{@resets@pp} except that it is for use within the +% \Lenv{subappendices} environment; as such, it is a bit simpler. % \begin{macrocode} \newcommand{\@resets@ppsub}{ \par @@ -6994,31 +10033,43 @@ % \end{macro} % % \begin{macro}{\ifnamesubappendix} +% \begin{macro}{\namesubappendixtrue} +% \begin{macro}{\namesubappendixfalse} +% \begin{macro}{\namedsubappendices} +% \begin{macro}{\unnamedsubappendices} % Switch for adding an `appendix' name before subappendix numbers. % \changes{v1.0}{2001/11/13}{Added \cs{ifnamesubappendix}} +% \changes{v1.61803}{2008/01/30}{Added \cs{namedsubappendices} and +% \cs{unnamedsubappendices}} % \begin{macrocode} \newif\ifnamesubappendix \namesubappendixfalse +\newcommand*{\namedsubappendices}{\namesubappendixtrue} +\newcommand*{\unnamedsubappendices}{\namesubappendixfalse} % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{environment}{subappendices} % The environment for subappendices. Start it off by doing the resetting -% of the |\section| command. +% of the \cs{section} command. % \changes{v1.0}{2001/11/13}{Modified subappendices environment} % \begin{macrocode} \newenvironment{subappendices}{% \@resets@ppsub % \end{macrocode} -% Change the definition of |\addappheadtotoc| to give a |section| entry. +% Change the definition of \cs{addappheadtotoc} to give a \texttt{section} entry. % \changes{v1.618}{2005/09/02}{Fixed bookmark for \cs{appendixpage} (mempatch v2.3)} % \begin{macrocode} \def\addappheadtotoc{\phantomsection \addcontentsline{toc}{section}{\appendixtocname}} % \end{macrocode} % To implement the naming we do cunning things with the -% |\@seccntformat| command. +% \cs{@seccntformat} command. % \begin{macrocode} \ifnamesubappendix \def\sectionname{\appendixname} @@ -7035,7 +10086,7 @@ % \end{environment} % % \begin{macro}{\@formatsecmark@pp} -% Formats the page header for a redefined |\sectionmark|. +% Formats the page header for a redefined \cs{sectionmark}. % \begin{macrocode} \newcommand{\@formatsecmark@pp}[1]{% \MakeUppercase{\appendixname\space @@ -7140,9 +10191,6 @@ % \end{macrocode} % \end{macro} % -% -% -% % \subsection{Paragraphs} % % \subsubsection{Ragged} @@ -7159,7 +10207,7 @@ % % \begin{macro}{\ragrparindent} % \begin{macro}{\raggedyright} -% |\raggedyright|\oarg{plus} provides controllable ragged right paragraphs. +% \cs{raggedyright}\oarg{plus} provides controllable ragged right paragraphs. % \changes{v1.4}{2003/12/10}{Added \cs{raggedyright}} % \begin{macrocode} \newdimen\ragrparindent @@ -7222,12 +10270,12 @@ % The following commands are used to set the default values for the list % environment's parameters. See the \LaTeX{} manual for an explanation % of the meanings of the parameters. Defaults for the list -% environment are set as follows. First, |\rightmargin|, -% |\listparindent| and |\itemindent| are set to 0pt. Then, for a Kth -% level list, the command |\@listK| is called, where `K' denotes `i', -% '`i', ... , `vi'. (I.e., |\@listiii| is called for a third-level -% list.) By convention, |\@listK| should set |\leftmargin| to -% |\leftmarginK|. +% environment are set as follows. First, \cs{rightmargin}, +% \cs{listparindent} and \cs{itemindent} are set to 0pt. Then, for a Kth +% level list, the command \cs{@listK} is called, where `K' denotes `i', +% '`i', ... , `vi'. (I.e., \cs{@listiii} is called for a third-level +% list.) By convention, \cs{@listK} should set \cs{leftmargin} to +% \cs{leftmarginK}. % % % \begin{macro}{\leftmargin} @@ -7238,7 +10286,7 @@ % \begin{macro}{\leftmarginv} % \begin{macro}{\leftmarginvi} % For efficiency, level-one list's values are defined at top level, and -% |\@listi| is defined to set only |\leftmargin|. +% \cs{@listi} is defined to set only \cs{leftmargin}. % % In two column mode the margins should be smaller than in one column typesetting. % \begin{macrocode} @@ -7248,7 +10296,7 @@ \setlength{\leftmargini}{2.5em} \fi % \end{macrocode} -% The value of |\leftmargin| has to be set at this outer level. +% The value of \cs{leftmargin} has to be set at this outer level. % \begin{macrocode} \leftmargin \leftmargini % \end{macrocode} @@ -7275,7 +10323,7 @@ % \end{macro} % % \begin{macro}{\itemindent} -% Here we set the |\itemindent| which is the extra indentation before +% Here we set the \cs{itemindent} which is the extra indentation before % a label. % \begin{macrocode} \setlength{\itemindent}{\z@} @@ -7284,8 +10332,8 @@ % % \begin{macro}{\labelsep} % \begin{macro}{\labelwidth} -% |\labelsep| is the distance between the label and the text of an -% item; |\labelwidth| is the width of the label. +% \cs{labelsep} is the distance between the label and the text of an +% item; \cs{labelwidth} is the width of the label. % \begin{macrocode} \setlength{\labelsep}{0.5em} \setlength{\labelwidth}{\leftmargini} @@ -7311,6 +10359,44 @@ % \end{macro} % \end{macro} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \begin{macro}{\everylistparindent} +% \begin{macro}{\list} +% The kernel sets \cs{listparindent} to zero within a \cs{list}, where it +% can be overridden in \cs{list}'s second argument. Here it is set to +% \cs{everyparlistindent} by default, which in turn is 0pt. +% \begin{macrocode} +\newdimen\everylistparindent + \everylistparindent \z@ +\renewcommand*{\list}[2]{% + \ifnum \@listdepth >5\relax + \@toodeep + \else + \global\advance\@listdepth\@ne + \fi + \rightmargin\z@ + \listparindent\everylistparindent + \itemindent\z@ + \csname @list\romannumeral\the\@listdepth\endcsname + \def\@itemlabel{#1}% + \let\makelabel\@mklab + \@nmbrlistfalse + #2\relax + \@trivlist + \parskip\parsep + \parindent\listparindent + \advance\linewidth -\rightmargin + \advance\linewidth -\leftmargin + \advance\@totalleftmargin \leftmargin + \parshape \@ne \@totalleftmargin \linewidth + \ignorespaces} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% % \begin{macro}{\parsepi} % \begin{macro}{\topsepi} % \begin{macro}{\itemsepi} @@ -7336,163 +10422,173 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\defaultlists} -% The standard \LaTeX{} classes have list parameters that give some separation -% between lists and |\item|s in a list. This macro sets these values, -% which also depend on the font size. -% \changes{v0.2}{2001/06/03}{Introduced \cs{defaultlist} and \cs{tightlist}} -% \changes{v0.3}{2001/07/09}{Changed \cs{defaultlist} and \cs{tightlist} to -% \cs{defaultlists} and \cs{tightlists} respectively, -% and their supports} -% \begin{macrocode} -\newcommand{\defaultlists}{% %% initialise for 10pt - \setlength\partopsep{2\p@ \@plus 1\p@ \@minus 1\p@} - \parsepi= 4\p@ \@plus2\p@ \@minus\p@ - \topsepi= 8\p@ \@plus2\p@ \@minus4\p@ - \itemsepi= 4\p@ \@plus2\p@ \@minus\p@ - \parsepii= 2\p@ \@plus\p@ \@minus\p@ - \topsepii= 4\p@ \@plus2\p@ \@minus\p@ - \topsepiii= 2\p@ \@plus\p@ \@minus\p@ -\ifcase\@ptsize % 0 = 10pt -\or % 1 = 11pt - \setlength\partopsep{3\p@ \@plus 1\p@ \@minus 1\p@} - \parsepi= 4.5\p@ \@plus2\p@ \@minus\p@ - \topsepi= 9\p@ \@plus3\p@ \@minus5\p@ - \itemsepi= 4.5\p@ \@plus2\p@ \@minus\p@ - \parsepii= 2\p@ \@plus\p@ \@minus\p@ - \topsepii= 4.5\p@ \@plus2\p@ \@minus\p@ - \topsepiii= 2\p@ \@plus\p@ \@minus\p@ -\or % 2 = 12pt - \setlength\partopsep{3\p@ \@plus 2\p@ \@minus 2\p@} - \parsepi= 5\p@ \@plus2.5\p@ \@minus\p@ - \topsepi= 10\p@ \@plus4\p@ \@minus6\p@ - \itemsepi= 5\p@ \@plus2.5\p@ \@minus\p@ - \parsepii= 2.5\p@ \@plus\p@ \@minus\p@ - \topsepii= 5\p@ \@plus2.5\p@ \@minus\p@ - \topsepiii= 2.5\p@ \@plus\p@ \@minus\p@ -\or % 3 = 13pt %% not available -\or % 4 = 14pt - \setlength\partopsep{4\p@ \@plus 2\p@ \@minus 2\p@} - \parsepi= 6\p@ \@plus2.5\p@ \@minus\p@ - \topsepi= 12\p@ \@plus4\p@ \@minus6\p@ - \itemsepi= 6\p@ \@plus2.5\p@ \@minus\p@ - \parsepii= 3\p@ \@plus\p@ \@minus\p@ - \topsepii= 6\p@ \@plus2.5\p@ \@minus\p@ - \topsepiii= 3\p@ \@plus\p@ \@minus\p@ -\or % 5 = 15pt %% not available -\or % 6 = 16pt %% not available -\or % 7 = 17pt - \setlength\partopsep{5\p@ \@plus 2\p@ \@minus 2\p@} - \parsepi= 7\p@ \@plus3\p@ \@minus\p@ - \topsepi= 14\p@ \@plus6\p@ \@minus8\p@ - \itemsepi= 7\p@ \@plus3\p@ \@minus\p@ - \parsepii= 3\p@ \@plus\p@ \@minus\p@ - \topsepii= 7\p@ \@plus3\p@ \@minus\p@ - \topsepiii= 3.5\p@ \@plus\p@ \@minus\p@ -\or % 8 = 18pt %% not available -\or % 9 = 9pt - \setlength\partopsep{2\p@ \@plus 1\p@ \@minus 1\p@} - \parsepi= 3.5\p@ \@plus2\p@ \@minus\p@ - \topsepi= 7\p@ \@plus3\p@ \@minus5\p@ - \itemsepi= 3.5\p@ \@plus2\p@ \@minus\p@ - \parsepii= 2\p@ \@plus\p@ \@minus\p@ - \topsepii= 4\p@ \@plus2\p@ \@minus\p@ - \topsepiii= 2\p@ \@plus\p@ \@minus\p@ -\fi -} - +% \begin{macro}{\itemsepii} +% \begin{macro}{\itemsepiii} +% \begin{macro}{\partopsepii} +% \begin{macro}{\partopsepii} +% We need some new lengths for lists to cater for non-zero \cs{parskip}. +% \changes{v1.61803}{2008/01/30}{Added \cs{itemsepii}, \cs{itemsepiii} and +% \cs{partopsepii} (mempatch v4.6)} +% \begin{macrocode} +\newlength{\itemsepii} +\newlength{\itemsepiii} +\newlength{\partopsepii} +\newlength{\partopsepiii} % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % -% -% \begin{macro}{\tightlists} -% This macro sets the parameters for lists that have less open vertical -% space in them. I think that these look neater than the defaults. -% Effectively, no additional vertical space is added. If there is a -% blank line before a list, then an extra 1/2 blank line is added before -% \emph{and} after the list (making one blank line in total). -% \begin{macrocode} -\newcommand{\tightlists}{% - \setlength\partopsep{0.5\onelineskip \@plus 0\p@ \@minus 0\p@} - \parsepi= \parskip - \itemsepi = \p@ \@plus\p@ \@minus\p@ - \topsepi = 0.5\parskip - \parsepii = \parskip - \topsepii = 0.5\parskip - \topsepiii = 0.5\parskip -} +% \begin{macro}{\setnzplist} +% Common code for non-zero \cs{parskip} in lists. +% \begin{macrocode} +\newcommand*{\setnzplist}{% + \partopsep \p@ \@plus\z@ \@minus\p@ + \topsepi\z@ + \parsepi\parskip + \itemsepi\z@ + \topsepii\z@ + \parsepii\parskip + \itemsepii\z@ + \topsepiii\z@ +%% \parsepiii\parskip + \itemsepiii\z@} % \end{macrocode} % \end{macro} % -% \begin{macro}{\@listI} -% \begin{macro}{\@listi} -% |\@listI| defines top level and |\@listi| values of -% |\leftmargin|, |\parsep|, |\topsep|, and |\itemsep| -% -% \begin{macrocode} -\def\@listi{\leftmargin\leftmargini - \parsep\parsepi - \topsep\topsepi - \itemsep\itemsepi} -\let\@listI\@listi -% \end{macrocode} -% We should initialise these parameters to the standard defaults -% \begin{macrocode} +% \begin{macro}{\defaultlists} +% The standard \LaTeX\ classes have list parameters that give some +% separation between lists and \cs{item}s in lists. This macro sets +% those values. This is a simplification of memoir's original, and will +% apply to any font size. +% \changes{v1.61803}{2008/01/30}{Complete replacement of \cs{defaultlists} +% (mempatch 4.5)} +% \begin{macrocode} +\newcommand*{\defaultlists}{% + \setlength{\partopsep}{0.2\onelineskip \@plus 0.1\onelineskip + \@minus 0.1\onelineskip}% + \parsepi = 0.3333\onelineskip \@plus 0.1667\onelineskip \@minus \p@ + \itemsepi = \parsepi + \topsepi = 0.6667\onelineskip \@plus 0.3333\onelineskip + \@minus 0.2\onelineskip + \parsepii = 0.1667\onelineskip \@plus \p@ \@minus \p@ + \topsepii = \parsepi + \topsepiii = \parsepii + \everylistparindent \listparindent +% \end{macrocode} +% Additional code to cater for non-zero \cs{parskip}s. +% \changes{v1.61803}{2008/01/30}{Modified \cs{defaultlists} for +% non-zero \cs{parskip} (memptach v4.6)} +% \begin{macrocode} + \itemsepii\parsepii + \itemsepiii\topsepiii + \partopsepiii \p@ \@plus\z@ \@minus\p@ + \ifm@mnzpskip + \setnzplist + \fi} \defaultlists -\@listi % \end{macrocode} % \end{macro} -% \end{macro} -% % -% \begin{macro}{\@listii} -% \begin{macro}{\@listiii} -% \begin{macro}{\@listiv} -% \begin{macro}{\@listv} -% \begin{macro}{\@listvi} -% Here are the same macros for the lower level lists. +% \begin{macro}{\firmlists} +% \begin{macro}{\firmlists*} +% \begin{macro}{\m@msfirmlists} +% \begin{macro}{\m@mfirmlists} +% These give approximately half the vertical spacing of the default lists, +% with all spaces equal. The starred version allows slightly less space +% before and after the list when it is preceded by a blank line. +% \changes{v1.61803}{2008/01/30}{Added \cs{firmlists}, etc. (mempatch v4.5)} % \begin{macrocode} -\def\@listii{\leftmargin\leftmarginii - \labelwidth\leftmarginii - \advance\labelwidth-\labelsep - \topsep\topsepii - \parsep\parsepii - \itemsep\parsep} +\newcommand*{\firmlists}{% + \@ifstar{\m@msfirmlists}{\m@mfirmlists}} -\def\@listiii{\leftmargin\leftmarginiii - \labelwidth\leftmarginiii - \advance\labelwidth-\labelsep - \topsep\topsepiii - \parsep\z@ - \partopsep \p@ \@plus\z@ \@minus\p@ - \itemsep\topsep} +\newcommand*{\m@msfirmlists}{ + \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}% + \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@ + \itemsepi = \parsepi + \topsepi = \parsepi + \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@ + \topsepii = \parsepi + \topsepiii = \parsepii + \everylistparindent\listparindent} -\def\@listiv{\leftmargin\leftmarginiv - \labelwidth\leftmarginiv - \advance\labelwidth-\labelsep} +\newcommand*{\m@mfirmlists}{ + \setlength{\partopsep}{0.1\onelineskip \@plus 0.05\onelineskip + \@minus 0.05\onelineskip}% + \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@ + \itemsepi = \parsepi + \topsepi = \parsepi + \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@ + \topsepii = \parsepi + \topsepiii = \parsepii + \everylistparindent\listparindent} -\def\@listv{\leftmargin\leftmarginv - \labelwidth\leftmarginv - \advance\labelwidth-\labelsep} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\tightlists} +% \begin{macro}{\tightlists*} +% \begin{macro}{\m@mstightlists} +% \begin{macro}{\m@mtightlists} +% This macro sets the parameters for lists that have less open vertical +% space in them. I think that these look neater than the defaults. +% Effectively, no additional vertical space is added. +% The starred version allows slightly no extra space +% before and after the list when it is preceded by a blank line, +% whereas the unstarred version puts half a \cs{onelineskip} +% before \emph{and} after. +% \changes{v1.61803}{2008/01/30}{Revised \cs{tightlists}, etc. (mempatch v4.5)} +% \changes{v1.61803}{2008/01/30}{Revised \cs{tightlists} for non-zero +% \cs{parskip}(mempatch v4.6)} +% \begin{macrocode} +\newcommand*{\tightlists}{% + \@ifstar{\m@mstightlists}{\m@mtightlists}} + +\newcommand*{\m@mstightlists}{% + \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}% + \parsepi = \z@ \@plus \p@ \@minus \p@ + \itemsepi = \parsepi + \topsepi = \z@ \@plus \p@ \@minus \p@ + \parsepii = \z@ \@plus \p@ \@minus \p@ + \topsepii = \parsepi + \topsepiii = \parsepii + \everylistparindent\parindent + \ifm@mnzpskip + \setnzplist + \partopsepiii\partopsep + \fi} -\def\@listvi{\leftmargin\leftmarginvi - \labelwidth\leftmarginvi - \advance\labelwidth-\labelsep} +\newcommand*{\m@mtightlists}{% + \setlength{\partopsep}{0.5\onelineskip \@plus \p@ \@minus \p@}% + \parsepi = \z@ \@plus \p@ \@minus \p@ + \itemsepi = \parsepi + \topsepi = \z@ \@plus \p@ \@minus \p@ + \parsepii = \z@ \@plus \p@ \@minus \p@ + \topsepii = \parsepi + \topsepiii = \parsepii + \everylistparindent\parindent + \ifm@mnzpskip + \setnzplist + \partopsepiii\partopsep + \fi} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} -% \end{macro} % % \begin{macro}{\firmlist} % \begin{macro}{\tightlist} % These two macros can be used at the start of a list environment to -% reduce the vertical gaps. |\tightlist| removes all interior spaces -% while |\firmlist| only removes some. +% reduce the vertical gaps. \cs{tightlist} removes all interior spaces +% while \cs{firmlist} only removes some. % \changes{v0.3}{2001/07/09}{Added \cs{firmlist} and reimplemented the % original \cs{tightlist}} % \begin{macrocode} @@ -7505,15 +10601,15 @@ % \end{macro} % \end{macro} % -% The space before and after a |trivlist| environment is controlled -% by the |\topsep| and |\partopsep| skips. There are several environments, -% such as |center|, that are defined as a |trivlist|. +% The space before and after a \Lenv{trivlist} environment is controlled +% by the \cs{topsep} and \cs{partopsep} skips. There are several environments, +% such as \Lenv{center}, that are defined as a \Lenv{trivlist}. % % \begin{macro}{\m@msavetopsep} % \begin{macro}{\m@msavepartopsep} % \begin{macro}{\savetrivseps} % \begin{macro}{\restoretrivseps} -% Two skips to store the |\topsep| and |\partopsep| values and a means +% Two skips to store the \cs{topsep} and \cs{partopsep} values and a means % of setting them and restoring them. % \changes{v1.6}{2004/01/28}{Added methods for adjusting the space around % a trivlist} @@ -7527,7 +10623,7 @@ \topsep\m@msavetopsep \partopsep\m@msavepartopsep} % \end{macrocode} -% Save the initial |\topsep| and |\partopsep| values. +% Save the initial \cs{topsep} and \cs{partopsep} values. % \begin{macrocode} \savetrivseps @@ -7538,7 +10634,7 @@ % \end{macro} % % \begin{macro}{\zerotrivseps} -% A macro to zero |\topsep| and |\partopsep|. +% A macro to zero \cs{topsep} and \cs{partopsep}. % \begin{macrocode} \newcommand*{\zerotrivseps}{% \topsep\z@ @@ -7548,6 +10644,72 @@ % \end{macro} % % +% \begin{macro}{\@listI} +% \begin{macro}{\@listi} +% \cs{@listI} defines top level and \cs{@listi} values of +% \cs{leftmargin}, \cs{parsep}, \cs{topsep}, and \cs{itemsep} +% +% \begin{macrocode} +\def\@listi{\leftmargin\leftmargini + \parsep\parsepi + \topsep\topsepi + \itemsep\itemsepi} +\let\@listI\@listi +% \end{macrocode} +% We should initialise these parameters to the standard defaults +% \begin{macrocode} +\defaultlists +\@listi + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\@listii} +% \begin{macro}{\@listiii} +% \begin{macro}{\@listiv} +% \begin{macro}{\@listv} +% \begin{macro}{\@listvi} +% Here are the same macros for the lower level lists. +% \begin{macrocode} +\def\@listii{\leftmargin\leftmarginii + \labelwidth\leftmarginii + \advance\labelwidth-\labelsep + \topsep\topsepii + \parsep\parsepii + \itemsep\parsepii} + +\def\@listiii{\leftmargin\leftmarginiii + \labelwidth\leftmarginiii + \advance\labelwidth-\labelsep + \topsep\topsepiii + \parsep\z@ +%%% \itemsep\topsep +%%% \partopsep \p@ \@plus\z@ \@minus\p@ + \itemsep\itemsepiii + \partopsep\partopsepiii} + +\def\@listiv{\leftmargin\leftmarginiv + \labelwidth\leftmarginiv + \advance\labelwidth-\labelsep} + +\def\@listv{\leftmargin\leftmarginv + \labelwidth\leftmarginv + \advance\labelwidth-\labelsep} + +\def\@listvi{\leftmargin\leftmarginvi + \labelwidth\leftmarginvi + \advance\labelwidth-\labelsep} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% % \subsection{Enumerate} % % @@ -7579,7 +10741,7 @@ % \begin{macro}{\labelenumiii} % \begin{macro}{\labelenumiv} % The label for each item is generated by the commands\\ -% |\labelenumi| \ldots\ |\labelenumiv|. +% \cs{labelenumi} \ldots\ \cs{labelenumiv}. % \begin{macrocode} \newcommand{\labelenumi}{\theenumi.} \newcommand{\labelenumii}{\theenumii)} @@ -7594,8 +10756,8 @@ % \begin{macro}{\p@enumii} % \begin{macro}{\p@enumiii} % \begin{macro}{\p@enumiv} -% The expansion of |\p@enumN||\theenumN| defines the output of a -% |\ref| command when referencing an item of the Nth level of an +% The expansion of \verb?\p@enumN\theenumN? defines the output of a +% \cs{ref} command when referencing an item of the Nth level of an % enumerated list. % \begin{macrocode} \renewcommand{\p@enumii}{\theenumi} @@ -7615,13 +10777,13 @@ % This package gives the enumerate environment an optional argument % which determines the style in which the counter is printed. % -% An occurence of one of the tokens |A a I i| or |1| produces the value -% of the counter printed with (respectively) |\Alph \alph \Roman \roman| -% or |\arabic|. +% An occurence of one of the tokens \verb?A a I i? or \verb?1? produces the value +% of the counter printed with (respectively) \verb?\Alph \alph \Roman \roman? +% or \cs{arabic}. % % These letters may be surrounded by any strings involving any other -% \TeX\ expressions, however the tokens |A a I i 1| must be inside a -% |{ }| group if they are not to be taken as special. +% \TeX\ expressions, however the tokens \verb?A a I i 1? must be inside a +% \verb?{ }? group if they are not to be taken as special. % % % \begin{macro}{\@enlab} @@ -7633,7 +10795,7 @@ % \end{macro} % % \begin{macro}{\@enQmark} -% This just expands to a `?'. |\ref| will produce this, if no counter +% This just expands to a `?'. \cs{ref} will produce this, if no counter % is printed. % \begin{macrocode} \def\@enQmark{?} @@ -7642,13 +10804,13 @@ % % The next four macros build up the command that will print the item % label. They each gobble one token or group from the optional argument, -% and add corresponding tokens to the register |\@enLab|. They each end -% with a call to |\@enloop|, which starts the processing of the next +% and add corresponding tokens to the register \cs{@enLab}. They each end +% with a call to \cs{@enloop}, which starts the processing of the next % token. % \begin{macro}{\@enLabel} -% Add the counter to the label. |#2| will be one of the `special' -% tokens |A a I i 1|, and is thrown away. |#1| will be a command -% like |\Roman|. +% Add the counter to the label. \verb?#2? will be one of the `special' +% tokens \verb?A a I i 1?, and is thrown away. \verb?#1? will be a command +% like \cs{Roman}. % \begin{macrocode} \def\@enLabel#1#2{% \edef\@enThe{\noexpand#1{\@enumctr}}% @@ -7669,7 +10831,7 @@ % \end{macro} % % \begin{macro}{\@enGroup} -% Add a |{ }| group to the label. +% Add a \verb?{ }? group to the label. % \begin{macrocode} \def\@enGroup#1{\@enLab\expandafter{\the\@enLab{#1}}\@enloop} % \end{macrocode} @@ -7685,9 +10847,9 @@ % \begin{macro}{\@enloop} % \begin{macro}{\@enloop@} % The body of the main loop. -% Eating tokens this way instead of using |\@tfor| lets you see -% spaces and {\bf all} braces. |\@tfor| would treat {\tt a} and -% |{a}| as special, but not |{{a}}|. +% Eating tokens this way instead of using \cs{@tfor} lets you see +% spaces and \textbf{all} braces. \cs{@tfor} would treat \verb?a? and +% \verb?{a}? as special, but not \verb?{{a}}?. % \begin{macrocode} \def\@enloop{\futurelet\@entemp\@enloop@} % \end{macrocode} @@ -7723,11 +10885,11 @@ % Some packages may want to extend the number of special characters % that are associated with counter representations. This feature % was requested to enable Russian alphabetic counting, but here -% I give an example of a footnote symbol counter, triggered by |*|. +% I give an example of a footnote symbol counter, triggered by \verb?*?. % % To enable a new counter type based on a letter, you just need -% to add a new |\ifx| clause by analogy with the code above. -% So for example to make |*| trigger footnote symbol counting. +% to add a new \cs{ifx} clause by analogy with the code above. +% So for example to make \verb?*? trigger footnote symbol counting. % a package should do the following. % % Initialise the hook, in case the package is loaded before @@ -7736,8 +10898,8 @@ % \providecommand\@enhook{} %\end{verbatim} % -% Add to the hook a new |\ifx| clause that associates |*| with the -% |\fnsymbol| counter command. +% Add to the hook a new \cs{ifx} clause that associates \verb?*? with the +% \cs{fnsymbol} counter command. %\begin{verbatim} % \g@addto@macro\@enhook{% % \ifx *\@entemp @@ -7751,7 +10913,7 @@ % At this point we just need initialise the hook, taking care not % to over write any definitions another package may already have added. % (PRW: as this is now in a class, it can be defined instead of -% |\provide|d). +% \cs{provide}d). % \begin{macrocode} %% \providecommand\@enhook{} \newcommand\@enhook{} @@ -7759,10 +10921,10 @@ % \end{macro} % % \begin{macro}{\enumerate} -% The new {\tt enumerate} environment. This is the first half of the +% The new \Lenv{enumerate} environment. This is the first half of the % original enumerate environment. If there is an optional argument, call -% |\@@enum@| to define the label commands, otherwise call -% |\@enum@| which is the second half of the original definition. +% \cs{@@enum@} to define the label commands, otherwise call +% \cs{@enum@} which is the second half of the original definition. % \begin{macrocode} \def\enumerate{% \ifnum \@enumdepth >3 \@toodeep\else @@ -7778,12 +10940,12 @@ \def\@@enum@[#1]{% % \end{macrocode} % Initialise the loop which will break apart the optional argument. -% The command to print the label is built up in |\@enlab|. -% |\@enThe| will be used to define |\theenum|\,$n$. +% The command to print the label is built up in \cs{@enlab}. +% \cs{@enThe} will be used to define \cs{theenum}\,$n$. % \begin{macrocode} \@enLab{}\let\@enThe\@enQmark % \end{macrocode} -% The |\@enum@| below is never expanded, it is used to detect the end +% The \cs{@enum@} below is never expanded, it is used to detect the end % of the token list. % \begin{macrocode} \@enloop#1\@enum@ @@ -7793,21 +10955,21 @@ \ifx\@enThe\@enQmark\@warning{The counter will not be printed.% ^^J\space\@spaces\@spaces\@spaces The label is: \the\@enLab}\fi % \end{macrocode} -% Define |\labelenum|$\,n$ and |\theenum|$\,n$. +% Define \cs{labelenum}$\,n$ and \cs{theenum}$\,n$. % \begin{macrocode} \expandafter\edef\csname label\@enumctr\endcsname{\the\@enLab}% \expandafter\let\csname the\@enumctr\endcsname\@enThe % \end{macrocode} % Set the counter to 7 so that we get the width of `vii' if roman -% numbering is in force then set |\leftmargin|$\,n$. to the width of the -% label plus |\labelsep|. +% numbering is in force then set \cs{leftmargin}$\,n$. to the width of the +% label plus \cs{labelsep}. % \begin{macrocode} \csname c@\@enumctr\endcsname7 \expandafter\settowidth \csname leftmargin\romannumeral\@enumdepth\endcsname {\the\@enLab\hspace{\labelsep}}% % \end{macrocode} -% Finally call |\@enum@| which is the second half of the original +% Finally call \cs{@enum@} which is the second half of the original % definition. % \begin{macrocode} \@enum@} @@ -7815,8 +10977,8 @@ % \end{macro} % % \begin{macro}{\@enum@} -% All the list parameters have now been defined, so call |\list|. This -% is taken straight from the original definition of |\enumerate|. +% All the list parameters have now been defined, so call \cs{list}. This +% is taken straight from the original definition of \cs{enumerate}. % \begin{macrocode} \def\@enum@{\list{\csname label\@enumctr\endcsname}% {\usecounter{\@enumctr}\def\makelabel##1{\hss\llap{##1}}}} @@ -7835,8 +10997,8 @@ % \begin{macro}{\labelitemii} % \begin{macro}{\labelitemiii} % \begin{macro}{\labelitemiii} -% Itemization is controlled by the commands: |\labelitemi|, -% |\labelitemii|, etc., which define +% Itemization is controlled by the commands: \cs{labelitemi}, +% \cs{labelitemii}, etc., which define % the labels of the various itemization levels: the symbols used are: % bullet (\textbullet), bold en-dash (\textbf{\textendash}), % centered asterisk (\textasteriskcentered), and centered dot @@ -7853,12 +11015,12 @@ % \end{macro} % \end{macro} % -% It seems like a reasonable idea to give the |itemize| environment -% an optional argument to match |enumerate|. Fortunately this seems +% It seems like a reasonable idea to give the \Lenv{itemize} environment +% an optional argument to match \Lenv{enumerate}. Fortunately this seems % to be much simpler and I might even be able to work it out for myself. % % \begin{environment}{itemize} -% This is a hack at the kernel code for |itemize|. +% This is a hack at the kernel code for \Lenv{itemize}. % \begin{macrocode} \renewcommand{\itemize}[1][\@empty]{% \ifnum \@itemdepth >\thr@@\@toodeep\else @@ -7900,7 +11062,7 @@ % % \begin{macro}{\descriptionlabel} % To change the formatting of the label, you must redefine -% |\descriptionlabel|. +% \cs{descriptionlabel}. % % \begin{macrocode} \newcommand*{\descriptionlabel}[1]{\hspace\labelsep @@ -7937,7 +11099,7 @@ % \begin{environment}{quotation} % The quotation environment is defined by making clever use of % the list environment's parameters. The lines in the environment -% are set smaller than |\textwidth|. The first line of a paragraph +% are set smaller than \cs{textwidth}. The first line of a paragraph % inside this environment is indented. % % \begin{macrocode} @@ -7992,53 +11154,449 @@ % \end{environment} % % \begin{macro}{\symboldef} -% Within a |symbols| environment the command -% |\symboldef{|\meta{symbol}|}{|\meta{meaning}|}| +% Within a \Lenv{symbols} environment the command +% \cs{symboldef}\marg{symbol}\marg{meaning} % is used to specify and explain each symbol or abbreviation. % \begin{macrocode} \newcommand{\symboldef}[2]{\item[#1] #2} % \end{macrocode} % \end{macro} % +% \section{Abstracts} +% +% Books usually do not have abstracts, but I decided to add in the code +% from the \Lpack{abstract} +% package~\cite{ABSTRACT}. +% \changes{v0.3}{2001/07/09}{Added code for abstracts} +% +% +% We just have the \Lpack{report} or \Lpack{article} style for the +% abstract with no \Lopt{titlepage} option. The original code, +% from \file{classes.dtx} for this is: +% \begin{verbatim} +% \newenvironment{abstract}{% +% \if@twocolumn +% \section*{\abstractname} +% \else +% \small +% \begin{center}% +% {\bfseries \abstractname\vspace{-.5em}\vspace{\z@}}%% +% \end{center}% +% \quotation +% \fi}% +% {\if@twocolumn\else\endquotation\fi} +% \end{verbatim} +% +% +% The following \cs{if...} commands are for implementing various options. +% \begin{macro}{\if@bsonecol} +% \begin{macro}{\ifadd@bstotoc} +% \begin{macro}{\ifnumber@bs} +% \begin{macro}{\if@bsrunin} +% \begin{macrocode} +\newif\if@bsonecol + \@bsonecoltrue +\newif\ifadd@bstotoc + \add@bstotocfalse +\newif\ifnumber@bs + \number@bsfalse +\newif\if@bsrunin + \@bsruninfalse + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\abstractcol} +% \begin{macro}{\abstractintoc} +% \begin{macro}{\abstractnum} +% \begin{macro}{\abstractrunin} +% These are the use-level commands for setting the options. If +% the abstract is runin, then it must not be numbered otherwise +% adding it to the ToC might result in something peculiar. +% \begin{macrocode} +\newcommand{\abstractcol}{\@bsonecolfalse} +\newcommand{\abstractintoc}{\add@bstotoctrue} +\newcommand{\abstractnum}{\number@bstrue\@bsruninfalse} +\newcommand{\abstractrunin}{\@bsrunintrue\number@bsfalse} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% The next set of macros comprise the +% implementation of the \Lenv{abstract} environment. +% +% \begin{macro}{\abstractnamefont} +% \begin{macro}{\abstracttextfont} +% These two macros are for specifying the fonts for typesetting the +% abstract's title and text. They are initialised for the default case +% (i.e., no class options). +% \begin{macrocode} +\newcommand{\abstractnamefont}{\normalfont\small\bfseries} +\newcommand{\abstracttextfont}{\normalfont\small} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\abscolnamefont} +% \begin{macro}{\abscoltextfont} +% These two macros are for specifying the fonts for typesetting the +% abstract's title and text in a two column document where the abstarct +% is part of a column. +% \changes{v1.61803}{2008/01/30}{Added \cs{abscolnamefont} and +% \cs{abscoltextfont} (mempatch v4.8)} +% \begin{macrocode} +\newcommand{\abscolnamefont}{\normalfont\Large\bfseries} +\newcommand{\abscoltextfont}{\normalfont} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\absnamepos} +% \begin{macro}{\abstitleskip} +% \cs{absnamepos} specifies the environment in which the abstract's title +% name will be typeset, and the length \cs{abstitleskip} is an adjustement +% to the vertical space between the title and the abstract's text. These +% are initialised for the default case. +% \begin{macrocode} +\newcommand{\absnamepos}{center} +\newlength{\abstitleskip} \setlength{\abstitleskip}{-0.5em} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\absleftindent} +% \begin{macro}{\abs@leftindent} +% \begin{macro}{\absrightindent} +% \begin{macro}{\absparindent} +% \begin{macro}{\absparsep} +% The abstract's text is typeset as a single item list, called +% \texttt{@bstr@ctlist}. These lengths set the left and right margin indents, the +% paragraph indentation, and the inter-paragraph vertical space. Their +% initial values are all class option-dependent. +% \changes{v1.618}{2005/09/03}{Added \cs{abs@leftindent} per Lars Madsen (mempatch v3.0)} +% \begin{macrocode} +\newlength{\absleftindent} + \absleftindent=\leftmargin +\newdimen\abs@leftindent + \abs@leftindent=\leftmargin +\newlength{\absrightindent} + \absrightindent=\leftmargin +\newlength{\absparindent} +\newlength{\absparsep} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\abslabeldelim} +% \begin{macro}{\@bslabeldelim} +% The contents of \cs{abslabeldelim} are typeset after a run-in heading. +% \begin{macrocode} +\newcommand{\abslabeldelim}[1]{\def\@bslabeldelim{#1}} +\abslabeldelim{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@bsrunintitle} +% This macro typeset the run-in heading. +% \begin{macrocode} +\newcommand{\@bsrunintitle}{% + \hspace*{\abstitleskip}{\abstractnamefont\abstractname\@bslabeldelim}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setup@bstract} +% Now arrange to set all the class option-dependent values. +% \changes{v1.618}{2005/09/03}{Used \cs{abs@leftindent} in \cs{setup@bstract} (mempatch v3.0)} +% \changes{v1.61803}{2008/01/30}{Changed \cs{setup@bstract} to cater for +% \cs{abscolnamefont}, etc., and don't set +% \cs{absrightindent} to \cs{absleftindent}.} +% \begin{macrocode} +\newcommand{\setup@bstract}{% + \abs@leftindent=\absleftindent + \if@twocolumn +% \end{macrocode} +% Values for the \Lopt{twocolumn} class option. +% \begin{macrocode} + \if@bsonecol + \else + \abs@leftindent=\z@ + \absrightindent=\z@ + \renewcommand*{\abstractnamefont}{\abscolnamefont} + \renewcommand*{\abstracttextfont}{\abscoltextfont} + \renewcommand*{\absnamepos}{flushleft} + \setlength{\abstitleskip}{-2ex} + \fi + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\AtBeginDocument{\setlength{\absparindent}{\parindent} + \setlength{\absparsep}{\parskip}} + +% \end{macrocode} +% +% \begin{environment}{@bstr@ctlist} +% The abstract's text is typeset within the \Lenv{@bstr@ctlist} list environment. +% \changes{v1.618}{2005/09/03}{Used \cs{abs@leftindent} in \cs{@bstr@ctlist} (mempatch v3.0)} +% \begin{macrocode} +\newenvironment{@bstr@ctlist}{% + \list{}{% + %%\topsep \z@ + \partopsep \z@ + \listparindent \absparindent + \itemindent \listparindent + \leftmargin \abs@leftindent + \rightmargin \absrightindent + \parsep \absparsep}% + \item\relax} + {\endlist} + +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\put@bsintoc} +% This macro adds the abstract's title to the ToC. It does nothing if +% the abstract is being numbered. +% \begin{macrocode} +\newcommand{\put@bsintoc}{% + \ifadd@bstotoc + \ifnumber@bs\else + \phantomsection + \addcontentsline{toc}{chapter}{\abstractname} + \fi + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\num@bs} +% This macro generates a numbered abstract heading. +% \begin{macrocode} +\newcommand{\num@bs}{\chapter{\abstractname}} + +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{abstract} +% At last we are in position to define the \Lenv{abstract} environment. This +% follows very much along the lines of the standard class definitions, but with +% macros inserted at strategic points. +% +% The \Lopt{twocolumn} option and the default case. These use the same code +% as any style differences are embedded in the new macros. +% \begin{macrocode} +\newenvironment{abstract}{% + \setup@bstract + \if@bsrunin\else + \ifnumber@bs \num@bs \else + \begin{\absnamepos}\abstractnamefont\abstractname\end\absnamepos% + \vspace{\abstitleskip}% + \fi + \fi + \put@bsintoc% + \begin{@bstr@ctlist}\if@bsrunin\@bsrunintitle\fi\abstracttextfont}% + {\par\end{@bstr@ctlist}} + +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{onecolabstract} +% An environment for typesetting a single column abstract, +% particularly as the optional argument to the \cs{twocolumn} command. +% \begin{macrocode} +\newenvironment{onecolabstract}{% + \begin{@twocolumnfalse}\begin{abstract}}{% + \end{abstract}\end{@twocolumnfalse}} + +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\thanks} +% \begin{macro}{\@bs@thanks} +% We have to keep the contents of the \cs{thanks} commands as normally these +% are emptied by the \cs{maketitle} command. I do this by extending the definition +% of the \cs{thanks} (from \file{ltsect.dtx}) command, +% so that \cs{@bs@thanks} has a copy of the contents +% of \cs{@thanks}. +% \begin{macrocode} +\addtoiargdef{\thanks}{}{% + \protected@xdef\@bs@thanks{\@bs@thanks + \protect\footnotetext[\the\c@footnote]{#1}}% +} +\let\@bs@thanks\@empty + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\saythanks} +% This macro typesets any \cs{thanks} commands \emph{after} using +% \texttt{onecolabstract}. +% \begin{macrocode} +\newcommand{\saythanks}{\begingroup + \renewcommand{\thefootnote}{\fnsymbol{footnote}}\@bs@thanks + \endgroup\global\let\@bs@thanks\@empty} + +% \end{macrocode} +% \end{macro} +% % % \section{Verse} % -% The class provides a more flexible |verse| environment than the +% The class provides a more flexible \Lenv{verse} environment than the % standard classes. This is based on the \Lpack{verse} % package~\cite{VERSE}. % \changes{v1.0}{2001/10/30}{Complete rewrite of verse typesetting} % % \subsection{Environments} % +% Before proceeding with the main, here are some macros for aspects +% of line numbering. % -% \begin{macro}{vslineno} -% We need counters for stanza and poem lines. +% \begin{macro}{\c@vslineno} +% \begin{macro}{\c@poemline} +% \begin{macro}{\c@modulo@vs} +% \begin{macro}{\c@memfvsline} +% We need counters for stanza and poem lines. The \texttt{memfvsline} +% counter is for adjusting the starting line for verse line numbers. % \changes{v1.1}{2002/03/10}{Added poemline and modulo@vs counters} +% \changes{v1.61803}{2008/01/30}{Added memfvsline counter (mempatch v4.9)} % \begin{macrocode} \newcounter{vslineno} \newcounter{poemline} \newcounter{modulo@vs} +\newcounter{memfvsline} % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\poemlines} -% |\poemlines{|\meta{nth}|}| specifies that every \meta{nth} line of +% \cs{poemlines}\marg{nth} specifies that every \meta{nth} line of % a poem is to be numbered. % \changes{v1.1}{2002/03/10}{Added \cs{poemlines}} % \changes{v1.2}{2002/07/27}{\cs{poemlines} now just calls \cs{linenumberfrequency}} +% \changes{v1.61803}{2008/01/30}{Deleted \cs{poemlines}.} % \begin{macrocode} -\newcommand{\poemlines}[1]{\linenumberfrequency{#1}% - \@memwarn{Use \string\linenumberfrequency\space - instead of \string\poemlines}% -} +%%%\newcommand{\poemlines}[1]{\linenumberfrequency{#1}% +%%% \@memwarn{Use \string\linenumberfrequency\space +%%% instead of \string\poemlines}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\linenumberfont} +% \begin{macro}{\vlvnumfont} +% Set line numbering font(s). +% \begin{macrocode} +\newcommand{\linenumberfont}[1]{\def\vlvnumfont{#1}} +%%% \linenumberfont{\small\rmfamily} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\ifbvcountlines} +% \begin{macro}{\bvcountlinestrue} +% \begin{macro}{\bvcountlinesfalse} +% Looking ahead, TRUE for (boxed) verbatim line numbers to be printed. Default +% is not to print them. Not that \cs{linenumberfrequency} twiddles with this. +% \begin{macrocode} +\newif\ifbvcountlines% TRUE to print line numbers of (boxed) verbatim lines + \bvcountlinesfalse + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\linenumberfrequency} +% \begin{macro}{\linemodnum} +% Set numbering intervals (number modulo). Default is modulus 0. +% \begin{macrocode} +\newcommand{\linenumberfrequency}[1]{% + \ifnum #1< \@ne + \def\linemodnum{0\relax} + \bvcountlinesfalse + \else + \def\linemodnum{#1\relax} + \bvcountlinestrue + \fi} + +%%%%\linenumberfrequency{0} % \end{macrocode} % \end{macro} +% \end{macro} +% +% \begin{macro}{\setverselinenums} +% \cs{setverselinenums}\marg{firstline}\marg{startnumsat} sets the first line +% number to \meta{firstline} and the first line number to be printed is +% \meta{startnumsat}. Use within the \Lenv{verse} environment before the +% first verse. Note that \\ +% \verb?firstline <= startnumsat < firstline + linenumberfrequency? +% \changes{v1.61803}{2008/01/30}{Added \cs{setverselinenums} (mempatch v4.9)} +% \begin{macrocode} +\newcommand*{\setverselinenums}[2]{% + \c@poemline #1\relax \advance\c@poemline \m@ne + \refstepcounter{poemline}% + \ifnum\z@<\linemodnum% we are printing line numbers + \@tempcnta #2\relax + \divide\@tempcnta\linemodnum + \multiply\@tempcnta\linemodnum + \c@memfvsline #2\relax + \advance\c@memfvsline-\@tempcnta + \fi} + +% \end{macrocode} +% \end{macro} % % \changes{v1.1}{2002/03/24}{Added \cs{getmodulo@vs}} % \changes{v1.2}{2002/07/27}{Using \cs{getthelinenumber} instead of \cs{getmodulo@vs}} % +% \begin{macro}{\getthelinenumber} +% \cs{getthelinenumber}\marg{counter}\marg{start} returns \cs{thecounter} +% if it is exactly divisible by \cs{linenumberfrequency}, provided this is +% not zero. \meta{start} is the first number. +% \changes{v1.61802}{2008/01/30}{Generalised \cs{getthelinenumber} to cater +% for set of first line number.} +% \begin{macrocode} +\newcommand{\getthelinenumber}[2]{% + \ifnum\@ne>\linemodnum% no line numbers + \else + \ifnum\@ne=\linemodnum% every line numbered + \@nameuse{the#1}% + \else + \@tempcnta=\@nameuse{c@#1}% + \advance\@tempcnta -\@nameuse{c@#2}% + \divide\@tempcnta \linemodnum + \multiply\@tempcnta \linemodnum + \advance\@tempcnta \@nameuse{c@#2}% + \ifnum\@tempcnta=\@nameuse{c@#1}\@nameuse{the#1}\fi + \fi + \fi} + +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\ifaltindent} % This should be set TRUE for indenting alternate lines. % \begin{macrocode} @@ -8056,7 +11614,7 @@ % \end{macro} % % \begin{macro}{\ifstarpattern} -% This should be set TRUE for indenting lines according in a |patverse*| +% This should be set TRUE for indenting lines according in a \Lenv{patverse*} % environment. % \changes{v1.1}{2002/03/8}{Added \cs{ifstarpattern}} % \begin{macrocode} @@ -8066,9 +11624,6 @@ % \end{macrocode} % \end{macro} % -% -% -% % \begin{macro}{\vleftskip} % \begin{macro}{\vrightskip} % Skips to the left and right of a line of verse. @@ -8095,7 +11650,7 @@ % \end{macro} % % \begin{macro}{\flagverse} -% |\flagverse{|\meta{flag}|}| inserts \meta{flag} at the left (of a line). +% \cs{flagverse}\marg{flag} inserts \meta{flag} at the left (of a line). % \changes{v1.1}{2002/03/24}{Added \cs{flagverse}} % \begin{macrocode} \newcommand{\flagverse}[1]{% @@ -8105,7 +11660,7 @@ % \end{macro} % % \begin{macro}{\versewidth} -% The length |\versewidth| is a convenience length for the user. +% The length \cs{versewidth} is a convenience length for the user. % \begin{macrocode} \newlength{\versewidth} % \end{macrocode} @@ -8114,8 +11669,8 @@ % \begin{macro}{\vgap} % \begin{macro}{\vin} % \begin{macro}{\vindent} -% The length |\vgap| is used as the basis for spacing. |\vin| makes -% a horizontal space of |\vgap| and |\vindent| is the indentation +% The length \cs{vgap} is used as the basis for spacing. \cs{vin} makes +% a horizontal space of \cs{vgap} and \cs{vindent} is the indentation % of wrapped lines. % \begin{macrocode} \newlength{\vgap} \setlength{\vgap}{1.5em} @@ -8154,10 +11709,11 @@ % \end{macro} % % \begin{macro}{\verselinebreak} -% Break a verse line by inserting |\newline|. +% Break a verse line by inserting \cs{newline}. % \changes{v1.1}{2002/03/28}{Modified \cs{verselinebreak}} +% \changes{v1.61803}{2008/01/30}{Removed extraneous space from \cs{verselinebreak} (mempatch v4.4, Aaron Rendahl)} % \begin{macrocode} -\newcommand{\verselinebreak}[1][\z@]{\newline\hspace*{#1}} +\newcommand{\verselinebreak}[1][\z@]{\newline\hspace*{#1}\ignorespaces} % \end{macrocode} % \end{macro} @@ -8174,7 +11730,7 @@ % \end{macro} % % \begin{macro}{\@vsifbang} -% Like the kernel |\@ifstar| except it looks for an exclamation mark! +% Like the kernel \cs{@ifstar} except it looks for an exclamation mark! % \changes{v1.1}{2002/03/24}{Added \cs{@vsifbang}} % \begin{macrocode} \newcommand{\@vsifbang}[1]{\@ifnextchar !{\@firstoftwo{#1}}} @@ -8182,7 +11738,7 @@ % \end{macro} % % \begin{macro}{\@vsifgt} -% Like the kernel |\@ifstar| except it looks for a |>| character. +% Like the kernel \cs{@ifstar} except it looks for a \verb?>? character. % \changes{v1.1}{2002/03/28}{Added \cs{@vsifgt}} % \begin{macrocode} \newcommand{\@vsifgt}[1]{\@ifnextchar >{\@firstoftwo{#1}}} @@ -8190,41 +11746,73 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\verselinenumbersright} +% \begin{macro}{\verselinenumbersleft} +% \begin{macro}{\@vstypelinenum} +% Declarations for setting line numbers at the right (the default) +% or the left.. +% \changes{v1.61803}{2008/01/30}{Added \cs{verselinenumbersright} and +% \cs{verselinenumbersleft} (mempatch v4.4, v4.9)} +% \begin{macrocode} +\newcommand*{\verselinenumbersright}{\def\@vstypelinenum{\@vslnumright}} +\newcommand*{\verselinenumbersleft}{\def\@vstypelinenum{\@vslnumleft}} +\verselinenumbersright + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@vslnumright} +% \begin{macro}{\@vslnumleft} +% Internal code for right/left line numbers. +% \begin{macrocode} +\newcommand*{\@vslnumright}{% + \hfill\rlap{\kern\vrightskip\kern\rightmargin% + \vlvnumfont\getthelinenumber{poemline}{memfvsline}}} +\newcommand*{\@vslnumleft}{% + \hfill\rlap{\kern-\textwidth\kern-\vrightskip% + \vlvnumfont\getthelinenumber{poemline}{memfvsline}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\@vscentercr} % This puts the poem line number in the margin, increments % the line numbers, and then deals with the options. It is based -% on the kernel |\@centercr|. -% This has to handle various forms of the |\\| command: |\\|, -% |\\*|, |\\!|, and |\\>|, together with an optional length argument. +% on the kernel \cs{@centercr}. +% This has to handle various forms of the \verb?\\? command: \verb?\\?, +% \verb?\\*?, \verb?\\!?, and \verb?\\>?, together with an optional length argument. % \changes{v1.1}{2002/03/28}{Major rewrite of \cs{@vscentercr} and friends} % \changes{v1.2}{2002/07/27}{Changed \cs{@vscentercr} to use general % linenumbering} +% \changes{v1.61803}{2008/01/30}{Changed \cs{@vscentercr} for left/right numbers +% (mempatch v4.4)} % \begin{macrocode} \newcommand{\@vscentercr}{% \ifhmode \unskip\else \@nolnerr\fi - \hfill\rlap{\kern\vrightskip\kern\rightmargin% - \vlvnumfont\getthelinenumber{poemline}}% + \@vstypelinenum% % \end{macrocode} -% For |>| call |\verselinebreak| to process it. +% For \verb?>? call \cs{verselinebreak} to process it. % \begin{macrocode} \@vsifgt{\verselinebreak}{% - \incr@vsline + \incr@vsline % \end{macrocode} -% If the call is |\\*...| call |\@vsxcentercr| to handle the |*...|. -% If the call is |\\!|, do nothing. -% If the call is |\\![...]|, call |\@vsicentercr| to handle the |[...]|. -% Otherwise, call |\@vsxcentercr|. +% If the call is \verb?\\*...? call \cs{@vsxcentercr} to handle the \verb?*...?. +% If the call is \verb?\\!?, do nothing. +% If the call is \verb?\\![...]?, call \cs{@vsicentercr} to handle the \verb?[...]?. +% Otherwise, call \cs{@vsxcentercr}. % \begin{macrocode} - \par\@ifstar{\nobreak\@vsxcentercr}{% + \par\@ifstar{\nobreak\@vsxcentercr}{% % \end{macrocode} % \begin{macrocode} - \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}}}} + \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@vsxcentercr} -% Processes |\\*|, and either calls |\@vsicentercr| to handle a |[length]|, -% or |\start@vsline|. +% Processes \verb?\\*?, and either calls cs{@vsicentercr} to handle a \verb?[length]?, +% or \cs{start@vsline}. % \changes{v1.1}{2002/03/24}{Added \cs{@vsxcentercr}} % \begin{macrocode} \newcommand{\@vsxcentercr}{\addvspace{-\parskip}% @@ -8233,7 +11821,7 @@ % \end{macro} % % \begin{macro}{\@vsicentercr} -% Processes |(\\...)[length]| and then calls |\start@vsline|. +% Processes \verb?(\\...)[length]? and then calls \cs{start@vsline}. % \changes{v1.1}{2002/03/24}{Added \cs{@vsicentercr}} % \begin{macrocode} \def\@vsicentercr[#1]{\vskip #1\ignorespaces \start@vsline} @@ -8268,11 +11856,11 @@ % \end{macro} % % \begin{environment}{verse} -% The extended |verse| environment. It sets the verse line counter, +% The extended \Lenv{verse} environment. It sets the verse line counter, % then defines the particular list environment adjusting the margins % to center according to the length parameter. If the length parameter -% is at least the |\linewidth| then the `centering' defaults to -% the original |verse| layout. +% is at least the \cs{linewidth} then the `centering' defaults to +% the original \Lenv{verse} layout. % \changes{v1.1}{2001/08/03}{Initialise the line counter to 1, not 0, in % all cases} % \changes{v1.1}{2002/03/28}{Changes to verse environment for line numbering} @@ -8312,7 +11900,7 @@ % \end{environment} % % \begin{environment}{altverse} -% This sets |\altindenttrue| (afterwards false) and initialises the line counter. +% This sets \cs{altindenttrue} (afterwards false) and initialises the line counter. % \changes{v1.1}{2002/03/28}{Added \cs{starpatternfalse} to altverse} % \begin{macrocode} \newenvironment{altverse}% @@ -8330,15 +11918,6 @@ % digits to an array of digits, and then being able to access the % digit at a particular position in the array. % -% \begin{macro}{\@nameedef} -% A shorthand for using |\protected@edef|. -% \begin{macrocode} -\newcommand{\@nameedef}[1]{ - \expandafter\protected@edef\csname #1\endcsname} - -% \end{macrocode} -% \end{macro} -% % % \begin{macro}{\ifbounderror} % A flag set TRUE if an attempt is made to access an array element outside @@ -8367,8 +11946,8 @@ % % % \begin{macro}{\newarray} -% |\newarray{|\meta{arrayname}|}{|\meta{low}|}{|\meta{high}|}| defines -% an array called \meta{arrayname} (no backslash e.g. |MyArray|), +% \cs{newarray}\marg{arrayname}\marg{low}\marg{high} defines +% an array called \meta{arrayname} (no backslash e.g. \verb?MyArray?), % with low and high limts \meta{low} and \meta{high}. % \begin{macrocode} \newcommand{\newarray}[3]{% @@ -8376,15 +11955,14 @@ \@nameedef{#1-high}{#3}% \ifnum #3<#2 \@memerror{Limits for array #1 are in reverse order}{\@ehc}% - \fi -} + \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\stringtoarray} -% |\stringtoarray{|\meta{arrayname}|}{|\meta{string}|}| puts each character +% \cs{stringtoarray}\marg{arrayname}\marg{string} puts each character % from \meta{string} sequentially into the \meta{arrayname} array, starting % with \meta{low} = 1. It checks for an empty \meta{string} and handles that % specially. @@ -8399,15 +11977,14 @@ }{% \c@chrsinstr \@ne \expandafter\@vsstringtoarray \the@vsstring\@vsend - } -} + }} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@vsstringtoarray} -% Recursively adds characters to the array |\@vsarrayname|, incrementing +% Recursively adds characters to the array \cs{@vsarrayname}, incrementing % the array's high limit. % \begin{macrocode} \def\@vsstringtoarray #1#2\@vsend{% @@ -8421,43 +11998,39 @@ \@vsstringtoarray #2\@vsend% }% } - \@vsinext -} + \@vsinext} % \end{macrocode} % \end{macro} % % % \begin{macro}{\setarrayelement} -% |\setarrayelement{|\meta{arrayname}|}{|\meta{index}|}{|\meta{value}|}| sets +% \cs{setarrayelement}\marg{arrayname}\marg{index}\marg{value} sets % the \meta{arrayname} array's element at \meta{index} to \meta{value}. % \begin{macrocode} \newcommand{\setarrayelement}[3]{% \checkarrayindex{#1}{#2}% - \@nameedef{#1-#2}{#3}% -} - + \@nameedef{#1-#2}{#3}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\getarrayelement} -% |\getarrayelement{|\meta{arrayname}|}{|\meta{index}|}{|\meta{value}|}| -% defines the parameterless macro \meta{value} (e.g., |\result|) to be +% \cs{getarrayelement}\marg{arrayname}\marg{index}\marg{value} +% defines the parameterless macro \meta{value} (e.g., \cs{result}) to be % the value at \meta{index} in the \meta{arrayname} array. % \begin{macrocode} \newcommand{\getarrayelement}[3]{% \checkarrayindex{#1}{#2}% - \protected@edef#3{\@nameuse{#1-#2}}% -} + \protected@edef#3{\@nameuse{#1-#2}}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\checkarrayindex} -% |\checkarrayindex{|\meta{arrayname}|}{|\meta{index}|}| checks that -% the \meta{index} of the \meta{arrayname} array is valid. |\ifbounderror| +% \cs{checkarrayindex}\marg{arrayname}\marg{index} checks that +% the \meta{index} of the \meta{arrayname} array is valid. \cs{ifbounderror} % is set FALSE if everything is OK, otherwise it is set TRUE. % \begin{macrocode} \newcommand{\checkarrayindex}[2]{% @@ -8479,30 +12052,28 @@ \@memerror{Index #2 outside limits for array #1}{\@ehc}% \fi \bounderrortrue - \fi -} + \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\arraytostring} -% |\arraytostring{|\meta{arrayname}|}{|\meta{string}|}| converts the +% \cs{arraytostring}\marg{arrayname}\marg{string} converts the % characters in the \meta{arrayname} array into the parameterless macro -% \meta{string} (e.g., |\MyString|). +% \meta{string} (e.g., \cs{MyString}). % \begin{macrocode} \newcommand{\arraytostring}[2]{% \def#2{}% \c@chrsinstr = \@nameuse{#1-low}% - \@vsarraytostring{#1}{#2}% -} + \@vsarraytostring{#1}{#2}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@vsarraytostring} -% |\@vsarraytostring{|\meta{arrayname}|}{|\meta{string}|}| recursively +% \cs{@vsarraytostring}\marg{arrayname}\marg{string} recursively % adds the (character) elements from \meta{arrayname} to \meta{string}. % \begin{macrocode} \newcommand{\@vsarraytostring}[2]{% @@ -8510,16 +12081,15 @@ \protected@edef#2{#2\@nameuse{#1-\thechrsinstr}}% \advance\c@chrsinstr\@ne% \@vsarraytostring{#1}{#2}% - \fi% -} + \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\checkifinteger} -% |\checkifinteger{|\meta{num}|}| checks if \meta{num} is an integer. -% If it is, then |\ifinteger| is set TRUE, otherwise it is set FALSE. +% \cs{checkifinteger}\marg{num} checks if \meta{num} is an integer. +% If it is, then \cs{ifinteger} is set TRUE, otherwise it is set FALSE. % (Code based on Donald Arseneau's \Lpack{cite} package). % \begin{macrocode} \newcommand{\checkifinteger}[1]{% @@ -8528,17 +12098,16 @@ \integertrue% \else \integerfalse% - \fi% -} + \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\gobm} -% |\gobm{|\meta{num}|}| is defined as \meta{num}. It could be defined as: \\ -% |\newcommand{\gobm}[1]{\ifx-#1\expandafter\gobm\else#1\fi}| \\ +% \cs{gobm}\marg{num} is defined as \meta{num}. It could be defined as: \\ +% \verb?\newcommand{\gobm}[1]{\ifx-#1\expandafter\gobm\else#1\fi}? \\ % which would remove a leading minus sign (hyphen) from its argument -% (|gobm| = gobble minus sign). +% (\verb?gobm? = gobble minus sign). % (Code from a posting to \ctt{} by Donald Arseneau on 1997/07/21). % \begin{macrocode} \newcommand{\gobm}[1]{#1} @@ -8547,19 +12116,18 @@ % \end{macro} % % \begin{macro}{\indentpattern} -% |\indentpattern{|\meta{digits}|}| stores \meta{digits} for use as +% \cs{indentpattern}\marg{digits} stores \meta{digits} for use as % a verse indentation pattern. % \begin{macrocode} \newcommand{\indentpattern}[1]{% \stringtoarray{Array@vs}{#1}} - % \end{macrocode} % \end{macro} % % % \begin{macro}{\get@vsindent} -% |\get@vsindent| gets the indent pattern digit for the |\thevslineno|, -% then uses this to specify the line indentation as |digit*\vgap|. +% \cs{get@vsindent} gets the indent pattern digit for the \cs{thevslineno}, +% then uses this to specify the line indentation as \verb?digit*\vgap?. % \changes{v1.61}{2004/03/21}{Changed \cs{get@vsindent} to use counter % value number instead of \cs{thevslineno}} % \begin{macrocode} @@ -8586,10 +12154,10 @@ % % % \begin{macro}{\getstar@vsindent} -% |\getstar@vsindent| gets the indent pattern digit for the |patverse*| +% \cs{getstar@vsindent} gets the indent pattern digit for the \Lenv{patverse*} % environment, -% then uses this to specify the line indentation as |digit*\vgap|. -% It lets the pattern repeat by resetting the |vslineno| counter. +% then uses this to specify the line indentation as \verb?digit*\vgap?. +% It lets the pattern repeat by resetting the \texttt{vslineno} counter. % \changes{v1.1}{2002/03/28}{Added \cs{getstar@vsindent}} % \begin{macrocode} \newcommand{\getstar@vsindent}{% @@ -8608,8 +12176,8 @@ % % \begin{environment}{patverse} % The environment for setting verse line indents according to a pattern. -% It starts by setting |\ifpattern| TRUE, any other flags to FALSE, -% and initialises the line number. It ends by setting |\ifpattern| FALSE. +% It starts by setting \cs{ifpattern} TRUE, any other flags to FALSE, +% and initialises the line number. It ends by setting \cs{ifpattern} FALSE. % \changes{v1.1}{2002/03/28}{Added \cs{starpatternfalse} to patverse} % \begin{macrocode} \newenvironment{patverse}% @@ -8623,8 +12191,8 @@ % \begin{environment}{patverse*} % The environment for setting verse line indents according to a repeating % pattern. -% It starts by setting |\ifstarpattern| TRUE, any other flags to FALSE, -% and initialises the line number. It ends by setting |\ifstarpattern| FALSE. +% It starts by setting \cs{ifstarpattern} TRUE, any other flags to FALSE, +% and initialises the line number. It ends by setting \cs{ifstarpattern} FALSE. % \changes{v1.1}{2002/03/28}{Added patverse* environment} % \begin{macrocode} \newenvironment{patverse*}% @@ -8639,8 +12207,8 @@ % \subsection{Titles} % % \begin{macro}{\poemtitle} -% Typeset a poem title (like |\section| or other). The actual work -% is done by |\@vsptitle| (plain) or |\@vssptitle| (starred). +% Typeset a poem title (like \cs{section} or other). The actual work +% is done by \cs{@vsptitle} (plain) or \cs{@vssptitle} (starred). % \begin{macrocode} \newcommand{\poemtitle}{\par% \secdef\@vsptitle\@vssptitle} @@ -8648,7 +12216,7 @@ % \end{macro} % % \begin{macro}{\poemtoc} -% The kind of entry |\poemtitle| is to make in the ToC. +% The kind of entry \cs{poemtitle} is to make in the ToC. % \begin{macrocode} \newcommand{\poemtoc}{section} @@ -8659,9 +12227,11 @@ % \begin{macro}{\mempoemstarinfo} % \verb?\mempoeminfo{title}? \\ % \verb?\mempoemstarinfo{title}? \\ +% \changes{v1.61803}{2008/01/30}{Made \cs{mempoeminfo} and fiends \cs{long} +% (mempatch v4.9)} % \begin{macrocode} -\newcommand*{\mempoeminfo}[1]{} -\newcommand*{\mempoemstarinfo}[1]{} +\newcommand{\mempoeminfo}[1]{} +\newcommand{\mempoemstarinfo}[1]{} % \end{macrocode} % \end{macro} @@ -8722,7 +12292,7 @@ % % \begin{macro}{\beforepoemtitleskip} % \begin{macro}{\afterpoemtitleskip} -% Lengths before and after a poem title, using approcimately \cs{section} +% Lengths before and after a poem title, using approximately \cs{section} % values. % \begin{macrocode} \newlength{\beforepoemtitleskip} @@ -8771,7 +12341,7 @@ % \begin{macro}{\poemtitlestarmark} % \begin{macro}{\poemtitlepstyle} % \begin{macro}{\poemtitlestarpstyle} -% \cs{poemtitlemark}\marg{poemf@rhdr} is used for marks for a PoemTitle and +% \cs{poemtitlemark}\marg{poemf@rhdr} is used for marks for a \cs{PoemTitle} and % \cs{poemtitlestarmark}\marg{poemf@hdr} is for marks for \cs{PoemTitle*}. % The \cs{poemtitlepstyle} and \cs{poemtitlestarpstyle} macros are provided % as hooks so that, for example, pagestyles can be set for the regular @@ -8819,8 +12389,8 @@ % \verb?\memPoemTitleinfo{num}{toc}{head}{full}? \\ % \verb?\memPoemTitlestarinfo{short}{full}? % \begin{macrocode} -\newcommand*{\memPoemTitleinfo}[4]{} -\newcommand*{\memPoemTitlestarinfo}[2]{} +\newcommand{\memPoemTitleinfo}[4]{} +\newcommand{\memPoemTitlestarinfo}[2]{} % \end{macrocode} % \end{macro} @@ -8877,8 +12447,7 @@ % \end{macrocode} % Add hook for title referencing. % \begin{macrocode} - \ifheadnameref\M@gettitle{\poemf@rhdr}\else\M@gettitle{\poemf@rtoc}\fi -} + \ifheadnameref\M@gettitle{\poemf@rhdr}\else\M@gettitle{\poemf@rtoc}\fi} % \end{macrocode} % \end{macro} @@ -8906,8 +12475,7 @@ % \begin{macrocode} \interlinepenalty\@M \printPoemTitletitle{#1}% - \afterPoemTitle - }} + \afterPoemTitle}} % \end{macrocode} % \end{macro} @@ -8930,8 +12498,7 @@ \def\afterPoemTitlenum{\par\nobreak\vskip \midPoemTitleskip} \def\printPoemTitlenonum{} \def\printPoemTitletitle##1{\PoemTitlefont ##1} - \def\afterPoemTitle{\par\nobreak\vskip \afterPoemTitleskip} -} + \def\afterPoemTitle{\par\nobreak\vskip \afterPoemTitleskip}} \@PTchs@def@ult % \end{macrocode} @@ -8984,8 +12551,7 @@ \fi \poemtitlestarmark{\poemf@rhdr}% \poemtitlestarpstyle - \memPoemTitlestarinfo{\poemf@rhdr}{#2}% -} + \memPoemTitlestarinfo{\poemf@rhdr}{#2}} % \end{macrocode} % \end{macro} @@ -9027,7 +12593,7 @@ % % \begin{macro}{\arraycolsep} % The columns in an array environment are separated by -% 2|\arraycolsep|. +% 2\cs{arraycolsep}. % \begin{macrocode} \setlength\arraycolsep{5\p@} % \end{macrocode} @@ -9035,7 +12601,7 @@ % % \begin{macro}{\tabcolsep} % The columns in an tabular environment are separated by -% 2|\tabcolsep|. +% 2\cs{tabcolsep}. % \begin{macrocode} \setlength\tabcolsep{6\p@} % \end{macrocode} @@ -9043,7 +12609,7 @@ % % \begin{macro}{\arrayrulewidth} % The width of rules in the array and tabular environments is given -% by\\ |\arrayrulewidth|. +% by\\ \cs{arrayrulewidth}. % \begin{macrocode} \setlength\arrayrulewidth{.4\p@} % \end{macrocode} @@ -9051,7 +12617,7 @@ % % \begin{macro}{\doublerulesep} % The space between adjacent rules in the array and tabular -% environments is given by |\doublerulesep|. +% environments is given by \cs{doublerulesep}. % \begin{macrocode} \setlength\doublerulesep{2\p@} % \end{macrocode} @@ -9060,7 +12626,7 @@ % \subsection{Tabbing} % % \begin{macro}{\tabbingsep} -% This controls the space that the |\'| command puts in. (See +% This controls the space that the \verb?\'? command puts in. (See % \LaTeX{} manual for an explanation.) % \begin{macrocode} \setlength\tabbingsep{\labelsep} @@ -9071,15 +12637,36 @@ % \subsection{Minipage} % % \begin{macro}{\@minipagerestore} -% The macro |\@minipagerestore| is called upon entry to a minipage +% The macro \cs{@minipagerestore} is called upon entry to a minipage % environment to set up things that are to be handled differently -% inside a minipage environment. In the current styles, it does -% nothing. +% inside a minipage environment. In the standard styles it does +% nothing, as was the case originally for memoir. +% +% Memoir extends it to support verbatim footnotes (see later) in minipages +% and also for abnormal parskips (see later). +% \changes{v1.61803}{2008/01/30}{Collected \cs{@minipagerestore} modifications together} +% \begin{macrocode} +\newcommand{\@minipagerestore}{% +% \end{macrocode} +% For \cs{verbfootnote} to work in a minipage we have to use +% \cs{@verbmpfootnotetext} instead of \cs{@verbfootnotetext}. +% \begin{macrocode} + \let\@verbfootnotetext\@verbmpfootnotetext +% \end{macrocode} +% The next is for enabling the extended footnotes in a minipage. +% \begin{macrocode} + \m@mdoextrafeetmini +% \end{macrocode} +% And this is for abnormal parskips. +% \begin{macrocode} + \ifm@mnzpskip \parskip=\m@mabparskip\fi} + +% \end{macrocode} % \end{macro} % % \begin{macro}{\@mpfootins} -% Minipages have their own footnotes; |\skip||\@mpfootins| plays -% same r\^ole for footnotes in a minipage as |\skip||\footins| does +% Minipages have their own footnotes; \verb?\skip\@mpfootins? plays +% the same r\^ole for footnotes in a minipage as \verb?\skip\footins? does % for ordinary footnotes. % % \begin{macrocode} @@ -9091,10 +12678,10 @@ % \subsection{Framed boxes} % % \begin{macro}{\fboxsep} -% The space left by |\fbox| and |\framebox| between the box and the +% The space left by \cs{fbox} and \cs{framebox} between the box and the % text in it. % \begin{macro}{\fboxrule} -% The width of the rules in the box made by |\fbox| and |\framebox|. +% The width of the rules in the box made by \cs{fbox} and \cs{framebox}. % \begin{macrocode} \setlength\fboxsep{3\p@} \setlength\fboxrule{.4\p@} @@ -9109,7 +12696,7 @@ % The equation counter will be reset at beginning of a new chapter % and the equation number will be prefixed by the chapter number. % -% This code must follow the |\chapter| definition, or more exactly +% This code must follow the \cs{chapter} definition, or more exactly % the definition of the chapter counter. % \begin{macrocode} \@addtoreset{equation}{chapter} @@ -9119,7 +12706,7 @@ % \end{macro} % % \begin{macro}{\jot} -% |\jot| is the extra space added between lines of an eqnarray +% \cs{jot} is the extra space added between lines of an eqnarray % environment. The default value is used. % \begin{macrocode} % \setlength\jot{3pt} @@ -9127,7 +12714,7 @@ % \end{macro} % % \begin{macro}{\@eqnnum} -% The macro |\@eqnnum| defines how equation numbers are to appear in +% The macro \cs{@eqnnum} defines how equation numbers are to appear in % equations. Again the default is used. % % \begin{macrocode} @@ -9307,7 +12894,7 @@ \ifnum \@lastchclass=9 \thr@@ % \end{macrocode} % Otherwise we will assume that the \textsf{token} belongs to the -% class $0$ +% class 0 % and assign the corresponding number to \cs{@chnum} if our % assumption is correct. % \begin{macrocode} @@ -9316,7 +12903,7 @@ % 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 % 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} @@ -9337,7 +12924,7 @@ \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 +% 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 % insignificant here for most classes. @@ -9350,7 +12937,7 @@ \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 @@ -9359,7 +12946,7 @@ \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. +% so we choose class 0 and number 0 and give an error message. % Then we finish the macro by closing all \cs{if}'s. % \begin{macrocode} \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi @@ -9382,7 +12969,7 @@ % % 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 +% \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 @@ -9406,8 +12993,8 @@ % \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 \cs{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 @@ -9417,7 +13004,7 @@ % \begin{macro}{\prepnext@tok} % The macro \cs{prepnext@tok} is in charge of preparing the next % \textsf{token} register. For that purpose we increase -% \cs{count@} by $1$: +% \cs{count@} by 1: % \begin{macrocode} \def\prepnext@tok{\advance \count@ \@ne % \end{macrocode} @@ -9468,7 +13055,7 @@ \def\insert@column{% % \end{macrocode} % Here, we assume that the \textsf{count} register -% \cs{@tempcnta} has saved the value $\verb?\count@? - 1$. +% \cs{@tempcnta} has saved the value \verb?\count@?-1. % \begin{macrocode} \the@toks \the \@tempcnta % \end{macrocode} @@ -9579,7 +13166,7 @@ % \begin{macrocode} \let\@sharp\relax \let\@startpbox\relax \let\@endpbox\relax % \end{macrocode} -% Now we remove possible $*$-forms and user-defined column +% 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 @@ -9591,14 +13178,14 @@ % \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, +% \cs{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. +% \textsf{token} register 0 for use. % \begin{macrocode} \prepnext@tok % \end{macrocode} @@ -9637,8 +13224,8 @@ \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$, +% \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} % directly and save a macro name. After the preamble has been @@ -9655,35 +13242,35 @@ % \begin{macrocode} \ifcase\@lastchclass % \end{macrocode} -% If the last class equals $0$ we add a +% 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 +% 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?{..}?. % \begin{macrocode} \@preamerr \thr@@ \or % \end{macrocode} -% If \cs{@lastchclass} is $4$ the user preamble has been empty. +% If \cs{@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 +% Class 5 is allowed again. In this case % (the user preamble ends with \verb?@{..}?) we need not % do anything. % \begin{macrocode} @@ -9723,13 +13310,13 @@ % \begin{macrocode} \ifcase \@lastchclass % \end{macrocode} -% If the last character class was $0$ we separate the columns by +% 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 @@ -9739,17 +13326,17 @@ % \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. +% 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 @@ -9757,7 +13344,7 @@ % \begin{macrocode} \@acol \@firstampfalse \or % \end{macrocode} -% For class $5$ \textsf{tokens} only the character \verb?&? is inserted +% For class 5 \textsf{tokens} only the character \verb?&? is inserted % as a column separator. Therefore we call \cs{@addamp}. % \begin{macrocode} \@addamp @@ -9773,14 +13360,14 @@ % % % \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 +% the value 10 at this point nothing happens when \cs{@classx} is % called. So the macro \cs{@chlassz} may start like this: % \begin{macrocode} \def\@classz{\@classx @@ -9802,7 +13389,7 @@ % \begin{macrocode} \@addtopreamble{\ifcase \@chnum % \end{macrocode} -% If \cs{@chnum} has the value $0$ a centered column has to be +% If \cs{@chnum} has the value 0 a centered column has to be % generated. % So we begin with stretchable space. % \begin{macrocode} @@ -9829,8 +13416,8 @@ % \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.\ \cs{@chnum} 1 +% or 2) are generated the same way. Since one \cs{hfil} is % missing the text is moved to the relevant side. % The \verb?\kern\z@? is needed in case of an empty column % entry. Otherwise @@ -9846,7 +13433,7 @@ % by \cs{vcenter}. This command is allowed only in math % mode. Therefore we start with a~\verb?$?. % \begin{macrocode} - $\vcenter + $\vcenter%$ % \end{macrocode} % The part of the templates which is the same in all three cases % (\texttt{p}, \texttt{m} and \texttt{b}) @@ -9857,7 +13444,7 @@ % Between these two macros we find the well known % \cs{insert@column}. % \begin{macrocode} - \@startpbox{\@nextchar}\insert@column \@endpbox $\or + \@startpbox{\@nextchar}\insert@column \@endpbox $\or%$ % \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 @@ -9877,9 +13464,9 @@ % \end{macro} % % \begin{macro}{\@classix} -% Class $9$ (\texttt{>}--\textsf{token}) prevented repeated +% 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$. +% making class 9 equivalent to class 10. % \changes{v1.618}{2005/09/03}{Let \cs{@classix} to \cs{relax} (mempatch v3.10)} % \begin{macrocode} \let\@classix\relax @@ -9889,10 +13476,10 @@ % % \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). +% 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 +% to 6 and call \cs{@classvi}. By doing this we achieve that % \texttt{<} is treated like \texttt{!}. % \begin{macrocode} \def\@classviii{\ifnum \@lastchclass >\z@\ifnum\@lastchclass=\tw@\else @@ -9918,11 +13505,11 @@ % \end{macro} % % \begin{macro}{\@classvii} -% As a consequence it follows that in case of class $7$ +% 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 +% We only check if the last \textsf{token} was of class 3 which is % forbidden. % \begin{macrocode} \def\@classvii{\ifnum \@lastchclass = \thr@@ @@ -9940,8 +13527,8 @@ % % \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$ +% 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?|?. @@ -9958,8 +13545,8 @@ % \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 \cs{@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} @@ -9969,20 +13556,20 @@ % % \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} 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 +% class 3. To save command identifiers we do this call up % in the macro \cs{@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$. +% by one. Therefore we decrease \cs{count@} by 1. % \begin{macrocode} \def\@classii{\advance \count@ \m@ne % \end{macrocode} @@ -9999,7 +13586,7 @@ % \end{macro} % % \begin{macro}{\@classv} -% Class $5$ is \texttt{@}-expressions (and is also called by class 1) +% 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 @@ -10026,9 +13613,9 @@ % % % \begin{macro}{\@classi} -% In the case of class $0$ we were able to generate the necessary +% 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$. +% Analogously the macro \cs{@classvi} can be used for class 1. % \begin{macrocode} \def\@classi{\@classvi % \end{macrocode} @@ -10433,7 +14020,7 @@ % Our new definition of \cs{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\gdef\@halignto{}%$ % \end{macrocode} % Since there might be an optional argument we call another % macro which is also used by the other environments. @@ -10462,7 +14049,7 @@ % % \begin{macro}{\tabular} % \begin{macro}{\tabular*} -% The environments \textsf{tabular} and \textsf{tabular$*$} differ +% The environments \textsf{tabular} and \textsf{tabular*} differ % only in the initialisation of the command \cs{@halignto}. Therefore % we define % \begin{macrocode} @@ -10495,7 +14082,7 @@ % insert a \verb?$? and then assign the correct values to \cs{col@sep} and % \cs{d@llar...}. % \begin{macrocode} - \hbox \bgroup $\col@sep\tabcolsep \let\d@llarbegin\begingroup + \hbox \bgroup $\col@sep\tabcolsep \let\d@llarbegin\begingroup%$ \let\d@llarend\endgroup % \end{macrocode} % Now everything \textsf{tabular} specific is done and we are able to @@ -10529,11 +14116,11 @@ % % \begin{macro}{\endtabular} % \begin{macro}{\endtabular*} -% To end a \textsf{tabular} or \textsf{tabular$*$} environment we +% To end a \textsf{tabular} or \textsf{tabular*} environment we % call up \cs{endarray}, close the math mode and then the surrounding % \cs{hbox}. % \begin{macrocode} -\def\endtabular{\endarray $\egroup} +\def\endtabular{\endarray $\egroup}%$ \expandafter\let\csname endtabular*\endcsname=\endtabular % \end{macrocode} % \end{macro} @@ -10689,7 +14276,7 @@ % 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 +% 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 % definitions. % \begin{macrocode} @@ -10724,9 +14311,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]{% @@ -10743,9 +14330,9 @@ % \end{macrocode} % Now we must correct the definition of \cs{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 +% 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 +% \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)} % \begin{macrocode} @@ -10977,9 +14564,9 @@ % \begin{macrocode} \def\DC@centre#1#2#3{% \let\DC@end\DC@endcentre - \uppercase{\def~}{$\egroup\setbox\tw@=\hbox\bgroup${#2}}% + \uppercase{\def~}{$\egroup\setbox\tw@=\hbox\bgroup${#2}}%$ \setbox\tw@=\hbox{${\phantom{{#2}}}$}% - \setbox\z@=\hbox\bgroup$\mathcode`#1="8000 } + \setbox\z@=\hbox\bgroup$\mathcode`#1="8000 }%$ % \end{macrocode} % \end{macro} % @@ -10987,7 +14574,7 @@ % and then pad out the smaller of the two boxes so there is the same % amount of stuff either side of the point. % \begin{macrocode} -\def\DC@endcentre{$\egroup +\def\DC@endcentre{$\egroup%$ \ifdim \wd\z@>\wd\tw@ \setbox\tw@=\hbox to\wd\z@{\unhbox\tw@\hfill}% \else @@ -11040,14 +14627,14 @@ % \cs{count@} times the width of a digit. \cs{DC@rl} defined above % determines the two cases. % \begin{macrocode} - \setbox\z@\hbox\DC@rl$\mathcode`#1="8000 } + \setbox\z@\hbox\DC@rl$\mathcode`#1="8000 }%$ % \end{macrocode} % \end{macro} % % \begin{macro}{\DC@endright} % Just finish off the second box, and then put out both boxes. % \begin{macrocode} -\def\DC@endright{$\hfil\egroup\box\z@\box\tw@} +\def\DC@endright{$\hfil\egroup\box\z@\box\tw@}%$ % \end{macrocode} % \end{macro} % @@ -11428,7 +15015,7 @@ % Reduce the number of effective \texttt{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 +% the new column width. Temporarily store this value (times -1) in % \cs{dimen@}. % \begin{macrocode} \ifnum\TX@cols>\@ne @@ -12288,8 +15875,63 @@ % \end{macrocode} % % -% \subsection{Continuous tabulars} +% \subsection{Input files into tabulars, and etex} % +% M.J. Williams (CTT \textit{\cs{noalign} problem with \cs{input} and +% tabular in memoir class}, 28 Aug 2007) reported that using \cs{input} in a +% tabular resulted in errors. His example was: +% \begin{verbatim} +% ... +% \begin{tabular}{c|c} \hline +% 1 & 2 \\ \hline +% \input{data} \hline +% 5 & 6 \\ \hline +% \end{tabular} +% \end{verbatim} +% where \texttt{data.tex} contains the single line (and no newline) \\ +% \verb?3 & 4 \\? +% +% Morten H{\o}gholm noted that the problem +% was caused by \Lpack{memoir}'s extension to \cs{input} +% and gave a solution that depends on processing via +% \texttt{etex} rather than \texttt{tex}. +% +% Here's Morten's fix. Quoting, in part: +% \begin{quotation} +% \Lpack{memoir} extends the file loading mechanism by providing +% \cs{AtBeginFile} and \cs{AtEndFile} whose arguments are executed as +% the names indicate. \ldots after inputting a file the storage bins are +% emptied. The problem [in your case] is that this emptying is an +% assignment and so starts a new tabular cell and \cs{hline} is only +% allowed after \verb?\\? or other \cs{hline}s. +% +% \ldots the tabular environment wraps each tabular cell in additional +% groups so one can do an explicit test for which type of group we are in. +% If tested to be in an align group \emph{and} in vertical mode it means +% TeX hasn't found something to start a new cell and +% then \cs{noalign} can be used. +% \end{quotation} +% +% \begin{macrocode} +\ifetex + \renewcommand*{\killm@matf}[1]{% + \ifnum 6=\currentgrouptype + \ifvmode + \expandafter\expandafter\expandafter\@firstoftwo + \expandafter\expandafter\expandafter\noalign + \fi + \fi + \@firstofone + {\@namelet{#1-m@mfb}\relax + \@namelet{#1-m@mfe}\relax + }% + } +\fi + +% \end{macrocode} +% +% +% \subsection{Continuous tabulars} % % The standard \texttt{tabular} environment is wrapped inside a box % (see \verb?\@tabular?), @@ -12426,11 +16068,11 @@ % % \subsubsection{Horizontal lines} % -% The standard \verb?\hline? can produce odd results when used with -% continuous tabulars, but \verb?\hhline? or \verb?\cline? are OK. -% I want a version of \verb?\hline? +% The standard \cs{hline} can produce odd results when used with +% continuous tabulars, but \cs{hhline} or \cs{cline} are OK. +% I want a version of \cs{hline} % that works with continuous tabulars and has an adjustable width -% (i.e., thickness). This will be based on a modified \verb?\cline? +% (i.e., thickness). This will be based on a modified \cs{cline} % % For reference, here are the essentials of the kernel's definitions. % \begin{verbatim} @@ -12459,7 +16101,7 @@ % % \begin{macro}{\memcline} % \begin{macro}{\m@m@cline} -% This is a version of the kernel \verb?\cline? code that provides +% This is a version of the kernel \cs{cline} code that provides % a variable width. % \begin{macrocode} \newcommand*{\memcline}[2]{\m@m@cline[#1]#2\@nil} @@ -12481,9 +16123,9 @@ % % \begin{macro}{\memhline} % \begin{macro}{\m@mhline} -% A version of \verb?\hline?, based on \verb?\memcline?, taking a -% rule width as argument. It draws a \verb?\memcline? from the -% first to the last (\verb?\@curtab?) column. +% A version of \cs{hline}, based on \cs{memcline}, taking a +% rule width as argument. It draws a \cs{memcline} from the +% first to the last (\cs{@curtab}) column. % \begin{macrocode} \newcommand*{\memhline}[1][\arrayrulewidth]{\memcline{#1}{1-\@curtab}} \newcommand*{\m@mhline}{\cline{1-\@curtab}} @@ -12511,8 +16153,7 @@ % \begin{macrocode} \def\ctabsetlines{% \let\hline\m@mhline - \let\@BTnormal\m@m@BTnormal -} + \let\@BTnormal\m@m@BTnormal} % \end{macrocode} % \end{macro} @@ -12580,7 +16221,7 @@ % \end{macro} % % \begin{macro}{\autocols} -% \verb?\autocols?\oarg{width}\marg{pos}\marg{num}\marg{style}\marg{comma separated list} +% \cs{autocols}\oarg{width}\marg{pos}\marg{num}\marg{style}\marg{comma separated list} % arranges the elements in the \meta{comma separated list} into \meta{num} % columns, the elements filling each column before moving to the next. % That is, the elements are ordered top to bottom and left to right. @@ -12639,8 +16280,7 @@ \the\crtok \else &\global\advance\@cellstogo\m@ne - \fi - } + \fi}% % \end{macrocode} % Calculate the width of the columns % \begin{macrocode} @@ -12651,12 +16291,12 @@ \TX@col@width=\@mincolumnwidth \fi \penalty\abovecolumnspenalty - \noindent % usually not a paragraph + \noindent% usually not a paragraph % \end{macrocode} -% Create most of the preamble by looping to add \verb?\@cellsincolumn?-1 slots, +% Create most of the preamble by looping to add \cs{@cellsincolumn}-1 slots, % then the last one which is different. % \begin{macrocode} - \def\@preamble{} + \def\@preamble{}% \begingroup \let\@sharp\relax \ifnum\@cellsincolumn>\@ne @@ -12673,7 +16313,7 @@ \endgroup \let\@sharp ## % \end{macrocode} -% Start the \verb?\valign? +% Start the \cs{valign} % \begin{macrocode} \tabskip\ctableftskip %% \tabskip\z@ @@ -12686,18 +16326,17 @@ % \begin{macrocode} \@for\@tempa:=#5\do{ \@tempa\unskip\space\@endcolumnactions}% - \the\crtok \egroup \par \endgroup -} + \the\crtok \egroup \par \endgroup} % \end{macrocode} % \end{macro} % % % \begin{macro}{\linespercol} -% \verb?\linespercol? calculates the maximum number of lines that go into -% a column, where there are \verb?\TX@cols? columns and \verb?\@linestogo? +% \cs{linespercol} calculates the maximum number of lines that go into +% a column, where there are \cs{TX@cols} columns and \cs{@linestogo} % lines, so that the columns are balanced as well as possible. The result -% is \verb?\@cellstogo? +% is \cs{@cellstogo} % \begin{macrocode} \newcommand*{\linespercol}{% \@cellsincolumn=\@linestogo @@ -12709,15 +16348,14 @@ \ifnum \@tempcnta>\z@ \advance\@cellsincolumn \@ne \fi - \global\@cellstogo=\@cellsincolumn -} + \global\@cellstogo=\@cellsincolumn} % \end{macrocode} % \end{macro} % % % \begin{macro}{\autorows} -% \verb?\autorows?\oarg{width}\marg{pos}\marg{num}\marg{style}\marg{comma separated list} +% \cs{autorows}\oarg{width}\marg{pos}\marg{num}\marg{style}\marg{comma separated list} % arranges the elements in the \meta{comma separated list} into \meta{num} % columns, the elements filling each row before moving to the next. % That is, the elements are ordered left to right and top to bottom. @@ -12799,10 +16437,10 @@ \noindent % usually not a paragraph \vskip -\z@ % don't know why we need this, but looks bad without it % \end{macrocode} -% Create most of the preamble by looping to add \verb?\@cellsincolumn?-1 slots, +% Create most of the preamble by looping to add \cs{@cellsincolumn}-1 slots, % then the last one which is different. % \begin{macrocode} - \def\@preamble{} + \def\@preamble{}% \begingroup \let\@sharp\relax \ifnum\TX@cols>\@ne @@ -12843,8 +16481,7 @@ \@for\@tempa:=#5\do{% \@tempa\unskip\space\@endcolumnactions}% %% \the\crtok \postautotab \the\crtok \egroup \endgroup \par - \the\crtok \egroup \endgroup \par -} + \the\crtok \egroup \endgroup \par} % \end{macrocode} % \end{macro} @@ -12875,46 +16512,46 @@ % \item[\texttt{\bslash ext@TYPE}] % The file extension indicating the file on which the contents % list for float type \texttt{TYPE} is stored. For example, -% |\ext@figure| = `lof'. +% \cs{ext@figure} = `lof'. % % \item[\texttt{\bslash fnum@TYPE}] % A macro to generate the figure number for a caption. For -% example, |\fnum@TYPE| == `Figure |\thefigure|'. +% example, \cs{fnum@TYPE} == `Figure \cs{thefigure}'. % % \item[\texttt{\bslash @makecaption}{\meta{num}}{\meta{text}}] % A macro to make a caption, with \meta{num} the value produced -% by |\fnum@...| and \meta{text} the text of the caption. It -% can assume it's in a |\parbox| of the appropriate width. +% by \cs{fnum@...} and \meta{text} the text of the caption. It +% can assume it's in a \cs{parbox} of the appropriate width. % This will be used for \emph{all} floating objects. % % \end{description} % % The actual environment that implements a floating object such as -% a figure is defined using the macros |\@float| and |\end@float|, +% a figure is defined using the macros \cs{@float} and \cs{end@float}, % which are defined in \file{latex.dtx}. % % An environment that implements a single column floating object is -% started with |\@float{|\texttt{TYPE}|}[|\meta{placement}|]| of type +% started with \verb?\@float{TYPE}?\oarg{placement} of type % \texttt{TYPE} with \meta{placement} as the placement specifier. -% The default value of \meta{PLACEMENT} is defined by |\fps@TYPE|. +% The default value of \meta{PLACEMENT} is defined by \cs{fps@TYPE}. % -% The environment is ended by |\end@float|. E.g., |\figure| == -% |\@float|{figure}, |\endfigure| == |\end@float|. +% The environment is ended by \cs{end@float}. E.g., \cs{figure} == +% \verb?\@float{figure}?, \cs{endfigure} == \cs{end@float}. % % % \subsection{Floats} % -% To define a float environment, say |fenv|, the following macros must be defined: +% To define a float environment, say \Lenv{fenv}, the following macros must be defined: % \begin{itemize} -% \item |\fps@fenv| The default placement specifier (normally |tbp|). -% \item |\ftype@fenv| The type number which is an integer and a power of 2. -% \item |\ext@fenv| The file extension for the contents list. -% \item |\c@fenv| A counter for the environment (for caption numbering). -% \item |\fnum@fenv| A macro to generate the caption `number'. -% \item |\l@fenv| A macro to produce an entry in a list of\ldots. -% \item |\flegtocfenv| A macro to write a |\namedlegend| title to a listof file. -% \item |\flegfenv| A macro to typeset the name of a |\namedlegend|. -% \item |\toclevel@fenv| Holding a bookmark level (required if the +% \item \cs{fps@fenv} The default placement specifier (normally \verb?tbp?). +% \item \cs{ftype@fenv} The type number which is an integer and a power of 2. +% \item \cs{ext@fenv} The file extension for the contents list. +% \item \cs{c@fenv} A counter for the environment (for caption numbering). +% \item \cs{fnum@fenv} A macro to generate the caption `number'. +% \item \cs{l@fenv} A macro to produce an entry in a list of\ldots. +% \item \cs{flegtocfenv} A macro to write a \cs{namedlegend} title to a listof file. +% \item \cs{flegfenv} A macro to typeset the name of a \cs{namedlegend}. +% \item \cs{toclevel@fenv} Holding a bookmark level (required if the % \Lpack{hyperref} package will be used). % \end{itemize} % @@ -12930,10 +16567,13 @@ % \end{macro} % % \begin{macro}{\newfloat} -% |\newfloat[|\meta{within}|]{|\meta{fenv}|}{|\meta{ext}|}{|\meta{capname}|}| -% creates the commands for a new float environment, \meta{fenv} (aka |X|), -% using \meta{ext} (aka |Z|) as the +% \cs{newfloat}oarg{within}\marg{fenv}\marg{ext}\marg{capname} +% creates the commands for a new float environment, \meta{fenv} (aka \texttt{X}), +% using \meta{ext} (aka \texttt{Z}) as the % file extension and \meta{capname} for the caption name. +% \changes{v1.61803}{2008/01/30}{Changed setting of \cs{ftype@X} in +% \cs{newfloat} to correctly assign float numbers, courtesy Flavian +% Lambert (mempatch v4.9)} % \begin{macrocode} \newcommand{\newfloat}[4][\@empty]{% % \end{macrocode} @@ -12941,8 +16581,10 @@ % Define the float type, set it to the float counter, and double % the counter afterwards. % \begin{macrocode} - \@namedef{ftype@#2}{\value{newflo@tctr}} - \addtocounter{newflo@tctr}{\value{newflo@tctr}} +%%% \@namedef{ftype@#2}{\value{newflo@tctr}} +%%% \addtocounter{newflo@tctr}{\value{newflo@tctr}} + \expandafter\edef\csname ftype@#2\endcsname{\the\c@newflo@tctr}% + \advance\c@newflo@tctr \c@newflo@tctr % \end{macrocode} % \end{macro} % @@ -12964,11 +16606,11 @@ % \end{macro} % % \begin{macro}{\ext@X} -% \begin{macro}{Zdepth} -% Define |\ext@X| for the file extension and set the new |Zdepth| +% \begin{macro}{\c@Zdepth} +% Define \cs{ext@X} for the file extension and set the new \verb?Zdepth? % depth counter to 1. % \begin{macrocode} - \@namedef{ext@#2}{#3} % file extension + \@namedef{ext@#2}{#3}% file extension \@ifundefined{c@#3depth}{\newcounter{#3depth}}{} \setcounter{#3depth}{1} @@ -12981,8 +16623,8 @@ % \begin{macro}{\fnum@X} % \begin{macro}{\flegX} % \begin{macro}{\flegtocX} -% |\fps@X| is the default float placement specification, |\fnum@X| -% typesets the caption name and number, and |\flegX| and |\flegtocX| are for +% \cs{fps@X} is the default float placement specification, \cs{fnum@X} +% typesets the caption name and number, and \cs{flegX} and \cs{flegtocX} are for % named legends. % \begin{macrocode} \@namedef{fps@#2}{tbp} % position @@ -13007,42 +16649,48 @@ % \end{environment} % \end{environment} % -% This ends the definition of |\newfloat|. +% This ends the definition of \cs{newfloat}. % \begin{macrocode} } % end \newfloat % \end{macrocode} % \end{macro} % +% \begin{macro}{\setfloatlocations} +% \cs{setfloatlocations}\marg{float}\marg{locs} sets the defualt locations +% for the \meta{float} class of floats (e.g., \texttt{figure}) to \meta{locs} +% (initially \texttt{tbp}). For tables you might want to use: \\ +% \verb?\setfloatlocations{table}{htbp}? +% \changes{v1.61803}{2008/01/30}{Added \cs{setfloatlocations} (mempatch v4.9)} +% \begin{macrocode} +\newcommand*{\setfloatlocations}[2]{\@namedef{fps@#1}{#2}} + +% \end{macrocode} +% \end{macro} % -% -% -% -% -% -% To define subcaptions for use in a new float environment, say |fenv|, the +% To define subcaptions for use in a new float environment, say \texttt{fenv}, the % following macros must be defined~\cite{SUBFIGURE}: % \begin{itemize} -% \item A new counter |subfenv| for subcaption numbering. -% \item A new counter |extdepth|, where |ext| is the file extension -% for the contents list of |fenv|, for setting the contents depth. -% \item |\thesubfenv| for the formatting of the subcaption number. -% \item |\@thesubfenv| for typesetting the number. -% \item |\@@thesubfenv| for alternative label reference. -% \item |\p@subfenv| for prepending to the subcaption number when it is referenced. -% \item |\ext@subfenv| the file extension for the contents list. -% \item |\l@subfenv| for formatting the contents list entry. -% \item |\@makesubfloatcaption| for typesetting the subcaption. -% \item |\toclevel@subfenv| for hyperref bookmarks +% \item A new counter \texttt{subfenv} for subcaption numbering. +% \item A new counter \texttt{extdepth}, where \texttt{ext} is the file extension +% for the contents list of \texttt{fenv}, for setting the contents depth. +% \item \cs{thesubfenv} for the formatting of the subcaption number. +% \item \cs{@thesubfenv} for typesetting the number. +% \item \cs{@@thesubfenv} for alternative label reference. +% \item \cs{p@subfenv} for prepending to the subcaption number when it is referenced. +% \item \cs{ext@subfenv} the file extension for the contents list. +% \item \cs{l@subfenv} for formatting the contents list entry. +% \item \cs{@makesubfloatcaption} for typesetting the subcaption. +% \item \cs{toclevel@subfenv} for hyperref bookmarks % \end{itemize} % % \begin{macro}{\newsubfloat} -% |\newsubfloat{|\meta{fenv}|}| creates the commands for a new -% subfloat for \meta{fenv} (aka X). +% \cs{newsubfloat}\marg{fenv} creates the commands for a new +% subfloat for \meta{fenv} (aka \texttt{X}). % \begin{macrocode} \newcommand{\newsubfloat}[1]{% % \end{macrocode} -% Call |\newlistentry[X]{subX}{extX}{1}| to get most of the work done. +% Call \verb?\newlistentry[X]{subX}{extX}{1}? to get most of the work done. % \begin{macrocode} \newlistentry[#1]{sub#1}{\@nameuse{ext@#1}}{1} % \end{macrocode} @@ -13065,8 +16713,7 @@ \if@tightsubcap\hskip\subfloatlabelskip\else\space\fi} \@namedef{@@thesub#1}{\@nameuse{thesub#1}} \@namedef{p@sub#1}{\csname the#1\endcsname} - \@namedef{toclevel@sub#1}{1} -} + \@namedef{toclevel@sub#1}{1}} % \end{macrocode} % \end{macro} @@ -13079,10 +16726,10 @@ % % By permission of Steven Douglas Cochran the class provides similar % functionality as the \Lpack{subfigure} package~\cite{SUBFIGURE}. -% This requires some changes to be made to |\@float| and |\end@float|. +% This requires some changes to be made to \cs{@float} and \cs{end@float}. % % \begin{macro}{\ifdonemaincaption} -% This is set TRUE after the |\(cont)caption| has been called in a float. +% This is set TRUE after the \cs{(cont)caption} has been called in a float. % \changes{v1.1}{2002/03/10}{Changed \cs{if@contmaincaption} to % \cs{ifdonemaincaption}} % \begin{macrocode} @@ -13094,8 +16741,8 @@ % % \begin{macro}{\@float} % \begin{macro}{\@dbfloat} -% The kernel |\@float| and |\@dblfloat| macros are redefined to set -% |\ifdonemaincaption| to FALSE, and also to zero the subfloat +% The kernel \cs{@float} and \cs{@dblfloat} macros are redefined to set +% \cs{ifdonemaincaption} to FALSE, and also to zero the subfloat % counter, if it is defined. % Ignasi Furi\`{o} reported\footnote{Private email from % \texttt{ignasi.furio@uib.es}, 2003/10/17} that floats embedded in text @@ -13118,7 +16765,7 @@ % % \begin{macro}{\end@float} % \begin{macro}{\end@dblfloat} -% The kernel |\end@float| and |\end@dblfloat| macros are redefined to +% The kernel \cs{end@float} and \cs{end@dblfloat} macros are redefined to % dump out any subcaptions that have not yet been processed. % \begin{macrocode} \let\@memoldefloat\end@float @@ -13154,7 +16801,7 @@ % \subsection{Captions} % % The caption styling -% is accomplished by redefining the |\@makecaption| +% is accomplished by redefining the \cs{@makecaption} % command. First, though, define and initialise the user-level commands. % % \begin{macro}{\if@contcw} @@ -13204,21 +16851,24 @@ % \end{macro} % \end{macro} % +% % \begin{macro}{\flushleftright} % \begin{macro}{\centerlastline} -% These are in addition to the |\centering|, |\raggedleft| and |\raggedright| -% declarations for paragraphing. |\flushleftright| sets the skips to \TeX's +% These are in addition to the \cs{centering}, \cs{raggedleft} and \cs{raggedright} +% declarations for paragraphing. \cs{flushleftright} sets the skips to \TeX's % normal (block) paragraphing values, -% while |\centerlastline| sets the skips to give a centered last line in +% while \cs{centerlastline} sets the skips to give a centered last line in % a block paragraph. +% \changes{v1.61803}{2008/01/30}{Used \cs{@flushglue} in \cs{flushleftright} and +% \cs{centerlastline} (mempatch v4.7)} % \begin{macrocode} -\newcommand{\flushleftright}{% +\newcommand*{\flushleftright}{% \leftskip\z@ \rightskip\z@ - \parfillskip=\z@ plus 1fil} -\newcommand{\centerlastline}{% - \leftskip=\z@ plus 1fil + \parfillskip\@flushglue} +\newcommand*{\centerlastline}{% + \parfillskip=\z@ plus 2fil \rightskip=\z@ plus -1fil - \parfillskip=\z@ plus 2fil} + \leftskip\@flushglue} % \end{macrocode} % \end{macro} @@ -13228,7 +16878,7 @@ % \begin{macro}{\@contcstyle} % The paragraphing style for the caption. % \begin{macrocode} -\newcommand{\captionstyle}[1]{\def\@contcstyle{#1}} +\newcommand*{\captionstyle}[1]{\def\@contcstyle{#1}} \captionstyle{} % \end{macrocode} @@ -13244,7 +16894,7 @@ % % I had email from J{\o}rgen Larsen (\url{jl@dirac.ruc.dk}), 2003/04/09, % asking for separate controls for the short and long captions. \\ -% |\captionstyle|\oarg{short}\marg{normal}. +% \cs{captionstyle}\oarg{short}\marg{normal}. % \changes{v1.4}{2003/11/22}{Extended \cs{captionstyle} (from patch v1.5)} % \begin{macrocode} \renewcommand{\captionstyle}{% @@ -13327,6 +16977,20 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\captiontitlefinal} +% \cs{captiontitlefinal}\marg{stuff} will put \meta{stuff} immediately +% at the end of a \cs{caption}'s title text but it will not appear +% in the LoF/LoT/etc. For example \\ +% \verb?\captiontitlefinal{.}? \\ +% The code was supplied by Frederic Connes. +% \changes{v1.61803}{2008/01/30}{Added \cs{captiontitlefinal} (mempatch v4.4)} +% \begin{macrocode} +\newcommand*{\captiontitlefinal}[1]{\def\@contfinal{#1}} + \captiontitlefinal{} + +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\abovecaptionskip} % \begin{macro}{\belowcaptionskip} % Vertical space above and below a caption. Make them sum to an @@ -13342,7 +17006,7 @@ % \end{macro} % % \begin{macro}{\caption} -% For subfloat support, the (kernel) |\caption| macro needs to note that it +% For subfloat support, the (kernel) \cs{caption} macro needs to note that it % has been called. % \begin{macrocode} \let\@memoldcaption\caption @@ -13355,13 +17019,13 @@ % \verb?\memcaptioninfo{type}{\thetypenum}{short}{long}? % \changes{v1.618}{2005/09/10}{Added \cs{memcaptioninfo}} % \begin{macrocode} -\newcommand*{\memcaptioninfo}[4]{} +\newcommand{\memcaptioninfo}[4]{} % \end{macrocode} % \end{macro} % % \begin{macro}{\@caption} -% For title referencing support, the (kernel) |\@caption| macro needs +% For title referencing support, the (kernel) \cs{@caption} macro needs % to store the title. % \changes{v1.618}{2005/09/03}{Added braces around second argument of \cs{@memold@caption} (per Dan Luecking, mempatch v3.0)} % \begin{macrocode} @@ -13375,22 +17039,24 @@ % \end{macro} % % \begin{macro}{\@makecaption} -% This is a reimplementation of the kernel |\@makecaption| command. +% This is a reimplementation of the kernel \cs{@makecaption} command. % As well as including the caption typesetting commands it enables -% captions that include forced newlines (e.g., by |\\|). +% captions that include forced newlines (e.g., by \verb?\\?). % % The first part is due to % Donald Arseneau\footnote{Email: \texttt{asnd@triumf.ca}} from postings -% to the \ctt{} newsgroup and Email discussions. The |\topskip| strut is +% to the \ctt{} newsgroup and Email discussions. The \cs{topskip} strut is % used whenever the caption is the first part of the float. This means, % among other things, that if a caption comes at the % top of a page, then the first line of the caption will be aligned with -% the normal first line of a page. The |\abovecaptionskip| is only used +% the normal first line of a page. The \cs{abovecaptionskip} is only used % when there is something above the caption in the current float. % \changes{v0.31}{2001/07/24}{Changed \cs{@tempa} to \cs{@memtempa} in \cs{@makecaption}} % \changes{v1.0a}{2002/02/12}{Added extra centering code in \cs{@makecaption}} % \changes{v1.4}{2003/11/22}{Added separate short/long styles in \cs{@makecaption} % (from patch v1.5)} +% \changes{v1.61803}{2008/01/30}{Added \cs{@contfinal} to \cs{@makecaption} +% (mempatch v4.4)} % \begin{macrocode} \long\def\@makecaption#1#2{\let\@memtempa\relax \ifdim\prevdepth>-99\p@ \vskip\abovecaptionskip @@ -13411,7 +17077,7 @@ % Now measure the width of the total caption, not forgetting to take account % of the font specifications, and then restore the footnoting. % \begin{macrocode} - \sbox\@tempboxa{\@contnfont #1\@contdelim \@conttfont #2} + \sbox\@tempboxa{\@contnfont #1\@contdelim \@conttfont #2\@contfinal} \let\footnote\@contfnote \let\footnotemark\@contfmark % \end{macrocode} @@ -13423,7 +17089,7 @@ \if@contcw % \end{macrocode} % For typesetting at anything other than the normal width, put the caption -% into a |\parbox| of the specified width. This must be centered. +% into a \cs{parbox} of the specified width. This must be centered. % \begin{macrocode} \centering \parbox{\@contcwidth}{% @@ -13442,17 +17108,17 @@ \sbox\@tempboxa{\@contnfont #1\@contdelim} \@contpre% {\@contcstyle\hangindent=\wd\@tempboxa - \noindent\box\@tempboxa\@memtempa \@conttfont #2\par} + \noindent\box\@tempboxa\@memtempa \@conttfont #2\@contfinal\par} \else \if@contindent % \end{macrocode} % An indented caption is similar, except the amount of indentation is -% kept in |\@contindw|. +% kept in \cs{@contindw}. % \begin{macrocode} \@contpre% {\@contnfont #1\@contdelim}\@memtempa {\@contcstyle\hangindent=\@contindw - \hangafter=\@ne\@conttfont #2\par}% <- v1.4 + \hangafter=\@ne\@conttfont #2\@contfinal\par}% <- v1.4 \else % \end{macrocode} % For the normal style, just typeset the caption. @@ -13461,12 +17127,12 @@ {\@contnfont #1\@contdelim}\@memtempa {\ifdim\wd\@tempboxa<\linewidth \@contcshortstyle\else \@contcstyle\fi% <- v1.4 - \@conttfont #2\par} + \@conttfont #2\@contfinal\par} \fi \fi % \end{macrocode} % Finish off the typesetting by processing the post-text, and if not using -% the normal width then close off the |\parbox|, and lastly put in some +% the normal width then close off the \cs{parbox}, and lastly put in some % vertical space. % \begin{macrocode} \@contpost @@ -13484,9 +17150,9 @@ % \subsubsection{Continuation captions and legends} % % \begin{macro}{\contcaption} -% |\contcaption{|\meta{text}|}| is a user-level command. +% \cs{contcaption}\marg{text} is a user-level command. % It is a simplified -% version of the normal |\caption| command as it doesn't have to deal +% version of the normal \cs{caption} command as it doesn't have to deal % with numbering or list of \dots entries. % % However, @@ -13505,14 +17171,14 @@ % % \begin{macro}{\@@contcaption} % \begin{macro}{\@contcaption} -% |\@contcaption| is the workhorse for the |\contcaption| command. In turn, -% it uses the |\@makecaption| command (defined in the usual classes) +% \cs{@contcaption} is the workhorse for the \cs{contcaption} command. In turn, +% it uses the \cs{@makecaption} command (defined in the usual classes) % to do most of its work. It -% uses the number of the previous |\caption| command in the same +% uses the number of the previous \cs{caption} command in the same % type of float and its implementation includes much of the code -% used in the \LaTeX{} |\@caption| command. +% used in the \LaTeX{} \cs{@caption} command. % -% First specify |\@@contcaption{|\meta{type}|}{|\meta{title}|}| +% First specify \cs{@@contcaption}\marg{type}\marg{title} % to save some repetitive code. % \begin{macrocode} \long\def\@@contcaption#1#2{% @@ -13529,7 +17195,7 @@ % \end{macrocode} % \end{macro} % -% Now for |\@contcaption{|\meta{type}|}{|\meta{title}|}|. +% Now for \cs{@contcaption}\marg{type}\marg{title}. % It has to flush out any subcaptions at the % appropriate time, as well as typesetting the caption. % \begin{macrocode} @@ -13557,7 +17223,7 @@ % \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{legend}} % \changes{v1.618}{2005/09/10}{Added \cs{memlegendinfo}} % \begin{macrocode} -\newcommand*{\memlegendinfo}[1]{} +\newcommand{\memlegendinfo}[1]{} \newcommand{\legend}[1]{% \M@gettitle{#1}% \memlegendinfo{#1}% @@ -13586,7 +17252,7 @@ % \changes{v1.618}{2005/09/10}{Added \cs{memnamedlegendinfo}} % \begin{macrocode} \newcommand{\namedlegend}{\@dblarg{\@legend\@captype}} -\newcommand*{\memnamedlegendinfo}[3]{} +\newcommand{\memnamedlegendinfo}[3]{} % \end{macrocode} % \end{macro} @@ -13643,7 +17309,7 @@ % % The bilingual caption commands all use internal grouping so % that any changes are kept local. This has the unfortunate side-effect -% that any |\label| command must be within the grouping otherwise the +% that any \cs{label} command must be within the grouping otherwise the % wrong number is picked up. To make the coding, if not necessarily the % use, of the commands simpler, I have not used the traditional style % of square brackets for optional caption text arguments. Instead, empty @@ -13661,9 +17327,9 @@ % \changes{v1.618}{2005/09/10}{Added \cs{membitwonumcaptioninfo}, % \cs{membitwonumcaptioninfo} and \cs{membicaptioninfo}} % \begin{macrocode} -\newcommand*{\membitwonumcaptioninfo}[7]{} -\newcommand*{\membionenumcaptioninfo}[7]{} -\newcommand*{\membicaptioninfo}[6]{} +\newcommand{\membitwonumcaptioninfo}[7]{} +\newcommand{\membionenumcaptioninfo}[7]{} +\newcommand{\membicaptioninfo}[6]{} % \end{macrocode} % \end{macro} @@ -13681,7 +17347,7 @@ \let\memcaptioninfo\@gobblefour % \end{macrocode} % Check if the first language argument is vacuous, then call -% the normal |\caption| for language 1. +% the normal \cs{caption} for language 1. % \begin{macrocode} \@ifmtarg{#2}{\def\m@mscapi{#3}\caption{#3}}% {\def\m@mscapi{#2}\caption[#2]{#3}}% @@ -13695,8 +17361,8 @@ % Remove any extra spacing between the captions, and set the % NAME for the second caption. Use a command to transfer % the NAME to the renewal code to avoid circularity if -% for example, we are trying to redefine |\tablename| as -% |\tablename|. Decrement the caption counter. +% for example, we are trying to redefine \cs{tablename} as +% \cs{tablename}. Decrement the caption counter. % \begin{macrocode} \setlength{\abovecaptionskip}{0pt}% \setlength{\belowcaptionskip}{0pt}% @@ -13711,8 +17377,7 @@ {\def\m@mscapii{#5}\caption[#5]{#6}}% \membitwonumcaptioninfo{\@captype}{\@nameuse{the\@captype}}% {\m@mscapi}{#3}{#4}{\m@mscapii}{#6}% - \endgroup -} + \endgroup} % \end{macrocode} % \end{macro} @@ -13728,7 +17393,7 @@ \let\memcaptioninfo\@gobblefour % \end{macrocode} % Check if the first language argument is vacuous, then call -% the normal |\caption| for language 1. +% the normal \cs{caption} for language 1. % \begin{macrocode} \@ifmtarg{#2}{\def\m@mscapi{#3}\caption{#3}}% {\def\m@mscapi{#2}\caption[#2]{#3}}% @@ -13760,8 +17425,7 @@ {\protect\numberline{}{\ignorespaces #5}}}% \membionenumcaptioninfo{\@captype}{\@nameuse{the\@captype}}% {\m@mscapi}{#3}{#4}{\m@mscapii}{#6}% - \endgroup -} + \endgroup} % \end{macrocode} % \end{macro} @@ -13777,7 +17441,7 @@ \let\memcaptioninfo\@gobblefour % \end{macrocode} % Check if the first language argument is vacuous, then call -% the normal |\caption| for language 1. +% the normal \cs{caption} for language 1. % \begin{macrocode} \@ifmtarg{#2}{\def\m@mscapi{#3}\caption{#3}}% {\def\m@mscapi{#2}\caption[#2]{#3}}% @@ -13789,7 +17453,7 @@ \fi % \end{macrocode} % Do the between captions code and -% finally just use |\contcaption| for the +% finally just use \cs{contcaption} for the % second language. % \begin{macrocode} \setlength{\abovecaptionskip}{0pt}% @@ -13800,8 +17464,7 @@ \contcaption{#5}% \membicaptioninfo{\@captype}{\@nameuse{the\@captype}}% {\m@mscapi}{#3}{#4}{#5}% - \endgroup -} + \endgroup} % \end{macrocode} % \end{macro} @@ -13813,11 +17476,11 @@ \newcommand{\bicontcaption}[3]{% \begingroup % \end{macrocode} -% Call |\contcaption| for language 1. +% Call \cs{contcaption} for language 1. % \begin{macrocode} \contcaption{#1}% % \end{macrocode} -% Do the between captions code and use |\contcaption| for the second +% Do the between captions code and use \cs{contcaption} for the second % language. % \begin{macrocode} \setlength{\abovecaptionskip}{0pt}% @@ -13826,8 +17489,7 @@ \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}% \@contmidbi \contcaption{#3}% - \endgroup -} + \endgroup} % \end{macrocode} % \end{macro} @@ -13858,7 +17520,7 @@ % \begin{macro}{\hangsubcaption} % \begin{macro}{\normalsubcaption} % For dealing with short and hanging subcaptions. -% Analagous to the \Lpack{subfigure} |nooneline| and |hang| options. +% Analagous to the \Lpack{subfigure} \texttt{nooneline} and \texttt{hang} options. % The default is normal subcaptions. % \begin{macrocode} \newif\if@shortsubcap @@ -13881,8 +17543,8 @@ % \begin{macro}{\subfloatbottomskip} % \begin{macro}{\subfloatlabelskip} % \begin{macro}{\subfloatcapmargin} -% These |\subfloat...| lengths are analagous to the \Lpack{subfigure} -% |\subfig...| lengths. +% These \cs{subfloat...} lengths are analagous to the \Lpack{subfigure} +% \cs{subfig...} lengths. % \begin{macrocode} \newskip\subfloattopskip \newskip\subfloatcapskip @@ -13939,7 +17601,7 @@ % \begin{macro}{\subcaptionfont} % \begin{macro}{\@subcapfont} % These macros set the size and fonts for the subcaptions. Set the defaults -% to |\footnotesize|, and the normal roman font. +% to \cs{footnotesize}, and the normal roman font. % \begin{macrocode} \newcommand*{\subcaptionsize}[1]{\def\@subcapsize{#1}} \newcommand*{\subcaptionlabelfont}[1]{\def\@subcaplabelfont{#1}} @@ -13959,10 +17621,10 @@ % \begin{macro}{\@contkeep} % \begin{macro}{\@contset} % \begin{macro}{\subconcluded} -% |\@contkeep| stores -% the current subfloat number in counter |@contsubnum| and -% |\@contset| sets the subfloat number to the value of |@contsubnum|. -% |\subconcluded| sets the subfloat number to zero. +% \cs{@contkeep} stores +% the current subfloat number in counter \verb?@contsubnum? and +% \cs{@contset} sets the subfloat number to the value of \verb?@contsubnum?. +% \cs{subconcluded} sets the subfloat number to zero. % \begin{macrocode} \newcounter{@contsubnum} \newcommand{\@contkeep}{% @@ -13989,7 +17651,7 @@ % \end{macro} % % \begin{macro}{\subcaption} -% |\subcaption[|\meta{list-entry}|]{|\meta{caption}|}| is a generic +% \cs{subcaption}\oarg{list-entry}\marg{caption} is a generic % subcaption. There is no \Lpack{subfigure} equivalent. % \begin{macrocode} \newcommand{\subcaption}{% @@ -14006,8 +17668,8 @@ % \end{macro} % % \begin{macro}{\@memsubcap} -% This handles the optional argument to |\subcaption|. It sets |\@tempdima| -% to |\hsize| as later on |\@makesubfloatcaption| uses this. +% This handles the optional argument to \cs{subcaption}. It sets \cs{@tempdima} +% to \cs{hsize} as later on \cs{@makesubfloatcaption} uses this. % \changes{v1.1a}{2002/04/28}{Added \cs{@tempdima} to \cs{@memsubcap}} % \begin{macrocode} \long\def\@memsubcap#1[#2]#3{% @@ -14025,9 +17687,9 @@ % % % \begin{macro}{\@memsubcaption} -% |\@memsubcaption{|\meta{type}|}{|\meta{list-entry}|}{|\meta{caption}|}| +% \cs{@memsubcaption}\marg{type}\marg{list-entry}\marg{caption} % typesets a subcaption. This is a copy of the \Lpack{subfigure} -% |\@subcaption| macro. +% \cs{@subcaption} macro. % \begin{macrocode} \newcommand{\@memsubcaption}[3]{% \ifx \relax#2\relax \else @@ -14047,8 +17709,8 @@ % % % \begin{macro}{\contsubcaption} -% |\contsubcaption[|\meta{caption}|]| is the continued version of -% |\subcaption|. +% \cs{contsubcaption}\oarg{caption} is the continued version of +% \cs{subcaption}. % \begin{macrocode} \newcommand{\contsubcaption}{% \bgroup @@ -14063,10 +17725,10 @@ % % % \begin{environment}{subfloat} -% The \Lpack{subfigure} documentation suggests a way of defining a |subfloat| -% environment. This is a trivial implementation because the |\subcaption| -% and |\contsubcaption| commands are provided by the class, and can be used -% within a |subfloat|. +% The \Lpack{subfigure} documentation suggests a way of defining a \Lenv{subfloat} +% environment. This is a trivial implementation because the \cs{subcaption} +% and \cs{contsubcaption} commands are provided by the class, and can be used +% within a \Lenv{subfloat}. % \begin{macrocode} \newenvironment{subfloat}{}{} @@ -14077,9 +17739,9 @@ % % \begin{macro}{\subbottom} % \begin{macro}{\@memsubbody} -% |\subbottom[|\meta{list-entry}|][|\meta{subcaption}|]{|\meta{text}|}| +% \cs{subbottom}\oarg{list-entry}\oarg{subcaption}\marg{text} % typesets a subcaption below the \meta{text}. Most of the work is -% performed by the |\@memsubbody| macro. +% performed by the \cs{@memsubbody} macro. % \begin{macrocode} \newcommand{\subbottom}{% \@contbotsubtrue @@ -14103,7 +17765,7 @@ % % \begin{macro}{\contsubbottom} % \begin{macro}{\@memcontsubbody} -% These are the continued versions of |\subbottom| and |\@memsubbody|. +% These are the continued versions of \cs{subbottom} and \cs{@memsubbody}. % \begin{macrocode} \newcommand{\contsubbottom}{% \@contbotsubtrue @@ -14125,7 +17787,7 @@ % % \begin{macro}{\subtop} % \begin{macro}{\contsubtop} -% These are similar to |\subbottom| and |\contsubbottom| except that they +% These are similar to \cs{subbottom} and \cs{contsubbottom} except that they % put the subcaption on top of the \meta{text}. % \begin{macrocode} \newcommand{\subtop}{% @@ -14143,7 +17805,7 @@ % \changes{v1.1a}{2002/04/28}{Deleted \cs{@contsubfloat} as it was not used} % % \begin{macro}{\@memsubfig} -% This is a revised version of the \Lpack{subfigure} |\@subfigure| command +% This is a revised version of the \Lpack{subfigure} \cs{@subfigure} command % --- just the called macro names are changed. % \begin{macrocode} \def\@memsubfig[#1]{% @@ -14155,9 +17817,9 @@ % \end{macro} % % \begin{macro}{\@memsubfloat} -% This is a modified version of the \Lpack{subfigure} |\@subfloat| -% command Essentially the |\csname if#1topcap\endcsname| constructs are -% replaced by |\if@contbotsub|. +% This is a modified version of the \Lpack{subfigure} \cs{@subfloat} +% command Essentially the \verb?\csname if#1topcap\endcsname? constructs are +% replaced by \cs{if@contbotsub}. % \begin{macrocode} \def\@memsubfloat#1[#2][#3]#4{% \@tempcnta=\@ne @@ -14218,7 +17880,7 @@ % typesetting of the subcaptions. % % \begin{macro}{\@memsubfigcaptionlist} -% A copy of |\@subfigcaptionlist|. +% A copy of \cs{@subfigcaptionlist}. % \begin{macrocode} \newcommand*{\@memsubfigcaptionlist}{} % \end{macrocode} @@ -14226,7 +17888,7 @@ % % % \begin{macro}{\memlistsubcaptions} -% A copy of |\listsubcaptions|. +% A copy of \cs{listsubcaptions}. % \begin{macrocode} \newcommand*{\memlistsubcaptions}{% \@ifstar @@ -14238,7 +17900,7 @@ % % % \begin{macro}{\@memlistsubcaptions} -% A copy of |\@listsubcaptions|. +% A copy of \cs{@listsubcaptions}. % \begin{macrocode} \newcommand*{\@memlistsubcaptions}[1]{% \@ifundefined{@captype}{}{% @@ -14253,7 +17915,7 @@ % \end{macro} % % \begin{macro}{\@makesubfloatcaption} -% This is a copy of |\@makesubfigurecaption|. +% This is a copy of \cs{@makesubfigurecaption}. % \begin{macrocode} \newcommand{\@makesubfloatcaption}[2]{% \setbox\@tempboxa\hbox{% @@ -14279,7 +17941,7 @@ % \end{macro} % % \begin{macro}{\memsubfig@caption} -% This is a copy of |\subfig@caption|. +% This is a copy of \cs{subfig@caption}. % \begin{macrocode} \newcommand{\memsubfig@caption}[2]{% \if@hangsubcap @@ -14297,7 +17959,7 @@ % \end{macro} % % \begin{macro}{\memsubfig@captionpar} -% This replaces |\subfig@captionpar|. +% This replaces \cs{subfig@captionpar}. % \begin{macrocode} \newcommand{\memsubfig@captionpar}[2]{% \parbox[t]{#1}{\@subcapsize\@contsubcstyle #2}} @@ -14306,7 +17968,7 @@ % \end{macro} % % \begin{macro}{\memsub@label} -% These are copies of |\sub@label| and |\subref|. +% These are copies of \cs{sub@label} and \cs{subref}. % \begin{macrocode} \newcommand{\memsub@label}{% \@ifnextchar (% @@ -14318,7 +17980,7 @@ % \end{macro} % % \begin{macro}{\sf@memsub@label} -% This is a copy of |\sf@sub@label|. +% This is a copy of \cs{sf@sub@label}. % \begin{macrocode} \def\sf@memsub@label(#1)#2{% \protected@edef\mem@currentlabelname{#1}% @@ -14328,7 +17990,7 @@ % \end{macro} % % \begin{macro}{\sf@@memsub@label} -% This is an expanded copy of |\sf@@sub@label| processed after any packages may +% This is an expanded copy of \cs{sf@@sub@label} processed after any packages may % have been loaded. % \begin{macrocode} \AtBeginDocument{% @@ -14392,7 +18054,7 @@ % \end{macro} % % \begin{macro}{\subcaptionref} -% This is a copy of the |\subref| macro. +% This is a copy of the \cs{subref} macro. % \begin{macrocode} \newcommand*{\subcaptionref}{% \@ifstar{\ssc@ref}{\sc@ref}} @@ -14401,7 +18063,7 @@ % % \begin{macro}{\ssc@ref} % \begin{macro}{\sc@ref} -% The implementation of the starred and unstarred forms of |\subcaptionref|. +% The implementation of the starred and unstarred forms of \cs{subcaptionref}. % \begin{macrocode} \newcommand*{\ssc@ref}[1]{\ref{sub@#1}} \newcommand*{\sc@ref}[1]{{\@subcaplabelfont\ref{sub@#1}}} @@ -14410,6 +18072,591 @@ % \end{macro} % \end{macro} % +% \subsubsection{Side captions} +% \changes{v1.61803}{2008/01/30}{Added all the code for side captions +% (mempatch v4.1)} +% +% \begin{macro}{\m@mscap@capbox} +% \begin{macro}{\m@mscap@fbox} +% We need two save boxes, one to hold the caption and the other +% for the float material. +% \begin{macrocode} +\newsavebox{\m@mscap@capbox} +\newsavebox{\m@mscap@fbox} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\sidecapsep} +% \begin{macro}{\sidecapwidth} +% \cs{sidecapsep} is the space between the text and the caption, which +% is set in a box \cs{sidecapwidth} wide. These are initialized to +% the \cs{marginpar...} values. +% \begin{macrocode} +\newdimen\sidecapsep + \sidecapsep=\marginparsep +\newdimen\sidecapwidth + \sidecapwidth=\marginparwidth +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\setsidecaps} +% \cs{setsidecaps}\marg{sep}\marg{width} sets the \cs{sidecapsep} and +% \cs{sidecapwidth} (Ivars Finvers noted that the initial values don't change +% if the \cs{marginpar...} values change, such as at \cs{checkandfixthelayout}). +% \changes{v1.61803}{2008/01/30}{Added \cs{setsidecaps} (mempatch v4.6)} +% \begin{macrocode} +\newcommand*{\setsidecaps}[2]{% + \setlength{\sidecapsep}{#1}\@memznegtest{\sidecapsep}% + \setlength{\sidecapwidth}{#2}\@memznegtest{\sidecapwidth}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@m@tempdima} +% \begin{macro}{\m@mscapraise} +% Lengths for internal use. \cs{m@m@tempdima} is meant for general +% temporary use. +% \begin{macrocode} +\newdimen\m@m@tempdima +\newdimen\m@mscapraise +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\sidecapraise} +% Length to make (small) adjustments to the position of the caption wrt the float. +% \begin{macrocode} +\newdimen\sidecapraise + \sidecapraise \z@ + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setsidecappos} +% \begin{macro}{\m@mscappos} +% \cs{setsidecappos}\marg{pos}, where \meta{pos} is one of \texttt{t}, +% \texttt{c}, or \texttt{b}, sets the vertical position of the caption +% in relation to the float and the result is saved as \cs{m@mscappos}. +% The default is \texttt{c}. +% \begin{macrocode} +\newcommand*{\setsidecappos}[1]{% + \def\m@mscappos{#1}\def\@tempb{t}% + \ifx\@tempb\m@mscappos + \else + \def\@tempb{b}% + \ifx\@tempb\m@mscappos + \else + \def\@tempb{c}% + \ifx\@tempb\m@mscappos + \else + \@memerror{Argument to \string\setsidecappos\space is not t or c or b. + \MessageBreak Set to c}{\@ehc}% + \def\m@mscappos{c}% + \fi + \fi + \fi} +\setsidecappos{c} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\sidecapmargin} +% \begin{macro}{\m@mscapmarg} +% \cs{sidecapmargin}\marg{margin}, where \meta{marg} is one of +% \texttt{left}, \texttt{right}, \texttt{inner}, or \texttt{outer}, +% controls the margin where the caption will be put. The result +% is saved as \cs{m@mscapmarg} as a number. The default +% is \texttt{left}. +% \begin{macrocode} +\newcommand{\sidecapmargin}[1]{% + \def\@tempa{#1}\def\@tempb{left}% + \ifx\@tempb\@tempa + \def\m@mscapmarg{0}% left + \else + \def\@tempb{right}% + \ifx\@tempb\@tempa + \def\m@mscapmarg{1}% right + \else + \def\@tempb{outer}% + \ifx\@tempb\@tempa + \def\m@mscapmarg{2}% outer + \else + \def\@tempb{inner}% + \ifx\@tempb\@tempa + \def\m@mscapmarg{3}% inner + \else + \@memerror{Unrecognized argument for \string\sidecapmargin}% + {\@ehc}% + \def\m@mscapmarg{-1}% error + \fi + \fi + \fi + \fi} +\sidecapmargin{left} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\ifscapmargleft} +% \begin{macro}{\scapmarglefttrue} +% \begin{macro}{\scapmargleftfalse} +% \cs{ifscapmargleft} is TRUE the caption should be in the left hand margin, +% otherwise in the right hand margin. +% \begin{macrocode} +\newif\ifscapmargleft + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\sidecapfloatwidth} +% \begin{macro}{\m@mscapmainwidth} +% \cs{sidecapfloatwidth} is the width of the box holding the float. +% Note that this is a macro, +% not a length, so must be changed using \cs{renewcommand*}. +% The default is \cs{linewidth}. Later, \cs{m@mscapmainwidth} will be set +% to the current length specification from \cs{sidecapfloatwidth}. +% \begin{macrocode} +\def\sidecapfloatwidth{\linewidth} +\newdimen\m@mscapmainwidth + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\m@mscaplkern} +% \begin{macro}{\setm@mscaplkern} +% \cs{setm@mscaplkern} is a utility macro to calculate the kern +% (\cs{m@mscaplkern}) required when the caption is in the left margin. +% \begin{macrocode} +\newdimen\m@mscaplkern +\newcommand*{\setm@mscaplkern}{% + \m@mscaplkern=\sidecapwidth + \advance\m@mscaplkern \sidecapsep + \advance\m@mscaplkern \m@mscapmainwidth} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\sidecapstyle} +% \cs{sidecapstyle} is called just before the caption is set. It can +% be redefined to set different caption style parameters. The default +% is raggedleft for left margin captions and raggedright for right +% margin captions. +% \begin{macrocode} +\newcommand*{\sidecapstyle}{% +%%% \captionnamefont{\bfseries}% + \ifscapmargleft + \captionstyle{\raggedleft}% + \else + \captionstyle{\raggedright}% + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sidecaption} +% The whole shebang is in the \texttt{sidecaption} environment but +% it is more convenient to specify this via macros rather than +% directly as an environment. +% +% \cs{sidecaption}\oarg{fortoc}\marg{title}\oarg{label} is what it +% looks like to the user, but internally further macros handle +% all the arguments. +% \begin{macrocode} +\newcommand*{\sidecaption}{% + \@ifnextchar [{\@sidecaption}{\@sidecaption[]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@sidecaption} +% \cs{@sidecaption}\oarg{fortoc}\marg{title} grabs the first +% two arguments. +% \begin{macrocode} +\def\@sidecaption[#1]#2{% + \@ifnextchar [{\@@sidecaption{#1}{#2}}{\@@sidecaption{#1}{#2}[]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@sidecaption} +% \cs{@@sidecaption}\marg{fortoc}\marg{title}\oarg{label} is the +% last macro in the chain and handles all three arguments. +% This does all the work for \verb?\begin{sidecaption}? +% \begin{macro}{\m@mscap@fortoc} +% \begin{macro}{\m@mscap@forcap} +% \begin{macro}{\m@mscaplabel} +% First, save all the arguments as macros. +% \begin{macrocode} +\def\@@sidecaption#1#2[#3]{% + \ifx\@empty#1\@empty + \def\m@mscap@fortoc{#2}% + \else + \def\m@mscap@fortoc{#1}% + \fi + \def\m@mscap@forcap{#2}% + \ifx\@empty#3\@empty + \def\m@mscaplabel{}% + \else + \def\m@mscaplabel{\@bsphack\label{#3}\@esphack}% + \fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% Set the float width, calculate the left margin kern, and start +% a \texttt{minipage} to hold the float, saving it in box +% \cs{m@mscap@fbox}. +% \begin{macrocode} + \m@mscapstart@fbox} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mscapstart@fbox} +% \begin{macro}{\m@mscapend@fbox} +% \cs{m@mscapstart@fbox} is the macro that actually sets the float width, +% calculates the left margin kern, and starts the float's \texttt{minipage}. +% The macro \cs{m@mscapend@fbox} ends the box. +% \begin{macrocode} +\newcommand*{\m@mscapstart@fbox}{% + \setlength{\m@mscapmainwidth}{\sidecapfloatwidth}% + \setm@mscaplkern + \begin{lrbox}{\m@mscap@fbox}% + \begin{minipage}[c]{\m@mscapmainwidth}} +\newcommand*{\m@mscapend@fbox}{% + \end{minipage}% + \end{lrbox}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\endsidecaption} +% \cs{endsidecaption} does the work for \verb?\end{sidecaption}?. +% +% Finish the float minipage, then increment the caption counter and +% call \cs{label} via \cs{m@mscaplabel}. +% \begin{macrocode} +\def\endsidecaption{% + \m@mscapend@fbox + \refstepcounter\@captype + \m@mscaplabel +% \end{macrocode} +% Set the caption inside a minipage, saving it in box \cs{m@mscap@capbox}. +% \begin{macrocode} + \begin{lrbox}{\m@mscap@capbox}% + \begin{minipage}[c]{\sidecapwidth}% + \sidecapstyle + \@caption\@captype[\m@mscap@fortoc]{\m@mscap@forcap} + \end{minipage}% + \end{lrbox}% +% \end{macrocode} +% Output the float and caption. +% \begin{macrocode} + \m@mscapopboxes} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mscapopboxes} +% Having determined how high the caption box must be raised with +% respect to the float box, output the boxes. +% \begin{macrocode} +\newcommand*{\m@mscapopboxes}{% + \m@mcalcscapraise +% \end{macrocode} +% Set the float (from box \cs{m@mscap@fbox}) then the caption (from +% box \cs{m@mscap@capbox}) kerning it to the left or right as +% appropriate. +% \begin{macrocode} + \usebox{\m@mscap@fbox}\m@mscapcheckside + \ifscapmargleft% + \rlap{\kern-\m@mscaplkern + \raisebox{\m@mscapraise}{\usebox{\m@mscap@capbox}}}% + \else% + \rlap{\kern\sidecapsep + \raisebox{\m@mscapraise}{\usebox{\m@mscap@capbox}}}% + \fi +% \end{macrocode} +% Finally, make \cs{m@mscapthisside} a no-op. +% \begin{macrocode} + \gdef\m@mscapthisside{}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mcalcscapraise} +% Calculate the amount the caption might have to be raised wrt the +% float. This depends on the position: \\ +% \texttt{t:} raise by the difference in heights \\ +% \texttt{c:} shouldn't have to do anything as the minipages are meant +% to center aligned \\ +% \texttt{b:} lower by the difference in depths \\ +% +% However, experiments showed that a little bit of tweaking might +% help. The final adjustment, \cs{sidecapraise} is controlled by +% the user. +% \begin{macrocode} +\newcommand*{\m@mcalcscapraise}{% + \def\@tempb{t}% + \ifx\m@mscappos\@tempb + \settoheight{\m@m@tempdima}{\strut\usebox{\m@mscap@capbox}}% + \settoheight{\m@mscapraise}{\usebox{\m@mscap@fbox}}% + \advance\m@mscapraise -\m@m@tempdima + \advance\m@mscapraise 0.5ex + \else + \def\@tempb{b}% + \ifx\m@mscappos\@tempb + \settodepth{\m@m@tempdima}{\usebox{\m@mscap@fbox}}% + \settodepth{\m@mscapraise}{\strut\usebox{\m@mscap@capbox}}% + \advance\m@mscapraise -\m@m@tempdima + \else + \m@mscapraise=\z@ + \advance\m@mscapraise 0.25ex + \fi + \fi + \advance\m@mscapraise \sidecapraise} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mscapcheckside} +% This macro determines whether the caption should be set in the +% left or right margin. In twocolumn documents the caption for a single +% column float is always set in the adjacent margin. Starred floats +% are treated as regular floats as in a onecolumn document. +% \begin{macrocode} +\newcommand*{\m@mscapcheckside}{% + \if@twocolumn + \ifdim\hsize=\textwidth% float* + \m@mscapcheckregside + \else + \if@firstcolumn + \scapmarglefttrue + \else + \scapmargleftfalse + \fi + \fi + \else + \m@mscapcheckregside + \fi +% \end{macrocode} +% Finally apply any user's override. +% \begin{macrocode} + \m@mscapthisside} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mscapcheckregside} +% This performs the margin calculation for onecolumn documents. +% \begin{macrocode} +\newcommand*{\m@mscapcheckregside}{% + \if@twoside + \checkoddpage + \ifnum\m@mscapmarg<\@ne% % left + \scapmarglefttrue + \else + \ifnum\m@mscapmarg=\@ne% % right + \scapmargleftfalse + \else + \ifnum\m@mscapmarg=\tw@% % outer + \scapmarglefttrue + \ifoddpage + \scapmargleftfalse + \fi + \else% % inner + \scapmargleftfalse + \ifoddpage + \scapmarglefttrue + \fi + \fi + \fi + \fi + \else% oneside + \scapmarglefttrue + \ifnum\m@mscapmarg>\@ne + \ifnum\m@mscapmarg<\thr@@ + \scapmargleftfalse + \fi + \fi + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\overridescapmargin} +% \begin{macro}{\m@mscapthisside} +% User macro to override the calculated caption margin. Call as either:\\ +% \verb?\overridescapmargin{left}? or \verb?\overridescapmargin{right}? \\ +% \begin{macrocode} +\newcommand*{\overridescapmargin}[1]{% + \def\@tempb{#1}\def\@tempa{left}% + \ifx\@tempa\@tempb + \def\m@mscapthisside{\scapmarglefttrue}% + \else + \def\@tempa{right}% + \ifx\@tempa\@tempb + \def\m@mscapthisside{\scapmargleftfalse}% + \else + \@memerror{Argument to \string\overridescapmargin\space neither + left nor right}{\@ehc}% + \def\m@mscapthisside{}% + \fi + \fi} +\newcommand*{\m@mscapthisside}{} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Now for the other kinds of captions. +% +% \begin{macro}{\sidecontcaption} +% \cs{sidecontcaption}\marg{title}\oarg{label} is for +% a continuation sidecaption. +% \begin{macrocode} +\newcommand*{\sidecontcaption}{% + \@sidecontcaption} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@sidecontcaption} +% \cs{@sidecontcaption}\marg{title} grabs the first +% argument. +% \begin{macrocode} +\def\@sidecontcaption#1{% + \@ifnextchar [{\@@sidecontcaption{#1}}{\@@sidecontcaption{#1}[]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@sidecontcaption} +% \cs{@@sidecontcaption}\marg{title}\oarg{label} is the +% last macro in the chain and handles all two arguments. +% This does all the work for \verb?\begin{sidecontcaption}? +% \begin{macrocode} +\def\@@sidecontcaption#1[#2]{% + \def\m@mscap@forcap{#1}% + \ifx\@empty#2\@empty + \def\m@mscaplabel{}% + \else + \def\m@mscaplabel{\@bsphack\label{#2}\@esphack}% + \fi + \m@mscapstart@fbox} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endsidecontcaption} +% \cs{endsidecontcaption} does the work for \verb?\end{sidecontcaption}?. +% +% \begin{macrocode} +\def\endsidecontcaption{% + \m@mscapend@fbox + \addtocounter{\@captype}{\m@ne}\refstepcounter\@captype + \m@mscaplabel + \begin{lrbox}{\m@mscap@capbox}% + \begin{minipage}[c]{\sidecapwidth}% + \sidecapstyle + \@contcaption\@captype{\m@mscap@forcap} + \end{minipage}% + \end{lrbox}% + \m@mscapopboxes} + +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\sidenamedlegend} +% \begin{macro}{\@sidenamedlegend} +% \cs{sidenamedlegend}\oarg{fortoc}\marg{title} is for +% a namedlegend sidecaption. +% \begin{macrocode} +\newcommand*{\sidenamedlegend}{% + \@ifnextchar [{\@sidenamedlegend}{\@sidenamedlegend[]}} +\def\@sidenamedlegend[#1]#2{% + \@@sidenamedlegend{#1}{#2}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@sidenamedlegend} +% \cs{@@sidenamedlegend}\marg{fortoc}\marg{title} is the +% last macro in the chain and handles all arguments. +% This does all the work for \verb?\begin{sidenamedlegend}? +% \begin{macrocode} +\def\@@sidenamedlegend#1#2{% + \ifx\@empty#1\@empty + \def\m@mscap@fortoc{#2}% + \else + \def\m@mscap@fortoc{#1}% + \fi + \def\m@mscap@forcap{#2}% + \def\m@mscaplabel{}% + \m@mscapstart@fbox} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endsidenamedlegend} +% \cs{endsidenamedlegend} does the work for \verb?\end{sidenamedlegend}?. +% \begin{macrocode} +\def\endsidenamedlegend{% + \m@mscapend@fbox + \begin{lrbox}{\m@mscap@capbox}% + \begin{minipage}[c]{\sidecapwidth}% + \sidecapstyle + \@legend\@captype[\m@mscap@fortoc]{\m@mscap@forcap} + \end{minipage}% + \end{lrbox}% + \m@mscapopboxes} + +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\sidelegend} +% \cs{sidelegend}\marg{title} is for +% a legend sidecaption. +% \begin{macrocode} +\newcommand*{\sidelegend}{% + \@@sidelegend} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@sidelegend} +% \cs{@@sidelegend}\marg{title} is the +% last macro in the chain and handles all arguments. +% This does all the work for \verb?\begin{sidelegend}? +% \begin{macrocode} +\def\@@sidelegend#1{% + \def\m@mscap@forcap{#1}% + \m@mscapstart@fbox} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endsidelegend} +% \cs{endsidelegend} does the work for \verb?\end{sidelegend}?. +% \begin{macrocode} +\def\endsidelegend{% + \m@mscapend@fbox + \begin{lrbox}{\m@mscap@capbox}% + \begin{minipage}[c]{\sidecapwidth}% + \sidecapstyle + \legend{\m@mscap@forcap} + \end{minipage}% + \end{lrbox}% + \m@mscapopboxes} + +% \end{macrocode} +% \end{macro} +% % % % @@ -14422,7 +18669,7 @@ % \begin{macro}{\epigraphwidth} % \begin{macro}{\epigraphrule} % The several length commands, which can be changed by the user with -% |\setlength|. +% \cs{setlength}. % \begin{macrocode} \newlength{\beforeepigraphskip} \setlength{\beforeepigraphskip}{.5\baselineskip} @@ -14490,10 +18737,12 @@ % % \begin{macro}{\@epitext} % The internal command to typeset the \meta{text}. Put it into a minipage of the -% right size and typeset per |\textflush|. +% right size and typeset per \cs{textflush}. +% \changes{v1.61803}{2008/01/30}{Added \cs{par} to \cs{@epitext} and +% \cs{@episource} (mempatch v4.7)} % \begin{macrocode} \newcommand{\@epitext}[1]{% - \begin{minipage}{\epigraphwidth}\begin{\textflush} #1\\ + \begin{minipage}{\epigraphwidth}\begin{\textflush} #1\par % \end{macrocode} % Draw a rule if it will be visible, otherwise add some extra vertical space. % \begin{macrocode} @@ -14504,19 +18753,20 @@ % % \begin{macro}{\@episource} % The internal command for typesetting the \meta{source}, which is put -% into a minipage and typeset according to |\sourceflush|. +% into a minipage and typeset according to \cs{sourceflush}. % \begin{macrocode} \newcommand{\@episource}[1]{% \begin{minipage}{\epigraphwidth} - \begin{\sourceflush} #1\end{\sourceflush} - \end{minipage}} + \begin{\sourceflush} #1\par + \end{\sourceflush}\end{minipage}} + % \end{macrocode} % \end{macro} % % \begin{macro}{\epigraph} % Having got the preliminaries out of the way, here's the user command % for a single epigraph. This is set in a minipage to prevent breaking -% across a page. Position it according to |\epigraphflush|. +% across a page. Position it according to \cs{epigraphflush}. % \begin{macrocode} \newcommand{\epigraph}[2]{\vspace{\beforeepigraphskip} {\epigraphsize\begin{\epigraphflush}\begin{minipage}{\epigraphwidth} @@ -14529,7 +18779,7 @@ % % \begin{macro}{\qitem} % \begin{macro}{\qitemlabel} -% |\qitem| is the epigraph list version of |\item|. +% \cs{qitem} is the epigraph list version of \cs{item}. % Set everything inside a minipage. % \begin{macrocode} \newcommand{\qitem}[2]{{% @@ -14537,7 +18787,7 @@ \@epitext{#1}\\ \@episource{#2} \end{minipage}}} % \end{macrocode} -% |\qitemlabel| is needed for a list as well. It is not going to +% \cs{qitemlabel} is needed for a list as well. It is not going to % typeset anything. % \begin{macrocode} \newcommand{\qitemlabel}[1]{\hfill} @@ -14547,13 +18797,13 @@ % % % \begin{environment}{epigraphs} -% Now for the epigraph list. This is defined in terms of a |list| +% Now for the epigraph list. This is defined in terms of a \Lenv{list} % environment. % \begin{macrocode} \newenvironment{epigraphs}{% % \end{macrocode} % Do the vertical space, set the font size, position according to -% |\epigraphflush|, and put everything into a minipage. +% \cs{epigraphflush}, and put everything into a minipage. % \begin{macrocode} \vspace{\beforeepigraphskip}\begin{\epigraphflush} \epigraphsize @@ -14577,7 +18827,7 @@ % \begin{macro}{\dropchapter} % \begin{macro}{\undodrop} % Commands to drop and restore positions of chapter titles. Dropping is -% accomplished by inserting vertical space before the |\@chapapp| command. +% accomplished by inserting vertical space before the \cs{@chapapp} command. % \begin{macrocode} \newcommand{\dropchapter}[1]{% \let\@epichapapp\@chapapp @@ -14604,10 +18854,11 @@ % \end{macro} % % \begin{macro}{\@epipos} -% This routine sets the |\if@epi...| booleans according to the value of -% |\epigraphflush|. If |\epigraphflush| is neither |center| nor |flushleft| -% then it defaults to |flushright|. We have to use this to be upward -% compatible with |\epigraphflush| being set by the user with |\renewcommand|. +% This routine sets the \cs{if@epi...} booleans according to the value of +% \cs{epigraphflush}. If \cs{epigraphflush} is neither \texttt{center} nor +% \texttt{flushleft} +% then it defaults to \texttt{flushright}. We have to use this to be upward +% compatible with \cs{epigraphflush} being set by the user with \cs{renewcommand}. % \begin{macrocode} \newcommand{\@epipos}{ \long\def\@ept{flushleft} @@ -14626,26 +18877,26 @@ % % % \begin{macro}{\epigraphhead} -% |\epigraphhead[|\meta{distance}|]{|\meta{text}|}| puts \meta{text} at +% \cs{epigraphhead}\oarg{distance}\marg{text} puts \meta{text} at % \meta{distance} (a number, not a length) below the header at the -% page position specified by |\epigraphflush|. +% page position specified by \cs{epigraphflush}. % \begin{macrocode} \newcommand{\epigraphhead}[2][95]{% % \end{macrocode} -% We have to use |\def| instead of the normal \LaTeX{} definition commands +% We have to use \cs{def} instead of the normal \LaTeX{} definition commands % as we will keep on % (re)defining things. For reasons that are not fully clear to me \LaTeX{} -% doesn't seem to like me using a |\savebox| for storing the epigraph text, +% doesn't seem to like me using a \cs{savebox} for storing the epigraph text, % so I'll use a command instead. % \begin{macrocode} \def\@epitemp{\begin{minipage}{\epigraphwidth}#2\end{minipage}} % \end{macrocode} -% Define an |epigraph| page style. +% Define an \texttt{epigraph} page style. % \begin{macrocode} \def\ps@epigraph{\let\@mkboth\@gobbletwo % \end{macrocode} -% There are three possible definitions for |\@oddhead| depending on the -% value of |\epigraphflush|. We call |\@epipos| to decide which one to do. +% There are three possible definitions for \cs{@oddhead} depending on the +% value of \cs{epigraphflush}. We call \cs{@epipos} to decide which one to do. % \begin{macrocode} \@epipos \if@epirhs @@ -14667,23 +18918,23 @@ \def\@oddfoot{\reset@font\hfil\thepage\hfil} \let\@evenfoot\@oddfoot} % \end{macrocode} -% Make |epigraph| be the page style for this page. +% Make \texttt{epigraph} be the page style for this page. % \begin{macrocode} \thispagestyle{epigraph}} % \end{macrocode} % \end{macro} % -% The above produces a |plain| pagestyle with the epigraph. Life is +% The above produces a \texttt{plain} pagestyle with the epigraph. Life is % more complex if someone wants a fancy style with the epigraph. They % will have to do some work, though. % % \begin{macro}{\the@epigraph} % \begin{macro}{\@epidrop} % \begin{macro}{\epigraphforheader} -% |\the@pigraph| is a macro to store the contents of an epigraph, and |\@pidrop| +% \cs{the@pigraph} is a macro to store the contents of an epigraph, and \cs{@pidrop} % stores the \meta{distance} number. -% |\epigraphforheader|\oarg{distance}\marg{text} defines the internal macros +% \cs{epigraphforheader}\oarg{distance}\marg{text} defines the internal macros % appropriately. % \changes{v1.2}{2002/08/10}{Added \cs{the@epigraph}, \cs{@epidrop}} % \changes{v1.2}{2002/08/10}{Added \cs{epigraphforheader}} @@ -14699,9 +18950,9 @@ % \end{macro} % % \begin{macro}{\epigraphpicture} -% |\epigraphpicture| puts |\the@epigraph| into a zero-sized picture at location -% |(0,-\@epidrop)|. This can then be used as part of a fancy chapter header. -% The coding is similar to |\epigraphhead|. +% \cs{epigraphpicture} puts \cs{the@epigraph} into a zero-sized picture at location +% \verb?(0,-\@epidrop)?. This can then be used as part of a fancy chapter header. +% The coding is similar to \cs{epigraphhead}. % \changes{v1.2}{2002/08/10}{Added \cs{epigraphpicture}} % \begin{macrocode} \newcommand{\epigraphpicture}{% @@ -14737,7 +18988,7 @@ % \begin{macro}{\@memoldfonterr} % \begin{macro}{\@memoldfontwarn} % Macros for old font class error and warning. E.g., \\ -% |\@memoldfonterr{\tt}{\ttfamily}{\texttt}| +% \verb?\@memoldfonterr{\tt}{\ttfamily}{\texttt}? % \changes{v1.4}{2003/02/27}{Added \cs{@memoldfonterr} and \cs{@memoldfontwarn}} % \changes{v1.618}{2005/09/03}{Fiddled with the braces in \cs{@memoldfontwarn} (mempatch v3.0)} % \begin{macrocode} @@ -14959,29 +19210,37 @@ % useful to ensure consistency throughout the document --- I don't have % to remember whether it is `see Figure ...' or `figure' or `Fig.' or \ldots. % \begin{macrocode} -\newcommand{\fref}[1]{\figurerefname~\ref{#1}} -\newcommand{\tref}[1]{\tablerefname~\ref{#1}} -\newcommand{\pref}[1]{\pagerefname~\pageref{#1}} +\newcommand*{\fref}[1]{\figurerefname~\ref{#1}} +\newcommand*{\tref}[1]{\tablerefname~\ref{#1}} +\newcommand*{\pref}[1]{\pagerefname~\pageref{#1}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % +% \begin{macro}{\Aref} +% \begin{macro}{\Bref} % \begin{macro}{\Pref} % \begin{macro}{\Cref} % \begin{macro}{\Sref} % These are named references to labeled Part, Chapter and Sectional % divisions. % \changes{v1.2}{2002/07/27}{Added \cs{Pref}, \cs{Cref} and \cs{Sref}} +% \changes{v1.61803}{2008/01/30}{Added \cs{Bref} (mempatch v4.9+)} +% \changes{v1.61803}{2008/05/17}{Added \cs{Aref}} % \begin{macrocode} -\newcommand{\Pref}[1]{\partrefname\ref{#1}} -\newcommand{\Cref}[1]{\chapterrefname\ref{#1}} -\newcommand{\Sref}[1]{\sectionrefname\ref{#1}} +\newcommand*{\Aref}[1]{\appendixrefname\ref{#1}} +\newcommand*{\Bref}[1]{\bookrefname\ref{#1}} +\newcommand*{\Pref}[1]{\partrefname\ref{#1}} +\newcommand*{\Cref}[1]{\chapterrefname\ref{#1}} +\newcommand*{\Sref}[1]{\sectionrefname\ref{#1}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \subsection{Title referencing} % @@ -14992,8 +19251,8 @@ % % Titles for numbered sectioning units and for floats with captions are % the same as the respective TOC, LOF, or LOT entry (even when no TOC is -% printed). When a short title is provided (|\section[short]{long}|) -% it will be used for the |\titleref|. This is especially useful for +% printed). When a short title is provided (\verb?\section[short]{long}?) +% it will be used for the \cs{titleref}. This is especially useful for % figure captions. Unnumbered sections take their title reference from % the printed title. Beware! This turns the title into a moving argument % when it normally is not, and will cause weird errors if there are @@ -15003,23 +19262,23 @@ % their section. % % The format of the title reference is controlled by the command -% |\theTitleReference|, which can be redefined with |\renewcommand|. +% \cs{theTitleReference}, which can be redefined with \cs{renewcommand}. % It takes two parameters: the number and the title. The number is -% just the regular |\ref| and it is WRONG in unnumbered sections. +% just the regular \cs{ref} and it is WRONG in unnumbered sections. % Beware! The default definition is the unadorned title. You could % do, for example, \\ -% |\renewcommand{\theTitleReference}[2]{#1\ \emph{#2}}|. +% \verb?\renewcommand{\theTitleReference}[2]{#1\ \emph{#2}}?. % -% The title of the current section is also available without |\label|: -% Use the command |\currenttitle| to generate a |\titleref| to the current -% section. If you have redefined |\theTitleReference| to print the number +% The title of the current section is also available without \cs{label}: +% Use the command \cs{currenttitle} to generate a \cs{titleref} to the current +% section. If you have redefined \cs{theTitleReference} to print the number % with the title, be aware that the two may not correspond: In a numbered % list the number will show the current item but the title will show the % current section, but in an unnumbered section the number will show % some previous section number. % -% The big problem with the |[usetoc]| method is that |\titleref| will -% not refer to a |\label| which was given in the title or caption itself; +% The big problem with the \verb?[usetoc]? method is that \cs{titleref} will +% not refer to a \cs{label} which was given in the title or caption itself; % the label must be placed after the sectioning command or the caption. % If you make a title-reference to a label given in a title, you will get % a warning message. @@ -15027,16 +19286,22 @@ % \changes{v1.4}{2003/11/16}{Added title referencing (from patch v1.4)} % % \begin{macro}{\ifheadnameref} -% |\ifheadnameref|: FALSE use ToC entry, TRUE use header entry +% \begin{macro}{\headnameref} +% \begin{macro}{\tocnameref} +% \cs{ifheadnameref}: FALSE use ToC entry, TRUE use header entry +% \changes{v1.61803}{2008/01/30}{Added \cs{headnameref} and \cs{tocnameref}} % \begin{macrocode} \newif\ifheadnameref - \headnamereffalse - +\newcommand*{\headnameref}{\headnamereftrue} +\newcommand*{\tocnameref}{\headnamereffalse} + \tocnameref % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\theTitleReference} -% |\theTitleReference|\marg{num}\marg{title} is the style for typesetting +% \cs{theTitleReference}\marg{num}\marg{title} is the style for typesetting % a referenced (number and) title. % \begin{macrocode} \newcommand{\theTitleReference}[2]{#2} @@ -15045,8 +19310,8 @@ % \end{macro} % % \begin{macro}{\label} -% This redefinition of |\label| is intended to work with other redirections -% of |\label|, if they record extra information in a similar way. +% This redefinition of \cs{label} is intended to work with other redirections +% of \cs{label}, if they record extra information in a similar way. % \begin{macrocode} \let\@mem@old@label\label \def\label#1{\@bsphack\begingroup @@ -15059,7 +19324,7 @@ % \end{macro} % % \begin{macro}{\@mem@@gettitle} -% |@mem@@gettitle|\marg{title} grabs a title text. +% \cs{@mem@@gettitle}\marg{title} grabs a title text. % \begin{macrocode} \def\@mem@@gettitle#1{\begingroup \let\protect\@unexpandable@protect \let\label\@mem@nestwarn @@ -15084,8 +19349,8 @@ % % \begin{macro}{\titleref} % \begin{macro}{\currenttitle} -% |\titleref|\marg{key} prints the title corresponding to |\label{key}|. -% |\currenttitle| prints the latest title. +% \cs{titleref}\marg{key} prints the title corresponding to \verb?\label{key}?. +% \cs{currenttitle} prints the latest title. % \begin{macrocode} \DeclareRobustCommand{\titleref}[1]{\begingroup \let\numberline\@gobble \let\M@TitleReference\@mem@theTR % interrupt recursion of \ref @@ -15121,7 +19386,7 @@ % % \begin{macro}{\namerefon} % \begin{macro}{\namerefoff} -% Named references has turned some arguments (e.g., |\legend{text}|) into +% Named references has turned some arguments (e.g., \verb?\legend{text}?) into % moving ones (Sven.Hartrumpf@FernUni-Hagen.de reported a problem but % not a cause, March 2003). Not everyone needs named references. % \begin{macrocode} @@ -15132,94 +19397,40 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@caption} -% add hooks to |\@caption| -% \begin{macrocode} -\let\M@old@caption\@caption -\long\def\@caption#1[#2]#3{\M@gettitle{#2}\M@old@caption{#1}[{#2}]{#3}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\legend} -% \begin{macro}{\@legend} -% add hooks to |\legend| -% \begin{macrocode} -\let\M@oldlegend\legend -\long\def\legend#1{\M@gettitle{#1}\M@oldlegend{#1}} -\let\M@old@legend\@legend -\long\def\@legend#1[#2]#3{\M@gettitle{#2}\M@old@legend{#1}[{#2}]{#3}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@vsptitle} -% \begin{macro}{\@vssptitle} -% add hooks to |\poemtitle| -% \begin{macrocode} -\let\M@old@vsptitle\@vsptitle -\long\def\@vsptitle[#1]#2{\M@gettitle{#1}\M@old@vsptitle[{#1}]{#2}} -\let\M@old@vssptitle\@vssptitle -\long\def\@vssptitle#1{\M@gettitle{#1}\M@old@vssptitle{#1}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@spart} -% \begin{macro}{\@part} -% add hooks to |\part(*)| -% \begin{macrocode} -%%%\let\M@old@spart\@spart -%%%\def\@spart#1{\M@gettitle{#1}\M@old@spart{#1}} -%%%\let\M@old@part\@part -%%%\def\@part[#1]{\M@gettitle{#1}\M@old@part[{#1}]} - -% \end{macrocode} -% \end{macro} -% \end{macro} - % % \section{Table of Contents, etc.} % -% A |\section| command writes a -% |\contentsline{section}{|\meta{title}|}{|\meta{page}|}| command +% A \cs{section} command writes a +% \verb?\contentsline{section}?\marg{title}\marg{page} command % on the \file{.toc} file, where \meta{title} contains the % contents of the entry and \meta{page} is the page number. If % sections are being numbered, then \meta{title} will be of the -% form |\numberline{|\meta{num}|}{|\meta{heading}|}| where -% \meta{num} is the number produced by |\thesection|. Other +% form \cs{numberline}\marg{num}\marg{heading} where +% \meta{num} is the number produced by \cs{thesection}. Other % sectioning commands work similarly. % -% A |\caption| command in a `figure' environment writes -% -% |\contentsline{figure}{\numberline{|\meta{num}|}{|% -% \meta{caption}|}}{|\meta{page}|}| -% +% A \cs{caption} command in a `figure' environment writes \\ +% \verb?\contentsline{figure}{?\cs{numberline}\marg{num}\marg{caption}\verb?}?\marg{page} \\ % on the \file{.lof} file, where \meta{num} is the number produced -% by |\thefigure| and \meta{caption} is the figure caption. It +% by \cs{thefigure} and \meta{caption} is the figure caption. It % works similarly for a `table' environment. % -% The command |\contentsline{|\meta{name}|}| expands to -% |\l@|\meta{name}. So, to specify the table of contents, we must -% define |\l@chapter|, |\l@section|, |\l@subsection|, ... ; to -% specify the list of figures, we must define |\l@figure|; and so -% on. Most of these can be defined with the |\@dottedtocline| -% command, which works as follows. -% -% |\@dottedtocline{|\meta{level}|}{|\meta{indent}|}{|^^A -% \meta{numwidth}|}{|^^A -% \meta{title}|}{|\meta{page}|}| +% The command \cs{contentsline}\marg{name} expands to +% \cs{l@}\meta{name}. So, to specify the table of contents, we must +% define \cs{l@chapter}, \cs{l@section}, \cs{l@subsection}, \ldots ; to +% specify the list of figures, we must define \cs{l@figure}; and so +% on. Most of these can be defined with the \cs{@dottedtocline} +% command, which works as follows. \\ +% \cs{@dottedtocline}\marg{level}\marg{indent}\marg{numwidth}\marg{title}\marg{page} % % \begin{description} -% \item[\meta{level}] An entry is produced only if\meta{ level} +% \item[\meta{level}] An entry is produced only if\meta{level} % $<=$ value of the \Lcount{tocdepth} counter. Note, -% |\chapter| is level 0, |\section| is level 1, etc. +% \cs{chapter} is level 0, \cs{section} is level 1, etc. % \item[\meta{indent}] The indentation from the outer left margin -% of the start of the contents line. +% of the start of the contents line. % \item[\meta{numwidth}] The width of a box in which the section -% number is to go, if \meta{title} includes a |\numberline| +% number is to go, if \meta{title} includes a \cs{numberline} % command. % \end{description} % @@ -15227,13 +19438,13 @@ % \begin{macro}{\@tocrmarg} % \begin{macro}{\@dotsep} % This command uses the following three parameters, which are set -% with a |\newcommand| (so em's can be used to make them depend upon +% with a \cs{newcommand} (so em's can be used to make them depend upon % the font). % \begin{description} % \item[\texttt{\bslash @pnumwidth}] The width of a box in which the % page number is put. % \item[\texttt{\bslash @tocrmarg}] The right margin for multiple -% line entries. One wants |\@tocrmarg| $\ge$ |\@pnumwidth| +% line entries. One wants \cs{@tocrmarg} $\ge$ \cs{@pnumwidth} % \item[\texttt{\bslash @dotsep}] Separation between dots, in mu % units. Should be defined as a number like 2 or 1.7 % \end{description} @@ -15278,6 +19489,8 @@ % \begin{macro}{\restorefromonecol} % The ToC, LoF, etc are always set in a single column. These two % macros cooperate to swith from two-columns to one column, and back again. +% \changes{v1.0a}{2002/01/24}{Deleted \cs{ensuretwocol} and +% \cs{restorefromtwocol} as they were unused. BUT later reinstated them.} % \begin{macrocode} \newcommand*{\ensureonecol}{% \if@twocolumn @@ -15291,11 +19504,9 @@ % \end{macro} % \end{macro} % -% \changes{v1.0a}{2002/01/24}{Deleted \cs{ensuretwocol} and \cs{restorefromtwocol} -% as they were unused} % % \begin{macro}{\cftparskip} -% The |\parskip| local to the ToC, etc, is set to the length |\cftparskip|. +% The \cs{parskip} local to the ToC, etc, is set to the length \cs{cftparskip}. % \begin{macrocode} \newlength{\cftparskip} \setlength{\cftparskip}{0pt} @@ -15304,9 +19515,9 @@ % \end{macro} % % \begin{macro}{\newlistof} -% |\newlistof{|\meta{listofcmmd}|}{|\meta{ext}|}{|\meta{listofname}|}| -% creates the command |\listofcmmd| to typeset a new List of, where the -% external file has the extension |.ext| and the heading title is +% \cs{newlistof}\marg{listofcmmd}\marg{ext}\marg{listofname} +% creates the command \cs{listofcmmd} to typeset a new List of, where the +% external file has the extension \file{.ext} and the heading title is % \meta{listofname}. The code for this is a heavily modified part % of the \Lpack{tocloft} package. % @@ -15314,8 +19525,8 @@ \newcommand{\newlistof}[3]{% % \end{macrocode} % -% In the following, |X| stands for the value of \meta{listofcmmd} and -% |Z| stands for the value of \meta{ext}. +% In the following, \texttt{X} stands for the value of \meta{listofcmmd} and +% \texttt{Z} stands for the value of \meta{ext}. % % \begin{macro}{\ext@Z} % \begin{macro}{\Zdepth} @@ -15361,6 +19572,7 @@ % % \begin{macro}{\@plainZ} % The unstarred listof version +% \changes{v1.61803}{2008/01/30}{Slight change to \cs{@plainZ} (mempatch v4.6)} % \begin{macrocode} \@namedef{@plain#2}{% \ensureonecol @@ -15370,6 +19582,7 @@ \@nameuse{@#2maketitle} \phantomsection \addcontentsline{toc}{chapter}{#3} +\parskip\cftparskip \@starttoc{#2}% \endgroup \restorefromonecol} @@ -15379,10 +19592,13 @@ % \begin{macro}{\@Zmaketitle} % This macro typesets the title. % \changes{v1.3}{2002/10/10}{Added \cs{printZnonum} to \cs{@Zmaketitle}} +% \changes{v1.61803}{2008/01/30}{Slight changes to \cs{@Zmaketitle} +% (mempatch v4.6)} % \begin{macrocode} \@namedef{@#2maketitle}{% \@nameuse{#2headstart} - {\parindent\z@ \parskip\cftparskip + {\parindent\z@ +%%%% \parskip\cftparskip \interlinepenalty\@M % \end{macrocode} % \changes{v1.3}{2002/11/14}{Added printZnonum to \cs{newlistof}} @@ -15399,7 +19615,7 @@ % % \begin{macro}{\Zheadstart} % \begin{macro}{\afterZtitle} -% The macros |\Zheadstart| and |\afterZtitle| +% The macros \cs{Zheadstart} and \cs{afterZtitle} % control what goes before and after the title. They % default to the corresponding macros for chapters. % \begin{macrocode} @@ -15411,7 +19627,7 @@ % % \begin{macro}{\printZnonum} % This typesets something before the title and defaults -% to |\printchapternonum|. +% to \cs{printchapternonum}. % \changes{v1.3}{2002/10/10}{Added \cs{printZnonum} macro} % \begin{macrocode} \@namedef{print#2nonum}{\printchapternonum} @@ -15419,14 +19635,14 @@ % \end{macro} % % \begin{macro}{\printZtitle} -% The title is typeset by the macro |\printZtitle{|\meta{title}|}| -% which defaults to |\printchaptertitle|. +% The title is typeset by the macro \cs{printZtitle}\marg{title} +% which defaults to \cs{printchaptertitle}. % \begin{macrocode} \@namedef{print#2title}##1{\printchaptertitle{##1}} % \end{macrocode} % \end{macro} % -% This is the end of the definition of |\newlistof|. +% This is the end of the definition of \cs{newlistof}. % \begin{macrocode} } % end \newlistof @@ -15434,7 +19650,7 @@ % \end{macro} % % \begin{macro}{\@starttoc} -% A list of macro calls |\@starttoc| to read the appropriate file. I have +% A list of macro calls \cs{@starttoc} to read the appropriate file. I have % changed the kernel definition to allow a file to be read multiple times % by delaying killing the file until the end of the document. % \changes{v1.3}{2002/11/14}{Changed \cs{@starttoc}} @@ -15487,10 +19703,10 @@ % % \begin{macro}{\setpnumwidth} % \begin{macro}{\setrmarg} -% User commands for setting |\@pnumwidth| and |\@tocrmarg|. +% User commands for setting \cs{@pnumwidth} and \cs{@tocrmarg}. % \begin{macrocode} -\newcommand{\setpnumwidth}[1]{\renewcommand{\@pnumwidth}{#1}} -\newcommand{\setrmarg}[1]{\renewcommand{\@tocrmarg}{#1}} +\newcommand*{\setpnumwidth}[1]{\renewcommand{\@pnumwidth}{#1}} +\newcommand*{\setrmarg}[1]{\renewcommand{\@tocrmarg}{#1}} % \end{macrocode} % \end{macro} % \end{macro} @@ -15499,11 +19715,11 @@ % \begin{macro}{\cftdotfill} % In the default ToC, a dotted line can be used to provide a leader between % a title and the page number. The definition of this leader is buried -% in the |\@dottedtocline| command. The |\cftdotfill{|\meta{sep}|}| +% in the \cs{@dottedtocline} command. The \cs{cftdotfill}\marg{sep} % command provides a parameterised version of the leader code, where % \meta{sep} is the separation between the dots in mu units. % The symbol used for the `dots' in the leader is given by the value -% of |\cftdot|. +% of \cs{cftdot}. % \begin{macrocode} \providecommand{\cftdot}{.} \providecommand{\cftdotfill}[1]{% @@ -15514,9 +19730,9 @@ % % \begin{macro}{\cftdotsep} % \begin{macro}{\cftnodots} -% |\cftdotsep| holds the default dot separation. -% If the kerns in |\cftdotfill| are large enough, then no dots will -% be printed. |\cftnodots| should be `large enough'. +% \cs{cftdotsep} holds the default dot separation. +% If the kerns in \cs{cftdotfill} are large enough, then no dots will +% be printed. \cs{cftnodots} should be `large enough'. % \changes{v1.2}{2002/07/07}{Changed \cs{cftnodots} from 10,000 to 2,000 for % 17pt option and pdflatex} % \begin{macrocode} @@ -15530,57 +19746,68 @@ % entries. % % A \file{.toc} (also \file{.lof} and \file{.lot}) file consists -% of a list of -% |\contentsline{|\meta{kind}|}{|\meta{title}|}{|\meta{page}|}| -% commands, where \meta{kind} is the kind of heading (e.g., |part| or -% |section| or |figure|), \meta{title} is the title text (including the number), +% of a list of \\ +% \cs{contentsline}\marg{kind}\marg{title}\marg{page} \\ +% commands, where \meta{kind} is the kind of heading (e.g., \texttt{part} or +% \texttt{section} or \texttt{figure}), \meta{title} is the title text +% (including the number), % and \meta{page} is the page number. The entries are inserted into the -% file by calling the -% |\addcontentsline{|\meta{file}|}{|\meta{kind}|}{|\meta{title}|}| -% command, where \meta{file} is the file extension (e.g., |toc|, |lot|) -% and the other arguments are the same as for the |\contentsline| +% file by calling the \\ +% \cs{addcontentsline}\marg{file}\marg{kind}\marg{title} \\ +% command, where \meta{file} is the file extension (e.g., \texttt{toc}, \texttt{lot}) +% and the other arguments are the same as for the \cs{contentsline} % command. (Arbitrary stuff may also be put into the file via the -% |\addtocontents{|\meta{file}|}{|\meta{text}|}| command). -% The typesetting of the |\contentsline| entries is performed by -% commands of the form |\l@kind|. The sectioning and captioning commands -% call |\addcontentsline| to insert their titles into the \file{.toc} +% \cs{addtocontents}\marg{file}\marg{text} command). +% The typesetting of the \cs{contentsline} entries is performed by +% commands of the form \cs{l@kind}. The sectioning and captioning commands +% call \cs{addcontentsline} to insert their titles into the \file{.toc} % etc., files. % % For the purposes at hand it is generally impossible to treat % the typesetting % of a title and its number separately, as both are bundled into the -% \meta{title} argument within |\contentsline|. They could be handled -% separately if the |\contentsline| command was suitably modified. If -% this was done, then the |\addtocontentsline| command would also need +% \meta{title} argument within \cs{contentsline}. They could be handled +% separately if the \cs{contentsline} command was suitably modified. If +% this was done, then the \cs{addtocontentsline} command would also need % to be changed which would then require the sectioning and captioning % commands to be modified as well. This is certainly possible, but would % cause problems if any other package also modified the sectioning or % captioning commands, and there are several packages which do this. % -% I provide modified versions of the |\l@kind| commands. +% I provide modified versions of the \cs{l@kind} commands. % Essentially, my new definitions -% consist of inlined versions of the code for |\@dottedtocline|. +% consist of inlined versions of the code for \cs{@dottedtocline}. % % % \begin{macro}{\cftparfillskip} -% The |\l@kind| commands modify (locally) the value of |\parfillskip|. -% |\cftparfillskip| is a copy of the default \theTeXbook{} -% |\parfillskip| definition. +% The \cs{l@kind} commands modify (locally) the value of \cs{parfillskip}. +% \cs{cftparfillskip} is a copy of the default \theTeXbook{} +% \cs{parfillskip} definition. % \begin{macrocode} -\newcommand{\cftparfillskip}{\parfillskip=0pt plus1fil} +\newcommand*{\cftparfillskip}{\parfillskip=0pt plus1fil} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@cftn@me} +% Lars Madsen suggested that macros like \cs{cftfigurename} be added +% to entries in the LoF, and so on. +% \changes{v1.61803}{2008/01/30}{Added \cs{@cftn@me} (Lars Madsen mempatch v4.5)} +% \begin{macrocode} +\newcommand*{\@cftn@me}{} + % \end{macrocode} % \end{macro} % % \begin{macro}{\numberline} -% The purpose of the |\numberline{|\meta{secnum}|}| command is to typeset -% \meta{secnum} left justified in a box of width |\@tempdima|. I redefine -% it to add three additional parameters, namely |\@cftbsnum|, -% |\@cftasnum| and |\@cftasnumb| +% The purpose of the \cs{numberline}\marg{secnum} command is to typeset +% \meta{secnum} left justified in a box of width \cs{@tempdima}. I redefine +% it to add three additional parameters, namely \cs{@cftbsnum}, +% \cs{@cftasnum} and \cs{@cftasnumb} % (see \file{ltsect.dtx} for the original % definition). % \begin{macrocode} -\renewcommand{\numberline}[1]{% - \hb@xt@\@tempdima{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb} +\renewcommand*{\numberline}[1]{% + \hb@xt@\@tempdima{\@cftn@me\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb} % \end{macrocode} % \end{macro} % @@ -15598,20 +19825,22 @@ % % % \begin{macro}{\newlistentry} -% |\newlistentry[|\meta{within}|]{|\meta{counter}|}{|\meta{ext}|}{|\meta{level-1}|}| +% \cs{newlistentry}\oarg{within}\marg{counter}\marg{ext}\marg{level-1} % creates a set of commands for typesetting a new kind of entry in a List of. % \meta{counter} is the name of the counter for the entry and must be % the same as the name -% of the entry (e.g., |subsection|). The optional \meta{within} is the -% name of a counter within which |counter| is defined. The file extension +% of the entry (e.g., \texttt{subsection}). The optional \meta{within} is the +% name of a counter within which \texttt{counter} is defined. The file extension % for the List of is \meta{ext} and \meta{level-1} is one less than the % level of the entry in the List of. +% \changes{v1.61803}{2008/01/30}{Added \cs{cftXname} to \cs{newlistentry} +% (mempatch v4.5)} % \begin{macrocode} \newcommand{\newlistentry}[4][\@empty]{% % \end{macrocode} % -% In the following, |X| is used as the value of \meta{counter} and -% |Z| as the value of \meta{ext}. +% In the following, \texttt{X} is used as the value of \meta{counter} and +% \texttt{Z} as the value of \meta{ext}. % % \begin{macro}{\c@X} % \begin{macro}{\theX} @@ -15629,7 +19858,6 @@ \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}} \fi}{} \setcounter{#2}{0} - % \end{macrocode} % \end{macro} % \end{macro} @@ -15638,11 +19866,11 @@ % rest of the new commands are defined. % % \begin{macro}{\l@X} -% |\l@X{|\meta{title}|}{|\meta{page}|}| typesets the entry. +% \cs{l@X}\marg{title}\marg{page} typesets the entry. % \begin{macrocode} \@namedef{l@#2}##1##2{% % \end{macrocode} -% Only typeset if the |\Zdepth| is greater than \meta{level-1}. +% Only typeset if the \cs{Zdepth} is greater than \meta{level-1}. % \begin{macrocode} \ifnum \@nameuse{c@#3depth} > #4\relax % \end{macrocode} @@ -15650,16 +19878,16 @@ % \begin{macrocode} \vskip \@nameuse{cftbefore#2skip} % \end{macrocode} -% Start a group to keep paragraphing changes local. Set the |\leftskip| +% Start a group to keep paragraphing changes local. Set the \cs{leftskip} % to the entry's indentation. % \begin{macrocode} {\leftskip \@nameuse{cft#2indent}\relax % \end{macrocode} -% Set the |\rightskip| to |\@tocrmarg| to leave room for the page number. +% Set the \cs{rightskip} to \cs{@tocrmarg} to leave room for the page number. % \begin{macrocode} \rightskip \@tocrmarg % \end{macrocode} -% Ensure that the last line of an entry will be filled. Setting |\parfillskip| +% Ensure that the last line of an entry will be filled. Setting \cs{parfillskip} % to a negative value prevents `overfull box' messages. % \begin{macrocode} \parfillskip -\rightskip @@ -15676,14 +19904,17 @@ % \begin{macrocode} \leavevmode % \end{macrocode} -% Our version of |\numberline| expects that the width of the number box -% is in |\@tempdima|, and that the three macros |\@cftbsnum|, |\@cftaqsnum|, -% and |\@cftasnumb| are defined. We set all these to the values for this entry. +% Our version of \cs{numberline} expects that the width of the number box +% is in \cs{@tempdima}, and that the three macros \cs{@cftbsnum}, +% \cs{@cftaqsnum}, and \cs{@cftasnumb} are defined. We set all these to +% the values for this entry. % \begin{macrocode} - \@tempdima \@nameuse{cft#2numwidth}\relax + \settowidth{\@tempdima}{\@nameuse{cft#2font}\@nameuse{cft#2name}}% + \addtolength{\@tempdima}{\@nameuse{cft#2numwidth}}% \expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname \expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname \expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname + \expandafter\let\expandafter\@cftn@me\csname cft#2name\endcsname % \end{macrocode} % Arrange that the (entry number and) first line of the title is set at % the current indent, and that any subsequent lines will be further @@ -15704,7 +19935,7 @@ % \end{macrocode} % \end{macro} % -% Now define all the layout commands used by |\l@X|. The default +% Now define all the layout commands used by \cs{l@X}. The default % values of these print the entry in a normal font with a dotted % line between the title and the page number. % \begin{macro}{\cftbeforeXskip} @@ -15745,6 +19976,7 @@ % \end{macro} % \end{macro} % \begin{macro}{\cftXfont} +% \begin{macro}{\cftXname} % \begin{macro}{\cftXpresnum} % \begin{macro}{\cftXaftersnum} % \begin{macro}{\cftXaftersnumb} @@ -15756,6 +19988,7 @@ % dotsep, the font and the leader % \begin{macrocode} \@namedef{cft#2font}{\normalfont} + \@namedef{cft#2name}{} \@namedef{cft#2presnum}{} \@namedef{cft#2aftersnum}{} \@namedef{cft#2aftersnumb}{} @@ -15772,25 +20005,34 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\toclevel@X} -% The hyperref package needs a command |\toclevel@X|, holding +% The hyperref package needs a command \cs{toclevel@X}, holding % the \meta{level-1} value. % \begin{macrocode} \@namedef{toclevel@#2}{#4} % \end{macrocode} % \end{macro} % +% \begin{macro}{\cftXformatpnum} % \begin{macro}{\cftXfillnum} % Typeset the leader and page number. +% \changes{v1.61803}{2008/01/30}{Added \cs{cftXformatpnum} (Dan Leucking +% mempatch v4.9)} % \begin{macrocode} + \@namedef{cft#2formatpnum}##1{% + \hb@xt@\@pnumwidth{\hfil\@nameuse{cft#2pagefont}##1}} \@namedef{cft#2fillnum}##1{% {\@nameuse{cft#2leader}}\nobreak - \hb@xt@\@pnumwidth{% - \hfil\@nameuse{cft#2pagefont}##1}\@nameuse{cft#2afterpnum}\par} +%%% \hb@xt@\@pnumwidth{% +%%% \hfil\@nameuse{cft#2pagefont}##1} + \@nameuse{cft#2formatpnum}{##1}% + \@nameuse{cft#2afterpnum}\par} % \end{macrocode} % \end{macro} -% This ends the definition of |\newlistentry|. +% \end{macro} +% This ends the definition of \cs{newlistentry}. % \begin{macrocode} } % end \newlistentry @@ -15799,16 +20041,121 @@ % % % \begin{macro}{\cftsetindents} -% |\cftsetindents{|\meta{entry}|}{|\meta{indent}|}{|\meta{numwidth}|}| sets +% \cs{cftsetindents}\marg{entry}\marg{indent}\marg{numwidth} sets % the \textit{indent} and \textit{numwidth} for entry \meta{entry}. % \begin{macrocode} -\newcommand{\cftsetindents}[3]{% +\newcommand*{\cftsetindents}[3]{% \setlength{\@nameuse{cft#1indent}}{#2} - \setlength{\@nameuse{cft#1numwidth}}{#3} -} + \setlength{\@nameuse{cft#1numwidth}}{#3}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\cftbookname} +% If you want a book entry in the ToC like: \\ +% BOOK I Title ... \\ +% then \verb?\renewcommand*{\cftbookname}{BOOK~}? \\ +% \begin{macrocode} +\newcommand*{\cftbookname}{} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\cftbookbreak} +% \begin{macro}{\l@book} +% \begin{macro}{\booknumberline} +% Now for the ToC entry. +% \changes{v1.61803}{2008/01/30}{Added \cs{l@book} and supports (mempatch v4.4)} +% \begin{macrocode} +\newcommand*{\cftbookbreak}{\addpenalty{-\@highpenalty}% + \addvspace{\cftbeforebookskip}} +\newcommand*{\l@book}[2]{% + \ifnum\c@tocdepth >-3\relax +%% \addpenalty{-\@highpenalty}% + \cftbookbreak +%% \addvspace{\cftbeforebookskip}% + \begingroup + {\leftskip \cftbookindent\relax + \rightskip \@tocrmarg + \parfillskip -\rightskip + \parindent \cftbookindent\relax\@afterindenttrue + \interlinepenalty\@M + \leavevmode + \settowidth{\@tempdima}{\cftbookfont\cftbookname}% + \addtolength{\@tempdima}{\cftbooknumwidth}% + \let\@cftbsnum \cftbookpresnum + \let\@cftasnum \cftbookaftersnum + \let\@cftasnumb \cftbookaftersnumb + \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip + {\cftbookfont #1}% + \cftbookfillnum{#2}} + \nobreak + \global\@nobreaktrue + \everypar{\global\@nobreakfalse\everypar{}}% + \endgroup + \fi} +\newcommand{\booknumberline}[1]{% + \hb@xt@\@tempdima{% + \cftbookname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb\space} % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cftbeforebookskip} +% \begin{macro}{\cftbookindent} +% \begin{macro}{\cftbooknumwidth} +% \begin{macro}{\cftbookfont} +% \begin{macro}{\cftbookpresnum} +% \begin{macro}{\cftbookaftersnum} +% \begin{macro}{\cftbookaftersnumb} +% \begin{macro}{\cftbookleader} +% \begin{macro}{\cftbookdotsep} +% \begin{macro}{\cftbookpagefont} +% \begin{macro}{\cftbookafterpnum} +% \begin{macro}{\cftbookfillnum} +% \begin{macro}{\cftbookformatpnum} +% \begin{macrocode} +\newlength{\cftbeforebookskip} + \setlength{\cftbeforebookskip}{2.25em \@plus\p@} +\newdimen\cftbookindent + \setlength{\cftbookindent}{0em} +\newdimen\cftbooknumwidth + \setlength{\cftbooknumwidth}{1.5em} +\newcommand*{\cftbookfont}{\large\bfseries} +\newcommand*{\cftbookpresnum}{} +\newcommand*{\cftbookaftersnum}{} +\newcommand*{\cftbookaftersnumb}{} +\newcommand*{\cftbookleader}{% + \large\bfseries\cftdotfill{\cftbookdotsep}} +\newcommand*{\cftbookdotsep}{\cftnodots} +\newcommand*{\cftbookpagefont}{\large\bfseries} +\newcommand{\cftbookafterpnum}{} +\newcommand{\cftbookfillnum}[1]{% + {\cftbookleader}% +%%%% {\hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}}% + \cftbookformatpnum{#1}% + \cftbookafterpnum\par} +\newcommand{\cftbookformatpnum}[1]{% + \hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % % % \begin{macro}{\cftpartname} @@ -15822,14 +20169,19 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\cftpartbreak} % \begin{macro}{\l@part} -% Can't use |\newlistentry| for this because of the initial penalty -% and the final |\nobreak| code. +% Can't use \cs{newlistentry} for \cs{l@part} because of the initial penalty +% and the final \cs{nobreak} code. +% \changes{v1.61803}{2008/01/30}{Added \cs{cftpartbreak}} % \begin{macrocode} +\newcommand*{\cftpartbreak}{\addpenalty{-\@highpenalty}% + \addvspace{\cftbeforepartskip}} \newcommand*{\l@part}[2]{% \ifnum \c@tocdepth >-2\relax - \addpenalty{-\@highpenalty}% - \addvspace{\cftbeforepartskip}% +%%% \addpenalty{-\@highpenalty}% +%%% \addvspace{\cftbeforepartskip}% + \cftpartbreak \begingroup {\leftskip \cftpartindent\relax \rightskip \@tocrmarg @@ -15853,15 +20205,27 @@ % \end{macrocode} % \end{macro} +% \end{macro} +% +% \begin{macro}{\toclevel@part} +% Needed if the \Lpack{hyperref} package is used. +% \changes{v1.61803}{2008/01/30}{Added \cs{toclevel@part} (mempatch v4.9)} +% \begin{macrocode} +\newcommand*{\toclevel@part}{-1} + +% \end{macrocode} +% \end{macro} % % \begin{macro}{\partnumberline} -% |\partnumberline| is a special version of |\numberline| output by |\part|. -% It's default definition uis identical to |\numberline|. +% \cs{partnumberline} is a special version of \cs{numberline} output by \cs{part}. +% Its default definition is identical to \cs{numberline}. % \changes{v1.3}{2002/11/14}{Added \cs{partnumberline}} +% \changes{v1.61803}{2008/01/30}{Added a space after the number in +% \cs{partnumberline} (mempatch v4.4)} % \begin{macrocode} \newcommand{\partnumberline}[1]{% \hb@xt@\@tempdima{% - \cftpartname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb} + \cftpartname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb\space} % \end{macrocode} % \end{macro} @@ -15877,11 +20241,13 @@ % \begin{macro}{\cftpartpagefont} % \begin{macro}{\cftpartafterpnum} % \begin{macro}{\cftpartindent} +% \begin{macro}{\cftpartformatpnum} % \begin{macro}{\cftpartfillnum} % These are the user commands to control the typesetting of Part entries. % They are initialised to give the standard appearance. % \changes{v1.3}{2002/10/10}{Changed \cs{cftpartnumwidth} to cater for % use of \cs{numberline} in the ToC} +% \changes{v1.61803}{2008/01/30}{Added \cs{cftpartformatpnum} (mempatch v4.9)} % \begin{macrocode} \newlength{\cftbeforepartskip} \setlength{\cftbeforepartskip}{2.25em \@plus\p@} @@ -15898,9 +20264,11 @@ \newcommand{\cftpartdotsep}{\cftnodots} \newcommand{\cftpartpagefont}{\large\bfseries} \newcommand{\cftpartafterpnum}{} + \newcommand*{\cftpartformatpnum}[1]{% + \hb@xt@\@pnumwidth{\hss {\cftpartpagefont #1}}} \newcommand{\cftpartfillnum}[1]{% {\cftpartleader}% - {\hb@xt@\@pnumwidth{\hss {\cftpartpagefont #1}}}% + {\cftpartformatpnum{#1}}% \cftpartafterpnum\par} % \end{macrocode} @@ -15916,6 +20284,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % % \begin{macro}{\cftchaptername} @@ -15961,10 +20330,11 @@ % \end{macro} % % \begin{macro}{\l@chapter} -% |\l@chapter{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for -% a |chapter| heading. It is a parameterised copy of the default |\l@chapter| +% \cs{l@chapter}\marg{title}\marg{page} typesets the ToC entry for +% a \texttt{chapter} heading. It is a parameterised copy of the default +% \cs{l@chapter} % (see \file{classes.dtx} for the original definition). Can't use -% |\newlistentry| for this because of the intial penalty. +% \cs{newlistentry} for this because of the intial penalty. % \changes{v1.3}{2002/11/14}{Added \cs{cftchapterbreak} to \cs{l@chapter}} % \changes{v1.618}{2005/09/03}{Defined \cs{l@chapter} in terms of \cs{l@chapapp} (mempatch v3.12)} % \begin{macrocode} @@ -15974,6 +20344,15 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\toclevel@chapter} +% Needed if the \Lpack{hyperref} package is used. +% \changes{v1.61803}{2008/01/30}{Added \cs{toclevel@chapter} (mempatch v4.9)} +% \begin{macrocode} +\newcommand*{\toclevel@chapter}{0} + +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\cftappendixname} % If you want a appendixed chapter entry in the ToC like: \\ % Appendix A A title ... \\ @@ -16000,9 +20379,9 @@ % \end{macro} % % \begin{macro}{\chapternumberline} -% |\chapternumberline| is a special version of |\numberline| output by -% |\chapter|. -% It's default definition is identical to |\numberline|. +% \cs{chapternumberline} is a special version of \cs{numberline} output by +% \cs{chapter}. +% It's default definition is identical to \cs{numberline}. % \changes{v1.3}{2002/11/14}{Added \cs{chapternumberline}} % \changes{v1.618}{2005/09/03}{Added \cs{@chapapp@head} to \cs{chapternumberline} (mempatch v3.12)} % \begin{macrocode} @@ -16024,9 +20403,11 @@ % \begin{macro}{\cftchapterdotsep} % \begin{macro}{\cftchapterpagefont} % \begin{macro}{\cftchapterafterpnum} +% \begin{macro}{\cftchapterformatpnum} % \begin{macro}{\cftchapterfillnum} % These are the user commands to control the typesetting of Chapter entries. % They are initialised to give the standard appearance. +% \changes{v1.61803}{2008/01/30}{Added \cs{cftchapterformatpnum} (mempatch v4.9)} % \begin{macrocode} \newlength{\cftbeforechapterskip} \setlength{\cftbeforechapterskip}{1.0em \@plus\p@} @@ -16043,9 +20424,11 @@ \newcommand{\cftchapterdotsep}{\cftnodots} \newcommand{\cftchapterpagefont}{\bfseries} \newcommand{\cftchapterafterpnum}{} - \newcommand{\cftchapterfillnum}[1]{ + \newcommand*{\cftchapterformatpnum}[1]{% + \hb@xt@\@pnumwidth{\hfil\cftchapterpagefont #1}} + \newcommand*{\cftchapterfillnum}[1]{ {\cftchapterleader}\nobreak - \hb@xt@\@pnumwidth{\hfil\cftchapterpagefont #1}% + \cftchapterformatpnum{#1}% \cftchapterafterpnum\par} % \end{macrocode} % \end{macro} @@ -16060,9 +20443,10 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\cftchapterbreak} -% Another parameter for |\l@chapter|. +% Another parameter for \cs{l@chapter}. % \changes{v1.3}{2002/11/14}{Added \cs{cftchapterbreak}} % \begin{macrocode} \newcommand{\cftchapterbreak}{\addpenalty{-\@highpenalty}} @@ -16075,9 +20459,9 @@ % \begin{macro}{\l@subsubsection} % \begin{macro}{\l@paragraph} % \begin{macro}{\l@subparagraph} -% |\l@section{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for -% a |section| heading. Similarly |\l@subsection| and |\l@subsubsection| -% for |\subsection| and |\subsubsection| entries, and so on. +% \cs{l@section}\marg{title}\marg{page} typesets the ToC entry for +% a \cs{section} heading. Similarly \cs{l@subsection} and \cs{l@subsubsection} +% for \cs{subsection} and \cs{subsubsection} entries, and so on. % \changes{v1.4}{2003/11/22}{Used \cs{newlistentry} for pararaph and % subparagraph (from patch v1.7)} % \changes{v1.618}{2005/09/02}{Corrected (sub)paragraph ToC indents (mempatch v2.3)} @@ -16112,20 +20496,21 @@ % \Lpack{subfigure} package is actually loaded. % % \begin{macro}{\@cftl@subfigtab} -% This command redefines the |\l@subfigure| and |\l@subtable| commands. +% This command redefines the \cs{l@subfigure} and \cs{l@subtable} commands. +% \changes{v1.61803}{2008/01/30}{Made \cs{@cftl@subfigtab} a no-op (mempatch v4.6)} % \begin{macrocode} -\newcommand{\@cftl@subfigtab}{ +\newcommand*{\@cftl@subfigtab}{ % \end{macrocode} % \begin{macro}{\l@subfigure} % \begin{macro}{\l@subtable} -% |\l@subfigure{|\meta{title}|}{|\meta{page}|}| typesets the LoF entry for -% a |subfigure| caption heading, and |\l@subtable| does the same for subtables. +% \cs{l@subfigure}\marg{title}\marg{page} typesets the LoF entry for +% a subfigure caption heading, and \cs{l@subtable} does the same for subtables. % \begin{macrocode} \newlistentry[figure]{subfigure}{lof}{1} \cftsetindents{subfigure}{2.3em}{2.5em} \newlistentry[table]{subtable}{lot}{1} - \cftsetindents{subtable}{2.3em}{2.5em} -} + \cftsetindents{subtable}{2.3em}{2.5em}} +\renewcommand*{\@cftl@subfigtab}{} % \end{macrocode} % \end{macro} @@ -16148,9 +20533,9 @@ % % \begin{macro}{\cftpagenumbersoff} % The user level command for switching off page numbers is -% |\cftpagenumbersoff{|\meta{entry}|}| where \meta{entry} is the +% \cs{cftpagenumbersoff}\marg{entry} where \meta{entry} is the % name of the entry. -% The macro redefines the |\cftXnumfill| command so that there is no leader +% The macro redefines the \cs{cftXfillnum} command so that there is no leader % and the page number is ignored. % \begin{macrocode} \DeclareRobustCommand{\cftpagenumbersoff}[1]{% @@ -16161,35 +20546,30 @@ % \end{macro} % % \begin{macro}{\cftpagenumberson} -% |\cftpagenumberson{|\meta{entry}|}| is the user level command for -% reversing the corresponding |\cftpagenumbersoff|. -% The macro defines the |\cftXnumfill| command to correspond to +% \cs{cftpagenumberson}\marg{entry} is the user level command for +% reversing the corresponding \cs{cftpagenumbersoff}. +% The macro defines the \cs{cftXfillnum} command to correspond to % the default definition. +% \changes{v1.61803}{2008/01/30}{Modified \cs{cftpagenumberson} to use \cs{cftXformatpnum} +% (mempatch v4.9)} % \begin{macrocode} \DeclareRobustCommand{\cftpagenumberson}[1]{% \@namedef{cft#1fillnum}##1{% - {\@nameuse{cft#1leader}}\nobreak - \hb@xt@\@pnumwidth{% - \hfil\@nameuse{cft#1pagefont}##1}\@nameuse{cft#1afterpnum}\par}} + \@nameuse{cft#1leader}\nobreak + \@nameuse{cft#1formatpnum}{##1}% + \@nameuse{cft#1afterpnum}\par}} % \end{macrocode} % \end{macro} % % -% -% -% -% -% -% % \subsection{Chapter precis} % -% % \begin{macro}{\chapterprecis} -% The command |\chapterprecis{|\meta{text}|}| typesets +% The command \cs{chapterprecis}\marg{text} typesets % \meta{text} at the point where it is called, and also adds \meta{text} % to the \file{.toc} file. It is expects to be called immediately after -% a |\chapter| command. +% a \cs{chapter} command. % \begin{macrocode} \newcommand{\chapterprecis}[1]{% \chapterprecishere{#1} @@ -16198,8 +20578,8 @@ % \end{macro} % % \begin{macro}{\chapterprecishere} -% |\chapterprecishere{|\meta{text}|}| typesets \meta{text}. It expects -% to be called immediately after a |\chapter| command. +% \cs{chapterprecishere}\marg{text} typesets \meta{text}. It expects +% to be called immediately after a \cs{chapter} command. % \changes{v1.3}{2002/11/14}{Parameterised \cs{chapterprecishere}} % \begin{macrocode} \newcommand{\chapterprecishere}[1]{% @@ -16208,22 +20588,38 @@ % \end{macro} % % \begin{macro}{\prechapterprecis} +% \begin{macro}{\prechapterprecisshift} +% \begin{macro}{\precisfont} % \begin{macro}{\postchapterprecis} -% These put code before and after |\chapterprecishere| text. By -% default |\prechapterprecis| adds some negative space and starts a -% quote environment using italics. |\postchapterprecis| ends +% The \cs{pre...} and \cs{post...} macros put code before and after +% \cs{chapterprecishere} text. By +% default \cs{prechapterprecis} adds some (negative) space (defined by +% \cs{prechapterprecisshift} whose value depends on whether or not the +% \Lopt{article} option is used, as discovered by Lars Madsen) and starts a +% quote environment using the \cs{precisfont}. \cs{postchapterprecis} ends % the quote environment. % \changes{v1.3}{2002/11/14}{Added \cs{prechapterprecis} and % \cs{postchapterprecis}} +% \changes{v1.61803}{2008/01/30}{Added \cs{prechapterprecisshift} and +% \cs{precisfont} (mempatch v4.9)} % \begin{macrocode} +\newdimen\prechapterprecisshift +\ifartopt + \prechapterprecisshift=0pt +\else + \prechapterprecisshift=-2\baselineskip +\fi +\newcommand*{\precisfont}{\normalfont\itshape} \newcommand{\prechapterprecis}{% - \vspace*{-2\baselineskip}% - \begin{quote}\normalfont\itshape} -\newcommand{\postchapterprecis}{\end{quote}} + \vspace*{\prechapterprecisshift}% + \begin{quote}\precisfont} +\newcommand*{\postchapterprecis}{\end{quote}} % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\precistocfont} % Font for typesetting chapter precis in the ToC. @@ -16235,10 +20631,10 @@ % % \begin{macro}{\chapterprecistoc} % \begin{macro}{\precistoctext} -% |\chapterprecistoc{|\meta{text}|}| effectively adds \meta{text} to +% \cs{chapterprecistoc}\marg{text} effectively adds \meta{text} to % the \file{.toc} % file. The \meta{text} will be typeset within the same margins as the -% the title text of a |\chapter| heading, using the |\precistocfont| font. +% the title text of a \cs{chapter} heading, using the \cs{precistocfont} font. % \changes{v1.3}{2002/11/14}{Added \cs{precistoctext}} % \begin{macrocode} \newcommand{\chapterprecistoc}[1]{% @@ -16251,7 +20647,7 @@ {\leftskip \cftchapterindent\relax \advance\leftskip \cftchapternumwidth\relax % \end{macrocode} -% Set the right hand margin to |\@tocrmarg|. +% Set the right hand margin to \cs{@tocrmarg}. % \begin{macrocode} \rightskip \@tocrmarg\relax % \end{macrocode} @@ -16267,9 +20663,9 @@ % \subsection{Adding things to the ToC} % % \begin{macro}{\cftlocalchange} -% |\cftmakelocalchange{|\meta{file}|}{|\meta{pnumwidth}|}{|\meta{tocrmarg}|}| -% makes an entry into \meta{file} to change the |\@pnumwidth| and -% the |\@tocrmarg| values. +% \cs{cftmakelocalchange}\marg{file}\marg{pnumwidth}\marg{tocrmarg} +% makes an entry into \meta{file} to change the \cs{@pnumwidth} and +% the \cs{@tocrmarg} values. % \begin{macrocode} \newcommand{\cftlocalchange}[3]{% \addtocontents{#1}{\protect\setpnumwidth{#2} \protect\setrmarg{#3}}} @@ -16277,8 +20673,8 @@ % \end{macro} % % \begin{macro}{\cftaddtitleline} -% |\cftaddtitleline{|\meta{file}|}{|\meta{kind}|}{|\meta{title}|}{|\meta{page}|}| -% adds a |\contentsline| entry to \meta{file} with the given information. +% \cs{cftaddtitleline}\marg{file}\marg{kind}\marg{title}\marg{page} +% adds a \cs{contentsline} entry to \meta{file} with the given information. % \begin{macrocode} \newcommand{\cftaddtitleline}[4]{% \addtocontents{#1}{\protect\contentsline{#2}{#3}{#4}}} @@ -16286,8 +20682,8 @@ % \end{macro} % % \begin{macro}{\cftaddnumtitleline} -% |\cftaddnumtitleline{|\meta{file}|}{|\meta{kind}|}{|\meta{num}|}{|\meta{title}|}{|\meta{page}|}| -% adds a |\contentsline| entry to \meta{file} with the given information. +% \cs{cftaddnumtitleline}\marg{file}\marg{kind}\marg{num}\marg{title}\marg{page} +% adds a \cs{contentsline} entry to \meta{file} with the given information. % \begin{macrocode} \newcommand{\cftaddnumtitleline}[5]{% \addtocontents{#1}% @@ -16297,6 +20693,53 @@ % \end{macro} % % +% \begin{macro}{\cftinsertcode} +% \begin{macro}{\cftinserthook} +% \begin{macro}{\cftinsert} +% This is a generalisation of a suggestion by Lars Madsen (private email, +% 2007/12/14). +% +% \cs{cftinsertcode}\marg{id}\marg{code} creates a hook to be executed in +% a `List of'. Since we use \cs{@nameuse} it does not matter if the hook +% does not exist +% +% \cs{cftinserthook}\marg{list}\marg{id} inserts the hook \meta{id} into the +% \meta{list} `List of' file (in the form of \cs{cftinsert}\marg{id}). +% +% Use like this: +% \begin{verbatim} +% \cftinsertcode{A}{% +% \renewcommand*{\cftchapterfont}{\normalfont\scshape} +% ... +% } +% \cftinsertcode{F}{...} +% \cftinsertcode{G}{...} +% ... +% \frontmatter +% \tableofcontents +% \cftinserthook{lof}{G} +% \listoffigures +% \chapter{...} +% ... +% \mainmatter +% \cftinserthook{lof}{F} +% \cftinserthook{toc}{A} +% \chapter{...} +% ... +% \end{verbatim} +% +% \changes{v1.61803}{2008/01/30}{Added \cs{cftinsert} and friends (mempatch v4.9)} +% \begin{macrocode} +\newcommand*{\cftinsert}[1]{\@nameuse{cftinsert#1}} +\newcommand{\cftinsertcode}[2]{\@namedef{cftinsert#1}{#2}} +\newcommand*{\cftinserthook}[2]{% + \addtocontents{#1}{\protect\cftinsert\protect{#2\protect}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \subsection{ToC and divisional numbering} % % Commands are provided, based on the \Lpack{tocvsec2} package, for changing @@ -16304,134 +20747,173 @@ % % \begin{macro}{\@setclcnt} % Helper macro to set a sectioning-related counter. Use as -% |\@setclcnt{|\meta{sec}|}{|\meta{counter}|}| to set \Lcount{counter} +% \cs{@setclcnt}\marg{sec}\marg{counter} to set \Lcount{counter} % to the level of \meta{sec}. +% \changes{v1.61803}{2008/01/30}{Added book to \cs{@setclcnt} and friends +% (mempatch v4.4)} % \begin{macrocode} -\newcommand{\@setclcnt}[2]{ +\newcommand*{\@setclcnt}[2]{% \@tempswafalse - \nametest{#1}{none} + \nametest{#1}{none}% \ifsamename - \setcounter{#2}{-10} + \setcounter{#2}{-10}% \@tempswatrue \fi - \nametest{#1}{part} + \nametest{#1}{book}% \ifsamename - \setcounter{#2}{-1} + \setcounter{#2}{-2}% \@tempswatrue \fi - \nametest{#1}{chapter} + \nametest{#1}{part}% \ifsamename - \setcounter{#2}{0} + \setcounter{#2}{-1}% \@tempswatrue \fi - \nametest{#1}{section} + \nametest{#1}{chapter}% \ifsamename - \setcounter{#2}{1} + \setcounter{#2}{0}% \@tempswatrue \fi - \nametest{#1}{subsection} + \nametest{#1}{section}% \ifsamename - \setcounter{#2}{2} + \setcounter{#2}{1}% \@tempswatrue \fi - \nametest{#1}{subsubsection} + \nametest{#1}{subsection}% \ifsamename - \setcounter{#2}{3} + \setcounter{#2}{2}% \@tempswatrue \fi - \nametest{#1}{paragraph} + \nametest{#1}{subsubsection}% \ifsamename - \setcounter{#2}{4} + \setcounter{#2}{3}% \@tempswatrue \fi - \nametest{#1}{subparagraph} + \nametest{#1}{paragraph}% \ifsamename - \setcounter{#2}{5} + \setcounter{#2}{4}% \@tempswatrue \fi - \nametest{#1}{all} + \nametest{#1}{subparagraph}% \ifsamename - \setcounter{#2}{50} + \setcounter{#2}{5}% \@tempswatrue \fi - \if@tempswa\else + \nametest{#1}{all}% + \ifsamename + \setcounter{#2}{50}% + \@tempswatrue + \fi + \if@tempswa\else \@memerror{% Unknown document division name (#1) }{% - I'll ignore it. - Type \space <return> and I'll continue.\MessageBreak - If you haven't mistyped the name then use - \protect\setcounter\space instead.} - \fi -} + I'll ignore it. + Type \space <return> and I'll continue.\MessageBreak + If you haven't mistyped the name then use + \protect\setcounter\space instead.}% + \fi} + % \end{macrocode} % \end{macro} % % \begin{macro}{\settocdepth} -% |\settocdepth{|\meta{sec}|}| is the user command for setting +% \cs{settocdepth}\marg{sec} is the user command for setting % \Lcount{tocdepth} in the \file{.toc} file to the value corresponding to % \meta{sec}. % \changes{v1.3}{2002/11/14}{Changed \cs{settocdepth} to use \cs{changetocdepth}} +% \changes{v1.61803}{2008/01/30}{Added book to ToC depth setting (mempatch v4.4)}. % \begin{macrocode} -\newcommand{\settocdepth}[1]{% +\newcommand*{\settocdepth}[1]{% \@tempswafalse - \nametest{#1}{none} + \nametest{#1}{none}% \ifsamename - \addtocontents{toc}{\changetocdepth{-10}} + \addtocontents{toc}{\changetocdepth{-10}}% \@tempswatrue \fi - \nametest{#1}{part} + \nametest{#1}{book}% \ifsamename - \addtocontents{toc}{\changetocdepth{-1}} + \addtocontents{toc}{\changetocdepth{-2}}% \@tempswatrue \fi - \nametest{#1}{chapter} + \nametest{#1}{part}% \ifsamename - \addtocontents{toc}{\changetocdepth{0}} + \addtocontents{toc}{\changetocdepth{-1}}% \@tempswatrue \fi - \nametest{#1}{section} + \nametest{#1}{chapter}% \ifsamename - \addtocontents{toc}{\changetocdepth{1}} + \addtocontents{toc}{\changetocdepth{0}}% \@tempswatrue \fi - \nametest{#1}{subsection} + \nametest{#1}{section}% \ifsamename - \addtocontents{toc}{\changetocdepth{2}} + \addtocontents{toc}{\changetocdepth{1}}% \@tempswatrue \fi - \nametest{#1}{subsubsection} + \nametest{#1}{subsection}% \ifsamename - \addtocontents{toc}{\changetocdepth{3}} + \addtocontents{toc}{\changetocdepth{2}}% \@tempswatrue \fi - \nametest{#1}{paragraph} + \nametest{#1}{subsubsection}% \ifsamename - \addtocontents{toc}{\changetocdepth{4}} + \addtocontents{toc}{\changetocdepth{3}}% \@tempswatrue \fi - \nametest{#1}{subparagraph} + \nametest{#1}{paragraph}% \ifsamename - \addtocontents{toc}{\changetocdepth{5}} + \addtocontents{toc}{\changetocdepth{4}}% \@tempswatrue \fi - \nametest{#1}{all} + \nametest{#1}{subparagraph}% \ifsamename - \addtocontents{toc}{\changetocdepth{50}} + \addtocontents{toc}{\changetocdepth{5}}% \@tempswatrue \fi - \if@tempswa\else + \nametest{#1}{all}% + \ifsamename + \addtocontents{toc}{\changetocdepth{50}}% + \@tempswatrue + \fi + \if@tempswa +% \end{macrocode} +% The next bit is from Heiko Oberdiek (CTT {\itshape Re: Memoir, \verb?\settocdepth? +% and pdflatex \verb?=>? problem with PDF bookmarks}, 2006/07/21) as +% \Lpack{hyperref} needs \verb?\tocdepth? set in the body not just in the ToC. +% \begin{macrocode} + \@ifundefined{toclevel@#1}{% + \@memwarn{Unknown toclevel for #1}% + }{% + \setcounter{tocdepth}{\@nameuse{toclevel@#1}}% + } + \else \@memerror{% Unknown document division name (#1) }{% - I'll ignore it. Type \space <return> and I'll continue.} - \fi -} + I'll ignore it. + Type \space <return> and I'll continue.}% + \fi} + % \end{macrocode} % \end{macro} % +% \begin{macro}{\toclevel@none} +% \begin{macro}{\toclevel@all} +% Couple of extras for hypperef to cater for \texttt{all} and \texttt{none} +% as `division levels'. +% \changes{v1.61803}{2008/01/30}{Added \cs{toclevel@none} and \cs{toclevel@all} +% (mempatch v4.4)} +% \begin{macrocode} +\newcommand*{\toclevel@none}{-10} +\newcommand*{\toclevel@all}{50} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\changetocdepth} -% Changes the |tocdepth| counter. Make it robust as it will be written +% Changes the \texttt{tocdepth} counter. Make it robust as it will be written % to the *.toc file. % \changes{v1.3}{2002/11/14}{Added \cs{changetocdepth}} % \begin{macrocode} @@ -16441,28 +20923,17 @@ % \end{macro} % % \begin{macro}{\maxtocdepth} -% |\maxtocdepth{|\meta{sec}|}| can be used to initialise \Lcount{tocdepth} +% \cs{maxtocdepth}\marg{sec} can be used to initialise \Lcount{tocdepth} % to the value corresponding to \meta{sec}. This can only be used -% between the end of the preamble and the |\tableofcontents| command. +% between the end of the preamble and the \cs{tableofcontents} command. % \begin{macrocode} \newcommand{\maxtocdepth}[1]{% \@setclcnt{#1}{tocdepth}} % \end{macrocode} % \end{macro} % -% \begin{macro}{\setsecnumdepth} -% |\setsecnumdepth{|\meta{sec}|}| is the user command for setting -% \Lcount{secnumdepth} to the value for \meta{sec}. It can only be used after -% the preamble. -% \begin{macrocode} -\newcommand{\setsecnumdepth}[1]{%\leavevmode% - \@setclcnt{#1}{secnumdepth}} -% \end{macrocode} -% \end{macro} -% -% % \begin{macro}{\maxsecnumdepth} -% |\maxsecnumdepth{|\meta{sec}|}| can be used to initialise +% \cs{maxsecnumdepth}\marg{sec} can be used to initialise % \Lcount{secnumdepth} % to the value corresponding to \meta{sec}. % \changes{v1.1}{2002/03/10}{Added maxsecnumdepth counter and modified \cs{maxsecnumdepth}} @@ -16474,13 +20945,34 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\setsecnumdepth} +% \cs{setsecnumdepth}\marg{sec} is the user command for setting +% \Lcount{secnumdepth} to the value for \meta{sec}. In the preamble it sets +% both the \Lcount{secnumdepth} and \Lcount{maxsecnumdepth} to \meta{sec} +% while in the body it only sets \Lcount{secnumdepth}. +% \changes{v1.61803}{2008/01/30}{Extended \cs{setsecnumdepth} to make it more +% intuitive (mempatch v4.9)} +% \begin{macrocode} +\newcommand{\setsecnumdepth}[1]{% + \ifx\@nodocument\relax% after the preamble + \@setclcnt{#1}{secnumdepth}% + \else + \@setclcnt{#1}{secnumdepth}% + \@setclcnt{#1}{maxsecnumdepth}% + \fi} +\setsecnumdepth{section} + +% \end{macrocode} +% \end{macro} +% +% % % % \section{Bibliography} % % % \begin{macro}{\bibindent} -% The \Lopt{open} bibliography uses an indentation of |\bibindent|. +% The \Lopt{open} bibliography uses an indentation of \cs{bibindent}. % \begin{macrocode} \newdimen\bibindent \setlength\bibindent{1.5em} @@ -16497,7 +20989,7 @@ % \end{macro} % % \begin{macro}{\biblistextra} -% A hook into the |bibitemlist|. +% A hook into the \texttt{bibitemlist}. % \changes{v1.4}{2003/11/22}{Added \cs{biblistextra} (from patch v1.7)} % \begin{macrocode} \newcommand{\biblistextra}{\itemsep=\bibitemsep} @@ -16506,13 +20998,13 @@ % \end{macro} % % \begin{environment}{bibitemlist} -% The |thebibliography| environment starts a new document division. +% The \texttt{thebibliography} environment starts a new document division. % Internally it tweaks some typesetting aspects; principally it -% uses |\sloppy| because good linebreaking is hard in a bibliography, -% and |\sfcode`\.=1000\relax| causes a full stop not to produce an +% uses \cs{sloppy} because good linebreaking is hard in a bibliography, +% and \verb?\sfcode`\.=1000\relax? causes a full stop not to produce an % end-of-sentence space. The implementation of the environment is -% based on the generic |list| environment, and uses the |\c@enumiv| -% counter for the labels. The following code is extracted from the +% based on the generic \texttt{list} environment, and uses the \cs{c@enumiv} +% count for the labels. The following code is extracted from the % \Lpack{book} class, plus some additions. % \changes{v1.4}{2003/11/22}{Added \cs{biblistextra} to bibitemlist (from patch v1.7)} % \begin{macrocode} @@ -16540,7 +21032,7 @@ % \end{environment} % % \begin{macro}{\newblock} -% The default is for |\newblock| to provide a small space. +% The default is for \cs{newblock} to provide a small space. % \begin{macrocode} \newcommand{\newblock}{\hskip .11em\@plus.33em\@minus.07em} % \end{macrocode} @@ -16556,7 +21048,7 @@ % % \begin{macro}{\setbiblabel} % \begin{macro}{\@biblabel} -% This is the user command for setting the label for a |\bibitem|. +% This is the user command for setting the label for a \cs{bibitem}. % The following sets the default definition. % \begin{macrocode} \newcommand*{\setbiblabel}[1]{% @@ -16570,13 +21062,13 @@ % \begin{macro}{\@memb@bsec} % In a \ctt{} thread \textit{memoir, natbib, and chapterbib} in January 2003 % there was a discussion on how to get all three to work together. -% Donald Arseneau suggested that |\bibsection| be used as a `standard' +% Donald Arseneau suggested that \cs{bibsection} be used as a `standard' % way of controlling the sectioning command of a bibliography. Here is % an implementation of that idea. % -% |\@memb@bchap| is a copy of memoir's original code for the start -% of the |thebibliography| environment which used a |\chapter*| -% title. |\@memb@bsec| is the much simpler version for a |\section| title. +% \cs{@memb@bchap} is a copy of memoir's original code for the start +% of the \texttt{thebibliography} environment which used a \cs{chapter*} +% 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)} % \begin{macrocode} @@ -16604,7 +21096,7 @@ % \end{macro} % % \begin{environment}{thebibliography} -% The definition of the |thebibliography| environment in this class is not +% The definition of the \texttt{thebibliography} environment in this class is not % quite the same as in the standard classes! % % \changes{v0.2}{2001/06/03}{Deleted starred version of thebibliography} @@ -16650,7 +21142,7 @@ % % % \begin{macro}{\@cite} -% The output of the |\cite| command is produced by this macro. The default +% The output of the \cs{cite} command is produced by this macro. The default % is used. The \Lpack{cite} package is a good way of changing this. % \begin{macrocode} % \renewcommand*{\@cite}[1]{[#1]} @@ -16660,12 +21152,12 @@ % \subsection{Use with the \Lpack{natbib} and \Lpack{chapterbib} packages} % % The \Lpack{natbib} package~\cite{NATBIB} uses its own definition for -% the |\thebibliography| environment, which knows nothing about adding +% the \texttt{thebibliography} environment, which knows nothing about adding % the Bibliography to the ToC. The following makes appropriate changes % to \Lpack{natbib} code to support the class. % % The \Lpack{chapterbib} package by Donald Arseneau also may make changes -% to the |\thebibliography| environment --- perhaps memoir's version +% to the \texttt{thebibliography} environment --- perhaps memoir's version % or natbib's version. % % As packages get loaded after classes, I have to try and patch any @@ -16678,24 +21170,24 @@ % \changes{v1.4}{2003/02/27}{Added code supporting chapterbib (patch 1.3)} % \begin{macro}{\bibsection} % \begin{macro}{\endthebibliography} -% Natbib provides |\bibsection| for titling the bibliography. I also have -% to extend the end of the |thebibliography| environment to cater for -% |\postbibhook|. +% Natbib provides \cs{bibsection} for titling the bibliography. I also have +% to extend the end of the \texttt{thebibliography} environment to cater for +% \cs{postbibhook}. % \begin{macrocode} \AtBeginDocument{% \@ifpackageloaded{natbib}{% natbib is loaded % \end{macrocode} -% As \Lpack{natbib} is used, change |\endthebibliography| to the class +% As \Lpack{natbib} is used, change \cs{endthebibliography} to the class % definition. % \begin{macrocode} \addtodef{\endthebibliography}{}{\vskip-\lastskip\postbibhook} \@ifpackagewith{natbib}{sectionbib}{% with sectionbib option % \end{macrocode} -% \Lpack{natbib}'s |sectionbib| option is used, +% \Lpack{natbib}'s \Lopt{sectionbib} option is used, % \begin{macrocode} \renewcommand{\bibsection}{\@memb@bsec}}% % \end{macrocode} -% The |sectionbib| option is not used, so we have a chapter title. +% The \Lopt{sectionbib} option is not used, so we have a chapter title. % \begin{macrocode} {\renewcommand{\bibsection}{\@memb@bchap}}}% % \end{macrocode} @@ -16708,15 +21200,15 @@ % \begin{macrocode} \@ifpackagewith{chapterbib}{sectionbib}{% % \end{macrocode} -% \Lpack{chapterbib} is used with its |sectionbib| option. This is the -% only case to worry about. Kill \Lpack{chapterbib}'s |\sectionbib| macro +% \Lpack{chapterbib} is used with its \Lopt{sectionbib} option. This is the +% only case to worry about. Kill \Lpack{chapterbib}'s \cs{sectionbib} macro % which it calls at begin document to do its patch, then make sure % the class definition is used. % \begin{macrocode} \renewcommand{\sectionbib}[2]{} \renewcommand{\bibsection}{\@memb@bsec}}{} % \end{macrocode} -% And we've finished with this bunch of |\AtBeginDocument|. +% And we've finished with this bunch of \cs{AtBeginDocument} code. % \begin{macrocode} } @@ -16740,20 +21232,36 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\onecolindex} +% \begin{macro}{\twocolindex} +% \changes{v1.61803}{2008/01/30}{Added \cs{onecolindex} and \cs{twocolindex}} +% \begin{macrocode} +\newcommand*{\onecolindex}{\onecolindextrue} +\newcommand*{\twocolindex}{\onecolindexfalse} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{environment}{theindex} -% The environment `theindex' can be used for indices. It makes an +% The environment \texttt{theindex} can be used for indices. It makes an % index with two columns, with each entry a separate paragraph. At -% the user level the commands |\item|, |\subitem| and |\subsubitem| +% the user level the commands \cs{item}, \cs{subitem} and \cs{subsubitem} % are used to produce index entries of various levels. When a new -% letter of the alphabet is encountered an amount of |\indexspace| +% letter of the alphabet is encountered an amount of \cs{indexspace} % white space can be added. % % % \changes{v0.2}{2001/06/03}{Deleted starred version of theindex} % \changes{v0.2}{2001/06/03}{Changed Index pagestyle to chapter} % \changes{v1.618}{2005/09/03}{Make \cs{indexcolsep} work, courtesy of hazydirk (mempatch v3.11)} +% \changes{v1.61803}{2008/01/30}{Added \cs{clearforchapter} to theindex +% environment (Erik Quaeghebeur, mempatch v4.4)} +% \changes{v1.61803}{2008/01/30}{Added an indextitlepagestyle (Lars Madsen +% mempatch v4.6)} % \begin{macrocode} \newenvironment{theindex}{% + \clearforchapter \if@twocolumn \@restonecolfalse \else @@ -16774,7 +21282,7 @@ \phantomsection \addcontentsline{toc}{chapter}{\indexname}% \fi - \thispagestyle{chapter}\parindent\z@ + \thispagestyle{indextitlepagestyle}\parindent\z@ \parskip\z@ \@plus .3\p@\relax \let\item\@idxitem}% {\if@restonecol\onecolumn\else\twocolumn\fi} @@ -16782,6 +21290,13 @@ % \end{macrocode} % \end{environment} % +% \begin{macro}{\ps@indextitlepagestyle} +% \begin{macrocode} +\aliaspagestyle{indextitlepagestyle}{chapter} + +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\ifnoindexintoc} % \begin{macro}{\indexintoc} % \begin{macro}{\noindexintoc} @@ -16854,13 +21369,13 @@ % \begin{macro}{\index} % \begin{macro}{\specialindex} % \begin{macro}{\makememindexhook} -% This is a modified version of the kernel |\makeindex| to allow for -% multiple indexes. It also defines |\index| (which is a modified version -% of the standard |\index|) and |\specialindex|. +% This is a modified version of the kernel \cs{makeindex} to allow for +% multiple indexes. It also defines \cs{index} (which is a modified version +% of the standard \cs{index}) and \cs{specialindex}. % -% |\makememindexhook| is a null op but can be redefined to add extra code -% into |\makeindex|. For example, to incorporate \Lpack{ledmac}'s -% |\edindex| into the scheme: +% \cs{makememindexhook} is a null op but can be redefined to add extra code +% into \cs{makeindex}. For example, to incorporate \Lpack{ledmac}'s +% \cs{edindex} into the scheme: % \begin{verbatim} % \renewcommand*{\makememindexhook}{% % \def\edindex{\@bsphack% @@ -16886,8 +21401,8 @@ \fi} % \end{macrocode} -% Initially define, but emasculate, |\index| and |\specialindex| which are -% defined properly by the user calling |\makeindex|. +% Initially define, but emasculate, \cs{index} and \cs{specialindex} which are +% defined properly by the user calling \cs{makeindex}. % \begin{macrocode} \renewcommand{\index}[2][\jobname]{\@bsphack\@esphack} \newcommand{\specialindex}[3]{\@bsphack\@esphack} @@ -16907,21 +21422,33 @@ % \end{macro} % % \begin{macro}{\ifreportnoidxfile} +% \begin{macro}{\reportnoidxfile} +% \begin{macro}{\ignorenoidxfile} % \begin{macro}{\ifshowindexmark} +% \begin{macro}{\showindexmarks} +% \begin{macro}{\hideindexmarks} % Two booleans to control reporting on unknown \file{idx} files and % displaying indexed items in the margin. % \begin{macrocode} \newif\ifreportnoidxfile - \reportnoidxfilefalse +\newcommand*{\reportnoidxfile}{\reportnoidxfiletrue} +\newcommand*{\ignorenoidxfile}{\reportnoidxfilefalse} + \ignorenoidxfile \newif\ifshowindexmark - \showindexmarkfalse +\newcommand*{\showindexmarks}{\showindexmarktrue} +\newcommand*{\hideindexmarks}{\showindexmarkfalse} + \hideindexmarks % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\@index} -% |\@index[file]| is first stage of |\index|, handling the \file{idx} file. +% \verb?\@index[file]? is first stage of \cs{index}, handling the \file{idx} file. % \begin{macrocode} \def\@index[#1]{% \@ifundefined{#1@idxfile}% @@ -16949,9 +21476,9 @@ % % \begin{macro}{\@wrindexm@m} % \begin{macro}{\@@wrindexhyp} -% The next stage in index processing is |\@wrindexm@m{item}|, +% The next stage in index processing is \verb?\@wrindexm@m{item}?, % which writes the \file{idx} file name -% and indexed item to the \file{aux} file. The |\@@wrindexhyp| macro +% and indexed item to the \file{aux} file. The \cs{@@wrindexhyp} macro % provides hyperlinks in case the \Lpack{hyperref} package is used. % \begin{macrocode} \newcommand{\@wrindexm@m}[1]{\@@wrindexhyp#1||\\} @@ -16979,7 +21506,7 @@ % \begin{macro}{\hyperpage} % \begin{macro}{\hyperlink} % These are defined in the \Lpack{hyperref} package but we need them. -% other hyperstuff is only used if the package itself is used. +% Other hyperstuff is only used if the package itself is used. % \begin{macrocode} \newcommand{\hyperpage}[1]{#1} \newcommand{\hyperlink}[2]{#2} @@ -16989,9 +21516,9 @@ % \end{macro} % % \begin{macro}{\@@wrindexm@m} -% The macro |\@@wrindexm@m{file}{item}{page}| has been written into +% The macro \verb?\@@wrindexm@m{file}{item}{page}? has been written into % the \file{aux} file. It is normally defined so that it calls -% |\@@@wrindexm@m{item}{page}| to finally write to the \file{idx} file. +% \verb?\@@@wrindexm@m{item}{page}? to finally write to the \file{idx} file. % \begin{macrocode} \newcommand{\@@wrindexm@m}[1]{\begingroup \def\@idxfile{\@nameuse{#1@idxfile}} @@ -17110,6 +21637,54 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\ifm@mxindy} +% \begin{macro}{\m@mxindytrue} +% \begin{macro}{\m@mxindyfalse} +% \begin{macro}{\xindyindex} +% \begin{macro}{\@@wrspindexhyp} +% Use \cs{xindyindex} when you are going to use the xindy program rather +% than makeindex. hyperrefed entries won't work with xindy. +% The code was supplied by Frederic +% Connes\footnote{\texttt{frederic@connes.org}} in an email to me on +% 2006/01/08. +% \changes{v1.61803}{2008/01/30}{Added \cs{xindyindex} (Frederic Connes +% mempatch v4.4)} +% \begin{macrocode} +\newif\ifm@mxindy +\m@mxindyfalse +\newcommand*{\xindyindex}{\m@mxindytrue} +\def\@@wrspindexhyp#1|#2|#3\\{% + \ifshowindexmark\@showidx{#1}\fi + \ifx\\#2\\% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}% + \ifm@mxindy{#1}\else{#1|hyperspindexpage(\thepage)}\fi + {\@nameuse{the\@sptheidx}}}% + \else + \def\Hy@temp@A{#2}% + \ifx\Hy@temp@A\HyInd@ParenLeft + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}% + \ifm@mxindy{#1|#2}\else{#1|#2hyperspindexpage(\thepage)}\fi + {\@nameuse{the\@sptheidx}}}% + \else + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|#2}% + {\@nameuse{the\@sptheidx}}}% + \fi + \fi + \endgroup + \@esphack} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% % \begin{macro}{\@@wrindexhyp} % \begin{macro}{\@@wrspindexhyp} % If the \Lpack{hyperref} package is not being used, or \cs{ifmemhyperindex} @@ -17174,7 +21749,7 @@ % \end{macro} % % The next part of the code is essentially the \Lpack{showidx} package. -% I tried putting index entries into marginoars but too many on a page +% I tried putting index entries into marginpars but too many on a page % led to the `too many floats' problem. % % \begin{macro}{\indexmarkstyle} @@ -17214,8 +21789,7 @@ #1\relax \vrule \@height \z@ \@depth .3\normalbaselineskip \@width \z@\relax }% - \ifhmode\penalty\@M \hskip\z@skip\fi -} + \ifhmode\penalty\@M \hskip\z@skip\fi} % \end{macrocode} % \end{macro} @@ -17245,16 +21819,18 @@ \fi \box\@indexbox }% - \vss -}} + \vss}} % \end{macrocode} % \end{macro} % +% \section{Page bottom} +% % \begin{macro}{\raggedbottom} % \begin{macro}{\flushbottom} % \begin{macro}{\@texttop} -% These kernel macros need changing because of the new marginal insert. +% These kernel macros need changing because of the new \cs{@indexbox} +% marginal insert. % \begin{macrocode} \renewcommand{\raggedbottom}{% \def\@textbottom{\vskip\z@ plus.0001fil}% @@ -17269,6 +21845,47 @@ % \end{macro} % \end{macro} % +% \subsection{Widows and sloppybottom} +% +% There was a discussion \textit{widow handling?} on CTT in +% May 2006. \texttt{ivowel@gmail.com} wrote +% \begin{quote} +% in experimenting with raggedbottom, widowpenalty, and clubpenalty, +% I think that I have not found a solution that strikes me as +% particularly desirable. I think what I would really like is that +% widows (i.e., left-over single lines that begin on the following +% page) are resolved not by pushing one extra line from the same +% paragraph also onto the next page, but by stretching the +% \cs{textheight} to allow this one extra at the bottom of the +% same page. +% \end{quote} +% Donald Arseneau, as he so often does, came up with a solution he +% termed \cs{sloppybottom}. Here is a generalised version. +% +% \begin{macro}{\sloppybottom} +% \cs{sloppybottom} allows an extra line on a page to save a widow. +% You must increase the \cs{topskip} (by 60 percent is reasonable) and this +% will push the text lower on the page. Run \cs{checkandfixthelayout} +% after the change. For example: +% \begin{verbatim} +% \setlength{\topskip}{1.6\topskip} +% \checkandfixthelayout +% \sloppybottom +% ... +% \end{verbatim} +% \changes{v1.61803}{2008/01/30}{Added \cs{sloppybottom} (mempatch v4.6)} +% \begin{macrocode} +\newcommand*{\sloppybottom}{% + \def\@textbottom{\vskip \z@ \@plus.0001fil \@minus .95\topskip}% + \topskip=1\topskip \@plus 0.625\topskip \@minus .95\topskip + \def\@texttop{\vskip \z@ \@plus -0.625\topskip \@minus -0.95\topskip}} + +% \end{macrocode} +% \end{macro} +% +% +% +% % \section{Glossaries} % % Standard LaTeX provides little and insufficient support for @@ -17285,12 +21902,22 @@ % \begin{macrocode} \newif\ifonecolglossary \onecolglossarytrue - % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % +% \begin{macro}{\onecolglossary} +% \begin{macro}{\twocolglossary} +% \changes{v1.61803}{2008/01/30}{Added \cs{onecolglossary} and \cs{twocolglossary}} +% \begin{macrocode} +\newcommand*{\onecolglossary}{\onecolglossarytrue} +\newcommand*{\twocolglossary}{\onecolglossaryfalse} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% % % \begin{environment}{theglossary} % The environment \texttt{theglossary} is used for glossaries. @@ -17430,7 +22057,7 @@ % \end{macro} % % \begin{macro}{\@glossary} -% \cs{@glossary}\oarg[file] handles the first of the \cs{glossary} optional +% \cs{@glossary}\oarg{file} handles the first of the \cs{glossary} optional % arguments, even though the calling sequence looks like: \\ % \cs{@glossary}\oarg{file}\parg{key}\marg{term}\marg{desc}. \\ % It calls \cs{@@glossary} to handle the second optional argument @@ -17459,7 +22086,7 @@ \begingroup \@sanitize % \end{macrocode} -% Use the correct key, \verb?key? if given, otherwise \verb?term?. +% Use the correct key, \meta{key} if given, otherwise \meta{term}. % \begin{macrocode} \ifx\@empty#2\@empty \@wrglom@m{#3}{#3}{#4}% @@ -17618,19 +22245,19 @@ % % \subsection{Marginpars} % -% A |\marginpar| is a kind of floating object --- you can't control +% A \cs{marginpar} is a kind of floating object --- you can't control % exactly where it will go. There is one problem with the kernel -% definition of |\marginpar| in that sometimes a |\marginpar| may +% definition of \cs{marginpar} in that sometimes a \cs{marginpar} may % end up on the wrong side of the page. The following is an attempt % to fix that using the odd/even page check provided as part of % the class. % % \begin{macro}{\@addmarginpar} -% The part of the code for |\marginpar| that deals with deciding which -% side of the page it should be printed on is |\@addmarginpar|, buried -% away in the |output| routine. A couple of minor changes are made +% The part of the code for \cs{marginpar} that deals with deciding which +% side of the page it should be printed on is \cs{@addmarginpar}, buried +% away in the kernel's \texttt{output} routine. A couple of minor changes are made % to the kernel code. The first is at the beginning where I have added -% the |\checkoddpage| page checking code. +% the \cs{checkoddpage} page checking code. % \begin{macrocode} \def\@addmarginpar{% \checkoddpage @@ -17645,7 +22272,7 @@ \if@mparswitch % \end{macrocode} % The next line, reading \\ -% |\ifodd\c@page \else\@tempcnta\m@ne \fi| \\ +% \verb?\ifodd\c@page \else\@tempcnta\m@ne \fi? \\ % is where the odd/even page checking is done in the kernel code. I % replace it with my code, and then continue with the kernel. % \begin{macrocode} @@ -17660,7 +22287,7 @@ \ifdim\@tempdima >\z@ % \end{macrocode} % The next line in the kernel reads: \\ -% |\@latex@warning@no@line {Marginpar on page \thepage\space moved}| \\ +% \verb?\@latex@warning@no@line {Marginpar on page \thepage\space moved}? \\ % I have changed the warning message to give the user an indication % of the severity of the move. Then follow the kernel on to the end. % \begin{macrocode} @@ -17711,14 +22338,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\sideparvshift} -% Vertical shift for sidepar to align with text line -% \begin{macrocode} -\newlength{\sideparvshift} - \setlength{\sideparvshift}{-2.08ex}% seems to work for all font sizes - -% \end{macrocode} -% \end{macro} % % \begin{macro}{\ifreversesidepar} % \begin{macro}{\ifsideparswitch} @@ -17735,11 +22354,34 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\sideparvshift} +% Vertical shift for sidepar to align with text line +% \begin{macrocode} +\newlength{\sideparvshift} +%%%% \setlength{\sideparvshift}{-2.08ex}% seems to work for all font sizes + +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}{\sidepar} -% \cs{sidepar}\oarg{left}\marg{right} (per \cs{marginpar}) +% \begin{macro}{\@sidepar} +% \cs{sidepar}\oarg{left}\marg{right} (per \cs{marginpar}). +% Sidepars had a nasty habit of moving up or down depending on whether +% characters in the sidepar and the main text line have ascenders and/or +% descenders. The length \cs{sideparvshift} was provided to +% enable adjustments. This is Dan Luecking's modified version of my +% original code +% (CTT \textit{Re: sidepars drift up a point}, 2006/04/11) which does a much +% better job, +% and the default for \cs{sideparvshift} is now 0pt. +% \changes{v1.61803}{2008/01/30}{Fixed \cs{sidepars} from moving up and down +% (mempatch v4.5)} +% \changes{v1.61803}{2008/01/30}{Normalised font in \cs{@sidepar} +% (mempatch v4.9)} % \begin{macrocode} \newcommand{\sidepar}{\@dblarg{\@sidepar}} -\long\def\@sidepar[#1]#2{\@bsphack\leavevmode\vadjust{% % +\long\def\@sidepar[#1]#2{\@bsphack\strut\vadjust{% \checkoddpage \ifsideparswitch \ifreversesidepar @@ -17753,31 +22395,39 @@ \oddpagetrue \ifreversesidepar \oddpagefalse - \fi + \fi \fi \rlap{\kern-\parindent \if@twocolumn - \if@firstcolumn % put at left - \kern -\marginparsep \kern -\marginparwidth % at left - \else % put at right - \kern \columnwidth \kern \marginparsep % at right + \if@firstcolumn% put at left + \kern -\marginparsep \kern -\marginparwidth + \else% put at right + \kern \columnwidth \kern \marginparsep \fi \else - \ifoddpage % put at right - \kern \textwidth \kern \marginparsep % at right - \else % put at left - \kern -\marginparsep \kern -\marginparwidth % at left + \ifoddpage% put at right + \kern \textwidth \kern \marginparsep + \else% put at left + \kern -\marginparsep \kern -\marginparwidth \fi \fi - \vbox to 0pt{% - \kern \sideparvshift% % vertical shift to align top text lines - \begin{minipage}{\marginparwidth}% - \ifoddpage #2\else #1\fi% + \setbox0=\vtop to 0pt{% + \begin{minipage}[t]{\marginparwidth}% + \normalfont\normalsize + \ifoddpage #2\else #1\fi% \end{minipage}% - \vss}}}\@esphack} + \vss}% + \vtop to 0pt{\kern\sideparvshift% default should be 0pt + \kern-\dp\strutbox + \kern-\ht0 + \box0 \vss}}}% + \@esphack} +\setlength{\sideparvshift}{0pt} % \end{macrocode} % \end{macro} +% \end{macro} +% % % % \subsection{Sidebars} @@ -17816,17 +22466,38 @@ % % \end{verbatim} % -% The following is my attempt to rewrite the above into a form suitable -% for LaTeX, and this class in particular. +% The following started off (2002/03/19) as my attempt to rewrite the above +% into a form suitable for LaTeX, and this class in particular. +% +% Donald Arseneau came up with some improvements to my sidebar code. +% The impetus +% for this came from a CTT thread, \textit{whitespace after my command}, +% 2006/11/30 and earlier. In email to me on 2006/11/30 he said: +% \begin{quotation} +% For \Lpack{memoir} \cs{sidebar}, it seems the rules are expanding +% to fill the space for the sidebar, so here is my suggested change +% to \cs{sidecontents}. +% +% It occurs to me that a separate \cs{sidetsep} (or \cs{sidetopsep}) +% would be more valuable than having an explicit 1\cs{onelineskip}. +% +% I grouped common code into two macros, and altered \cs{sidebarform} too. +% \end{quotation} +% +% Since then we have been going back and forth, with the result that +% practically all the complex code is Donald's. +% \changes{v1.61803}{2008/01/30}{Major rewrite of \cs{sidebar} code +% (mempatch v4.6 and v4.9)} +% % % \begin{macro}{\sideins} -% Create a new insert called |\sideins|, which also creates a corresponding +% Create a new insert called \cs{sideins}, which also creates a corresponding % skip, count, dimen, and box. \\ -% |\skip\sideins| is the extra vertical space to allow on the page for +% \verb?\skip\sideins? is the extra vertical space to allow on the page for % the insert, \\ -% |\count\sideins| is the magnification factor for page breaking, \\ -% |\dimen\sideins| is the maximum insertion size (height) per page, \\ -% and the inserted material will be in |\box\sideins| when a page is output. +% \verb?\count\sideins? is the magnification factor for page breaking, \\ +% \verb?\dimen\sideins? is the maximum insertion size (height) per page, \\ +% and the inserted material will be in \verb?\box\sideins? when a page is output. % \begin{macrocode} \newinsert\sideins \skip\sideins=0pt @@ -17835,12 +22506,29 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\sidebartopsep} +% Separation at the top of a sidebar. +% \begin{macrocode} +\newlength{\sidebartopsep} + \setlength{\sidebartopsep}{0pt} +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}{\setsidebarheight} -% The macro |\setsidebarheight{|\meta{length}|}| sets the total +% The macro \cs{setsidebarheight}\marg{length} sets the total % height of sidebars on a page to \meta{length}. +% This is an interface for controlling \verb?\dimen\sideins? properly, +% taking account of \cs{topskip} and the sidebar font size (and therefore +% should be invoked \emph{after} declaring \cs{sidebarfont}). +% +% Note that \cs{sidebartopsep} is \emph{not} included as part of the +% allocated height. % \begin{macrocode} -\newcommand{\setsidebarheight}[1]{\dimen\sideins= #1} - \setsidebarheight{20\onelineskip} +\newcommand{\setsidebarheight}[1]{% + \setlength{\dimen\sideins}{#1}% + \advance\dimen\sideins-\topskip + \advance\dimen\sideins\ht\strutbox} % \end{macrocode} % \end{macro} @@ -17848,17 +22536,16 @@ % \begin{macro}{\sidebarhsep} % \begin{macro}{\sidebarvsep} % \begin{macro}{\sidebarwidth} -% The length |\sidebarhsep| is the gap between the typeblock and the sidebar. -% |\sidebarvsep| is the vertical gap between sidebars on a page. +% The length \cs{sidebarhsep} is the gap between the typeblock and the sidebar. +% \cs{sidebarvsep} is the vertical gap between sidebars on a page. % The maximum number of sidebar lines on a page is -% |1 + (\dimen\sideins - \sidebarvsep)|, assuming |\dimen\sideins| -% is defined in terms of |\onelineskip|. -% The width of the sidebar is |\sidebarwidth|. +% \verb?1 + (\dimen\sideins - \sidebarvsep)?, assuming \verb?\dimen\sideins? +% is defined in terms of \cs{onelineskip}. +% The width of the sidebar is \cs{sidebarwidth}. % \begin{macrocode} -\newlength{\sidebarhsep} \setlength{\sidebarhsep}{\marginparsep} -\newlength{\sidebarvsep} \setlength{\sidebarvsep}{2\onelineskip} -\newlength{\sidebarwidth} \setlength{\sidebarwidth}{\marginparwidth} - +\newlength{\sidebarhsep} +\newlength{\sidebarvsep} +\newlength{\sidebarwidth} % \end{macrocode} % \end{macro} % \end{macro} @@ -17867,13 +22554,52 @@ % \begin{macro}{\sidebarfont} % The font for typesetting the contents of a sidebar. % \begin{macrocode} -\newcommand{\sidebarfont}{\normalfont} +\newcommand{\sidebarfont}{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setsidebars} +% \cs{setsidebars}\marg{hsep}\marg{width}\marg{vsep}\marg{topsep}\marg{font}\marg{height} +% sets the main \cs{sidebar} parameters. A \verb?*? argument means leave the +% setting as is. +% \changes{v1.61803}{2008/01/30}{Added \cs{setsidebars} (mempatch v4.6)} +% \begin{macrocode} +\newcommand*{\setsidebars}[6]{% + \nametest{#1}{*}\ifsamename\else + \setlength{\sidebarhsep}{#1}\@memznegtest{\sidebarhsep}% + \fi + \nametest{#2}{*}\ifsamename\else + \setlength{\sidebarwidth}{#2}\@memznegtest{\sidebarwidth}% + \fi + \nametest{#3}{*}\ifsamename\else + \setlength{\sidebarvsep}{#3}\@memnegtest{\sidebarvsep}% + \fi + \nametest{#4}{*}\ifsamename\else + \setlength{\sidebartopsep}{#4}% + \fi + \nametest{#5}{*}\ifsamename\else + \def\sidebarfont{#5}% + \fi + \nametest{#6}{*}\ifsamename\else + \setsidebarheight{#6}% + \ifdim\dimen\sideins>\z@\else + \@memerror{\protect\sidebarheight\space is zero or negative}{\@ehd}% + \fi + \fi} +\setsidebars{\marginparsep}% sidebarhsep + {\marginparwidth}% sidebarwidth + {\onelineskip}% sidebarvsep + {0pt}% sidebartopsep + {\normalsize\normalfont}% sidebarfont + {\textheight}% sidebarheight + % \end{macrocode} % \end{macro} % +% % \begin{macro}{\sidebarform} -% |\sidebarform| sets the `raggedness' in a sidebar. The current definition -% is less ragged than |\raggedright|. Examples: +% \cs{sidebarform} sets the `raggedness' in a sidebar. The current definition +% is less ragged than \cs{raggedright}. Examples: % \begin{verbatim} % for flushleftright \renewcommand{\sidebarform}{} % for raggedleft \renewcommand{\sidebarform}{\raggedleft} @@ -17934,252 +22660,165 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\m@sideb@left} +% \begin{macro}{\m@sideb@right} +% Code used later to put sidebars into the desired margin. +% \changes{v1.61803}{2008/01/30}{Added \cs{m@sideb@left} and \cs{m@sideb@right} +% (mempatch v4.6)} +% \begin{macrocode} +\newcommand*{\m@sideb@left}{% + \@tempdimc \sidebarwidth + \advance\@tempdimc\sidebarhsep + \kern-\@tempdimc} +\newcommand*{\m@sideb@right}{% + \@tempdimc \columnwidth% or \hsize + \advance\@tempdimc\sidebarhsep + \kern\@tempdimc} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\sidecontents} % This locates the horizontal position of a sidebar. On two column -% pages it is put in the margin next to the column where |\sidebar| +% pages it is put in the margin next to the column where \cs{sidebar} % is called, otherwise it is put in the outer (foredge) margin, except % for the oneside option when it is put into the right hand margin. -% This can be separately controlled via \verb?\ifsidebaroneside?. +% This can be separately controlled via \cs{ifsidebaroneside}. % Emanuele Vicentini\footnote{\texttt{emanuelevicentini@yahoo.it}, % private email, 2004/04/05} % suggested to code for the oneside option. % \changes{v1.61}{2004/04/05}{Changed \cs{sidecontents} for oneside option} % \changes{v1.618}{2005/09/03}{Changed \cs{sidecontents} for \cs{sidebarmargin}} +% \changes{v1.61803}{2008/01/30}{Modified \cs{sidecontents} (mempatch v4.6)} % \begin{macrocode} -\newcommand{\sidecontents}{{% +\newcommand{\sidecontents}{\hbox to \z@{% \if@twocolumn% %% put outside nearest column \if@firstcolumn% %% move to left - \setlength{\@tempdimc}{\sidebarwidth}% - \advance\@tempdimc\sidebarhsep - \moveleft\@tempdimc + \m@sideb@left \else% %% move to right - \setlength{\@tempdimc}{\columnwidth}% - \advance\@tempdimc\sidebarhsep - \moveright\@tempdimc + \m@sideb@right \fi \else% %% put into foremargin? \ifsidebaroneside% %% put into right hand margin - \setlength{\@tempdimc}{\hsize}% - \advance\@tempdimc\sidebarhsep - \moveright\@tempdimc - \else% %% ??? + \m@sideb@right + \else% %% pick the margin \ifcase\m@msidebar@margin% 0 to left - \setlength{\@tempdimc}{\sidebarwidth}% - \advance\@tempdimc\sidebarhsep - \moveleft\@tempdimc + \m@sideb@left \or% 1 to right - \setlength{\@tempdimc}{\hsize}% - \advance\@tempdimc\sidebarhsep - \moveright\@tempdimc + \m@sideb@right \or% 2 to outer \ifodd\c@page% %% move to right - \setlength{\@tempdimc}{\hsize}% - \advance\@tempdimc\sidebarhsep - \moveright\@tempdimc + \m@sideb@right \else% %% move to left - \setlength{\@tempdimc}{\sidebarwidth}% - \advance\@tempdimc\sidebarhsep - \moveleft\@tempdimc + \m@sideb@left \fi \or% 3 to inner \ifodd\c@page% %% move to left - \setlength{\@tempdimc}{\sidebarwidth}% - \advance\@tempdimc\sidebarhsep - \moveleft\@tempdimc + \m@sideb@left \else% %% move to right - \setlength{\@tempdimc}{\hsize}% - \advance\@tempdimc\sidebarhsep - \moveright\@tempdimc + \m@sideb@right \fi \fi \fi \fi +% \end{macrocode} +% DA and I have gone to and fro on the next bit of code trying to get +% the top alignment correct. +% \begin{verbatim} +% \vtop to0pt{% +% \vskip\onelineskip +% \unvbox\sideins \vss}% +% \end{verbatim} +% DA has the last word. +% \begin{macrocode} \vtop to0pt{% - \vskip\onelineskip + \normalsize\normalfont\sidebarfont% select font so we know the strut size + \vskip\topskip \vskip-\ht\strutbox + \vskip\sidebartopsep% extra vertical shift \unvbox\sideins \vss}% -}} + \hss}} % \end{macrocode} % \end{macro} % % \begin{macro}{\sidebar} -% |\sidebar{|\meta{text}|}| puts \meta{text} into a sidebar. +% \cs{sidebar}\marg{text} puts \meta{text} into a sidebar. % % Florence Henry (\texttt{florence.henry@obspm.fr}) in the thread % \textit{Of memoir, sidebar, and justification}, 2003/04/02, pointed -% out that |itemize| in a |\sidebar| could overflow. DA gave the +% out that \texttt{itemize} in a \cs{sidebar} could overflow. DA gave the % solution hint. +% +% DA says that having stacked insertions position properly is difficult. +% Here he uses the size of the strut to regulate both the height and the +% depth of each insertion (much as for footnotes). The following is his +% code and commentary. % \changes{v1.4}{2003/11/22}{Revised \cs{sidebar}} +% \changes{v1.61803}{2008/01/30}{DA's rewrite of \cs{sidebar} (mempatch v4.6)} % \begin{macrocode} \newcommand{\sidebar}[1]{% \insert\sideins{% - \splittopskip\sidebarvsep\relax - \hsize \sidebarwidth - \@parboxrestore % <- added in v1.4 - \sidebarform \sidebarfont - \noindent\vbox to \sidebarvsep{}\ignorespaces #1% - \ifhmode\unskip\strut\fi\par}} - % \end{macrocode} -% \end{macro} -% -% Now for the nasty bits which involve modifying the LaTeX output -% routine --- always a dangerous thing to do! -% -% \begin{macro}{\memold@makecol} -% \begin{macro}{\mem@makecol} -% A modified version of the kernel |\@makecol|. +% Begin the insertion with settings. The height of the strut box +% (dependant on the font) will determine the top alignment both initially +% and after a page break. The setting for maximum depth does not control +% anything; see the code further on instead. % \begin{macrocode} -\let\memold@makecol\@makecol -\gdef\mem@makecol{% - \ifvoid\footins - \setbox\@outputbox \box\@cclv - \else - \setbox\@outputbox \vbox{% - \boxmaxdepth\@maxdepth - \@tempdima\dp\@cclv - \unvbox\@cclv - \vskip-\@tempdima - \vskip \skip\footins - \color@begingroup - \normalcolor - \footnoterule - \unvbox \footins - \color@endgroup - } - \fi - \ifvoid\sideins\else %%% start of change - \setbox\@outputbox \vbox{% - \sidecontents - \unvbox\@outputbox - } - \fi %%% end of change - \xdef\@freelist{\@freelist\@midlist}% - \global\let\@midlist\@empty - \@combinefloats - \ifvbox\@kludgeins - \@makespecialcolbox - \else - \setbox\@outputbox \vbox to\@colht{% - \boxmaxdepth \maxdepth - \@texttop - \dimen@ \dp\@outputbox - \unvbox \@outputbox - \vskip -\dimen@ - \@textbottom - }% - \fi - \global \maxdepth \@maxdepth -} - + \hsize\sidebarwidth + \@parboxrestore + \sidebarform \normalsize\normalfont\sidebarfont + \splittopskip=\ht\strutbox + \splitmaxdepth=\dp\strutbox % doesn't do anything useful % \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\if@mem@nofoot} -% \begin{macro}{\@mem@testifnofoot} -% \begin{macro}{\@mem@extranofoot} -% These are from [RS] as \verb?\@doclearpage? should check for more than -% just \verb?\footins? being void. Note that this covers all current -% class defined inserts, including sidebars. -% \changes{v1.61}{2004/03/14}{Added \cs{if@mem@nofoot}, -% \cs{@mem@testifnofoot}, and -% \cs{@mem@extranofoot}} +% Allow a free split at the top (so this whole insertion moves +% to the next page if it does not fit). % \begin{macrocode} -\newif\if@mem@nofoot -\newcommand*{\@mem@testifnofoot}{% - \@mem@nofoottrue - \ifvoid\footins\else\@mem@nofootfalse\fi - \ifvoid\footinsv@r\else\@mem@nofootfalse\fi - \ifvoid\sideins\else\@mem@nofootfalse\fi - \@mem@extranofeet} -\newcommand*{\@mem@extranofeet}{} - + \allowbreak % \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\memold@doclearpage} -% \begin{macro}{\mem@doclearpage} -% I thought that I could get away with using the kernel's -% \verb?\@doclearpage? but [RS] discovered that I couldn't. -% \changes{v1.62}{2004/03/14}{Redid \cs{@doclearpage} using [RS] code} +% Control the (vertical) positioning of non-split entries. Footnotes (and +% previous versions of \cs{sidebar}) us a strut at the beginning of the text, +% but we will allow a baseline-skip to perform the same function. This +% method also introduces a \cs{parskip} when the paragraph begins, so we +% counteract that. (The problem with an initial strut is that it messes' +% up entries that begin with vertical space.) % \begin{macrocode} -\let\memold@doclearpage\@doclearpage -\newcommand{\mem@doclearpage}{% -%%%% \typeout{Redefining @doclearpage} - \@mem@testifnofoot - \if@mem@nofoot - \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa - \setbox\@tempboxa\box\@cclv - \xdef\@deferlist{\@toplist\@botlist\@deferlist}% - \global\let\@toplist\@empty - \global\let\@botlist\@empty - \global\@colroom\@colht - \ifx \@currlist\@empty - \else - \@latexerr{Float(s) lost}\@ehb - \global\let\@currlist\@empty - \fi - \@makefcolumn\@deferlist - \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}% - \if@twocolumn - \if@firstcolumn - \xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}% - \global\let\@dbltoplist\@empty - \global\@colht\textheight - \begingroup - \@dblfloatplacement - \@makefcolumn\@dbldeferlist - \@whilesw\if@fcolmade \fi{\@outputpage - \@makefcolumn\@dbldeferlist}% - \endgroup - \else - \vbox{}\clearpage - \fi - \fi - \else - \setbox\@cclv\vbox{\box\@cclv\vfil}% - \@makecol\@opcol - \clearpage - \fi -} - + \prevdepth=\dp\strutbox % supersedes a "top-strut" + \vskip-\parskip % \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\memold@reinserts} -% \begin{macro}{\mem@reinserts} -% Almost a copy of the kernel |\@reinserts|. +% Now the user's sidebar entry: % \begin{macrocode} -\let\memold@reinserts\@reinserts -\gdef\mem@reinserts{% - \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi - \ifvbox\@kludgeins\insert\@kludegins{\unvbox\@kludgeins}\fi - \ifvoid\sideins\else\sidecontents\fi -} - + #1% % \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@makecol} -% \begin{macro}{\@doclearpage} -% Replace the kernel version of |\@makecol| and \verb?\@doclearpage? -% with the memoir versions. +% If the entry ended still in a paragraph, take the chance to insert a +% final strut; then end the paragraph. % \begin{macrocode} -\gdef\@makecol{\mem@makecol} -\gdef\@doclearpage{\mem@doclearpage} + \ifvmode\else + \unskip\@finalstrut\strutbox + \fi\par +% \end{macrocode} +% Explicitly force the effect of \cs{maxdepth} (\cs{splitmaxdepth}), +% but using the depth of the strut in the r\^{o}le of \cs{maxdepth}. +% \begin{macrocode} + \ifdim\prevdepth>\dp\strutbox \prevdepth=\dp\strutbox \fi +% \end{macrocode} +% Now control how adjacent entries abut (whether or not a final strut got +% inserted) and how an entry fits at the bottom of the page. Use \cs{vskip}s +% to move from the text bottom to where a strut would bottom out, +% but insert an allowed breakpoint at the baseline position +% (so that the entry baseline may match the page's baseline). Finally +% insert the extra separation between entries. +% \begin{macrocode} + \ifdim\prevdepth>99\p@ + \nobreak + \vskip-\prevdepth + \allowbreak + \vskip\dp\strutbox + \fi + \vskip\sidebarvsep}} % \end{macrocode} % \end{macro} -% \end{macro} -% -% I think that the original kernel version of |\@reinserts| -% might be alright, but you never know. If it is not, -% then we can treat it like |\@makecol|, for example. % % % \subsection{Footnotes} @@ -18327,7 +22966,7 @@ % \def\thempfn{\thefootnote} % \end{verbatim} % -% And from \file{ltboxes.dtx} for the |minipage| environment. +% And from \file{ltboxes.dtx} for the \texttt{minipage} environment. % % \DescribeMacro{\@mpfn} % \DescribeMacro{\thempfn} @@ -18361,7 +23000,7 @@ % % \begin{macro}{\footnoterule} % Usually, footnotes are separated from the main body of the text -% by a small rule. This rule is drawn by the macro |\footnoterule|. +% by a small rule. This rule is drawn by the macro \cs{footnoterule}. % We have to make sure that the rule takes no vertical space (see % \file{plain.tex}) so we compensate for the natural heigth of the % rule of 0.4pt by adding the right amount of vertical skip. @@ -18389,12 +23028,12 @@ % \end{macrocode} % \end{macro} % -% The footnote mechanism of \LaTeX{} calls the macro |\@makefntext| +% The footnote mechanism of \LaTeX{} calls the macro \cs{@makefntext} % to produce the actual footnote. The macro gets the text of the -% footnote as its argument and should use |\@thefnmark| as the mark -% of the footnote. The macro |\@makefntext| is called when -% effectively inside a |\parbox| of width |\columnwidth| (i.e., -% with |\hsize| = |\columnwidth|). +% footnote as its argument and should use \cs{@thefnmark} as the mark +% of the footnote. The macro \cs{@makefntext} is called when +% effectively inside a \cs{parbox} of width \cs{columnwidth} (i.e., +% with \cs{hsize} = \cs{columnwidth}). % % An example of what can be achieved is given by the following piece % of \TeX{} code. @@ -18418,7 +23057,7 @@ % footnote text is set like an ordinary text paragraph, with no % indentation except on the first line of a paragraph, and the % first line of the footnote. Thus, all the macro must do is set -% |\parindent| to the appropriate value for succeeding paragraphs +% \cs{parindent} to the appropriate value for succeeding paragraphs % and put the proper indentation before the mark. % \begin{verbatim} % \newcommand{\@makefntext}[1]{% @@ -18430,7 +23069,7 @@ % This class provides a configurable specification. % % Normally, if two or more footnotes are sequentially applied: \\ -% |...text\footnote{first}\footnote{second}...| \\ +% \verb?...text\footnote{first}\footnote{second}...? \\ % the markers in the text run together % (e.g., \ldots text\textsuperscript{12}). % The class provides a separator between the markers @@ -18475,14 +23114,27 @@ % \end{macro} % % \begin{macro}{\@footnotetext} +% \begin{macro}{\m@mold@footnotetext} % \begin{macro}{\@footnotemark} % We have to modify the kernel's \cs{@footnotetext} and \cs{@footnotemark} % to implement the separator. % \changes{v1.618}{2005/09/03}{Stop body font changes leaking into footnotes (mempatch v3.7)} +% \changes{v1.61803}{2008/01/30}{Keep single spacing in footnotes (mempatch v4.6)} % \begin{macrocode} +\renewcommand{\@footnotetext}[1]{\insert\footins{% + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font% <- v1.6180 addition + \foottextfont + \@preamfntext + \hsize\columnwidth + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark}% + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces{\foottextfont #1}% + \@finalstrut\strutbox}% + \color@endgroup}\m@mmf@prepare} \let\m@mold@footnotetext\@footnotetext -\renewcommand{\@footnotetext}[1]{% - \rest@font\m@mold@footnotetext{#1}\m@mmf@prepare} \renewcommand*{\@footnotemark}{% \leavevmode \ifhmode @@ -18498,13 +23150,14 @@ % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\footmarkwidth} % \begin{macro}{\footmarksep} % \begin{macro}{\footparindent} -% The mark is typset right justified in a box with width |\footmarkwidth|. -% Second and later lines of the text are offset |\footmarksep| from the -% end of the box. Paragraphs in footnotes are indented by |\parindent|. +% The mark is typset right justified in a box with width \cs{footmarkwidth}. +% Second and later lines of the text are offset \cs{footmarksep} from the +% end of the box. Paragraphs in footnotes are indented by \cs{parindent}. % \begin{macrocode} \newlength{\footmarkwidth} \newlength{\footmarksep} @@ -18516,8 +23169,8 @@ % % \begin{macro}{\footmarkstyle} % \begin{macro}{\footscript} -% The marker is typeset according to |\footscript|\marg{marker}. This -% can be specified by the user via |\footmarkstyle|. +% The marker is typeset according to \cs{footscript}\marg{marker}. This +% can be specified by the user via \cs{footmarkstyle}. % \begin{macrocode} \newcommand*{\footmarkstyle}[1]{\def\footscript##1{#1}} % \end{macrocode} @@ -18562,7 +23215,7 @@ % % \begin{macro}{\makefootmark} % \begin{macro}{\@makefntext} -% The class version of |\@makefntext|. +% The class version of \cs{@makefntext}. % \begin{macrocode} \newcommand{\makefootmark}[1]{% \leavevmode @@ -18575,7 +23228,7 @@ % In the thread \textit{memoir and footnote.sty trouble}, 2003/04/02, % Patrik Nyman (\texttt{patrik.nyman@orient.su.se}) noted that in order % to stop \file{footnote.sty} (from \texttt{mdwtools}) barfing my original \\ -% |\newcommand{\@makefntext}[1]{\makefootmark{#1}}| \\ +% \verb?\newcommand{\@makefntext}[1]{\makefootmark{#1}}? \\ % had to be changed. % \changes{v1.4}{2004/11/22}{Revised \cs{@makefntext}} % \begin{macrocode} @@ -18595,7 +23248,7 @@ % % \begin{macro}{\@makefnmark} % The footnote markers that are printed in the text to point to the -% footnotes should be produced by the macro |\@makefnmark|. We use +% footnotes should be produced by the macro \cs{@makefnmark}. We use % the default definition for it. % \begin{macrocode} %\renewcommand\@makefnmark{\hbox{\@textsuperscript{% @@ -18606,9 +23259,9 @@ % \begin{macro}{\footref} % Sometimes it is desireable to reference a footnote more than % once. -% If a footnote is labelled (e.g., |\footnote{text\label{fn}}|) then -% the macro |\footref|\marg{fn} will print the footnote marker. -% The code is essentially a much simplified version of |\footnotemark| +% If a footnote is labelled (e.g., \verb?\footnote{text\label{fn}}?) then +% the macro \cs{footref}\marg{fn} will print the footnote marker. +% The code is essentially a much simplified version of \cs{footnotemark} % from \file{ltfloat.dtx}. % \changes{v1.0}{2001/10/30}{Added \cs{footref}} % \begin{macrocode} @@ -18629,7 +23282,7 @@ % % \begin{macro}{\verbfootnote} % \begin{macro}{\@xverbfootnote} -% |\verbfootnote| is just like |\footnote| except that it can contain +% \cs{verbfootnote} is just like \cs{footnote} except that it can contain % verbatim material. % \begin{macrocode} \def\verbfootnote{\@ifnextchar[\@xverbfootnote{\stepcounter\@mpfn @@ -18676,6 +23329,8 @@ % \begin{macro}{\f@t} % \begin{macro}{\@foot} % Guess what these do. +% \changes{v1.61803}{2008/01/30}{Added \cs{m@mmf@prepare} to \cs{@foot} to +% implement the multifootnotemark separator (noted by zarko, CTT 2005/01/15)} % \begin{macrocode} \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t \else \let\next\f@t\fi \next} @@ -18687,6 +23342,7 @@ \def\@foot{% \strut\egroup %%%% \color@endgroup + \m@mmf@prepare } % \end{macrocode} @@ -18697,7 +23353,7 @@ % % \begin{macro}{\@verbmpfootnotetext} % Footnotes in minipages are a little different, so another -% version of |\...footnotetext|. +% version of \cs{...footnotetext}. % \begin{macrocode} \long\def\@verbmpfootnotetext{% \global\setbox\@mpfootins\vbox{% @@ -18717,14 +23373,13 @@ % \end{macro} % % \begin{macro}{\@minipagerestore} -% To get the |\verbfootnote| to work in a |minipage| we have to use -% |\@verbmpfootnotetext| instead of |\\@verbfootnotetext|. There is -% a nice hook in the kernel |minipage| code for this. -% \begin{macrocode} -\def\@minipagerestore{\let\@verbfootnotetext\@verbmpfootnotetext} - -% \end{macrocode} -% \end{macro} +% To get the \cs{verbfootnote} to work in a \texttt{minipage} we have to use +% \cs{@verbmpfootnotetext} instead of \cs{@verbfootnotetext}. There is +% a nice hook in the kernel \texttt{minipage} code for this. +% +% As of version 1.61803 the following code is placed earlier. \\ +% \verb?\def\@minipagerestore{\let\@verbfootnotetext\@verbmpfootnotetext}? +% \end{macro} % % % \subsection{Major extensions for footnotes} @@ -18734,120 +23389,30 @@ % \end{macrocode} % -% This all requires modifications to the output routine's \cs{@makecol} +% This all requires modifications to the output routine's \cs{@makecol}, +% which will be done later. % -% \begin{macro}{\m@m@makecolfloats} -% \begin{macro}{\m@m@makecoltext} -% These two macros contain code common to both versions of \cs{@makecol} -% \begin{macrocode} -\newcommand{\m@m@makecolfloats}{% - \xdef\@freelist{\@freelist\@midlist}% - \global\let\@midlist\@empty - \@combinefloats} -\newcommand{\m@m@makecoltext}{% - \ifvbox\@kludgeins - \@makespecialcolbox - \else - \setbox\@outputbox \vbox to\@colht{% - \@texttop - \dimen@ \dp\@outputbox - \unvbox \@outputbox - \vskip -\dimen@ - \@textbottom}% - \fi} - -% \end{macrocode} -% \end{macro} -% \end{macro} +% \begin{macro}{\setfootnoterule} +% Per Starb\"{a}ck found (CTT \textit{feetbelowfloat in memoir}, 2006/11/24) +% that \cs{feetbelowfloat} did not affect anything when \cs{raggedbottom} +% is in effect. % -% \begin{macro}{\m@m@makecolintro} -% A hook into the revised \cs{@makecol} +% \cs{setfootnoterule}\oarg{vfill}\marg{uplift}\marg{width}\marg{thickness} +% defines the \cs{footnoterule}. Memoir's default setting is \\ +% \verb?\setfootnoterule{3pt}{0.4\columnwidth}{\normalrulethickness}? \\ +% To force footnotes to the bottom after a \cs{raggedbottom} use \\ +% \verb?\setfootnoterule[\vfill]{3pt}{0.4\columnwidth}{\normalrulethickness}? +% \changes{v1.61803}{2008/01/30}{Added \cs{setfootnoterule} (memptatch v4.6)} % \begin{macrocode} -\newcommand{\m@m@makecolintro}{} +\newcommand*{\setfootnoterule}[4][]{% + \def\footnoterule{\kern -#2\relax #1\relax + \hrule width #3\relax + \kern #2\kern-#4}} +\setfootnoterule{3pt}{0.4\columnwidth}{\normalrulethickness} % \end{macrocode} % \end{macro} % -% \begin{macro}{\mem@makecol} -% A version \cs{@makecol} giving the standard footnote order (bottom -% floats after footnotes). -% \begin{macrocode} -\gdef\mem@makecol{% - \m@m@makecolintro - \ifvoid\footins - \setbox\@outputbox \box\@cclv - \else - \setbox\@outputbox \vbox{% - \boxmaxdepth\@maxdepth - \@tempdima\dp\@cclv - \unvbox\@cclv - \vskip \skip\footins - \color@begingroup - \normalcolor - \footnoterule - \unvbox \footins - \color@endgroup - }% - \fi - \m@mdoextrafeet - \ifvoid\sideins\else - \setbox\@outputbox \vbox{% - \sidecontents - \unvbox\@outputbox}% - \fi - \m@m@makecolfloats - \m@m@makecoltext - \global \maxdepth \@maxdepth} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\mem@makecolbf} -% A version of \cs{@makecol} which puts footnotes at the bottom of the page -% (after any bottom floats). -% \begin{macrocode} -\gdef\mem@makecolbf{% - \m@m@makecolintro - \setbox\@outputbox \box\@cclv - \m@m@makecolfloats - \ifvoid\footins - \else - \setbox\@outputbox \vbox{% - \boxmaxdepth\@maxdepth - \unvbox\@outputbox - \vskip \skip\footins - \color@begingroup - \normalcolor - \footnoterule - \unvbox \footins - \color@endgroup - }% - \fi - \m@mdoextrafeet - \ifvoid\sideins\else - \setbox\@outputbox \vbox{% - \sidecontents - \unvbox\@outputbox}% - \fi - \m@m@makecoltext - \global \maxdepth \@maxdepth} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\feetabovefloat} -% \begin{macro}{\feetbelowfloat} -% declarations to put footnotes above bottom floats (standard \LaTeX) -% or at the bottom of the page -% \begin{macrocode} -\newcommand{\feetabovefloat}{\gdef\@makecol{\mem@makecol}} -\newcommand{\feetbelowfloat}{\gdef\@makecol{\mem@makecolbf}} -\feetabovefloat - -% \end{macrocode} -% \end{macro} -% \end{macro} -% % All sorts of extra kinds of footnotes. % % \begin{macro}{\m@mdoextrafeet} @@ -18871,16 +23436,10 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@reinserts} % \begin{macro}{\m@mdodoreinextrafeet} % \begin{macro}{\extrafeetreinshook} -% Redefine \cs{@reinserts} with hooks for multiple footnote kinds. +% Hooks into \cs{@reinserts} for multiple footnote kinds. % \begin{macrocode} -\gdef \@reinserts{% - \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi - \m@mdodoreinextrafeet - \ifvoid\sideins\else\sidecontents\fi - \ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi} \newcommand{\m@mdodoreinextrafeet}{% \ifvoid\footinsv@r\else\insert\footinsv@r{\unvbox\footinsv@r}\fi \extrafeetreinshook} @@ -18889,7 +23448,6 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % % % @@ -18916,48 +23474,38 @@ % % We are going to change some of the kernel footnote macros % -% \begin{macro}{\@footnotetext} % \begin{macro}{\@mpfootnotetext} -% \begin{macro}{\m@mold@footnotetext} % \begin{macro}{\m@mold@mpfootnotetext} +% \changes{v1.6180}{2006/06/12}{Stop font changes leaking into footnotes. +% The v1.618 change was too early} % \begin{macrocode} -\renewcommand{\@footnotetext}[1]{\insert\footins{% - \foottextfont - \@preamfntext - \hsize\columnwidth - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark}% - \color@begingroup - \@makefntext{% - \rule\z@\footnotesep\ignorespaces{\foottextfont #1}% - \@finalstrut\strutbox}% - \color@endgroup}\m@mmf@prepare} \renewcommand{\@mpfootnotetext}[1]{% \global\setbox\@mpfootins\vbox{% \unvbox\@mpfootins + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition \foottextfont \hsize\columnwidth \@parboxrestore \protected@edef\@currentlabel{% \csname p@mpfootnote\endcsname\@thefnmark}% \color@begingroup + \reset@font% <- v1.6180 addition \@makefntext{% - \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \rule\z@\footnotesep\ignorespaces{\foottextfont #1}% + \@finalstrut\strutbox}% \color@endgroup}} % \end{macrocode} -% Save our revised versions of \cs{@footnotetext} and \cs{@mpfootnotetext} +% Save our revised version of \cs{@mpfootnotetext} % \begin{macrocode} -\let\m@mold@footnotetext\@footnotetext \let\m@mold@mpfootnotetext\@mpfootnotetext % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % % % We also to patch the minipage environment. We can use -% \cs{@minipagerestore} for the \texttt{begin} part, but have to +% \cs{@minipagerestore} for the \texttt{begin} part (done earlier), +% but have to % modify \cs{endminipage} % % \begin{macro}{\m@mdoextrafeetmini} @@ -18967,7 +23515,7 @@ \newcommand{\m@mdoextrafeetmini}{% \extrafeetminihook} \newcommand{\extrafeetminihook}{} -\renewcommand{\@minipagerestore}{\m@mdoextrafeetmini} +%%%%\renewcommand{\@minipagerestore}{\m@mdoextrafeetmini} % \end{macrocode} % \end{macro} @@ -19141,14 +23689,16 @@ \newcommand{\m@make@footnotetext}[1]{% \@namelongdef{@footnotetext#1}##1{% \insert\@nameuse{footins#1}{% - \@nameuse{foottextfont#1}% + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\@nameuse{foottextfont#1}% \@preamfntext \hsize\columnwidth \protected@edef\@currentlabel{% \csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}}% \color@begingroup \@nameuse{@makefntext#1}{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \rule\z@\footnotesep\ignorespaces{\@nameuse{foottextfont#1} ##1}% + \@finalstrut\strutbox}% \color@endgroup}% \m@mmf@prepare}} @@ -19162,12 +23712,15 @@ \@namelongdef{@mpfootnotetext#1}##1{% \global\setbox\@nameuse{@mpfootins#1}\vbox{% \unvbox\@nameuse{@mpfootins#1}% - \@nameuse{foottextfont#1} \hsize\columnwidth \@parboxrestore + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\@nameuse{foottextfont#1}% + \hsize\columnwidth \@parboxrestore \protected@edef\@currentlabel{% \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}% \color@begingroup \@nameuse{@makefntext#1}{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \rule\z@\footnotesep\ignorespaces{\@nameuse{foottextfont#1} ##1}% + \@finalstrut\strutbox}% \color@endgroup}% \m@mmf@prepare}} @@ -19490,7 +24043,8 @@ % \changes{v1.618}{2005/09/03}{Added missing percent to \cs{@twocolfootnotetext} (mempatch v3.1)} % \begin{macrocode} \newcommand{\@twocolfootnotetext}[1]{\insert\footinsv@r{% - \foottextfont + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\foottextfont \@preamfntext \protected@edef\@currentlabel{% \csname p@footnote\endcsname\@thefnmark}% @@ -19532,7 +24086,9 @@ \newcommand{\@mptwocolfootnotetext}[1]{% \global\setbox\@mpfootinsv@r\vbox{% \unvbox\@mpfootinsv@r - \foottextfont \hsize\columnwidth \@parboxrestore + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\foottextfont + \hsize\columnwidth \@parboxrestore \protected@edef\@currentlabel{% \csname p@mpfootnote\endcsname\@thefnmark}% \color@begingroup @@ -19572,8 +24128,9 @@ % \begin{macrocode} \newcommand{\m@make@twocolfootnotetext}[1]{% \@namelongdef{@twocolfootnotetext#1}##1{% - \insert\@nameuse{footins#1}{ - \@nameuse{foottextfont#1}% + \insert\@nameuse{footins#1}{% + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\@nameuse{foottextfont#1}% \@preamfntext \protected@edef\@currentlabel{% \csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}% @@ -19593,13 +24150,14 @@ \@namelongdef{@mptwocolfootnotetext#1}##1{% \global\setbox\@nameuse{@mpfootins#1}\vbox{% \unvbox\@nameuse{@mpfootins#1} - \@nameuse{foottextfont#1} \hsize\columnwidth \@parboxrestore + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\@nameuse{foottextfont#1}% + \hsize\columnwidth \@parboxrestore \protected@edef\@currentlabel{% \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}% \color@begingroup \@nameuse{@twocolfootfmt#1}{##1}% - \color@endgroup}% - \m@mmf@prepare}} + \color@endgroup}\m@mmf@prepare}} % \end{macrocode} % \end{macro} @@ -19668,14 +24226,14 @@ % \cs{@footnotetext} % \begin{macrocode} \newcommand{\@threecolfootnotetext}[1]{\insert\footinsv@r{% - \foottextfont + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\foottextfont \@preamfntext \protected@edef\@currentlabel{% \csname p@footnote\endcsname\@thefnmark}% \color@begingroup \@threecolfootfmt{#1}% - \color@endgroup}% - \m@mmf@prepare} + \color@endgroup}\m@mmf@prepare} % \end{macrocode} % \end{macro} @@ -19710,13 +24268,14 @@ \newcommand{\@mpthreecolfootnotetext}[1]{% \global\setbox\@mpfootinsv@r\vbox{% \unvbox\@mpfootinsv@r - \foottextfont \hsize\columnwidth \@parboxrestore + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\foottextfont + \hsize\columnwidth \@parboxrestore \protected@edef\@currentlabel{% \csname p@mpfootnote\endcsname\@thefnmark}% \color@begingroup \@threecolfootfmt{#1}% - \color@endgroup}% - \m@mmf@prepare} + \color@endgroup}\m@mmf@prepare} % \end{macrocode} % \end{macro} @@ -19752,15 +24311,15 @@ % \begin{macrocode} \newcommand{\m@make@threecolfootnotetext}[1]{% \@namelongdef{@threecolfootnotetext#1}##1{% - \insert\@nameuse{footins#1}{ - \@nameuse{foottextfont#1}% + \insert\@nameuse{footins#1}{% + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\@nameuse{foottextfont#1}% \@preamfntext \protected@edef\@currentlabel{% \csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}% \color@begingroup \@nameuse{@threecolfootfmt#1}{##1}% - \color@endgroup}% - \m@mmf@prepare}} + \color@endgroup}\m@mmf@prepare}} % \end{macrocode} % \end{macro} @@ -19773,13 +24332,14 @@ \@namelongdef{@mpthreecolfootnotetext#1}##1{% \global\setbox\@nameuse{@mpfootins#1}\vbox{% \unvbox\@nameuse{@mpfootins#1} - \@nameuse{foottextfont#1} \hsize\columnwidth \@parboxrestore + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\@nameuse{foottextfont#1}% + \hsize\columnwidth \@parboxrestore \protected@edef\@currentlabel{% \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}% \color@begingroup \@nameuse{@threecolfootfmt#1}{##1}% - \color@endgroup}% - \m@mmf@prepare}} + \color@endgroup}\m@mmf@prepare}} % \end{macrocode} % \end{macro} @@ -19931,7 +24491,8 @@ % \cs{@footnotetext} % \begin{macrocode} \newcommand{\@parafootnotetext}[1]{\insert\footinsv@r{ - \foottextfont + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\foottextfont \@preamfntext \protected@edef\@currentlabel{% \csname p@footnote\endcsname\@thefnmark}% @@ -19939,8 +24500,7 @@ \color@begingroup \noindent \@parafootfmt{#1}% \color@endgroup}% - \m@mungebox}% - \m@mmf@prepare} + \m@mungebox}\m@mmf@prepare} % \end{macrocode} % \end{macro} @@ -19964,15 +24524,16 @@ \newcommand{\@mpparafootnotetext}[1]{% \global\setbox\@mpfootinsv@r\vbox{% \unvbox\@mpfootinsv@r - \foottextfont \hsize\columnwidth \@parboxrestore + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\foottextfont + \hsize\columnwidth \@parboxrestore \protected@edef\@currentlabel{% \csname p@mpfootnote\endcsname\@thefnmark}% \setbox0=\vbox{\hsize=\maxdimen \color@begingroup \noindent \@parafootfmt{#1}% \color@endgroup}% - \m@mungebox}% - \m@mmf@prepare} + \m@mungebox}\m@mmf@prepare} % \end{macrocode} % \end{macro} @@ -20013,7 +24574,8 @@ \newcommand{\m@make@parafootnotetext}[1]{% \@namelongdef{@parafootnotetext#1}##1{% \insert\@nameuse{footins#1}{ - \@nameuse{foottextfont#1}% + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\@nameuse{foottextfont#1}% \@preamfntext \protected@edef\@currentlabel{% \csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}% @@ -20021,8 +24583,7 @@ \color@begingroup \noindent \@nameuse{@parafootfmt#1}{##1}% \color@endgroup}% - \m@mungebox}% - \m@mmf@prepare}} + \m@mungebox}\m@mmf@prepare}} % \end{macrocode} % \end{macro} @@ -20035,15 +24596,16 @@ \@namelongdef{@mpparafootnotetext#1}##1{% \global\setbox\@nameuse{@mpfootins#1}\vbox{% \unvbox\@nameuse{@mpfootins#1} - \@nameuse{foottextfont#1} \hsize\columnwidth \@parboxrestore + \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition + \reset@font\@nameuse{foottextfont#1}% + \hsize\columnwidth \@parboxrestore \protected@edef\@currentlabel{% \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}% \setbox0=\vbox{\hsize=\maxdimen \color@begingroup \noindent \@nameuse{@parafootfmt#1}{##1}% \color@endgroup}% - \m@mungebox}% - \m@mmf@prepare}} + \m@mungebox}\m@mmf@prepare}} % \end{macrocode} % \end{macro} @@ -20108,8 +24670,615 @@ % \end{macrocode} % \end{macro} % +% \subsection{Nasty insert bits} +% \changes{v1.61803}{2008/01/30}{Put \cs{@makecol} and associated code +% into new section `Nasty insert bits' (mempatch various)} +% +% \cs{sidebar} is implemented as a new kind of \cs{insert} and the +% extended footnotes are also implemented via new kinds of \cs{insert}s. +% New \cs{insert}s mean that the kernel's \cs{@makecol} must be revised +% to cater for them. As this is part of the output process it is nasty to +% do. +% +% Before v1.61803 \cs{@makecol} got (re)defined at several points in the +% code. Here is what I hope is the final version od \cs{@makecol} and +% associated code after having resolved and combined all the changes. +% +% +% \begin{macro}{\if@mem@nofoot} +% \begin{macro}{\@mem@testifnofoot} +% \begin{macro}{\@mem@extranofoot} +% These are from [RS] as \cs{@doclearpage} should check for more than +% just \cs{footins} being void. Note that this covers all current +% class defined inserts, including sidebars. +% \changes{v1.61}{2004/03/14}{Added \cs{if@mem@nofoot}, +% \cs{@mem@testifnofoot}, and +% \cs{@mem@extranofoot}} +% \begin{macrocode} +\newif\if@mem@nofoot +\newcommand*{\@mem@testifnofoot}{% + \@mem@nofoottrue + \ifvoid\footins\else\@mem@nofootfalse\fi + \ifvoid\footinsv@r\else\@mem@nofootfalse\fi + \ifvoid\sideins\else\@mem@nofootfalse\fi + \@mem@extranofeet} +\newcommand*{\@mem@extranofeet}{} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\memold@doclearpage} +% \begin{macro}{\mem@doclearpage} +% \begin{macro}{\@doclearpage} +% I thought that I could get away with using the kernel's +% \cs{@doclearpage} but [RS] discovered that I couldn't. +% \changes{v1.62}{2004/03/14}{Redid \cs{@doclearpage} using [RS] code} +% \begin{macrocode} +\let\memold@doclearpage\@doclearpage +\newcommand{\mem@doclearpage}{% + \@mem@testifnofoot + \if@mem@nofoot + \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa + \setbox\@tempboxa\box\@cclv + \xdef\@deferlist{\@toplist\@botlist\@deferlist}% + \global\let\@toplist\@empty + \global\let\@botlist\@empty + \global\@colroom\@colht + \ifx \@currlist\@empty + \else + \@latexerr{Float(s) lost}\@ehb + \global\let\@currlist\@empty + \fi + \@makefcolumn\@deferlist + \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}% + \if@twocolumn + \if@firstcolumn + \xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}% + \global\let\@dbltoplist\@empty + \global\@colht\textheight + \begingroup + \@dblfloatplacement + \@makefcolumn\@dbldeferlist + \@whilesw\if@fcolmade \fi{\@outputpage + \@makefcolumn\@dbldeferlist}% + \endgroup + \else + \vbox{}\clearpage + \fi + \fi + \else + \setbox\@cclv\vbox{\box\@cclv\vfil}% + \@makecol\@opcol + \clearpage + \fi} +% \end{macrocode} +% Replace the kernel's \cs{@doclearpage}. +% \begin{macrocode} +\gdef\@doclearpage{\mem@doclearpage} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\m@m@makecolfloats} +% \begin{macro}{\m@m@makecoltext} +% These two macros contain code common to versions of \cs{@makecol} +% \begin{macrocode} +\newcommand*{\m@m@makecolfloats}{% + \xdef\@freelist{\@freelist\@midlist}% + \global\let\@midlist\@empty + \@combinefloats} +\newcommand*{\m@m@makecoltext}{% + \ifvbox\@kludgeins + \@makespecialcolbox + \else + \setbox\@outputbox \vbox to\@colht{% + \@texttop + \dimen@ \dp\@outputbox + \unvbox \@outputbox + \vskip -\dimen@ + \@textbottom}% + \fi} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\m@m@makecolintro} +% A hook into the revised \cs{@makecol} +% \begin{macrocode} +\newcommand*{\m@m@makecolintro}{} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mopfootnote} +% (footnote) code for possible use in \cs{@makecol}. +% \begin{macrocode} +\newcommand*{\m@mopfootnote}{\setbox\@outputbox \vbox{% + \boxmaxdepth\@maxdepth + \@tempdima\dp\@cclv + \unvbox\@cclv + \vskip-\@tempdima + \vskip \skip\footins + \color@begingroup + \normalcolor + \footnoterule + \unvbox \footins + \color@endgroup}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mopsidebar} +% (sidebar) code for possible use in \cs{@makecol}. +% From DA's latest sidebar fixes. +% \begin{macrocode} +\newcommand*{\m@mopsidebar}{% + \ifvoid\sideins\else + \setbox\@outputbox \vbox{% + \sidecontents + \unvbox\@outputbox} + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mem@makecol} +% DA's latest version of \cs{@makecol} (giving the standard +% footnote order (bottom floats after footnotes)) putting the sidebar +% insert after the others (from mempatch v4.9). +% \begin{macrocode} +\gdef\mem@makecol{% + \m@m@makecolintro + \ifvoid\footins + \setbox\@outputbox \box\@cclv + \else + \m@mopfootnote + \fi + \m@mdoextrafeet + \m@m@makecolfloats + \m@mopsidebar + \m@m@makecoltext + \global \maxdepth \@maxdepth} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mem@makecolbf} +% A version of \cs{@makecol} which puts footnotes at the bottom of the page +% (after any bottom floats). +% \begin{macrocode} +\gdef\mem@makecolbf{% + \m@m@makecolintro + \setbox\@outputbox \box\@cclv + \m@m@makecolfloats + \ifvoid\footins + \else + \m@mopfootnote + \fi + \m@mdoextrafeet + \m@mopsidebar + \m@m@makecoltext + \global \maxdepth \@maxdepth} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mem@makecoldblf} +% A version of \cs{@makecol} which is a placeholder to fix the doublefloat +% problem. % +% \begin{macrocode} +\gdef\mem@makecoldblf{% + \m@m@makecolintro + \setbox\@outputbox \box\@cclv + \m@m@makecolfloats + \m@mopsidebar% <- added + \ifvoid\footins + \else + \m@mopfootnote + \fi + \m@mdoextrafeet + \m@m@makecoltext + \global \maxdepth \@maxdepth} + +% \end{macrocode} +% \end{macro} % +% \begin{macro}{\feetabovefloat} +% \begin{macro}{\feetbelowfloat} +% \begin{macro}{\@makecol} +% declarations to put footnotes above bottom floats (standard \LaTeX) +% or at the bottom of the page +% \begin{macrocode} +\newcommand{\feetabovefloat}{\gdef\@makecol{\mem@makecol}} +\newcommand{\feetbelowfloat}{\gdef\@makecol{\mem@makecolbf}} +\feetabovefloat + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\@reinserts} +% DA's final version from last patch. +% \begin{macrocode} +\gdef\@reinserts{% + \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi + \m@mdodoreinextrafeet + \ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi + \ifvoid\sideins\else\insert\sideins{\unvbox\sideins}\fi} + +% \end{macrocode} +% \end{macro} +% +% +% +% \subsection{End notes} +% +% This is from the \Lpack{pagenote} package, with minor amendments. +% \changes{v1.61803}{2008/01/30}{Added page notes (mempatch v4.5)} +% +% \begin{macro}{\ifm@mpnpageopt} +% \begin{macro}{\ifm@mpncontopt} +% We need two flags for the options. +% \cs{m@mpnpageoptfalse} means that page numbers are not available and +% \cs{m@mpncontopt} means that note numbers are reset at each \cs{chapter}. +% \begin{macrocode} +\newif\ifm@mpnpageopt + \m@mpnpageoptfalse +\newif\ifm@mpncontopt + \m@mpncontoptfalse +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\c@pagenote} +% \begin{macro}{\thepagenote} +% We need a counter for the notes. This is the default definition. +% \begin{macrocode} +\newcounter{pagenote}[chapter] +\renewcommand{\thepagenote}{\arabic{pagenote}} +\setcounter{pagenote}{0} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\notepageref} +% \begin{macro}{\continuousnotenums} +% Let the user change the default options. +% \cs{notepageref} makes page numbers available (the package \Lopt{page} option)% and \cs{continuousnotenums} means that notes will be numbered continuously +% throughout the document(the package \Lopt{continuous} option). +% \begin{macrocode} +\newcommand*{\notepageref}{\m@mpnpageopttrue} +\@onlypreamble\notepageref +\newcommand*{\continuousnotenums}{% + \counterwithout{pagenote}{chapter} + \renewcommand{\thepagenote}{\arabic{pagenote}}} +\@onlypreamble\continuousnotenums + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\ifmempagenotes} +% Need to check if notes are required. +% \begin{macrocode} +\newif\ifmempagenotes + \mempagenotesfalse + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\makepagenote} +% This sets up the note file. At the end it emasculates itself so it can only +% be used once. +% \begin{macrocode} +\newcommand*{\makepagenote}{% + \newwrite\@notefile + \immediate\openout\@notefile=\jobname.ent + \mempagenotestrue +% \end{macrocode} +% \begin{macro}{\pagenote} +% Make sure that this has a useful definition. +% \begin{macrocode} + \def\pagenote{\@bsphack\begingroup + \@sanitize + \m@m@wrpnote}% +% \end{macrocode} +% \end{macro} +% \begin{macrocode} + \typeout{Writing note file \jobname.ent}% + \let\makepagenote\@empty} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\immediate@protected@write} +% We might have to do some immediate writes. This is an immediate +% version of the kernel \cs{protected@write}. +% \begin{macrocode} +\newcommand{\immediate@protected@write}[3]{% + \begingroup + #2% + \let\protect\@unexpandable@protect + \edef\reserved@a{\immediate\write#1{#3}}% + \reserved@a + \endgroup + \if@nobreak\ifvmode\nobreak\fi\fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@m@pnwrite} +% If the \Lopt{page} option is used we cannot use an immediate write +% because the page number is only known in the output routine. +% \begin{macrocode} +\let\m@m@pnwrite\immediate@protected@write +\AtBeginDocument{% + \ifm@mpnpageopt + \let\m@m@pnwrite\protected@write + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pnchap} +% \begin{macro}{\pnschap} +% Redefine these for different subheadings in the notes list. +% \begin{macrocode} +\newcommand*{\pnchap}{\f@rtoc} +\newcommand*{\pnschap}{\f@rbdy} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\m@m@wrpnote} +% This writes the note information to the note file. If the optional argument +% is empty it increments the +% note counter and calls \cs{notenumintext} to handle its appearance in +% the body text. +% \changes{v1.61803}{2008/05/25}{Made \cs{m@m@wrpnote} match the effect +% described in memman regarding the optional argument.} +% \begin{macrocode} +\newcommand{\m@m@wrpnote}[2][]{% + \@ifmtarg{#1}{\refstepcounter{pagenote}% + \notenumintext{\thepagenote}}{}% +% \end{macrocode} +% Check if this is the first note in a division, and if so indicate this +% in the file. +% \begin{macrocode} + \ifm@mpn@new@chap + \global\m@mpn@new@chapfalse + \addtonotes{\string\pagenotesubhead{\@chapapp}{\thechapter}{\pnchap}}% + \fi + \ifm@mpn@new@schap + \global\m@mpn@new@schapfalse + \addtonotes{\string\pagenotesubhead{\@chapapp}{}{\pnschap}}% + \fi +% \end{macrocode} +% Finally, write the entry. +% \begin{macrocode} + \m@m@pnwrite\@notefile{} + {\string\noteentry{\thepagenote}{#1}{#2}{\thepage}}% + \endgroup + \@esphack} + +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\pagenote} +% The user command to generate a note. It is given substance +% by \cs{makepagenote}. +% \begin{macrocode} +\def\pagenote{\@bsphack\begingroup \@sanitize\m@m@pagenote} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@m@pagenote} +% \begin{macrocode} +\newcommand{\m@m@pagenote}[2][]{\endgroup\@esphack} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pagetofootnote} +% \begin{macro}{\foottopagenote} +% \begin{macro}{\memsavefootnote} +% \begin{macro}{\memsavepagenote} +% Let the user change pagenotes to footnotes, or vice-versa. In either +% case the optional argument is ignored. +% \begin{macrocode} +\newcommand*{\pagetofootnote}{% + \let\memsavepagenote\pagenote + \renewcommand{\pagenote}[2][]{\footnote{##2}}} +\newcommand*{\foottopagenote}{% + \let\memsavefootnote\footnote + \renewcommand*{\footnote}[2][]{\pagenote{##2}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\addtonotes} +% \cs{addtonotes}\marg{text} puts \meta{text} into the notes file. +% \begin{macrocode} +\newcommand{\addtonotes}[1]{\ifmempagenotes + \IfFileExists{\jobname.ent}{\m@m@pnwrite\@notefile{}{#1}}{\mempnofilewarn}% +\fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\notenumintext} +% \begin{macro}{\notenuminnotes} +% \cs{notenumintext}\marg{notenum} typesets \meta{notenum} (in the body text). +% \begin{macrocode} +\newcommand{\notenumintext}[1]{% + \textsuperscript{#1}} +% \end{macrocode} +% \cs{notenuminnotes}\marg{notenum} typesets \meta{notenum} (as part of the note). +% \begin{macrocode} +\newcommand{\notenuminnotes}[1]{% + {\normalfont #1.}\space} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\noteentry} +% \cs{noteentry}\marg{notenum}\marg{id}\marg{pagenum}\marg{text} +% typesets a note. +% \begin{macrocode} +\newcommand{\noteentry}[4]{% + \prenoteinnotes + \noteidinnotes{#1}{#2}\pageinnotes{#4}\noteinnotes{#3}% + \postnoteinnotes} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\idtextinnotes} +% \cs{idtextinnotes}\marg{id text} typesets the note's \meta{id text}. +% \begin{macrocode} +\newcommand{\idtextinnotes}[1]{% + [#1]\space} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\noteidinnotes} +% \cs{noteidinnotes}\marg{notenum}\marg{id} is used to typeset the note +% identification (in the note listing). It is set so that it typesets the +% \meta{id} if it is not empty, otherwise it sets the \meta{notenum}. +% \begin{macrocode} +\newcommand{\noteidinnotes}[2]{% + \@ifmtarg{#2}{% + \notenuminnotes{#1}}{\idtextinnotes{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pageinnotes} +% \begin{macro}{\printpageinnotes} +% \cs{pageinnotes}\meta{pagenum} calls +% \cs{printpageinnotes}\marg{pagenum} to typeset the originating +% page number (in the note), but only if the \cs{notepageref} declaration +% has been used (the page number is not trustworthy unless the +% \cs{notepageref} has been used). +% \begin{macrocode} +\newcommand{\pageinnotes}[1]{% + \ifm@mpnpageopt \printpageinnotes{#1}\fi} +\newcommand*{\printpageinnotes}[1]{% + (\pagerefname\ #1)\space} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\noteinnotes} +% \cs{noteinnotes}\marg{text} is used to typeset the note's text +% (in the note list). +% \begin{macrocode} +\newcommand{\noteinnotes}[1]{#1} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\prenoteinnotes} +% \begin{macro}{\postnoteinnotes} +% These are called immediately before and after the note information is +% typeset. +% \begin{macrocode} +\newcommand{\prenoteinnotes}{\par\noindent} +\newcommand{\postnoteinnotes}{\par} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\notesname} +% \begin{macro}{\notedivision} +% Heading for note list. +% \begin{macrocode} +\providecommand*{\notesname}{Notes} +\newcommand*{\notedivision}{\chapter{\notesname}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\printnotes} +% \begin{macro}{\printpagenotes*} +% User commands to print the note file. +% \begin{macrocode} +\newcommand*{\printpagenotes}{\@ifstar{\@sprintpagenotes}{\@printpagenotes}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\mempnofilewarn} +% Warning when the notes file does not exist. +% \begin{macrocode} +\newcommand*{\mempnofilewarn}{% + \ClassWarning{memoir}{There is no .ent file}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@sprintpagenotes} +% Macro implementing \cs{printpagenotes*}. +% \begin{macrocode} +\newcommand*{\@sprintpagenotes}{% + \ifmempagenotes + \notedivision +\IfFileExists{\jobname.ent}{% + \immediate\closeout\@notefile + \input{\jobname.ent}% + \immediate\openout\@notefile=\jobname.ent% + }{% + \mempnofilewarn +}% +\fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@printpagenotes} +% Macro implementing \cs{printpagenotes}. +% \begin{macrocode} +\newcommand*{\@printpagenotes}{% + \ifmempagenotes + \notedivision + \IfFileExists{\jobname.ent}{% + \immediate\closeout\@notefile + \input{\jobname.ent}% + }{% + \mempnofilewarn + } + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pagenotesubhead} +% The section heading before each set of notes. \\ +% \cs{pagenotesubhead}\marg{chaptername}\marg{number}\marg{title} +% \begin{macrocode} +\newcommand*{\pagenotesubhead}[3]{% + \section*{#1 #2 #3}} + +% \end{macrocode} +% \end{macro} % % \section{Change marks} \label{sec:vct} % @@ -20130,14 +25299,26 @@ % \begin{macrocode} \newif\ifchangemarks\changemarksfalse % \end{macrocode} -% The marks only work properly when the |draft| option -% is in effect. Also, the command |\changemarkstrue| must be +% The marks only work properly when the \Lopt{draft} option +% is in effect. Also, the command \cs{changemarkstrue} must be % put in the document preamble. % \end{macro} % +% \begin{macro}{\changemarks} +% \begin{macro}{\nochangemarks} +% More user friendly version of \cs{changemarks(true/false)}. +% \changes{v1.61803}{2008/01/30}{Added \cs{changemarks} and \cs{nochangemarks}} +% \begin{macrocode} +\newcommand*{\changemarks}{\changemarkstrue} +\newcommand*{\nochangemarks}{\changemarksfalse} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\v@rid} -% This acts as an alias for |\marginpar| when both |changemarks| is -% true and the |draft| option is in effect, otherwise it throws +% This acts as an alias for \cs{marginpar} when both \cs{ifchangemarks} is +% true and the \Lopt{draft} option is in effect, otherwise it throws % away its two arguments. % \changes{v1.2}{2002/07/27}{Added \cs{@bsphack} and \cs{@esphack} to \cs{v@rid}} % \begin{macrocode} @@ -20163,7 +25344,7 @@ % into the final document. % \changes{v1.2}{2002/07/27}{Added \cs{@bsphack} and \cs{@esphack} to changemarks} % \begin{macro}{\added} -% |\added{|\meta{change-id}|}| +% \cs{added}\marg{change-id} % Flags, with the symbol $\oplus$, that something has been added % to the manuscript. % \begin{macrocode} @@ -20177,7 +25358,7 @@ % \end{macro} % % \begin{macro}{\deleted} -% |\deleted{|\meta{change-id}|}| +% \cs{deleted}\marg{change-id} % Flags, with the symbol $\neq$, that something has been deleted % from the manuscript. % \begin{macrocode} @@ -20191,7 +25372,7 @@ % \end{macro} % % \begin{macro}{\changed} -% |\changed{|\meta{change-id}|}| +% \cs{changed}\marg{change-id} % Flags, with the symbol $\Leftrightarrow$, that something % has been changed in the text. % \begin{macrocode} @@ -20229,8 +25410,8 @@ % did not seem to work together. The following are some snippets from % that thread, identified by the various proponents. % \begin{description} -% \item[crop] Ah, yes. It cannot work with all those |\settrims| etc. -% crop.sty does only respect |\stock{width,height}|, +% \item[crop] Ah, yes. It cannot work with all those \cs{settrims} etc. +% crop.sty does only respect \verb?\stock{width,height}?, % but none of the other memoir specific trim marks stuff \ldots % % \item[crop] \ldots I'm not a memoir expert. crop.sty respects all the @@ -20243,11 +25424,11 @@ % % \item[memoir] I will try and take a look at the problem but I'm % not a crop expert --- I've never used it. However it seems odd to -% me that crop doesn't work with memopir. Memoir provides a different +% me that crop doesn't work with memoir. Memoir provides a different % interface for specifying the page layout but then translates everything % to the standard length variables. \ldots % -% \item[crop] You've just taken code from it |...:->| +% \item[crop] You've just taken code from it \verb?...:->? % % crop doesn't have its own idea at all. It just uses that of DEK % and LaTeX, which says, that the reference point of the output box @@ -20255,28 +25436,43 @@ % to right] and 1 inch down % from the upper left (virtual) paper corner. % -% \item[crop] With other words: crop changes |\hoffset| and |\voffset|, +% \item[crop] With other words: crop changes \cs{hoffset} and \cs{voffset}, % in order to center the logical (virtual) page on the physical sheet % of paper, in the middle of the crop marks. The length macros -% |\evensidemargin| and |\oddsidemargin| are unchanged and refer still +% \cs{evensidemargin} and \cs{oddsidemargin} are unchanged and refer still % to the logical page (modulo 1 inch). % % The memoir class, in contrast (mis)uses the LaTeX margins -% |\even(odd)sidemargin| for that purpose. +% \cs{even(odd)sidemargin} for that purpose. % -% Thus, the meaning of |\even(odd)sidemargin| is different +% Thus, the meaning of \cs{even(odd)sidemargin} is different % in both packages. % \end{description} % % Given all the above I concluded that \Lpack{crop} would remain % as it was, and that in order to satisfy Peter Heslin I would have -% to extend the trimming marks. The following is limited to extensions +% to extend the trimming marks. The following was originally limited to +% extensions % asked for by Peter Heslin. % +% \begin{macro}{\showtrimsoff} +% \begin{macro}{\showtrimson} +% Switch trimming marksoff and on. Requested by James Hunt on CTT +% \textit{Are crop marks needed on every page?}, February 2006. +% \changes{v1.61803}{2008/01/30}{Added \cs{showtrimsoff} and \cs{showtrimson} +% (mempatch v4.5)} +% \begin{macrocode} +\newcommand*{\showtrimsoff}{\showtrimsfalse} +\newcommand*{\showtrimson}{\showtrimstrue} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\trimmark} % This is a cross % in a zero sized picture for marking the corner of a logical page. Up to -% version 1.0 the macro used |\setlength| for adjusting the |\unitlength| +% version 1.0 the macro used \cs{setlength} for adjusting the \cs{unitlength} % but Henrik Holm\footnote{Message to \ctt{} on 2002/01/04 % (\texttt{h.holm@spray.no})} discovered that if the \Lpack{calc} package % is used then LaTeX complains about a missing number. @@ -20401,20 +25597,17 @@ \let\tmarktl\trimmark \let\tmarktr\trimmark \let\tmarkbl\trimmark - \let\tmarkbr\trimmark -} + \let\tmarkbr\trimmark} \newcommand*{\trimLmarks}{% \let\tmarktl\Ltrimpictl \let\tmarktr\Ltrimpictr \let\tmarkbl\Ltrimpicbl - \let\tmarkbr\Ltrimpicbr -} + \let\tmarkbr\Ltrimpicbr} \newcommand*{\trimFrame}{% \let\tmarktl\null \let\tmarktr\null \let\tmarkbl\Ftrimpicbl - \let\tmarkbr\null -} + \let\tmarkbr\null} \newcommand*{\trimNone}{% \let\tmarktl\relax \let\tmarktr\relax @@ -20423,8 +25616,7 @@ \let\tmarktm\relax \let\tmarkml\relax \let\tmarkmr\relax - \let\tmarkbm\relax -} + \let\tmarkbm\relax} % \end{macrocode} % \end{macro} @@ -20433,12 +25625,12 @@ % \end{macro} % % \begin{macro}{\trimmarks} -% This positions four marks (|\trimmark|) at the corners of a -% logical page. It is basically a |\vbox| with zero height and width. +% This positions four marks (\cs{trimmark}) at the corners of a +% logical page. It is basically a \cs{vbox} with zero height and width. % % Bastiaan Niels Veelo reported (2003/07/11) odd things (e.g., some % macros ignored) when changing trim marks. Turns out to be related -% to the use of |\protect|. +% to the use of \cs{protect}. % \changes{v1.1}{2002/03/10}{Changed \cs{trimmarks} to work properly with the oneside option} % \changes{v1.3}{2002/10/10}{Changed \cs{trimmarks} to use \cs{tmarktl}, etc., % instead of four \cs{trimmark}s} @@ -20470,91 +25662,108 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\c@sheetsequence} -% Peter Heslin asked for the ability to add a sequential page number -% (1 for the first page, N for the last page, no matter what value -% the page counter has) to the trimming marks. -% -% |\c@sheetsequence| is a new counter for pages starting at the -% beginning and independent -% of the standard page counter. This should not be reset by anything. -% The counter increment has to be added to the output routine. % -% This may also be useful for page N of M numbering. -% \changes{v1.3}{2002/10/10}{Added sheetsequence counter.} -% \begin{macrocode} -\newcounter{sheetsequence} - \setcounter{sheetsequence}{1} - \renewcommand{\thesheetsequence}{\@arabic\c@sheetsequence} -\g@addto@macro{\@outputpage}{\stepcounter{sheetsequence}} - -% \end{macrocode} -% \end{macro} +% \subsection{Quark marks} % -% \begin{macro}{\c@lastsheet} -% \begin{macro}{\c@lastpage} -% While we're at it, might as well provide for lastpage and lastsheet counters -% \changes{v1.3}{2002/11/14}{Added lastsheet and lastpage functions.} -% \begin{macrocode} -\newcounter{lastsheet} - \setcounter{lastsheet}{0} -\newcounter{lastpage} - \setcounter{lastpage}{0} -% \end{macrocode} -% \end{macro} -% \end{macro} +% William Adams (2006/08/28) supplied the following code to use trim marks +% along the style of Quark Xpress. % -% \begin{macro}{\dol@stsheet} -% \begin{macro}{\dol@stpage} -% These two macros write the values of lastsheet and lastpage to the -% \file{aux} file. They have to be called at the end of the document -% after a |\clearpage| to flush out any floats. -% \changes{v1.4}{2003/02/27}{In \cs{dol@stpage} use the page counter value, -% not \cs{thepage} otherwise problems with -% non-arabic page numbers (patch 1.1)} -% \changes{v1.61}{2004/03/21}{In \cs{dol@stpage} use the sheet counter value, -% not \cs{thesheetsequence} otherwise problems -% if (e.g., hangul.sty) \cs{@arabic} is redefined} -% \changes{v1.618}{2005/09/02}{Made \cs{dol@stsheet} and \cs{dol@stpage} -% obey \cs{nofiles}} -% \begin{macrocode} -\newcommand{\dol@stsheet}{% - \if@filesw - \addtocounter{sheetsequence}{-1}% - \immediate\write\@auxout% - {\string\setcounter{lastsheet}{\the\c@sheetsequence}}% - \stepcounter{sheetsequence}% - \fi} -\newcommand{\dol@stpage}{% - \if@filesw - \addtocounter{page}{-1}% - \immediate\write\@auxout% - {\string\setcounter{lastpage}{\the\c@page}}% - \stepcounter{page}% - \fi} -% \end{macrocode} -% I originally used this: \\ -% \verb?\AtEndDocument{\clearpage\dol@stsheet\dol@stpage}? -% but following the CTT thread \textit{AtEndDocument produces unwanted page -% break}, 2004/03/11, and in particular Dan Luecking's response I now -% try as hard as possible to do it right at the end, but even this is not -% 100\% reliable. The only way to ensure reliability is to modify the kernel -% \verb?\enddocument? which doesn't seem to be a particularly wise thing -% to do. -% \changes{v1.61}{2004/03/14}{Changed location of calls to \cs{dol@stsheet} -% and \cs{dol@stpage}} +% \begin{macro}{\registrationColour} +% \begin{macro}{\quarkmarks} +% Trim marks on the style of Quark Express. +% \changes{v1.61803}{2008/01/30}{Added \cs{quarkmarks} (mempatch v4.6)} % \begin{macrocode} -\AtBeginDocument{\AtEndDocument{\clearpage\dol@stsheet\dol@stpage}} +\newcommand*{\registrationColour}[1]{#1} +\newcommand*{\quarkmarks}{% +\renewcommand*{\tmarktl}{\registrationColour{% + \begin{picture}(0,0) + \setlength{\unitlength}{1bp}\thicklines + \put(-36,0){\line(1,0){24}} + \put(0,12){\line(0,1){24}} + \put(3,27){\ttfamily\fontsize{8bp}{10bp}\selectfont\jobname\ \ + \today\ \ \printtime\ \ Page \thepage} + \end{picture}}} +\renewcommand*{\tmarktm}{\registrationColour{% + \begin{picture}(0,0) + \setlength{\unitlength}{1bp}\thicklines + \put(-24,24){\line(1,0){48}} + \put(0,12){\line(0,1){24}} + \put(0,24){\oval(12,12)} + \end{picture}}} +\renewcommand*{\tmarktr}{\registrationColour{% + \begin{picture}(0,0) + \setlength{\unitlength}{1bp}\thicklines + \put(12,0){\line(1,0){24}} + \put(0,12){\line(0,1){24}} + \end{picture}}} +\renewcommand*{\tmarkmr}{\registrationColour{% + \begin{picture}(0,0) + \setlength{\unitlength}{1bp}\thicklines + \put(12,0){\line(1,0){24}} + \put(24,-24){\line(0,1){48}} + \put(24,0){\oval(12,12)} + \end{picture}}} +\renewcommand*{\tmarkbr}{\registrationColour{% + \begin{picture}(0,0) + \setlength{\unitlength}{1bp}\thicklines + \put(12,0){\line(1,0){24}} + \put(0,-36){\line(0,1){24}} + \end{picture}}} +\renewcommand*{\tmarkbm}{\registrationColour{% + \begin{picture}(0,0) + \setlength{\unitlength}{1bp}\thicklines + \put(-24,-24){\line(1,0){48}} + \put(0,-36){\line(0,1){24}} + \put(0,-24){\oval(12,12)} + \end{picture}}} +\renewcommand*{\tmarkbl}{\registrationColour{% + \begin{picture}(0,0) + \setlength{\unitlength}{1bp}\thicklines + \put(-36,0){\line(1,0){24}} + \put(0,-36){\line(0,1){24}} + \end{picture}}} +\renewcommand*{\tmarkml}{\registrationColour{% + \begin{picture}(0,0) + \setlength{\unitlength}{1bp}\thicklines + \put(-36,0){\line(1,0){24}} + \put(-24,-24){\line(0,1){48}} + \put(-24,0){\oval(12,12)} + \end{picture}}} +\renewcommand*{\trimmarks}{% +%% \special{papersize=\the\stockwidth,\the\stockheight} + {% + \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page + \hb@xt@\z@{\hskip-1in + \ifodd\c@page + \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth + \else + \if@twoside + \hskip\trimedge % left of logical page + \else + \hskip\stockwidth \hsip-\trimedge \hskip-\paperwidth + \fi + \fi + \vbox to \paperheight{% + \let\protect\relax % <- v1.4 addition + \hb@xt@\paperwidth{\tmarktl\hfil\tmarktm\hfil\tmarktr}% + \vfil + \hb@xt@\paperwidth{\tmarkml\hfil\tmarkmr}% + \vfil + \hb@xt@\paperwidth{\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}% + \hss}% + \vss}}% +}} % \end{macrocode} % \end{macro} % \end{macro} % -% Any marks are put onto the pages by adding to the |\shipout| +% +% Any marks are put onto the pages by adding to the \cs{shipout} % routine. % % \begin{macro}{\mem@oldshipout} -% Keep a copy of the current version of |\shipout| in |\mem@oldshipout|. +% Keep a copy of the current version of \cs{shipout} in \cs{mem@oldshipout}. % \begin{macrocode} \let\mem@oldshipout\shipout % \end{macrocode} @@ -20562,9 +25771,13 @@ % % \begin{macro}{\mem@shipi} % \begin{macro}{\mem@shipii} -% Effectively these will add the |\trimmarks| to the box holding -% the contents of the page. Note that any \cs{makeindex} must come \emph{before} \Lpack{pagesel} (and \Lpack{selectp}) package. -% \changes{v1.618}{2005/09/03}{Changed \cs{mem@shipii} for the pagesel package, courtesy James Szinger (mempatch v311)} +% Effectively these will add the \cs{trimmarks} to the box holding +% the contents of the page. Note that any \cs{makeindex} must come +% \emph{before} \Lpack{pagesel} (and \Lpack{selectp}) package. +% \changes{v1.618}{2005/09/03}{Changed \cs{mem@shipii} for the pagesel package, +% courtesy James Szinger (mempatch v311)} +% \changes{v1.61803}{2008/01/30}{Added \cs{ifshowtrims} to \cs{mem@shipii} +% (mempatch v4.5)} % \begin{macrocode} \newcommand*{\mem@shipi}{% \ifvoid\@cclv\expandafter\aftergroup\fi\mem@shipii} @@ -20572,16 +25785,20 @@ \ifvoid\@cclv \mem@oldshipout\box\@cclv \else - \mem@oldshipout\vbox{\trimmarks\unvbox\@cclv}% + \ifshowtrims + \mem@oldshipout\vbox{\trimmarks\unvbox\@cclv}% + \else + \mem@oldshipout\box\@cclv + \fi \fi} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\shipout} -% Our new version of |\shipout|, which is only needed for the -% \Lopt{showtrims} option. This adds |\mem@shipi| to the page box -% which then calls the original version of |\shipout|. +% Our new version of \cs{shipout}, which is only needed for the +% \Lopt{showtrims} option. This adds \cs{mem@shipi} to the page box +% which then calls the original version of \cs{shipout}. % \begin{macrocode} \ifshowtrims \renewcommand*{\shipout}{\afterassignment\mem@shipi\setbox\@cclv=} @@ -20591,8 +25808,6 @@ % \end{macro} % % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % \section{Verbatims, boxes, and files} % % All the code in this section was added for version 1.2 of the class. @@ -20609,10 +25824,10 @@ % % \begin{macro}{\every@verbatim} % \begin{macro}{\afterevery@verbatim} -% The hook (i.e.\ token register) |\every@verbatim| +% The hook (i.e., token register) \cs{every@verbatim} % is initialized to \meta{empty}. % -% PW added the |\afterevery@verbatim| hook. +% PW added the \cs{afterevery@verbatim} hook. % \begin{macrocode} \newtoks\every@verbatim \every@verbatim={} @@ -20625,7 +25840,7 @@ % % % \begin{macro}{\@makeother} -% |\@makeother| takes as argument a character and changes +% \cs{@makeother} takes as argument a character and changes % its category code to $12$ (other). % \begin{macrocode} \def\@makeother#1{\catcode`#112\relax} @@ -20634,7 +25849,7 @@ % % % \begin{macro}{\@vobeyspaces} -% The macro |\@vobeyspaces| causes spaces in the input +% The macro \cs{@vobeyspaces} causes spaces in the input % to be printed as spaces in the output. % \begin{macrocode} \begingroup @@ -20646,9 +25861,9 @@ % % % \begin{macro}{\@xobeysp} -% The macro |\@xobeysp| produces exactly one space in +% The macro \cs{@xobeysp} produces exactly one space in % the output, protected against breaking just before it. -% (|\@M| is an abbreviation for the number $10000$.) +% (\cs{@M} is an abbreviation for the number $10000$.) % \begin{macrocode} \def\@xobeysp{\leavevmode\penalty\@M\ } % \end{macrocode} @@ -20656,7 +25871,7 @@ % % % \begin{macro}{\verbatim@line} -% We use a newly defined token register called |\verbatim@line| +% We use a newly defined token register called \cs{verbatim@line} % that will be used as the character buffer. % \begin{macrocode} \newtoks\verbatim@line @@ -20676,7 +25891,7 @@ % \end{macrocode} % % \begin{macro}{\@xobeytab} -% |\@xobeytab| puts enough spaces in to get to the next nominal +% \cs{@xobeytab} puts enough spaces in to get to the next nominal % tab stop % \begin{macrocode} \def\@xobeytab{% @@ -20689,7 +25904,7 @@ % \end{macro} % % \begin{macro}{\@vobeytabs} -% |\@vobeytabs| initialises use of \cs{@xobeytab}. Needs to be +% \cs{@vobeytabs} initialises use of \cs{@xobeytab}. Needs to be % executed within a group, as mustn't be allowed to leak out into the % wide world. % @@ -20702,7 +25917,7 @@ % \end{macro} % % \begin{macro}{\verbatim@tabexpand} -% |\verbatim@tabexpand|\meta{body of line}|\@nil| processes every +% \cs{verbatim@tabexpand}\marg{body of line}\cs{@nil} processes every % character of a line by tail recursion, counting the characters and % juggling things when a tab is encountered. % \begin{macrocode} @@ -20716,7 +25931,7 @@ \else % \end{macrocode} % -% We can safely put |\@xobeysp| into the token register, since it +% We can safely put \cs{@xobeysp} into the token register, since it % does precisely what we need % \begin{macrocode} \toks@\expandafter{\the\toks@#1}% @@ -20737,7 +25952,7 @@ % \begin{macro}{\tabson} % \begin{macro}{\tabsoff} % \begin{macro}{\@maybeobeytabs} -% |\tabson| turns tabbing on, and |\tabsoff| turns it off. Default +% \cs{tabson} turns tabbing on, and \cs{tabsoff} turns it off. Default % is no tabbing. % \begin{macrocode} \newif\ift@bs @@ -20773,7 +25988,7 @@ % % \begin{macro}{\notabverbatim@processline} % Processes a line ignoring TABs (this is the original \Lpack{verbatim} -% package definition of |\verbatim@processline|). +% package definition of \cs{verbatim@processline}). % \begin{macrocode} \def\notabverbatim@processline{\the\verbatim@line\par} @@ -20787,13 +26002,13 @@ % \begin{macro}{\verbatim@startline} % \begin{macro}{\verbatim@addtoline} % \begin{macro}{\verbatim@processline} -% |\verbatim@startline| initializes processing of a line -% by emptying the character buffer (|\verbatim@line|). +% \cs{verbatim@startline} initializes processing of a line +% by emptying the character buffer (\cs{verbatim@line}). % \begin{macrocode} \def\verbatim@startline{\verbatim@line{}} % \end{macrocode} -% |\verbatim@addtoline| adds the tokens in its argument -% to our buffer register |\verbatim@line| without expanding +% \cs{verbatim@addtoline} adds the tokens in its argument +% to our buffer register \cs{verbatim@line} without expanding % them. % \begin{macrocode} \def\verbatim@addtoline#1{% @@ -20802,12 +26017,12 @@ % Processing a line inside a \texttt{verbatim} or \texttt{verbatim*} % environment means printing it. % Ending the line means that we have to begin a new paragraph. -% We use |\par| for this purpose. Note that |\par| -% is redefined in |\@verbatim| to force \TeX{} into horizontal +% We use \cs{par} for this purpose. Note that \cs{par} +% is redefined in \cs{@verbatim} to force \TeX{} into horizontal % mode and to insert an empty box so that empty lines in the input % do appear in the output. % (PW changed next line from \\ -% |\def\verbatim@processline{\the\verbatim@line\par}| +% \verb?\def\verbatim@processline{\the\verbatim@line\par}? % \begin{macrocode} \def\verbatim@processline{\notabverbatim@processline} % \end{macrocode} @@ -20816,24 +26031,24 @@ % \end{macro} % % \begin{macro}{\verbatim@finish} -% As a default, |\verbatim@finish| processes the remaining +% As a default, \cs{verbatim@finish} processes the remaining % characters. % When this macro is called we are facing the following problem: -% when the |\end{verbatim}| -% command is encountered |\verbatim@processline| is called +% when the \verb?\end{verbatim}? +% command is encountered \cs{verbatim@processline} is called % to process the characters preceding the command on the same % line. If there are none, an empty line would be output if we % did not check for this case. % -% If the line is empty |\the\verbatim@line| expands to +% If the line is empty \verb?\the\verbatim@line? expands to % nothing. To test this we use a trick similar to that on p.\ 376 -% of the \TeX{}book, but with |$|\ldots|$| instead of -% the |!| tokens. These |$| tokens can never have the same -% category code as a |$| token that might possibly appear in the -% token register |\verbatim@line|, as such a token will always have +% of the \TeX{}book, but with \verb?$?\ldots\verb?|$? instead of +% the \verb?!? tokens. These \verb?$? tokens can never have the same +% category code as a \verb?$? token that might possibly appear in the +% token register \cs{verbatim@line}, as such a token will always have % been read with category code $12$ (other). -% Note that |\ifcat| expands the following tokens so that -% |\the\verbatim@line| is replaced by the accumulated +% Note that \cs{ifcat} expands the following tokens so that +% \verb?\the\verbatim@line? is replaced by the accumulated % characters % \begin{macrocode} \def\verbatim@finish{\ifcat$\the\verbatim@line$\else @@ -20845,11 +26060,11 @@ % \subsubsection{The \texttt{verbatim} and \texttt{verbatim*} environments} % % \begin{macro}{\verbatim@font} -% We start by defining the macro |\verbatim@font| that is +% We start by defining the macro \cs{verbatim@font} that is % to select the font and to set font-dependent parameters. -% Then we go through |\verbatim@nolig@list| to avoid +% Then we go through \cs{verbatim@nolig@list} to avoid % certain ligatures. -% |\verbatim@nolig@list| is a macro defined in the \LaTeXe{} kernel +% \cs{verbatim@nolig@list} is a macro defined in the \LaTeXe{} kernel % to expand to % \begin{verbatim} % \do\`\do\<\do\>\do\,\do\'\do\- @@ -20886,11 +26101,11 @@ % % % \begin{macro}{\@verbatim} -% The macro |\@verbatim| sets up things properly. -% First of all, the tokens of the |\every@verbatim| hook +% The macro \cs{@verbatim} sets up things properly. +% First of all, the tokens of the \cs{every@verbatim} hook % are inserted. % Then a \texttt{trivlist} environment is started and its first -% |\item| command inserted. +% \cs{item} command inserted. % Each line of the \texttt{verbatim} or \texttt{verbatim*} % environment will be treated as a separate paragraph. % \begin{macrocode} @@ -20898,9 +26113,9 @@ \trivlist \item \relax % \end{macrocode} % The following extra vertical space is for compatibility with the -% \LaTeX kernel: otherwise, using the |verbatim| package changes -% the vertical spacing of a |verbatim| environment nested within a -% |quote| environment. +% \LaTeX kernel: otherwise, using the \Lpack{verbatim} package changes +% the vertical spacing of a \texttt{verbatim} environment nested within a +% \texttt{quote} environment. % \begin{macrocode} \if@minipage\else\vskip\parskip\fi % \end{macrocode} @@ -20916,35 +26131,35 @@ \parindent\z@\parfillskip\@flushglue\parskip\z@ % \end{macrocode} % There's one point to make here: -% the \texttt{list} environment uses \TeX's |\parshape| +% the \texttt{list} environment uses \TeX's \cs{parshape} % primitive to get a special indentation for the first line % of the list. % If the list begins with a \texttt{verbatim} environment -% this |\parshape| is still in effect. +% this \cs{parshape} is still in effect. % Therefore we have to reset this internal parameter explicitly. -% We could do this by assigning $0$ to |\parshape|. +% We could do this by assigning $0$ to \cs{parshape}. % However, there is a simpler way to achieve this: % we simply tell \TeX{} to start a new paragraph. % As is explained on p.~103 of the \TeX{}book, this resets -% |\parshape| to zero. +% \cs{parshape} to zero. % \begin{macrocode} \@@par % \end{macrocode} -% We now ensure that |\par| has the correct definition, +% We now ensure that \cs{par} has the correct definition, % namely to force \TeX{} into horizontal mode % and to include an empty box. % This is to ensure that empty lines do appear in the output. -% Afterwards, we insert the |\interlinepenalty| since \TeX{} +% Afterwards, we insert the \cs{interlinepenalty} since \TeX{} % does not add a penalty between paragraphs (here: lines) -% by its own initiative. Otherwise a |verbatim| environment -% could be broken across pages even if a |\samepage| +% by its own initiative. Otherwise a \texttt{verbatim} environment +% could be broken across pages even if a \cs{samepage} % declaration were present. % % However, in a top-aligned minipage, this will result in an extra % empty line added at the top. Therefore, a slightly more % complicated construct is necessary. % One of the important things here is the inclusion of -% |\leavevmode| as the first macro in the first line, for example, +% \cs{leavevmode} as the first macro in the first line, for example, % a blank verbatim line is the first thing in a list item. % \begin{macrocode} \def\par{% @@ -20956,12 +26171,12 @@ \fi}% % \end{macrocode} % But to avoid an error message when the environment -% doesn't contain any text, we redefine |\@noitemerr| -% which will in this case be called by |\endtrivlist|. +% doesn't contain any text, we redefine \cs{@noitemerr} +% which will in this case be called by \cs{endtrivlist}. % \begin{macrocode} \def\@noitemerr{\@warning{No verbatim text}}% % \end{macrocode} -% Now we call |\obeylines| to make the end of line character +% Now we call \cs{obeylines} to make the end of line character % active, % \begin{macrocode} \obeylines @@ -20976,11 +26191,11 @@ \verbatim@font % \end{macrocode} % To avoid a breakpoint after the labels box, we remove the penalty -% put there by the list macros: another use of |\unpenalty|! +% put there by the list macros: another use of \cs{unpenalty}! % \begin{macrocode} \everypar \expandafter{\the\everypar \unpenalty}% % \end{macrocode} -% PW added next code at end of |\@verbatim|. +% PW added next code at end of \cs{@verbatim}. % \begin{macrocode} \wrapright\the\afterevery@verbatim} % \end{macrocode} @@ -20990,21 +26205,21 @@ % \begin{macro}{\verbatim} % \begin{macro}{\verbatim*} % Now we define the toplevel macros. -% |\verbatim| is slightly changed: +% \cs{verbatim} is slightly changed: % after setting up things properly it calls -% |\verbatim@start|. -% This is done inside a group, so that |\verbatim| can be used -% directly, without |\begin|. +% \cs{verbatim@start}. +% This is done inside a group, so that \cs{verbatim} can be used +% directly, without \cs{begin}. % % PW. The following is the original code, but I want a version of -% |verbatim| that recognises TABs. +% \texttt{verbatim} that recognises TABs. % \begin{verbatim} % \begin{macrocode} % \def\verbatim{% % \begingroup\@verbatim \frenchspacing\@vobeyspaces % \verbatim@start} % \end{macrocode} -% |\verbatim*| is defined accordingly. +% \cs{verbatim*} is defined accordingly. % \begin{macrocode} % \@namedef{verbatim*}{\begingroup\@verbatim\verbatim@start} % \def\endverbatim{\endtrivlist\endgroup} @@ -21034,7 +26249,7 @@ % \begin{macro}{\endverbatim*} % To end the \texttt{verbatim} and \texttt{verbatim*} % environments it is only necessary to finish the -% \texttt{trivlist} environment started in |\@verbatim| and +% \texttt{trivlist} environment started in \cs{@verbatim} and % close the corresponding group, and handle\footnote{Noted by % Zarko Cucej (\url{zarko.cucej@uni-mb.si}).} following (non-) paragraph, % by using \cs{@doendpe}. @@ -21049,27 +26264,37 @@ % \end{macro} % \end{macro} % +% For abnormal \cs{parskip}s the NTG class included the following, but I'm +% not sure if it is relevant here, but if it is just how it should be included. +% \begin{verbatim} +% From NTG, where it is a \cs{def} +% \providecommand*{\verbatim}{% +% \topsep=-0.5\parskip +% \@verbatim +% \frenchspacing\@vobeyspaces \@xverbatim} +% \end{verbatim} +% % % \subsubsection{The \texttt{comment} environment} % -% The |\comment| macro is similar to |\verbatim*|. +% The \cs{comment} macro is similar to \cs{verbatim*}. % However, we do not need to switch fonts or set special -% formatting parameters such as |\parindent| or |\parskip|. +% formatting parameters such as \cs{parindent} or \cs{parskip}. % We need only set the category code of all special characters -% to $12$ (other) and that of |^^M| (the end of line character) +% to $12$ (other) and that of \verb?^^M? (the end of line character) % to $13$ (active). % The latter is needed for macro parameter delimiter matching in % the internal macros defined below. % In contrast to the default definitions used by the -% |\verbatim| and |\verbatim*| macros, -% we define |\verbatim@addtoline| to throw away its argument -% and |\verbatim@processline|, |\verbatim@startline|, -% and |\verbatim@finish| to act as no-ops. -% Then we call |\verbatim@|. -% But the first thing we do is to call |\@bsphack| so that +% \cs{verbatim} and \cs{verbatim*} macros, +% we define \cs{verbatim@addtoline} to throw away its argument +% and \cs{verbatim@processline}, \cs{verbatim@startline}, +% and \cs{verbatim@finish} to act as no-ops. +% Then we call \cs{verbatim@}. +% But the first thing we do is to call \cs{@bsphack} so that % this environment has no influence whatsoever upon the spacing. % -% PW: This is the original code for the |comment| environment, +% PW: This is the original code for the \texttt{comment} environment, % which I'm going to change. % \begin{verbatim} % \def\comment{\@bsphack @@ -21080,9 +26305,9 @@ % \let\verbatim@finish\relax % \verbatim@} % \end{verbatim} -% |\endcomment| is very simple: it only calls -% |\@esphack| to take care of the spacing. -% The |\end| macro closes the group and therefore takes care +% \cs{endcomment} is very simple: it only calls +% \cs{@esphack} to take care of the spacing. +% The \cs{end} macro closes the group and therefore takes care % of restoring everything we changed. % \begin{verbatim} % \let\endcomment=\@esphack @@ -21091,7 +26316,7 @@ % PW: The remainder of this section is my code. % % \begin{macro}{\setupcomment} -% |\setupcomment| does all the |\let|s in the original |\comment| code. +% \cs{setupcomment} does all the \cs{let}s in the original \cs{comment} code. % \begin{macrocode} \newcommand{\setupcomment}{% \let\do\@makeother\dospecials\catcode`\^^M\active @@ -21106,7 +26331,7 @@ % previously. It's `user beware' time. % % \begin{macro}{\newcomment} -% |\newcomment|\marg{name} creates a new comment environment called +% \cs{newcomment}\marg{name} creates a new comment environment called % \meta{name}. This is a generalisation of the original comment code. % \begin{macrocode} \newcommand{\newcomment}[1]{% @@ -21116,7 +26341,7 @@ % \end{macro} % % \begin{macro}{\commentsoff} -% |\commentsoff|\marg{name} switches off the \meta{name} comment +% \cs{commentsoff}\marg{name} switches off the \meta{name} comment % environment by defining the relevent macros to do nothing. % \begin{macrocode} \newcommand{\commentsoff}[1]{% @@ -21126,46 +26351,46 @@ % \end{macro} % % \begin{macro}{\commentson} -% |\commentson|\marg{name} switches on the \meta{name} comment -% environment. It has to do the same things as |\newcomment| does, -% so let |\newcomment| do the work. +% \cs{commentson}\marg{name} switches on the \meta{name} comment +% environment. It has to do the same things as \cs{newcomment} does, +% so let \cs{newcomment} do the work. % \begin{macrocode} \newcommand{\commentson}[1]{\newcomment{#1}} % \end{macrocode} % \end{macro} % -% We had better supply the |comment| environment, as promised. +% We had better supply the \texttt{comment} environment, as promised. % \begin{macrocode} \newcomment{comment} % \end{macrocode} % % PW: That is the end of my changes and extensions to the original -% |comment| environment code. +% \texttt{comment} environment code. % % % \subsubsection{The main loop} % % Here comes the tricky part: % During the definition of the macros we need to use the special -% characters |\|, |{|, and |}| not only with their +% characters \verb?\?, \verb?{?, and \verb?}? not only with their % normal category codes, % but also with category code $12$ (other). % We achieve this by the following trick: -% first we tell \TeX{} that |\|, |{|, and |}| -% are the lowercase versions of |!|, |[|, and |]|. -% Then we replace every occurrence of |\|, |{|, and |}| -% that should be read with category code $12$ by |!|, |[|, -% and |]|, respectively, -% and give the whole list of tokens to |\lowercase|, +% first we tell \TeX{} that \verb?\?, \verb?{?, and \verb?}? +% are the lowercase versions of \verb?!?, \verb?[?, and \verb?]?. +% Then we replace every occurrence of \verb?\?, \verb?{?, and \verb?}? +% that should be read with category code $12$ by \verb?!?, \verb?[?, +% and \verb?]?, respectively, +% and give the whole list of tokens to \cs{lowercase}, % knowing that category codes are not altered by this primitive! % % But first we have ensure that -% |!|, |[|, and |]| themselves have +% \verb?!?, \verb?[?, and \verb?]? themselves have % the correct category code! % To allow special settings of these codes we hide their setting in -% the macro |\vrb@catcodes|. If it is already defined our new +% the macro \cs{vrb@catcodes}. If it is already defined our new % definition is skipped. % \begin{macrocode} \@ifundefined{vrb@catcodes}% @@ -21181,13 +26406,13 @@ \vrb@catcodes \lccode`\!=`\\ \lccode`\[=`\{ \lccode`\]=`\} % \end{macrocode} -% We also need the end-of-line character |^^M|, +% We also need the end-of-line character \verb?^^M?, % as an active character. -% If we were to simply write |\catcode`\^^M=\active| +% If we were to simply write \verb?\catcode`\^^M=\active? % then we would get an unwanted active end of line character % at the end of every line of the following macro definitions. % Therefore we use the same trick as above: -% we write a tilde |~| instead of |^^M| and +% we write a tilde \verb?~? instead of \verb?^^M? and % pretend that the % latter is the lowercase variant of the former. % Thus we have to ensure now that the tilde character has @@ -21195,127 +26420,127 @@ % \begin{macrocode} \catcode`\~=\active \lccode`\~=`\^^M % \end{macrocode} -% The use of the |\lowercase| primitive leads to one problem: -% the uppercase character `|C|' needs to be used in the +% The use of the \cs{lowercase} primitive leads to one problem: +% the uppercase character `\texttt{C}' needs to be used in the % code below and its case must be preserved. % So we add the command: % \begin{macrocode} \lccode`\C=`\C % \end{macrocode} -% Now we start the token list passed to |\lowercase|. +% Now we start the token list passed to \cs{lowercase}. % We use the following little trick (proposed by Bernd Raichle): -% The very first token in the token list we give to |\lowercase| is -% the |\endgroup| primitive. This means that it is processed by -% \TeX{} immediately after |\lowercase| has finished its operation, -% thus ending the group started by |\begingroup| above. This avoids +% The very first token in the token list we give to \cs{lowercase} is +% the \cs{endgroup} primitive. This means that it is processed by +% \TeX{} immediately after \cs{lowercase} has finished its operation, +% thus ending the group started by \cs{begingroup} above. This avoids % the global definition of all macros. % \begin{macrocode} \lowercase{\endgroup % \end{macrocode} % \begin{macro}{\verbatim@start} -% The purpose of |\verbatim@start| is to check whether there -% are any characters on the same line as the |\begin{verbatim}| +% The purpose of \cs{verbatim@start} is to check whether there +% are any characters on the same line as the \verb?\begin{verbatim}? % and to pretend that they were on a line by themselves. % On the other hand, if there are no characters remaining % on the current line we shall just find an end of line character. -% |\verbatim@start| performs its task by first grabbing the +% \cs{verbatim@start} performs its task by first grabbing the % following character (its argument). -% This argument is then compared to an active |^^M|, +% This argument is then compared to an active \verb?^^M?, % the end of line character. % \begin{macrocode} \def\verbatim@start#1{% \verbatim@startline \if\noexpand#1\noexpand~% % \end{macrocode} -% If this is true we transfer control to |\verbatim@| +% If this is true we transfer control to \cs{verbatim@} % to process the next line. We use -% |\next| as the macro which will continue the work. +% \cs{next} as the macro which will continue the work. % \begin{macrocode} \let\next\verbatim@ % \end{macrocode} -% Otherwise, we define |\next| to expand to a call -% to |\verbatim@| followed by the character just +% Otherwise, we define \cs{next} to expand to a call +% to \cs{verbatim@} followed by the character just % read so that it is reinserted into the text. % This means that those characters remaining on this line % are handled as if they formed a line by themselves. % \begin{macrocode} \else \def\next{\verbatim@#1}\fi % \end{macrocode} -% Finally we call |\next|. +% Finally we call \cs{next}. % \begin{macrocode} \next}% % \end{macrocode} % \end{macro} % % \begin{macro}{\verbatim@} -% The three macros |\verbatim@|, |\verbatim@@|, -% and |\verbatim@@@| form the ``main loop'' of the +% The three macros \cs{verbatim@}, \cs{verbatim@@}, +% and \cs{verbatim@@@} form the ``main loop'' of the % \texttt{verbatim} environment. -% The purpose of |\verbatim@| is to read exactly one line +% The purpose of \cs{verbatim@} is to read exactly one line % of input. -% |\verbatim@@| and |\verbatim@@@| work together to +% \cs{verbatim@@} and \cs{verbatim@@@} work together to % find out whether the four characters -% |\end| (all with category code $12$ (other)) occur in that +% \cs{end} (all with category code $12$ (other)) occur in that % line. -% If so, |\verbatim@@@| will call -% |\verbatim@test| to check whether this |\end| is -% part of |\end{verbatim}| and will terminate the environment +% If so, \cs{verbatim@@@} will call +% \cs{verbatim@test} to check whether this \cs{end} is +% part of \verb?\end{verbatim}? and will terminate the environment % if this is the case. % Otherwise we continue as if nothing had happened. -% So let's have a look at the definition of |\verbatim@|: +% So let's have a look at the definition of \cs{verbatim@}: % \begin{macrocode} \def\verbatim@#1~{\verbatim@@#1!end\@nil}% % \end{macrocode} -% Note that the |!| character will have been replaced by a -% |\| with category code $12$ (other) by the |\lowercase| +% Note that the \verb?!? character will have been replaced by a +% \verb?\? with category code $12$ (other) by the \cs{lowercase} % primitive governing this code before the definition of this % macro actually takes place. % That means that -% it takes the line, puts |\end| (four character tokens) -% and |\@nil| (one control sequence token) as a +% it takes the line, puts \cs{end} (four character tokens) +% and \cs{@nil} (one control sequence token) as a % delimiter behind it, and -% then calls |\verbatim@@|. +% then calls \cs{verbatim@@}. % \end{macro} % % \begin{macro}{\verbatim@@} -% |\verbatim@@| takes everything up to the next occurrence of -% the four characters |\end| as its argument. +% \cs{verbatim@@} takes everything up to the next occurrence of +% the four characters \cs{end} as its argument. % \begin{macrocode} \def\verbatim@@#1!end{% % \end{macrocode} % That means: if they do not occur in the original line, then -% argument |#1| is the -% whole input line, and |\@nil| is the next token +% argument \verb?#1? is the +% whole input line, and \cs{@nil} is the next token % to be processed. -% However, if the four characters |\end| are part of the +% However, if the four characters \cs{end} are part of the % original line, then -% |#1| consists of the characters in front of |\end|, +% \verb?#1? consists of the characters in front of \cs{end}, % and the next token is the following character (always remember % that the line was lengthened by five tokens). -% Whatever |#1| may be, it is verbatim text, -% so |#1| is added to the line currently built. +% Whatever \verb?#1? may be, it is verbatim text, +% so \verb?#1? is added to the line currently built. % \begin{macrocode} \verbatim@addtoline{#1}% % \end{macrocode} % The next token in the input stream % is of special interest to us. -% Therefore |\futurelet| defines |\next| to be equal -% to it before calling |\verbatim@@@|. +% Therefore \cs{futurelet} defines \cs{next} to be equal +% to it before calling \cs{verbatim@@@}. % \begin{macrocode} \futurelet\next\verbatim@@@}% % \end{macrocode} % \end{macro} % % \begin{macro}{\verbatim@@@} -% |\verbatim@@@| will now read the rest of the tokens on +% \cs{verbatim@@@} will now read the rest of the tokens on % the current line, -% up to the final |\@nil| token. +% up to the final \cs{@nil} token. % \begin{macrocode} \def\verbatim@@@#1\@nil{% % \end{macrocode} % If the first of the above two cases occurred, i.e.\ no -% |\end| characters were on that line, |#1| is empty -% and |\next| is equal to |\@nil|. +% \cs{end} characters were on that line, \verb?#1? is empty +% and \cs{next} is equal to \cs{@nil}. % This is easily checked. % \begin{macrocode} \ifx\next\@nil @@ -21328,22 +26553,22 @@ \verbatim@startline \let\next\verbatim@ % \end{macrocode} -% Otherwise we have to check what follows these |\end| +% Otherwise we have to check what follows these \cs{end} % tokens. % \begin{macrocode} \else % \end{macrocode} % Before we continue, it's a good idea to stop for a moment % and remember where we are: -% We have just read the four character tokens |\end| +% We have just read the four character tokens \cs{end} % and must now check whether the name of the environment (surrounded % by braces) follows. -% To this end we define a macro called |\@tempa| +% To this end we define a macro called \cs{@tempa} % that reads exactly one character and decides what to do next. % This macro should do the following: skip spaces until % it encounters either a left brace or the end of the line. % But it is important to remember which characters are skipped. -% The |\end|\meta{optional spaces}|{| characters +% The \cs{end}\meta{optional spaces}\verb?{? characters % may be part of the verbatim text, i.e.\ these characters % must be printed. % @@ -21356,43 +26581,43 @@ % it has read the right brace. % Therefore we need a way to accumulate the characters read % so that we can reinsert them if necessary. -% The token register |\@temptokena| is used for this purpose. +% The token register \cs{@temptokena} is used for this purpose. % % Before we do this we have to get rid of the superfluous -% |\end| tokens at the end of the line. +% \cs{end} tokens at the end of the line. % To this end we define a temporary macro whose argument -% is delimited by |\end\@nil| (four character tokens +% is delimited by \verb?\end\@nil? (four character tokens % and one control sequence token) to be used below -% on the rest of the line, after appending a |\@nil| token to it. -% (Note that this token can never appear in |#1|.) +% on the rest of the line, after appending a \cs{@nil} token to it. +% (Note that this token can never appear in \verb?#1?.) % We use the following definition of -% |\@tempa| to get the rest of the line (after the first -% |\end|). +% \cs{@tempa} to get the rest of the line (after the first +% \cs{end}). % \begin{macrocode} \def\@tempa##1!end\@nil{##1}% % \end{macrocode} % We mentioned already that we use token register -% |\@temptokena| +% \cs{@temptokena} % to remember the characters we skip, in case we need them again. -% We initialize this with the |\end| we have thrown away -% in the call to |\@tempa|. +% We initialize this with the \cs{end} we have thrown away +% in the call to \cs{@tempa}. % \begin{macrocode} \@temptokena{!end}% % \end{macrocode} -% We shall now call |\verbatim@test| +% We shall now call \cs{verbatim@test} % to process the characters % remaining on the current line. % But wait a moment: we cannot simply call this macro % since we have already read the whole line. -% Therefore we have to first expand the macro |\@tempa| to insert -% them again after the |\verbatim@test| token. -% A |^^M| character is appended to denote the end of the line. +% Therefore we have to first expand the macro \cs{@tempa} to insert +% them again after the \cs{verbatim@test} token. +% A \verb?^^M? character is appended to denote the end of the line. % (Remember that this character comes disguised as a tilde.) % \begin{macrocode} \def\next{\expandafter\verbatim@test\@tempa#1\@nil~}% % \end{macrocode} % That's almost all, but we still have to -% now call |\next| to do the work. +% now call \cs{next} to do the work. % \begin{macrocode} \fi \next}% % \end{macrocode} @@ -21400,12 +26625,12 @@ % % % \begin{macro}{\verbatim@test} -% We define |\verbatim@test| to investigate every token +% We define \cs{verbatim@test} to investigate every token % in turn. % \begin{macrocode} \def\verbatim@test#1{% % \end{macrocode} -% First of all we set |\next| equal to |\verbatim@test| +% First of all we set \cs{next} equal to \cs{verbatim@test} % in case this macro must call itself recursively in order to % skip spaces. % \begin{macrocode} @@ -21413,20 +26638,20 @@ % \end{macrocode} % We have to distinguish four cases: % \begin{enumerate} -% \item The next token is a |^^M|, i.e.\ we reached +% \item The next token is a \verb?^^M?, i.e.\ we reached % the end of the line. That means that nothing % special was found. -% Note that we use |\if| for the following +% Note that we use \cs{if} for the following % comparisons so that the category code of the % characters is irrelevant. % \begin{macrocode} \if\noexpand#1\noexpand~% % \end{macrocode} % We add the characters accumulated in token register -% |\@temptokena| to the current line. Since -% |\verbatim@addtoline| does not expand its argument, +% \cs{@temptokena} to the current line. Since +% \cs{verbatim@addtoline} does not expand its argument, % we have to do the expansion at this point. Then we -% |\let| |\next| equal to |\verbatim@| +% \cs{let} \cs{next} equal to \cs{verbatim@} % to prepare to read the next line. % \begin{macrocode} \expandafter\verbatim@addtoline @@ -21436,7 +26661,7 @@ \let\next\verbatim@ % \end{macrocode} % \item A space character follows. -% This is allowed, so we add it to |\@temptokena| +% This is allowed, so we add it to \cs{@temptokena} % and continue. % \begin{macrocode} \else \if\noexpand#1 @@ -21446,24 +26671,24 @@ % This is the most interesting case. % We must now collect characters until we read the closing % brace and check whether they form the environment name. -% This will be done by |\verbatim@testend|, so here -% we let |\next| equal this macro. +% This will be done by \cs{verbatim@testend}, so here +% we let \cs{next} equal this macro. % Again we will process the rest of the line, character % by character. % The characters forming the name of the environment will -% be accumulated in |\@tempc|. +% be accumulated in \cs{@tempc}. % We initialize this macro to expand to nothing. % \begin{macrocode} \else \if\noexpand#1\noexpand[% \let\@tempc\@empty \let\next\verbatim@testend % \end{macrocode} -% Note that the |[| character will be a |{| when +% Note that the \verb?[? character will be a \verb?{? when % this macro is defined. -% \item Any other character means that the |\end| was part +% \item Any other character means that the \cs{end} was part % of the verbatim text. % Add the characters to the current line and prepare to call -% |\verbatim@| to process the rest of the line. +% \cs{verbatim@} to process the rest of the line. % \begin{macrocode} \else \expandafter\verbatim@addtoline @@ -21472,7 +26697,7 @@ \fi\fi\fi % \end{macrocode} % \end{enumerate} -% The last thing this macro does is to call |\next| +% The last thing this macro does is to call \cs{next} % to continue processing. % \begin{macrocode} \next}% @@ -21480,26 +26705,26 @@ % \end{macro} % % \begin{macro}{\verbatim@testend} -% |\verbatim@testend| is called when -% |\end|\meta{optional spaces}|{| was seen. -% Its task is to scan everything up to the next |}| -% and to call |\verbatim@@testend|. -% If no |}| is found it must reinsert the characters it read -% and return to |\verbatim@|. +% \cs{verbatim@testend} is called when +% \cs{end}\meta{optional spaces}\verb?{? was seen. +% Its task is to scan everything up to the next \verb?}? +% and to call \cs{verbatim@@testend}. +% If no \verb?}? is found it must reinsert the characters it read +% and return to \cs{verbatim@}. % The following definition is similar to that of -% |\verbatim@test|: +% \cs{verbatim@test}: % it takes the next character and decides what to do. % \begin{macrocode} \def\verbatim@testend#1{% % \end{macrocode} % Again, we have four cases: % \begin{enumerate} -% \item |^^M|: As no |}| is found in the current line, +% \item \verb?^^M?: As no \verb?}? is found in the current line, % add the characters to the buffer. To avoid a % complicated construction for expanding -% |\@temptokena| -% and |\@tempc| we do it in two steps. Then we -% continue with |\verbatim@| to process the +% \cs{@temptokena} +% and \cs{@tempc} we do it in two steps. Then we +% continue with \cs{verbatim@} to process the % next line. % \begin{macrocode} \if\noexpand#1\noexpand~% @@ -21511,21 +26736,21 @@ \verbatim@startline \let\next\verbatim@ % \end{macrocode} -% \item |}|: Call |\verbatim@@testend| to check +% \item \verb?}?: Call \cs{verbatim@@testend} to check % if this is the right environment name. % \begin{macrocode} \else\if\noexpand#1\noexpand]% \let\next\verbatim@@testend % \end{macrocode} -% \item |\|: This character must not occur in the name of +% \item \verb?\?: This character must not occur in the name of % an environment. Thus we stop collecting characters. % In principle, the same argument would apply to other -% characters as well, e.g., |{|. -% However, |\| is a special case, since it may be -% the first character of |\end|. This means that +% characters as well, e.g., \verb?{?. +% However, \verb?\? is a special case, since it may be +% the first character of \cs{end}. This means that % we have to look again for -% |\end{|\meta{environment name}|}|. -% Note that we prefixed the |!| by a |\noexpand| +% \cs{end}\marg{environment name} +% Note that we prefixed the \verb?!? by a \cs{noexpand} % primitive, to protect ourselves against it being an % active character. % \begin{macrocode} @@ -21537,7 +26762,7 @@ \def\next{\verbatim@!}% % \end{macrocode} % \item Any other character: collect it and continue. -% We cannot use |\edef| to define |\@tempc| +% We cannot use \cs{edef} to define \cs{@tempc} % since its replacement text might contain active % character tokens. % \begin{macrocode} @@ -21553,32 +26778,32 @@ % \end{macro} % % \begin{macro}{\verbatim@@testend} -% Unlike the previous macros |\verbatim@@testend| is simple: -% it has only to check if the |\end{|\ldots|}| -% matches the corresponding |\begin{|\ldots|}|. +% Unlike the previous macros \cs{verbatim@@testend} is simple: +% it has only to check if the \cs{end}\marg{...} +% matches the corresponding \cs{begin}\marg{...} % \begin{macrocode} \def\verbatim@@testend{% % \end{macrocode} -% We use |\next| again to define the things that are +% We use \cs{next} again to define the things that are % to be done. % Remember that the name of the current environment is -% held in |\@currenvir|, the characters accumulated -% by |\verbatim@testend| are in |\@tempc|. +% held in \cs{@currenvir}, the characters accumulated +% by \cs{verbatim@testend} are in \cs{@tempc}. % So we simply compare these and prepare to execute -% |\end{|\meta{current environment}|}| +% \cs{end}\marg{current environment} % macro if they match. -% Before we do this we call |\verbatim@finish| to process +% Before we do this we call \cs{verbatim@finish} to process % the last line. -% We define |\next| via |\edef| so that -% |\@currenvir| is replaced by its expansion. -% Therefore we need |\noexpand| to inhibit the expansion -% of |\end| at this point. +% We define \cs{next} via \cs{edef} so that +% \cs{@currenvir} is replaced by its expansion. +% Therefore we need \cs{noexpand} to inhibit the expansion +% of \cs{end} at this point. % \begin{macrocode} \ifx\@tempc\@currenvir \verbatim@finish \edef\next{\noexpand\end{\@currenvir}% % \end{macrocode} -% Without this trick the |\end| command would not be able +% Without this trick the \cs{end} command would not be able % to correctly check whether its argument matches the name of % the current environment and you'd get an % interesting \LaTeX{} error message such as: @@ -21587,20 +26812,20 @@ %\end{verbatim} % But what do we do with the rest of the characters, those % that remain on that line? -% We call |\verbatim@rescan| to take care of that. +% We call \cs{verbatim@rescan} to take care of that. % Its first argument is the name of the environment just % ended, in case we need it again. -% |\verbatim@rescan| takes the list of characters to be +% \cs{verbatim@rescan} takes the list of characters to be % reprocessed as its second argument. % (This token list was inserted after the current macro -% by |\verbatim@@@|.) -% Since we are still in an |\edef| we protect it -% by means of|\noexpand|. +% by \cs{verbatim@@@}.) +% Since we are still in an \cs{edef} we protect it +% by means of\cs{noexpand}. % \begin{macrocode} \noexpand\verbatim@rescan{\@currenvir}}% % \end{macrocode} % If the names do not match, we reinsert everything read up -% to now and prepare to call |\verbatim@| to process +% to now and prepare to call \cs{verbatim@} to process % the rest of the line. % \begin{macrocode} \else @@ -21611,15 +26836,15 @@ \let\next\verbatim@ \fi % \end{macrocode} -% Finally we call |\next|. +% Finally we call \cs{next}. % \begin{macrocode} \next}% % \end{macrocode} % \end{macro} % % \begin{macro}{\verbatim@rescan} -% In principle |\verbatim@rescan| could be used to -% analyse the characters remaining after the |\end{...}| +% In principle \cs{verbatim@rescan} could be used to +% analyse the characters remaining after the \verb?\end{...}? % command and pretend that these were read % ``properly'', assuming ``standard'' category codes are in % force.\footnote{Remember that they were all read with @@ -21630,27 +26855,27 @@ % Besides, we think that this is not worth the effort: % After a \texttt{verbatim} or \texttt{verbatim*} environment % a new line in the output is begun anyway, -% and an |\end{comment}| can easily be put on a line by itself. +% and an \verb?\end{comment}? can easily be put on a line by itself. % So there is no reason why there should be any text here. % For the benefit of the user who did put something there % (a comment, perhaps) % we simply issue a warning and drop them. % The method of testing is explained in Appendix~D, p.\ 376 of -% the \TeX{}book. We use |^^M| instead of the |!| +% the \TeX{}book. We use \verb?^^M? instead of the \verb?!? % character used there -% since this is a character that cannot appear in |#1|. -% The two |\noexpand| primitives are necessary to avoid +% since this is a character that cannot appear in \verb?#1?. +% The two \cs{noexpand} primitives are necessary to avoid % expansion of active characters and macros. % % One extra subtlety should be noted here: remember that % the token list we are currently building will first be -% processed by the |\lowercase| primitive before \TeX{} +% processed by the \cs{lowercase} primitive before \TeX{} % carries out the definitions. -% This means that the `|C|' character in the -% argument to the |\@warning| macro must be protected against -% being changed to `|c|'. That's the reason why we added the -% |\lccode`\C=`\C| assignment above. -% We can now finish the argument to |\lowercase| as well as the +% This means that the `\texttt{C}' character in the +% argument to the \cs{@warning} macro must be protected against +% being changed to `\texttt{c}'. That's the reason why we added the +% \verb?\lccode`\C=`\C? assignment above. +% We can now finish the argument to \cs{lowercase} as well as the % group in which the category codes were changed. % \begin{macrocode} \def\verbatim@rescan#1#2~{\if\noexpand~\noexpand#2~\else @@ -21669,8 +26894,8 @@ % \end{macro} % % \begin{macro}{\verbatim@readfile} -% The macro |\verbatim@readfile| encloses the main loop by calls to -% the macros |\verbatim@startline| and |\verbatim@finish|, +% The macro \cs{verbatim@readfile} encloses the main loop by calls to +% the macros \cs{verbatim@startline} and \cs{verbatim@finish}, % respectively. This makes sure % that the user can initialize and finish the command when the file % is empty or doesn't exist. The \texttt{verbatim} environment has a @@ -21686,12 +26911,12 @@ \typeout{No file #1.}% \else % \end{macrocode} -% At this point we pass the name of the file to |\@addtofilelist| -% so that its appears appears in the output of a |\listfiles| +% At this point we pass the name of the file to \cs{@addtofilelist} +% so that its appears appears in the output of a \cs{listfiles} % command. -% In addition, we use |\ProvidesFile| to make a log entry in the +% In addition, we use \cs{ProvidesFile} to make a log entry in the % transcript file and to distinguish files read in via -% |\verbatiminput| from others. +% \cs{verbatiminput} from others. % \begin{macrocode} \@addtofilelist{#1}% \ProvidesFile{#1}[(verbatim)]% @@ -21711,7 +26936,7 @@ % \end{macro} % % \begin{macro}{\verbatim@read@file} -% All the work is done in |\verbatim@read@file|. It reads the input +% All the work is done in \cs{verbatim@read@file}. It reads the input % file line by line and recursively calls itself until the end of % the file. % \begin{macrocode} @@ -21720,19 +26945,19 @@ \ifeof\verbatim@in@stream \else % \end{macrocode} -% For each line we call |\verbatim@addtoline| with the contents of +% For each line we call \cs{verbatim@addtoline} with the contents of % the line. \hskip0pt plus 3cm\penalty0\hskip0pt plus -3cm -% |\verbatim@processline| is called next. +% \cs{verbatim@processline} is called next. % \begin{macrocode} \expandafter\verbatim@addtoline\expandafter{\next}% \verbatim@processline % \end{macrocode} -% After processing the line we call |\verbatim@startline| to +% After processing the line we call \cs{verbatim@startline} to % initialize all before we read the next line. % \begin{macrocode} \verbatim@startline % \end{macrocode} -% Without |\expandafter| each call of |\verbatim@read@file| uses +% Without \cs{expandafter} each call of \cs{verbatim@read@file} uses % space in \TeX's input stack.\footnote{A standard \TeX\ would % report an overflow error if you try to read a file with more than % ca.\ 200~lines. The same error occurs if the first line of code @@ -21746,9 +26971,9 @@ % % % \begin{macro}{\verbatiminput} -% |\verbatiminput| first starts a group to keep font and category +% \cs{verbatiminput} first starts a group to keep font and category % changes local. -% Then it calls the macro |\verbatim@input| with additional +% Then it calls the macro \cs{verbatim@input} with additional % arguments, depending on whether an asterisk follows. % % PW. I added the TAB checking code. @@ -21763,23 +26988,23 @@ % \end{macro} % % \begin{macro}{\verbatim@input} -% |\verbatim@input| first checks whether the file exists, using -% the standard macro |\IfFileExists| which leaves the name of the -% file found in |\@filef@und|. -% Then everything is set up as in the |\verbatim| macro. +% \cs{verbatim@input} first checks whether the file exists, using +% the standard macro cs{IfFileExists} which leaves the name of the +% file found in \cs{@filef@und}. +% Then everything is set up as in the \cs{verbatim} macro. % \begin{macrocode} \def\verbatim@input#1#2{% \IfFileExists {#2}{\@verbatim #1\relax % \end{macrocode} % Then it reads in the file, finishes off the \texttt{trivlist} -% environment started by |\@verbatim| and closes the group. +% environment started by \cs{@verbatim} and closes the group. % This restores everything to its normal settings. % \begin{macrocode} \verbatim@readfile{\@filef@und}\endtrivlist\endgroup\@doendpe}% % \end{macrocode} % If the file is not found a more or less helpful message is -% printed. The final |\endgroup| is needed to close the group -% started in |\verbatiminput| above. +% printed. The final \cs{endgroup} is needed to close the group +% started in \cs{verbatiminput} above. % \begin{macrocode} {\typeout {No file #2.}\endgroup}} % \end{macrocode} @@ -21793,8 +27018,8 @@ % \begin{macro}{\verbatimindent} % \begin{macro}{\verbatimbreakchar} % \begin{macro}{\setverbatimbreak} -% The length |\verbatimindent| is the distance continuation lines are indented -% from the left margin. |\verbatimbreakchar| is the character to indicate +% The length \cs{verbatimindent} is the distance continuation lines are indented +% from the left margin. \cs{verbatimbreakchar} is the character to indicate % a wrapped line. % \begin{macrocode} \newlength{\verbatimindent} @@ -21811,31 +27036,44 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\raggedwrap} % \begin{macro}{\wrappingon} % \begin{macro}{\wrapright} % \begin{macro}{\wrappingoff} -% |\wrappingon| and |\wrappingoff| enable/prohibit wrapping. The -% default is |\wrappingoff|. +% \cs{wrappingon} and \cs{wrappingoff} enable/prohibit wrapping. The +% default is \cs{wrappingoff}. % % The macro -% |\wrapright| is used to set paragraph skips; without |\raggedright| lines -% may break at the first space \emph{outside} the text area -% \begin{macrocode} -\newcommand{\wrappingon}{% +% \cs{wrapright} is used to set paragraph skips; without raggedright the +% lines +% may break at the first space \emph{outside} the text area. However, +% Paul (\url{paulaugust2003@yahoo.com}) found that wrapped verbatims +% in a list (e.g., \texttt{itemize}) were not indented although regular +% verbatims were indented. \cs{raggedwrap} is a variation on \cs{raggedright} +% (\cs{leftskip} is set to \cs{@totalleftmargin} instead of 0pt), and seems +% to have fixed the problem with the original code which used +% \cs{raggedright}. +% \changes{v1.61803}{2008/01/30}{Added \cs{raggedwrap} (mempatch v4.4)} +% \begin{macrocode} +\newcommand*{\raggedwrap}{% + \@rightskip\@flushglue + \rightskip\@rightskip + \leftskip\@totalleftmargin + \parindent\ragrparindent} +\newcommand*{\wrappingon}{% \def\@xobeysp{~\discretionary{\verbatimbreakchar}% {\kern\verbatimindent}{}}% - \def\wrapright{\raggedright}% -} -\newcommand{\wrappingoff}{% + \def\wrapright{\raggedwrap}} +\newcommand*{\wrappingoff}{% \def\@xobeysp{\leavevmode\penalty\@M\ }% - \def\wrapright{}% -} + \def\wrapright{}} \wrappingoff % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % % \subsection{Writing and boxing verbatim} @@ -21874,7 +27112,7 @@ % % \begin{environment}{fboxverbatim} % \texttt{fboxverbatim} puts the contents of a verbatim environment -% in a framing box. (PW: This was originally called |boxedverbatim|). +% in a framing box. (PW: This was originally called \texttt{boxedverbatim}). % % (Written by Victor Eijkhout.) % @@ -21916,7 +27154,7 @@ \egroup % \end{macrocode} % -% To change the code for centring, the next line needs a spot of +% To change the code for centering, the next line needs a spot of % hacking. % % \begin{macrocode} @@ -21929,7 +27167,7 @@ % % \subsection{The shortvrb package} % -% The following is the \Lpack{shortvrb} package code (from |doc.dtx| +% The following is the \Lpack{shortvrb} package code (from \texttt{doc.dtx} % by Frank Mittelbach). It has been so useful to me that I wanted % to include it in the class. % @@ -21944,19 +27182,19 @@ \@shortvrbinfo{Made }{#1}% \add@special{#1}% % \end{macrocode} -% Then the character's current catcode is stored in |\cc\|\meta{c}. +% Then the character's current catcode is stored in \verb?\cc\?\meta{c}. % \begin{macrocode} \expandafter \xdef\csname cc\string#1\endcsname{\the\catcode`#1}% % \end{macrocode} % The character is spliced into the definition using the same trick as -% used in |\verb| (for instance), having activated |~| in a group. +% used in \cs{verb} (for instance), having activated \verb?~? in a group. % \begin{macrocode} \begingroup \catcode`\~\active \lccode`\~`#1% \lowercase{% % \end{macrocode} -% The character's old meaning is recorded in |\ac\|\meta{c} prior to +% The character's old meaning is recorded in \verb?\ac\?\meta{c} prior to % assigning it a new one. % \begin{macrocode} \global\expandafter\let @@ -21979,13 +27217,13 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\DeleteShortVerb} -% Here's the means of undoing a |\MakeShortVerb|, for instance in a +% Here's the means of undoing a \cs{MakeShortVerb}, for instance in a % region where you need to use the character outside a verbatim -% environment. It arranges for |\dospecials| and |\@sanitize| to be +% environment. It arranges for \cs{dospecials} and \cs{@sanitize} to be % altered appropriately, restores the saved catcode and, if necessary, % the character's meaning (as stored by -% |\MakeShortVerb|). If the catcode wasn't stored in -% |\cc\|\meta{c} (by |\MakeShortVerb|) the command is silently +% \cs{MakeShortVerb}). If the catcode wasn't stored in +% \verb?\cc\?\meta{c} (by \cs{MakeShortVerb}) the command is silently % ignored. % \begin{macrocode} \def\DeleteShortVerb#1{% @@ -21997,8 +27235,8 @@ \rem@special{#1}% \global\catcode`#1\csname cc\string#1\endcsname % \end{macrocode} -% We must not forget to reset |\cc\|\meta{c}, otherwise the check in -% |\MakeShortVerb| for a repeated definition will not work. +% We must not forget to reset \verb?\cc\?\meta{c}, otherwise the check in +% \cs{MakeShortVerb} for a repeated definition will not work. % \begin{macrocode} \global \expandafter\let \csname cc\string#1\endcsname \relax \ifnum\catcode`#1=\active @@ -22015,7 +27253,7 @@ % Helper function for info messages. % \begin{macrocode} \def\@shortvrbinfo#1#2{% - \PackageInfo{shortvrb}{% + \ClassInfo{memoir}{% #1\expandafter\@gobble\string#2 a short reference for \string\verb}} % \end{macrocode} @@ -22023,12 +27261,12 @@ % % \begin{macro}{\add@special} % This helper macro adds its argument to the -% |\dospecials| macro which is conventionally used by verbatim macros +% \cs{dospecials} macro which is conventionally used by verbatim macros % to alter the catcodes of the currently active characters. We need -% to add |\do\|\meta{c} to the expansion of |\dospecials| after +% to add \verb?\do\?\meta{c} to the expansion of \cs{dospecials} after % removing the character if it was already there to avoid multiple -% copies building up should |\MakeShortVerb| not be balanced by -% |\DeleteShortVerb| (in case anything that uses |\dospecials| cares +% copies building up should \cs{MakeShortVerb} not be balanced by +% \cs{DeleteShortVerb} (in case anything that uses \cs{dospecials} cares % about repetitions). % \begin{macrocode} \def\add@special#1{% @@ -22036,8 +27274,8 @@ \expandafter\gdef\expandafter\dospecials\expandafter {\dospecials \do #1}% % \end{macrocode} -% Similarly we have to add |\@makeother\|\meta{c} to |\@sanitize| -% (which is used in things like |\index| to re-catcode all special +% Similarly we have to add \verb?\@makeother\?\meta{c} to \cs{@sanitize} +% (which is used in things like \cs{index} to re-catcode all special % characters except braces). % \begin{macrocode} \expandafter\gdef\expandafter\@sanitize\expandafter @@ -22045,19 +27283,19 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\rem@special} -% The inverse of |\add@special| is slightly trickier. |\do| is +% The inverse of cs{add@special} is slightly trickier. \cs{do} is % re-defined to expand to nothing if its argument is the character of % interest, otherwise to expand simply to the argument. We can then -% re-define |\dospecials| to be the expansion of itself. The space -% after |=`##1| prevents an expansion to |\relax|! +% re-define \cs{dospecials} to be the expansion of itself. The space +% after \verb?=`##1? prevents an expansion to \cs{relax}! % \begin{macrocode} \def\rem@special#1{% \def\do##1{% \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}% \xdef\dospecials{\dospecials}% % \end{macrocode} -% Fixing |\@sanitize| is the same except that we need to re-define -% |\@makeother| which obviously needs to be done in a group. +% Fixing \cs{@sanitize} is the same except that we need to re-define +% \cs{@makeother} which obviously needs to be done in a group. % \begin{macrocode} \begingroup \def\@makeother##1{% @@ -22122,61 +27360,9 @@ % at page boundaries % \item A heading can be put at the start of `continuation' pages % \item Lines of verbatim text can be numbered -% \item Can be `degraded' to normal verbatim environment +% \item Can be `downgraded' to normal verbatim environment % \end{itemize} % -% Before proceeding with the main, here are some macros for aspects -% of line numbering. -% -% \begin{macro}{\linenumberfont} -% \begin{macro}{\vlvnumfont} -% Set line numbering font(s). -% \begin{macrocode} -\newcommand{\linenumberfont}[1]{\def\vlvnumfont{#1}} -%%% \linenumberfont{\small\rmfamily} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\linenumberfrequency} -% \begin{macro}{\linemodnum} -% Set numbering intervals (number modulo). Default is modulus 0. -% \begin{macrocode} -\newcommand{\linenumberfrequency}[1]{% - \ifnum #1< \@ne - \def\linemodnum{0\relax} - \bvcountlinesfalse - \else - \def\linemodnum{#1\relax} - \bvcountlinestrue - \fi -} -%%%%\linenumberfrequency{0} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\getthelinenumber} -% |\getthelinenumber|\marg{counter} returns |\thecounter| if it is exactly -% divisible by |\linenumberfrequency|, provided this is not zero. -% \begin{macrocode} -\newcommand{\getthelinenumber}[1]{% - \ifnum\@ne=\linemodnum - \@nameuse{the#1} - \else - \ifnum\@ne<\linemodnum - \@tempcnta=\@nameuse{c@#1} - \divide\@tempcnta\linemodnum \multiply\@tempcnta\linemodnum - \ifnum\@tempcnta=\@nameuse{c@#1}\@nameuse{the#1}\fi - \fi - \fi -} - -% \end{macrocode} -% \end{macro} -% % OK, on to the main code. % % \begin{macro}{\boxverbflag} @@ -22198,46 +27384,66 @@ % % \begin{macro}{\bvtopofpage} % \begin{macro}{\b@vtop} -% Can use |\bvtopofpage| to put a heading above continued verbatims. +% Can use \cs{bvtopofpage} to put a heading above continued verbatims. % For example \\ -% |\bvtopofpage{\begin{center}\normalfont (Continued)\end{center}}| \\ -% It only works for |\bvperpagetrue|. +% \verb?\bvtopofpage{\begin{center}\normalfont (Continued)\end{center}}? \\ +% It only works for \cs{bvperpagetrue}. % \begin{macrocode} \newcommand{\bvtopofpage}[1]{% - \long\def\b@vtop{#1} -} + \long\def\b@vtop{#1}} \def\b@vtop{} % used in \boxverb@split for heading % \end{macrocode} % \end{macro} % \end{macro} % -% -% \begin{macro}{\theb@vlinenumber} -% \begin{macro}{\resetbvlinenumber} -% |\resetbvlinenumber| reinitializes the line numbering. +% \begin{macro}{\c@memfbvline} +% \begin{macro}{\c@bvlinectr} +% Counter for adjusting the starting line number for boxed verbatims +% and for the line number itself.. % \begin{macrocode} +\newcounter{memfbvline} + \c@memfbvline=\z@ \newcounter{bvlinectr} -\def\theb@vlinenumber{\getthelinenumber{bvlinectr}} -\newcommand{\resetbvlinenumber}{\setcounter{bvlinectr}{0}} - % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\ifbvcountlines} -% TRUE for verbatim line numbers to be printed. Default is not -% to print them. Note that |\linenumberfrequency| twiddles with this. +% \begin{macro}{\setbvlinenums} +% \cs{setbvlinenums}\marg{firstline}\marg{startnumsat} sets the first line +% number to \meta{firstline} and the first line number to be printed is +% \meta{startnumsat}. +% \changes{v1.61803}{2008/01/30}{Added \cs{setbvlinenums} (mempatch v4.9)} % \begin{macrocode} -\newif\ifbvcountlines % TRUE to print line numbers of verbatim lines - \bvcountlinesfalse +\newcommand*{\setbvlinenums}[2]{% + \c@bvlinectr #1\relax \advance\c@bvlinectr \m@ne + \ifnum\z@<\linemodnum% we are printing line numbers + \@tempcnta #2\relax + \divide\@tempcnta\linemodnum + \multiply\@tempcnta\linemodnum + \c@memfbvline #2\relax + \advance\c@memfbvline-\@tempcnta + \fi} + % \end{macrocode} % \end{macro} % +% \begin{macro}{\theb@vlinenumber} +% \begin{macro}{\resetbvlinenumber} +% \cs{resetbvlinenumber} reinitializes the line numbering. +% \changes{v1.61803}{2008/01/30}{Changed \cs{theb@vlinenumber} (mempatch v4.9)} +% \begin{macrocode} +\def\theb@vlinenumber{\getthelinenumber{bvlinectr}{memfbvline}} +\newcommand*{\resetbvlinenumber}{\setcounter{bvlinectr}{0}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\b@vdocount} % \begin{macro}{\bvnumlength} % Increment line number if counting. A line number is printed in -% a space width |\bvnumlength|, which is given a temporary value here. +% a space width \cs{bvnumlength}, which is given a temporary value here. % \begin{macrocode} \def\b@vdocount{\ifbvcountlines\stepcounter{bvlinectr}\fi} \newlength{\bvnumlength} @@ -22256,8 +27462,8 @@ % \begin{macrocode} \newif\ifbvcountinside % TRUE if line numbers inside box \bvcountinsidetrue -\newcommand{\bvnumbersinside}{\bvcountinsidetrue} -\newcommand{\bvnumbersoutside}{\bvcountinsidefalse} +\newcommand*{\bvnumbersinside}{\bvcountinsidetrue} +\newcommand*{\bvnumbersoutside}{\bvcountinsidefalse} % \end{macrocode} % \end{macro} @@ -22284,10 +27490,27 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\@@m@mline} +% \cs{@@line} is defined as \verb?\def\@@line{\hb@xt@\hsize}? and I need +% an equivalent for \cs{linewidth} instead of \cs{hsize} for use in +% \cs{setupboxverb@line}. +% \changes{v1.61803}{2008/01/30}{Added \cs{@@m@mline} (mempatch v4.9)} +% \begin{macrocode} +\newcommand*{\@@m@mline}{\hb@xt@\linewidth} + +% \end{macrocode} +% \end{macro} % % \begin{macro}{\setupboxverb@line} -% Use a macro for the first main part of DA's code for |\boxedverbatim|, +% Use a macro for the first main part of DA's code for \cs{boxedverbatim}, % adding lots of hooks. +% +% Per Starb\"{a}ck had problems with the combination of \texttt{adjustwidth} +% with \texttt{boxedverbatim} (see CTT \textit{Re: [memoir] adjustwidth + +% boxedverbatim}, 2007/02/10) and Lars Madsen came up with a suggestion to +% use \cs{linewidth} instead of \cs{hsize}. +% \changes{v1.61803}{2008/01/30}{Changed \cs{hsize} to \cs{linewidth} in +% \cs{setupboxverb@line} (mempatch v4.9)} % \begin{macrocode} \newcommand{\setupboxverb@line}{% \par @@ -22299,7 +27522,8 @@ % \begin{macrocode} \def\verbatim@processline{\leavevmode \b@vdocount% - \bvleftsidehook\vbox{\advance\hsize-.8\p@ \@@line + \bvleftsidehook\vbox{\advance% \hsize-.8\p@ \@@line % changed to \linewidth + \linewidth-.8\p@ \@@line {\b@vdooutside\strut\kern\bvboxsep% \b@vdoinside% \ift@bs @@ -22308,8 +27532,7 @@ \the\verbatim@line \fi \hss}% - \kern\bvboxsep}\bvrightsidehook\par}% -} + \kern\bvboxsep}\bvrightsidehook\par}} % \end{macrocode} % \end{macro} @@ -22318,7 +27541,7 @@ % % \begin{macro}{\setupbox@verb} % Use a macro for the second main part of DA's code, and integrate it -% with the other verbatim codes (e.g., include |\@maybeobeytags|). +% with the other verbatim codes (e.g., include \cs{@maybeobeytags}). % \begin{macrocode} \newcommand{\setupbox@verb}{% \leftskip\z@skip \rightskip\z@skip @@ -22326,8 +27549,7 @@ \parfillskip\z@ plus\p@ minus\p@ \lineskip-\bvboxsep \baselineskip\z@skip \frenchspacing\@vobeyspaces\@maybeobeytabs - \boxverb@toprule -} + \boxverb@toprule} % \end{macrocode} % \end{macro} @@ -22338,20 +27560,19 @@ % \begin{macro}{\boxedverbatim*} % \begin{macro}{\endboxedverbatim*} % Given the two macros above, we can write a briefer version of DA's -% |\boxedverbatim(*)|. +% \cs{boxedverbatim(*)}. % As noted by Zarko Cucej\footnote{\url{zarko.cucej@uni-mb.si}}, have to handle % a following (no-) paragraph. % \changes{v1.4}{2003/11/22}{Added \cs{@doendpe} to \cs{endboxedverbatim} % (from patch v1.8)} % \begin{macrocode} \def\boxedverbatim{\begingroup + \let\@@line\@@m@mline% new from mempatch v4.9 \setupboxverb@line \@verbatim \setupbox@verb - \verbatim@start -} + \verbatim@start} \def\endboxedverbatim{\bvendrulehook\endtrivlist\endgroup\@doendpe} - \@namedef{boxedverbatim*}{\let\frenchspacing\@gobble \boxedverbatim} \@namelet{endboxedverbatim*}\endboxverbatim @@ -22370,10 +27591,12 @@ % \begin{macro}{\bvendofpage} % \cs{bvendofpage}\marg{spec} sets the boxed verbatim `end of page' to \meta{spec}. % \changes{v1.618}{2005/09/02}{Added \cs{bvendofpage} (mempatch v2.3d)} +% \changes{v1.61803}{2008/01/30}{Changed \cs{bvendofpage} to include width} % \begin{macrocode} \newcommand*{\bvendofpage}[1]{% \def\boxverb@botpage{#1}} -\bvendofpage{\hrule\kern-.4pt} +%%%%\bvendofpage{\hrule\kern-.4pt} +\bvendofpage{\hrule width\linewidth\kern-.4pt} % \end{macrocode} % \end{macro} @@ -22397,9 +27620,11 @@ % \begin{macro}{\bvrightsidehook} % \begin{macro}{\bvtopmidhook} % The new hooks, for the top, bottom, left and right of the box. +% \changes{v1.61803}{2008/01/30}{Added \cs{linewidth} to \cs{bvtoprulehook} and +% \cs{bvendrulehook} (mempatch v4.9)} % \begin{macrocode} -\def\bvtoprulehook{\hrule \nobreak \vskip-.1\p@} -\def\bvendrulehook{\hrule} +\def\bvtoprulehook{\hrule width\linewidth \nobreak\vskip-.1\p@} +\def\bvendrulehook{\hrule width\linewidth} \def\bvleftsidehook{\vrule} \def\bvrightsidehook{\vrule} \def\bvtopmidhook{\rule{0\p@}{2\bvboxsep} \hss} @@ -22413,7 +27638,7 @@ % % \begin{macro}{\boxedverbatiminput} % \begin{macro}{\boxedverbatim@input} -% |\boxedverbatiminput{filename}| read in filename contents as verbatim +% \cs{boxedverbatiminput}\marg{filename} read in filename contents as verbatim % \begin{macrocode} \newcommand{\boxedverbatiminput}{\begingroup \@ifstar{\let\frenchspacing\@gobble @@ -22445,8 +27670,7 @@ \renewcommand{\bvtoprulehook}{\hrule \nobreak \vskip-.1\p@}% \renewcommand{\bvleftsidehook}{\vrule}% \renewcommand{\bvrightsidehook}{\vrule}% - \renewcommand{\bvendrulehook}{\hrule}% -} + \renewcommand{\bvendrulehook}{\hrule}} % \end{macrocode} % \end{macro} @@ -22459,8 +27683,7 @@ \renewcommand{\bvtoprulehook}{}% \renewcommand{\bvleftsidehook}{}% \renewcommand{\bvrightsidehook}{}% - \renewcommand{\bvendrulehook}{}% -} + \renewcommand{\bvendrulehook}{}} % \end{macrocode} % \end{macro} @@ -22473,8 +27696,7 @@ \renewcommand{\bvtoprulehook}{\hrule \nobreak \vskip-.1\p@}% \renewcommand{\bvleftsidehook}{}% \renewcommand{\bvrightsidehook}{}% - \renewcommand{\bvendrulehook}{\hrule}% -} + \renewcommand{\bvendrulehook}{\hrule}} % \end{macrocode} % \end{macro} @@ -22487,8 +27709,7 @@ \renewcommand{\bvtoprulehook}{\vskip 3ex}% \renewcommand{\bvleftsidehook}{\vrule}% \renewcommand{\bvrightsidehook}{\vrule}% - \renewcommand{\bvendrulehook}{}% -} + \renewcommand{\bvendrulehook}{}} % \end{macrocode} % \end{macro} @@ -22500,7 +27721,7 @@ % The following code is the \Lpack{framed} package~\cite{FRAMED} % by Donald Arseneau. % \changes{v1.4}{2003/11/22}{Updated framed code to v0.8a of the package} -% +% \changes{v1.61803}{2008/01/30}{Updated framed code to v0.95 of the package} % % \begin{macro}{\framed} % \begin{macro}{\endframed} @@ -22516,41 +27737,57 @@ % \end{macro} % \end{macro} % -% DA sent me a pre-release copy of v0.6 of his \Lpack{framed} +% Way back when DA sent me a pre-release copy of v0.6 of his \Lpack{framed} % package~\cite{FRAMED}. % We also discussed good ways of embedding it into the class. One result -% being that I defined some some items |\AtBeginDocument|, but this is +% being that I defined some some items \cs{AtBeginDocument}, but this is % no longer required as DA has changed \Lpack{framed} to cooperate -% with memoir. +% with memoir. We continue to have sporadic email conversations about the +% interaction of \Lpack{memoir} and \Lpack{framed}. % % Here is a modified version of \file{framed.sty}. In particular -% I deleted the debugging code (lines starting with \verb?|?). +% I moved some of DA's description of the code into the general commentary +% instead of comments within the code. % % \begin{verbatim} -% framed.sty v 0.8a 21-Jul-2003 -% Copyright (C) 1992-2003 by Donald Arseneau +% framed.sty v 0.95 2007/10/04 +% Copyright (C) 1992-2007 by Donald Arseneau (asnd@triumf.ca) % These macros may be freely transmitted, reproduced, or modified % provided that this notice is left intact. % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Create framed or shaded regions that can break across pages using -% \begin{framed} ... \end{framed} -- ordinary frame box (box at margin) -% \begin{shaded} ... \end{shaded} -- shaded background (into margin) -% ... leftbar ... -- line on left side -% -% The "framed" environment puts the text into "\fbox" with the -% settings "\fboxrule=\FrameRule" and "\fboxsep=\FrameSep". -% You can change these lengths (using "\setlength") and you -% can even change the definition of "\FrameCommand" to use -% much fancier boxes. -% -% In fact, the "shaded" environment just redefines "\FrameCommand" -% to use "\colorbox{shadecolor}" (and you have to define the -% color "shadecolor"). +%====================== Begin Instructions ======================= +% +% framed.sty +% ~~~~~~~~~~ +% Create framed, shaded, or differently highlighted regions that can +% break across pages. The environments defined are +% framed -- ordinary frame box (\fbox) with edge at margin +% shaded -- shaded background (\colorbox) bleeding into margin +% snugshade -- similar +% leftbar -- thick vertical line in left margin +% to be used like +% \begin{framed} +% copious text +% \end{framed} +% +% But the more general purpose of this package is to facilitate the +% creation of environments that enable page breaking +% within arbitrary decorations using a simple new-environment definition +% incorporating \FrameCommand and +% \begin{MakeFramed}{settings} ... \end{MakeFramed} +% +% The "framed" environment uses "\fbox" as its "\FrameCommand" with +% the additional settings \fboxrule=\FrameRule and \fboxsep=\FrameSep. +% You can change these lengths (using \setlength) and you can change +% the definition of \FrameCommand to use much fancier boxes. +% +% In fact, the "shaded" environment just redefines \FrameCommand to be +% \colorbox{shadecolor} (and you have to define the color "shadecolor": +% \definecolor{shadecolor}...). % % A page break is allowed, and even encouraged, before the framed % environment. If you want to attach some text (a box title) to the -% frame, then the text should be inserted by \FrameCommand +% frame, then the text should be inserted by \FrameCommand. % % The contents of the framed regions are restricted: % Floats, footnotes, marginpars and head-line entries will be lost. @@ -22558,10 +27795,12 @@ % This package will not work with the page breaking of multicol.sty, % or other systems that perform column-balancing. % -% The MakeFramed environment does the work. Its "settings" argument +% The MakeFramed environment does the work. Its "settings" argument % should contain any adjustments to the text width (applied to \hsize, -% and using the "\width" of the frame itself) as well as a `restore' -% command -- \@parboxrestore or \FrameRestore or something similar. +% and using the "\width" of the frame itself) as well as a "restore" +% command -- \@parboxrestore or \FrameRestore or something similar; +% as an example, the snugshade environment shows how to suppress excess +% spacing within the box, copying the code from minipage. % % Expert commands: % \MakeFramed, \endMakeFramed: the "MakeFramed" environment @@ -22569,96 +27808,83 @@ % \FrameRestore: restore some text settings, but fewer than \@parboxrestore % \FrameRule: length register; \fboxrule for default "framed". % \FrameSep: length register; \fboxsep for default "framed". -% \FrameHeightAdjust: macro; height of frame above baselineskip at -% top of page -% +% \FrameHeightAdjust: macro; height of frame above baseline at top of page +% % This is still a `pre-production' version because I can think of many -% features/improvements that should be made. Nevertheless, starting +% features/improvements that should be made. Nevertheless, starting % with version 0.5 it should be bug-free. % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% ToDo: +% Test more varieties of list +% Improve and correct documentation +% Propagation of \marks +% Handle footnotes (how??) floats (?) and marginpars. +% Stretchability modification. +%======================== End Instructions ======================== +% +% \ProvidesPackage{framed}[2007/10/04 v 0.95: +% framed or shaded text with page breaks] +% +% \newenvironment{framed}% using default \FrameCommand +% {\MakeFramed {\advance\hsize-\width \FrameRestore}}% +% {\endMakeFramed} +% +% \newenvironment{shaded}{% +% \def\FrameCommand{\fboxsep=\FrameSep \colorbox{shadecolor}}% +% \MakeFramed {\FrameRestore}}% +% {\endMakeFramed} +% +% \newenvironment{leftbar}{% +% \def\FrameCommand{\vrule width 3pt \hspace{10pt}}% +% \MakeFramed {\advance\hsize-\width \FrameRestore}}% +% {\endMakeFramed} +% +% \newenvironment{snugshade}{% +% \def\FrameCommand{\colorbox{shadecolor}}% +% \MakeFramed {\FrameRestore\@setminipage}}% +% {\par\unskip\endMakeFramed} +% % \end{verbatim} % +% Now for the package code. +% % \begin{macrocode} -%%%%%%%%%%%% BEGIN FRAMED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%% PW -- can't have \ProvidesPpackage -%%\ProvidesPackage{framed}[2003/07/21 v 0.8a: -%% framed or shaded text with page breaks] +\chardef\FrameRestore=\catcode`\| % for debug +\catcode`\|=\catcode`\% % (debug: insert space after backslash) % \end{macrocode} % -% \begin{macro}{\ifframeasnormal} +% \begin{macro}{\MakeFramed} % \begin{macrocode} -%% PW added \ifframeasnormal % TRUE normal paras, FALSE minipage paras -%% PW default is (FALSE to match DA v0.5, or TRUE to match DA v0.6) -\newif\ifframeasnormal - \frameasnormaltrue - +\def\MakeFramed#1{\par % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\endMakeFramed} -% \begin{environment}{framed} -% \begin{environment}{shaded} -% \begin{environment}{leftbar} +% measure added width and height; call result \cs{width} and \cs{height} % \begin{macrocode} -%% PW Define some things AtBeginDocument if they have not already -%% been defined via someone using the framed package. -\AtBeginDocument{\@ifundefined{framed}{% -\def\endMakeFramed{\par - \kern\z@ \penalty-100 % put depth into height - \egroup - \begingroup \put@frame \endgroup} - -\newenvironment{framed}% using default \FrameCommand - {\MakeFramed {\advance\hsize-\width \FrameRestore}}% - {\endMakeFramed} - -\newenvironment{shaded}{% - \def\FrameCommand{\colorbox{shadecolor}}% - \MakeFramed {\FrameRestore}}% - {\endMakeFramed} - -\newenvironment{leftbar}{% - \def\FrameCommand{\vrule width 3pt \hspace{10pt}}% - \MakeFramed {\advance\hsize-\width \FrameRestore}}% - {\endMakeFramed} - -}{}} % end of AtBeginDocument - + \fb@sizeofframe\FrameCommand + \let\width\fb@frw \let\height\fb@frh % \end{macrocode} -% \end{environment} -% \end{environment} -% \end{environment} -% \end{macro} -% -% \begin{macro}{\MakeFramed} +% insert pre-penalties and skips % \begin{macrocode} -%% \def\MakeFramed#1{\par %% PW change to \newcommand -\newcommand{\MakeFramed}[1]{\par - % measure added width and height; call result \width and \height - \setbox\z@\vbox{\vskip-1in \hbox{\hskip-1in - \FrameCommand{\hbox{\vrule \@height .7in \@depth.3in \@width 1in}}}% - \vskip\z@skip}% - \def\width{\wd\z@}\def\height{\ht\z@}% - \edef\fb@frw{\the\width}\edef\fb@frh{\the\height}% - % insert pre-penalties and skips \begingroup \skip@\lastskip \if@nobreak\else \penalty9999 % updates \page parameters \ifdim\pagefilstretch=\z@ \ifdim\pagefillstretch=\z@ +% \end{macrocode} +% not infinitely stretchable, so encourage a page break here +% \begin{macrocode} \edef\@tempa{\the\skip@}% \ifx\@tempa\zero@glue \penalty-30 \else \vskip-\skip@ \penalty-30 \vskip\skip@ \fi\fi\fi \penalty\z@ - % Give a stretchy breakpoint that will always be taken in preference - % to the \penalty 9999 used to update page parameters. The cube root - % of 10000/100 indicates a multiplier of 0.21545, but the maximum - % calculated badness is really 8192, not 10000, so the multiplier - % is 0.2301. +% \end{macrocode} +% Give a stretchy breakpoint that will always be taken in preference +% to the \cs{penalty} 9999 used to update page parameters. The cube root +% of 10000/100 indicates a multiplier of 0.21545, but the maximum +% calculated badness is really 8192, not 10000, so the multiplier +% is 0.2301. +% \begin{macrocode} \advance\skip@ \z@ plus-.5\baselineskip \advance\skip@ \z@ plus-.231\height \advance\skip@ \z@ plus-.231\skip@ @@ -22667,103 +27893,250 @@ \fi \addvspace{\topsep}% \endgroup - % clear out pending page break +% \end{macrocode} +% clear out pending page break +% \begin{macrocode} \penalty\@M \vskip 2\baselineskip \vskip\height \penalty9999 \vskip -2\baselineskip \vskip-\height \penalty9999 % updates \pagetotal +|\message{After clearout, \pagetotal=\the\pagetotal, +| \pagegoal=\the\pagegoal. }% \fb@adjheight \setbox\@tempboxa\vbox\bgroup #1% Modifications to \hsize (can use \width and \height) - \textwidth\hsize \columnwidth\hsize -} + \textwidth\hsize \columnwidth\hsize} % \end{macrocode} % \end{macro} % -% \begin{macro}{\put@frame} -% |\put@frame| takes the contents of |\@tempboxa| and puts all, or a piece, -% of it on the page with a frame (|\FrameCommand|). It recurses until -% all of |\@tempboxa| has been used up. (|\@tempboxa| must have zero depth.) +% \begin{macro}{\endMakeFramed} % \begin{macrocode} -\def\put@frame{\relax +\def\endMakeFramed{\par + \kern\z@ + \hrule\@width\hsize\@height\z@ + \penalty-100 % put depth into height + \egroup + % {\showoutput\showbox\@tempboxa}% + \begingroup + \fb@put@frame\FrameCommand\FirstFrameCommand + \endgroup} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fb@put@frame} +% \cs{fb@put@frame}\marg{nosplit}\marg{split} +% takes the contents of \cs{@tempboxa} and puts all, +% or a piece, +% of it on the page with a frame (\cs{FrameCommand}, \cs{FirstFrameCommand}, +% \cs{MidFrameCommand}, or \cs{LastFrameCommand}). It recurses until all of +% \cs{@tempboxa} has been used up. (\cs{@tempboxa} must have zero depth.) \\ +% \meta{nosplit} = attempted framing command, if no split \\ +% \meta{split} = framing command if split. +% +% First iteration: Try to fit with \cs{FrameCommand}. If it does not fit, +% split for \cs{FirstFrameCommand}. +% +% Later iteration: Try to fit with \cs{LastFrameCommand}. If it does not +% fit, split for \cs{MidFrameCommand}. +% \begin{macrocode} +\def\fb@put@frame#1#2{\relax \ifdim\pagegoal=\maxdimen \pagegoal\vsize \fi - \ifinner \else - \dimen@\pagegoal \advance\dimen@-\pagetotal % space left on page - \ifdim\dimen@<2\baselineskip - \eject \fb@adjheight \put@frame + \ifinner + \fb@putboxa#1% + \fb@afterframe + \else + \dimen@\pagegoal \advance\dimen@-\pagetotal % natural space left on page + \ifdim\dimen@<2\baselineskip % Too little room on page +| \message{Page has only \the\dimen@\space room left; eject. }% + \eject \fb@adjheight \fb@put@frame#1#2% \else % there's appreciable room left on the page - \begingroup % temporarily set \dimen@ to be... - \advance\dimen@.8\pageshrink % maximum space available on page - \advance\dimen@-\fb@frh\relax % space for frame's contents - \expandafter\endgroup - % restore \dimen@ to real room left on page - \ifdim\dimen@>\ht\@tempboxa % whole box does fit - \else % box must be split - \setbox\@tempboxa\vbox{% simulate frame and flexiblity of page: - \vskip \fb@frh \@plus\pagestretch \@minus.8\pageshrink - \kern137sp\kern-137sp\penalty-30 - \unvbox\@tempboxa}% - \edef\fb@resto@set{\boxmaxdepth\the\boxmaxdepth - \splittopskip\the\splittopskip}% % v0.8a - \boxmaxdepth\z@ \splittopskip\z@ - \setbox\tw@\vsplit\@tempboxa to\dimen@ - \setbox\tw@\vbox{\unvbox\tw@}% natural-sized - % If the split-to size > (\vsize-\topskip), - % then set box to full size - \begingroup + \fb@sizeofframe#1% +| \message{\string\pagetotal=\the\pagetotal, +| \string\pagegoal=\the\pagegoal, +| \string\pagestretch=\the\pagestretch, +| \string\pageshrink=\the\pageshrink, +| \string\fb@frh=\fb@frh. \space} +| \message{Box of size \the\ht\@tempboxa\space + \fb@frh}% + \begingroup % temporarily set \dimen@ to be... + \advance\dimen@.8\pageshrink % maximum space available on page + \advance\dimen@-\fb@frh\relax % space available for frame's contents + \expandafter\endgroup +% \end{macrocode} +% expand \cs{ifdim}, then restore \cs{dimen@} to real room left on page +% \begin{macrocode} + \ifdim\dimen@>\ht\@tempboxa % whole box does fit +| \message{fits in \the\dimen@. }% +% \end{macrocode} +% Use vsplit anyway to capture the marks \\ +% !!!???!!! MERGE THIS WITH THE else CLAUSE!!! +% \begin{macrocode} + \fb@putboxa#1% + \fb@afterframe + \else % box must be split +| \message{must be split to fit in \the\dimen@. }% +% \end{macrocode} +% update frame measurement to use \cs{FirstFrameCommand} +% or \cs{MidFrameCommand} +% \begin{macrocode} + \fb@sizeofframe#2% + \setbox\@tempboxa\vbox{% simulate frame and flexiblity of the page: + \vskip \fb@frh \@plus\pagestretch \@minus.8\pageshrink + \kern137sp\kern-137sp\penalty-30 + \unvbox\@tempboxa}% + \edef\fb@resto@set{\boxmaxdepth\the\boxmaxdepth + \splittopskip\the\splittopskip}% + \boxmaxdepth\z@ \splittopskip\z@ +| \message{Padded box of size \the\ht\@tempboxa\space split +| to \the\dimen@}% +% \end{macrocode} +% Split box here +% \begin{macrocode} + \setbox\tw@\vsplit\@tempboxa to\dimen@ +| \toks99\expandafter{\splitfirstmark}% +| \toks98\expandafter{\splitbotmark}% +| \message{Marks are: \the\toks99, \the\toks98. }% + \setbox\tw@\vbox{\unvbox\tw@}% natural-sized +| \message{Natural height of split box is \the\ht\tw@, leaving +| \the\ht\@tempboxa\space remainder. }% +% \end{macrocode} +% If the split-to size $>$ (\cs{vsize}-\cs{topskip}), then set box to full size +% \begin{macrocode} + \begingroup \advance\dimen@\topskip \expandafter\endgroup - \ifdim\dimen@>\pagegoal - \dimen@ii\pagegoal - \advance\dimen@ii -\topskip - \advance\dimen@ii \FrameHeightAdjust\relax - \else % suspect this is wrong: - % If the split-to size > feasible room_on_page, - % rebox it smaller. - \advance\dimen@.8\pageshrink - \ifdim\ht\tw@>\dimen@ - \dimen@ii\dimen@ - \else % use natural size - \dimen@ii\ht\tw@ + \ifdim\dimen@>\pagegoal +| \message{Frame is big -- Use up the full column. }% + \dimen@ii\pagegoal + \advance\dimen@ii -\topskip + \advance\dimen@ii \FrameHeightAdjust\relax + \else % suspect this is wrong: +% \end{macrocode} +% If the split-to size $>$ feasible room-on-page, rebox it smaller. +% \begin{macrocode} + \advance\dimen@.8\pageshrink + \ifdim\ht\tw@>\dimen@ +| \message{Box too tall; rebox it to \the\dimen@. }% + \dimen@ii\dimen@ + \else % use natural size + \dimen@ii\ht\tw@ + \fi \fi - \fi - % Re-box contents to desired size \dimen@ii - \advance\dimen@ii -\fb@frh - \setbox\tw@\vbox to\dimen@ii \bgroup - % remove simulated frame and page flexibility: - \vskip -\fb@frh \@plus-\pagestretch \@minus-.8\pageshrink - \unvbox\tw@ \unpenalty\unpenalty - \ifdim\lastkern=-137sp % whole box went to next page - \egroup \fb@resto@set \eject -%%% % (\vskip for frame size was discarded) % v 0.8a - \fb@adjheight - \else % - \egroup \fb@resto@set % v0.8a - \ifvoid\@tempboxa % it all fit after all - \setbox\@tempboxa\box\tw@ - \else % it really did split - \ifdim\wd\tw@>\z@ - \centerline{\FrameCommand{\box\tw@}}% ? \centerline bad idea - \else - \box\tw@ - \fi - \hrule \@height\z@ - \eject +% \end{macrocode} +% Re-box contents to desired size \cs{dimen@ii} +% \begin{macrocode} + \advance\dimen@ii -\fb@frh + \setbox\tw@\vbox to\dimen@ii \bgroup +% \end{macrocode} +% remove simulated frame and page flexibility: +% \begin{macrocode} + \vskip -\fb@frh \@plus-\pagestretch \@minus-.8\pageshrink + \unvbox\tw@ \unpenalty\unpenalty + \ifdim\lastkern=-137sp % whole box went to next page +| \message{box split at beginning! }% + % need work here??? + \egroup \fb@resto@set \eject % (\vskip for frame size was discarded) \fb@adjheight - \put@frame - \fi\fi\fi\fi\fi - \ifvoid\@tempboxa\else - \centerline{\FrameCommand{\box\@tempboxa}}% - \nointerlineskip \null %{\showoutput \showlists} - \penalty-30 \vskip\topsep + \fb@put@frame#1#2% INSERTED ??? + \else % Got material split off at the head + \egroup \fb@resto@set + \ifvoid\@tempboxa % it all fit after all +| \message{box split at end! }% + \setbox\@tempboxa\box\tw@ + \fb@putboxa#1% + \fb@afterframe + \else % it really did split +| \message{box split as expected. Its reboxed height +| is \the\ht\tw@. }% + \ifdim\wd\tw@>\z@ + \wd\tw@\wd\@tempboxa +% \end{macrocode} +% PW: the next line was: \\ +% \verb?\centerline{#2{\box\tw@}}% ??? \centerline bad idea? \\ +% but I have changed it as follows so that \cs{centerline} can be changed +% from elsewhere if useful. +% \begin{macrocode} + \memfblineboxtwo{#2{\box\tw@}}% ??? \centerline bad idea? \\ + \else +| \message{Zero width means likely blank. +| Don't frame it (guess)}% + \box\tw@ + \fi + \hrule \@height\z@ \@width\hsize + \eject + \fb@adjheight + \fb@put@frame\LastFrameCommand\MidFrameCommand + \fi\fi\fi\fi\fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\memfblineboxtwo} +% \begin{macro}{\memfblineboxa} +% PW: this is an addition of mine. There is a question mark against the +% use of \cs{centerline} within the \Lenv{framed} code. I have +% created these two macros which are used in the code instead of +% \cs{centerline}, so that those parts of the code can be easily altered. +% are used instead +% \begin{macrocode} +\newcommand{\memfblineboxtwo}[1]{\centerline{#1}} +\newcommand{\memfblineboxa}[1]{\centerline{#1}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\fb@putboxa} +% \begin{macrocode} +\def\fb@putboxa#1{% + \ifvoid\@tempboxa +%%%% PackageWarning{framed}{Boxa is void -- discard it. }% + \@memwarn{Boxa is void -- discard it. }% + \else +| \message{Frame and place boxa. }% +| %{\showoutput\showbox\@tempboxa}% +%%%%%%% \centerline{#1{\box\@tempboxa}}% + \memfblineboxa{#1{\box\@tempboxa}}% \fi} % \end{macrocode} % \end{macro} % +% \begin{macro}{\fb@afterframe} +% \begin{macrocode} +\def\fb@afterframe{% + \nointerlineskip \null %{\showoutput \showlists} + \penalty-30 \vskip\topsep \relax} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fb@frw} +% \begin{macro}{\fb@frh} +% \begin{macro}{\fb@sizeofframe} +% \cs{fb@sizeofframe}\marg{framecommand} measures width and height added by +% frame (\meta{framecommand}) and call the results \cs{fb@frw} and \cs{fb@frh}. +% \begin{macrocode} +\newdimen\fb@frw +\newdimen\fb@frh +\def\fb@sizeofframe#1{\begingroup + \setbox\z@\vbox{\vskip-5in \hbox{\hskip-5in + #1{\hbox{\vrule \@height 4.7in \@depth.3in \@width 5in}}}% + \vskip\z@skip}% +| \message{Measuring frame addition for \string#1 in \@currenvir\space +| gives ht \the\ht\z@\space and wd \the\wd\z@. }% +%{\showoutput\showbox\z@}% + \global\fb@frw\wd\z@ \global\fb@frh\ht\z@ + \endgroup} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\fb@adjheight} % \begin{macrocode} -\def\fb@adjheight{% +\def\fb@adjheight{% \vbox to\FrameHeightAdjust{}% get proper baseline skip from above. \penalty\@M \nointerlineskip \vskip-\FrameHeightAdjust @@ -22776,84 +28149,219 @@ % \begin{macrocode} \edef\zero@glue{\the\z@skip} +\catcode`\|=\FrameRestore + % \end{macrocode} % \end{macro} % % \begin{macro}{\FrameCommand} +% \begin{macro}{\FrameRule} +% \begin{macro}{\FrameSep} +% \begin{macro}{\FirstFrameCommand} +% \begin{macro}{\MidFrameCommand} +% \begin{macro}{\LastFrameCommand} +% Provide configuration commands: +% \begin{macrocode} +\providecommand\FrameCommand{% + \setlength\fboxrule{\FrameRule}\setlength\fboxsep{\FrameSep}% + \fbox} +\@ifundefined{FrameRule}{\newdimen\FrameRule \FrameRule=\fboxrule}{} +\@ifundefined{FrameSep} {\newdimen\FrameSep \FrameSep =3\fboxsep}{} +\providecommand\FirstFrameCommand{\FrameCommand} +\providecommand\MidFrameCommand{\FrameCommand} +\providecommand\LastFrameCommand{\FrameCommand} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\FrameHeightAdjust} +% Height of frame above first baseline when frame starts a page: % \begin{macrocode} -%% Define configuration commands: -\def\FrameCommand{\fboxrule=\FrameRule \fboxsep=\FrameSep \fbox} -\newdimen\FrameRule \FrameRule= \fboxrule -\newdimen\FrameSep \FrameSep = 3\fboxsep - -%% Height of frame above first baseline when frame starts a page: -%%\def\FrameHeightAdjust{6pt} % PW changed the value -\def\FrameHeightAdjust{0.6em} +\providecommand\FrameHeightAdjust{6pt} % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}{\FrameRestore} -% |\FrameRestore| has parts of |\@parboxrestore|. See how it is used in the -% `settings' argument of |\MakeFrame|. Previous behaviour can be restored by -% using |\@parboxrestore| there, or redefining: -% \begin{verbatim} -% \makeatletter -% \renewcommand{\FrameRestore}{\@parboxrestore} -% \makeatother -% \end{verbatim} -% However, PW's |\ifframeasnormal| obviates the need for this. -% \changes{v1.618}{2005/09/03}{Corrected spelling of \cs{@dischyph} in \cs{FrameRestore} (mempatch v3.5)} -% \begin{macrocode} -%% PW: I have added my \ifframeasnormal to the original \FrameRestore -%% The commented out lines are commented out by DA in the -%% framed package - -%\def\FrameRestore{% %% PW change to \newcommand -\newcommand{\FrameRestore}{% - \let\if@nobreak\iffalse - \let\if@noskipsec\iffalse - \let\-\@dischyph - \let\'\@acci\let\`\@accii\let\=\@acciii - \linewidth\hsize - \sloppy -\ifframeasnormal\else - \let\par\@@par - \parindent\z@ \parskip\z@skip - \everypar{}% - \@totalleftmargin\z@ - \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip - \parfillskip\@flushglue \lineskip\normallineskip - \baselineskip\normalbaselineskip - \let\\\@normalcr -\fi -} +% \cs{FrameRestore} has parts of \cs{@parboxrestore}, performing a similar but +% less complete restoration of a default layout. See how it is used in the +% "settings" argument of \cs{MakeFrame}. Though not a parameter, \cs{hsize} +% should be set to the desired total line width available inside the +% frame before invoking \cs{FrameRestore}. +% \begin{macrocode} +\def\FrameRestore{% + \let\if@nobreak\iffalse + \let\if@noskipsec\iffalse + \let\-\@dischyph + \let\'\@acci\let\`\@accii\let\=\@acciii + % \message{FrameRestore: + % \@totalleftmargin=\the \@totalleftmargin, + % \rightmargin=\the\rightmargin, + % \@listdepth=\the\@listdepth. }% +% \end{macrocode} +% Test if we are in a list (or list-like paragraph) +% \begin{macrocode} + \ifnum \ifdim\@totalleftmargin>\z@ 1\fi + \ifdim\rightmargin>\z@ 1\fi + \ifnum\@listdepth>0 1\fi 0>\z@ + % \message{In a list: \linewidth=\the\linewidth, + % \@totalleftmargin=\the\@totalleftmargin, + % \parshape=\the\parshape, \columnwidth=\the\columnwidth, + % \hsize=\the\hsize, + % \labelwidth=\the\labelwidth. }% +% \end{macrocode} +% Now try to propagate changes of width from \cs{hsize} to list parameters. +% This is deficient, but a more advanced way to indicate modification to text +% dimensions is not (yet) provided; in particular, no separate left/right +% adjustment. (PW. I have provided a macro for the next few lines as I think +% that I may have a reason to allow them to be easily changed). +% \begin{macrocode} +%%% \@setminipage % snug fit around the item +%%% \advance\linewidth-\columnwidth \advance\linewidth\hsize +%%% \parshape\@ne \@totalleftmargin \linewidth + \memfblistfixparams + \else % Not in list + \linewidth=\hsize + %\message{No list, set \string\linewidth=\the\hsize. }% + \fi + \sloppy} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \end{macrocode} % \end{macro} % +% \begin{macro}{\memfblistfixparams} +% An extract of some code from \cs{FrameRestore}. +% Try to propagate changes of width from \cs{hsize} to list parameters. +% This is deficient, but a more advanced way to indicate modification to text +% dimensions is not (yet) provided; in particular, no separate left/right +% adjustment. % \begin{macrocode} -% Compatability with previous versions (temporary!): -%%\let\fram@d=\MakeFramed \let\endfram@d=\endMakeFramed +\newcommand*{\memfblistfixparams}{% + \@setminipage % snug fit around the item + \advance\linewidth-\columnwidth \advance\linewidth\hsize + \parshape\@ne \@totalleftmargin \linewidth} -%%%%%%%%%%%% END FRAMED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \end{macrocode} +% \end{macro} +% +% I have moved the following from the start of the \Lpack{framed} +% package to here. +% +% \begin{environment}{framed} +% \begin{environment}{shaded} +% \begin{environment}{leftbar} +% \begin{environment}{snugshade} +% \begin{macrocode} +\newenvironment{framed}% using default \FrameCommand + {\MakeFramed {\advance\hsize-\width \FrameRestore}}% + {\endMakeFramed} + +\newenvironment{shaded}{% + \def\FrameCommand{\fboxsep=\FrameSep \colorbox{shadecolor}}% + \MakeFramed {\FrameRestore}}% + {\endMakeFramed} + +\newenvironment{leftbar}{% + \def\FrameCommand{\vrule width 3pt \hspace{10pt}}% + \MakeFramed {\advance\hsize-\width \FrameRestore}}% + {\endMakeFramed} + +\newenvironment{snugshade}{% + \def\FrameCommand{\colorbox{shadecolor}}% + \MakeFramed {\FrameRestore\@setminipage}}% + {\par\unskip\endMakeFramed} % \end{macrocode} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% +% As the package used \cs{newenvironment} it will +% burp if it is used with the class. There are two options: either +% prevent \Lpack{framed} from being loaded, or kill the environments +% if it is loaded. I'm going for the latter as Donald will be updating +% his package at some point and author's may want to use it before it's +% updated here. +% +% \begin{macrocode} +\AtBeginPackage{framed}{% + \let\framed\relax \let\endframed\relax + \let\shaded\relax \let\endshaded\relax + \let\leftbar\relax \let\endleftbar\relax + \let\snugshade\relax \let\endsnugshade\relax} + +% \end{macrocode} +% +% +% \begin{environment}{qframe} +% This is from an email to me from DA shortly after he released \Lpack{framed} +% v 0.95. +% \begin{quote} +% A frame more like a simple parbox. +% Notably useful for use +% inside a single list item --- the frame matches the text of the other +% items. +% \end{quote} +% He actually called it \Lenv{pframe} and said that something similar +% could be in a later version of \Lpack{framed}. +% +% I have found it useful for framing \Lenv{quote} or \Lenv{adjustwidth} +% environments, or similar. Hence the name, from +% `\textit{q}uote \textit{frame}'. +% \changes{v1.61803}{2008/01/30}{Added the qframe environment} +% \begin{macrocode} +\newenvironment{qframe}{% + \def\FrameCommand##1{\fboxrule=\FrameRule\fboxsep=\FrameSep + \hskip\@totalleftmargin\fbox{##1}% There is no \@totalrightmargin, so... + \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}% + \MakeFramed{\advance\hsize-\width + \advance\hsize \FrameSep + \@totalleftmargin\z@ \linewidth=\hsize}}% + {\endMakeFramed} + +% \end{macrocode} +% \end{environment} +% +% \begin{environment} +% And here is my corresponding version for \Lenv{shaded}. +% \changes{v1.61803}{2008/01/30}{Added the qshade environment} +% \begin{macrocode} +\newenvironment{qshade}{% + \def\FrameCommand##1{\fboxsep=\FrameSep + \hskip\@totalleftmargin + \hskip -1\FrameSep + \colorbox{shadecolor}{##1}% + \hskip-\linewidth \hskip-\@totalleftmargin + \hskip -1\FrameSep + \hskip\columnwidth}% + \MakeFramed{\advance\hsize-\width + \advance\hsize 3\FrameSep + \@totalleftmargin\z@ \linewidth=\hsize}}% + {\endMakeFramed} + +% \end{macrocode} +% \end{environment} +% % % \subsection{The newfile package} % % The following code is from the \Lpack{newfile} package. % To try and avoid name clashes with other packages, each internal macro -% in this package includes the character string `|stre@m|'. +% in this package includes the character string `\verb?stre@m?'. % % \begin{macro}{\newoutputstream} -% |\newoutputam|\marg{stream} creates a new output stream called \meta{stream}. +% \cs{newoutputstream}\marg{stream} creates a new output stream called \meta{stream}. % Different files may be associated with the \meta{stream}. Note that % TeX permits no more than 16 output streams. % \begin{macrocode} -\newcommand{\newoutputstream}[1]{% +\newcommand*{\newoutputstream}[1]{% \@ifundefined{#1outstre@m}% {\expandafter\newwrite\csname #1outstre@m\endcsname \csname newif\expandafter\endcsname @@ -22872,11 +28380,11 @@ % \end{macro} % % \begin{macro}{\newinputstream} -% |\newinputstream|\marg{stream} creates a new input stream called \meta{stream}. +% \cs{newinputstream}\marg{stream} creates a new input stream called \meta{stream}. % Different files may be associated with the \meta{stream}. Note that % TeX permits no more than 16 input streams. % \begin{macrocode} -\newcommand{\newinputstream}[1]{% +\newcommand*{\newinputstream}[1]{% \@ifundefined{#1instre@m}% {\expandafter\newread\csname #1instre@m\endcsname \csname newif\expandafter\endcsname @@ -22898,7 +28406,7 @@ % multiple places. % % \begin{macro}{\IfStreamOpen} -% |\IfStreamOpen|\marg{stream}\marg{TRUE code}\marg{FALSE code} +% \cs{IfStreamOpen}\marg{stream}\marg{TRUE code}\marg{FALSE code} % checks if stream \meta{stream} is currently open. % \begin{macrocode} \newcommand{\IfStreamOpen}[3]{% @@ -22907,7 +28415,7 @@ % \end{macro} % % \begin{macro}{\instre@mandopen} -% |\instre@mandopen|\marg{stream}\marg{TRUE code} checks if \meta{stream} +% \cs{instre@mandopen}\marg{stream}\marg{TRUE code} checks if \meta{stream} % is an input stream and is open. If so, it executes \meta{TRUE code}. % \begin{macrocode} \newcommand{\instre@mandopen}[2]{% @@ -22920,7 +28428,7 @@ % \end{macro} % % \begin{macro}{\instre@mandclosed} -% |\instre@mandclosed|\marg{stream}\marg{TRUE code} checks if \meta{stream} +% \cs{instre@mandclosed}\marg{stream}\marg{TRUE code} checks if \meta{stream} % is an input stream and is closed (not open). % If so, it executes \meta{TRUE code}. % \begin{macrocode} @@ -22934,7 +28442,7 @@ % \end{macro} % % \begin{macro}{\outstre@mandopen} -% |\outstre@mandopen|\marg{stream}\marg{TRUE code} checks if \meta{stream} +% \cs{outstre@mandopen}\marg{stream}\marg{TRUE code} checks if \meta{stream} % is an output stream and is open. If so, it executes \meta{TRUE code}. % \begin{macrocode} \newcommand{\outstre@mandopen}[2]{% @@ -22947,7 +28455,7 @@ % \end{macro} % % \begin{macro}{\outstre@mandclosed} -% |\outstre@mandclosed|\marg{stream}\marg{TRUE code} checks if \meta{stream} +% \cs{outstre@mandclosed}\marg{stream}\marg{TRUE code} checks if \meta{stream} % is an output stream and is closed (not open). % If so, it executes \meta{TRUE code}. % \begin{macrocode} @@ -22961,41 +28469,38 @@ % \end{macro} % % \begin{macro}{\openoutputfile} -% |\openoutputfile|\marg{filename}\marg{stream} opens the file called +% \cs{openoutputfile}\marg{filename}\marg{stream} opens the file called % \meta{filename} and attaches it to the stream \meta{stream} for -% writing. However, if the |\nofiles| command has been given the +% writing. However, if the \cs{nofiles} command has been given the % file is \emph{not} attached to the stream. No more than one file can be % attached to a stream at any given time. % \begin{macrocode} -\newcommand{\openoutputfile}[2]{% +\newcommand*{\openoutputfile}[2]{% \outstre@mandclosed{#2}{% \global\@namedef{#1@filename}{#1}% \if@filesw \immediate\openout\@nameuse{#2outstre@m}=\@nameuse{#1@filename}% \fi \global\csname stre@m#2opentrue\endcsname% - \@nameuse{atstreamopen#2}% - }% -} + \@nameuse{atstreamopen#2}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\closeoutputstream} -% |\closeoutputstream|\marg{stream} closes the stream \meta{stream}. +% \cs{closeoutputstream}\marg{stream} closes the stream \meta{stream}. % \begin{macrocode} -\newcommand{\closeoutputstream}[1]{% +\newcommand*{\closeoutputstream}[1]{% \outstre@mandopen{#1}{% \@nameuse{atstreamclose#1}% \immediate\closeout\@nameuse{#1outstre@m}% - \global\csname stre@m#1openfalse\endcsname}% -} + \global\csname stre@m#1openfalse\endcsname}} % \end{macrocode} % \end{macro} % % \begin{macro}{\openinputfile} -% |\openinputfile|\marg{filename}\marg{stream} opens the file called +% \cs{openinputfile}\marg{filename}\marg{stream} opens the file called % \meta{filename} and attaches it to the stream \meta{stream} for % reading. The file is added to the list of files. % No more than one file can be attached to a stream at @@ -23011,27 +28516,25 @@ \@nameuse{atstreamopen#2}}}% {% file not found \typeout{No file #1.} - }% -} + }} % \end{macrocode} % \end{macro} % % \begin{macro}{\closeinputstream} -% |\closeinputstream|\marg{stream} closes the stream \meta{stream}. +% \cs{closeinputstream}\marg{stream} closes the stream \meta{stream}. % \begin{macrocode} \newcommand{\closeinputstream}[1]{% \instre@mandopen{#1}{% \@nameuse{atstreamclose#1}% \immediate\closein\@nameuse{#1instre@m}% - \global\csname stre@m#1openfalse\endcsname}% -} + \global\csname stre@m#1openfalse\endcsname}} % \end{macrocode} % \end{macro} % % \begin{environment}{writeverbatim} -% |\begin{writeverbatim}|\marg{stream} writes the contents of +% \verb?\begin{writeverbatim}?\marg{stream} writes the contents of % the environment as verbatim text to the given \meta{stream}. % \begin{macrocode} \def\writeverbatim#1{% @@ -23047,7 +28550,7 @@ % \end{environment} % % \begin{macro}{\addtostream} -% |\addtostream|\marg{stream}\marg{text} writes \meta{text} to the +% \cs{addtostream}\marg{stream}\marg{text} writes \meta{text} to the % given \meta{stream}. % \begin{macrocode} \newcommand{\addtostream}[2]{% @@ -23056,17 +28559,16 @@ {\let\protect\string \immediate\write\@nameuse{#1outstre@m}{#2}% }}% - \@esphack -} + \@esphack} % \end{macrocode} % \end{macro} % % \begin{macro}{\ifstre@mnoteof} % \begin{macro}{\checkstre@mnoteof} -% |\checkstre@mnoteof|\marg{stream} sets |\ifstre@mnoteof| to TRUE if +% \cs{checkstre@mnoteof}\marg{stream} sets \cs{ifstre@mnoteof} to TRUE if % \meta{stream} is not at the end of the file (i.e., it is the opposite -% of |\ifeof|). +% of \cs{ifeof}). % \begin{macrocode} \newif\ifstre@mnoteof \newcommand{\checkstre@meof}[1]{% @@ -23077,8 +28579,8 @@ % \end{macro} % % \begin{macro}{\readstream} -% |\readstream|\marg{stream} reads the contents of -% the given \meta{stream} as |\input| text. +% \cs{readstream}\marg{stream} reads the contents of +% the given \meta{stream} as \cs{input} text. % \begin{macrocode} \def\readstream#1{ \instre@mandopen{#1}{% @@ -23086,15 +28588,14 @@ \read\@nameuse{#1instre@m} to\temptokstre@m \temptokstre@m \repeat - }% -} + }} % \end{macrocode} % \end{macro} % % \begin{macro}{\readaline} -% |\readaline|\marg{stream} reads what TeX considers to be one line -% from the given \meta{stream} as |\input| text. +% \cs{readaline}\marg{stream} reads what TeX considers to be one line +% from the given \meta{stream} as \cs{input} text. % \begin{macrocode} \def\readaline#1{ \instre@mandopen{#1}{% @@ -23103,22 +28604,20 @@ \else \read\@nameuse{#1instre@m} to\temptokstre@m \temptokstre@m - \fi - }% -} + \fi}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\readverbatim} -% |\readverbatim|\marg{stream} reads the contents of +% \cs{readverbatim}\marg{stream} reads the contents of % the given \meta{stream} as verbatim text. % % The read verbatim code is a slight variation on code from the % \Lpack{verbatim} package. Most of the setup is done by the macros -% |\stre@mverb@input|\marg{setup}\marg{stream} and -% |\verbatim@readstre@m|\marg{stream}. Finally, |\verbatim@read@file| +% \cs{stre@mverb@input}\marg{setup}\marg{stream} and +% \cs{verbatim@readstre@m}\marg{stream}. Finally, \cs{verbatim@read@file} % is a \Lpack{verbatim} package macro. % \begin{macrocode} \def\readverbatim{\begingroup @@ -23133,8 +28632,8 @@ % % \begin{macro}{\stre@mverb@input} % \begin{macro}{\@verbinstre@m} -% |\stre@mverb@input|\marg{setup}\marg{stream} is a stream -% version of |\verbatim@input|. It defines |\@verbinstre@m| +% \cs{stre@mverb@input}\marg{setup}\marg{stream} is a stream +% version of \cs{verbatim@input}. It defines \cs{@verbinstre@m} % to be \meta{stream}. % % \begin{macrocode} @@ -23143,31 +28642,29 @@ {\@verbatim #1\relax \def\@verbinstre@m{\@nameuse{#2instre@m}} \verb@readstre@m\endtrivlist\endgroup\@doendpe}% - {\@memwarn{Stream #2\space is not open}\endgroup}% -} + {\@memwarn{Stream #2\space is not open}\endgroup}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\verb@readstre@m} -% |\verb@readstre@m| is the stream analogue to |\verbatim@readfile|. +% \cs{verb@readstre@m} is the stream analogue to \cs{verbatim@readfile}. % \begin{macrocode} \newcommand{\verb@readstre@m}{% \verbatim@startline \expandafter\endlinechar\expandafter\m@ne \expandafter\verbatim@read@stre@m \expandafter\endlinechar\the\endlinechar\relax - \verbatim@finish -} + \verbatim@finish} % \end{macrocode} % \end{macro} % % \begin{macro}{\verbatim@read@stre@m} -% |\verbatim@read@stre@m| is the analogue to |\verbatim@readfile|. -% It gets its input from the stream |\@verbinstre@m|, which is defined -% in the |\stre@mverb@input| macro. +% \cs{verbatim@read@stre@m} is the analogue to \cs{verbatim@readfile}. +% It gets its input from the stream \cs{@verbinstre@m}, which is defined +% in the \cs{stre@mverb@input} macro. % \begin{macrocode} \newcommand{\verbatim@read@stre@m}{% \read\@verbinstre@m to\next @@ -23177,16 +28674,15 @@ \verbatim@processline \verbatim@startline \expandafter\verbatim@read@stre@m - \fi -} + \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\readboxedverbatim} -% |\readboxedverbatim|\marg{stream} is the equivalent of -% |\readverbtim| except that it generates a boxed verbatim. +% \cs{readboxedverbatim}\marg{stream} is the equivalent of +% \cs{readverbtim} except that it generates a boxed verbatim. % \begin{macrocode} \newcommand{\readboxedverbatim}{\begingroup \@ifstar{\stre@mbvin\relax}% @@ -23196,8 +28692,8 @@ % \end{macro} % % \begin{macro}{\stre@mbvin} -% |\stre@mbvin|\marg{setup}\marg{stream} is the workhorse for -% |\readboxedverbatim|, and in its turn it uses |\verb@readstre@m|. +% \cs{stre@mbvin}\marg{setup}\marg{stream} is the workhorse for +% \cs{readboxedverbatim}, and in its turn it uses \cs{verb@readstre@m}. % \begin{macrocode} \newcommand{\stre@mbvin}[2]{% \IfStreamOpen{#2}% @@ -23206,8 +28702,7 @@ \def\@verbinstre@m{\@nameuse{#2instre@m}}% \setupbox@verb \verb@readstre@m\bvendrulehook\endtrivlist\endgroup\@doendpe}% - {\@memwarn{Stream #2\space is not open}\endgroup}% -} + {\@memwarn{Stream #2\space is not open}\endgroup}} % \end{macrocode} % \end{macro} @@ -23220,7 +28715,7 @@ % \subsection{Extra `provide' commands} % % \begin{macro}{\provideenvironment} -% Works like |\providecommand| but for environments. +% Works like \cs{providecommand} but for environments. % \changes{v1.2}{2002/08/04}{Added \cs{provideenvironment} and supports} % \begin{macrocode} \newcommand{\provideenvironment}{\@star@or@long\m@mprovenv} @@ -23229,7 +28724,7 @@ % % \begin{macro}{\m@mprovenv} % This checks if the environment has been defined. If not it calls -% the kernel code for |\newenvironment| otherwise it calls code to +% the kernel code for \cs{newenvironment} otherwise it calls code to % discard arguments. % \begin{macrocode} \newcommand{\m@mprovenv}[1]{\@ifundefined{#1}% @@ -23242,14 +28737,14 @@ % % \begin{macro}{\m@mgobbleoptsandtwo} % \begin{macro}{\m@mgobbleoptandtwo} -% |\m@mgobbleoptsandtwo| gobbles the |[opt][opt]{begin}{end}| arguments to -% |\provideenvironment|. It is actually more general than that as it will +% \cs{m@mgobbleoptsandtwo} gobbles the \verb?[opt][opt]{begin}{end}? arguments to +% \cs{provideenvironment}. It is actually more general than that as it will % gobble any sequence of any number of optional arguments followed by % two required arguments. If there are no optional arguments it disposes -% of the two required ones, other it calls a recursive procedure to +% of the two required ones, otherwise it calls a recursive procedure to % discard any number of optionals, then two required ones. % -% |\m@mgobbleoptandtwo| recursively discards optional arguments, then finally +% \cs{m@mgobbleoptandtwo} recursively discards optional arguments, then finally % two required arguments. % \begin{macrocode} \newcommand{\m@mgobbleoptsandtwo}{% @@ -23261,20 +28756,17 @@ % \end{macro} % \end{macro} % -% -% -% % \begin{macro}{\providecounter} -% Works like the other |\provide...| commands, but for counters. -% Code is based on |\newcounter| in |ltcounts.dtx|. +% Works like the other \cs{provide...} commands, but for counters. +% Code is based on \cs{newcounter} in \file{ltcounts.dtx}. % \changes{v1.2}{2002/07/17}{Added \cs{providecounter}} % \begin{macrocode} \newcommand*{\providecounter}[1]{% \@ifundefined{c@#1}% {\newcounter{#1}}% {\@memwarn{Counter `#1' already defined}% - \@ifnextchar[{\m@mgobbleopt}{}}% -} + \@ifnextchar[{\m@mgobbleopt}{}}} + % \end{macrocode} % \end{macro} % @@ -23288,8 +28780,8 @@ % \end{macro} % % \begin{macro}{\providelength} -% Works like the other |\provide...| commands, but for lengths. -% Code is based on |\provide@command| in |ltdefns.dtx|. +% Works like the other \cs{provide...} commands, but for lengths. +% Code is based on \cs{provide@command} in \file{ltdefns.dtx}. % \changes{v1.2}{2002/07/17}{Added \cs{providelength}} % \begin{macrocode} \newcommand*{\providelength}[1]{% @@ -23298,8 +28790,7 @@ \endgroup \expandafter\@ifundefined\@gtempa {\newlength{#1}}% - {\@memwarn{Length #1 already defined}}% -} + {\@memwarn{Length #1 already defined}}} % \end{macrocode} % \end{macro} @@ -23308,7 +28799,7 @@ % \begin{macro}{\m@mnewlog} % \begin{macro}{\m@mnewlogs} % For defining a new log-like math function. -% |\newloglike{\fun}{string}| or |\newloglike*{\fun}{string}|. +% \verb?\newloglike{\fun}{string}? or \verb?\newloglike*{\fun}{string}?. % The starred version is for functions with limits (like an integral sign). % \changes{v1.6}{2004/01/28}{Added \cs{newloglike}} % \begin{macrocode} @@ -23326,7 +28817,7 @@ % \begin{macro}{\provideloglike} % \begin{macro}{\m@mprovlogs} % \begin{macro}{\m@mprovlog} -% The provide version of |\newloglike|. +% The provide version of \cs{newloglike}. % \changes{v1.6}{2004/01/28}{Added \cs{provideloglike}} % \begin{macrocode} \newcommand*{\provideloglike}{\@ifstar{\m@mprovlogs}{\m@mprovlog}} @@ -23344,17 +28835,17 @@ % \subsection{Changing counters} % % In LaTeX, a new counter called, say `ctr', is created by the command -% |\newcounter{ctr}[within]|. If the optional within argument is given +% \verb?\newcounter{ctr}[within]?. If the optional within argument is given % the the counter `ctr' is reset to zero each time the counter `within' -% changes. The command |\thectr| typesets the value of the counter ctr. -% This is automatically defined by |\newcounter| and is initialised +% changes. The command \cs{thectr} typesets the value of the counter ctr. +% This is automatically defined by \cs{newcounter} and is initialised % to typeset arabic numerals. Sometimes it may be desireable to change % the counter definitions. % % The following code is based on the \Lpack{chngcntr} package~\cite{CHNGCNTR}. % % \begin{macro}{\@removefromreset} -% This code uses David Carlisle's |\@removefromreset| command as +% This code uses David Carlisle's \cs{@removefromreset} command as % specified in the remreset package~\cite{REMRESET}. % It is provided here as a convenience to the user, and with % David Carlisle's permission. @@ -23377,7 +28868,7 @@ % % \begin{macro}{\@ifbothcntrs} % This is called as \\ -% |\@ifbothcntrs{|\meta{cntr}|}{|\meta{within}|}{<code when both are counters>}|. +% \cs{@ifbothcntrs}\marg{cntr}\marg{within}\marg{code when both are counters}. % This tests if both \meta{cntr} and \meta{within} are counters. % \begin{macrocode} \newcommand{\@ifbothcntrs}[3]{% @@ -23397,12 +28888,12 @@ % \begin{macro}{\@csinstar} % \begin{macro}{\@csin} % It is sometimes desireable to change a counter that has been defined -% by |\newcounter{ctr}| to act as though it had been defined as -% |\newcounter{ctr}[within]|. The command -% |\counterwithin{ctr}{within}| accomplishes this. By default, -% it also redefines the |\thectr| command so that it typesets values -% in the style |\thewithin.\arabic{ctr}|. The starred version of the -% command suppresses the redefinition of |\thectr|. +% by \verb?\newcounter{ctr}? to act as though it had been defined as +% \verb?\newcounter{ctr}[within]?. The command +% \verb?\counterwithin{ctr}{within}? accomplishes this. By default, +% 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}. % % \begin{macrocode} \newcommand{\counterwithin}{\@ifstar{\@csinstar}{\@csin}} @@ -23422,12 +28913,12 @@ % \begin{macro}{\counterwithout*} % \begin{macro}{\@csoutstar} % \begin{macro}{\@csout} -% Likewise, the command |\counterwithout{ctr}{within}| changes a -% counter that has been created by |\newcounter{ctr}[within]| to act -% as though it had been created by |\newcounter{ctr}|. By default it -% also redefines the |\thectr| command so that it just typesets an arabic +% Likewise, the command \verb?\counterwithout{ctr}{within}? changes a +% counter that has been created by \verb?\newcounter{ctr}[within]? to act +% as though it had been created by \verb?\newcounter{ctr}?. By default it +% also redefines the \cs{thectr} command so that it just typesets an arabic % numeral. The starred version of the command suppresses the redefinition -% of |\thectr|. +% of \cs{thectr}. % \changes{v1.618}{2005/09/03}{Deleted chngctr from \cs{@csoutstar} (mempatch v3.4)} % \begin{macrocode} \newcommand{\counterwithout}{\@ifstar{\@csoutstar}{\@csout}} @@ -23443,12 +28934,12 @@ % \end{macro} % \end{macro} % -% Any number of |\counterwithin{ctr}{...}| and |\counterwithout{ctr}{...}| +% Any number of \verb?\counterwithin{ctr}{...}? and \verb?\counterwithout{ctr}{...}? % commands can be issued for a given counter, ctr, if you wish to toggle % between the two styles. The current value of ctr is unaffected by -% |\counterwithin| and |\counterwithout|. If you want to change the value -% after one of these commands, use |\setcounter{ctr}{...}|, and to change -% the typeseting style use |\renewcommand{\thectr}{...}|. +% \cs{counterwithin} and \cs{counterwithout}. If you want to change the value +% after one of these commands, use \verb?\setcounter{ctr}{...}?, and to change +% the typeseting style use \verb?\renewcommand{\thectr}{...}?. % % \subsection{Odd/even page checking} % @@ -23459,30 +28950,50 @@ % the page reference for the label. % % \begin{macro}{\ifoddpage} +% \begin{macro}{\oddpagetrue} +% \begin{macro}{\oddpagefalse} % \begin{macro}{\ifstrictpagecheck} -% \begin{macro}{\c@cp@cntr} -% \begin{macro}{\cplabel} -% The boolean |\ifoddpage| is TRUE if the checked page is odd. The -% boolean |\ifstrictpagecheck| is for turning on (TRUE) and off (FALSE) -% the strictest method of page checking. The counter |cp@cntr| is used -% to make unique labels, which start with |\cplabel|. +% \begin{macro}{\strictpagechecktrue} +% \begin{macro}{\strictpagecheckfalse} +% \begin{macro}{\strictpagecheck} +% \begin{macro}{\easypagecheck} +% The boolean \cs{ifoddpage} is TRUE if the checked page is odd. The +% boolean \cs{ifstrictpagecheck} is for turning on (TRUE) and off (FALSE) +% the strictest method of page checking. +% \changes{v1.61803}{2008/01/30}{Added \cs{strictpagecheck} and \cs{easypagecheck}} % \begin{macrocode} \newif\ifoddpage \newif\ifstrictpagecheck \strictpagecheckfalse -\newcounter{cp@cntr} -\newcommand{\cplabel}{^_} +\newcommand*{\strictpagecheck}{\strictpagechecktrue} +\newcommand*{\easypagecheck}{\strictpagecheckfalse} + % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\c@cp@cntr} +% \begin{macro}{\cplabel} +% The counter \verb?cp@cntr? is used to make unique labels, which start +% with \cs{cplabel}. +% \begin{macrocode} +\newcounter{cp@cntr} +\newcommand{\cplabel}{^_} +% \end{macrocode} +% \end{macro} +% \end{macro} % % % \begin{macro}{\checkoddpage} % This is the user level command to check for odd/even page. It does -% a robust check for |\strictpagecheck| otherwise the simple minded -% check. It sets |\ifoddpage| to TRUE if the page is odd, otherwise +% a robust check for \cs{strictpagecheck} otherwise the simple minded +% check. It sets \cs{ifoddpage} to TRUE if the page is odd, otherwise % it sets it to FALSE. % % This is now fixed so that it should work for non-arabic page numbering. @@ -23516,8 +29027,8 @@ % \end{macro} % % \begin{macro}{\pmemprotected@write} -% |\pmemprotected@write| is a modified version of the kernel's -% |\protected@write|. +% \cs{pmemprotected@write} is a modified version of the kernel's +% \cs{protected@write}. % % This version of the macro was provided by Romano Giannetti % (\url{romano@dea.icai.upco.es}) on 15 July 2003. @@ -23536,7 +29047,7 @@ % \end{macro} % % \begin{macro}{\pmemlabel} -% A version of |\label| that uses |\pmemprotected@write|. +% A version of \cs{label} that uses \cs{pmemprotected@write}. % \begin{macrocode} \newcommand{\pmemlabel}[1]{\@bsphack \pmemprotected@write\@auxout{}% @@ -23572,8 +29083,8 @@ % % \begin{macro}{\@ifmtarg} % \begin{macro}{\@ifnotmtarg} -% |\@ifmtarg{|\meta{arg}|}{<code when empty>}{<code when arg not empty>}| \\ -% |\@ifnotmtarg{|\meta{arg}|}{<code when arg not empty>}| \\ +% \cs{@ifmtarg}\marg{arg}\marg{code when empty}\marg{code when arg not empty} \\ +% \cs{@ifnotmtarg}\marg{arg}\marg{code when arg not empty} \\ % \begin{macrocode} \begingroup \catcode`\Q=3 @@ -23618,14 +29129,13 @@ \@firstcolumntrue% \fi% \setlength{\hsize}{\columnwidth}% - \setlength{\linewidth}{\hsize}% -} + \setlength{\linewidth}{\hsize}} % \end{macrocode} % \end{macro} % % \begin{macro}{\changetext} -% |\changetext{|\meta{H}|}{|\meta{W}|}{|\meta{E}|}{|\meta{O}|}{|\meta{G}|}| +% \cs{changetext}\marg{H}\marg{W}\marg{E}\marg{O}\marg{G} % adds the given lengths to 5 main bits of the page layout. An empty % argument means `no change'. % \begin{macrocode} @@ -23635,25 +29145,43 @@ \@ifmtarg{#3}{}{\addtolength{\evensidemargin}{#3}}% \@ifmtarg{#4}{}{\addtolength{\oddsidemargin}{#4}}% \@ifmtarg{#5}{}{\addtolength{\columnsep}{#5}}% - \ch@ngetext% -} + \ch@ngetext} % \end{macrocode} % \end{macro} % -% Any given change lasts until another |\changetext| command is given. -% A |\changetext| command should only be issued between two paragraphs. +% Any given change lasts until another \cs{changetext} command is given. +% A \cs{changetext} command should only be issued between two paragraphs. % -% |\changetext| should not be used by anyone unless they really +% \cs{changetext} should not be used by anyone unless they really % know what they are doing. If you really know what you are doing % then you should know enough not to use it. % +% \begin{macro}{\changepage} +% Change the page layout, but DON'T. +% \changes{v1.61803}{2008/01/30}{Added \cs{changepage} to match chngpage.sty} +% \begin{macrocode} +\DeclareRobustCommand{\changepage}[9]{% + \@ifmtarg{#1}{}{\addtolength{\textheight}{#1}}% + \@ifmtarg{#2}{}{\addtolength{\textwidth}{#2}}% + \@ifmtarg{#3}{}{\addtolength{\evensidemargin}{#3}}% + \@ifmtarg{#4}{}{\addtolength{\oddsidemargin}{#4}}% + \@ifmtarg{#5}{}{\addtolength{\columnsep}{#5}}% + \ch@ngetext + \@ifmtarg{#6}{}{\addtolength{\topmargin}{#6}}% + \@ifmtarg{#7}{}{\addtolength{\headheight}{#7}}% + \@ifmtarg{#8}{}{\addtolength{\headsep}{#8}}% + \@ifmtarg{#9}{}{\addtolength{\footskip}{#9}}} + +% \end{macrocode} +% \end{macro} +% % \subsection{Temporarily changing the text width} % % % \begin{environment}{adjustwidth} % \begin{environment}{adjustwidth*} -% |\begin{adjustwidth}{|\meta{left}|}{|\meta{right}|}| +% \verb?\begin{adjustwidth}?\marg{left}\marg{right} % adds the given lengths to the left and right hand margins. A positive % value will shorten the text and a negative value will widen it. The % starred version of the environment will cause the @@ -23703,33 +29231,50 @@ % % The environments only work for complete paragraphs. % +% \subsection{Centering text} +% % \begin{macro}{\calccentering} % This macro calculates the amount to be added to the spine margin % (and subtracted from the foredge margin) % in order to center the textblock. Call as \\ -% |\calccentering{\length}| and it sets |\length| +% \verb?\calccentering{\length}? and it sets \cs{length} % to the required value. Then use as \\ -% |\begin{adjustwidth*}{\length}{-\length}...| +% \verb?\begin{adjustwidth*}{\length}{-\length}...? % \begin{macrocode} \newcommand{\calccentering}[1]{ #1 = \paperwidth \advance #1 by -\textwidth \divide #1 by \tw@ - \advance #1 by -\spinemargin -} + \advance #1 by -\spinemargin} % \end{macrocode} % \end{macro} % +% \begin{environment}{vplace} +% \verb?\begin{vplace}?\oarg{decimal number} centers its body vertically. The +% optional argument \meta{decimal number} increases ($>1.0$) or decreases +% ($<1.0$) the space above the body with respect to the space below. +% This is more robust than the method proposed in the manual. +% \changes{v1.61803}{2008/01/30}{Added vplace environment (mempatch v4.4)} +% \begin{macrocode} +\newenvironment{vplace}[1][1]{% + \par\vspace{\stretch{#1}}% +}{% + \vspace*{\stretch{1}}% + \par} + +% \end{macrocode} +% \end{environment} +% % % \subsection{Moving from the current page} % % Much of this code is taken from the \Lpack{nextpage} package~\cite{NEXTPAGE}. % -% Clear to next page is |\clearpage|. +% Clear to next page is \cs{clearpage}. % % \begin{macro}{\cleartoevenpage} -% |\cleartoevenpage[|\meta{text}|}| clears to the next even +% \cs{cleartoevenpage}\oarg{text} clears to the next even % numbered page, % putting the optional \meta{text} on the skipped page, if any. % \begin{macrocode} @@ -23740,10 +29285,10 @@ % \end{macrocode} % \end{macro} % -% Move to the next page without flushing floats is |\newpage|. +% Move to the next page without flushing floats is \cs{newpage}. % % \begin{macro}{\movetoevenpage} -% |\movetoevenpage[|\meta{text}|}| moves to the next even +% \cs{movetoevenpage}\oarg{text} moves to the next even % numbered page without flushing floats, % putting the optional \meta{text} on the skipped page, if any. % \begin{macrocode} @@ -23769,7 +29314,7 @@ % \end{macro} % % \begin{macro}{\movetooddpage} -% |\movetooddpage[|\meta{text}|}| moves to the next odd +% \cs{movetooddpage}\oarg{text} moves to the next odd % numbered page without flushing floats, % putting the optional \meta{text} on the skipped page, if any. % \begin{macrocode} @@ -23794,7 +29339,7 @@ % \subsection{Needing space at the bottom of a page} % % \begin{macro}{\needspace} -% |\needspace{|\meta{length}|}| checks if the is \meta{length} amount +% \cs{needspace}\marg{length} checks if the is \meta{length} amount % of vertical space left on the page. If there is not it will start % a new page. The code is a variant of code thought of for the % \Lpack{needspace} package~\cite{NEEDSPACE}. @@ -23809,10 +29354,10 @@ % % \begin{macro}{\Needspace} % \begin{macro}{\Needspace*} -% |\Needspace| and |\Needspace*| are more robust versions of |\needspace|, -% which depends on penalties. If either |\needspace| or |\Needspace| -% produce a short page it will be ragged bottom, even if |\flushbottom| -% is in effect. The |\Needspace*| version honours the |\...bottom| +% \cs{Needspace} and \cs{Needspace*} are more robust versions of \cs{needspace}, +% which depends on penalties. If either \cs{needspace} or \cs{Needspace} +% produce a short page it will be ragged bottom, even if \cs{flushbottom} +% is in effect. The \cs{Needspace*} version honours the \cs{...bottom} % declaration. % \begin{macrocode} \newcommand{\Needspace}{\@ifstar{\M@sneedsp@}{\M@needsp@}} @@ -23822,7 +29367,7 @@ % % \begin{macro}{\M@sneedsp@} % \begin{macro}{\M@needsp@} -% These implement |\Needspace*| and |\Needspace| respectively. +% These implement \cs{Needspace*} and \cs{needspace} respectively. % \begin{macrocode} \newcommand{\M@sneedsp@}[1]{\par \penalty-100\begingroup \setlength{\dimen@}{#1}% @@ -23844,6 +29389,46 @@ % \end{macro} % \end{macro} % +% +% \subsection{Overlong lines} +% +% LaTeX provides \cs{fussy} and \cs{sloppy} to control the amount of slack +% in a line while trying to make justified lines. Their definitions are: +% \begin{verbatim} +% \def\fussy{% +% \emergencystretch\z@ +% \tolerance 200% +% \hfuzz .1\p@ +% \vfuzz\hfuzz} +% \def\sloppy{% +% \tolerance 9999% +% \emergencystretch 3em% +% \hfuzz .5\p@ +% \vfuzz\hfuzz} +% \end{verbatim} +% +% \begin{macro}{\midsloppy} +% Somewhere between \cs{fussy} and \cs{sloppy}. +% \changes{v1.61803}{2008/01/30}{Added \cs{midsloppy} and midsloppypar +% (mempatch v4.5)} +% \begin{macrocode} +\newcommand*{\midsloppy}{% + \tolerance 5000% + \hbadness 4000% + \emergencystretch 1.5em% + \hfuzz .1\p@ + \vfuzz\hfuzz} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{midsloppypar} +% A paragraph form of \cs{midsloppy}; equivalent to \verb?\par \midsloppy ... \par}? +% \begin{macrocode} +\newenvironment{midsloppypar}{\par\midsloppy}{\par} + +% \end{macrocode} +% \end{environment} +% % \subsection{Text spacing commands} % % While we're at it, new text spacing commands to supplement @@ -23878,7 +29463,7 @@ % Styles for fractions like 3/4. % % \begin{macro}{\slashfracstyle} -% |\slashfracstyle| based on the kernel |\textsuperscript| macro +% \cs{slashfracstyle} based on the kernel \cs{textsuperscript} macro % \changes{v1.4}{2003/11/16}{Added \cs{slashfrac} and supports (from patch v1.4)} % \begin{macrocode} \DeclareRobustCommand*{\slashfracstyle}[1]{% @@ -23887,7 +29472,7 @@ % \end{macro} % % \begin{macro}{\slashfrac} -% |\slashfrac| based on TeXbook exercise 11.6 +% \cs{slashfrac} based on TeXbook exercise 11.6 % \begin{macrocode} \DeclareRobustCommand*{\slashfrac}[2]{\leavevmode \raise.5ex\hbox{\slashfracstyle{#1}}\kern-.13em/% @@ -23898,8 +29483,8 @@ % % \begin{macro}{\textsubscript} % \begin{macro}{\@textsubscript} -% |\textsubscript|, for text subscripts, based on the kernel -% |\textsuperscript| macro. +% \cs{textsubscript}, for text subscripts, based on the kernel +% \cs{textsuperscript} macro. % \changes{v1.4}{2003/11/16}{Added \cs{textsubscript} and supports % (from patch v1.5)} % \begin{macrocode} @@ -24060,8 +29645,8 @@ % \end{macro} % % \begin{macro}{\numdigits} -% |\numdigits|\marg{number} splits the \meta{number} into individual digits. -% It sets |\minusnumbertrue| if the number is negative, otherwise it is false. +% \cs{numdigits}\marg{number} splits the \meta{number} into individual digits. +% It sets \cs{minusnumbertrue} if the number is negative, otherwise it is false. % \begin{macrocode} \newcommand*{\numdigits}[1]{% \setcounter{ism@mctr}{0}% @@ -24148,14 +29733,13 @@ \divide \c@workm@mctr by \m@mten \multiply \c@workm@mctr by \m@mten \advance \c@bsm@mctr by -\c@workm@mctr - \fi -} + \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\form@tnumber} -% |\form@tnumber|\marg{number} formats \meta{number} as digits. +% \cs{form@tnumber}\marg{number} formats \meta{number} as digits. % \begin{macrocode} \newcommand*{\form@tnumber}[1]{% \numdigits{#1}% @@ -24229,14 +29813,13 @@ \thexsm@mctr \fi \fi - \theism@mctr % units -} + \theism@mctr} % units % \end{macrocode} % \end{macro} % % \begin{macro}{\cardinal} -% |\cardinal|\marg{number} prints \meta{number} unformatted. +% \cs{cardinal}\marg{number} prints \meta{number} unformatted. % \begin{macrocode} \newcommand*{\cardinal}[1]{% \begingroup @@ -24247,7 +29830,7 @@ % \end{macro} % % \begin{macro}{\fcardinal} -% |\fcardinal|\marg{number} prints \meta{number} formatted. +% \cs{fcardinal}\marg{number} prints \meta{number} formatted. % \begin{macrocode} \newcommand*{\fcardinal}[1]{% \begingroup @@ -24258,7 +29841,7 @@ % \end{macro} % % \begin{macro}{\ordinal} -% |\ordinal|\marg{number} prints \meta{number} as an unformatted ordinal. +% \cs{ordinal}\marg{number} prints \meta{number} as an unformatted ordinal. % \begin{macrocode} \newcommand*{\ordinal}[1]{% \begingroup @@ -24279,7 +29862,7 @@ % \end{macro} % % \begin{macro}{\fordinal} -% |\fordinal|\marg{number} prints \meta{number} as a formatted ordinal. +% \cs{fordinal}\marg{number} prints \meta{number} as a formatted ordinal. % \begin{macrocode} \newcommand*{\fordinal}[1]{% \begingroup @@ -24490,7 +30073,7 @@ % \end{macrocode} % \end{macro} % -% Names of small ordinals. The use of |\nthstring| instead of `th' saves +% Names of small ordinals. The use of \cs{nthstring} instead of `th' saves % some tokens. % \begin{macrocode} \newcommand*\nthNameo{\nNameo\nthstring} @@ -24526,7 +30109,7 @@ % \end{macro} % % \begin{macro}{\teenordinalname} -% Get the ordinal name of a 'teen number (10 -- 19). Using |\nthstring| +% Get the ordinal name of a 'teen number (10 -- 19). Using \cs{nthstring} % instead of `th' to save some tokens. % \begin{macrocode} \newcommand*{\teenordinalname}[1]{% @@ -24587,7 +30170,7 @@ % \end{macrocode} % \end{macro} % -% The names of tens ordinals. The use of |\tiethstring| instead +% The names of tens ordinals. The use of \cs{tiethstring} instead % of `tieth' saves somes tokens. % \begin{macrocode} \newcommand*\nthNamexx{\iflowernumtoname t\else T\fi wen\tiethstring} @@ -24602,7 +30185,7 @@ % \end{macrocode} % % \begin{macro}{\n@me@number} -% |\n@me@number|\meta{number} is an internal macro to convert a +% \cs{n@me@number}\marg{number} is an internal macro to convert a % \meta{number} to names. % \begin{macrocode} \newcommand*{\n@me@number}[1]{% @@ -24725,16 +30308,16 @@ \fi \fi \fi % end ifmakeordinal -\endgroup -} +\endgroup} % \end{macrocode} % \end{macro} % +% \changes{v1.61803}{2008/01/30}{Made all \cs{(num/ordinal)toname} robust} % \begin{macro}{\numtoname} % Lowercase all names % \begin{macrocode} -\newcommand*{\numtoname}[1]{% +\DeclareRobustCommand{\numtoname}[1]{% \makeordinalfalse \notnumtonameallcapstrue% \lowernumtonametrue% @@ -24746,7 +30329,7 @@ % \begin{macro}{\numtoName} % Uppercase first letter of first name (all else lowercase). % \begin{macrocode} -\newcommand*{\numtoName}[1]{% +\DeclareRobustCommand{\numtoName}[1]{% \makeordinalfalse \notnumtonameallcapstrue% \lowernumtonamefalse% @@ -24758,7 +30341,7 @@ % \begin{macro}{\NumToName} % Uppercase first letter of all names (all else lowercase). % \begin{macrocode} -\newcommand*{\NumToName}[1]{% +\DeclareRobustCommand{\NumToName}[1]{% \makeordinalfalse \notnumtonameallcapsfalse% \lowernumtonamefalse% @@ -24770,7 +30353,7 @@ % \begin{macro}{\ordinaltoname} % Lowercase all ordinal names % \begin{macrocode} -\newcommand*{\ordinaltoname}[1]{% +\DeclareRobustCommand{\ordinaltoname}[1]{% \makeordinaltrue \notnumtonameallcapstrue% \lowernumtonametrue% @@ -24782,7 +30365,7 @@ % \begin{macro}{\ordinaltoName} % Uppercase first letter of first ordinal name (all else lowercase). % \begin{macrocode} -\newcommand*{\ordinaltoName}[1]{% +\DeclareRobustCommand{\ordinaltoName}[1]{% \makeordinaltrue \notnumtonameallcapstrue% \lowernumtonamefalse% @@ -24794,7 +30377,7 @@ % \begin{macro}{\OrdinalToName} % Uppercase first letter of all ordinal names (all else lowercase). % \begin{macrocode} -\newcommand*{\OrdinalToName}[1]{% +\DeclareRobustCommand{\OrdinalToName}[1]{% \makeordinaltrue \notnumtonameallcapsfalse% \lowernumtonamefalse% @@ -24808,7 +30391,7 @@ % % % This is from a posting by Donald Arseneau to \ctt{} on 23 April 2001 to fix -% a problem --- `When I use |\onecolumn\chapter...| its headline +% a problem --- `When I use \verb?\onecolumn\chapter...? its headline % is printed lower on the page than for two-column chapters' % % DA and I had previously discussed this in relation to the Index @@ -24816,9 +30399,9 @@ % % Donald posted the following. % -% |\vspace*| gives bad spacing after a pagebreak and |\@makechapterhead| -% starts with |\vspace*|. -% The biggest problem is the definition of |\@topnewpage|, which is used +% \cs{vspace*} gives bad spacing after a pagebreak and \cs{@makechapterhead} +% starts with \cs{vspace*}. +% The biggest problem is the definition of \cs{@topnewpage}, which is used % for the two-column spanning text. Here is a redefinition: % \changes{v0.2}{2001/06/03}{Added DA's redefinition of \cs{@topnewpage}} % \begin{macro}{\@topnewpage} @@ -24871,15 +30454,266 @@ \global \vsize \@colht \global \@colroom \@colht \@floatplacement + \fi} + +% \end{macrocode} +% \end{macro} +% +% The original version of \cs{@topnewpage} is in \file{ltouput.dtx}, line 159. +% +% \subsection{Time of day} +% +% William Adams (2006/08/28) supplied a basis for +% \cs{printime}, which he needed for \cs{quarkmarks} but I have used one +% from \textit{TeX for the Impatient} +% as it saves some counters. +% \changes{v1.61803}{2008/01/30}{Added \cs{printime} and friends (mempatch v4.6)} +% \begin{macro}{\m@mcalchm} +% Calculate the hours and minutes from \cs{time}. +% \begin{macrocode} +\newcommand*{\m@mcalchm}{% + \count0 = \time \divide \count0 by 60\relax + \count2 = \count0\relax% the hour + \count4 = \time \multiply\count0 by 60\relax + \advance\count4 by -\count0\relax% the minute + \ifnum\count4<10 \toks1 = {0}% make a leading zero + \else \toks1 = {}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hmpunct} +% \begin{macro}{\amname} +% \begin{macro}{\pmname} +% User format controls for \cs{printtime} +% \begin{macrocode} +%%% punctuation, am and pm for \printtime +\newcommand*{\hmpunct}{:}% hours minutes separator +\newcommand*{\amname}{am}% ante meridiem +\newcommand*{\pmname}{pm}% post meridiem + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\printtime} +% \begin{macro}{\printtime*} +% Print the time of day as 24 hour clock or 12 hour clock +% \cs{printtime} prints the time par 24 hour clock and \cs{printtime*} +% per 12 hour clock. +% \begin{macrocode} +\newcommand*{\printtime}{% + \@ifstar{\m@msprtime}{\m@mprtime}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\m@mprtime} +% \begin{macro}{\m@msprtime} +% These implement time printing: \cs{m@mprtime} as 24 hour clock and +% \cs{m@msprtime} as 12 hour clock +% \begin{macrocode} +\newcommand*{\m@mprtime}{\begingroup + \m@mcalchm + \number\count2\hmpunct\the\toks1 \number\count4 + \endgroup} +\newcommand*{\m@msprtime}{\begingroup + \m@mcalchm + \def\@mpm{\pmname}% + \ifnum\count2<1\relax% early in the morning + \count2=12\relax + \ifnum\count4>0\relax% not midnight + \def\@mpm{\amname}% + \fi + \else + \ifnum\time<721\relax% noon or earlier + \def\@mpm{\amname}% + \else + \ifnum\time>779\relax% 1300 hrs or later + \advance\count2 by -12\relax + \fi + \fi \fi -} + \number\count2\hmpunct\the\toks1 \number\count4\ \@mpm + \endgroup} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Sequential sheet (page) numbers} +% +% \begin{macro}{\c@sheetsequence} +% Peter Heslin asked for the ability to add a sequential page number +% (1 for the first page, N for the last page, no matter what value +% the page counter has) to the trimming marks. +% +% \cs{c@sheetsequence} is a new counter for pages starting at the +% beginning and independent +% of the standard page counter. This should not be reset by anything. +% The counter increment has to be added to the output routine. +% +% This may also be useful for page N of M numbering. +% \changes{v1.3}{2002/10/10}{Added sheetsequence counter.} +% \begin{macrocode} +\newcounter{sheetsequence} + \setcounter{sheetsequence}{1} + \renewcommand{\thesheetsequence}{\@arabic\c@sheetsequence} +\g@addto@macro{\@outputpage}{\stepcounter{sheetsequence}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\c@lastsheet} +% \begin{macro}{\c@lastpage} +% While we're at it, might as well provide for lastpage and lastsheet counters +% \changes{v1.3}{2002/11/14}{Added lastsheet and lastpage functions.} +% \begin{macrocode} +\newcounter{lastsheet} + \setcounter{lastsheet}{0} +\newcounter{lastpage} + \setcounter{lastpage}{0} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\dol@stsheet} +% \begin{macro}{\dol@stpage} +% These two macros write the values of lastsheet and lastpage to the +% \file{aux} file. They have to be called at the end of the document +% after a \cs{clearpage} to flush out any floats. +% \changes{v1.4}{2003/02/27}{In \cs{dol@stpage} use the page counter value, +% not \cs{thepage} otherwise problems with +% non-arabic page numbers (patch 1.1)} +% \changes{v1.61}{2004/03/21}{In \cs{dol@stpage} use the sheet counter value, +% not \cs{thesheetsequence} otherwise problems +% if (e.g., hangul.sty) \cs{@arabic} is redefined} +% \changes{v1.618}{2005/09/02}{Made \cs{dol@stsheet} and \cs{dol@stpage} +% obey \cs{nofiles}} +% \changes{v1.61803}{2008/01/30}{Made \cs{dol@stsheet} and \cs{dolastpage} +% use \cs{memsetcounter} instead of \cs{setcounter}} + +% \begin{macrocode} +\newcommand{\dol@stsheet}{% + \if@filesw + \addtocounter{sheetsequence}{-1}% + \immediate\write\@auxout% + {\string\memsetcounter{lastsheet}{\the\c@sheetsequence}}% + \stepcounter{sheetsequence}% + \fi} +\newcommand{\dol@stpage}{% + \if@filesw + \addtocounter{page}{-1}% + \immediate\write\@auxout% + {\string\memsetcounter{lastpage}{\the\c@page}}% + \stepcounter{page}% + \fi} +% \end{macrocode} +% I originally used this: \\ +% \verb?\AtEndDocument{\clearpage\dol@stsheet\dol@stpage}? +% but following the CTT thread \textit{AtEndDocument produces unwanted page +% break}, 2004/03/11, and in particular Dan Luecking's response I now +% try as hard as possible to do it right at the end, but even this is not +% 100\% reliable. The only way to ensure reliability is to modify the kernel +% \verb?\enddocument? which doesn't seem to be a particularly wise thing +% to do. +% \changes{v1.61}{2004/03/14}{Changed location of calls to \cs{dol@stsheet} +% and \cs{dol@stpage}} +% \begin{macrocode} +\AtBeginDocument{\AtEndDocument{\clearpage\dol@stsheet\dol@stpage}} % \end{macrocode} % \end{macro} +% \end{macro} % -% The original version of |\@topnewpage| is in \file{ltouput.dtx}, line 159. +% \subsection{Leaves per gathering} % +% Traditionally books are assembled in terms of gatherings, or signatures, +% with perhaps 8 or 16 pages (or leaves) per grouping (a leaf has two pages, +% recto and one verso). At the request of Alan Ristow code for this has +% been included in the class. % +% \begin{macro}{\ifcntrmod} +% \begin{macro}{\ifnotcntrmod} +% \begin{macro}{\iscntrmod} +% \cs{iscntrmod}\marg{counter}\marg{number} returns \cs{cntrmod(true|false)} +% and \cs{notcntrmod(false|true)} if \meta{counter} is a multiple of +% \meta{number}. +% \changes{v1.61803}{2008/01/30}{Added \cs{iscntrmod}} +% \begin{macrocode} +\newif\ifcntrmod +\newif\ifnotcntrmod +\newcommand*{\iscntrmod}[2]{ + \@tempcnta=\@nameuse{c@#1}% + \@tempcntb=\@tempcnta + \divide\@tempcnta #2\relax + \multiply\@tempcnta #2\relax + \advance\@tempcntb-\@tempcnta + \ifnum\@tempcntb=0\relax + \cntrmodtrue + \notcntrmodfalse + \else + \cntrmodfalse + \notcntrmodtrue + \fi} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@memensuresigpages} +% Ouput enough (empty) pages to make up a complete final signature. +% \changes{v1.61803}{2008/01/30}{Added \cs{@memensuresigpages}} +% \begin{macrocode} +\newcommand*{\@memensuresigpages}{% + \ifnum\@mempagespersig<\@ne + \else + \iscntrmod{sheetsequence}{\@mempagespersig} + \ifcntrmod + \else + \clearpage + \pagestyle{empty} + \mbox{} + \loop + \iscntrmod{sheetsequence}{\@mempagespersig} + \ifnotcntrmod + \clearpage + \pagestyle{empty} + \mbox{} + \repeat + \fi + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\leavespergathering} +% \cs{leavespergathering}\marg{num} is the user command for specifying that +% there must be \meta{num} leaves per gathering (2\meta{num} pages per +% gathering). For \meta{num} more than one the total number of pages output +% is exactly divisible by 2\meta{num}. \meta{num} less than two (the default) +% has no effect. +% \changes{v1.61803}{2008/01/30}{Added \cs{leavespergathering}} +% \begin{macrocode} +\newcommand*{\leavespergathering}[1]{\@memcnta=#1\relax + \ifnum\@memcnta<\tw@ + \def\@mempagespersig{-1}% + \else + \multiply\@memcnta \tw@ + \edef\@mempagespersig{\@memcnta}% + \fi} +\leavespergathering{0} + +% \end{macrocode} +% \end{macro} +% +% Finally, make sure that the requested number of pages is output. +% \begin{macrocode} +\AtEndDocument{\@memensuresigpages} + +% \end{macrocode} % % \section{Initialization} \label{sec:init} % @@ -24895,6 +30729,7 @@ % \begin{macro}{\contentsname} % \begin{macro}{\listfigurename} % \begin{macro}{\listtablename} +% \begin{macro}{\bookname} % \begin{macro}{\partname} % \begin{macro}{\chaptername} % \begin{macro}{\appendixname} @@ -24911,6 +30746,7 @@ \newcommand*{\contentsname}{Contents} \newcommand*{\listfigurename}{List of Figures} \newcommand*{\listtablename}{List of Tables} +\newcommand*{\bookname}{Book} \newcommand*{\partname}{Part} \newcommand*{\chaptername}{Chapter} \newcommand*{\appendixname}{Appendix} @@ -24932,6 +30768,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\figurename} % \begin{macro}{\tablename} @@ -24957,26 +30794,35 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\bookrefname} % \begin{macro}{\partrefname} % \begin{macro}{\chapterrefname} % \begin{macro}{\sectionrefname} +% \begin{macro}{\appendixrefname} % More names for referencing. % \changes{v1.2}{2002/07/27}{Added \cs{partrefname}, \cs{chapterrefname} % and \cs{sectionrefname}} +% \changes{v1.61803}{2008/01/30}{Added \cs{bookrefname} (mempatch v4.9+)} +% \changes{v1.61803}{2008/05/17}{Added \cs{appendixrefname}} % \begin{macrocode} +\newcommand*{\bookrefname}{Book~} \newcommand*{\partrefname}{Part~} \newcommand*{\chapterrefname}{Chapter~} \newcommand*{\sectionrefname}{\S} +\newcommand*{\appendixrefname}{Appendix~} + % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % % \subsection{Date} % % \begin{macro}{\today} -% This macro uses the \TeX\ primitives |\month|, |\day| and |\year| +% This macro uses the \TeX\ primitives \cs{month}, \cs{day} and \cs{year} % to provide the date of the \LaTeX-run. % \begin{macrocode} \newcommand{\today}{\ifcase\month\or @@ -25011,9 +30857,9 @@ \pagenumbering{arabic} % \end{macrocode} -% We set the sectional counters to zero, the |tocdepth| to -% one (sections and above listed), the |secnumdepth| to -% two (sections and above numbered), and |\maxsecnumdepth| to +% We set the sectional counters to zero, the \verb?tocdepth? to +% one (sections and above listed), the \verb?secnumdepth? to +% two (sections and above numbered), and \cs{maxsecnumdepth} to % the same. % \changes{v1.1a}{2002/04/28}{Added initialisation of \cs{maxsecnumdepth}} % \begin{macrocode} @@ -25025,7 +30871,7 @@ % \end{macrocode} % -% Set the |\linenumberfrequency| to zero to prohibit line numbering +% Set the \cs{linenumberfrequency} to zero to prohibit line numbering % and also set the font for line numbers. Can now set the final space % for boxed verbatim line numbers. % \begin{macrocode} @@ -25048,15 +30894,15 @@ \fi % \end{macrocode} % When the \Lopt{twocolumn} option was specified we call -% |\twocolumn| to activate this mode. We try to make each column as -% long as the others, but call |sloppy| to make our life easier. +% \cs{twocolumn} to activate this mode. We try to make each column as +% long as the others, but call \cs{sloppy} to make our life easier. % \begin{macrocode} \if@twocolumn \twocolumn \sloppy \flushbottom % \end{macrocode} -% Normally we call |\onecolumn| to initiate typesetting in one +% Normally we call \cs{onecolumn} to initiate typesetting in one % column. % \begin{macrocode} \else @@ -25073,15 +30919,17 @@ % \begin{environment}{figure} % \begin{environment}{figure*} % This is the definition of the actual environment. The form with the -% |*| is used for double column figures. We use |\newfloat| to set it. +% \verb?*? is used for double column figures. We use \cs{newfloat} to set it. % In this class figures are numbered per chapter, but we need to change -% the default definition of |\thefigure| if a figure +% the default definition of \cs{thefigure} if a figure % is in a pre-numbered chapter. % \changes{v1.3a}{2002/11/22}{Added \cs{kill@lastcounter} after new % figure float} +% \changes{v1.61803}{2008/01/30}{Killed \cs{kill@lastcounter} after new +% figure float} % \begin{macrocode} \newfloat[chapter]{figure}{lof}{\figurename} - \kill@lastcounter{lofdepth} +%%% \kill@lastcounter{lofdepth} \renewcommand{\thefigure}{\thechapter.\@arabic\c@figure} % \end{macrocode} @@ -25095,16 +30943,18 @@ % version is used. % \changes{v1.3}{2002/11/14}{Added \cs{kill@lastcounter} after new % list of figures} +% \changes{v1.61803}{2008/01/30}{Killed \cs{kill@lastcounter} after new +% listoffigures} % \begin{macrocode} \newlistof{listoffigures}{lof}{\listfigurename} - \kill@lastcounter{lofdepth} +%%% \kill@lastcounter{lofdepth} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\l@figure} -% |\l@figure{|\meta{title}|}{|\meta{page}|}| typesets the LoF entry for -% a |figure| caption heading. +% \cs{l@figure}\marg{title}\marg{page} typesets the LoF entry for +% a \cs{figure} caption heading. % \changes{v1.3a}{2002/11/22}{Deleted \cs{kill@lastcounter} after new % figure listentry} % \begin{macrocode} @@ -25121,9 +30971,11 @@ % The definition for tables is almost identical. % \changes{v1.3a}{2002/11/22}{Added \cs{kill@lastcounter} after new % table float} +% \changes{v1.61803}{2008/01/30}{Killed \cs{kill@lastcounter} after new +% table float} % \begin{macrocode} \newfloat[chapter]{table}{lot}{\tablename} - \kill@lastcounter{lotdepth} +%%% \kill@lastcounter{lotdepth} \renewcommand{\thetable}{\thechapter.\@arabic\c@table} % \end{macrocode} @@ -25137,16 +30989,18 @@ % version is used. % \changes{v1.3}{2002/11/14}{Added \cs{kill@lastcounter} after new % list of tables} +% \changes{v1.61803}{2008/01/30}{Killed \cs{kill@lastcounter} after new +% list of tables} % \begin{macrocode} \newlistof{listoftables}{lot}{\listtablename} - \kill@lastcounter{lotdepth} +%%% \kill@lastcounter{lotdepth} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\l@table} -% |\l@table{|\meta{title}|}{|\meta{page}|}| typesets the LoT entry for -% a |table| caption heading. +% \cs{l@table}\marg{title}\marg{page} typesets the LoT entry for +% a \cs{table} caption heading. % \changes{v1.3a}{2002/11/22}{Deleted \cs{kill@lastcounter} after new % table listentry} % \begin{macrocode} @@ -25157,15 +31011,20 @@ % \end{macrocode} % \end{macro} % -% The \Lpack{subfigure} package defines |lofdepth| and |lotdepth| -% counters. If is not used, then we have to define them. +% The \Lpack{subfigure} package defines \verb?lofdepth? and \verb?lotdepth? +% counters. If is not used, then we have to define them. The \Lpack{subfig} +% package replaced \Lpack{subfigure} in 2005, and this only defined +% the counters if they were not previously defined. It now seems sensible +% to ignore any use of the \Lpack{subfigure} package. This makes life a lot +% simpler. +% \changes{v1.61803}{2008/01/30}{Ignore subfig(ure) package re \cs{lofdepth} +% and \cs{lotdepth}} % \begin{macrocode} -\AtBeginDocument{% - \@ifundefined{c@lofdepth}% - {\newcounter{lofdepth}\setcounter{lofdepth}{1}}{} - \@ifundefined{c@lotdepth}% - {\newcounter{lotdepth}\setcounter{lotdepth}{1}}{} -} +%%%\AtBeginDocument{% +%%% \@ifundefined{c@lofdepth}% +%%% {\newcounter{lofdepth}\setcounter{lofdepth}{1}}{} +%%% \@ifundefined{c@lotdepth}% +%%% {\newcounter{lotdepth}\setcounter{lotdepth}{1}}{}} % \end{macrocode} % @@ -25174,7 +31033,7 @@ % The \Lopt{article} option requires changes to the default chapterstyle, % and the numbering of floats, etc. % -% Emanuele Vicentini (2003/07/21) suggested making |\maketitle| more +% Emanuele Vicentini (2003/07/21) suggested making \cs{maketitle} more % closely match the real article's appearance. % Alan Budden\footnote{\texttt{alan.s.budden@bristol.ac.uk}} commented % on 2003/12/18 that the equation counter should be continuous. @@ -25206,7 +31065,7 @@ % \begin{macro}{\msdoublespacing} % \begin{macro}{\mssinglespacing} % These do nothing unless the \Lopt{ms} option is used; then they change -% the |\baselinestretch|. +% the \cs{baselinestretch}. % \begin{macrocode} \newcommand{\msdoublespacing}{} \newcommand{\mssinglespacing}{} @@ -25246,6 +31105,7 @@ \EmulatedPackage{array} \EmulatedPackage{booktabs} \EmulatedPackage{ccaption} +\EmulatedPackage{changepage} \EmulatedPackage{chngcntr} \EmulatedPackage{chngpage} \EmulatedPackage{crop} @@ -25253,16 +31113,21 @@ \EmulatedPackage{delarray} \EmulatedPackage{enumerate} \EmulatedPackage{epigraph} -\EmulatedPackage{framed} +%%%%%\EmulatedPackage{framed} \EmulatedPackage{ifmtarg} \EmulatedPackage{ifpdf} +\EmulatedPackage{ifxetex} \EmulatedPackage{index} \EmulatedPackage{makeidx} \EmulatedPackage{moreverb} +\EmulatedPackage{mparhack} \EmulatedPackage{needspace} \EmulatedPackage{newfile} \EmulatedPackage{nextpage} +\EmulatedPackage{pagenote} +\EmulatedPackage{parskip} \EmulatedPackage{patchcmd} +\EmulatedPackage{setspace} \EmulatedPackage{shortvrb} \EmulatedPackage{showidx} \EmulatedPackage{tabularx} @@ -25275,6 +31140,85 @@ % \end{macrocode} % +% \subsection{Interaction with the \Lpack{caption} package} +% +% Although the author of the \Lpack{caption} package has, over the years, +% made it work +% with many other classes he has not extended it to either recognise +% or work with the memoir +% class. Some authors want to use the \Lpack{caption} package, hence\ldots +% +% Kill changes to the caption macros when the \Lpack{caption} package is used. +% The \Lpack{caption} package checks the definitions of the \cs{@makecaption}, +% \cs{caption} and \cs{@caption} macros. These need to be identical to the +% definitions in the standard classes for the package to disbelieve that +% the \Lpack{memoir} class is being used. +% +% \begin{macro}{\@makecaption} +% \begin{macro}{\caption} +% \begin{macro}{\@caption} +% \changes{v1.61803}{2008/01/30}{Killed memoir's captioning when the caption +% package is used (mempatch v4.9).} +% \begin{macrocode} +%%% revert changes to captioning macros if the caption package is used. +\AtBeginPackage{caption}{ +\ClassWarningNoLine{memoir}{% + You are using the caption package with the memoir \MessageBreak + class. This may cause unexpected or inconsistent \MessageBreak + results if you use any of memoir's captioning facilities} + +\long\def\@makecaption##1##2{% + \vskip\abovecaptionskip + \sbox\@tempboxa{##1: ##2}% + \ifdim \wd\@tempboxa >\hsize + ##1: ##2\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \vskip\belowcaptionskip} + +\def\caption{% + \ifx\@captype\@undefined + \@latex@error{\noexpand\caption outside float}\@ehd + \expandafter\@gobble + \else + \refstepcounter\@captype + \expandafter\@firstofone + \fi + {\@dblarg{\@caption\@captype}}% +} + +\long\def\@caption##1[##2]##3{% + \par + \addcontentsline{\csname ext@##1\endcsname}{##1}% + {\protect\numberline{\csname the##1\endcsname}{\ignorespaces ##2}}% + \begingroup + \@parboxrestore + \if@minipage + \@setminipage + \fi + \normalsize + \@makecaption{\csname fnum@##1\endcsname}{\ignorespaces ##3}\par + \endgroup} +} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Interaction with the \Lpack{float} package} +% +% The \Lpack{float} package also defines \cs{newfloat}, so kill memoir's +% version when the \Lpack{float} package gets used. +% \changes{v1.61803}{2008/01/30}{Killed \cs{newfloat} when float package is +% used (mempatch v4.9)} +% \begin{macrocode} +\AtBeginPackage{float}{\let\newfloat\relax} + +% \end{macrocode} +% % \subsection{Patch file} % % At the suggestion of Danie Els (\texttt{DanieEls@sun.ac.za}), Dan Leucking diff --git a/Master/texmf-dist/source/latex/memoir/memoir.ins b/Master/texmf-dist/source/latex/memoir/memoir.ins index a7c522b19f9..6ad343c81c6 100644 --- a/Master/texmf-dist/source/latex/memoir/memoir.ins +++ b/Master/texmf-dist/source/latex/memoir/memoir.ins @@ -1,6 +1,6 @@ %% memoir.ins %% Author: Peter Wilson (herries dot press at earthlink dot net) -%% Copyright 2001--2005 Peter R. Wilson +%% Copyright 2001--2008 Peter R. Wilson %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -27,7 +27,7 @@ Author: Peter Wilson (herries dot press at earthlink dot net) Herries Press - Copyright 2001--2005 Peter R. Wilson + Copyright 2001--2008 Peter R. Wilson This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -62,6 +62,12 @@ \generateFile{mem12.clo}{t}{\from{memoir.dtx}{12pt}} \generateFile{mem14.clo}{t}{\from{memoir.dtx}{14pt}} \generateFile{mem17.clo}{t}{\from{memoir.dtx}{17pt}} +\generateFile{mem20.clo}{t}{\from{memoir.dtx}{20pt}} +\generateFile{mem25.clo}{t}{\from{memoir.dtx}{25pt}} +\generateFile{mem30.clo}{t}{\from{memoir.dtx}{30pt}} +\generateFile{mem36.clo}{t}{\from{memoir.dtx}{36pt}} +\generateFile{mem48.clo}{t}{\from{memoir.dtx}{48pt}} +\generateFile{mem60.clo}{t}{\from{memoir.dtx}{60pt}} \Msg{*** Generating the MakeIndex configuration files ***} @@ -82,6 +88,12 @@ \Msg{* \space\space mem12.clo} \Msg{* \space\space mem14.clo} \Msg{* \space\space mem17.clo} +\Msg{* \space\space mem20.clo} +\Msg{* \space\space mem25.clo} +\Msg{* \space\space mem30.clo} +\Msg{* \space\space mem36.clo} +\Msg{* \space\space mem48.clo} +\Msg{* \space\space mem60.clo} \Msg{*} \Msg{*} \Msg{* To produce the documented source run the files ending with} diff --git a/Master/texmf-dist/source/latex/memoir/mempatch.dtx b/Master/texmf-dist/source/latex/memoir/mempatch.dtx index 9dd60a743ca..6808ffc1070 100755 --- a/Master/texmf-dist/source/latex/memoir/mempatch.dtx +++ b/Master/texmf-dist/source/latex/memoir/mempatch.dtx @@ -2,7 +2,7 @@ % % mempatch.dtx % Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net -% Copyright 2001 --- 2007 Peter R. Wilson +% Copyright 2001 --- 2008 Peter R. Wilson % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -19,7 +19,7 @@ % % % \fi -% \CheckSum{7349} +% \CheckSum{482} % % \def\dtxfile{\texttt{mempatch.dtx}} % \def\fileversion{v1.0} \def\filedate{2003/10/04} @@ -58,6 +58,8 @@ % \def\fileversion{v4.8} \def\filedate{2007/01/22} % \def\fileversion{v4.9} \def\filedate{2007/12/14} % \def\fileversion{v4.9a} \def\filedate{2007/12/24} +% \def\fileversion{v4.9a+} \def\filedate{2007/12/31} +% \def\fileversion{v5.0} \def\filedate{2008/05/26} % % \title{The LaTeX \Lpack{memoir} class for configurable book % typesetting: Code patches\thanks{This @@ -726,11 +728,9 @@ % % \section{Patches for the class code} \label{sec:class} % -% At this date, 2005/09/25, with the simultaneous release of memoir v1.618 +% At this date, 2008/05/26, with the simultaneous release of memoir v1.61803 % and the patch file, by definition there are no patches. % -% Subsequently code patches were found to be required. -% % \subsection{Identification} \label{sec:id} % % \changes{v2.0}{2004/01/31}{No code in mempatch.sty} @@ -789,6808 +789,18 @@ % ^^A \ProvidesFile{mempatch.sty}[2007/01/22 v4.8 Patches for memoir class v1.618] % ^^A \ProvidesFile{mempatch.sty}[2007/12/14 v4.9 Patches for memoir class v1.618] % +% ^^A \ProvidesFile{mempatch.sty}[2007/12/24 v4.9a Patches for memoir class v1.618] +% ^^A \ProvidesFile{mempatch.sty}[2007/12/31 v4.9a+ Patches for memoir class v1.618] % \begin{macrocode} -\ProvidesFile{mempatch.sty}[2007/12/24 v4.9a Patches for memoir class v1.618] +\ProvidesFile{mempatch.sty}[2008/05/26 v5.0 Patches for memoir class v1.61803] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Version 4.0 was released simultaneously with version 1.618 of memoir. +%%% Version 5.0 was released simultaneously with version 1.61803 of memoir. %%% By definition there were no patches. -%%% Most of the subsequent additions are noted in the Addendum. -%%% -%%% Version 4.3 introduces the \reparticle macro which is not in the -%%% Addendum. -%%% -%%% Version 4.4 introduces several additional commands, in particular -%%% the \book command provides a document division above Part. See the -%%% code (towards the end) for details of the new commands. -%%% -%%% Version 4.5 introduces commands for switching trim marks off and on -%%% and a \DisemulatePackage macro to negate a prior \EmulatedPackage. -%%% It also provides the functions of the pagenote package for end notes. -%%% See the code (near the end) for details. -%%% -%%% Version 4.6 fixes all known bugs and provides means of increasing -%%% the interlinear and interparagraph spacing, adds some minor new commands, -%%% and provides about a dozen more built-in chapterstyles. -%%% See the code (near the end) for details. -%%% -%%% Version 4.7 fixes tiny bugs introduced in version 4.6 -%%% -%%% Version 4.8 fixes some more little bugs. -%%% -%%% Version 4.9 fixes yet more bugs. It also provides means of formatting -%%% page numbers in the ToC, etc., and improved control over line numbering -%%% for verses and boxed verbatims. -%%% -%%% Version 4.9a fixes the (few) bugs in version 4.9. -%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% \end{macrocode} -% -% -% \section{Mempatch version 4.1} -% -% \begin{macrocode} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%% Version 4.1 (2005/10/03 and later) - -% \end{macrocode} -% -% \begin{macro}{\@ssect} -% Gabriel Guernik on 2005/10/03 discovered that I had made a boo-boo with \cs{memsecstarinfo} -% in \cs{@ssect} by calling it with 3 arguments when it only has two. -% \changes{v4.1}{2005/10/03}{Fixed problem with \cs{memsecstarinfo} in -% \cs{@ssect}} -% \begin{macrocode} -%%%% Use correct number of arguments for \memsecstarinfo (2 not 3). -\def\@ssect#1#2#3#4#5{% - \M@gettitle{#5}% - \memsecstarinfo{\m@msecn@mame}{#5}% - \@mem@old@ssect{#1}{#2}{#3}{#4}{#5}} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Side captions} -% \changes{v4.1}{2005/10/03}{Added all the code for side captions} -% -% \begin{macrocode} -%%%%%%%%%%%% -%%%%%%%%%%%% Side captions -%%%%%%%%%%%% - -% \end{macrocode} -% -% \begin{macro}{\m@mscap@capbox} -% \begin{macro}{\m@mscap@fbox} -% We need two save boxes, one to hold the caption and the other -% for the float material. -% \begin{macrocode} -\newsavebox{\m@mscap@capbox} -\newsavebox{\m@mscap@fbox} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\sidecapsep} -% \begin{macro}{\sidecapwidth} -% \cs{sidecapsep} is the space between the text and the caption, which -% is set in a box \cs{sidecapwidth} wide. These are initialized to -% the \cs{marginpar...} values. -% \begin{macrocode} -\newdimen\sidecapsep - \sidecapsep=\marginparsep -\newdimen\sidecapwidth - \sidecapwidth=\marginparwidth - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\m@m@tempdima} -% \begin{macro}{\m@mscapraise} -% Lengths for internal use. \cs{m@m@tempdima} is meant for general -% temporary use. -% \begin{macrocode} -\newdimen\m@m@tempdima -\newdimen\m@mscapraise - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\sidecapraise} -% Length to make (small) adjustments to the position of the caption wrt the float. -% \begin{macrocode} -\newdimen\sidecapraise - \sidecapraise \z@ - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\setsidecappos} -% \begin{macro}{\m@mscappos} -% \cs{setsidecappos}\marg{pos}, where \meta{pos} is one of \texttt{t}, -% \texttt{c}, or \texttt{b}, sets the vertical position of the caption -% in relation to the float and the result is saved as \cs{m@mscappos}. -% The default is \texttt{c}. -% \begin{macrocode} -\newcommand*{\setsidecappos}[1]{% - \def\m@mscappos{#1}\def\@tempb{t}% - \ifx\@tempb\m@mscappos - \else - \def\@tempb{b}% - \ifx\@tempb\m@mscappos - \else - \def\@tempb{c}% - \ifx\@tempb\m@mscappos - \else - \@memerror{Argument to \string\setsidecappos\space is not t or c or b. - \MessageBreak Set to c}{\@ehc}% - \def\m@mscappos{c}% - \fi - \fi - \fi} -\setsidecappos{c} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\sidecapmargin} -% \begin{macro}{\m@mscapmarg} -% \cs{sidecapmargin}\marg{margin}, where \meta{marg} is one of -% \texttt{left}, \texttt{right}, \texttt{inner}, or \texttt{outer}, -% controls the margin where the caption will be put. The result -% is saved as \cs{m@mscapmarg} as a number. The default -% is \texttt{left}. -% \begin{macrocode} -\newcommand{\sidecapmargin}[1]{% - \def\@tempa{#1}\def\@tempb{left}% - \ifx\@tempb\@tempa - \def\m@mscapmarg{0}% left - \else - \def\@tempb{right}% - \ifx\@tempb\@tempa - \def\m@mscapmarg{1}% right - \else - \def\@tempb{outer}% - \ifx\@tempb\@tempa - \def\m@mscapmarg{2}% outer - \else - \def\@tempb{inner}% - \ifx\@tempb\@tempa - \def\m@mscapmarg{3}% inner - \else - \@memerror{Unrecognized argument for \string\sidecapmargin}% - {\@ehc}% - \def\m@mscapmarg{-1}% error - \fi - \fi - \fi - \fi} -\sidecapmargin{left} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\ifscapmargleft} -% \begin{macro}{\scapmarglefttrue} -% \begin{macro}{\scapmargleftfalse} -% \cs{ifscapmargleft} is TRUE the caption should be in the left hand margin, -% otherwise in the right hand margin. -% \begin{macrocode} -\newif\ifscapmargleft - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\sidecapfloatwidth} -% \begin{macro}{\m@mscapmainwidth} -% \cs{sidecapfloatwidth} is the width of the box holding the float. -% Note that this is a macro, -% not a length, so must be changed using \cs{renewcommand*}. -% The default is \cs{linewidth}. Later, \cs{m@mscapmainwidth} will be set -% to the current length specification from \cs{sidecapfloatwidth}. -% \begin{macrocode} -\def\sidecapfloatwidth{\linewidth} -\newdimen\m@mscapmainwidth - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\m@mscaplkern} -% \begin{macro}{\setm@mscaplkern} -% \cs{setm@mscaplkern} is a utility macro to calculate the kern -% (\cs{m@mscaplkern}) required when the caption is in the left margin. -% \begin{macrocode} -\newdimen\m@mscaplkern -\newcommand*{\setm@mscaplkern}{% - \m@mscaplkern=\sidecapwidth - \advance\m@mscaplkern \sidecapsep - \advance\m@mscaplkern \m@mscapmainwidth} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\sidecapstyle} -% \cs{sidecapstyle} is called just before the caption is set. It can -% be redefined to set different caption style parameters. The default -% is raggedleft for left margin captions and raggedright for right -% margin captions. -% \begin{macrocode} -\newcommand*{\sidecapstyle}{% -%%% \captionnamefont{\bfseries}% - \ifscapmargleft - \captionstyle{\raggedleft}% - \else - \captionstyle{\raggedright}% - \fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\sidecaption} -% The whole shebang is in the \texttt{sidecaption} environment but -% it is more convenient to specify this via macros rather than -% directly as an environment. -% -% \cs{sidecaption}\oarg{fortoc}\marg{title}\oarg{label} is what it -% looks like to the user, but internally further macros handle -% all the arguments. -% \begin{macrocode} -\newcommand*{\sidecaption}{% - \@ifnextchar [{\@sidecaption}{\@sidecaption[]}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@sidecaption} -% \cs{@sidecaption}\oarg{fortoc}\marg{title} grabs the first -% two arguments. -% \begin{macrocode} -\def\@sidecaption[#1]#2{% - \@ifnextchar [{\@@sidecaption{#1}{#2}}{\@@sidecaption{#1}{#2}[]}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@sidecaption} -% \cs{@@sidecaption}\marg{fortoc}\marg{title}\oarg{label} is the -% last macro in the chain and handles all three arguments. -% This does all the work for \verb?\begin{sidecaption}? -% \begin{macro}{\m@mscap@fortoc} -% \begin{macro}{\m@mscap@forcap} -% \begin{macro}{\m@mscaplabel} -% First, save all the arguments as macros. -% \begin{macrocode} -\def\@@sidecaption#1#2[#3]{% - \ifx\@empty#1\@empty - \def\m@mscap@fortoc{#2}% - \else - \def\m@mscap@fortoc{#1}% - \fi - \def\m@mscap@forcap{#2}% - \ifx\@empty#3\@empty - \def\m@mscaplabel{}% - \else - \def\m@mscaplabel{\@bsphack\label{#3}\@esphack}% - \fi -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% Set the float width, calculate the left margin kern, and start -% a \texttt{minipage} to hold the float, saving it in box -% \cs{m@mscap@fbox}. -% \begin{macrocode} - \m@mscapstart@fbox} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\m@mscapstart@fbox} -% \begin{macro}{\m@mscapend@fbox} -% \cs{m@mscapstart@fbox} is the macro that actually sets the float width, -% calculates the left margin kern, and starts the float's \texttt{minipage}. -% The macro \cs{m@mscapend@fbox} ends the box. -% \begin{macrocode} -\newcommand*{\m@mscapstart@fbox}{% - \setlength{\m@mscapmainwidth}{\sidecapfloatwidth}% - \setm@mscaplkern - \begin{lrbox}{\m@mscap@fbox}% - \begin{minipage}[c]{\m@mscapmainwidth}} -\newcommand*{\m@mscapend@fbox}{% - \end{minipage}% - \end{lrbox}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\endsidecaption} -% \cs{endsidecaption} does the work for \verb?\end{sidecaption}?. -% -% Finish the float minipage, then increment the caption counter and -% call \cs{label} via \cs{m@mscaplabel}. -% \begin{macrocode} -\def\endsidecaption{% - \m@mscapend@fbox - \refstepcounter\@captype - \m@mscaplabel -% \end{macrocode} -% Set the caption inside a minipage, saving it in box \cs{m@mscap@capbox}. -% \begin{macrocode} - \begin{lrbox}{\m@mscap@capbox}% - \begin{minipage}[c]{\sidecapwidth}% - \sidecapstyle - \@caption\@captype[\m@mscap@fortoc]{\m@mscap@forcap} - \end{minipage}% - \end{lrbox}% -% \end{macrocode} -% Output the float and caption. -% \begin{macrocode} - \m@mscapopboxes} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\m@mscapopboxes} -% Having determined how high the caption box must be raised with -% respect to the float box, output the boxes. -% \begin{macrocode} -\newcommand*{\m@mscapopboxes}{% - \m@mcalcscapraise -% \end{macrocode} -% Set the float (from box \cs{m@mscap@fbox}) then the caption (from -% box \cs{m@mscap@capbox}) kerning it to the left or right as -% appropriate. -% \begin{macrocode} - \usebox{\m@mscap@fbox}\m@mscapcheckside - \ifscapmargleft% - \rlap{\kern-\m@mscaplkern - \raisebox{\m@mscapraise}{\usebox{\m@mscap@capbox}}}% - \else% - \rlap{\kern\sidecapsep - \raisebox{\m@mscapraise}{\usebox{\m@mscap@capbox}}}% - \fi -% \end{macrocode} -% Finally, make \cs{m@mscapthisside} a no-op. -% \begin{macrocode} - \gdef\m@mscapthisside{}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\m@mcalcscapraise} -% Calculate the amount the caption might have to be raised wrt the -% float. This depends on the position: \\ -% \texttt{t:} raise by the difference in heights \\ -% \texttt{c:} shouldn't have to do anything as the minipages are meant -% to center aligned \\ -% \texttt{b:} lower by the difference in depths \\ -% -% However, experiments showed that a little bit of tweaking might -% help. The final adjustment, \cs{sidecapraise} is controlled by -% the user. -% \begin{macrocode} -\newcommand*{\m@mcalcscapraise}{% - \def\@tempb{t}% - \ifx\m@mscappos\@tempb - \settoheight{\m@m@tempdima}{\strut\usebox{\m@mscap@capbox}}% - \settoheight{\m@mscapraise}{\usebox{\m@mscap@fbox}}% - \advance\m@mscapraise -\m@m@tempdima - \advance\m@mscapraise 0.5ex - \else - \def\@tempb{b}% - \ifx\m@mscappos\@tempb - \settodepth{\m@m@tempdima}{\usebox{\m@mscap@fbox}}% - \settodepth{\m@mscapraise}{\strut\usebox{\m@mscap@capbox}}% - \advance\m@mscapraise -\m@m@tempdima - \else - \m@mscapraise=\z@ - \advance\m@mscapraise 0.25ex - \fi - \fi - \advance\m@mscapraise \sidecapraise} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\m@mscapcheckside} -% This macro determines whether the caption should be set in the -% left or right margin. In twocolumn documents the caption for a single -% column float is always set in the adjacent margin. Starred floats -% are treated as regular floats as in a onecolumn document. -% \begin{macrocode} -\newcommand*{\m@mscapcheckside}{% - \if@twocolumn - \ifdim\hsize=\textwidth% float* - \m@mscapcheckregside - \else - \if@firstcolumn - \scapmarglefttrue - \else - \scapmargleftfalse - \fi - \fi - \else - \m@mscapcheckregside - \fi -% \end{macrocode} -% Finally apply any user's override. -% \begin{macrocode} - \m@mscapthisside} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\m@mscapcheckregside} -% This performs the margin calculation for onecolumn documents. -% \changes{v4.1}{2005/11/21}{Fixed missing t in \cs{marglefttrue}, courtesy Jorgen Larsen} -% \begin{macrocode} -\newcommand*{\m@mscapcheckregside}{% - \if@twoside - \checkoddpage - \ifnum\m@mscapmarg<\@ne% % left - \scapmarglefttrue - \else - \ifnum\m@mscapmarg=\@ne% % right - \scapmargleftfalse - \else - \ifnum\m@mscapmarg=\tw@% % outer - \scapmarglefttrue - \ifoddpage - \scapmargleftfalse - \fi - \else% % inner - \scapmargleftfalse - \ifoddpage - \scapmarglefttrue - \fi - \fi - \fi - \fi - \else% oneside - \scapmarglefttrue - \ifnum\m@mscapmarg>\@ne - \ifnum\m@mscapmarg<\thr@@ - \scapmargleftfalse - \fi - \fi - \fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\overridescapmargin} -% \begin{macro}{\m@mscapthisside} -% User macro to override the calculated caption margin. Call as either:\\ -% \verb?\overridescapmargin{left}? or \verb?\overridescapmargin{right}? \\ -% \begin{macrocode} -\newcommand*{\overridescapmargin}[1]{% - \def\@tempb{#1}\def\@tempa{left}% - \ifx\@tempa\@tempb - \def\m@mscapthisside{\scapmarglefttrue}% - \else - \def\@tempa{right}% - \ifx\@tempa\@tempb - \def\m@mscapthisside{\scapmargleftfalse}% - \else - \@memerror{Argument to \string\overridescapmargin\space neither - left nor right}{\@ehc}% - \def\m@mscapthisside{}% - \fi - \fi} -\newcommand*{\m@mscapthisside}{} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% Now for the other kinds of captions. -% -% \begin{macro}{\sidecontcaption} -% \cs{sidecontcaption}\marg{title}\oarg{label} is for -% a continuation sidecaption. -% \begin{macrocode} -\newcommand*{\sidecontcaption}{% - \@sidecontcaption} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@sidecontcaption} -% \cs{@sidecontcaption}\marg{title} grabs the first -% argument. -% \begin{macrocode} -\def\@sidecontcaption#1{% - \@ifnextchar [{\@@sidecontcaption{#1}}{\@@sidecontcaption{#1}[]}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@sidecontcaption} -% \cs{@@sidecontcaption}\marg{title}\oarg{label} is the -% last macro in the chain and handles all two arguments. -% This does all the work for \verb?\begin{sidecontcaption}? -% \begin{macrocode} -\def\@@sidecontcaption#1[#2]{% - \def\m@mscap@forcap{#1}% - \ifx\@empty#2\@empty - \def\m@mscaplabel{}% - \else - \def\m@mscaplabel{\@bsphack\label{#2}\@esphack}% - \fi - \m@mscapstart@fbox} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\endsidecontcaption} -% \cs{endsidecontcaption} does the work for \verb?\end{sidecontcaption}?. -% -% \begin{macrocode} -\def\endsidecontcaption{% - \m@mscapend@fbox - \addtocounter{\@captype}{\m@ne}\refstepcounter\@captype - \m@mscaplabel - \begin{lrbox}{\m@mscap@capbox}% - \begin{minipage}[c]{\sidecapwidth}% - \sidecapstyle - \@contcaption\@captype{\m@mscap@forcap} - \end{minipage}% - \end{lrbox}% - \m@mscapopboxes} - -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\sidenamedlegend} -% \begin{macro}{\@sidenamedlegend} -% \cs{sidenamedlegend}\oarg{fortoc}\marg{title} is for -% a namedlegend sidecaption. -% \begin{macrocode} -\newcommand*{\sidenamedlegend}{% - \@ifnextchar [{\@sidenamedlegend}{\@sidenamedlegend[]}} -\def\@sidenamedlegend[#1]#2{% - \@@sidenamedlegend{#1}{#2}} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@@sidenamedlegend} -% \cs{@@sidenamedlegend}\marg{fortoc}\marg{title} is the -% last macro in the chain and handles all arguments. -% This does all the work for \verb?\begin{sidenamedlegend}? -% \begin{macrocode} -\def\@@sidenamedlegend#1#2{% - \ifx\@empty#1\@empty - \def\m@mscap@fortoc{#2}% - \else - \def\m@mscap@fortoc{#1}% - \fi - \def\m@mscap@forcap{#2}% - \def\m@mscaplabel{}% - \m@mscapstart@fbox} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\endsidenamedlegend} -% \cs{endsidenamedlegend} does the work for \verb?\end{sidenamedlegend}?. -% \begin{macrocode} -\def\endsidenamedlegend{% - \m@mscapend@fbox - \begin{lrbox}{\m@mscap@capbox}% - \begin{minipage}[c]{\sidecapwidth}% - \sidecapstyle - \@legend\@captype[\m@mscap@fortoc]{\m@mscap@forcap} - \end{minipage}% - \end{lrbox}% - \m@mscapopboxes} - -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\sidelegend} -% \cs{sidelegend}\marg{title} is for -% a legend sidecaption. -% \begin{macrocode} -\newcommand*{\sidelegend}{% - \@@sidelegend} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@sidelegend} -% \cs{@@sidelegend}\marg{title} is the -% last macro in the chain and handles all arguments. -% This does all the work for \verb?\begin{sidelegend}? -% \begin{macrocode} -\def\@@sidelegend#1{% - \def\m@mscap@forcap{#1}% - \m@mscapstart@fbox} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\endsidelegend} -% \cs{endsidelegend} does the work for \verb?\end{sidelegend}?. -% \begin{macrocode} -\def\endsidelegend{% - \m@mscapend@fbox - \begin{lrbox}{\m@mscap@capbox}% - \begin{minipage}[c]{\sidecapwidth}% - \sidecapstyle - \legend{\m@mscap@forcap} - \end{minipage}% - \end{lrbox}% - \m@mscapopboxes} - -% \end{macrocode} -% \end{macro} -% -% \section{Mempatch version 4.2} -% -% \begin{macrocode} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%% Version 4.2 (2005/11/21 and later) - -% \end{macrocode} -% -% \subsection{AtBegin/End...} -% -% Code, based on a hint from Morten H{\o}gholm\footnote{CTT posting -% 2005/11/08, \textit{Re: Checking for packages froma class... -% revisited}} that the \Lpack{scrlfile} package from -% \Lpack{koma-script} includes commands such as \\ -% \cs{AfterFile}\marg{file}\marg{code} \\ -% plus before and after classes and packages. -% -% \begin{macrocode} -%%%%%%%%%%%% -%%%%%%%%%%%% Extensions to \AtBeginDocument -%%%%%%%%%%%% - -% \end{macrocode} -% -% Extend the \cs{InputIfFileExists} macro to call hooks before and -% the actual inputting. The kernel version (as of 2005/11/21) is: -% \begin{verbatim} -% \newcommand{\InputIfFileExists}[2]{% -% \IfFileExists{#1}% -% {\#2\@addtofilelist{#1}\@@input \@filef@und}} -% \end{verbatim} -% -% \begin{macro}{\InputIfFileExists} -% Effectively all file input is handled by this macro. Extend it -% by adding pre- and post- input hooks. -% \begin{macrocode} -\renewcommand{\InputIfFileExists}[2]{% - \IfFileExists{#1}% - {#2\@addtofilelist{#1}\m@matbeginf{#1}% - \@@input \@filef@und - \m@matendf{#1}% - \killm@matf{#1}}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\m@matbeginf} -% \begin{macro}{\m@matendf} -% \cs{m@matbeginf}\marg{file} calls macro \cs{file-m@mfb} if it -% is defined. Similarly \cs{m@matendf}\marg{file} calls -% \cs{file-m@mfe} if it is defined. -% \begin{macrocode} -\newcommand{\m@matbeginf}[1]{\@ifundefined{#1-m@mfb}{}% - {\@nameuse{#1-m@mfb}}} -\newcommand{\m@matendf}[1]{\@ifundefined{#1-m@mfe}{}% - {\@nameuse{#1-m@mfe}}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\killm@matf} -% \cs{killm@matf}\marg{file} undefines the \cs{file-m@mfb} and -% \cs{file-m@mfe} macros. -% \begin{macrocode} -\newcommand*{\killm@matf}[1]{% - \@namelet{#1-m@mfb}\relax - \@namelet{#1-m@mfe}\relax} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\AtBeginFile} -% \begin{macro}{\AtEndFile} -% \cs{AtBeginFile}\marg{file}\marg{code} inserts \meta{code} -% just before \meta{file} is input. Similarly \cs{AtEndFile} inserts -% just after input. -% \begin{macrocode} -\newcommand{\AtBeginFile}[2]{\@ifundefined{#1-m@mfb}% - {\@namedef{#1-m@mfb}{#2}}% - {\expandafter\addtodef\csname #1-m@mfb\endcsname{}{#2}}} -\newcommand{\AtEndFile}[2]{\@ifundefined{#1-m@mfe}% - {\@namedef{#1-m@mfe}{#2}}% - {\expandafter\addtodef\csname #1-m@mfe\endcsname{}{#2}}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\AtBeginPackage} -% \begin{macro}{\AtEndPackage} -% \begin{macro}{\RequireAtEndPackage} -% \cs{AtBeginPackage}\marg{pack}\marg{code} inserts \meta{code} -% just before the \meta{pack} package is input, and \cs{AtEndPackage} -% is the equivalent for after input. \cs{RequireAtEndPackage} inserts -% \meta{code} either at the end of \meta{pack}, or immediately if -% \meta{pack} has already been input. -% \begin{macrocode} -\newcommand{\AtBeginPackage}[2]{% - \AtBeginFile{#1.\@pkgextension}{#2}} -\newcommand{\AtEndPackage}[2]{% - \AtEndFile{#1.\@pkgextension}{#2}} -\newcommand{\RequireAtEndPackage}[2]{% - \@ifpackageloaded{#1}{#2}% - {\AtEndFile{#1.\@pkgextension}{#2}}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\AtBeginClass} -% \begin{macro}{\AtEndClass} -% \begin{macro}{\RequireAtEndClass} -% \cs{AtBeginClass}\marg{class}\marg{code} and friends are the class -% equivalents of \cs{AtBeginPackage} and friends. -% \begin{macrocode} -\newcommand{\AtBeginClass}[2]{% - \AtBeginFile{#1.\@clsextension}{#2}} -\newcommand{\AtEndClass}[2]{% - \AtEndFile{#1.\@clsextension}{#2}} -\newcommand{\RequireAtEndClass}[2]{% - \@ifclassloaded{#1}{#2}% - {\AtEndFile{#1.\@clsextension}{#2}}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \section{Mempatch version 4.3} -% -% \begin{macrocode} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%% Version 4.3 (2005/12/13 and later) - -% \end{macrocode} -% -% \subsection{reparticle chapter style} -% -% The \verb?reparticle? chapterstyle replicates the appearance -% of a \cs{section} in an \Lpack{article} class. -% -% \begin{macrocode} -%%% Replicate the appearance of a \section in the article class -\makechapterstyle{reparticle}{% - \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex}% - \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}% - \setlength{\afterchapskip}{2.3ex \@plus .2ex}% - \renewcommand*{\printchaptername}{}% - \renewcommand*{\chapternamenum}{}% - \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries}% - \renewcommand*{\chapnumfont}{\chaptitlefont}% - \renewcommand*{\printchapternum}{\@hangfrom{\chapnumfont \thechapter\quad}}% - \renewcommand*{\afterchapternum}{}} - -% \end{macrocode} -% -% \begin{macro}{\reparticle} -% Call this to get division heads to replicate the \Lpack{article} class. -% For example: \\ -% \verb?\ifartopt \reparticle \fi? -% \begin{macrocode} -%%% \reparticle redefines the higher level division heads fonts and spacing -%%% to replicate the article class (but \chapter must still be used). -%%% Use, for example like: \ifartopt \reparticle \fi -\newcommand*{\reparticle}{% - \chapterstyle{reparticle}% - \setsecheadstyle{\large\bfseries\raggedright}% - \setsubsecheadstyle{\normalsize\bfseries\raggedright}% -} - -% \end{macrocode} -% \end{macro} -% -% \section{Mempatch version 4.4} -% -% \begin{macrocode} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%% Version 4.4 (2006/01/06 and later) - -% \end{macrocode} -% -% \subsection{Captiontitlefinal} -% -% \begin{macro}{\captiontitlefinal} -% \begin{macro}{\@makecaption} -% \cs{captiontitlefinal}\marg{stuff} puts \meta{stuff} immediately at the -% end of the caption's title text, but it will not appear the the LoF/LoT/etc. -% The code was supplied by Frederic -% Connes\footnote{\texttt{frederic@connes.org}} in an email to me on -% 2005/12/28. -% \changes{v4.4a}{2006/01/23}{Fixed \cs{@tewmpboxa} typo in \cs{@makecaption}} -% \begin{macrocode} -%%% \captiontitlefinal{<stuff>} will put <stuff> immediately at the -%%% end of a \caption's title text and it will not appear in the -%%% LoF/LoT/etc. For example: \captiontitlefinal{.} -%%% (Code supplied by Frederic Connes) -\newcommand*{\captiontitlefinal}[1]{\def\@contfinal{#1}} -\captiontitlefinal{} - -\renewcommand{\@makecaption}[2]{\let\@memtempa\relax - \ifdim\prevdepth>-99\p@ \vskip\abovecaptionskip - \else \def\@memtempa{\vbox to\topskip{}}\fi - \let\@contfnote\footnote \renewcommand{\footnote}[2][]{}% - \let\@contfmark\footnotemark \renewcommand{\footnotemark}[1][]{}% - \sbox\@tempboxa{\@contnfont #1\@contdelim \@conttfont #2\@contfinal}% - \let\footnote\@contfnote - \let\footnotemark\@contfmark - \ifdim\wd\@tempboxa<\linewidth \centering\fi - \if@contcw - \centering - \parbox{\@contcwidth}{% - \ifdim\wd\@tempboxa<\@contcwidth \centering\fi - \fi - \if@conthang - \sbox\@tempboxa{\@contnfont #1\@contdelim}% - \@contpre% - {\@contcstyle\hangindent=\wd\@tempboxa - \noindent\box\@tempboxa\@memtempa \@conttfont #2\@contfinal\par}% - \else - \if@contindent - \@contpre% - {\@contnfont #1\@contdelim}\@memtempa - {\@contcstyle\hangindent=\@contindw - \hangafter=\@ne\@conttfont #2\@contfinal\par}% <- v1.4 - \else - \@contpre% - {\@contnfont #1\@contdelim}\@memtempa - {\ifdim\wd\@tempboxa<\linewidth - \@contcshortstyle\else \@contcstyle\fi% <- v1.4 - \@conttfont #2\@contfinal\par}% - \fi - \fi - \@contpost - \if@contcw - \par - }% end of the parbox - \fi - \vskip\belowcaptionskip} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \subsection{xindy and theindex} -% -% \begin{macro}{\ifm@mxindy} -% \begin{macro}{\m@mxindytrue} -% \begin{macro}{\m@mxindyfalse} -% \begin{macro}{\xindyindex} -% \begin{macro}{\@@wrspindexhyp} -% Use \cs{xindyindex} when you are going to use the xindy program rather -% than makeindex. hyperrefed entries won't work with xindy. -% The code was supplied by Frederic -% Connes\footnote{\texttt{frederic@connes.org}} in an email to me on -% 2006/01/08. -% \begin{macrocode} -%%% Use the declaration \xindyindex if you will be using the xindy program -%%% instead of MakeIndex to process index entries. As yet, xindy will not -%%% hyperref any entries. -%%% (Code supplied by Frederic Connes) -\newif\ifm@mxindy -\m@mxindyfalse -\newcommand*{\xindyindex}{\m@mxindytrue} -\def\@@wrspindexhyp#1|#2|#3\\{% - \ifshowindexmark\@showidx{#1}\fi - \ifx\\#2\\% - \protected@write\@auxout{}% - {\string\@@wrindexm@m{\@idxfile}% - \ifm@mxindy{#1}\else{#1|hyperspindexpage(\thepage)}\fi - {\@nameuse{the\@sptheidx}}}% - \else - \def\Hy@temp@A{#2}% - \ifx\Hy@temp@A\HyInd@ParenLeft - \protected@write\@auxout{}% - {\string\@@wrindexm@m{\@idxfile}% - \ifm@mxindy{#1|#2}\else{#1|#2hyperspindexpage(\thepage)}\fi - {\@nameuse{the\@sptheidx}}}% - \else - \protected@write\@auxout{}% - {\string\@@wrindexm@m{\@idxfile}{#1|#2}% - {\@nameuse{the\@sptheidx}}}% - \fi - \fi - \endgroup - \@esphack} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{environment}{theindex} -% Problem noted by Erik Quaeghebeur\footnote{\texttt{equaeghe@nospammail.net}} -% in a CTT posting \textit{memoir, openleft and \cs{clear*page} commands} on -% 2006/01/04 that an index did not start on a verso page when the -% \textsf{openleft} option is in effect. -% On 2006/12/06 Lars Madsen asked for an `indexpagestyle'. It's easier -% to add it here than under version 4.6. -% \begin{macrocode} -\renewenvironment{theindex}{% - \clearforchapter% <- added - \if@twocolumn - \@restonecolfalse - \else - \@restonecoltrue - \fi - \ifonecolindex - \onecolumn - \chapter*{\indexname} - \preindexhook - \else - \setlength{\columnseprule}{\indexrule}% - \setlength{\columnsep}{\indexcolsep}% - \twocolumn[\@makeschapterhead{\indexname} - \preindexhook]% - \fi - \indexmark - \ifnoindexintoc\else - \phantomsection - \addcontentsline{toc}{chapter}{\indexname} - \fi -%%% \thispagestyle{chapter}\parindent\z@ % <- changed in v4.6 - \thispagestyle{indextitlepagestyle}\parindent\z@ - \parskip\z@ \@plus .3\p@\relax - \let\item\@idxitem}% - {\if@restonecol\onecolumn\else\twocolumn\fi} - -% \end{macrocode} -% \end{environment} -% -% \subsection{Verse numbering} -% -% \begin{macro}{\verselinebreak} -% Aaron Rendahl (\texttt{arendahl@stat.umn.edu}) provided the \cs{ignorespaces} -% fix for an extra indent when using \verb?\\>[0pt]? to end a verse line. -% \changes{v4.4}{2006/01/14}{Added \cs{ignorespaces} to \cs{verselinebreak}} -% \begin{macrocode} -%%% \ignorespaces fix by Aaron Rendahl to remove extraneous space -%%% with \\>[0pt] ending a verse line -\renewcommand*{\verselinebreak}[1][\z@]{\newline\hspace*{#1}\ignorespaces} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\verselinenumbersright} -% \begin{macro}{\verselinenumbersleft} -% \begin{macro}{\@vslnumright} -% \begin{macro}{\@vslnumleft} -% \begin{macro}{\@vscentercr} -% New declarations for setting verse line numbers at the right (default) -% or at the left. -% \changes{v4.4}{2006/01/15}{Added code for switching verse line numbers left/right} -% \begin{macrocode} -%%% Use the \verselinenumbersleft declaration to set verse line numbers -%%% at the left. To later return to the default of setting them at the right -%%% use the \verselinenumbersright declaration. -\newcommand*{\verselinenumbersright}{\def\@vstypelinenum{\@vslnumright}} -\newcommand*{\verselinenumbersleft}{\def\@vstypelinenum{\@vslnumleft}} -\verselinenumbersright - -\newcommand*{\@vslnumright}{% - \hfill\rlap{\kern\rightskip\kern\rightmargin% - \vlvnumfont\getthelinenumber{poemline}}} -\newcommand*{\@vslnumleft}{% - \hfill\rlap{\kern-\textwidth\kern-\rightskip% - \vlvnumfont\getthelinenumber{poemline}}} -\renewcommand*{\@vscentercr}{% - \ifhmode \unskip\else \@nolnerr\fi - \@vstypelinenum% - \@vsifgt{\verselinebreak}{% - \incr@vsline - \par\@ifstar{\nobreak\@vsxcentercr}{% - \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}}}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \subsection{Wrapped verbatims} -% -% \begin{macro}{\raggedwrap} -% \begin{macro}{\wrappingon} -% Paul (\texttt{paulaugust2003@yahoo.com}) found that wrapped verbatims in -% a list environment (e.g. \texttt{itemize}) were not indented although -% regular verbatims were. -% -% \cs{raggedwrap} is a variation on \cs{raggedright} (\cs{leftskip} is set -% to \cs{@totalleftmargin} instead of 0pt). Hopefully this fix will not -% mess up any existing wrapped verbatims. -% \changes{v4.4}{2006/01/16}{Fixed surprise in wrapped verbatims} -% \begin{macrocode} -%%% Fix for wrapped verbatims in list environments. -\newcommand*{\raggedwrap}{% - \@rightskip\@flushglue - \rightskip\@rightskip - \leftskip\@totalleftmargin - \parindent\ragrparindent} -\renewcommand*{\wrappingon}{% - \def\@xobeysp{~\discretionary{\verbatimbreakchar}% - {\kern\verbatimindent}{}}% - \def\wrapright{\raggedwrap}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \subsection{Page after a Part heading} -% -% \begin{macro}{\partblankpage} -% \begin{macro}{\nopartblankpage} -% \begin{macro}{\ifm@mnopartnewpage} -% \begin{macro}{\m@mnopartnewpagetrue} -% \begin{macro}{\m@mnopartnewpagefalse} -% \begin{macro}{\@endpart} -% Code to prevent a \cs{part} outputting a blank page. Provided by -% Frederic Connes. -% \changes{v4.4}{2006/01/15}{Added controls for \cs{part} blank pages} -% \begin{macrocode} -%%% Use the \nopartblankpage declaration if you don't want a blank -%%% page after a Part title page. The default is set by \partblankpage. -\newif\ifm@mnopartnewpage -\newcommand*{\partblankpage}{\m@mnopartnewpagefalse} -\newcommand*{\nopartblankpage}{\m@mnopartnewpagetrue} - -\renewcommand*{\@endpart}{\afterpartskip - \ifm@mnopartnewpage - \else - \if@twoside - \if@openright - \null - \thispagestyle{afterpart}% - \newpage - \fi - \fi - \fi - \if@tempswa - \twocolumn - \fi} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\partnumberline} -% Let's make sure that there is a space between the part number and -% title in the ToC. -% \changes{v4.4}{2006/01/16}{Added space after part number in ToC} -% \begin{macrocode} -\renewcommand{\partnumberline}[1]{% - \hb@xt@\@tempdima{% - \cftpartname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb\space} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\ps@afterpart} -% \begin{macro}{\ps@book} -% \begin{macro}{\ps@afterbook} -% Some new page styles for the page after a Part page, and a Book and -% its following page. -% \begin{macrocode} -\aliaspagestyle{afterpart}{empty} -\aliaspagestyle{book}{empty} -\aliaspagestyle{afterbook}{empty} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\midpartskip} -% \changes{v4.9}{2007/11/30}{Changed space in \cs{midpartskip}.} -% \begin{macrocode} -\renewcommand{\midpartskip}{\par\vskip 2\onelineskip} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Book document division} -% -% Frederic Connes tells me that in French typography there is often -% a sectional division above Part. He called this \cs{superpart} but -% I think that \cs{book} more closely resembles the English usage. -% He provided code for implementing his \cs{superpart}. (I have just -% checked and the Chicago Manual of Style does have an example of -% a Book, Part, Chapter, Subsection hierarchy). -% -% \begin{macro}{\book} -% \begin{macro}{\book*} -% Here we go with a \cs{book} division. -% \changes{v4.4}{2006/01/15}{Added a \cs{book} division with all that that entails} -% \begin{macrocode} -%%% The \book (and \book*) document division is one level higher than -%%% a \cs{part}. It has the same kind of controls over its appearance in -%%% the body of the document and in the ToC as \part has. -\newcommand*{\book}{% - \@setupbook - \secdef\@book\@sbook} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\bookmark} -% \begin{macro}{\c@book} -% \begin{macro}{\thebook} -% \begin{macro}{\theHbook} -% \begin{macro}{\toclevel@book} -% Start of the setting up. \cs{theHbook} and \cs{toclevel@book} are for -% \Lpack{hyperref} -% \begin{macrocode} -\newcommand*{\bookmark}[1]{} -\newcounter{book} \setcounter{book}{0} -\renewcommand*{\thebook}{\Roman{book}} -\newcommand*{\theHbook}{\arabic{book}} -\newcommand*{\toclevel@book}{-2} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\beforebookskip} -% \begin{macro}{\midbookskip} -% \begin{macro}{\afterbookskip} -% \begin{macrocode} -\newcommand*{\beforebookskip}{\null\vfil} -\newcommand*{\midbookskip}{\par \vskip 2\onelineskip} -\newcommand*{\afterbookskip}{\vfil\newpage} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@setupbook} -% Start off the book page. -% \begin{macrocode} -\newcommand*{\@setupbook}{% - \if@openright - \cleardoublepage - \else - \clearpage - \fi - \thispagestyle{book}% - \if@twocolumn - \@tempswatrue - \else - \@tempswafalse - \fi - \beforebookskip} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\bookname} -% \begin{macro}{\booknamefont} -% \begin{macro}{\booknumfont} -% \begin{macro}{\booktitlefont} -% Specify the typesetting styles. -% \begin{macrocode} -\newcommand*{\bookname}{Book} -\newcommand*{\booknamefont}{\normalfont\huge\bfseries} -\newcommand*{\booknumfont}{\normalfont\huge\bfseries} -\newcommand*{\booktitlefont}{\normalfont\Huge\bfseries} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\printbookname} -% \begin{macro}{\booknamenum} -% \begin{macro}{\printbooknum} -% \begin{macro}{\printbooktitle} -% \begin{macrocode} -\newcommand*{\printbookname}{\booknamefont \bookname} -\newcommand*{\booknamenum}{\space} -\newcommand*{\printbooknum}{\booknumfont \thebook} -\newcommand{\printbooktitle}[1]{\booktitlefont #1} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\membookinfo} -% \begin{macro}{\membookstarinfo} -% \changes{v4.9}{2007/08/26}{Made \cs{membookinfo} and \cs{membookstarinfo} -% \cs{long}} -% \begin{macrocode} -\newcommand{\membookinfo}[3]{} -\newcommand{\membookstarinfo}[1]{} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@book} -% \begin{macro}{\@sbook} -% \begin{macrocode} -\long\def\@book[#1]#2{% - \M@gettitle{#1}% - \phantomsection - \ifnum\c@secnumdepth > -3\relax - \refstepcounter{book}% - \addcontentsline{toc}{book}% - {\protect\booknumberline{\thebook}#1}% - \membookinfo{\thebook}{#1}{#2}% - \else - \addcontentsline{toc}{book}{#1}% - \membookinfo{}{#1}{#2}% - \fi - \bookmark{#1}% - {\centering - \interlinepenalty \@M - \normalfont - \ifnum \c@secnumdepth >-3\relax - \printbookname \booknamenum \printbooknum - \midbookskip - \fi - \printbooktitle{#2}\par}% - \@endbook} - -\def\@sbook#1{% - \M@gettitle{#1}% - \phantomsection - \membookstarinfo{#1}% - {\centering - \interlinepenalty \@M - \normalfont - \printbooktitle{#1}\par}% - \@endbook} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\bookblankpage} -% \begin{macro}{\nobookblankpage} -% \begin{macro}{\ifm@mnobooknewpage} -% \begin{macro}{\m@mnobooknewpagetrue} -% \begin{macro}{\m@mnobooknewpagefalse} -% \begin{macro}{\@endbook} -% Code to prevent a \cs{book} outputting a blank page. Provided by -% Frederic Connes. -% \changes{v4.4}{2006/01/15}{Added controls for \cs{book} blank pages} -% \begin{macrocode} -%%% Use the \nobookblankpage declaration if you don't want a blank -%%% page after a Book title page. The default is set by \bookblankpage. -\newif\ifm@mnobooknewpage -\newcommand*{\bookblankpage}{\m@mnobooknewpagefalse} -\newcommand*{\nobookblankpage}{\m@mnobooknewpagetrue} - -\newcommand*{\@endbook}{\afterbookskip - \ifm@mnobooknewpage - \else - \if@twoside - \if@openright - \null - \thispagestyle{afterbook}% - \newpage - \fi - \fi - \fi - \if@tempswa - \twocolumn - \fi} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\cftbookname} -% \begin{macro}{\cftbookbreak} -% \begin{macro}{\l@book} -% \begin{macro}{\booknumberline} -% Now for the ToC entry. -% \changes{v4.9a}{2007/12/24}{Added \cs{cftbookbreak}} -% \begin{macrocode} -\newcommand*{\cftbookname}{} -\newcommand*{\cftbookbreak}{\addpenalty{-\@highpenalty}% - \addvspace{\cftbeforebookskip}} -\newcommand*{\l@book}[2]{% - \ifnum\c@tocdepth >-3\relax -%% \addpenalty{-\@highpenalty}% - \cftbookbreak -%% \addvspace{\cftbeforebookskip}% - \begingroup - {\leftskip \cftbookindent\relax - \rightskip \@tocrmarg - \parfillskip -\rightskip - \parindent \cftbookindent\relax\@afterindenttrue - \interlinepenalty\@M - \leavevmode - \settowidth{\@tempdima}{\cftbookfont\cftbookname}% - \addtolength{\@tempdima}{\cftbooknumwidth}% - \let\@cftbsnum \cftbookpresnum - \let\@cftasnum \cftbookaftersnum - \let\@cftasnumb \cftbookaftersnumb - \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip - {\cftbookfont #1}% - \cftbookfillnum{#2}} - \nobreak - \global\@nobreaktrue - \everypar{\global\@nobreakfalse\everypar{}}% - \endgroup - \fi} -\newcommand{\booknumberline}[1]{% - \hb@xt@\@tempdima{% - \cftbookname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb\space} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\cftbeforebookskip} -% \begin{macro}{\cftbookindent} -% \begin{macro}{\cftbooknumwidth} -% \begin{macro}{\cftbookfont} -% \begin{macro}{\cftbookpresnum} -% \begin{macro}{\cftbookaftersnum} -% \begin{macro}{\cftbookaftersnumb} -% \begin{macro}{\cftbookleader} -% \begin{macro}{\cftbookdotsep} -% \begin{macro}{\cftbookpagefont} -% \begin{macro}{\cftbookafterpnum} -% \begin{macro}{\cftbookfillnum} -% \begin{macro}{\cftbookformatpnum} -% \changes{v4.9}{2007/08/20}{Added \cs{cftbookformatpnum}} -% \begin{macrocode} -% ToC layout parameters. -\newlength{\cftbeforebookskip} - \setlength{\cftbeforebookskip}{2.25em \@plus\p@} -\newdimen\cftbookindent - \setlength{\cftbookindent}{0em} -\newdimen\cftbooknumwidth - \setlength{\cftbooknumwidth}{1.5em} -\newcommand*{\cftbookfont}{\large\bfseries} -\newcommand*{\cftbookpresnum}{} -\newcommand*{\cftbookaftersnum}{} -\newcommand*{\cftbookaftersnumb}{} -\newcommand*{\cftbookleader}{% - \large\bfseries\cftdotfill{\cftbookdotsep}} -\newcommand*{\cftbookdotsep}{\cftnodots} -\newcommand*{\cftbookpagefont}{\large\bfseries} -\newcommand{\cftbookafterpnum}{} -\newcommand{\cftbookfillnum}[1]{% - {\cftbookleader}% -%%%% {\hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}}% - \cftbookformatpnum{#1}% - \cftbookafterpnum\par} -\newcommand{\cftbookformatpnum}[1]{% - \hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@setclcnt} -% Add the book to \cs{@setclcnt} -% \begin{macrocode} -\renewcommand*{\@setclcnt}[2]{% - \@tempswafalse - \nametest{#1}{none}% - \ifsamename - \setcounter{#2}{-10}% - \@tempswatrue - \fi - \nametest{#1}{book}% - \ifsamename - \setcounter{#2}{-2}% - \@tempswatrue - \fi - \nametest{#1}{part}% - \ifsamename - \setcounter{#2}{-1}% - \@tempswatrue - \fi - \nametest{#1}{chapter}% - \ifsamename - \setcounter{#2}{0}% - \@tempswatrue - \fi - \nametest{#1}{section}% - \ifsamename - \setcounter{#2}{1}% - \@tempswatrue - \fi - \nametest{#1}{subsection}% - \ifsamename - \setcounter{#2}{2}% - \@tempswatrue - \fi - \nametest{#1}{subsubsection}% - \ifsamename - \setcounter{#2}{3}% - \@tempswatrue - \fi - \nametest{#1}{paragraph}% - \ifsamename - \setcounter{#2}{4}% - \@tempswatrue - \fi - \nametest{#1}{subparagraph}% - \ifsamename - \setcounter{#2}{5}% - \@tempswatrue - \fi - \nametest{#1}{all}% - \ifsamename - \setcounter{#2}{50}% - \@tempswatrue - \fi - \if@tempswa\else - \@memerror{% - Unknown document division name (#1) - }{% - I'll ignore it. - Type \space <return> and I'll continue.\MessageBreak - If you haven't mistyped the name then use - \protect\setcounter\space instead.}% - \fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\settocdepth} -% Add \cs{book} to ToC depth setting. -% \begin{macrocode} -\renewcommand*{\settocdepth}[1]{% - \@tempswafalse - \nametest{#1}{none}% - \ifsamename - \addtocontents{toc}{\changetocdepth{-10}}% - \@tempswatrue - \fi - \nametest{#1}{book}% - \ifsamename - \addtocontents{toc}{\changetocdepth{-2}}% - \@tempswatrue - \fi - \nametest{#1}{part}% - \ifsamename - \addtocontents{toc}{\changetocdepth{-1}}% - \@tempswatrue - \fi - \nametest{#1}{chapter}% - \ifsamename - \addtocontents{toc}{\changetocdepth{0}}% - \@tempswatrue - \fi - \nametest{#1}{section}% - \ifsamename - \addtocontents{toc}{\changetocdepth{1}}% - \@tempswatrue - \fi - \nametest{#1}{subsection}% - \ifsamename - \addtocontents{toc}{\changetocdepth{2}}% - \@tempswatrue - \fi - \nametest{#1}{subsubsection}% - \ifsamename - \addtocontents{toc}{\changetocdepth{3}}% - \@tempswatrue - \fi - \nametest{#1}{paragraph}% - \ifsamename - \addtocontents{toc}{\changetocdepth{4}}% - \@tempswatrue - \fi - \nametest{#1}{subparagraph}% - \ifsamename - \addtocontents{toc}{\changetocdepth{5}}% - \@tempswatrue - \fi - \nametest{#1}{all}% - \ifsamename - \addtocontents{toc}{\changetocdepth{50}}% - \@tempswatrue - \fi - \if@tempswa -% \end{macrocode} -% The next bit is from Heiko Oberdiek (CTT {\itshape Re: Memoir, \verb?\settocdepth? -% and pdflatex \verb?=>? problem with PDF bookmarks}, 2006/07/21) as -% \Lpack{hyperref} needs \verb?\tocdepth? set in the body not just in the ToC. -% \begin{macrocode} - \@ifundefined{toclevel@#1}{% - \@memwarn{Unknown toclevel for #1}% - }{% - \setcounter{tocdepth}{\@nameuse{toclevel@#1}}% - } - \else - \@memerror{% - Unknown document division name (#1) - }{% - I'll ignore it. - Type \space <return> and I'll continue.}% - \fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\toclevel@none} -% \begin{macro}{\toclevel@all} -% Couple of extras for hypperef to cater for \texttt{all} and \texttt{none} -% as `division levels'. -% \begin{macrocode} -\newcommand*{\toclevel@none}{-10} -\newcommand*{\toclevel@all}{50} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \section{Mempatch version 4.5} -% -% \begin{macrocode} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%% Version 4.5 (2006/02/11 and later) - -% \end{macrocode} -% -% \subsection{Odds and ends} -% -% \begin{macro}{\DisemulatePackage} -% Undoes an \cs{EmulatedPackage} -% \begin{macrocode} -%%% \DisemulatePackage{pack} undoes a previous \EmulatedPackage{pack}. -%%% For example \DisemulatePackage{index} if you need to use the index package. -\providecommand*{\DisemulatePackage}[1]{% - \@namelet{ver@#1.\@pkgextension}\relax} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@nameedef} -% Add a missing \verb?%? (noticed by Lars Madsen). -% \begin{macrocode} -\renewcommand{\@nameedef}[1]{% - \expandafter\protected@edef\csname #1\endcsname} - - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@smemmain} -% Change the timing of \cs{clear[double]page}. Problem noted by David Wilson -% \url{David.Wilson@murdoch.edu.au} in email dated 2006/01/29. It now matches -% the other \cs{...matter} macros. -% \begin{macrocode} -%%% change timing of \@mainmattertrue in \@smemmain -\renewcommand*{\@smemmain}{% - \ifartopt - \clearpage - \else - \cleardoublepage - \counterwithin{figure}{chapter}% - \counterwithin{table}{chapter}% - \fi - \@mainmattertrue - \setcounter{secnumdepth}{\value{maxsecnumdepth}}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@footnotetext} -% This was fixed in v1.618, except that I unfixed it later in the class file. -% This really should be done in a new class release, but it's not time for -% that yet. -% \begin{macrocode} -\renewcommand{\@footnotetext}[1]{% - \reset@font\m@mold@footnotetext{#1}\m@mmf@prepare} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\ifm@mpn@new@chap} -% \begin{macro}{\m@mpn@new@chapfalse} -% \begin{macro}{\m@mpn@new@chaptrue} -% \begin{macro}{\ifm@mpn@new@schap} -% \begin{macro}{\m@mpn@new@schapfalse} -% \begin{macro}{\m@mpn@new@schaptrue} -% These are for supporting the page/end notes, flagging that a -% \verb?\chapter(*)? has been called. -% \begin{macrocode} -\newif\ifm@mpn@new@chap - \m@mpn@new@chapfalse -\newif\ifm@mpn@new@schap - \m@mpn@new@schapfalse - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@chapter} -% \begin{macro}{\f@rbdy} -% Fix from Lars Madsen for mistiming \verb?\chaptermark? in articles. -% Also adding \verb?\m@m@new@chap? flag, and setting \verb?\f@rbdy? -% to the chapter title for the body of the text. -% \begin{macrocode} -%%% Fix for mistiming of \chaptermark with article option -\def\@chapter[#1]#2{% - \m@mpn@new@chaptrue - \def\f@rbdy{#2}% - \ifx\ch@pt@c\@empty % no optional args - \def\f@rtoc{#2}% - \def\f@rhdr{#2}% - \else % at least one opt arg - \let\f@rtoc\ch@pt@c - \ifx\@empty#1\@empty - \let\f@rhdr\ch@pt@c - \else - \def\f@rhdr{#1}% - \fi - \fi - \m@m@Andfalse - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \m@m@Andtrue - \fi - \fi - \ifm@m@And - \refstepcounter{chapter}% - \fi - \ifartopt - \@makechapterhead{#2}% - \@afterheading - \chaptermark{\f@rhdr}% - \else - \chaptermark{\f@rhdr}% - \insertchapterspace - \if@twocolumn - \@topnewpage[\@makechapterhead{#2}]% - \else - \@makechapterhead{#2}% - \fi - \@afterheading - \fi - \ifm@m@And - \ifanappendix - \addcontentsline{toc}{appendix}{% - \protect\chapternumberline{\thechapter}\f@rtoc}% - \memappchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}% - \else - \addcontentsline{toc}{chapter}{% - \protect\chapternumberline{\thechapter}\f@rtoc}% - \memchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}% - \fi - \else - \addcontentsline{toc}{chapter}{\f@rtoc}% - \ifanappendix - \memappchapinfo{}{\f@rtoc}{\f@rhdr}{#2}% - \else - \memchapinfo{}{\f@rtoc}{\f@rhdr}{#2}% - \fi - \fi - \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{\f@rtoc}\fi} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@schapter} -% \begin{macro}{\@m@mschapter} -% Make the same page/end note extensions to \verb?\@schapter?. -% \begin{macrocode} -\renewcommand{\@schapter}[1]{% - \m@mpn@new@schaptrue - \def\f@rbdy{#1}% - \ifartopt - \@makeschapterhead{#1}% - \else - \if@twocolumn - \@topnewpage[\@makeschapterhead{#1}] - \else - \@makeschapterhead{#1}% - \fi - \fi - \@afterheading} -\renewcommand{\@m@mschapter}[2][\@empty]{% - \@schapter{#2}% - \ifx \@empty#1 - \def\f@rhdr{#2}% - \else - \def\f@rhdr{#1}% - \setcounter{secnumdepth}{-10}% - \chaptermark{#1}% - \setcounter{secnumdepth}{\value{maxsecnumdepth}}% - \fi - \ifanappendix - \memappchapstarinfo{\f@rhdr}{#2}% - \else - \memchapstarinfo{\f@rhdr}{#2}% - \fi - \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{#2}\fi} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% \subsection{Switch trims on/off} -% -% \begin{macro}{\showtrimson} -% \begin{macro}{\showtrimsoff} -% \begin{macro}{\mem@shipii} -% Switch trimming marks off and on. Requested by a James Hunt on CTT, -% \emph{Are crop marks needed on every page?}, February 2006. -% \begin{macrocode} -%%%% Use \showtrimsoff and \showtrimson to switch trim marks off and on. -%%%% If the showtrims option has not been used, these do nothing. -\newcommand*{\showtrimsoff}{\showtrimsfalse} -\newcommand*{\showtrimson}{\showtrimstrue} -\renewcommand*{\mem@shipii}{% - \ifvoid\@cclv - \mem@oldshipout\box\@cclv - \else - \ifshowtrims - \mem@oldshipout\vbox{\trimmarks\unvbox\@cclv}% - \else - \mem@oldshipout\box\@cclv - \fi - \fi} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \subsection{Sidepars} -% -% \begin{macro}{\@sidepar} -% Sidepars have a nasty habit of moving up or down depending on whether -% characters in the sidepar and the main text line have ascenders and/or -% descenders. The length \verb?\sideparvshift? was provided to -% enable adjustments. This code from Dan Luecking -% (CTT \textit{Re: sidepars drift up a point}, 2006/04/11) does a much -% better job, -% and the default for \verb?\sideparvshift? is now 0pt. -% \begin{macrocode} -%%%% Fix to stop \sidepars moving up or down -\long\def\@sidepar[#1]#2{\@bsphack\strut\vadjust{% - \checkoddpage - \ifsideparswitch - \ifreversesidepar - \ifoddpage - \oddpagefalse - \else - \oddpagetrue - \fi - \fi - \else - \oddpagetrue - \ifreversesidepar - \oddpagefalse - \fi - \fi - \rlap{\kern-\parindent - \if@twocolumn - \if@firstcolumn% put at left - \kern -\marginparsep \kern -\marginparwidth - \else% put at right - \kern \columnwidth \kern \marginparsep - \fi - \else - \ifoddpage% put at right - \kern \textwidth \kern \marginparsep - \else% put at left - \kern -\marginparsep \kern -\marginparwidth - \fi - \fi - \setbox0=\vtop to 0pt{% - \begin{minipage}[t]{\marginparwidth}% -% \end{macrocode} -% Normalise the font (suggested by Lars Madsen). -% \changes{v4.9}{2007/05/02}{Normalised font in \cs{@sidepar}} -% \begin{macrocode} - \normalfont\normalsize - \ifoddpage #2\else #1\fi% - \end{minipage}% - \vss}% - \vtop to 0pt{\kern\sideparvshift% default should be 0pt - \kern-\dp\strutbox - \kern-\ht0 - \box0 \vss}}}% - \@esphack} -\setlength{\sideparvshift}{0pt} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Anonymous divisions} -% -% \begin{macro}{\@fbreak} -% \begin{macro}{\@sfbreak} -% The \verb?\fancybreak? macros start a paragraph and so should end it as well, -% as noted by Dan Luecking (CTT \textit{Re: Appendix Package - adding -% semicolon ``:'' after appendix letter in ToC} 2006/04/20). -% -% \begin{macrocode} -%%%% Ensure that fancybreaks close the paragraph they start -\renewcommand{\@fbreak}[1]{\par - \penalty -100 - \noindent\parbox{\linewidth}{\centering #1}% - \par -% \penalty -20 - \@afterindentfalse - \@afterheading} -\renewcommand{\@sfbreak}[1]{\par - \penalty -100 - \noindent\parbox{\linewidth}{\centering #1}% - \par -% \penalty -20 - \@afterindenttrue - \@afterheading} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \subsection{Vertically center text} -% -% \begin{environment}{vplace} -% An environment which centers its body vertically. This is more robust -% than that proposed in the manual. The optional argument, which is a -% (decimal) number, increases ($>1.0$) or decreases ($<1.0$) the space -% above the body with respect to that below. -% \begin{macrocode} -%%%% \begin{vplace}[<num>] vertically centered stuff \end{vplace} -%%%% <num> adjusts above space wrt to below space -\newenvironment{vplace}[1][1]{% - \par\vspace*{\stretch{#1}}% -}{% - \vspace*{\stretch{1}}% - \par} - -% \end{macrocode} -% \end{environment} -% -% \subsection{End notes} -% -% This is from the \Lpack{pagenote} package, with minor amendments. -% -% \begin{macrocode} -%%%% -%%%% Include the functions of the pagenote package -%%%% - -% \end{macrocode} -% -% \begin{macro}{\ifm@mpnpageopt} -% \begin{macro}{\ifm@mpncontopt} -% We need two flags for the options. -% \begin{macrocode} -\newif\ifm@mpnpageopt - \m@mpnpageoptfalse -\newif\ifm@mpncontopt - \m@mpncontoptfalse -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\notepageref} -% \begin{macro}{\continuousnotenums} -% Let the user change the default options. -% \begin{macrocode} -\newcommand*{\notepageref}{\m@mpnpageopttrue} -\newcommand*{\continuousnotenums}{% - \counterwithout{pagenote}{chapter} - \renewcommand{\thepagenote}{\arabic{pagenote}}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% \begin{macro}{\c@pagenote} -% \begin{macro}{\thepagenote} -% We need a counter for the notes. Just how it is defined depends on the -% \Lopt{continuous} option. -% \begin{macrocode} -%\ifm@mpncontopt -% \newcounter{pagenote} -%\else - \newcounter{pagenote}[chapter] -%\fi -\renewcommand{\thepagenote}{\arabic{pagenote}} -\setcounter{pagenote}{0} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\ifmempagenotes} -% Need to check if notes are required. -% \begin{macrocode} -\newif\ifmempagenotes - \mempagenotesfalse - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\makepagenote} -% This sets up the note file. At the end it emasculates itself so it can only -% be used once. -% \begin{macrocode} -\newcommand*{\makepagenote}{% - \newwrite\@notefile - \immediate\openout\@notefile=\jobname.ent - \mempagenotestrue -% \end{macrocode} -% \begin{macro}{\pagenote} -% Make sure that this has a useful definition. -% \begin{macrocode} - \def\pagenote{\@bsphack\begingroup - \@sanitize - \m@m@wrpnote}% -% \end{macrocode} -% \end{macro} -% \begin{macrocode} - \typeout{Writing note file \jobname.ent}% - \let\makepagenote\@empty} - -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\immediate@protected@write} -% We might have to do some immediate writes. This is an immediate -% version of the kernel \verb?\protected@write?. -% \begin{macrocode} -\newcommand{\immediate@protected@write}[3]{% - \begingroup - #2% - \let\protect\@unexpandable@protect - \edef\reserved@a{\immediate\write#1{#3}}% - \reserved@a - \endgroup - \if@nobreak\ifvmode\nobreak\fi\fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\m@m@pnwrite} -% If the \Lopt{page} option is used we cannot use an immediate write -% because the page number is only known in the output routine. -% \begin{macrocode} -\ifm@mpnpageopt - \let\m@m@pnwrite\protected@write -\else - \let\m@m@pnwrite\immediate@protected@write -\fi - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\pnchap} -% \begin{macro}{\pnschap} -% Redefine these for different subheadings in the notes list. -% \begin{macrocode} -\newcommand*{\pnchap}{\f@rtoc} -\newcommand*{\pnschap}{\f@rbdy} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\m@m@wrpnote} -% This writes the note information to the note file. It first increments the -% note counter and calls \verb?\notenumintext? to handle its appearance in -% the body text. -% \begin{macrocode} -\newcommand{\m@m@wrpnote}[2][]{% - \refstepcounter{pagenote}% - \notenumintext{\thepagenote}% -% \end{macrocode} -% Check if this is the first note in a division, and if so indicate this -% in the file. -% \begin{macrocode} - \ifm@mpn@new@chap - \global\m@mpn@new@chapfalse - \addtonotes{\string\pagenotesubhead{\@chapapp}{\thechapter}{\pnchap}}% - \fi - \ifm@mpn@new@schap - \global\m@mpn@new@schapfalse - \addtonotes{\string\pagenotesubhead{\@chapapp}{}{\pnschap}}% - \fi -% \end{macrocode} -% Finally, write the entry. -% \begin{macrocode} - \m@m@pnwrite\@notefile{} - {\string\noteentry{\thepagenote}{#1}{#2}{\thepage}}% - \endgroup - \@esphack} - -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\pagenote} -% The user command to generate a note. It is given substance -% by \verb?\makepagenote?. -% \begin{macrocode} -\def\pagenote{\@bsphack\begingroup \@sanitize\m@m@pagenote} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\m@m@pagenote} -% \begin{macrocode} -\newcommand{\m@m@pagenote}[2][]{\endgroup\@esphack} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\pagetofootnote} -% \begin{macro}{\foottopagenote} -% \begin{macro}{\memsavefootnote} -% \begin{macro}{\memsavepagenote} -% Let the user change pagenotes to footnotes, or vice-versa. In either -% case the optional argument is ignored. -% \begin{macrocode} -\newcommand*{\pagetofootnote}{% - \let\memsavepagenote\pagenote - \renewcommand{\pagenote}[2][]{\footnote{##2}}} -\newcommand*{\foottopagenote}{% - \let\memsavefootnote\footnote - \renewcommand*{\footnote}[2][]{\pagenote{##2}}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\addtonotes} -% \verb?\addtonotes?\marg{text} puts \meta{text} into the notes file. -% \begin{macrocode} -\newcommand{\addtonotes}[1]{% - \ifmempagenotes - \IfFileExists{\jobname.ent}{\m@m@pnwrite\@notefile{}{#1}}{\mempnofilewarn}% -\fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\notenumintext} -% \begin{macro}{\notenuminnotes} -% \verb?\notenumintext?\marg{notenum} typesets \meta{notenum} (in the body text). -% \begin{macrocode} -\newcommand{\notenumintext}[1]{% - \textsuperscript{#1}} -% \end{macrocode} -% \verb?\notenuminnotes?\marg{notenum} typesets \meta{notenum} (as part of the note). -% \begin{macrocode} -\newcommand{\notenuminnotes}[1]{% - {\normalfont #1.}\space} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\noteentry} -% \verb?\noteentry?\marg{notenum}\marg{id}\marg{pagenum}\marg{text} -% typesets a note. -% \begin{macrocode} -\newcommand{\noteentry}[4]{% - \prenoteinnotes - \noteidinnotes{#1}{#2}\pageinnotes{#4}\noteinnotes{#3}% - \postnoteinnotes} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\idtextinnotes} -% \verb?\idtextinnotes?\marg{id text} typesets the note's \meta{id text}. -% \begin{macrocode} -\newcommand{\idtextinnotes}[1]{% - [#1]\space} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\noteidinnotes} -% \verb?\noteidinnotes?\marg{notenum}\marg{id} is used to typeset the note -% identification (in the note listing). It is set so that it typesets the -% \meta{id} if it is not empty, otherwise it sets the \meta{notenum}. -% \begin{macrocode} -\newcommand{\noteidinnotes}[2]{% - \@ifmtarg{#2}{% - \notenuminnotes{#1}}{\idtextinnotes{#2}}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\pageinnotes} -% \begin{macro}{\printpageinnotes} -% \verb?\pageinnotes?\meta{pagenum} calls -% \verb?\printpageinnotes?\marg{pagenum} to typeset the originating -% page number (in the note), but only if the \verb?\notepageref? declaration -% has been used (the page number is not trustworthy unless the -% \verb?\notepageref? has been used). -% \begin{macrocode} -\newcommand{\pageinnotes}[1]{% - \ifm@mpnpageopt \printpageinnotes{#1}\fi} -\newcommand*{\printpageinnotes}[1]{% - (\pagerefname\ #1)\space} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\noteinnotes} -% \verb?\noteinnotes?\marg{text} is used to typeset the note's text -% (in the note list). -% \begin{macrocode} -\newcommand{\noteinnotes}[1]{#1} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\prenoteinnotes} -% \begin{macro}{\postnoteinnotes} -% These are called immediately before and after the note information is -% typeset. -% \begin{macrocode} -\newcommand{\prenoteinnotes}{\par\noindent} -\newcommand{\postnoteinnotes}{\par} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\notesname} -% \begin{macro}{\notedivision} -% Heading for note list. -% \begin{macrocode} -\providecommand*{\notesname}{Notes} -\newcommand*{\notedivision}{\chapter{\notesname}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% \begin{macro}{\printnotes} -% \begin{macro}{\printpagenotes*} -% User commands to print the note file. -% \begin{macrocode} -\newcommand*{\printpagenotes}{\@ifstar{\@sprintpagenotes}{\@printpagenotes}} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\mempnofilewarn} -% Warning when the notes file does not exist. -% \begin{macrocode} -\newcommand*{\mempnofilewarn}{% - \ClassWarning{memoir}{There is no .ent file}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@sprintpagenotes} -% Macro implementing \verb?\printpagenotes*?. -% \begin{macrocode} -\newcommand*{\@sprintpagenotes}{% - \ifmempagenotes - \notedivision -\IfFileExists{\jobname.ent}{% - \immediate\closeout\@notefile - \input{\jobname.ent}% - \immediate\openout\@notefile=\jobname.ent% - }{% - \mempnofilewarn -}% -\fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@printpagenotes} -% Macro implementing \verb?\printpagenotes?. -% \begin{macrocode} -\newcommand*{\@printpagenotes}{% - \ifmempagenotes - \notedivision - \IfFileExists{\jobname.ent}{% - \immediate\closeout\@notefile - \input{\jobname.ent}% - }{% - \mempnofilewarn - } - \fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\pagenotesubhead} -% The section heading before each set of notes. \\ -% \verb?\pagenotesubhead?\marg{chaptername}\marg{number}\marg{title} -% \begin{macrocode} -\newcommand*{\pagenotesubhead}[3]{% - \section*{#1 #2 #3}} - -% \end{macrocode} -% \end{macro} -% -% Prevent loading of the \Lpack{pagenote} package. -% \begin{macrocode} -\EmulatedPackage{pagenote} - -% \end{macrocode} -% -% \subsection{ToC, LoF, etc lists} -% -% Lars Madsen suggested that macros like \verb?\cftfigurename? be added for use -% in the LoF, and so on. -% -% \begin{macro}{\@cftn@me} -% \begin{macro}{\numberline} -% \begin{macrocode} -\newcommand*{\@cftn@me}{} -\renewcommand*{\numberline}[1]{% - \hb@xt@\@tempdima{\@cftn@me\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\newlistentry} -% Extend \cs{newlistentry} to add \cs{cftXname}. -% \changes{v4.8}{2007/01/22}{Added missing backslash in \cs{newlistentry}} -% \begin{macrocode} -\renewcommand*{\newlistentry}[4][\@empty]{% - \@ifundefined{c@#2}{% check & set the counter - \ifx \@empty#1\relax - \newcounter{#2}% % added the backslash 2007/01/22 per J{\o}rgen Larsen - \else - \newcounter{#2}[#1]% - \expandafter\edef\csname the#2\endcsname{% - \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}% - \fi}{} - \setcounter{#2}{0} - \@namedef{l@#2}##1##2{% - \ifnum \@nameuse{c@#3depth} > #4\relax - \vskip \@nameuse{cftbefore#2skip}% - {\leftskip \@nameuse{cft#2indent}\relax - \rightskip \@tocrmarg - \parfillskip -\rightskip - \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue - \interlinepenalty\@M - \leavevmode - \settowidth{\@tempdima}{\@nameuse{cft#2font}\@nameuse{cft#2name}}% - \addtolength{\@tempdima}{\@nameuse{cft#2numwidth}}% -\expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname -\expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname -\expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname -\expandafter\let\expandafter\@cftn@me\csname cft#2name\endcsname - \advance\leftskip\@tempdima \null\nobreak\hskip -\leftskip - {\@nameuse{cft#2font}##1}\nobreak - \@nameuse{cft#2fillnum}{##2}} - \fi - }% end of \l@#2 - \expandafter\newlength\csname cftbefore#2skip\endcsname - \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@} - \expandafter\newlength\csname cft#2indent\endcsname - \expandafter\newlength\csname cft#2numwidth\endcsname - \ifcase #4\relax% 0 (level 1) - \setlength{\@nameuse{cft#2indent}}{0em} - \setlength{\@nameuse{cft#2numwidth}}{2.3em} - \or% 1 (level 2) - \setlength{\@nameuse{cft#2indent}}{2.3em} - \setlength{\@nameuse{cft#2numwidth}}{3.2em} - \or% 2 (level 3) - \setlength{\@nameuse{cft#2indent}}{5.5em} - \setlength{\@nameuse{cft#2numwidth}}{4.1em} - \or% 3 (level 4) - \setlength{\@nameuse{cft#2indent}}{8.5em} - \setlength{\@nameuse{cft#2numwidth}}{5.0em} - \else% anything else - \setlength{\@nameuse{cft#2indent}}{10.5em} - \setlength{\@nameuse{cft#2numwidth}}{6.0em} - \fi - \@namedef{cft#2font}{\normalfont} - \@namedef{cft#2name}{} - \@namedef{cft#2presnum}{} - \@namedef{cft#2aftersnum}{} - \@namedef{cft#2aftersnumb}{} - \@namedef{cft#2dotsep}{\cftdotsep} - \@namedef{cft#2leader}{\normalfont\cftdotfill{\@nameuse{cft#2dotsep}}} - \@namedef{cft#2pagefont}{\normalfont} - \@namedef{cft#2afterpnum}{} - \@namedef{cft#2toclevel@#2}{#4} - \@namedef{cft#2formatpnum}##1{% - \hb@xt@\@pnumwidth{\hfil\@nameuse{cft#2pagefont}##1}} - \@namedef{cft#2fillnum}##1{% - {\@nameuse{cft#2leader}}\nobreak -% \end{macrocode} -% Dan Luecking (\ctt{} \textit{Re: setting page numbers in toc in their -% natural-width box}, 15 August 2007) suggested that there should be a macro -% here instead of: -% \begin{verbatim} -% \hb@xt@\@pnumwidth{% -% \hfil\@nameuse{cft#2pagefont}##1} -% \end{verbatim} -% \changes{v4.9}{2007/08/20}{Changed \cs{newlistentry} to accomodate \cs{cftXformatpnum}} -% \begin{macrocode} - \@nameuse{cft#2formatpnum}{##1}% - \@nameuse{cft#2afterpnum}\par} -}% end of \newlistentry - -% \end{macrocode} -% \end{macro} -% -% Now redo the \cs{newlistentry}s to effect the above changes. -% \begin{macrocode} -\let\cftbeforesectionskip\relax -\let\cftsectionindent\relax -\let\cftsectionnumwidth\relax -\newlistentry[chapter]{section}{toc}{0} - \cftsetindents{section}{1.5em}{2.3em} -\let\cftbeforesubsectionskip\relax -\let\cftsubsectionindent\relax -\let\cftsubsectionnumwidth\relax -\newlistentry[section]{subsection}{toc}{1} - \cftsetindents{subsection}{3.8em}{3.2em} -\let\cftbeforesubsubsectionskip\relax -\let\cftsubsubsectionindent\relax -\let\cftsubsubsectionnumwidth\relax -\newlistentry[subsection]{subsubsection}{toc}{2} - \cftsetindents{subsubsection}{7.0em}{4.1em} -\let\cftbeforeparagraphskip\relax -\let\cftparagraphindent\relax -\let\cftparagraphnumwidth\relax -\newlistentry[subsubsection]{paragraph}{toc}{3} - \cftsetindents{paragraph}{10.0em}{5.0em} -\let\cftbeforesubparagraphskip\relax -\let\cftsubparagraphindent\relax -\let\cftsubparagraphnumwidth\relax -\newlistentry[paragraph]{subparagraph}{toc}{4} - \cftsetindents{subparagraph}{12.0em}{6.0em} - -% \end{macrocode} -% -% \begin{macrocode} -\let\cftbeforefigureskip\relax -\let\cftfigureindent\relax -\let\cftfigurenumwidth\relax -\newlistentry[chapter]{figure}{lof}{0} - \cftsetindents{figure}{0em}{2.3em} -\let\cftbeforetableskip\relax -\let\cfttableindent\relax -\let\cfttablenumwidth\relax -\newlistentry[chapter]{table}{lot}{0} - \cftsetindents{table}{0em}{2.3em} - -% \end{macrocode} -% -% \begin{macro}{\cftpartformatpnum} -% \begin{macro}{\cftpartfillnum} -% \begin{macro}{\cftchapterformatpnum} -% \begin{macro}{\cftchapterfillnum} -% \changes{v4.9}{2007/08/20}{Added \cs{cftpartformatpnum} and \cs{cftchapterformatpnum}} -% But we also have to change the \cs{part} and \cs{chapter} entries in the -% ToC for the new \cs{cftXformatpnum} macros. -% \begin{macrocode} -\newcommand{\cftpartformatpnum}[1]{% - \hb@xt@\@pnumwidth{\hss {\cftpartpagefont #1}}} -\renewcommand{\cftpartfillnum}[1]{% - {\cftpartleader}{\cftpartformatpnum{#1}}% - \cftpartafterpnum\par} -\newcommand{\cftchapterformatpnum}[1]{% - \hb@xt@\@pnumwidth{\hfil{\cftchapterpagefont #1}}} -\renewcommand{\cftchapterfillnum}[1]{% - {\cftchapterleader}\nobreak\cftchapterformatpnum{#1}% - \cftchapterafterpnum\par} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\cftpagenumberson} -% We also have to change \cs{cftpagenumberson} to accomodate -% \cs{cftXformatpnum}. -% \changes{v4.9}{2007/08/20}{Modified \cs{cftpagenumberson} for \cs{cftXformatpnum}.} -% \begin{macrocode} -\DeclareRobustCommand{\cftpagenumberson}[1]{% - \@namedef{cft#1fillnum}##1{% - \@nameuse{cft#1leader}\nobreak - \@nameuse{cft#1formatpnum}{##1}% - \@nameuse{cft#1afterpnum}\par}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\cftpartbreak} -% \begin{macro}{\l@part} -% \changes{v4.9a}{2007/12/24}{Added \cs{cftpartbreak}} -% \begin{macrocode} -\newcommand*{\cftpartbreak}{\addpenalty{-\@highpenalty}% - \addvspace{\cftbeforepartskip}} -\renewcommand*{\l@part}[2]{% - \ifnum\c@tocdepth >-2\relax -%% \addpenalty{-\@highpenalty}% - \cftpartbreak -%% \addvspace{\cftbeforepartskip}% - \begingroup - {\leftskip \cftpartindent\relax - \rightskip \@tocrmarg - \parfillskip -\rightskip - \parindent \cftpartindent\relax\@afterindenttrue - \interlinepenalty\@M - \leavevmode - \settowidth{\@tempdima}{\cftpartfont\cftpartname}% - \addtolength{\@tempdima}{\cftpartnumwidth}% - \let\@cftbsnum \cftpartpresnum - \let\@cftasnum \cftpartaftersnum - \let\@cftasnumb \cftpartaftersnumb - \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip - {\cftpartfont #1}% - \cftpartfillnum{#2}} - \nobreak - \global\@nobreaktrue - \everypar{\global\@nobreakfalse\everypar{}}% - \endgroup - \fi} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \subsection{Page layout} -% -% Morten H{\o}gholm suggested (2006/07/26) that instead of using TeX syntax I should use -% \verb?\setlength? when setting up the page layout so that the \Lpack{calc} -% package can be used, e.g. \\ -% \verb?\settypeblocksize{41\baselineskip+\topskip}{310pt}{*}? -% -% -% \begin{macro}{\setrectanglesize} -% The macro \cs{setrectanglesize}\marg{H}\marg{W}\marg{r} -% calculates the height and width of a rectangle given any two out of -% the three arguments. An unvalued argument is denoted by \texttt{*}. -% -% Table~\ref{tab:setrect} shows the argument combinations and the result -% for each combination. -% \begin{table} -% \centering -% \caption{Arguments and results for \cs{setrectanglesize}}\label{tab:setrect} -% \begin{tabular}{ccc|l} \hline -% H & W & r & Result \\ \hline -% * & W & r & $H = rW$ \\{} -% * & W & * & $H = W$ \\{} -% * & * & r & ambiguous \\{} -% * & * & * & ambiguous \\{} -% H & W & r & $H, W$ \\ -% H & W & * & $H, W$ \\ -% H & * & r & $W = rH$ \\ -% H & * & * & $W = H$ \\ -% \hline -% \end{tabular} -% \end{table} -% -% The -% calculated height and width are stored in \cs{@tempdima} and \cs{@tempdimb} -% respectively. Both lengths are set to zero if there is an error. -% \begin{macrocode} -\renewcommand*{\setrectanglesize}[3]{% - \nametest{#1}{*}% - \ifsamename % H = * - \nametest{#2}{*}% - \ifsamename % W = * - \@memerror{% - The combination of argument values is ambiguous.\MessageBreak - The lengths will be set to zero}{\@ehd} - \setlength{\@tempdima}{0pt}% - \setlength{\@tempdimb}{0pt}% - \else % W - \nametest{#3}{*}% - \ifsamename % r = * - \setlength{\@tempdimb}{#2}% - \setlength{\@tempdima}{\@tempdimb}% - \else % r - \setlength{\@tempdimb}{#2} - \setlength{\@tempdima}{#3\@tempdimb} - \fi - \fi - \else % H - \nametest{#2}{*}% - \ifsamename % W = * - \nametest{#3}{*}% - \ifsamename % r = * - \setlength{\@tempdima}{#1}% - \setlength{\@tempdimb}{\@tempdima}% - \else % r - \setlength{\@tempdima}{#1}% - \setlength{\@tempdimb}{#3\@tempdima}% - \fi - \else % W - \setlength{\@tempdima}{#1}% - \setlength{\@tempdimb}{#2}% - \fi - \fi -} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\setfillsize} -% Consider a set of 4 lengths, $T$, $L$, $C$, and $R$, such that -% $T = L + C + R$, where $T$ is a fixed size and normally $C$ is also fixed. -% Also $L$ and $R$ may be specified independently of each other or as a -% ratio (i.e., $L = rR$ or $R = rL$). -% The macro -% \cs{setfillsize}\marg{T}\marg{C}\marg{L}\marg{R}\marg{r} -% maintains these constraints among the variables, where an unvalued -% argument is denoted by \texttt{*}. -% -% Table~\ref{tab:setfill} shows the argument combinations and the result -% for each combination. -% \begin{table} -% \centering -% \caption{Arguments and results for \cs{setfillsize}}\label{tab:setfill} -% \begin{tabular}{cccc|ll} \hline -% C & L & R & r & Result & \\ \hline -% * & * & R & r & $L = rR$, & $C = T - L - R$ \\{} -% * & * & R & * & $L = R$, & $C = T - L - R$ \\{} -% * & * & * & r & ambigous & \\{} -% * & * & * & * & ambiguous & \\{} -% * & L & R & r & $L$, $R$, & $C = T - L - R$ \\{} -% * & L & R & * & $L$, $R$, & $C = T - L - R$ \\{} -% * & L & * & r & $R = rL$, & $C = T - L - R$ \\{} -% * & L & * & * & $R = L$, & $C = T - L - R$ \\{} -% C & * & R & r & $L = T - C - R$ & $C$ \\ -% C & * & R & * & $L = T - C - R$, & $C$ \\ -% C & * & * & r & $L + R = T - C$, $R = rL$, & $C$ \\ -% C & * & * & * & $L + R = T - C$, $R = L$, & $C$ \\ -% C & L & R & r & ambiguous & $C$ \\ -% C & L & R & * & ambiguous & $C$ \\ -% C & L & * & r & $R = T - C - L$, & $C$ \\ -% C & L & * & * & $R = T - C - L$, & $C$ \\ -% \hline -% \end{tabular} -% \end{table} -% -% -% The -% calculated values of \meta{C}, \meta{L} and \meta{R} are stored in -% \cs{@tempdimc}, \cs{@tempdima} and \cs{@tempdimb} respectively. -% If there is an error the lengths are set to zero. -% \begin{macrocode} -\renewcommand*{\setfillsize}[5]{% - \nametest{#2}{*}% - \ifsamename % C = * - \nametest{#3}{*}% - \ifsamename % L = * - \nametest{#4}{*}% - \ifsamename % R = * - \@memerror{% - The combination of argument values is ambiguous.\MessageBreak - The lengths will be set to zero}{\@ehd} - \setlength{\@tempdima}{0pt}% - \setlength{\@tempdimb}{0pt}% - \setlength{\@tempdimc}{0pt}% - \else % R - \nametest{#5}{*}% - \ifsamename % r = * - \setlength{\@tempdimb}{#4}% - \setlength{\@tempdima}{\@tempdimb}% - \setlength{\@tempdimc}{#1}% - \advance\@tempdimc -\@tempdima - \advance\@tempdimc -\@tempdimb - \else % r - \setlength{\@tempdimb}{#4}% - \setlength{\@tempdima}{#5\@tempdimb}% - \setlength{\@tempdimc}{#1}% - \advance\@tempdimc -\@tempdima - \advance\@tempdimc -\@tempdimb - \fi - \fi - \else % L - \nametest{#4}{*}% - \ifsamename % R = * - \nametest{#5}{*}% - \ifsamename % r = * - \setlength{\@tempdima}{#3}% - \setlength{\@tempdimb}{\@tempdima}% - \setlength{\@tempdimc}{#1}% - \advance\@tempdimc -\@tempdima - \advance\@tempdimc -\@tempdimb - \else % r - \setlength{\@tempdima}{#3}% - \setlength{\@tempdimb}{#5\@tempdima}% - \setlength{\@tempdimc}{#1}% - \advance\@tempdimc -\@tempdima - \advance\@tempdimc -\@tempdimb - \fi - \else % R - \setlength{\@tempdima}{#3}% - \setlength{\@tempdimb}{#4}% - \setlength{\@tempdimc}{#1}% - \advance\@tempdimc -\@tempdima - \advance\@tempdimc -\@tempdimb - \fi - \fi - \else % C is valued - \nametest{#3}{*}% - \ifsamename % L = * - \nametest{#4}{*}% - \ifsamename % R = * - \nametest{#5}{*}% - \ifsamename % r = * - \setlength{\@tempdimc}{#2}% - \setlength{\@tempdima}{#1}% - \advance\@tempdima -\@tempdimc - \@tempdima = 0.5\@tempdima - \@tempdimb = \@tempdima - \else % r (CODE PERHAPS FIXED) - \setlength{\@tempdimc}{#2}% - \setlength{\@tempdimb}{#1}% % T - \advance\@tempdimb -\@tempdimc % T - C - \@tempdima = 1000sp - \@tempdima = #5\@tempdima % 1000r sp - \advance\@tempdima by 1000sp % 1000(1+r)sp - \@tempcnta = \@tempdima % 1000(1+r) - \@tempdima = \@tempdimb % T - C - \divide\@tempdima by \@tempcnta % (T-C)/1000(1+r) pts - \@tempdima = 1000\@tempdima % (T-C)/(1+r) pts = L - \advance\@tempdimb by -\@tempdima % = R - \fi - \else % R - \setlength{\@tempdimc}{#2}% - \setlength{\@tempdimb}{#4}% - \setlength{\@tempdima}{#1}% - \advance\@tempdima -\@tempdimc - \advance\@tempdima -\@tempdimb - \fi - \else % L - \nametest{#4}{*}% - \ifsamename % R = * - \setlength{\@tempdimc}{#2}% - \setlength{\@tempdima}{#3}% - \setlength{\@tempdimb}{#1}% - \advance\@tempdimb -\@tempdimc - \advance\@tempdimb -\@tempdima - \else % R - \@memerror{% - The combination of argument values is ambiguous.\MessageBreak - The lengths will be set to zero}{\@ehd}% - \setlength{\@tempdima}{0pt}% - \setlength{\@tempdimb}{0pt}% - \setlength{\@tempdimc}{#2}% - \fi - \fi - \fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\m@mclassicht} -% The classic adjustment of the \cs{textheight} to get an integral number -% of lines (given an integral number of baselineskips returns a height -% giving one more line in the block). -% \begin{macrocode} -\newcommand*{\m@mclassicht}{% - \setlength{\@tempdima}{\textheight}% - \divide\@tempdima \baselineskip - \@tempcnta=\@tempdima - \setlength{\textheight}{\@tempcnta\baselineskip}% - \addtolength{\textheight}{\topskip}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\m@mlinesht} -% The adjustment of the \cs{textheight} to get an integral number -% of lines (given an inegral number of baselineskips returns a height -% giving that number of lines). -% \begin{macrocode} -\newcommand*{\m@mlinesht}{% - \setlength{\@tempdima}{\textheight}% - \advance\@tempdima -\baselineskip - \divide\@tempdima \baselineskip - \@tempcnta=\@tempdima - \setlength{\textheight}{\@tempcnta\baselineskip}% - \addtolength{\textheight}{\topskip}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\m@mnearestht} -% The adjustment of the \cs{textheight} to get an integral number -% of lines with the calculated height being as the closest to the given -% height. Algorithm supplied by Lars Madsen and Morten H{\o}gholm on -% 2006/07/27. -% \begin{macrocode} -\newcommand*{\m@mnearestht}{% - \setlength{\@tempdima}{\textheight}% - \advance\@tempdima -\topskip - \advance\@tempdima 0.5\baselineskip - \divide\@tempdima \baselineskip - \@tempcnta=\@tempdima - \setlength{\textheight}{\@tempcnta\baselineskip}% - \addtolength{\textheight}{\topskip}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\checkthelayout} -% \cs{checkthelayout}\oarg{text} is the user level macro for -% checking the layout. The \meta{text} argument controls which -% algorithm should be used to calculate the \cs{textheight}. -% \changes{v4.9}{2007/11/14}{Changed some page layout tests to negative from zero or negative} -% \begin{macrocode} -\renewcommand*{\checkthelayout}[1][classic]{% -% \end{macrocode} -% First check the dimensions are not negative. -% \begin{macrocode} - \@memnegtest{\trimedge} - \@memnegtest{\trimtop} - \@memznegtest{\stockwidth} - \@memznegtest{\paperwidth} - \@memznegtest{\textwidth} -%%% \@memznegtest{\spinemargin} - \@memnegtest{\spinemargin} -%%% \@memznegtest{\foremargin} - \@memnegtest{\foremargin} - \@memznegtest{\marginparsep} - \@memznegtest{\marginparwidth} - \@memznegtest{\stockheight} - \@memznegtest{\paperheight} - \@memznegtest{\textheight} -%%% \@memznegtest{\uppermargin} - \@memnegtest{\uppermargin} -%%% \@memznegtest{\lowermargin} - \@memnegtest{\lowermargin} -%%% \@memznegtest{\headheight} - \@memnegtest{\headheight} -%%% \@memznegtest{\headsep} - \@memnegtest{\headsep} -%%% \@memznegtest{\footskip} - \@memnegtest{\footskip} -% \end{macrocode} -% -% Carry on regardless. We may need to adjust the \cs{textheight} -% to get an integral number of lines. -% \begin{macrocode} - \nametest{#1}{classic}% - \ifsamename - \m@mclassicht - \else - \nametest{#1}{lines}% - \ifsamename - \m@mlinesht - \else - \nametest{#1}{nearest}% - \ifsamename - \m@mnearestht - \else - \nametest{#1}{fixed} - \ifsamename - \else% not classic, lines, nearest, or fixed - \@memerror{Optional argument is not one of:\MessageBreak - classic, fixed, lines, or nearest. \MessageBreak - I will assume the default}% - {\@ehc}% - \fi - \fi - \fi - \fi - \setulmargins{\uppermargin}{*}{*} -% \end{macrocode} -% -% Check that all the sums add up correctly, or -% at least to within a small (\cs{@tempdimb}) error. -% \begin{macrocode} - \@tempdimb = -1pt - \@tempdima=\stockwidth - \advance\@tempdima -\trimedge - \advance\@tempdima -\paperwidth - \ifdim\@tempdima<\@tempdimb - \@tempdima = -\@tempdima - \@memerror{\protect\paperwidth\space and/or - \protect\trimedge\space - are too large for \protect\stockwidth\space - by \the\@tempdima}% - {\@ehd} - \fi - \@tempdima = \paperwidth - \advance\@tempdima -\foremargin - \advance\@tempdima -\textwidth - \advance\@tempdima -\spinemargin - \ifdim\@tempdima<\@tempdimb - \@tempdima = -\@tempdima - \@memerror{\protect\spinemargin\space and/or - \protect\textwidth\space and/or - \protect\foremargin\space - are too large for \protect\paperwidth\space - by \the\@tempdima}% - {\@ehd} - \fi - \@tempdima = \stockheight - \advance\@tempdima -\trimtop - \advance\@tempdima -\paperheight - \ifdim\@tempdima<\@tempdimb - \@tempdima = -\@tempdima - \@memerror{\protect\paperheight\space and/or - \protect\trimtop\space - are too large for \protect\stockheight\space - by \the\@tempdima}% - {\@ehd} - \fi - \@tempdima = \paperheight - \advance\@tempdima -\uppermargin - \advance\@tempdima -\textheight - \advance\@tempdima -\lowermargin - \ifdim\@tempdima<\@tempdimb - \@tempdima = -\@tempdima - \@memerror{\protect\uppermargin\space and/or - \protect\textheight\space and/or - \protect\lowermargin\space - are too large for \protect\paperheight\space - by \the\@tempdima}% - {\@ehd} - \fi - \@tempdima = \uppermargin - \advance\@tempdima -\headheight - \advance\@tempdima -\headsep - \ifdim\@tempdima<\@tempdimb - \@tempdima = -\@tempdima - \@memerror{\protect\headheight\space and/or - \protect\headsep\space - are too large for \protect\uppermargin\space - by \the\@tempdima}% - {\@ehd} - \fi - \@tempdima = \lowermargin - \advance\@tempdima -\footskip - \ifdim\@tempdima<\z@ - \@tempdima = -\@tempdima - \@memerror{\protect\footskip - is too large for \protect\lowermargin\space - by \the\@tempdima}% - {\@ehd} - \fi -} -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\checkandfixthelayout} -% This macro checks and fixes the layout, and reports the result. It takes the -% same optional argument as \cs{checkthelayout}. -% \begin{macrocode} -\renewcommand*{\checkandfixthelayout}[1][classic]{% - \checkthelayout[#1]% - \fixthelayout - \typeoutlayout} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Overlong lines} -% -% LaTeX provides \cs{fussy} and \cs{sloppy} to control the amount of slack -% in a line while trying to make justified lines. Their definitions are: -% \begin{verbatim} -% \def\fussy{% -% \emergencystretch\z@ -% \tolerance 200% -% \hfuzz .1\p@ -% \vfuzz\hfuzz} -% \def\sloppy{% -% \tolerance 9999% -% \emergencystretch 3em% -% \hfuzz .5\p@ -% \vfuzz\hfuzz} -% \end{verbatim} -% -% \begin{macro}{\midsloppy} -% Somewhere between \cs{fussy} and \cs{sloppy}. -% \begin{macrocode} -\newcommand*{\midsloppy}{% - \tolerance 5000% - \hbadness 4000% - \emergencystretch 1.5em% - \hfuzz .1\p@ - \vfuzz\hfuzz} -% \end{macrocode} -% \end{macro} -% -% \begin{environment}{midsloppypar} -% A paragraph form of \cs{midsloppy}; equivalent to \verb?\par \midsloppy ... \par}? -% \begin{macrocode} -\newenvironment{midsloppypar}{\par\midsloppy}{\par} - -% \end{macrocode} -% \end{environment} -% -% \subsection{Lists} -% -% \begin{macro}{\everylistparindent} -% \begin{macro}{\list} -% The kernel sets \cs{listparindent} to zero within a \cs{list}, where it -% can be overridden in \cs{list}'s second argument. Here it is set to -% \cs{everyparlistindent} by default, which in turn is 0pt. -% \begin{macrocode} -\newdimen\everylistparindent - \everylistparindent \z@ -\renewcommand*{\list}[2]{% - \ifnum \@listdepth >5\relax - \@toodeep - \else - \global\advance\@listdepth\@ne - \fi - \rightmargin\z@ - \listparindent\everylistparindent - \itemindent\z@ - \csname @list\romannumeral\the\@listdepth\endcsname - \def\@itemlabel{#1}% - \let\makelabel\@mklab - \@nmbrlistfalse - #2\relax - \@trivlist - \parskip\parsep - \parindent\listparindent - \advance\linewidth -\rightmargin - \advance\linewidth -\leftmargin - \advance\@totalleftmargin \leftmargin - \parshape \@ne \@totalleftmargin \linewidth - \ignorespaces} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\defaultlists} -% This is a simplification of memoir's original, and will apply to any font -% size. -% \changes{v4.9}{2007/11/24}{Set \cs{everyparlistindent} to \cs{parindent} in -% \cs{defaultlists} and \cs{firmlists}} -% \begin{macrocode} -\renewcommand*{\defaultlists}{% - \setlength{\partopsep}{0.2\onelineskip \@plus 0.1\onelineskip - \@minus 0.1\onelineskip}% - \parsepi = 0.3333\onelineskip \@plus 0.1667\onelineskip \@minus \p@ - \itemsepi = \parsepi - \topsepi = 0.6667\onelineskip \@plus 0.3333\onelineskip - \@minus 0.2\onelineskip - \parsepii = 0.1667\onelineskip \@plus \p@ \@minus \p@ - \topsepii = \parsepi - \topsepiii = \parsepii - \everylistparindent \listparindent} -\defaultlists - -% \end{macrocode} -% \end{macro} -% -% These are the original versions of \cs{firmlist} and \cs{tightlist}. -% \begin{verbatim} -% \newcommand*{\firmlist}{% -% \setlength{\itemsep}{0.5\itemsep}\setlength{\parskip}{0.5\parskip}} -% -% \newcommand*{\tightlist}{% -% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} -% \end{verbatim} -% -% \begin{macro}{\firmlists} -% \begin{macro}{\firmlists*} -% \begin{macro}{\m@msfirmlists} -% \begin{macro}{\m@mfirmlists} -% These give approximately half the vertical spacing of the default lists, -% with all spaces equal. The starred version allows slightly less space -% before and after the list when it is preceded by a blank line. -% -% \begin{macrocode} -\newcommand*{\firmlists}{% - \@ifstar{\m@msfirmlists}{\m@mfirmlists}} - -\newcommand*{\m@msfirmlists}{ - \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}% - \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@ - \itemsepi = \parsepi - \topsepi = \parsepi - \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@ - \topsepii = \parsepi - \topsepiii = \parsepii - \everylistparindent\listparindent} - -\newcommand*{\m@mfirmlists}{ - \setlength{\partopsep}{0.1\onelineskip \@plus 0.05\onelineskip - \@minus 0.05\onelineskip}% - \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@ - \itemsepi = \parsepi - \topsepi = \parsepi - \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@ - \topsepii = \parsepi - \topsepiii = \parsepii - \everylistparindent\listparindent} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\tightlists} -% \begin{macro}{\tightlists*} -% \begin{macro}{\m@mstightlists} -% \begin{macro}{\m@mtightlists} -% These give zero vertical spacing of the default lists. -% The starred version allows slightly no extra space -% before and after the list when it is preceded by a blank line, -% whereas the unstarred version puts half a \cs{onelineskip} -% before and after. -% -% \begin{macrocode} -\renewcommand*{\tightlists}{% - \@ifstar{\m@mstightlists}{\m@mtightlists}} - -\newcommand*{\m@mstightlists}{% - \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}% - \parsepi = \z@ \@plus \p@ \@minus \p@ - \itemsepi = \parsepi - \topsepi = \z@ \@plus \p@ \@minus \p@ - \parsepii = \z@ \@plus \p@ \@minus \p@ - \topsepii = \parsepi - \topsepiii = \parsepii - \everylistparindent\parindent} - -\newcommand*{\m@mtightlists}{% - \setlength{\partopsep}{0.5\onelineskip \@plus \p@ \@minus \p@}% - \parsepi = \z@ \@plus \p@ \@minus \p@ - \itemsepi = \parsepi - \topsepi = \z@ \@plus \p@ \@minus \p@ - \parsepii = \z@ \@plus \p@ \@minus \p@ - \topsepii = \parsepi - \topsepiii = \parsepii - \everylistparindent\parindent} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% -% -% \section{Mempatch version 4.6} -% -% \begin{macrocode} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%% Version 4.6 (2006/11/22 and later) - -% \end{macrocode} -% -% -% \subsection{Double spacing} -% -% This is an embedding of the code from the \Lpack{setspace} package, with -% names changed. -% -% \begin{macrocode} -\EmulatedPackage{setspace} - -% \end{macrocode} -% -% \begin{macro}{\setSpacing} -% \cs{setSpacing}\marg{num} effectively increases the \cs{baselineskip} to \meta{num}*\cs{baselineskip} -% \begin{macrocode} -\newcommand{\setSpacing}[1]{% - \def\baselinestretch{#1}% - \@currsize} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\setSingleSpace} -% \cs{setSingleSpace}\marg{num} effectively increases the \cs{baselineskip} for single -% spacing to \meta{num}*\cs{baselineskip} (\meta{num} should be close to 1.0). -% \begin{macrocode} -\newcommand*{\setSingleSpace}[1]{% - \def\m@m@singlespace{#1}} -\setSingleSpace{1} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\SingleSpacing} -% \cs{SingleSpacing} starts single spacing. -% \begin{macrocode} -%%% start single spacing -\newcommand*{\SingleSpacing}{% - \setSpacing{\m@m@singlespace}% - \vskip\baselineskip% correction for coming into single spacing -} -\SingleSpacing - -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\OnehalfSpacing} -% \cs{OnehalfSpacing} starts `one and a half' spacing, which to most thesis nitpickers -% will look like double spacing. -% \begin{macrocode} -%%% start `one and a half spacing', the elegant version of double spacing. -\newcommand*{\OnehalfSpacing}{ - \setSpacing{1.25}% default (10pt) - \ifcase \@ptsize \relax % 10pt - \setSpacing{1.25}% - \or% 11pt - \setSpacing{1.213}% - \or% 12pt - \setSpacing{1.241}% - \or\or% 14pt - \setSpacing{1.20}% - \or\or\or% 17pt - \setSpacing{1.16}% - \or\or% 9pt - \setSpacing{1.35}% - \fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\DoubleSpacing} -% \cs{DoubleSpacing} starts double spacing, which to most thesis nitpickers -% will look far too spaced out. -% \begin{macrocode} -%%% start double spacing, which looks terrible. -\newcommand*{\DoubleSpacing}{ - \setSpacing{1.667}% default (10pt) - \ifcase \@ptsize \relax % 10pt - \setSpacing{1.667}% - \or% 11pt - \setSpacing{1.618}% - \or% 12pt - \setSpacing{1.655}% - \or\or% 14pt - \setSpacing{1.60}% - \or\or\or% 17pt - \setSpacing{1.545}% - \or\or% 9pt - \setSpacing{1.8}% - \fi} - -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\@setsize} -% Modify the kernel command. -% \begin{macrocode} -\renewcommand*{\@setsize}[4]{% - \@nomath#1% - \let\@currsize#1% - \baselineskip #2% - \baselineskip \baselinestretch\baselineskip - \parskip \baselinestretch\parskip - \setbox\strutbox \hbox{% - \vrule height.7\baselineskip - depth .3\baselineskip - width \z@}% - \skip\footins \baselinestretch\skip\footins - \normalbaselineskip\baselineskip#3#4} - -% \end{macrocode} -% \end{macro} -% -% -% \begin{environment}{SingleSpace} -% Environment form of \cs{SingleSpacing}. -% \begin{macrocode} -%%% Environment form of \SingleSpacing. -\newenvironment{SingleSpace}{% - \vskip\baselineskip - \setSpacing{\m@m@singlespace}% - \vskip -\baselineskip -}{\par} - -% \end{macrocode} -% \end{environment} -% -% \begin{environment}{SingleSpace*} -% Don't use this; it's only here to match the \Lpack{setspace} package. -% \begin{macrocode} -\newenvironment{SingleSpace*}{% -% \vskip\baselineskip - \setSpacing{\m@m@singlespace}% - \vskip 0.5\baselineskip -}{\vskip -0.5\baselineskip} - -% \end{macrocode} -% \end{environment} -% -% \begin{macro}{\m@mrestore@spacing} -% \begin{macrocode} -\newcommand*{\m@mrestore@spacing}{% - \par - \vskip \parskip - \vskip \baselineskip - \endgroup - \vskip -\parskip - \vskip -\baselineskip} - -% \end{macrocode} -% \end{macro} -% -% \begin{environment}{Spacing} -% \begin{macrocode} -%%% \begin{Spacing}{num} baselineskip is increased to num*baselineskip. -\newenvironment{Spacing}[1]{% - \par - \begingroup - \setSpacing{#1}}{\m@mrestore@spacing} - -% \end{macrocode} -% \end{environment} -% -% \begin{environment}{OnehalfSpace} -% \begin{macrocode} -%%% Environment form of \OnehalfSpacing -\newenvironment{OnehalfSpace}{% - \begingroup - \OnehalfSpacing}{\m@mrestore@spacing} - -% \end{macrocode} -% \end{environment} -% -% \begin{environment}{DoubleSpace} -% \begin{macrocode} -%%% Environment form of \DoubleSpacing -\newenvironment{DoubleSpace}{% - \begingroup - \DoubleSpacing}{\m@mrestore@spacing} - -% \end{macrocode} -% \end{environment} -% -% Deal with spacing around displays. -% -% \begin{macro}{\memdskipstretch} -% \begin{macro}{\setDisplayskipStretch} -% \begin{macro}{\noDisplayskipStretch} -% \begin{macrocode} -%%% \setDisplayskipStretch{num} changes space around displays by the factor -%%% (1+num). -%%% \noDisplayskipStretch keeps the regular space around displays. -\newcommand*{\memdskipstretch}{0.0} -\newcommand*{\setDisplayskipStretch}[1]{% - \renewcommand*{\memdskipstretch}{#1}} -\newcommand*{\noDisplayskipStretch}{\setDisplayskipStretch{0.0}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\memdskips} -% Macro added to \cs{everydisplay}, changing the settings of displayskips -% \begin{macrocode} -\newcommand*{\memdskips}{% - \advance\abovedisplayskip \memdskipstretch\abovedisplayskip - \advance\belowdisplayskip \memdskipstretch\belowdisplayskip - \advance\abovedisplayshortskip \memdskipstretch\abovedisplayshortskip - \advance\belowdisplayshortskip \memdskipstretch\belowdisplayshortskip -} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\everydisplay} -% \begin{macrocode} -\everydisplay\expandafter{% - \the\everydisplay - \memdskips} - -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\@xfloat} -% Reset \cs{baselinestretch} in floats. -% \begin{macrocode} -\let\m@m@xfloat\@xfloat -\def\@xfloat #1[#2]{% - \m@m@xfloat #1[#2]% - \def\baselinestretch{\m@m@singlespace}% - \normalsize} - -% \end{macrocode} -% \end{macro} -% -% The extra spacing does not add space before and after a minipage. -% The solution, hinted at by Donald Arseneau, is to create a new -% environment. I came up with a solution which DA then much improved upon -% (CTT \textit{setspace and minipages}, 2006/11/28). -% This is like minipage from an author's view, except that it is -% always top positioned and acts like a paragraph. -% \begin{macro}{\memPD} -% \begin{macrocode} -\newdimen\memPD -% \end{macrocode} -% \end{macro} -% \begin{environment}{vminipage} -% The user view, just as for \texttt{minipage}, but ensures the \texttt{t} -% position and as a new paragraph. -% \begin{macrocode} -%%% vminipage is like minipage but with better fore and aft spacing. -\newenvironment{vminipage}{% - \par - \@ifnextchar[%] - \@ivminipage - {\@iiiminipage t\relax[s]} -}{% - \par\global\memPD=\prevdepth - \endminipage - \par - \kern-\memPD% no pagebreak allowed here - \hbox{\vrule depth \memPD width \z@}} - -% \end{macrocode} -% \end{environment} -% -% \begin{macro}{\@ivminipage} -% Deal with first optional argument to \texttt{vminipage}. -% \begin{macrocode} - \def\@ivminipage[#1]{% - \@ifnextchar[%] - {\@iiminipage{t}}{\@iiiminipage{t}\relax[s]}} -% \end{macrocode} -% \end{macro} -% -% -% -% We want single spacing in footnotes. Memoir has redone much of the footnote -% stuff, so we have to modify the modified versions. -% -% \begin{macro}{\@footnotetext} -% \begin{macro}{\@mpfootnotetext} -% \begin{macro}{\m@mold@footnotetext} -% \begin{macro}{\m@mold@mpfootnotetext} -% Single spacing in footnotes. -% \begin{macrocode} -%%% Ensure single spacing in footnotes %%% - -\renewcommand{\@footnotetext}[1]{% - \insert\footins{% - \def\baselinestretch{\m@m@singlespace} - \reset@font\foottextfont - \@preamfntext - \hsize\columnwidth - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \color@begingroup - \@makefntext{% - \rule\z@\footnotesep\ignorespaces{\foottextfont #1}% - \@finalstrut\strutbox}% - \color@endgroup}\m@mmf@prepare} - -\renewcommand{\@mpfootnotetext}[1]{% - \global\setbox\@mpfootins\vbox{% - \unvbox \@mpfootins - \def\baselinestretch{\m@m@singlespace} - \reset@font\foottextfont - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@mpfootnote\endcsname\@thefnmark - }% - \color@begingroup - \@makefntext{% - \rule\z@\footnotesep\ignorespaces{\foottextfont #1} - \@finalstrut\strutbox}% - \color@endgroup}\m@mmf@prepare} - -\let\m@mold@footnotetext\@footnotetext -\let\m@mold@mpfootnotetext\@mpfootnotetext - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\plainfootnotes} -% \begin{macrocode} -\renewcommand{\plainfootnotes}{% - \let\@footnotetext\m@mold@footnotetext - \let\@mpfootnotetext\m@mold@mpfootnotetext} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\m@make@footnotetext} -% \begin{macro}{\m@make@mpfootnotetext} -% \begin{macrocode} -\renewcommand{\m@make@footnotetext}[1]{% - \@namelongdef{@footnotetext#1}##1{% - \insert\@nameuse{footins#1}{% - \def\baselinestretch{\m@m@singlespace} - \reset@font\@nameuse{foottextfont#1}% - \@preamfntext - \hsize\columnwidth - \protected@edef\@currentlabel{% - \csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}% - }% - \color@begingroup - \@nameuse{@makefntext#1}{% - \rule\z@\footnotesep\ignorespaces{\@nameuse{foottextfont#1} ##1}% - \@finalstrut\strutbox}% - \color@endgroup}\m@mmf@prepare}} - -\renewcommand{\m@make@mpfootnotetext}[1]{% - \@namelongdef{@mpfootnotetext#1}##1{% - \global\setbox\@nameuse{@mpfootins#1}\vbox{% - \unvbox \@nameuse{@mpfootins#1}% - \def\baselinestretch{\m@m@singlespace} - \reset@font\@nameuse{foottextfont#1}% - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}% - }% - \color@begingroup - \@nameuse{@makefntext#1}{% - \rule\z@\footnotesep\ignorespaces{\@nameuse{foottextfont#1} ##1} - \@finalstrut\strutbox}% - \color@endgroup}\m@mmf@prepare}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@twocolfootnotetext} -% \begin{macro}{\@mptwocolfootnotetext} -% \begin{macrocode} -\renewcommand{\@twocolfootnotetext}[1]{% - \insert\footinsv@r{% - \def\baselinestretch{\m@m@singlespace} - \reset@font\foottextfont - \@preamfntext - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \color@begingroup - \@twocolfootfmt{#1}% - \color@endgroup}\m@mmf@prepare} - -\renewcommand{\@mptwocolfootnotetext}[1]{% - \global\setbox\@mpfootinsv@r\vbox{% - \unvbox \@mpfootinsv@r - \def\baselinestretch{\m@m@singlespace} - \reset@font\foottextfont - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@mpfootnote\endcsname\@thefnmark - }% - \color@begingroup - \@twocolfootfmt{#1}% - \color@endgroup}\m@mmf@prepare} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\m@maketwocolfootnotetext} -% \begin{macro}{\m@make@mptwocolfootnotetext} -% \begin{macrocode} -\renewcommand{\m@make@twocolfootnotetext}[1]{% - \@namelongdef{@twocolfootnotetext#1}##1{% - \insert\@nameuse{footins#1}{% - \def\baselinestretch{\m@m@singlespace} - \reset@font\@nameuse{foottextfont#1}% - \@preamfntext - \protected@edef\@currentlabel{% - \csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}% - }% - \color@begingroup - \@nameuse{@twocolfootfmt#1}{##1} - \color@endgroup}\m@mmf@prepare}} - -\renewcommand{\m@make@mptwocolfootnotetext}[1]{% - \@namelongdef{@mptwocolfootnotetext#1}##1{% - \global\setbox\@nameuse{@mpfootins#1}\vbox{% - \unvbox \@nameuse{@mpfootins#1}% - \def\baselinestretch{\m@m@singlespace} - \reset@font\@nameuse{foottextfont#1}% - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}% - }% - \color@begingroup - \@nameuse{@twocolfootfmt#1}{##1}% - \color@endgroup}\m@mmf@prepare}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@threecolfootnotetext} -% \begin{macro}{\@mpthreecolfootnotetext} -% \begin{macrocode} -\renewcommand{\@threecolfootnotetext}[1]{% - \insert\footinsv@r{% - \def\baselinestretch{\m@m@singlespace} - \reset@font\foottextfont - \@preamfntext - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \color@begingroup - \@threecolfootfmt{#1}% - \color@endgroup}\m@mmf@prepare} - -\renewcommand{\@mpthreecolfootnotetext}[1]{% - \global\setbox\@mpfootinsv@r\vbox{% - \unvbox \@mpfootinsv@r - \def\baselinestretch{\m@m@singlespace} - \reset@font\foottextfont - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@mpfootnote\endcsname\@thefnmark - }% - \color@begingroup - \@threecolfootfmt{#1}% - \color@endgroup}\m@mmf@prepare} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\m@makethreecolfootnotetext} -% \begin{macro}{\m@make@mpthreecolfootnotetext} -% \begin{macrocode} -\renewcommand{\m@make@threecolfootnotetext}[1]{% - \@namelongdef{@threecolfootnotetext#1}##1{% - \insert\@nameuse{footins#1}{% - \def\baselinestretch{\m@m@singlespace} - \reset@font\@nameuse{foottextfont#1}% - \@preamfntext - \protected@edef\@currentlabel{% - \csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}% - }% - \color@begingroup - \@nameuse{@threecolfootfmt#1}{##1} - \color@endgroup}\m@mmf@prepare}} - -\renewcommand{\m@make@mpthreecolfootnotetext}[1]{% - \@namelongdef{@mpthreecolfootnotetext#1}##1{% - \global\setbox\@nameuse{@mpfootins#1}\vbox{% - \unvbox \@nameuse{@mpfootins#1}% - \def\baselinestretch{\m@m@singlespace} - \reset@font\@nameuse{foottextfont#1}% - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}% - }% - \color@begingroup - \@nameuse{@threecolfootfmt#1}{##1}% - \color@endgroup}\m@mmf@prepare}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\@parafootnotetext} -% \begin{macro}{\@mpparafootnotetext} -% \begin{macrocode} -\renewcommand{\@parafootnotetext}[1]{% - \insert\footinsv@r{% - \def\baselinestretch{\m@m@singlespace} - \reset@font\foottextfont - \@preamfntext - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \setbox0=\vbox{\hsize=\maxdimen - \color@begingroup - \noindent \@parafootfmt{#1}% - \color@endgroup}\m@mungebox}% - \m@mmf@prepare} - -\renewcommand{\@mpparafootnotetext}[1]{% - \global\setbox\@mpfootinsv@r\vbox{% - \unvbox \@mpfootinsv@r - \def\baselinestretch{\m@m@singlespace} - \reset@font\foottextfont - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@mpfootnote\endcsname\@thefnmark - }% - \setbox0=\vbox{\hsize=\maxdimen - \color@begingroup - \noindent \@parafootfmt{#1}% - \color@endgroup}\m@mungebox}% - \m@mmf@prepare} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\m@makeparafootnotetext} -% \begin{macro}{\m@make@mpparafootnotetext} -% \begin{macrocode} -\renewcommand{\m@make@parafootnotetext}[1]{% - \@namelongdef{@parafootnotetext#1}##1{% - \insert\@nameuse{footins#1}{% - \def\baselinestretch{\m@m@singlespace} - \reset@font\@nameuse{foottextfont#1}% - \@preamfntext - \protected@edef\@currentlabel{% - \csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}% - }% - \setbox0=\vbox{\hsize=\maxdimen - \color@begingroup - \noindent \@nameuse{@parafootfmt#1}{##1} - \color@endgroup}\m@mungebox}\m@mmf@prepare}} - -\renewcommand{\m@make@mpparafootnotetext}[1]{% - \@namelongdef{@mpparafootnotetext#1}##1{% - \global\setbox\@nameuse{@mpfootins#1}\vbox{% - \unvbox \@nameuse{@mpfootins#1}% - \def\baselinestretch{\m@m@singlespace} - \reset@font\@nameuse{foottextfont#1}% - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}% - }% - \setbox0=\vbox{\hsize=\maxdimen - \color@begingroup - \noindent \@nameuse{@parafootfmt#1}{##1}% - \color@endgroup}\m@mungebox}\m@mmf@prepare}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% \subsection{Abnormal parskips} -% -% Non-zero, positive \cs{parskip}, which is not to be encouraged. Code -% based on Robin Fairbairns \Lpack{parskip} package and the NTG classes. -% -% Prevent loading of the \Lpack{parskip} package. -% \begin{macrocode} -\EmulatedPackage{parskip} - -% \end{macrocode} -% -% \begin{macro}{\ifm@mnzpskip} -% \begin{macro}{\m@mnzpskiptrue} -% \begin{macro}{\m@mnzpskipfalse} -% \cs{ifm@mnzpskip} is TRUE if \cs{parskip} set to antything but 0pt. -% \begin{macrocode} -\newif\ifm@mnzpskip -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\traditionalparskip} -% \begin{macro}{\m@mabparskip} -% \begin{macro}{\abnormalparskip} -% \begin{macro}{\nonzeroparskip} -% \begin{macrocode} -%%% \traditionalparskip set \parskip to 0pt. -\newcommand*{\traditionalparskip}{% - \parskip \z@ - \m@mnzpskipfalse} -\newskip\m@mabparskip -%%% \abnormalparskip{length} sets \parskip to length. -\newcommand*{\abnormalparskip}[1]{% - \setlength{\parskip}{#1}\m@mabparskip=#1\relax - \m@mnzpskiptrue} -%%% \nonzeroparskip sets \parskip to a non-zero value that might be -%%% not too bad (any non-zero \parskip is not good). -\newcommand*{\nonzeroparskip}{\abnormalparskip{% - 0.5\baselineskip - \@plus .1\baselineskip \@minus .1\baselineskip% NTG -%% 0.5/baselineskip \@plus 2pt% RF -}} -\traditionalparskip - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\defaultlists} -% \begin{macro}{\tightlists} -% Change these to cater for abnormal \cs{parskip}s -% \begin{macrocode} -%%% Change lists to cater for non-zero \parskip. -\newlength{\itemsepii} -\newlength{\itemsepiii} -\newlength{\partopsepiii} -%%%\newskip\parsepiii -\let\m@mold@defaultlists\defaultlists -\renewcommand*{\defaultlists}{% - \m@mold@defaultlists - \itemsepii\parsepii - \itemsepiii\topsepiii - \partopsepiii \p@ \@plus\z@ \@minus\p@ - \ifm@mnzpskip - \partopsep \p@ \@plus\z@ \@minus\p@ - \topsepi\z@ - \parsepi\parskip - \itemsepi\z@ - \topsepii\z@ - \parsepii\parskip - \itemsepii\z@ - \topsepiii\z@ -%% \parsepiii\parskip - \itemsepiii\z@ - \fi} - -\let\m@mold@tightlists\tightlists -\renewcommand*{\tightlists}{% - \m@mold@tightlists - \ifm@mnzpskip - \partopsep \p@ \@plus\z@ \@minus\p@ - \topsepi\z@ - \parsepi\parskip - \itemsepi\z@ - \topsepii\z@ - \parsepii\parskip - \itemsepii\z@ - \topsepiii\z@ -%% \parsepiii\parskip - \itemsepiii\z@ - \partopsepiii\partopsep - \fi} - -\let\@listI\@listi -\defaultlists -\@listi - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% \begin{macro}{\@listii} -% \begin{macro}{\@listiii} -% \begin{macrocode} -\renewcommand*{\@listii}{% - \leftmargin\leftmarginii - \labelwidth\leftmarginii - \advance\labelwidth-\labelsep - \topsep\topsepii - \parsep\parsepii - \itemsep\itemsepii} -\renewcommand*{\@listiii}{% - \leftmargin\leftmarginiii - \labelwidth\leftmarginiii - \advance\labelwidth-\labelsep - \topsep\topsepiii - \parsep\z@ - \itemsep\itemsepiii - \partopsep\partopsepiii} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% -% -% \begin{macro}{\verbatim} -% From NTG, where it is a \cs{def} -% \begin{macrocode} -\providecommand*{\verbatim}{% - \topsep=-0.5\parskip - \@verbatim - \frenchspacing\@vobeyspaces \@xverbatim} - -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\@minpagerestore} -% From NTG -% \begin{macrocode} -\providecommand*{\@minipagerestore}{% - \parskip=.5\baselineskip \@plus .1\baselineskip \@minus .1\baselineskip} -% \end{macrocode} -% But there are two conflicting earlier definitions which I'll now combine. -% \begin{macrocode} -\renewcommand*{\@minipagerestore}{% - \let\@verbfootnotetext\@verbmpfootnotetext% for \verbfootnotein a minipage - \m@mdoextrafeetmini% footnotes in minipages - \ifm@mnzpskip \parskip=\m@mabparskip\fi} - -% \end{macrocode} -% \end{macro} -% -% Use zero \cs{parskip} in ToC listing. Already done in memoir. -% -% -% -% -% \subsection{Side captions} -% -% \begin{macro}{\setsidecaps} -% Ivars Finvers (\texttt{ifinvers@ucalgary.ca}) noted (2006/09/26) -% that the settings for -% \cs{sidecapwidth} and \cs{sidecapsep} didn't change if the marginal note -% settings were changed via \cs{checkandfixthelayout}. These settings get -% checked at setting time, not at \cs{checkand...}. -% \begin{macrocode} -%%% \setsidecaps{<sep>}{<width>} sets sidecaption lengths -\newcommand*{\setsidecaps}[2]{% - \setlength{\sidecapsep}{#1}\@memznegtest{\sidecapsep}% - \setlength{\sidecapwidth}{#2}\@memznegtest{\sidecapwidth}} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Sidebars} -% -% Donald Arseneau came up with some improvements to sidebars. The impetus -% for this came from a CTT thread, \textit{whitespace after my command}, -% 2006/11/30 and earlier. In email to me on 2006/11/30 he said: -% \begin{quotation} -% For \Lclass{memoir} \cs{sidebar}, it seems the rules are expanding -% to fill the space for the sidebar, so here is my suggested change -% to \cs{sidecontents}. -% -% It occurs to me that a separate \cs{sidetsep} (or \cs{sidetopsep}) -% would be more valuable than having an explicit 1\cs{onelineskip}. -% -% I grouped common code into two macros, and altered \cs{sidebarform} too. -% \end{quotation} -% -% Since then we have been going back and forth, with the result that -% practically all the complex code is Donald's. -% -% \begin{macro}{\m@sideb@left} -% \begin{macro}{\m@sideb@right} -% Some common code for use later. -% \begin{macrocode} -\newcommand*{\m@sideb@left}{% - \@tempdimc \sidebarwidth - \advance\@tempdimc\sidebarhsep - \kern-\@tempdimc} -\newcommand*{\m@sideb@right}{% - \@tempdimc \columnwidth% or \hsize - \advance\@tempdimc\sidebarhsep - \kern\@tempdimc} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\sidebartopsep} -% New length for separation at the top of a sidebar. -% \begin{macrocode} -\newlength{\sidebartopsep} - \setlength{\sidebartopsep}{0pt} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\sidebarfont} -% \begin{macrocode} -\renewcommand*{\sidebarfont}{} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\setsidebarheight} -% The macro \cs{setsidebarheight}\marg{height} sets the total height -% of sidebars on a page to \meta{height}. This is an interface for -% controlling \verb?\dimen\sideins? properly, taking account of \cs{topskip} -% and the sidebar font size (and therefore should be invoked \emph{after} -% declaring \cs{sidebarfont}). -% -% Note that \cs{sidebartopsep} is \emph{not} included as part of the -% allocated height. -% \begin{macrocode} -\renewcommand*{\setsidebarheight}[1]{% - \setlength{\dimen\sideins}{#1}% - \advance\dimen\sideins-\topskip - \advance\dimen\sideins\ht\strutbox} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\setsidebars} -% Macro to set the main sidebar parameters. -% \begin{macrocode} -%%% \setsidebars{hsep}{width}{vsep}{topsep}{font}{height} -%%% A * argument means leave the setting as is. -\newcommand*{\setsidebars}[6]{% - \nametest{#1}{*}\ifsamename\else - \setlength{\sidebarhsep}{#1}\@memznegtest{\sidebarhsep}% - \fi - \nametest{#2}{*}\ifsamename\else - \setlength{\sidebarwidth}{#2}\@memznegtest{\sidebarwidth}% - \fi - \nametest{#3}{*}\ifsamename\else - \setlength{\sidebarvsep}{#3}\@memnegtest{\sidebarvsep}% - \fi - \nametest{#4}{*}\ifsamename\else - \setlength{\sidebartopsep}{#4}% - \fi - \nametest{#5}{*}\ifsamename\else - \def\sidebarfont{#5}% - \fi - \nametest{#6}{*}\ifsamename\else - \setsidebarheight{#6}% - \ifdim\dimen\sideins>\z@\else - \@memerror{\protect\sidebarheight\space is zero or negative}{\@ehd}% - \fi - \fi} - \setsidebars{\marginparsep}% sidebarhsep - {\marginparwidth}% sidebarwidth - {\onelineskip}% sidebarvsep - {0pt}% sidebartopsep - {\normalsize\normalfont}% sidebarfont - {\textheight}% sidebarheight - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\sidecontents} -% \begin{macrocode} -\renewcommand{\sidecontents}{\hbox to \z@{% - \if@twocolumn% %% put outside nearest column - \if@firstcolumn% %% move to left - \m@sideb@left - \else% %% move to right - \m@sideb@right - \fi - \else% %% put into foremargin? - \ifsidebaroneside% %% move to right - \m@sideb@right - \else% %% pick the margin - \ifcase\m@msidebar@margin% 0 to left - \m@sideb@left - \or% 1 to right - \m@sideb@right - \or% 2 to outer - \ifodd\c@page% %% move to right - \m@sideb@right - \else% %% move to left - \m@sideb@left - \fi - \or% 3 to inner - \ifodd\c@page% %% move to left - \m@sideb@left - \else %% move to right - \m@sideb@right - \fi - \fi - \fi - \fi -% \end{macrocode} -% DA and I have gone to and fro on the next bit of code trying to get -% the top alignment correct. DA has the last word. -% \begin{verbatim} -% \vtop to0pt{% -% \vskip\sidebartopsep -% \unvbox\sideins \vss}% -% \end{verbatim} -% \begin{macrocode} -% \vbox to0pt{% -% \vskip\onelineskip \vskip-\topskip -% \vskip\sidebartopsep -% \unvbox\sideins \vss}% -% \end{verbatim} -% \begin{macrocode} - \vtop to0pt{% - \normalsize\normalfont\sidebarfont % select font so we know the strut size - \vskip\topskip \vskip-\ht\strutbox - \vskip\sidebartopsep % extra vertical shift - \unvbox\sideins \vss}% - \hss -}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\sidebar} -% DA says that having stacked insertions position properly is difficult. -% Here he uses the size of the strut to regulate both the height and the -% depth of each insertion (much as for footnotes). The following is his -% code and commentary. -% \begin{macrocode} -\renewcommand{\sidebar}[1]{% - \insert\sideins{% -% \end{macrocode} -% Begin the insertion with settings. The height of the strut box -% (dependant on the font) will determine the top alignment both initially -% and after a page break. The setting for maximum depth does not control -% anything; see the code further on instead. -% \begin{macrocode} - \hsize\sidebarwidth - \@parboxrestore - \sidebarform \normalsize\normalfont\sidebarfont - \splittopskip=\ht\strutbox - \splitmaxdepth=\dp\strutbox % doesn't do anything useful -% \end{macrocode} -% Allow a free split at the top (so this whole insertion moves -% to the next page if it does not fit). -% \begin{macrocode} - \allowbreak -% \end{macrocode} -% Control the (vertical) positioning of non-split entries. Footnotes (and -% previous versions of \cs{sidebar}) us a strut at the beginning of the text, -% but we will allow a baseline-skip to perform the same function. This -% method also introduces a \cs{parskip} when the paragraph begins, so we -% counteract that. (The problem with an initial strut is that it messes' -% up entries that begin with vertical space.) -% \begin{macrocode} - \prevdepth=\dp\strutbox % supersedes a "top-strut" - \vskip-\parskip -% \end{macrocode} -% Now the user's sidebar entry: -% \begin{macrocode} - #1% -% \end{macrocode} -% If the entry ended still in a paragraph, take the chance to insert a -% final strut; then end the paragraph. -% \begin{macrocode} - \ifvmode\else - \unskip\@finalstrut\strutbox - \fi\par -% \end{macrocode} -% Explicitly force the effect of \cs{maxdepth} (\cs{splitmaxdepth}), -% but using the depth of the strut in the r\^{o}le of \cs{maxdepth}. -% \begin{macrocode} - \ifdim\prevdepth>\dp\strutbox \prevdepth=\dp\strutbox \fi -% \end{macrocode} -% Now control how adjacent entries abut (whether or not a final strut got -% inserted) and how an entry fits at the bottom of the page. Use \cs{vskip}s -% to move from the text bottom to where a strut would bottom out, -% but insert an allowed breakpoint at the baseline position -% (so that the entry baseline may match the page's baseline). Finally -% insert the extra separation between entries. -% \begin{macrocode} - \ifdim\prevdepth>99\p@ - \nobreak - \vskip-\prevdepth - \allowbreak - \vskip\dp\strutbox - \fi - \vskip\sidebarvsep}} - -% \end{macrocode} -% \end{macro} -% -% -% \subsection{Typeout the layout} -% -% Update this for sidecaptions and sidebars. -% -% \begin{macro}{\typeoutlayout} -% Include the sidecap and sidebar settings. -% \begin{macrocode} -\renewcommand*{\typeoutlayout}{% - \typeout{} - \typeout{******************************************************} - \typeout{Stock height and width: - \the\stockheight\space by \the\stockwidth} - \typeout{Top and edge trims: - \the\trimtop\space and \the\trimedge} - \typeout{Page height and width: - \the\paperheight\space by \the\paperwidth} - \typeout{Text height and width: - \the\textheight\space by \the\textwidth} - \typeout{Spine and edge margins: - \the\spinemargin\space and \the\foremargin} - \typeout{Upper and lower margins: - \the\uppermargin\space and \the\lowermargin} - \typeout{Headheight and headsep: - \the\headheight\space and \the\headsep} - \typeout{Footskip: - \the\footskip} - \typeout{Columnsep and columnseprule: - \the\columnsep\space and \the\columnseprule} - \typeout{Marginparsep and marginparwidth: - \the\marginparsep\space and \the\marginparwidth} - \typeout{Sidecapsep and sidecapwidth: - \the\sidecapsep\space and \the\sidecapwidth} - \typeout{Sidebarhsep and sidebarwidth: - \the\sidebarhsep\space and \the\sidebarwidth} - \typeout{Sidebarvsep and sidebartopsep: - \the\sidebarvsep\space and \the\sidebartopsep} - \typeout{Sidebarheight: - \the\dimen\sideins} - \typeout{******************************************************} - \typeout{}} - -% \end{macrocode} -% \end{macro} -% -% -% \subsection{Footnotes} -% -% Per Starb\"{a}ck found (CTT \textit{feetbelowfloat in memoir}, 2006/11/24) -% that this didn't effect anything in \cs{raggedbottom}, contrary to the -% claim in the manual. -% -% \begin{macro}{\setfootnoterule} -% \cs{setfootnoterule}\oarg{vfill}\marg{uplift}\marg{width}\marg{thickness} -% defines the \cs{footnoterule}. -% \begin{macrocode} -%%% user command to set the \footnoterule -%%% \setfootnoterule[<fill>]{<uplift>}{<width>}{<thickness>} -\newcommand*{\setfootnoterule}[4][]{% - \def\footnoterule{\kern -#2\relax #1\relax - \hrule width #3\relax - \kern #2\kern-#4}} -%%%% memoir's default setting is: -\setfootnoterule{3pt}{0.4\columnwidth}{\normalrulethickness} -%%%% to force footnotes to the bottom after a \raggedbottom -%%%% \setfootnoterule[\vfill]{3pt}{0.4\columnwidth}{\normalrulethickness} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Widows and sloppybottom} -% -% There was a discussion \textit{widow handling?} on CTT in -% May 2006. \texttt{ivowel@gmail.com} wrote -% \begin{quote} -% in experimenting with raggedbottom, widowpenalty, and clubpenalty, -% I think that I have not found a solution that strikes me as -% particularly desirable. I think what I would really like is that -% widows (i.e., left-over single lines that begin on the following -% page) are resolved not by pushing one extra line from the same -% paragraph also onto the next page, but by stretching the -% \cs{textheight} to allow this one extra at the bottom of the -% same page. -% \end{quote} -% Donald Arseneau, as he so often does, came up with a solution he -% termed \cs{sloppybottom}. Here is a generalised version. -% -% \begin{macro}{\sloppybottom} -% Allow an extra line on a page to save a widow. -% \begin{macrocode} -%%% \sloppybottom allows an extra line on a page to save a widow. -%%% You must increase the \topskip (by 60\% is reasonable) and this -%%% will push the text lower on the page. Run \checkandfixthelayout -%%% after the change. For example: -%%% \setlength{\topskip}{1.6\topskip} -%%% \checkandfixthelayout -%%% \sloppybottom -%%% ... -\newcommand*{\sloppybottom}{% - \def\@textbottom{\vskip \z@ \@plus.0001fil \@minus .95\topskip}% - \topskip=1\topskip \@plus 0.625\topskip \@minus .95\topskip - \def\@texttop{\vskip \z@ \@plus -0.625\topskip \@minus -0.95\topskip}} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Quark marks} -% -% William Adams (2006/08/28) supplied the following code to use trim marks -% along the style of Quark Xpress. He also supplied a basis for -% \cs{printime} but I have used one from \textit{TeX for the Impatient} -% as it saves some counters. -% \begin{macro}{\m@mcalchm} -% Calculate the hours and minutes from \cs{time}. -% \begin{macrocode} -%%% \m@mcalchm calculates the time of day. (Code basis from TeX for the Impatient) -\newcommand*{\m@mcalchm}{% - \count0 = \time \divide \count0 by 60\relax - \count2 = \count0\relax% the hour - \count4 = \time \multiply\count0 by 60\relax - \advance\count4 by -\count0\relax% the minute - \ifnum\count4<10 \toks1 = {0}% make a leading zero - \else \toks1 = {}% - \fi} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\hmpunct} -% \begin{macro}{\amname} -% \begin{macro}{\pmname} -% User format controls for \cs{printtime} -% \begin{macrocode} -%%% punctuation, am and pm for \printtime -\newcommand*{\hmpunct}{:}% hours minutes separator -\newcommand*{\amname}{am}% ante meridiem -\newcommand*{\pmname}{pm}% post meridiem - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\printtime} -% \begin{macro}{\printtime*} -% Print the time of day as 24 hour clock or 12 hour clock -% \begin{macrocode} -%%% \printtime prints time per 24 hour clock -%%% \printtime* prints time per 12 hour clock -\newcommand*{\printtime}{% - \@ifstar{\m@msprtime}{\m@mprtime}} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\m@mprtime} -% \begin{macro}{\m@msprtime} -% These implement time printing: \cs{m@mprtime} as 24 hour clock and -% \cs{m@msprtime} as 12 hour clock -% \begin{macrocode} -\newcommand*{\m@mprtime}{\begingroup - \m@mcalchm - \number\count2\hmpunct\the\toks1 \number\count4 - \endgroup} -\newcommand*{\m@msprtime}{\begingroup - \m@mcalchm - \def\@mpm{\pmname}% - \ifnum\count2<1\relax% early in the morning - \count2=12\relax - \ifnum\count4>0\relax% not midnight - \def\@mpm{\amname}% - \fi - \else - \ifnum\time<721\relax% noon or earlier - \def\@mpm{\amname}% - \else - \ifnum\time>779\relax% 1300 hrs or later - \advance\count2 by -12\relax - \fi - \fi - \fi - \number\count2\hmpunct\the\toks1 \number\count4\ \@mpm - \endgroup} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\registrationColour} -% \begin{macro}{\quarkmarks} -% \begin{macrocode} -%%% \quarkmarks generates trim marks in the style of Quark Xpress -%%% (Code supplied by William Adams) -%%% -\newcommand*{\registrationColour}[1]{#1} -\newcommand*{\quarkmarks}{% -\renewcommand*{\tmarktl}{\registrationColour{% - \begin{picture}(0,0) - \setlength{\unitlength}{1bp}\thicklines - \put(-36,0){\line(1,0){24}} - \put(0,12){\line(0,1){24}} - \put(3,27){\ttfamily\fontsize{8bp}{10bp}\selectfont\jobname\ \ - \today\ \ \printtime\ \ Page \thepage} - \end{picture}}} -\renewcommand*{\tmarktm}{\registrationColour{% - \begin{picture}(0,0) - \setlength{\unitlength}{1bp}\thicklines - \put(-24,24){\line(1,0){48}} - \put(0,12){\line(0,1){24}} - \put(0,24){\oval(12,12)} - \end{picture}}} -\renewcommand*{\tmarktr}{\registrationColour{% - \begin{picture}(0,0) - \setlength{\unitlength}{1bp}\thicklines - \put(12,0){\line(1,0){24}} - \put(0,12){\line(0,1){24}} - \end{picture}}} -\renewcommand*{\tmarkmr}{\registrationColour{% - \begin{picture}(0,0) - \setlength{\unitlength}{1bp}\thicklines - \put(12,0){\line(1,0){24}} - \put(24,-24){\line(0,1){48}} - \put(24,0){\oval(12,12)} - \end{picture}}} -\renewcommand*{\tmarkbr}{\registrationColour{% - \begin{picture}(0,0) - \setlength{\unitlength}{1bp}\thicklines - \put(12,0){\line(1,0){24}} - \put(0,-36){\line(0,1){24}} - \end{picture}}} -\renewcommand*{\tmarkbm}{\registrationColour{% - \begin{picture}(0,0) - \setlength{\unitlength}{1bp}\thicklines - \put(-24,-24){\line(1,0){48}} - \put(0,-36){\line(0,1){24}} - \put(0,-24){\oval(12,12)} - \end{picture}}} -\renewcommand*{\tmarkbl}{\registrationColour{% - \begin{picture}(0,0) - \setlength{\unitlength}{1bp}\thicklines - \put(-36,0){\line(1,0){24}} - \put(0,-36){\line(0,1){24}} - \end{picture}}} -\renewcommand*{\tmarkml}{\registrationColour{% - \begin{picture}(0,0) - \setlength{\unitlength}{1bp}\thicklines - \put(-36,0){\line(1,0){24}} - \put(-24,-24){\line(0,1){48}} - \put(-24,0){\oval(12,12)} - \end{picture}}} -\renewcommand*{\trimmarks}{% -%% \special{papersize=\the\stockwidth,\the\stockheight} - {% - \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page - \hb@xt@\z@{\hskip-1in - \ifodd\c@page - \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth - \else - \if@twoside - \hskip\trimedge % left of logical page - \else - \hskip\stockwidth \hsip-\trimedge \hskip-\paperwidth - \fi - \fi - \vbox to \paperheight{% - \let\protect\relax % <- v1.4 addition - \hb@xt@\paperwidth{\tmarktl\hfil\tmarktm\hfil\tmarktr}% - \vfil - \hb@xt@\paperwidth{\tmarkml\hfil\tmarkmr}% - \vfil - \hb@xt@\paperwidth{\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}% - \hss}% - \vss}}% -}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% \subsection{Pagestyles} -% -% Lars Madsen (2006/11/03) noted that there were some missing \verb?%? -% at the end of some lines in \cs{makepagestyle} that would cause -% extraneous spaces in something like: \\ -% \verb?X\pagestyle{plain}X? \\ -% though I can't think that many would do this. In any case here is the -% entire revised section from \texttt{memoir.dtx} \ldots -% -% -% \begin{macro}{\makepagestyle} -% At last we can put everything together for defining a new pagestyle, -% via the macro \cs{makepagestyle}\marg{style} which initially sets up -% a new pagestyle \meta{style} corresponding the the \LaTeX{} \texttt{empty} -% pagestyle. The prior macros can then be used to make modifications -% to the style. -% \changes{v1.0}{2001/11/15}{Now 2 stage process for defining \cs{@evenhead} -% and friends} -% \changes{v1.61}{2004/03/14}{Added \cs{m@mhe@dreset} at several points in -% \cs{makepagestyle} (from patch 2.1)} -% \begin{macrocode} -%%% Remove extraneous spaces from pagestyle code -%%% -\renewcommand*{\makepagestyle}[1]{% -% \end{macrocode} -% First define the macro \cs{ps@style}, which in turn defines the macros -% \cs{@evenhead}, \cs{@oddhead}, \cs{@evenfoot} and \cs{@oddfoot}. -% \begin{macrocode} - \@namedef{ps@#1}{% - \@namedef{#1@evenhead}{% -% \end{macrocode} -% The code for the definition of \cs{@evenhead} and friends is based on code -% from Piet van Oostrum's \Lpack{fancyhdr} package. The three -% parts of the header are put into parboxes, with fills between them, and -% the whole lot is put into a box the width of the header. Fillers are put -% before and after the main box which control the header position. -% -% First the left filler which is either \cs{relax} or \cs{hss}, and then -% start the main box. -% \begin{macrocode} - \@nameuse{#1evenhpl}\hb@xt@\@nameuse{#1runwidth}{\m@mhe@dreset% - \vbox{\hbox{% -% \end{macrocode} -% The left part of the header. -% \begin{macrocode} - \rlap{\parbox[b]{\@nameuse{#1runwidth}}{% - \raggedright\@nameuse{#1eheadl}\strut}}\hfill -% \end{macrocode} -% The center part of the header. -% \begin{macrocode} - \parbox[b]{\@nameuse{#1runwidth}}{% - \centering\@nameuse{#1eheadc}\strut}\hfill -% \end{macrocode} -% The right part of the header. -% \begin{macrocode} - \llap{\parbox[b]{\@nameuse{#1runwidth}}{% - \raggedleft\@nameuse{#1eheadr}\strut}}}% -% \end{macrocode} -% Finally, the header rule and finish with the right filler, which -% is either \cs{relax} or \cs{hss}. -% \begin{macrocode} - \@nameuse{#1headrule}}}\@nameuse{#1evenhpr}}% -% \end{macrocode} -% The code for the \cs{@oddhead}, \cs{@evenfoot} and \cs{@oddfoot} follows -% a similar pattern. Here is \cs{@oddhead}. -% \begin{macrocode} - \@namedef{#1@oddhead}{% - \@nameuse{#1oddhpl}\hb@xt@\@nameuse{#1runwidth}{\m@mhe@dreset% - \vbox{\hbox{% - \rlap{\parbox[b]{\@nameuse{#1runwidth}}{% - \raggedright\@nameuse{#1oheadl}\strut}}\hfill - \parbox[b]{\@nameuse{#1runwidth}}{% - \centering\@nameuse{#1oheadc}\strut}\hfill - \llap{\parbox[b]{\@nameuse{#1runwidth}}{% - \raggedleft\@nameuse{#1oheadr}\strut}}}% - \@nameuse{#1headrule}}}\@nameuse{#1oddhpr}}% -% \end{macrocode} -% And \cs{@evenfoot}. For the footers the rules come \emph{before} any foot -% entries. -% \begin{macrocode} - \@namedef{#1@evenfoot}{% - \@nameuse{#1evenfpl}\hb@xt@\@nameuse{#1runwidth}{\m@mhe@dreset% - \vbox{\@nameuse{#1footrule}\hbox{% - \rlap{\parbox[b]{\@nameuse{#1runwidth}}{% - \raggedright\@nameuse{#1efootl}\strut}}\hfill - \parbox[b]{\@nameuse{#1runwidth}}{% - \centering\@nameuse{#1efootc}\strut}\hfill - \llap{\parbox[b]{\@nameuse{#1runwidth}}{% - \raggedleft\@nameuse{#1efootr}\strut}}}% - }}\@nameuse{#1evenfpr}}% -% \end{macrocode} -% Lastly the \cs{@oddfoot}. -% \begin{macrocode} - \@namedef{#1@oddfoot}{% - \@nameuse{#1oddfpl}\hb@xt@\@nameuse{#1runwidth}{\m@mhe@dreset% - \vbox{\@nameuse{#1footrule}\hbox{% - \rlap{\parbox[b]{\@nameuse{#1runwidth}}{% - \raggedright\@nameuse{#1ofootl}\strut}}\hfill - \parbox[b]{\@nameuse{#1runwidth}}{% - \centering\@nameuse{#1ofootc}\strut}\hfill - \llap{\parbox[b]{\@nameuse{#1runwidth}}{% - \raggedleft\@nameuse{#1ofootr}\strut}}}% - }}\@nameuse{#1oddfpr}}% -% \end{macrocode} -% Now we define \cs{@evenhead} etc., in terms of \verb?#1@evenhead?. -% \begin{macrocode} - \def\@evenhead{\@nameuse{#1@evenhead}}% - \def\@oddhead{\@nameuse{#1@oddhead}}% - \def\@evenfoot{\@nameuse{#1@evenfoot}}% - \def\@oddfoot{\@nameuse{#1@oddfoot}}% -% \end{macrocode} -% To finish off the definition of \cs{ps@style}, add in a hook which can be -% defined so that it adds additional code, if required. -% \begin{macrocode} - \@nameuse{#1pshook}% - }% -% \end{macrocode} -% The final part of setting up the new pagestyle is defining all the macros -% called by \cs{ps@style}, and giving them default values. Make the headers -% and footers empty. -% \begin{macrocode} - \makeevenhead{#1}{}{}{}% - \makeoddhead{#1}{}{}{}% - \makeevenfoot{#1}{}{}{}% - \makeoddfoot{#1}{}{}{}% -% \end{macrocode} -% Make the headers/footers the same width as the \cs{textwidth}, center -% them, and ensure -% that the rules have zero height so that they will be invisible. -% \begin{macrocode} - \makerunningwidth{#1}{\textwidth}% - \makeheadposition{#1}{}{}{}{}% - \makeheadrule{#1}{\textwidth}{0pt}% - \makefootrule{#1}{\textwidth}{\footruleheight}{\footruleskip}% -% \end{macrocode} -% Finally, there is no addtional code needed, so make the hook empty, and -% we are done. -% \begin{macrocode} - \makepsmarks{#1}{}% -} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\aliaspagestyle} -% The command \cs{aliaspagestyle}\marg{aliasl}\marg{original} -% defines the \meta{alias} pagestyle to be an alias for the -% \meta{original} pagestyle. -% \begin{macrocode} -\renewcommand*{\aliaspagestyle}[2]{% - \@namedef{ps@#1}{\@nameuse{ps@#2}}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\copypagestyle} -% The command \cs{copypagestyle}\marg{new}\marg{original} -% defines the \meta{new} pagestyle to be a copy of the -% \meta{original} pagestyle. -% -% It first makes the \meta{new} (empty) pagestyle then defines the internals -% in terms of the \meta{original} internals. -% \changes{v1.2}{2002/08/10}{Added \cs{copypagestyle}} -% \begin{macrocode} -\renewcommand*{\copypagestyle}[2]{% - \makepagestyle{#1}% -% \end{macrocode} -% Do the headers and footers. -% \begin{macrocode} - \makeevenhead{#1}{\@nameuse{#2eheadl}}% - {\@nameuse{#2eheadc}}{\@nameuse{#2eheadr}}% - \makeoddhead{#1}{\@nameuse{#2oheadl}}% - {\@nameuse{#2oheadc}}{\@nameuse{#2oheadr}}% - \makeevenfoot{#1}{\@nameuse{#2efootl}}% - {\@nameuse{#2efootc}}{\@nameuse{#2efootr}}% - \makeoddfoot{#1}{\@nameuse{#2ofootl}}% - {\@nameuse{#2ofootc}}{\@nameuse{#2ofootr}}% -% \end{macrocode} -% Set the width. -% \begin{macrocode} - \makerunningwidth{#1}{\@nameuse{#2runwidth}}% -% \end{macrocode} -% Specify the \cs{headposition}. -% \begin{macrocode} - \@namedef{#1evenhpl}{\@nameuse{#2evenhpl}}% - \@namedef{#1oddhpl}{\@nameuse{#2oddhpl}}% - \@namedef{#1evenfpl}{\@nameuse{#2evenfpl}}% - \@namedef{#1oddfpl}{\@nameuse{#2oddfpl}}% -% \end{macrocode} -% Specify the head and foot rules. -% \begin{macrocode} - \@namedef{#1headrule}{\@nameuse{#2headrule}}% - \@namedef{#1footrule}{\@nameuse{#2footrule}}% -% \end{macrocode} -% And pick up the hook. -% \begin{macrocode} - \makepsmarks{#1}{\@nameuse{#2pshook}}% -} - -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\ifonlyfloats} -% \cs{ifonlyfloats}\marg{yes}\marg{no} processes \meta{yes} if the macro is -% called on a page consisting only of floats, otherwise \meta{no} is -% processed. \cs{if@fcolmade} is specified in \file{ltoutput.dtx}. -% \changes{v1.0}{2001/11/14}{Added \cs{ifonlyfloats}} -% \begin{macrocode} -\renewcommand*{\ifonlyfloats}[2]{\if@fcolmade #1\else #2\fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\mergepagefloatstyle} -% \cs{mergepagefloatstyle}\marg{style}\marg{textstyle}\marg{floatstyle} -% makes a new page style \meta{style} that is \meta{textstyle} on normal -% pages but uses \meta{floatstyle} on float-only pages. Both \meta{textstyle} -% and \meta{floatstyle} must have been previously defined. -% \changes{v1.0}{2001/11/15}{Added \cs{mergepagefloatstyle}} -% \begin{macrocode} -\renewcommand*{\mergepagefloatstyle}[3]{% -% \end{macrocode} -% Make sure that the two styles have been called, otherwise we get some -% undefined errors. -% \begin{macrocode} - \@nameuse{ps@#3}\@nameuse{ps@#2}% -% \end{macrocode} -% Specify the pagestyle's headers and footers. -% \begin{macrocode} - \@namedef{ps@#1}{% - \def\@evenhead{\ifonlyfloats{\@nameuse{#3@evenhead}}% - {\@nameuse{#2@evenhead}}}% - \def\@oddhead{\ifonlyfloats{\@nameuse{#3@oddhead}}% - {\@nameuse{#2@oddhead}}}% - \def\@evenfoot{\ifonlyfloats{\@nameuse{#3@evenfoot}}% - {\@nameuse{#2@evenfoot}}}% - \def\@oddfoot{\ifonlyfloats{\@nameuse{#3@oddfoot}}% - {\@nameuse{#2@oddfoot}}}% -% \end{macrocode} -% Set the hook to the \meta{textstyle} on the assumption that that is -% more complex that required for a float page. -% \begin{macrocode} - \@namedef{#1pshook}{\@nameuse{#2pshook}}% -% \end{macrocode} -% That's it. -% \begin{macrocode} -}} -% \end{macrocode} -% \end{macro} -% -% The pagestyles \pstyle{empty} and \pstyle{plain} are defined -% in \file{latex.dtx}. However, I will redefine them here, just in -% case someone takes a fancy to modifying them. -% -% \begin{macro}{\ps@empty} -% The \pstyle{empty} pagestyle is simple, it's just what we get when -% we call \cs{makepagestyle}. -% \begin{macrocode} -\makepagestyle{empty} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\ps@plain} -% The \pstyle{plain} pagestyle is also simple, it just puts the -% page number at the bottom middle of the page. -% We call \cs{makepagestyle{plain}} and then adjust as required. -% \begin{macrocode} -\makepagestyle{plain} - \makeevenfoot{plain}{}{\thepage}{} - \makeoddfoot{plain}{}{\thepage}{} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\nouppercaseheads} -% \begin{macro}{\uppercaseheads} -% \begin{macro}{\memUChead} -% Spurred by Lars Madsen's \Lpack{memexsupp} v0.05 package here is -% a way of switching uppercasing in the headings pagestyle. -% \changes{v4.9}{2007/09/07}{Added uppercase switches for headings pagestyle} -% \begin{macrocode} -\newcommand*{\nouppercaseheads}{% - \let\memUChead\relax} -\newcommand*{\uppercaseheads}{% - \let\memUChead\MakeUppercase} -\uppercaseheads - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\ps@headings} -% The \pstyle{headings} pagestyle behaves differently for -% twosided and onesided printing. This is a rewrite of the -% standard style. -% \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@headings}} -% \changes{v4.9}{2007/09/07}{Removed \cs{@mkboth} as is never used} -% \changes{v4.9}{2007/09/07}{Replaced \cs{MakeUppercase} by \cs{memUChead} in headings pagestyle} -% \changes{v4.9}{2007/11/11}{For twosided docs set both marks for ToC, etc (suggested by Lars Madsen)} -% \begin{macrocode} -\if@twoside -% \end{macrocode} -% The footer is empty and the header contains the page number and -% one of the marks. -% \begin{macrocode} - \makepagestyle{headings} - \makepsmarks{headings}{% -%%% \let\@mkboth\markboth - \def\chaptermark##1{% - \markboth{\memUChead{% - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \@chapapp\ \thechapter. \ % - \fi - \fi - ##1}}{}}% - \def\tocmark{\markboth{\memUChead{\contentsname}}{\memUChead{\contentsname}}}% - \def\lofmark{\markboth{\memUChead{\listfigurename}}{\memUChead{\listfigurename}}}% - \def\lotmark{\markboth{\memUChead{\listtablename}}{\memUChead{\listtablename}}}% - \def\bibmark{\markboth{\memUChead{\bibname}}{\memUChead{\bibname}}}% - \def\indexmark{\markboth{\memUChead{\indexname}}{\memUChead{\indexname}}}% - \def\sectionmark##1{% - \markright{\memUChead{% - \ifnum \c@secnumdepth > \z@ - \thesection. \ % - \fi - ##1}}}% - }% - \makeevenhead{headings}{\thepage}{}{\slshape\leftmark} - \makeoddhead{headings}{\slshape\rightmark}{}{\thepage} -\else -% \end{macrocode} -% For one sided printing even and odd pages are treated the same, -% so no need to bother with the evenhead, and -% just the \cs{rightmark} is used. -% \begin{macrocode} - \makepagestyle{headings} - \makepsmarks{headings}{% -%%% \let\@mkboth\markboth - \def\chaptermark##1{% - \markright{\memUChead{% - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \@chapapp\ \thechapter. \ % - \fi - \fi - ##1}}}% - \def\tocmark{\markright{\memUChead{\contentsname}}}% - \def\lofmark{\markright{\memUChead{\listfigurename}}}% - \def\lotmark{\markright{\memUChead{\listtablename}}}% - \def\bibmark{\markright{\memUChead{\bibname}}}% - \def\indexmark{\markright{\memUChead{\indexname}}}% - } - \makeoddhead{headings}{\slshape\rightmark}{}{\thepage} -\fi - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\ps@myheadings} -% The \pstyle{myheadings} page style is simpler because the user -% has to specify the contents using \cs{markboth} and \cs{markright} -% commands. This is the definition used in the standard classes. -% \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@myheadings}} -% \begin{verbatim}} -% \newcommand{\ps@myheadings}{% -% \let\@oddfoot\@empty\let\@evenfoot\@empty -% \def\@evenhead{\thepage\hfil{\slshape\leftmark}}% -% \def\@oddhead{{\slshape\rightmark}\hfil\thepage}% -% \let\@mkboth\@gobbletwo -% \let\chaptermark\@gobble -% \let\sectionmark\@gobble -% } -% \end{verbatim} -% Translating that into our terms we get: -% \changes{v1.0}{2001/11/15}{Changed the code for creating the myheadings pagestyle} -% \changes{v1.4}{2003/11/22}{Further change to myheadings pagestyle code} -% \begin{macrocode} -\makepagestyle{myheadings} - \makepsmarks{myheadings}{% -%%% \let\@mkboth\@gobbletwo - \let\chaptermark\@gobble - \let\sectionmark\@gobble - \def\tocmark{}% - \def\lofmark{}% - \def\lotmark{}% - \def\bibmark{}% - \def\indexmark{}% - } - \makeevenhead{myheadings}{\thepage}{}{\slshape\leftmark} - \makeoddhead{myheadings}{\slshape\rightmark}{}{\thepage} - -% \end{macrocode} -% (Kai von Fintel (\texttt{fintel@mit.edu}) emailed me on 2003/02/24 -% saying that the original \verb?\let\tocmark\@gobble? in the myheadings -% pagestyle did nasty things -% to the ToC, etc. Now using \verb?\def\tocmark{}?.) -% \end{macro} -% -% \begin{macro}{\ps@chapter} -% \begin{macro}{\ps@part} -% \begin{macro}{\ps@cleared} -% The standard classes use the \pstyle{plain} pagestyle for the first page -% of a chapter. This class uses the \pstyle{chapter} instead, which is -% aliased to \pstyle{plain}. Similarly for parts. -% Further, \cs{cleardoublepage} uses whatever -% pagestyle is in effect for the empty verso page. I find that this -% looks odd if the header contains a chapter name. This class uses -% the \pstyle{cleared} pagestyle in this case. I have aliased this -% to \pstyle{empty}; the \pstyle{plain} would be another reasonable choice. -% \begin{macrocode} -\aliaspagestyle{chapter}{plain} -\aliaspagestyle{part}{plain} -\aliaspagestyle{cleared}{empty} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\cleardoublepage} -% A slight adjustment to the kernel definition to set a pagestyle. -% \begin{macrocode} -\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else - \hbox{}\thispagestyle{cleared}% - \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi} - -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\ps@ruled} -% Partly to show how it is done, the class provides a \pstyle{ruled} pagestyle. -% In this style the headers and footers are the same width as the textblock, -% there is a rule under the header, page numbers are set in the footers -% at the outside of the page. Even page headers have the chapter number -% and title at the left, and odd page headers have the section title -% at the right. -% -% Start by making the (empty) \pstyle{ruled} pagestyle. -% \begin{macrocode} -\makepagestyle{ruled} -% \end{macrocode} -% There is no need to change the default width (which is the \cs{textwidth}), -% nor the default positions (centered), -% nor to make the footrule visible. We do, though, have to put the page -% numbers into the footers. -% \begin{macrocode} -\makeevenfoot{ruled}{\thepage}{}{} -\makeoddfoot{ruled}{}{}{\thepage} -% \end{macrocode} -% Make the header rule visible and equal to the \cs{textwidth}. -% \begin{macrocode} -\makeheadrule{ruled}{\textwidth}{\normalrulethickness} -% \end{macrocode} -% -% \begin{macro}{\@ruledmarks} -% We have to make sure that the \cs{chapter} and \cs{section} commands make -% the appropriate marks for use in the headers. We use the hook for this. -% Note that contrary to normal \LaTeX{} practice, the titles are not -% automatically upper-cased. The marks for the tocbibinds also need adjusting. -% \changes{v1.1}{2002/03/10}{Changed \cs{@ruledmarks} to cater for tocbibind} -% \begin{macrocode} -\renewcommand*{\@ruledmarks}{% -%%% \let\@mkboth\markboth - \def\chaptermark##1{% - \markboth{% - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \thechapter. \ % - \fi - \fi - ##1}{}} - \def\sectionmark##1{\markright{##1}}% - \def\tocmark{\markboth{\contentsname}{}}% - \def\lofmark{\markboth{\listfigurename}{}}% - \def\lotmark{\markboth{\listtablename}{}}% - \def\bibmark{\markboth{\bibname}{}}% - \def\indexmark{\markboth{\indexname}{}}% -} -\makepsmarks{ruled}{\@ruledmarks} -% \end{macrocode} -% \end{macro} -% -% We can now define the even page header which is to have the chapter title -% at the left. As the chapter mark did no upper-casing we will print it -% using small caps, but just use the normal font for section title on -% the odd page header. -% \begin{macrocode} -\makeevenhead{ruled}{\scshape\leftmark}{}{} -\makeoddhead{ruled}{}{}{\rightmark} - -% \end{macrocode} -% \end{macro} -% This is all that we need to do for the \pstyle{ruled} pagestyle. -% -% \begin{macro}{\ps@Ruled} -% Also define a \pstyle{Ruled} pagestyle similar to \pstyle{ruled} except that the -% headers and footers are 10\% wider than the textblock, sticking out -% into the fore edge. -% \begin{macrocode} -\makepagestyle{Ruled} -\makerunningwidth{Ruled}{1.1\textwidth} -\makeheadposition{Ruled}{flushright}{flushleft}{flushright}{flushleft} -\makeevenfoot{Ruled}{\thepage}{}{} -\makeoddfoot{Ruled}{}{}{\thepage} -\makeheadrule{Ruled}{1.1\textwidth}{\normalrulethickness} -\makepsmarks{Ruled}{\@ruledmarks} -\makeevenhead{Ruled}{\scshape\leftmark}{}{} -\makeoddhead{Ruled}{}{}{\rightmark} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\headwidth} -% \begin{macro}{\ps@companion} -% A \pstyle{companion} pagestyle like the one in the -% \textit{\LaTeX{} Companion} series. -% We need the \cs{headwidth} length for this. -% \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@companion}} -% \begin{macrocode} -%%%%\newlength{\headwidth} % don't use in the patch file - -\makepagestyle{companion} -\setlength{\headwidth}{\textwidth} - \addtolength{\headwidth}{\marginparsep} - \addtolength{\headwidth}{\marginparwidth} -\makerunningwidth{companion}{\headwidth} -\makeheadrule{companion}{\headwidth}{\normalrulethickness} -\makeheadposition{companion}{flushright}{flushleft}{}{} -\makepsmarks{companion}{% -%%% \let\@mkboth\markboth - \def\chaptermark##1{\markboth{##1}{##1}} % left mark & right marks - \def\sectionmark##1{\markright{% - \ifnum \c@secnumdepth>\z@ - \thesection. \ % - \fi - ##1}} - \def\tocmark{\markboth{\contentsname}{\contentsname}}% - \def\lofmark{\markboth{\listfigurename}{\listfigurename}}% - \def\lotmark{\markboth{\listtablename}{\listtablename}}% - \def\bibmark{\markboth{\bibname}{\bibname}}% - \def\indexmark{\markboth{\indexname}{\indexname}}% -} -\makeevenhead{companion}{\normalfont\bfseries\thepage}{}% - {\normalfont\bfseries\leftmark} -\makeoddhead{companion}{\normalfont\bfseries\rightmark}{}% - {\normalfont\bfseries\thepage} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -%% \subsection{Theindex} -% -% On 2006/12/05 Lars Madsen asked for an `indextitlepagestyle' (he wanted -% to put a hyperlink bar with links to each letter startpoint into the -% header). -% \begin{macro}{\ps@indextitlepagestyle} -% Here is half of it, the other half is in the definition of \cs{theindex}. -% \begin{macrocode} -\aliaspagestyle{indextitlepagestyle}{chapter} - -% \end{macrocode} -% \end{macro} -% -% \subsection{New Listof...} -% -% Ignacio Fern\'{a}ndez Galv\'{a}n (aka Jellby) noted a problem with -% changing chapter styles and the ToC heading -% (ctt, \textit{Inconsistency in memoir}, 2006/11/04). Unfortunately the -% fix involves repeating much prior code. Essentially, I got the -% setting of \cs{parskip} equal to \cs{cftparskip} in the wrong place. -% The following has been copied from \file{memoir.dtx} and appropriate -% changes made. -% -% \begin{macro}{\newlistof} -% \cs{newlistof}\marg{listofcmmd}\marg{ext}\marg{listofname} -% creates the command \cs{listofcmmd} to typeset a new List of, where the -% external file has the extension \file{.ext} and the heading title is -% \meta{listofname}. The code for this is a heavily modified part -% of the \Lpack{tocloft} package. -% -% \begin{macrocode} -%%%%%%% Fix for inconsistent chapter styles and ToC, etc style. -\renewcommand*{\newlistof}[3]{% -% \end{macrocode} -% -% In the following, \verb?X? stands for the value of \meta{listofcmmd} and -% \verb?Z? stands for the value of \meta{ext}. -% -% \begin{macro}{\ext@Z} -% \begin{macro}{\Zdepth} -% The file extension and listing depth, which is set to level~1. -% \begin{macrocode} - \@namedef{ext@#2}{#2} - \@ifundefined{c@#2depth}{\newcounter{#2depth}}{} - \setcounter{#2depth}{1} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\Zmark} -% The heading marks for the listing. -% \changes{v1.1}{2002/03/10}{Changed \cs{@mkboth} to \cs{markboth} in \cs{Zmark}} -% \begin{macrocode} - \@namedef{#2mark}{\markboth{#3}{#3}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\X} -% Typeset the listing title and entries, -% with both a normal and starred version. -% \begin{macrocode} - \@namedef{#1}{\@ifstar{\@nameuse{@star#2}}{\@nameuse{@plain#2}}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@starZ} -% The starred listof version -% \begin{macrocode} - \@namedef{@star#2}{% - \ensureonecol - \par - \begingroup -%%%%%%% \parindent\z@ \parskip\cftparskip - \@nameuse{@#2maketitle} - \@starttoc{#2}% - \endgroup - \restorefromonecol} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@plainZ} -% The unstarred listof version -% \begin{macrocode} - \@namedef{@plain#2}{% - \ensureonecol - \par - \begingroup -%%%%%%% \parindent\z@ \parskip\cftparskip - \@nameuse{@#2maketitle} - \phantomsection - \addcontentsline{toc}{chapter}{#3} -\parskip\cftparskip - \@starttoc{#2}% - \endgroup - \restorefromonecol} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@Zmaketitle} -% This macro typesets the title. -% \changes{v1.3}{2002/10/10}{Added \cs{printZnonum} to \cs{@Zmaketitle}} -% \begin{macrocode} - \@namedef{@#2maketitle}{% - \@nameuse{#2headstart} - {\parindent\z@ -%%%%%%%% \parskip\cftparskip - \interlinepenalty\@M -% \end{macrocode} -% \changes{v1.3}{2002/11/14}{Added printZnonum to \cs{newlistof}} -% \begin{macrocode} - \@nameuse{print#2nonum}% - \@nameuse{print#2title}{#3}% - \@nameuse{#2mark}% - \thispagestyle{chapter}% - \@nameuse{after#2title} - } - \@afterheading} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\Zheadstart} -% \begin{macro}{\afterZtitle} -% The macros \cs{Zheadstart} and \cs{afterZtitle} -% control what goes before and after the title. They -% default to the corresponding macros for chapters. -% \begin{macrocode} - \@namedef{#2headstart}{\chapterheadstart} - \@namedef{after#2title}{\afterchaptertitle} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\printZnonum} -% This typesets something before the title and defaults -% to \cs{printchapternonum}. -% \changes{v1.3}{2002/10/10}{Added \cs{printZnonum} macro} -% \begin{macrocode} - \@namedef{print#2nonum}{\printchapternonum} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\printZtitle} -% The title is typeset by the macro \cs{printZtitle}\marg{title} -% which defaults to \cs{printchaptertitle}. -% \begin{macrocode} - \@namedef{print#2title}##1{\printchaptertitle{##1}} -% \end{macrocode} -% \end{macro} -% -% This is the end of the definition of \cs{newlistof}. -% \begin{macrocode} -} % end \newlistof - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@starttoc} -% A list of macro calls \cs{@starttoc} to read the appropriate file. I have -% changed the kernel definition to allow a file to be read multiple times -% by delaying killing the file until the end of the document. -% \changes{v1.3}{2002/11/14}{Changed \cs{@starttoc}} -% \begin{macrocode} -\renewcommand*{\@starttoc}[1]{% - \begingroup\makeatletter - \@input{\jobname.#1}% - \if@filesw - \AtEndDocument{% - \expandafter\newwrite\csname tf@#1\endcsname - \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax - }% - \fi - \@nobreakfalse - \endgroup} - -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -\newlistof{tableofcontents}{toc}{\contentsname} -\newlistof{listoffigures}{lof}{\listfigurename} -\newlistof{listofables}{lot}{\listtablename} -%%% remove subfigure support -\renewcommand*{\@cftl@subfigtab}{} - -% \end{macrocode} -% -% \subsection{Chapter styles} -% -% I have added some further chapter styles. These have either been sent to me, -% published on CTT or are my own invention. -% -% \begin{macro}{\chs@default} -% A reimplementation of the default chapter style which sets everything. -% \begin{macrocode} -\makechapterstyle{default}{% - \setlength{\beforechapskip}{50pt} - \def\chapterheadstart{\vspace*{\beforechapskip}} - \def\chapnamefont{\normalfont\huge\bfseries} - \def\printchaptername{\chapnamefont \@chapapp} - \def\chapternamenum{\space} - \def\chapnumfont{\normalfont\huge\bfseries} - \def\printchapternum{\chapnumfont \thechapter} - \setlength{\midchapskip}{20pt} - \def\afterchapternum{\par\nobreak\vskip \midchapskip} - \def\printchapternonum{} - \def\chaptitlefont{\normalfont\Huge\bfseries} - \def\printchaptertitle##1{\chaptitlefont ##1} - \setlength{\afterchapskip}{40pt} - \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@bianchi} -% Posted to CTT on 2003/12/09, \textit{New chapter style: chapter vs chapter*} -% by Stefano Bianchi. -% \begin{macrocode} -%% Stefano Bianchi, ctt 2003/12/09 `New chapter style: chapter vs chapter*' -\makechapterstyle{bianchi}{% - \chapterstyle{default} - \renewcommand*{\chapnamefont}{\normalfont\Large\sffamily\itshape} - \renewcommand*{\chapnumfont}{\normalfont\huge} - \renewcommand*{\printchaptername}{% - \chapnamefont\centering\@chapapp} - \renewcommand*{\printchapternum}{\chapnumfont \textit{\thechapter}} - \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily} - \renewcommand*{\printchaptertitle}[1]{% - \hrule\vskip\onelineskip \centering \chaptitlefont\textbf{##1}\par} - \renewcommand*{\afterchaptertitle}{\vskip\onelineskip \hrule\vskip - \afterchapskip} - \renewcommand*{\printchapternonum}{% - \vphantom{\chapnumfont \textit{9}}\afterchapternum}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@bringhurst} -% My bringhurst style. -% \begin{macrocode} -\makechapterstyle{bringhurst}{% - \chapterstyle{default} - \renewcommand*{\chapterheadstart}{} - \renewcommand*{\printchaptername}{} - \renewcommand*{\chapternamenum}{} - \renewcommand*{\printchapternum}{} - \renewcommand*{\afterchapternum}{} - \renewcommand*{\printchaptertitle}[1]{% - \raggedright\Large\scshape\MakeLowercase{##1}} - \renewcommand*{\afterchaptertitle}{% - \vskip\onelineskip \hrule\vskip\onelineskip}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@brotherton} -% An extremely simple chapterstyle created by William Adams for Mike -% Brotherton's science fiction novel \textit{Star Dragon}, posted to CTT -% 2006/12/09, \textit{An example of a novel?}. -% \begin{macrocode} -\makechapterstyle{brotherton}{% - \chapterstyle{default} - \renewcommand*{\printchapternum}{\chapnumfont - \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@chappell} -% My Chappell style -% \begin{macrocode} -\makechapterstyle{chappell}{% - \chapterstyle{default} - \setlength{\beforechapskip}{0pt} - \renewcommand*{\chapnamefont}{\large\centering} - \renewcommand*{\chapnumfont}{\large} - \renewcommand*{\printchapternonum}{% - \vphantom{\printchaptername \chapnumfont 1} - \afterchapternum - \vskip \onelineskip \vskip -\topskip} - \renewcommand*{\chaptitlefont}{\Large\itshape} - \renewcommand*{\printchaptertitle}[1]{% - \hrule\vskip\onelineskip \centering\chaptitlefont ##1}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@culver} -% By me in an answer to Christopher Culver on CTT, -% \textit{"Biblical" formatting, how?} on 2004/03/29,where I called it -% the `biblical' style. -% \changes{v4.9}{2007/11/14}{Changed culver chapterstyle to match description} -% \begin{macrocode} -\makechapterstyle{culver}{% - \chapterstyle{default} - \chapterstyle{article}% - \renewcommand*{\thechapter}{\Roman{chapter}} - \renewcommand*{\printchapternum}{% center number/title - \centering\chapnumfont \thechapter\space\space}% - \renewcommand*{\printchapternonum}{\centering} - \renewcommand*{\clearforchapter}{}% no new page - \aliaspagestyle{chapter}{headings}% no special pagestyle -} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@dash} -% A very simple style of mine but I couldn't think of a good name for it. -% \begin{macrocode} -\makechapterstyle{dash}{% - \chapterstyle{default} - \setlength{\beforechapskip}{5\onelineskip} - \renewcommand*{\printchaptername}{} - \renewcommand*{\chapternamenum}{} - \renewcommand*{\chapnumfont}{\normalfont\large} - \settoheight{\midchapskip}{\chapnumfont 1} - \renewcommand*{\printchapternum}{\centering \chapnumfont - \rule[0.5\midchapskip]{1em}{0.4pt} \thechapter\ - \rule[0.5\midchapskip]{1em}{0.4pt}} - \renewcommand*{\afterchapternum}{\par\nobreak\vskip 0.5\onelineskip} - \renewcommand*{\printchapternonum}{\centering - \vphantom{\chapnumfont 1}\afterchapternum} - \renewcommand*{\chaptitlefont}{\normalfont\Large} - \renewcommand*{\printchaptertitle}[1]{\centering \chaptitlefont ##1} - \setlength{\afterchapskip}{2.5\onelineskip}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@demo2} -% My second version of the demo chapterstyle. -% \begin{macrocode} -\makechapterstyle{demo2}{% - \chapterstyle{default} - \renewcommand*{\printchaptername}{\centering} - \renewcommand*{\printchapternum}{\chapnumfont - \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi} - \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily} - \renewcommand*{\printchaptertitle}[1]{% - \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1} - \renewcommand*{\afterchaptertitle}{% - \vskip\onelineskip \hrule\vskip \afterchapskip} - \setlength{\beforechapskip}{3\baselineskip} - \renewcommand*{\printchapternonum}{% - \vphantom{\chapnumfont One} - \afterchapternum% - \vskip\topskip} - \setlength{\beforechapskip}{2\onelineskip}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@demo3} -% My third version of the demo chapterstyle. -% \changes{v4.9}{2007/11/14}{Added demo3 chapterstyle} -% \begin{macrocode} -\makechapterstyle{demo3}{% - \chapterstyle{default} - \renewcommand*{\printchaptername}{\centering} - \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape} - \renewcommand*{\printchapternum}{\chapnumfont - \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi} - \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily} - \renewcommand*{\printchaptertitle}[1]{% - \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1} - \renewcommand*{\afterchaptertitle}{% - \vskip\onelineskip \hrule\vskip \afterchapskip} - \setlength{\beforechapskip}{0pt} - \setlength{\midchapskip}{2\onelineskip} - \setlength{\afterchapskip}{2\onelineskip} - \renewcommand*{\printchapternonum}{% - \vphantom{\chapnumfont One} - \afterchapternum% - \vskip\topskip}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@ell} -% Another of my styles which I'll probably use for my next book. -% \begin{macrocode} -\makechapterstyle{ell}{% - \chapterstyle{default} - \renewcommand*{\chapnumfont}{\normalfont\HUGE\sffamily} - \renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily} - \settowidth{\chapindent}{\chapnumfont 111} - \renewcommand*{\chapterheadstart}{\begingroup - \vspace*{\beforechapskip}% - \begin{adjustwidth}{}{-\chapindent}% - \hrulefill - \smash{\rule{0.4pt}{15mm}} - \end{adjustwidth}\endgroup} - \renewcommand*{\printchaptername}{} - \renewcommand*{\chapternamenum}{} - \renewcommand*{\printchapternum}{% - \begin{adjustwidth}{}{-\chapindent} - \hfill - \raisebox{10mm}[0pt][0pt]{\chapnumfont \thechapter}% - \hspace*{1em} - \end{adjustwidth}\vspace*{-3.0\onelineskip}} - \renewcommand*{\printchaptertitle}[1]{% - \vskip\onelineskip - \raggedleft {\chaptitlefont ##1}\par\nobreak}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@ger} -% Posted to CTT on 2002/04/12 \textit{Fancy Headings, Chapter Headings} by Gerardo Garcia. -% \changes{v4.7}{2006/12/23}{Renamed the `Ger' chapterstyle to `ger'} -% \begin{macrocode} -%% Gerardo Garcia, ctt 2002/04/12, `Fancy Headings, Chapter Headings -\makechapterstyle{ger}{% - \chapterstyle{default} - \renewcommand*{\chapterheadstart}{\vspace*{\beforechapskip} - \mbox{}\\\mbox{}\rule[0pt]{\textwidth}{0.4pt}\par} - \setlength{\midchapskip}{20pt} - \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1 - \\\mbox{}\rule[5pt]{\textwidth}{0.4pt}}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@lyhne} -% Posted to CTT 2006/02/09 \textit{Glossary}, by Anders Lyhne. -% It requires the \Lpack{graphicx} package. I have modified it to remove the -% new length and adjusted the unnumbered appearance. -% \begin{macrocode} -\makechapterstyle{lyhne}{% needs graphicx package - \chapterstyle{default} - \setlength{\beforechapskip}{1.5cm} - \setlength{\afterchapskip}{1cm} - \setlength{\midchapskip}{2cm} - \renewcommand*{\chapnamefont}{\normalfont\normalsize\scshape\raggedleft} - \renewcommand*{\chaptitlefont}{\normalfont\normalsize\bfseries\sffamily\raggedleft} - \renewcommand*{\chapternamenum}{} - \renewcommand*{\printchapternum}{\makebox[0pt][l]{\hspace{0.2em}% - \resizebox{!}{2ex}{\chapnamefont\bfseries\sffamily\thechapter}}} - \renewcommand*{\afterchapternum}{\par\hspace{1.5cm}\hrule\vspace{0.2cm}} - \renewcommand*{\printchapternonum}{\vphantom{\chapnamefont 1}\afterchapternum} - \renewcommand*{\afterchaptertitle}{\vskip 0.2cm - \hrule\vskip\afterchapskip}} - -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\chs@madsen} -% Posted to CTT on 2003/12/09, \textit{New chapter style: chapter vs chapter*} -% by Lars Madsen. -% This requires the \Lpack{graphicx} package, -% \changes{v4.7}{2006/12/23}{Added \cs{raggedleft} to \cs{chaptitlefont} in the madsen chapterstyle} -% \begin{macrocode} -%% posted to ctt, December 2003 -%%%% \usepackage{graphicx} -\makechapterstyle{madsen}{% - \chapterstyle{default} - \renewcommand*{\chapnamefont}{% - \normalfont\Large\scshape\raggedleft} - \renewcommand*{\chaptitlefont}{% - \normalfont\Huge\bfseries\sffamily\raggedleft} - \renewcommand*{\chapternamenum}{} - \renewcommand*{\printchapternum}{% - \makebox[0pt][l]{\hspace{0.4em} - \resizebox{!}{4ex}{% - \chapnamefont\bfseries\sffamily\thechapter} - }% - }% - \renewcommand*{\afterchapternum}{% - \par\hspace{1.5cm}\hrule\vskip\midchapskip}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\colorchapnum} -% \begin{macro}{\colorchaptitle} -% \begin{macro}{\chs@pedersen} -% Posted to CTT 2006/01/31, \textit{Chapter style}, by Troels Pedersen. -% It requires the \Lpack{graphicx} package and possibly the \Lpack{color} -% package. I have used a \cs{sidebar} instead of the original \cs{marginpar}, -% and eliminated a new length. The original color specification, the same for -% the title and nunmber, can now be set via \cs{colorchapnum} and -% \cs{colorchaptitle}. -% \begin{macrocode} -\newcommand*{\colorchapnum}{} -\newcommand*{\colorchaptitle}{} -\makechapterstyle{pedersen}{% - \chapterstyle{default} - \setlength{\beforechapskip}{-20pt} - \setlength{\afterchapskip}{10pt} - \renewcommand*{\chapnamefont}{\normalfont\LARGE\itshape} - \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape\colorchapnum} - \renewcommand*{\chaptitlefont}{\normalfont\huge\itshape\colorchaptitle} - \renewcommand*{\afterchapternum}{} - \renewcommand*{\printchaptername}{} - \setlength{\midchapskip}{20mm}% was \numberheight - \renewcommand*{\chapternamenum}{} - \renewcommand*{\printchapternum}{% - \sidebar{\raisebox{0pt}[0pt][0pt]{\makebox[0pt][l]{% - \resizebox{!}{\midchapskip}{\chapnumfont\thechapter}}}}} - \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1} -} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\chs@southall} -% Style provided by Thomas Dye. I have modified the original to eliminate -% the use of new lengths. -% \begin{macrocode} -%% Thomas Dye's southall chapter style -\makechapterstyle{southall}{% - \chapterstyle{default} - \setlength{\afterchapskip}{5\baselineskip} - \setlength{\beforechapskip}{36pt}% \headindent - \setlength{\midchapskip}{\textwidth}% \rightblock - \addtolength{\midchapskip}{-\beforechapskip} - \renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}} - \renewcommand*{\chaptitlefont}{\huge\rmfamily\raggedright} - \renewcommand*{\chapnumfont}{\chaptitlefont} - \renewcommand*{\printchaptername}{} - \renewcommand*{\chapternamenum}{} - \renewcommand*{\afterchapternum}{} - \renewcommand*{\printchapternum}{% - \begin{minipage}[t][\baselineskip][b]{\beforechapskip} - {\vspace{0pt}\chapnumfont%%%\figureversion{lining} - \thechapter} - \end{minipage}} - \renewcommand*{\printchaptertitle}[1]{% - \hfill\begin{minipage}[t]{\midchapskip} - {\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}} - \renewcommand*{\afterchaptertitle}{% - \par\vspace{\baselineskip}% - \hrulefill \par\nobreak\noindent \vskip \afterchapskip}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@thatcher} -% Original posted to CTT on 2006/01/18 by Scott Thatcher, -% \textit{memoir: chapter headings capitalize math symbols}. I have modified -% it to cater for multiline titles, appendices, and unnumbered chapters. -% \begin{macrocode} -\makechapterstyle{thatcher}{% - \chapterstyle{default} - \renewcommand*{\chapterheadstart}{} - \renewcommand*{\printchaptername}{% - \centerline{\chapnumfont{\@chapapp\ \thechapter}}} - \renewcommand*{\chapternamenum}{} - \renewcommand*{\chapnumfont}{\normalfont\scshape\MakeLowercase} - \renewcommand*{\printchapternum}{} - \renewcommand*{\afterchapternum}{% - \par\centerline{\parbox{0.5in}{\hrulefill}}\par} - \renewcommand*{\printchapternonum}{% - \vphantom{\chapnumfont \@chapapp 1}\par - \parbox{0.5in}{}\par} - \renewcommand*{\chaptitlefont}{\normalfont\large} - \renewcommand*{\printchaptertitle}[1]{% - \centering \chaptitlefont\MakeUppercase{##1}}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@veelo} -% This, from Baastian Veelo, has been noted in the documentation for -% quite a time. -% I have modified the original to eliminate the need for extra lengths. -% \begin{macrocode} -%% A new chapter style, that suits well for trimmed documents. -%% We are scaling the chapter number, which most DVI viewers -%% will not display accurately. It requires the graphicx package. -%%%% \usepackage{graphicx} -\makechapterstyle{veelo}{% - \chapterstyle{default} - \setlength{\afterchapskip}{40pt} - \renewcommand*{\chapterheadstart}{\vspace*{40pt}} - \renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt} - \renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright} - \renewcommand*{\chapnumfont}{\normalfont\HUGE} - \renewcommand*{\chaptitlefont}{\normalfont\HUGE\bfseries\flushright} - \renewcommand*{\printchaptername}{% - \chapnamefont\MakeUppercase{\@chapapp}} - \renewcommand*{\chapternamenum}{} -% \setlength{\numberheight}{18mm} -% \setlength{\barlength}{\paperwidth} -% \addtolength{\barlength}{-\textwidth} -% \addtolength{\barlength}{-\spinemargin} - \setlength{\beforechapskip}{18mm}% \numberheight - \setlength{\midchapskip}{\paperwidth}% \barlength - \addtolength{\midchapskip}{-\textwidth} - \addtolength{\midchapskip}{-\spinemargin} - \renewcommand*{\printchapternum}{% - \makebox[0pt][l]{% - \hspace{.8em}% - \resizebox{!}{\beforechapskip}{\chapnumfont \thechapter}% - \hspace{.8em}% - \rule{\midchapskip}{\beforechapskip}% - }% - }% - \makeoddfoot{plain}{}{}{\thepage}} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\chs@verville} -% I posted the original to CTT on 2005/01/18, \textit{Headers and special -% formatting of sections}, in answer to a question by -% Guy Verville. This version caters for unnumbered chapters. -% \begin{macrocode} -\makechapterstyle{verville}{% - \chapterstyle{default} - \setlength{\beforechapskip}{0pt} - \renewcommand*{\printchaptername}{} - \renewcommand*{\printchapternum}{% - \hrule \vskip 0.5\onelineskip - \Huge \centering \thechapter.\ } - \renewcommand*{\printchapternonum}{% - \hrule \vskip 0.5\onelineskip - \Huge \centering} - \renewcommand*{\afterchapternum}{} - \setlength{\midchapskip}{0pt} - \renewcommand*{\printchaptertitle}[1]{% - ##1 \par - \vskip 0.5\onelineskip - \hrule}} - -% \end{macrocode} -% \end{macro} -% -% -% \section{Mempatch version 4.7} -% -% \begin{macrocode} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%% Version 4.7 (2006/12/23 and later) - -% \end{macrocode} -% -% \subsection{Epigraphs} -% -% Erik Quaeghebeur (CTT, 2006/12/21, \textit{[memoir:epigraph] dissapearing initial L/l -% (minimal example)}) discovered that an initial `l' was deleted when -% \texttt{flushleftright} was used for \cs{epigraphtextposition}. This was caused -% by `fil' being the last token in the definition. -% -% \begin{macro}{flushleftright} -% \changes{v4.7}{2006/12/23}{Changed \cs{flushleftright} and \cs{centerlastline} -% so that `fil' was not the last token} -% \begin{macrocode} -\renewcommand*{\flushleftright}{% - \leftskip\z@ \rightskip\z@ - \parfillskip\@flushglue} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{centerlastline} -% \begin{macrocode} -\renewcommand*{\centerlastline}{% - \parfillskip=\z@ plus 2fil - \rightskip=\z@ plus -1fil - \leftskip\@flushglue} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{@epitext} -% \changes{v4.7}{2006/12/23}{Added \cs{par} to \cs{@epitext} and \cs{@episource}} -% \begin{macrocode} -\renewcommand{\@epitext}[1]{% - \begin{minipage}{\epigraphwidth}\begin{\textflush} #1\par - \ifdim\epigraphrule>\z@ \@epirule \else \vspace*{1ex}\fi - \end{\textflush}\end{minipage}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{@episource} -% \begin{macrocode} -\renewcommand{\@episource}[1]{% - \begin{minipage}{\epigraphwidth}\begin{\sourceflush} #1\par - \end{\sourceflush}\end{minipage}} - -% \end{macrocode} -% \end{macro} -% -% \section{Mempatch version 4.8} -% -% \begin{macrocode} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%% Version 4.8 (2007/01/22 and later) - -% \end{macrocode} -% -% \subsection{Abstracts} -% -% There are various problems with the code for abstracts, partly because -% it was too early in the class file (it should have come \emph{after} -% the code for lists). -% \changes{v4.8}{2007/01/22}{Several changes to the code for abstracts} -% -% \begin{macro}{\abscolnamefont} -% \begin{macro}{\abscoltextfont} -% Fonts for an abstract in a two column document where the abstract -% is part of a column. Also the default \cs{absrightmargin}. -% \changes{v4.8}{2007/01/22}{Added \cs{abscolnamefont} and \cs{abscoltextfont}} -% \begin{macrocode} -%%%% \abscolnamefont and \abscoltextfont are the fonts when an abstract -%%%% is like a section in a two column document. -\newcommand*{\abscolnamefont}{\normalfont\Large\bfseries} -\newcommand*{\abscoltextfont}{\normalfont} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\absleftindent} -% \begin{macro}{\abs@leftindent} -% \begin{macro}{\absrightindent} -% Set these lengths \emph{after} \cs{leftmargin} and \cs{rightmargin} have -% been set. -% \begin{macrocode} -\absleftindent=\leftmargin -\abs@leftindent=\leftmargin -\absrightindent=\leftmargin - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% -% \begin{macro}{\setup@bstract} -% The \cs{setup@bstract} macro set \cs{absrightindent} and it shouldn't -% have done. -% \changes{v4.8}{2007/01/22}{Deleted always setting \cs{absrightindent} in \cs{setup@bstract}} -% \begin{macrocode} -\renewcommand*{\setup@bstract}{% - \abs@leftindent=\absleftindent - \if@twocolumn - \if@bsonecol - \else - \abs@leftindent=\z@ - \absrightindent=\z@ - \renewcommand*{\abstractnamefont}{\abscolnamefont} - \renewcommand*{\abstracttextfont}{\abscoltextfont} - \renewcommand*{\absnamepos}{flushleft} - \setlength{\abstitleskip}{-2ex} - \fi - \fi} - -% \end{macrocode} -% \end{macro} -% -% -% \section{Mempatch version 4.9} -% -% \begin{macrocode} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%% Version 4.9 (2007/05/02 and later) - -% \end{macrocode} -% -% \subsection{New floats} -% -% The original went badly wrong in assigning numbers to the different -% float types. (This was discovered by Flavian Lambert). -% -% \begin{macro}{\newfloat} -% \cs{newfloat}\oarg{within}\marg{fenv}\marg{ext}\marg{capname} -% creates the commands for a new float environment, \meta{fenv} (aka texttt{X}), -% using \meta{ext} (aka \texttt{Z}) as the -% file extension and \meta{capname} for the caption name. -% \changes{v4.9}{2007/05/02}{Changed setting of \cs{ftype@X} in \cs{newfloat}} -% \begin{macrocode} -\renewcommand{\newfloat}[4][\@empty]{% -% \end{macrocode} -% \begin{macro}{\ftype@X} -% Define the float type, set it to the float counter, and double -% the counter afterwards. -% \begin{macrocode} -%%%% \@namedef{ftype@#2}{\value{newflo@tctr}} -%%%% \addtocounter{newflo@tctr}{\value{newflo@tctr}} - \expandafter\edef\csname ftype@#2\endcsname{\the\c@newflo@tctr} - \advance\c@newflo@tctr \c@newflo@tctr -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\c@X} -% Create the counter for the caption, which must not have been previously -% defined. -% \begin{macrocode} - \@ifundefined{c@#2}{% counter is not defined - \ifx \@empty#1\relax - \newcounter{#2} - \else - \newcounter{#2}[#1] - \expandafter\edef\csname the#2\endcsname{% - \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}} - \fi}{} - \setcounter{#2}{0} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\ext@X} -% \begin{macro}{Zdepth} -% Define \cs{ext@X} for the file extension and set the new \verb?Zdepth? -% depth counter to 1. -% \begin{macrocode} - \@namedef{ext@#2}{#3} % file extension - \@ifundefined{c@#3depth}{\newcounter{#3depth}}{} - \setcounter{#3depth}{1} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% \begin{macro}{\fps@X} -% \begin{macro}{\fnum@X} -% \begin{macro}{\flegX} -% \begin{macro}{\flegtocX} -% \cs{fps@X} is the default float placement specification, \cs{fnum@X} -% typesets the caption name and number, and \cs{flegX} and \cs{flegtocX} -% are for named legends. -% \begin{macrocode} - \@namedef{fps@#2}{tbp} % position - \@namedef{fnum@#2}{#4~\@nameuse{the#2}} % caption naming - \@namedef{fleg#2}{#4} % legend naming - \@namedef{flegtoc#2}##1{} % legend name in ToC - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{environment}{X} -% \begin{environment}{X*} -% Finally define the new float environment, in both normal and starred -% forms. -% \begin{macrocode} - \newenvironment{#2}{\@float{#2}}{\end@float} - \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat} -% \end{macrocode} -% \end{environment} -% \end{environment} -% -% This ends the definition of \cs{newfloat}. -% \begin{macrocode} -} % end \newfloat - -% \end{macrocode} -% \end{macro} -% -% Now correct the settings for figures and tables, and prepare for -% user-defined floats. -% \begin{macrocode} -%%%% fix figure and table settings. -\def\ftype@figure{1} -\def\ftype@table{2} -\setcounter{newflo@tctr}{4} - -% \end{macrocode} -% -% \subsection{Boxed verbatims} -% -% Per Starb\"{a}ck had problems with the adjustwidth and boxedverbatim -% combination (see CTT \textit{Re: [memoir] adjustwidth + boxedverbatim} -% 2007/02/10) in which Lars Madsen came up with a suggestion to use -% \cs{linewidth}. -% -% \begin{macro}{\@@m@mline} -% \cs{@@line} is \verb?\def\@@line{\hb@xt@\hsize}? but I need one -% for \cs{linewidth}. -% \changes{v4.9}{2007/09/08}{Added \cs{@@m@mline}} -% \begin{macrocode} -\newcommand*{\@@m@mline}{\hb@xt@\linewidth} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\setupboxverb@line} -% \begin{macro}{\boxedverbatim} -% Use \cs{linewidth} instead of \cs{hsize} in these two macros. -% \changes{v4.9}{2007/09/08}{Used \cs{linewidth} instead of \cs{hsize} in -% \cs{setupboxverb@line} and \cs{boxedverbatim}} -% \begin{macrocode} -\renewcommand*{\setupboxverb@line}{% - \par - \ifbvperpage - \output=\expandafter{\expandafter\boxverb@split \the\output} - \fi - \def\verbatim@processline{\leavevmode - \b@vdocount% - \bvleftsidehook\vbox{\advance% \hsize-.8\p@% changed to \linewidth - \linewidth-.8\p@ - \@@line - {\b@vdooutside\strut\kern\bvboxsep% - \b@vdoinside% - \ift@bs - \tabverbatim@processline - \else - \the\verbatim@line - \fi - \hss}% - \kern\bvboxsep}\bvrightsidehook\par}} -\renewcommand*{\boxedverbatim}{\begingroup - \let\@@line\@@m@mline%%% new in v4.9 - \setupboxverb@line - \@verbatim - \setupbox@verb - \verbatim@start} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\bvtoprulehook} -% \begin{macro}{\bvendrulehook} -% \begin{macro}{\bvendofpage} -% \changes{v4.9}{2007/05/02}{Added \cs{linewidth} to boxedverbatim lines} -% \begin{macrocode} -\renewcommand*{\bvtoprulehook}{\hrule width\linewidth \nobreak \vskip -0.1pt} -\renewcommand*{\bvendrulehook}{\hrule width\linewidth} -\renewcommand*{\bvendofpage}{\hrule width\linewidth\kern-0.4pt} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \subsection{Chapter precis} -% -% Lars Madsen found that a chapter precis bumped into the chapter title -% when the article option was used. -% \changes{v4.9}{2007/08/18}{Changed chapter precis spacing} -% -% \begin{macro}{\prechapterprecisshift} -% (Negative) Space between chapter title and a precis. Need a different value -% for the article option. -% \begin{macrocode} -\newdimen\prechapterprecisshift -\ifartopt - \prechapterprecisshift=0pt -\else - \prechapterprecisshift=-2\baselineskip -\fi -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\precisfont} -% Font for precis typesetting. -% \begin{macrocode} -\newcommand*{\precisfont}{\normalfont\itshape} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\prechapterprecis} -% Set up for typesetting the precis text (in a quote environment). -% \begin{macrocode} -\renewcommand*{\prechapterprecis}{% - \vspace*{\prechapterprecisshift}% - \begin{quote}\precisfont} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Sidebars} -% -% Another problem raised its head --- floats and sidebars didn't work well -% together with the sidebar starting at odd vertical positions. As ever, -% Donald Arseneau came to the rescue (email correspondence May 2007). -% Even with the changes, there are still unsolved problems with full width -% floats on top of double columns. -% \changes{v4.9}{2007/08/18}{Another revamping of sidebar code} -% -% \begin{macro}{\m@mopsidebar} -% This might be used more than once in the following code. -% \begin{macrocode} -\newcommand*{\m@mopsidebar}{% - \ifvoid\sideins\else - \setbox\@outputbox \vbox{% - \sidecontents - \unvbox\@outputbox} - \fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\mem@makecol} -% In this version of \cs{mem@makecol} the sidebar insert is done -% after the other inserts and floats. -% \begin{macrocode} -\gdef\mem@makecol{% - \m@m@makecolintro - \ifvoid\footins - \setbox\@outputbox \box\@cclv - \else - \setbox\@outputbox \vbox{% - \boxmaxdepth\@maxdepth - \@tempdima\dp\@cclv - \unvbox\@cclv - \vskip-\@tempdima - \vskip \skip\footins - \color@begingroup - \normalcolor - \footnoterule - \unvbox\footins - \color@endgroup - } - \fi - \m@mdoextrafeet - \m@m@makecolfloats - \m@mopsidebar - \m@m@makecoltext - \global\maxdepth \@maxdepth} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\mem@makecolbf} -% This is a placeholder for attempts fo fix the doublefloat problem. -% \begin{macrocode} -\gdef\mem@makecolbf{% - \m@m@makecolintro - \setbox\@outputbox \box\@cclv - \m@m@makecolfloats - \m@mopsidebar - \ifvoid\footins - \else - \setbox\@outputbox \vbox{% - \boxmaxdepth\@maxdepth - \unvbox\@outputbox - \vskip \skip\footins - \color@begingroup - \normalcolor - \footnoterule - \unvbox\footins - \color@endgroup - }% - \fi - \m@m@makecoltext - \global\maxdepth \@maxdepth} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@reinserts} -% A change here to use \cs{unvbox}\cs{sideins} instead of \cs{sidecontents}. -% \begin{macrocode} -\gdef\@reinserts{% - \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi - \m@mdodoreinextrafeet - \ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi - \ifvoid\sideins\else\insert\sideins{\unvbox\sideins}\fi -} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Float placement} -% -% \begin{macro}{\setfloatlocations} -% \cs{setfloatlocations}\marg{float}\marg{locs} sets the default -% location for the \meta{float} class of floats (e.g., \texttt{figure}) -% to \meta{locs} (initially \texttt{tbp}). For tables might use: \\ -% \verb?\setfloatlocations{table}{htbp}? -% \begin{macrocode} -\newcommand*{\setfloatlocations}[2]{\@namedef{fps@#1}{#2}} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Setting secnumdepth} -% -% The interplay between setting the \Lcount{secnumdepth} counter and -% \Lcount{maxsecnumdepth} is not well understood. Perhaps this will help. -% -% \begin{macro}{\setsecnumdepth} -% In the preamble \cs{setsecnumdepth}\marg{sec} sets both \Lcount{secnumdepth} -% and \Lcount{maxsecnumdepth} to \meta{sec} while in the body it only sets -% \Lcount{secnumdepth}. -% \changes{v4.9}{2007/08/19}{Changed \cs{setsecnumdepth} to set both -% \Lcount{secnumdepth} and \Lcount{maxsecnumdepth} counters} -% \begin{macrocode} -\renewcommand*{\setsecnumdepth}[1]{% - \ifx\@nodocument\relax% after the preamble - \@setclcnt{#1}{secnumdepth}% - \else - \@setclcnt{#1}{secnumdepth}% - \@setclcnt{#1}{maxsecnumdepth}% - \fi} -\setsecnumdepth{section} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Appendices} -% -% \begin{macro}{\addappheadtotoc} -% This needs a \cs{phantomsection} for when \Lpack{hyperref} is used. -% \changes{v4.9}{2007/08/19}{Added \cs{phantomsection} to \cs{addappheadtotoc}} -% \begin{macrocode} -\renewcommand*{\addappheadtotoc}{% - \phantomsection\addcontentsline{toc}{chapter}{\appendixtocname}} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Formatting TOC page numbers} -% -% Dan Luecking (\ctt{} \textit{Re: setting page numbers in toc in their -% natural-width box} 15 August 2007) suggested that a macro like -% \cs{cftXformatpnum} should be used for controlling the typesetting -% of page numbers in the ToC instead of the `hard coded': \\ -% \verb?\hbox to \@pnumwidth{\hfil\cftXpagefont #1}? -% I have implemented this, but the code is scattered in earlier `patches' -% as much of the code to be modified was given in pre 4.9 patches. -% -% \subsection{Heading hooks} -% -% At least one person thinks it a good idea to use multi-paragraph captions. -% It therefore seems possible that others will want multi-paragraph sectional -% headings. -% -% \begin{macro}{\memcaptioninfo} -% \begin{macro}{\memlegendinfo} -% \begin{macro}{\memnamedlegendinfo} -% \begin{macro}{\membitwocaptioninfo} -% \begin{macro}{\membionecaptioninfo} -% \begin{macro}{\membicaptioninfo} -% \changes{v4.9}{2007/08/26}{Made \cs{memcaptioninfo} and friends \cs{long}} -% \begin{macrocode} -\renewcommand{\memcaptioninfo}[4]{} -\renewcommand{\memlegendinfo}[1]{} -\renewcommand{\memnamedlegendinfo}[3]{} -\renewcommand{\membitwonumcaptioninfo}[7]{} -\renewcommand{\membionenumcaptioninfo}[7]{} -\renewcommand{\membicaptioninfo}[6]{} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\mempartinfo} -% \begin{macro}{\mempartstarinfo} -% \begin{macro}{\memchapinfo} -% \begin{macro}{\memchapstarinfo} -% \begin{macro}{\memappchapinfo} -% \begin{macro}{\memappchapstarinfo} -% \begin{macro}{\memsecinfo} -% \begin{macro}{\memsecstarinfo} -% \changes{v4.9}{2007/08/26}{Made \cs{mempartinfo} and friends \cs{long}} -% \begin{macrocode} -\renewcommand{\mempartinfo}[3]{} -\renewcommand{\mempartstarinfo}[1]{} -\renewcommand{\memchapinfo}[4]{} -\renewcommand{\memchapstarinfo}[2]{} -\renewcommand{\memappchapinfo}[4]{} -\renewcommand{\memappchapstarinfo}[2]{} -\renewcommand{\memsecinfo}[5]{} -\renewcommand{\memsecstarinfo}[2]{} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\mempoeminfo} -% \begin{macro}{\mempoemstarinfo} -% \begin{macro}{\memPoemTitleinfo} -% \begin{macro}{\memPoemTitlestarinfo} -% \changes{v4.9}{2007/08/26}{Made \cs{mempoeminfo} and friends \cs{long}} -% \begin{macrocode} -\renewcommand{\mempoeminfo}[1]{} -\renewcommand{\mempoemstarinfo}[1]{} -\renewcommand{\memPoemTitleinfo}[4]{} -\renewcommand{\memPoemTitlestarinfo}[2]{} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\memapppageinfo} -% \begin{macro}{\memapppagestarinfo} -% \begin{macro}{\memleadpageinfo} -% \begin{macro}{\memleadpagestarinfo} -% \changes{v4.9}{2007/08/26}{Made \cs{memapppageinfo} and friends \cs{long}} -% \begin{macrocode} -\renewcommand{\memapppageinfo}[1]{} -\renewcommand{\memapppagestarinfo}[1]{} -\renewcommand{\memleadpageinfo}[3]{} -\renewcommand{\memleadpagestarinfo}[2]{} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \subsection{Verse and Boxed Verbatims} -% -% Ignacio Fern\'{a}ndez Galv\'{a}n (email 2007/04/07) noticed that -% \cs{vrightskip} had no effect on the verse line number positioning. -% -% \begin{macro}{\@vslnumright} -% \begin{macro}{\@vslnumleft} -% \changes{v4.9}{2007/05/02}{Replaced \cs{rightskip} by \cs{vrightskip} -% in \cs{@vslnumright} and \cs{@vslnumleft}} -% \begin{macrocode} -\renewcommand*{\@vslnumright}{% - \hfill\rlap{\kern\vrightskip\kern\rightmargin% - \vlvnumfont\getthelinenumber{poemline}}} -\renewcommand*{\@vslnumleft}{% - \hfill\rlap{\kern-\textwidth\kern-\vrightskip% - \vlvnumfont\getthelinenumber{poemline}}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% Somebody hiding behind the name and email address of -% `Person \verb?facetious_nickname@hotmail.com?' -% wanted to be able to set the first verse line number to other -% than 1, and also start printing line numbers with that line (\ctt{} -% \textit{verse package --- line numbering} 2 January 2007). I supplied -% code for this, asking the requestor to tell me if it worked or not but (s)he -% never replied. It makes you wonder whether it's worth -% bothering to try and help folk. -% -% \begin{macro}{\c@memfvsline} -% A new counter for adjustment to the starting line for printing verse -% line numbers. -% \begin{macrocode} -\newcounter{memfvsline} - \c@memfvsline=\z@ -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\setverselinenums} -% \cs{setverselinenums}\marg{firstline}\marg{startnumsat} sets the first -% verse line number to \meta{firstline} and the first line number to be -% printed at -% line \meta{startnumsat}. Use this within the \texttt{verse} environment -% before the first verse. Note that this must hold: \\ -% \verb?firstline <= startnumsat < firstline+ poemlines? -% \changes{v4.9}{2007/09/05}{Added \cs{setverselinenums} and modified -% \cs{getthelinenumber} accordingly} -% \begin{macrocode} -\newcommand*{\setverselinenums}[2]{% - \c@poemline #1\relax \advance\c@poemline \m@ne - \refstepcounter{poemline}% - \ifnum\z@<\linemodnum% we are printing line numbers - \@tempcnta #2\relax - \divide\@tempcnta\linemodnum - \multiply\@tempcnta\linemodnum - \c@memfvsline #2\relax - \advance\c@memfvsline-\@tempcnta - \fi} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\getthelinenumber} -% Revise this to cater for \cs{setverselinenums}. -% \begin{macrocode} -\renewcommand*{\getthelinenumber}[1]{ - \ifnum\@ne>\linemodnum% no line numbers - \else - \ifnum\@ne=\linemodnum% every line numbered - \@nameuse{the#1}% - \else - \@tempcnta=\@nameuse{c@#1}% - \advance\@tempcnta -\c@memfvsline - \divide\@tempcnta \linemodnum - \multiply\@tempcnta \linemodnum - \advance\@tempcnta \c@memfvsline - \ifnum\@tempcnta=\@nameuse{c@#1}\@nameuse{the#1}\fi - \fi - \fi} - -% \end{macrocode} -% \end{macro} -% -% And while we're at it we might as well provide similar functionality -% for \texttt{boxedverbatim}s. Unfortunately the calculations are slightly -% different for the two cases, so we can't share the code. -% \begin{macro}{\c@memfbvline} -% A new counter for adjustment to the starting line for printing -% \texttt{boxedverbatim} line numbers. -% \begin{macrocode} -\newcounter{memfbvline} - \c@memfbvline=\z@ -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\setbvlinenums} -% \cs{setbvlinenums}\marg{firstline}\marg{startnumsat} sets the first -% \texttt{boxedverbatim} line number to \meta{firstline} and the first -% line number to be printed at line \meta{startnumsat}. -% \changes{v4.9}{2007/09/05}{Added \cs{setbvlinenums} and \cs{getthebvlinenumber}} -% \begin{macrocode} -\newcommand*{\setbvlinenums}[2]{% - \c@bvlinectr #1\relax \advance\c@bvlinectr \m@ne - \ifnum\z@<\linemodnum% we are printing lines - \@tempcnta #2\relax - \divide\@tempcnta\linemodnum - \multiply\@tempcnta\linemodnum - \c@memfbvline #2\relax - \advance\c@memfbvline-\@tempcnta - \fi} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\getthebvlinenumber} -% \begin{macrocode} -\newcommand*{\getthebvlinenumber}[1]{% - \ifnum\@ne>\linemodnum% no line numbers - \else - \ifnum\@ne=\linemodnum% every line numbered - \@nameuse{the#1}% - \else - \@tempcnta=\@nameuse{c@#1}% - \advance\@tempcnta-\c@memfbvline - \divide\@tempcnta \linemodnum - \multiply\@tempcnta \linemodnum - \advance\@tempcnta \c@memfbvline - \ifnum\@tempcnta=\@nameuse{c@#1}\@nameuse{the#1}\fi - \fi - \fi} - -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\theb@vlinenumber} -% \changes{v4.9}{2007/09/05}{Changed \cs{theb@vlinenumber} to use \cs{getthebvlinenumber}} -% \begin{macrocode} -\renewcommand*{\theb@vlinenumber}{\getthebvlinenumber{bvlinectr}} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Input files into tabulars, and etex} -% -% M.J. Williams (CTT \textit{\cs{noalign} problem with \cs{input} and -% tabular in memoir class}, 28 Aug 2007) reported that using \cs{input} in a -% tabular resulted in errors. His example was: -% \begin{verbatim} -% ... -% \begin{tabular}{c|c} \hline -% 1 & 2 \\ \hline -% \input{data} \hline -% 5 & 6 \\ \hline -% \end{tabular} -% \end{verbatim} -% where \texttt{data.tex} contains the single line (and no newline) \\ -% \verb?3 & 4 \\? -% -% Morten H{\o}gholm noted that the problem -% was caused by \Lpack{memoir}'s extension to \cs{input} -% and gave a solution that depends on processing via -% \texttt{etex} rather than \texttt{tex}. -% -% \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)}. -% \begin{macrocode} -%%% \ifetex is TRUE if etex is used instead of tex as the basis. -\newif\ifetex - \etexfalse -\ifx\eTeXversion\@undefined\else - \ifx\eTeXversion\relax\else - \ifnum\eTeXversion>0\relax - \etextrue - \fi - \fi -\fi - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% Here's Morten's fix. Quoting, in part: -% \begin{quotation} -% \Lpack{memoir} extends the file loading mechanism by providing -% \cs{AtBeginFile} and \cs{AtEndFile} whose arguments are executed as -% the names indicate. \ldots after inputting a file the storage bins are -% emptied. The problem [in your case] is that this emptying is an -% assignment and so starts a new tabular cell and \cs{hline} is only -% allowed after \verb?\\? or other \cs{hline}s. -% -% \ldots the tabular environment wraps each tabular cell in additional -% groups so one can do an explicit test for which type of group we are in. -% If tested to be in an align group \emph{and} in vertical mode it means -% TeX hasn't found something to start a new cell and -% then \cs{noalign} can be used. -% \end{quotation} -% -% \begin{macrocode} -\ifetex - \renewcommand*{\killm@matf}[1]{% - \ifnum 6=\currentgrouptype - \ifvmode - \expandafter\expandafter\expandafter\@firstoftwo - \expandafter\expandafter\expandafter\noalign - \fi - \fi - \@firstofone - {\@namelet{#1-m@mfb}\relax - \@namelet{#1-m@mfe}\relax - }% - } -\fi - -% \end{macrocode} -% -% \subsection{Interaction with the \Lpack{float} package} -% -% The \Lpack{float} package also defines \cs{newfloat}. -% -% \begin{macro}{\newfloat} -% Kill \cs{newfloat} if the \Lpack{float} package is loaded. -% \changes{v4.9}{2007/09/14}{Kill \cs{newfloat} if float package is loaded} -% \begin{macrocode} -%%% kill \newfloat if the float package is used. -\AtBeginPackage{float}{\let\newfloat\relax} - -% \end{macrocode} -% \end{macro} -% -% \subsection{Interaction with the \Lpack{caption} package} -% -% Kill changes to the caption macros if the \Lpack{caption} package is used. -% The \Lpack{caption} package checks the definitions of the \cs{@makecaption}, -% \cs{caption} and \cs{@caption} macros. These need to be identical to the -% definitions in the standard classes for the package to disbelieve that -% the \Lpack{memoir} class is being used. -% -% \begin{macro}{\@makecaption} -% \begin{macro}{\caption} -% \begin{macro}{\@caption} -% \changes{v4.9}{2007/11/14}{Revert caption macros for the caption package} -% \changes{v4.9a}{2007/12/18}{Added missing comment mark at end of \cs{caption} -% for caption package checking} -% \begin{macrocode} -%%% revert changes to captioning macros if the caption package is used. -\AtBeginPackage{caption}{ -\ClassWarningNoLine{memoir}{% - You are using the caption package with the memoir \MessageBreak - class. This may cause unexpected or inconsistent \MessageBreak - results if you use memoir's captioning facilities} - -\long\def\@makecaption##1##2{% - \vskip\abovecaptionskip - \sbox\@tempboxa{##1: ##2}% - \ifdim \wd\@tempboxa >\hsize - ##1: ##2\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \vskip\belowcaptionskip} - -\def\caption{% - \ifx\@captype\@undefined - \@latex@error{\noexpand\caption outside float}\@ehd - \expandafter\@gobble - \else - \refstepcounter\@captype - \expandafter\@firstofone - \fi - {\@dblarg{\@caption\@captype}}% -} - -\long\def\@caption##1[##2]##3{% - \par - \addcontentsline{\csname ext@##1\endcsname}{##1}% - {\protect\numberline{\csname the##1\endcsname}{\ignorespaces ##2}}% - \begingroup - \@parboxrestore - \if@minipage - \@setminipage - \fi - \normalsize - \@makecaption{\csname fnum@##1\endcsname}{\ignorespaces ##3}\par - \endgroup} -} % \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \subsection{XeTeX} -% -% Having supplied an \cs{ifpdf} to check if pdfLaTeX is being used, -% here's one for XeTeX. -% -% \begin{macro}{\ifxetex} -% Checks if XeTeX is being used. -% \changes{v4.9}{2007/11/14}{Added \cs{ifxetex}} -% \changes{v4.9a}{2007/12/23}{Added more to \cs{ifxetex}} -% \begin{macrocode} -%%% Use this to check if XeTeX is being used. -\newif\ifxetex -\@ifundefined{XeTeXrevision}{\xetexfalse}{\xetextrue} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\RequireXeTeX} -% Check for XeTeX from the \Lpack{ifxetex} package. -% \changes{v4.9a}{2007/12/23}{Added \cs{RequireXeTeX}} -% \begin{macrocode} -\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} -\EmulatedPackage{ifxetex} - -% \end{macrocode} -% \end{macro} -% -% \subsection{For package documentation} -% -% Some macros that may be useful for documenting LaTeX code. These -% have principally come from \texttt{doc.dtx}. -% -% \begin{macro}{\bs} -% Prints \verb?\? -% \begin{macrocode} -\def\bs{\texttt{\char`\\}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\l@nohyphenation} -% \begin{macro}{\meta} -% \begin{macro}{\meta@font@select} -% From \texttt{doc.dtx} \\ -% \cs{meta}\marg{arg} prints \meta{arg}. -% \begin{macrocode} -\ifx\l@nohyphenation\undefined - \newlanguage\l@nohyphenation -\fi -\DeclareRobustCommand{\meta}[1]{% - \ensuremath\langle - \ifmmode \expandafter \nfss@text \fi - {% - \meta@font@select - \edef\meta@hyphen@restore - {\hyphenchar\the\font\the\hyphenchar\font}% - \hyphenchar\font\m@ne - \language\l@nohyphenation - #1\/% - \meta@hyphen@restore - }\ensuremath\rangle -} -\def\meta@font@select{\itshape} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\marg} -% \begin{macro}{\oarg} -% \begin{macro}{\parg} -% Robust versions of the \texttt{doc.dtx} macros. \\ -% \cs{marg}\marg{arg} prints \marg{arg} \\ -% \cs{oarg}\marg{arg} prints \oarg{arg} \\ -% \cs{parg}\marg{arg} prints \parg{arg} \\ -% \begin{macrocode} -\DeclareRobustCommand{\marg}[1]{% - {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} -\DeclareRobustCommand{\oarg}[1]{% - {\ttfamily\char`\[}\meta{#1}{\ttfamily\char`\]}} -\DeclareRobustCommand{\parg}[1]{% - {\ttfamily\char`\(}\meta{#1}{\ttfamily\char`\)}} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\cs} -% \verb?\cs{arg}? prints \cs{arg}. -% \begin{macrocode} -\DeclareRobustCommand{\cs}[1]{\texttt{\char`\\#1}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\cmd} -% \verb?\cmd{\fred}? prints \cmd{\fred}. -% \begin{macrocode} -%%%%\providecommand*{\cmd}[1]{\cs{\expandafter\cmd@to@cs\string#1}} -%%%% \def\cmd@to@cs#1#2{\char\number`#2\relax} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\cmdprint} -% \begin{macro}{\cmdpx} -% From Heiko Oberdiek CTT 2001/05/26 (print and index a command) \\ -% \verb?\cmdprint{\fred}? prints \verb?\fred? \\ -% \verb?\cmd{\fred}? prints and indexes \verb?\fred?. NOTE It assumes that -% \verb!?! is the `actual' character for MakeIndex (it is normally \verb!@! -% but that is not much use if a command includes \verb!@! as part of its name). -% \begin{macrocode} -\newcommand{\cmdprint}[1]{\texttt{\string#1}} -\newcommand{\cmd}[1]{\cmdprint{#1}% - \index{\expandafter\@gobble\string#1?\string\cmdprint{\string#1}}} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \subsection{Copying pagestyles} -% -% I missed some of the pagestyle elements in the original \cs{copypagestyle}. -% (Problem discovered by Erik Quaeghebeur on 2007/11/27 CTT) -% -% \begin{macro}{\copypagestyle} -% \changes{v4.9}{2007/11/28}{Added missing elements to \cs{copypagestyle}} -% \begin{macrocode} -\renewcommand*{\copypagestyle}[2]{% - \makepagestyle{#1}% - \makeevenhead{#1}{\@nameuse{#2eheadl}}% - {\@nameuse{#2eheadc}}{\@nameuse{#2eheadr}}% - \makeoddhead{#1}{\@nameuse{#2oheadl}}% - {\@nameuse{#2oheadc}}{\@nameuse{#2oheadr}}% - \makeevenfoot{#1}{\@nameuse{#2efootl}}% - {\@nameuse{#2efootc}}{\@nameuse{#2efootr}}% - \makeoddfoot{#1}{\@nameuse{#2ofootl}}% - {\@nameuse{#2ofootc}}{\@nameuse{#2ofootr}}% - \makerunningwidth{#1}{\@nameuse{#2runwidth}}% -%%%% corrected these elements - \@namedef{#1evenhpl}{\@nameuse{#2evenhpl}}% - \@namedef{#1oddhpl}{\@nameuse{#2oddhpl}}% - \@namedef{#1evenhpr}{\@nameuse{#2evenhpr}}% - \@namedef{#1oddhpr}{\@nameuse{#2oddhpr}}% -%%%% added these elements - \@namedef{#1evenfpl}{\@nameuse{#2evenfpl}}% - \@namedef{#1oddfpl}{\@nameuse{#2oddfpl}}% - \@namedef{#1evenfpr}{\@nameuse{#2evenfpr}}% - \@namedef{#1oddfpr}{\@nameuse{#2oddfpr}}% -%%%% back to the original - \@namedef{#1headrule}{\@nameuse{#2headrule}}% - \@namedef{#1footrule}{\@nameuse{#2footrule}}% - \makepsmarks{#1}{\@nameuse{#2pshook}}% -} - -% \end{macrocode} -% \end{macro} -% -% \subsection{The extra font sizes} -% -% With Metafont fonts you can't effectively specify any font sizes other -% than Knuth's, but with outline fonts you can as they can be scaled on the -% fly. Here's and extension to enable these to be used. -% -% \begin{macro}{\@ivpt} -% \begin{macro}{\@xxxvivpt} -% \begin{macro}{\@xviiilpt} -% \begin{macro}{\@lxpt} -% \begin{macro}{\@lxxiipt} -% Macros for font sizes --- extensions to the kernel ones. -% \begin{macrocode} -\newcommand*{\@ivpt}{4} -\newcommand*{\@xxxvipt}{36} -\newcommand*{\@xviiilpt}{48} -\newcommand*{\@lxpt}{60} -\newcommand*{\@lxxiipt}{72} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\extendedfontsizes} -% \begin{macro}{\LARGE} -% \begin{macro}{\huge} -% \begin{macro}{\Huge} -% \begin{macro}{\HUGE} -% \begin{macro}{\miniscule} -% Makes all font sizes, from \cs{miniscule} to \cs{HUGE} unique. -% \begin{macrocode} -\newcommand*{\extendedfontsizes}{% -\ifcase\@ptsize % 0=10pt - \or % 11pt - \renewcommand*{\HUGE}{\@setfontsize\HUGE\@xxxvipt{48}} - \or % 12pt - \renewcommand*{\Huge}{\@setfontsize\Huge\@xxxvipt{48}} - \renewcommand*{\HUGE}{\@setfontsize\HUGE\@xviiilpt{60}} - \or \or % 14pt - \renewcommand*{\huge}{\@setfontsize\huge\@xxxvipt{48}} - \renewcommand*{\Huge}{\@setfontsize\Huge\@xviiilpt{60}} - \renewcommand*{\HUGE}{\@setfontsize\HUGE\@lxpt{72}} - \or \or \or % 17pt - \renewcommand*{\LARGE}{\@setfontsize\LARGE\@xxxvipt{44}} - \renewcommand*{\huge}{\@setfontsize\huge\@xviiilpt{60}} - \renewcommand*{\Huge}{\@setfontsize\Huge\@lxpt{72}} -% \renewcommand*{\HUGE}{\@setfontsize\HUGE\@lxxiipt{96}} - \renewcommand*{\HUGE}{\@setfontsize\HUGE\@lxxiipt{90}} - \or \or % 9pt - \renewcommand*{\miniscule}{\@setfontsize\miniscule\@ivpt{5}} -\fi} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \subsection{Frontmatter amd mainmatter} -% -% If \cs{frontmatter} and \cs{mainmatter} are used with the article option, -% then a page numbering / margin problem can occur if the frontmatter ends -% on an odd page --- the first mainmatter next page is odd as well which throws -% puts two odd-margined pages together. -% -% One fix from Morten is to always \cs{cleardoublepage} for twosided articles. -% -% One fix from me is for the ...matter macros to just switch on/off section -% numbering. -% -% Morten's is simpler to implement. -% -% \begin{macro}{\@smemmain} -% \changes{v4.9}{2007/12/07}{Changed clear pages in \cs{@smemmain}} -% \begin{macrocode} -\renewcommand*{\@smemmain}{% - \@mainmattertrue - \setcounter{secnumdepth}{\value{maxsecnumdepth}} - \ifartopt - \if@twoside - \cleardoublepage - \else - \clearpage - \fi - \else - \cleardoublepage - \counterwithin{figure}{chapter} - \counterwithin{table}{chapter} - \fi} - -% \end{macrocode} -% \end{macro} -% -% \subsection{ToC hooks} -% -% This is a generalisation of a suggestion by Lars Madsen (private email, -% 2007/12/14). -% -% \begin{macro}{\cftinsert} -% \begin{macro}{\cftinsertcode} -% \begin{macro}{\cftinserthook} -% \changes{v4.9}{2007/12/14}{Added \cs{cftinsert} and friends} -% \changes{v4.9a}{2007/12/18}{Fixed argument bug in \cs{cftinserthook}} -% \begin{macrocode} -%%% -%%% Following code suggested by Lars Madsen -%%% Command inserted in a `List of' holding a hook for extra code -\newcommand*{\cftinsert}[1]{\@nameuse{cftinsert#1}} -%%% Create a hook to be executed in a `List of'. Since we use \@nameuse -%%% it does not matter if the hook does not exist -\newcommand{\cftinsertcode}[2]{\@namedef{cftinsert#1}{#2}} -%%% Insert a hook into the `List of' file -\newcommand*{\cftinserthook}[2]{% - \addtocontents{#1}{\protect\cftinsert\protect{#2\protect}}} -%%% -%%% Use like this: -%%% \cftinsertcode{A}{% -%%% \renewcommand*{\cftchapterfont}{\normalfont\scshape} -%%% ... -%%% } -%%% \cftinsertcode{F}{...} -%%% \cftinsertcode{G}{...} -%%% ... -%%% \frontmatter -%%% \tableofcontents -%%% \cftinserthook{lof}{G} -%%% \listoffigures -%%% \chapter{...} -%%% ... -%%% \mainmatter -%%% \cftinserthook{lof}{F} -%%% \cftinserthook{toc}{A} -%%% \chapter{...} -%%% - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \subsection{Setting the ToC depth} -% -% \begin{macro}{\toclevel@part} -% \begin{macro}{\toclevel@chapter} -% Somehow I missed these out much earlier. -% \changes{v4.9}{2007/12/14}{Added \cs{toclevel@part} and \cs{toclevel@chapter}} -% \begin{macrocode} -\newcommand*{\toclevel@part}{-1} -\newcommand*{\toclevel@chapter}{0} - -% \end{macrocode} -% \end{macro} -% \end{macro} % % The end of the patch file. % diff --git a/Master/texmf-dist/source/latex/memoir/mempatch.ins b/Master/texmf-dist/source/latex/memoir/mempatch.ins index 9ec01baf512..593655ba2b8 100755 --- a/Master/texmf-dist/source/latex/memoir/mempatch.ins +++ b/Master/texmf-dist/source/latex/memoir/mempatch.ins @@ -1,6 +1,6 @@ %% mempatch.ins %% Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net -%% Copyright 2001 --- 2006 Peter R. Wilson +%% Copyright 2001 --- 2008 Peter R. Wilson %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -28,7 +28,7 @@ \preamble Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net - Copyright 2001 --- 2006 Peter R. Wilson + Copyright 2001 --- 2008 Peter R. Wilson This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either |