% \iffalse meta-comment % % memoir.dtx % % This program is provided under the terms of the % LaTeX Project Public License distributed from CTAN % archives in directory macros/latex/base/lppl.txt. % % Author: Peter Wilson (CUA) % now at: peter.r.wilson@boeing.com % Copyright 2001 Peter R. Wilson % % \fi % \CheckSum{13781} % % \changes{v0.1}{2001/05/20}{First public alpha release} % \changes{v0.2}{2001/06/03}{First beta release} % \changes{v0.3}{2001/07/09}{Bug fixing} % \changes{v0.31}{2001/07/09}{Bug fixing} % \changes{v0.32}{2001/08/03}{Fix for old versions of amsmath package} % \changes{v0.33}{2001/08/03}{Added controllable chapter/LoF spacing} % \changes{v0.33}{2001/08/03}{Fixed bug in \cs{appendixpage}} % \changes{v1.0}{2001/10/30}{First production release} % \changes{v1.0a}{2001/12/07}{Feature fixes} ^^A never released % \changes{v1.1}{2002/03/10}{More fixups} % \changes{v1.1}{2002/03/10}{Replaced all the subfigure code} % \changes{v1.1}{2002/03/28}{Added sidebars} % \changes{v1.1}{2002/03/28}{Upgraded verse typesetting} % \changes{v1.2}{2002/07/07}{Added 17pt option} % \changes{v1.2}{2002/07/07}{Added extra \cs{provide} commands} % \changes{v1.2}{2002/07/27}{Major verbatim, box and file additions} % \changes{v1.2}{2002/07/27}{Removed extraneous space from change marks} % \changes{v1.2}{2002/07/27}{Extra optarg in \cs{chapter} and \cs{chapter*}} % \changes{v1.2}{2002/07/27}{Twiddled font sizes a little} % \changes{v1.2}{2002/08/27}{Fixed 12pt bug} % \changes{v1.3}{2002/09/27}{Minor tweaks wrt v1.2} % \changes{v1.3}{2002/10/10}{Extra trimming styles} % \changes{v1.3}{2002/10/10}{Major extensions for indexing} % \changes{v1.3}{2002/11/14}{Automatically call a patch file} % \changes{v1.3a}{2002/11/22}{Fixed nasty figure/table bug} % % ^^A \def\fileversion{v0.1} % ^^A \def\filedate{2001/05/20} % ^^A \def\fileversion{v0.2} % ^^A \def\filedate{2001/06/03} % ^^A \def\fileversion{v0.3} % ^^A \def\filedate{2001/07/14} % ^^A \def\fileversion{v0.31} % ^^A \def\filedate{2001/07/24} % ^^A \def\fileversion{v0.32} % ^^A \def\filedate{2001/08/03} % ^^A \def\fileversion{v0.33} % ^^A \def\filedate{2001/08/31} % ^^A \def\fileversion{v1.0} % ^^A \def\filedate{2001/11/17} % ^^A \def\fileversion{v1.0a} % ^^A \def\filedate{2001/12/07} % \def\fileversion{v1.1} % \def\filedate{2002/03/28} % \def\fileversion{v1.1a} % \def\filedate{2002/04/28} % \def\fileversion{v1.2} % \def\filedate{2002/08/10} % \def\fileversion{v1.2} % \def\filedate{2002/08/27} % \def\fileversion{v1.3} % \def\filedate{2002/11/14} % \def\fileversion{v1.3a} % \def\filedate{2002/11/22} % \title{The LaTeX \Lpack{memoir} class for configurable book % typesetting: Source code\thanks{This % file has version number \fileversion, last revised % \filedate.}} % % \author{% % Peter Wilson\\ % Catholic University of America \\ % Now at \texttt{peter.r.wilson@boeing.com} % } % \date{\filedate} % \maketitle % % \begin{abstract} % The \Lpack{memoir} class is designed for typesetting % general books such as novels, biographies, histories, % and so on, although as it supports all the functionality of the % standard \Lpack{book} class it can also be used for technical writing. % It provides more functions than the standard class as well as % presenting a more friendly interface for the book designer. % It can also simulate the typesetting style of the standard \Lpack{article} % class. % % Version 0.33 of the class was the last of the beta releases and % version 1.0 was the first production release. % \end{abstract} % % \tableofcontents % \listoftables % % \StopEventually{} % % % % \section{Introduction} % % This document provides the commented source % for the LaTeX \Lpack{memoir} class, which is designed for typesetting % general books such as novels, biographies, histories, % and so on. It has all the functionality of the standard \Lpack{book} % class and, as well as providing some extra functions, also provides % a more friendly interface for the document designer. As it can encompass % everything that the \Lpack{book} class provides it may also be used % for technical writing. % % The default appearance of a document typeset with this class is % the same as if it had been typeset with the \Lpack{book} class and % it can be made to simulate the \Lpack{article} class.. % The class, though, includes extra facilities that make it easy to % change the appearance of such things as the page headers and footers, % the style of chapter and other sectional headings, and the style of % captions. It also makes it easy to both change the style of the % Table of Contents, List of Figures, etc., as well as creating new % kinds of `List of\ldots'. New types of floats, if needed, can be % created very simply. Epigraphs can be put into the document in a % variety of styles. % % The class provides a variety of page, chapter and captioning % 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 % 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 % manuscript to look as though it was typewritten, there is an option % to do this (double spacing, ragged right, no hyphenation, % fixed width font). There is also an unsophisticated means of flagging any % revisions to the text. % % 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. % % % I hope that apart from the font commands the class % is compatible with % `standard' LaTeX. % % Development of this class would never have been started without % the wonderful work done by Leslie Lamport and others~\cite{CLASSES} % from whom I have learned a great deal and borrowed much code. % % Sections~\ref{sec:docstrip} through~\ref{sec:ic} describe some % administrative elements and code for general use later in the % specification. % The macros forming the class file are defined in sections~\ref{sec:opt} % through~\ref{sec:init}. % % This manual is typeset according to the conventions of the % \LaTeX{} \textsc{docstrip} utility which enables the automatic % extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}. % % % \section{A driver for this document} \label{sec:docstrip} % % The next series of code contains the documentation driver file for % \LaTeX, i.e., the file that will produce the documentation you are % currently reading. This will be extracted from this file by the % \textsc{docstrip} program. % % \begin{macrocode} %<*driver> \documentclass{ltxdoc} \usepackage{url} % \end{macrocode} % % We do not want the following basic elements to appear in the index. % \begin{macrocode} \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath} \DoNotIndex{\@centercr,\@cite} \DoNotIndex{\@dotsep,\@empty,\@gobble,\@gobbletwo,\@ignoretrue} \DoNotIndex{\@input,\@ixpt,\@m} \DoNotIndex{\@minus,\@ne,\@nil,\@nomath,\@plus,\@set@topoint} \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb} \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt} \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt} \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace} \DoNotIndex{\advance,\Alph,\alph} \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box} \DoNotIndex{\bullet} \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption} \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass} \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist} \DoNotIndex{\EnableCrossrefs,\end,\endgroup} \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter} \DoNotIndex{\fbox} \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef} \DoNotIndex{\global,\halign,\hbox,\hfil,\hfill,\hrule} \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi} \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi} \DoNotIndex{\input} \DoNotIndex{\jobname,\kern,\leavevmode,\let} \DoNotIndex{\list,\llap,\long,\m@ne,\m@th} \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment} \DoNotIndex{\NeedsTeXFormat,\newdimen} \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number} \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@} \DoNotIndex{\par,\paragraph,\paragraphmark,\parfillskip} \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions} \DoNotIndex{\protect,\ProvidesClass} \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font} \DoNotIndex{\rightskip,\rlap,\rmfamily,\roman} \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength} \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space} \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase} \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt} \DoNotIndex{\viipt,\vipt,\vskip,\vspace} \DoNotIndex{\wd,\xiipt,\year,\z@} \DoNotIndex{\@namedef,\@nameuse,\csname,\endcsname} % \end{macrocode} % We do want an index, using linenumbers, but not update information. % \begin{macrocode} \EnableCrossrefs \CodelineIndex %% \RecordChanges % \end{macrocode} % We had better have page headings to aid navigation, but I don't % like Uppercased titles. % \begin{macrocode} \renewcommand{\MakeUppercase}[1]{#1} \pagestyle{headings} % \end{macrocode} % We use so many \file{docstrip} modules that we set the % \texttt{StandardModuleDepth} counter to 1. % \begin{macrocode} \setcounter{StandardModuleDepth}{1} % \end{macrocode} % Some commonly used abbreviations % \begin{macrocode} \newcommand*{\Lopt}[1]{\textsf {#1}} % typeset an option \newcommand*{\file}[1]{\texttt {#1}} % typeset a file \newcommand*{\Lcount}[1]{\textsl {\small#1}} % typeset a counter \newcommand*{\pstyle}[1]{\textsl {#1}} % typeset a pagestyle \newcommand*{\Lenv}[1]{\texttt {#1}} % typeset an environment \newcommand*{\Lpack}[1]{\textsf {#1}} % typeset a package % \end{macrocode} % We want the full details printed. % \begin{macrocode} \begin{document} \DocInput{memoir.dtx} \PrintIndex %% \PrintChanges \end{document} % % \end{macrocode} % % % % % % \section{Identification} \label{sec:id} % % The \Lpack{memoir} document class can only be used with LaTeX2e, % so we make % sure that an appropriate message is displayed when another TeX % format is used. % \begin{macrocode} %\NeedsTeXFormat{LaTeX2e} % \end{macrocode} % % Announce the name, option files and version for LaTeX2e files: % \begin{macrocode} %\ProvidesClass{memoir}[2002/11/22 v1.3a configurable document class] %<9pt>\ProvidesFile{mem9.clo}[2002/07/27 v0.2 memoir class 9pt size option] %<10pt>\ProvidesFile{mem10.clo}[2002/07/27 v0.2 memoir class 10pt size option] %<11pt>\ProvidesFile{mem11.clo}[2002/07/27 v0.2 memoir class 11pt size option] %<12pt>\ProvidesFile{mem12.clo}[2002/08/27 v0.2a memoir class 12pt size option] %<14pt>\ProvidesFile{mem14.clo}[2002/07/27 v0.2 memoir class 14pt size option] %<17pt>\ProvidesFile{mem17.clo}[2002/07/07 v0.1 memoir class 17pt size option] % \end{macrocode} % % % \section{Initial Code} \label{sec:ic} % % \begin{macrocode} %<*class> % \end{macrocode} % % Note (2001/08/03): Old versions of the \Lpack{amsmath} package did odd % things with |\@tempa|, |\@tempb| and |\@tempc|. I have now replaced % any use of these with |\@memtempa|, etc. % % 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 % pointsize we are typesetting in. So, normally, it's value is one % of 0, 1 or 2. % \begin{macrocode} \newcommand{\@ptsize}{} % \end{macrocode} % \end{macro} % % Any new lengths that depend on the point size option must be declared % before the options are executed. % \begin{macro}{\onelineskip} % \begin{macro}{\lxvchars} % \begin{macro}{\xlvchars} % The length |\onelineskip| is the vertical space taken % by a normal line of text. The lengths |\lxvchars| and |\xlvchars| are % the approximate lengths required for typesetting lines with either 65 or 45 % characters. % \begin{macrocode} \newlength{\onelineskip} \newlength{\lxvchars} \newlength{\xlvchars} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@memcnta} % We need a scratch count register. % \begin{macrocode} \newcount\@memcnta % \end{macrocode} % \end{macro} % % \changes{v1.0a}{2001/11/28}{Deleted count register \cs{@memtempa}} % % \begin{macro}{\if@restonecol} % When the document has to be printed in two columns, we sometimes % have to temporarily switch to one column. This switch is used to % remember to switch back. % \begin{macrocode} \newif\if@restonecol % \end{macrocode} % \end{macro} % % \begin{macro}{\if@openright} % This is TRUE if chapters are to start on righthand (recto) pages; % this is the default. FALSE means chapters can start on any page. % \begin{macrocode} \newif\if@openright \@openrighttrue % \end{macrocode} % \end{macro} % % \begin{macro}{\if@openleft} % This is TRUE if chapters are to start on lefthand (verso) pages. % \begin{macrocode} \newif\if@openleft \@openleftfalse % \end{macrocode} % \end{macro} % % \begin{macro}{\if@mainmatter} % This is TRUE if the main part of the document is being currently procesed; % this is the default. % \begin{macrocode} \newif\if@mainmatter \@mainmattertrue % \end{macrocode} % \end{macro} % % \begin{macro}{\if@memoldfont} % This is TRUE if the \Lopt{oldfontcommands} option is used. % \changes{v1.0a}{2002/01/29}{Added \cs{if@memoldfont}} % \begin{macrocode} \newif\if@memoldfont \@memoldfontfalse % \end{macrocode} % \end{macro} % % % % \begin{macro}{\ifsamename} % \begin{macro}{\nametest} % The macro |\nametest{|\meta{name1}|}{|\meta{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} % 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}|. % \begin{macrocode} \newif\ifsamename \newcommand{\nametest}[2]{% \samenamefalse \begingroup \def\@memtempa{#1} \def\@memtempb{#2} \ifx \@memtempa\@memtempb \endgroup \samenametrue \else \endgroup \fi } % \end{macrocode} % \end{macro} % \end{macro} % % \changes{v0.3}{2001/07/09}{Deleted \cs{fillline} and \cs{makecommand} as % they were not used} % % % \begin{macro}{\kill@lastcounter} % |\kill@lastcounter{|\meta{cntr}|}|\footnote{With thanks to Stefan Ulrich % (\texttt{ulrich@cis.uni-muenchen.de}) who answered a question on this % on \texttt{ctt}, 2001/07/09. (Also answered by Heiko Oberdiek, % \texttt{oberdiek@ruf.uni-freiburg.de}).} % kills the counter \meta{cntr}. This macro is an extension to the % suggestions as it also makes the last count register reusable. % \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|. % \changes{v0.3}{2001/07/09}{Added \cs{kill@counter}} % \begin{macrocode} \newcommand{\kill@lastcounter}[1]{% % \end{macrocode} % Deallocate the last counter register. From the TeXbook, |\count10| is % the number of the last register. % \begin{macrocode} \advance\count10 \m@ne % \end{macrocode} % Set the internal counter definition to |\relax|. % \begin{macrocode} \expandafter\let\csname c@#1\endcsname\relax} % \end{macrocode} % \end{macro} % % % \begin{macro}{\ifpdf} % This can be used to check whether or not a document is being processed % by LaTeX or pdfLaTeX. % \changes{v1.0}{2001/09/21}{Made checking of \cs{pdfouput} more robust} % \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}{\phantomsection} % A command needed if the \Lpack{hyperref} package is used, for putting % before certain |\addcontentsline| commands. % \begin{macrocode} \newcommand{\phantomsection}{} % \end{macrocode} % \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 % 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 % Michael Downes\footnote{\texttt{epsmjd@ams.org}} and % Heiko Oberdiek\footnote{\texttt{oberdiek@ruf.uni-freiburg.de}} % were kind enough to respond. % The responses arrived almost simultaneously, both % supplying methods for adding code at the end of a macro defined to take % one argument. Michael Downes' response included a remark about it probably % being too much effort to formulate a general way of doing this. % Heiko Oberdiek almost immediately replied with such a generalisation. % % The following code, which I have extracted from a package that I % wrote but which I did not submit to CTAN, incorporates the work of both % Michael and Heiko. I have added a bit. All errors are my responsibility. % Michael went on the write the \Lpack{patchcmd} package which is % a generalisation of the facilities below and so there was no need for % my more restricted package. % \changes{v0.33}{2001/08/31}{Replaced \cs{appendiarg} with \cs{addtodef} % and friends} % % \begin{macro}{\wo@dmacro} % Heiko Oberdiek suggested\footnote{Via email on 2000/07/12.} that % \meta{macro} should be tested for being the name of a macro, rather than % 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:'. % \begin{macrocode} \edef\wo@dmacro{% \string m\string a\string c\string r\string o\string :% } % \end{macrocode} % \end{macro} % % \begin{macro}{\wo@difmacro@begingroup} % This appears to take two arguments: % |\wo@difmacro@begingroup{|\meta{macro}|}{|\meta{code}|}|, where % \meta{macro} should be the name of a defined macro and \meta{code} % is code to be executed if and only if \meta{macro} \emph{is} a % defined macro. % \begin{macrocode} \def\wo@difmacro@begingroup#1{% % \end{macrocode} % Start a group. % \begin{macrocode} \begingroup % \end{macrocode} % Test if |#1| is a defined macro; |\wo@dparsemacro| does most of the work. % \begin{macrocode} \edef\x{% \noexpand\wo@dparsemacro\meaning#1\wo@dmacro\string -% }% \x\@nil{#1}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\wo@dparsemacro} % This is called by |\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 % \emph{must} close the group. % \begin{macrocode} \begingroup \edef\x{\endgroup \def\noexpand\wo@dparsemacro##1\wo@dmacro##2\string -}% \x#3\@nil#4{% \ifx\\#3\\% \endgroup \ClassWarning{memoir}{\string `\string #4\string ' is not a macro}% \expandafter\@gobble \else \expandafter\@firstofone \fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\addtodef} % \begin{macro}{\addtodef*} % \begin{macro}{\wo@daddtodef} % The command |\addtodef{|\meta{macro}|}{|\meta{start-stuff}|}{|\meta{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}). % 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 % being amended has no argument, % but both versions are provided for consistency. % % The kernel |\@star@or@long| and |\l@ngrel@x| commands % (in \file{ltdefns.dtx}) are used to handle % the potential |*| 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}, % \meta{start-stuff} and \meta{end-stuff}. % \begin{macrocode} \long\def\wo@daddtodef#1#2#3{% % \end{macrocode} % Check if \meta{macro} has been defined. % \begin{macrocode} \wo@difmacro@begingroup{#1}{% % \end{macrocode} % If \meta{macro} is defined then store the tokens corresponding to the % body of \meta{macro} and the extra \meta{-stuff} in token registers. % \begin{macrocode} \@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 % 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|. % \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. % \begin{macrocode} \x }% } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\addtoiargdef} % \begin{macro}{\addtoiargdef*} % \begin{macro}{\wo@daddtoiargdef} % This adds stuff at the start and/or end of a macro that takes one argument. % It is a modification of Michael Downes' appending % code\footnote{Posted to \texttt{ctt} on 15~June 2000,\\ % URL: \url{http://www.dejanews.com/getdoc.xp?AN=635057844}.} % which was: % \begin{small}\begin{verbatim} % \def\appendef#1#2{% % \begingroup % \toks@\expandafter{#1{##1}#2}% % \edef\x{\endgroup \def\noexpand#1####1{\the\toks@}}% % \x} % \end{verbatim} % \par\end{small} % % \begin{macrocode} \def\addtoiargdef{\@star@or@long\wo@daddtoiargdef} \long\def\wo@daddtoiargdef#1#2#3{% \wo@difmacro@begingroup{#1}{% \@temptokena{#2}% \toks@\expandafter{#1{##1}#3}% \edef\x{\endgroup \l@ngrel@x\def\noexpand#1####1{\the\@temptokena \the\toks@}}% \x }% } % \end{macrocode} % For the record, Heiko Oberdiek produced the following % version\footnote{Posted to \texttt{ctt} on 16~June 2000,\\ % URL: \url{http://www.dejanews.com/getdoc.xp?AN=635095381}.} % which avoids the use of a token register. % \begin{small}\begin{verbatim} % \newcommand{\appendiargdef}[2]{% % \long\expandafter\def\expandafter#1\expandafter % ##\expandafter1\expandafter{#1{##1}#2}} % \end{verbatim} % \par\end{small} % % \end{macro} % \end{macro} % \end{macro} % % % % \section{Declaration of Options} \label{sec:opt} % % % \subsection{Setting Paper Sizes} % % The variables |\paperheight| and |\paperwidth| should reflect the % physical paper size after trimming. % % Option \Lopt{letterpaper} will be the default. % % \begin{macro}{\stockheight} % \begin{macro}{\stockwidth} % \begin{macro}{\trimtop} % \begin{macro}{\trimedge} % The lengths |\stockheight| and |\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 % 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...| % sizes are the same and the trims are zero. This class assumes that this % is the normal case. % \begin{macrocode} \newlength{\stockheight} \newlength{\stockwidth} \newlength{\trimtop} \newlength{\trimedge} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % Declare the stock size options. % \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, % assuming that the dimensions were originally given for portrait % orientation. % \begin{macrocode} \DeclareOption{landscape} {\setlength\@tempdima {\stockheight} \setlength\stockheight{\stockwidth} \setlength\stockwidth {\@tempdima}} % \end{macrocode} % % % \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| % statements. This is done for historical reasons to stay compatible % with other packages that use the |\@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. % % Option \Lopt{10pt} will be the default. % \changes{v1.2}{2002/07/07}{Added 17pt option} % \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}} % \end{macrocode} % % % \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 % paragraphs into the outside margin. The default is \Lopt{twoside}. % \begin{macro}{\if@twoside} % \begin{macro}{\if@mparswitch} % \begin{macrocode} \DeclareOption{twoside}{\@twosidetrue \@mparswitchtrue} \DeclareOption{oneside}{\@twosidefalse \@mparswitchfalse} % \end{macrocode} % \end{macro} % \end{macro} % % % \subsection{Two column printing} % % Two-column and one-column printing is again realized via a switch % which is defined in the kernel. The default is single column printing. % % \begin{macro}{\if@twocolumn} % \begin{macrocode} \DeclareOption{onecolumn}{\@twocolumnfalse} \DeclareOption{twocolumn}{\@twocolumntrue} % \end{macrocode} % \end{macro} % % % \subsection{The \Lopt{draft} option} % % If the user requests \Lopt{draft} we show any overfull boxes, % marginal notes are allowed, and any copyright notices are not % 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 \fi| % \begin{macro}{\ifdraftdoc} % \begin{macrocode} \newif\ifdraftdoc\draftdocfalse \setlength{\overfullrule}{\z@} \DeclareOption{final}{\setlength{\overfullrule}{\z@} \draftdocfalse \msdocfalse} \DeclareOption{draft}{\setlength\overfullrule{5pt}% \draftdoctrue \msdocfalse} % \end{macrocode} % \end{macro} % % \subsection{The \Lopt{ms} option} % % \begin{macro}{\ifmsdoc} % The \Lopt{ms} option makes the document look as though it was produced % on a typewriter. We use a flag for remembering this. The user may also % use the flag for specifying \Lopt{ms} effects. % \begin{macrocode} \newif\ifmsdoc \msdocfalse \DeclareOption{ms}{% \msdoctrue \draftdocfalse \setlength\overfullrule{\z@} } % \end{macrocode} % \end{macro} % % \subsection{The \Lopt{showtrims} option} % % The \Lopt{showtrims} option will display crosses at the corners % of the logical pages showing where the stock should be trimmed. % % \begin{macro}{\ifshowtrims} % \begin{macrocode} \newif\ifshowtrims \showtrimsfalse \DeclareOption{showtrims}{\showtrimstrue} % \end{macrocode} % \end{macro} % % \subsection{The \Lopt{article} option} % % The \Lopt{article} option typesets as a simulation of the % \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. % \begin{macrocode} \newif\ifartopt \artoptfalse \DeclareOption{article}{\artopttrue} % \end{macrocode} % \end{macro} % % \subsection{The \Lopt{subfigure} option} % % The \Lopt{subfigure} option has been made a no-op since version 1.1. % \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} % % % \subsection{The openright, openleft and openany options} % % The \Lopt{openright} option specifies that Chapters must begin on % recto pages. The \Lopt{openleft} option specifies that Chapters % must begin on verso pages and the \Lopt{openany} option lets Chapters % start on any page. % \changes{v1.0}{2001/10/24}{Added the openleft option} % \begin{macrocode} \DeclareOption{openright}{\@openrighttrue} \DeclareOption{openany}{\@openrightfalse} \DeclareOption{openleft}{\@openlefttrue} % \end{macrocode} % % \begin{macro}{\openright} % \begin{macro}{\openany} % \begin{macro}{\openleft} % Commands that can be used to change the option in the middle of the % document\footnote{Openleft provided to meet a request by % Vladimir G.~Ivanovic (\texttt{vladimir@acm.org}) in September 2001.}. % \begin{macrocode} \newcommand{\openright}{\@openrighttrue\@openleftfalse% \gdef\clearforchapter{\cleartorecto}} \newcommand{\openany}{\@openrightfalse\@openleftfalse% \gdef\clearforchapter{\clearpage}} \newcommand{\openleft}{\@openlefttrue \gdef\clearforchapter{\cleartoverso}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \subsection{Equation numbering on the left} % % The \Lopt{leqno} option prints equation numbers on the left. This % is implemented via an external class option file. % \begin{macrocode} \DeclareOption{leqno}{\input{leqno.clo}} % \end{macrocode} % % \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| % from the current left margin. This % is implemented via an external class option file. % \begin{macrocode} \DeclareOption{fleqn}{\input{fleqn.clo}} % \end{macrocode} % % \subsection{Open bibliography} % % The \Lopt{openbib} option redefines the |thebibliography| so that each % block starts on a new line, and succeeding lines in a block are % indented by |\bibindent|. % \changes{v1.0a}{2001/11/28}{Replaced \cs{AtEndOfPackage} with \cs{AtEndOfClass}} % \begin{macrocode} \DeclareOption{openbib}{% \AtEndOfClass{% \renewcommand\@openbib@code{% \advance\leftmargin\bibindent \itemindent -\bibindent \listparindent \itemindent \parsep \z@ }% \renewcommand\newblock{\par}}% } % \end{macrocode} % % \subsection{Old font commands} % % The \Lopt{oldfontcommands} option enables commands like |\bf| and friends. % \changes{v1.0a}{2002/01/29}{Added the oldfontcommands option} % \begin{macrocode} \DeclareOption{oldfontcommands}{% \@memoldfonttrue} % \end{macrocode} % % % \section{Executing Options} \label{sec:xopt} % % Here we execute the default options to initialize certain % variables. % \begin{macrocode} \ExecuteOptions{final,letterpaper,10pt,onecolumn,openright,twoside} % \end{macrocode} % % The |\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, % 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. % \begin{macrocode} \ProcessOptions % \end{macrocode} % % \begin{macro}{\cleartorecto} % A repeat of |\cleardoublepage|; clears to a recto (odd-numbered) page. % \begin{macrocode} \def\cleartorecto{\clearpage\if@twoside \ifodd\c@page\else \hbox{}\thispagestyle{cleared}% \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\cleartoverso} % Clears to a verso (even-numbered) page. % \begin{macrocode} \def\cleartoverso{\clearpage\if@twoside \ifodd\c@page\hbox{}\thispagestyle{cleared}% \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi} % \end{macrocode} % \end{macro} % % Set |\clearforchapter| according to the options. % \begin{macrocode} \if@openleft \openleft \else \if@openright \openright \else \openany \fi \fi % \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{macrocode} \ifnum\@ptsize = 9\relax \input{mem\@ptsize.clo} \else \input{mem1\@ptsize.clo} \fi % % \end{macrocode} % % \section{Loading Packages} \label{sec:lpack} % % This class file does not load additional package files. % % % \section{Document Layout} \label{sec:docl} % \label{sec:maincode} % % In this section we deal with the more difficult typographical % details. % % \subsection{Fonts} % % \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: % % \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| % for the size of the font selected. (The actual value will be % |\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}. % % \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\\ % \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 |\normalsize| macro also sets new values for\\ % |\abovedisplayskip|, |\abovedisplayshortskip| and % |\belowdisplayshortskip|. % % \begin{macrocode} %<*9pt|10pt|11pt|12pt|14pt|17pt> % \end{macrocode} % \changes{v0.11 (mem14.clo)}{2001/10/30}{Changed baseline skip from 17.28pt to 17.5pt} % \begin{macrocode} \renewcommand{\normalsize}{% %<*9pt> \@setfontsize\normalsize\@ixpt\@xpt \abovedisplayskip 9\p@ \@plus 2\p@ \@minus 4.5\p@ \abovedisplayshortskip \z@ \@plus 3\p@ \belowdisplayshortskip 5.5\p@ \@plus 2.5\p@ \@minus 3\p@ % %<*10pt> \@setfontsize\normalsize\@xpt\@xiipt \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@ % %<*11pt> \@setfontsize\normalsize\@xipt{13.6}% \abovedisplayskip 11\p@ \@plus3\p@ \@minus6\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@ % %<*12pt> \@setfontsize\normalsize\@xiipt{14.5}% \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@ % %<*14pt> \@setfontsize\normalsize\@xivpt{17.5}% \abovedisplayskip 14\p@ \@plus3\p@ \@minus8\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 7\p@ \@plus3.5\p@ \@minus3\p@ % %<*17pt> \@setfontsize\normalsize\@xviipt{22}% \abovedisplayskip 15\p@ \@plus4\p@ \@minus8\p@ \abovedisplayshortskip \z@ \@plus4\p@ \belowdisplayshortskip 8\p@ \@plus4\p@ \@minus3\p@ % % \end{macrocode} % The |\belowdisplayskip| is always equal to the % |\abovedisplayskip|. The parameters of the first level list are % always given by |\@listI|. % \begin{macrocode} \belowdisplayskip \abovedisplayskip \let\@listi\@listI} % \end{macrocode} % % We initially choose the normalsize font. % \begin{macrocode} \normalsize % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\small} % This code is similar to that for |\normalsize|. % \begin{macrocode} \newcommand{\small}{% %<*9pt> \@setfontsize\small\@viiipt{9.5} \abovedisplayskip 6\p@ \@plus 2\p@ \@minus 4\p@ \abovedisplayshortskip \z@ \@plus 2\p@ \belowdisplayshortskip 4\p@ \@plus 2\p@ \@minus 2\p@ \def\@listi{\leftmargin\leftmargini \topsep 2\p@ \@plus 2\p@ \@minus 2\p@ \parsep 1\p@ \@plus\p@ \@minus\p@ \itemsep \parsep %% \itemindent\z@ }% % %<*10pt> \@setfontsize\small\@ixpt{11}% \abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@ \abovedisplayshortskip \z@ \@plus2\p@ \belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@ \def\@listi{\leftmargin\leftmargini \topsep 4\p@ \@plus2\p@ \@minus2\p@ \parsep 2\p@ \@plus\p@ \@minus\p@ \itemsep \parsep %% \itemindent\z@ }% % %<*11pt> \@setfontsize\small\@xpt\@xiipt \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@ \def\@listi{\leftmargin\leftmargini \topsep 6\p@ \@plus2\p@ \@minus2\p@ \parsep 3\p@ \@plus2\p@ \@minus\p@ \itemsep \parsep %% \itemindent\z@ }% % %<*12pt> \@setfontsize\small\@xipt{13.6} \abovedisplayskip 11\p@ \@plus3\p@ \@minus6\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@ \def\@listi{\leftmargin\leftmargini \topsep 9\p@ \@plus3\p@ \@minus5\p@ \parsep 4.5\p@ \@plus2\p@ \@minus\p@ \itemsep \parsep %% \itemindent\z@ }% % %<*14pt> \@setfontsize\small\@xiipt{14.5} \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@ \def\@listi{\leftmargin\leftmargini \topsep 11\p@ \@plus4\p@ \@minus6\p@ \parsep 6\p@ \@plus3\p@ \@minus\p@ \itemsep \parsep %% \itemindent\z@ }% % %<*17pt> \@setfontsize\small\@xivpt{17} \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 7\p@ \@plus4\p@ \@minus3\p@ \def\@listi{\leftmargin\leftmargini \topsep 11\p@ \@plus4\p@ \@minus6\p@ \parsep 6\p@ \@plus3\p@ \@minus\p@ \itemsep \parsep %% \itemindent\z@ }% % \belowdisplayskip \abovedisplayskip } % \end{macrocode} % \end{macro} % % \begin{macro}{\footnotesize} % This code is similar to that for |\normalsize|. % \begin{macrocode} \newcommand{\footnotesize}{% %<*9pt> \@setfontsize\footnotesize\@viipt{8} \abovedisplayskip 6\p@ \@plus 2\p@ \@minus 4\p@ \abovedisplayshortskip \z@ \@plus 2\p@ \belowdisplayshortskip 4\p@ \@plus 2\p@ \@minus 2\p@ \def\@listi{\leftmargin\leftmargini \topsep 2\p@ \@plus 2\p@ \@minus 2\p@ \parsep 1\p@ \@plus\p@ \@minus\p@ \itemsep \parsep %% \itemindent\z@ }% % %<*10pt> \@setfontsize\footnotesize\@viiipt{9.5}% \abovedisplayskip 6\p@ \@plus2\p@ \@minus4\p@ \abovedisplayshortskip \z@ \@plus\p@ \belowdisplayshortskip 3\p@ \@plus\p@ \@minus2\p@ \def\@listi{\leftmargin\leftmargini \topsep 3\p@ \@plus\p@ \@minus\p@ \parsep 2\p@ \@plus\p@ \@minus\p@ \itemsep \parsep %% \itemindent\z@ }% % %<*11pt> \@setfontsize\footnotesize\@ixpt{11}% \abovedisplayskip 8\p@ \@plus2\p@ \@minus4\p@ \abovedisplayshortskip \z@ \@plus\p@ \belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@ \def\@listi{\leftmargin\leftmargini \topsep 4\p@ \@plus2\p@ \@minus2\p@ \parsep 2\p@ \@plus\p@ \@minus\p@ \itemsep \parsep %% \itemindent\z@ }% % %<*12pt> \@setfontsize\footnotesize\@xpt\@xiipt \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@ \def\@listi{\leftmargin\leftmargini \topsep 6\p@ \@plus2\p@ \@minus2\p@ \parsep 3\p@ \@plus2\p@ \@minus\p@ \itemsep \parsep %% \itemindent\z@ }% % %<*14pt> \@setfontsize\footnotesize\@xipt{13.6}% \abovedisplayskip 11\p@ \@plus3\p@ \@minus6\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@ \def\@listi{\leftmargin\leftmargini \topsep 6.5\p@ \@plus3.5\p@ \@minus3\p@ \parsep 4\p@ \@plus3\p@ \@minus\p@ \itemsep \parsep %% \itemindent\z@ }% % %<*17pt> \@setfontsize\footnotesize\@xiipt{14}% \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@ \def\@listi{\leftmargin\leftmargini \topsep 6.5\p@ \@plus3.5\p@ \@minus3\p@ \parsep 4\p@ \@plus3\p@ \@minus\p@ \itemsep \parsep %% \itemindent\z@ }% % \belowdisplayskip \abovedisplayskip } % \end{macrocode} % \end{macro} % % \begin{macro}{\miniscule} % \begin{macro}{\scriptsize} % \begin{macro}{\tiny} % \begin{macro}{\large} % \begin{macro}{\Large} % \begin{macro}{\LARGE} % \begin{macro}{\huge} % \begin{macro}{\Huge} % \begin{macro}{\HUGE} % These are all much simpler than the previous macros, they just % select a new fontsize, but leave the parameters for displays and % lists alone. % \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}} % %<*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}} % %<*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 % %<*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 % %<*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 % %<*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 % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macrocode} % %<*class> % \end{macrocode} % % \begin{macro}{\captionsize} % This internal command holds the font size for captions. % \begin{macrocode} \newcommand{\captionsize}{\normalsize} % \end{macrocode} % \end{macro} % % \subsection{Paragraphing} % % \begin{macro}{\lineskip} % \begin{macro}{\normallineskip} % These parameters control \TeX's behaviour when two lines tend to % come too close together. % \begin{macrocode} \setlength\lineskip{1\p@} \setlength\normallineskip{1\p@} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\baselinestretch} % This is used as a multiplier for |\baselineskip|. The default is % to \emph{not} stretch the baselines. % \begin{macrocode} \renewcommand{\baselinestretch}{} % \end{macrocode} % \end{macro} % % % \begin{macro}{\parskip} % \begin{macro}{\onelineskip} % % |\parskip| is additional vertical space between paragraphs; default % is zero. % % % |\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@} % %<*9pt|10pt|11pt|12pt|14pt|17pt> %<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@} % \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. % \begin{macrocode} \if@twocolumn \setlength\parindent{1em} \else %<9pt> \setlength\parindent{12\p@} %<10pt> \setlength\parindent{15\p@} %<11pt> \setlength\parindent{17\p@} %<12pt> \setlength\parindent{1.5em} %<14pt> \setlength\parindent{1.5em} %<17pt> \setlength\parindent{1.5em} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\smallskipamount} % \begin{macro}{\medskipamount} % \begin{macro}{\bigskipamount} % The values for these three parameters are set in the LaTeX kernel. % Historically they have been size invariant. % \begin{macrocode} \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@} % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\@lowpenalty} % \begin{macro}{\@medpenalty} % \begin{macro}{\@highpenalty}% % The commands |\nopagebreak| and |\nolinebreak| put in penalties % to discourage these breaks at the point they are put in. % They use |\@lowpenalty|, |\@medpenalty| or |\@highpenalty|, % dependent on their argument. % \begin{macrocode} %<*class> \@lowpenalty 51 \@medpenalty 151 \@highpenalty 301 % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\clubpenalty} % \begin{macro}{\widowpenalty} % These penalties are used to discourage club and widow lines. % The default values are 150 each, but we want stronger discouragement. % \begin{macrocode} \clubpenalty 1000 \widowpenalty 1000 % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\displaywidowpenalty} % \begin{macro}{\predisplaypenalty} % \begin{macro}{\postdisplaypenalty} % Discourage, but do not prevent, widows in front of a math display % and forbid breaking directly in front of a display. Allow break % after a display without a penalty. The default values are % used, therefore we only show them here. % \begin{macrocode} % \displaywidowpenalty 50 % \predisplaypenalty 10000 % \postdisplaypenalty 0 % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\interlinepenalty} % Allow the breaking of a page in the middle of a paragraph. % \begin{macrocode} % \interlinepenalty 0 % \end{macrocode} % \end{macro} % % % \begin{macro}{\brokenpenalty} % We allow the breaking of a page after a hyphenated line. % \begin{macrocode} % \brokenpenalty 100 % \end{macrocode} % \end{macro} % % \begin{macro}{\hangpara} % |\hangpara{|\meta{indent}|}{|\meta{afternum}|}| at the start of a % paragraph will make it hung. If \meta{indent} is positive the left % will be indented, otherwise the right. If \meta{afternum}, say N, % is positive the N+1 th lines onwards will be indented. For N negative, % the first N lines will be indented. % \begin{macrocode} \newcommand{\hangpara}[2]{\hangindent#1\hangafter#2\noindent} % \end{macrocode} % \end{macro} % % \begin{environment}{hangparas} % |\begin{hangparas}{|\meta{indent}|}{|\meta{afternum}|}| hangs % a series of paragraphs. % \begin{macrocode} \newenvironment{hangparas}[2]{\setlength{\parindent}{\z@} \everypar={\hangpara{#1}{#2}}}{\par} % \end{macrocode} % \end{environment} % % % % \subsection{Page Layout} % % All margin dimensions are measured from a point one inch from the % top and lefthand side of the page. % % \subsubsection{Vertical spacing} % % \begin{macro}{\headheight} % \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 |\headsep| is the distance between the bottom % of the running head and the top of the text. % % The |\topskip| is the % |\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! % % 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|. % \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} % %<*9pt|10pt|11pt|12pt|14pt|17pt> %<*9pt> \setlength\headheight{11\p@} \setlength\headsep{.225in} \setlength\topskip{9\p@} \setlength\footskip{.33in} % %<*10pt> \setlength\headheight{12\p@} \setlength\headsep{.25in} \setlength\topskip{10\p@} \setlength\footskip{.35in} % %<*11pt> \setlength\headheight{13.6\p@} \setlength\headsep{.275in} \setlength\topskip{11\p@} \setlength\footskip{.38in} % %<*12pt> \setlength\headheight{14\p@} \setlength\headsep{.275in} \setlength\topskip{12\p@} \setlength\footskip{30\p@} % %<*14pt> \setlength\headheight{17.5\p@} \setlength\headsep{.30in} \setlength\topskip{14.4\p@} \setlength\footskip{.4in} % %<*17pt> \setlength\headheight{22\p@} \setlength\headsep{.30in} \setlength\topskip{14.4\p@} \setlength\footskip{.4in} % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \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 % 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|. % \begin{macrocode} \setlength\maxdepth{.5\topskip} \setlength\@maxdepth\maxdepth % \end{macrocode} % \end{macro} % \end{macro} % % \subsubsection{The dimension of text} % % \begin{macro}{\lxvchars} % The length |\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} %<9pt>\setlength\lxvchars{276\p@} % %<10pt>\setlength\lxvchars{300\p@} % standard 345pt %<11pt>\setlength\lxvchars{324\p@} % standard 360pt %<12pt>\setlength\lxvchars{336\p@} % standard 390pt %<14pt>\setlength\lxvchars{408\p@} % %<17pt>\setlength\lxvchars{444\p@} % % \end{macrocode} % \end{macro} % % \begin{macro}{\xlvchars} % The length |\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). % \begin{macrocode} %<9pt>\setlength\xlvchars{192\p@} % %<10pt>\setlength\xlvchars{204\p@} % %<11pt>\setlength\xlvchars{216\p@} % %<12pt>\setlength\xlvchars{240\p@} % %<14pt>\setlength\xlvchars{288\p@} % %<17pt>\setlength\xlvchars{312\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 % separation between the notes. % \begin{macrocode} \if@twocolumn \setlength\marginparsep{10\p@} \else \setlength\marginparsep{7\p@} \fi %<9pt|10pt|11pt>\setlength{\marginparpush}{5\p@} %<12pt|14pt>\setlength{\marginparpush}{7\p@} %<17pt>\setlength{\marginparpush}{10\p@} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macrocode} % %<*class> % \end{macrocode} % % \begin{macro}{\setrectanglesize} % The macro |\setrectanglesize{|\meta{H}|}{|\meta{W}|}{|\meta{r}|}| % calculates the height and width of a rectangle given any two out of % the three arguments. An unvalued argument is denoted by |*|. % % 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 % 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} % \MakeShortVerb{\|} % \end{table} % % The % calculated height and width are stored in |\@tempdima| and |\@tempdimb| % respectively. Both lengths are set to zero if there is an error. % \begin{macrocode} \newcommand{\setrectanglesize}[3]{% \nametest{#1}{*} \ifsamename % H = * \nametest{#2}{*} \ifsamename % W = * \ClassError{memoir}{% The combination of argument values is ambiguous.\MessageBreak The lengths will be set to zero}{\@ehd} \@tempdima = \z@ \@tempdimb = \z@ \else % W \nametest{#3}{*} \ifsamename % r = * \@tempdimb = #2\relax \@tempdima = \@tempdimb \else % r \@tempdimb = #2\relax \@tempdima = #3\@tempdimb \fi \fi \else % H \nametest{#2}{*} \ifsamename % W = * \nametest{#3}{*} \ifsamename % r = * \@tempdima = #1\relax \@tempdimb = \@tempdima \else % r \@tempdima = #1\relax \@tempdimb = #3\@tempdima \fi \else % W \@tempdima = #1\relax \@tempdimb = #2\relax \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 % |\setfillsize{|\meta{T}|}{|\meta{C}|}{|\meta{L}|}{|\meta{R}|}{|\meta{r}|}| % maintains these constraints among the variables, where an unvalued % argument is denoted by |*|. % % 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 % 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} % \MakeShortVerb{\|} % \end{table} % % % The % calculated values of |C|, |L| and |R| are stored |\@tempdimc|, % |\@tempdima| and |\@tempdimb| respectively. If there is an error % the lengths are set to zero. % \begin{macrocode} \newcommand{\setfillsize}[5]{% \nametest{#2}{*} \ifsamename % C = * \nametest{#3}{*} \ifsamename % L = * \nametest{#4}{*} \ifsamename % R = * \ClassError{memoir}{% The combination of argument values is ambiguous.\MessageBreak The lengths will be set to zero}{\@ehd} \@tempdima = \z@ \@tempdimb = \z@ \@tempdimc = \z@ \else % R \nametest{#5}{*} \ifsamename % r = * \@tempdimb = #4\relax \@tempdima = \@tempdimb \@tempdimc = #1\relax \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \else % r \@tempdimb = #4\relax \@tempdima = #5\@tempdimb \@tempdimc = #1\relax \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \fi \fi \else % L \nametest{#4}{*} \ifsamename % R = * \nametest{#5}{*} \ifsamename % r = * \@tempdima = #3\relax \@tempdimb = \@tempdima \@tempdimc = #1\relax \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \else % r \@tempdima = #3\relax \@tempdimb = #5\@tempdima \@tempdimc = #1\relax \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \fi \else % R \@tempdima = #3\relax \@tempdimb = #4\relax \@tempdimc = #1\relax \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \fi \fi \else % C is valued \nametest{#3}{*} \ifsamename % L = * \nametest{#4}{*} \ifsamename % R = * \nametest{#5}{*} \ifsamename % r = * \@tempdimc = #2\relax \@tempdima = #1\relax \advance\@tempdima -\@tempdimc \@tempdima = 0.5\@tempdima \@tempdimb = \@tempdima \else % r (CODE PERHAPS FIXED) \@tempdimc = #2\relax % C \@tempdimb = #1\relax % 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 \@tempdimc = #2\relax \@tempdimb = #4\relax \@tempdima = #1\relax \advance\@tempdima -\@tempdimc \advance\@tempdima -\@tempdimb \fi \else % L \nametest{#4}{*} \ifsamename % R = * \@tempdimc = #2\relax \@tempdima = #3\relax \@tempdimb = #1\relax \advance\@tempdimb -\@tempdimc \advance\@tempdimb -\@tempdima \else % R \ClassError{memoir}{% The combination of argument values is ambiguous.\MessageBreak The lengths will be set to zero}{\@ehd} \@tempdima = \z@ \@tempdimb = \z@ \@tempdimc = #2\relax \fi \fi \fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\setstocksize} % \begin{macro}{\settrims} % \begin{macro}{\settrimmedsize} % |\setstocksize{|\meta{height}|}{|\meta{width}|}| sets the height % and width of the stock material and % |\settrims{|\meta{top}|}{|\meta{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|. % \begin{macrocode} \newcommand{\setstocksize}[2]{% \setlength{\stockheight}{#1} \setlength{\stockwidth}{#2} } \newcommand{\settrims}[2]{% \setlength{\trimtop}{#1} \setlength{\trimedge}{#2} } \newcommand{\settrimmedsize}[3]{% \setrectanglesize{#1}{#2}{#3} \setlength{\paperheight}{\@tempdima} \setlength{\paperwidth}{\@tempdimb} } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\settypeblocksize} % |\settypeblocksize{|\meta{height}|}{|\meta{width}|}{|\meta{ratio}|}| % calulates the |\textheight| and |\textwidth| from two out of the % three arguments. % \begin{macrocode} \newcommand{\settypeblocksize}[3]{% \setrectanglesize{#1}{#2}{#3} \setlength{\textheight}{\@tempdima} \setlength{\textwidth}{\@tempdimb} } % \end{macrocode} % \end{macro} % % \begin{macro}{\spinemargin} % \begin{macro}{\foremargin} % \begin{macro}{\setlrmargins} % |\setlrmargins{|\meta{L}|}{|\meta{R}|}{|\meta{r}|}| sets the Left (spine) % and Right (fore edge) margins with constant typeblock. % \begin{macrocode} \newlength{\spinemargin} \newlength{\foremargin} \newcommand{\setlrmargins}[3]{% \setfillsize{\paperwidth}{\textwidth}{#1}{#2}{#3} \setlength{\textwidth}{\@tempdimc} \setlength{\spinemargin}{\@tempdima} \setlength{\foremargin}{\@tempdimb} } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\setlrmarginsandblock} % |\setlrmarginsandblock{|\meta{L}|}{|\meta{R}|}{|\meta{r}|}| sets the Left (spine) % and Right (fore edge) margins with variable typeblock. % \begin{macrocode} \newcommand{\setlrmarginsandblock}[3]{% \setfillsize{\paperwidth}{*}{#1}{#2}{#3} \setlength{\textwidth}{\@tempdimc} \setlength{\spinemargin}{\@tempdima} \setlength{\foremargin}{\@tempdimb} } % \end{macrocode} % \end{macro} % % \begin{macro}{\uppermargin} % \begin{macro}{\lowermargin} % \begin{macro}{\setulmargins} % |\setulmargins{|\meta{L}|}{|\meta{R}|}{|\meta{r}|}| sets the Left (upper) % and Right (lower) margins with constant typeblock. % \begin{macrocode} \newlength{\uppermargin} \newlength{\lowermargin} \newcommand{\setulmargins}[3]{% \setfillsize{\paperheight}{\textheight}{#1}{#2}{#3} \setlength{\textheight}{\@tempdimc} \setlength{\uppermargin}{\@tempdima} \setlength{\lowermargin}{\@tempdimb} } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\setulmarginsandblock} % |\setulmarginsandblock{|\meta{L}|}{|\meta{R}|}{|\meta{r}|}| sets the Left (upper) % and Right (lower) margins with variable typeblock. % \begin{macrocode} \newcommand{\setulmarginsandblock}[3]{% \setfillsize{\paperheight}{*}{#1}{#2}{#3} \setlength{\textheight}{\@tempdimc} \setlength{\uppermargin}{\@tempdima} \setlength{\lowermargin}{\@tempdimb} } % \end{macrocode} % \end{macro} % % \begin{macro}{\headdrop} % \begin{macro}{\setheaderspaces} % |\setheaderspaces{|\meta{L}|}{|\meta{R}|}{|\meta{r}|}| sets the Left (head margin) % and Right (headsep) spacing with constant headheight. % \begin{macrocode} \newlength{\headdrop} \newcommand{\setheaderspaces}[3]{% \setfillsize{\uppermargin}{\headheight}{#1}{#2}{#3} \setlength{\headheight}{\@tempdimc} \setlength{\headdrop}{\@tempdima} \setlength{\headsep}{\@tempdimb} } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\setheadfoot} % |\setheadfoot{|\meta{headheight}|}{|\meta{footskip}|}| % sets the headheight and the footskip. % \begin{macrocode} \newcommand{\setheadfoot}[2]{% \setlength{\headheight}{#1} \setlength{\footskip}{#2} } % \end{macrocode} % \end{macro} % % \begin{macro}{\setcolsepandrule} % |\setcolsepandrule{|\meta{colsep}|}{|\meta{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.} % \begin{macrocode} \newcommand{\setcolsepandrule}[2]{% \setlength{\columnsep}{#1} \setlength{\columnseprule}{#2} } % \end{macrocode} % \end{macro} % % \begin{macro}{\setmarginnotes} % |\setmarginnotes{|\meta{sep}|}{|\meta{width}|}{|\meta{push}|}| % sets the marginpar parameters. % \begin{macrocode} \newcommand{\setmarginnotes}[3]{% \setlength{\marginparsep}{#1} \setlength{\marginparwidth}{#2} \setlength{\marginparpush}{#3} } % \end{macrocode} % \end{macro} % % % % Initialise the paper size and trimming to their default values. % \begin{macrocode} \settrimmedsize{\stockheight}{\stockwidth}{*} \settrims{\z@}{\z@} % \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, % an inch margin on either side. In the standard classes the initial % line length is about 14\% greater than |\lxvchars|. % \begin{macrocode} \setlength{\@tempdimb}{1.14\lxvchars} \setlength\@tempdima{\paperwidth} \addtolength\@tempdima{-2in} % \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|. % \begin{macrocode} \if@twocolumn \ifdim\@tempdima>2\@tempdimb\relax \setlength\textwidth{2\@tempdimb} \else \setlength\textwidth{\@tempdima} \fi % \end{macrocode} % In onecolumn % the text should not be wider than the minumum of the paperwidth (less % 2in for the margins) and the maximum length of the character line. % \begin{macrocode} \else \ifdim\@tempdima>\@tempdimb\relax \setlength\textwidth{\@tempdimb} \else \setlength\textwidth{\@tempdima} \fi \fi % \end{macrocode} % Adjust the width to be a whole number of points. % \begin{macrocode} \@settopoint\textwidth % \end{macrocode} % \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|, % 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|. % \begin{macrocode} \divide\@tempdima\baselineskip \@tempcnta=\@tempdima \setlength\textheight{\@tempcnta\baselineskip} \addtolength\textheight{\topskip} % \end{macrocode} % \end{macro} % % The margins are calculated. % % \begin{macro}{\oddsidemargin} % \begin{macro}{\marginparwidth} % \begin{macro}{\evensidemargin} % The margins depend on the paper size, also for two sided % printing the inner margin is made smaller than the outer. % \begin{macrocode} \if@twoside \setlength\@tempdima {\paperwidth} \addtolength\@tempdima {-\textwidth} \setlength\oddsidemargin {.4\@tempdima} \addtolength\oddsidemargin {-1in} \setlength\marginparwidth {.6\@tempdima} \addtolength\marginparwidth{-\marginparsep} \addtolength\marginparwidth{-0.4in} \else \setlength\@tempdima {\paperwidth} \addtolength\@tempdima {-\textwidth} \setlength\oddsidemargin {.5\@tempdima} \addtolength\oddsidemargin {-1in} \setlength\marginparwidth {.5\@tempdima} \addtolength\marginparwidth{-\marginparsep} \addtolength\marginparwidth{-0.8in} % don't know why this is .8 and not .4 \fi \ifdim\marginparwidth>2in \setlength\marginparwidth{2in} \fi % \end{macrocode} % Set these values to integer numbers of points, and calculate the % |\evensidemargin|. % \begin{macrocode} \@settopoint\oddsidemargin \@settopoint\marginparwidth \setlength\evensidemargin {\paperwidth} \addtolength\evensidemargin{-2in} \addtolength\evensidemargin{-\textwidth} \addtolength\evensidemargin{-\oddsidemargin} \@settopoint\evensidemargin % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\topmargin} % The |\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} \setlength\topmargin {\paperheight} \addtolength\topmargin{-2in} \addtolength\topmargin{-\headheight} \addtolength\topmargin{-\headsep} \addtolength\topmargin{-\textheight} \addtolength\topmargin{-\footskip} \addtolength\topmargin{-.5\topmargin} \@settopoint\topmargin % \end{macrocode} % \end{macro} % % 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|. % % We can get the spine % and edge margins from the |\oddsidemargin|. % \begin{macrocode} \setlength{\spinemargin}{\oddsidemargin} \addtolength{\spinemargin}{1in} \setlrmargins{\spinemargin}{*}{*} % \end{macrocode} % % Similarly we can get the upper and lower margins from the % |\topmargin|, |\headheight| and |\headskip|. % \begin{macrocode} \setlength{\uppermargin}{\topmargin} \addtolength{\uppermargin}{1in} \addtolength{\uppermargin}{\headheight} \addtolength{\uppermargin}{\headsep} \setulmargins{\uppermargin}{*}{*} % \end{macrocode} % % \begin{macro}{\checkthelayout} % This macro checks that the current layout dimensions are sensible and % checks the arithmetic. % % First check the dimensions are not negative. % \changes{v1.0a}{2002/01/18}{Added \cs{checkthelayout}} % \begin{macrocode} \newcommand{\checkthelayout}{% \ifdim\stockwidth>\z@\else \ClassError{memoir}{\protect\stockwidth\space is zero or negative}% {\@ehd} \fi \ifdim\trimedge<\z@ \ClassError{memoir}{\protect\trimedge\space is negative}% {\@ehd} \fi \ifdim\paperwidth>\z@\else \ClassError{memoir}{\protect\paperwidth\space is zero or negative}% {\@ehd} \fi \ifdim\textwidth>\z@\else \ClassError{memoir}{\protect\textwidth\space is zero or negative}% {\@ehd} \fi \ifdim\spinemargin>\z@\else \ClassError{memoir}{\protect\spinemargin\space is zero or negative}% {\@ehd} \fi \ifdim\foremargin>\z@\else \ClassError{memoir}{\protect\foremargin\space is zero or negative}% {\@ehd} \fi \ifdim\marginparsep>\z@\else \ClassError{memoir}{\protect\marginparsep\space is zero or negative}% {\@ehd} \fi \ifdim\marginparwidth>\z@\else \ClassError{memoir}{\protect\marginparwidth\space is zero or negative}% {\@ehd} \fi \ifdim\stockheight>\z@\else \ClassError{memoir}{\protect\stockheight\space is zero or negative}% {\@ehd} \fi \ifdim\trimtop<\z@ \ClassError{memoir}{\protect\trimtop\space is negative}% {\@ehd} \fi \ifdim\paperheight>\z@\else \ClassError{memoir}{\protect\paperheight\space is zero or negative}% {\@ehd} \fi \ifdim\textheight>\z@\else \ClassError{memoir}{\protect\textheight\space is zero or negative}% {\@ehd} \fi \ifdim\uppermargin>\z@\else \ClassError{memoir}{\protect\uppermargin\space is zero or negative}% {\@ehd} \fi \ifdim\lowermargin>\z@\else \ClassError{memoir}{\protect\lowermargin\space is zero or negative}% {\@ehd} \fi \ifdim\headheight>\z@\else \ClassError{memoir}{\protect\headheight\space is zero or negative}% {\@ehd} \fi \ifdim\headsep>\z@\else \ClassError{memoir}{\protect\headsep\space is zero or negative}% {\@ehd} \fi \ifdim\footskip>\z@\else \ClassError{memoir}{\protect\footskip\space is zero or negative}% {\@ehd} \fi % \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} \setulmargins{\uppermargin}{*}{*} % \end{macrocode} % % Check that all the sums add up correctly, or % at least to within a small (|\@tempdimb|) error. % \begin{macrocode} \@tempdimb = -1pt \@tempdima=\stockwidth \advance\@tempdima -\trimedge \advance\@tempdima -\paperwidth \ifdim\@tempdima<\@tempdimb \@tempdima = -\@tempdima \ClassError{memoir}{\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 \ClassError{memoir}{\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 \ClassError{memoir}{\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 \ClassError{memoir}{\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 \ClassError{memoir}{\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 \ClassError{memoir}{\protect\footskip is too large for \protect\lowermargin\space by \the\@tempdima}% {\@ehd} \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}{% \topmargin = \trimtop \advance\topmargin \uppermargin \advance\topmargin -\headsep \advance\topmargin -\headheight \advance\topmargin -1in % \end{macrocode} % % Now the |\oddsidemargin|. % \begin{macrocode} \oddsidemargin = \stockwidth \advance\oddsidemargin -\trimedge \advance\oddsidemargin -\paperwidth \advance\oddsidemargin \spinemargin \advance\oddsidemargin -1in % \end{macrocode} % % And the |\evensidemargin|. % \begin{macrocode} \evensidemargin = \trimedge \advance\evensidemargin \foremargin \advance\evensidemargin -1in % \end{macrocode} % % % Set the values to the nearest whole point. % \begin{macrocode} \@settopoint\textwidth \@settopoint\oddsidemargin \@settopoint\evensidemargin } % \end{macrocode} % \end{macro} % % \begin{macro}{\typeoutlayout} % 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}} % \begin{macrocode} \newcommand{\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{******************************************************} \typeout{} } % \end{macrocode} % \end{macro} % % \begin{macro}{\checkandfixthelayout} % This macro checks and fixes the layout, and reports the result. % \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 \fixthelayout \typeoutlayout } % \end{macrocode} % \end{macro} % % \begin{macro}{\typeoutstandardlayout} % Types out the current values of the standard page layout parameters. % \changes{v1.0a}{2002/01/25}{Added \cs{typeoutstandardlayout}} % \begin{macrocode} \newcommand{\typeoutstandardlayout}{% \typeout{} \typeout{******************************************************} \typeout{Page height and width: \the\paperheight\space by \the\paperwidth} \typeout{Text height and width: \the\textheight\space by \the\textwidth} \typeout{Oddside and evenside margins: \the\oddsidemargin\space and \the\evensidemargin} \typeout{Topmargin and footskip: \the\topmargin\space and \the\footskip} \typeout{Headheight and headsep: \the\headheight\space and \the\headsep} \typeout{Columnsep and columnseprule: \the\columnsep\space and \the\columnseprule} \typeout{Marginparsep and marginparwidth: \the\marginparsep\space and \the\marginparwidth} \typeout{******************************************************} \typeout{} } % \end{macrocode} % \end{macro} % % % % % % \subsubsection{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 % \begin{macrocode} % %<*9pt|10pt|11pt|12pt|14pt|17pt> % \end{macrocode} % % \begin{macrocode} %<9pt>\setlength\footnotesep{6.0\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@} %% ???????? % \end{macrocode} % \end{macro} % % \begin{macro}{\footins} % |\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@} %<10pt>\setlength{\skip\footins}{9\p@ \@plus 4\p@ \@minus 2\p@} %<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@} % \end{macrocode} % \end{macro} % % \subsubsection{Float placement parameters} % % \begin{macrocode} % %<*class> % \end{macrocode} % % 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|. % % \paragraph{Limits for the placement of floating objects} % % The settings here make it easier to place floats than with the % standard classes. % % \begin{macro}{\c@topnumber} % The \Lcount{topnumber} counter holds the maximum number of % floats that can appear on the top of a text page (classically 2) % \begin{macrocode} \setcounter{topnumber}{3} % \end{macrocode} % \end{macro} % % \begin{macro}{\topfraction} % This indicates the maximum part of a text page that can be % occupied by floats at the top (classically 0.7). % \begin{macrocode} \renewcommand{\topfraction}{.85} % \end{macrocode} % \end{macro} % % \begin{macro}{\c@bottomnumber} % The \Lcount{bottomnumber} counter holds the maximum number of % floats that can appear on the bottom of a text page (classically 1). % \begin{macrocode} \setcounter{bottomnumber}{2} % \end{macrocode} % \end{macro} % % \begin{macro}{\bottomfraction} % This indicates the maximum part of a text page that can be % occupied by floats at the bottom (classically 0.3). % \begin{macrocode} \renewcommand{\bottomfraction}{.5} % \end{macrocode} % \end{macro} % % \begin{macro}{\c@totalnumber} % This indicates the maximum number of floats that can appear on % any text page (classically 3). % \begin{macrocode} \setcounter{totalnumber}{4} % \end{macrocode} % \end{macro} % % \begin{macro}{\textfraction} % This indicates the minimum part of a text page that has to be % occupied by text (classically 0.2). % \begin{macrocode} \renewcommand{\textfraction}{.1} % \end{macrocode} % \end{macro} % % \begin{macro}{\floatpagefraction} % This indicates the minimum part of a page that has to be % occupied by floating objects before a `float page' is % produced (classically 0.5). % \begin{macrocode} \renewcommand{\floatpagefraction}{.7} % \end{macrocode} % \end{macro} % % \begin{macro}{\c@dbltopnumber} % The \Lcount{dbltopnumber} counter holds the maximum number of % two column floats that can appear on the top of a two column text % page (classically 2). % \begin{macrocode} \setcounter{dbltopnumber}{3} % \end{macrocode} % \end{macro} % % \begin{macro}{\dbltopfraction} % This indicates the maximum part of a two column text page that % can be occupied by two column floats at the top (classically 0.7). % \begin{macrocode} \renewcommand{\dbltopfraction}{.85} % \end{macrocode} % \end{macro} % % \begin{macro}{\dblfloatpagefraction} % This indicates the minimum part of a page that has to be % occupied by two column wide floating objects before a `float % page' is produced (classically 0.5). % \begin{macrocode} \renewcommand{\dblfloatpagefraction}{.7} % \end{macrocode} % \end{macro} % % \paragraph{Floats on a text page} % % \begin{macrocode} % %<*9pt|10pt|11pt|12pt|14pt|17pt> % \end{macrocode} % % \begin{macro}{\floatsep} % \begin{macro}{\textfloatsep} % \begin{macro}{\intextsep} % When a floating object is placed on a page with text, these % parameters control the separation between the float and the other % 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. % % |\textfloatsep| is the space between the main text and floats % at the top or bottom of the page. % % |\intextsep| is the space between in-text floats and the text. % \begin{macrocode} %<*9pt> \setlength\floatsep {12\p@ \@plus 2\p@ \@minus 2\p@} \setlength\textfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@} \setlength\intextsep {12\p@ \@plus 2\p@ \@minus 2\p@} % %<*10pt> \setlength\floatsep {12\p@ \@plus 2\p@ \@minus 2\p@} \setlength\textfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@} \setlength\intextsep {12\p@ \@plus 2\p@ \@minus 2\p@} % %<*11pt> \setlength\floatsep {12\p@ \@plus 2\p@ \@minus 2\p@} \setlength\textfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@} \setlength\intextsep {12\p@ \@plus 2\p@ \@minus 2\p@} % %<*12pt> \setlength\floatsep {12\p@ \@plus 2\p@ \@minus 2\p@} \setlength\textfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@} \setlength\intextsep {14\p@ \@plus 4\p@ \@minus 4\p@} % %<*14pt> \setlength\floatsep {14\p@ \@plus 4\p@ \@minus 4\p@} \setlength\textfloatsep{20\p@ \@plus 4\p@ \@minus 4\p@} \setlength\intextsep {14\p@ \@plus 4\p@ \@minus 4\p@} % %<*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@} % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\dblfloatsep} % \begin{macro}{\dbltextfloatsep} % When floating objects that span the whole |\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|. % % |\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 % at the top or bottom of the page. % % \begin{macrocode} %<*9pt> \setlength\dblfloatsep {12\p@ \@plus 2\p@ \@minus 2\p@} \setlength\dbltextfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@} % %<*10pt> \setlength\dblfloatsep {12\p@ \@plus 2\p@ \@minus 2\p@} \setlength\dbltextfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@} % %<*11pt> \setlength\dblfloatsep {12\p@ \@plus 2\p@ \@minus 2\p@} \setlength\dbltextfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@} % %<*12pt> \setlength\dblfloatsep {14\p@ \@plus 2\p@ \@minus 4\p@} \setlength\dbltextfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@} % %<*14pt> \setlength\dblfloatsep {14\p@ \@plus 2\p@ \@minus 4\p@} \setlength\dbltextfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@} % %<*17pt> \setlength\dblfloatsep {15\p@ \@plus 4\p@ \@minus 4\p@} \setlength\dbltextfloatsep{25\p@ \@plus 5\p@ \@minus 5\p@} % % \end{macrocode} % \end{macro} % \end{macro} % % \paragraph{Floats on their own page or column} % % \begin{macro}{\@fptop} % \begin{macro}{\@fpsep} % \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. % % 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 % remaining empty space. % \begin{macrocode} %<*9pt> \setlength\@fptop{0\p@ \@plus 1fil} \setlength\@fpsep{9\p@ \@plus 2fil} \setlength\@fpbot{0\p@ \@plus 1fil} % %<*10pt> \setlength\@fptop{0\p@ \@plus 1fil} \setlength\@fpsep{8\p@ \@plus 2fil} \setlength\@fpbot{0\p@ \@plus 1fil} % %<*11pt> \setlength\@fptop{0\p@ \@plus 1fil} \setlength\@fpsep{8\p@ \@plus 2fil} \setlength\@fpbot{0\p@ \@plus 1fil} % %<*12pt> \setlength\@fptop{0\p@ \@plus 1fil} \setlength\@fpsep{10\p@ \@plus 2fil} \setlength\@fpbot{0\p@ \@plus 1fil} % %<*14pt> \setlength\@fptop{0\p@ \@plus 1fil} \setlength\@fpsep{10\p@ \@plus 2fil} \setlength\@fpbot{0\p@ \@plus 1fil} % %<*17pt> \setlength\@fptop{0\p@ \@plus 1fil} \setlength\@fpsep{12\p@ \@plus 2fil} \setlength\@fpbot{0\p@ \@plus 1fil} % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@dblfptop} % \begin{macro}{\@dblfpsep} % \begin{macro}{\@dblfpbot} % Double column floats in two column mode are handled with similar % parameters. % \begin{macrocode} %<*9pt> \setlength\@dblfptop{0\p@ \@plus 1fil} \setlength\@dblfpsep{7\p@ \@plus 2fil} \setlength\@dblfpbot{0\p@ \@plus 1fil} % %<*10pt> \setlength\@dblfptop{0\p@ \@plus 1fil} \setlength\@dblfpsep{8\p@ \@plus 2fil} \setlength\@dblfpbot{0\p@ \@plus 1fil} % %<*11pt> \setlength\@dblfptop{0\p@ \@plus 1fil} \setlength\@dblfpsep{8\p@ \@plus 2fil} \setlength\@dblfpbot{0\p@ \@plus 1fil} % %<*12pt> \setlength\@dblfptop{0\p@ \@plus 1fil} \setlength\@dblfpsep{10\p@ \@plus 2fil} \setlength\@dblfpbot{0\p@ \@plus 1fil} % %<*14pt> \setlength\@dblfptop{0\p@ \@plus 1fil} \setlength\@dblfpsep{12\p@ \@plus 2fil} \setlength\@dblfpbot{0\p@ \@plus 1fil} % %<*17pt> \setlength\@dblfptop{0\p@ \@plus 1fil} \setlength\@dblfpsep{12\p@ \@plus 2fil} \setlength\@dblfpbot{0\p@ \@plus 1fil} % % %<*class> % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \subsection{Page Styles} % % The page style \pstyle{foo} is defined by defining the command % |\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. % % \begin{macro}{\@evenhead} % \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 % contents of the heading box for odd-numbered pages. It is called % inside an |\hbox| of width |\textwidth|. % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \subsubsection{Marking conventions} % % To make headings determined by the sectioning commands, the page % style defines the commands |\chaptermark|, |\sectionmark|, % \ldots,\\ % where |\chaptermark{|\meta{TEXT}|}| is called by % |\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| % commands should be initialized to no-ops.) % % \LaTeX{} extends \TeX's |\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. % % |\markright{|\meta{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| % command. % % |\rightmark|: Used in the |\@oddhead|, |\@oddfoot|, |\@evenhead| % or |\@evenfoot| macros, it gets the current % `right' mark. |\rightmark| works like \TeX's % |\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| % command. However, it does produce somewhat anomalous results if % two |\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. % % % % \subsubsection{Defining the page styles} % % 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{}|. % 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 % width of the headers/footers may also be specified, rules may be drawn % below the headers and/or above the footers, and the complete header and/or % footer may be offset with respect to the textblock when the width is not % the same as the textwidth. % % In the following \meta{style} is the name of a pagestyle being defined % (e.g., |ruled|). % % \begin{macro}{\makeevenhead} % The command % |\makeevenhead{|\meta{style}|}{|\meta{left}|}{|\meta{center}|}{|\meta{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. % \begin{macrocode} \newcommand{\makeevenhead}[4]{% \@namedef{#1eheadl}{#2} \@namedef{#1eheadc}{#3} \@namedef{#1eheadr}{#4} } % \end{macrocode} % \end{macro} % % \begin{macro}{\makeoddhead} % \begin{macro}{\makeevenfoot} % \begin{macro}{\makeoddfoot} % These three macros are similar to |\makeevenhead| except that they are % for the oddhead, evenfoot and oddfoot. % \begin{macrocode} \newcommand{\makeoddhead}[4]{% \@namedef{#1oheadl}{#2} \@namedef{#1oheadc}{#3} \@namedef{#1oheadr}{#4} } \newcommand{\makeevenfoot}[4]{% \@namedef{#1efootl}{#2} \@namedef{#1efootc}{#3} \@namedef{#1efootr}{#4} } \newcommand{\makeoddfoot}[4]{% \@namedef{#1ofootl}{#2} \@namedef{#1ofootc}{#3} \@namedef{#1ofootr}{#4} } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\makerunningwidth} % The macro |\makerunningwidth{|\meta{style}|}{|\meta{length}|}| sets the % width of the headers and footers of pagestyle \meta{style} to be \meta{length}. % \begin{macrocode} \newcommand{\makerunningwidth}[2]{% \@namedef{#1runwidth}{#2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\normalrulethickness} % \begin{macro}{\footruleheight} % \begin{macro}{\footruleskip} % \begin{macro}{\makeheadrule} % \begin{macro}{\makefootrule} % |\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 % will appear between the bottom of the textblock and above any actual footer. % \begin{macrocode} \newcommand{\normalrulethickness}{0.4pt} \newcommand{\footruleheight}{\z@skip} \newcommand{\footruleskip}{0.3\normalbaselineskip} % \end{macrocode} % The macro |\makeheadrule{|\meta{style}|}{|\meta{width}|}{|\meta{height}|}| % specifies the width and height of the header rule for \meta{style}. % % Similarly % |\makefootrule{|\meta{style}|}{|\meta{width}|}{|\meta{height}|}{|\meta{skip}|}| % specifies the width, height and skip for the footrule. % \begin{macrocode} \newcommand{\makeheadrule}[3]{% \@namedef{#1headrule}{% \hrule\@width #2\@height #3 \vskip-#3} } \newcommand{\makefootrule}[4]{% \@namedef{#1footrule}{% \vskip-#4\vskip-#3 \hrule\@width #2\@height #3 \vskip #4} } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\makeheadposition} % |\makeheadposition{|\meta{style}|}{|\meta{eheadpos}|}{|\meta{oheadpos}|}{|\meta{efootpos}|}{|\meta{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|. % \begin{macrocode} \newcommand{\makeheadposition}[5]{% % \end{macrocode} % Do the even head position first. % \begin{macrocode} \nametest{flushleft}{#2} \ifsamename \@namedef{#1evenhpl}{\relax} \@namedef{#1evenhpr}{\hss} \else \nametest{flushright}{#2} \ifsamename \@namedef{#1evenhpl}{\hss} \@namedef{#1evenhpr}{\relax} \else \@namedef{#1evenhpl}{\hss} \@namedef{#1evenhpr}{\hss} \fi \fi % \end{macrocode} % And similarly for the odd head and even \& odd footers. % \begin{macrocode} \nametest{flushleft}{#3} \ifsamename \@namedef{#1oddhpl}{\relax} \@namedef{#1oddhpr}{\hss} \else \nametest{flushright}{#3} \ifsamename \@namedef{#1oddhpl}{\hss} \@namedef{#1oddhpr}{\relax} \else \@namedef{#1oddhpl}{\hss} \@namedef{#1oddhpr}{\hss} \fi \fi \nametest{flushleft}{#4} \ifsamename \@namedef{#1evenfpl}{\relax} \@namedef{#1evenfpr}{\hss} \else \nametest{flushright}{#4} \ifsamename \@namedef{#1evenfpl}{\hss} \@namedef{#1evenfpr}{\relax} \else \@namedef{#1evenfpl}{\hss} \@namedef{#1evenfpr}{\hss} \fi \fi \nametest{flushleft}{#5} \ifsamename \@namedef{#1oddfpl}{\relax} \@namedef{#1oddfpr}{\hss} \else \nametest{flushright}{#5} \ifsamename \@namedef{#1oddfpl}{\hss} \@namedef{#1oddfpr}{\relax} \else \@namedef{#1oddfpl}{\hss} \@namedef{#1oddfpr}{\hss} \fi \fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\makepsmarks} % \begin{macro}{\makepshook} % The macro |\makepsmarks{|\meta{style}|}{|\meta{code}|}| specifies that % \meta{code} is the definition of the hook for pagestyle \meta{style}. % |\makepshook| is a deprecated version of |\makepsmarks|. % \changes{v1.0}{2001/11/15}{Added \cs{makepsmarks} and deprecated % \cs{makepshook}} % \begin{macrocode} \newcommand{\makepsmarks}[2]{\@namedef{#1pshook}{#2}} \newcommand{\makepshook}[2]{% \ClassWarning{memoir}{\protect\makepshook\space is deprecated.\MessageBreak Use \protect\makepsmarks\space instead} \@namedef{#1pshook}{#2} } % \end{macrocode} % \end{macro} % \end{macro} % % \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| % 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} % \begin{macrocode} \newcommand{\makepagestyle}[1]{% % \end{macrocode} % First define the macro |\ps@style|, which in turn defines the macros % |\@evenhead|, |\@oddhead|, |\@evenfoot| and |\@oddfoot|. % \begin{macrocode} \@namedef{ps@#1}{% \@namedef{#1@evenhead}{% % \end{macrocode} % The code for the definition of |\@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 % start the main box. % \begin{macrocode} \@nameuse{#1evenhpl}\hb@xt@\@nameuse{#1runwidth}{\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 |\relax| or |\hss|. % \begin{macrocode} \@nameuse{#1headrule}}}\@nameuse{#1evenhpr}} % \end{macrocode} % The code for the |\@oddhead|, |\@evenfoot| and |\@oddfoot| follows % a similar pattern. Here is |\@oddhead|. % \begin{macrocode} \@namedef{#1@oddhead}{% \@nameuse{#1oddhpl}\hb@xt@\@nameuse{#1runwidth}{\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 |\@evenfoot|. For the footers the rules come \emph{before} any foot % entries. % \begin{macrocode} \@namedef{#1@evenfoot}{% \@nameuse{#1evenfpl}\hb@xt@\@nameuse{#1runwidth}{% \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 |\@oddfoot|. % \begin{macrocode} \@namedef{#1@oddfoot}{% \@nameuse{#1oddfpl}\hb@xt@\@nameuse{#1runwidth}{% \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 |\@evenhead| etc., in terms of |#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 |\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 |\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 |\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 |\aliaspagestyle{|\meta{aliasl}|}{|\meta{original}|}| % defines the \meta{alias} pagestyle to be an alias for the % \meta{original} pagestyle. % \begin{macrocode} \newcommand{\aliaspagestyle}[2]{% \@namedef{ps@#1}{\@nameuse{ps@#2}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\copypagestyle} % The command |\copypagestyle{|\meta{new}|}{|\meta{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} \newcommand{\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 |\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} % |\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}. % \changes{v1.0}{2001/11/14}{Added \cs{ifonlyfloats}} % \begin{macrocode} \newcommand{\ifonlyfloats}[2]{\if@fcolmade #1\else #2\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\mergepagefloatstyle} % |\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} \newcommand{\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 |\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 |\makepagestyle{plain}| and then adjust as required. % \begin{macrocode} \makepagestyle{plain} \makeevenfoot{plain}{}{\thepage}{} \makeoddfoot{plain}{}{\thepage}{} % \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}} % \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{\MakeUppercase{% \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\sectionmark##1{% \markright{\MakeUppercase{% \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 |\rightmark| is used. % \begin{macrocode} \makepagestyle{headings} \makepsmarks{headings}{% \let\@mkboth\markboth \def\chaptermark##1{% \markright{\MakeUppercase{% \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}}}% } \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 |\markboth| and |\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} % \begin{macrocode} \makepagestyle{myheadings} \makepsmarks{myheadings}{% \let\@mkboth\@gobbletwo \let\chaptermark\@gobble \let\sectionmark\@gobble \let\tocmark\@gobble \let\lofmark\@gobble \let\lotmark\@gobble \let\bibmark\@gobble \let\indexmark\@gobble } \makeevenhead{myheadings}{\thepage}{}{\slshape\leftmark} \makeoddhead{myheadings}{\slshape\rightmark}{}{\thepage} % \end{macrocode} % \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, |\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 |\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 |\textwidth|. % \begin{macrocode} \makeheadrule{ruled}{\textwidth}{\normalrulethickness} % \end{macrocode} % % \begin{macro}{\@ruledmarks} % We have to make sure that the |\chapter| and |\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 \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 LaTeX Companion series. % We need the |\headwidth| length for this. % \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@companion}} % \begin{macrocode} \newlength{\headwidth} \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{Page numbering} % % The kernel includes the |\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. % (\texttt{skunk@mit.edu}) September 2001.}. % % \begin{macro}{\pagenumbering} % \begin{macro}{\pagenumbering*} % |\pagenumbering{|\meta{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} \renewcommand{\pagenumbering}{% \@ifstar{\@smempnum}{\@mempnum}} % \end{macrocode} % \begin{macro}{\@smempnum} % \begin{macrocode} \newcommand{\@smempnum}[1]{% \gdef\thepage{\csname @#1\endcsname \c@page}} % \end{macrocode} % \end{macro} % \begin{macro}{\@mempnum} % \begin{macrocode} \newcommand{\@mempnum}[1]{% \@smempnum{#1}\global\c@page \@ne} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\c@storedpagenumber} % A counter to store the page number. % \begin{macrocode} \newcounter{storedpagenumber} \setcounter{storedpagenumber}{1} % \end{macrocode} % \end{macro} % % \begin{macro}{\savepagenumber} % \begin{macro}{\restoregenumber} % |\savepagenumber| saves the current page number and |\restorepagenumber| % sets the page number to the stored value. % \changes{v1.0}{2001/09/24}{Added \cs{savepagenumber} and \cs{restorepagenumber}} % \begin{macrocode} \newcommand{\savepagenumber}{\global\c@storedpagenumber \c@page} \newcommand{\restorepagenumber}{\global\c@page \c@storedpagenumber} % \end{macrocode} % \end{macro} % \end{macro} % % % % % \section{Document Markup} \label{sec:docm} % % \subsection{The title} % % For books the title is usually designed specifically for the particular % work, so this class does not provide a |\maketitle| command or any of the % |\title| and other commands that normally go along with this. If you want % |\maketitle| and friends I suggest that you use the \Lpack{titling} % package~\cite{TITLING} which provides for configurable, and multiple, % titles. % % \begin{macro}{\if@titlepage} % The \Lpack{titling} package expects that the document class provides % a \Lopt{titlepage} option that is implemented by setting |\@titlepagetrue|. % This class does not have that option, but we need to make sure that % the \Lopt{titling} package is usable. % \changes{v0.2}{2001/06/03}{Added \cs{if@titlepage} to support the titling package} % \begin{macrocode} \newif\if@titlepage \@titlepagefalse % \end{macrocode} % \end{macro} % % % \subsection{Parts, chapters and sections} % % \subsubsection{Building blocks} The definitions in this part of a % class file usually make use of two internal macros, |\@startsection| and % |\secdef|. To understand % what is going on here, we describe their syntax. % % \DescribeMacro{\@startsection} % The macro |\@startsection| has 6 required arguments, optionally % followed by a $*$, an optional argument and a required argument: % % |\@startsection|\meta{name}\meta{level}\meta{indent}^^A % \meta{beforeskip}\meta{afterskip}\meta{style} % optional *\\ % \null\hphantom{\bslash @startsection}^^A % |[|\meta{altheading}|]|\meta{heading} % % It is a generic command to start a section, the arguments have % the following meaning: % % \begin{description} % \item[\meta{name}] The name of the user level command, e.g., % `section'. % \item[\meta{level}] A number, denoting the depth of the section % --- e.g., chapter = 0, section = 1, etc. A section number % will be printed if and only if \meta{level} $<=$ the value % of the \Lcount{secnumdepth} counter. % \item[\meta{indent}] The indentation of the heading from the left % margin % \item[\meta{beforeskip}] The absolute value of this argument % gives the skip to leave above the heading. If it is % negative, then the paragraph indent of the text following % the heading is suppressed. % \item[\meta{afterskip}] If positive, this gives the skip to leave % below the heading, else it gives the skip to leave to the % right of a run-in heading. % \item[\meta{style}] Commands to set the style of the heading. % \item[$*$] When this is missing the heading is numbered and the % corresponding counter is incremented. % \item[\meta{altheading}] Gives an alternative heading to use in % the table of contents and in the running heads. This should % 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 % 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: % % |\secdef|\meta{unstarcmds}\meta{starcmds} % % \begin{description} % \item[\meta{unstarcmds}] Used for the normal form of a % sectioning command. % \item[\meta{starcmds}] Used for the $*$-form of a % sectioning command. % \end{description} % % You can use |\secdef| as follows: % \begin{verbatim} % \def\chapter { ... \secdef \CMDA \CMDB } % \def\CMDA [#1]#2{ ... } % Command to define % % \chapter[...]{...} % \def\CMDB #1{ ... } % Command to define % % \chapter*{...} % \end{verbatim} % % \DescribeMacro{\@hangfrom} % Internally the |\@startsection| macro uses |\@hangfrom{NUM}|, where % |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: % \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}| \\ % or as a block paragraph: \\ % |\renewcommand{\@hangfrom}[1]{\noindent #1}| \\ % % \DescribeMacro{\@seccntformat} % The |\@startsection| macro also uses |\@seccntformat{NUM}| to format % the section number, including the space after it. Its definition, % from \file{ltsect.dtx}, is % \begin{verbatim} % \def\@seccntformat#1{\csname the#1\endcsname\quad} % \end{verbatim} % This is the command to change if you need different number formatting. For % example the combination % \begin{verbatim} % \renewcommand{\@seccntformat}[1]{\llap{\csname the#1\endcsname\quad}} % \renewcommand{\@hangfrom}[1]{\noindent #1} % \end{verbatim} % will hang the section numbers in the margin. % % \begin{table} % \centering % \caption{Document division levels}\label{tab:levels} % \begin{tabular}{lr} \hline % Division & Level \\ \hline % part & -1 \\ % chapter & 0 \\ % section & 1 \\ % subsection & 2 \\ % subsubsection & 3 \\ % paragraph & 4 \\ % subparagraph & 5 \\ % \hline % \end{tabular} % \end{table} % % The values used for the document division levels are the same % as defined by the standard LaTeX classes and are given in % Table~\ref{tab:levels}. % % \subsection{Mark commands} % % \begin{macro}{\partmark} % \begin{macro}{\chaptermark} % \begin{macro}{\sectionmark} % \begin{macro}{\subsectionmark} % \begin{macro}{\subsubsectionmark} % \begin{macro}{\paragraphmark} % \begin{macro}{\subparagraphmark} % The default initialisations of the |\...mark| commands for use in % the pagestyles. Most are already defined in the kernel but they are % all noted here. % \begin{macrocode} \newcommand*{\partmark}[1]{} \newcommand*{\chaptermark}[1]{} % \newcommand*{\sectionmark}[1]{} % \newcommand*{\subsectionmark}[1]{} % \newcommand*{\subsubsectionmark}[1]{} % \newcommand*{\paragraphmark}[1]{} % \newcommand*{\subparagraphmark}[1]{} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\bibmark} % Marks for the bibliography, which may be filled with |\bibname|. % \changes{v1.1}{2002/03/10}{Added \cs{bibmark}} % \begin{macrocode} \newcommand*{\bibmark}{} % \end{macrocode} % \end{macro} % % \begin{macro}{\indexmark} % Marks for the index, which may be filled with |\indexname|. % \changes{v1.1}{2002/03/10}{Added \cs{indexmark}} % \begin{macrocode} \newcommand*{\indexmark}{} % \end{macrocode} % \end{macro} % % % \subsubsection{Define Counters} % % \begin{macro}{\c@secnumdepth} % The value of the counter \Lcount{secnumdepth} gives the depth of % the highest-level sectioning command that is to produce section % numbers. % \begin{macrocode} \setcounter{secnumdepth}{2} % \end{macrocode} % \end{macro} % % \begin{macro}{\c@part} % \begin{macro}{\c@chapter} % \begin{macro}{\c@section} % \begin{macro}{\c@subsection} % \begin{macro}{\c@subsubsection} % \begin{macro}{\c@paragraph} % \begin{macro}{\c@subparagraph} % These counters are used for the sectioning numbers. The macro\\ % |\newcounter{|\meta{newctr}|}[|\meta{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. % \begin{macrocode} \newcounter{part} \newcounter{chapter} % \end{macrocode} % The lower level divisions get reset by higher level divisions. % \begin{macrocode} \newcounter{section}[chapter] \newcounter{subsection}[section] \newcounter{subsubsection}[subsection] \newcounter{paragraph}[subsubsection] \newcounter{subparagraph}[paragraph] % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\thepart} % \begin{macro}{\thechapter} % \begin{macro}{\thesection} % \begin{macro}{\thesubsection} % \begin{macro}{\thesubsubsection} % \begin{macro}{\theparagraph} % \begin{macro}{\thesubparagraph} % For any counter \Lcount{CTR}, |\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. % % |\roman{|\Lcount{COUNTER}|}| prints the value of % \Lcount{COUNTER} as a lowercase roman numeral. % % |\Roman{|\Lcount{COUNTER}|}| prints the value of % \Lcount{COUNTER} as an uppercase roman numeral. % % |\alph{|\Lcount{COUNTER}|}| prints the value of \Lcount{COUNTER} % as a lowercase letter: $1 =$~a, $2 =$~ b, etc. % % |\Alph{|\Lcount{COUNTER}|}| prints the value of \Lcount{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}{\thesection.\@arabic\c@subsection} \renewcommand{\thesubsubsection}{\thesubsection.\@arabic\c@subsubsection} \renewcommand{\theparagraph}{\thesubsubsection.\@arabic\c@paragraph} \renewcommand{\thesubparagraph}{\theparagraph.\@arabic\c@subparagraph} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@chapapp} % |\@chapapp| is initially defined as |\chaptername|. The |\appendix| % command redfines it as |\appendixname|. % \begin{macrocode} \newcommand{\@chapapp}{\chaptername} % \end{macrocode} % \end{macro} % % \subsubsection{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. % % \begin{macro}{\frontmatter} % \begin{macro}{\frontmatter*} % The |\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 % also ensures that the next page will be recto. % The starred version makes no changes to the page numbering\footnote{The % starred versions were added to meet a request by Daniel Richard G. % (\texttt{skunk@mit.edu}) in September 2001.}. % \changes{v0.3}{2001/07/09}{\cs{frontmatter} switches off numbering via % the secnumdepth counter} % \changes{v1.0}{2001/09/21}{Added \cs{frontmatter*} command} % \begin{macrocode} \newcommand{\frontmatter}{% \@ifstar{\@smemfront}{\@memfront}} % \end{macrocode} % \begin{macro}{\@smemfront} % \begin{macrocode} \newcommand{\@smemfront}{% \cleardoublepage \@mainmatterfalse \setcounter{secnumdepth}{-10} \counterwithout{figure}{chapter} \counterwithout{table}{chapter} } % \end{macrocode} % \end{macro} % \begin{macro}{\@memfront} % \begin{macrocode} \newcommand{\@memfront}{% \@smemfront\pagenumbering{roman}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\mainmatter} % \begin{macro}{\mainmatter*} % The |\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. % \changes{v0.3}{2001/07/09}{\cs{mainmatter} switches on section numbering % via the secnumdepth counter} % \changes{v1.0}{2001/09/21}{Added \cs{mainmatter*} command} % \begin{macrocode} \newcommand{\mainmatter}{% \@ifstar{\@smemmain}{\@memmain}} % \end{macrocode} % \begin{macro}{\@smemmain} % \changes{v1.1}{2002/03/10}{Modified \cs{@smemmain} to reset the secnumdepth % counter to maxsecnumdepth} % \begin{macrocode} \newcommand{\@smemmain}{ \cleardoublepage \@mainmattertrue \setcounter{secnumdepth}{\value{maxsecnumdepth}} \counterwithin{figure}{chapter} \counterwithin{table}{chapter} } % \end{macrocode} % \end{macro} % \begin{macro}{\@memmain} % \begin{macrocode} \newcommand{\@memmain}{% \@smemmain\pagenumbering{arabic}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\backmatter} % This command turns off chapter numbering but leaves the page numbering alone. % It twiddles the numbering caption numbering. % The back matter may start on any new page. % \changes{v0.3}{2001/07/09}{\cs{backmatter} uses the secnumdepth counter} % \begin{macrocode} \newcommand{\backmatter}{% \if@openright \cleardoublepage \else \clearpage \fi \@mainmatterfalse \setcounter{secnumdepth}{-10} %% \renewcommand{\thesection}{\@arabic\c@section} \counterwithout{figure}{chapter} \counterwithout{table}{chapter} \setcounter{figure}{0} \setcounter{table}{0} } % \end{macrocode} % \end{macro} % % % % % \subsubsection{Divisions} % % % % \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|. % \begin{macrocode} \newcommand{\part}{% \@setuppart \secdef\@part\@spart} % \end{macrocode} % \end{macro} % % \begin{macro}{\beforepartskip} % \begin{macro}{\midpartskip} % \begin{macro}{\afterpartskip} % These three macros are the skips before, in the middle, and after the % Part heading. % \begin{macrocode} \newcommand{\beforepartskip}{\null\vfil} \newcommand{\midpartskip}{\par\vskip 20pt} \newcommand{\afterpartskip}{\vfil\newpage} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@setuppart} % This macro does the work of setting up for the |\part| command. % A single column page, normally recto, with a \pstyle{part} pagestyle is started. % \begin{macrocode} \newcommand{\@setuppart}{% \if@openright \cleardoublepage \else \clearpage \fi \thispagestyle{part}% \if@twocolumn \onecolumn \@tempswatrue \else \@tempswafalse \fi \beforepartskip} % \end{macrocode} % \end{macro} % % \begin{macro}{\partnamefont} % \begin{macro}{\partnumfont} % \begin{macro}{\parttitlefont} % These three macros specify the fonts for the part name and number, and % for the part title, respectively. % \changes{v0.2}{2001/06/03}{Rewrote the typesetting for Part titles} % \begin{macrocode} \newcommand{\partnamefont}{\normalfont\huge\bfseries} \newcommand{\partnumfont}{\normalfont\huge\bfseries} \newcommand{\parttitlefont}{\normalfont\Huge\bfseries} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\printpartname} % \begin{macro}{\partnamenum} % \begin{macro}{\printpartnum} % \begin{macro}{\printparttitle} % Macros to print the various parts of a Part heading. % \begin{macrocode} \newcommand{\printpartname}{\partnamefont \partname} \newcommand{\partnamenum}{\space} \newcommand{\printpartnum}{\partnumfont \thepart} \newcommand{\printparttitle}[1]{\parttitlefont #1} % \end{macrocode} % \end{macro} % \end{macro} % \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. % \changes{v1.3}{2002/11/14}{Used \cs{partnumberline} in \cs{@part}} % \begin{macrocode} \def\@part[#1]#2{% \ifnum \c@secnumdepth >-2\relax \refstepcounter{part}% %% \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% \addcontentsline{toc}{part}% {\protect\partnumberline{\thepart}#1}% \else \addcontentsline{toc}{part}{#1}% \fi % \end{macrocode} % Empty the marks, center the title on the page, and set the normal font. % \begin{macrocode} \markboth{}{}% {\centering \interlinepenalty \@M \normalfont % \end{macrocode} % Print the number, if there is one, then the title below. Macro |\@endpart| % tidies everything up at the end. % \begin{macrocode} \ifnum \c@secnumdepth >-2\relax \printpartname \partnamenum \printpartnum \midpartskip \fi \printparttitle{#2}\par}% \@endpart} % \end{macrocode} % \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. % \begin{macrocode} \def\@spart#1{% {\centering \interlinepenalty \@M \normalfont \printparttitle{#1}\par}% \@endpart} % \end{macrocode} % \end{macro} % % \begin{macro}{\@endpart} % This finishes off both |\@part| and |\@spart|. 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. % \begin{macrocode} \def\@endpart{\afterpartskip \if@twoside \if@openright \null \thispagestyle{empty}% \newpage \fi \fi \if@tempswa \twocolumn \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\chapter} % The command to start a new chapter. Chapters always start on a new page % with a \pstyle{chapter} pagestyle. Floats are not allowed at the top of the page. % The typesetting is done by either |\@chapter| or |\@schapter|. % \changes{v0.3}{2001/07/09}{Changed \cs{chapter} for article option} % \changes{v1.0}{2001/10/24}{Changed chapter page clearing to \cs{clearforchapter}} % \changes{v1.2}{2002/07/27}{New optarg in \cs{chapter} for short heading} % \begin{macrocode} \newcommand\chapter{% \ifartopt\else \clearforchapter \thispagestyle{chapter} \global\@topnum\z@ \fi \@afterindentfalse \@ifstar{\@m@mschapter}{\@m@mchapter}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@m@mchapter} % \begin{macro}{\ch@pt@c} % \begin{macro}{\m@m@empty} % Intermediate and support macros for the extra optional argument % to |\chapter|. Have to do this long windedly otherwise dear old % \Lpack{hyperref} barfs. % % The code for two optional arguments is based on a posting % to |ctt| by Robin Fairbairns (1997/04/12 Re: Several optional arguments % for macro?). % \begin{macrocode} \newcommand{\@m@mchapter}[1][\@empty]{% \def\ch@pt@c{#1}% capture first optional arg \@dblarg{\@chapter}} \def\m@m@empty{\@empty} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\@chapter} % \begin{macro}{\f@rtoc} % \begin{macro}{\f@rhdr} % |\@chapter[|\meta{tocmark}|]{|\meta{title}|}| % typesets the title of a % |\chapter|. % There is a number if |\secnumdepth| is greater than -1 and |\@mainmatter| % is TRUE. % % \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}} % \begin{macrocode} \def\@chapter[#1]#2{% \ifx\ch@pt@c\m@m@empty % no optional args \def\f@rtoc{#1}% \def\f@rhdr{#1}% \else % at least one opt arg \def\f@rtoc{\ch@pt@c}% \nametest{#1}{#2}% \ifsamename % one opt arg \def\f@rhdr{\ch@pt@c}% \else % two opt args \def\f@rhdr{#1}% \fi \fi \ifnum \c@secnumdepth >\m@ne \if@mainmatter \refstepcounter{chapter}% \typeout{\@chapapp\space\thechapter.}% \addcontentsline{toc}{chapter}% {\protect\chapternumberline{\thechapter}\f@rtoc}% \else \addcontentsline{toc}{chapter}{\f@rtoc}% \fi \else \addcontentsline{toc}{chapter}{\f@rtoc}% \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} % \begin{macrocode} \chaptermark{\f@rhdr} \ifartopt \@makechapterhead{#2}% \@afterheading \else \insertchapterspace \if@twocolumn \@topnewpage[\@makechapterhead{#2}]% \else \@makechapterhead{#2}% \@afterheading \fi \fi} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\@makechapterhead} % This \emph{really} typesets a |\chapter|. Leave some whitespace and prepare to % set |\raggedright|. % \changes{v1.3}{2002/10/10}{Added \cs{printchapternonum} to % \cs{@makechapterhead}} % \begin{macrocode} \def\@makechapterhead#1{% \chapterheadstart% \vspace*{50\p@}% {\parindent \z@ \raggedright \normalfont % \end{macrocode} % If there is a number, typeset it, otherwise call |\printchapternonum|.. % \begin{macrocode} \ifnum \c@secnumdepth >\m@ne \if@mainmatter \printchaptername \chapternamenum \printchapternum \afterchapternum % \par\nobreak \vskip 20\p@ \else \printchapternonum \fi \else \printchapternonum \fi % \end{macrocode} % Typeset the title. % \begin{macrocode} \interlinepenalty\@M \printchaptertitle{#1} % \Huge \bfseries #1 \afterchaptertitle % \par\nobreak \vskip 40\p@ }} % \end{macrocode} % \end{macro} % % \begin{macro}{\insertchapterspace} % By default, a |\chapter| inserts some vertical space into the LoF and LoT. % The macro |\insertchapterspace| performs the insertion. % \changes{v0.33}{2001/08/31}{Added \cs{insertchapterspace}} % \begin{macrocode} \newcommand{\insertchapterspace}{% \addtocontents{lof}{\protect\addvspace{10pt}}% \addtocontents{lot}{\protect\addvspace{10pt}}% } % \end{macrocode} % \end{macro} % % % % \begin{macro}{\@chs@def@ult} % This sets up all the definitions used in |\@makechapterhead| % and |\@makeschapterhead|. % \changes{v1.3}{2002/10/10}{Added \cs{printchapternonum} to \cs{@chs@def@ult}} % \begin{macro}{\chapterheadstart} % \begin{macro}{\printchaptername} % \begin{macro}{\chapternamenum} % \begin{macro}{\printchapternum} % \begin{macro}{\afterchapternum} % \begin{macro}{\printchapternum} % \begin{macro}{\printchapternonum} % \begin{macro}{\printchaptertitle} % \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} } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \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. % \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} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\makechapterstyle} % \begin{macro}{\chapterstyle} % |\chapterstyle{|\meta{style}|}| is like |\pagestyle|, except it's for % chapters. % % |\makechapterstyle{|\meta{style}|}{|\meta{text}|}| creates % or overrides the \meta{style} chapter style defining it as \meta{text} % So, |\makechapterstyle{fred}{code}| specifies that the chapter style |fred| % is defined as the macro |\chs@fred{code}|, % and |\chapterstyle{fred}| calls the macro |\chs@fred|. % \begin{macrocode} \newcommand{\makechapterstyle}[2]{\@namedef{chs@#1}{\@chs@def@ult #2}} \newcommand{\chapterstyle}[1]{\@nameuse{chs@#1}} % \end{macrocode} % \end{macro} % \end{macro} % % 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} } \chapterstyle{default} % \end{macrocode} % % % \begin{macro}{\@m@mschapter} % This deals with the new optional argument for starred chapters. % \begin{macrocode} \newcommand{\@m@mschapter}[2][\@empty]{% \@schapter{#2}% \ifx \@empty #1\else % opt arg \setcounter{secnumdepth}{-10}% \chaptermark{#1}% \setcounter{secnumdepth}{\value{maxsecnumdepth}}% \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@schapter} % |\@schapter{|\meta{long}|}| typesets the title of a % |\chapter*|. It is easier than the |\@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}} % \begin{macrocode} \newcommand{\@schapter}[1]{% \ifartopt \@makeschapterhead{#1}% \@afterheading \else \if@twocolumn \@topnewpage[\@makeschapterhead{#1}]% \else \@makeschapterhead{#1}% \@afterheading \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@makeschapterhead} % This \emph{really} typesets a |\chapter*|, and is similar to |\@makechapterhead|. % \changes{v1.3}{2002/10/10}{Added \cs{printchapternonum} to % \cs{@makeschapterhead}} % \begin{macrocode} \def\@makeschapterhead#1{% \chapterheadstart {\parindent \z@ \raggedright \normalfont \printchapternonum \interlinepenalty\@M \printchaptertitle{#1} \afterchaptertitle } } % \end{macrocode} % \end{macro} % % \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} % \begin{macrocode} \makechapterstyle{section}{% \renewcommand{\printchaptername}{} \renewcommand{\chapternamenum}{} \renewcommand{\chapnumfont}{\normalfont\Huge\bfseries} \renewcommand{\printchapternum}{\chapnumfont \thechapter\space} \renewcommand{\afterchapternum}{} } % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@article} % The \pstyle{article} chapter style. It prints the heading as though it % were a section in an \Lpack{article} class document. % \changes{v0.3}{2001/07/09}{Added article chapterstyle} % \changes{v1.0a}{2002/01/18}{Made \cs{chapnumfont} change in article chapterstyle explicit} % \begin{macrocode} \makechapterstyle{article}{% \renewcommand{\chapterheadstart}{\vspace{\beforechapskip}} \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex} \setlength{\afterchapskip}{2.3ex \@plus .2ex} \renewcommand{\printchaptername}{} \renewcommand{\chapternamenum}{} \renewcommand{\chaptitlefont}{\normalfont\Large\bfseries} \renewcommand{\chapnumfont}{\normalfont\Large\bfseries} \renewcommand{\printchapternum}{\chapnumfont \thechapter\space} \renewcommand{\afterchapternum}{} } % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@hangnum} % The \pstyle{hangnum} style puts the chapter number in the margin. % \begin{macrocode} \makechapterstyle{hangnum}{% \renewcommand{\chapnumfont}{\chaptitlefont} \settowidth{\chapindent}{\chapnumfont 999} \renewcommand{\printchaptername}{} \renewcommand{\chapternamenum}{} \renewcommand{\printchapternum}{% \noindent\llap{\makebox[\chapindent][l]{\chapnumfont \thechapter}}} \renewcommand{\afterchapternum}{} } % \end{macrocode} % \end{macro} % % \begin{macro}{\chapindent} % \begin{macro}{\chs@companion} % The \pstyle{companion} style is like that in the LaTeX Companion % series. It requires the |\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} % \begin{macrocode} \newlength{\chapindent} \makechapterstyle{companion}{% \renewcommand{\chapnamefont}{\normalfont\LARGE\scshape} \renewcommand{\printchaptername}{\raggedleft\chapnamefont \@chapapp} \renewcommand{\chapnumfont}{\normalfont\Huge} \setlength{\chapindent}{\marginparsep} \addtolength{\chapindent}{\marginparwidth} \renewcommand{\printchaptertitle}[1]{% \begin{adjustwidth}{}{-\chapindent} \raggedleft \chaptitlefont ##1\par\nobreak \end{adjustwidth}} } % \end{macrocode} % \end{macro} % \end{macro} % % \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]{% \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1} \renewcommand{\afterchaptertitle}{\vskip\onelineskip \hrule\vskip \afterchapskip} } % \end{macrocode} % \end{macro} % % % % \subsubsection{Lower level headings} % % These commands all make use of |\@startsection|. % % We will tweak |\@startsection| so that a short page (where a section % heading is moved from the bottom of the page to the top of the next) % can be set |\raggedbottom|. % % \begin{macro}{\ifraggedbottomsection} % |\raggedbottomsectiontrue| for ragged short pages. % \changes{v1.3}{2002/11/14}{Added \cs{ifraggedbottomsection}} % \begin{macrocode} \newif\ifraggedbottomsection \raggedbottomsectionfalse % \end{macrocode} % \end{macro} % % \begin{macro}{\bottomsectionskip} % Decreasing this length increases short page bottom flushness. % \changes{v1.3}{2002/11/14}{Added \cs{bottomsectionskip}} % \begin{macrocode} \newlength{\bottomsectionskip} \setlength{\bottomsectionskip}{10mm} % \end{macrocode} % \end{macro} % % \begin{macro}{\@startsection} % This is a modified version of the kernel |\@startsection| to make short % pages raggedbottom. It is based on the thread {\itshape Can |\flushbottom| % and |\section| be made to live together?} on CTT in September 2002. % \changes{v1.3}{2002/11/14}{Modified \cs{@startsection}} % \begin{macrocode} \let\m@m@startsection\@startsection \renewcommand{\@startsection}{% \ifraggedbottomsection\if@nobreak\else \vskip\z@\@plus\bottomsectionskip \penalty\z@ \vskip\z@\@plus -\bottomsectionskip \fi\fi \m@m@startsection} % \end{macrocode} % \end{macro} % % % \begin{macro}{\section} % 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. % \begin{macrocode} \newcommand{\section}{% \sechook% \@startsection{section}{1}% level 1 {\secindent}% heading indent {\beforesecskip}% skip before the heading {\aftersecskip}% skip after the heading {\normalfont\secheadstyle}} % font % \end{macrocode} % \end{macro} % % \begin{macro}{\sechook} % \begin{macro}{\setsechook} % |\sechook| is called at the start of a |\section| and % |\setsechook{|\meta{code}|}| redefines it. % \begin{macrocode} \newcommand{\sechook}{} \newcommand{\setsechook}[1]{\renewcommand{\sechook}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\secindent} % \begin{macro}{\beforesecskip} % \begin{macro}{\aftersecskip} % \begin{macro}{\secheadstyle} % \begin{macro}{\setsecindent} % \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. % These are set to the default values for the \Lpack{book} class, % except that the heading will be |\raggedright|, thus preventing % hyphenation. The % |\set...| commands are for the user to change the values. % \begin{macrocode} \newlength{\secindent} \newcommand{\setsecindent}[1]{\setlength{\secindent}{#1}} \setsecindent{\z@} \newskip\beforesecskip \newcommand{\setbeforesecskip}[1]{\setlength{\beforesecskip}{#1}} \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex} \newskip\aftersecskip \newcommand{\setaftersecskip}[1]{\setlength{\aftersecskip}{#1}} \setaftersecskip{2.3ex \@plus .2ex} \newcommand{\secheadstyle}{} \newcommand{\setsecheadstyle}[1]{\renewcommand{\secheadstyle}{#1}} \setsecheadstyle{\Large\bfseries\raggedright} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \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. % \begin{macrocode} \newcommand{\subsection}{% \subsechook% \@startsection{subsection}{2}% level 2 {\subsecindent}% heading indent {\beforesubsecskip}% skip before the heading {\aftersubsecskip}% skip after the heading {\normalfont\subsecheadstyle}} % font % \end{macrocode} % \end{macro} % % \begin{macro}{\subsechook} % \begin{macro}{\setsubsechook} % |\subsechook| is called at the start of a |\subsection| and % |\setsubsechook{|\meta{code}|}| redefines it. % \begin{macrocode} \newcommand{\subsechook}{} \newcommand{\setsubsechook}[1]{\renewcommand{\subsechook}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\subsecindent} % \begin{macro}{\beforesubsecskip} % \begin{macro}{\aftersubsecskip} % \begin{macro}{\subsecheadstyle} % \begin{macro}{\setsubsecindent} % \begin{macro}{\setbeforesubsecskip} % \begin{macro}{\setaftersubsecskip} % \begin{macro}{\setsubsecheadstyle} % The macros for controlling |\subsection| headings. % \begin{macrocode} \newlength{\subsecindent} \newcommand{\setsubsecindent}[1]{\setlength{\subsecindent}{#1}} \setsubsecindent{\z@} \newskip\beforesubsecskip \newcommand{\setbeforesubsecskip}[1]{\setlength{\beforesubsecskip}{#1}} \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex} \newskip\aftersubsecskip \newcommand{\setaftersubsecskip}[1]{\setlength{\aftersubsecskip}{#1}} \setaftersubsecskip{1.5ex \@plus .2ex} \newcommand{\subsecheadstyle}{} \newcommand{\setsubsecheadstyle}[1]{\renewcommand{\subsecheadstyle}{#1}} \setsubsecheadstyle{\large\bfseries\raggedright} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \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. % \begin{macrocode} \newcommand{\subsubsection}{% \subsubsechook% \@startsection{subsubsection}{3}% level 3 {\subsubsecindent}% heading indent {\beforesubsubsecskip}% skip before the heading {\aftersubsubsecskip}% skip after the heading {\normalfont\subsubsecheadstyle}} % font % \end{macrocode} % \end{macro} % % \begin{macro}{\subsubsechook} % \begin{macro}{\setsubsubsechook} % |\subsubsechook| is called at the start of a |\subsubsection| and % |\setsubsubsechook{|\meta{code}|}| redefines it. % \begin{macrocode} \newcommand{\subsubsechook}{} \newcommand{\setsubsubsechook}[1]{\renewcommand{\subsubsechook}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\subsubsecindent} % \begin{macro}{\beforesubsubsecskip} % \begin{macro}{\aftersubsubsecskip} % \begin{macro}{\subsubsecheadstyle} % \begin{macro}{\setsubsubsecindent} % \begin{macro}{\setbeforesubsubsecskip} % \begin{macro}{\setaftersubsubsecskip} % \begin{macro}{\setsubsubsecheadstyle} % The macros for controlling |\subsubsection| headings. % \begin{macrocode} \newlength{\subsubsecindent} \newcommand{\setsubsubsecindent}[1]{\setlength{\subsubsecindent}{#1}} \setsubsubsecindent{\z@} \newskip\beforesubsubsecskip \newcommand{\setbeforesubsubsecskip}[1]{\setlength{\beforesubsubsecskip}{#1}} \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex} \newskip\aftersubsubsecskip \newcommand{\setaftersubsubsecskip}[1]{\setlength{\aftersubsubsecskip}{#1}} \setaftersubsubsecskip{1.5ex \@plus .2ex} \newcommand{\subsubsecheadstyle}{} \newcommand{\setsubsubsecheadstyle}[1]{\renewcommand{\subsubsecheadstyle}{#1}} \setsubsubsecheadstyle{\normalsize\bfseries\raggedright} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % % \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. % \begin{macrocode} \newcommand{\paragraph}{% \parahook% \@startsection{paragraph}{4}% level 4 {\paraindent}% heading indent {\beforeparaskip}% skip before the heading {\afterparaskip}% skip after the heading {\normalfont\paraheadstyle}} % font % \end{macrocode} % \end{macro} % % \begin{macro}{\parahook} % \begin{macro}{\setparahook} % |\parahook| is called at the start of a |\paragraph| and % |\setparahook{|\meta{code}|}| redefines it. % \begin{macrocode} \newcommand{\parahook}{} \newcommand{\setparahook}[1]{\renewcommand{\parahook}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\paraindent} % \begin{macro}{\beforeparaskip} % \begin{macro}{\afterparaskip} % \begin{macro}{\paraheadstyle} % \begin{macro}{\setparaindent} % \begin{macro}{\setbeforeparaskip} % \begin{macro}{\setafterparaskip} % \begin{macro}{\setparaheadstyle} % The macros for controlling |\paragraph| headings. % \begin{macrocode} \newlength{\paraindent} \newcommand{\setparaindent}[1]{\setlength{\paraindent}{#1}} \setparaindent{\z@} \newskip\beforeparaskip \newcommand{\setbeforeparaskip}[1]{\setlength{\beforeparaskip}{#1}} \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex} \newskip\afterparaskip \newcommand{\setafterparaskip}[1]{\setlength{\afterparaskip}{#1}} \setafterparaskip{-1em} \newcommand{\paraheadstyle}{} \newcommand{\setparaheadstyle}[1]{\renewcommand{\paraheadstyle}{#1}} \setparaheadstyle{\normalsize\bfseries} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % % \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. % \begin{macrocode} \newcommand{\subparagraph}{% \subparahook% \@startsection{subparagraph}{5}% level 5 {\subparaindent}% heading indent {\beforesubparaskip}% skip before the heading {\aftersubparaskip}% skip after the heading {\normalfont\subparaheadstyle}} % font % \end{macrocode} % \end{macro} % % \begin{macro}{\subparahook} % \begin{macro}{\setsubparahook} % |\subparahook| is called at the start of a |\subparagraph| and % |\setsubparahook{|\meta{code}|}| redefines it. % \begin{macrocode} \newcommand{\subparahook}{} \newcommand{\setsubparahook}[1]{\renewcommand{\subparahook}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\subparaindent} % \begin{macro}{\beforesubparaskip} % \begin{macro}{\aftersubparaskip} % \begin{macro}{\subparaheadstyle} % \begin{macro}{\setsubparaindent} % \begin{macro}{\setbeforesubparaskip} % \begin{macro}{\setaftersubparaskip} % \begin{macro}{\setsubparaheadstyle} % The macros for controlling |\subparagraph| headings. % \begin{macrocode} \newlength{\subparaindent} \newcommand{\setsubparaindent}[1]{\setlength{\subparaindent}{#1}} \setsubparaindent{\parindent} \newskip\beforesubparaskip \newcommand{\setbeforesubparaskip}[1]{\setlength{\beforesubparaskip}{#1}} \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex} \newskip\aftersubparaskip \newcommand{\setaftersubparaskip}[1]{\setlength{\aftersubparaskip}{#1}} \setaftersubparaskip{-1em} \newcommand{\subparaheadstyle}{} \newcommand{\setsubparaheadstyle}[1]{\renewcommand{\subparaheadstyle}{#1}} \setsubparaheadstyle{\normalsize\bfseries} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \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). % \changes{v0.2}{2001/06/03}{Added \cs{sethangfrom}} % \begin{macrocode} \newcommand{\sethangfrom}[1]{\renewcommand{\@hangfrom}[1]{#1}} % \end{macrocode} % \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). % \changes{v0.2}{2001/06/03}{Added \cs{setsecnumformat}} % \begin{macrocode} \newcommand{\setsecnumformat}[1]{\renewcommand{\@seccntformat}[1]{#1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\hangsecnum} % \begin{macro}{\defaultsecnum} % These are declarations for putting sectional numbers in the margin, % or the default sectional number formatting. % \changes{v0.2}{2001/06/03}{Added \cs{hangsecnum} and \cs{defaultsecnum}} % \begin{macrocode} \newcommand{\hangsecnum}{% \def\@seccntformat##1{\llap{\csname the##1\endcsname\quad}}} \newcommand{\defaultsecnum}{% \def\@seccntformat##1{\csname the##1\endcsname\quad}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\plainbreak} % |\plainbreak{|\meta{num}|}| generates \meta{num} blanks lines and % suppresses the indentation of a following paragraph. The starred % version, |\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}} % \end{macrocode} % \end{macro} % % \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 % CTT by Donald Arseneau on 2001/03/26. % \begin{macrocode} \newcommand*{\@pbreak}[1]{\par \penalty -100 \vskip #1\onelineskip \@plus 2\onelineskip \penalty -20 \vskip \z@ \@plus -2\onelineskip \@afterindentfalse \@afterheading} \newcommand*{\@spbreak}[1]{\par \penalty -100 \vskip #1\onelineskip \@plus 2\onelineskip \penalty -20 \vskip \z@ \@plus -2\onelineskip \@afterindenttrue \@afterheading} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\fancybreak} % |\fancybreak{|\meta{text}|}| typesets \meta{text} centered. For example, % |\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} % \begin{macrocode} \newcommand{\fancybreak}{\@ifstar{\@sfbreak}{\@fbreak}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@fbreak} % \begin{macro}{\@sfbreak} % These are the internal forms for the two versions of |\fancybreak|. % \begin{macrocode} \newcommand{\@fbreak}[1]{\par \penalty -100 \noindent\parbox{\linewidth}{\centering #1}\null \penalty -20 %% \vskip -\onelineskip \@afterindentfalse \@afterheading} \newcommand{\@sfbreak}[1]{\par \penalty -100 \noindent\parbox{\linewidth}{\centering #1}\null \penalty -20 %% \vskip -\onelineskip \@afterindenttrue \@afterheading} % \end{macrocode} % \end{macro} % \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} % 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 % starred break commands. % \changes{v0.2}{2001/06/03}{Added \cs{plainfancybreak} and supporting macros} % \begin{macrocode} \newcommand{\plainfancybreak}{\@ifstar{\@spfbreak}{\@pfbreak}} % \end{macrocode} % \end{macro} % % \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|. % \begin{macrocode} \newcommand{\@pfbreak}[3]{\par \@tempdimc\pagegoal \advance\@tempdimc-\pagetotal \ifdim #1>\@tempdimc \@fbreak{#3}\else \@pbreak{#2}\fi} \newcommand{\@spfbreak}[3]{\par \@tempdimc\pagegoal \advance\@tempdimc-\pagetotal \ifdim #1>\@tempdimc \@sfbreak{#3}\else \@spbreak{#2}\fi} % \end{macrocode} % \end{macro} % \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 % 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}} % % \begin{macro}{\pen@ltyabovefpbreak} % \begin{macro}{\pen@ltybelowfpbreak} % Penalities for communication with the output routine. % \begin{macrocode} \newcommand*{\pen@ltyabovepfbreak}{2} \newcommand*{\pen@ltybelowpfbreak}{-4} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\pfbreakskip} % The vertical space taken by the plain and fancy breaks. % \begin{macrocode} \newlength{\pfbreakskip} \setlength{\pfbreakskip}{2\baselineskip} % \end{macrocode} % \end{macro} % % \begin{macro}{\pfbreakdisplay} % This is the fancybreak display, which must fit into |\pfbreakskip| % vertical space. % \begin{macrocode} \newcommand{\pfbreakdisplay}{*\quad*\quad*} % \end{macrocode} % \end{macro} % % \begin{macro}{\pfbre@kdispl@y} % Typesets |\pfbreakdisplay| vertically and horizontally centered. % \begin{macrocode} \def\pfbre@kdispl@y{\vbox to 1\pfbreakskip{\vss \hb@xt@ \columnwidth{\hss \pfbreakdisplay \hss}% \vss}} % \end{macrocode} % \end{macro} % % \begin{macro}{\nopfbreakOutput} % Save the cureent output routine. % \begin{macrocode} \edef\nopfbreakOutput{\the\output} % \end{macrocode} % \end{macro} % % \begin{macro}{\pfbreakOutput} % Special output to handle the |\pfbreak|. % \begin{macrocode} \def\pfbreakOutput{% \ifnum\outputpenalty=\pen@ltyabovepfbreak \nopfbreakOutput \pfbre@kdispl@y \nobreak \vskip-\pfbreakskip \else\ifnum\outputpenalty=\pen@ltybelowpfbreak \unvbox 255\relax \nobreak \vskip-\pfbreakskip \pfbre@kdispl@y \break \else \nopfbreakOutput \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\output} % Use the new |\pfbreak| output routine. % \begin{macrocode} \output={\pfbreakOutput} % \end{macrocode} % \end{macro} % % \begin{macro}{\pfbreak} % Typesets a plain break in the middle of the page, otherwise % a fancybreak at either the bottom or top of the page. % \begin{macrocode} \newcommand{\pfbreak}{\@ifstar{\@spfbreakgap}{\@pfbreakgap}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@pfbreakgap} % Unstarred version of |\pfbreak|. % \begin{macrocode} \newcommand{\@pfbreakgap}{% \par {% \skip@\lastskip \nobreak \vskip -\ifdim\prevdepth>\maxdepth \maxdepth \else\ifdim\prevdepth>-1000pt\prevdepth \else\ifinner 0pt \else \pagedepth \fi \fi \fi \vskip -\skip@ \ifdim\skip@<\pfbreakskip \advance\skip@ -1\skip@ \advance\skip@ 1\pfbreakskip \fi \penalty\pen@ltyabovepfbreak \vskip\skip@ \penalty\pen@ltybelowpfbreak } \@afterindentfalse \@afterheading } % \end{macrocode} % \end{macro} % % \begin{macro}{\@spfbreakgap} % Starred version of |\pfbreak|. % \begin{macrocode} \newcommand{\@spfbreakgap}{% \par {% \skip@\lastskip \nobreak \vskip -\ifdim\prevdepth>\maxdepth \maxdepth \else\ifdim\prevdepth>-1000pt\prevdepth \else\ifinner 0pt \else \pagedepth \fi \fi \fi \vskip -\skip@ \ifdim\skip@<\pfbreakskip \advance\skip@ -1\skip@ \advance\skip@ 1\pfbreakskip \fi \penalty\pen@ltyabovepfbreak \vskip\skip@ \penalty\pen@ltybelowpfbreak } \@afterindenttrue \@afterheading } % \end{macrocode} % \end{macro} % % % While on the subject of breaks\ldots % % \begin{macro}{\noprelistbreak} % Putting this immediately before a list (e.g., |itemize|) should % prevent a page break at that point. % \changes{v1.2}{2002/07/27}{Added \cs{noprelistbreak}} % \begin{macrocode} \newcommand*{\noprelistbreak}{\@nobreaktrue\nopagebreak} % \end{macrocode} % \end{macro} % % % \subsection{Appendices} % % \begin{macro}{\appendix} % In the standard \Lpack{book} class the |\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. % \end{itemize} % \begin{macrocode} \newcommand\appendix{\par \setcounter{chapter}{0}% \setcounter{section}{0}% \gdef\@chapapp{\appendixname}% \gdef\thechapter{\@Alph\c@chapter}} % \end{macrocode} % \end{macro} % % % This class provides additional appendixing capabilities. % % % \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 % 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} \newcommand{\appendixpage}{% \@ifstar{\@sapppage}{\@apppage}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@apppage} % |\@apppage| typesets an appendix page and makes an entry in the ToC. % \begin{macrocode} \def\@apppage{% \@setuppart \addappheadtotoc \markboth{}{}% {\centering \interlinepenalty \@M \normalfont \printparttitle{\appendixpagename}\par}% \@endpart} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@sapppage} % |\@sapppage| typesets an appendix page and does not make an entry in the ToC. % \begin{macrocode} \def\@sapppage{% \@setuppart \markboth{}{}% {\centering \interlinepenalty \@M \normalfont \printparttitle{\appendixpagename}\par}% \@endpart} % \end{macrocode} % \end{macro} % % % \begin{macro}{\addappheadtotoc} % 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. % \begin{macrocode} \def\addappheadtotoc{\addcontentsline{toc}{chapter}{\appendixtocname}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@ppsavesec} % \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| % command is the one for the user. % \begin{macrocode} \newcounter{@ppsavesec} \newcounter{@ppsaveapp} \setcounter{@ppsaveapp}{0} \newcommand{\@ppsavesec}{% \setcounter{@ppsavesec}{\value{chapter}}} \newcommand{\@pprestoresec}{% \setcounter{chapter}{\value{@ppsavesec}}} \newcommand{\@ppsaveapp}{% \setcounter{@ppsaveapp}{\value{chapter}}} \newcommand{\restoreapp}{% \setcounter{chapter}{\value{@ppsaveapp}}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \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 % restores sectional numbering. It saves the sectional number at the start % and restores the appendix number at the end. % \begin{macrocode} \newcommand{\@resets@pp}{ \par \@ppsavesec \setcounter{section}{0} \setcounter{chapter}{0} \renewcommand\@chapapp{\appendixname} \renewcommand\thechapter{\@Alph\c@chapter} \restoreapp } % \end{macrocode} % \end{macro} % % \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 % end of the environment save the appendix number and restore the main counters. % \begin{macrocode} \newenvironment{appendices}{\@resets@pp}% {\@ppsaveapp\@pprestoresec} % \end{macrocode} % \end{environment} % % \begin{macro}{\setthesection} % The user commands for specifying the numbering style for subappendices. % \begin{macrocode} \newcommand{\setthesection}{\thechapter.\Alph{section}} % \end{macrocode} % \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. % \begin{macrocode} \newcommand{\@resets@ppsub}{ \par \setcounter{section}{0} \renewcommand{\thesection}{\setthesection} } % \end{macrocode} % \end{macro} % % \begin{macro}{\ifnamesubappendix} % Switch for adding an `appendix' name before subappendix numbers. % \changes{v1.0}{2001/11/13}{Added \cs{ifnamesubappendix}} % \begin{macrocode} \newif\ifnamesubappendix \namesubappendixfalse % \end{macrocode} % \end{macro} % % \begin{environment}{subappendices} % The environment for subappendices. Start it off by doing the resetting % of the |\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. % \begin{macrocode} \def\addappheadtotoc{\addcontentsline{toc}{section}{\appendixtocname}} % \end{macrocode} % To implement the naming we do cunning things with the % |\@seccntformat| command. % \begin{macrocode} \ifnamesubappendix \def\sectionname{\appendixname} \def\@seccntformat##1{\@ifundefined{##1name}{}{\csname ##1name\endcsname\ }% \csname the##1\endcsname\quad} \fi % \end{macrocode} % That's it. % \begin{macrocode} }{} % \end{macrocode} % \end{environment} % % \begin{macro}{\@formatsecmark@pp} % Formats the page header for a redefined |\sectionmark|. % \begin{macrocode} \newcommand{\@formatsecmark@pp}[1]{% \MakeUppercase{\appendixname\space \ifnum \c@secnumdepth >\z@ \thesection\quad \fi #1}} % \end{macrocode} % \end{macro} % % % % % % \subsection{Lists} % % \subsubsection{General List Parameters} % % 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|. % % % \begin{macro}{\leftmargin} % \begin{macro}{\leftmargini} % \begin{macro}{\leftmarginii} % \begin{macro}{\leftmarginiii} % \begin{macro}{\leftmarginiv} % \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|. % % In two column mode the margins should be smaller than in one column typesetting. % \begin{macrocode} \if@twocolumn \setlength{\leftmargini}{2em} \else \setlength{\leftmargini}{2.5em} \fi % \end{macrocode} % The value of |\leftmargin| has to be set at this outer level. % \begin{macrocode} \leftmargin \leftmargini % \end{macrocode} % Lower level list margins are calculated so that they are indented % more than the label in an outer list. % \begin{macrocode} \setlength{\leftmarginii}{2.2em} \setlength{\leftmarginiii}{1.87em} \setlength{\leftmarginiv}{1.7em} \if@twocolumn \setlength{\leftmarginv}{.5em} \setlength{\leftmarginvi}{.5em} \else \setlength{\leftmarginv}{1em} \setlength{\leftmarginvi}{1em} \fi % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\itemindent} % Here we set the |\itemindent| which is the extra indentation before % a label. % \begin{macrocode} \setlength{\itemindent}{\z@} % \end{macrocode} % \end{macro} % % \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. % \begin{macrocode} \setlength{\labelsep}{0.5em} \setlength{\labelwidth}{\leftmargini} \addtolength{\labelwidth}{-\labelsep} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@beginparpenalty} % \begin{macro}{\@endparpenalty} % These penalties are inserted before and after a list or paragraph % environment. They are set to a bonus value to encourage page % breaking at these points. % \begin{macro}{\@itempenalty} % This penalty is inserted between list items. % \begin{macrocode} \@beginparpenalty -\@lowpenalty \@endparpenalty -\@lowpenalty \@itempenalty -\@lowpenalty % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\parsepi} % \begin{macro}{\topsepi} % \begin{macro}{\itemsepi} % \begin{macro}{\parsepii} % \begin{macro}{\topsepii} % \begin{macro}{\topsepiii} % Lists may be nested and the exact layout depends on the level % of nesting. These lengths are used to control the nesting-level % aspects. % \begin{macrocode} \newlength{\parsepi} \newlength{\topsepi} \newlength{\itemsepi} \newlength{\parsepii} \newlength{\topsepii} \newlength{\topsepiii} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \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 } % \end{macrocode} % \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 } % \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} \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\parsep} \def\@listiii{\leftmargin\leftmarginiii \labelwidth\leftmarginiii \advance\labelwidth-\labelsep \topsep\topsepiii \parsep\z@ \partopsep \p@ \@plus\z@ \@minus\p@ \itemsep\topsep} \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} % % \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. % \changes{v0.3}{2001/07/09}{Added \cs{firmlist} and reimplemented the % original \cs{tightlist}} % \begin{macrocode} \newcommand{\firmlist}{% \setlength{\itemsep}{0.5\itemsep}\setlength{\parskip}{0.5\parskip}} \newcommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} % \end{macrocode} % \end{macro} % \end{macro} % % \subsubsection{Enumerate} % % % The enumerate environment uses four counters: \Lcount{enumi}, % \Lcount{enumii}, \Lcount{enumiii} and \Lcount{enumiv}, where % \Lcount{enumN} controls the numbering of the Nth level % enumeration. % % \begin{macro}{\theenumi} % \begin{macro}{\theenumii} % \begin{macro}{\theenumiii} % \begin{macro}{\theenumiv} % The counters are already defined in \file{latex.dtx}, but their % representation is changed here. % % \begin{macrocode} \renewcommand{\theenumi}{\@arabic\c@enumi} \renewcommand{\theenumii}{\@alph\c@enumii} \renewcommand{\theenumiii}{\@roman\c@enumiii} \renewcommand{\theenumiv}{\@Alph\c@enumiv} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\labelenumi} % \begin{macro}{\labelenumii} % \begin{macro}{\labelenumiii} % \begin{macro}{\labelenumiv} % The label for each item is generated by the commands\\ % |\labelenumi| \ldots\ |\labelenumiv|. % \begin{macrocode} \newcommand{\labelenumi}{\theenumi.} \newcommand{\labelenumii}{\theenumii)} \newcommand{\labelenumiii}{\theenumiii.} \newcommand{\labelenumiv}{\theenumiv.} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \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 % enumerated list. % \begin{macrocode} \renewcommand{\p@enumii}{\theenumi} \renewcommand{\p@enumiii}{\theenumi(\theenumii)} \renewcommand{\p@enumiv}{\p@enumiii\theenumiii} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % The following is taken directly from David Carlisle's % \Lpack{enumerate} package. % % START OF DAVID CARLISLE'S CODE AND COMMENTARY % % 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|. % % 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. % % % \begin{macro}{\@enlab} % Internal token register used to build up the label command from the % optional argument. % \begin{macrocode} \newtoks\@enLab % \end{macrocode} % \end{macro} % % \begin{macro}{\@enQmark} % This just expands to a `?'. |\ref| will produce this, if no counter % is printed. % \begin{macrocode} \def\@enQmark{?} % \end{macrocode} % \end{macro} % % The next four macros build up the command that will print the item % label. They each gobble one token or group from the optional argument, % and add corresponding tokens to the register |\@enLab|. They each end % with a call to |\@enloop|, which starts the processing of the next % token. % \begin{macro}{\@enLabel} % Add the counter to the label. |#2| will be one of the `special' % tokens |A a I i 1|, and is thrown away. |#1| will be a command % like |\Roman|. % \begin{macrocode} \def\@enLabel#1#2{% \edef\@enThe{\noexpand#1{\@enumctr}}% \@enLab\expandafter{\the\@enLab\csname the\@enumctr\endcsname}% \@enloop} % \end{macrocode} % \end{macro} % % \begin{macro}{\@enSpace} % \begin{macro}{\@enSp@ce} % Add a space to the label. The tricky bit is to gobble the space token, % as you can not do this with a macro argument. % \begin{macrocode} \def\@enSpace{\afterassignment\@enSp@ce\let\@memtempa= } \def\@enSp@ce{\@enLab\expandafter{\the\@enLab\space}\@enloop} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@enGroup} % Add a |{ }| group to the label. % \begin{macrocode} \def\@enGroup#1{\@enLab\expandafter{\the\@enLab{#1}}\@enloop} % \end{macrocode} % \end{macro} % % \begin{macro}{\@enOther} % Add anything else to the label % \begin{macrocode} \def\@enOther#1{\@enLab\expandafter{\the\@enLab#1}\@enloop} % \end{macrocode} % \end{macro} % % \begin{macro}{\@enloop} % \begin{macro}{\@enloop@} % The body of the main loop. % Eating tokens this way instead of using |\@tfor| lets you see % spaces and {\bf all} braces. |\@tfor| would treat {\tt a} and % |{a}| as special, but not |{{a}}|. % \begin{macrocode} \def\@enloop{\futurelet\@entemp\@enloop@} % \end{macrocode} % \begin{macrocode} \def\@enloop@{% \ifx A\@entemp \def\@memtempa{\@enLabel\Alph }\else \ifx a\@entemp \def\@memtempa{\@enLabel\alph }\else \ifx i\@entemp \def\@memtempa{\@enLabel\roman }\else \ifx I\@entemp \def\@memtempa{\@enLabel\Roman }\else \ifx 1\@entemp \def\@memtempa{\@enLabel\arabic}\else \ifx \@sptoken\@entemp \let\@memtempa\@enSpace \else \ifx \bgroup\@entemp \let\@memtempa\@enGroup \else \ifx \@enum@\@entemp \let\@memtempa\@gobble \else \let\@memtempa\@enOther % \end{macrocode} % Hook for possible extensions % \begin{macrocode} \@enhook % \end{macrocode} % % \begin{macrocode} \fi\fi\fi\fi\fi\fi\fi\fi % \end{macrocode} % \end{macro} % Process the current token, then look at the next. % \begin{macrocode} \@memtempa} % \end{macrocode} % \end{macro} % % \begin{macro}{\@enhook} % Hook for possible extensions. % Some packages may want to extend the number of special characters % that are associated with counter representations. This feature % was requested to enable Russian alphabetic counting, but here % I give an example of a footnote symbol counter, triggered by |*|. % % To enable a new counter type based on a letter, you just need % to add a new |\ifx| clause by analogy with the code above. % So for example to make |*| trigger footnote symbol counting. % a package should do the following. % % Initialise the hook, in case the package is loaded before % \textsf{enumerate}. %\begin{verbatim} % \providecommand\@enhook{} %\end{verbatim} % % Add to the hook a new |\ifx| clause that associates |*| with the % |\fnsymbol| counter command. %\begin{verbatim} % \g@addto@macro\@enhook{% % \ifx *\@entemp % \def\@memtempa{\@enLabel\fnsymbol}% % \fi} %\end{verbatim} % This code sequence should work whether it is loaded before or after % this enumerate package. Any number of new counter types may be added % in this way. % % At this point we just need initialise the hook, taking care not % to over write any definitions another package may already have added. % (PRW: as this is now in a class, it can be defined instead of % |\provide|d). % \begin{macrocode} %% \providecommand\@enhook{} \newcommand\@enhook{} % \end{macrocode} % \end{macro} % % \begin{macro}{\enumerate} % The new {\tt enumerate} environment. This is the first half of the % original enumerate environment. If there is an optional argument, call % |\@@enum@| to define the label commands, otherwise call % |\@enum@| which is the second half of the original definition. % \begin{macrocode} \def\enumerate{% \ifnum \@enumdepth >3 \@toodeep\else \advance\@enumdepth \@ne \edef\@enumctr{enum\romannumeral\the\@enumdepth}\fi \@ifnextchar[{\@@enum@}{\@enum@}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@@enum@} % Handle the optional argument.. % \begin{macrocode} \def\@@enum@[#1]{% % \end{macrocode} % Initialise the loop which will break apart the optional argument. % The command to print the label is built up in |\@enlab|. % |\@enThe| will be used to define |\theenum|\,$n$. % \begin{macrocode} \@enLab{}\let\@enThe\@enQmark % \end{macrocode} % The |\@enum@| below is never expanded, it is used to detect the end % of the token list. % \begin{macrocode} \@enloop#1\@enum@ % \end{macrocode} % Issue a warning if we did not find one of the `special' tokens. % \begin{macrocode} \ifx\@enThe\@enQmark\@warning{The counter will not be printed.% ^^J\space\@spaces\@spaces\@spaces The label is: \the\@enLab}\fi % \end{macrocode} % Define |\labelenum|$\,n$ and |\theenum|$\,n$. % \begin{macrocode} \expandafter\edef\csname label\@enumctr\endcsname{\the\@enLab}% \expandafter\let\csname the\@enumctr\endcsname\@enThe % \end{macrocode} % Set the counter to 7 so that we get the width of `vii' if roman % numbering is in force then set |\leftmargin|$\,n$. to the width of the % label plus |\labelsep|. % \begin{macrocode} \csname c@\@enumctr\endcsname7 \expandafter\settowidth \csname leftmargin\romannumeral\@enumdepth\endcsname {\the\@enLab\hspace{\labelsep}}% % \end{macrocode} % Finally call |\@enum@| which is the second half of the original % definition. % \begin{macrocode} \@enum@} % \end{macrocode} % \end{macro} % % \begin{macro}{\@enum@} % All the list parameters have now been defined, so call |\list|. This % is taken straight from the original definition of |\enumerate|. % \begin{macrocode} \def\@enum@{\list{\csname label\@enumctr\endcsname}% {\usecounter{\@enumctr}\def\makelabel##1{\hss\llap{##1}}}} % \end{macrocode} % \end{macro} % % END OF DAVID CARLISLE'S CODE AND COMMENTARY % % % % \subsubsection{Itemize} % % % \begin{macro}{\labelitemi} % \begin{macro}{\labelitemii} % \begin{macro}{\labelitemiii} % \begin{macro}{\labelitemiii} % Itemization is controlled by the commands: |\labelitemi|, % |\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 % (\textperiodcentered). % % \begin{macrocode} \newcommand{\labelitemi}{\textbullet} \newcommand{\labelitemii}{\normalfont\bfseries \textendash} \newcommand{\labelitemiii}{\textasteriskcentered} \newcommand{\labelitemiv}{\textperiodcentered} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % It seems like a reasonable idea to give the |itemize| environment % an optional argument to match |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|. % \begin{macrocode} \renewcommand{\itemize}[1][\@empty]{% \ifnum \@itemdepth >\thr@@\@toodeep\else \advance\@itemdepth\@ne \ifx \@empty #1\else % optional argument \@namedef{labelitem\romannumeral\the\@itemdepth}{#1}% \fi \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}% \expandafter \list \csname\@itemitem\endcsname {\def\makelabel##1{\hss\llap{##1}}}% \fi} \let\enditemize =\endlist % \end{macrocode} % \end{environment} % % \subsubsection{Description} % % The class defines two description environment, the standard one and a `block' % one. % % \changes{v1.2}{2002/07/27}{Now two `description' environments.} % % \begin{environment}{description} % The description environment is defined here -- while the default itemize % and enumerate environments are defined in \file{latex.dtx}. % % \changes{v1.2}{2002/07/27}{The \texttt{description} environment now matches % the standard layout.} % \begin{macrocode} \newenvironment{description}% {\list{}{\labelwidth\z@ \itemindent-\leftmargin \let\makelabel\descriptionlabel}}% {\endlist} % \end{macrocode} % \end{environment} % % \begin{macro}{\descriptionlabel} % To change the formatting of the label, you must redefine % |\descriptionlabel|. % % \begin{macrocode} \newcommand*{\descriptionlabel}[1]{\hspace\labelsep \normalfont\bfseries #1} % \end{macrocode} % \end{macro} % % \begin{environment}{blockdescription} % The `block' description environment. % % \changes{v1.2}{2002/07/27}{Renamed original \texttt{description} environment % to \texttt{blockdescription}.} % \begin{macrocode} \newenvironment{blockdescription}% {\list{}{\labelwidth\z@ \itemindent 0.5em \labelsep 0.5em \let\makelabel\blockdescriptionlabel}}% {\endlist} % \end{macrocode} % \end{environment} % % \begin{macro}{\blockdescriptionlabel} % To change the formatting of the label, you must redefine % |\blockdescriptionlabel|. % % \begin{macrocode} \newcommand*{\blockdescriptionlabel}[1]{%%% \hspace\labelsep \normalfont\bfseries #1} % \end{macrocode} % \end{macro} % % % \subsection{Verse} % % The class provides a more flexible |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} % % \subsubsection{Verse code} % % % \begin{macro}{vslineno} % We need counters for stanza and poem lines. % \changes{v1.1}{2002/03/10}{Added poemline and modulo@vs counters} % \begin{macrocode} \newcounter{vslineno} \newcounter{poemline} \newcounter{modulo@vs} % \end{macrocode} % \end{macro} % % \begin{macro}{\poemlines} % |\poemlines{|\meta{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}} % \begin{macrocode} \newcommand{\poemlines}[1]{\linenumberfrequency{#1}% \ClassWarning{memoir}{Use \string\linenumberfrequency\space instead of \string\poemlines}% } % \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}{\ifaltindent} % This should be set TRUE for indenting alternate lines. % \begin{macrocode} \newif\ifaltindent \altindentfalse % \end{macrocode} % \end{macro} % % \begin{macro}{\ifpattern} % This should be set TRUE for indenting lines according to a pattern. % \begin{macrocode} \newif\ifpattern \patternfalse % \end{macrocode} % \end{macro} % % \begin{macro}{\ifstarpattern} % This should be set TRUE for indenting lines according in a |patverse*| % environment. % \changes{v1.1}{2002/03/8}{Added \cs{ifstarpattern}} % \begin{macrocode} \newif\ifstarpattern \starpatternfalse % \end{macrocode} % \end{macro} % % % % % \begin{macro}{\vleftskip} % \begin{macro}{\vrightskip} % Skips to the left and right of a line of verse. % \changes{v1.1}{2002/03/24}{Added \cs{vleftskip} and \cs{vrightskip}} % \changes{v1.2}{2002/07/27}{Changed defaults for \cs{vleftskip} and \cs{vrightskip}} % \begin{macrocode} \newlength{\vleftskip} \setlength{\vleftskip}{3em} \newlength{\vrightskip} \setlength{\vrightskip}{1em} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\stanzaskip} % Skip between stanzas. % \changes{v1.2}{2002/07/07}{Added \cs{stanzaskip}} % \begin{macrocode} \newlength{\stanzaskip} \setlength{\stanzaskip}{\onelineskip} % \end{macrocode} % \end{macro} % % \begin{macro}{\flagverse} % |\flagverse{|\meta{flag}|}| inserts \meta{flag} at the left (of a line). % \changes{v1.1}{2002/03/24}{Added \cs{flagverse}} % \begin{macrocode} \newcommand{\flagverse}[1]{\hskip-\vleftskip\llap{#1}\hskip\vleftskip\ignorespaces} % \end{macrocode} % \end{macro} % % \begin{macro}{\versewidth} % The length |\versewidth| is a convenience length for the user. % \begin{macrocode} \newlength{\versewidth} % \end{macrocode} % \end{macro} % % \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 % of wrapped lines. % \begin{macrocode} \newlength{\vgap} \setlength{\vgap}{1.5em} \newcommand{\vin}{\hspace*{\vgap}} \newlength{\vindent} \setlength{\vindent}{2\vgap} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\verselinebreak} % Break a verse line by inserting |\newline|. % \changes{v1.1}{2002/03/28}{Modified \cs{verselinebreak}} % \begin{macrocode} \newcommand{\verselinebreak}[1][\z@]{\newline\hspace*{#1}% extra verseindent } % \end{macrocode} % \end{macro} % % \begin{macro}{\incr@vsline} % Increment the line counters. % \changes{v1.1}{2002/03/24}{Added poemline counter to \cs{incr@vsline}} % \begin{macrocode} \newcommand{\incr@vsline}{% \refstepcounter{poemline}% \stepcounter{vslineno}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@vsifbang} % Like the kernel |\@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}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@vsifgt} % Like the kernel |\@ifstar| except it looks for a |>| character. % \changes{v1.1}{2002/03/28}{Added \cs{@vsifgt}} % \begin{macrocode} \newcommand{\@vsifgt}[1]{\@ifnextchar >{\@firstoftwo{#1}}} % \end{macrocode} % \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. % \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} % \begin{macrocode} \newcommand{\@vscentercr}{% \ifhmode \unskip\else \@nolnerr\fi \hfill\rlap{\kern\vrightskip\kern\rightmargin% \vlvnumfont\getthelinenumber{poemline}}% % \end{macrocode} % For |>| call |\verselinebreak| to process it. % \begin{macrocode} \@vsifgt{\verselinebreak}{% \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|. % \begin{macrocode} \par\@ifstar{\nobreak\@vsxcentercr}{% % \end{macrocode} % \begin{macrocode} \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@vsxcentercr} % Processes |\\*|, and either calls |\@vsicentercr| to handle a |[length]|, % or |\start@vsline|. % \changes{v1.1}{2002/03/24}{Added \cs{@vsxcentercr}} % \begin{macrocode} \newcommand{\@vsxcentercr}{\addvspace{-\parskip}% \@ifnextchar[ {\@vsicentercr}{\start@vsline}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@vsicentercr} % Processes |(\\...)[length]| and then calls |\start@vsline|. % \changes{v1.1}{2002/03/24}{Added \cs{@vsicentercr}} % \begin{macrocode} \def\@vsicentercr[#1]{\vskip #1\ignorespaces \start@vsline} % \end{macrocode} % \end{macro} % % \begin{macro}{\start@vsline} % This is called at the start of every verse line except the first. % \changes{v1.1}{2002/03/28}{Added \cs{ifstarpattern} to \cs{start@vsline}} % \begin{macrocode} \newcommand{\start@vsline}{% \ifaltindent\ifodd\thevslineno\else\vin\fi\fi% \ifpattern\get@vsindent\fi% \ifstarpattern\getstar@vsindent\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\theHpoemline} % For the \Lpack{hyperref} package need a wat of distinguishing % lines of a poem. See ther thread \textit{PDFTEX/Hyperef hates memoir verse % environment?} on CTT October 2002. % \changes{v1.3}{2002/11/14}{Added verse counter and \cs{theHpoemline}} % \begin{macrocode} \newcounter{verse} \setcounter{verse}{0} \newcommand{\theHpoemline}{\theverse.\thepoemline} % \end{macrocode} % \end{macro} % % \begin{environment}{verse} % The extended |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. % \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} % \changes{v1.3}{2002/11/14}{Changes to verse environment for hyperref} % \begin{macrocode} \newenvironment{verse}[1][\linewidth]{ \refstepcounter{verse}% \setcounter{poemline}{0}\refstepcounter{poemline}% \setcounter{vslineno}{1}% \let\\=\@vscentercr \list{}{\itemsep \z@ \itemindent -\vindent% \listparindent\itemindent \parsep \stanzaskip \ifdim #1 < \linewidth \rightmargin \z@ \setlength{\leftmargin}{\linewidth}% \addtolength{\leftmargin}{-#1}% \addtolength{\leftmargin}{-0.5\leftmargin}% \else \rightmargin \leftmargin \fi \addtolength{\leftmargin}{\vindent}} \item[]}{\endlist} % \end{macrocode} % \end{environment} % % \begin{environment}{altverse} % This sets |\altindenttrue| (afterwards false) and initialises the line counter. % \changes{v1.1}{2002/03/28}{Added \cs{starpatternfalse} to altverse} % \begin{macrocode} \newenvironment{altverse}% {\starpatternfalse\patternfalse\altindenttrue\setcounter{vslineno}{1}}% {\altindentfalse} % \end{macrocode} % \end{environment} % % % \subsubsection{Pattern code} % % The pattern code is based on the idea of converting a string of % 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 % the array limits. % \begin{macrocode} \newif\ifbounderror \bounderrorfalse % \end{macrocode} % \end{macro} % % \begin{macro}{\ifinteger} % A flag to indicate if a `number' is an integer (TRUE) or not (FALSE). % \begin{macrocode} \newif\ifinteger % \end{macrocode} % \end{macro} % % \begin{macro}{\c@chrsinstr} % A counter for the number of characters. % \begin{macrocode} \newcounter{chrsinstr} % CHARactersINSTRing % \end{macrocode} % \end{macro} % % % \begin{macro}{\newarray} % |\newarray{|\meta{arrayname}|}{|\meta{low}|}{|\meta{high}|}| defines % an array called \meta{arrayname} (no backslash e.g. |MyArray|), % with low and high limts \meta{low} and \meta{high}. % \begin{macrocode} \newcommand{\newarray}[3]{% \@nameedef{#1-low}{#2}% \@nameedef{#1-high}{#3}% \ifnum #3<#2 \ClassError{memoir}{Limits for array #1 are in reverse order}{\@ehc}% \fi } % \end{macrocode} % \end{macro} % % % \begin{macro}{\stringtoarray} % |\stringtoarray{|\meta{arrayname}|}{|\meta{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. % \begin{macrocode} \newcommand{\stringtoarray}[2]{% \def\@vsarrayname{#1}% \protected@edef\the@vsstring{#2}% \newarray{\@vsarrayname}{1}{1}% \@ifmtarg{#2}{% \c@chrsinstr \z@ \@namedef{\@vsarrayname-1}{} }{% \c@chrsinstr \@ne \expandafter\@vsstringtoarray \the@vsstring\@vsend } } % \end{macrocode} % \end{macro} % % % \begin{macro}{\@vsstringtoarray} % Recursively adds characters to the array |\@vsarrayname|, incrementing % the array's high limit. % \begin{macrocode} \def\@vsstringtoarray #1#2\@vsend{% \@namedef{\@vsarrayname-\the\c@chrsinstr}{#1} \@nameedef{\@vsarrayname-high}{\the\c@chrsinstr} \@ifmtarg{#2}{% \def\@vsinext{}% }{% \advance\c@chrsinstr \@ne \def\@vsinext{% \@vsstringtoarray #2\@vsend% }% } \@vsinext } % \end{macrocode} % \end{macro} % % % \begin{macro}{\setarrayelement} % |\setarrayelement{|\meta{arrayname}|}{|\meta{index}|}{|\meta{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}% } % \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 % the value at \meta{index} in the \meta{arrayname} array. % \begin{macrocode} \newcommand{\getarrayelement}[3]{% \checkarrayindex{#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| % is set FALSE if everything is OK, otherwise it is set TRUE. % \begin{macrocode} \newcommand{\checkarrayindex}[2]{% \bounderrorfalse \expandafter\ifx\csname #1-low\endcsname\relax% \ifpattern\else \ClassError{memoir}{No array called #1}{\@ehc}% \fi \bounderrortrue \fi \ifnum #2<\@nameuse{#1-low}\relax% \ifpattern\else \ClassError{memoir}{Index #2 outside limits for array #1}{\@ehc}% \fi \bounderrortrue \fi \ifnum #2>\@nameuse{#1-high}\relax% \ifpattern\else \ClassError{memoir}{Index #2 outside limits for array #1}{\@ehc}% \fi \bounderrortrue \fi } % \end{macrocode} % \end{macro} % % % \begin{macro}{\arraytostring} % |\arraytostring{|\meta{arrayname}|}{|\meta{string}|}| converts the % characters in the \meta{arrayname} array into the parameterless macro % \meta{string} (e.g., |\MyString|). % \begin{macrocode} \newcommand{\arraytostring}[2]{% \def#2{}% \c@chrsinstr = \@nameuse{#1-low}% \@vsarraytostring{#1}{#2}% } % \end{macrocode} % \end{macro} % % % \begin{macro}{\@vsarraytostring} % |\@vsarraytostring{|\meta{arrayname}|}{|\meta{string}|}| recursively % adds the (character) elements from \meta{arrayname} to \meta{string}. % \begin{macrocode} \newcommand{\@vsarraytostring}[2]{% \ifnum\c@chrsinstr>\@nameuse{#1-high}\else \protected@edef#2{#2\@nameuse{#1-\thechrsinstr}}% \advance\c@chrsinstr\@ne% \@vsarraytostring{#1}{#2}% \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. % (Code based on Donald Arseneau's \Lpack{cite} package). % \begin{macrocode} \newcommand{\checkifinteger}[1]{% \protected@edef\@vsa{#1}% \ifcat _\ifnum9<1\gobm{#1} _\else A\fi \integertrue% \else \integerfalse% \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}| \\ % which would remove a leading minus sign (hyphen) from its argument % (|gobm| = gobble minus sign). % (Code from a posting to CTT by Donald Arseneau on 1997/07/21). % \begin{macrocode} \newcommand{\gobm}[1]{#1} % \end{macrocode} % \end{macro} % % \begin{macro}{\indentpattern} % |\indentpattern{|\meta{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|. % \begin{macrocode} \newcommand{\get@vsindent}{% \getarrayelement{Array@vs}{\thevslineno}{\@vspat}% \ifbounderror \arraytostring{Array@vs}{\@vsp@t}% \ClassWarning{memoir}{% Index `\thevslineno' for pattern `\@vsp@t' is out of bounds}% \def\@vspat{0}% \else \checkifinteger{\@vspat}% \ifinteger\else \arraytostring{Array@vs}{\@vsp@t}% \ClassWarning{memoir}{% `\@vspat' at index `\thevslineno' in pattern `\@vsp@t' is not a digit}% \def\@vspat{0}% \fi \fi \ifcase\@vspat\else\hspace*{\@vspat\vgap}\fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\getstar@vsindent} % |\getstar@vsindent| gets the indent pattern digit for the |patverse*| % environment, % then uses this to specify the line indentation as |digit*\vgap|. % It lets the pattern repeat by resetting the |vslineno| counter. % \changes{v1.1}{2002/03/28}{Added \cs{getstar@vsindent}} % \begin{macrocode} \newcommand{\getstar@vsindent}{% \expandafter\ifx\csname Array@vs-high\endcsname\relax \ClassError{memoir}{A pattern has not been specified}{\@ehc} \else \ifnum\c@vslineno>\@nameuse{Array@vs-high}% \setcounter{vslineno}{1}% \fi \get@vsindent \fi} % \end{macrocode} % \end{macro} % % % \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. % \changes{v1.1}{2002/03/28}{Added \cs{starpatternfalse} to patverse} % \begin{macrocode} \newenvironment{patverse}% {\starpatternfalse\patterntrue\altindentfalse\setcounter{vslineno}{1}}% {\patternfalse} % \end{macrocode} % \end{environment} % % \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. % \changes{v1.1}{2002/03/28}{Added patverse* environment} % \begin{macrocode} \newenvironment{patverse*}% {\starpatterntrue\patternfalse\altindentfalse\setcounter{vslineno}{1}}% {\starpatternfalse} % \end{macrocode} % \end{environment} % % % \subsection{Title code} % % \begin{macro}{\poemtitle} % Typeset a poem title (like |\section| or other). The actual work % is done by |\@vsptitle| (plain) or |\@vssptitle| (starred). % \begin{macrocode} \newcommand{\poemtitle}{\par% \secdef\@vsptitle\@vssptitle} % \end{macrocode} % \end{macro} % % \begin{macro}{\poemtoc} % The kind of entry |\poemtitle| is to make in the ToC. % \begin{macrocode} \newcommand{\poemtoc}{section} % \end{macrocode} % \end{macro} % % \begin{macro}{\@vsptitle} % Typeset a |poemtitle|. % \changes{v1.3}{2002/11/14}{Added \cs{phantomsection} to \cs{@vsptitle}} % \begin{macrocode} \def\@vsptitle[#1]#2{% \phantomsection \addcontentsline{toc}{\poemtoc}{#1} \poemtitlemark{#1}% \@vstypeptitle{#2} \@afterheading} % \end{macrocode} % \end{macro} % % \begin{macro}{\@vssptitle} % Typeset a |\poemtitle*|. % \begin{macrocode} \def\@vssptitle#1{% \@vstypeptitle{#1} \@afterheading} % \end{macrocode} % \end{macro} % % \begin{macro}{\@vstypeptitle} % This \emph{really} typesets the title. % \begin{macrocode} \newcommand{\@vstypeptitle}[1]{% \vspace{\beforepoemtitleskip} {\poemtitlefont #1\par} \vspace{\afterpoemtitleskip} } % \end{macrocode} % \end{macro} % % \begin{macro}{\poemtitlefont} % \begin{macro}{\poemtitlemark} % Sets the appearance to the title of a poem, and something for a header. % \begin{macrocode} \newcommand{\poemtitlefont}{\normalfont\large\bfseries\centering} \newcommand{\poemtitlemark}[1]{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\beforepoemtitleskip} % \begin{macro}{\afterpoemtitleskip} % Lengths before and after a poem title, using the |\section| values. % \begin{macrocode} \newlength{\beforepoemtitleskip} \setlength{\beforepoemtitleskip}{3.5ex \@plus 1ex \@minus .2ex} \newlength{\afterpoemtitleskip} \setlength{\afterpoemtitleskip}{2.3ex \@plus.2ex} % \end{macrocode} % \end{macro} % \end{macro} % % % % \subsection{Defining new environments} % % % \subsubsection{Quotation} % % \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 % inside this environment is indented. % % \begin{macrocode} \newenvironment{quotation}% {\list{}{\listparindent 1.5em% \itemindent \listparindent \rightmargin \leftmargin \parsep \z@ \@plus\p@}% \item[]}% {\endlist} % \end{macrocode} % \end{environment} % % \subsubsection{Quote} % % % \begin{environment}{quote} % The quote environment is like the quotation environment except % that paragraphs are not indented. % % \begin{macrocode} \newenvironment{quote}% {\list{}{\rightmargin\leftmargin}% \item[]}% {\endlist} % \end{macrocode} % \end{environment} % % \subsubsection{Theorem} % % This document class does not define it's own theorem environments, % the defaults, supplied by \file{latex.dtx} are available. % % % % \subsubsection{Listing of symbols and abbreviations} % % Another possible element is the listing of symbols % and abbreviations. % % \begin{environment}{symbols} % \begin{macro}{\symbollabel} % \begin{macrocode} \newcommand{\symbollabel}[1]{{#1 \hfill}} % \end{macrocode} % \end{macro} % \begin{macrocode} \newenvironment{symbols}{\list{}% {\itemindent 0em \leftmargin 8em \labelsep 1em \labelwidth 5em \let\makelabel\symbollabel}}% {\endlist} % \end{macrocode} % \end{environment} % % \begin{macro}{\symboldef} % Within a |symbols| environment the command % |\symboldef{|\meta{symbol}|}{|\meta{meaning}|}| % is used to specify and explain each symbol or abbreviation. % \begin{macrocode} \newcommand{\symboldef}[2]{\item[#1] #2} % \end{macrocode} % \end{macro} % % % % \subsection{Setting parameters for existing environments} % % \subsubsection{Array and tabular} % % \begin{macro}{\arraycolsep} % The columns in an array environment are separated by % 2|\arraycolsep|. % \begin{macrocode} \setlength\arraycolsep{5\p@} % \end{macrocode} % \end{macro} % % \begin{macro}{\tabcolsep} % The columns in an tabular environment are separated by % 2|\tabcolsep|. % \begin{macrocode} \setlength\tabcolsep{6\p@} % \end{macrocode} % \end{macro} % % \begin{macro}{\arrayrulewidth} % The width of rules in the array and tabular environments is given % by\\ |\arrayrulewidth|. % \begin{macrocode} \setlength\arrayrulewidth{.4\p@} % \end{macrocode} % \end{macro} % % \begin{macro}{\doublerulesep} % The space between adjacent rules in the array and tabular % environments is given by |\doublerulesep|. % \begin{macrocode} \setlength\doublerulesep{2\p@} % \end{macrocode} % \end{macro} % % \subsubsection{Tabbing} % % \begin{macro}{\tabbingsep} % This controls the space that the |\'| command puts in. (See % \LaTeX{} manual for an explanation.) % \begin{macrocode} \setlength\tabbingsep{\labelsep} % \end{macrocode} % \end{macro} % % \subsubsection{Minipage} % % \begin{macro}{\@minipagerestore} % The macro |\@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. % \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 % for ordinary footnotes. % % \begin{macrocode} \skip\@mpfootins = \skip\footins % \end{macrocode} % \end{macro} % % \subsubsection{Framed boxes} % % \begin{macro}{\fboxsep} % The space left by |\fbox| and |\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|. % \begin{macrocode} \setlength\fboxsep{3\p@} \setlength\fboxrule{.4\p@} % \end{macrocode} % \end{macro} % \end{macro} % % \subsubsection{Equation and eqnarray} % % |equation| and |eqnarray| counters are not required by ISO, and % the equations are to be left-justified. The default is for the % left-hand side of equations to be flushleft. % \begin{macro}{\theequation} % 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 % the definition of the chapter counter. % \begin{macrocode} \@addtoreset{equation}{chapter} \renewcommand{\theequation}{% \ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@equation} % \end{macrocode} % \end{macro} % % \begin{macro}{\jot} % |\jot| is the extra space added between lines of an eqnarray % environment. The default value is used. % \begin{macrocode} % \setlength\jot{3pt} % \end{macrocode} % \end{macro} % % \begin{macro}{\@eqnnum} % The macro |\@eqnnum| defines how equation numbers are to appear in % equations. Again the default is used. % % \begin{macrocode} % \def\@eqnnum{(\theequation)} % \end{macrocode} % \end{macro} % % \subsection{Floating objects} % % The file \file{latex.dtx} only defines a number of tools with % which floating objects can be defined. This is done in the % document class. It needs to define the following macros for each % floating object of type \texttt{TYPE} (e.g., \texttt{TYPE} = % figure). % % \begin{description} % \item[\texttt{\bslash fps@TYPE}] % The default placement specifier for floats of type % \texttt{TYPE}. % % \item[\texttt{\bslash ftype@TYPE}] % The type number for floats of type \texttt{TYPE}. Each % \texttt{TYPE} has associated a unique positive \texttt % {TYPE} number, which is a power of two. E.g., figures might % have type number 1, tables type number 2, programs type % number 4, etc. % % \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'. % % \item[\texttt{\bslash fnum@TYPE}] % A macro to generate the figure number for a caption. For % example, |\fnum@TYPE| == `Figure |\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. % 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|, % 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 % \texttt{TYPE} with \meta{placement} as the placement specifier. % The default value of \meta{PLACEMENT} is defined by |\fps@TYPE|. % % The environment is ended by |\end@float|. E.g., |\figure| == % |\@float|{figure}, |\endfigure| == |\end@float|. % % % \subsubsection{New floats} % % To define a float environment, say |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 % \Lpack{hyperref} package will be used). % \end{itemize} % % \begin{macro}{newflo@tctr} % A counter for the type number of a new float. Normally % figures are of type 1, tables type 2, and the next float type is then 4, and so % on. % \begin{macrocode} \newcounter{newflo@tctr} \setcounter{newflo@tctr}{1} % \end{macrocode} % \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 % file extension and \meta{capname} for the caption name. % \begin{macrocode} \newcommand{\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}} % \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 |\ext@X| for the file extension and set the new |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} % |\fps@X| is the default float placement specification, |\fnum@X| % typesets the caption name and number, and |\flegX| and |\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 |\newfloat|. % \begin{macrocode} } % end \newfloat % \end{macrocode} % \end{macro} % % % % % % % % To define subcaptions for use in a new float environment, say |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 % \end{itemize} % % \begin{macro}{\newsubfloat} % |\newsubfloat{|\meta{fenv}|}| creates the commands for a new % subfloat for \meta{fenv} (aka X). % \begin{macrocode} \newcommand{\newsubfloat}[1]{% % \end{macrocode} % Call |\newlistentry[X]{subX}{extX}{1}| to get most of the work done. % \begin{macrocode} \newlistentry[#1]{sub#1}{\@nameuse{ext@#1}}{1} % \end{macrocode} % % \begin{macro}{\ext@subX} % \begin{macro}{\thesubX} % \begin{macro}{\@thesubX} % \begin{macro}{\@@thesubX} % \begin{macro}{\p@subX} % \begin{macro}{\toclevel@subX} % And now for the rest of the commands for subcaptions. % \changes{v1.1}{2002/03/10}{Added \cs{@namedef} of \cs{@@thesubenv} % to \cs{newsubfloat}} % \changes{v1.1}{2002/03/10}{Added \cs{@namedef} of \cs{toclevel@subenv} % to \cs{newsubfloat}} % \begin{macrocode} \@namedef{ext@sub#1}{\csname ext@#1\endcsname} \@namedef{thesub#1}{(\alph{sub#1})} \@namedef{@thesub#1}{\@nameuse{thesub#1}% \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} } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % 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|. % % \begin{macro}{\ifdonemaincaption} % This is set TRUE after the |\(cont)caption| has been called in a float. % \changes{v1.1}{2002/03/10}{Changed \cs{if@contmaincaption} to % \cs{ifdonemaincaption}} % \begin{macrocode} \newif\ifdonemaincaption \donemaincaptionfalse % \end{macrocode} % \end{macro} % % \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 % counter, if it is defined. % \begin{macrocode} \let\@memoldfloat\@float \renewcommand{\@float}[1]{\donemaincaptionfalse \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax} \@memoldfloat{#1}} \let\@memolddblfloat\@dblfloat \renewcommand{\@dblfloat}[1]{\donemaincaptionfalse \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax} \@memolddblfloat{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\end@float} % \begin{macro}{\end@dblfloat} % The kernel |\end@float| and |\end@dblfloat| macros are redefined to % dump out any subcaptions that have not yet been processed. % \begin{macrocode} \let\@memoldefloat\end@float \renewcommand{\end@float}{% \@memlistsubcaptions{\@captype}\@memoldefloat} \let\@memoldedblfloat\end@dblfloat \renewcommand{\end@dblfloat}{% \@memlistsubcaptions{\@captype}\@memoldedblfloat} % \end{macrocode} % \end{macro} % \end{macro} % % \subsection{Captions} % % The caption styling % is accomplished by redefining the |\@makecaption| % command. First, though, define and initialise the user-level commands. % % \begin{macro}{\if@contcw} % \begin{macro}{\if@conthang} % \begin{macro}{\if@contindent} % For use when checking caption width and captioning styles styles. % \begin{macrocode} \newif\if@contcw \newif\if@conthang \newif\if@contindent % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\captiondelim} % \begin{macro}{\@contdelim} % For the caption delimeter. % \begin{macrocode} \newcommand{\captiondelim}[1]{\def\@contdelim{#1}} \captiondelim{: } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\captionnamefont} % \begin{macro}{\@contnfont} % The font for the caption name. % \begin{macrocode} \newcommand{\captionnamefont}[1]{\def\@contnfont{#1}} \captionnamefont{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\captiontitlefont} % \begin{macro}{\@conttfont} % The font for the caption title. % \begin{macrocode} \newcommand{\captiontitlefont}[1]{\def\@conttfont{#1}} \captiontitlefont{} % \end{macrocode} % \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 % normal (block) paragraphing values, % while |\centerlastline| sets the skips to give a centered last line in % a block paragraph. % \begin{macrocode} \newcommand{\flushleftright}{% \leftskip\z@ \rightskip\z@ \parfillskip=\z@ plus 1fil} \newcommand{\centerlastline}{% \leftskip=\z@ plus 1fil \rightskip=\z@ plus -1fil \parfillskip=\z@ plus 2fil} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\captionstyle} % \begin{macro}{\@contcstyle} % The paragraphing style for the caption. % \begin{macrocode} \newcommand{\captionstyle}[1]{\def\@contcstyle{#1}} \captionstyle{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@contcwidth} % \begin{macro}{\captionwidth} % \begin{macro}{\changecaptionwidth} % \begin{macro}{\normalcaptionwidth} % The macros for dealing with the caption width. % \begin{macrocode} \newlength{\@contcwidth} \newcommand{\captionwidth}[1]{\setlength{\@contcwidth}{#1}} \captionwidth{\linewidth} \newcommand{\changecaptionwidth}{\@contcwtrue} \newcommand{\normalcaptionwidth}{\@contcwfalse} \normalcaptionwidth % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@contindw} % \begin{macro}{\hangcaption} % \begin{macro}{\indentcaption} % \begin{macro}{\normalcaption} % The macros for hanging and indented captions. % \begin{macrocode} \newlength{\@contindw} \newcommand{\hangcaption}{\@conthangtrue\@contindentfalse} \newcommand{\indentcaption}[1]{\setlength{\@contindw}{#1}% \@conthangfalse\@contindenttrue} \newcommand{\normalcaption}{\@conthangfalse\@contindentfalse} \normalcaption % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\precaption} % \begin{macro}{\@contpre} % \begin{macro}{\postcaption} % \begin{macro}{\@contpost} % \begin{macro}{\midbicaption} % \begin{macro}{\@contmidbi} % The macros for the pre- and post-caption text/commands, and % for the mid-caption command for bilingual captions. % \begin{macrocode} \newcommand{\precaption}[1]{\def\@contpre{#1}} \precaption{} \newcommand{\postcaption}[1]{\def\@contpost{#1}} \postcaption{} \newcommand{\midbicaption}[1]{\def\@contmidbi{#1}} \midbicaption{} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\abovecaptionskip} % \begin{macro}{\belowcaptionskip} % Vertical space above and below a caption. Make them sum to an % integral number of lines. % \begin{macrocode} \newlength{\abovecaptionskip} \setlength{\abovecaptionskip}{0.5\onelineskip} \newlength{\belowcaptionskip} \setlength{\belowcaptionskip}{0.5\onelineskip} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\caption} % For subfloat support, the (kernel) |\caption| macro needs to note that it % has been called. % \begin{macrocode} \let\@memoldcaption\caption \def\caption{\donemaincaptiontrue\@memoldcaption} % \end{macrocode} % \end{macro} % % \begin{macro}{\@makecaption} % This is a reimplementation of the kernel |\@makecaption| command. % As well as including the caption typesetting commands it enables % captions that include forced newlines (e.g., by |\\|). % % 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 % 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 % 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}} % \begin{macrocode} \long\def\@makecaption#1#2{\let\@memtempa\relax \ifdim\prevdepth>-99\p@ \vskip\abovecaptionskip \else \def\@memtempa{\vbox to\topskip{}}\fi % \end{macrocode} % \begin{macro}{\@contfnote} % \begin{macro}{\@contfmark} % The caption title will be typeset twice, firstly to measure its width % and secondly to actually typeset it. To avoid problems caused by % a footnote in the caption getting processed twice, we temporarily % disable the expected relevant commands. % \begin{macrocode} \let\@contfnote\footnote \renewcommand{\footnote}[2][]{} \let\@contfmark\footnotemark \renewcommand{\footnotemark}[1][]{} % \end{macrocode} % \end{macro} % \end{macro} % 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} \let\footnote\@contfnote \let\footnotemark\@contfmark % \end{macrocode} % If the caption is less than one % line, then the whole caption needs to be centered on the page (otherwise % the short caption may be typeset flushleft). % \begin{macrocode} \ifdim\wd\@tempboxa<\linewidth \centering \fi \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. % \begin{macrocode} \centering \parbox{\@contcwidth}{% % \end{macrocode} % Henrik Holm\footnote{Email from \texttt{henrik@tele.ntnu.no} on % 2002/02/10.} proposed adding the next line to center short, narrow captions. % \begin{macrocode} \ifdim\wd\@tempboxa<\@contcwidth \centering \fi \fi \if@conthang % \end{macrocode} % For a hanging caption we have to measure the width of the caption name, % then typeset the whole caption in a hanging paragraph. % \changes{v1.1}{2002/03/10}{Changed code for hangcaption in \cs{@makecaption}} % \begin{macrocode} \sbox\@tempboxa{\@contnfont #1\@contdelim} \@contpre% {\@contcstyle\hangindent=\wd\@tempboxa\noindent\box\@tempboxa\@memtempa \@conttfont #2\par} \else \if@contindent % \end{macrocode} % An indented caption is similar, except the amount of indentation is % kept in |\@contindw|. % \begin{macrocode} \@contpre% {\@contnfont #1\@contdelim}\@memtempa {\@contcstyle\hangindent=\@contindw\hangafter=\@ne\@conttfont #2\par} \else % \end{macrocode} % For the normal style, just typeset the caption. % \begin{macrocode} \@contpre% {\@contnfont #1\@contdelim}\@memtempa {\@contcstyle\@conttfont #2\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 % vertical space. % \begin{macrocode} \@contpost \if@contcw \par } % end of the \parbox \fi \vskip\belowcaptionskip} % \end{macrocode} % \end{macro} % % % % \subsubsection{Continuation captions and legends} % % \begin{macro}{\contcaption} % |\contcaption{|\meta{text}|}| is a user-level command. % It is a simplified % version of the normal |\caption| command as it doesn't have to deal % with numbering or list of \dots entries. % \begin{macrocode} \newcommand{\contcaption}{\@contcaption\@captype} % \end{macrocode} % \end{macro} % % % \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) % to do most of its work. It % uses the number of the previous |\caption| command in the same % type of float and its implementation includes much of the code % used in the LaTeX |\@caption| command. % % First specify |\@@contcaption{|\meta{type}|}{|\meta{title}|}| % to save some repetitive code. % \begin{macrocode} \long\def\@@contcaption#1#2{% \par \begingroup \@parboxrestore \if@minipage \@setminipage \fi \normalsize \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #2}\par \endgroup} % \end{macrocode} % \end{macro} % % Now for |\@contcaption{|\meta{type}|}{|\meta{title}|}|. % It has to flush out any subcaptions at the % appropriate time, as well as typesetting the caption. % \begin{macrocode} \long\def\@contcaption#1#2{% \if@contbotsub \@memlistsubcaptions{#1}% \@@contcaption{#1}{#2}% \else \@@contcaption{#1}{#2}% \@memlistsubcaptions{#1}% \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\legend} % The command is called as |\legend{|\meta{text}|}|. It is intended % to be used in a float environment for an `anonymous' caption, but can be % used anywhere. % % The implementation is similar to the |\caption| command but we have % to eliminate printing of a delimeter. % \begin{macrocode} \newcommand{\legend}[1]{% \par \begingroup \@parboxrestore \if@minipage \@setminipage \fi \normalsize \captiondelim{\mbox{}} \@makecaption{}{\ignorespaces #1}\par \endgroup} % \end{macrocode} % \end{macro} % % % \begin{macro}{\namedlegend} % |\namedlegend[|\meta{short-title}|]{|\meta{long-title}|}| is like the % |\caption| command except that it does not number the caption. % \begin{macrocode} \newcommand{\namedlegend}{\@dblarg{\@legend\@captype}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@legend} % |\@legend{|\meta{type}|}[|\meta{short-title}|]{|\meta{long-title}|}| % is the workhorse for the |\namedlegend| command. In turn, it calls % |\@makelegend|. It requires two commands to have been defined, namely % |\flegtoctype| and |\flegtype|. The command |\flegtoctype{|\meta{text}|}| % is responsible for writing a title text to the appropriate listof file. % |\flegtype| is responsible for typeseting the name of the legend. % \begin{macrocode} \long\def\@legend#1[#2]#3{% \par \csname flegtoc#1\endcsname{#2}% \begingroup \@parboxrestore \if@minipage \@setminipage \fi \normalsize \@makecaption{\csname fleg#1\endcsname}{\ignorespaces #3}\par \endgroup} % \end{macrocode} % \end{macro} % % % \subsubsection{Non-float captions} % % \begin{macro}{\newfixedcaption} % \begin{macro}{\renewfixedcaption} % \begin{macro}{\providefixedcaption} % These commands are defined in terms of their |\...command| counterparts.\\ % Call as |\...fixedcaption[|\meta{capcommand}|]{|\meta{command}|}{|\meta{env}|}| % \begin{macrocode} \newcommand{\newfixedcaption}[3][\caption]{% \newcommand{#2}{\def\@captype{#3}#1}} \newcommand{\renewfixedcaption}[3][\caption]{% \renewcommand{#2}{\def\@captype{#3}#1}} \newcommand{\providefixedcaption}[3][\caption]{% \providecommand{#2}{\def\@captype{#3}#1}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \subsubsection{Bilingual captions} % % 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 % 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 % `required' arguments are used as the implementation means. % % % \begin{macro}{\bitwonumcaption} % The 6 arguments are: optional label, short and long in language 1, % name in % language 2, and short and long in language 2. Both texts are put % into the List of as numbered entries. % \begin{macrocode} \newcommand{\bitwonumcaption}[6][\@empty]{% \begingroup % \end{macrocode} % Check if the first language argument is vacuous, then call % the normal |\caption| for language 1. % \begin{macrocode} \@ifmtarg{#2}{\caption{#3}}{\caption[#2]{#3}} % \end{macrocode} % Do the optional labeling. % \begin{macrocode} \ifx \@empty #1\else \label{#1} \fi % \end{macrocode} % Remove any extra spacing between the captions, and set the % NAME for the second caption. Use a command to transfer % the NAME to the renewell code to avoid circularity if % for example, we are trying to redefine |\tablename| as % |\tablename|. Decrement the caption counter. % \begin{macrocode} \setlength{\abovecaptionskip}{0pt} \setlength{\belowcaptionskip}{0pt} \edef\@memtempc{#4} \expandafter \renewcommand \csname \@captype name\endcsname{\@memtempc} \addtocounter{\@captype}{-1} % \end{macrocode} % Now repeat for the second language caption. % \begin{macrocode} \@contmidbi \@ifmtarg{#5}{\caption{#6}}{\caption[#5]{#6}} \endgroup } % \end{macrocode} % \end{macro} % % \begin{macro}{\bionenumcaption} % The 6 arguments are: optional labelling, % short and long in language 1, name in % language 2, and short and long in language 2. Both texts are put % into the List of, but only the first is numbered. % \begin{macrocode} \newcommand{\bionenumcaption}[6][\@empty]{% \begingroup % \end{macrocode} % Check if the first language argument is vacuous, then call % the normal |\caption| for language 1. % \begin{macrocode} \@ifmtarg{#2}{\caption{#3}}{\caption[#2]{#3}} % \end{macrocode} % Do the optional labeling. % \begin{macrocode} \ifx \@empty #1\else \label{#1} \fi % \end{macrocode} % Do the between captions code. % \begin{macrocode} \setlength{\abovecaptionskip}{0pt} \setlength{\belowcaptionskip}{0pt} \edef\@memtempc{#4} \expandafter \renewcommand \csname \@captype name\endcsname{\@memtempc} % \end{macrocode} % Use a continuation caption for the second language, not forgetting % to add the appropriate unnumbered text to the List. % \begin{macrocode} \@contmidbi \contcaption{#6} \@ifmtarg{#5}{% \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}% {\protect\numberline{}{\ignorespaces #6}}}{% \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}% {\protect\numberline{}{\ignorespaces #5}}} \endgroup } % \end{macrocode} % \end{macro} % % \begin{macro}{\bicaption} % The 5 arguments are: optional labelling, % short and long in language 1, name in % language 2, and long in language 2. % Only the first text is put into the List. % \begin{macrocode} \newcommand{\bicaption}[5][\@empty]{% \begingroup % \end{macrocode} % Check if the first language argument is vacuous, then call % the normal |\caption| for language 1. % \begin{macrocode} \@ifmtarg{#2}{\caption{#3}}{\caption[#2]{#3}} % \end{macrocode} % Do the optional labeling. % \begin{macrocode} \ifx \@empty #1\else \label{#1} \fi % \end{macrocode} % Do the between captions code and % finally just use |\contcaption| for the % second language. % \begin{macrocode} \setlength{\abovecaptionskip}{0pt} \setlength{\belowcaptionskip}{0pt} \edef\@memtempc{#4} \expandafter \renewcommand \csname \@captype name\endcsname{\@memtempc} \@contmidbi \contcaption{#5} \endgroup } % \end{macrocode} % \end{macro} % % \begin{macro}{\bicontcaption} % The 3 arguments are long in language 1, name in % language 2, and long in language 2. % \begin{macrocode} \newcommand{\bicontcaption}[3]{% \begingroup % \end{macrocode} % Call |\contcaption| for language 1. % \begin{macrocode} \contcaption{#1} % \end{macrocode} % Do the between captions code and use |\contcaption| for the second % language. % \begin{macrocode} \setlength{\abovecaptionskip}{0pt} \setlength{\belowcaptionskip}{0pt} \edef\@memtempc{#2} \expandafter \renewcommand \csname \@captype name\endcsname{\@memtempc} \@contmidbi \contcaption{#3} \endgroup } % \end{macrocode} % \end{macro} % % % % \subsubsection{Support for the \Lopt{subfigure} package functionality} % % Much of the code in this section is based on the \Lpack{subfigure} % package code, by kind permission of its author, Steven Douglas Cochran. % To try and avoid clashes with the real \Lpack{subfigure} code I have % used different macro names, especially when I have copied the code. % % \begin{macro}{\subcaptionstyle} % \begin{macro}{\@contsubcstyle} % The paragraphing style for subcaptions. % \begin{macrocode} \newcommand{\subcaptionstyle}[1]{\def\@contsubcstyle{#1}} \subcaptionstyle{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\if@shortsubcap} % \begin{macro}{\if@hangsubcap} % \begin{macro}{\shortsubcaption} % \begin{macro}{\hangsubcaption} % \begin{macro}{\normalsubcaption} % For dealing with short and hanging subcaptions. % Analagous to the \Lpack{subfigure} |nooneline| and |hang| options. % The default is normal subcaptions. % \begin{macrocode} \newif\if@shortsubcap \newif\if@hangsubcap \newcommand*{\shortsubcaption}{\@shortsubcaptrue} \newcommand*{\hangsubcaption}{\@hangsubcaptrue} \newcommand*{\normalsubcaption}{\@shortsubcapfalse\@hangsubcapfalse} \normalsubcaption % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\subfloattopskip} % \begin{macro}{\subfloatcapskip} % \begin{macro}{\subfloatcaptopadj} % \begin{macro}{\subfloatbottomskip} % \begin{macro}{\subfloatlabelskip} % \begin{macro}{\subfloatcapmargin} % These |\subfloat...| lengths are analagous to the \Lpack{subfigure} % |\subfig...| lengths. % \begin{macrocode} \newskip\subfloattopskip \newskip\subfloatcapskip \newskip\subfloatcaptopadj \newskip\subfloatbottomskip \newskip\subfloatlabelskip \newdimen\subfloatcapmargin % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\if@tightsubcap} % \begin{macro}{\loosesubcaptions} % \begin{macro}{\tightsubcaptions} % Unlike the \Lpack{subfigure} package the class provides no options for % subcaptions. These macros provide the \Lpack{subfigure} loose/tight % option functions. Set the default to tight. % \begin{macrocode} \newif\if@tightsubcap \newcommand{\loosesubcaptions}{% \subfloattopskip = 10\p@ \subfloatcapskip = 10\p@ \subfloatcaptopadj = \z@ \subfloatbottomskip = 10\p@ \subfloatlabelskip = 0.33em \subfloatcapmargin = 10\p@ \@tightsubcapfalse } \newcommand{\tightsubcaptions}{% \subfloattopskip = 5\p@ \subfloatcapskip = \z@ \subfloatcaptopadj = 3\p@ \subfloatbottomskip = 5\p@ \subfloatlabelskip = 0.33em \@plus 0.07em \@minus 0.03em \subfloatcapmargin = \z@ \@tightsubcaptrue } \tightsubcaptions % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\subcaptionsize} % \begin{macro}{\@subcapsize} % \begin{macro}{\subcaptionlabelfont} % \begin{macro}{\@subcaplabelfont} % \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. % \begin{macrocode} \newcommand*{\subcaptionsize}[1]{\def\@subcapsize{#1}} \newcommand*{\subcaptionlabelfont}[1]{\def\@subcaplabelfont{#1}} \newcommand*{\subcaptionfont}[1]{\def\@subcapfont{#1}} \subcaptionsize{\footnotesize} \subcaptionlabelfont{\normalfont} \subcaptionfont{\normalfont} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \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. % \begin{macrocode} \newcounter{@contsubnum} \newcommand{\@contkeep}{\setcounter{@contsubnum}{\value{sub\@captype}}} \newcommand{\@contset}{\setcounter{sub\@captype}{\value{@contsubnum}}} \newcommand{\subconcluded}{\setcounter{sub\@captype}{0}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % % \begin{macro}{\if@contbotsub} % A flag indicating whether the subcaption is to be at the bottom or % top of the subfloat; TRUE for the subcaption at the bottom. % \begin{macrocode} \newif\if@contbotsub \@contbotsubtrue % \end{macrocode} % \end{macro} % % \begin{macro}{\subcaption} % |\subcaption[|\meta{list-entry}|]{|\meta{caption}|}| is a generic % subcaption. There is no \Lpack{subfigure} equivalent. % \begin{macrocode} \newcommand{\subcaption}{% \bgroup \let\label=\memsub@label \ifdonemaincaption\else \advance\csname c@\@captype\endcsname\@ne \fi \refstepcounter{sub\@captype}\@contkeep \@ifnextchar [% {\@memsubcap{sub\@captype}}% {\@memsubcap{sub\@captype}[\@empty]}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@memsubcap} % This handles the optional argument to |\subcaption|. It sets |\@tempdima| % to |\hsize| as later on |\@makesubfloatcaption| uses this. % \changes{v1.1a}{2002/04/28}{Added \cs{@tempdima} to \cs{@memsubcap}} % \begin{macrocode} \long\def\@memsubcap#1[#2]#3{% \@tempdima=\hsize \vskip\subfloatcapskip \ifx \@empty #2 \@memsubcaption{#1}{#3}{#3}% \else \@memsubcaption{#1}{#2}{#3}% \fi \vskip\subfloatcapskip \egroup} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@memsubcaption} % |\@memsubcaption{|\meta{type}|}{|\meta{list-entry}|}{|\meta{caption}|}| % typesets a subcaption. This is a copy of the \Lpack{subfigure} % |\@subcaption| macro. % \begin{macrocode} \newcommand{\@memsubcaption}[3]{% \ifx \relax#2\relax \else \bgroup \let\label\@gobble \let\protect\string \def\@memsubcaplabel{\@nameuse{@@the#1}}% \xdef\@memsubfigcaptionlist{% \@memsubfigcaptionlist,% {\protect\numberline{\@memsubcaplabel}\noexpand{\ignorespaces #2}}}% \egroup \fi \@makesubfloatcaption{\@nameuse{@the#1}}{#3}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\contsubcaption} % |\contsubcaption[|\meta{caption}|]| is the continued version of % |\subcaption|. % \begin{macrocode} \newcommand{\contsubcaption}{% \bgroup \let\label=\memsub@label \@contset \refstepcounter{sub\@captype}\@contkeep \@ifnextchar [% {\@memsubcap{sub\@captype}}% {\@memsubcap{sub\@captype}[\@empty]}} % \end{macrocode} % \end{macro} % % % \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|. % \begin{macrocode} \newenvironment{subfloat}{}{} % \end{macrocode} % \end{environment} % % % % \begin{macro}{\subbottom} % \begin{macro}{\@memsubbody} % |\subbottom[|\meta{list-entry}|][|\meta{subcaption}|]{|\meta{text}|}| % typesets a subcaption below the \meta{text}. Most of the work is % performed by the |\@memsubbody| macro. % \begin{macrocode} \newcommand{\subbottom}{% \@contbotsubtrue \@memsubbody} \newcommand{\@memsubbody}{% \bgroup \let\label=\memsub@label \ifdonemaincaption\else \advance\csname c@\@captype\endcsname\@ne \fi \refstepcounter{sub\@captype}\@contkeep% \leavevmode \@ifnextchar [% {\@memsubfig}% {\@memsubfig[\@empty]}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\contsubbottom} % \begin{macro}{\@memcontsubbody} % These are the continued versions of |\subbottom| and |\@memsubbody|. % \begin{macrocode} \newcommand{\contsubbottom}{% \@contbotsubtrue \@memcontsubbody} \newcommand{\@memcontsubbody}{% \bgroup \let\label=\memsub@label \@contset \refstepcounter{sub\@captype}\@contkeep% \leavevmode \@ifnextchar [% {\@memsubfig}% {\@memsubfig[\@empty]}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\subtop} % \begin{macro}{\contsubtop} % These are similar to |\subbottom| and |\contsubbottom| except that they % put the subcaption on top of the \meta{text}. % \begin{macrocode} \newcommand{\subtop}{% \@contbotsubfalse \@memsubbody} \newcommand{\contsubtop}{% \@contbotsubfalse \@memcontsubbody} % \end{macrocode} % \end{macro} % \end{macro} % % \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 % --- just the called macro names are changed. % \begin{macrocode} \def\@memsubfig[#1]{% \@ifnextchar [% {\@memsubfloat{sub\@captype}[#1]}% {\@memsubfloat{sub\@captype}[\@empty #1][#1]}} % \end{macrocode} % \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|. % \begin{macrocode} \def\@memsubfloat#1[#2][#3]#4{% \@tempcnta=\@ne \if@tightsubcap \if@minipage \@tempcnta=\z@ \else \ifdim\lastskip=\z@ \@tempcnta=\@ne \else \@tempcnta=\tw@ \fi \fi \fi \if@contbotsub \def\subfig@top{\subfloattopskip}% \def\subfig@bottom{\subfloatbottomskip}% \else \def\subfig@top{\subfloatbottomskip}% \def\subfig@bottom{\subfloattopskip}% \fi \setbox\@tempboxa \hbox{#4}% \@tempdima=\wd\@tempboxa \vtop\bgroup \vbox\bgroup \ifcase\@tempcnta \@minipagefalse \or \vspace{\subfig@top} \or \ifdim \lastskip=\z@ \else \@tempskipb\subfig@top\@xaddvskip \fi \fi \if@contbotsub \box\@tempboxa\egroup \ifx \@empty#3\relax \else \vskip\subfloatcapskip \@memsubcaption{#1}{#2}{#3}% \fi \else \ifx \@empty#3\relax \else \@memsubcaption{#1}{#2}{#3}% \vskip\subfloatcapskip \vskip\subfloatcaptopadj \fi\egroup \box\@tempboxa \fi \vspace{\subfig@bottom} \egroup \egroup} % \end{macrocode} % \end{macro} % % % The following series of macros, from \Lpack{subfigure}, control the % typesetting of the subcaptions. % % \begin{macro}{\@memsubfigcaptionlist} % A copy of |\@subfigcaptionlist|. % \begin{macrocode} \newcommand*{\@memsubfigcaptionlist}{} % \end{macrocode} % \end{macro} % % % \begin{macro}{\memlistsubcaptions} % A copy of |\listsubcaptions|. % \begin{macrocode} \newcommand*{\memlistsubcaptions}{% \@ifstar {\gdef\@memsubfigcaptionlist{}}% {\@memlistsubcaptions{\@captype}}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@memlistsubcaptions} % A copy of |\@listsubcaptions|. % \begin{macrocode} \newcommand*{\@memlistsubcaptions}[1]{% \@ifundefined{@captype}{}{% \@ifundefined{ext@sub#1}{}{% \@for \@tempa:=\@memsubfigcaptionlist \do {% \ifx \@empty\@tempa\relax \else \addcontentsline{\@nameuse{ext@sub#1}}{sub#1}{\@tempa}% \fi}}}% \gdef\@memsubfigcaptionlist{}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@makesubfloatcaption} % This is a copy of |\@makesubfigurecaption|. % \begin{macrocode} \newcommand{\@makesubfloatcaption}[2]{% \setbox\@tempboxa\hbox{% \@subcapsize {\@subcaplabelfont #1}{\@subcapfont\ignorespaces #2}}% \@tempdimb=-\subfloatcapmargin \multiply\@tempdimb\tw@ \advance\@tempdimb\@tempdima \hb@xt@\@tempdima{% \hss \ifdim \wd\@tempboxa >\@tempdimb \memsubfig@caption{#1}{#2}% \else \if@shortsubcap \memsubfig@caption{#1}{#2}% \else \box\@tempboxa \fi \fi \hss}} % \end{macrocode} % \end{macro} % % \begin{macro}{\memsubfig@caption} % This is a copy of |\subfig@caption|. % \begin{macrocode} \newcommand{\memsubfig@caption}[2]{% \if@hangsubcap \sbox{\@tempboxa}{\@subcapsize\@subcaplabelfont #1}% \addtolength{\@tempdimb}{-\wd\@tempboxa}% \usebox{\@tempboxa}% \memsubfig@captionpar{\@tempdimb}{% {\@subcapfont\ignorespaces #2}}% \else \memsubfig@captionpar{\@tempdimb}{{\@subcaplabelfont #1}% {\@subcapfont\ignorespaces #2}}% \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\memsubfig@captionpar} % This replaces |\subfig@captionpar|. % \begin{macrocode} \newcommand{\memsubfig@captionpar}[2]{% \parbox[t]{#1}{\@subcapsize\@contsubcstyle #2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\memsub@label} % These are copies of |\sub@label| and |\subref|. % \begin{macrocode} \newcommand{\memsub@label}{% \@ifnextchar (% {\sf@memsub@label}% {\sf@memsub@label(Sub\@captype\space \@nameuse{p@sub\@captype}% \@nameuse{thesub\@captype})}} % \end{macrocode} % \end{macro} % % \begin{macro}{\sf@memsub@label} % This is a copy of |\sf@sub@label|. % \begin{macrocode} \def\sf@memsub@label(#1)#2{% \protected@edef\mem@currentlabelname{#1}% \sf@@memsub@label{#2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\sf@@memsub@label} % This is an expanded copy of |\sf@@sub@label| processed after any packages may % have been loaded. % \begin{macrocode} \AtBeginDocument{% \@ifpackageloaded{nameref}{% % \end{macrocode} % The \Lpack{nameref} package is loaded. % \begin{macrocode} \newcommand*{\sf@@memsub@label}[1]{% \@bsphack \protected@write\@auxout{}{% \string\newlabel{#1}% {{\@nameuse{p@sub\@captype}\@nameuse{@@thesub\@captype}}% {\thepage}% {\mem@currentlabelname\relax}% {\@currentHref}{}}}% \protected@write\@auxout{}{% \string\newlabel{sub@#1}% {{\@nameuse{@@thesub\@captype}}% {\thepage}% {\mem@currentlabelname\relax}% {\@currentHref}{}}}% \@esphack} }{\@ifpackageloaded{hyperref}{% % \end{macrocode} % The \Lpack{hyperref} package is loaded, but not \Lpack{nameref}. % \begin{macrocode} \newcommand*{\sf@@memsub@label}[1]{% \@bsphack \protected@write\@auxout{}{% \string\newlabel{#1}% {{\@nameuse{p@sub\@captype}\@nameuse{@@thesub\@captype}}% {\thepage}% {\mem@currentlabelname\relax}% {\@currentHref}{}}}% \protected@write\@auxout{}{% \string\newlabel{sub@#1}% {{\@nameuse{@@thesub\@captype}}% {\thepage}% {\mem@currentlabelname\relax}% {\@currentHref}{}}}% \@esphack} }{% % \end{macrocode} % Neither the \Lpack{hyperref} nor the \Lpack{nameref} % package is loaded. % \begin{macrocode} \let\@memoldlabel\label \newcommand*{\sf@@memsub@label}[1]{% \@bsphack \@memoldlabel{#1}% \protected@write\@auxout{}{% \string\newlabel{sub@#1}% {{\@nameuse{@@thesub\@captype}}% {\thepage}}}% \@esphack} }{}% } } % \end{macrocode} % \end{macro} % % \begin{macro}{\subcaptionref} % This is a copy of the |\subref| macro. % \begin{macrocode} \newcommand*{\subcaptionref}{% \@ifstar{\ssc@ref}{\sc@ref}} % \end{macrocode} % \end{macro} % % \begin{macro}{\ssc@ref} % \begin{macro}{\sc@ref} % The implementation of the starred and unstarred forms of |\subcaptionref|. % \begin{macrocode} \newcommand*{\ssc@ref}[1]{\ref{sub@#1}} \newcommand*{\sc@ref}[1]{{\@subcaplabelfont\ref{sub@#1}}} % \end{macrocode} % \end{macro} % \end{macro} % % % % % % \subsection{Marginpars} % % A |\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 % 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 % to the kernel code. The first is at the beginning where I have added % the |\checkoddpage| page checking code. % \begin{macrocode} \def\@addmarginpar{% \checkoddpage % \end{macrocode} % Continue with the kernel code. % \begin{macrocode} \@next\@marbox\@currlist{\@cons\@freelist\@marbox \@cons\@freelist\@currbox}\@latexbug\@tempcnta\@ne \if@twocolumn \if@firstcolumn \@tempcnta\m@ne \fi \else \if@mparswitch % \end{macrocode} % The next line, reading \\ % |\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} \ifoddpage \else \@tempcnta\m@ne \fi \fi \if@reversemargin \@tempcnta -\@tempcnta \fi \fi \ifnum\@tempcnta <\z@ \global\setbox\@marbox\box\@currbox \fi \@tempdima\@mparbottom \advance\@tempdima -\@pageht \advance\@tempdima\ht\@marbox \ifdim\@tempdima >\z@ % \end{macrocode} % The next line in the kernel reads: \\ % |\@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} \@latex@warning@no@line {Marginpar on page \thepage\space moved by \the\@tempdima}% \else \@tempdima\z@ \fi \global\@mparbottom\@pageht \global\advance\@mparbottom\@tempdima \global\advance\@mparbottom\dp\@marbox \global\advance\@mparbottom\marginparpush \advance\@tempdima -\ht\@marbox \global\setbox \@marbox \vbox {\vskip \@tempdima \box \@marbox}% \global \ht\@marbox \z@ \global \dp\@marbox \z@ \kern -\@pagedp \nointerlineskip \hb@xt@\columnwidth {\ifnum \@tempcnta >\z@ \hskip\columnwidth \hskip\marginparsep \else \hskip -\marginparsep \hskip -\marginparwidth \fi \box\@marbox \hss}% \nointerlineskip \hbox{\vrule \@height\z@ \@width\z@ \@depth\@pagedp}% } % \end{macrocode} % \end{macro} % % \subsection{Epigraphs} % % This code comes from the \Lpack{epigraph} package~\cite{EPIGRAPH}. % % \begin{macro}{\beforeepigraphskip} % \begin{macro}{\afterepigraphskip} % \begin{macro}{\epigraphwidth} % \begin{macro}{\epigraphrule} % The several length commands, which can be changed by the user with % |\setlength|. % \begin{macrocode} \newlength{\beforeepigraphskip} \setlength{\beforeepigraphskip}{.5\baselineskip} \newlength{\afterepigraphskip} \setlength{\afterepigraphskip}{.5\baselineskip} \newlength{\epigraphwidth} \setlength{\epigraphwidth}{.4\textwidth} \newlength{\epigraphrule} \setlength{\epigraphrule}{.4\p@} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\epigraphsize} % The size of the font to be used. % \begin{macrocode} \newcommand{\epigraphsize}{\small} % \end{macrocode} % \end{macro} % % \begin{macro}{\epigraphflush} % \begin{macro}{\textflush} % \begin{macro}{\sourceflush} % The three commands to position epigraphs in the textblock and to position % the components of the epigraph. % \begin{macrocode} \newcommand{\epigraphflush}{flushright} \newcommand{\textflush}{flushleft} \newcommand{\sourceflush}{flushright} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\epigraphfontsize} % \begin{macro}{\epigraphposition} % \begin{macro}{\epigraphtextposition} % \begin{macro}{\epigraphsourceposition} % These are declarative forms of the above. It's a bit late now, but % the previous macros should have been internal. % \changes{v1.2}{2002/08/10}{Added some declarations for epigraphs.} % \begin{macrocode} \newcommand{\epigraphfontsize}[1]{\def\epigraphsize{#1}} \newcommand{\epigraphposition}[1]{\long\def\epigraphflush{#1}} \newcommand{\epigraphtextposition}[1]{\def\textflush{#1}} \newcommand{\epigraphsourceposition}[1]{\def\sourceflush{#1}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % % % \begin{macro}{\@epirule} % The internal command to draw a rule between text and source. % \begin{macrocode} \newcommand{\@epirule}{\rule[.5ex]{\epigraphwidth}{\epigraphrule}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@epitext} % The internal command to typeset the \meta{text}. Put it into a minipage of the % right size and typeset per |\textflush|. % \begin{macrocode} \newcommand{\@epitext}[1]{% \begin{minipage}{\epigraphwidth}\begin{\textflush} #1\\ % \end{macrocode} % Draw a rule if it will be visible, otherwise add some extra vertical space. % \begin{macrocode} \ifdim\epigraphrule>\z@ \@epirule \else \vspace*{1ex} \fi \end{\textflush}\end{minipage}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@episource} % The internal command for typesetting the \meta{source}, which is put % into a minipage and typeset according to |\sourceflush|. % \begin{macrocode} \newcommand{\@episource}[1]{% \begin{minipage}{\epigraphwidth}\begin{\sourceflush} #1\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|. % \begin{macrocode} \newcommand{\epigraph}[2]{\vspace{\beforeepigraphskip} {\epigraphsize\begin{\epigraphflush}\begin{minipage}{\epigraphwidth} \@epitext{#1}\\ \@episource{#2} \end{minipage}\end{\epigraphflush} \vspace{\afterepigraphskip}}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\qitem} % \begin{macro}{\qitemlabel} % |\qitem| is the epigraph list version of |\item|. % Set everything inside a minipage. % \begin{macrocode} \newcommand{\qitem}[2]{{\raggedright\item \begin{minipage}{\epigraphwidth} \@epitext{#1}\\ \@episource{#2} \end{minipage}}} % \end{macrocode} % |\qitemlabel| is needed for a list as well. It is not going to % typeset anything. % \begin{macrocode} \newcommand{\qitemlabel}[1]{\hfill} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{environment}{epigraphs} % Now for the epigraph list. This is defined in terms of a |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. % \begin{macrocode} \vspace{\beforeepigraphskip}\begin{\epigraphflush} \epigraphsize \begin{minipage}{\epigraphwidth} \list{}% % \end{macrocode} % Make the list just fit the minipage (i.e., no indents). % \begin{macrocode} {\itemindent\z@ \labelwidth\z@ \labelsep\z@ \leftmargin\z@ \rightmargin\z@ \let\makelabel\qitemlabel}}% {\endlist\end{minipage}\end{\epigraphflush} \vspace{\afterepigraphskip}} % \end{macrocode} % \end{environment} % % \subsubsection{Epigraphs before a chapter title} % % % \begin{macro}{\@epichapapp} % \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. % \begin{macrocode} \newcommand{\dropchapter}[1]{% \let\@epichapapp\@chapapp \renewcommand{\@chapapp}{\vspace*{#1}\@epichapapp}} \newcommand{\undodrop}{\let\@chapapp\@epichapapp} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % Placing an epigraph before a chapter title uses the scheme outlined % by Piet van Oostrum~\cite{FANCYHDR}. This is to put a zero sized % picture into the page header. % % \begin{macro}{\if@epirhs} % \begin{macro}{\if@epicenter} % Two booleans for testing whether an epigraph is to be at the RH margin, % centered, or at the LH margin. The default is RH margin. % \begin{macrocode} \newif\if@epirhs \@epirhstrue \newif\if@epicenter \@epicentertrue % \end{macrocode} % \end{macro} % \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|. % \begin{macrocode} \newcommand{\@epipos}{ \long\def\@ept{flushleft} \ifx\epigraphflush\@ept \@epirhsfalse \@epicenterfalse \else \long\def\@ept{center} \ifx\epigraphflush\@ept \@epirhsfalse \@epicentertrue \else \@epirhstrue \@epicenterfalse \fi \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\epigraphhead} % |\epigraphhead[|\meta{distance}|]{|\meta{text}|}| puts \meta{text} at % \meta{distance} (a number, not a length) below the header at the % page position specified by |\epigraphflush|. % \begin{macrocode} \newcommand{\epigraphhead}[2][95]{% % \end{macrocode} % We have to use |\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, % so I'll use a command instead. % \begin{macrocode} \def\@epitemp{\begin{minipage}{\epigraphwidth}#2\end{minipage}} % \end{macrocode} % Define an |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. % \begin{macrocode} \@epipos \if@epirhs \def\@oddhead{\hfil\begin{picture}(0,0) \put(0,-#1){\makebox(0,0)[r]{\@epitemp}} \end{picture}} \else \if@epicenter \def\@oddhead{\hfil\begin{picture}(0,0) \put(0,-#1){\makebox(0,0)[b]{\@epitemp}} \end{picture}\hfil} \else \def\@oddhead{\begin{picture}(0,0) \put(0,-#1){\makebox(0,0)[l]{\@epitemp}} \end{picture}\hfil} \fi \fi \let\@evenhead\@oddhead \def\@oddfoot{\reset@font\hfil\thepage\hfil} \let\@evenfoot\@oddfoot} % \end{macrocode} % Make |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 % 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| % stores the \meta{distance} number. % |\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}} % \begin{macrocode} \newcommand{\the@epigraph}{} \newcommand{\@epidrop}{95} \newcommand{\epigraphforheader}[2][95]{% \def\@epidrop{#1}\long\def\the@epigraph{#2}} % \end{macrocode} % \end{macro} % \end{macro} % \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|. % \changes{v1.2}{2002/08/10}{Added \cs{epigraphpicture}} % \begin{macrocode} \newcommand{\epigraphpicture}{% \def\@epitemp{\begin{minipage}{\epigraphwidth}\the@epigraph\end{minipage}}% \@epipos \if@epirhs \begin{picture}(0,0)% \put(0,-\@epidrop){\makebox(0,0)[r]{\@epitemp}}% \end{picture}% \else \if@epicenter \begin{picture}(0,0)% \put(0,-\@epidrop){\makebox(0,0)[b]{\@epitemp}}% \end{picture}% \else \begin{picture}(0,0)% \put(0,-\@epidrop){\makebox(0,0)[l]{\@epitemp}}% \end{picture}% \fi \fi} % \end{macrocode} % \end{macro} % % % % \subsection{Font changing} % % The class does not support the old font changing commands unless the % \Lopt{oldfontcommands} option is used. % % \begin{macro}{\rm} % The old command for roman font. % \changes{v1.0a}{2002/01/29}{Changed definition of \cs{rm}} % \begin{macrocode} \if@memoldfont \DeclareOldFontCommand{\rm}{% \ClassWarning{memoir}{The \protect\rm\space font command is deprecated. \MessageBreak Try to use \protect\rmfamily\space or \protect\textrm\space instead}% \normalfont\rmfamily}{\mathrm} \else \def\rm{\ClassError{memoir}{Font command \protect\rm\space is not supported}{% Use \protect\textrm{...}, or {\protect\rmfamily\space ...}, or the oldfontcommands option}} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\sf} % The old sans font command. % \changes{v1.0a}{2002/01/29}{Changed definition of \cs{sf}} % \begin{macrocode} \if@memoldfont \DeclareOldFontCommand{\sf}{% \ClassWarning{memoir}{The \protect\sf\space font command is deprecated. \MessageBreak Try to use \protect\sffamily\space or \protect\textsf\space instead}% \normalfont\sffamily}{\mathsf} \else \def\sf{\ClassError{memoir}{Font command \protect\sf\space is not supported}{% Use \protect\textsf{...}, or {\protect\sffamily\space ...}, or the oldfontcommands option}} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\tt} % The old typewriter font command. % \changes{v1.0a}{2002/01/29}{Changed definition of \cs{tt}} % \begin{macrocode} \if@memoldfont \DeclareOldFontCommand{\tt}{% \ClassWarning{memoir}{The \protect\tt\space font command is deprecated. \MessageBreak Try to use \protect\ttfamily\space or \protect\texttt\space instead}% \normalfont\ttfamily}{\mathtt} \else \def\tt{\ClassError{memoir}{Font command \protect\tt\space is not supported}{% Use \protect\texttt{...}, or {\protect\ttfamily\space ...}, or the oldfontcommands option}} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\bf} % The old bold font command. % \changes{v1.0a}{2002/01/29}{Changed definition of \cs{bf}} % \begin{macrocode} \if@memoldfont \DeclareOldFontCommand{\bf}{% \ClassWarning{memoir}{The \protect\bf\space font command is deprecated. \MessageBreak Try to use \protect\bfseries\space or \protect\textbf\space instead}% \normalfont\bfseries}{\mathbf} \else \def\bf{\ClassError{memoir}{Font command \protect\bf\space is not supported}{% Use \protect\textbf{...}, or {\protect\bfseries\space ...}, or the oldfontcommands option}} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\it} % The old italic font command. % \changes{v1.0a}{2002/01/29}{Changed definition of \cs{it}} % \begin{macrocode} \if@memoldfont \DeclareOldFontCommand{\it}{% \ClassWarning{memoir}{The \protect\it\space font command is deprecated. \MessageBreak Try to use \protect\itshape\space or \protect\textit\space instead}% \normalfont\itshape}{\mathit} \else \def\it{\ClassError{memoir}{Font command \protect\it\space is not supported}{% Use \protect\textit{...}, or {\protect\itshape\space ...}, or the oldfontcommands option}} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\sl} % The old slanted font command. % \changes{v1.0a}{2002/01/29}{Changed definition of \cs{sl}} % \begin{macrocode} \if@memoldfont \DeclareOldFontCommand{\sl}{% \ClassWarning{memoir}{The \protect\sl\space font command is deprecated. \MessageBreak Try to use \protect\slshape\space or \protect\textsl\space instead}% \normalfont\slshape}{\@nomath\sl} \else \def\sl{\ClassError{memoir}{Font command \protect\sl\space is not supported}{% Use \protect\textsl{...}, or {\protect\slshape\space ...}, or the oldfontcommands option}} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\sc} % The old small caps font command. % \changes{v1.0a}{2002/01/29}{Changed definition of \cs{sc}} % \begin{macrocode} \if@memoldfont \DeclareOldFontCommand{\sc}{% \ClassWarning{memoir}{The \protect\sc\space font command is deprecated. \MessageBreak Try to use \protect\scshape\space or \protect\textsc\space instead}% \normalfont\scshape}{\@nomath\sc} \else \def\sc{\ClassError{memoir}{Font command \protect\sc\space is not supported}{% Use \protect\textsc{...}, or {\protect\scshape\space ...}, or the oldfontcommands option}} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\cal} % The old calligraphic font command. % \changes{v1.0a}{2002/01/29}{Added definition of \cs{cal}} % \begin{macrocode} \if@memoldfont \DeclareRobustCommand*\cal{% \ClassWarning{memoir}{The \protect\cal\space font command is deprecated. \MessageBreak Try to use \protect\mathcal\space instead}% \@fontswitch\relax\mathcal} \else \def\cal{\ClassError{memoir}{Font command \protect\cal\space is not supported}{% Use \protect\mathcal, or the oldfontcommands option}} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\mit} % The old math italic font command. % \changes{v1.0a}{2002/01/29}{Added definition of \cs{mit}} % \begin{macrocode} \if@memoldfont \DeclareRobustCommand*\mit{% \ClassWarning{memoir}{The \protect\mit\space font command is deprecated. \MessageBreak Try to use \protect\mathnormal\space instead}% \@fontswitch\relax\mathnormal} \else \def\mit{\ClassError{memoir}{Font command \protect\mit\space is not supported}{% Use \protect\mathnormal, or the oldfontcommands option}} \fi % \end{macrocode} % \end{macro} % % % \begin{macro}{\em} % The old emphasis font command. % \changes{v0.2}{2001/06/03}{Redid coding for \cs{emph} and \cs{em}} % \begin{macrocode} \let\@memoldem\em \DeclareTextFontCommand{\emph}{\@memoldem} \renewcommand{\em}{\@memoldem% \ClassWarning{memoir}{Font command \protect\em\space is deprecated.\MessageBreak Use \protect\emph{...} instead}} % \end{macrocode} % \end{macro} % % % % % % \section{Cross Referencing} \label{sec:xref} % % \subsection{Label referencing} % % \begin{macro}{\fref} % \begin{macro}{\tref} % \begin{macro}{\pref} % These are named references to labeled figures, tables and pages. % I find these % 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}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \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}} % \begin{macrocode} \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} % % % \subsection{Table of Contents, etc.} % % A |\section| command writes a % |\contentsline{section}{|\meta{title}|}{|\meta{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 % sectioning commands work similarly. % % A |\caption| command in a `figure' environment writes % % |\contentsline{figure}{\numberline{|\meta{num}|}{|% % \meta{caption}|}}{|\meta{page}|}| % % on the \file{.lof} file, where \meta{num} is the number produced % by |\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}|}| % % \begin{description} % \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. % \item[\meta{indent}] The indentation from the outer left margin % 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| % command. % \end{description} % % \begin{macro}{\@pnumwidth} % \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 % 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| % \item[\texttt{\bslash @dotsep}] Separation between dots, in mu % units. Should be defined as a number like 2 or 1.7 % \end{description} % % \begin{macrocode} \newcommand{\@pnumwidth}{1.55em} \newcommand{\@tocrmarg} {2.55em} \newcommand{\@dotsep}{4.5} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\tocentryskip} % \begin{macro}{\tocbaseline} % \begin{macro}{\tocskip} % We define two lengths and a utility command. % \begin{macrocode} \newlength{\tocentryskip} \setlength{\tocentryskip}{1em} \newlength{\tocbaseline} \setlength{\tocbaseline}{20pt} \newcommand{\tocskip}[1]{% \addtocontents{toc}{\protect\vspace{#1}}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \subsubsection{New List of \ldots} % % It is apparent that users want to do at least two things that are not % readily provided by the standard classes: (a) change the appearance % of the Table of Contents, etc., headings, and (b) create new List of\ldots. % This class provides a means of creating new Lists whose headings are % parameterized, thereby killing two birds with one stone. % % In this class the tables of % contents, figures etc. are always set in single-column style. % The titles are added to the ToC, unless the starred versions of the % commands are used. % % \begin{macro}{\ensureonecol} % \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. % \begin{macrocode} \newcommand*{\ensureonecol}{% \if@twocolumn \@restonecoltrue\onecolumn \else \@restonecolfalse \fi} \newcommand*{\restorefromonecol}{\if@restonecol\twocolumn\fi} % \end{macrocode} % \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|. % \begin{macrocode} \newlength{\cftparskip} \setlength{\cftparskip}{0pt} % \end{macrocode} % \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 % \meta{listofname}. The code for this is a heavily modified part % of the \Lpack{tocloft} package. % % \begin{macrocode} \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}. % % \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} \@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 |\Zheadstart| and |\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 |\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 |\printZtitle{|\meta{title}|}| % which defaults to |\printchaptertitle|. % \begin{macrocode} \@namedef{print#2title}##1{\printchaptertitle{##1}} % \end{macrocode} % \end{macro} % % This is the end of the definition of |\newlistof|. % \begin{macrocode} } % end \newlistof % \end{macrocode} % \end{macro} % % \begin{macro}{\@starttoc} % A list of macro calls |\@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} % % % \subsubsection{Table of Contents, etc} % % \begin{macro}{\tableofcontents} % \begin{macro}{\tableofcontents*} % These macros request that LaTeX produces a table of % contents. The ToC heading is added to the ToC unless the starred % version is used. % % \begin{macrocode} \newlistof{tableofcontents}{toc}{\contentsname} % \end{macrocode} % \end{macro} % \end{macro} % % The List of Figures and List of Tables are defined later. % % % % \subsubsection{List entries} % % Each command in the body of the text that makes an entry in the ToC, % or LoF or LoT needs an addtional macro to format the entry, as described % above. Users often want to change the formatting of the entries but % it is not immediately obvious how to do that. % % I have borrowed and modified more of the code from the \Lpack{tocloft} % package to enable easy creation and modification the formatting of the % entries. % % % \begin{macro}{\setpnumwidth} % \begin{macro}{\setrmarg} % User commands for setting |\@pnumwidth| and |\@tocrmarg|. % \begin{macrocode} \newcommand{\setpnumwidth}[1]{\renewcommand{\@pnumwidth}{#1}} \newcommand{\setrmarg}[1]{\renewcommand{\@tocrmarg}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\cftdot} % \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}|}| % 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|. % \begin{macrocode} \providecommand{\cftdot}{.} \providecommand{\cftdotfill}[1]{% \leaders\hbox{$\m@th\mkern #1 mu\hbox{\cftdot}\mkern #1 mu$}\hfill} % \end{macrocode} % \end{macro} % \end{macro} % % \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'. % \changes{v1.2}{2002/07/07}{Changed \cs{cftnodots} from 10,000 to 2,000 for % 17pt option and pdflatex} % \begin{macrocode} \providecommand{\cftdotsep}{4.5} \newcommand{\cftnodots}{2000} % \end{macrocode} % \end{macro} % \end{macro} % % Now for the trickier bits regarding the typesetting of the ToC % 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), % 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| % 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} % 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 % 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. % Essentially, my new definitions % consist of inlined versions of the code for |\@dottedtocline|. % % % \begin{macro}{\cftparfillskip} % The |\l@kind| commands modify (locally) the value of |\parfillskip|. % |\cftparfillskip| is a copy of the default \textit{\TeX book} % |\parfillskip| definition. % \begin{macrocode} \newcommand{\cftparfillskip}{\parfillskip=0pt plus1fil} % \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| % (see \file{ltsect.dtx} for the original % definition). % \begin{macrocode} \renewcommand{\numberline}[1]{% \hb@xt@\@tempdima{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb} % \end{macrocode} % \end{macro} % % \begin{macro}{\@cftbsnum} % \begin{macro}{\@cftasnum} % \begin{macro}{\@cftasnumb} % \begin{macrocode} \newcommand{\@cftbsnum}{} \newcommand{\@cftasnum}{} \newcommand{\@cftasnumb}{} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\newlistentry} % |\newlistentry[|\meta{within}|]{|\meta{counter}|}{|\meta{ext}|}{|\meta{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 % for the List of is \meta{ext} and \meta{level-1} is one less than the % level of the entry in the List of. % \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}. % % \begin{macro}{\c@X} % \begin{macro}{\theX} % Check if \meta{within} and \meta{counter} have been defined. It is % an error if \meta{within} has not been defined. \meta{counter} % will be created if it has not been previously defined. % Set the default counter values. % \begin{macrocode} \@ifundefined{c@#2}{% check & set the counter \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} % \end{macro} % % That finishes off the error checking. No matter what the result, the % rest of the new commands are defined. % % \begin{macro}{\l@X} % |\l@X{|\meta{title}|}{|\meta{page}|}| typesets the entry. % \begin{macrocode} \@namedef{l@#2}##1##2{% % \end{macrocode} % Only typeset if the |\Zdepth| is greater than \meta{level-1}. % \begin{macrocode} \ifnum \@nameuse{c@#3depth} > #4\relax % \end{macrocode} % Add some vertical space. % \begin{macrocode} \vskip \@nameuse{cftbefore#2skip} % \end{macrocode} % Start a group to keep paragraphing changes local. Set the |\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. % \begin{macrocode} \rightskip \@tocrmarg % \end{macrocode} % Ensure that the last line of an entry will be filled. Setting |\parfillskip| % to a negative value prevents `overfull box' messages. % \begin{macrocode} \parfillskip -\rightskip % \end{macrocode} % Set the paragraph's indentation to the entry's indentation. % \begin{macrocode} \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue % \end{macrocode} % Try and prevent breaks between lines in a multiline entry. % \begin{macrocode} \interlinepenalty\@M % \end{macrocode} % Make sure we have left vertical mode. % \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. % \begin{macrocode} \@tempdima \@nameuse{cft#2numwidth}\relax \expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname \expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname \expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\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 % indented. % \begin{macrocode} \advance\leftskip\@tempdima \null\nobreak\hskip -\leftskip % \end{macrocode} % Print the (number and) title, prohibiting any breqaking. % \begin{macrocode} {\@nameuse{cft#2font}##1}\nobreak % \end{macrocode} % Print the leader and the page number, and then close the group. % \begin{macrocode} \@nameuse{cft#2fillnum}{##2}} \fi } % end of \l@#2 % \end{macrocode} % \end{macro} % % Now define all the layout commands used by |\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} % The skip before the title. % \begin{macrocode} \expandafter\newlength\csname cftbefore#2skip\endcsname \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@} % \end{macrocode} % \end{macro} % \begin{macro}{\cftXindent} % \begin{macro}{\cftXnumwidth} % The indent and width for the number. % \begin{macrocode} \expandafter\newlength\csname cft#2indent\endcsname \expandafter\newlength\csname cft#2numwidth\endcsname % \end{macrocode} % Set the default values for the indent and numwidth depending on % the entry's level. A level of 1 corresponds to a figure entry % (no indent, and space for a number like N.N). % \begin{macrocode} \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 % \end{macrocode} % \end{macro} % \end{macro} % \begin{macro}{\cftXfont} % \begin{macro}{\cftXpresnum} % \begin{macro}{\cftXaftersnum} % \begin{macro}{\cftXaftersnumb} % \begin{macro}{\cftXdotsep} % \begin{macro}{\cftXleader} % \begin{macro}{\cftXpagefont} % \begin{macro}{\cftXafterpnum} % And the remaining commands; the only ones that are not null are for the % dotsep, the font and the leader % \begin{macrocode} \@namedef{cft#2font}{\normalfont} \@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}{} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\toclevel@X} % The hyperref package needs a command |\toclevel@X|, holding % the \meta{level-1} value. % \begin{macrocode} \@namedef{toclevel@#2}{#4} % \end{macrocode} % \end{macro} % % \begin{macro}{\cftXfillnum} % Typeset the leader and page number. % \begin{macrocode} \@namedef{cft#2fillnum}##1{% {\@nameuse{cft#2leader}}\nobreak \hb@xt@\@pnumwidth{% \hfil\@nameuse{cft#2pagefont}##1}\@nameuse{cft#2afterpnum}\par} % \end{macrocode} % \end{macro} % This ends the definition of |\newlistentry|. % \begin{macrocode} } % end \newlistentry % \end{macrocode} % \end{macro} % % % \begin{macro}{\cftsetindents} % |\cftsetindents{|\meta{entry}|}{|\meta{indent}|}{|\meta{numwidth}|}| sets % the \textit{indent} and \textit{numwidth} for entry \meta{entry}. % \begin{macrocode} \newcommand{\cftsetindents}[3]{% \setlength{\@nameuse{cft#1indent}}{#2} \setlength{\@nameuse{cft#1numwidth}}{#3} } % \end{macrocode} % \end{macro} % % % % % \begin{macro}{\l@part} % Can't use |\newlistentry| for this because of the initial penalty % and the final |\nobreak| code. % \begin{macrocode} \newcommand*{\l@part}[2]{% \ifnum \c@tocdepth >-2\relax \addpenalty{-\@highpenalty}% \addvspace{\cftbeforepartskip}% \begingroup {\leftskip \cftpartindent\relax \rightskip \@tocrmarg \parfillskip -\rightskip \parindent \cftpartindent\relax\@afterindenttrue \interlinepenalty\@M \leavevmode \@tempdima \cftpartnumwidth\relax \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} % % \begin{macro}{\partnumberline} % |\partnumberline| is a special version of |\numberline| output by |\part|. % It's default definition uis identical to |\numberline|. % \changes{v1.3}{2002/11/14}{Added \cs{partnumberline}} % \begin{macrocode} \newcommand{\partnumberline}[1]{% \hb@xt@\@tempdima{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb} % \end{macrocode} % \end{macro} % % \begin{macro}{\cftbeforepartskip} % \begin{macro}{\cftpartnumwidth} % \begin{macro}{\cftpartfont} % \begin{macro}{\cftpartpresnum} % \begin{macro}{\cftpartaftersnum} % \begin{macro}{\cftpartaftersnumb} % \begin{macro}{\cftpartleader} % \begin{macro}{\cftpartdotsep} % \begin{macro}{\cftpartpagefont} % \begin{macro}{\cftpartafterpnum} % \begin{macro}{\cftpartindent} % \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} % \begin{macrocode} \newlength{\cftbeforepartskip} \setlength{\cftbeforepartskip}{2.25em \@plus\p@} \newlength{\cftpartindent} \setlength{\cftpartindent}{0em} \newlength{\cftpartnumwidth} \setlength{\cftpartnumwidth}{1.5em} \newcommand{\cftpartfont}{\large\bfseries} \newcommand{\cftpartpresnum}{} \newcommand{\cftpartaftersnum}{} \newcommand{\cftpartaftersnumb}{} \newcommand{\cftpartleader}{\large\bfseries\cftdotfill{\cftpartdotsep}} \newcommand{\cftpartdotsep}{\cftnodots} \newcommand{\cftpartpagefont}{\large\bfseries} \newcommand{\cftpartafterpnum}{} \newcommand{\cftpartfillnum}[1]{% {\cftpartleader}% {\hb@xt@\@pnumwidth{\hss {\cftpartpagefont #1}}}\cftpartafterpnum\par} % \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} % % \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| % (see \file{classes.dtx} for the original definition). Can't use % |\newlistentry| for this because of the intial penalty. % \changes{v1.3}{2002/11/14}{Added \cs{cftchapterbreak} to \cs{l@chapter}} % \begin{macrocode} \newcommand*{\l@chapter}[2]{% \ifnum \c@tocdepth >\m@ne %% \addpenalty{-\@highpenalty}% replaced this by next line \cftchapterbreak \vskip \cftbeforechapterskip {\leftskip \cftchapterindent\relax \rightskip \@tocrmarg \parfillskip -\rightskip \parindent \cftchapterindent\relax\@afterindenttrue \interlinepenalty\@M \leavevmode \@tempdima \cftchapternumwidth\relax \let\@cftbsnum \cftchapterpresnum \let\@cftasnum \cftchapteraftersnum \let\@cftasnumb \cftchapteraftersnumb \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip {\cftchapterfont #1}\nobreak \cftchapterfillnum{#2}} \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\chapternumberline} % |\chapternumberline| is a special version of |\numberline| output by % |\chapter|. % It's default definition uis identical to |\numberline|. % \changes{v1.3}{2002/11/14}{Added \cs{chapternumberline}} % \begin{macrocode} \newcommand{\chapternumberline}[1]{% \hb@xt@\@tempdima{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb} % \end{macrocode} % \end{macro} % % \begin{macro}{\cftbeforechapterskip} % \begin{macro}{\cftchapterindent} % \begin{macro}{\cftchapternumwidth} % \begin{macro}{\cftchapterfont} % \begin{macro}{\cftchapterpresnum} % \begin{macro}{\cftchapteraftersnum} % \begin{macro}{\cftchapteraftersnumb} % \begin{macro}{\cftchapterleader} % \begin{macro}{\cftchapterdotsep} % \begin{macro}{\cftchapterpagefont} % \begin{macro}{\cftchapterafterpnum} % \begin{macro}{\cftchapterfillnum} % These are the user commands to control the typesetting of Chapter entries. % They are initialised to give the standard appearance. % \begin{macrocode} \newlength{\cftbeforechapterskip} \setlength{\cftbeforechapterskip}{1.0em \@plus\p@} \newlength{\cftchapterindent} \setlength{\cftchapterindent}{0em} \newlength{\cftchapternumwidth} \setlength{\cftchapternumwidth}{1.5em} \newcommand{\cftchapterfont}{\bfseries} \newcommand{\cftchapterpresnum}{} \newcommand{\cftchapteraftersnum}{} \newcommand{\cftchapteraftersnumb}{} \newcommand{\cftchapterleader}{\bfseries\cftdotfill{\cftchapterdotsep}} \newcommand{\cftchapterdotsep}{\cftnodots} \newcommand{\cftchapterpagefont}{\bfseries} \newcommand{\cftchapterafterpnum}{} \newcommand{\cftchapterfillnum}[1]{ {\cftchapterleader}\nobreak \hb@xt@\@pnumwidth{\hfil\cftchapterpagefont #1}\cftchapterafterpnum\par} % \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} % % \begin{macro}{\cftchapterbreak} % Another parameter for |\l@chapter|. % \changes{v1.3}{2002/11/14}{Added \cs{cftchapterbreak}} % \begin{macrocode} \newcommand{\cftchapterbreak}{\addpenalty{-\@highpenalty}} % \end{macrocode} % \end{macro} % % \begin{macro}{\l@section} % \begin{macro}{\l@subsection} % \begin{macro}{\l@subsubsection} % |\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. % \begin{macrocode} \newlistentry[chapter]{section}{toc}{0} \cftsetindents{section}{1.5em}{2.3em} \newlistentry[section]{subsection}{toc}{1} \cftsetindents{subsection}{3.8em}{3.2em} \newlistentry[subsection]{subsubsection}{toc}{2} \cftsetindents{subsubsection}{7.0em}{4.1em} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % To save on some macro names, use the |subsubsection| layout for % |paragraph| and |subparagraph|, except for the space for numbers. % % \begin{macro}{\l@paragraph} % |\l@paragraph{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for % a |paragraph| heading. % \begin{macrocode} \newcommand*{\l@paragraph}[2]{% \ifnum \c@tocdepth >3\relax \vskip \cftbeforesubsubsectionskip {\leftskip \cftparagraphindent\relax \rightskip \@tocrmarg \parfillskip -\rightskip \parindent \cftparagraphindent\relax\@afterindenttrue \interlinepenalty\@M \leavevmode \@tempdima \cftparagraphnumwidth\relax \let\@cftbsnum \cftsubsubsectionpresnum \let\@cftasnum \cftsubsubsectionaftersnum \let\@cftasnumb \cftsubsubsectionaftersnumb \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip {\cftsubsubsectionfont #1}\nobreak \cftsubsubsectionfillnum{#2}} \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\cftparagraphindent} % \begin{macro}{\cftparagraphnumwidth} % \begin{macrocode} \newlength{\cftparagraphindent} \newlength{\cftparagraphnumwidth} \cftsetindents{paragraph}{10.0em}{5.0em} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\l@subparagraph} % |\l@subparagraph{|\meta{title}|}{|\meta{page}|}| typesets the ToC entry for % a |subparagraph| heading. % \begin{macrocode} \newcommand*{\l@subparagraph}[2]{% \ifnum \c@tocdepth >4\relax \vskip \cftbeforesubsubsectionskip {\leftskip \cftsubparagraphindent\relax \rightskip \@tocrmarg \parfillskip -\rightskip \parindent \cftsubparagraphindent\relax\@afterindenttrue \interlinepenalty\@M \leavevmode \@tempdima \cftsubparagraphnumwidth\relax \let\@cftbsnum \cftsubsubsectionpresnum \let\@cftasnum \cftsubsubsectionaftersnum \let\@cftasnumb \cftsubsubsectionaftersnumb \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip {\cftsubsubsectionfont #1}\nobreak \cftsubsubsectionfillnum{#2}} \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\cftsubparagraphindent} % \begin{macro}{\cftsubparagraphnumwidth} % \begin{macrocode} \newlength{\cftsubparagraphindent} \newlength{\cftsubparagraphnumwidth} \cftsetindents{subparagraph}{12.0em}{6.0em} % \end{macrocode} % \end{macro} % \end{macro} % % The typesetting for Figures and Tables is defined later. % % % % \subsubsection{Support for the \Lpack{subfigure} package} % % The code for supporting the \Lpack{subfigure} package is, in all % essentials, the same as that for the figure and table captions; only the % names are changed. However, the code need only be executed if the % \Lpack{subfigure} package is actually loaded. % % \begin{macro}{\@cftl@subfigtab} % This command redefines the |\l@subfigure| and |\l@subtable| commands. % \begin{macrocode} \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. % \begin{macrocode} \newlistentry[figure]{subfigure}{lof}{1} \cftsetindents{subfigure}{2.3em}{2.5em} \newlistentry[table]{subtable}{lot}{1} \cftsetindents{subtable}{2.3em}{2.5em} } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % Call the \Lpack{subfigure} package setup code only if the % \Lopt{subfigure} package has been used. % \begin{macrocode} \AtBeginDocument{\@ifpackageloaded{subfigure}{\@cftl@subfigtab}{}} % \end{macrocode} % % % \subsubsection{Switching page numbering} % % It can, at times, be useful to be able to have ToC entries that have % no printed page numbers. % % \begin{macro}{\cftpagenumbersoff} % The user level command for switching off page numbers is % |\cftpagenumbersoff{|\meta{entry}|}| where \meta{entry} is the % name of the entry. % The macro redefines the |\cftXnumfill| command so that there is no leader % and the page number is ignored. % \begin{macrocode} \DeclareRobustCommand{\cftpagenumbersoff}[1]{% \@namedef{cft#1fillnum}##1{% \cftparfillskip\@nameuse{cft#1afterpnum}\par}} % \end{macrocode} % \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 % the default definition. % \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}} % \end{macrocode} % \end{macro} % % % % % % % % % \subsubsection{Chapter precis} % % % \begin{macro}{\chapterprecis} % The command |\chapterprecis{|\meta{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. % \begin{macrocode} \newcommand{\chapterprecis}[1]{% \chapterprecishere{#1} \chapterprecistoc{#1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chapterprecishere} % |\chapterprecishere{|\meta{text}|}| typesets \meta{text}. It expects % to be called immediately after a |\chapter| command. % \changes{v1.3}{2002/11/14}{Parameterised \cs{chapterprecishere}} % \begin{macrocode} \newcommand{\chapterprecishere}[1]{% \prechapterprecis #1\postchapterprecis} % \end{macrocode} % \end{macro} % % \begin{macro}{\prechapterprecis} % \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 quote environment. % \changes{v1.3}{2002/11/14}{Added \cs{prechapterprecis} and % \cs{postchapterprecis}} % \begin{macrocode} \newcommand{\prechapterprecis}{% \vspace*{-2\baselineskip}% \begin{quote}\normalfont\itshape} \newcommand{\postchapterprecis}{\end{quote}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\precistocfont} % Font for typesetting chapter precis in the ToC. % \changes{v1.3}{2002/11/14}{Added \cs{precistocfont}} % \begin{macrocode} \newcommand{\precistocfont}{\normalfont\itshape} % \end{macrocode} % \end{macro} % % \begin{macro}{\chapterprecistoc} % \begin{macro}{\precistoctext} % |\chapterprecistoc{|\meta{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. % \changes{v1.3}{2002/11/14}{Added \cs{precistoctext}} % \begin{macrocode} \newcommand{\chapterprecistoc}[1]{\addtocontents{toc}{\precistoctext{#1}}} \DeclareRobustCommand{\precistoctext}[1]{% % \end{macrocode} % Start a group to localize changes to the paragraphing. Set the % left margin to the chapter indent plus the chapter number width. % \begin{macrocode} {\leftskip \cftchapterindent\relax \advance\leftskip \cftchapternumwidth\relax % \end{macrocode} % Set the right hand margin to |\@tocrmarg|. % \begin{macrocode} \rightskip \@tocrmarg\relax % \end{macrocode} % Typeset \meta{text} using an italic font, then ensure that the paragraph % is finished (to use the local skips). Finally close the group and we % are done. % \begin{macrocode} \precistocfont #1\par}} % \end{macrocode} % \end{macro} % \end{macro} % % \subsubsection{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. % \begin{macrocode} \newcommand{\cftlocalchange}[3]{% \addtocontents{#1}{\protect\setpnumwidth{#2} \protect\setrmarg{#3}}} % \end{macrocode} % \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. % \begin{macrocode} \newcommand{\cftaddtitleline}[4]{% \addtocontents{#1}{\protect\contentsline{#2}{#3}{#4}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\cftaddnumtitleline} % |\cftaddtitleline{|\meta{file}|}{|\meta{kind}|}{|\meta{num}|}{|\meta{title}|}{|\meta{page}|}| % adds a |\contentsline| entry to \meta{file} with the given information. % \begin{macrocode} \newcommand{\cftaddnumtitleline}[5]{% \addtocontents{#1}% {\protect\contentsline{#2}{\protect\numberline{#3}{\protect\ignorespaces #4}}{#5}}} % \end{macrocode} % \end{macro} % % % \subsubsection{ToC and divisional numbering} % % Commands are provided, based on the \Lpack{tocvsec2} package, for changing % the section numbering level and the ToC entry level. % % \begin{macro}{\@setclcnt} % Helper macro to set a sectioning-related counter. Use as % |\@setclcnt{|\meta{sec}|}{|\meta{counter}|}| to set \Lcount{counter} % to the level of \meta{sec}. % \begin{macrocode} \newcommand{\@setclcnt}[2]{ \@tempswafalse \nametest{#1}{none} \ifsamename \setcounter{#2}{-10} \@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 \ClassError{memoir}{% Unknown document division name (#1) }{% I'll ignore it. Type \space 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 % \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}} % \begin{macrocode} \newcommand{\settocdepth}[1]{% \@tempswafalse \nametest{#1}{none} \ifsamename \addtocontents{toc}{\changetocdepth{-10}} \@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\else \ClassError{memoir}{% Unknown document division name (#1) }{% I'll ignore it. Type \space and I'll continue.} \fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\changetocdepth} % Changes the |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} \DeclareRobustCommand{\changetocdepth}[1]{\setcounter{tocdepth}{#1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\maxtocdepth} % |\maxtocdepth{|\meta{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. % \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 % \Lcount{secnumdepth} % to the value corresponding to \meta{sec}. % \changes{v1.1}{2002/03/10}{Added maxsecnumdepth counter and modified \cs{maxsecnumdepth}} % \begin{macrocode} \newcounter{maxsecnumdepth} \newcommand{\maxsecnumdepth}[1]{% \@setclcnt{#1}{secnumdepth}\@setclcnt{#1}{maxsecnumdepth}} % \end{macrocode} % \end{macro} % % % % \subsection{Bibliography} % % % \begin{macro}{\bibindent} % The \Lopt{open} bibliography uses an indentation of |\bibindent|. % \begin{macrocode} \newdimen\bibindent \setlength\bibindent{1.5em} % \end{macrocode} % \end{macro} % % \begin{environment}{bibitemlist} % The |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 % 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 % \Lpack{book} class. % \begin{macrocode} \newenvironment{bibitemlist}[1]{% \list{\@biblabel{\@arabic\c@enumiv}}% {\settowidth\labelwidth{\@biblabel{#1}}% \leftmargin\labelwidth \advance\leftmargin\labelsep \@openbib@code \usecounter{enumiv}% \let\p@enumiv\@empty \renewcommand\theenumiv{\@arabic\c@enumiv}}% \sloppy \clubpenalty4000 \@clubpenalty \clubpenalty \widowpenalty4000% \sfcode`\.\@m} {\def\@noitemerr {\@latex@warning{Empty `thebibliography' environment}}% \endlist} % \end{macrocode} % \end{environment} % % \begin{macro}{\newblock} % The default is for |\newblock| to provide a small space. % \begin{macrocode} \newcommand{\newblock}{\hskip .11em\@plus.33em\@minus.07em} % \end{macrocode} % \end{macro} % % \begin{macro}{\@openbib@code} % This a an empty hook. It will be modified if the \Lopt{openbib} % option is used. % \begin{macrocode} \let\@openbib@code\@empty % \end{macrocode} % \end{macro} % % \begin{macro}{\setbiblabel} % \begin{macro}{\@biblabel} % This is the user command for setting the label for a |\bibitem|. % The following sets the default definition. % \begin{macrocode} \newcommand*{\setbiblabel}[1]{% \renewcommand*{\@biblabel}[1]{#1}} \setbiblabel{[#1]\hfill} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{environment}{thebibliography} % The definition of the |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} % \begin{macrocode} \newenvironment{thebibliography}[1]{% \chapter*{\bibname} \bibmark \ifnobibintoc\else \phantomsection \addcontentsline{toc}{chapter}{\bibname} \fi \prebibhook \begin{bibitemlist}{#1}}{\end{bibitemlist}\postbibhook} % \end{macrocode} % \end{environment} % % \begin{macro}{\ifnobibintoc} % \begin{macro}{\bibintoc} % \begin{macro}{\nobibintoc} % Flag to control whether or not to add the bibliography title to the ToC, % and declarations to set the flag. % Default is to put the title into the ToC. % \changes{v0.2}{2001/06/03}{Added \cs{ifnobibintoc}, etc.} % \begin{macrocode} \newif\ifnobibintoc \newcommand*{\bibintoc}{\nobibintocfalse} \newcommand*{\nobibintoc}{\nobibintoctrue} \bibintoc % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\prebibhook} % \begin{macro}{\postbibhook} % These two macros are called just before starting the bib items and just % after finishing them. By default they do nothing but can be changed % by the user to give, say, some introductory information. % \begin{macrocode} \newcommand{\prebibhook}{} \newcommand{\postbibhook}{} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\@cite} % The output of the |\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]} % \end{macrocode} % \end{macro} % % % % % \subsection{The index} % % I allow for a single column index as well as the default double column. % % \begin{macro}{\ifonecolindex} % TRUE for a one column index. % \changes{v1.3}{2002/10/10}{Added one column index} % \begin{macrocode} \newif\ifonecolindex \onecolindexfalse % \end{macrocode} % \end{macro} % % \begin{environment}{theindex} % The environment `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| % are used to produce index entries of various levels. When a new % letter of the alphabet is encountered an amount of |\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} % \begin{macrocode} \newenvironment{theindex}{% \if@twocolumn \@restonecolfalse \else \@restonecoltrue \fi \ifonecolindex \onecolumn \chapter*{\indexname} \preindexhook \else \twocolumn[\@makeschapterhead{\indexname} \preindexhook]% \fi \indexmark \setlength{\columnseprule}{\indexrule} \setlength{\columnsep}{\indexcolsep} \ifnoindexintoc\else \phantomsection \addcontentsline{toc}{chapter}{\indexname} \fi \thispagestyle{chapter}\parindent\z@ \parskip\z@ \@plus .3\p@\relax \let\item\@idxitem} {\if@restonecol\onecolumn\else\twocolumn\fi} % \end{macrocode} % \end{environment} % % \begin{macro}{\ifnoindexintoc} % \begin{macro}{\indexintoc} % \begin{macro}{\noindexintoc} % Flag to control whether or not to add the index title to the ToC, % and declarations to set the flag. % Default is to put the title into the ToC. % \changes{v0.2}{2001/06/03}{Added \cs{ifnoindexintoc}, etc.} % \begin{macrocode} \newif\ifnoindexintoc \newcommand*{\indexintoc}{\noindexintocfalse} \newcommand*{\noindexintoc}{\noindexintoctrue} \indexintoc % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\indexcolsep} % \begin{macro}{\indexrule} % These two lengths control the column separation and the thickness % of the inter-column rule. % \changes{v0.2}{2001/06/03}{Added \cs{indexcolsep} and \cs{indexrule}} % \begin{macrocode} \newlength{\indexcolsep} \setlength{\indexcolsep}{35pt} \newlength{\indexrule} \setlength{\indexrule}{0pt} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\preindexhook} % A macro that is called between the index heading and the start of the % two columns. The user can modify it to add something. % \begin{macrocode} \newcommand{\preindexhook}{} % \end{macrocode} % \end{macro} % % \begin{macro}{\l@index} % Format the index entry in the table of contents. % \begin{macrocode} \newcommand{\l@index}{\@dottedtocline{1}{0em}{0pt}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@idxitem} % \begin{macro}{\subitem} % \begin{macro}{\subsubitem} % Thsee macros are used to format the entries in the index. % \begin{macrocode} \newcommand{\@idxitem} {\par\hangindent 40\p@} \newcommand{\subitem} {\par\hangindent 40\p@ \hspace*{20\p@}} \newcommand{\subsubitem}{\par\hangindent 40\p@ \hspace*{30\p@}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\indexspace} % The amount of white space that is inserted between `letter % blocks' in the index. % \begin{macrocode} \newcommand{\indexspace}{\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax} % \end{macrocode} % \end{macro} % % \begin{macro}{\makeindex} % \begin{macro}{\index} % \begin{macro}{\specialindex} % 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|. % \changes{v1.3}{2002/11/14}{Indexing macros completely redone and extended} % \begin{macrocode} \renewcommand{\makeindex}[1][\jobname]{% \def\index{\@bsphack% \@ifnextchar [{\@index}{\@index[\jobname]}} \def\specialindex{\@bsphack\@spindex}% \if@filesw \expandafter\newwrite\csname #1@idxfile\endcsname \expandafter\immediate\openout \csname #1@idxfile\endcsname #1.idx\relax \typeout{Writing index file #1.idx }% \fi} % \end{macrocode} % Initially define, but emasculate, |\index| and |\specialindex| which are % defined properly by the user calling |\makeindex|. % \begin{macrocode} \renewcommand{\index}[2][\jobname]{\@bsphack\@esphack} \newcommand{\specialindex}[3]{\@bsphack\@esphack} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\printindex} % The command to read an \file{ind} file. % \begin{macrocode} \newcommand{\printindex}[1][\jobname]{\@input@{#1.ind}} % \end{macrocode} % \end{macro} % % \begin{macro}{\ifreportnoidxfile} % \begin{macro}{\ifshowindexmark} % Two booleans to control reporting on unknown \file{idx} files and % displaying indexed items in the margin. % \begin{macrocode} \newif\ifreportnoidxfile \reportnoidxfilefalse \newif\ifshowindexmark \showindexmarkfalse % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@index} % |\@index[file]| is first stage of |\index|, handling the \file{idx} file. % \begin{macrocode} \def\@index[#1]{% \@ifundefined{#1@idxfile}% {\ifreportnoidxfile \ClassWarning{memoir}{Undefined index file #1}% \fi \begingroup \@sanitize \@nowrindex}% {\def\@idxfile{#1}% \begingroup \@sanitize \@wrindexm@m}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@nowrindex} % Called when there is no \file{idx} file to throw away the indexed item. % \begin{macrocode} \newcommand{\@nowrindex}[1]{% \ifshowindexmark\@showidx{#1}\fi\endgroup\@esphack} % \end{macrocode} % \end{macro} % % \begin{macro}{\@wrindexm@m} % \begin{macro}{\@@wrindexhyp} % The next stage in index processing is |\@wrindexm@m{item}|, % which writes the \file{idx} file name % and indexed item to the \file{aux} file. The |\@@wrindexhyp| macro % provides hyperlinks in case the \Lpack{hyperref} package is used. % \begin{macrocode} \newcommand{\@wrindexm@m}[1]{\@@wrindexhyp#1||\\} \def\@@wrindexhyp#1|#2|#3\\{% \ifshowindexmark\@showidx{#1}\fi \ifx\\#2\\% \protected@write\@auxout{}% {\string\@@wrindexm@m{\@idxfile}{#1|hyperpage}{\thepage}}% \else \def\Hy@temp@A{#2}% \ifx\Hy@temp@A\HyInd@ParenLeft \protected@write\@auxout{}% {\string\@@wrindexm@m{\@idxfile}{#1|#2hyperpage}{\thepage}}% \else \protected@write\@auxout{}% {\string\@@wrindexm@m{\@idxfile}{#1|#2}{\thepage}}% \fi \fi \endgroup \@esphack} % \end{macrocode} % \end{macro} % \end{macro} % % \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. % \begin{macrocode} \newcommand{\hyperpage}[1]{#1} \newcommand{\hyperlink}[2]{#2} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@@wrindexm@m} % The macro |\@@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. % \begin{macrocode} \newcommand{\@@wrindexm@m}[1]{\begingroup \def\@idxfile{\@nameuse{#1@idxfile}} \@sanitize \@@@wrindexm@m} % \end{macrocode} % \end{macro} % % \begin{macro}{\@@@wrindexm@m} % |\@@@wrindexm@m{item}{page}| writes the |\indexentry| to the \file{idx} file % \begin{macrocode} \newcommand{\@@@wrindexm@m}[2]{% \immediate\write \@idxfile{\string\indexentry{#1}{#2}}% \endgroup} % \end{macrocode} % The \file{aux} file is read both at the beginning and end of a document. % |\@@@wrindexm@m| must be disabled after the first \file{aux} read so that % items are not inserted twice into an \file{idx} file. % \begin{macrocode} \AtBeginDocument{% \def\@@@wrindexm@m#1#2{\endgroup}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@spindex} % Now do similar things for |\specialindex|. % \begin{macrocode} \newcommand{\@spindex}[2]{% \@ifundefined{#1@idxfile}% {\ifreportnoidxfile \ClassWarning{memoir}{Undefined index file #1}% \fi \begingroup \@sanitize \@nowrindex}% {\def\@idxfile{#1}% \def\@sptheidx{#2}% \begingroup \@sanitize \@wrspindex}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@wrspindex} % \begin{macro}{\@@wrspindexhyp} % \begin{macrocode} \newcommand{\@wrspindex}[1]{\@@wrspindexhyp#1||\\} \def\@@wrspindexhyp#1|#2|#3\\{% \ifshowindexmark\@showidx{#1}\fi \ifx\\#2\\% \protected@write\@auxout{}% {\string\@@wrindexm@m{\@idxfile}{#1|hyperspindexpage(\thepage)}{\@nameuse{the\@sptheidx}}}% \else \def\Hy@temp@A{#2}% \ifx\Hy@temp@A\HyInd@ParenLeft \protected@write\@auxout{}% {\string\@@wrindexm@m{\@idxfile}{#1|#2hyperspindexpage(\thepage)}{\@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} % % \begin{macro}{\hyperpage} % \begin{macrocode} \def\hyperspindexpage(#1)#2{\hyperlink{page.#1}{#2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\see} % \begin{macro}{\seename} % \begin{macro}{\seealso} % \begin{macro}{\alsoname} % These definitions are taken from the \Lpack{makeidx} package. % \begin{macrocode} \newcommand*{\see}[2]{\emph{\seename} #1} \newcommand*{\seename}{see} \newcommand*{\seealso}[2]{\emph{\alsoname} #1} \newcommand*{\alsoname}{see also} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\citeindexfile} % For the \Lpack{natbib} package, and possibly other packages that do % some special indexing. % \begin{macrocode} \newcommand{\citeindexfile}{\jobname} \AtBeginDocument{\@ifpackageloaded{natbib}{% \def\NAT@index{\index[\citeindexfile]{\NAT@idxtxt}}}{}} % \end{macrocode} % \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 % led to the `too many floats' problem. % % \begin{macro}{\indexmarkstyle} % \begin{macro}{\@indexbox} % \begin{macrocode} \newtoks\indexmarkstyle \indexmarkstyle{\normalfont\footnotesize\ttfamily} \newinsert\@indexbox \dimen\@indexbox\maxdimen % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macrocode} \begingroup \catcode`\@\active \expandafter\gdef\csname\string @sanitizeat\endcsname {\def @{\char`\@}} \endgroup % \end{macrocode} % % \begin{macro}{\@showidx} % \begin{macrocode} \newcommand{\@showidx}[1]{% \insert\@indexbox{% \@sanitizeat \the\indexmarkstyle \hsize\marginparwidth \hangindent\marginparsep \parindent\z@ \everypar{}\let\par\@@par \parfillskip\@flushglue \lineskip\normallineskip \baselineskip .8\normalbaselineskip\sloppy \raggedright \leavevmode \vrule \@height .7\normalbaselineskip \@width \z@\relax #1\relax \vrule \@height \z@ \@depth .3\normalbaselineskip \@width \z@\relax }% \ifhmode\penalty\@M \hskip\z@skip\fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\@leftidx} % \begin{macro}{\@rightidx} % \begin{macrocode} \newcommand{\@leftidx}{\hskip-\marginparsep \hskip-\marginparwidth} \newcommand{\@rightidx}{\hskip\columnwidth \hskip\marginparsep} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@mkidx} % \begin{macrocode} \newcommand{\@mkidx}{\vbox to \z@{% \rlap{% \if@twocolumn \if@firstcolumn \@leftidx \else \@rightidx \fi \else \if@twoside \ifodd\c@page \@rightidx \else \@leftidx \fi \else \@rightidx \fi \fi \box\@indexbox }% \vss }} % \end{macrocode} % \end{macro} % % \begin{macro}{\raggedbottom} % \begin{macro}{\flushbottom} % \begin{macro}{\@texttop} % These kernel macros need changing because of the new marginal insert. % \begin{macrocode} \renewcommand{\raggedbottom}{% \def\@textbottom{\vskip\z@ plus.0001fil}% \let\@texttop\@mkidx} \renewcommand{\flushbottom}{% \let\@textbottom\relax \let\@texttop\@mkidx} \let\@texttop\@mkidx % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % % \subsection{Footnotes} % % \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|. % 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. % % To prevent the rule from colliding with the footnote we first add % a little negative vertical skip, then we put the rule and make % sure we end up at the same point where we begun this operation. % \begin{macrocode} \renewcommand{\footnoterule}{% \kern-3\p@ \hrule width .4\columnwidth \kern 2.6\p@} % \end{macrocode} % \end{macro} % % \begin{macro}{\c@footnote} % Footnotes are numbered per chapter. The counter is predefined. % \begin{macrocode} \@addtoreset{footnote}{chapter} % \end{macrocode} % \end{macro} % % The footnote mechanism of \LaTeX{} calls the macro |\@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|). % % An example of what can be achieved is given by the following piece % of TeX code. % \begin{verbatim} % \long\def\@makefntext#1{% % \@setpar{\@@par % \@tempdima = \hsize % \advance\@tempdima-10pt % \parshape \@ne 10pt \@tempdima}% % \par % \parindent 1em\noindent % \hbox to \z@{\hss\@makefnmark}#1} % \end{verbatim} % The effect of this definition is that all lines of the footnote % are indented by 10pt, while the first line of a new paragraph is % indented by 1em. To change these dimensions, just substitute the % desired value for `10pt' (in both places) or `1em'. The mark is % flushright against the footnote. % % The standard classes use a simpler macro, in which the % 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 % and put the proper indentation before the mark. % \begin{verbatim} % \newcommand{\@makefntext}[1]{% % \parindent 1em% % \noindent % \hb@xt@1.8em{\hss\@makefnmark}#1} % \end{verbatim} % % This class provides a configurable specification. % % \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|. % \begin{macrocode} \newlength{\footmarkwidth} \newlength{\footmarksep} \newlength{\footparindent} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\footmarkstyle} % \begin{macro}{\footscript} % The marker is typeset according to |\footscript|\marg{marker}. This % can be specified by the user via |\footmarkstyle|. % \begin{macrocode} \newcommand*{\footmarkstyle}[1]{\def\footscript##1{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\makefootmarkhook} % A vacuous macro that thye user can redefine to do something useful? % \begin{macrocode} \newcommand{\makefootmarkhook}{} % \end{macrocode} % \end{macro} % % \begin{macro}{\footfootmark} % This macro typesets the footnote marker. % \begin{macrocode} \newcommand{\footfootmark}{% \ifdim\footmarkwidth < \z@ % \end{macrocode} % Negative width, mark is in the margin. % \begin{macrocode} \llap{\hb@xt@ -\footmarkwidth{\hss\normalfont\footscript{\@thefnmark}}% \hspace*{-\footmarkwidth}}% \else \ifdim\footmarkwidth = \z@ % \end{macrocode} % Zero width, mark is at (inside) the margin. % \begin{macrocode} {\normalfont\footscript{\@thefnmark}}% \else % \end{macrocode} % Positive width. % \begin{macrocode} \hb@xt@\footmarkwidth{\hss\normalfont\footscript{\@thefnmark}}% \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\makefootmark} % \begin{macro}{\@makefntext} % The class version of |\@makefntext|. % \begin{macrocode} \newcommand{\makefootmark}[1]{% \leavevmode \parindent \footparindent\noindent \leftskip\footmarksep\relax \advance\leftskip \footmarkwidth \null\nobreak\hskip -\leftskip\relax \makefootmarkhook\relax \footfootmark #1} \newcommand{\@makefntext}[1]{\makefootmark{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % All that now remains for the footer part is to set the defaults. % \begin{macrocode} \footmarkstyle{\textsuperscript{#1}} \setlength{\footmarkwidth}{1.8em} \setlength{\footmarksep}{-1.8em} \setlength{\footparindent}{1em} % \end{macrocode} % % \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 % the default definition for it. % \begin{macrocode} %\renewcommand\@makefnmark{\hbox{\@textsuperscript{% % \normalfont\@thefnmark}}} % \end{macrocode} % \end{macro} % % \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| % from file{ltfloat.dtx}. % \changes{v1.0}{2001/10/30}{Added \cs{footref}} % \begin{macrocode} \newcommand{\footref}[1]{% \begingroup \unrestored@protected@xdef\@thefnmark{\ref{#1}}% \endgroup \@footnotemark} % \end{macrocode} % \end{macro} % % The following code for footnotes that can include verbatims is based % on Jeremy Gibbons \textit{`Footnotes with verbatim material'} % in the column \textit{`Hey --- it works'} (edited by Jeremy Gibbons), % TeX and TUG NEWS, vol 2 no. 4, p 9, October 1993. I have updated % the basic code so that it works for LaTeX2e. % % \begin{macro}{\verbfootnote} % \begin{macro}{\@xverbfootnote} % |\verbfootnote| is just like |\footnote| except that it can contain % verbatim material. % \begin{macrocode} \def\verbfootnote{\@ifnextchar[\@xverbfootnote{\stepcounter\@mpfn \protected@xdef\@thefnmark{\thempfn}% \@footnotemark\@verbfootnotetext}} \def\@xverbfootnote[#1]{% \begingroup \csname c@\@mpfn\endcsname #1\relax \unrestored@protected@xdef\@thefnmark{\thempfn}% \endgroup \@footnotemark\@verbfootnotetext} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@verbfootnotetext} % This is the secret ingredient. It is based on the |\footnote| macro % in the TeXbook page 363, which somehow manages to read an argument % with verbatims. As Knuth says that it is subtle and involves trickery, % don't expect me to even try to explain anything. % % I'm not at all sure about the color bits, though! % \begin{macrocode} \long\def\@verbfootnotetext{% \insert\footins\bgroup \footnotesize \interlinepenalty\interfootnotelinepenalty \splittopskip\footnotesep \splitmaxdepth \dp\strutbox \floatingpenalty \@MM \hsize\columnwidth \@parboxrestore \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}% \color@begingroup \@makefntext{\rule{\z@}{\footnotesep}\ignorespaces}% \futurelet\next\fo@t } % \end{macrocode} % \end{macro} % % \begin{macro}{\fo@t} % \begin{macro}{\f@@t} % \begin{macro}{\f@t} % \begin{macro}{\@foot} % Guess what these do. % \begin{macrocode} \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t \else \let\next\f@t\fi \next} \def\f@@t{\bgroup\aftergroup\@foot\let\next} \def\f@t#1{#1\@foot} \def\@foot{\strut\egroup\color@endgroup} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@verbmpfootnotetext} % Footnotes in minipages are a little different, so another % version of |\...footnotetext|. % \begin{macrocode} \long\def\@verbmpfootnotetext{% \global\setbox\@mpfootins\vbox{% \reset@font\footnotesize \unvbox\@mpfootins \bgroup \hsize\columnwidth \@parboxrestore \edef\@currentlabel{\csname p@mpfootnote\endcsname\@thefnmark}% \color@begingroup \@makefntext{\rule{\z@}{\footnotesep}\ignorespaces}% } \futurelet\next\fo@t } % \end{macrocode} % \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} % % For my reference, in case I want to fiddle with it even more % than I have already done so, here is the kernel code (from ltfloat.dtx) % for footnotes. % \begin{verbatim} % \newinsert\footins % \skip\footins=\bigskipamount % \count\footins=1000 % \dimen\footins=8in % % \def\footnoterule{\kern-3\p@ \hrule \@width 2in \kern 2.6\p@} % % \@definecounter{footnote} % \def\thefootnote{\@arabic\c@footnote} % \@definecounter{mpfootnote} % \def\thempfootnote{\itshape\@alph\c@mpfootnote} % \def\@makefnmark{\hbox{\@textsuperscript{\normalfont\@thefnmark}}} % % \DeclareRobustCommand*\textsuperscript[1]{% % \@textsuperscript{\selectfont#1}} % \def\@textsuperscript#1{% % {\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@#1}}}}} % % \newdimen\footnotesep % % \def\footnote{\@ifnextchar[\@xfootnote{\stepcounter\@mpfn % \protected@xdef\@thefnmark{\thempfn}% % \@footnotemark\@footnotetext}} % % \def\@xfootnote[#1]{% % \begingroup % \csname c@\@mpfn\endcsname #1\relax % \unrestored@protected@xdef\@thefnmark{\thempfn}% % \endgroup % \@footnotemark\@footnotetext} % % \long\def\@footnotetext#1{% % \insert\footins{% % \reset@font\footnotesize % \interlinepenalty\interfootnotelinepenalty % \splittopskip\footnotesep % \splitmaxdepth \dp\strutbox \floatingpenalty \@MM % \hsize\columnwidth \@parboxrestore % \protected@edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}% % \color@begingroup % \@makefntext{\rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% % \color@endgroup}} % % \def\footnotemark{% % \@ifnextchar[\@xfootnotemark % {\stepcounter{footnote}% % \protected@xdef\@thefnmark{\thefootnote}% % \@footnotemark}} % % \def\@xfootnotemark[#1]{% % \begingroup % \c@footnote #1\relax % \unrestored@protected@xdef\@thefnmark{\thefootnote}% % \endgroup % \@footnotemark} % % \def\@footnotemark{% % \leavevmode % \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi % \@makefnmark % \ifhmode\spacefactor\@x@sf\fi % \relax} % % \def\footnotetext{% % \@ifnextchar [\@xfootnotenext % {\protected@xdef\@thefnmark{\thempfn}% % \@footnotetext}} % % \def\@xfootnotenext[#1]{% % \begingroup % \csname c@\@mpfn\endcsname #1\relax % \unrestored@protected@xdef\@thefnmark{\thempfn}% % \endgroup % \@footnotetext} % % \def\@mpfn{footnote} % \def\thempfn{\thefootnote} % \end{verbatim} % And from ltboxes.dtx for the |minipage| environment. When setting up % the environment, it includes: % \begin{verbatim} % \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@ % \let\@footnotetext\@mpfootnotetext % \end{verbatim} % Later it defines: % \begin{verbatim} % \long\def\@mpfootnotetext#1{% % \global\setbox\@mpfootins\vbox{% % \unvbox\@mpfootins % \reset@font\footnotesize % \hsize\columnwidth % \@parboxrestore % \protected@edef\@currentlabel{\csname p@mpfootnote\endcsname\@thefnmark}% % \color@begingroup % \@makefntext{\rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% % \color@endgroup}} % \end{verbatim} % % % % \section{Change marks} \label{sec:vct} % % When preparing a manuscript it normally goes through % several iterations. The commands provided may be used to identify % changes made to a document during its life cycle. % % The code for this part of the class is based on the version % controls in the \Lpack{iso} class~\cite{ISOCLASS}. % % \subsection{Print control} % % Members of the development group often need to see the changes % between document versions, while the general public does not. % \begin{macro}{\ifchangemarks} % This controls the appearence of the version controls defined % below. % \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 % put in the document preamble. % \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 % away its two arguments. % \changes{v1.2}{2002/07/27}{Added \cs{@bsphack} and \cs{@esphack} to \cs{v@rid}} % \begin{macrocode} \newcommand{\v@rid}[2]{% \@bsphack \ifchangemarks \ifdraftdoc \marginpar[#1]{#2}% \fi\fi \@esphack} % \end{macrocode} % \end{macro} % % \subsection{Change marking} % % The following commands flag changes in the typeset document. Each of % the commands takes one parameter which is intended to be a % `change number' or comment for tracking purposes. A symbol and % the \meta{change-id} is put into the margin near where the command % is given. The marking commands should be attached to some word or % punctuation mark in the text otherwise extraneous spaces may creep % 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}|}| % Flags, with the symbol $\oplus$, that something has been added % to the manuscript. % \begin{macrocode} \newcommand{\added}[1]{% \@bsphack \ifchangemarks \v@rid{\small$\oplus$ #1}{\small$\oplus$ #1}% \fi \@esphack} % \end{macrocode} % \end{macro} % % \begin{macro}{\deleted} % |\deleted{|\meta{change-id}|}| % Flags, with the symbol $\neq$, that something has been deleted % from the manuscript. % \begin{macrocode} \newcommand{\deleted}[1]{% \@bsphack \ifchangemarks \v@rid{\small$\neq$ #1}{\small$\neq$ #1}% \fi \@esphack} % \end{macrocode} % \end{macro} % % \begin{macro}{\changed} % |\changed{|\meta{change-id}|}| % Flags, with the symbol $\Leftrightarrow$, that something % has been changed in the text. % \begin{macrocode} \newcommand{\changed}[1]{% \@bsphack \ifchangemarks \v@rid{\small$\Leftrightarrow$ #1}{\small$\Leftrightarrow$ #1}% \fi \@esphack} % \end{macrocode} % \end{macro} % % \section{Trimming marks} % % The \Lopt{showtrims} options prints trimming marks at the corners % of the logical page. The code for this comes from ideas gleaned % from Martin Schr\"{o}der's \Lpack{everyshi} package~\cite{EVERYSHI} % and Melchior Franz's \Lpack{crop} package~\cite{CROP}. % The implementation and any errors are mine. % % The implementation up to October 2002 was limited to putting a cross % at the page corners. The manual directed users to the \Lpack{crop} % packge if they wanted anything more. In October 2002 the implementation % was substantially extended. The background to this is below. % % Before the release of version 1.7 of \Lpack{crop} in May 2002 its % author asked me to make some changes to \Lpack{memoir} that would be % helpful to him, and I did so. Later he told me that the changes were % unnecessary and I reverted to the original \Lpack{memoir} code. % % On 2002/10/06 Peter Heslin (\url{peter.heslin@ucd.ie}) started a % thread on \url{comp.text.tex} titled `Incompatibility of memoir.cls % and crop.sty' in which he said that \Lpack{memoir} and \Lpack{crop} % 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}|, % 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 % usual LaTeX paper dimensions and simply puts the marks around the % page. It works with all standard classes and the KOMA classes. memoir % seems to do things completely differently \ldots % % Sorry, but I'm afraid I have to pass the problem to the memoir % author. \ldots % % \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 % 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 |...:->| % % 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 % in the output routine is assumed 1 inch to the left [later corrected % to right] and 1 inch down % from the upper left (virtual) paper corner. % % \item[crop] With other words: crop changes |\hoffset| and |\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 % to the logical page (modulo 1 inch). % % The memoir class, in contrast (mis)uses the LaTeX margins % |\even(odd)sidemargin| for that purpose. % % Thus, the meaning of |\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 % asked for by Peter Heslin. % % \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| % 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. % \changes{v1.0a}{2002/01/04}{Removed \cs{setlength} from \cs{trimmark}. Stops % problem with the calc package.} % \begin{macrocode} \newcommand*{\trimmark}{% \begin{picture}(0,0) \unitlength 1cm \thinlines \put(-2,0){\line(1,0){4}} \put(0,-2){\line(0,1){4}} \end{picture}} % \end{macrocode} % \end{macro} % % \begin{macro}{\Ltrimpictl} % \begin{macro}{\Ltrimpictr} % \begin{macro}{\Ltrimpicbl} % \begin{macro}{\Ltrimpicbr} % `L' shaped trim marks for four corners. % \changes{v1.3}{2002/10/10}{Added \cs{Ltrimpictl}, \cs{Ltrimpictr}, \cs{Ltrimpicbl} % and \cs{Ltrimpicbr}} % \begin{macrocode} \newcommand*{\Ltrimpictl}{% \begin{picture}(0,0) \unitlength 1mm \thinlines \put(-2,0){\line(-1,0){18}} \put(0,2){\line(0,1){18}} \end{picture}} \newcommand*{\Ltrimpictr}{% \begin{picture}(0,0) \unitlength 1mm \thinlines \put(2,0){\line(1,0){18}} \put(0,2){\line(0,1){18}} \end{picture}} \newcommand*{\Ltrimpicbl}{% \begin{picture}(0,0) \unitlength 1mm \thinlines \put(-2,0){\line(-1,0){18}} \put(0,-2){\line(0,-1){18}} \end{picture}} \newcommand*{\Ltrimpicbr}{% \begin{picture}(0,0) \unitlength 1mm \thinlines \put(2,0){\line(1,0){18}} \put(0,-2){\line(0,-1){18}} \end{picture}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\Ftrimpicbl} % Frame the page. % \changes{v1.3}{2002/10/10}{Added \cs{Ftrimpictl}} % \begin{macrocode} \newcommand*{\Ftrimpicbl}{% \begin{picture}(0,0) \unitlength 1pt \thinlines \put(0,0){\framebox(\strip@pt\paperwidth,\strip@pt\paperheight){}} \end{picture}} % \end{macrocode} % \end{macro} % % \begin{macro}{\tmarktl} % \begin{macro}{\tmarktr} % \begin{macro}{\tmarkbl} % \begin{macro}{\tmarkbr} % The trimming marks used for corner display. % \changes{v1.3}{2002/10/10}{Added \cs{tmarktl}, \cs{tmarktr}, \cs{tmarkbl} % and \cs{tmarkbr}} % \begin{macrocode} \newcommand*{\tmarktl}{\trimmark} \newcommand*{\tmarktr}{\trimmark} \newcommand*{\tmarkbl}{\trimmark} \newcommand*{\tmarkbr}{\trimmark} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\tmarktm} % \begin{macro}{\tmarkml} % \begin{macro}{\tmarkmr} % \begin{macro}{\tmarkbm} % The trimming marks used for mid-side display. % \changes{v1.3}{2002/10/10}{Added \cs{tmarktm}, \cs{tmarkml}, \cs{tmarkmr} % and \cs{tmarkbm}} % \begin{macrocode} \newcommand*{\tmarktm}{} \newcommand*{\tmarkml}{} \newcommand*{\tmarkmr}{} \newcommand*{\tmarkbm}{} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\trimXmarks} % \begin{macro}{\trimLmarks} % \begin{macro}{\trimFrame} % \begin{macro}{\trimNone} % These are declarations for the different kinds of trimming marks. % \changes{v1.3}{2002/10/10}{Added \cs{trimXmarks}, \cs{trimLmarks}, % \cs{trimFrame} and \cs{trimNone}} % \begin{macrocode} \newcommand*{\trimXmarks}{% \let\tmarktl\trimmark \let\tmarktr\trimmark \let\tmarkbl\trimmark \let\tmarkbr\trimmark } \newcommand*{\trimLmarks}{% \let\tmarktl\Ltrimpictl \let\tmarktr\Ltrimpictr \let\tmarkbl\Ltrimpicbl \let\tmarkbr\Ltrimpicbr } \newcommand*{\trimFrame}{% \let\tmarktl\null \let\tmarktr\null \let\tmarkbl\Ftrimpicbl \let\tmarkbr\null } \newcommand*{\trimNone}{% \let\tmarktl\relax \let\tmarktr\relax \let\tmarkbl\relax \let\tmarkbr\relax \let\tmarktm\relax \let\tmarkml\relax \let\tmarkmr\relax \let\tmarkbm\relax } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \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. % \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} % \begin{macrocode} \newcommand*{\trimmarks}{% \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 \hskip-\trimedge \hskip-\paperwidth \fi \fi \vbox to \paperheight{% \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} % % \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} % % \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 |\clearpage| to flush out any floats. % \begin{macrocode} \newcommand{\dol@stsheet}{\addtocounter{sheetsequence}{-1}% \immediate\write\@auxout% {\string\setcounter{lastsheet}{\thesheetsequence}}% \stepcounter{sheetsequence}} \newcommand{\dol@stpage}{\addtocounter{page}{-1}% \immediate\write\@auxout% {\string\setcounter{lastpage}{\thepage}}% \stepcounter{page}} \AtEndDocument{\clearpage\dol@stsheet\dol@stpage} % \end{macrocode} % \end{macro} % \end{macro} % % Any marks are put onto the pages by adding to the |\shipout| % routine. % % \begin{macro}{\mem@oldshipout} % Keep a copy of the current version of |\shipout| in |\mem@oldshipout|. % \begin{macrocode} \let\mem@oldshipout\shipout % \end{macrocode} % \end{macro} % % \begin{macro}{\mem@shipi} % \begin{macro}{\mem@shipii} % Effectively these will add the |\trimmarks| to the box holding % the contents of the page. % \begin{macrocode} \newcommand*{\mem@shipi}{% \ifvoid\@cclv\expandafter\aftergroup\fi\mem@shipii} \newcommand*\mem@shipii{\mem@oldshipout\vbox{\trimmarks\unvbox\@cclv}} % \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|. % \begin{macrocode} \ifshowtrims \renewcommand*{\shipout}{\afterassignment\mem@shipi\setbox\@cclv=} \fi % \end{macrocode} % \end{macro} % % \section{Titles and abstracts} % % \subsection{Titles} % % 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. % \changes{v0.3}{2001/07/09}{Added titling code} % % \begin{macro}{\pretitle} % \begin{macro}{\@bspretitle} % \begin{macro}{\posttitle} % \begin{macro}{\@bsposttitle} % \begin{macro}{\preauthor} % \begin{macro}{\@bspreauthor} % \begin{macro}{\postauthor} % \begin{macro}{\@bspostauthor} % \begin{macro}{\predate} % \begin{macro}{\@bspredate} % \begin{macro}{\postdate} % \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|. % \begin{macrocode} \newcommand{\pretitle}[1]{\def\@bspretitle{#1}} \newcommand{\posttitle}[1]{\def\@bsposttitle{#1}} \newcommand{\preauthor}[1]{\def\@bspreauthor{#1}} \newcommand{\postauthor}[1]{\def\@bspostauthor{#1}} \newcommand{\predate}[1]{\def\@bspredate{#1}} \newcommand{\postdate}[1]{\def\@bspostdate{#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} % % These are defined initially % to mimic the normal \LaTeX{} style. % \begin{macrocode} \pretitle{\begin{center}\LARGE} \posttitle{\par\end{center}\vskip 0.5em} \preauthor{\begin{center} \large \lineskip .5em% \begin{tabular}[t]{c}} \postauthor{\end{tabular}\par\end{center}} \predate{\begin{center}\large} \postdate{\par\end{center}} % \end{macrocode} % % \begin{macro}{\maketitlehooka} % \begin{macro}{\maketitlehookb} % \begin{macro}{\maketitlehookc} % \begin{macro}{\maketitlehookd} % The four hooks which will be called by |\maketitle|. These are initially % vacuous. % \begin{macrocode} \newcommand{\maketitlehooka}{} \newcommand{\maketitlehookb}{} \newcommand{\maketitlehookc}{} \newcommand{\maketitlehookd}{} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\thanksmarkseries} % \begin{macro}{\@bsmarkseries} % \begin{macro}{\symbolthanksmark} % These are for specifying the kind of series for thanks markers. % \begin{macrocode} \newcommand{\thanksmarkseries}[1]{% \def\@bsmarkseries{\renewcommand{\thefootnote}{\@nameuse{#1}{footnote}}}} \newcommand{\symbolthanksmark}{\thanksmarkseries{\fnsymbol}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\continuousmarks} % \begin{macro}{\@bscontmark} % These are for (non) zeroing of the footnote counter. % \begin{macrocode} \newcommand{\@bscontmark}{\setcounter{footnote}{0}} \newcommand{\continuousmarks}{\def\@bscontmark{}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\thanksheadextra} % \begin{macro}{\@bsthanksheadpre} % \begin{macro}{\@bsthanksheadpost} % These are for inserting stuff before and after a mark in the titling. % \begin{macrocode} \newcommand{\thanksheadextra}[2]{% \def\@bsthanksheadpre{#1}% \def\@bsthanksheadpost{#2}} % \end{macrocode} % \end{macro} % \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}} % \begin{macrocode} \newcommand{\thanksfootextra}[2]{% \ClassWarning{memoir}{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 % but it is fragile in a moving argument. % \begin{macrocode} \DeclareRobustCommand{\thanksmark}[1]{\footnotemark[#1]} % \end{macrocode} % \end{macro} % % \begin{macro}{\thanksgap} % This specifies some horizontal space. % \begin{macrocode} \newcommand{\thanksgap}[1]{\hspace{#1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\tamark} % This stores the current definition of |\@thefnmark|. For some reason % using |\@thefnmark| directly only gave the last value. % \begin{macrocode} \newcommand{\tamark}{\@thefnmark} % \end{macrocode} % \end{macro} % % \begin{macro}{\thanksmarkwidth} % A length determining the size of the box for typesetting % a thanks marker. % \begin{macrocode} \newlength{\thanksmarkwidth} % \end{macrocode} % \end{macro} % % \begin{macro}{\thanksmarksep} % A length determining the inset of thanks footnotes. % \changes{v1.2}{2002/08/10}{Replaced \cs{thanksmargin} by \cs{thanksmarksep}} % \begin{macrocode} \newlength{\thanksmarksep} % \end{macrocode} % \end{macro} % % \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}. % The default is a superscript mark. % \changes{v1.2}{2002/08/10}{Added \cs{thanksmarkstyle}} % \begin{macrocode} \newcommand{\thanksmarkstyle}[1]{\def\thanksscript##1{#1}} \thanksmarkstyle{\textsuperscript{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\makethanksmarkhook} % A vacuous macro used as a hook into |\makethanksmark|. % \begin{macrocode} \newcommand{\makethanksmarkhook}{} % \end{macrocode} % \end{macro} % % \begin{macro}{\thanksfootmark} % This typesets the thanks footnote mark. % \changes{v1.2}{2002/08/10}{Complete rewrite of \cs{thanksfootmark}} % \begin{macrocode} \newcommand{\thanksfootmark}{% \ifdim\thanksmarkwidth < \z@ % \end{macrocode} % Negative width, mark is in the margin. % \begin{macrocode} \llap{\hb@xt@ -\thanksmarkwidth{\hss\normalfont\thanksscript{\tamark}}% \hspace*{-\thanksmarkwidth}}% \else \ifdim\thanksmarkwidth = \z@ % \end{macrocode} % Zero width, mark is at (inside) the margin. % \begin{macrocode} {\normalfont\thanksscript{\tamark}}% \else % \end{macrocode} % Positive width. % \begin{macrocode} \hb@xt@\thanksmarkwidth{\hss\normalfont\thanksscript{\tamark}}% \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\makethanksmark} % This sets the general indentations for the thanks footnote, % and typesets the mark. The code is a simplified version of that % for typesetting ToC entries. % \changes{v1.2}{2002/08/10}{Minor changes to \cs{makethanksmark}} % \begin{macrocode} \newcommand{\makethanksmark}{% \leavevmode% \parindent 1em\noindent \leftskip\thanksmarksep\relax \advance\leftskip \thanksmarkwidth \null\nobreak\hskip -\leftskip\relax \makethanksmarkhook\relax \thanksfootmark} % \end{macrocode} % \end{macro} % % \begin{macro}{\usethanksrule} % \begin{macro}{\cancelhanksrule} % Simple macros that let |\footnoterule| to another rule definition. % \begin{macrocode} \newcommand{\usethanksrule}{\let\footnoterule\thanksrule} \newcommand{\cancelthanksrule}{\let\footnoterule\@bsfootnoterule} % \end{macrocode} % \end{macro} % \end{macro} % % % Now set up the rest of the thanks defaults, styling having been % done earlier. % \begin{macrocode} \thanksmarkseries{fnsymbol} % symbols \thanksheadextra{}{} \setlength{\thanksmarkwidth}{1.8em} \setlength{\thanksmarksep}{-\thanksmarkwidth} % \end{macrocode} % \begin{macro}{\thanksrule} % \begin{macro}{\@bsfootnoterule} % These are saved versions of the |\footnoterule| definition as it % is at the end of the preamble. % \begin{macrocode} \AtBeginDocument{% \let\thanksrule\footnoterule \let\@bsfootnoterule\footnoterule } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\droptitle} % A titling block has |\droptitle| amount of additional vertical space % above it (normally zero). % \begin{macrocode} \newlength{\droptitle} \setlength{\droptitle}{0pt} % \end{macrocode} % \end{macro} % % \begin{macro}{\maketitle} % The following is a % modification of |\maketitle| as in the \Lpack{article}, \Lpack{report}, % and \Lpack{book} classes. It sets the pagestyle to \pstyle{title}. % \begin{macrocode} \newcommand{\maketitle}{\par \begingroup \@bsmarkseries \def\@makefnmark{\rlap{\@textsuperscript{% \normalfont\@bsthanksheadpre \tamark \@bsthanksheadpost}}}% \long\def\@makefntext##1{\makethanksmark ##1} \if@twocolumn \ifnum \col@number=\@ne \@maketitle \else \twocolumn[\@maketitle]% \fi \else \newpage \global\@topnum\z@ \@maketitle \fi \thispagestyle{title}\@thanks \endgroup \@bscontmark % \setcounter{footnote}{0}% } \aliaspagestyle{title}{plain} % \end{macrocode} % % \begin{macro}{\@maketitle} % Our version of |\@maketitle|. % \begin{macrocode} \newcommand{\@maketitle}{% \newpage \null \vskip 2em% \vspace*{\droptitle} \maketitlehooka {\@bspretitle \@title \@bsposttitle} \maketitlehookb {\@bspreauthor \@author \@bspostauthor} \maketitlehookc {\@bspredate \@date \@bspostdate} \maketitlehookd \par \vskip 1.5em} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{environment}{titlingpage} % The |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. % \begin{macrocode} \newenvironment{titlingpage}% {\let\footnoterule\relax \let\footnotesize\small \if@twocolumn \@restonecoltrue\onecolumn \else \@restonecolfalse \fi \thispagestyle{titlingpage}% \setcounter{page}{\@ne}% }{% \thispagestyle{titlingpage}% \if@restonecol \twocolumn \fi \if@twoside \cleardoublepage \else \clearpage \fi \setcounter{page}{\@ne}} \aliaspagestyle{titlingpage}{empty} % \end{macrocode} % \end{environment} % % \begin{macro}{\emptythanks} % This macro discards all prior |\thanks| texts. % \begin{macrocode} \newcommand{\emptythanks}{\global\let\@thanks\@empty} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@bsmtitlempty} % |\@bsmtitlempty| is a helper macro to save some macro space. % It empties some elements of |\maketitle|. % \begin{macrocode} \newcommand{\@bsmtitlempty}{% \global\let\maketitle\relax \global\let\@maketitle\relax \global\let\title\relax \global\let\author\relax \global\let\date\relax \global\let\thanksmarkseries\relax \global\let\thanksheadextra\relax \global\let\thanksfootextra\relax \global\let\thanksmark\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|. % \begin{macrocode} \newcommand{\keepthetitle}{% \@bsmtitlempty \global\let\thanks\relax \global\let\and\relax \global\let\@thanks\@empty \global\let\@title\@empty \global\let\@author\@empty \global\let\@date\@empty } % \end{macrocode} % \end{macro} % % \begin{macro}{\killtitle} % |\killtitle| undefines the remaining macros of |\maketitle|. % \begin{macrocode} \newcommand{\killtitle}{% \keepthetitle \global\let\thetitle\relax \global\let\theauthor\relax \global\let\thedate\relax } % \end{macrocode} % \end{macro} % % % \begin{macro}{\thetitle} % \begin{macro}{\theauthor} % \begin{macro}{\thedate} % In order to make the |\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. % \begin{macrocode} \addtoiargdef{\title}{}{% \begingroup \renewcommand{\thanks}[1]{} \renewcommand{\thanksmark}[1]{} \renewcommand{\thanksgap}[1]{} \protected@xdef\thetitle{#1} \endgroup} \addtoiargdef{\author}{}{% \begingroup \renewcommand{\thanks}[1]{} \renewcommand{\and}{\unskip, } \renewcommand{\thanksmark}[1]{} \renewcommand{\thanksgap}[1]{} \protected@xdef\theauthor{#1} \endgroup} \addtoiargdef{\date}{}{% \begingroup \renewcommand{\thanks}[1]{} \renewcommand{\thanksmark}[1]{} \renewcommand{\thanksgap}[1]{} \protected@xdef\thedate{#1} \endgroup} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \subsection{Abstracts} % % I also 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}{\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. % \begin{macrocode} \newlength{\absleftindent} \newlength{\absrightindent} \newlength{\absparindent} \newlength{\absparsep} % \end{macrocode} % \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. % \begin{macrocode} \newcommand{\setup@bstract}{% \if@twocolumn % \end{macrocode} % Values for the \Lopt{twocolumn} class option. % \begin{macrocode} \if@bsonecol \setlength{\absleftindent}{\leftmargin} \else \setlength{\absleftindent}{\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} \setlength{\absleftindent}{\leftmargin} \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. % \begin{macrocode} \newenvironment{@bstr@ctlist}{% \list{}{% %%\topsep \z@ \partopsep \z@ \listparindent \absparindent \itemindent \listparindent \leftmargin \absleftindent \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{Verbatims, boxes, and files} % % All the code in this section was added for version 1.2 of the class. % \changes{v1.2}{2002/07/27}{Section `Verbatims, boxes and files' added} % % \subsection{Modified version of the verbatim package} % % Much of this is from the \Lpack{verbatim} package code~\cite{VERBATIM}. % Unless indicated otherwise, the code and commentary is from that % package. % % % \subsubsection{Preliminaries} % % \begin{macro}{\every@verbatim} % \begin{macro}{\afterevery@verbatim} % The hook (i.e.\ token register) |\every@verbatim| % is initialized to \meta{empty}. % % PW added the |\afterevery@verbatim| hook. % \begin{macrocode} \newtoks\every@verbatim \every@verbatim={} \newtoks\afterevery@verbatim \afterevery@verbatim={} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\@makeother} % |\@makeother| takes as argument a character and changes % its category code to $12$ (other). % \begin{macrocode} \def\@makeother#1{\catcode`#112\relax} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@vobeyspaces} % The macro |\@vobeyspaces| causes spaces in the input % to be printed as spaces in the output. % \begin{macrocode} \begingroup \catcode`\ =\active% \def\x{\def\@vobeyspaces{\catcode`\ \active\let \@xobeysp}} \expandafter\endgroup\x % \end{macrocode} % \end{macro} % % % \begin{macro}{\@xobeysp} % The macro |\@xobeysp| produces exactly one space in % the output, protected against breaking just before it. % (|\@M| is an abbreviation for the number $10000$.) % \begin{macrocode} \def\@xobeysp{\leavevmode\penalty\@M\ } % \end{macrocode} % \end{macro} % % % \begin{macro}{\verbatim@line} % We use a newly defined token register called |\verbatim@line| % that will be used as the character buffer. % \begin{macrocode} \newtoks\verbatim@line % \end{macrocode} % \end{macro} % % PW. I have extended the original \Lpack{verbatim} package code to handle % TABs within verbatims. Normally TeX replaces a TAB by either a single space or % ignores it altogether. For this purpose I have bits of code from the \Lpack{moreverb} % package~\cite{MOREVERB} for handling TABs. % % \textit{Code and commentary from moreverb.} % % We define a few auxiliary macros and counters for expanding tabs. % \begin{macrocode} \newcount\tab@position % \end{macrocode} % % \begin{macro}{\@xobeytab} % |\@xobeytab| puts enough spaces in to get to the next nominal % tab stop % \begin{macrocode} \def\@xobeytab{% \loop \toks@\expandafter{\the\toks@\@xobeysp}% \advance\tab@position-1 \ifnum\tab@position>0 \repeat } % \end{macrocode} % \end{macro} % % \begin{macro}{\@vobeytabs} % |\@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. % % \begin{macrocode} \begingroup \catcode`\^^I=\active \gdef\@vobeytabs{\catcode`\^^I\active\let^^I\@xobeytab}% \endgroup % \end{macrocode} % \end{macro} % % \begin{macro}{\verbatim@tabexpand} % |\verbatim@tabexpand|\meta{body of line}|\@nil| processes every % character of a line by tail recursion, counting the characters and % juggling things when a tab is encountered. % \begin{macrocode} \def\verbatim@tabexpand#1{% \ifx#1\@nil \the\toks@ \expandafter\par \else \ifx#1\@xobeytab \@xobeytab \else % \end{macrocode} % % We can safely put |\@xobeysp| into the token register, since it % does precisely what we need % \begin{macrocode} \toks@\expandafter{\the\toks@#1}% \advance\tab@position\m@ne \fi \ifnum\tab@position=0 \tab@position\tab@size \fi \expandafter\verbatim@tabexpand \fi } % \end{macrocode} % \end{macro} % % \textit{End of code and commentary from moreverb.} % % PW. Some macros for turning tabbing on and off. % % \begin{macro}{\tabson} % \begin{macro}{\tabsoff} % \begin{macro}{\@maybeobeytabs} % |\tabson| turns tabbing on, and |\tabsoff| turns it off. Default % is no tabbing. % \begin{macrocode} \newif\ift@bs \newcommand{\tabson}[1][4]{% \ifnum\@ne > #1\relax \tabsoff \else \t@bstrue \def\tab@size{#1\relax}% \def\@maybeobeytabs{\@vobeytabs}% \fi } \newcommand{\tabsoff}{% \t@bsfalse \def\tab@size{\z@}% \def\@maybeobeytabs{}% } \tabsoff % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\tabverbatim@processline} % Process a line with TABs (extracted from \Lpack{moreverb}). % \begin{macrocode} \def\tabverbatim@processline{\tab@position\tab@size \toks@{}% \expandafter\verbatim@tabexpand\the\verbatim@line\@nil} % \end{macrocode} % \end{macro} % % \begin{macro}{\notabverbatim@processline} % Processes a line ignoring TABs (this is the original \Lpack{verbatim} % package definition of |\verbatim@processline|). % \begin{macrocode} \def\notabverbatim@processline{\the\verbatim@line\par} % \end{macrocode} % \end{macro} % % \textit{We are now back to the \Lpack{verbatim} code.} % % The following four macros are defined globally in a way suitable for % the \texttt{verbatim} and \texttt{verbatim*} environments. % \begin{macro}{\verbatim@startline} % \begin{macro}{\verbatim@addtoline} % \begin{macro}{\verbatim@processline} % |\verbatim@startline| initializes processing of a line % by emptying the character buffer (|\verbatim@line|). % \begin{macrocode} \def\verbatim@startline{\verbatim@line{}} % \end{macrocode} % |\verbatim@addtoline| adds the tokens in its argument % to our buffer register |\verbatim@line| without expanding % them. % \begin{macrocode} \def\verbatim@addtoline#1{% \verbatim@line\expandafter{\the\verbatim@line#1}} % \end{macrocode} % Processing a line inside a \texttt{verbatim} or \texttt{verbatim*} % environment means printing it. % Ending the line means that we have to begin a new paragraph. % We use |\par| for this purpose. Note that |\par| % is redefined in |\@verbatim| to force \TeX{} into horizontal % mode and to insert an empty box so that empty lines in the input % do appear in the output. % (PW changed next line from \\ % |\def\verbatim@processline{\the\verbatim@line\par}| % \begin{macrocode} \def\verbatim@processline{\notabverbatim@processline} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\verbatim@finish} % As a default, |\verbatim@finish| processes the remaining % characters. % When this macro is called we are facing the following problem: % when the |\end{verbatim}| % command is encountered |\verbatim@processline| is called % to process the characters preceding the command on the same % line. If there are none, an empty line would be output if we % did not check for this case. % % If the line is empty |\the\verbatim@line| expands to % nothing. To test this we use a trick similar to that on p.\ 376 % of the \TeX{}book, but with |$|\ldots|$| instead of % the |!| tokens. These |$| tokens can never have the same % category code as a |$| token that might possibly appear in the % token register |\verbatim@line|, as such a token will always have % been read with category code $12$ (other). % Note that |\ifcat| expands the following tokens so that % |\the\verbatim@line| is replaced by the accumulated % characters % \begin{macrocode} \def\verbatim@finish{\ifcat$\the\verbatim@line$\else \verbatim@processline\fi} % \end{macrocode} % \end{macro} % % % \subsubsection{The \texttt{verbatim} and \texttt{verbatim*} environments} % % \begin{macro}{\verbatim@font} % We start by defining the macro |\verbatim@font| that is % to select the font and to set font-dependent parameters. % Then we go through |\verbatim@nolig@list| to avoid % certain ligatures. % |\verbatim@nolig@list| is a macro defined in the \LaTeXe{} kernel % to expand to % \begin{verbatim} % \do\`\do\<\do\>\do\,\do\'\do\- % \end{verbatim} % All the characters in this list can be part of a ligature in some % font or other. % % PW. This is the original version which I'm going to replace. % \begin{verbatim} % \def\verbatim@font{\normalfont\ttfamily % \hyphenchar\font\m@ne % \let\do\do@noligs % \verbatim@nolig@list} % \end{verbatim} % \end{macro} % % \begin{macro}{\setverbatimfont} % \begin{macro}{\m@mverbfont} % \begin{macro}{\verbatim@font} % User level handle for changing the font used for verbatim text. % \begin{macrocode} \newcommand{\setverbatimfont}[1]{\def\m@mverbfont{#1}} \setverbatimfont{\normalfont\ttfamily} \def\verbatim@font{\m@mverbfont \hyphenchar\font\m@ne \let\do\do@noligs \verbatim@nolig@list} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\@verbatim} % The macro |\@verbatim| sets up things properly. % First of all, the tokens of the |\every@verbatim| hook % are inserted. % Then a \texttt{trivlist} environment is started and its first % |\item| command inserted. % Each line of the \texttt{verbatim} or \texttt{verbatim*} % environment will be treated as a separate paragraph. % \begin{macrocode} \def\@verbatim{\the\every@verbatim \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. % \begin{macrocode} \if@minipage\else\vskip\parskip\fi % \end{macrocode} % The paragraph parameters are set appropriately: % the penalty at the beginning of the environment, % left and right margins, paragraph indentation, the glue to % fill the last line, and the vertical space between paragraphs. % The latter space has to be zero since we do not want to add % extra space between lines. % \begin{macrocode} \@beginparpenalty \predisplaypenalty \leftskip\@totalleftmargin\rightskip\z@ \parindent\z@\parfillskip\@flushglue\parskip\z@ % \end{macrocode} % There's one point to make here: % the \texttt{list} environment uses \TeX's |\parshape| % primitive to get a special indentation for the first line % of the list. % If the list begins with a \texttt{verbatim} environment % this |\parshape| is still in effect. % Therefore we have to reset this internal parameter explicitly. % We could do this by assigning $0$ to |\parshape|. % However, there is a simpler way to achieve this: % we simply tell \TeX{} to start a new paragraph. % As is explained on p.~103 of the \TeX{}book, this resets % |\parshape| to zero. % \begin{macrocode} \@@par % \end{macrocode} % We now ensure that |\par| has the correct definition, % namely to force \TeX{} into horizontal mode % and to include an empty box. % This is to ensure that empty lines do appear in the output. % Afterwards, we insert the |\interlinepenalty| since \TeX{} % does not add a penalty between paragraphs (here: lines) % by its own initiative. Otherwise a |verbatim| environment % could be broken across pages even if a |\samepage| % declaration were present. % % However, in a top-aligned minipage, this will result in an extra % empty line added at the top. Therefore, a slightly more % complicated construct is necessary. % One of the important things here is the inclusion of % |\leavevmode| as the first macro in the first line, for example, % a blank verbatim line is the first thing in a list item. % \begin{macrocode} \def\par{% \if@tempswa \leavevmode\null\@@par\penalty\interlinepenalty \else \@tempswatrue \ifhmode\@@par\penalty\interlinepenalty\fi \fi}% % \end{macrocode} % But to avoid an error message when the environment % doesn't contain any text, we redefine |\@noitemerr| % which will in this case be called by |\endtrivlist|. % \begin{macrocode} \def\@noitemerr{\@warning{No verbatim text}}% % \end{macrocode} % Now we call |\obeylines| to make the end of line character % active, % \begin{macrocode} \obeylines % \end{macrocode} % change the category code of all special characters, % to $12$ (other). % \begin{macrocode} \let\do\@makeother \dospecials % \end{macrocode} % and switch to the font to be used. % \begin{macrocode} \verbatim@font % \end{macrocode} % To avoid a breakpoint after the labels box, we remove the penalty % put there by the list macros: another use of |\unpenalty|! % \begin{macrocode} \everypar \expandafter{\the\everypar \unpenalty}% % \end{macrocode} % PW added next code at end of |\@verbatim|. % \begin{macrocode} \wrapright\the\afterevery@verbatim} % \end{macrocode} % \end{macro} % % % \begin{macro}{\verbatim} % \begin{macro}{\verbatim*} % Now we define the toplevel macros. % |\verbatim| is slightly changed: % after setting up things properly it calls % |\verbatim@start|. % This is done inside a group, so that |\verbatim| can be used % directly, without |\begin|. % % PW. The following is the original code, but I want a version of % |verbatim| that recognises TABs. % \begin{verbatim} % \begin{macrocode} % \def\verbatim{\begingroup\@verbatim \frenchspacing\@vobeyspaces % \verbatim@start} % \end{macrocode} % |\verbatim*| is defined accordingly. % \begin{macrocode} % \@namedef{verbatim*}{\begingroup\@verbatim\verbatim@start} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\endverbatim} % \begin{macro}{\endverbatim*} % To end the \texttt{verbatim} and \texttt{verbatim*} % environments it is only necessary to finish the % \texttt{trivlist} environment started in |\@verbatim| and % close the corresponding group. % \begin{macrocode} % \def\endverbatim{\endtrivlist\endgroup} % \expandafter\let\csname endverbatim*\endcsname =\endverbatim % \end{macrocode} % \end{verbatim} % \end{macro} % \end{macro} % % % \begin{macro}{\verbatim} % \begin{macro}{\verbatim*} % PW. The code for these is a modified version of the original \Lpack{verbatim} % code. % \begin{macrocode} \def\verbatim{\begingroup \ift@bs \def\verbatim@processline{\tabverbatim@processline}% \fi \@verbatim \frenchspacing\@vobeyspaces\@maybeobeytabs\verbatim@start} \@namedef{verbatim*}{\begingroup \ift@bs \def\verbatim@processline{\tabverbatim@processline}% \fi \@verbatim\@maybeobeytabs\verbatim@start} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\endverbatim} % \begin{macro}{\endverbatim*} % \begin{macrocode} \def\endverbatim{\endtrivlist\endgroup} \expandafter\let\csname endverbatim*\endcsname =\endverbatim % \end{macrocode} % \end{macro} % \end{macro} % % % \subsubsection{The \texttt{comment} environment} % % The |\comment| macro is similar to |\verbatim*|. % However, we do not need to switch fonts or set special % formatting parameters such as |\parindent| or |\parskip|. % We need only set the category code of all special characters % to $12$ (other) and that of |^^M| (the end of line character) % to $13$ (active). % The latter is needed for macro parameter delimiter matching in % the internal macros defined below. % In contrast to the default definitions used by the % |\verbatim| and |\verbatim*| macros, % we define |\verbatim@addtoline| to throw away its argument % and |\verbatim@processline|, |\verbatim@startline|, % and |\verbatim@finish| to act as no-ops. % Then we call |\verbatim@|. % But the first thing we do is to call |\@bsphack| so that % this environment has no influence whatsoever upon the spacing. % % PW: This is the original code for the |comment| environment, % which I'm going to change. % \begin{verbatim} % \def\comment{\@bsphack % \let\do\@makeother\dospecials\catcode`\^^M\active % \let\verbatim@startline\relax % \let\verbatim@addtoline\@gobble % \let\verbatim@processline\relax % \let\verbatim@finish\relax % \verbatim@} % \end{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 % of restoring everything we changed. % \begin{verbatim} % \let\endcomment=\@esphack % \end{verbatim} % % PW: The remainder of this section is my code. % % \begin{macro}{\setupcomment} % |\setupcomment| does all the |\let|s in the original |\comment| code. % \begin{macrocode} \newcommand{\setupcomment}{% \let\do\@makeother\dospecials\catcode`\^^M\active \let\verbatim@startline\relax \let\verbatim@addtoline\@gobble \let\verbatim@processline\relax \let\verbatim@finish\relax} % \end{macrocode} % \end{macro} % % The macros below do no checking to see if something has (not) been defined % previously. It's `user beware' time. % % \begin{macro}{\newcomment} % |\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]{% \expandafter\def\csname #1\endcsname{\@bsphack\setupcomment\verbatim@}% \expandafter\let\csname end#1\endcsname=\@esphack} % \end{macrocode} % \end{macro} % % \begin{macro}{\commentsoff} % |\commentsoff|\marg{name} switches off the \meta{name} comment % environment by defining the relevent macros to do nothing. % \begin{macrocode} \newcommand{\commentsoff}[1]{% \expandafter\def\csname #1\endcsname{}% \expandafter\def\csname end#1\endcsname{}} % \end{macrocode} % \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. % \begin{macrocode} \newcommand{\commentson}[1]{\newcomment{#1}} % \end{macrocode} % \end{macro} % % We had better supply the |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. % % % \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 % normal category codes, % but also with category code $12$ (other). % We achieve this by the following trick: % first we tell \TeX{} that |\|, |{|, and |}| % are the lowercase versions of |!|, |[|, and |]|. % Then we replace every occurrence of |\|, |{|, and |}| % that should be read with category code $12$ by |!|, |[|, % and |]|, respectively, % and give the whole list of tokens to |\lowercase|, % knowing that category codes are not altered by this primitive! % % But first we have ensure that % |!|, |[|, and |]| themselves have % the correct category code! % To allow special settings of these codes we hide their setting in % the macro |\vrb@catcodes|. If it is already defined our new % definition is skipped. % \begin{macrocode} \@ifundefined{vrb@catcodes}% {\def\vrb@catcodes{% \catcode`\!12\catcode`\[12\catcode`\]12}}{} % \end{macrocode} % This trick allows us to use this code for applications where other % category codes are in effect. % % We start a group to keep the category code changes local. % \begin{macrocode} \begingroup \vrb@catcodes \lccode`\!=`\\ \lccode`\[=`\{ \lccode`\]=`\} % \end{macrocode} % We also need the end-of-line character |^^M|, % as an active character. % If we were to simply write |\catcode`\^^M=\active| % then we would get an unwanted active end of line character % at the end of every line of the following macro definitions. % Therefore we use the same trick as above: % we write a tilde |~| instead of |^^M| and % pretend that the % latter is the lowercase variant of the former. % Thus we have to ensure now that the tilde character has % category code $13$ (active). % \begin{macrocode} \catcode`\~=\active \lccode`\~=`\^^M % \end{macrocode} % The use of the |\lowercase| primitive leads to one problem: % the uppercase character `|C|' needs to be used in the % code below and its case must be preserved. % So we add the command: % \begin{macrocode} \lccode`\C=`\C % \end{macrocode} % Now we start the token list passed to |\lowercase|. % We use the following little trick (proposed by Bernd Raichle): % The very first token in the token list we give to |\lowercase| is % the |\endgroup| primitive. This means that it is processed by % \TeX{} immediately after |\lowercase| has finished its operation, % thus ending the group started by |\begingroup| above. This avoids % the global definition of all macros. % \begin{macrocode} \lowercase{\endgroup % \end{macrocode} % \begin{macro}{\verbatim@start} % The purpose of |\verbatim@start| is to check whether there % are any characters on the same line as the |\begin{verbatim}| % and to pretend that they were on a line by themselves. % On the other hand, if there are no characters remaining % on the current line we shall just find an end of line character. % |\verbatim@start| performs its task by first grabbing the % following character (its argument). % This argument is then compared to an active |^^M|, % the end of line character. % \begin{macrocode} \def\verbatim@start#1{% \verbatim@startline \if\noexpand#1\noexpand~% % \end{macrocode} % If this is true we transfer control to |\verbatim@| % to process the next line. We use % |\next| as the macro which will continue the work. % \begin{macrocode} \let\next\verbatim@ % \end{macrocode} % Otherwise, we define |\next| to expand to a call % to |\verbatim@| followed by the character just % read so that it is reinserted into the text. % This means that those characters remaining on this line % are handled as if they formed a line by themselves. % \begin{macrocode} \else \def\next{\verbatim@#1}\fi % \end{macrocode} % Finally we call |\next|. % \begin{macrocode} \next}% % \end{macrocode} % \end{macro} % % \begin{macro}{\verbatim@} % The three macros |\verbatim@|, |\verbatim@@|, % and |\verbatim@@@| form the ``main loop'' of the % \texttt{verbatim} environment. % The purpose of |\verbatim@| is to read exactly one line % of input. % |\verbatim@@| and |\verbatim@@@| work together to % find out whether the four characters % |\end| (all with category code $12$ (other)) occur in that % line. % If so, |\verbatim@@@| will call % |\verbatim@test| to check whether this |\end| is % part of |\end{verbatim}| and will terminate the environment % if this is the case. % Otherwise we continue as if nothing had happened. % So let's have a look at the definition of |\verbatim@|: % \begin{macrocode} \def\verbatim@#1~{\verbatim@@#1!end\@nil}% % \end{macrocode} % Note that the |!| character will have been replaced by a % |\| with category code $12$ (other) by the |\lowercase| % primitive governing this code before the definition of this % macro actually takes place. % That means that % it takes the line, puts |\end| (four character tokens) % and |\@nil| (one control sequence token) as a % delimiter behind it, and % then calls |\verbatim@@|. % \end{macro} % % \begin{macro}{\verbatim@@} % |\verbatim@@| takes everything up to the next occurrence of % the four characters |\end| as its argument. % \begin{macrocode} \def\verbatim@@#1!end{% % \end{macrocode} % That means: if they do not occur in the original line, then % argument |#1| is the % whole input line, and |\@nil| is the next token % to be processed. % However, if the four characters |\end| are part of the % original line, then % |#1| consists of the characters in front of |\end|, % and the next token is the following character (always remember % that the line was lengthened by five tokens). % Whatever |#1| may be, it is verbatim text, % so |#1| is added to the line currently built. % \begin{macrocode} \verbatim@addtoline{#1}% % \end{macrocode} % The next token in the input stream % is of special interest to us. % Therefore |\futurelet| defines |\next| to be equal % to it before calling |\verbatim@@@|. % \begin{macrocode} \futurelet\next\verbatim@@@}% % \end{macrocode} % \end{macro} % % \begin{macro}{\verbatim@@@} % |\verbatim@@@| will now read the rest of the tokens on % the current line, % up to the final |\@nil| token. % \begin{macrocode} \def\verbatim@@@#1\@nil{% % \end{macrocode} % If the first of the above two cases occurred, i.e.\ no % |\end| characters were on that line, |#1| is empty % and |\next| is equal to |\@nil|. % This is easily checked. % \begin{macrocode} \ifx\next\@nil % \end{macrocode} % If so, this was a simple line. % We finish it by processing the line we accumulated so far. % Then we prepare to read the next line. % \begin{macrocode} \verbatim@processline \verbatim@startline \let\next\verbatim@ % \end{macrocode} % Otherwise we have to check what follows these |\end| % tokens. % \begin{macrocode} \else % \end{macrocode} % Before we continue, it's a good idea to stop for a moment % and remember where we are: % We have just read the four character tokens |\end| % and must now check whether the name of the environment (surrounded % by braces) follows. % To this end we define a macro called |\@tempa| % that reads exactly one character and decides what to do next. % This macro should do the following: skip spaces until % it encounters either a left brace or the end of the line. % But it is important to remember which characters are skipped. % The |\end|\meta{optional spaces}|{| characters % may be part of the verbatim text, i.e.\ these characters % must be printed. % % Assume for example that the current line contains % \begin{verbatim*} % \end {AVeryLongEnvironmentName} %\end{verbatim*} % As we shall soon see, the scanning mechanism implemented here % will not find out that this is text to be printed until % it has read the right brace. % Therefore we need a way to accumulate the characters read % so that we can reinsert them if necessary. % The token register |\@temptokena| is used for this purpose. % % Before we do this we have to get rid of the superfluous % |\end| tokens at the end of the line. % To this end we define a temporary macro whose argument % is delimited by |\end\@nil| (four character tokens % and one control sequence token) to be used below % on the rest of the line, after appending a |\@nil| token to it. % (Note that this token can never appear in |#1|.) % We use the following definition of % |\@tempa| to get the rest of the line (after the first % |\end|). % \begin{macrocode} \def\@tempa##1!end\@nil{##1}% % \end{macrocode} % We mentioned already that we use token register % |\@temptokena| % to remember the characters we skip, in case we need them again. % We initialize this with the |\end| we have thrown away % in the call to |\@tempa|. % \begin{macrocode} \@temptokena{!end}% % \end{macrocode} % We shall now call |\verbatim@test| % to process the characters % remaining on the current line. % But wait a moment: we cannot simply call this macro % since we have already read the whole line. % Therefore we have to first expand the macro |\@tempa| to insert % them again after the |\verbatim@test| token. % A |^^M| character is appended to denote the end of the line. % (Remember that this character comes disguised as a tilde.) % \begin{macrocode} \def\next{\expandafter\verbatim@test\@tempa#1\@nil~}% % \end{macrocode} % That's almost all, but we still have to % now call |\next| to do the work. % \begin{macrocode} \fi \next}% % \end{macrocode} % \end{macro} % % % \begin{macro}{\verbatim@test} % We define |\verbatim@test| to investigate every token % in turn. % \begin{macrocode} \def\verbatim@test#1{% % \end{macrocode} % First of all we set |\next| equal to |\verbatim@test| % in case this macro must call itself recursively in order to % skip spaces. % \begin{macrocode} \let\next\verbatim@test % \end{macrocode} % We have to distinguish four cases: % \begin{enumerate} % \item The next token is a |^^M|, i.e.\ we reached % the end of the line. That means that nothing % special was found. % Note that we use |\if| for the following % comparisons so that the category code of the % characters is irrelevant. % \begin{macrocode} \if\noexpand#1\noexpand~% % \end{macrocode} % We add the characters accumulated in token register % |\@temptokena| to the current line. Since % |\verbatim@addtoline| does not expand its argument, % we have to do the expansion at this point. Then we % |\let| |\next| equal to |\verbatim@| % to prepare to read the next line. % \begin{macrocode} \expandafter\verbatim@addtoline \expandafter{\the\@temptokena}% \verbatim@processline \verbatim@startline \let\next\verbatim@ % \end{macrocode} % \item A space character follows. % This is allowed, so we add it to |\@temptokena| % and continue. % \begin{macrocode} \else \if\noexpand#1 \@temptokena\expandafter{\the\@temptokena#1}% % \end{macrocode} % \item An open brace follows. % This is the most interesting case. % We must now collect characters until we read the closing % brace and check whether they form the environment name. % This will be done by |\verbatim@testend|, so here % we let |\next| equal this macro. % Again we will process the rest of the line, character % by character. % The characters forming the name of the environment will % be accumulated in |\@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 % this macro is defined. % \item Any other character means that the |\end| was part % of the verbatim text. % Add the characters to the current line and prepare to call % |\verbatim@| to process the rest of the line. % \begin{macrocode} \else \expandafter\verbatim@addtoline \expandafter{\the\@temptokena}% \def\next{\verbatim@#1}% \fi\fi\fi % \end{macrocode} % \end{enumerate} % The last thing this macro does is to call |\next| % to continue processing. % \begin{macrocode} \next}% % \end{macrocode} % \end{macro} % % \begin{macro}{\verbatim@testend} % |\verbatim@testend| is called when % |\end|\meta{optional spaces}|{| was seen. % Its task is to scan everything up to the next |}| % and to call |\verbatim@@testend|. % If no |}| is found it must reinsert the characters it read % and return to |\verbatim@|. % The following definition is similar to that of % |\verbatim@test|: % it takes the next character and decides what to do. % \begin{macrocode} \def\verbatim@testend#1{% % \end{macrocode} % Again, we have four cases: % \begin{enumerate} % \item |^^M|: As no |}| is found in the current line, % add the characters to the buffer. To avoid a % complicated construction for expanding % |\@temptokena| % and |\@tempc| we do it in two steps. Then we % continue with |\verbatim@| to process the % next line. % \begin{macrocode} \if\noexpand#1\noexpand~% \expandafter\verbatim@addtoline \expandafter{\the\@temptokena[}% \expandafter\verbatim@addtoline \expandafter{\@tempc}% \verbatim@processline \verbatim@startline \let\next\verbatim@ % \end{macrocode} % \item |}|: Call |\verbatim@@testend| to check % if this is the right environment name. % \begin{macrocode} \else\if\noexpand#1\noexpand]% \let\next\verbatim@@testend % \end{macrocode} % \item |\|: This character must not occur in the name of % an environment. Thus we stop collecting characters. % In principle, the same argument would apply to other % characters as well, e.g., |{|. % However, |\| is a special case, since it may be % the first character of |\end|. This means that % we have to look again for % |\end{|\meta{environment name}|}|. % Note that we prefixed the |!| by a |\noexpand| % primitive, to protect ourselves against it being an % active character. % \begin{macrocode} \else\if\noexpand#1\noexpand!% \expandafter\verbatim@addtoline \expandafter{\the\@temptokena[}% \expandafter\verbatim@addtoline \expandafter{\@tempc}% \def\next{\verbatim@!}% % \end{macrocode} % \item Any other character: collect it and continue. % We cannot use |\edef| to define |\@tempc| % since its replacement text might contain active % character tokens. % \begin{macrocode} \else \expandafter\def\expandafter\@tempc\expandafter {\@tempc#1}\fi\fi\fi % \end{macrocode} % \end{enumerate} % As before, the macro ends by calling itself, to % process the next character if appropriate. % \begin{macrocode} \next}% % \end{macrocode} % \end{macro} % % \begin{macro}{\verbatim@@testend} % Unlike the previous macros |\verbatim@@testend| is simple: % it has only to check if the |\end{|\ldots|}| % matches the corresponding |\begin{|\ldots|}|. % \begin{macrocode} \def\verbatim@@testend{% % \end{macrocode} % We use |\next| again to define the things that are % to be done. % Remember that the name of the current environment is % held in |\@currenvir|, the characters accumulated % by |\verbatim@testend| are in |\@tempc|. % So we simply compare these and prepare to execute % |\end{|\meta{current environment}|}| % macro if they match. % Before we do this we call |\verbatim@finish| to process % the last line. % We define |\next| via |\edef| so that % |\@currenvir| is replaced by its expansion. % Therefore we need |\noexpand| to inhibit the expansion % of |\end| at this point. % \begin{macrocode} \ifx\@tempc\@currenvir \verbatim@finish \edef\next{\noexpand\end{\@currenvir}% % \end{macrocode} % Without this trick the |\end| command would not be able % to correctly check whether its argument matches the name of % the current environment and you'd get an % interesting \LaTeX{} error message such as: % \begin{verbatim} %! \begin{verbatim*} ended by \end{verbatim*}. %\end{verbatim} % But what do we do with the rest of the characters, those % that remain on that line? % We call |\verbatim@rescan| to take care of that. % Its first argument is the name of the environment just % ended, in case we need it again. % |\verbatim@rescan| takes the list of characters to be % reprocessed as its second argument. % (This token list was inserted after the current macro % by |\verbatim@@@|.) % Since we are still in an |\edef| we protect it % by means of|\noexpand|. % \begin{macrocode} \noexpand\verbatim@rescan{\@currenvir}}% % \end{macrocode} % If the names do not match, we reinsert everything read up % to now and prepare to call |\verbatim@| to process % the rest of the line. % \begin{macrocode} \else \expandafter\verbatim@addtoline \expandafter{\the\@temptokena[}% \expandafter\verbatim@addtoline \expandafter{\@tempc]}% \let\next\verbatim@ \fi % \end{macrocode} % Finally we call |\next|. % \begin{macrocode} \next}% % \end{macrocode} % \end{macro} % % \begin{macro}{\verbatim@rescan} % In principle |\verbatim@rescan| could be used to % analyse the characters remaining after the |\end{...}| % command and pretend that these were read % ``properly'', assuming ``standard'' category codes are in % force.\footnote{Remember that they were all read with % category codes $11$ (letter) and $12$ (other) so % that control sequences are not recognized as such.} % But this is not always possible (when there are unmatched % curly braces in the rest of the line). % Besides, we think that this is not worth the effort: % After a \texttt{verbatim} or \texttt{verbatim*} environment % a new line in the output is begun anyway, % and an |\end{comment}| can easily be put on a line by itself. % So there is no reason why there should be any text here. % For the benefit of the user who did put something there % (a comment, perhaps) % we simply issue a warning and drop them. % The method of testing is explained in Appendix~D, p.\ 376 of % the \TeX{}book. We use |^^M| instead of the |!| % character used there % since this is a character that cannot appear in |#1|. % The two |\noexpand| primitives are necessary to avoid % expansion of active characters and macros. % % One extra subtlety should be noted here: remember that % the token list we are currently building will first be % processed by the |\lowercase| primitive before \TeX{} % carries out the definitions. % This means that the `|C|' character in the % argument to the |\@warning| macro must be protected against % being changed to `|c|'. That's the reason why we added the % |\lccode`\C=`\C| assignment above. % We can now finish the argument to |\lowercase| as well as the % group in which the category codes were changed. % \begin{macrocode} \def\verbatim@rescan#1#2~{\if\noexpand~\noexpand#2~\else \@warning{Characters dropped after `\string\end{#1}'}\fi}} % \end{macrocode} % \end{macro} % % \subsubsection{The \cs{verbatiminput} command} % % \begin{macro}{\verbatim@in@stream} % We begin by allocating an input stream (out of the 16 available % input streams). % \begin{macrocode} \newread\verbatim@in@stream % \end{macrocode} % \end{macro} % % \begin{macro}{\verbatim@readfile} % The macro |\verbatim@readfile| encloses the main loop by calls to % the macros |\verbatim@startline| and |\verbatim@finish|, % respectively. This makes sure % that the user can initialize and finish the command when the file % is empty or doesn't exist. The \texttt{verbatim} environment has a % similar behaviour when called with an empty text. % \begin{macrocode} \def\verbatim@readfile#1{% \verbatim@startline % \end{macrocode} % When the file is not found we issue a warning. % \begin{macrocode} \openin\verbatim@in@stream #1\relax \ifeof\verbatim@in@stream \typeout{No file #1.}% \else % \end{macrocode} % At this point we pass the name of the file to |\@addtofilelist| % so that its appears appears in the output of a |\listfiles| % command. % In addition, we use |\ProvidesFile| to make a log entry in the % transcript file and to distinguish files read in via % |\verbatiminput| from others. % \begin{macrocode} \@addtofilelist{#1}% \ProvidesFile{#1}[(verbatim)]% % \end{macrocode} % While reading from the file it is useful to switch off the % recognition of the end-of-line character. This saves us stripping % off spaces from the contents of the line. % \begin{macrocode} \expandafter\endlinechar\expandafter\m@ne \expandafter\verbatim@read@file \expandafter\endlinechar\the\endlinechar\relax \closein\verbatim@in@stream \fi \verbatim@finish } % \end{macrocode} % \end{macro} % % \begin{macro}{\verbatim@read@file} % All the work is done in |\verbatim@read@file|. It reads the input % file line by line and recursively calls itself until the end of % the file. % \begin{macrocode} \def\verbatim@read@file{% \read\verbatim@in@stream to\next \ifeof\verbatim@in@stream \else % \end{macrocode} % For each line we call |\verbatim@addtoline| with the contents of % the line. \hskip0pt plus 3cm\penalty0\hskip0pt plus -3cm % |\verbatim@processline| is called next. % \begin{macrocode} \expandafter\verbatim@addtoline\expandafter{\next}% \verbatim@processline % \end{macrocode} % After processing the line we call |\verbatim@startline| to % initialize all before we read the next line. % \begin{macrocode} \verbatim@startline % \end{macrocode} % Without |\expandafter| each call of |\verbatim@read@file| uses % space in \TeX's input stack.\footnote{A standard \TeX\ would % report an overflow error if you try to read a file with more than % ca.\ 200~lines. The same error occurs if the first line of code % in \S 390 of \textsl{``TeX: The Program''\/} is missing.} % \begin{macrocode} \expandafter\verbatim@read@file \fi } % \end{macrocode} % \end{macro} % % % \begin{macro}{\verbatiminput} % |\verbatiminput| first starts a group to keep font and category % changes local. % Then it calls the macro |\verbatim@input| with additional % arguments, depending on whether an asterisk follows. % % PW. I added the TAB checking code. % \begin{macrocode} \def\verbatiminput{\begingroup \ift@bs \def\verbatim@processline{\tabverbatim@processline}% \fi \@ifstar{\verbatim@input{\@maybeobeytabs}}% {\verbatim@input{\frenchspacing\@vobeyspaces\@maybeobeytabs}}} % \end{macrocode} % \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. % \begin{macrocode} \def\verbatim@input#1#2{% \IfFileExists {#2}{\@verbatim #1\relax % \end{macrocode} % Then it reads in the file, finishes off the \texttt{trivlist} % environment started by |\@verbatim| and closes the group. % This restores everything to its normal settings. % \begin{macrocode} \verbatim@readfile{\@filef@und}\endtrivlist\endgroup\@doendpe}% % \end{macrocode} % If the file is not found a more or less helpful message is % printed. The final |\endgroup| is needed to close the group % started in |\verbatiminput| above. % \begin{macrocode} {\typeout {No file #2.}\endgroup}} % \end{macrocode} % \end{macro} % % \textit{That completes my borrowings from \Lpack{verbatim}.} % % The next bunch of code implements wrapping verbatim lines so they, hopefully, % stay within the typeblock. % % \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 % a wrapped line. % \begin{macrocode} \newlength{\verbatimindent} \setlength{\verbatimindent}{3em} \newcommand*{\verbatimbreakchar}{\char`\%} \newcommand*{\setverbatimbreak}{% \vspace*{-\baselineskip}% \def\@xobeysp{~\discretionary{\verbatimbreakchar}{\kern\verbatimindent}{}}% } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\wrappingon} % \begin{macro}{\wrapright} % \begin{macro}{\wrappingoff} % |\wrappingon| and |\wrappingoff| enable/prohibit wrapping. The % default is |\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}{% \def\@xobeysp{~\discretionary{\verbatimbreakchar}{\kern\verbatimindent}{}}% \def\wrapright{\raggedright}% } \newcommand{\wrappingoff}{% \def\@xobeysp{\leavevmode\penalty\@M\ }% \def\wrapright{}% } \wrappingoff % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \subsection{Writing and boxing verbatim} % % This bunch of code is from the \Lpack{moreverb} package. % % \begin{environment}{verbatimoutput} % |\begin{verbatimoutput}|\marg{filename} writes all text in its body to a % file, the name of which it is given as an argument. (The code was % written by Rainer Sch\"opf but the environment was called |verbatimwrite|). % \changes{v1.3}{2002/09/27}{Changed name verbatimwrite to % verbatimoutput (but neither were mentioned in the manual)} % \begin{macrocode} \newwrite \verbatim@out \def\verbatimoutput#1{% \@bsphack \immediate\openout \verbatim@out #1 \let\do\@makeother\dospecials \catcode`\^^M\active %% \catcode`\^^I=12 %% PW with this TABs are written ^^I \def\verbatim@processline{% \immediate\write\verbatim@out {\the\verbatim@line}}% \verbatim@start} % \end{macrocode} % \begin{macrocode} \def\endverbatimoutput{% \immediate\closeout\verbatim@out \@esphack} % \end{macrocode} % \end{environment} % % % % \begin{environment}{fboxverbatim} % \texttt{fboxverbatim} puts the contents of a verbatim environment % in a framing box. (PW: This was originally called |boxedverbatim|). % % (Written by Victor Eijkhout.) % % Bug fix (supplied by David Carlisle) 1995/12/28, marked % \verb+%%%DPC%%%+ % % First, redefine `processline' to produce only a line as wide % as the natural width of the line % % \begin{macrocode} \def\fboxverbatim{\begingroup% \tabsoff %% PW otherwise box fills the width \def\verbatim@processline{% {\setbox0=\hbox{\the\verbatim@line}% \hsize=\wd0 \the\verbatim@line\par}}% % \end{macrocode} % % Now save the verbatim code in a box % % \begin{macrocode} \@minipagetrue%%%DPC%%% \@tempswatrue%%%DPC%%% \setbox0=\vbox\bgroup \verbatim } % \end{macrocode} % % At the end of the environment, we (umm) simply have to stick the % results into a frame. % % \begin{macrocode} \def\endfboxverbatim{% \endverbatim \unskip\setbox0=\lastbox %%%DPC%%% % \end{macrocode} % % Now everything's in the box, so we can close it\dots % % \begin{macrocode} \egroup % \end{macrocode} % % To change the code for centring, the next line needs a spot of % hacking. % % \begin{macrocode} \fbox{\box0}% <<<=== change here for centering,... \endgroup} % \end{macrocode} % \end{environment} % % % % \subsection{The shortvrb package} % % The following is the \Lpack{shortvrb} package code (from |doc.dtx| % by Frank Mittelbach). It has been so useful to me that I wanted % to include it in the class. % % CODE AND COMMENTARY IS BY FRANK MITTELBACH % % \begin{macro}{\MakeShortVerb} % \begin{macrocode} \def\MakeShortVerb#1{% \expandafter\ifx\csname cc\string#1\endcsname\relax % \end{macrocode} % \begin{macrocode} \@shortvrbinfo{Made }{#1}% \add@special{#1}% % \end{macrocode} % Then the character's current catcode is stored in |\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. % \begin{macrocode} \begingroup \catcode`\~\active \lccode`\~`#1% \lowercase{% % \end{macrocode} % The character's old meaning is recorded in |\ac\|\meta{c} prior to % assigning it a new one. % \begin{macrocode} \global\expandafter\let \csname ac\string#1\endcsname~% \gdef~{\verb~}}% \endgroup % \end{macrocode} % Finally the character is made active. % \begin{macrocode} \global\catcode`#1\active % \end{macrocode} % If we suspect that \meta{c} is already a short reference, we tell % the user. Now he or she is responsible if anything goes wrong\,\dots % \begin{macrocode} \else % \end{macrocode} % \begin{macrocode} \@shortvrbinfo\@empty{#1 already}% \fi} % \end{macrocode} % \end{macro} % \begin{macro}{\DeleteShortVerb} % Here's the means of undoing a |\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 % 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 % ignored. % \begin{macrocode} \def\DeleteShortVerb#1{% \expandafter\ifx\csname cc\string#1\endcsname\relax \else % \end{macrocode} % \begin{macrocode} \@shortvrbinfo{Deleted }{#1 as}% \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. % \begin{macrocode} \global \expandafter\let \csname cc\string#1\endcsname \relax \ifnum\catcode`#1=\active \begingroup \catcode`\~\active \lccode`\~`#1% \lowercase{% \global\expandafter\let\expandafter~% \csname ac\string#1\endcsname}% \endgroup \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@shortvrbinfo} % Helper function for info messages. % \begin{macrocode} \def\@shortvrbinfo#1#2{% \PackageInfo{shortvrb}{% #1\expandafter\@gobble\string#2 a short reference for \string\verb}} % \end{macrocode} % \end{macro} % % \begin{macro}{\add@special} % This helper macro adds its argument to the % |\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 % 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 % about repetitions). % \begin{macrocode} \def\add@special#1{% \rem@special{#1}% \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 % characters except braces). % \begin{macrocode} \expandafter\gdef\expandafter\@sanitize\expandafter {\@sanitize \@makeother #1}} % \end{macrocode} % \end{macro} % \begin{macro}{\rem@special} % The inverse of |\add@special| is slightly trickier. |\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|! % \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. % \begin{macrocode} \begingroup \def\@makeother##1{% \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}% \xdef\@sanitize{\@sanitize}% \endgroup} % \end{macrocode} % \end{macro} % % END OF MITTELBACH CODE AND COMMENTARY. % % \subsection{General verbatim boxing and line numbering} % % A while ago I wrote a package that I never released. Here it is % now, updated and improved. The package was based on code originally % posted to CTT by Donald Arseneau on 13 July 2000. % % This is DA's posted code. % \begin{verbatim} % \RequirePackage{verbatim} % \def\boxverbflag{14 } % % \def\boxedverbatim{% % \fboxsep=1em % \def\verbatim@processline{\leavevmode % \vrule\vbox{\advance\hsize-.8p@ \@@line % {\strut\kern\fboxsep\the\verbatim@line\hss}% % \kern\fbozsep}\vrule\par}% % \@verbatim % but make some replacement settings % % \ifdim\@totalleftmargin>\fboxsep \fboxsep\@totalleftmargin \fi % \leftskip\x@skip \rightskip\z@skip % \interlinepenalty\boxverbflag % \parfillskip\z@ plus\p@ minus\p@ % \lineskip-\fboxsep \baselineskip\z@skip % \frenchspacing\@vobeyspaces % \boxverb@toprule % \verbatim@start} % % \def\endboxedverbatim{\hrule\endtrivlist} % % \@namefdef{boxedverbatim*}{\let\frenchspacing\@gobble \boxedverbatim} % \@namefdef{endboxedverbatim*}{\hrule\endtrivlist} % % \output=\expandafter{\expandafter\boxverb@split \the\output} % % \def\boxverb@toprule{\hrule \nobreak \vskip-.1\p@ % \@@line{\vrule height2\fboxsep \hss \vrule}} % % \def\boxverb@split{\ifnum\outputpenalty=\boxverbflag % \ifdim\dp\@cclv=\z@ % \setbox\@cclv\vbox{\unvbox\@cclv\hrule\kern-.4pt}% % \null \kern-.7\topskip \boxverb@toprule % \fi\fi} % \end{verbatim} % That's the end of DA's posted code % % I have extended this to provide: % \begin{itemize} % \item A (multipage) boxed verbatim % \item A (multipage) boxed verbatim input % \item Normally each `page' is boxed, but start/end rules can be switched off % 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 % \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} % \begin{macro}{\bvboxsep} % \begin{macrocode} \def\boxverbflag{14 } \newlength{\bvboxsep} % user can change this \setlength{\bvboxsep}{1em} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macrocode} \newif\ifbvperpage % start/end lines on every page of multipage verbatim \bvperpagetrue % \end{macrocode} % % \begin{macro}{\bvtopofpage} % \begin{macro}{\b@vtop} % Can use |\bvtopofpage| to put a heading above continued verbatims. % For example \\ % |\bvtopofpage{\begin{center}\normalfont (Continued)\end{center}}| \\ % It only works for |\bvperpagetrue|. % \begin{macrocode} \newcommand{\bvtopofpage}[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{macrocode} \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{macrocode} \newif\ifbvcountlines % TRUE to print line numbers of verbatim lines \bvcountlinesfalse % \end{macrocode} % \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. % \begin{macrocode} \def\b@vdocount{\ifbvcountlines\stepcounter{bvlinectr}\fi} \newlength{\bvnumlength} %% \settowidth{\bvnumlength}{\vlvnumfont 9999} \settowidth{\bvnumlength}{\normalfont 999} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\ifbvcountinside} % \begin{macro}{\bvnumbersinside} % \begin{macro}{\bvnumbersoutside} % Flag and commands for positioning the numbers. Default is to print % them inside the box. % \begin{macrocode} \newif\ifbvcountinside % TRUE if line numbers inside box \bvcountinsidetrue \newcommand{\bvnumbersinside}{\bvcountinsidetrue} \newcommand{\bvnumbersoutside}{\bvcountinsidefalse} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\b@vdoinside} % \begin{macro}{\b@vdooutside} % Print numbers inside (outside) the box. % \begin{macrocode} \def\b@vdoinside{% \ifbvcountlines\ifbvcountinside% \makebox[\bvnumlength][r]{\vlvnumfont \theb@vlinenumber\space}% \fi\fi} \def\b@vdooutside{% \ifbvcountlines\ifbvcountinside\else% \llap{\makebox[\bvnumlength][r]{\vlvnumfont \theb@vlinenumber\space}}% \fi\fi} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\setupboxverb@line} % Use a macro for the first main part of DA's code for |\boxedverbatim|, % adding lots of hooks. % \begin{macrocode} \newcommand{\setupboxverb@line}{% \par \ifbvperpage \output=\expandafter{\expandafter\boxverb@split \the\output} \fi % \end{macrocode} % \begin{macro}{\verbatim@processline} % \begin{macrocode} \def\verbatim@processline{\leavevmode \b@vdocount% \bvleftsidehook\vbox{\advance\hsize-.8\p@ \@@line {\b@vdooutside\strut\kern\bvboxsep% \b@vdoinside% \ift@bs \tabverbatim@processline \else \the\verbatim@line \fi \hss}% \kern\bvboxsep}\bvrightsidehook\par}% } % \end{macrocode} % \end{macro} % \end{macro} % % % \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|). % \begin{macrocode} \newcommand{\setupbox@verb}{% \leftskip\z@skip \rightskip\z@skip \interlinepenalty\boxverbflag \parfillskip\z@ plus\p@ minus\p@ \lineskip-\bvboxsep \baselineskip\z@skip \frenchspacing\@vobeyspaces\@maybeobeytabs \boxverb@toprule } % \end{macrocode} % \end{macro} % % \begin{macro}{\boxedverbatim} % Given the two macros above, we can write a briefer version of DA's % |\boxedverbatim(*)| % \begin{macrocode} \def\boxedverbatim{\begingroup \setupboxverb@line \@verbatim \setupbox@verb \verbatim@start } \def\endboxedverbatim{\bvendrulehook\endtrivlist\endgroup} \@namedef{boxedverbatim*}{% \let\frenchspacing\@gobble \boxedverbatim} \@namedef{endboxedverbatim*}{\bvendrulehook\endtrivlist\endgroup} % \end{macrocode} % \end{macro} % % \begin{macrocode} \def\boxverb@toprule{\bvtoprulehook \@@line{\bvleftsidehook \bvtopmidhook \bvrightsidehook}} % \end{macrocode} % % \begin{macro}{\boxverb@split} % \begin{macrocode} \def\boxverb@split{\ifnum\outputpenalty=\boxverbflag \ifdim\dp\@cclv=\z@ \setbox\@cclv\vbox{\unvbox\@cclv\hrule\kern-.4pt}% \null \kern-.7\topskip \b@vtop \boxverb@toprule \fi \fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\bvtoprulehook} % \begin{macro}{\bvendrulehook} % \begin{macro}{\bvleftsidehook} % \begin{macro}{\bvrightsidehook} % \begin{macro}{\bvtopmidhook} % The new hooks, for the top, bottom, left and right of the box. % \begin{macrocode} \def\bvtoprulehook{\hrule \nobreak \vskip-.1\p@} \def\bvendrulehook{\hrule} \def\bvleftsidehook{\vrule} \def\bvrightsidehook{\vrule} \def\bvtopmidhook{\rule{0\p@}{2\bvboxsep} \hss} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\boxedverbatiminput} % \begin{macro}{\boxedverbatim@input} % |\boxedverbatiminput{filename}| read in filename contents as verbatim % \begin{macrocode} \newcommand{\boxedverbatiminput}{\begingroup \@ifstar{\let\frenchspacing\@gobble \boxedverbatim@input\relax}% {\boxedverbatim@input{\frenchspacing\@vobeyspaces}}} % \end{macrocode} % % \begin{macrocode} \def\boxedverbatim@input#1#2{% \setupboxverb@line \IfFileExists {#2}{\@verbatim #1\relax \setupbox@verb \verbatim@readfile{\@filef@und}\bvendrulehook\endtrivlist\endgroup\@doendpe}% {\typeout {No file #2.}\endgroup} } % \end{macrocode} % \end{macro} % \end{macro} % % Some prepackaged boxing styles. % % \begin{macro}{\bvbox} % Original (default) boxing. % \begin{macrocode} \newcommand{\bvbox}{% \bvperpagetrue% \renewcommand{\bvtoprulehook}{\hrule \nobreak \vskip-.1\p@}% \renewcommand{\bvleftsidehook}{\vrule}% \renewcommand{\bvrightsidehook}{\vrule}% \renewcommand{\bvendrulehook}{\hrule}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\nobvbox} % No boxing % \begin{macrocode} \newcommand{\nobvbox}{% \bvperpagefalse% \renewcommand{\bvtoprulehook}{}% \renewcommand{\bvleftsidehook}{}% \renewcommand{\bvrightsidehook}{}% \renewcommand{\bvendrulehook}{}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\bvtopandtail} % Head and foot horizontal lines only % \begin{macrocode} \newcommand{\bvtopandtail}{% \bvperpagefalse% \renewcommand{\bvtoprulehook}{\hrule \nobreak \vskip-.1\p@}% \renewcommand{\bvleftsidehook}{}% \renewcommand{\bvrightsidehook}{}% \renewcommand{\bvendrulehook}{\hrule}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\bvsides} % Side vertical lines only % \begin{macrocode} \newcommand{\bvsides}{% \bvperpagefalse% \renewcommand{\bvtoprulehook}{\vskip 3ex}% \renewcommand{\bvleftsidehook}{\vrule}% \renewcommand{\bvrightsidehook}{\vrule}% \renewcommand{\bvendrulehook}{}% } % \end{macrocode} % \end{macro} % % % % \subsection{The framed package} % % The following code is the \Lpack{framed} package. % % CODE BY DONALD ARSENEAU % % \begin{macrocode} %%%%% framed.sty v 0.3 29-Jul-2001 % Copyright (C) 1992-2001 by Donald Arseneau % These macros may be freely transmitted, reproduced, or modified % provided that this notice is left intact. % % \end{macrocode} % % % 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) % % 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|). % % The contents of the framed regions are restricted: % Floats, footnotes, marginpars and head-line entries will be lost. % (Some of these may be handled in a later version.) % This package will not work with the page breaking of multicol.sty, % or other systems that perform column-balancing. % % PW. I have deleted the original tracing code. % % \begin{macrocode} %%%% \ProvidesPackage{framed}[2001/07/29 v 0.3: framed text with page breaks] % \end{macrocode} % % \begin{environment}{framed} % \begin{macrocode} \newenvironment{framed}% using default \FrameCommand {\fram@d {\advance\hsize-\width}}% {\endfram@d} % \end{macrocode} % \end{environment} % % % \begin{environment}{framed} % \begin{macrocode} \newenvironment{shaded}{% \def\FrameCommand{\colorbox{shadecolor}}% \fram@d {}}% {\endfram@d} % \end{macrocode} % \end{environment} % % \begin{macro}{\fram@d} % \begin{macrocode} \def\fram@d#1{\par \begingroup \skip@\lastskip \penalty\@M % updates \page parameters \ifdim\pagefilstretch=\z@ \ifdim\pagefillstretch=\z@ \if@nobreak\else \vskip-\skip@ \penalty-30 \vskip\skip@ \fi\fi\fi \addvspace{\topsep}% \endgroup % measure added width and height; call result \width and \height \setbox\z@\vbox{\vskip-1in \hbox{\hskip-1in \FrameCommand{\hbox{\vrule \@height 1in \@width 1in}}}\vskip\z@skip}% \def\width{\wd\z@}\def\height{\ht\z@}% \edef\fb@frw{\the\width}\edef\fb@frh{\the\height}% \penalty\@M \vskip 2\baselineskip \vskip\height % clear out pending page break \penalty\@M \vskip -2\baselineskip \vskip-\height \penalty\@M % updates \pagetotal \fb@adjheight \setbox\@tempboxa\vbox\bgroup #1% Modifications to \hsize (can use \width and \height) \textwidth\hsize \columnwidth\hsize \@parboxrestore } % \end{macrocode} % \end{macro} % % \begin{macro}{\endfram@d} % \begin{macrocode} \def\endfram@d{\par \kern\z@ \penalty-100 % put depth into height \egroup \begingroup \put@frame \endgroup } % \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{macrocode} \def\put@frame{\relax \ifdim\pagegoal=\maxdimen \pagegoal\vsize \fi \dimen@\pagegoal \advance\dimen@-\pagetotal % natural space left on page \ifdim\dimen@>2\baselineskip % there's appreciable room left on the page \begingroup \advance\dimen@.8\pageshrink\relax % maximum space available on page \expandafter\endgroup \ifdim\dimen@>\ht\@tempboxa % whole box does fit % \end{macrocode} % Box of size |\the\ht\@tempboxa| fits in |\the\dimen@|. % \begin{macrocode} \else % box must be split % \end{macrocode} % Box of size |\the\ht\@tempboxa| must be split to fit in |\the\dimen@|. % \begin{macrocode} \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}% \boxmaxdepth\z@ \splittopskip\z@ % \end{macrocode} % Box of size |\the\ht\@tempboxa| is split to the |\the\dimen@|. % \begin{macrocode} \setbox\tw@\vsplit\@tempboxa to\dimen@ \setbox\tw@\vbox{\unvbox\tw@}% natural-sized % \end{macrocode} % Natural height of the split box is |\the\ht\tw@|. % If the split-to size |> (\vsize-\topskip)|, then set box to full size % \begin{macrocode} \begingroup \advance\dimen@\topskip \expandafter\endgroup \ifdim\dimen@>\pagegoal % \end{macrocode} % Frame is too big, use up the full column. % \begin{macrocode} \dimen@ii\pagegoal \advance\dimen@ii -\topskip \advance\dimen@ii \FrameHeightAdjust\relax \else \advance\dimen@.8\pageshrink \ifdim\ht\tw@>\dimen@ii % \end{macrocode} % Box too tall; rebox it to |\the\dimen@|. % \begin{macrocode} \dimen@ii\dimen@ \else % use natural size \dimen@ii\ht\tw@ \fi \fi \advance\dimen@ii -\fb@frh \setbox\tw@\vbox to\dimen@ii \bgroup \vskip -\fb@frh \@plus-\pagestretch \@minus-.8\pageshrink \unvbox\tw@ \ifdim\lastkern=-137sp % whole box went to next page % \end{macrocode} % Box split at beginning! % \begin{macrocode} \egroup \eject % (\vskip for frame size was discarded) \fb@adjheight \else % \egroup \ifvoid\@tempboxa % it all fit after all % \end{macrocode} % Box split at end! % \begin{macrocode} \setbox\@tempboxa\box\tw@ \else % it really did split % \end{macrocode} % Box split as expected. Its reboxed height is |\the\ht\tw@|. % \begin{macrocode} \centerline{\FrameCommand{\box\tw@}}% \hrule \@height\z@ \eject \fb@adjheight \put@frame \fi\fi\fi\fi \ifvoid\@tempboxa\else \centerline{\FrameCommand{\box\@tempboxa}}% \nointerlineskip \null \penalty-30 \vskip\topsep \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\fb@adjheight} % \begin{macrocode} \def\fb@adjheight{% \vbox to\FrameHeightAdjust{}% get proper baseline skip from above. \penalty\@M \nointerlineskip \vskip-\FrameHeightAdjust \penalty\@M} % useful for tops of pages % \end{macrocode} % \end{macro} % % \begin{macro}{\FrameCommand} % \begin{macro}{\FrameRule} % \begin{macro}{\FrameSep} % \begin{macrocode} \providecommand\FrameCommand{\fboxrule=\FrameRule \fboxsep=\FrameSep \fbox} \newdimen\FrameRule \FrameRule= \fboxrule \newdimen\FrameSep \FrameSep = 3\fboxsep % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\FrameHeightAdjust} % |\FrameHeightAdjust| is the height of the frame above % the first baseline when |frame| starts a page. % \begin{macrocode} \providecommand\FrameHeightAdjust{6pt} % \end{macrocode} % \end{macro} % % END OF ARSENEAU CODE % % \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|'. % % \begin{macro}{\newoutputstream} % |\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]{% \@ifundefined{#1outstre@m}% {\expandafter\newwrite\csname #1outstre@m\endcsname \csname newif\expandafter\endcsname \csname ifstre@m#1open\endcsname \global\csname stre@m#1openfalse\endcsname \expandafter\ifx\csname atstreamopen#1\endcsname\relax \global\@namedef{atstreamopen#1}{}% \fi \expandafter\ifx\csname atstreamclose#1\endcsname\relax \global\@namedef{atstreamclose#1}{}% \fi }% {\ClassWarning{memoir}{Output stream #1\space is already defined}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\newinputstream} % |\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]{% \@ifundefined{#1instre@m}% {\expandafter\newread\csname #1instre@m\endcsname \csname newif\expandafter\endcsname \csname ifstre@m#1open\endcsname \global\csname stre@m#1openfalse\endcsname \expandafter\ifx\csname atstreamopen#1\endcsname\relax \global\@namedef{atstreamopen#1}{}% \fi \expandafter\ifx\csname atstreamclose#1\endcsname\relax \global\@namedef{atstreamclose#1}{}% \fi }% {\ClassWarning{memoir}{Input stream #1\space is already defined}}} % \end{macrocode} % \end{macro} % % Some checking macros will be useful as some of the checks occur in % multiple places. % % \begin{macro}{\IfStreamOpen} % |\IfStreamOpen|\marg{stream}\marg{TRUE code}\marg{FALSE code} % checks if stream \meta{stream} is currently open. % \begin{macrocode} \newcommand{\IfStreamOpen}[3]{% \csname ifstre@m#1open\endcsname#2\else#3\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\instre@mandopen} % |\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]{% \@ifundefined{#1instre@m}{% \ClassWarning{memoir}{#1\space is not an input stream}}% {\IfStreamOpen{#1}{#2}{% \ClassWarning{memoir}{Input stream #1\space is not open}}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\instre@mandclosed} % |\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} \newcommand{\instre@mandclosed}[2]{% \@ifundefined{#1instre@m}{% \ClassWarning{memoir}{#1\space is not an input stream}}% {\IfStreamOpen{#1}{% \ClassWarning{memoir}{Input stream #1\space is open}}{#2}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\outstre@mandopen} % |\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]{% \@ifundefined{#1outstre@m}{% \ClassWarning{memoir}{#1\space is not an output stream}}% {\IfStreamOpen{#1}{#2}{% \ClassWarning{memoir}{Output stream #1\space is not open}}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\outstre@mandclosed} % |\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} \newcommand{\outstre@mandclosed}[2]{% \@ifundefined{#1outstre@m}{% \ClassWarning{memoir}{#1\space is not an output stream}}% {\IfStreamOpen{#1}{% \ClassWarning{memoir}{Output stream #1\space is open}}{#2}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\openoutputfile} % |\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 % 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]{% \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}% }% } % \end{macrocode} % \end{macro} % % \begin{macro}{\closeoutputstream} % |\closeoutputstream|\marg{stream} closes the stream \meta{stream}. % \begin{macrocode} \newcommand{\closeoutputstream}[1]{% \outstre@mandopen{#1}{% \@nameuse{atstreamclose#1}% \immediate\closeout\@nameuse{#1outstre@m}% \global\csname stre@m#1openfalse\endcsname}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\openinputfile} % |\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 % any given time. % \begin{macrocode} \newcommand{\openinputfile}[2]{% \IfFileExists{#1}{% file exists \instre@mandclosed{#2}{% \@addtofilelist{#1}% \global\@namedef{#1@filename}{#1}% \immediate\openin\@nameuse{#2instre@m}=\@nameuse{#1@filename}% \global\csname stre@m#2opentrue\endcsname% \@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}. % \begin{macrocode} \newcommand{\closeinputstream}[1]{% \instre@mandopen{#1}{% \@nameuse{atstreamclose#1}% \immediate\closein\@nameuse{#1instre@m}% \global\csname stre@m#1openfalse\endcsname}% } % \end{macrocode} % \end{macro} % % \begin{environment}{writeverbatim} % |\begin{writeverbatim}|\marg{stream} writes the contents of % the environment as verbatim text to the given \meta{stream}. % \begin{macrocode} \def\writeverbatim#1{% \@bsphack \let\do\@makeother\dospecials \catcode`\^^M\active \def\verbatim@processline{% \immediate\write\@nameuse{#1outstre@m}{\the\verbatim@line}}% \verbatim@start} \def\endwriteverbatim{\@esphack} % \end{macrocode} % \end{environment} % % \begin{macro}{\addtostream} % |\addtostream|\marg{stream}\marg{text} writes \meta{text} to the % given \meta{stream}. % \begin{macrocode} \newcommand{\addtostream}[2]{% \@bsphack \outstre@mandopen{#1}{% {\let\protect\string \immediate\write\@nameuse{#1outstre@m}{#2}% }}% \@esphack } % \end{macrocode} % \end{macro} % % \begin{macro}{\ifstre@mnoteof} % \begin{macro}{\checkstre@mnoteof} % |\checkstre@mnoteof|\marg{stream} sets |\ifstre@mnoteof| to TRUE if % \meta{stream} is not at the end of the file (i.e., it is the opposite % of |\ifeof|). % \begin{macrocode} \newif\ifstre@mnoteof \newcommand{\checkstre@meof}[1]{% \stre@mnoteoftrue\ifeof\@nameuse{#1instre@m}\stre@mnoteoffalse\fi} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\readstream} % |\readstream|\marg{stream} reads the contents of % the given \meta{stream} as |\input| text. % \begin{macrocode} \def\readstream#1{ \instre@mandopen{#1}{% \loop \checkstre@meof{#1} \ifstre@mnoteof \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. % \begin{macrocode} \def\readaline#1{ \instre@mandopen{#1}{% \ifeof\@nameuse{#1instre@m} \ClassWarning{memoir}{No more to read from stream #1} \else \read\@nameuse{#1instre@m} to\temptokstre@m \temptokstre@m \fi }% } % \end{macrocode} % \end{macro} % % % \begin{macro}{\readverbatim} % |\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| % is a \Lpack{verbatim} package macro. % \begin{macrocode} \def\readverbatim{\begingroup \ift@bs \def\verbatim@processline{\tabverbatim@processline}% \fi \@ifstar{\stre@mverb@input{\@maybeobeytabs}}% {\stre@mverb@input{\frenchspacing\@vobeyspaces\@maybeobeytabs}}} % \end{macrocode} % \end{macro} % % \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| % to be \meta{stream}. % % \begin{macrocode} \newcommand{\stre@mverb@input}[2]{% \IfStreamOpen{#2}% {\@verbatim #1\relax \def\@verbinstre@m{\@nameuse{#2instre@m}} \verb@readstre@m\endtrivlist\endgroup\@doendpe}% {\ClassWarning{memoir}{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|. % \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 } % \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. % \begin{macrocode} \newcommand{\verbatim@read@stre@m}{% \read\@verbinstre@m to\next \ifeof\@verbinstre@m \else \expandafter\verbatim@addtoline\expandafter{\next}% \verbatim@processline \verbatim@startline \expandafter\verbatim@read@stre@m \fi } % \end{macrocode} % \end{macro} % % % \begin{macro}{\readboxedverbatim} % |\readboxedverbatim|\marg{stream} is the equivalent of % |\readverbtim| except that it generates a boxed verbatim. % \begin{macrocode} \newcommand{\readboxedverbatim}{\begingroup \@ifstar{\stre@mbvin\relax}% {\stre@mbvin{\frenchspacing\@vobeyspaces}}} % \end{macrocode} % \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|. % \begin{macrocode} \newcommand{\stre@mbvin}[2]{% \IfStreamOpen{#2}% {\setupboxverb@line \@verbatim #1\relax \def\@verbinstre@m{\@nameuse{#2instre@m}}% \setupbox@verb \verb@readstre@m\bvendrulehook\endtrivlist\endgroup\@doendpe}% {\ClassWarning{memoir}{Stream #2\space is not open}\endgroup}% } % \end{macrocode} % \end{macro} % % % % \section{Utilities} % % % \subsection{Extra `provide' commands} % % \begin{macro}{\provideenvironment} % Works like |\providecommand| but for environments. % \changes{v1.2}{2002/08/04}{Added \cs{provideenvironment} and supports} % \begin{macrocode} \newcommand{\provideenvironment}{\@star@or@long\m@mprovenv} % \end{macrocode} % \end{macro} % % \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 % discard arguments. % \begin{macrocode} \newcommand{\m@mprovenv}[1]{\@ifundefined{#1}% {\new@environment{#1}}% % create new environment {\ClassWarning{memoir}{Environment `#1' already defined}% \m@mgobbleoptsandtwo}} % \end{macrocode} % \end{macro} % % % \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 % 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 % discard any number of optionals, then two required ones. % % |\m@mgobbleoptandtwo| recursively discards optional arguments, then finally % two required arguments. % \begin{macrocode} \newcommand{\m@mgobbleoptsandtwo}{% \@ifnextchar [{\m@mgobbleoptandtwo}{\@gobbletwo}} \def\m@mgobbleoptandtwo[#1]{% \@ifnextchar [{\m@mgobbleoptandtwo}{\@gobbletwo}} % \end{macrocode} % \end{macro} % \end{macro} % % % % % \begin{macro}{\providecounter} % Works like the other |\provide...| commands, but for counters. % Code is based on |\newcounter| in |ltcounts.dtx|. % \changes{v1.2}{2002/07/17}{Added \cs{providecounter}} % \begin{macrocode} \newcommand*{\providecounter}[1]{% \@ifundefined{c@#1}% {\newcounter{#1}}% {\ClassWarning{memoir}{Counter `#1' already defined}% \@ifnextchar[{\m@mgobbleopt}{}}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\m@mgobbleopt} % Gobble an optional argument. % \changes{v1.2}{2002/07/07}{Added \cs{m@mgobbleopt}} % \begin{macrocode} \def\m@mgobbleopt[#1]{} % \end{macrocode} % \end{macro} % % \begin{macro}{\providelength} % Works like the other |\provide...| commands, but for lengths. % Code is based on |\provide@command| in |ltdefns.dtx|. % \changes{v1.2}{2002/07/17}{Added \cs{providelength}} % \begin{macrocode} \newcommand*{\providelength}[1]{% \begingroup \escapechar\m@ne\xdef\@gtempa{{\string#1}}% \endgroup \expandafter\@ifundefined\@gtempa {\newlength{#1}}% {\ClassWarning{memoir}{Length #1 already defined}}% } % \end{macrocode} % \end{macro} % % \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 % 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 % 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 % specified in the remreset package~\cite{REMRESET}. % It is provided here as a convenience to the user, and with % David Carlisle's permission. % % START OF DAVID CARLISLE'S CODE % \begin{macrocode} \providecommand{\@removefromreset}[2]{{% \expandafter\let\csname c@#1\endcsname\@removefromreset \def\@elt##1{% \expandafter\ifx\csname c@##1\endcsname\@removefromreset \else \noexpand\@elt{##1}% \fi}% \expandafter\xdef\csname cl@#2\endcsname{% \csname cl@#2\endcsname}}} % \end{macrocode} % END OF DAVID CARLISLE'S CODE % \end{macro} % % \begin{macro}{\@ifbothcntrs} % This is called as \\ % |\@ifbothcntrs{|\meta{cntr}|}{|\meta{within}|}{}|. % This tests if both \meta{cntr} and \meta{within} are counters. % \begin{macrocode} \newcommand{\@ifbothcntrs}[3]{% \@ifundefined{c@#1}{% counter undefined \ClassError{memoir}{#1 is not a counter}{\@eha}}% {% else counter is defined \@ifundefined{c@#2}{% within undefined \ClassError{memoir}{#2 is not a counter}{\@eha}}% {% else both counter and within are defined #3}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\counterwithin} % \begin{macro}{\counterwithin*} % \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|. % % \begin{macrocode} \newcommand{\counterwithin}{\@ifstar{\@csinstar}{\@csin}} \newcommand{\@csinstar}[2]{% \@ifbothcntrs{#1}{#2}{\@addtoreset{#1}{#2}}} \newcommand{\@csin}[2]{% \@ifbothcntrs{#1}{#2}{\@addtoreset{#1}{#2}% \@namedef{the#1}{\@nameuse{the#2}.\arabic{#1}}}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\counterwithout} % \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 % numeral. The starred version of the command suppresses the redefinition % of |\thectr|. % % \begin{macrocode} \newcommand{\counterwithout}{\@ifstar{\@csoutstar}{\@csout}} \newcommand{\@csoutstar}[2]{% \@ifbothcntrs{chngcntr}{#1}{#2}{\@removefromreset{#1}{#2}}} \newcommand{\@csout}[2]{% \@ifbothcntrs{#1}{#2}{\@removefromreset{#1}{#2}% \@namedef{the#1}{\arabic{#1}}}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % Any number of |\counterwithin{ctr}{...}| and |\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}{...}|. % % \subsection{Odd/even page checking} % % It is difficult to check robustly if the current page is odd or even. % This code, which is based on the \Lpack{chngpage} package~\cite{CHNGPAGE}, % provides a method that has proved (so far) to be robust. % It works by writing out a label and on the next LaTeX run checks % the page reference for the label. % % \begin{macro}{\ifoddpage} % \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{macrocode} \newif\ifoddpage \newif\ifstrictpagecheck \strictpagecheckfalse \newcounter{cp@cntr} \newcommand{\cplabel}{^_} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\cpset@ref} % \begin{macro}{\cpp@geref} % We need to be able to handle a particular label not (yet) being in % the \file{.aux} file when we come to check the |\pageref| number. % \begin{macrocode} \newcommand{\cpset@ref}[3]{% \ifx#1\relax 0% in case no label in the *.aux file (page number made = 0) \else \expandafter#2#1% \fi} \newcommand{\cpp@geref}[1]{% \expandafter\cpset@ref\csname r@#1\endcsname\@secondoftwo{#1}} % \end{macrocode} % The \Lpack{hyperref} package screws around with most of the % LaTeX internals, so special code is needed if the package is % loaded. % \begin{macrocode} \AtBeginDocument{% % special code if hyperrref package is used \@ifpackageloaded{hyperref}{% \renewcommand{\cpp@geref}[1]{% \expandafter\ifx\csname r@#1\endcsname\relax 0% % zero \else \expandafter\expandafter\expandafter\expandafter \expandafter\expandafter\expandafter\@car \expandafter\expandafter\expandafter\@gobble \csname r@#1\endcsname\@nil \fi}}{}} % \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 % it sets it to FALSE. % \begin{macrocode} \DeclareRobustCommand{\checkoddpage}{% \oddpagefalse% \ifstrictpagecheck \stepcounter{cp@cntr}\label{\cplabel\thecp@cntr}% \@memcnta=\cpp@geref{\cplabel\thecp@cntr} % must have a space here \ifodd\@memcnta\oddpagetrue\fi \else \ifodd\c@page\oddpagetrue\fi \fi } % \end{macrocode} % \end{macro} % % \subsection{Checking for empty arguments} % % Like page checking, testing for an empty macro argument is more % difficult than it might appear at first sight. % % The following code is from the \Lpack{ifmtarg} package~\cite{IFMTARG}. % % \begin{macro}{\@ifmtarg} % \begin{macro}{\@ifnotmtarg} % |\@ifmtarg{|\meta{arg}|}{}{}| \\ % |\@ifnotmtarg{|\meta{arg}|}{}| \\ % \begin{macrocode} \begingroup \catcode`\Q=3 \long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil} \long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4} \long\gdef\@ifnotmtarg#1{\@xifmtarg#1QQ\@firstofone\@gobble\@nil} \endgroup % \end{macrocode} % \end{macro} % \end{macro} % % Some example uses: % \begin{verbatim} % \newcommand{\isempty}[1]{% % \@ifmtarg{#1}{\typeout{YES}}{\typeout{NO}}} % \newcommand{\isnotempty}[1]{% % \@ifnotmtarg{#1}{\typeout{YES}}} % % \isempty{} -> YES \isnotempty{} -> % \isempty{ } -> YES \isnotempty{ } -> % \isempty{A} -> NO \isnotempty{A} -> YES % \isempty{ A } -> NO \isnotempty{ A } -> YES % \end{verbatim} % % % \subsection{Changing the page layout in the document} % % You should not do this, but\ldots % % The following code is essentially from the \Lpack{chngpage} % package~\cite{CHNGPAGE}. % % \begin{macro}{\ch@ngetext} % This macro sets the page output parameters. % \begin{macrocode} \DeclareRobustCommand{\ch@ngetext}{% \setlength{\@colht}{\textheight}\setlength{\@colroom}{\textheight}% \setlength{\vsize}{\textheight}\setlength{\columnwidth}{\textwidth}% \if@twocolumn% \advance\columnwidth-\columnsep \divide\columnwidth\tw@% \@firstcolumntrue% \fi% \setlength{\hsize}{\columnwidth}% \setlength{\linewidth}{\hsize}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\changetext} % |\changetext{|\meta{H}|}{|\meta{W}|}{|\meta{E}|}{|\meta{O}|}{|\meta{G}|}| % adds the given lengths to 5 main bits of the page layout. An empty % argument means `no change'. % \begin{macrocode} \DeclareRobustCommand{\changetext}[5]{% \@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% } % \end{macrocode} % \end{macro} % % Any given change lasts until another |\changetext| command is given. % A |\changetext| command should only be issued between two paragraphs. % % |\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. % % \subsection{Temporarily changing the text width} % % % \begin{environment}{adjustwidth} % \begin{environment}{adjustwidth*} % |\begin{adjustwidth}{|\meta{left}|}{|\meta{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 % margin changes to switch between odd and even pages. % % This code is based on the \Lpack{chngpage} package. % \changes{v0.2}{2001/06/03}{Replaced optional arg of adjustwidth by adjustwidth*} % \begin{macrocode} \newenvironment{adjustwidth}[2]{% \begin{list}{}{% \topsep\z@% \listparindent\parindent% \parsep\parskip% \@ifmtarg{#1}{\setlength{\leftmargin}{\z@}}{\setlength{\leftmargin}{#1}}% \@ifmtarg{#2}{\setlength{\rightmargin}{\z@}}{\setlength{\rightmargin}{#2}}% } \item[]}{\end{list}} % \end{macrocode} % % \begin{macrocode} \newenvironment{adjustwidth*}[2]{% \begin{list}{}{% \topsep\z@% \listparindent\parindent% \parsep\parskip% \checkoddpage \ifoddpage % odd numbered page \@ifmtarg{#1}{\setlength{\leftmargin}{\z@}}{\setlength{\leftmargin}{#1}}% \@ifmtarg{#2}{\setlength{\rightmargin}{\z@}}{\setlength{\rightmargin}{#2}}% \else % even numbered page \@ifmtarg{#2}{\setlength{\leftmargin}{\z@}}{\setlength{\leftmargin}{#2}}% \@ifmtarg{#1}{\setlength{\rightmargin}{\z@}}{\setlength{\rightmargin}{#1}}% \fi } \item[]}{\end{list}} % \end{macrocode} % \end{environment} % \end{environment} % % The environments only work for complete paragraphs. % % \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| % to the required value. Then use as \\ % |\begin{adjustwidth*}{\length}{-\length}...| % \begin{macrocode} \newcommand{\calccentering}[1]{ #1 = \paperwidth \advance #1 by -\textwidth \divide #1 by \tw@ \advance #1 by -\spinemargin } % \end{macrocode} % \end{macro} % % % \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|. % % \begin{macro}{\cleartoevenpage} % |\cleartoevenpage[|\meta{text}|}| clears to the next even % numbered page, % putting the optional \meta{text} on the skipped page, if any. % \begin{macrocode} \newcommand{\cleartoevenpage}[1][\@empty]{% \clearpage% \ifodd\c@page\hbox{}#1\clearpage\fi} % \end{macrocode} % \end{macro} % % Move to the next page without flushing floats is |\newpage|. % % \begin{macro}{\movetoevenpage} % |\movetoevenpage[|\meta{text}|}| moves to the next even % numbered page without flushing floats, % putting the optional \meta{text} on the skipped page, if any. % \begin{macrocode} \newcommand{\movetoevenpage}[1][\@empty]{% \newpage% \ifodd\c@page\hbox{}#1\newpage\fi} % \end{macrocode} % \end{macro} % % Clear to next odd numbered page is |\cleardoublepage|. % % \begin{macro}{\cleartooddpage} % |\cleartooddpage[|\meta{text}|}| clears to the next odd % numbered page, % putting the optional \meta{text} on the skipped page, if any. % \begin{macrocode} \newcommand{\cleartooddpage}[1][\@empty]{% \clearpage% \ifodd\c@page\else\hbox{}#1\clearpage\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\movetooddpage} % |\movetooddpage[|\meta{text}|}| moves to the next odd % numbered page without flushing floats, % putting the optional \meta{text} on the skipped page, if any. % \begin{macrocode} \newcommand{\movetooddpage}[1][\@empty]{% \newpage% \ifodd\c@page\else\hbox{}#1\newpage\fi} % \end{macrocode} % \end{macro} % % Example uses: \\ % \begin{verbatim} % \cleartooddpage % same as \cleardouble page % \cleartooddpage[\thispagestyle{empty}] % No headings on the skipped page % \cleartoevenpage % go to next even numbered page % Next example puts text on a skipped page % \cleartoevenpage[\vspace*{\hfill}THIS PAGE LEFT BLANK\vspace*{\hfill}] % \end{verbatim} % % % % \subsection{Needing space at the bottom of a page} % % \begin{macro}{\needspace} % |\needspace{|\meta{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 from the \Lpack{needspace} package~\cite{NEEDSPACE}. % \begin{macrocode} \newcommand{\needspace}[1]{% \vskip \z@ \@plus #1\pagebreak[3]\vskip \z@ \@plus -#1\relax} % \end{macrocode} % \end{macro} % % \subsection{Numbers to names} % % The macros here convert an integer number in the range 1--99 into % the natural language name of the number. % % \begin{macro}{\iflowernumtoname} % A flag for lowercasing the initial letters. % \begin{macrocode} \newif\iflowernumtoname \lowernumtonamefalse % \end{macrocode} % \end{macro} % % \begin{macro}{\numtoname} % Integers to lowercased names. % \begin{macrocode} \newcommand{\numtoname}[1]{% \lowernumtonametrue% \numtoName{#1}% \lowernumtonamefalse} % \end{macrocode} % \end{macro} % % \begin{macro}{\numtoName} % Integers to names with first letter uppercase, in the range 1--99. % \begin{macrocode} \newcommand{\numtoName}[1]{% \ifnum #1<\@ne \else \ifnum #1<20\relax \ifcase #1\relax \or\nNamei\or\nNameii\or\nNameiii\or\nNameiv\or\nNamev\or \nNamevi\or\nNamevii\or\nNameviii\or\nNameix\or\nNamex\or \nNamexi\or\nNamexii\or\nNamexiii\or\nNamexiv\or\nNamexv\or \nNamexvi\or\nNamexvii\or\nNamexviii\or\nNamexix\fi \else \tenstoName{#1}% % must have the first comment char \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\tenstoName} % Integers to names in the range 20--99. % \begin{macrocode} \newcommand{\tenstoName}[1]{% \@tempcnta=#1\relax \@tempcntb=\m@ne \divide\@tempcnta by 10 \ifcase\@tempcnta\or\or \nNamexx% \@tempcntb=#1\relax\advance\@tempcntb -20\relax\or \nNamexxx% \@tempcntb=#1\relax\advance\@tempcntb -30\relax\or \nNamexl% \@tempcntb=#1\relax\advance\@tempcntb -40\relax\or \nNamel% \@tempcntb=#1\relax\advance\@tempcntb -50\relax\or \nNamelx% \@tempcntb=#1\relax\advance\@tempcntb -60\relax\or \nNamelxx% \@tempcntb=#1\relax\advance\@tempcntb -70\relax\or \nNamelxxx% \@tempcntb=#1\relax\advance\@tempcntb -80\relax\or \nNamexc% \@tempcntb=#1\relax\advance\@tempcntb -90\relax\else \nNamec% \fi% \ifnum\@tempcntb>\z@ \space \numtoName{\@tempcntb}% \fi} % \end{macrocode} % \end{macro} % % % \subsection{A fix for two column headings} % % % 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 % is printed lower on the page than for two-column chapters' % % DA and I had previously discussed this in relation to the Index % and I had put a hack into the \Lpack{tocbibind} package to fix the Index. % % 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 % 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} % \begin{macrocode} \long\def \@topnewpage [#1]{% \@nodocument \@next\@currbox\@freelist{}{}% \global \setbox\@currbox \vbox {% \break \prevdepth\z@ \begingroup \normalcolor \hsize\textwidth \@parboxrestore \col@number \@ne #1% \vskip -\dbltextfloatsep \endgroup \null % ordinary \baselineskip \vskip -\topskip }% \begingroup %% \showbox\@currbox \splitmaxdepth\maxdepth \splittopskip\topskip \setbox\@tempboxa \vsplit\@currbox to \z@ \endgroup %% \showbox\@currbox \ifdim \ht\@currbox>\textheight \ht\@currbox \textheight \fi \global \count\@currbox \tw@ \@tempdima -\ht\@currbox \advance \@tempdima -\dbltextfloatsep \global \advance \@colht \@tempdima \ifx \@dbltoplist \@empty \else \@latexerr{Float(s) lost}\@ehb \let \@dbltoplist \@empty \fi \@cons \@dbltoplist \@currbox \global \@dbltopnum \m@ne \ifdim \@colht<2.5\baselineskip \@latex@warning@no@line {Optional argument of \noexpand\twocolumn too tall on page \thepage}% \@emptycol \if@firstcolumn \else \@emptycol \fi \else \global \vsize \@colht \global \@colroom \@colht \@floatplacement \fi } % \end{macrocode} % \end{macro} % % The original version of |\@topnewpage| is in \file{ltouput.dtx}, line 159. % % % \section{Experimental code} % % Code in this section is probably unstable and possibly may disappear % altogether. % % \subsection{Sidebars} % % \changes{v1.1}{2002/03/19}{Added experimental code for sidebars} % % On 2002/10/22 Donald Arseneau posted the following code to ctt for adding % sidebars to plain TeX. % \begin{verbatim} % \newinsert\sideins % \skip\sideins=0pt % \count\sideins=0 % \dimen\sideins=2in % % \def\sidebarvsep{25pt} % \def\sidebarhsep{15pt} % % \let\mainpagecontents\pagecontents % % \def\sidecontents{% % \ifvoid\sideins\else % {\advance\hsize\sidebarhsep % \moveright\hsize \vtop to0pt{% % \vskip-\sidebarvsep \vskip\topskip % offset by difference % \unvbox\sideins \vss}% % }\fi} % \def\pagecontents{\sidecontents\mainpagecontents} % \long\def\sidebar#1{ % \insert\sideins{% % \splittopskip\sidebarvsep\relax % \hsize 1.5in \rightskip=0pt plus 20pt \it % \noindent \vbox to \sidebarvsep{}\ignorespaces #1% % \ifhmode \unskip\strut\fi \par % }% % } % % \end{verbatim} % % The following is my attempt to rewrite the above into a form suitable % for LaTeX, and this class in particular. % % \begin{macro}{\sideins} % Create a new insert called |\sideins|, which also creates a corresponding % skip, count, dimen, and box. \\ % |\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. % \begin{macrocode} \newinsert\sideins \skip\sideins=0pt \count\sideins=0 % \end{macrocode} % \end{macro} % % \begin{macro}{\setsidebarheight} % The macro |\setsidebarheight{|\meta{length}|}| sets the total % height of sidebars on a page to \meta{length}. % \begin{macrocode} \newcommand{\setsidebarheight}[1]{\dimen\sideins= #1} \setsidebarheight{20\onelineskip} % \end{macrocode} % \end{macro} % % \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 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|. % \begin{macrocode} \newlength{\sidebarhsep} \setlength{\sidebarhsep}{\marginparsep} \newlength{\sidebarvsep} \setlength{\sidebarvsep}{2\onelineskip} \newlength{\sidebarwidth} \setlength{\sidebarwidth}{\marginparwidth} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\sidebarfont} % The font for typesetting the contents of a sidebar. % \begin{macrocode} \newcommand{\sidebarfont}{\normalfont} % \end{macrocode} % \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| % is called, otherwise it is put in the outer (foredge) margin. % \begin{macrocode} \newcommand{\sidecontents}{ {\if@twocolumn %% put outside nearest column \if@firstcolumn %% move to left \setlength{\@tempdimc}{\sidebarwidth}% \advance\@tempdimc\sidebarhsep \moveleft\@tempdimc \else %% move to right \setlength{\@tempdimc}{\columnwidth} \advance\@tempdimc\sidebarhsep \moveright\@tempdimc \fi \else %% put into foremargin \ifodd\c@page %% move to right \setlength{\@tempdimc}{\hsize}% \advance\@tempdimc\sidebarhsep \moveright\@tempdimc \else %% move to left \setlength{\@tempdimc}{\sidebarwidth}% \advance\@tempdimc\sidebarhsep \moveleft\@tempdimc \fi \fi \vtop to0pt{% \vskip\onelineskip \unvbox\sideins \vss}% } } % \end{macrocode} % \end{macro} % % \begin{macro}{\sidebar} % |\sidebar{|\meta{text}|}| puts \meta{text} into a sidebar. % \begin{macrocode} \newcommand{\sidebar}[1]{%%%%\textbf{[sidebar]}% \insert\sideins{% \splittopskip\sidebarvsep\relax \hsize \sidebarwidth \rightskip=0pt plus 20pt \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{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 } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\memold@doclearpage} % \begin{macro}{\mem@doclearpage} % At the moment this is a straight copy of the kernel |\@doclearpage|. % \begin{macrocode} \let\memold@doclearpage\@doclearpage \newcommand{\mem@doclearpage}{% %%%% \typeout{Redefining @doclearpage} \ifvoid\footins \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} % \end{macro} % \end{macro} % % \begin{macro}{\memold@reinserts} % \begin{macro}{\mem@reinserts} % Almost a copy of the kernel |\@reinserts|. % \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 } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@makecol} % Replace the kernel version of |\@makecol| with the memoir version. % \begin{macrocode} \gdef\@makecol{\mem@makecol} % \end{macrocode} % \end{macro} % % I think that the original kernel versions of |\@reinserts| and % |\@doclearpage| might be alright, but you never know. If they are % not, then we can treat them like |\@makecol|. % % % % \section{Initialization} \label{sec:init} % % \subsection{Words and phrases} % % This document class is for documents prepared in the English language. % To prepare a version for another language, various English words % and phrases must % be replaced. The English elements that require replacement are % defined below in command names. % % \begin{macro}{\abstractname} % \begin{macro}{\contentsname} % \begin{macro}{\listfigurename} % \begin{macro}{\listtablename} % \begin{macro}{\partname} % \begin{macro}{\chaptername} % \begin{macro}{\appendixname} % \begin{macro}{\appendixtocname} % \begin{macro}{\appendixpagename} % \begin{macro}{\bibname} % \begin{macro}{\indexname} % % This list is for titles of document sections. % % \begin{macrocode} \newcommand{\abstractname}{Abstract} \newcommand{\contentsname}{Contents} \newcommand{\listfigurename}{List of Figures} \newcommand{\listtablename}{List of Tables} \newcommand{\partname}{Part} \newcommand{\chaptername}{Chapter} \newcommand{\appendixname}{Appendix} \newcommand{\appendixtocname}{Appendices} \newcommand{\appendixpagename}{Appendices} \newcommand{\bibname}{Bibliography} \newcommand{\indexname}{Index} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\figurename} % \begin{macro}{\tablename} % \begin{macro}{\figurerefname} % \begin{macro}{\tablerefname} % \begin{macro}{\pagename} % \begin{macro}{\pagrefename} % % These are the names and phrases used for general elements. % % \begin{macrocode} \newcommand{\figurename}{Figure} \newcommand{\tablename}{Table} \newcommand{\figurerefname}{Figure} \newcommand{\tablerefname}{Table} \newcommand{\pagename}{page} \newcommand{\pagerefname}{page} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\partrefname} % \begin{macro}{\chapterrefname} % \begin{macro}{\sectionrefname} % More names for referencing. % \changes{v1.2}{2002/07/27}{Added \cs{partrefname}, \cs{chapterrefname} % and \cs{sectionrefname}} % \begin{macrocode} \newcommand{\partrefname}{Part~} \newcommand{\chapterrefname}{Chapter~} \newcommand{\sectionrefname}{\S} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\nNamei} % \begin{macro}{\nNameii} % \begin{macro}{\nNameiii} % \begin{macro}{\nNameiv} % \begin{macro}{\nNamev} % These are the names for numbers 1 to 5. % \begin{macrocode} \newcommand*\nNamei{\iflowernumtoname o\else O\fi ne} \newcommand*\nNameii{\iflowernumtoname t\else T\fi wo} \newcommand*\nNameiii{\iflowernumtoname t\else T\fi hree} \newcommand*\nNameiv{\iflowernumtoname f\else F\fi our} \newcommand*\nNamev{\iflowernumtoname f\else F\fi ive} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\nNamevi} % \begin{macro}{\nNamevii} % \begin{macro}{\nNameviii} % \begin{macro}{\nNameix} % \begin{macro}{\nNamex} % These are the names for numbers 6 to 10. % \begin{macrocode} \newcommand*\nNamevi{\iflowernumtoname s\else S\fi ix} \newcommand*\nNamevii{\iflowernumtoname s\else S\fi even} \newcommand*\nNameviii{\iflowernumtoname e\else E\fi ight} \newcommand*\nNameix{\iflowernumtoname n\else N\fi ine} \newcommand*\nNamex{\iflowernumtoname t\else T\fi en} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\nNamexi} % \begin{macro}{\nNamexii} % \begin{macro}{\nNamexiii} % \begin{macro}{\nNamexiv} % \begin{macro}{\nNamexv} % These are the names for numbers 11 to 15. % \begin{macrocode} \newcommand*\nNamexi{\iflowernumtoname e\else E\fi leven} \newcommand*\nNamexii{\iflowernumtoname t\else T\fi welve} \newcommand*\nNamexiii{\iflowernumtoname t\else T\fi hirteen} \newcommand*\nNamexiv{\iflowernumtoname f\else F\fi ourteen} \newcommand*\nNamexv{\iflowernumtoname f\else F\fi ifteen} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\nNamexvi} % \begin{macro}{\nNamexvii} % \begin{macro}{\nNamexviii} % \begin{macro}{\nNamexix} % \begin{macro}{\nNamexx} % These are the names for numbers 16 to 20. % \begin{macrocode} \newcommand*\nNamexvi{\iflowernumtoname s\else S\fi ixteen} \newcommand*\nNamexvii{\iflowernumtoname s\else S\fi eventeen} \newcommand*\nNamexviii{\iflowernumtoname e\else E\fi ighteen} \newcommand*\nNamexix{\iflowernumtoname n\else N\fi ineteen} \newcommand*\nNamexx{\iflowernumtoname t\else T\fi wenty} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\nNamexxx} % \begin{macro}{\nNamexl} % \begin{macro}{\nNamel} % \begin{macro}{\nNamelx} % \begin{macro}{\nNamelxx} % These are the names for numbers 30 to 70. % \begin{macrocode} \newcommand*\nNamexxx{\iflowernumtoname t\else T\fi hirty} \newcommand*\nNamexl{\iflowernumtoname f\else F\fi orty} \newcommand*\nNamel{\iflowernumtoname f\else F\fi ifty} \newcommand*\nNamelx{\iflowernumtoname s\else S\fi ixty} \newcommand*\nNamelxx{\iflowernumtoname s\else S\fi eventy} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\nNamelxxx} % \begin{macro}{\nNamexc} % \begin{macro}{\nNamec} % These are the names for numbers 80 to 100. % \begin{macrocode} \newcommand*\nNamelxxx{\iflowernumtoname e\else E\fi ighty} \newcommand*\nNamexc{\iflowernumtoname n\else N\fi inety} \newcommand*\nNamec{\iflowernumtoname h\else H\fi undred or more} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % % \subsection{Date} % % \begin{macro}{\today} % This macro uses the \TeX\ primitives |\month|, |\day| and |\year| % to provide the date of the \LaTeX-run. % \begin{macrocode} \newcommand{\today}{\ifcase\month\or January\or February\or March\or April\or May\or June\or July\or August\or September\or October\or November\or December\fi \space\number\day, \number\year} % \end{macrocode} % \end{macro} % % \subsection{Two column mode} % % \begin{macro}{\columnsep} % This gives the distance between two columns in two column mode. % \begin{macrocode} \setlength\columnsep{10\p@} % \end{macrocode} % \end{macro} % % \begin{macro}{\columnseprule} % This gives the width of the rule between two columns in two % column mode. We have no visible rule. % \begin{macrocode} \setlength\columnseprule{0\p@} % \end{macrocode} % \end{macro} % % \subsection{The page style and counters} % We use the page style \pstyle{headings} by % default and arabic page numbering. % \begin{macrocode} \pagestyle{headings} \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 % the same. % \changes{v1.1a}{2002/04/28}{Added initialisation of \cs{maxsecnumdepth}} % \begin{macrocode} \setcounter{part}{0} \setcounter{chapter}{0} \setcounter{tocdepth}{1} \setcounter{secnumdepth}{2} \maxsecnumdepth{section} % \end{macrocode} % % Set the |\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} \linenumberfrequency{0} \linenumberfont{\small\rmfamily} \settowidth{\bvnumlength}{\vlvnumfont 9999} % \end{macrocode} % % % \subsection{Single or double sided printing} % % % Unless the \Lopt{twoside} wasn't specified, We do not try to make % each page of equal height. % \begin{macrocode} \if@twoside \else \raggedbottom \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. % \begin{macrocode} \if@twocolumn \twocolumn \sloppy \flushbottom % \end{macrocode} % Normally we call |\onecolumn| to initiate typesetting in one % column. % \begin{macrocode} \else \onecolumn \fi % \end{macrocode} % % \subsection{Floats} % % \subsubsection{Figure and Table environments and lists} % % Here are the implementations of the figure and table environments % and their accompanying List of\ldots % % \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. % In this class figures are numbered per chapter, but we need to change % the default definition of |\thefigure| if a figure % is in a pre-numbered chapter. % \changes{v1.3a}{2002/11/22}{Added \cs{kill@lastcounter} after new % figure float} % \begin{macrocode} \newfloat[chapter]{figure}{lof}{\figurename} \kill@lastcounter{lofdepth} \renewcommand{\thefigure}{\thechapter.\@arabic\c@figure} % \end{macrocode} % \end{environment} % \end{environment} % % \begin{macro}{\listoffigures} % \begin{macro}{\listoffigures*} % These macros request that LaTeX produces a list of figures. % The LoF heading is added to the ToC unless the starred % version is used. % \changes{v1.3}{2002/11/14}{Added \cs{kill@lastcounter} after new % list of figures} % \begin{macrocode} \newlistof{listoffigures}{lof}{\listfigurename} \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. % \changes{v1.3a}{2002/11/22}{Deleted \cs{kill@lastcounter} after new % figure listentry} % \begin{macrocode} \newlistentry[chapter]{figure}{lof}{0} \cftsetindents{figure}{0em}{2.3em} %% \kill@lastcounter{lofdepth} % \end{macrocode} % \end{macro} % % % \begin{environment}{table} % \begin{environment}{table*} % The definition for tables is almost identical. % \changes{v1.3a}{2002/11/22}{Added \cs{kill@lastcounter} after new % table float} % \begin{macrocode} \newfloat[chapter]{table}{lot}{\tablename} \kill@lastcounter{lotdepth} \renewcommand{\thetable}{\thechapter.\@arabic\c@table} % \end{macrocode} % \end{environment} % \end{environment} % % \begin{macro}{\listoftables} % \begin{macro}{\listoftables*} % These macros request that LaTeX produces a list of tables. % The LoT heading is added to the ToC unless the starred % version is used. % \changes{v1.3}{2002/11/14}{Added \cs{kill@lastcounter} after new % list of tables} % \begin{macrocode} \newlistof{listoftables}{lot}{\listtablename} \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. % \changes{v1.3a}{2002/11/22}{Deleted \cs{kill@lastcounter} after new % table listentry} % \begin{macrocode} \newlistentry[chapter]{table}{lot}{0} \cftsetindents{table}{0em}{2.3em} %% \kill@lastcounter{lotdepth} % \end{macrocode} % \end{macro} % % The \Lpack{subfigure} package defines |lofdepth| and |lotdepth| % counters. If is not used, then we have to define them. % \begin{macrocode} \AtBeginDocument{% \@ifundefined{c@lofdepth}{\newcounter{lofdepth}\setcounter{lofdepth}{1}}{} \@ifundefined{c@lotdepth}{\newcounter{lotdepth}\setcounter{lotdepth}{1}}{} } % \end{macrocode} % % \subsection{The \Lopt{article} option} % % The \Lopt{article} option requires changes to the default chapterstyle, % and the numbering of floats, etc. % \changes{v1.0a}{2001/12/07}{Added footnote and chaptername changes to the article option} % \begin{macrocode} \ifartopt \chapterstyle{article} \counterwithout{figure}{chapter} \counterwithout{table}{chapter} \counterwithout{footnote}{chapter} \renewcommand{\chaptername}{} \fi % \end{macrocode} % % % \subsection{The \Lopt{ms} option} % % This should be done last as it makes various changes to the defaults. % % \begin{macro}{\msdoublespacing} % \begin{macro}{\mssinglespacing} % These do nothing unless the \Lopt{ms} option is used; then they change % the |\baselinestretch|. % \begin{macrocode} \newcommand{\msdoublespacing}{} \newcommand{\mssinglespacing}{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macrocode} \ifmsdoc \renewcommand{\msdoublespacing}{% \renewcommand{\baselinestretch}{1.6}\large\normalsize} \renewcommand{\mssinglespacing}{% \renewcommand{\baselinestretch}{1.0}\large\normalsize} \renewcommand{\familydefault}{cmtt} \renewcommand{\rmdefault}{cmtt} \renewcommand{\sfdefault}{cmtt} \renewcommand{\bfdefault}{m} \renewcommand{\itdefault}{n} \renewcommand{\sldefault}{n} \renewcommand{\scdefault}{n} \renewcommand{\baselinestretch}{1.6} \@twocolumnfalse \onecolumn \sloppy \@twosidefalse \raggedbottom \pagestyle{plain} \fi % \end{macrocode} % % \subsection{Use with the \Lpack{natbib} package} % % The \Lpack{natbib} package~\cite{NATBIB} uses its own definition for % the |\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. % % \changes{v1.1}{2002/03/10}{Added internal support for the natbib package} % \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|. % \begin{macrocode} \AtBeginDocument{% \@ifpackageloaded{natbib}{% natbib is loaded \renewcommand{\bibsection}{% \chapter*{\bibname} \bibmark \ifnobibintoc\else \phantomsection \addcontentsline{toc}{chapter}{\bibname} \fi \prebibhook} \addtodef{\endthebibliography}{}{\vskip-\lastskip\postbibhook} }{}} % \end{macrocode} % \end{macro} % \end{macro} % % \subsection{Patch file} % % At the suggestion of Danie Els (\texttt{DanieEls@sun.ac.za}), Dan Leucking % (\texttt{luecking@uark.edu}) and others, input a patch file, if one exists, % as the final act. (This is preferable to my series of \file{memfixa.sty}, % \file{memfixb.sty} packages, and so on, for each release of the class.) % \changes{v1.3}{2002/11/14}{Added input of mempatch.sty} % \begin{macrocode} \InputIfFileExists{mempatch.sty} % \end{macrocode} % % The end of the class definitions. % \begin{macrocode} % % \end{macrocode} % % % % % \bibliographystyle{alpha} % % \begin{thebibliography}{GMSN94A} % % \bibitem[ArWi00]{IFMTARG} % Donald Arseneau and Peter Wilson. % \newblock \emph{The ifmtarg package}. % \newblock March, 2000. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/misc}) % % \bibitem[Car98a]{ENUMERATE} % David Carlisle. % \newblock \emph{The enumerate package}. % \newblock August, 1998. % \newblock (Available from CTAN in % \texttt{/macros/latex/required/tools}) % % \bibitem[Car98b]{REMRESET} % David Carlisle. % \newblock \emph{The remreset package}. % \newblock August, 1998. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/carlisle}) % % \bibitem[Coc02]{SUBFIGURE} % Steven Douglas Cochran. % \newblock \emph{The subfigure package}. % \newblock March, 2002. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/subfigure}) % % \bibitem[Dal99]{NATBIB} % Patrick W. Daly. % \newblock \emph{Natural Sciences Citations and References}. % \newblock May, 1999 % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/natbib}) % % \bibitem[Fai98]{MOREVERB} % Robin Fairbairns. % \newblock \emph{The moreverb package}. % \newblock December, 1998. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/moreverb}) % % \bibitem[Fra00]{CROP} % Melchior Franz. % \newblock \emph{The crop package}. % \newblock February, 2000. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/crop}) % % \bibitem[GMS94]{GOOSSENS94} % Michel Goossens, Frank Mittelbach, and Alexander Samarin. % \newblock {\em The LaTeX Companion}. % \newblock Addison-Wesley Publishing Company, 1994. % % % \bibitem[LMB99]{CLASSES} % Leslie Lamport, Frank Mittelbach and Johannes Braams. % \newblock \emph{Standard Document Classes for LaTeX version 2e}. % \newblock September, 1999. % \newblock (Available from CTAN as % \texttt{/macros/latex/base/classes.dtx}) % % \bibitem[Oos96]{FANCYHDR} % Piet van Oostrum. % \newblock \emph{Page layout in LaTeX}. % \newblock June, 1996. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/fancyhdr}) % % \bibitem[Rahtz]{HYPERREF} % Sebastian Rahtz. % \newblock \emph{Hypertext marks in LaTeX}. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/hyperref}) % % \bibitem[Sch98]{EVERYSHI} % Martin Schr\"{o}der. % \newblock \emph{The everyshi package}. % \newblock August, 1998. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/ms}) % % \bibitem[SRR01]{VERBATIM} % Rainer Sch\"{o}pf, Bernd Raichle and Chris Rowley. % \newblock \emph{A new implementation of LaTeX's verbatim and verbatim* % environments}. % \newblock March, 2001. % \newblock (Available from CTAN in % \texttt{/macros/latex/required/tools}) % % \bibitem[Wil99]{TOCVSEC2} % Peter Wilson. % \newblock \emph{The tocvsec2 package}. % \newblock January, 1999. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/tocvsec2}) % % \bibitem[Wil00a]{EPIGRAPH} % Peter Wilson. % \newblock \emph{The epigraph package}. % \newblock February, 2000. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/epigraph}) % % \bibitem[Wil00b]{ISOCLASS} % Peter Wilson. % \newblock \emph{LaTeX files for typesetting ISO standards}. % \newblock February, 2000. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/isostds/iso}) % % \bibitem[Wil00c]{NEXTPAGE} % Peter Wilson. % \newblock \emph{The nextpage package}. % \newblock February, 2000. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/misc}) % % \bibitem[Wil00d]{NEEDSPACE} % Peter Wilson. % \newblock \emph{The needspace package}. % \newblock March, 2000. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/misc}) % % \bibitem[Wil01a]{ABSTRACT} % Peter Wilson. % \newblock \emph{The abstract package}. % \newblock February, 2001. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/abstract}) % % \bibitem[Wil01b]{CHNGPAGE} % Peter Wilson. % \newblock \emph{The chngpage package}. % \newblock February, 2001. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/misc}) % % \bibitem[Wil01c]{APPENDIX} % Peter Wilson. % \newblock \emph{The appendix package}. % \newblock March, 2001. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/appendix}) % % \bibitem[Wil01d]{CCAPTION} % Peter Wilson. % \newblock \emph{The ccaption package}. % \newblock March, 2001. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/ccaption}) % % \bibitem[Wil01e]{CHNGCNTR} % Peter Wilson. % \newblock \emph{The chngcntr package}. % \newblock March, 2001. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/misc}) % % \bibitem[Wil01f]{HANGING} % Peter Wilson. % \newblock \emph{The hanging package}. % \newblock March, 2001. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/hanging}) % % \bibitem[Wil01g]{TITLING} % Peter Wilson. % \newblock \emph{The titling package}. % \newblock March, 2001. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/titling}) % % \bibitem[Wil01h]{TOCBIBIND} % Peter Wilson. % \newblock \emph{The tocbibind package}. % \newblock April, 2001. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/tocbibind}) % % \bibitem[Wil01i]{TOCLOFT} % Peter Wilson. % \newblock \emph{The tocloft package}. % \newblock April, 2001. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/tocloft}) % % \bibitem[Wil01j]{VERSE} % Peter Wilson. % \newblock \emph{Typesetting simple verse with LaTeX}. % \newblock August, 2001. % \newblock (Available from CTAN in % \texttt{/macros/latex/contrib/supported/verse}) % % % % % \end{thebibliography} % % % \Finale % \endinput %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~}