% \iffalse meta-comment % % memoir.dtx % Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net % Maintainer: Lars Madsen (daleif+memoir at imf dot au dot dk) % Copyright 2001--2010 Peter R. Wilson % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either % version 1.3 of this license or (at your option) any % later version. % The latest version of the license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of % LaTeX version 2003/06/01 or later. % % This work has the LPPL maintenance status "maintained". % % This work consists of the files listed in the README file. % % \fi % \CheckSum{30174} % % \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} % \changes{v1.4}{2003/02/27}{Added patches v1.1} % \changes{v1.4}{2003/02/27}{Added patches v1.3} % \changes{v1.4}{2003/11/16}{Including current patches} % \changes{v1.4}{2003/11/16}{Added patches v1.2} % \changes{v1.4}{2003/11/22}{Added patches v1.4} % \changes{v1.4}{2003/11/22}{Added patches v1.5} % \changes{v1.4}{2003/11/22}{Added patches v1.6} % \changes{v1.4}{2003/11/22}{Added patches v1.7} % \changes{v1.4}{2003/11/30}{Added patches v1.8} % \changes{v1.4}{2003/11/30}{Added patches v1.9} % \changes{v1.6}{2004/01/31}{Decided to issue v1.4 as v1.6 on the way to % the golden section 1.6180339887...} % \changes{v1.61}{2004/03/14}{Changes to clo files, and footnotes} % \changes{v1.61}{2004/03/21}{Removed a potential problem with the % hangul package} % \changes{v1.618}{2005/09/02}{Folded in all v1.61 patches} % \changes{v1.618}{2005/09/15}{Some minor extensions} % \changes{v1.618}{2005/09/25}{Support for glossaries} % \changes{v1.6180}{2006/06/12}{Footnote font fix} % \changes{v1.61803}{2008/05/26}{Folded in all mempatch v4.9a patches} % \changes{v1.618033}{2008/06/02}{Fixed(?) page layout algorithms} % \changes{v1.6180339}{2008/07/23}{Unemulated if... packages} % \changes{v1.6180339}{2008/07/23}{Folded in all mempatch v5.1 patches} % \changes{v1.6180339a}{2008/08/07}{Removed extra space in footnotes} % \changes{v1.6180339c}{2009/01/21}{Minor bug fixes and extensions} % \changes{v1.6180339c}{2009/01/25}{A few more} % \changes{v1.6180339d}{2009/02/04}{Fixed a bug in the running % head/foot widths} % \changes{v1.6180339f}{2009/03/16}{Start of `f' version.} % \changes{v1.6180339f}{2009/03/16}{Fixed problem with companion pagestyle % and added 2 col Toc} % \changes{v1.6180339f}{2009/04/25}{Extended description lists} % \changes{v1.6180339f}{2009/07/12}{Added three \cs{memlet...} macros} % \changes{v1.6180339g}{2009/07/13}{Fixed a bug regading extre enties % in the page note list} % \changes{v1.61803398}{2009/07/17}{Added bidi (RTL) support} % \changes{v1.61803398}{2009/07/27}{Fixed bug in \cs{@setclcnt}, added simple pagestyle} % \changes{v1.61803398}{2009/08/08}{changed the code that defined the % main function out of \cs{newlistof}} % \changes{v1.61803398}{2009/09/10}{fixed bug with upquote} % \changes{v1.61803398b}{2009/09/21}{fixed typo} % \changes{v1.61803398c}{2009/11/13}{fixed typo} % \changes{v1.61803398d}{2009/11/13}{fixed infelicity with \cs{@starttoc}} % \changes{v1.61803398d}{2009/12/01}{fixed bug in ifxetex, ifpdf,...} % \changes{v1.61803398d}{2009/12/18}{made \cs{subcaptionref} robust} % \changes{v1.61803398d}{2010/xx/xx}{several changes} % \changes{v1.618033988}{2010/02/16}{bumped version to v1.618033988} % \changes{v1.618033988b}{2010/02/17}{fixed typo that broke \cs{feetbelowfloat}} % \changes{v1.618033988c}{2010/02/20}{fixed sporadic space in \cs{@footnotetext}} % \changes{v1.618033988d}{2010/02/26}{fixed bug in % \cs{marginparmargin}\{left\} in twoside mode} % % \changes{v3.6}{2010/04/19}{Reversioned memoir to a more suitable scheme} % \changes{v3.6d}{2010/07/01}{Various bug fixes} % \changes{v3.6e}{2010/08/20}{Maintenance} % \changes{v3.6f}{2010/08/22}{Bad typo} % \changes{v3.6g}{2010/09/19}{Maintenance} % \changes{v3.6h}{2011/02/13}{Various things} % \changes{v3.6i}{2011/02/18}{Two bug fixes} % \changes{v3.6j}{2011/03/06}{Bug fixes} % % \def\dtxfile{memoir.dtx} % % \def\fileversion{v0.1} \def\filedate{2001/05/20} % \def\fileversion{v0.2} \def\filedate{2001/06/03} % \def\fileversion{v0.3} \def\filedate{2001/07/14} % \def\fileversion{v0.31} \def\filedate{2001/07/24} % \def\fileversion{v0.32} \def\filedate{2001/08/03} % \def\fileversion{v0.33} \def\filedate{2001/08/31} % \def\fileversion{v1.0} \def\filedate{2001/11/17} % \def\fileversion{v1.0a} \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} % \def\fileversion{v1.4} \def\filedate{2003/12/18} % \def\fileversion{v1.6} \def\filedate{2004/01/31} % \def\fileversion{v1.61} \def\filedate{2004/04/04} % \def\fileversion{v1.618} \def\filedate{2005/09/27} % \def\fileversion{v1.6180} \def\filedate{2006/06/12} % \def\fileversion{v1.61803} \def\filedate{2008/05/26} % \def\fileversion{v1.618033} \def\filedate{2008/06/02} % \def\fileversion{v1.6180339} \def\filedate{2008/07/23} % \def\fileversion{v1.6180339a} \def\filedate{2008/08/07} % \def\fileversion{v1.6180339c} \def\filedate{2009/01/21} % \def\fileversion{v1.6180339c} \def\filedate{2009/01/25} % \def\fileversion{v1.6180339d} \def\filedate{2009/02/04} % \def\fileversion{v1.6180339e} \def\filedate{2009/02/06} % \def\fileversion{v1.6180339f} \def\filedate{2009/07/12} % \def\fileversion{v1.6180339g} \def\filedate{2009/07/13} % \def\fileversion{v1.61803398} \def\filedate{2009/09/10} % \def\fileversion{v1.61803398b} \def\filedate{2009/09/21} % \def\fileversion{v1.61803398c} \def\filedate{2009/11/17} % \def\fileversion{v1.61803398d} \def\filedate{2009/11/23} % \def\fileversion{v1.618033988} \def\filedate{2010/02/16} % \def\fileversion{v1.618033988b} \def\filedate{2010/02/17} % \def\fileversion{v1.618033988c} \def\filedate{2010/02/20} % \def\fileversion{v3.6} \def\filedate{2010/04/19} % \def\fileversion{v3.6d} \def\filedate{2010/07/01} % \def\fileversion{v3.6e} \def\filedate{2010/08/20} % \def\fileversion{v3.6f} \def\filedate{2010/08/22} % \def\fileversion{v3.6g} \def\filedate{2010/09/19} % \def\fileversion{v3.6h} \def\filedate{2011/02/13} % \def\fileversion{v3.6i} \def\filedate{2011/02/18} % \def\fileversion{v3.6j} \def\filedate{2011/03/06} % \title{The LaTeX \Lpack{memoir} class for configurable book % typesetting: Source code\thanks{This % file (\texttt{\dtxfile}) has version number \fileversion, last revised % \filedate.}} % % \author{% % Peter Wilson\thanks{\texttt{herries dot press at earthlink dot net}}\\ % Herries Press \\ % (with the assistance of Lars Madsen)} % \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. % % The class was first released in mid 2001 and has been well used ever % since. % \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 if you have scaleable fonts available they can be set at any size. % There is a reasonably intuitive means of setting the margins % and placement of the text on a page. There is an option to put % trim marks on the printed pages if the stock sheets need to be trimmed % down to the final page size. For those whose publishers like a % 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 \cs{bf}, \cs{sl}, \cs{it} and \cs{sc} commands; % it warns about using the \cs{em} command but does support it. % % % I hope that apart from the font commands the class % 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[twoside]{ltxdoc} \usepackage[T1]{fontenc} \usepackage{url} %%\usepackage[draft=false, %% plainpages=false, %% pdfpagelabels, %% bookmarksnumbered, %% hyperindex=true %% ]{hyperref} % Doesn't work with indexing of \DescribeMacro \providecommand{\phantomsection}{} % just in case hyperref not used % \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} \makeatletter \@mparswitchfalse \makeatother \renewcommand{\MakeUppercase}[1]{#1} \pagestyle{headings} % \end{macrocode} % We may 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 \newcommand*{\ctt}{\textsc{ctt}} % comp.text.tex \newenvironment{PW}{\em}{} \newcommand*{\theTeXbook}{\textit{The \TeX book}} \let\oldllap\llap \def\llap#1{\oldllap{#1\quad}} % might be evil % \end{macrocode} % We want the full details printed. % \begin{macrocode} \begin{document} \DeleteShortVerb{\|} \raggedbottom \raggedright \DocInput{memoir.dtx} \PrintIndex %% \PrintChanges \end{document} % % \end{macrocode} % % % ^^A There are some elements we do not want to appear in the index. % \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} % ^^A \DoNotIndex{\if@tempswa,\fi} % \DoNotIndex{\ifcase,\or,\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} % % % % \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} % % ^^A Use the Golden Section as the version number (1.6180339887 4989484820 4586834365) % \changes{v3.6}{2010/04/19}{Not any more, apparently people does not % know the numeric value of the golden ration very well} % % % Announce the name, option files and version for LaTeX2e files: % \begin{macrocode} %\ProvidesClass{memoir}% % [2011/03/06 v3.6j configurable book, report, article document class] %<9pt>\ProvidesFile{mem9.clo}% %<9pt> [2008/01/30 v0.4 memoir class 9pt size option] %<10pt>\ProvidesFile{mem10.clo}% %<10pt> [2008/01/30 v0.3 memoir class 10pt size option] %<11pt>\ProvidesFile{mem11.clo}% %<11pt> [2008/01/30 v0.3 memoir class 11pt size option] %<12pt>\ProvidesFile{mem12.clo}% %<12pt> [2010/10/19 v0.4b memoir class 12pt size option] %<14pt>\ProvidesFile{mem14.clo}% %<14pt> [2008/01/30 v0.4 memoir class 14pt size option] %<17pt>\ProvidesFile{mem17.clo}% %<17pt> [2008/01/30 v0.3 memoir class 17pt size option] %<20pt>\ProvidesFile{mem20.clo}% %<20pt> [2008/01/31 v0.1 memoir class 20pt size option] %<25pt>\ProvidesFile{mem25.clo}% %<25pt> [2008/01/31 v0.1 memoir class 25pt size option] %<30pt>\ProvidesFile{mem30.clo}% %<30pt> [2008/01/31 v0.1 memoir class 30pt size option] %<36pt>\ProvidesFile{mem36.clo}% %<36pt> [2008/01/31 v0.1 memoir class 36pt size option] %<48pt>\ProvidesFile{mem48.clo}% %<48pt> [2008/01/31 v0.1 memoir class 48pt size option] %<60pt>\ProvidesFile{mem60.clo}% %<60pt> [2008/01/31 v0.1 memoir class 60pt size option] % \end{macrocode} % % % \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 \cs{@tempa}, \cs{@tempb} and \cs{@tempc}. I have now replaced % any use of these with \cs{@memtempa}, etc. % % In this part we define a few commands that are used later on. % % \begin{macro}{\@ptsize} % \begin{macro}{\@memptsize} % The \cs{@ptsize} control sequence is normally used to store the % second digit of the % pointsize we are typesetting in. So, normally, it's value is one % of 0, 1 or 2. % % \cs{@memptsize} stores the full pointsize. % \changes{v1.61803}{2008/01/30}{Added \cs{@memptsize}} % \begin{macrocode} \newcommand*{\@ptsize}{} \newcommand*{\@memptsize}{} % \end{macrocode} % \end{macro} % \end{macro} % % Any new lengths that depend on the point size option must be declared % before the options are executed. % \begin{macro}{\onelineskip} % \begin{macro}{\lxvchars} % \begin{macro}{\xlvchars} % The length \cs{onelineskip} is the vertical space taken % by a normal line of text. The lengths \cs{lxvchars} and \cs{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} % \begin{macro}{\c@memmarkcntra} % We need a scratch count register and a scratch counter. % \changes{v1.61803}{2008/10/30}{Added @memmarkcntra scratch counter} % \begin{macrocode} \newcount\@memcnta \newcounter{@memmarkcntra} % \end{macrocode} % \end{macro} % \end{macro} % % \changes{v1.0a}{2001/11/28}{Deleted count register \cs{@memtempa}} % % \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}{\ifextrafontsizes} % This is TRUE if the \Lopt{extrafontsizes} option is used. % \changes{v1.61803}{2008/01/30}{Added \cs{ifextrafontsizes}} % \begin{macrocode} \newif\ifextrafontsizes \extrafontsizesfalse % \end{macrocode} % \end{macro} % % \begin{macro}{\@memerror} % \begin{macro}{\@memwarn} % Two macros to save some space when reporting errors or warnings. % The macros take the same arguments, ignoring the first in each case, % as \cs{ClassError} and \cs{ClassWarning}, e.g., \\ % \verb?\@memwarn{Message}? \\ % instead of \\ % \verb?\ClassWarning{memoir}{Message}?. % \changes{v1.4}{2003/02/27}{Added \cs{@memerror} and \cs{@memwarn}} % \begin{macrocode} \newcommand*{\@memerror}{\ClassError{memoir}} \newcommand*{\@memwarn}{\ClassWarning{memoir}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\ifsamename} % \begin{macro}{\nametest} % The macro \cs{nametest}\marg{name1}\marg{name2} tests whether the % characters forming the two arguments are the same or not. If they are the % same then \cs{ifsamename} is set TRUE, otherwise it is set FALSE. \meta{name1} % and \meta{name2} must both be either macro names (including the backslash) % or must both not be macro names. That is, you cannot do % \verb?\nametest{\cs}{cs}?. % \changes{v1.61803398d}{2010/02/13}{added some \% because the macro % was leaking spaces} % \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} % % \begin{macro}{\ifm@m@And} % \begin{macro}{\m@m@Andtrue} % \begin{macro}{\m@m@Andfalse} % \begin{macro}{\ifm@m@Or} % \begin{macro}{\m@m@Ortrue} % \begin{macro}{\m@m@Orfalse} % \begin{macro}{\ifm@m@Xor} % \begin{macro}{\m@m@Xortrue} % \begin{macro}{\m@m@Xorfalse} % These are for `if A and B', `if A or B' and `if A xor B'. % % For A and B: % \begin{verbatim} % \m@m@Andfalse % \ifA % \ifB % \m@mAndtrue % \fi % \fi % \end{verbatim} % For A or B: % \begin{verbatim} % \m@m@Ortrue % \ifA % \else % \ifB % \else % \m@m@Orfalse % \fi % \fi % \end{verbatim} % For A xor B: % \begin{verbatim} % \m@m@Xortrue % \ifA % \ifB % \m@m@Xfalse % \fi % \else % \ifB % \else % \m@m@Xorfalse % \fi % \fi % \end{verbatim} % \changes{v1.618}{2005/09/09}{Added \cs{ifm@m@And}, \cs{ifm@m@Or} and \cs{ifm@m@Xor}} % \begin{macrocode} \newif\ifm@m@And \newif\ifm@m@Or \newif\ifm@m@Xor % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \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} % \cs{kill@lastcounter}\marg{cntr}\footnote{With thanks to Stefan Ulrich % (\texttt{ulrich@cis.uni-muenchen.de}) who answered a question on this % on \ctt, 2001/07/09. (Also answered by Heiko Oberdiek, % \texttt{oberdiek@ruf.uni-freiburg.de}).} % 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:\\ % \verb?\newcounter{fred} \kill@lastcounter{fred} \newcounter{fred}? \\ % there is no error with the second \cs{newcounter}. % \changes{v0.3}{2001/07/09}{Added \cs{kill@counter}} % \changes{v1.618}{2005/09/02}{Ensured \cs{kill@counter} zeroed the counter} % \begin{macrocode} \newcommand{\kill@lastcounter}[1]{% % \end{macrocode} % Deallocate the last counter register. From \theTeXbook, \verb?\count10? is % the number of the last register. The counter should be zeroed before being % deallocated otherwise an immediatally following \cs{newcount} may not % be zero when allocated\footnote{Discovered and fix provided by Robert % Schlicht on 2005/08/31.}. % \begin{macrocode} \count\count10 \z@ \advance\count10 \m@ne % \end{macrocode} % Set the internal counter definition to \cs{relax}. % \begin{macrocode} \expandafter\let\csname c@#1\endcsname\relax} % \end{macrocode} % \end{macro} % % \begin{macro}{\@name@p@xdf} % \begin{macro}{\@name@unresp@xdef} % \begin{macro}{\@namelet} % \begin{macro}{\@namelongdef} % Utility definition macros, along the lines of the kernel's \cs{@namedef}. % \changes{v1.4}{2003/11/22}{Added \cs{@namelet} and friends (from patch v1.8)} % \begin{macrocode} \newcommand{\@name@p@xdef}[1]{% \expandafter\protected@xdef\csname #1\endcsname} \newcommand{\@name@unresp@xdef}[1]{% \expandafter\unrestored@protected@xdef\csname #1\endcsname} \newcommand{\@namelet}[1]{% \expandafter\let\csname #1\endcsname} \newcommand{\@namelongdef}[1]{% \long\expandafter\def\csname #1\endcsname} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\memletcmdtxt} % \begin{macro}{\memlettxttxt} % \begin{macro}{\memlettxtcmd} % More utility macros (for the user but perhaps better not to tell them about % it in the manual) \\ % \verb?\memletcmdtxt{\cmd}{txt} -> \let\cmd\txt? \\ % \verb?\memlettxttxt{txta}{txtb} -> \let\txta\txtb? \\ % \verb?\memlettxtcmd{txt}{\cmd} -> \let\txt\cmd? \\ % \changes{v1.6180339f}{2009/06/25}{Added \cs{memletcmdtxt}, \cs{memlettxttxt} % and \cs{memlettxtcmd}} % \begin{macrocode} \newcommand*{\memletcmdtxt}[2]{\expandafter\let\expandafter#1\csname#2\endcsname} \newcommand*{\memlettxttxt}[1]{\expandafter\memletcmdtxt\csname#1\endcsname} \newcommand*{\memlettxtcmd}[2]{\expandafter\let\csname#1\endcsname#2} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@nameedef} % A shorthand for using \cs{protected@edef}. % \begin{macrocode} \newcommand{\@nameedef}[1]{% \expandafter\protected@edef\csname #1\endcsname} % \end{macrocode} % \end{macro} % % % \begin{macro}{\memjustarg} % \begin{macro}{\memgobble} % Utility macros \emph{that are not to be changed by any user!} % \changes{v1.618}{2005/09/25}{Added \cs{memjustarg} and \cs{memgobble}} % \begin{macrocode} \newcommand{\memjustarg}[1]{#1} \newcommand{\memgobble}[1]{} % \end{macrocode} % \end{macro} % \end{macro} % % \subsection{Classes, Packages and Files} % % \begin{macro}{\@memfakeusepackage} % \cs{@memfakeusepackage}\marg{pack} fools \LaTeX{} into thinking % that the \meta{pack.sty} package has been loaded. % \changes{v1.4}{2003/11/22}{Added \cs{@memfakeusepackage} (from patch v1.9)} % \begin{macrocode} \newcommand*{\@memfakeusepackage}[1]{% \@namelet{ver@#1.sty}\@empty} % \end{macrocode} % \end{macro} % % \begin{macro}{\EmulatedPackage} % \begin{macro}{\EmulatedPackageWithOptions} % There was some discussion on CTT\footnote{\textit{Re: breakurl + pdfetex % for generating .dvi}, March 2005.} about how to prevent loading of % a package. My response was to use \cs{@memfakusepackage}. Donald Arseneau % came up with this comprehensive solution (there was a little discussion % about naming with my final suggestion as here). \\ % \cs{EmulatedPackage}\marg{package}\oarg{date} \\ % \cs{EmulatedPackageWithOptions}\marg{option-list}\marg{package}\oarg{date} \\ % % \changes{v1.618}{2005/09/04}{Added \cs{EmulatedPackage} and % \cs{EmulatedPackageWithOptions}} % \changes{v1.6180339}{2008/07/23}{Extended \cs{EmulatedPackage}} % \begin{macrocode} \providecommand*{\EmulatedPackage}{} \renewcommand*{\EmulatedPackage}[1]{% \@ifnextchar[{\@emulated@package{#1}}% {\@emulated@package{#1}[\@empty]}%] } \providecommand*{\EmulatedPackageWithOptions}{} \renewcommand*{\EmulatedPackageWithOptions}[2]{% \PassOptionsToPackage{#1}{#2}% \EmulatedPackage{#2}% } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@emulated@package} % The workhorse for the user commands. % \begin{macrocode} \def\@emulated@package#1[#2]{% \expandafter\xdef\csname ver@#1.\@pkgextension\endcsname{#2}% \@ifundefined{opt@#1.\@pkgextension}% {\@namedef{opt@#1.\@pkgextension}{}}{}% \wlog{Package #1 \ifx\@empty#2\else[#2] \fi \if,\csname opt@#1.\@pkgextension\endcsname,\else (with options \csname opt@#1.\@pkgextension\endcsname) \fi emulated by \@currname.}% } \@onlypreamble\EmulatedPackage \@onlypreamble\EmulatedPackageWithOptions \@onlypreamble\@emulated@package % \end{macrocode} % \end{macro} % % \begin{macro}{\DisemulatePackage} % \cs{DisemulatePackage}\marg{package} undoes a previous % \cs{EmulatedPackage...} % \changes{v1.61803}{2008/01/30}{Added \cs{DisemulatePackage} from memptach v4.5} % \changes{v1.6180339}{2008/07/23}{Fixed \cs{DisemulatePackage} from mempatch v5.1} % \begin{macrocode} \newcommand*{\DisemulatePackage}[1]{% \@namelet{ver@#1.\@pkgextension}\relax} \@onlypreamble\DisemulatePackage % \end{macrocode} % \end{macro} % % % Code, based on a hint from Morten H{\o}gholm\footnote{CTT posting % 2005/11/08, \textit{Re: Checking for packages froma class... % revisited}} that the \Lpack{scrlfile} package from % \Lpack{koma-script} includes commands such as \\ % \cs{AfterFile}\marg{file}\marg{code} \\ % plus before and after classes and packages. % \changes{v1.16803}{2008/01/30}{Added various \cs{AtBegin...} and % \cs{AtEnd...} macros (mempatch v4.2)} % % Extend the \cs{InputIfFileExists} macro to call hooks before and % the actual inputting. The kernel version (as of 2005/11/21) is: % \begin{verbatim} % \newcommand{\InputIfFileExists}[2]{% % \IfFileExists{#1}% % {\#2\@addtofilelist{#1}\@@input \@filef@und}} % \end{verbatim} % % \begin{macro}{\InputIfFileExists} % Effectively all file input is handled by this macro. Extend it % by adding pre- and post- input hooks. % \begin{macrocode} \renewcommand{\InputIfFileExists}[2]{% \IfFileExists{#1}% {#2\@addtofilelist{#1}\m@matbeginf{#1}% \@@input \@filef@und \m@matendf{#1}% \killm@matf{#1}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\m@matbeginf} % \begin{macro}{\m@matendf} % \cs{m@matbeginf}\marg{file} calls macro \cs{file-m@mfb} if it % is defined. Similarly \cs{m@matendf}\marg{file} calls % \cs{file-m@mfe} if it is defined. % \begin{macrocode} \newcommand{\m@matbeginf}[1]{\@ifundefined{#1-m@mfb}{}% {\@nameuse{#1-m@mfb}}} \newcommand{\m@matendf}[1]{\@ifundefined{#1-m@mfe}{}% {\@nameuse{#1-m@mfe}}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\killm@matf} % \cs{killm@matf}\marg{file} undefines the \cs{file-m@mfb} and % \cs{file-m@mfe} macros. % \begin{macrocode} \newcommand*{\killm@matf}[1]{% \@namelet{#1-m@mfb}\relax \@namelet{#1-m@mfe}\relax} % \end{macrocode} % \end{macro} % % \begin{macro}{\AtBeginFile} % \begin{macro}{\AtEndFile} % \cs{AtBeginFile}\marg{file}\marg{code} inserts \meta{code} % just before \meta{file} is input. Similarly \cs{AtEndFile} inserts % just after input. % \begin{macrocode} \newcommand{\AtBeginFile}[2]{\@ifundefined{#1-m@mfb}% {\@namedef{#1-m@mfb}{#2}}% {\expandafter\addtodef\csname #1-m@mfb\endcsname{}{#2}}} \newcommand{\AtEndFile}[2]{\@ifundefined{#1-m@mfe}% {\@namedef{#1-m@mfe}{#2}}% {\expandafter\addtodef\csname #1-m@mfe\endcsname{}{#2}}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\AtBeginPackage} % \begin{macro}{\AtEndPackage} % \begin{macro}{\RequireAtEndPackage} % \cs{AtBeginPackage}\marg{pack}\marg{code} inserts \meta{code} % just before the \meta{pack} package is input, and \cs{AtEndPackage} % is the equivalent for after input. \cs{RequireAtEndPackage} inserts % \meta{code} either at the end of \meta{pack}, or immediately if % \meta{pack} has already been input. % \begin{macrocode} \newcommand{\AtBeginPackage}[2]{% \AtBeginFile{#1.\@pkgextension}{#2}} \newcommand{\AtEndPackage}[2]{% \AtEndFile{#1.\@pkgextension}{#2}} \newcommand{\RequireAtEndPackage}[2]{% \@ifpackageloaded{#1}{#2}% {\AtEndFile{#1.\@pkgextension}{#2}}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\AtBeginClass} % \begin{macro}{\AtEndClass} % \begin{macro}{\RequireAtEndClass} % \cs{AtBeginClass}\marg{class}\marg{code} and friends are the class % equivalents of \cs{AtBeginPackage} and friends. % \begin{macrocode} \newcommand{\AtBeginClass}[2]{% \AtBeginFile{#1.\@clsextension}{#2}} \newcommand{\AtEndClass}[2]{% \AtEndFile{#1.\@clsextension}{#2}} \newcommand{\RequireAtEndClass}[2]{% \@ifclassloaded{#1}{#2}% {\AtEndFile{#1.\@clsextension}{#2}}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % % % \begin{macro}{\phantomsection} % A command needed if the \Lpack{hyperref} package is used, for putting % before certain \cs{addcontentsline} commands. % \begin{macrocode} \newcommand{\phantomsection}{} % \end{macrocode} % \end{macro} % % \begin{macro}{\nofiles} % The kernel's \cs{nofiles}, which surprisingly may be called \emph{before} % the class is loaded, lets \cs{makeindex} to \cs{relax}. This could % cause problems\footnote{As reported by Heiko Oberdiek on 2005/07/09.} % with my initial version of \cs{makeindex}. % Here's the kernel \cs{nofiles} definition: % \begin{verbatim} % \def\nofiles{% % \@fileswfalse% flag for suppressing \immediate \writes % \typeout{No auxiliary output files.^^J}% % \long\def\protected@write##1##2##3% % {\write\m@ne{}\if@nobreak\ifvmode\nobreak\fi\fi}% % \let\makeindex\relax % \let\makeglossary\relax} % \end{verbatim} % To get it to work for when \cs{makeindex}es optional argument is % used I let \cs{makeindex} itself deal with \cs{nofiles} (and % also \cs{makeglossary}). % \changes{v1.618}{2005/09/25}{Modified the kernel's \cs{nofiles}} % \begin{macrocode} \renewcommand*{\nofiles}{% \@fileswfalse% flag for suppressing \immediate \writes \typeout{No auxiliary output files.^^J}% \long\def\protected@write##1##2##3% {\write\m@ne{}\if@nobreak\ifvmode\nobreak\fi\fi}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\memsetcounter} % A wrapper round \cs{setcounter}. I want to use this in the \texttt{aux} file. % \changes{v1.61803}{2008/01/30}{Added \cs{memsetcounter}} % \begin{macrocode} \newcommand*{\memsetcounter}[2]{\setcounter{#1}{#2}} \AtBeginDocument{\immediate\write\@mainaux{% \string\providecommand*{\string\memsetcounter}[2]{}}} % \end{macrocode} % \end{macro} % % \subsection{For package documentation} % % Some macros that may be useful for documenting LaTeX code. These % have principally come from \texttt{doc.dtx}. % % \begin{macro}{\bs} % Prints \verb?\? % \begin{macrocode} \def\bs{\texttt{\char`\\}} % \end{macrocode} % \end{macro} % % \begin{macro}{\l@nohyphenation} % \begin{macro}{\meta} % \begin{macro}{\meta@font@select} % From \texttt{doc.dtx} \\ % \cs{meta}\marg{arg} prints \meta{arg}. % \begin{macrocode} \ifx\l@nohyphenation\undefined \newlanguage\l@nohyphenation \fi \DeclareRobustCommand{\meta}[1]{% \ensuremath\langle \ifmmode \expandafter \nfss@text \fi {% \meta@font@select \edef\meta@hyphen@restore {\hyphenchar\the\font\the\hyphenchar\font}% \hyphenchar\font\m@ne \language\l@nohyphenation #1\/% \meta@hyphen@restore }\ensuremath\rangle } \def\meta@font@select{\itshape} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\marg} % \begin{macro}{\oarg} % \begin{macro}{\parg} % Robust versions of the \texttt{doc.dtx} macros. \\ % \cs{marg}\marg{arg} prints \marg{arg} \\ % \cs{oarg}\marg{arg} prints \oarg{arg} \\ % \cs{parg}\marg{arg} prints \parg{arg} \\ % \begin{macrocode} \DeclareRobustCommand{\marg}[1]{% {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} \DeclareRobustCommand{\oarg}[1]{% {\ttfamily\char`\[}\meta{#1}{\ttfamily\char`\]}} \DeclareRobustCommand{\parg}[1]{% {\ttfamily\char`\(}\meta{#1}{\ttfamily\char`\)}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\cs} % \verb?\cs{arg}? prints \cs{arg}. % \begin{macrocode} \DeclareRobustCommand{\cs}[1]{\texttt{\char`\\#1}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\cmdprint} % \begin{macro}{\cmd} % From Heiko Oberdiek CTT 2001/05/26 (print and index a command) \\ % \verb?\cmdprint{\fred}? prints \verb?\fred? \\ % \verb?\cmd{\fred}? prints and indexes \verb?\fred?. NOTE It assumes that % \verb!?! is the `actual' character for MakeIndex (it is normally \verb!@! % but that is not much use if a command includes \verb!@! as part of its name). % \begin{macrocode} \newcommand{\cmdprint}[1]{\texttt{\string#1}} \newcommand{\cmd}[1]{\cmdprint{#1}% \index{\expandafter\@gobble\string#1?\string\cmdprint{\string#1}}} % \end{macrocode} % \end{macro} % \end{macro} % % % % % \subsection{Checking the processor} % % Prior to 2008/07/22 the \Lpack{hyperref} package was modified in such a % way as to produce warnings about versions of the \Lpack{ifpdf} and % \Lpack{ifxetex} packages when \Lpack{hyperref} was used with versions % v1.618033, % v1.61803, or v1.618 mempatch v4.9 of the class. % \Lpack{hyperref}'s author refused to % make any changes to his package, insisting that emulating a package was % `ugly hacking'. He did, though, provide an example code that could be % added to memoir % to use a package if it was available. I have used it for the emulations % in this section. There will be no further changes to the class to accomodate % any further changes to \Lpack{hyperref} --- it's easy for a package to % determine what class is being used and make arrangements accordingly, % especially as there are not all that many classes. There are hundreds % of packages that might be used with a particular class and it would be % senseless for a class to attempt to take account of everything that might % be used with it. % % \begin{macro}{\ifpdf} % \begin{macro}{\pdftrue} % \begin{macro}{\pdffalse} % This can be used to check whether or not a document is being processed % by \LaTeX{} or pdf\LaTeX. % \changes{v1.0}{2001/09/21}{Made checking of \cs{pdfouput} more robust} % \changes{v1.618}{2005/09/03}{Prohibit loading the ifpdf package (mempatch v3.9)} % \changes{v1.618033}{2008/06/02}{Further improved pdf checking} % \changes{v1.6180339}{2008/07/23}{Use ifpdf package if available} % \changes{v1.61803398d}{2009/12/01}{if \cs{ifpdf} is already % defined, e.g. using \cs{RequirePackage} before \cs{documentclass}, % then using \cs{newif}\cs{ifpdf} will cause TeX to eat up a lot of % code. We fix this using a hint by Will Robertson.} % \begin{macrocode} \newif\ifm@mifpdf \m@mifpdffalse \IfFileExists{ifpdf.sty}{\RequirePackage{ifpdf}\relax}{% \ClassWarningNoLine{memoir}{% Package `ifpdf' is not installed.\MessageBreak The package is being emulated}% \m@mifpdftrue \expandafter\newif\csname ifpdf\endcsname \pdffalse \ifx\pdfoutput\undefined \else \ifx\pdfoutput\@undefined \else \ifx\pdfoutput\relax \else \ifnum\pdfoutput>0\relax \pdftrue \fi \fi \fi \fi %%\EmulatedPackage{ifpdf}[2008/07/23] } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\ifetex} % \begin{macro}{\etextrue} % \begin{macro}{\etexfalse} % Check if \texttt{etex} is being used. This is based on the check for % \texttt{pdf(latex)}. Someone may have created a package for this, % or perhaps not. % \changes{v1.61803}{2008/01/30}{Added check for etex (mempatch v4.9)} % \changes{v1.618033}{2008/06/02}{Improved check for etex} % \changes{v1.6180339}{2008/07/23}{Use an ifetex package if available} % \changes{v1.6180339c}{2008/12/27}{Changed ifetex message from Warning to Info} % \begin{macrocode} \newif\ifm@mifetex \m@mifetexfalse \IfFileExists{ifetex.sty}{\RequirePackage{ifetex}\relax}{% \ClassInfo{memoir}{% An `ifetex' package is being emulated}% \m@mifetextrue \newif\ifetex \etexfalse \ifx\eTeXversion\undefined \else \ifx\eTeXversion\@undefined \else \ifx\eTeXversion\relax \else \ifnum\eTeXversion>0\relax \etextrue \fi \fi \fi \fi %%\EmulatedPackage{ifetex}[2008/07/23] } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % Having supplied an \cs{ifpdf} to check if pdfLaTeX is being used, % here's one for XeTeX. % % \begin{macro}{\ifxetex} % \begin{macro}{\xetextrue} % \begin{macro}{\xetexfalse} % \begin{macro}{\RequireXeTeX} % Checks if XeTeX is being used. % \changes{v1.61803}{2008/01/30}{Added checks for XeTeX (mempatch v4.9)} % \changes{v1.6180339}{2008/07/23}{Use ifxetex package if available} % \changes{v1.61803398d}{2009/12/01}{if \cs{ifxetex} is already % defined, e.g. using \cs{RequirePackage} before \cs{documentclass}, % then using \cs{newif}\cs{ifxetex} will cause TeX to eat up a lot of % code. We fix this using a hint by Will Robertson.} % \begin{macrocode} \newif\ifm@mifxetex \m@mifxetexfalse \IfFileExists{ifxetex.sty}{\RequirePackage{ifxetex}\relax}{% \ClassWarningNoLine{memoir}{% The `ifxetex' package is not installed.\MessageBreak The package is being emulated}% \expandafter\newif\csname ifxetex\endcsname \@ifundefined{XeTeXrevision}{\xetexfalse}{\xetextrue} \m@mifxetextrue% % \end{macrocode} % Check for XeTeX from the \Lpack{ifxetex} package. % \begin{macrocode} %%\EmulatedPackage{ifxetex}[2008/07/23] } \ifm@mifxetex% % ifxetex package not found, emulate \RequireXeTeX \def\RequireXeTeX{% \ifxetex\else \@memerror{XeTeX is required to process this document}% {Try again with xelatex, not (pdf)latex.\MessageBreak Or try removing any XeTeX package(s).} \fi} \fi % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\ifluatex} % \begin{macro}{\luatextrue} % \begin{macro}{\luatexfalse} % Check if \texttt{luatex} is being used. This is based on the check for % \texttt{pdf(latex)}. Someone may have created a package for this, or % perhaps not. % \changes{v1.61803}{2008/01/30}{Added check for luatex} % \changes{v1.6180339}{2008/07/23}{Use an ifluatex package if available} % \changes{v1.6180339c}{2008/12/31}{It seems that Heiko Oberdiek has created an % ifluatex package.} % \changes{v1.61803398d}{2009/12/01}{if \cs{ifluatex} is already % defined, e.g. using \cs{RequirePackage} before \cs{documentclass}, % then using \cs{newif}\cs{ifluatex} will cause TeX to eat up a lot of % code. We fix this using a hint by Will Robertson.} % \begin{macrocode} \newif\ifm@mifluatex \m@mifluatexfalse \IfFileExists{ifluatex.sty}{\RequirePackage{ifluatex}\relax}{% \ClassWarningNoLine{memoir}{% The `ifluatex' package is not installed.\MessageBreak The package is being emulated}% \m@mifluatextrue \expandafter\newif\csname ifluatex\endcsname \luatexfalse \ifx\luatexversion\@undefined \else \ifx\luatexversion\undefined \else \ifx\luatexversion\relax \else \luatextrue \fi \fi \fi %%\EmulatedPackage{ifluatex}[2008/07/23] } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \subsection{Extending an existing macro} % % % My usual technique for modifying the code of an existing % macro was to use \cs{renewcommand}. However it slowly became apparent that % many of such modifications merely consisted of adding some code at % either the start or end of the existing definition. In June 2000 I % posed a question % on the \texttt{comp.text.tex} newsgroup about this, and % Michael Downes\footnote{\texttt{epsmjd@ams.org}} and % Heiko Oberdiek\footnote{\texttt{oberdiek@ruf.uni-freiburg.de}} % were kind enough to respond. % 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. % % \cs{wo@dmacro} is a helper for handling the string `macro:'. % \begin{macrocode} \edef\wo@dmacro{% \string m\string a\string c\string r\string o\string :% } % \end{macrocode} % \end{macro} % % \begin{macro}{\wo@difmacro@begingroup} % This seems to take two arguments: % \cs{wo@difmacro@begingroup}\marg{macro}\marg{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 \verb?#1? is a defined macro; \cs{wo@dparsemacro} does most of the work. % \begin{macrocode} \edef\x{% \noexpand\wo@dparsemacro\meaning#1\wo@dmacro\string -% }% \x\@nil{#1}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\wo@dparsemacro} % This is called by \cs{wo@difmacro@begingroup}. If \meta{macro} is not % a defined macro it prints a warning and closes the group begun by % \cs{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 \@memwarn{\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 \cs{addtodef}\marg{macro}\marg{start-stuff}\marg{end-stuff} % adds stuff at the start and/or end of an argumentless macro. % Initially the code for appending was a reimplementation of the % kernel \cs{g@addto@macro} command (from \file{ltclass.dtx}). % Later, at Michael Downes' suggestion, I combined % appending and prepending stuff into a single command. % Actually, there is no real need to have both % \cs{addtodef} and \cs{addtodef*} as the body of the command % being amended has no argument, % but both versions are provided for consistency. % % The kernel \cs{@star@or@long} and \cs{l@ngrel@x} commands % (in \file{ltdefns.dtx}) are used to handle % the potential \verb?*? after the command name. % \begin{macrocode} \def\addtodef{\@star@or@long\wo@daddtodef} % \end{macrocode} % The \cs{@star@or@long} command dealt with a possible \verb?*? and now % \cs{wo@daddtodef} does the work. It picks up the three arguments % that the user thinks belong to \cs{addtodef}, namely \meta{macro}, % \meta{start-stuff} and \meta{end-stuff}. % \begin{macrocode} \long\def\wo@daddtodef#1#2#3{% % \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 \cs{x}, so that calling \cs{x} % will \cs{def} a new version of \meta{macro}, whose body consists of the % saved tokens (i.e., the orginal body plus the extra stuff). % As Michael Downes noted, single letter control sequences do not take any of % \TeX's hash table space. % \cs{l@ngrel@x} % has been previously set to either \cs{long} or \cs{relax} by \cs{@star@or@long}, % and so may make the new definition of \meta{macro} to be \cs{long}. % \begin{macrocode} \edef\x{\endgroup \l@ngrel@x\def\noexpand#1{\the\@temptokena \the\toks@}}% % \end{macrocode} % Finally, call \cs{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 \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 \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} % % Continuing the saga, Michael came up with a pretty general solution for % modifying a macro with any number (up to 9) of arguments which he % sent to me on 2000/07/13; this became % the \Lpack{patchcmd} package which is on CTAN. I'm sure that Michael % would have given me permission to include it here if he had not tragically % passed away in 2003. I miss his encouragement, advice, and skills. % % \begin{macro}{\patchcmd} % \cs{patchcmd}\marg{macro}\marg{start-stuff}\marg{end-stuff} inserts % \meta{start-stuff} at the beginning of the definition of \meta{macro} % and \meta{end-stuff} at the end of the definition. \meta{macro} % can have 0--9 arguments and be defined by \cs{newcommand} (and associates) % or with \cs{DeclareRobustCommand}. For macros that use \cs{futurelet} % (e.g., those with starred forms or optional arguments) only prepending % works --- any non-empty \meta{end-stuff} will mess things up. \cs{patchcmd} % does not work with macros that have delimited arguments. % \changes{v1.618}{2005/09/05}{Added \cs{patchcmd}} % % \begin{macrocode} %%%%%%%%%%%%%%%% Michael Downes' patchcmd 2000/07/31 v1.03 %%%%%%%% \newcommand{\patchcommand}[1]{% \expandafter\patchcmd@a\meaning#1??->@\@nil#1% } % \end{macrocode} % \end{macro} % % \begin{macro}{\patchcmd@a} % \begin{macrocode} \long\def\patchcmd@a#1#2#3->#4#5\@nil#6{% \ifx @#4\relax \patchcmdError#6#1% \expandafter\@gobbletwo % discard the other two arguments \else \if l#2\toks@{\patchcmd@e{}#6}% l in this position means \long \else \toks@{\patchcmd@e*#6}% not \long \fi \patchcmd@b #3@#4#5 ? ? ? \@nil#6% \expandafter\the\expandafter\toks@ \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\patchcmd@b} % \begin{macrocode} \def\patchcmd@b#1:#2@#3#4 #5#6 #7 #8\@nil#9{% \if \ifx @#7@\expandafter \ifx\csname #6\endcsname#9T\else F\fi\else F\fi T% \toks@\expandafter{\expandafter\patchcommand\csname #6 \endcsname}% \else \ifx @#2@% No arguments \toks@\expandafter{\the\toks@ 0}% \else \patchcmd@c 0#2{\string##}0% \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\patchcmd@c} % \begin{macrocode} \def\patchcmd@c#1#2#3{% \if\string###2% % yes it's a # token \ifodd 0#31 % and it's followed by a number \if 0#3\patchcmd@d#1\fi % number=0? then we're done \else \patchcmd@d D% # not a number: must be a delimited arg \fi \else \patchcmd@d D% not a # token: must be a delmited arg \fi \patchcmd@c#3} % \end{macrocode} % \end{macro} % % \begin{macro}{\patchcmd@d} % \begin{macrocode} \def\patchcmd@d#1{% \if D#1% %%% \PackageError{patchcmd}{Cannot change a macro that has %%% delimited arguments}\@ehd \@memerror{% Cannot change a macro that has delimited arguments}{\@ehd} \else \toks@\expandafter{\the\toks@ #1}% \fi \begingroup \aftergroup\@gobble \let\patchcmd@c\endgroup} % \end{macrocode} % \end{macro} % % \begin{macro}{\patchcmd@e} % \begin{macrocode} \def\patchcmd@e#1#2#3#4#5{% \begingroup \edef\@##1{% \@temptokena\noexpand\expandafter{% \noexpand#2% \ifnum#3>0 {####1}\ifnum#3>1 {####2}\ifnum#3>2 {####3}% \ifnum#3>3 {####4}\ifnum#3>4 {####5}\ifnum#3>5 {####6}% \ifnum#3>6 {####7}\ifnum#3>7 {####8}\ifnum#3>8 {####9}% \fi\fi\fi\fi\fi\fi\fi\fi\fi ##1% }% } \@{#5}% \edef\@##1{\endgroup \noexpand\renewcommand#1\noexpand#2\ifcase#3 \else [#3]\fi {##1\the\@temptokena}}% \@{#4}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\patchcmdError} % \begin{macrocode} \long\def\patchcmdError#1#2{% \begingroup \toks@{Not redefinable}% \ifcat\relax\noexpand#1% Is it a control sequence? \begingroup \let#1=?\ifx ?\relax % Is it "\relax"? \endgroup % accept current value of \toks@ \else \endgroup \if\ifx\relax#1u\else #2\fi u% \toks@{Not defined}% \fi \fi \fi \edef\@{\endgroup %%% \noexpand\PackageError{patchcmd}{% %%% \the\toks@: \string#1}\noexpand\@ehd}% \noexpand\@memerror{% \the\toks@: \string#1}\noexpand\@ehd}% \@} %%%%%%%%%%%%%%%%%%%%% end of patchcmd code %%%%%%%%%%%%%%%%%%%%%%%%%%% % \end{macrocode} % \end{macro} % % Prevent later loading of the original \Lpack{patchcmd} package. % \begin{macrocode} %%\@memfakeusepackage{patchcmd} % \end{macrocode} % % \changes{v1.61803398}{2009/07/18}{Added support for bidi} % \subsection{Support for the bidi package (RTL typesetting)} % % The \Lpack{bidi} package (system) enables bidirectional typesetting. % As part of % being able to accomplish this it often needs to exchange, for example, % \cs{leftskip} and \cs{rightskip} depending on whether it is setting % left-to-right (LTR) or right-to-left (RTL). In the case of \Lpack{memoir} % the initial \Lpack{bidi} system implementation used a \Lpack{bidimemoir} % class developed by Vafa Khalighi. Now, with Vafa's help, the necessary % changes have been incorporated in \Lpack{memoir}; the \Lpack{bidimemoir} % class is no longer needed. % % \begin{macro}{\memRTLleftskip} % \begin{macro}{\memRTLrightskip} % \begin{macro}{\memRTLvleftskip} % \begin{macro}{\memRTLvrightskip} % \begin{macro}{\memRTLraggedright} % \begin{macro}{\memRTLraggedleft} % \begin{macro}{\memRTLmainraggedright} % \begin{macro}{\memRTLmainraggedleft} % These are the hooks required to support the \Lpack{bidi} package, % plus some we added that \Lpack{bidi} can use. The idea behind the % \cs{XmainraggedX} macros are documents fully in RTL mode, then it % makes sense to have the raggedness of the header and footer % reversed. By default they do what the normally do, but in main RTL % mode, \Lpack{bidi} can redefine them to reverse the order of the % headers, i.e. the `left' part of the header is typeset as the % `right' part. % \changes{v3.6h}{2010/10/22}{Added \cs{mem@RTLmainraggedX} macros} % \begin{macrocode} \newcommand*{\memRTLleftskip}{\leftskip} \newcommand*{\memRTLrightskip}{\rightskip} \newcommand*{\memRTLvleftskip}{\leftskip} \newcommand*{\memRTLvrightskip}{\rightskip} \newcommand*{\memRTLraggedright}{\raggedright} \newcommand*{\memRTLraggedleft}{\raggedleft} \newcommand*{\memRTLmainraggedright}{\raggedright} \newcommand*{\memRTLmainraggedleft}{\raggedleft} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % It is expected that the \Lpack{bidi} package will redefine these as: % \begin{verbatim} % \renewcommand*{\memRTLleftskip}{\if@RTL\rightskip\else\leftskip\fi} % \renewcommand*{\memRTLrightskip}{\if@RTL\leftskip\else\rightskip\fi} % \renewcommand*{\memRTLvleftskip}{\if@RTL\vrightskip\else\vleftskip\fi} % \renewcommand*{\memRTLvrightskip}{\if@RTL\vleftskip\else\vrightskip\fi} % \renewcommand*{\memRTLraggedright}{\if@RTL\raggedleft\else\raggedright\fi} % \renewcommand*{\memRTLraggedleft}{\if@RTL\raggedright\else\raggedleft\fi} % \renewcommand*{\memRTLmainraggedright}{\if@RTLmain\raggedleft\else\raggedright\fi} % \renewcommand*{\memRTLmainraggedleft}{\if@RTLmain\raggedright\else\raggedleft\fi} % \end{verbatim} % % \section{Declaration of Options} \label{sec:opt} % % % \subsection{Setting Paper Sizes} % % The variables \cs{paperheight} and \cs{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 \cs{stockheight} and \cs{stockwidth} should be the height and % width of the stock sheet before trimming. For example, this is the % physical size % of a single sheet that might be laser-printed. The lengths \cs{trimtop} % and \cs{trimedge} are the amount that will be trimmed off the top and fore % edge of the physical sheet. % For desk printer output the size of the trimmed sheet is often the % same as the physical sheet. In other words the \cs{paper...} and \cs{stock...} % sizes are the same and the trims are zero. This class assumes that this % is the normal case. % \begin{macrocode} \newlength{\stockheight} \newlength{\stockwidth} \newlength{\trimtop} \newlength{\trimedge} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % The class provides an extended range of stock sizes. It may be useful at some % point to have macros for these. % % \begin{macro}{\stockdbill} % \begin{macro}{\stockstatement} % \begin{macro}{\stockexecutive} % \begin{macro}{\stockletter} % \begin{macro}{\stockold} % \begin{macro}{\stocklegal} % \begin{macro}{\stockledger} % \begin{macro}{\stockbroadsheet} % US stock sizes. % \changes{v1.61803}{2008/01/30}{Major expansion of stock size options} % \begin{macrocode} \newcommand*{\stockdbill} {\stockheight=7in \stockwidth=3in} \newcommand*{\stockstatement} {\stockheight=8.5in \stockwidth=5.5in} \newcommand*{\stockexecutive} {\stockheight=10.5in \stockwidth=7.25in} \newcommand*{\stockletter} {\stockheight=11in \stockwidth=8.5in} \newcommand*{\stockold} {\stockheight=12in \stockwidth=9in} \newcommand*{\stocklegal} {\stockheight=14in \stockwidth=8.5in} \newcommand*{\stockledger} {\stockheight=17in \stockwidth=11in} \newcommand*{\stockbroadsheet}{\stockheight=22in \stockwidth=17in} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\stockpottvo} % \begin{macro}{\stockfoolscapvo} % \begin{macro}{\stockcrownvo} % \begin{macro}{\stockpostvo} % \begin{macro}{\stocklargecrownvo} % \begin{macro}{\stocklargepostvo} % \begin{macro}{\stocksmalldemyvo} % Traditional British octavo sizes. % \begin{macrocode} \newcommand*{\stockpottvo} {\stockheight=6.25in \stockwidth=4in} \newcommand*{\stockfoolscapvo} {\stockheight=6.75in \stockwidth=4.25in} \newcommand*{\stockcrownvo} {\stockheight=7.5in \stockwidth=5in} \newcommand*{\stockpostvo} {\stockheight=8in \stockwidth=5in} \newcommand*{\stocklargecrownvo}{\stockheight=8in \stockwidth=5.25in} \newcommand*{\stocklargepostvo} {\stockheight=8.25in \stockwidth=5.25in} \newcommand*{\stocksmalldemyvo} {\stockheight=8.5in \stockwidth=5.675in} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\stockdemyvo} % \begin{macro}{\stockmediumvo} % \begin{macro}{\stocksmallroyalvo} % \begin{macro}{\stockroyalvo} % \begin{macro}{\stocksuperroyalvo} % \begin{macro}{\stockimperialvo} % \begin{macrocode} \newcommand*{\stockdemyvo} {\stockheight=8.75in \stockwidth=5.675in} \newcommand*{\stockmediumvo} {\stockheight=9in \stockwidth=5.75in} \newcommand*{\stocksmallroyalvo}{\stockheight=9.25in \stockwidth=6.175in} \newcommand*{\stockroyalvo} {\stockheight=10in \stockwidth=6.25in} \newcommand*{\stocksuperroyalvo}{\stockheight=10.25in \stockwidth=6.75in} \newcommand*{\stockimperialvo} {\stockheight=11in \stockwidth=7.5in} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\stockmcrownvo} % \begin{macro}{\stockmlargecrownvo} % \begin{macro}{\stockmdemyvo} % \begin{macro}{\stockmsmallroyalvo} % Metric stock sizes. % \begin{macrocode} \newcommand*{\stockmcrownvo} {\stockheight=186mm \stockwidth=123mm} \newcommand*{\stockmlargecrownvo} {\stockheight=198mm \stockwidth=129mm} \newcommand*{\stockmdemyvo} {\stockheight=216mm \stockwidth=138mm} \newcommand*{\stockmsmallroyalvo} {\stockheight=234mm \stockwidth=156mm} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\stockao} % \begin{macro}{\stockai} % \begin{macro}{\stockaii} % \begin{macro}{\stockaiii} % \begin{macro}{\stockaiv} % \begin{macro}{\stockav} % \begin{macro}{\stockavi} % The A series, A0 --- A6. % \changes{v1.6180339c}{2008/12/26}{Extended the A and B stock/paper size % seies with A/B0 through A/B2} % \begin{macrocode} \newcommand*{\stockao} {\stockheight=1189mm \stockwidth=841mm} \newcommand*{\stockai} {\stockheight=841mm \stockwidth=594mm} \newcommand*{\stockaii} {\stockheight=594mm \stockwidth=420mm} \newcommand*{\stockaiii}{\stockheight=420mm \stockwidth=297mm} \newcommand*{\stockaiv} {\stockheight=297mm \stockwidth=210mm} \newcommand*{\stockav} {\stockheight=210mm \stockwidth=148mm} \newcommand*{\stockavi} {\stockheight=148mm \stockwidth=105mm} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\stockbo} % \begin{macro}{\stockbi} % \begin{macro}{\stockbii} % \begin{macro}{\stockbiii} % \begin{macro}{\stockbiv} % \begin{macro}{\stockbv} % \begin{macro}{\stockbvi} % The B series, B0 --- B6. % \begin{macrocode} \newcommand*{\stockbo} {\stockheight=1414mm \stockwidth=1000mm} \newcommand*{\stockbi} {\stockheight=1000mm \stockwidth=707mm} \newcommand*{\stockbii} {\stockheight=707mm \stockwidth=500mm} \newcommand*{\stockbiii}{\stockheight=500mm \stockwidth=353mm} \newcommand*{\stockbiv} {\stockheight=353mm \stockwidth=250mm} \newcommand*{\stockbv} {\stockheight=250mm \stockwidth=176mm} \newcommand*{\stockbvi} {\stockheight=176mm \stockwidth=125mm} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % It will be useful also to provide macros that set the page sizes. % % \begin{macro}{\pagedbill} % \begin{macro}{\pagestatement} % \begin{macro}{\pageexecutive} % \begin{macro}{\pageletter} % \begin{macro}{\pageold} % \begin{macro}{\pagelegal} % \begin{macro}{\pageledger} % \begin{macro}{\pagebroadsheet} % \changes{v1.6180339c}{\cs{pageheight} and \cs{pagewidth} should be % \cs{paperheight} and \cs{paperwidth} % (courtesy Wilhelm Muller)} % US page sizes. % \begin{macrocode} \newcommand*{\pagedbill} {\paperheight=7in \paperwidth=3in} \newcommand*{\pagestatement} {\paperheight=8.5in \paperwidth=5.5in} \newcommand*{\pageexecutive} {\paperheight=10.5in \paperwidth=7.25in} \newcommand*{\pageletter} {\paperheight=11in \paperwidth=8.5in} \newcommand*{\pageold} {\paperheight=12in \paperwidth=9in} \newcommand*{\pagelegal} {\paperheight=14in \paperwidth=8.5in} \newcommand*{\pageledger} {\paperheight=17in \paperwidth=11in} \newcommand*{\pagebroadsheet}{\paperheight=22in \paperwidth=17in} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\pagepottvo} % \begin{macro}{\pagefoolscapvo} % \begin{macro}{\pagecrownvo} % \begin{macro}{\pagepostvo} % \begin{macro}{\pagelargecrownvo} % \begin{macro}{\pagelargepostvo} % \begin{macro}{\pagesmalldemyvo} % British traditional page sizes, octavo. % \begin{macrocode} \newcommand*{\pagepottvo} {\paperheight=6.25in \paperwidth=4in} \newcommand*{\pagefoolscapvo} {\paperheight=6.75in \paperwidth=4.25in} \newcommand*{\pagecrownvo} {\paperheight=7.5in \paperwidth=5in} \newcommand*{\pagepostvo} {\paperheight=8in \paperwidth=5in} \newcommand*{\pagelargecrownvo}{\paperheight=8in \paperwidth=5.25in} \newcommand*{\pagelargepostvo} {\paperheight=8.25in \paperwidth=5.25in} \newcommand*{\pagesmalldemyvo} {\paperheight=8.5in \paperwidth=5.675in} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\pagedemyvo} % \begin{macro}{\pagemediumvo} % \begin{macro}{\pagesmallroyalvo} % \begin{macro}{\pageroyalvo} % \begin{macro}{\pagesuperroyalvo} % \begin{macro}{\pageimperialvo} % \begin{macrocode} \newcommand*{\pagedemyvo} {\paperheight=8.75in \paperwidth=5.675in} \newcommand*{\pagemediumvo} {\paperheight=9in \paperwidth=5.75in} \newcommand*{\pagesmallroyalvo}{\paperheight=9.25in \paperwidth=6.175in} \newcommand*{\pageroyalvo} {\paperheight=10in \paperwidth=6.25in} \newcommand*{\pagesuperroyalvo}{\paperheight=10.25in \paperwidth=6.75in} \newcommand*{\pageimperialvo} {\paperheight=11in \paperwidth=7.5in} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\pagemcrownvo} % \begin{macro}{\pagemlargecrownvo} % \begin{macro}{\pagemdemyvo} % \begin{macro}{\pagemsmallroyalvo} % Metric sizes. % \begin{macrocode} \newcommand*{\pagemcrownvo} {\paperheight=186mm \paperwidth=123mm} \newcommand*{\pagemlargecrownvo} {\paperheight=198mm \paperwidth=129mm} \newcommand*{\pagemdemyvo} {\paperheight=216mm \paperwidth=138mm} \newcommand*{\pagemsmallroyalvo} {\paperheight=234mm \paperwidth=156mm} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\pageao} % \begin{macro}{\pageai} % \begin{macro}{\pageaii} % \begin{macro}{\pageaiii} % \begin{macro}{\pageaiv} % \begin{macro}{\pageav} % \begin{macro}{\pageavi} % The A series, A0 --- A6. % \begin{macrocode} \newcommand*{\pageao} {\paperheight=1189mm \paperwidth=841mm} \newcommand*{\pageai} {\paperheight=841mm \paperwidth=594mm} \newcommand*{\pageaii} {\paperheight=594mm \paperwidth=420mm} \newcommand*{\pageaiii}{\paperheight=420mm \paperwidth=297mm} \newcommand*{\pageaiv} {\paperheight=297mm \paperwidth=210mm} \newcommand*{\pageav} {\paperheight=210mm \paperwidth=148mm} \newcommand*{\pageavi} {\paperheight=148mm \paperwidth=105mm} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\pagebo} % \begin{macro}{\pagebi} % \begin{macro}{\pagebii} % \begin{macro}{\pagebiii} % \begin{macro}{\pagebiv} % \begin{macro}{\pagebv} % \begin{macro}{\pagebvi} % The B series, B0 --- B6. % \begin{macrocode} \newcommand*{\pagebo} {\paperheight=1414mm \paperwidth=1000mm} \newcommand*{\pagebi} {\paperheight=1000mm \paperwidth=707mm} \newcommand*{\pagebii} {\paperheight=707mm \paperwidth=500mm} \newcommand*{\pagebiii}{\paperheight=500mm \paperwidth=353mm} \newcommand*{\pagebiv} {\paperheight=353mm \paperwidth=250mm} \newcommand*{\pagebv} {\paperheight=250mm \paperwidth=176mm} \newcommand*{\pagebvi} {\paperheight=176mm \paperwidth=125mm} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % Declare the stock size options. % % Metric paper stock sizes. % \changes{v1.6180339c}{2008/12/26}{Extended class options to include stock % sizes A0, A1, A2, B0, B1 and B2} % \begin{macrocode} \DeclareOption{a0paper}{\stockao} \DeclareOption{a1paper}{\stockai} \DeclareOption{a2paper}{\stockaii} \DeclareOption{a3paper}{\stockaiii} \DeclareOption{a4paper}{\stockaiv} \DeclareOption{a5paper}{\stockav} \DeclareOption{a6paper}{\stockavi} \DeclareOption{b0paper}{\stockbo} \DeclareOption{b1paper}{\stockbi} \DeclareOption{b2paper}{\stockbii} \DeclareOption{b3paper}{\stockbiii} \DeclareOption{b4paper}{\stockbiv} \DeclareOption{b5paper}{\stockbv} \DeclareOption{b6paper}{\stockbvi} \DeclareOption{mcrownvopaper}{\stockmcrownvo} \DeclareOption{mlargecrownvopaper}{\stockmlargecrownvo} \DeclareOption{mdemyvopaper}{\stockmdemyvo} \DeclareOption{msmallroyalvopaper}{\stockmsmallroyalvo} % \end{macrocode} % US paper stock sizes. % \begin{macrocode} \DeclareOption{dbillpaper}{\stockdbill} \DeclareOption{statementpaper}{\stockstatement} \DeclareOption{executivepaper}{\stockexecutive} \DeclareOption{letterpaper}{\stockletter} \DeclareOption{oldpaper}{\stockold} \DeclareOption{legalpaper}{\stocklegal} \DeclareOption{ledgerpaper}{\stockledger} \DeclareOption{broadsheetpaper}{\stockbroadsheet} % \end{macrocode} % British octavo stock paper sizes. % \begin{macrocode} \DeclareOption{pottvopaper}{\stockpottvo} \DeclareOption{foolscapvopaper}{\stockfoolscapvo} \DeclareOption{crownvopaper}{\stockcrownvo} \DeclareOption{postvopaper}{\stockpostvo} \DeclareOption{largecrownvopaper}{\stocklargecrownvo} \DeclareOption{largepostvopaper}{\stocklargepostvo} \DeclareOption{smalldemyvopaper}{\stocksmalldemyvo} \DeclareOption{demyvopaper}{\stockdemyvo} \DeclareOption{mediumvopaper}{\stockmediumvo} \DeclareOption{smallroyalvopaper}{\stocksmallroyalvo} \DeclareOption{royalvopaper}{\stockroyalvo} \DeclareOption{superroyalvopaper}{\stocksuperroyalvo} \DeclareOption{imperialvopaper}{\stockimperialvo} % \end{macrocode} % Ebook. % \begin{macrocode} \DeclareOption{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. (At the suggestion of Wilhelm M\"{u}ller made this independent % of the option sequence). % \changes{v1.6180339c}{2008/12/26}{`Stabilised' the landscape option and % added a portrait option}. % \begin{macro}{\ifmemlandscape} % \begin{macro}{\memlandscapetrue} % \begin{macro}{\memlandscapefalse} % \begin{macrocode} \newif\ifmemlandscape \memlandscapefalse % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macrocode} \DeclareOption{landscape}{\memlandscapetrue} \DeclareOption{portrait}{\memlandscapefalse} % \end{macrocode} % % % \subsection{Choosing the type size} % % The type size options are handled by defining \cs{@ptsize} to contain % the last digit of the size in question and branching on \cs{ifcase} % statements. This is done for historical reasons to stay compatible % with other packages that use the \cs{@ptsize} variable to select % special actions. It makes the declarations of size options less % than 10pt or more than 20pt difficult. In this class \texttt{9} is used % for the \Lopt{9pt} option, assuming that the class will never define a % \Lopt{19pt} option. For larger options the full complement of digits % are used. % % In any event, \cs{@memptsize} holds the complete size. % % Option \Lopt{10pt} will be the default. % \changes{v1.2}{2002/07/07}{Added 17pt option} % \changes{v1.61803}{2008/01/30}{Added pt options 20 to 60.} % \changes{v1.61803}{2008/01/30}{Used \cs{@memptsize}} % \begin{macrocode} \renewcommand*{\@ptsize}{0} \renewcommand*{\@memptsize}{10} \DeclareOption{9pt}{\renewcommand*{\@ptsize}{9}\renewcommand*{\@memptsize}{9}} \DeclareOption{10pt}{\renewcommand*{\@ptsize}{0}\renewcommand*{\@memptsize}{10}} \DeclareOption{11pt}{\renewcommand*{\@ptsize}{1}\renewcommand*{\@memptsize}{11}} \DeclareOption{12pt}{\renewcommand*{\@ptsize}{2}\renewcommand*{\@memptsize}{12}} \DeclareOption{14pt}{\renewcommand*{\@ptsize}{4}\renewcommand*{\@memptsize}{14}} \DeclareOption{17pt}{\renewcommand*{\@ptsize}{7}\renewcommand*{\@memptsize}{17}} \DeclareOption{20pt}{\renewcommand*{\@ptsize}{20}\renewcommand*{\@memptsize}{20}} \DeclareOption{25pt}{\renewcommand*{\@ptsize}{25}\renewcommand*{\@memptsize}{25}} \DeclareOption{30pt}{\renewcommand*{\@ptsize}{30}\renewcommand*{\@memptsize}{30}} \DeclareOption{36pt}{\renewcommand*{\@ptsize}{36}\renewcommand*{\@memptsize}{36}} \DeclareOption{48pt}{\renewcommand*{\@ptsize}{48}\renewcommand*{\@memptsize}{48}} \DeclareOption{60pt}{\renewcommand*{\@ptsize}{60}\renewcommand*{\@memptsize}{60}} % \end{macrocode} % % \begin{macro}{\if@nyptsizeopt} % \begin{macro}{\@nyptsizeopttrue} % \begin{macro}{\@nyptsizeoptfalse} % \begin{macro}{\anyptfilebase} % \begin{macro}{\anyptsize} % For any point size: % \changes{v1.61803}{2008/02/29}{Added *pt option} % \begin{macrocode} \newif\if@nyptsizeopt \@nyptsizeoptfalse \providecommand*{\anyptfilebase}{mem} \providecommand*{\anyptsize}{10} \DeclareOption{*pt}{\@nyptsizeopttrue} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \subsection{Two-side or one-side printing} % % For two-sided printing we use the switch \cs{if@twoside}. In % addition we have to set the \cs{if@mparswitch} to get any margin % paragraphs into the outside margin. The default is \Lopt{twoside}. % \begin{macro}{\if@twoside} % \begin{macro}{\if@mparswitch} % \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 \cs{ifdraftdoc} flag to add additional effects: \\ % \verb?\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} % \cs{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 % and finally removed in version 1.61803. It was: % \changes{v0.3}{2001/07/09}{Added subfigure option} % \changes{v1.1}{2002/03/10}{Effectively removed subfigure option} % \changes{v1.61803}{2008/01/30}{Removed subfigure option} % \begin{verbatim} % \DeclareOption{subfigure}{% % \ClassWarningNoLine{memoir}{The subfigure option is not required}} % \end{verbatim} % % \subsection{The openright, openleft and openany options} % % 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 \cs{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 \verb?thebibliography? so that each % block starts on a new line, and succeeding lines in a block are % indented by \cs{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 \cs{bf} and friends. % \changes{v1.0a}{2002/01/29}{Added the oldfontcommands option} % \begin{macrocode} \DeclareOption{oldfontcommands}{\@memoldfonttrue} % \end{macrocode} % % \subsection{Extra font sizes} % % The \Lopt{extrafontsizes} options indicates that extended font sizes (above 25pt) % are available. % \changes{v1.61803}{2008/01/30}{Added extrafontsizes option.} % \begin{macrocode} \DeclareOption{extrafontsizes}{\extrafontsizestrue} % \end{macrocode} % % % \changes{v1.6180339f}{2009/07/12}{Added dead man switch for etex} % \subsection{ETeX} % % If found we automatically load the eTeX package right after % executing the class options. Though, some odd \LaTeX\ installations % may have the eTeX pacakge, but is not based on eTeX (eventhough that % is what the LaTeX-project have recommended for several years now), % so we add a dead mans switch to disable the loading. % \begin{macro}{\ifmem@noetex} % \begin{macro}{\mem@noetextrue} % \begin{macro}{\mem@noetexfalse} % \begin{macrocode} \newif\ifmem@noetex \mem@noetexfalse \DeclareOption{noetex}{\mem@noetextrue} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \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, portrait} % \end{macrocode} % % The \cs{ProcessOptions} command causes the execution of the code % for every option \Lopt{foo} % which is declared and for which the user typed % the \Lopt{foo} option in his % \cs{documentclass} command. For every option \Lopt{bar} he typed, % which is not declared, the option is assumed to be a global option. % All options will be passed as document options to any % \cs{usepackage} command in the document preamble. % % \cs{ProcessOptions*} processes the options in the order they are given % in the \cs{documentclass} command, instead of the definition order. % \changes{v1.6180339c}{2008/12/26}{Change \cs{ProcessOptions} to % \cs{ProcessOptions*} and handle landscape/portrait % option after \cs{ProcessOptions*}} % \begin{macrocode} \ProcessOptions* \ifmemlandscape \setlength\@tempdima {\stockheight} \setlength\stockheight{\stockwidth} \setlength\stockwidth {\@tempdima} \fi % \end{macrocode} % Load the eTeX package if found, and if the user has not explicitly % asked us not to. % \begin{macrocode} \ifmem@noetex\relax\else \IfFileExists{etex.sty}{\RequirePackage{etex}}{} \fi % \end{macrocode} % \begin{macro}{\memoirpostopthook} % A user could define this \emph{before} the \cs{documentclass} command % to do something at this point. For example, to set up a new stock size: \\ % \verb?\def\memoirpostopthook{\stockheight=44in \stockwidth=34in}? % \changes{v1.618033}{2008/06/02}{Added \cs{memoirpostopthook}} % \begin{macrocode} \providecommand*{\memoirpostopthook}{} \memoirpostopthook % \end{macrocode} % \end{macro} % % \begin{macro}{\cleartorecto} % A repeat of \cs{cleardoublepage}; clears to a recto (odd-numbered) page. % \begin{macrocode} \def\cleartorecto{\clearpage\if@twoside \ifodd\c@page\else \hbox{}\thispagestyle{cleared}% \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 \cs{clearforchapter} according to the options. % \begin{macrocode} \if@openleft \openleft \else \if@openright \openright \else \openany \fi \fi % \end{macrocode} % % \begin{macro}{\@ivpt} % \begin{macro}{\@xxxpt} % \begin{macro}{\@xxxvipt} % \begin{macro}{\@xlviiipt} % \begin{macro}{\@lxpt} % \begin{macro}{\@lxxiipt} % \begin{macro}{\@lxxxivpt} % \begin{macro}{\@xcvipt} % \begin{macro}{\@cviiipt} % \begin{macro}{\@cxxpt} % \begin{macro}{\@cxxxiipt} % \changes{v1.61803}{2008/01/30}{Added a bunch of \cs{@...pt} macros} % \begin{macrocode} \newcommand*{\@ivpt}{4} \newcommand*{\@xxxpt}{30} \newcommand*{\@xxxvipt}{36} \newcommand*{\@xlviiipt}{48} \newcommand*{\@lxpt}{60} \newcommand*{\@lxxiipt}{72} \newcommand*{\@lxxxivpt}{84} \newcommand*{\@xcvipt}{96} \newcommand*{\@cviiipt}{108} \newcommand*{\@cxxpt}{120} \newcommand*{\@cxxxiipt}{132} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % Now that all the options have been executed we can load the % chosen class option file that contains all size dependent code. The % larger sizes are only made available for the \Lopt{extrafontsizes} option. % % \begin{macro}{\memfontfamily} % \begin{macro}{\memfontenc} % \begin{macro}{\memfontpack} % The default font and coding as set by the kernel is \texttt{cmr} and % \texttt{OT1} respectively, giving Knuth's original Computer Modern Roman % font at a set of fixed sizes (maximum of 24.88pt). If we are to have % any size font we have to go to a scaleable font. As the Latin Modern font % is a scaleable version of Computer Modern, and all modern LaTeX distributions % include it, I am using this by default. % % By defining these three macros \emph{before} % the \cs{documentclass} any other font and package can be used. % \begin{macrocode} \providecommand*{\memfontfamily}{lmr} \providecommand*{\memfontenc}{T1} \providecommand*{\memfontpack}{lmodern} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % Deal with the `anyptsize' (\Lopt{*pt}) option first. In this case the macros % \cs{anyptfilebase} and \cs{anyptsize} should have been defined by the % author \emph{before} the \cs{documentclass} command, and a file \\ % \verb?\anyptfilebase\anyptsize.clo? should exist (if not the file will % default to \verb?mem10.clo?). % \changes{v1.61803}{2008/01/30}{Extended the loading of \texttt{.clo} files.} % \begin{macrocode} \if@nyptsizeopt \newcommand*{\@nyptclofile}{\anyptfilebase\anyptsize.clo} \IfFileExists{\@nyptclofile}{\def\@memptsize{\anyptsize}}{% \@memerror{You have used the `*pt' option but \MessageBreak file \@nyptclofile\space can't be found}% {I'll use mem10.clo instead} \renewcommand*{\@nyptclofile}{mem10.clo}% \def\@memptsize{10}% } \renewcommand*{\@ptsize}{\@memptsize} \usefont{\memfontenc}{\memfontfamily}{m}{n} \input{\@nyptclofile} \usepackage{\memfontpack}\usepackage[\memfontenc]{fontenc} \else % \end{macrocode} % Now for the fixed pt size options. % \begin{macrocode} \ifextrafontsizes \usefont{\memfontenc}{\memfontfamily}{m}{n} \input{mem\@memptsize.clo} \usepackage{\memfontpack}\usepackage[\memfontenc]{fontenc} \else \ifnum\@memptsize > 17\relax \@memerror{The `extrafontsizes' option is required to use \MessageBreak the `\@memptsize pt' option}% {The 17pt option will be used instead} \input{mem17.clo} \else \ifnum\@ptsize = 9\relax \input{mem\@ptsize.clo} \else \input{mem1\@ptsize.clo} \fi \fi \fi \fi % % \end{macrocode} % % % \section{Fonts and spaces} \label{sec:docl} % \label{sec:maincode} % % In this section we deal with most of the aspects that are related % to font sizes, and spacing that is related to the size of the body font. % % \subsection{Fonts} % % \LaTeX\ offers the user commands to change the size of the font, % relative to the `main' size. Each relative size changing command % \cs{size} executes the command % \verb?\@setfontsize\size? \meta{font-size} \meta{baselineskip} where: % % \begin{description} % \item[\meta{font-size}] The absolute size of the font to use from % now on. % % \item[\meta{baselineskip}] The normal value of \cs{baselineskip} % for the size of the font selected. (The actual value will be % \cs{baselinestretch} * \meta{baselineskip}.) % \end{description} % % A number of commands, defined in the \LaTeX\ kernel, shorten the % following definitions and are used throughout. They are listed in % the first part of Table~\ref{tab:sh}. Those in the second part are introduced % by the class. % % \begin{table} % \centering % \caption{Shorthand font point size commands}\label{tab:sh} % \begin{tabular}{ll@{\qquad}ll@{\qquad}ll} \hline % & & & & \cs{@ivpt} & 4 \\ % \cs{@vpt} & 5 & \cs{@vipt} & 6 & \cs{@viipt} & 7 \\ % \cs{@viiipt} & 8 & \cs{@ixpt} & 9 & \cs{@xpt} & 10 \\ % \cs{@xipt} & 10.95 & \cs{@xiipt} & 12 & \cs{@xivpt} & 14.4\\ % \cs{@xviipt} & 17.28 & \cs{@xxpt} & 20.74 & \cs{@xxvpt} & 24.88\\ \hline % \cs{@xxxpt} & 30 & \cs{@xxxvipt} & 36 & \cs{@xlviiipt} & 48 \\ % \cs{@lxpt} & 60 & \cs{@lxxiipt} & 72 & \cs{@lxxxivpt} & 84 \\ % \cs{@xcvipt} & 96 & \cs{@cviiipt} & 108 & \cs{@cxxpt} & 120 \\ % \cs{@cxxxiipt} & 132 \\ \hline % \end{tabular} % \end{table} % % \begin{macro}{\normalsize} % \begin{macro}{\@normalsize} % % The user level command for the main size is \cs{normalsize}. % Internally \LaTeX\ uses \cs{@normalsize} when it refers to the % main size. \cs{@normalsize} will be defined to work like % \cs{normalsize} if the latter is redefined from its default % definition (that just issues an error message). Otherwise, in the standard % classes \cs{@normalsize} simply selects a 10pt/12pt size, but here % it selects among the wider range. % % The \cs{normalsize} macro also sets new values for\\ % \cs{abovedisplayskip}, \cs{abovedisplayshortskip} and % \cs{belowdisplayshortskip}. % % For the larger sizes I have set \cs{abovedisplayskip} to the font size % and \cs{belowdisplayshortskip} to 0.5\cs{onelineskip}. % % \begin{macrocode} %<*9pt|10pt|11pt|12pt|14pt|17pt|20pt|25pt|30pt|36pt|48pt|60pt> % \end{macrocode} % \changes{v0.11 (mem14.clo)}{2001/10/30}{Changed baseline skip from 17.28pt to 17.5pt} % \changes{v1.61803}{2008/01/30}{Added files mem20.clo through mem60.clo} % \changes{v1.61803}{2008/01/30}{Changed .clo files to accomodate \cs{extrafontsizes}} % \begin{macrocode} \renewcommand{\normalsize}{% %<*9pt> \@setfontsize\normalsize\@ixpt\@xpt \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@ % %<*20pt> \@setfontsize\normalsize\@xxpt{25}% \abovedisplayskip 20\p@ \@plus5\p@ \@minus9\p@ \abovedisplayshortskip \z@ \@plus5\p@ \belowdisplayshortskip 12.5\p@ \@plus6\p@ \@minus3\p@ % %<*25pt> \@setfontsize\normalsize\@xxvpt{30}% \abovedisplayskip 25\p@ \@plus6\p@ \@minus10\p@ \abovedisplayshortskip \z@ \@plus6\p@ \belowdisplayshortskip 15\p@ \@plus7.5\p@ \@minus4\p@ % %<*30pt> \@setfontsize\normalsize\@xxxpt{37}% \abovedisplayskip 30\p@ \@plus7\p@ \@minus11\p@ \abovedisplayshortskip \z@ \@plus7\p@ \belowdisplayshortskip 18\p@ \@plus9\p@ \@minus4\p@ % %<*36pt> \@setfontsize\normalsize\@xxxvipt{45}% \abovedisplayskip 36\p@ \@plus8\p@ \@minus12\p@ \abovedisplayshortskip \z@ \@plus8\p@ \belowdisplayshortskip 22\p@ \@plus11\p@ \@minus5\p@ % %<*48pt> \@setfontsize\normalsize\@xlviiipt{60}% \abovedisplayskip 48\p@ \@plus9\p@ \@minus13\p@ \abovedisplayshortskip \z@ \@plus9\p@ \belowdisplayshortskip 30\p@ \@plus15\p@ \@minus7\p@ % %<*60pt> \@setfontsize\normalsize\@lxpt{72}% \abovedisplayskip 60\p@ \@plus10\p@ \@minus14\p@ \abovedisplayshortskip \z@ \@plus10\p@ \belowdisplayshortskip 36\p@ \@plus18\p@ \@minus9\p@ % % \end{macrocode} % The \cs{belowdisplayskip} is always equal to the % \cs{abovedisplayskip}. The parameters of the first level list are % always given by \cs{@listI}. % \begin{macrocode} \belowdisplayskip \abovedisplayskip \let\@listi\@listI} % \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 \cs{normalsize}. % (Robert Schlicht\footnote{\texttt{w.m.l@gmx.net}, via email on 2004/03/11.} % noted that in some cases \% signs were missing after \verb?\@setfontsize?). % % For the larger sizes I have set \cs{topsep} to 2/3\cs{onelineskip} % and \cs{parsep} to 1/2\cs{topsep}. % \changes{v1.61}{2004/03/12}{Added missing percent signs to some uses of % \cs{@setfontsize}} % \begin{macrocode} \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@ }% % %<*20pt> \@setfontsize\small\@xviipt{22}% \abovedisplayskip 17\p@ \@plus4\p@ \@minus8\p@ \abovedisplayshortskip \z@ \@plus4\p@ \belowdisplayshortskip 11\p@ \@plus4\p@ \@minus3\p@ \def\@listi{\leftmargin\leftmargini \topsep 14\p@ \@plus5\p@ \@minus7\p@ \parsep 7\p@ \@plus2\p@ \@minus3\p@ \itemsep \parsep}% % %<*25pt> \@setfontsize\small\@xxpt{25}% \abovedisplayskip 20\p@ \@plus5\p@ \@minus9\p@ \abovedisplayshortskip \z@ \@plus5\p@ \belowdisplayshortskip 12.5\p@ \@plus6\p@ \@minus3\p@ \def\@listi{\leftmargin\leftmargini \topsep 16\p@ \@plus5\p@ \@minus8\p@ \parsep 8\p@ \@plus3\p@ \@minus4\p@ \itemsep \parsep}% % %<*30pt> \@setfontsize\small\@xxvpt{30}% \abovedisplayskip 25\p@ \@plus6\p@ \@minus10\p@ \abovedisplayshortskip \z@ \@plus6\p@ \belowdisplayshortskip 15\p@ \@plus7.5\p@ \@minus4\p@ \def\@listi{\leftmargin\leftmargini \topsep 20\p@ \@plus7\p@ \@minus10\p@ \parsep 10\p@ \@plus4\p@ \@minus5\p@ \itemsep \parsep}% % %<*36pt> \@setfontsize\small\@xxxpt{37}% \abovedisplayskip 30\p@ \@plus7\p@ \@minus11\p@ \abovedisplayshortskip \z@ \@plus7\p@ \belowdisplayshortskip 18\p@ \@plus9\p@ \@minus4\p@ \def\@listi{\leftmargin\leftmargini \topsep 24\p@ \@plus8\p@ \@minus12\p@ \parsep 12\p@ \@plus4\p@ \@minus6\p@ \itemsep \parsep}% % %<*48pt> \@setfontsize\small\@xxxvipt{45}% \abovedisplayskip 36\p@ \@plus8\p@ \@minus12\p@ \abovedisplayshortskip \z@ \@plus8\p@ \belowdisplayshortskip 22\p@ \@plus11\p@ \@minus5\p@ \def\@listi{\leftmargin\leftmargini \topsep 30\p@ \@plus10\p@ \@minus15\p@ \parsep 15\p@ \@plus5\p@ \@minus7\p@ \itemsep \parsep}% % %<*60pt> \@setfontsize\small\@xlviiipt{60}% \abovedisplayskip 48\p@ \@plus9\p@ \@minus13\p@ \abovedisplayshortskip \z@ \@plus9\p@ \belowdisplayshortskip 30\p@ \@plus15\p@ \@minus7\p@ \def\@listi{\leftmargin\leftmargini \topsep 40\p@ \@plus13\p@ \@minus20\p@ \parsep 20\p@ \@plus6\p@ \@minus10\p@ \itemsep \parsep}% % \belowdisplayskip \abovedisplayskip } % \end{macrocode} % \end{macro} % % \begin{macro}{\footnotesize} % This code is similar to that for \cs{small}. % \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@ }% % %<*20pt> \@setfontsize\footnotesize\@xivpt{17.5}% \abovedisplayskip 14\p@ \@plus3\p@ \@minus8\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 7\p@ \@plus3.5\p@ \@minus3\p@ \def\@listi{\leftmargin\leftmargini \topsep 12\p@ \@plus4\p@ \@minus6\p@ \parsep 6\p@ \@plus2\p@ \@minus3\p@ \itemsep \parsep}% % %<*25pt> \@setfontsize\footnotesize\@xviipt{22}% \abovedisplayskip 17\p@ \@plus4\p@ \@minus8\p@ \abovedisplayshortskip \z@ \@plus4\p@ \belowdisplayshortskip 11\p@ \@plus4\p@ \@minus3\p@ \def\@listi{\leftmargin\leftmargini \topsep 14\p@ \@plus5\p@ \@minus7\p@ \parsep 7\p@ \@plus2\p@ \@minus3\p@ \itemsep \parsep}% % %<*30pt> \@setfontsize\footnotesize\@xxpt{25}% \abovedisplayskip 20\p@ \@plus5\p@ \@minus9\p@ \abovedisplayshortskip \z@ \@plus5\p@ \belowdisplayshortskip 12.5\p@ \@plus6\p@ \@minus3\p@ \def\@listi{\leftmargin\leftmargini \topsep 16\p@ \@plus5\p@ \@minus8\p@ \parsep 8\p@ \@plus3\p@ \@minus4\p@ \itemsep \parsep}% % %<*36pt> \@setfontsize\footnotesize\@xxvpt{30}% \abovedisplayskip 25\p@ \@plus6\p@ \@minus10\p@ \abovedisplayshortskip \z@ \@plus6\p@ \belowdisplayshortskip 15\p@ \@plus7.5\p@ \@minus4\p@ \def\@listi{\leftmargin\leftmargini \topsep 20\p@ \@plus7\p@ \@minus10\p@ \parsep 10\p@ \@plus4\p@ \@minus5\p@ \itemsep \parsep}% % %<*48pt> \@setfontsize\footnotesize\@xxxpt{37}% \abovedisplayskip 30\p@ \@plus7\p@ \@minus11\p@ \abovedisplayshortskip \z@ \@plus7\p@ \belowdisplayshortskip 18\p@ \@plus9\p@ \@minus4\p@ \def\@listi{\leftmargin\leftmargini \topsep 24\p@ \@plus8\p@ \@minus12\p@ \parsep 12\p@ \@plus4\p@ \@minus6\p@ \itemsep \parsep}% % %<*60pt> \@setfontsize\footnotesize\@xxxvipt{45}% \abovedisplayskip 36\p@ \@plus8\p@ \@minus12\p@ \abovedisplayshortskip \z@ \@plus8\p@ \belowdisplayshortskip 22\p@ \@plus11\p@ \@minus5\p@ \def\@listi{\leftmargin\leftmargini \topsep 30\p@ \@plus10\p@ \@minus15\p@ \parsep 15\p@ \@plus5\p@ \@minus7\p@ \itemsep \parsep}% % \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. The class provides two additional sizes, \cs{miniscule} % and \cs{HUGE}, with respect to the usual set. For the larger sizes (e.g., % 72pt and above) I have % made the \cs{baselineskip} approximately 20 precent larger than the pt size. % \changes{v1.2}{2002/07/27}{Added \cs{miniscule} and \cs{HUGE} font sizes} % \changes{v1.2}{2002/07/27}{Twiddled some font sizes to get regular steps} % \changes{v1.2a}{2002/08/27}{Fixed 12pt scriptsize bug} % \begin{macrocode} %<*9pt> \ifextrafontsizes \newcommand*{\miniscule}{\@setfontsize\miniscule\@ivpt{5}} \else \newcommand*{\miniscule}{\@setfontsize\miniscule\@vpt{6}} \fi \newcommand*{\tiny}{\@setfontsize\tiny\@vpt{6}} \newcommand*{\scriptsize}{\@setfontsize\scriptsize\@vipt{7}} \newcommand*{\large}{\@setfontsize\large\@xpt{12}} \newcommand*{\Large}{\@setfontsize\Large\@xipt{13.6}} \newcommand*{\LARGE}{\@setfontsize\LARGE\@xiipt{14.5}} \newcommand*{\huge}{\@setfontsize\huge\@xivpt{18}} \newcommand*{\Huge}{\@setfontsize\Huge\@xviipt{22}} \newcommand*{\HUGE}{\@setfontsize\HUGE\@xxpt{25}} % %<*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}} \ifextrafontsizes \newcommand*{\HUGE}{\@setfontsize\HUGE\@xxxpt{37}} \else \let\HUGE=\Huge \fi % %<*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}} \ifextrafontsizes \newcommand*{\Huge}{\@setfontsize\Huge\@xxxpt{37}} \newcommand*{\HUGE}{\@setfontsize\HUGE\@xxxvipt{45}} \else \let\Huge=\huge \let\HUGE=\huge \fi % %<*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}} \ifextrafontsizes \newcommand*{\huge}{\@setfontsize\Huge\@xxxpt{37}} \newcommand*{\Huge}{\@setfontsize\Huge\@xxxvipt{45}} \newcommand*{\HUGE}{\@setfontsize\HUGE\@xlviiipt{60}} \else \let\huge=\LARGE \let\Huge=\LARGE \let\HUGE=\LARGE \fi % %<*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}} \ifextrafontsizes \newcommand*{\LARGE}{\@setfontsize\LARGE\@xxxpt{37}} \newcommand*{\huge}{\@setfontsize\huge\@xxxvipt{45}} \newcommand*{\Huge}{\@setfontsize\Huge\@xlviiipt{60}} \newcommand*{\HUGE}{\@setfontsize\HUGE\@lxpt{72}} \else \let\LARGE=\Large \let\huge=\Large \let\Huge=\Large \let\HUGE=\Large \fi % %<*20pt> \newcommand*{\miniscule}{\@setfontsize\miniscule\@xpt{12}} \newcommand*{\tiny}{\@setfontsize\tiny\@xipt{13.6}} \newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xiipt{14.5}} \newcommand*{\large}{\@setfontsize\large\@xxvpt{30}} \newcommand*{\Large}{\@setfontsize\Large\@xxxpt{37}} \newcommand*{\LARGE}{\@setfontsize\LARGE\@xxxvipt{45}} \newcommand*{\huge}{\@setfontsize\huge\@xlviiipt{60}} \newcommand*{\Huge}{\@setfontsize\Huge\@lxpt{72}} \newcommand*{\HUGE}{\@setfontsize\HUGE\@lxxiipt{86}} % %<*25pt> \newcommand*{\miniscule}{\@setfontsize\miniscule\@xipt{13.6}} \newcommand*{\tiny}{\@setfontsize\tiny\@xiipt{14.5}} \newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xivpt{17.5}} \newcommand*{\large}{\@setfontsize\large\@xxxpt{37}} \newcommand*{\Large}{\@setfontsize\Large\@xxxvipt{45}} \newcommand*{\LARGE}{\@setfontsize\LARGE\@xlviiipt{60}} \newcommand*{\huge}{\@setfontsize\huge\@lxpt{72}} \newcommand*{\Huge}{\@setfontsize\Huge\@lxxiipt{86}} \newcommand*{\HUGE}{\@setfontsize\HUGE\@lxxxivpt{100}} % %<*30pt> \newcommand*{\miniscule}{\@setfontsize\miniscule\@xiipt{14.5}} \newcommand*{\tiny}{\@setfontsize\tiny\@xivpt{17.5}} \newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xviipt{22}} \newcommand*{\large}{\@setfontsize\large\@xxxvipt{45}} \newcommand*{\Large}{\@setfontsize\Large\@xlviiipt{60}} \newcommand*{\LARGE}{\@setfontsize\LARGE\@lxpt{72}} \newcommand*{\huge}{\@setfontsize\huge\@lxxiipt{86}} \newcommand*{\Huge}{\@setfontsize\Huge\@lxxxivpt{100}} \newcommand*{\HUGE}{\@setfontsize\HUGE\@xcvipt{116}} % %<*36pt> \newcommand*{\miniscule}{\@setfontsize\miniscule\@xivpt{17.5}} \newcommand*{\tiny}{\@setfontsize\tiny\@xviipt{22}} \newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xxpt{25}} \newcommand*{\large}{\@setfontsize\large\@xlviiipt{60}} \newcommand*{\Large}{\@setfontsize\Large\@lxpt{72}} \newcommand*{\LARGE}{\@setfontsize\LARGE\@lxxiipt{86}} \newcommand*{\huge}{\@setfontsize\huge\@lxxxivpt{100}} \newcommand*{\Huge}{\@setfontsize\Huge\@xcvipt{116}} \newcommand*{\HUGE}{\@setfontsize\HUGE\@cviiipt{132}} % %<*48pt> \newcommand*{\miniscule}{\@setfontsize\miniscule\@xviipt{22}} \newcommand*{\tiny}{\@setfontsize\tiny\@xxpt{25}} \newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xxvpt{30}} \newcommand*{\large}{\@setfontsize\large\@lxpt{72}} \newcommand*{\Large}{\@setfontsize\Large\@lxxiipt{86}} \newcommand*{\LARGE}{\@setfontsize\LARGE\@lxxxivpt{100}} \newcommand*{\huge}{\@setfontsize\huge\@xcvipt{116}} \newcommand*{\Huge}{\@setfontsize\Huge\@cviiipt{132}} \newcommand*{\HUGE}{\@setfontsize\HUGE\@cxxpt{144}} % %<*60pt> \newcommand*{\miniscule}{\@setfontsize\miniscule\@xxpt{25}} \newcommand*{\tiny}{\@setfontsize\tiny\@xxvpt{30}} \newcommand*{\scriptsize}{\@setfontsize\scriptsize\@xxxpt{37}} \newcommand*{\large}{\@setfontsize\large\@lxxiipt{86}} \newcommand*{\Large}{\@setfontsize\Large\@lxxxivpt{100}} \newcommand*{\LARGE}{\@setfontsize\LARGE\@xcvipt{116}} \newcommand*{\huge}{\@setfontsize\huge\@cviiipt{132}} \newcommand*{\Huge}{\@setfontsize\Huge\@cxxpt{144}} \newcommand*{\HUGE}{\@setfontsize\HUGE\@cxxxiipt{162}} % % \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 \cs{baselineskip}. The default is % to \emph{not} stretch the baselines. % \begin{macrocode} \renewcommand{\baselinestretch}{} % \end{macrocode} % \end{macro} % % % \begin{macro}{\parskip} % \begin{macro}{\onelineskip} % % \cs{parskip} is additional vertical space between paragraphs; default % is zero. % % % \cs{onelineskip} is the default space between baselines. % \changes{v0.11 (mem14.clo)}{2001/10/30}{Changed \cs{onelineskip} from 17.28pt to 17.5pt} % \begin{macrocode} \setlength\parskip{0\p@ \@plus \p@} % %<*9pt|10pt|11pt|12pt|14pt|17pt|20pt|25pt|30pt|36pt|48pt|60pt> %<9pt>\setlength{\onelineskip}{\@xpt\p@} %<10pt>\setlength{\onelineskip}{\@xiipt\p@} %<11pt>\setlength{\onelineskip}{13.6\p@} %<12pt>\setlength{\onelineskip}{14.5\p@} %<14pt>\setlength{\onelineskip}{17.5\p@} %<17pt>\setlength{\onelineskip}{22\p@} %<20pt>\setlength{\onelineskip}{25\p@} %<25pt>\setlength{\onelineskip}{30\p@} %<30pt>\setlength{\onelineskip}{37\p@} %<36pt>\setlength{\onelineskip}{45\p@} %<48pt>\setlength{\onelineskip}{60\p@} %<60pt>\setlength{\onelineskip}{72\p@} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\parindent} % \cs{parskip} gives extra vertical space between paragraphs and % \cs{parindent} is the width of the paragraph indentation. % \begin{macrocode} \if@twocolumn \setlength\parindent{1em} \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} %<20pt> \setlength\parindent{1.5em} %<25pt> \setlength\parindent{1.5em} %<30pt> \setlength\parindent{1.5em} %<36pt> \setlength\parindent{1.5em} %<48pt> \setlength\parindent{1.5em} %<60pt> \setlength\parindent{1.5em} \fi % % \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, but I have changed them for % the larger sizes (\cs{smallskipamount} is 1/4 the fontsize, and the others % each double up on the next lower). % \changes{v1.61803}{2008/01/30}{(small/med/big)skips not invraiant for larger font sizes.} % \changes{v1.61803}{2008/01/30}{Changed (small/med/big)skips for 17pt} % \begin{macrocode} %<*9pt|10pt|11pt|12pt|14pt> \setlength\smallskipamount{3\p@ \@plus 1\p@ \@minus 1\p@} \setlength\medskipamount{6\p@ \@plus 2\p@ \@minus 2\p@} \setlength\bigskipamount{12\p@ \@plus 4\p@ \@minus 4\p@} % %<*17pt|20pt|25pt|30pt|36pt|48pt|60pt> %<*17pt> \setlength\smallskipamount{4\p@ \@plus1\p@ \@minus1\p@} \setlength\medskipamount{8\p@ \@plus2\p@ \@minus2\p@} \setlength\bigskipamount{17\p@ \@plus4\p@ \@minus4\p@} % %<*20pt> \setlength\smallskipamount{5\p@ \@plus1\p@ \@minus1\p@} \setlength\medskipamount{10\p@ \@plus2\p@ \@minus2\p@} \setlength\bigskipamount{20\p@ \@plus4\p@ \@minus4\p@} % %<*25pt> \setlength\smallskipamount{6\p@ \@plus1\p@ \@minus1\p@} \setlength\medskipamount{12\p@ \@plus2\p@ \@minus2\p@} \setlength\bigskipamount{24\p@ \@plus4\p@ \@minus4\p@} % %<*30pt> \setlength\smallskipamount{5\p@ \@plus1\p@ \@minus1\p@} \setlength\medskipamount{10\p@ \@plus2\p@ \@minus2\p@} \setlength\bigskipamount{20\p@ \@plus4\p@ \@minus4\p@} % %<*36pt> \setlength\smallskipamount{9\p@ \@plus2\p@ \@minus2\p@} \setlength\medskipamount{18\p@ \@plus4\p@ \@minus4\p@} \setlength\bigskipamount{36\p@ \@plus8\p@ \@minus8\p@} % %<*48pt> \setlength\smallskipamount{12\p@ \@plus3\p@ \@minus3\p@} \setlength\medskipamount{24\p@ \@plus6\p@ \@minus6\p@} \setlength\bigskipamount{48\p@ \@plus12\p@ \@minus12\p@} % %<*60pt> \setlength\smallskipamount{15\p@ \@plus4\p@ \@minus4\p@} \setlength\medskipamount{30\p@ \@plus8\p@ \@minus8\p@} \setlength\bigskipamount{60\p@ \@plus16\p@ \@minus16\p@} % % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\@lowpenalty} % \begin{macro}{\@medpenalty} % \begin{macro}{\@highpenalty}% % The commands \cs{nopagebreak} and \cs{nolinebreak} put in penalties % to discourage these breaks at the point they are put in. % They use \cs{@lowpenalty}, \cs{@medpenalty} or \cs{@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} % % % % % \subsection{Vertical spacing} % % \begin{macro}{\headheight} % \begin{macro}{\headsep} % \begin{macro}{\topskip} % \begin{macro}{\footskip} % The \cs{headheight} is the height of the box that will contain the % running head. In this class it is point size dependent --- % \cs{onelineskip} (normally it is a constant 12pt). % % The \cs{headsep} is the distance between the bottom % of the running head and the top of the text. For the larger sizes % this is 1.8 times the fontsize. % % The \cs{topskip} is the \cs{baselineskip} for the first line on a page; % \LaTeX's output routine will not work properly if it has the % value 0pt, so do not do that! For the lareger sizes this is the font size. % % The distance from the baseline of the box which contains the % running footer to the baseline of last line of text is controlled % by the \cs{footskip}. For the larger sizes this is 2.5 times the % font size. % \changes{v0.11 (mem14.clo)}{2001/10/30}{Changed \cs{headheight} from 16pt to 17.5pt} % \changes{v0.11 (mem11.clo)}{2002/03/10}{Changed \cs{headheight} from 13pt to 13.6pt} % \changes{v0.4b (mem12.clo)}{2010/10/19}{Changed \cs{headheight} from 14pt to 14.5pt} % \begin{macrocode} % %<*9pt|10pt|11pt|12pt|14pt|17pt|20pt|25pt|30pt|36pt|48pt|60pt> %<*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.5\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} % %<*20pt> \setlength\headheight{25\p@} \setlength\headsep{36\p@} \setlength\topskip{20\p@} \setlength\footskip{50\p@} % %<*25pt> \setlength\headheight{30\p@} \setlength\headsep{45\p@} \setlength\topskip{25\p@} \setlength\footskip{62\p@} % %<*30pt> \setlength\headheight{37\p@} \setlength\headsep{54\p@} \setlength\topskip{30\p@} \setlength\footskip{75\p@} % %<*36pt> \setlength\headheight{45\p@} \setlength\headsep{65\p@} \setlength\topskip{36\p@} \setlength\footskip{90\p@} % %<*48pt> \setlength\headheight{60\p@} \setlength\headsep{86\p@} \setlength\topskip{48\p@} \setlength\footskip{120\p@} % %<*60pt> \setlength\headheight{72\p@} \setlength\headsep{108\p@} \setlength\topskip{60\p@} \setlength\footskip{150\p@} % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\maxdepth} % \begin{macro}{\@maxdepth} % The \TeX\ primitive register \cs{maxdepth} has a function that is % similar to that of \cs{topskip}. The register \cs{@maxdepth} should % always contain a copy of \cs{maxdepth}. In both plain \TeX\ and % \LaTeX~2.09 \cs{maxdepth} had a fixed value of \texttt{4pt}; in % native \LaTeX 2e mode we let the value depend on the typesize. We % set it so that \cs{maxdepth} $+$ \cs{topskip} $=$ typesize $\times % 1.5$. As it happens, in these classes \cs{topskip} is equal to the % typesize, therefor we set \cs{maxdepth} to half the value of % \cs{topskip}. % \begin{macrocode} \setlength\maxdepth{.5\topskip} \setlength\@maxdepth\maxdepth % \end{macrocode} % \end{macro} % \end{macro} % % % % \subsection{Footnotes} % % \begin{macro}{\footnotesep} % \cs{footnotesep} is the height of the strut placed at the beginning % of every footnote. It equals the height of a normal \cs{footnotesize} % strut, so no extra space appears between footnotes. % \changes{v1.61803}{2007/01/30}{Changed nearly all \cs{footnotesep}} % \begin{macrocode} %<9pt>\setlength\footnotesep{5.6\p@} %<10pt>\setlength\footnotesep{6.65\p@} %<11pt>\setlength\footnotesep{7.7\p@} %<12pt>\setlength\footnotesep{8.4\p@} %<14pt>\setlength\footnotesep{9.5\p@} %<17pt>\setlength\footnotesep{10.15\p@} %<20pt>\setlength\footnotesep{12.6\p@} %<25pt>\setlength\footnotesep{15.4\p@} %<30pt>\setlength\footnotesep{17.5\p@} %<36pt>\setlength\footnotesep{21\p@} %<48pt>\setlength\footnotesep{25.9\p@} %<60pt>\setlength\footnotesep{31.5\p@} % \end{macrocode} % \end{macro} % % \begin{macro}{\footins} % \verb?\skip\footins? is the space between the last line of the main % text and the top of the first footnote. % \begin{macrocode} %<9pt>\setlength{\skip\footins}{8\p@ \@plus 2\p@ \@minus 2\p@} %<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}{16\p@ \@plus 5\p@ \@minus 3\p@} %<20pt>\setlength{\skip\footins}{19\p@ \@plus 7\p@ \@minus 3\p@} %<25pt>\setlength{\skip\footins}{24\p@ \@plus 8\p@ \@minus 4\p@} %<30pt>\setlength{\skip\footins}{29\p@ \@plus 10\p@ \@minus 5\p@} %<36pt>\setlength{\skip\footins}{35\p@ \@plus 12\p@ \@minus 6\p@} %<48pt>\setlength{\skip\footins}{47\p@ \@plus 16\p@ \@minus 8\p@} %<60pt>\setlength{\skip\footins}{59\p@ \@plus 20\p@ \@minus 10\p@} % \end{macrocode} % \end{macro} % % \subsection{Floats} % % \paragraph{Floats on a text page} % % \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. % % \cs{floatsep} is the space between adjacent floats that are moved % to the top or bottom of the text page. For the larger sizes this is % \cs{bigskip}. % % \cs{textfloatsep} is the space between the main text and floats % at the top or bottom of the page. For the larger sizes this is % 1.45\cs{onelineskip}. % % \cs{intextsep} is the space between in-text floats and the text. % \begin{macrocode} %<*9pt> \setlength\floatsep {12\p@ \@plus 2\p@ \@minus 2\p@} \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 4\p@ \@minus 5\p@} \intextsep \floatsep % %<*20pt> \setlength\floatsep {20\p@ \@plus 4\p@ \@minus 4\p@} \setlength\textfloatsep{36\p@ \@plus 4\p@ \@minus 8\p@} \intextsep \floatsep % %<*25pt> \setlength\floatsep {24\p@ \@plus 4\p@ \@minus 4\p@} \setlength\textfloatsep{43\p@ \@plus 4\p@ \@minus 8\p@} \intextsep \floatsep % %<*30pt> \setlength\floatsep {30\p@ \@plus 6\p@ \@minus 6\p@} \setlength\textfloatsep{54\p@ \@plus 6\p@ \@minus 12\p@} \intextsep \floatsep % %<*36pt> \setlength\floatsep {36\p@ \@plus 8\p@ \@minus 8\p@} \setlength\textfloatsep{65\p@ \@plus 8\p@ \@minus 16\p@} \intextsep \floatsep % %<*48pt> \setlength\floatsep {48\p@ \@plus 12\p@ \@minus 12\p@} \setlength\textfloatsep{87\p@ \@plus 12\p@ \@minus 24\p@} \intextsep \floatsep % %<*60pt> \setlength\floatsep {60\p@ \@plus 16\p@ \@minus 16\p@} \setlength\textfloatsep{104\p@ \@plus 16\p@ \@minus 32\p@} \intextsep \floatsep % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\dblfloatsep} % \begin{macro}{\dbltextfloatsep} % When floating objects that span the whole \cs{textwidth} are placed % on a text page and \LaTeX{} is in twocolumn mode the separation % between the float and the text is controlled by \cs{dblfloatsep} % and \cs{dbltextfloatsep}. % % \cs{dblfloatsep} is the space between adjacent floats that are moved % to the top or bottom of the text page. % % \cs{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@} % %<*20pt> \dblfloatsep \floatsep \dbltextfloatsep \textfloatsep % %<*25pt> \dblfloatsep \floatsep \dbltextfloatsep \textfloatsep % %<*30pt> \dblfloatsep \floatsep \dbltextfloatsep \textfloatsep % %<*36pt> \dblfloatsep \floatsep \dbltextfloatsep \textfloatsep % %<*48pt> \dblfloatsep \floatsep \dbltextfloatsep \textfloatsep % %<*60pt> \dblfloatsep \floatsep \dbltextfloatsep \textfloatsep % % \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 \cs{@fptop} amount of stretchable whitespace is inserted, at % the bottom of the page we get an \cs{@fpbot} amount of stretchable % whitespace. Between adjacent floats the \cs{@fpsep} is inserted. % For the larger sizes \cs{@fpsep} is .7\cs{onelineskip}. % % These parameters are used for the placement of floating objects % in one column mode, or in single column floats in two column % mode. % % Note that at least one of the two parameters \cs{@fptop} and % \cs{@fpbot} should contain a \verb?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} % %<*20pt> \setlength\@fptop{0\p@ \@plus 1fil} \setlength\@fpsep{17\p@ \@plus 2fil} \@fpbot \@fptop % %<*25pt> \setlength\@fptop{0\p@ \@plus 1fil} \setlength\@fpsep{21\p@ \@plus 2fil} \@fpbot \@fptop % %<*30pt> \setlength\@fptop{0\p@ \@plus 1fil} \setlength\@fpsep{26\p@ \@plus 2fil} \@fpbot \@fptop % %<*36pt> \setlength\@fptop{0\p@ \@plus 1fil} \setlength\@fpsep{31\p@ \@plus 2fil} \@fpbot \@fptop % %<*48pt> \setlength\@fptop{0\p@ \@plus 1fil} \setlength\@fpsep{42\p@ \@plus 2fil} \@fpbot \@fptop % %<*60pt> \setlength\@fptop{0\p@ \@plus 1fil} \setlength\@fpsep{50\p@ \@plus 2fil} \@fpbot \@fptop % % \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} % %<*20pt> \@dblfptop \@fptop \@dblfpsep \@fpsep \@dblfpbot \@dblfptop % %<*25pt> \@dblfptop \@fptop \@dblfpsep \@fpsep \@dblfpbot \@dblfptop % %<*30pt> \@dblfptop \@fptop \@dblfpsep \@fpsep \@dblfpbot \@dblfptop % %<*36pt> \@dblfptop \@fptop \@dblfpsep \@fpsep \@dblfpbot \@dblfptop % %<*48pt> \@dblfptop \@fptop \@dblfpsep \@fpsep \@dblfpbot \@dblfptop % %<*60pt> \@dblfptop \@fptop \@dblfpsep \@fpsep \@dblfpbot \@dblfptop % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \subsection{The measure} % % The width of a line of text (and therefore the text block) is termed % the \emph{measure}. % % \begin{macro}{\lxvchars} % The length \cs{lxvchars} is the approximate length of a normal % text line containing 65 characters (a typesetters rule of thumb is % that there should be about 60--70 characters per line). % \begin{macrocode} %<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@} % %<20pt>\setlength\lxvchars{528\p@} % %<25pt>\setlength\lxvchars{626\p@} % %<30pt>\setlength\lxvchars{748\p@} % %<36pt>\setlength\lxvchars{891\p@} % %<48pt>\setlength\lxvchars{1177\p@} % %<60pt>\setlength\lxvchars{1463\p@} % % \end{macrocode} % \end{macro} % % \begin{macro}{\xlvchars} % The length \cs{xlvchars} is the approximate length of a normal % double column text line containing 45 characters % (a typesetters rule of thumb is % that there should be about 40--50 characters per column line). % \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@} % %<20pt>\setlength\xlvchars{365\p@} % %<25pt>\setlength\xlvchars{438\p@} % %<30pt>\setlength\xlvchars{518\p@} % %<36pt>\setlength\xlvchars{617\p@} % %<48pt>\setlength\xlvchars{815\p@} % %<60pt>\setlength\xlvchars{1014\p@} % % \end{macrocode} % \end{macro} % % \begin{macro}{\marginparsep} % \begin{macro}{\marginparpush} % \cs{marginparsep} is the horizontal space between the text block and % marginal notes, while \cs{marginparpush} is the minimum vertical % separation between the notes. % \begin{macrocode} \if@twocolumn %<*9pt|10pt|11pt|12pt|14pt> \setlength\marginparsep{10\p@} % %<*17pt|20pt|25pt|30pt|36pt|48pt|60pt> \setlength\marginparsep{1em} % \else %<*9pt|10pt|11pt|12pt|14pt> \setlength\marginparsep{7\p@} % %<*17pt|20pt|25pt|30pt|36pt|48pt|60pt> \setlength\marginparsep{0.7em} % \fi %<9pt|10pt|11pt>\setlength{\marginparpush}{5\p@} %<12pt|14pt>\setlength{\marginparpush}{7\p@} %<*17pt|20pt|25pt|30pt|36pt|48pt|60pt> \setlength\marginparpush{0.5em} % % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macrocode} % %<*class> % \end{macrocode} % % \section{Page Layout} % % % \subsection{The typeblock and margins} % % All margin dimensions are measured from a point one inch from the % top and lefthand side of the page. % % \begin{macro}{\setlxvchars} % \begin{macro}{\setxlvchars} % These were suggested and supplied by Morten H{\o}gholm (18 May 2003). % % \cs{setlxvchars}\oarg{fontspec} sets \cs{lxvchars} to the length of a line % containing 65 characters in the \meta{fontspec}. % % Similarly % \cs{setxlvchars}\oarg{fontspec} sets \cs{xlvchars} for 45 characters. % \changes{v1.4}{2003/11/22}{Added \cs{setlxvchars} and \cs{setxlvchars} % (from patch v1.6)} % \begin{macrocode} \newcommand*{\setlxvchars}[1][\normalfont]{\begingroup #1 \settowidth{\lxvchars}{abcdefghijklmnopqrstuvwxyz}% \setlength{\lxvchars}{2.042\lxvchars}% \addtolength{\lxvchars}{33.41pt}% \global\lxvchars=\lxvchars \endgroup} \newcommand*{\setxlvchars}[1][\normalfont]{\begingroup #1 \settowidth{\xlvchars}{abcdefghijklmnopqrstuvwxyz}% \setlength{\xlvchars}{1.415\xlvchars}% \addtolength{\xlvchars}{23.03pt}% \global\xlvchars=\xlvchars \endgroup} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\setrectanglesize} % The macro \cs{setrectanglesize}\marg{H}\marg{W}\marg{r} % calculates the height and width of a rectangle given any two out of % the three arguments. An unvalued argument is denoted by \verb?*?. % % Table~\ref{tab:setrect} shows the argument combinations and the result % for each combination. % \begin{table} % \centering % \caption{Arguments and results for \cs{setrectanglesize}}\label{tab:setrect} % \begin{tabular}{ccc|l} \hline % H & W & r & Result \\ \hline % * & W & r & $H = rW$ \\{} % * & W & * & $H = W$ \\{} % * & * & r & ambiguous \\{} % * & * & * & ambiguous \\{} % H & W & r & $H, W$ \\ % H & W & * & $H, W$ \\ % H & * & r & $W = rH$ \\ % H & * & * & $W = H$ \\ % \hline % \end{tabular} % \end{table} % % The % calculated height and width are stored in \cs{@tempdima} and \cs{@tempdimb} % respectively. Both lengths are set to zero if there is an error. % \changes{v1.61803}{2008/01/30}{Used \cs{setlength} instead of TeX syntax so that the calc package % can be used with page layout (Morten H{\o}gholm mempatch v4.5)} % \begin{macrocode} \newcommand*{\setrectanglesize}[3]{% \nametest{#1}{*}% \ifsamename % H = * \nametest{#2}{*}% \ifsamename % W = * \@memerror{% The combination of argument values is ambiguous.\MessageBreak The lengths will be set to zero}{\@ehd}% \setlength{\@tempdima}{0pt}% \setlength{\@tempdimb}{0pt}% \else % W \nametest{#3}{*}% \ifsamename % r = * \setlength{\@tempdimb}{#2}% \setlength{\@tempdima}{\@tempdimb}% \else % r \setlength{\@tempdimb}{#2}% \setlength{\@tempdima}{#3\@tempdimb}% \fi \fi \else % H \nametest{#2}{*}% \ifsamename % W = * \nametest{#3}{*}% \ifsamename % r = * \setlength{\@tempdima}{#1}% \setlength{\@tempdimb}{\@tempdima}% \else % r \setlength{\@tempdima}{#1}% \setlength{\@tempdimb}{#3\@tempdima}% \fi \else % W \setlength{\@tempdima}{#1}% \setlength{\@tempdimb}{#2}% \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\setfillsize} % Consider a set of 4 lengths, $T$, $L$, $C$, and $R$, such that % $T = L + C + R$, where $T$ is a fixed size and normally $C$ is also fixed. % Also $L$ and $R$ may be specified independently of each other or as a % ratio (i.e., $L = rR$ or $R = rL$). % The macro % \cs{setfillsize}\marg{T}\marg{C}\marg{L}\marg{R}\marg{r} % maintains these constraints among the variables, where an unvalued % argument is denoted by \verb?*?. % % Table~\ref{tab:setfill} shows the argument combinations and the result % for each combination. % \begin{table} % \centering % \caption{Arguments and results for \cs{setfillsize}}\label{tab:setfill} % \begin{tabular}{cccc|ll} \hline % C & L & R & r & Result & \\ \hline % * & * & R & r & $L = rR$, & $C = T - L - R$ \\{} % * & * & R & * & $L = R$, & $C = T - L - R$ \\{} % * & * & * & r & ambigous & \\{} % * & * & * & * & ambiguous & \\{} % * & L & R & r & $L$, $R$, & $C = T - L - R$ \\{} % * & L & R & * & $L$, $R$, & $C = T - L - R$ \\{} % * & L & * & r & $R = rL$, & $C = T - L - R$ \\{} % * & L & * & * & $R = L$, & $C = T - L - R$ \\{} % C & * & R & r & $L = T - C - R$ & $C$ \\ % C & * & R & * & $L = T - C - R$, & $C$ \\ % C & * & * & r & $L + R = T - C$, $R = rL$, & $C$ \\ % C & * & * & * & $L + R = T - C$, $R = L$, & $C$ \\ % C & L & R & r & ambiguous & $C$ \\ % C & L & R & * & ambiguous & $C$ \\ % C & L & * & r & $R = T - C - L$, & $C$ \\ % C & L & * & * & $R = T - C - L$, & $C$ \\ % \hline % \end{tabular} % ^^A \MakeShortVerb{\|} % \end{table} % % % The % calculated values of \texttt{C}, \texttt{L} and \texttt{R} are stored % \cs{@tempdimc}, % \cs{@tempdima} and \cs{@tempdimb} respectively. If there is an error % the lengths are set to zero. % \begin{macrocode} \newcommand*{\setfillsize}[5]{% \nametest{#2}{*}% \ifsamename % C = * \nametest{#3}{*}% \ifsamename % L = * \nametest{#4}{*}% \ifsamename % R = * \@memerror{% The combination of argument values is ambiguous.\MessageBreak The lengths will be set to zero}{\@ehd} \setlength{\@tempdima}{0pt}% \setlength{\@tempdimb}{0pt}% \setlength{\@tempdimc}{0pt}% \else % R \nametest{#5}{*}% \ifsamename % r = * \setlength{\@tempdimb}{#4}% \setlength{\@tempdima}{\@tempdimb}% \setlength{\@tempdimc}{#1}% \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \else % r \setlength{\@tempdimb}{#4}% \setlength{\@tempdima}{#5\@tempdimb}% \setlength{\@tempdimc}{#1}% \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \fi \fi \else % L \nametest{#4}{*}% \ifsamename % R = * \nametest{#5}{*}% \ifsamename % r = * \setlength{\@tempdima}{#3}% \setlength{\@tempdimb}{\@tempdima} \setlength{\@tempdimc}{#1}% \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \else % r \setlength{\@tempdima}{#3}% \setlength{\@tempdimb}{#5\@tempdima} \setlength{\@tempdimc}{#1}% \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \fi \else % R \setlength{\@tempdima}{#3}% \setlength{\@tempdimb}{#4}% \setlength{\@tempdimc}{#1}% \advance\@tempdimc -\@tempdima \advance\@tempdimc -\@tempdimb \fi \fi \else % C is valued \nametest{#3}{*}% \ifsamename % L = * \nametest{#4}{*}% \ifsamename % R = * \nametest{#5}{*}% \ifsamename % r = * \setlength{\@tempdimc}{#2}% \setlength{\@tempdima}{#1}% \advance\@tempdima -\@tempdimc \@tempdima = 0.5\@tempdima \@tempdimb = \@tempdima \else % r (CODE PERHAPS FIXED) \setlength{\@tempdimc}{#2} % C \setlength{\@tempdimb}{#1} % T \advance\@tempdimb -\@tempdimc % T - C \@tempdima = 1000sp \setlength{\@tempdima}{#5\@tempdima} % 1000r sp \advance\@tempdima by 1000sp % 1000(1+r)sp \@tempcnta = \@tempdima % 1000(1+r) \@tempdima = \@tempdimb % T - C \divide\@tempdima by \@tempcnta % (T-C)/1000(1+r) pts \@tempdima = 1000\@tempdima % (T-C)/(1+r) pts = L \advance\@tempdimb by -\@tempdima % = R \fi \else % R \setlength{\@tempdimc}{#2}% \setlength{\@tempdimb}{#4}% \setlength{\@tempdima}{#1}% \advance\@tempdima -\@tempdimc \advance\@tempdima -\@tempdimb \fi \else % L \nametest{#4}{*}% \ifsamename % R = * \setlength{\@tempdimc}{#2}% \setlength{\@tempdima}{#3}% \setlength{\@tempdimb}{#1}% \advance\@tempdimb -\@tempdimc \advance\@tempdimb -\@tempdima \else % R \@memerror{% The combination of argument values is ambiguous.\MessageBreak The lengths will be set to zero}{\@ehd}% \setlength{\@tempdima}{0pt}% \setlength{\@tempdimb}{0pt}% \setlength{\@tempdimc}{#2}% \fi \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\setstocksize} % \begin{macro}{\settrims} % \begin{macro}{\settrimmedsize} % \cs{setstocksize}\marg{height}\marg{width} sets the height % and width of the stock material and % \cs{settrims}\marg{top}\marg{edge} sets the trim lengths % for the top and side (fore edge) of the stock. % The macro \cs{settrimmedsize}\marg{height}\marg{width}\marg{ratio} % sets the size for the trimmed page, based on \cs{setrectanglesize}. % \begin{macrocode} \newcommand{\setstocksize}[2]{% \setlength{\stockheight}{#1}% \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} % \cs{settypeblocksize}\marg{height}\marg{width}\marg{ratio} % calulates the \cs{textheight} and \cs{textwidth} from two out of the % three arguments. % \begin{macrocode} \newcommand{\settypeblocksize}[3]{% \setrectanglesize{#1}{#2}{#3}% \setlength{\textheight}{\@tempdima}% \setlength{\textwidth}{\@tempdimb}} % \end{macrocode} % \end{macro} % % \begin{macro}{\binding} % \begin{macro}{\setbinding} % The length \cs{binding} is an allowance on the spine margin for % binding. \cs{setbinding}\marg{length} sets the \cs{binding}. % \changes{v1.6180339c}{2008/12/29}{Added binding offset code to the % layout functions} % \begin{macrocode} \newlength{\binding} \newcommand*{\setbinding}[1]{\setlength{\binding}{#1}} \setbinding{0pt} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\spinemargin} % \begin{macro}{\foremargin} % \begin{macro}{\setlrmargins} % \cs{setlrmargins}\marg{L}\marg{R}\marg{r} sets the Left (spine) % and Right (fore edge) margins with constant typeblock. % \changes{v1.6180339c}{2008/12/29}{Added binding to \cs{setlrmargins}} % \begin{macrocode} \newlength{\spinemargin} \newlength{\foremargin} \newcommand{\setlrmargins}[3]{% \advance\paperwidth -\binding \setfillsize{\paperwidth}{\textwidth}{#1}{#2}{#3}% \setlength{\textwidth}{\@tempdimc}% \setlength{\spinemargin}{\@tempdima}% \setlength{\foremargin}{\@tempdimb}% \advance\paperwidth \binding \advance\spinemargin \binding} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\setlrmarginsandblock} % \cs{setlrmarginsandblock}\marg{L}\marg{R}\marg{r} sets the Left (spine) % and Right (fore edge) margins with variable typeblock. % \changes{v1.6180339c}{2008/12/29}{Added binding to \cs{setlrmarginsandblock}} % \begin{macrocode} \newcommand{\setlrmarginsandblock}[3]{% \advance\paperwidth -\binding \setfillsize{\paperwidth}{*}{#1}{#2}{#3}% \setlength{\textwidth}{\@tempdimc}% \setlength{\spinemargin}{\@tempdima}% \setlength{\foremargin}{\@tempdimb}% \advance\paperwidth \binding \advance\spinemargin \binding} % \end{macrocode} % \end{macro} % % \begin{macro}{\uppermargin} % \begin{macro}{\lowermargin} % \begin{macro}{\setulmargins} % \cs{setulmargins}\marg{L}\marg{R}\marg{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} % \cs{setulmarginsandblock}\marg{L}\marg{R}\marg{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} % \cs{setheaderspaces}\marg{L}\marg{R}\marg{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} % \cs{setheadfoot}\marg{headheight}\marg{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} % \cs{setcolsepandrule}\marg{colsep}\marg{thickness} % sets the column separation and the rule thickness. % \changes{v1.0}{2001/09/20}{Changed \cs{setcolseprule} to % \cs{setcolsepandrule} to match the documentation.} % \begin{macrocode} \newcommand{\setcolsepandrule}[2]{% \setlength{\columnsep}{#1}% \setlength{\columnseprule}{#2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\setmarginnotes} % \cs{setmarginnotes}\marg{sep}\marg{width}\marg{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 \cs{@tempdimb} to size-dependent initial line length and % set \cs{@tempdima} to the maximum textwidth for the paper width, % an inch margin on either side. In the standard classes the initial % line length is about 14\% greater than \cs{lxvchars}. % \begin{macrocode} \setlength{\@tempdimb}{1.14\lxvchars} \setlength\@tempdima{\paperwidth} \addtolength\@tempdima{-2in} % \end{macrocode} % % \begin{macro}{\textwidth} % Now set the \cs{textwidth} depending on the number of columns. In twocolumn % mode each column should be no wider than \cs{@tempdimb}. % \begin{macrocode} \if@twocolumn \ifdim\@tempdima>2\@tempdimb\relax \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 \cs{textheight} is the height of the text block, excluding % headers and footers. This is set according to the \cs{paperheight}, % to an integral number of lines, and allowing a 1in margin at the % top and bottom and a further 1.5in for headers and footers. % \begin{macrocode} \setlength\@tempdima{\paperheight} \addtolength\@tempdima{-3.5in} % \end{macrocode} % Divide this height by the \cs{baselineskip} to get the number of lines. % Then (re)calculate the \cs{textheight} and finally add the \cs{topskip}. % \begin{macrocode} \divide\@tempdima\baselineskip \@tempcnta=\@tempdima \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 isn't .4 \fi \ifdim\marginparwidth>2in \setlength\marginparwidth{2in}% \fi % \end{macrocode} % Set these values to integer numbers of points, and afterwards calculate the % \cs{evensidemargin}. % Jonathon Stickel (\url{jjstickel@vcn.com}) on 2008/05/30 noted that % \cs{marginparwidth} had to be positive for the initial setting of the sidebar % geometry through \cs{setsidebars}. % \changes{v1.618033}{2008/06/02}{Ensured initial value of \cs{marginparwidth} % was positive} % \begin{macrocode} \@settopoint\oddsidemargin \@settopoint\marginparwidth \ifdim\marginparwidth<1pt \setlength\marginparwidth{1pt}\fi \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 \cs{topmargin} is the distance below the top of the printable % area (1in below the top of the paper) and the top of the box % containing the running head. % \begin{macrocode} \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 \cs{paperwidth} and \cs{paperheight} is the % same as the \cs{stockwidth} and \cs{stockheight}. % % We can get the spine % and edge margins from the \cs{oddsidemargin}. % \begin{macrocode} \setlength{\spinemargin}{\oddsidemargin} \addtolength{\spinemargin}{1in} \setlrmargins{\spinemargin}{*}{*} % \end{macrocode} % % Similarly we can get the upper and lower margins from the % \cs{topmargin}, \cs{headheight} and \cs{headskip}. % \begin{macrocode} \setlength{\uppermargin}{\topmargin} \addtolength{\uppermargin}{1in} \addtolength{\uppermargin}{\headheight} \addtolength{\uppermargin}{\headsep} \setulmargins{\uppermargin}{*}{*} % \end{macrocode} % % \begin{macro}{\@memznegtest} % DA suggested this in a private email (2003/002/13) to make error % checking and reporting a bit more (space) efficient. Use like \\ % \verb?\@memznegtest{\marginparsep}? instead of \\ % \begin{verbatim} % \ifdim\marginparsep>\z@\else % \@memerror{\protect\marginparsep\space is zero or negative}{\@ehd}% % \fi % \end{verbatim} % If its length variable argument is zero or less it reports an error. % % \changes{v1.4}{2003/02/27}{Added \cs{@memznegtest}} % \changes{v1.618033}{2008/06/02}{Changed \cs{@memznegtest} and % \cs{@memnegtest} to issue warnings instead of errors} % % \begin{macrocode} \newcommand*{\@memznegtest}[1]{% \ifdim#1>\z@\else %%%% \@memerror{\protect#1\space is zero or negative}{\@ehd}% \@memwarn{\protect#1\space is zero or negative}% \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@memnegtest} % Reports an error if its length variable argument is negative. % \changes{v1.4}{2003/02/27}{Added \cs{@memnegtest}} % \begin{macrocode} \newcommand*{\@memnegtest}[1]{% \ifdim#1<\z@ %%%% \@memerror{\protect#1\space is negative}{\@ehd}% \@memwarn{\protect#1\space is negative}% \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\m@mclassicht} % The classic adjustment of the \cs{textheight} to get an integral number % of lines (given an integral number of baselineskips returns a height % giving one more line in the block). % \changes{v1.61803}{2008/01/30}{Added \cs{m@mclassicht}, \cs{m@mlinesht} % and \cs{m@mnearestht} (mempatch v4.5)} % \begin{macrocode} \newcommand*{\m@mclassicht}{% \setlength{\@tempdima}{\textheight}% \divide\@tempdima \baselineskip \@tempcnta=\@tempdima \setlength{\textheight}{\@tempcnta\baselineskip}% \addtolength{\textheight}{\topskip}} % \end{macrocode} % \end{macro} % % \begin{macro}{\m@mlinesht} % The adjustment of the \cs{textheight} to get an integral number % of lines (given an inegral number of baselineskips returns a height % giving that number of lines). % \begin{macrocode} \newcommand*{\m@mlinesht}{% \setlength{\@tempdima}{\textheight}% \advance\@tempdima -\baselineskip \divide\@tempdima \baselineskip \@tempcnta=\@tempdima \setlength{\textheight}{\@tempcnta\baselineskip}% \addtolength{\textheight}{\topskip}} % \end{macrocode} % \end{macro} % % \begin{macro}{\m@mnearestht} % The adjustment of the \cs{textheight} to get an integral number % of lines with the calculated height being as the closest to the given % height. Algorithm supplied by Lars Madsen and Morten H{\o}gholm on % 2006/07/27. % \begin{macrocode} \newcommand*{\m@mnearestht}{% \setlength{\@tempdima}{\textheight}% \advance\@tempdima -\topskip \advance\@tempdima 0.5\baselineskip \divide\@tempdima \baselineskip \@tempcnta=\@tempdima \setlength{\textheight}{\@tempcnta\baselineskip}% \addtolength{\textheight}{\topskip}} % \end{macrocode} % \end{macro} % % \begin{macro}{\checkthelayout} % \cs{checkthelayout}\oarg{text} is the user level macro for % checking the layout. The \meta{text} argument controls which % algorithm should be used to calculate the \cs{textheight}. % \changes{v1.61803}{2008/01/30}{Extended \cs{checkthelayout} to include a choice % of algorithms (mempatch v4.5)} % \changes{v1.61803}{2008/01/30}{Changed some page layout tests to negative from zero or negative % (mempatch v4.5)} % \begin{macrocode} \newcommand*{\checkthelayout}[1][classic]{% % \end{macrocode} % First check the dimensions are not (zero or) negative. % \begin{macrocode} \@memnegtest{\trimedge} \@memnegtest{\trimtop} \@memznegtest{\stockwidth} \@memznegtest{\paperwidth} \@memznegtest{\textwidth} %%% \@memznegtest{\spinemargin} \@memnegtest{\spinemargin} %%% \@memznegtest{\foremargin} \@memnegtest{\foremargin} \@memznegtest{\marginparsep} \@memznegtest{\marginparwidth} \@memznegtest{\stockheight} \@memznegtest{\paperheight} \@memznegtest{\textheight} %%% \@memznegtest{\uppermargin} \@memnegtest{\uppermargin} %%% \@memznegtest{\lowermargin} \@memnegtest{\lowermargin} %%% \@memznegtest{\headheight} \@memnegtest{\headheight} %%% \@memznegtest{\headsep} \@memnegtest{\headsep} %%% \@memznegtest{\footskip} \@memnegtest{\footskip} % \end{macrocode} % % Carry on regardless. We may need to adjust the \cs{textheight} % to get an integral number of lines. % \begin{macrocode} \nametest{#1}{classic}% \ifsamename \m@mclassicht \else \nametest{#1}{lines}% \ifsamename \m@mlinesht \else \nametest{#1}{nearest}% \ifsamename \m@mnearestht \else \nametest{#1}{fixed} \ifsamename \else% not classic, lines, nearest, or fixed \@memerror{Optional argument is not one of:\MessageBreak classic, fixed, lines, or nearest. \MessageBreak I will assume the default}% {\@ehc}% \fi \fi \fi \fi \setulmargins{\uppermargin}{*}{*} % \end{macrocode} % % Check that all the sums add up correctly, or % at least to within a small (\cs{@tempdimb}) error. % \changes{v1.618033}{2008/06/02}{Added more information about problematic % layout values} % \begin{macrocode} \@tempdimb = -1pt \@tempdima=\stockwidth \advance\@tempdima -\trimedge \advance\@tempdima -\paperwidth \ifdim\@tempdima<\@tempdimb \@tempdima = -\@tempdima \@memerror{\protect\paperwidth\space (\the\paperwidth) and/or \protect\trimedge\space (\the\trimedge) are too large for \protect\stockwidth\space (\the\stockwidth) by \the\@tempdima}% {\@ehd} \fi \@tempdima = \paperwidth \advance\@tempdima -\foremargin \advance\@tempdima -\textwidth \advance\@tempdima -\spinemargin \ifdim\@tempdima<\@tempdimb \@tempdima = -\@tempdima \@memerror{\protect\spinemargin\space (\the\spinemargin) and/or \protect\textwidth\space (\the\textwidth) and/or \protect\foremargin\space (\the\foremargin) are too large for \protect\paperwidth\space (\the\paperwidth) by \the\@tempdima}% {\@ehd} \fi \@tempdima = \stockheight \advance\@tempdima -\trimtop \advance\@tempdima -\paperheight \ifdim\@tempdima<\@tempdimb \@tempdima = -\@tempdima \@memerror{\protect\paperheight\space (\the\paperheight) and/or \protect\trimtop\space (\the\trimtop) are too large for \protect\stockheight\space (\the\stockheight) by \the\@tempdima}% {\@ehd} \fi \@tempdima = \paperheight \advance\@tempdima -\uppermargin \advance\@tempdima -\textheight \advance\@tempdima -\lowermargin \ifdim\@tempdima<\@tempdimb \@tempdima = -\@tempdima \@memerror{\protect\uppermargin\space (\the\uppermargin) and/or \protect\textheight\space (\the\textheight) and/or \protect\lowermargin\space (\the\lowermargin) are too large for \protect\paperheight\space (\the\paperheight) by \the\@tempdima}% {\@ehd} \fi \@tempdima = \uppermargin \advance\@tempdima -\headheight \advance\@tempdima -\headsep \ifdim\@tempdima<\@tempdimb \@tempdima = -\@tempdima \@memerror{\protect\headheight\space (\the\headheight) and/or \protect\headsep\space (\the\headsep) are too large for \protect\uppermargin\space (\the\uppermargin) by \the\@tempdima}% {\@ehd} \fi \@tempdima = \lowermargin \advance\@tempdima -\footskip \ifdim\@tempdima<\z@ \@tempdima = -\@tempdima \@memerror{\protect\footskip\space (\the\footskip) is too large for \protect\lowermargin\space (\the\lowermargin) 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\relax % \end{macrocode} % % Now the \cs{oddsidemargin}. % \begin{macrocode} \oddsidemargin = \stockwidth \advance\oddsidemargin -\trimedge \advance\oddsidemargin -\paperwidth \advance\oddsidemargin \spinemargin \advance\oddsidemargin -1in\relax % \end{macrocode} % % And the \cs{evensidemargin}. % \begin{macrocode} \evensidemargin = \trimedge \advance\evensidemargin \foremargin \advance\evensidemargin -1in\relax % \end{macrocode} % % % Set the values to the nearest whole point. % \begin{macrocode} \@settopoint\textwidth \@settopoint\oddsidemargin \@settopoint\evensidemargin % \end{macrocode} % Fix standard page layouts after possible change of \cs{textwidth}. % \changes{v1.6180339f}{2009/03/16}{Added \cs{fixheaderwidths} to \cs{fixthelayout}} % \begin{macrocode} \fixheaderwidths} % \end{macrocode} % \end{macro} % % \begin{macro}{\typeoutlayout} % \begin{macro}{\settypeoutlayoutunit} % \begin{macro}{\mem@typeouttwolengths} % \begin{macro}{\mem@typeoutonelength} % Why not type out the calculated versions of the designed values? % \changes{v1.0a}{2002/01/18}{Added \cs{typeoutlayout}} % \changes{v1.0a}{2002/01/25}{Added column info to \cs{typeoutlayout}} % \changes{v1.61803}{2008/01/30}{Added sidecap and sidebar data to \cs{typeoutlayout} % (mempatch v4.6)} % \changes{v1.61803398d}{2010/02/04}{Added information about side feet} % \changes{v3.6g}{2010/09/17}{Added feature such that user can change % the unit used by \cs{typeoutlayout}, requested by Rasmus Villemoes} % Using the macro \cs{settypeoutlayoutunit}\marg{unit} before % \cs{typeoutlayout} (or more often \cs{checkandfixthelayout}), the % user can choose the unit in which the list is typeset. The code is % inspired by the \texttt{printlen} package. % \begin{macrocode} \newcommand\settypeoutlayoutunit[1]{ \nametest{#1}{pt} \ifsamename \def\mem@tl@unit{#1} \def\mem@tl@unitperpt{1.0} \else \nametest{#1}{pc} \ifsamename \def\mem@tl@unit{#1} \def\mem@tl@unitperpt{0.083333} \else \nametest{#1}{in} \ifsamename \def\mem@tl@unit{#1} \def\mem@tl@unitperpt{0.013837} \else \nametest{#1}{mm} \ifsamename \def\mem@tl@unit{#1} \def\mem@tl@unitperpt{0.351459} \else \nametest{#1}{cm} \ifsamename \def\mem@tl@unit{#1} \def\mem@tl@unitperpt{0.0351459} \else \nametest{#1}{bp} \ifsamename \def\mem@tl@unit{#1} \def\mem@tl@unitperpt{0.996264} \else \nametest{#1}{dd} \ifsamename \def\mem@tl@unit{#1} \def\mem@tl@unitperpt{0.9345718} \else \nametest{#1}{cc} \ifsamename \def\mem@tl@unit{#1} \def\mem@tl@unitperpt{0.0778809} \else \@memerror{Unknown unit '#1' not suitable for layout listing}{} \fi \fi \fi \fi \fi \fi \fi \fi } % \end{macrocode} % Default value is \texttt{pt}, other supported are \texttt{mm}, % \texttt{cm}, \texttt{in}, \texttt{bp}, \texttt{dd} and \texttt{cc}. % \begin{macrocode} \settypeoutlayoutunit{pt} % \end{macrocode} % To help with the typesetting, we need to helper macros: % \begin{macrocode} \newcommand\mem@typeouttwolengths[4]{ % #1 = text before % #2 = first length % #3 = text between % #4 = second length \setlength\@tempdimc{\mem@tl@unitperpt #2} \edef\l@first{\strip@pt\@tempdimc}% \setlength\@tempdimc{\mem@tl@unitperpt #4} \edef\l@second{\strip@pt\@tempdimc}% \typeout{#1: \l@first\mem@tl@unit\space#3\space\l@second\mem@tl@unit} } \newcommand\mem@typeoutonelength[2]{ % #1 = text before % #2 = first length \setlength\@tempdimc{\mem@tl@unitperpt #2} \edef\l@first{\strip@pt\@tempdimc}% \typeout{#1: \l@first\mem@tl@unit} } % \end{macrocode} % Thirdly \cs{typeoutlayout} need to be rewritten to take care of the % extra convertions % \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{Sidecapsep and sidecapwidth: % \the\sidecapsep\space and \the\sidecapwidth} % \typeout{Sidebarhsep and sidebarwidth: % \the\sidebarhsep\space and \the\sidebarwidth} % \typeout{Sidebarvsep and sidebartopsep: % \the\sidebarvsep\space and \the\sidebartopsep} % \typeout{Sidebarheight: % \the\dimen\sideins} % \typeout{Sidefoothsep and sidefootwidth: % \the\sidefoothsep\space and \the\sidefootwidth} % \typeout{Sidefootvsep and sidefootheight: % \the\sidefootvsep\space and \the\sidefootheight} \mem@typeouttwolengths{Stock height and width}{\stockheight}{by}{\stockwidth} \mem@typeouttwolengths{Top and edge trims}{\trimtop}{and}{\trimedge} \mem@typeouttwolengths{Page height and width}{\paperheight}{by}{\paperwidth} \mem@typeouttwolengths{Text height and width}{\textheight}{by}{\textwidth} \mem@typeouttwolengths{Spine and edge margins}{\spinemargin}{and}{\foremargin} \mem@typeouttwolengths{Upper and lower margins}{\uppermargin}{and}{\lowermargin} \mem@typeouttwolengths{Headheight and headsep}{\headheight}{and}{\headsep} \mem@typeoutonelength{Footskip}{\footskip} \mem@typeouttwolengths{Columnsep and columnseprule}{\columnsep}{and}{\columnseprule} \mem@typeouttwolengths{Marginparsep and marginparwidth}{\marginparsep}{and}{\marginparwidth} \mem@typeouttwolengths{Sidecapsep and sidecapwidth}{\sidecapsep}{and}{\sidecapwidth} \mem@typeouttwolengths{Sidebarhsep and sidebarwidth}{\sidebarhsep}{and}{\sidebarwidth} \mem@typeouttwolengths{Sidebarvsep and sidebartopsep}{\sidebarvsep}{and}{\sidebartopsep} \mem@typeoutonelength{Sidebarheight}{\dimen\sideins} \mem@typeouttwolengths{Sidefoothsep and sidefootwidth}{\sidefoothsep}{and}{\sidefootwidth} \mem@typeouttwolengths{Sidefootvsep and sidefootheight}{\sidefootvsep}{and}{\sidefootheight} \typeout{******************************************************} \typeout{}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\checkandfixthelayout} % This macro checks and fixes the layout, and reports the result. It takes the % same optional argument as \cs{checkthelayout}. % \changes{v0.2}{2001/06/03}{Replaced \cs{fixpagelayout} by \cs{checkandfixthelayout}} % \changes{v1.0a}{2002/01/18}{Partitioned \cs{checkandfixthelayout}} % \begin{macrocode} % \changes{v1.61803}{2008/01/30}{Changed \cs{checkandfixthelayout} % for the extended \cs{checkthelayout} (mempatch v4.5)} % \begin{macrocode} \newcommand*{\checkandfixthelayout}[1][classic]{% \checkthelayout[#1]% \fixthelayout \typeoutlayout} % \end{macrocode} % \end{macro} % % % \begin{macro}{\fixpdflayout} % \begin{macro}{\fixdvipslayout} % Page layout with pdf\LaTeX{} seems a bit iffy. % At the suggestion of Lars Madsen, help with % setting viewer (e.g., ghostview) % window sizes for dvi/ps. \cs{fixdvipslayout} does for \file{dvi} output % as \cs{fixpdflayout} does for \file{pdf} output. % \changes{v1.4}{2003/11/22}{Added \cs{fixpdflayout} (from patch v1.6)} % \changes{v1.4}{2003/12/01}{Added \cs{fixdvipslayout} } % \changes{v1.61803398}{2009/08/17}{on ctt dynamotwain suggested a % change to \cs{fixpdflayout} and the following \cs{AtBeginDocument} % such that the \cs{special} is not outputtet when running xelatex} % \begin{macrocode} \newcommand*{\fixpdflayout}{% \pdfpageheight=\the\stockheight \pdfpagewidth=\the\stockwidth \ifxetex\else \ifdim\pdfvorigin=0pt\pdfvorigin=1in\fi \ifdim\pdfhorigin=0pt\pdfhorigin=1in\fi \fi} \newcommand*{\fixdvipslayout}{% \AtBeginDvi{\special{papersize=\the\stockwidth,\the\stockheight}}} \AtBeginDocument{% \ifxetex \fixpdflayout \else \ifpdf \ifnum\pdfoutput<\@ne \fixdvipslayout \else \fixpdflayout \fi \else \fixdvipslayout \fi \fi} % \end{macrocode} % % With a landscape document when going \texttt{latex -> dvips} the % resulting \file{.ps} file % may apear upside down in \texttt{ghostview}. If this happens, try putting % the following in the document preamble: % \begin{verbatim} % \addtodef{\fixdvipslayout}{}{% % \special{!TeXDict begin /landplus90{true}store end }} % \end{verbatim} % See \texttt{http://www.radicaleye.com.dvips.html} (DVIPS Home Page) for % an explanation. % % Some other potential specials for PostScript printing may be % (at least for an HP 5SiMx LaserJet duplex printer): % \begin{verbatim} % \special{!TeXDict begin <> % setpagedevice end} % duplex % \special{!TeXDict begin <> % setpagedevice end} % short side binding % \end{verbatim} % \end{macro} % \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}} % \changes{v3.6g}{2010/09/17}{changed such that the user can change % the unit being used} % \begin{macrocode} \newcommand{\typeoutstandardlayout}{% \typeout{} \typeout{******************************************************} % \typeout{Page height and width: % \the\paperheight\space by \the\paperwidth} \mem@typeouttwolengths{Page height and width}{\paperheight}{by}{\paperwidth} % \typeout{Text height and width: % \the\textheight\space by \the\textwidth} \mem@typeouttwolengths{Text height and width}{\textheight}{by}{\textwidth} % \typeout{Oddside and evenside margins: % \the\oddsidemargin\space and \the\evensidemargin} \mem@typeouttwolengths{Oddside and evenside margins}{\oddsidemargin}{and}{\evensidemargin} % \typeout{Topmargin and footskip: % \the\topmargin\space and \the\footskip} \mem@typeouttwolengths{Topmargin and footskip}{\topmargin}{and}{\footskip} % \typeout{Headheight and headsep: % \the\headheight\space and \the\headsep} \mem@typeouttwolengths{Headheight and headsep}{\headheight}{and}{\headsep} % \typeout{Columnsep and columnseprule: % \the\columnsep\space and \the\columnseprule} \mem@typeouttwolengths{Columnsep and columnseprule}{\columnsep}{and}{\columnseprule} % \typeout{Marginparsep and marginparwidth: % \the\marginparsep\space and \the\marginparwidth} \mem@typeouttwolengths{Marginparsep and marginparwidth}{\marginparsep}{and}{\marginparwidth} \typeout{******************************************************} \typeout{} } % \end{macrocode} % \end{macro} % % % \subsection{Some predefined layouts} % % A few predefined layouts for the textblock are presented. The \cs{checkandfixthelayout} % macro \emph{must} be called afterwards. % % \begin{macro}{\medievalpage} % This implements Jan Tschichold's reconstruction of the page and textblock % layout used by medieval scribes and the early printers~\cite{}. % The spine, top, edge and bottom margins are in the ratios 2:3:4:6. % % \cs{medievalpage}\oarg{num} positions the typeblock on the page with the % margins in the above ratios. The spine margin is (page width)/\meta{num} % (default 9). This must be an integer. % \changes{v1.61803}{2008/01/30}{Added \cs{medievalpage}} % \begin{macrocode} %%%% s = w/#1, t = 1.5s, e = 2s, f = 3s \newcommand*{\medievalpage}[1][9]{% \spinemargin=\paperwidth \divide\spinemargin #1\relax \uppermargin = 1.5\spinemargin \setlrmarginsandblock{\spinemargin}{*}{2} \setulmarginsandblock{\uppermargin}{*}{2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\isopage} % An implementation of Bringhurst's layout for ISO proportioned pages. % It works for any page though. The edge margin is twice the spine, % and the bottom margin is twice the top. % % \cs{isopage}\oarg{num} positions and sizes the typeblock on the page % according to the above ratios. The spine is (page width)/\meta{num} % and the top margin id (page height)/\meta{num}. \meta{num} must be % an integer. % \changes{v1.61803}{2008/01/30}{Added \cs{isopage}} % \begin{macrocode} % s = w/#1, e = 2s, t = h/#1, f = 2h \newcommand*{\isopage}[1][9]{% \spinemargin=\paperwidth \divide\spinemargin #1\relax \uppermargin=\paperheight \divide\uppermargin #1\relax \setlrmarginsandblock{\spinemargin}{*}{2} \setulmarginsandblock{\uppermargin}{*}{2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\semiisopage} % An variation on Bringhurst's layout for ISO proportioned pages. % It works for any page though. The top margin is the same as the spine, % and the edge and bottom margins are twice the spine. % % \cs{semiisopage}\oarg{num} positions and sizes the typeblock on the page % according to the above ratios. The spine is (page width)/\meta{num}. % \meta{num} must be an integer. % \changes{v1.61803}{2008/01/30}{Added \cs{isopage}} % \begin{macrocode} %%% s = w/#1, t = s, e = 2s, f = e \newcommand*{\semiisopage}[1][9]{% \spinemargin=\paperwidth \divide\spinemargin #1\relax \uppermargin=\spinemargin \setlrmarginsandblock{\spinemargin}{*}{2} \setulmarginsandblock{\uppermargin}{*}{2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\setpagebl} % \begin{macro}{\setpageml} % \begin{macro}{\setpagetl} % \begin{macro}{\setpagetm} % \cs{setpagebl}\marg{height}\marg{width}\marg{ratio} sets a page smaller than % the stock size at the bottom left of the stock. The arguments are the % the same as for \cs{settrimmedsize}; % \meta{height}, \meta{width} and \meta{ratio} of height and width % (choose any two) of the desired page size. The trims are adjusted to suit. % \cs{setpagetl} puts the page at the top left, \cs{setpageml} at the % middle left, and \cs{setpagetm} at the top middle. % \changes{v1.61803}{2008/01/30}{Added \cs{setpagebl}, \cs{setpageml}, and % \cs{setpagetl}} % \changes{v1.6180339c}{2008/12/26}{Added \cs{setpagetm}} % \begin{macrocode} \newcommand*{\setpagebl}[3]{% \settrimmedsize{#1}{#2}{#3}% \trimtop=\stockheight \advance\trimtop -\paperheight \trimedge=\stockwidth \advance\trimedge -\paperwidth} \newcommand*{\setpageml}[3]{% \settrimmedsize{#1}{#2}{#3} \trimtop=\stockheight \advance\trimtop -\paperheight \advance\trimtop -0.5\trimtop \trimedge=\stockwidth \advance\trimedge -\paperwidth} \newcommand*{\setpagetl}[3]{% \settrimmedsize{#1}{#2}{#3} \trimtop=0pt \trimedge=\stockwidth \advance\trimedge -\paperwidth} \newcommand*{\setpagetm}[3]{% \settrimmedsize{#1}{#2}{#3}% \trimtop=0pt \trimedge=\stockwidth \advance\trimedge -\paperwidth \advance\trimedge -0.5\trimedge} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\setpagetr} % \begin{macro}{\setpagemr} % \begin{macro}{\setpagebr} % \begin{macro}{\setpagebm} % \begin{macro}{\setpagecc} % Similar to those above, these macros set the page on the stock % at the top right, middle right, bottom right, bottom middle, and centered. % \changes{v1.6180339c}{2008/12/26}{Added \cs{setpagetr}, \cs{setpagemr}, \cs{setpagebr}, % \cs{setpagebm} and \cs{setpagecc}} % \begin{macrocode} \newcommand*{\setpagetr}[3]{% \settrimmedsize{#1}{#2}{#3}% \trimtop=0pt \trimedge=0pt} \newcommand*{\setpagemr}[3]{% \settrimmedsize{#1}{#2}{#3}% \trimtop=\stockheight \advance\trimtop -\paperheight \advance\trimtop -0.5\trimtop \trimedge=0pt} \newcommand*{\setpagebr}[3]{% \settrimmedsize{#1}{#2}{#3}% \trimtop=\stockheight \advance\trimtop -\paperheight \trimedge=0pt} \newcommand*{\setpagebm}[3]{% \settrimmedsize{#1}{#2}{#3}% \trimtop=\stockheight \advance\trimtop -\paperheight \trimedge=\stockwidth \advance\trimedge -\paperwidth \advance\trimedge -0.5\trimedge} \newcommand*{\setpagecc}[3]{% \settrimmedsize{#1}{#2}{#3}% \trimtop=\stockheight \advance\trimtop -\paperheight \advance\trimtop -0.5\trimtop \trimedge=\stockwidth \advance\trimedge -\paperwidth \advance\trimedge -0.5\trimedge} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % % \subsection{Float placement parameters} % % % All float parameters are given default values in the \LaTeX{} % kernel. For this reason counters only need to be set with % \cs{setcounter} and other parameters are set using \cs{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} % % % \section{Page Styles} % % The page style \pstyle{foo} is defined by defining the command % \cs{ps@foo}. This command should make only local definitions. % There should be no stray spaces in the definition, since they % could lead to mysterious extra spaces in the output. % % \begin{macro}{\@evenhead} % \begin{macro}{\@oddhead} % \begin{macro}{\@evenfoot} % \begin{macro}{\@oddfoot} % The \cs{ps@...} command defines the macros \cs{@oddhead}, % \cs{@oddfoot}, \cs{@evenhead}, and \cs{@evenfoot} to define the running % heads and feet---e.g., \cs{@oddhead} is the macro to produce the % contents of the heading box for odd-numbered pages. It is called % inside an \cs{hbox} of width \cs{textwidth}. % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \subsection{Marking conventions} % % To make headings determined by the sectioning commands, the page % style defines the commands \cs{chaptermark}, \cs{sectionmark}, % \ldots,\\ % where \cs{chaptermark}\marg{TEXT} is called by % \cs{chapter} to set a mark, and so on. % % The \cs{...mark} commands and the \cs{...head} macros are defined % with the help of the following macros. (All the \cs{...mark} % commands should be initialized to no-ops.) % % \LaTeX{} extends \TeX's \cs{mark} facility by producing two kinds % of marks, a `left' and a `right' mark, using the following % commands: % \begin{flushleft} % \cs{markboth}\marg{LEFT}\marg{RIGHT}: Adds both marks. % % \cs{markright}\marg{RIGHT}: Adds a `right' mark. % % \cs{leftmark}: Used in the \cs{@oddhead}, \cs{@oddfoot}, \cs{@evenhead} % or \cs{@evenfoot} macros, it gets the current `left' % mark. \cs{leftmark} works like \TeX's \cs{botmark} % command. % % \cs{rightmark}: Used in the \cs{@oddhead}, \cs{@oddfoot}, \cs{@evenhead} % or \cs{@evenfoot} macros, it gets the current % `right' mark. \cs{rightmark} works like \TeX's % \cs{firstmark} command. % \end{flushleft} % % The marking commands work reasonably well for right marks % `numbered within' left marks--e.g., the left mark is changed by a % \cs{chapter} command and the right mark is changed by a \cs{section} % command. However, it does produce somewhat anomalous results if % two \cs{markboth}'s occur on the same page. % % % Commands like \cs{tableofcontents} that should set the marks in some % page styles use a \cs{@mkboth} command, which is \cs{let} by the % pagestyle command (\cs{ps@...}) to \cs{markboth} for setting the % heading or to \cs{@gobbletwo} to do nothing. % % % % \subsection{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 \cs{@evenhead}, \cs{@oddhead}, \cs{@evenfoot}, and \cs{@oddfoot}. % For this class, each header and footer is treated as three parts: a left, % center, and right part. In this case, defining a pagestyle consists of % specifying these 12 portions of the running headers and footers. The % 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., \verb?ruled?). % % \changes{v1.61803398d}{2010/02/09}{Added the following three macros} % \begin{macro}{\mem@set@ps@xtra@info} % \begin{macro}{\mem@ps@find@real} % \begin{macro}{\mem@ps@safe@change} % The class supports an aliasing feature, where a page style name can % actually call the code from another. Quite handy. But There might be % problems if a use try to modify an alias page style. We care for % this by storing some information about each page style, and throwing % an error if the user atempts to alter a page style marked as an % alias. % % \verb?\mem@set@ps@xtra@info? store two things: the name of the style % we are an alias for (if we are not an alias it will be blank) and an % indicator whether we are an alias (00 if we are and 01 if we are not). % \begin{macrocode} \newcommand\mem@set@ps@xtra@info[3]{% \@namedef{ps@#1@aliasfor}{#2}% \@namedef{ps@#1@isalias}{#3}} % \end{macrocode} % \verb?\mem@ps@find@real? starts at a given page style, if it is % marked as an alias, it will recursively go down the chain of aliases % and save the name of the first real page style in \verb?\@tempa?. % \begin{macrocode} \newcommand\mem@ps@find@real[1]{% \if\@nameuse{ps@#1@isalias}\relax \mem@ps@find@real{\@nameuse{ps@#1@aliasfor}} \else\def\@tempa{#1}\fi} % \end{macrocode} % \verb?\mem@ps@safe@change? takes a page style name, checks to see if % it is defined, if it is, it checks to see if it is safe to change it. % \begin{macrocode} \newcommand\mem@ps@safe@change[1]{% \@ifundefined{ps@#1}{% \@memerror{Undefined pagestyle '#1', so I cannot change it}{}}{} \if\@nameuse{ps@#1@isalias}\relax \mem@ps@find@real{#1} \@memerror{The pagestyle '#1' is marked as an alias page style.^^J Modifying an alias page style may give unexpected results.^^J The alias chain resolves to the real page style '\@tempa', so try issuing^^J \string\copypagestyle{#1}{\@tempa}^^J before before modifying '#1'}{} \fi } % \end{macrocode} % % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\makeevenhead} % The command % \cs{makeevenhead}\marg{style}\marg{left}\marg{center}\marg{right} % specifies that the left, center and right portions of the even header for % pagestyle \meta{style} are defined as the other three arguments, respectiveley. % Internally it defines the commands \cs{styleeheadl}, \cs{styleeheadc} and % \cs{styleeheadr} to be \meta{left}, \meta{center} and \meta{right} respectively. % \changes{v1.61803398d}{2010/02/09}{Added safe change test} % \begin{macrocode} \newcommand{\makeevenhead}[4]{% \mem@ps@safe@change{#1} \@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 \cs{makeevenhead} except that they are % for the oddhead, evenfoot and oddfoot. % \changes{v1.61803398d}{2010/02/09}{Added safe change test} % \begin{macrocode} \newcommand{\makeoddhead}[4]{% \mem@ps@safe@change{#1} \@namedef{#1oheadl}{#2} \@namedef{#1oheadc}{#3} \@namedef{#1oheadr}{#4} } \newcommand{\makeevenfoot}[4]{% \mem@ps@safe@change{#1} \@namedef{#1efootl}{#2} \@namedef{#1efootc}{#3} \@namedef{#1efootr}{#4} } \newcommand{\makeoddfoot}[4]{% \mem@ps@safe@change{#1} \@namedef{#1ofootl}{#2} \@namedef{#1ofootc}{#3} \@namedef{#1ofootr}{#4} } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\makerunningwidth} % \begin{macro}{\makerunningheadwidth} % \begin{macro}{\makerunningfootwidth} % \begin{macro}{\m@mhfstyle} % \begin{macro}{\m@mopthfwidth} % The macro \cs{makerunningwidth}\marg{style}\oarg{ftlength}\marg{length} % sets the % width of the headers and footers of pagestyle \meta{style} to % be \meta{length}, but if \meta{ftlength} is present the footer % width is set to \meta{ftlength}. The lengths are stored as the % macros \cs{styleheadrunwidth} and \cs{stylefootrunwidth}. The two % widths can be set individually using % \cs{makerunningheadwidth}\marg{style}\marg{length} and % \cs{makerunningfootwidth}\marg{style}\marg{length}. % \changes{v1.6180339c}{2008/12/26}{Enabled the width of headers and footers % to be different % (requested by Wilhelm M\"{u}ller).} % \changes{v1.6180339c}{2009/01/13}{Added \cs{makerunningheadwidth} % and \cs{makerunningfootwidth}}. % \changes{v1.6180339d}{2009/02/04}{Fixed a mental bug, /daleif} % \changes{v1.61803398d}{2010/02/09}{Added safe change test} % \begin{macrocode} \newcommand*{\makerunningwidth}[1]{% \mem@ps@safe@change{#1}% \def\m@mhfstyle{#1}% \m@mopthfwidth} \newcommand*{\m@mopthfwidth}[2][\@mpty]{% % \setlength\@tempdima{#2} \@namedef{\m@mhfstyle headrunwidth}{#2}% % \expandafter\edef\csname \m@mhfstyle headrunwidth\endcsname{\the\@tempdima} \ifx\@mpty #1 \@namedef{\m@mhfstyle footrunwidth}{#2}% % \expandafter\edef\csname \m@mhfstyle footrunwidth\endcsname{\the\@tempdima} \else \@namedef{\m@mhfstyle footrunwidth}{#1}% % \setlength\@tempdima{#1} % \expandafter\edef\csname \m@mhfstyle footrunwidth\endcsname{\the\@tempdima} \fi} \newcommand*{\makerunningheadwidth}[2]{% % \setlength\@tempdima{#2}% % \expandafter\edef\csname \m@mhfstyle headrunwidth\endcsname{\the\@tempdima}% \mem@ps@safe@change{#1}% \@namedef{#1headrunwidth}{#2}% } \newcommand*{\makerunningfootwidth}[2]{% % \setlength\@tempdima{#2}% \mem@ps@safe@change{#1}% \@namedef{#1footrunwidth}{#2}% % \expandafter\edef\csname \m@mhfstyle footrunwidth\endcsname{\the\@tempdima}% } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\normalrulethickness} % \begin{macro}{\footruleheight} % \begin{macro}{\footruleskip} % \begin{macro}{\makeheadrule} % \begin{macro}{\makefootrule} % \cs{normalrulethickness} is the thickness of a normal horizontal % or vertical rule. % \cs{footruleheight} is the height of a normal rule above a footer (actually zero). % \cs{footruleskip} is a distance sufficient to ensure that a foot rule % will appear between the bottom of the textblock and above any actual footer. % % (There was a \ctt{} thread \textit{ngerman, fancyhdr and \cs{footrulewidth} --- bug?} % in December 2002 that bears on the definitions below). % \changes{v1.4}{2003/02/27}{Make \cs{normalrulethickness} a length, % not a macro (patch 1.1)} % \changes{v1.4}{2003/02/27}{Initialise \cs{footruleheight} to 0pt, not % \cs{z@skip} (patch 1.1)} % \begin{macrocode} \newlength{\normalrulethickness} \setlength{\normalrulethickness}{0.4pt} \newcommand{\footruleheight}{0pt} \newcommand{\footruleskip}{0.3\normalbaselineskip} % \end{macrocode} % The macro \cs{makeheadrule}\marg{style}\marg{width}\marg{height} % specifies the width and height of the header rule for \meta{style}. % % Similarly % \cs{makefootrule}\marg{style}\marg{width}\marg{height}\marg{skip} % specifies the width, height and skip for the footrule. % \changes{v1.61803398d}{2010/02/09}{Added safe change test} % \begin{macrocode} \newcommand{\makeheadrule}[3]{% \mem@ps@safe@change{#1}% \@namedef{#1headrule}{% \@nameuse{#1headruleprefix}\hrule\@width #2\@height #3 \vskip-#3}} \newcommand{\makefootrule}[4]{% \mem@ps@safe@change{#1}% \@namedef{#1footrule}{% \vskip-#4\vskip-#3% \@nameuse{#1footruleprefix}\hrule\@width #2\@height #3 \vskip #4}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \changes{v3.6h}{2011/01/25}{Added this macro} % \begin{macro}{\makeheadfootruleprefix} % We insert a maro at the start of the head and foot rule. By default % it does nothing, but it can be ised to specify a different color to % the head or foot rules. % \begin{macrocode} \newcommand\makeheadfootruleprefix[3]{% \@namedef{#1headruleprefix}{#2}% \@namedef{#1footruleprefix}{#3}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\makeheadposition} % \cs{makeheadposition}\marg{style}\marg{eheadpos}\marg{oheadpos}\marg{efootpos}\marg{ofootpos} % specifies the horizontal positioning of the even and odd headers and footers, % respectively, % for the pagestyle \meta{style}. Each of the \meta{...pos} arguments may be % either \verb?flushleft?, \verb?center? or \verb?flushright?, with the obvious meanings. % An empty argument (or an unrecognised one) is equivalent to \verb?center?. % \changes{v1.61803398d}{2010/02/09}{Added safe change test} % \begin{macrocode} \newcommand{\makeheadposition}[5]{% \mem@ps@safe@change{#1}% % \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 \cs{makepsmarks}\marg{style}\marg{code} specifies that % \meta{code} is the definition of the hook for pagestyle \meta{style}. % \cs{makepshook} was a deprecated version of \cs{makepsmarks} and is % now deleted. % \changes{v1.0}{2001/11/15}{Added \cs{makepsmarks} and deprecated % \cs{makepshook}} % \changes{v1.4}{2003/12/14}{Deleted \cs{makepshook}} % \changes{v1.61803398d}{2010/02/09}{Added safe change test} % \begin{macrocode} \newcommand{\makepsmarks}[2]{\mem@ps@safe@change{#1}\@namedef{#1pshook}{#2}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\m@mhe@dreset} % To cater for potential baselineskip changes, such as \verb?\linespread{2}?, % we have to ensure they don't percolate into the header/footer. % (See CTT thread \textit{memoir + linespread}, 2004/02/11) % \changes{v1.61}{2004/03/14}{Added \cs{m@mhe@dreset}} % \begin{macrocode} \newcommand*{\m@mhe@dreset}{\def\baselinestretch{1}\normalsize} % \end{macrocode} % \end{macro} % % \begin{macro}{\makeheadfootvposition} % The headers and footers are typeset inside \cs{parbox}'es, using % \cs{makeheadfootvposition}\marg{style}\marg{headvpos}\marg{footvpost} % users can specify whether the alignment should be b,t or~c.The % default is~b. % \changes{v1.6180339c}{2009/01/13}{Added support for % controlling the alignment of the headers and footers} % \changes{v1.61803398d}{2010/02/09}{Added safe change test} % \begin{macrocode} \newcommand*\makeheadfootvposition[3]{% \mem@ps@safe@change{#1}% \@namedef{#1headvplacement}{#2}\@namedef{#1footvplacement}{#3}} % \end{macrocode} % \end{macro} % \begin{macro}{\mem@maxheadheight} % \begin{macro}{\mem@maxfootheight} % \begin{macro}{\mem@sayonce@head} % \begin{macro}{\mem@sayonce@foot} % \begin{macro}{\mem@hf@measure@vbox} % \begin{macro}{\mem@toolarge@header@message} % \begin{macro}{\mem@toolarge@footer@message} % \changes{v3.6h}{2010/10/21}{Added the above seven macros to be able % to measure the headers and warn users if their design takes them outside.} % \verb?\mem@maxheadheight? and \verb?\mem@maxfootheight? globally % stores the max measured head and foot heights. Actually the footer % ought to be measuring the total height and depth. We may add this % later. The two XsayonceX macros are toggles used such that we can % add a warning at only the first bad head/foot. We repeat the message % at the end of the document. % \begin{macrocode} \newlength\mem@maxheadheight \newlength\mem@maxfootheight \newcommand\mem@sayonce@head{00} \newcommand\mem@sayonce@foot{00} % \end{macrocode} % This is the work horse of this construction. First argument is the % height to compare against, second should be \texttt{head} or % \texttt{foot}, third is the warning message, and the fourth is the % material to be measured. The idea to taken from \Lpack{fancyhdr}. % \begin{macrocode} \newcommand\mem@hf@measure@vbox[4]{% \setbox0\vbox{#4}% \ifdim\ht0>#1\relax% \setlength\@tempdima{\@nameuse{mem@max#2height}}% \ifdim\ht0>\@tempdima\relax% \expandafter\global\@nameuse{mem@max#2height}=\ht0% \expandafter\if\@nameuse{mem@sayonce@#2}\relax% \@memwarn{#3}% \global\@namedef{mem@sayonece@#2}{01}% \fi% \fi% \fi% \box0% } % \end{macrocode} % Warning messages % \begin{macrocode} \newcommand\mem@toolarge@header@message{% The material used in the headers is too large^^J% (\the\mem@maxheadheight) for the given head height (\the\headheight), it is recommended to^^J% either increase the head height or redesign the header^^J% (in both cases you will find help in the memoir manual).% } \newcommand\mem@toolarge@footer@message{% The material used in the footer is too large^^J% (\the\mem@maxfootheight) for the given foot skip (\the\footskip), it is recommended to^^J% either increase the foot skip or redesign the fotoer^^J% (in both cases you will find help in the memoir manual).% } % \end{macrocode} % To make things easier to read we make two short cut macros % \begin{macrocode} \newcommand\mem@hvboxm[1]{% \mem@hf@measure@vbox\headheight{head}\mem@toolarge@header@message{#1}} \newcommand\mem@fvboxm[1]{% \mem@hf@measure@vbox\footskip{foot}\mem@toolarge@footer@message{#1}} % \end{macrocode} % Make sure to repeat the message at the end of the document. This % will show the max value up until the point where the end of document % stuff is executed. % \begin{macrocode} \AtEndDocument{ \ifdim\mem@maxheadheight>\headheight \@memwarn{\mem@toolarge@header@message} \fi \ifdim\mem@maxfootheight>\footskip \@memwarn{\mem@toolarge@footer@message} \fi } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\mem@ps@entry@wrap} % \changes{v3.6h}{2010/10/06}{Added this to help bidi control the % typesetting direction of the header and footer} % This macro is wrapped around eash entry in the headers and % footers. By default it does nothing, but can be redefined by % packages such as \Lpack{bidi} to control the typesetting direction % in the header. Bidi for example has two modes such that headers % can be RTL locally while the header stay at LTR. If this macro is % changed, it will be a good idea to coordinate it with the bidi % maintainer. % \begin{macrocode} \newcommand\mem@ps@entry@wrap{} % \end{macrocode} % % \end{macro} % \begin{macro}{\mem@ps@HLH} % \changes{v3.6d}{201010/06/24}{Factored \cs{makepagestyle}} % The entries in the header used in \cs{makepagestyle} (below) are % more or less the same. It depends on \emph{head/foot}, % \emph{odd/even} and a shorter \emph{o/e}. So to make the code more % maintainable we factor this out into a generator macro. The % explanation for the code being used is kept below (see % \cs{makepagestyle}). % \begin{macrocode} \newcommand\mem@ps@HLH[4]{% % #1 ps name % #2 type: head, foot % #3 odd/even % #4 odd/even short (o,e) \@namedef{#1@#3#2}{% \@nameuse{#1#3hpl}\hb@xt@\@nameuse{#1#2runwidth}{\m@mhe@dreset% % \end{macrocode} % In footers the line goes before the text, so we test and add the % footline if \texttt{\#2} equals \texttt{foot}. % \changes{v3.6h}{2010/10/06}{added the entry wrapper} % \changes{v3.6h}{201010/10/21}{Added the header/footer measuring feature.} % For the header/footer measuring stuff we look at \#2 and make the % suiting macro from that value. % \changes{v3.6h}{2010/10/22}{Added \cs{memRTLmainraggedX} macros such % that \Lpack{bidi} can also change the order of the header if RTL is % the main direction of the document.} % \begin{macrocode} \nametest{#2}{head}\ifsamename\let\mem@hfboxer\mem@hvboxm\else\let\mem@hfboxer\mem@fvboxm\fi% \mem@hfboxer{\nametest{#2}{foot}\ifsamename\@nameuse{#1#2rule}\fi% \hbox{% \rlap{% \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{% \memRTLmainraggedright\@nameuse{#1ps#2strut}% \mem@ps@entry@wrap{\@nameuse{#1#4#2l}}% \@nameuse{#1ps#2strut}}}\hfill \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{% \centering\@nameuse{#1ps#2strut}% \mem@ps@entry@wrap{\@nameuse{#1#4#2c}}% \@nameuse{#1ps#2strut}}\hfill \llap{% \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{% \memRTLmainraggedleft\@nameuse{#1ps#2strut}% \mem@ps@entry@wrap{\@nameuse{#1#4#2r}}% \@nameuse{#1ps#2strut}}}% }% % \end{macrocode} % In the header the line goes under the text, so we test and add the % headline if \texttt{\#2} equals \texttt{head}. % \begin{macrocode} \nametest{#2}{head}\ifsamename\@nameuse{#1#2rule}\fi% }}\@nameuse{#1#3hpr}}% % \end{macrocode} % And end by letting the LaTeX head/foot use our version % \begin{macrocode} \@namedef{@#3#2}{\@nameuse{#1@#3#2}}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\makepagestyle} % At last we can put everything together for defining a new pagestyle, % via the macro \cs{makepagestyle}\marg{style} which initially sets up % a new pagestyle \meta{style} corresponding the the \LaTeX{} \verb?empty? % pagestyle. The prior macros can then be used to make modifications % to the style. % \changes{v1.0}{2001/11/15}{Now 2 stage process for defining \cs{@evenhead} % and friends} % \changes{v1.61}{2004/03/14}{Added \cs{m@mhe@dreset} at several points in % \cs{makepagestyle} (from patch 2.1)} % \changes{v1.61803}{2008/01/30}{Removed extraneous spaces from pagestyle code % (mempatch v4.6)} % \changes{v1.61803398d}{2010/02/09}{Added storing extra information % about page styles} % We also make sure to specify that this is a `real' page style, and % thus sets the empty alias name and the alias test to 01. % \begin{macrocode} \newcommand{\makepagestyle}[1]{% \mem@set@ps@xtra@info{#1}{}{01}% % \end{macrocode} % First define the macro \cs{ps@style}, which in turn defines the macros % \cs{@evenhead}, \cs{@oddhead}, \cs{@evenfoot} and \cs{@oddfoot}. % \changes{v3.6d}{20101/06/24}{Factored \cs{makepagestyle}, such % that \cs{#1@evenhead} and friends are made using \emph{one} single % macro. We keep the original code just in case.} % \begin{macrocode} \@namedef{ps@#1}{% \mem@ps@HLH{#1}{head}{even}{e}% \mem@ps@HLH{#1}{head}{odd}{o}% \mem@ps@HLH{#1}{foot}{even}{e}% \mem@ps@HLH{#1}{foot}{odd}{o}% % \@namedef{#1@evenhead}{% % \end{macrocode} % The code for the definition of \cs{@evenhead} and friends is based on code % from Piet van Oostrum's \Lpack{fancyhdr} package~\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 \cs{relax} or \cs{hss}, and then % start the main box. % \changes{v1.6180339c}{2008/12/26}{Replaced \cs{...runwidth} by \cs{...headrunwidth} % or \cs{...footrunwidth}, as appropriate for headers and footers.} % \changes{v1.6180339c}{2009/01/13}{Replaced \cs{parbox}\texttt[b] % with \cs{parbox}\texttt{[\cs{nameuse{#1headvplacement}}]} etc.} % \begin{macrocode} % \@nameuse{#1evenhpl}\hb@xt@\@nameuse{#1headrunwidth}{\m@mhe@dreset% % \vbox{\hbox{% % \end{macrocode} % The left part of the header. % \begin{macrocode} % \rlap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{% % \raggedright\@nameuse{#1eheadl}\strut}}\hfill % \end{macrocode} % The center part of the header. % \begin{macrocode} % \parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{% % \centering\@nameuse{#1eheadc}\strut}\hfill % \end{macrocode} % The right part of the header. % \begin{macrocode} % \llap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{% % \raggedleft\@nameuse{#1eheadr}\strut}}}% % \end{macrocode} % Finally, the header rule and finish with the right filler, which % is either \cs{relax} or \cs{hss}. % \begin{macrocode} % \@nameuse{#1headrule}}}\@nameuse{#1evenhpr}}% % \end{macrocode} % The code for the \cs{@oddhead}, \cs{@evenfoot} and \cs{@oddfoot} follows % a similar pattern. Here is \cs{@oddhead}. % \begin{macrocode} % \@namedef{#1@oddhead}{% % \@nameuse{#1oddhpl}\hb@xt@\@nameuse{#1headrunwidth}{\m@mhe@dreset% % \vbox{\hbox{% % \rlap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{% % \raggedright\@nameuse{#1oheadl}\strut}}\hfill % \parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{% % \centering\@nameuse{#1oheadc}\strut}\hfill % \llap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{% % \raggedleft\@nameuse{#1oheadr}\strut}}}% % \@nameuse{#1headrule}}}\@nameuse{#1oddhpr}}% % \end{macrocode} % And \cs{@evenfoot}. For the footers the rules come \emph{before} any foot % entries. % \begin{macrocode} % \@namedef{#1@evenfoot}{% % \@nameuse{#1evenfpl}\hb@xt@\@nameuse{#1footrunwidth}{\m@mhe@dreset% % \vbox{\@nameuse{#1footrule}\hbox{% % \rlap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{% % \raggedright\@nameuse{#1efootl}\strut}}\hfill % \parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{% % \centering\@nameuse{#1efootc}\strut}\hfill % \llap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{% % \raggedleft\@nameuse{#1efootr}\strut}}}% % }}\@nameuse{#1evenfpr}}% % \end{macrocode} % Lastly the \cs{@oddfoot}. % \begin{macrocode} % \@namedef{#1@oddfoot}{% % \@nameuse{#1oddfpl}\hb@xt@\@nameuse{#1footrunwidth}{\m@mhe@dreset% % \vbox{\@nameuse{#1footrule}\hbox{% % \rlap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{% % \raggedright\@nameuse{#1ofootl}\strut}}\hfill % \parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{% % \centering\@nameuse{#1ofootc}\strut}\hfill % \llap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{% % \raggedleft\@nameuse{#1ofootr}\strut}}}% % }}\@nameuse{#1oddfpr}}% % \end{macrocode} % Now we define \cs{@evenhead} etc., in terms of \verb?#1@evenhead?. % \begin{macrocode} % \def\@evenhead{\@nameuse{#1@evenhead}}% % \def\@oddhead{\@nameuse{#1@oddhead}}% % \def\@evenfoot{\@nameuse{#1@evenfoot}}% % \def\@oddfoot{\@nameuse{#1@oddfoot}}% % \end{macrocode} % To finish off the definition of \cs{ps@style}, add in a hook which can be % defined so that it adds additional code, if required. % \begin{macrocode} \@nameuse{#1pshook}}% % \end{macrocode} % \changes{v3.6d}{2010/06/24}{Added strut initialization} Next we % initialize the struts being used. Remember the for the % \pstyle{empty} style, the strut should be empty. % \begin{macrocode} \nametest{#1}{empty}% \ifsamename% \@namedef{#1psheadstrut}{}\@namedef{#1psfootstrut}{}% \else% \@namedef{#1psheadstrut}{\strut}\@namedef{#1psfootstrut}{\strut}% \fi% % \end{macrocode} % % The final part of setting up the new pagestyle % is defining all the macros called by \cs{ps@style}, and giving them % default values. Make the headers and footers empty. % \begin{macrocode} \makeevenhead{#1}{}{}{}% \makeoddhead{#1}{}{}{}% \makeevenfoot{#1}{}{}{}% \makeoddfoot{#1}{}{}{}% % \end{macrocode} % Make the headers/footers the same width as the \cs{textwidth}, % center them, and ensure that the rules have zero height so that they % will be invisible. Also initialize the head/foot prefixes. % \changes{v3.6h}{2011/01/25}{Added the \cs{makeheadfootruleprefix}} % \begin{macrocode} \makerunningwidth{#1}{\textwidth}% \makeheadposition{#1}{}{}{}{}% \makeheadrule{#1}{\textwidth}{0pt}% \makefootrule{#1}{\textwidth}{\footruleheight}{\footruleskip}% \makeheadfootruleprefix{#1}{}{} % \end{macrocode} % Set the initial vertical header and footer positions. % \changes{v1.6180339c}{2009/01/13}{Added head/foot position initialisation} % \begin{macrocode} \makeheadfootvposition{#1}{b}{b}% % \end{macrocode} % Finally, there is no addtional code needed, so make the hook empty, and % we are done. % \begin{macrocode} \makepsmarks{#1}{}} % \end{macrocode} % \end{macro} % % \begin{macro}{\aliaspagestyle} % The command \cs{aliaspagestyle}\marg{alias}\marg{original} % defines the \meta{alias} pagestyle to be an alias for the % \meta{original} pagestyle. % \changes{v1.61803398d}{2010/02/09}{Added page style storing info} % We remember to set the stored alias name, and sets the alias test to % true (00). % \begin{macrocode} \newcommand{\aliaspagestyle}[2]{% \mem@set@ps@xtra@info{#1}{#2}{00}% \@namedef{ps@#1}{\@nameuse{ps@#2}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\copypagestyle} % The command \cs{copypagestyle}\marg{new}\marg{original} % defines the \meta{new} pagestyle to be a copy of the % \meta{original} pagestyle. % % It first makes the \meta{new} (empty) pagestyle then defines the internals % in terms of the \meta{original} internals. % \changes{v1.2}{2002/08/10}{Added \cs{copypagestyle}} % \changes{v1.61803}{2008/01/30}{Added missing elements to \cs{copypagestyle} % (per Erik Quaeghebeur mempatch v4.9)} % \begin{macrocode} \newcommand{\copypagestyle}[2]{% \makepagestyle{#1}% % \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{#2footrunwidth}]{\@nameuse{#2headrunwidth}}% % \end{macrocode} % Specify the \cs{headposition}. % \begin{macrocode} \@namedef{#1evenhpl}{\@nameuse{#2evenhpl}}% \@namedef{#1oddhpl}{\@nameuse{#2oddhpl}}% \@namedef{#1evenhpr}{\@nameuse{#2evenhpr}}% \@namedef{#1oddhpr}{\@nameuse{#2oddhpr}}% % \end{macrocode} % Also vertically % \changes{v1.6180339c}{2008/01/13}{Also copy the vertical positions} % \changes{v1.6180339e}{2008/02/06}{Bug fix, reported by Per % Starb\"ack on ctt} % \begin{macrocode} \makeheadfootvposition{#1}{\@nameuse{#2headvplacement}}{\@nameuse{#2footvplacement}}% % \end{macrocode} % Specify the feet % \begin{macrocode} \@namedef{#1evenfpl}{\@nameuse{#2evenfpl}}% \@namedef{#1oddfpl}{\@nameuse{#2oddfpl}}% \@namedef{#1evenfpr}{\@nameuse{#2evenfpr}}% \@namedef{#1oddfpr}{\@nameuse{#2oddfpr}}% % \end{macrocode} % Specify the head and foot rules and the prefixes. % \changes{v3.6h}{2011/01/25}{Added the \cs{makeheadfootruleprefix}} % \begin{macrocode} \@namedef{#1headrule}{\@nameuse{#2headrule}}% \@namedef{#1footrule}{\@nameuse{#2footrule}}% \@namedef{#1headruleprefix}{\@nameuse{#2headruleprefix}}% \@namedef{#1footruleprefix}{\@nameuse{#2footruleprefix}}% % \end{macrocode} % \changes{v3.6d}{2010/06/24}{Added strut copying to \cs{copypagestyle}} % And remember the struts % \begin{macrocode} \@namedef{#1psheadstrut}{\@nameuse{#2psheadstrut}} \@namedef{#1psfootstrut}{\@nameuse{#2psfootstrut}} % \end{macrocode} % \end{macro} % And pick up the hook. We end the macro here. % \begin{macrocode} \makepsmarks{#1}{\@nameuse{#2pshook}}} % \end{macrocode} % % % \begin{macro}{\ifonlyfloats} % \cs{ifonlyfloats}\marg{yes}\marg{no} processes \meta{yes} if the macro is % called on a page consisting only of floats, otherwise \meta{no} is % processed. \cs{if@fcolmade} is specified in \file{ltoutput.dtx}. % \changes{v1.0}{2001/11/14}{Added \cs{ifonlyfloats}} % \begin{macrocode} \newcommand{\ifonlyfloats}[2]{\if@fcolmade #1\else #2\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\mergepagefloatstyle} % \cs{mergepagefloatstyle}\marg{style}\marg{textstyle}\marg{floatstyle} % makes a new page style \meta{style} that is \meta{textstyle} on normal % pages but uses \meta{floatstyle} on float-only pages. Both \meta{textstyle} % and \meta{floatstyle} must have been previously defined. % \changes{v1.0}{2001/11/15}{Added \cs{mergepagefloatstyle}} % \begin{macrocode} \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} % % \begin{macro}{\makeheadfootstrut} % \changes{v3.6d}{2010/06/24}{Added \cs{makeheadfootstrut}} % In each `field' of the header a strut is added to keep alignment % right. This macro can be used to change a particular strut % configuration. Each combination is initialy set by % \cs{makepagestyle} to be equal to \cs{strut}, except the % \pstyle{empty} style, where the strut is empty by default. % \begin{macrocode} \newcommand*\makeheadfootstrut[3]{% \@namedef{#1psheadstrut}{#2}\@namedef{#1psfootstrut}{#3}} % \end{macrocode} % \end{macro} % % The pagestyles \pstyle{empty} and \pstyle{plain} are defined % in \file{latex.dtx}. However, I will redefine them here, just in % case someone takes a fancy to modifying them. % % \begin{macro}{\ps@empty} % The \pstyle{empty} pagestyle is simple, it's just what we get when % we call \cs{makepagestyle}. % \begin{macrocode} \makepagestyle{empty} % \end{macrocode} % \end{macro} % % \begin{macro}{\ps@plain} % The \pstyle{plain} pagestyle is also simple, it just puts the % page number at the bottom middle of the page. % We call \verb?\makepagestyle{plain}? and then adjust as required. % \begin{macrocode} \makepagestyle{plain} \makeevenfoot{plain}{}{\thepage}{} \makeoddfoot{plain}{}{\thepage}{} % \end{macrocode} % \end{macro} % % \begin{macro}{\ps@simple} % The \pstyle{simple} page style simply puts the page number in the header % at the outer margin. % \changes{v1.61803398}{2009/07/26}{PW: Added the `simple' pagestyle} % \begin{macrocode} \makepagestyle{simple} \makeevenhead{simple}{\thepage}{}{} \makeoddhead{simple}{}{}{\thepage} % \end{macrocode} % \end{macro} % % \begin{macro}{\nouppercaseheads} % \begin{macro}{\uppercaseheads} % \begin{macro}{\memUChead} % Spurred by Lars Madsen's \Lpack{memexsupp} v0.5 package here is a % way of switching uppercasing in the headings pagestyle. % \changes{v1.61803}{2008/01/30}{Added \cs{(no)uppercaseheads} and % \cs{memUChead} (mempatch v4.9)} % \begin{macrocode} \newcommand*{\nouppercaseheads}{\let\memUChead\relax} \newcommand*{\uppercaseheads}{\let\memUChead\MakeUppercase} \uppercaseheads % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % The macros \cs{createplainmark}, \cs{createmark} and \cs{addtopsmarks} % are modified versions of code supplied by Lars Madsen. % \changes{v1.61803}{2008/01/30}{Added, and used, \cs{createplainmark}, % \cs{createmark} and \cs{addtopsmarks}} % \begin{macro}{\createplainmark} % \cs{createplainmark}\marg{type}\marg{marks}\marg{text} creates a % \cs{typemark} (\meta{type} is \texttt{toc}, \texttt{bib}, etc) % with \meta{marks} (left, both, right) whose contents are \meta{text}. % For example \verb?\createplainmark{toc}{both}{\contentsname}?. The % difference between plain and regular marks, is that plain marks use % a fixed text, whereas regular marks recieve dynamic text and thus % is given an argument. % \begin{macrocode} \newcommand*{\createplainmark}[3]{% \nametest{#2}{left}% \ifsamename \@namedef{#1mark}{\markboth{\memUChead{#3}}{}}% \else \nametest{#2}{right}% \ifsamename \@namedef{#1mark}{\markright{\memUChead{#3}}}% \else \nametest{#2}{both}% \ifsamename\else \@memerror{% Unknown mark setting type `#2' for #1mark}{% I expected `left', `both' or `right'. \MessageBreak I will assume you meant `both'}% \fi \@namedef{#1mark}{\markboth{\memUChead{#3}}{\memUChead{#3}}}% \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\createmark} % \cs{createmark}\marg{division}\marg{marks}\marg{show}\marg{prefix}\marg{postfix} % creates a \cs{divisionmark} with \meta{marks} (= \texttt{left}, \texttt{both} % or \texttt{right}) controlling which marks are set, % \meta{show} (= \texttt{shownumber} or \texttt{nonumber}) controls the % display of the divison number in \cs{mainmatter}, \meta{prefix} is text % before the number and \meta{postfix} is text after the number. % \begin{macrocode} \newcommand\createmark[5]{% % \end{macrocode} % Handle \texttt{(show/no)number}, fails to \texttt{shownumber}. % \begin{macrocode} \def\@tempa{00} \nametest{#3}{nonumber}% \ifsamename \def\@tempa{01}% \else \nametest{#3}{shownumber} \ifsamename\else \@memerror{Unknown numbering value `#3' for #1mark}% {I expected `shownumber' or `nonumber'.\MessageBreak I will assume you meant `shownumber'}% \fi \fi \expandafter\if\@tempa% compares the two \@tempa digits \@namedef{#1marksn}##1{##1}% \else \@namedef{#1marksn}{\@gobble}% \fi % \end{macrocode} % The three \meta{marks} cases, \texttt{left}, \texttt{both} and % \texttt{right}; fails to \texttt{both}. % \begin{macrocode} \nametest{#2}{left}% \ifsamename \@namedef{#1mark}##1{% \@setclcnt{#1}{@memmarkcntra}% \advance\c@@memmarkcntra\m@ne \markboth{% \memUChead{% \ifnum \c@secnumdepth > \c@@memmarkcntra \if@mainmatter \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}% \fi \fi ##1}}{}}% \else \nametest{#2}{right} \ifsamename \@namedef{#1mark}##1{% \@setclcnt{#1}{@memmarkcntra} \advance\c@@memmarkcntra\m@ne \markright{% \memUChead{% \ifnum \c@secnumdepth > \c@@memmarkcntra \if@mainmatter% \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}% \fi% \fi% ##1}}}% \else \nametest{#2}{both}% \ifsamename\else \@memerror{% Unknown mark setting type `#2' for #1mark}{% I expected `left', `both' or `right'. \MessageBreak I will assume you meant `both'}% \fi \@namedef{#1mark}##1{% \@setclcnt{#1}{@memmarkcntra} \advance\c@@memmarkcntra\m@ne \markboth{% \memUChead{% \ifnum \c@secnumdepth > \c@@memmarkcntra \if@mainmatter \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}% \fi \fi ##1}}{% \memUChead{% \ifnum \c@secnumdepth > \c@@memmarkcntra \if@mainmatter \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}% \fi \fi ##1}}}% \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\addtopsmarks} % \cs{addtopsmarks}\marg{pagestyle}\marg{prepend}\marg{append} inserts % \meta{prepend} and \meta{append} at the start and end of the current % definition of \cs{pagestylepshook}. % \changes{v1.61803398d}{2010/02/09}{Added safe to change test} % \begin{macrocode} \newcommand\addtopsmarks[3]{% \mem@ps@safe@change{#1}% \expandafter\addtodef\expandafter{\csname #1pshook\endcsname}{#2}{#3}} % \end{macrocode} % \end{macro} % % \begin{macro}{\clearplainmark} % \begin{macro}{\clearmark} % For some page styles it is handy to be able to make sure that no % section or otherwise add data to the \cs{left-} and % \cs{rightmark}. The macros \cs{clearplainmark} and \cs{clearmark} % will take one argument specifying which mark to clear, and then % redefine this mark to do nothing or to gobble its given argument. % \begin{macrocode} \newcommand\clearplainmark[1]{% \@namedef{#1mark}{}} \newcommand\clearmark[1]{% \@namedef{#1mark}{\@gobble}} % \end{macrocode} % % \end{macro} % \end{macro} % % \begin{macro}{\ps@headings} % The \pstyle{headings} pagestyle behaves differently for % twosided and onesided printing. This is a rewrite of the % standard style. % \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@headings}} % \changes{v1.61803}{2008/01/30}{Used \cs{memUChead} in \cs{ps@headings} % (mempatch v4.9)} % \changes{v1.61803}{2008/01/30}{For twosided docs set both marks for ToC, etc. (mempatch v4.9)} % \changes{v1.61803}{2008/01/30}{Eliminated \cs{@mkboth} as never used % (mempatch v4.9)} % \changes{v1.61803}{2008/01/30}{Added \cs{glossarymark} to \cs{ps@headings}} % \begin{macrocode} \if@twoside % \end{macrocode} % The footer is empty and the header contains the page number and % one of the marks. % \begin{macrocode} \makepagestyle{headings} \makepsmarks{headings}{% \def\chaptermark##1{% \markboth{\memUChead{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter \@chapapp\ \thechapter. \ % \fi \fi ##1}}{}}% \def\tocmark{\markboth{\memUChead{\contentsname}}{\memUChead{\contentsname}}}% \def\lofmark{\markboth{\memUChead{\listfigurename}}{\memUChead{\listfigurename}}}% \def\lotmark{\markboth{\memUChead{\listtablename}}{\memUChead{\listtablename}}}% \def\bibmark{\markboth{\memUChead{\bibname}}{\memUChead{\bibname}}}% \def\indexmark{\markboth{\memUChead{\indexname}}{\memUChead{\indexname}}}% \def\sectionmark##1{% \markright{\memUChead{% \ifnum \c@secnumdepth > \z@ \thesection. \ % \fi ##1}}}} % \end{macrocode} % And here's a version of the above \cs{makepsmarks} using \cs{createmark} and % \cs{createplainmark}. % \begin{macrocode} \makepsmarks{headings}{% \createmark{chapter}{left}{shownumber}{\@chapapp\ }{. \ } \createmark{section}{right}{shownumber}{}{. \ } \createplainmark{toc}{both}{\contentsname} \createplainmark{lof}{both}{\listfigurename} \createplainmark{lot}{both}{\listtablename} \createplainmark{bib}{both}{\bibname} \createplainmark{index}{both}{\indexname} \createplainmark{glossary}{both}{\glossaryname} } \makeevenhead{headings}{\thepage}{}{\slshape\leftmark} \makeoddhead{headings}{\slshape\rightmark}{}{\thepage} \else % \end{macrocode} % For one sided printing even and odd pages are treated the same, % so no need to bother with the evenhead, and % just the \cs{rightmark} is used. % \begin{macrocode} \makepagestyle{headings} \makepsmarks{headings}{% \def\chaptermark##1{% \markright{\memUChead{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter \@chapapp\ \thechapter. \ % \fi \fi ##1}}}% \def\tocmark{\markright{\memUChead{\contentsname}}}% \def\lofmark{\markright{\memUChead{\listfigurename}}}% \def\lotmark{\markright{\memUChead{\listtablename}}}% \def\bibmark{\markright{\memUChead{\bibname}}}% \def\indexmark{\markright{\memUChead{\indexname}}}} % \end{macrocode} % And here's a version of the above \cs{makepsmarks} using \cs{createmark} and % \cs{createplainmark}. % \begin{macrocode} \makepsmarks{headings}{% \createmark{chapter}{right}{shownumber}{\@chapapp\ }{. \ } \createplainmark{toc}{right}{\contentsname} \createplainmark{lof}{right}{\listfigurename} \createplainmark{lot}{right}{\listtablename} \createplainmark{bib}{right}{\bibname} \createplainmark{index}{right}{\indexname} \createplainmark{glossary}{right}{\glossaryname} } \makeoddhead{headings}{\slshape\rightmark}{}{\thepage} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\ps@myheadings} % The \pstyle{myheadings} page style is simpler because the user % has to specify the contents using \cs{markboth} and \cs{markright} % commands. This is the definition used in the standard classes. % \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@myheadings}} % \begin{verbatim}} % \newcommand{\ps@myheadings}{% % \let\@oddfoot\@empty\let\@evenfoot\@empty % \def\@evenhead{\thepage\hfil{\slshape\leftmark}}% % \def\@oddhead{{\slshape\rightmark}\hfil\thepage}% % \let\@mkboth\@gobbletwo % \let\chaptermark\@gobble % \let\sectionmark\@gobble % } % \end{verbatim} % Translating that into our terms we get: % \changes{v1.0}{2001/11/15}{Changed the code for creating the myheadings pagestyle} % \changes{v1.4}{2003/11/22}{Further change to myheadings pagestyle code} % \begin{macrocode} \makepagestyle{myheadings} \makepsmarks{myheadings}{% \let\chaptermark\@gobble \let\sectionmark\@gobble \def\tocmark{}% \def\lofmark{}% \def\lotmark{}% \def\bibmark{}% \def\indexmark{}% \def\glossarymark{}} \makeevenhead{myheadings}{\thepage}{}{\slshape\leftmark} \makeoddhead{myheadings}{\slshape\rightmark}{}{\thepage} % \end{macrocode} % (Kai von Fintel (\texttt{fintel@mit.edu}) emailed me on 2003/02/24 % saying that the original \verb?\let\tocmark\@gobble? in the myheadings % pagestyle did nasty things % to the ToC, etc. Now using \verb?\def\tocmark{}?.) % \end{macro} % % \begin{macro}{\ps@chapter} % \begin{macro}{\ps@part} % \begin{macro}{\ps@cleared} % The standard classes use the \pstyle{plain} pagestyle for the first page % of a chapter. This class uses the \pstyle{chapter} instead, which is % aliased to \pstyle{plain}. Similarly for parts. % Further, \cs{cleardoublepage} uses whatever % pagestyle is in effect for the empty verso page. I find that this % looks odd if the header contains a chapter name. This class uses % the \pstyle{cleared} pagestyle in this case. I have aliased this % to \pstyle{empty}; the \pstyle{plain} would be another reasonable choice. % \begin{macrocode} \aliaspagestyle{chapter}{plain} \aliaspagestyle{part}{plain} \aliaspagestyle{cleared}{empty} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\cleardoublepage} % A slight adjustment to the kernel definition to set a pagestyle. % \begin{macrocode} \def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else \hbox{}\thispagestyle{cleared}% \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\ps@ruled} % Partly to show how it is done, the class provides a \pstyle{ruled} pagestyle. % In this style the headers and footers are the same width as the textblock, % there is a rule under the header, page numbers are set in the footers % at the outside of the page. Even page headers have the chapter number % and title at the left, and odd page headers have the section title % at the right. % % Start by making the (empty) \pstyle{ruled} pagestyle. % \begin{macrocode} \makepagestyle{ruled} % \end{macrocode} % There is no need to change the default width (which is the \cs{textwidth}), % nor the default positions (centered), % nor to make the footrule visible. We do, though, have to put the page % numbers into the footers. % \begin{macrocode} \makeevenfoot{ruled}{\thepage}{}{} \makeoddfoot{ruled}{}{}{\thepage} % \end{macrocode} % Make the header rule visible and equal to the \cs{textwidth}. % \begin{macrocode} \makeheadrule{ruled}{\textwidth}{\normalrulethickness} % \end{macrocode} % % \begin{macro}{\@ruledmarks} % We have to make sure that the \cs{chapter} and \cs{section} commands make % the appropriate marks for use in the headers. We use the hook for this. % Note that contrary to normal \LaTeX{} practice, the titles are not % automatically upper-cased. The marks for the tocbibinds also need adjusting. % \changes{v1.1}{2002/03/10}{Changed \cs{@ruledmarks} to cater for tocbibind} % \begin{macrocode} \newcommand{\@ruledmarks}{% \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}{}} \def\glossarymark{\markboth{\glossaryname}{}} } % \end{macrocode} % And here's a version using \cs{createmark} and friends. % \begin{macrocode} \renewcommand*{\@ruledmarks}{% \nouppercaseheads \createmark{chapter}{left}{shownumber}{}{. \space} \createmark{section}{right}{shownumber}{}{. \space} \createplainmark{toc}{both}{\contentsname} \createplainmark{lof}{both}{\listfigurename} \createplainmark{lot}{both}{\listtablename} \createplainmark{bib}{both}{\bibname} \createplainmark{index}{both}{\indexname} \createplainmark{glossary}{both}{\glossaryname}} \makepsmarks{ruled}{\@ruledmarks} % \end{macrocode} % \end{macro} % % We can now define the even page header which is to have the chapter title % at the left. As the chapter mark did no upper-casing we will print it % using small caps, but just use the normal font for section title on % the odd page header. % \begin{macrocode} \makeevenhead{ruled}{\scshape\leftmark}{}{} \makeoddhead{ruled}{}{}{\rightmark} % \end{macrocode} % \end{macro} % This is all that we need to do for the \pstyle{ruled} pagestyle. % % \begin{macro}{\ps@Ruled} % Also define a \pstyle{Ruled} pagestyle similar to \pstyle{ruled} except that the % headers and footers are 10\% wider than the textblock, sticking out % into the fore edge. % \begin{macrocode} \makepagestyle{Ruled} \makerunningwidth{Ruled}{1.1\textwidth} \makeheadposition{Ruled}{flushright}{flushleft}{flushright}{flushleft} \makeevenfoot{Ruled}{\thepage}{}{} \makeoddfoot{Ruled}{}{}{\thepage} \makeheadrule{Ruled}{1.1\textwidth}{\normalrulethickness} \makepsmarks{Ruled}{\@ruledmarks} \makeevenhead{Ruled}{\scshape\leftmark}{}{} \makeoddhead{Ruled}{}{}{\rightmark} % \end{macrocode} % \end{macro} % % \begin{macro}{\headwidth} % \begin{macro}{\ps@companion} % A \pstyle{companion} pagestyle like the one in the % \textit{\LaTeX{} Companion} series. % We need the \cs{headwidth} length for this. % \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@companion}} % \begin{macrocode} \newlength{\headwidth} \makepagestyle{companion} \setlength{\headwidth}{\textwidth} \addtolength{\headwidth}{\marginparsep} \addtolength{\headwidth}{\marginparwidth} \makerunningwidth{companion}{\headwidth} \makeheadrule{companion}{\headwidth}{\normalrulethickness} \makeheadposition{companion}{flushright}{flushleft}{}{} \makepsmarks{companion}{% \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}}} % \end{macrocode} % And here's a version of the above \cs{makepsmarks} using \cs{createmark} and % \cs{createplainmark}. % \begin{macrocode} \makepsmarks{companion}{% \nouppercaseheads \createmark{chapter}{both}{nonumber}{}{} \createmark{section}{right}{shownumber}{}{. \space} \createplainmark{toc}{both}{\contentsname} \createplainmark{lof}{both}{\listfigurename} \createplainmark{lot}{both}{\listtablename} \createplainmark{bib}{both}{\bibname} \createplainmark{index}{both}{\indexname} \createplainmark{glossary}{both}{\glossaryname}} \makeevenhead{companion}{\normalfont\bfseries\thepage}{}% {\normalfont\bfseries\leftmark} \makeoddhead{companion}{\normalfont\bfseries\rightmark}{}% {\normalfont\bfseries\thepage} % \end{macrocode} % \end{macro} % \end{macro} % % Another pagestyle called \pstyle{showlocs} can be used to show the % locations of the header, footer and textblock. I would expect that % this would be mainly used as an example for authors to create their % own similar styles. % \changes{v1.6180339c}{2008/12/28}{Added the showlocs pagestyle and supporting % macros} % \changes{v1.6180339c}{2009/01/25}{Added more supporting macros for the % showlocs pagestyle} % % \begin{macro}{\ifshowheadfootloc} % \begin{macro}{\showheadfootloctrue} % \begin{macro}{\showheadfootlocfalse} % \begin{macro}{\showheadfootlocon} % \begin{macro}{\showheadfootlocoff} % \begin{macro}{\ifshowtextblockloc} % \begin{macro}{\showtextblockloctrue} % \begin{macro}{\showtextblocklocfalse} % \begin{macro}{\showtextblocklocon} % \begin{macro}{\showtextblocklocoff} % Booleans controlling the appearance, or not, of the header/footer lines % and text frame in \pstyle{showlocs}. % \begin{macrocode} \newif\ifshowheadfootloc \showheadfootloctrue \newcommand*{\showheadfootlocon}{\showheadfootloctrue} \newcommand*{\showheadfootlocoff}{\showheadfootlocfalse} \newif\ifshowtextblockloc \showtextblockloctrue \newcommand*{\showtextblocklocon}{\showtextblockloctrue} \newcommand*{\showtextblocklocoff}{\showtextblocklocfalse} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\framepichead} % For producing a zero-sized picture of a line at the base of the header. % It is meant to be used as the left part of the header for a pagestyle. % \changes{v1.6180339c}{2008/12/28}{Added \cs{framepichead}} % \begin{macrocode} \newcommand*{\framepichead}{% \ifshowheadfootloc \begin{picture}(0,0) \unitlength 1pt \put(0,0){\line(1,0){\strip@pt\textwidth}} \end{picture}% \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\framepictextfoot} % For producing a zero-sized picture of a line at the base of the footer % and a frame around the text block. It is meant to be used as the left % part of a footer for a pagestyle. % \changes{v1.6180339c}{2008/12/28}{Added \cs{framepictextfoot}} % \begin{macrocode} \newcommand*{\framepictextfoot}{% \begin{picture}(0,0) \unitlength 1pt \ifshowheadfootloc \put(0,0){\line(1,0){\strip@pt\textwidth}} \fi \ifshowtextblockloc \put(0,\strip@pt\footskip)% {\framebox(\strip@pt\textwidth,\strip@pt\textheight){}} \fi \end{picture}} % \end{macrocode} % \end{macro} % % \begin{macro}{\ps@showlocs} % The \pstyle{showlocs} pagestyle. This is more to show what can be done. % \changes{v1.6180339c}{2008/12/28}{Added the showlocs pagestyle} % \begin{macrocode} \makepagestyle{showlocs} \makeevenhead{showlocs}{\framepichead\thepage}{\thepage}{\thepage} \makeoddhead{showlocs}{\framepichead\thepage}{\thepage}{\thepage} \makeevenfoot{showlocs}{\framepictextfoot\thepage}{\thepage}{\thepage} \makeoddfoot{showlocs}{\framepictextfoot\thepage}{\thepage}{\thepage} % \end{macrocode} % \end{macro} % % \begin{macro}{\fixheaderwidths} % The companion pagestyle, at least, needs adjusting (at \cs{fixthelayout} time) % if the \cs{textwidth} has changed from its initial value. % \changes{v1.6180339f}{2009/03/16}{Added \cs{fixheaderwidths}} % \begin{macrocode} \newcommand*{\fixheaderwidths}{% % companion pagestyle \setlength{\headwidth}{\textwidth} \addtolength{\headwidth}{\marginparsep} \addtolength{\headwidth}{\marginparwidth} \makerunningwidth{companion}{\headwidth} \makeheadrule{companion}{\headwidth}{\normalrulethickness} \makefootrule{companion}{\textwidth}{\footruleheight}{\footruleskip} } % \end{macrocode} % \end{macro} % % % \subsection{Page numbering} % % The kernel includes the \cs{pagenumbering} command for setting the % style (arabic, roman, etc.) of the page numbers, and at the same % time it resets the page counter. I want a version that resets the style % but not the number\footnote{Added to meet a request by Daniel Richard G. % (\texttt{skunk@mit.edu}) September 2001.}. % % \begin{macro}{\pagenumbering} % \begin{macro}{\pagenumbering*} % \cs{pagenumbering}\marg{style} is the normal version whereas % the starred version does not reset the counter. % \changes{v1.0}{2001/09/21}{Added \cs{pagenumbering} and \cs{pagenumbering*} } % \begin{macrocode} \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} % \cs{savepagenumber} saves the current page number and \cs{restorepagenumber} % sets the page number to the stored value. % \changes{v1.0}{2001/09/24}{Added \cs{savepagenumber} and \cs{restorepagenumber}} % \begin{macrocode} \newcommand{\savepagenumber}{\global\c@storedpagenumber \c@page} \newcommand{\restorepagenumber}{\global\c@page \c@storedpagenumber} % \end{macrocode} % \end{macro} % \end{macro} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \section{Non-traditional spacing} % \changes{v1.61803}{2008/01/30}{Added non-traditional spacing % (mempatch v4.6)} % % \subsection{Double spacing} % % This is an embedding and extension of the code from the \Lpack{setspace} % package, with % names changed. % % \begin{macro}{\setSpacing} % \cs{setSpacing}\marg{num} effectively increases the \cs{baselineskip} to % \meta{num}*\cs{baselineskip}. % (In package was \cs{setstretch}). % \begin{macrocode} \newcommand*{\setSpacing}[1]{% \def\baselinestretch{#1}% \@currsize} % \end{macrocode} % \end{macro} % % \begin{macro}{\setSingleSpace} % \begin{macro}{\setFootnoteSpacing} % \begin{macro}{\setFloatSpacing} % \cs{setSingleSpace}\marg{num} effectively increases the \cs{baselineskip} for % single spacing to \meta{num}*\cs{baselineskip} (\meta{num} should be % close to 1.0). (In package was \cs{SetSinglespace}). We extend with % two extra macros \cs{setFootnoteSpacing} and \cs{setFloatSpacing} % which can be used to explicitly set the spacing inside page notes % (fotnotes and friends) and inside floats. Changing % \cs{setSingleSpace} will also set page note and float spacings to % the same value. % \changes{v3.6g}{2010/09/19}{Added two extra 'single' spacing macros} % \begin{macrocode} \newcommand*{\setSingleSpace}[1]{% \def\m@m@singlespace{#1}% \def\m@m@footnote@spacing{#1}% \def\m@m@float@spacing{#1} % } \setSingleSpace{1} \newcommand*\setPagenoteSpacing[1]{\def\m@m@footnote@spacing{#1}} \newcommand*\setFloatSpacing[1] {\def\m@m@float@spacing{#1}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\SingleSpacing} % \cs{SingleSpacing} starts single spacing. (In package was \cs{singlespacing}). % \changes{v3.6g}{2010/09/19}{Added reset of the float and page note spacings} % \begin{macrocode} \newcommand*{\SingleSpacing}{% \setSpacing{\m@m@singlespace}% \edef\m@m@footnote@spacing{\baselinestretch}% \edef\m@m@float@spacing{\baselinestretch}% \vskip\baselineskip% correction for coming into single spacing } \SingleSpacing % \end{macrocode} % \end{macro} % % % \begin{macro}{\@OnehalfSpacing} % \begin{macro}{\OnehalfSpacing} % \cs{OnehalfSpacing} starts `one and a half' spacing, which to most % thesis nitpickers will look like double spacing. % (In package was \cs{onehalfspacing}). The starred version % \cs{OnehalfSpacing*} will also give page notes and floats the same spacing % \changes{v3.6g}{2010/09/19}{Made \cs{OnehalfSpacing} into a starred % version such that the starred version makes everything one half % spaced including page notes and floats} % \begin{macrocode} \newcommand*{\@OnehalfSpacing}{ \setSpacing{1.25}% default (10pt) \ifcase \@ptsize \relax % 10pt \setSpacing{1.25}% \or% 11pt \setSpacing{1.213}% \or% 12pt \setSpacing{1.241}% \or\or% 14pt \setSpacing{1.20}% \or\or\or% 17pt \setSpacing{1.16}% \or\or% 9pt \setSpacing{1.35}% \else% the extended sizes \setSpacing{1.16}% \fi} \newcommand*\OnehalfSpacing{% \@ifstar{% \@OnehalfSpacing% \edef\m@m@footnote@spacing{\baselinestretch}% \edef\m@m@float@spacing{\baselinestretch}% }{\@OnehalfSpacing}% } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\DoubleSpacing} % \begin{macro}{\@DoubleSpacing} % \cs{DoubleSpacing} starts double spacing, which to most thesis nitpickers % will look far too spaced out. (In package was % \cs{doublespacing}). The starred version will also set the page note % and float spacing to the same value. % \changes{v3.6g}{2010/09/19}{Extended with a starred version.} % \begin{macrocode} \newcommand*{\@DoubleSpacing}{ \setSpacing{1.667}% default (10pt) \ifcase \@ptsize \relax % 10pt \setSpacing{1.667}% \or% 11pt \setSpacing{1.618}% \or% 12pt \setSpacing{1.655}% \or\or% 14pt \setSpacing{1.60}% \or\or\or% 17pt \setSpacing{1.545}% \or\or% 9pt \setSpacing{1.8}% \else% larger sizes \setSpacing{1.5}% \fi} \newcommand*\DoubleSpacing{% \@ifstar{% \@DoubleSpacing% \edef\m@m@footnote@spacing{\baselinestretch}% \edef\m@m@float@spacing{\baselinestretch}% }{\@DoubleSpacing}% } % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\@setsize} % Modify the kernel command. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% check what this does!!!!!!!! % \begin{macrocode} \renewcommand*{\@setsize}[4]{% \@nomath#1% \let\@currsize#1% \baselineskip #2% \baselineskip \baselinestretch\baselineskip \parskip \baselinestretch\parskip \setbox\strutbox \hbox{% \vrule height.7\baselineskip depth .3\baselineskip width \z@}% \skip\footins \baselinestretch\skip\footins \normalbaselineskip\baselineskip#3#4} % \end{macrocode} % \end{macro} % % % \begin{environment}{SingleSpace} % Environment form of \cs{SingleSpacing}. (In package was \texttt{singlespace}). % \begin{macrocode} \newenvironment{SingleSpace}{% \vskip\baselineskip \setSpacing{\m@m@singlespace}% \vskip -\baselineskip }{\par} % \end{macrocode} % \end{environment} % % \begin{environment}{SingleSpace*} % Don't use this; it's only here to match the \Lpack{setspace} package. % (In package was \texttt{singlespace*}). % \begin{macrocode} \newenvironment{SingleSpace*}{% %% \vskip\baselineskip \setSpacing{\m@m@singlespace}% \vskip 0.5\baselineskip }{\vskip -0.5\baselineskip} % \end{macrocode} % \end{environment} % % \begin{macro}{\m@mrestore@spacing} % \begin{macrocode} \newcommand*{\m@mrestore@spacing}{% \par \vskip \parskip \vskip \baselineskip \endgroup \vskip -\parskip \vskip -\baselineskip} % \end{macrocode} % \end{macro} % % \begin{environment}{Spacing} % \verb?\begin{Spacing}{num}? increases the \cs{baselineskip} % to \verb?num*\baselineskip?. (In package was \texttt{spacing}). % \begin{macrocode} \newenvironment{Spacing}[1]{% \par \begingroup \setSpacing{#1}}{\m@mrestore@spacing} % \end{macrocode} % \end{environment} % % \begin{environment}{OnehalfSpace} % Environment form of \cs{OnehalfSpacing}. (In package was \texttt{onehalfspace}). % \changes{v3.6g}{2010/09/19}{Added starred version of environment to % complement the starred macro version} % \begin{macrocode} \newenvironment{OnehalfSpace}{% \begingroup \OnehalfSpacing}{\m@mrestore@spacing} \newenvironment{OnehalfSpace*}{% \begingroup \OnehalfSpacing*}{\m@mrestore@spacing} % \end{macrocode} % \end{environment} % % \begin{environment}{DoubleSpace} % Environment form of \cs{DoubleSpacing}. (In package was \texttt{doublespace}). % \changes{v3.6g}{2010/09/19}{Added starred version of environment to % complement the starred macro version} % \begin{macrocode} \newenvironment{DoubleSpace}{% \begingroup \DoubleSpacing}{\m@mrestore@spacing} \newenvironment{DoubleSpace*}{% \begingroup \DoubleSpacing}{\m@mrestore@spacing} % \end{macrocode} % \end{environment} % % % Deal with spacing around displays. % % \begin{macro}{\memdskipstretch} % \begin{macro}{\setDisplayskipStretch} % \begin{macro}{\noDisplayskipStretch} % \cs{setDisplayskipStretch}\marg{num} changes space around displays by the % factor (1+\meta{num}). \cs{noDisplaydkipStretch} keeps the regular % spacing around displays. (In package were \cs{setdisplayskipstretch} and % the \texttt{nodisplayskipstretch} option). % \begin{macrocode} \newcommand*{\memdskipstretch}{0.0} \newcommand*{\setDisplayskipStretch}[1]{% \renewcommand*{\memdskipstretch}{#1}} \newcommand*{\noDisplayskipStretch}{\setDisplayskipStretch{0.0}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\memdskips} % Macro added to the kernel hook \cs{everydisplay}, changing the settings % of displayskips % \begin{macrocode} \newcommand*{\memdskips}{% \advance\abovedisplayskip \memdskipstretch\abovedisplayskip \advance\belowdisplayskip \memdskipstretch\belowdisplayskip \advance\abovedisplayshortskip \memdskipstretch\abovedisplayshortskip \advance\belowdisplayshortskip \memdskipstretch\belowdisplayshortskip} % \end{macrocode} % \end{macro} % % \begin{macro}{\everydisplay} % \begin{macrocode} \everydisplay\expandafter{% \the\everydisplay \memdskips} % \end{macrocode} % \end{macro} % % \begin{macro}{\@xfloat} % Reset \cs{baselinestretch} in floats. % \begin{macrocode} \let\m@m@xfloat\@xfloat \def\@xfloat #1[#2]{% \m@m@xfloat #1[#2]% \def\baselinestretch{\m@m@float@spacing}% \normalsize} % \end{macrocode} % \end{macro} % % The extra spacing does not add space before and after a minipage. % The solution, hinted at by Donald Arseneau, is to create a new % environment. I came up with a solution which DA then much improved upon % (CTT \textit{setspace and minipages}, 2006/11/28). % This is like minipage from an author's view, except that it is % always top positioned and acts like a paragraph. % \begin{macro}{\memPD} % \begin{macrocode} \newdimen\memPD % \end{macrocode} % \end{macro} % \begin{environment}{vminipage} % The user view, just as for \texttt{minipage}, but ensures the \texttt{t} % position and as a new paragraph. It is like \texttt{minipage} but with % better fore and aft spacing. % \begin{macrocode} \newenvironment{vminipage}{% \par \@ifnextchar[%] \@ivminipage {\@iiiminipage t\relax[s]} }{% \par\global\memPD=\prevdepth \endminipage \par \kern-\memPD% no pagebreak allowed here \hbox{\vrule depth \memPD width \z@}} % \end{macrocode} % \end{environment} % % \begin{macro}{\@ivminipage} % Deal with first optional argument to \texttt{vminipage}. % \begin{macrocode} \def\@ivminipage[#1]{% \@ifnextchar[%] {\@iiminipage{t}}{\@iiiminipage{t}\relax[s]}} % \end{macrocode} % \end{macro} % % % \subsection{Abnormal parskips} % % Non-zero, positive \cs{parskip}, which is not to be encouraged. Code % based on Robin Fairbairns \Lpack{parskip} package and the NTG classes. % % \begin{macro}{\ifm@mnzpskip} % \begin{macro}{\m@mnzpskiptrue} % \begin{macro}{\m@mnzpskipfalse} % \cs{ifm@mnzpskip} is TRUE if \cs{parskip} set to anything but 0pt. % \begin{macrocode} \newif\ifm@mnzpskip % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\traditionalparskip} % \begin{macro}{\m@mabparskip} % \begin{macro}{\abnormalparskip} % \begin{macro}{\nonzeroparskip} % \cs{traditionalparskip} sets \cs{parskip} to 0pt. % \cs{abnormalparskip}\marg{length} sets \cs{parskip} to \meta{length}. % \cs{nonzeroparskip} sets \cs{parskip} to a non-zero value that might be % not too bad (any non-zero \cs{parskip} is not good). % \changes{v1.61803398c}{2009/11/13}{\cs{parskip} was set to \cs{z@}, % thus the stretch was missing, this broke \cs{flushbottom}} % \begin{macrocode} \newcommand*{\traditionalparskip}{% \setlength\parskip{0\p@ \@plus \p@} \m@mnzpskipfalse} \newskip\m@mabparskip \newcommand*{\abnormalparskip}[1]{% \setlength{\parskip}{#1}\m@mabparskip=#1\relax \m@mnzpskiptrue} \newcommand*{\nonzeroparskip}{\abnormalparskip{% 0.5\baselineskip \@plus .1\baselineskip \@minus .1\baselineskip% NTG %% 0.5/baselineskip \@plus 2pt% RF }} \traditionalparskip % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\@minpagerestore} % This needs extending: here's what NTG does, but I've put the % appropriate code later. % \begin{verbatim} % \providecommand*{\@minipagerestore}{% % \parskip=.5\baselineskip \@plus .1\baselineskip \@minus .1\baselineskip} % \end{verbatim} % \end{macro} % % \section{Titles} % % For books the title is usually designed specifically for the particular % work, so originally the class did not provide a \cs{maketitle} command or % any of the \cs{title} and other commands that normally go along with this. % After some thought I decided to add in the code from the % \Lpack{titling} package~\cite{TITLING}. However, in this case life % is a bit simpler as there is no pre-existing class code. % \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 \cs{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 \cs{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} % % \changes{v1.2}{2002/08/10}{Deprecated \cs{thanksfootextra}} % \changes{v1.2}{2002/08/10}{Removed \cs{thanksfootpre} and \cs{thanksfootpost}} % \changes{v1.4}{2003/12/14}{Removed \cs{thanksfootextra}} % % \begin{macro}{\thanksmark} % This adds a thanks mark. The \cs{footnotemark} could have been used directly % but it is fragile in a moving argument. % \begin{macrocode} \DeclareRobustCommand{\thanksmark}[1]{\footnotemark[#1]} % \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 \cs{@thefnmark}. For some reason % using \cs{@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} % \cs{thanksscript} is a wrapper round the actual mark stuff to be typeset. % The user can define this via \cs{thanksmarkstyle}\marg{code}. % The default is a superscript mark. % \changes{v1.2}{2002/08/10}{Added \cs{thanksmarkstyle}} % \begin{macrocode} \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 \cs{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}} % \changes{v1.61803398}{2009/07/17}{Added bidi support to \cs{makethanksmark}} % \changes{v1.61803398b}{2009/09/21}{fixed typo, \cs{thanksmarksep} % not \cs{thanksmark}} % \begin{macrocode} \newcommand{\makethanksmark}{% \leavevmode% \parindent 1em\noindent %%% \leftskip\thanksmarksep\relax \memRTLleftskip\thanksmarksep\relax %%% \advance\leftskip\thanksmarkwidth \advance\memRTLleftskip\thanksmarkwidth %%% \null\nobreak\hskip-\leftskip\relax \null\nobreak\hskip-\memRTLleftskip\relax \makethanksmarkhook\relax \thanksfootmark} % \end{macrocode} % \end{macro} % % \begin{macro}{\usethanksrule} % \begin{macro}{\cancelhanksrule} % Simple macros that let \cs{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 \cs{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 \cs{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 \cs{maketitle} as in the \Lpack{article}, \Lpack{report}, % and \Lpack{book} classes. It sets the pagestyle to \pstyle{title}. % \changes{v1.4}{2004/01/21}{Removed the \cs{rlap} from \cs{@makefnmark} % in \cs{maketitle} so multiple \cs{thanks} % work per \cs{footnote}} % \changes{v1.618}{2005/09/03}{Fix to remove extra blank page when % \cs{maketitle} (and \cs{@maketitle}) is used within adjustwidth % inside a titlingpage (mempatch v3.2)} % \begin{macrocode} \newcommand{\maketitle}{\par \begingroup \@bsmarkseries \def\@makefnmark{\@textsuperscript{% \normalfont\@bsthanksheadpre \tamark \@bsthanksheadpost}}% \long\def\@makefntext##1{\makethanksmark ##1} \if@twocolumn \ifnum \col@number=\@ne \@maketitle \else \twocolumn[\@maketitle]% \fi \else \ifdim\pagetotal>\z@ \newpage \fi \global\@topnum\z@ \@maketitle \fi \thispagestyle{title}\@thanks \endgroup \@bscontmark % \setcounter{footnote}{0}% } \aliaspagestyle{title}{plain} % \end{macrocode} % \end{macro} % % \begin{macro}{\@mem@titlefootkill} % \cs{@mem@titlefootkill}\marg{note} Warn about footnotes in titles. % \begin{macrocode} \newcommand*{\@mem@titlefootkill}[1]{% \@memwarn{Do not use \string\footnote\space in \string\maketitle.\MessageBreak Use \protect\thanks\space instead}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@maketitle} % Our version of \cs{@maketitle}. % Footnotes are killed in the title; see the thread `\cs{title}, \cs{author} % and \cs{footnote} feature in memoir class', February 2003. % \changes{v1.4}{2003/11/16}{Killed footnote in titles (from patch v1.4)} % \begin{macrocode} \newcommand{\@maketitle}{% \let\footnote\@mem@titlefootkill \ifdim\pagetotal>\z@ \newpage \fi \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} % % \begin{environment}{titlingpage} % The \Lenv{titlingpage} environment sets the pagestyle to be \pstyle{titlingpage}, % disables the footnote rule and ensures that the page is single % column. At the end it switches back to twocolumn if neccessary, % and then starts a new page as number 1. % \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 \cs{thanks} texts. % \begin{macrocode} \newcommand{\emptythanks}{\global\let\@thanks\@empty} % \end{macrocode} % \end{macro} % % \begin{macro}{\andnext} % The kernel \cs{and} macro puts space between author's names. The % \cs{andnext} macro puts a newline between the names. % \changes{v1.6}{2004/01/28}{Added \cs{andnext}} % \begin{macrocode} \newcommand*{\andnext}{% \end{tabular}\\ \begin{tabular}[t]{c}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@bsmtitlempty} % \cs{@bsmtitlempty} is a helper macro to save some macro space. % It empties some elements of \cs{maketitle}. % \begin{macrocode} \newcommand{\@bsmtitlempty}{% \global\let\maketitle\relax \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 % \cs{thetitle}, \cs{theauthor} and \cs{thedate}. % \changes{v1.6}{2004/01/28}{changed \cs{keepthetitle} to cater for \cs{andnext}} % \begin{macrocode} \newcommand{\keepthetitle}{% \@bsmtitlempty \global\let\thanks\relax \global\let\and\relax \global\let\andnext\relax \global\let\@thanks\@empty \global\let\@title\@empty \global\let\@author\@empty \global\let\@date\@empty} % \end{macrocode} % \end{macro} % % \begin{macro}{\killtitle} % \cs{killtitle} undefines the remaining macros of \cs{maketitle}. % \begin{macrocode} \newcommand{\killtitle}{% \keepthetitle \global\let\thetitle\relax \global\let\theauthor\relax \global\let\thedate\relax} % \end{macrocode} % \end{macro} % % % \begin{macro}{\thetitle} % \begin{macro}{\theauthor} % \begin{macro}{\thedate} % In order to make the \cs{title}, etc., values available for printing % their definitions (in \file{ltsect.dtx}) need extending to save their % arguments. We have to make sure that extraneous material, % like \cs{thanks}, is excluded from the saved texts. % \changes{v1.4}{2003/11/16}{Gobble footnotes in \cs{title}, \cs{author} % and \cs{date} (from patch v1.4)} % \changes{v1.6}{2004/01/28}{Added \cs{andnext} handling to \cs{author}} % \begin{macrocode} \addtoiargdef{\title}{% \begingroup\let\footnote\@gobble}{% \begingroup \renewcommand{\thanks}[1]{} \renewcommand{\thanksmark}[1]{} \renewcommand{\thanksgap}[1]{} \protected@xdef\thetitle{#1} \endgroup\endgroup} \addtoiargdef{\author}{% \begingroup\let\footnote\@gobble}{% \begingroup \renewcommand{\thanks}[1]{} \renewcommand{\and}{\unskip, } \renewcommand{\andnext}{\unskip, } \renewcommand{\thanksmark}[1]{} \renewcommand{\thanksgap}[1]{} \protected@xdef\theauthor{#1} \endgroup\endgroup} \addtoiargdef{\date}{% \begingroup\let\footnote\@gobble}{% \begingroup \renewcommand{\thanks}[1]{} \renewcommand{\thanksmark}[1]{} \renewcommand{\thanksgap}[1]{} \protected@xdef\thedate{#1} \endgroup\endgroup} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % % \section{Parts, chapters and other divisions} % % \subsection{Building blocks} The definitions in this part of a % class file usually make use of two internal macros, \cs{@startsection} and % \cs{secdef}. To understand % what is going on here, we describe their syntax. % % \DescribeMacro{\@startsection} % The macro \cs{@startsection} has 6 required arguments, optionally % followed by a $*$, an optional argument and a required argument: % % \cs{@startsection}\meta{name}\meta{level}\meta{indent}^^A % \meta{beforeskip}\meta{afterskip}\meta{style} % optional * %\\ % \null\hphantom{\bslash @startsection}^^A % \oarg{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 \cs{@startsection} and % its first six arguments. % % \DescribeMacro{\secdef} % The macro \cs{secdef} can be used when a sectioning command is % defined without using \cs{@startsection}. It has two arguments: % % \cs{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 \cs{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 \cs{@startsection} macro uses \verb?\@hangfrom{NUM}?, where % \verb?NUM? is the sectional number, to produce a hanging paragraph. That is, % the second and later lines of a multiline title are indented from the % left margin by the width of the number. % The definition of \cs{@hangfrom}, from \file{ltsect.dtx}, is: % \begin{verbatim} % \def\@hangfrom#1{\setbox\@tempboxa\hbox{{#1}}% % \hangindent \wd\@tempboxa\noindent\box\@tempboxa} % \end{verbatim} % % To get a normal paragraphed title you can do: \\ % \verb?\renewcommand{\@hangfrom}[1]{#1}? \\ % or as a block paragraph: \\ % \verb?\renewcommand{\@hangfrom}[1]{\noindent #1}}? \\ % % \DescribeMacro{\@seccntformat} % The \cs{@startsection} macro also uses \verb?\@seccntformat{NUM}? to format % the section number, including the space after it. Its definition, % from \file{ltsect.dtx}, is % \begin{verbatim} % \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 % book & -2 \\ % 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, with the exception % of the book division which is a memoir addition, and are given in % Table~\ref{tab:levels}. % \changes{v1.61803}{2008/01/30}{Added book division (from mempatch v4.4)} % \subsection{Mark commands} % % \begin{macro}{\bookpagemark} % \begin{macro}{\partmark} % \begin{macro}{\chaptermark} % \begin{macro}{\sectionmark} % \begin{macro}{\subsectionmark} % \begin{macro}{\subsubsectionmark} % \begin{macro}{\paragraphmark} % \begin{macro}{\subparagraphmark} % The default initialisations of the \cs{...mark} commands for use in % the pagestyles. Most are already defined in the kernel but they are % all noted here. % \begin{macrocode} \newcommand*{\bookpagemark}[1]{} \newcommand*{\partmark}[1]{} \newcommand*{\chaptermark}[1]{} % \newcommand*{\sectionmark}[1]{} % \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} % \end{macro} % % \begin{macro}{\bibmark} % Marks for the bibliography, which may be filled with \cs{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 \cs{indexname}. % \changes{v1.1}{2002/03/10}{Added \cs{indexmark}} % \begin{macrocode} \newcommand*{\indexmark}{} % \end{macrocode} % \end{macro} % % \begin{macro}{\glossarymark} % Marks for the glossary, which may be filled with \cs{glossaryname}. % \changes{v1.618}{2005/09/25}{Added \cs{glossarymark}} % \begin{macrocode} \newcommand*{\glossarymark}{} % \end{macrocode} % \end{macro} % % % \subsection{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@book} % \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\\ % \cs{newcounter}\marg{newctr}\oarg{oldctr}\\ % defines\meta{newctr} to be a counter, which is reset to zero when % counter \meta{oldctr} is stepped. Counter \meta{oldctr} must % already be defined. % % Book, part and chapter are the top level document divisions. % \begin{macrocode} \newcounter{book} \setcounter{book}{0} \newcounter{part} \setcounter{part}{0} \newcounter{chapter} \setcounter{chapter}{0} % \end{macrocode} % The lower level divisions get reset by higher level divisions. % \begin{macrocode} \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} % \end{macro} % % \begin{macro}{\thebook} % \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}, \cs{theCTR} is a macro that defines % the printed version of counter \Lcount{CTR}. It is defined in % terms of the following macros: % % \cs{arabic}\marg{COUNTER} prints the value of % \meta{COUNTER} as an arabic numeral. % % \cs{roman}\marg{COUNTER} prints the value of % \meta{COUNTER} as a lowercase roman numeral. % % \cs{Roman}\marg{COUNTER} prints the value of % \meta{COUNTER} as an uppercase roman numeral. % % \cs{alph}\marg{COUNTER} prints the value of \meta{COUNTER} % as a lowercase letter: $1 =$~a, $2 =$~ b, etc. % % \cs{Alph}\marg{COUNTER} prints the value of \meta{COUNTER} % as an uppercase letter: $1 =$~A, $2 =$~B, etc. % % \begin{macrocode} \renewcommand*{\thebook}{\@Roman\c@book} \renewcommand*{\thepart}{\@Roman\c@part} \renewcommand*{\thechapter}{\@arabic\c@chapter} \renewcommand*{\thesection}{\thechapter.\@arabic\c@section} \renewcommand*{\thesubsection}{% \thesection.\@arabic\c@subsection} \renewcommand*{\thesubsubsection}{% \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} % \end{macro} % % \begin{macro}{\@chapapp} % \cs{@chapapp} is initially defined as \cs{chaptername}. The \cs{appendix} % command redfines it as \cs{appendixname}. % \begin{macrocode} \newcommand{\@chapapp}{\chaptername} % \end{macrocode} % \end{macro} % % \subsection{Front, main and back matter} % % These are the three main logical divisions in a book. As noted earlier, % the boolean \cs{if@mainmatter} is TRUE iff the main matter is being % processed. Chapters will be unnumbered when \cs{if@mainmatter} is FALSE. % % \begin{macro}{\frontmatter} % \begin{macro}{\frontmatter*} % The \cs{frontmatter} command starts roman numbering and turns off % chapter numbering. % It ensures that lower level divisions will not have chapter numbers, % nor will figures or tables. It % 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}{\@memfront@floats} % \changes{v1.6180339f}{Added \cs{@memfront@floats}} % Factoring out the float counter domination, in case someone wants % something added or changed % \begin{macrocode} \newcommand\@memfront@floats{% \counterwithout{figure}{chapter} \counterwithout{table}{chapter} } % \end{macrocode} % \end{macro} % \begin{macro}{\@smemfront} % \begin{macrocode} \newcommand{\@smemfront}{% \cleardoublepage \@mainmatterfalse \setcounter{secnumdepth}{-10} \@memfront@floats } % \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 \cs{mainmatter} command starts arabic numbering and turns on chapter numbering. % It sets numbering to the normal state. It % also ensures that the next page will be recto. The starred version does % not change the page numbering. % % Romano Giannetti suggested that \cs{mainmatter} (and \cs{backmatter}) should % be almost no-ops with the article option. % \changes{v0.3}{2001/07/09}{\cs{mainmatter} switches on section numbering % via the secnumdepth counter} % \changes{v1.0}{2001/09/21}{Added \cs{mainmatter*} command} % \begin{macrocode} \newcommand{\mainmatter}{% \@ifstar{\@smemmain}{\@memmain}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@memmain@floats} % \changes{v1.6180339f}{Added \cs{@memmain@floats}} % Factoring out the float counter domination, in case someone wants % something added or changed % \begin{macrocode} \newcommand\@memmain@floats{% \counterwithin{figure}{chapter} \counterwithin{table}{chapter} } % \end{macrocode} % \end{macro} % \begin{macro}{\@smemmain} % If \cs{frontmatter} and \cs{mainmatter} are used with the article option, % then a page numbering / margin problem can occur if the frontmatter ends % on an odd page --- the first mainmatter next page is odd as well which throws % puts two odd-margined pages together. % % One fix from Morten is to always \cs{cleardoublepage} for twosided articles. % % One fix from me is for the ...matter macros to just switch on/off section % numbering. % % Morten's is simpler to implement. % % \changes{v1.1}{2002/03/10}{Modified \cs{@smemmain} to reset the secnumdepth % counter to maxsecnumdepth} % \changes{v1.4}{2003/11/22}{Included cognizance of article option in \cs{@smemmain} % (from patch v1.7)} % \changes{v1.61803}{2008/01/30}{Changed timing of \cs{clear[double]page} in % \cs{@smemmain} (David Wilson, mempatch v4.5)} % \changes{v1.61803}{2008/01/30}{Changed clear pages in \cs{@smemmain} % (mempatch v4.9)} % \begin{macrocode} \newcommand*{\@smemmain}{% \@mainmattertrue \setcounter{secnumdepth}{\value{maxsecnumdepth}} \ifartopt \if@twoside \cleardoublepage \else \clearpage \fi \else \cleardoublepage \@memmain@floats \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@memmain} % \begin{macrocode} \newcommand{\@memmain}{% \@smemmain\pagenumbering{arabic}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@memback@floats} % \changes{v1.6180339f}{Added \cs{@memback@floats}} % Factoring out the float counter domination, in case someone wants % something added or changed % \begin{macrocode} \newcommand\@memback@floats{% \counterwithout{figure}{chapter} \counterwithout{table}{chapter} \setcounter{figure}{0} \setcounter{table}{0} } % \end{macrocode} % \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} % \changes{v1.4}{2003/11/22}{Included cognizance of article option in \cs{backmatter} % (from patch v1.7)} % \begin{macrocode} \newcommand{\backmatter}{% \ifartopt \clearpage \else \if@openright \cleardoublepage \else \clearpage \fi \fi \@mainmatterfalse \setcounter{secnumdepth}{-10} \ifartopt\else \@memback@floats \fi} % \end{macrocode} % \end{macro} % % % \subsection{Book} % % This was added at the request of Frederic Connes who said that in % Frency typography there was often a division above the \cs{part} level. % % \begin{macro}{\theHbook} % \begin{macro}{\toclevel@book} % These are needed if the \Lpack{hyperref} is used. % \begin{macrocode} \newcommand*{\theHbook}{\arabic{book}} \newcommand*{\toclevel@book}{-2} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\book} % \begin{macro}{\book*} % \cs{book}\marg{title} starts a new book division called \meta{title}. % The actual typesetting of the title is done by \cs{@book} or \cs{@sbook}. % \changes{v1.61803}{2008/01/30}{Added \cs{book} and its entourage (mempatch v4.4)} % \begin{macrocode} \newcommand*{\book}{% \@setupbook \secdef\@book\@sbook} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\beforebookskip} % \begin{macro}{\midbookskip} % \begin{macro}{\afterbookskip} % These three macros are the skips before, in the middle, and after the % Book heading. % \begin{macrocode} \newcommand*{\beforebookskip}{\null\vfil} \newcommand*{\midbookskip}{\par\vskip 2\onelineskip} \newcommand*{\afterbookskip}{\vfil\newpage} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@setupbook} % This macro does the work of setting up for the \cs{book} command. % A single column page, normally recto, with a \pstyle{book} pagestyle is % started. % \begin{macrocode} \newcommand{\@setupbook}{% \if@openright \cleardoublepage \else \clearpage \fi \thispagestyle{book}% \if@twocolumn \onecolumn \@tempswatrue \else \@tempswafalse \fi \beforebookskip} % \end{macrocode} % \end{macro} % % \begin{macro}{\booknamefont} % \begin{macro}{\booknumfont} % \begin{macro}{\booktitlefont} % These three macros specify the fonts for the book name and number, and % for the book title, respectively. % \begin{macrocode} \newcommand*{\booknamefont}{\normalfont\huge\bfseries} \newcommand*{\booknumfont}{\normalfont\huge\bfseries} \newcommand*{\booktitlefont}{\normalfont\Huge\bfseries} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\printbookname} % \begin{macro}{\booknamenum} % \begin{macro}{\printbooknum} % \begin{macro}{\printbooktitle} % Macros to print the various books of a Book heading. % \begin{macrocode} \newcommand*{\printbookname}{\booknamefont \bookname} \newcommand*{\booknamenum}{\space} \newcommand*{\printbooknum}{\booknumfont \thebook} \newcommand*{\printbooktitle}[1]{\booktitlefont #1} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\membookinfo} % \begin{macro}{\membookstarinfo} % \begin{macrocode} \newcommand{\membookinfo}[3]{} \newcommand{\membookstarinfo}[1]{} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\@book} % \cs{@book}\oarg{short}\marg{long} typesets the title of a \cs{book} % book. There is a number if \cs{secnumdepth} is greater than -3. % \begin{macrocode} \long\def\@book[#1]#2{% \M@gettitle{#1}% \phantomsection \ifnum \c@secnumdepth >-3\relax \refstepcounter{book}% \addcontentsline{toc}{book}% {\protect\booknumberline{\thebook}#1}% \membookinfo{\thebook}{#1}{#2}% \else \addcontentsline{toc}{book}{#1}% \membookinfo{}{#1}{#2}% \fi % \end{macrocode} % Empty the marks, center the title on the page, and set the normal font. % \changes{v3.6j}{2011/03/03}{Set \cs{parskip} to zero, such that a % non-zero \cs{parskip} does not interfer with the title layout} % \begin{macrocode} \bookpagemark{#1}% {\centering \interlinepenalty \@M \parskip\z@ \normalfont % \end{macrocode} % Print the number, if there is one, then the title below. Macro \cs{@endbook} % tidies everything up at the end. % \begin{macrocode} \ifnum \c@secnumdepth >-3\relax \printbookname \booknamenum \printbooknum \midbookskip \fi \printbooktitle{#2}\par}% \@endbook} % \end{macrocode} % \end{macro} % % \begin{macro}{\@sbook} % \cs{@sbook}\marg{long} formats the title of a \cs{book*} book. It is % simpler than \cs{@book} because there is no number to print. % \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{@sbook}} % \changes{v3.6j}{2011/03/03}{Set \cs{parskip} to zero here as well} % \begin{macrocode} \long\def\@sbook#1{% \M@gettitle{#1}% \phantomsection \membookstarinfo{#1}% {\centering \interlinepenalty \@M \parskip\z@ \normalfont \printbooktitle{#1}\par}% \@endbook} % \end{macrocode} % \end{macro} % % \begin{macro}{\ifm@mnobooknewpage} % \begin{macro}{\m@mnobooknewpagetrue} % \begin{macro}{\m@mnobooknewpagefalse} % \begin{macro}{\bookblankpage} % \begin{macro}{\nobookblankpage} % The declaration \cs{nobookblankpage} prevents \cs{book} from % outputting a further (blank) page when it finishes. The default is set by % \cs{bookblankpage}. % \begin{macrocode} \newif\ifm@mnobooknewpage \m@mnobooknewpagefalse \newcommand*{\bookblankpage}{\m@mnobooknewpagefalse} \newcommand*{\nobookblankpage}{\m@mnobooknewpagetrue} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\bookpageend} % \begin{macro}{\@endbook} % This finishes off both \cs{@book} and \cs{@sbook}. % Following a \cs{nobookblankpage} nothing is done, otherwise % (after \cs{bookblankpage}) the current page is flushed, % and an extra blank page is created if both \Lopt{twoside} and % \Lopt{openright} are in effect. % At the end, if necessary, two column mode is switched back on. % \changes{v1.61803398}{2009/07/26}{PW: Added \cs{bookpageend} as cover for \cs{@endbook}} % \begin{macrocode} \newcommand*{\bookpageend}{\afterbookskip \ifm@mnobooknewpage \else \if@twoside \if@openright \null \thispagestyle{afterbook}% \newpage \fi \fi \fi \if@tempswa \twocolumn \fi} \def\@endbook{\bookpageend} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\ps@book} % \begin{macro}{\ps@afterbook} % Pagestyles for the book page and the (blank) page after a book page. % \begin{macrocode} \aliaspagestyle{book}{empty} \aliaspagestyle{afterbook}{empty} % \end{macrocode} % \end{macro} % \end{macro} % % % \subsection{Part} % % \begin{macro}{\part} % \cs{part}\marg{title} starts a new Part called \meta{title}. % The actual typesetting of the title is done by \cs{@part} or \cs{@spart}. % \begin{macrocode} \newcommand{\part}{% \@setuppart \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. % \changes{v1.61803}{2008/01/30}{Changed \cs{midpartskip} (mempatch v4.9)} % \begin{macrocode} \newcommand{\beforepartskip}{\null\vfil} \newcommand{\midpartskip}{\par\vskip 2\onelineskip} \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 \cs{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}{\mempartinfo} % \begin{macro}{\mempartstarinfo} % \verb?\mempartinfo{\thepart}{short}{long}? \\ % \verb?\mempartstarinfo{long}? \\ % \changes{v1.61803}{2008/01/30}{Made \cs{mempartinfo} long (mempatch v4.9).} % \begin{macrocode} \newcommand{\mempartinfo}[3]{} \newcommand{\mempartstarinfo}[1]{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@part} % \cs{@part}\oarg{short}\marg{long} typesets the title of a \cs{part} % part. There is a number if \cs{secnumdepth} is greater than -2. % \changes{v1.3}{2002/11/14}{Used \cs{partnumberline} in \cs{@part}} % \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{@part}} % \changes{v1.618}{2005/09/03}{Replaced \cs{markboth} by \cs{partmark} % in \cs{@part} courtesy of Frederic Connes (mempatch v3.11)} % \begin{macrocode} \long\def\@part[#1]#2{% \M@gettitle{#1}% \phantomsection \ifnum \c@secnumdepth >-2\relax \refstepcounter{part}% \addcontentsline{toc}{part}% {\protect\partnumberline{\thepart}#1}% \mempartinfo{\thepart}{#1}{#2}% \else \addcontentsline{toc}{part}{#1}% \mempartinfo{}{#1}{#2}% \fi % \end{macrocode} % Empty the marks, center the title on the page, and set the normal font. % \changes{v3.6j}{2011/03/03}{Set \cs{parskip} to zero inside the % group, such that a non-zero \cs{parskip} does not interfer with the % title layout} % \begin{macrocode} \partmark{#1}% {\centering \interlinepenalty \@M \parskip\z@ \normalfont % \end{macrocode} % Print the number, if there is one, then the title below. Macro \cs{@endpart} % tidies everything up at the end. % \begin{macrocode} \ifnum \c@secnumdepth >-2\relax \printpartname \partnamenum \printpartnum \midpartskip \fi \printparttitle{#2}\par}% \@endpart} % \end{macrocode} % \end{macro} % % \begin{macro}{\@spart} % \cs{@spart}\marg{long} formats the title of a \cs{part*} part. It is % simpler than \cs{@part} because there is no number to print. % \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{@spart}} % \changes{v3.6j}{2011/03/03}{Set \cs{parskip} to zero here as well} % \begin{macrocode} \long\def\@spart#1{% \M@gettitle{#1}% \phantomsection \mempartstarinfo{#1}% {\centering \interlinepenalty \@M \parskip\z@ \normalfont \printparttitle{#1}\par}% \@endpart} % \end{macrocode} % \end{macro} % % \begin{macro}{\ifm@mnopartnewpage} % \begin{macro}{\m@mnopartnewpagetrue} % \begin{macro}{\m@mnopartnewpagefalse} % \begin{macro}{\partblankpage} % \begin{macro}{\nopartblankpage} % The declaration \cs{nopartblankpage} prevents \cs{part} from % outputting a blank page when it finishes. The default is set by % \cs{partblankpage}. This code was originally supplied by Frederic Connes. % \changes{v1.61803}{2008/01/30}{Added \cs{partblankpage} and % \cs{nopartblankpage} (mempatch v v4.4).} % \begin{macrocode} \newif\ifm@mnopartnewpage \m@mnopartnewpagefalse \newcommand*{\partblankpage}{\m@mnopartnewpagefalse} \newcommand*{\nopartblankpage}{\m@mnopartnewpagetrue} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\partpageend} % \begin{macro}{\@endpart} % This finishes off both \cs{@part} and \cs{@spart}. % Following a \cs{nopartblankpage} nothing is done, otherwise % (after \cs{partblankpage}) the current page is flushed. % In the standard \Lpack{book} class if % two-sided mode is on a blank page is then produced. I think that this looks % odd when the \Lopt{openany} option is in force, so here it only produces % an extra blank page if both \Lopt{twoside} and \Lopt{openright} are % in effect. % % At the end, if necessary, two column mode is switched back on. % \changes{v1.61803}{2008/01/30}{Used the afterpart pagestyle in \cs{@endpart}} % \changes{v1.61803398}{2009/07/26}{PW: Added \cs{partpageend} as cover for \cs{@endpart}} % \begin{macrocode} \newcommand*{\partpageend}{\afterpartskip \ifm@mnopartnewpage \else \if@twoside \if@openright \null \thispagestyle{afterpart}% \newpage \fi \fi \fi \if@tempswa \twocolumn \fi} \def\@endpart{\partpageend} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\ps@afterpart} % Pagestyle for the (blank) page after a part page. % \changes{v1.61803}{2008/01/30}{Added afterpart pagestyle (mempatch v4.4)} % \begin{macrocode} \aliaspagestyle{afterpart}{empty} % \end{macrocode} % \end{macro} % % \subsection{Chapter} % % \begin{macro}{\chapter} % 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 \cs{@chapter} or \cs{@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} % \changes{v1.618}{2005/09/03}{Made article chapter start on a newline (mempatch v3.5)} % \changes{v3.6e}{2010/07/16}{Factored out the \cs{@afterindentfalse}} % \changes{v3.6h}{2011/02/07}{Added the chapter block} % \begin{macrocode} \newcommand\chapter{% % \end{macrocode} % The block macro can be defined to execute a \cs{FloatBlock} when we % are in article mode. Outside article mode \cs{clearforchapter} is % expected to be used for this. % \begin{macrocode} \ifartopt\par\@nameuse{chapterblock}\else \clearforchapter \thispagestyle{chapter} \global\@topnum\z@ \fi % \@afterindentfalse \m@mindentafterchapter \@ifstar{\@m@mschapter}{\@m@mchapter}} % \end{macrocode} % \end{macro} % % \begin{macro}{\m@mindentafterchapter} % \begin{macro}{\indentafterchapter} % \begin{macro}{\noindentafterchapter} % In order to make whether to indent the first paragraph after af % chapter configurable, we store \verb?\@afterindenttrue/false? in % \verb?\m@mindentafterchapter?, and provide % \verb?\indentafterchapter? and \verb?\noindentafterchapter? to set % it to a suitable value. % \begin{macrocode} \newcommand*\indentafterchapter{\def\m@mindentafterchapter{\@afterindenttrue}} \newcommand*\noindentafterchapter{\def\m@mindentafterchapter{\@afterindentfalse}} % \end{macrocode} % Default is not to indent. % \begin{macrocode} \noindentafterchapter % \end{macrocode} % % \end{macro} % \end{macro} % \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 \cs{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 \textit{Re: Several optional % arguments for macro?}). % \changes{v1.618}{2005/09/04}{Major changes to \cs{chapter} macros (from Morten Hogholm 2005/08/30)} % \begin{macrocode} \newcommand{\@m@mchapter}[1][]{% \def\ch@pt@c{#1}% capture first optional arg \@ifnextchar[{\@chapter}{\@chapter[]}% } \def\m@m@empty{\@empty} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\memchapinfo} % \begin{macro}{\memchapstarinfo} % \begin{macro}{\memappchapinfo} % \begin{macro}{\memappchapstarinfo} % \verb?\memchapinfo{num}{toc}{head}{full}? \\ % \verb?\memchapstarinfo{short}{full}? % \changes{v1.618}{2005/09/06}{Added \cs{memchapinfo}} % \begin{macrocode} \newcommand{\memchapinfo}[4]{} \newcommand{\memchapstarinfo}[2]{} \newcommand{\memappchapinfo}[4]{} \newcommand{\memappchapstarinfo}[2]{} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\ifm@mpn@new@chap} % \begin{macro}{\m@mpn@new@chapfalse} % \begin{macro}{\m@mpn@new@chaptrue} % \begin{macro}{\ifm@mpn@new@schap} % \begin{macro}{\m@mpn@new@schapfalse} % \begin{macro}{\m@mpn@new@schaptrue} % These are for supporting the [age/end notes, flagging that a % \verb?\chapter(*)? has been called. % \changes{v1.61803}{2008/01/30}{Added \cs{ifm@mpn@new@chap} and % \cs{ifm@mpn@new@chap} (mempatch v4.5)} % \begin{macrocode} \newif\ifm@mpn@new@chap \m@mpn@new@chapfalse \newif\ifm@mpn@new@schap \m@mpn@new@schapfalse % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@chapter} % \begin{macro}{\f@rtoc} % \begin{macro}{\f@rhdr} % \begin{macro}{\f@rbody} % \cs{@chapter}\oarg{tocmark}\marg{title} % typesets the title of a \cs{chapter}. % There is a number if \cs{secnumdepth} is greater than -1 and \cs{@mainmatter} % 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}} % \changes{v1.61803}{2008/01/30}{Added \cs{f@rbody} to \cs{@chapter}, % plus newchapter flag (mempatch v4.5)} % \changes{v1.6180339g}{2009/07/13}{added \cs{m@mpn@new@schapfalse} % otherwise both might end up true at the same time} % \begin{macrocode} \def\@chapter[#1]#2{% \m@mpn@new@chaptrue% \m@mpn@new@schapfalse% \def\f@rbdy{#2}% \ifx\ch@pt@c\@empty % no optional args \def\f@rtoc{#2}% \def\f@rhdr{#2}% \else % at least one opt arg \let\f@rtoc\ch@pt@c \ifx\@empty#1\@empty \let\f@rhdr\ch@pt@c \else \def\f@rhdr{#1}% \fi \fi \m@m@Andfalse \ifnum \c@secnumdepth >\m@ne \if@mainmatter \m@m@Andtrue \fi \fi \ifm@m@And \refstepcounter{chapter}% \fi % \end{macrocode} % Deal with the \Lopt{article} option. % \begin{macrocode} \ifartopt \@makechapterhead{#2}% \@afterheading \chaptermark{\f@rhdr}% \else % \end{macrocode} % Store the (short) title via \cs{chaptermark}, and add some whitespace to % the LoF and LoT. Then fiddle when we are using two columns, calling % \cs{@makechapterhead} to do the typesetting. % \changes{v0.3}{2001/07/09}{Changed \cs{@chapter} for article option} % \begin{macrocode} \chaptermark{\f@rhdr} \insertchapterspace \if@twocolumn \@topnewpage[\@makechapterhead{#2}]% \else \@makechapterhead{#2}% \fi \@afterheading \fi % \end{macrocode} % Vittorio De Martino (\texttt{demartino.vittoria@grtn.it}) on % 31 March 2003 reported that for articled chapters, which do not do % any \cs{clearpage}, \cs{addcontents} had to come after the title. % \changes{v1.4}{2003/11/16}{Changed \cs{@chapter} to match patches v1.n} % \begin{macrocode} \ifm@m@And \ifanappendix \addcontentsline{toc}{appendix}{% \protect\chapternumberline{\thechapter}\f@rtoc}% \memappchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}% \else \addcontentsline{toc}{chapter}{% \protect\chapternumberline{\thechapter}\f@rtoc}% \memchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}% \fi \else \addcontentsline{toc}{chapter}{\f@rtoc}% \ifanappendix \memappchapinfo{}{\f@rtoc}{\f@rhdr}{#2}% \else \memchapinfo{}{\f@rtoc}{\f@rhdr}{#2}% \fi \fi % \end{macrocode} % Add hook for title referencing. % \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{@chapter}} % \begin{macrocode} \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{\f@rtoc}\fi} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\@makechapterhead} % This \emph{really} typesets a \cs{chapter}. Leave some whitespace and prepare to % set \cs{raggedright}. % \changes{v1.3}{2002/10/10}{Added \cs{printchapternonum} to % \cs{@makechapterhead}} % \changes{v1.61803398}{2009/07/17}{Added bidi support to \cs{@makechapterhead}} % \changes{v3.6j}{2011/03/01}{Set \cs{parskip} to zero such that a % non-zero \cs{parskip} to not interfer with the placement of the title} % \begin{macrocode} \def\@makechapterhead#1{% \chapterheadstart% \vspace*{50\p@}% {%\parindent \z@ \raggedright \normalfont \parskip \z@ \parindent \z@ \memRTLraggedright \normalfont % \end{macrocode} % If there is a number, typeset it, otherwise call \cs{printchapternonum}. % \begin{macrocode} \ifm@m@And \printchaptername \chapternamenum \printchapternum \afterchapternum % \par\nobreak \vskip 20\p@ \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 \cs{chapter} inserts some vertical space into the LoF and LoT. % The macro \cs{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}{\beforechapskip} % \begin{macro}{\midchapskip} % \begin{macro}{\afterchapskip} % Lengths separating the various parts of a chapter heading. % \begin{macrocode} \newlength{\beforechapskip}\setlength{\beforechapskip}{50pt} \newlength{\midchapskip}\setlength{\midchapskip}{20pt} \newlength{\afterchapskip}\setlength{\afterchapskip}{40pt} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\@chs@def@ult} % This sets up all the definitions and defaults used in \cs{@makechapterhead} % and \cs{@makeschapterhead}. % \changes{v1.3}{2002/10/10}{Added \cs{printchapternonum} to \cs{@chs@def@ult}} % \changes{v1.61803}{2008/01/30}{Made \cs{@chs@def@ult} set all default chapter values} % \begin{macro}{\chapterheadstart} % \begin{macro}{\printchaptername} % \begin{macro}{\chapternamenum} % \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} % % \begin{macro}{\chapnamefont} % \begin{macro}{\chapnumfont} % \begin{macro}{\chaptitlefont} % Fonts for setting chapter name, number, and title. % \begin{macrocode} \def\chapnamefont{\normalfont\huge\bfseries}% \def\chapnumfont{\normalfont\huge\bfseries}% \def\chaptitlefont{\normalfont\Huge\bfseries}% \setlength{\beforechapskip}{50pt}% \setlength{\midchapskip}{20pt}% \setlength{\afterchapskip}{40pt}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % % \begin{macro}{\@m@mschapter} % This deals with the new optional argument for starred chapters. % \begin{macrocode} \newcommand{\@m@mschapter}[2][\@empty]{% \@schapter{#2}% \ifx \@empty#1 \def\f@rhdr{#2}% \else% opt arg \def\f@rhdr{#1}% \setcounter{secnumdepth}{-10}% \chaptermark{#1}% \setcounter{secnumdepth}{\value{maxsecnumdepth}}% \fi \ifanappendix \memappchapstarinfo{\f@rhdr}{#2}% \else \memchapstarinfo{\f@rhdr}{#2}% \fi \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{#2}\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@schapter} % \begin{macro}{\f@rbdy} % \cs{@schapter}\marg{long} typesets the title of a % \cs{chapter*}. It is easier than the \cs{@chapter} as there is no number % to worry about. % \changes{v0.3}{2001/07/09}{Changed \cs{@schapter} for article option} % \changes{v1.2}{2002/07/27}{Major rewrite of \cs{@schapter}} % \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{@schapter}} % \changes{v1.61803}{2008/01/30}{Changed \cs{@schapter} like % \cs{@chapter} (mempatch v4.5)} % \changes{v1.6180339g}{2009/07/13}{added \cs{m@mpn@new@chapfalse} % otherwise both might end up true at the same time} % \begin{macrocode} \newcommand{\@schapter}[1]{% \m@mpn@new@schaptrue% \m@mpn@new@chapfalse% \def\f@rbdy{#1}% \ifartopt \@makeschapterhead{#1}% \else \if@twocolumn \@topnewpage[\@makeschapterhead{#1}]% \else \@makeschapterhead{#1}% \fi \fi \@afterheading} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@makeschapterhead} % This \emph{really} typesets a \cs{chapter*}, and is similar to \cs{@makechapterhead}. % \changes{v1.3}{2002/10/10}{Added \cs{printchapternonum} to % \cs{@makeschapterhead}} % \changes{v1.61803398}{2009/07/17}{Added bidi support to \cs{@makeschapterhead}} % \changes{v3.6j}{2011/0301}{Made sure the \cs{parskip} is zero inside % the title area, otherwise placement might come out wrong} % \begin{macrocode} \def\@makeschapterhead#1{% \chapterheadstart {%\parindent \z@ \raggedright \normalfont \parskip \z@% \parindent \z@ \memRTLraggedright \normalfont \printchapternonum \interlinepenalty\@M \printchaptertitle{#1}% \afterchaptertitle}% } % \end{macrocode} % \end{macro} % % % \subsubsection{Chapter styling} % % % \begin{macro}{\makechapterstyle} % \begin{macro}{\chapterstyle} % \cs{chapterstyle}\marg{style} is like \cs{pagestyle}, except it's for % chapters. % % \cs{makechapterstyle}\marg{style}\marg{text} creates % or overrides the \meta{style} chapter style defining it as \meta{text} % So, \verb?\makechapterstyle{fred}{code}? specifies that the chapter style % \pstyle{fred} % is defined as the macro \verb?\chs@fred{code}?, % and \verb?\chapterstyle{fred}? calls the macro \cs{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} % \changes{v1.61803}{2008/01/30}{Simplified specification of the default chapterstyle} % \begin{macrocode} \makechapterstyle{default}{}% %% \setlength{\beforechapskip}{50pt} %% \def\chapterheadstart{\vspace*{\beforechapskip}} %% \def\chapnamefont{\normalfont\huge\bfseries} %% \def\printchaptername{\chapnamefont \@chapapp} %% \def\chapternamenum{\space} %% \def\chapnumfont{\normalfont\huge\bfseries} %% \def\printchapternum{\chapnumfont \thechapter} %% \setlength{\midchapskip}{20pt} %% \def\afterchapternum{\par\nobreak\vskip \midchapskip} %% \def\printchapternonum{} %% \def\chaptitlefont{\normalfont\Huge\bfseries} %% \def\printchaptertitle##1{\chaptitlefont ##1} %% \setlength{\afterchapskip}{40pt} %% \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}} \chapterstyle{default} % \end{macrocode} % % \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}{% \chapterstyle{default} \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} % \changes{v1.4}{2003/11/22}{Replaced \cs{space} by \cs{quad} in article chapterstyle % (from patch v1.7)} % \begin{macrocode} \makechapterstyle{article}{% \chapterstyle{default} \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex} \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}} \setlength{\afterchapskip}{2.3ex \@plus .2ex} \renewcommand{\printchaptername}{} \renewcommand{\chapternamenum}{} \renewcommand{\chaptitlefont}{\normalfont\Large\bfseries} \renewcommand{\chapnumfont}{\chaptitlefont} \renewcommand{\printchapternum}{\chapnumfont \thechapter\quad} \renewcommand{\afterchapternum}{}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@reparticle} % The \pstyle{reparticle} chapter style. It replicates the appearance % of a \cs{section} in an \Lpack{article} class document. % \changes{v1.61803}{2008/01/30}{Added reparticle chapterstyle (mempatch v4.3)} % \begin{macrocode} \makechapterstyle{reparticle}{% \chapterstyle{default} \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex} \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}} \setlength{\afterchapskip}{2.3ex \@plus .2ex} \renewcommand*{\printchaptername}{} \renewcommand*{\chapternamenum}{} \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries} \renewcommand*{\chapnumfont}{\chaptitlefont} \renewcommand*{\printchapternum}{\@hangfrom{\chapnumfont \thechapter\quad}}% \renewcommand*{\afterchapternum}{}} % \end{macrocode} % \end{macro} % % \begin{macro}{\reparticle} % Call this to get division heads to replicate the \Lopt{article} class. % For example: \\ % \verb?\ifartopt \reparticle \fi? \\ % The \cs{chapter} commands must still be used, though. % \changes{v1.61803}{2008/01/30}{Added \cs{reparticle} (mempatch v4.3)} % \changes{v1.61803398}{2009/07/17}{Added bidi support to \cs{reparticle}} % \begin{macrocode} \newcommand*{\reparticle}{% \chapterstyle{reparticle} %%% \setsecheadstyle{\normalfont\large\bfseries\raggedright} \setsecheadstyle{\normalfont\large\bfseries\memRTLraggedright}% %%% \setsubsecheadstyle{\normalfont\bfseries\raggedright} \setsubsecheadstyle{\normalfont\bfseries\memRTLraggedright}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@hangnum} % The \pstyle{hangnum} style puts the chapter number in the margin. % \begin{macrocode} \makechapterstyle{hangnum}{% \chapterstyle{default} \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 \textit{\LaTeX{} Companion} % series. It requires the \cs{chapindent} length. The user needs % to be careful to have a wide enough spine margin on verso pages % if the title may appear on a verso page. % \changes{v0.31}{2001/07/24}{Changed adjustwidth* to adjustwidth in companion chapterstyle} % \begin{macrocode} \newlength{\chapindent} \makechapterstyle{companion}{% \chapterstyle{default} \renewcommand*{\chapnamefont}{\normalfont\LARGE\scshape} \renewcommand*{\printchaptername}{\raggedleft\chapnamefont \@chapapp} \renewcommand*{\chapnumfont}{\normalfont\Huge} \setlength{\chapindent}{\marginparsep} \addtolength{\chapindent}{\marginparwidth} \renewcommand*{\printchaptertitle}[1]{% \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}{% \chapterstyle{default} \renewcommand*{\printchaptername}{\centering} \renewcommand*{\printchapternum}{\chapnumfont \numtoName{\c@chapter}} \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily} \renewcommand*{\printchaptertitle}[1]{% \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1} \renewcommand*{\afterchaptertitle}% {\vskip\onelineskip \hrule\vskip \afterchapskip}} % \end{macrocode} % \end{macro} % % \changes{v1.61803}{2008/01/30}{Added chapterstyles: bianchi, bringhurst, % brotherton, chappel, culver, dash, demo2, ell, Ger, % lyhne, madsen, pedersen, southall, thatcher, veelo, % verville, demo3 (mempatch v4.6)} % \begin{macro}{\chs@bianchi} % Posted to CTT on 2003/12/09, \textit{New chapter style: chapter vs chapter*} % by Stefano Bianchi. % \begin{macrocode} \makechapterstyle{bianchi}{% \chapterstyle{default} \renewcommand*{\chapnamefont}{\normalfont\Large\sffamily\itshape} \renewcommand*{\chapnumfont}{\normalfont\huge} \renewcommand*{\printchaptername}{% \chapnamefont\centering\@chapapp} \renewcommand*{\printchapternum}{\chapnumfont \textit{\thechapter}} \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily} \renewcommand*{\printchaptertitle}[1]{% \hrule\vskip\onelineskip \centering \chaptitlefont\textbf{##1}\par} \renewcommand*{\afterchaptertitle}{\vskip\onelineskip \hrule\vskip \afterchapskip} \renewcommand*{\printchapternonum}{% \vphantom{\chapnumfont \textit{9}}\afterchapternum}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@bringhurst} % My bringhurst style. % \changes{v1.61803398}{2009/07/17}{Added bidi support to bringhurst chapterstyle} % \begin{macrocode} \makechapterstyle{bringhurst}{% \chapterstyle{default} \renewcommand*{\chapterheadstart}{} \renewcommand*{\printchaptername}{} \renewcommand*{\chapternamenum}{} \renewcommand*{\printchapternum}{} \renewcommand*{\afterchapternum}{} \renewcommand*{\printchaptertitle}[1]{% %%% \raggedright\Large\scshape\MakeLowercase{##1}} \memRTLraggedright\Large\scshape\MakeLowercase{##1}} \renewcommand*{\afterchaptertitle}{% \vskip\onelineskip \hrule\vskip\onelineskip}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@brotherton} % An extremely simple chapterstyle created by William Adams for Mike % Brotherton's science fiction novel \textit{Star Dragon}, posted to CTT % 2006/12/09, \textit{An example of a novel?}. % \begin{macrocode} \makechapterstyle{brotherton}{% \chapterstyle{default} \renewcommand*{\printchapternum}{\chapnumfont \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@chappell} % My Chappell style % \begin{macrocode} \makechapterstyle{chappell}{% \chapterstyle{default} \setlength{\beforechapskip}{0pt} \renewcommand*{\chapnamefont}{\large\centering} \renewcommand*{\chapnumfont}{\large} \renewcommand*{\printchapternonum}{% \vphantom{\printchaptername \chapnumfont 1} \afterchapternum \vskip \onelineskip \vskip -\topskip} \renewcommand*{\chaptitlefont}{\Large\itshape} \renewcommand*{\printchaptertitle}[1]{% \hrule\vskip\onelineskip \centering\chaptitlefont ##1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@culver} % By me in an answer to Christopher Culver on CTT, % \textit{"Biblical" formatting, how?} on 2004/03/29,where I called it % the `biblical' style. % \begin{macrocode} \makechapterstyle{culver}{% \chapterstyle{default} \chapterstyle{article}% \renewcommand*{\thechapter}{\Roman{chapter}} \renewcommand*{\printchapternum}{% center number/title \centering\chapnumfont \thechapter\space\space}% \renewcommand*{\printchapternonum}{\centering} \renewcommand*{\clearforchapter}{}% no new page \aliaspagestyle{chapter}{headings}}% no special pagestyle % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@dash} % A very simple style of mine but I couldn't think of a good name for it. % \begin{macrocode} \makechapterstyle{dash}{% \chapterstyle{default} \setlength{\beforechapskip}{5\onelineskip} \renewcommand*{\printchaptername}{} \renewcommand*{\chapternamenum}{} \renewcommand*{\chapnumfont}{\normalfont\large} \settoheight{\midchapskip}{\chapnumfont 1} \renewcommand*{\printchapternum}{\centering \chapnumfont \rule[0.5\midchapskip]{1em}{0.4pt} \thechapter\ \rule[0.5\midchapskip]{1em}{0.4pt}} \renewcommand*{\afterchapternum}{\par\nobreak\vskip 0.5\onelineskip} \renewcommand*{\printchapternonum}{\centering \vphantom{\chapnumfont 1}\afterchapternum} \renewcommand*{\chaptitlefont}{\normalfont\Large} \renewcommand*{\printchaptertitle}[1]{\centering \chaptitlefont ##1} \setlength{\afterchapskip}{2.5\onelineskip}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@demo2} % My second version of the demo chapterstyle. % \begin{macrocode} \makechapterstyle{demo2}{% \chapterstyle{default} \renewcommand*{\printchaptername}{\centering} \renewcommand*{\printchapternum}{\chapnumfont \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi} \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily} \renewcommand*{\printchaptertitle}[1]{% \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1} \renewcommand*{\afterchaptertitle}{% \vskip\onelineskip \hrule\vskip \afterchapskip} \setlength{\beforechapskip}{3\baselineskip} \renewcommand*{\printchapternonum}{% \vphantom{\chapnumfont One} \afterchapternum% \vskip\topskip} \setlength{\beforechapskip}{2\onelineskip}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@demo3} % My third version of the demo chapterstyle. % \begin{macrocode} \makechapterstyle{demo3}{% \chapterstyle{default} \renewcommand*{\printchaptername}{\centering} \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape} \renewcommand*{\printchapternum}{\chapnumfont \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi} \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily} \renewcommand*{\printchaptertitle}[1]{% \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1} \renewcommand*{\afterchaptertitle}{% \vskip\onelineskip \hrule\vskip \afterchapskip} \setlength{\beforechapskip}{0pt} \setlength{\midchapskip}{2\onelineskip} \setlength{\afterchapskip}{2\onelineskip} \renewcommand*{\printchapternonum}{% \vphantom{\chapnumfont One} \afterchapternum% \vskip\topskip}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@ell} % Another of my styles which I'll probably use for my next book. % \begin{macrocode} \makechapterstyle{ell}{% \chapterstyle{default} \renewcommand*{\chapnumfont}{\normalfont\HUGE\sffamily} \renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily} \settowidth{\chapindent}{\chapnumfont 111} \renewcommand*{\chapterheadstart}{\begingroup \vspace*{\beforechapskip}% \begin{adjustwidth}{}{-\chapindent}% \hrulefill \smash{\rule{0.4pt}{15mm}} \end{adjustwidth}\endgroup} \renewcommand*{\printchaptername}{} \renewcommand*{\chapternamenum}{} \renewcommand*{\printchapternum}{% \begin{adjustwidth}{}{-\chapindent} \hfill \raisebox{10mm}[0pt][0pt]{\chapnumfont \thechapter}% \hspace*{1em} \end{adjustwidth}\vspace*{-3.0\onelineskip}} \renewcommand*{\printchaptertitle}[1]{% \vskip\onelineskip \raggedleft {\chaptitlefont ##1}\par\nobreak}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@ger} % Posted to CTT on 2002/04/12 \textit{Fancy Headings, Chapter Headings} by Gerardo Garcia. % \begin{macrocode} \makechapterstyle{ger}{% \chapterstyle{default} \renewcommand*{\chapterheadstart}{\vspace*{\beforechapskip} \mbox{}\\\mbox{}\rule[0pt]{\textwidth}{0.4pt}\par} \setlength{\midchapskip}{20pt} \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1 \\\mbox{}\rule[5pt]{\textwidth}{0.4pt}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@lyhne} % Posted to CTT 2006/02/09 \textit{Glossary}, by Anders Lyhne. % It requires the \Lpack{graphicx} package. I have modified it to remove the % new length and adjusted the unnumbered appearance. % \begin{macrocode} \makechapterstyle{lyhne}{% needs graphicx package \chapterstyle{default} \setlength{\beforechapskip}{1.5cm} \setlength{\afterchapskip}{1cm} \setlength{\midchapskip}{2cm} \renewcommand*{\chapnamefont}{\normalfont\normalsize\scshape\raggedleft} \renewcommand*{\chaptitlefont}{\normalfont\normalsize\bfseries\sffamily\raggedleft} \renewcommand*{\chapternamenum}{} \renewcommand*{\printchapternum}{\makebox[0pt][l]{\hspace{0.2em}% \resizebox{!}{2ex}{\chapnamefont\bfseries\sffamily\thechapter}}} \renewcommand*{\afterchapternum}{\par\hspace{1.5cm}\hrule\vspace{0.2cm}} \renewcommand*{\printchapternonum}{\vphantom{\chapnamefont 1}\afterchapternum} \renewcommand*{\afterchaptertitle}{\vskip 0.2cm \hrule\vskip\afterchapskip}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\chs@madsen} % Posted to CTT on 2003/12/09, \textit{New chapter style: chapter vs chapter*} % by Lars Madsen. % This requires the \Lpack{graphicx} package, % \changes{v1.61803398c}{2009/11/15}{Updated to provide a better % unnumbered look} % \changes{v3.6d}{2010/05/13}{the unnumbered version may be executed % in a context where \cs{thechapter} is not weldefined, replaced with % a 1} % \begin{macrocode} \makechapterstyle{madsen}{% requires graphicx package \chapterstyle{default} \renewcommand*{\chapnamefont}{% \normalfont\Large\scshape\raggedleft} \renewcommand*{\chaptitlefont}{% \normalfont\Huge\bfseries\sffamily\raggedleft} \renewcommand*{\chapternamenum}{} \renewcommand*{\printchapternum}{% \makebox[0pt][l]{\hspace{0.4em}% \resizebox{!}{4ex}{% \chapnamefont\bfseries\sffamily\thechapter}% }% }% \renewcommand*{\printchapternonum}{% \chapnamefont \phantom{\printchaptername \chapternamenum% \makebox[0pt][l]{\hspace{0.4em}% \resizebox{!}{4ex}{% \chapnamefont\bfseries\sffamily 1}% }% }% \afterchapternum % }% \renewcommand*{\afterchapternum}{% \par\hspace{1.5cm}\hrule\vskip\midchapskip}} % \end{macrocode} % \end{macro} % % \begin{macro}{\colorchapnum} % \begin{macro}{\colorchaptitle} % \begin{macro}{\chs@pedersen} % Posted to CTT 2006/01/31, \textit{Chapter style}, by Troels Pedersen. % It requires the \Lpack{graphicx} package and possibly the \Lpack{color} % package. I have used a \cs{sidebar} instead of the original \cs{marginpar}, % and eliminated a new length. The original color specification, the same for % the title and nunmber, can now be set via \cs{colorchapnum} and % \cs{colorchaptitle}. % \begin{macrocode} \newcommand*{\colorchapnum}{} \newcommand*{\colorchaptitle}{} \makechapterstyle{pedersen}{% \chapterstyle{default} \setlength{\beforechapskip}{-20pt} \setlength{\afterchapskip}{10pt} \renewcommand*{\chapnamefont}{\normalfont\LARGE\itshape} \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape\colorchapnum} \renewcommand*{\chaptitlefont}{\normalfont\huge\itshape\colorchaptitle} \renewcommand*{\afterchapternum}{} \renewcommand*{\printchaptername}{} \setlength{\midchapskip}{20mm}% was \numberheight \renewcommand*{\chapternamenum}{} \renewcommand*{\printchapternum}{% \sidebar{\raisebox{0pt}[0pt][0pt]{\makebox[0pt][l]{% \resizebox{!}{\midchapskip}{\chapnumfont\thechapter}}}}} \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\chs@southall} % Style provided by Thomas Dye. I have modified the original to eliminate % the use of new lengths. % \changes{v1.61803398}{2009/07/17}{Added bidi support to southall chapterstyle} % \begin{macrocode} %% Thomas Dye's southall chapter style \makechapterstyle{southall}{% \chapterstyle{default} \setlength{\afterchapskip}{5\baselineskip} \setlength{\beforechapskip}{36pt}% \headindent \setlength{\midchapskip}{\textwidth}% \rightblock \addtolength{\midchapskip}{-\beforechapskip} \renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}} %%% \renewcommand*{\chaptitlefont}{\huge\rmfamily\raggedright} \renewcommand*{\chaptitlefont}{\huge\rmfamily\memRTLraggedright} \renewcommand*{\chapnumfont}{\chaptitlefont} \renewcommand*{\printchaptername}{} \renewcommand*{\chapternamenum}{} \renewcommand*{\afterchapternum}{} \renewcommand*{\printchapternum}{% \begin{minipage}[t][\baselineskip][b]{\beforechapskip} {\vspace{0pt}\chapnumfont%%%\figureversion{lining} \thechapter} \end{minipage}} \renewcommand*{\printchaptertitle}[1]{% \hfill\begin{minipage}[t]{\midchapskip} {\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}} \renewcommand*{\afterchaptertitle}{% \par\vspace{\baselineskip}% \hrulefill \par\nobreak\noindent \vskip \afterchapskip}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@thatcher} % Original posted to CTT on 2006/01/18 by Scott Thatcher, % \textit{memoir: chapter headings capitalize math symbols}. I have modified % it to cater for multiline titles, appendices, and unnumbered chapters. % \begin{macrocode} \makechapterstyle{thatcher}{% \chapterstyle{default} \renewcommand*{\chapterheadstart}{} \renewcommand*{\printchaptername}{% \centerline{\chapnumfont{\@chapapp\ \thechapter}}} \renewcommand*{\chapternamenum}{} \renewcommand*{\chapnumfont}{\normalfont\scshape\MakeLowercase} \renewcommand*{\printchapternum}{} \renewcommand*{\afterchapternum}{% \par\centerline{\parbox{0.5in}{\hrulefill}}\par} \renewcommand*{\printchapternonum}{% \vphantom{\chapnumfont \@chapapp 1}\par \parbox{0.5in}{}\par} \renewcommand*{\chaptitlefont}{\normalfont\large} \renewcommand*{\printchaptertitle}[1]{% \centering \chaptitlefont\MakeUppercase{##1}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@veelo} % This, from Baastian Veelo, has been noted in the documentation for % quite a time. % I have modified the original to eliminate the need for extra lengths. % It well suits trimmed documents. % We are scaling the chapter number, which most DVI viewers % will not display accurately. It requires the graphicx package. % \begin{macrocode} \makechapterstyle{veelo}{% % \chapterstyle{default} \setlength{\afterchapskip}{40pt} \renewcommand*{\chapterheadstart}{\vspace*{40pt}} \renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt} \renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright} \renewcommand*{\chapnumfont}{\normalfont\HUGE} \renewcommand*{\chaptitlefont}{\normalfont\HUGE\bfseries\flushright} \renewcommand*{\printchaptername}{% \chapnamefont\MakeUppercase{\@chapapp}} \renewcommand*{\chapternamenum}{} % \setlength{\numberheight}{18mm} % \setlength{\barlength}{\paperwidth} % \addtolength{\barlength}{-\textwidth} % \addtolength{\barlength}{-\spinemargin} \setlength{\beforechapskip}{18mm}% \numberheight \setlength{\midchapskip}{\paperwidth}% \barlength \addtolength{\midchapskip}{-\textwidth} \addtolength{\midchapskip}{-\spinemargin} \renewcommand*{\printchapternum}{% \makebox[0pt][l]{% \hspace{.8em}% \resizebox{!}{\beforechapskip}{\chapnumfont \thechapter}% \hspace{.8em}% \rule{\midchapskip}{\beforechapskip}% }% }% \makeoddfoot{plain}{}{}{\thepage}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@verville} % I posted the original to CTT on 2005/01/18, \textit{Headers and special % formatting of sections}, in answer to a question by % Guy Verville. This version caters for unnumbered chapters. % \begin{macrocode} \makechapterstyle{verville}{% % \chapterstyle{default} \setlength{\beforechapskip}{0pt} \renewcommand*{\printchaptername}{} \renewcommand*{\printchapternum}{% \hrule \vskip 0.5\onelineskip \Huge \centering \thechapter.\ } \renewcommand*{\printchapternonum}{% \hrule \vskip 0.5\onelineskip \Huge \centering} \renewcommand*{\afterchapternum}{} \setlength{\midchapskip}{0pt} \renewcommand*{\printchaptertitle}[1]{% ##1 \par \vskip 0.5\onelineskip \hrule}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@crosshead} % A centered chapterstyle (from Bringhurst) % \changes{v1.61803}{2008/01/30}{Added chapterstyles: crosshead, dowding, % komalike, ntglike, tandh, and wilsondob} % \begin{macrocode} \makechapterstyle{crosshead}{% \setlength{\beforechapskip}{2\onelineskip}% \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}% \setlength{\afterchapskip}{2\onelineskip \@plus .2\onelineskip \@minus 0.2\onelineskip}% \renewcommand*{\printchaptername}{}% \renewcommand*{\chapternamenum}{}% \renewcommand*{\chapnumfont}{\normalfont\LARGE\bfseries}% \renewcommand*{\chaptitlefont}{\chapnumfont}% \renewcommand*{\printchapternum}{% \centering\chapnumfont \thechapter\quad}% \renewcommand{\afterchapternum}{}% \renewcommand*{\printchapternonum}{\centering}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@dowding} % A centered chapterstyle (from Dowding's \textit{Finer Points}) % \begin{macrocode} \makechapterstyle{dowding}{% \setlength{\beforechapskip}{2\onelineskip}% \setlength{\afterchapskip}{1.5\onelineskip \@plus .1\onelineskip \@minus 0.167\onelineskip}% \renewcommand*{\chapnamefont}{\normalfont}% \renewcommand*{\chapnumfont}{\chapnamefont}% \renewcommand*{\printchapternum}{\centering\chapnumfont \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}% \renewcommand*{\chaptitlefont}{\normalfont\itshape\huge\centering}% \renewcommand*{\printchapternonum}{% \vphantom{\printchaptername}\vskip\midchapskip}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@komalike} % A chapterstyle approximating the KOMA script style (\texttt{scrbook.cls}) % \begin{macrocode} \makechapterstyle{komalike}{% \setlength{\beforechapskip}{2\onelineskip}% \setlength{\afterchapskip}{1.5\onelineskip \@plus .1\onelineskip \@minus 0.167\onelineskip}% \renewcommand*{\printchaptername}{}% \renewcommand*{\chapternamenum}{}% \renewcommand*{\chapnumfont}{\normalfont\LARGE\sffamily\bfseries}% \renewcommand*{\printchapternum}{\chapnumfont \thechapter\space}% \renewcommand*{\afterchapternum}{}% \renewcommand*{\chaptitlefont}{\normalfont\LARGE\sffamily\bfseries}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@ntglike} % A chapterstyle approximating the NTG style (\texttt{boek.cls}) % \begin{macrocode} \makechapterstyle{ntglike}{% \setlength{\beforechapskip}{50pt \@plus 20pt}% \renewcommand*{\chapnamefont}{\normalfont\Large\bfseries}% \renewcommand*{\chapnumfont}{\normalfont\Large\bfseries}% \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@tandh} % A chapterstyle based on Thames \& Hudson \textit{Typography}. % \changes{v1.61803398}{2009/07/17}{Added bidi support to tandh chapterstyle} % \begin{macrocode} \makechapterstyle{tandh}{% \setlength{\beforechapskip}{1\onelineskip}% \setlength{\afterchapskip}{2\onelineskip \@plus .1\onelineskip \@minus 0.167\onelineskip}% \renewcommand*{\printchaptername}{}% \renewcommand*{\chapternamenum}{}% \renewcommand*{\chapnumfont}{\normalfont\huge\bfseries}% \renewcommand*{\printchapternum}{\chapnumfont \thechapter\quad}% \renewcommand*{\afterchapternum}{}% %%% \renewcommand*{\chaptitlefont}{\chapnumfont\raggedright}} \renewcommand*{\chaptitlefont}{\chapnumfont\memRTLraggedright}} % \end{macrocode} % \end{macro} % % \begin{macro}{\chs@wilsondob} % A chapterstyle based on Adrian Wilson's \textit{Design of books}. % \begin{macrocode} \makechapterstyle{wilsondob}{% \setlength{\beforechapskip}{2\onelineskip}% \setlength{\afterchapskip}{4\onelineskip \@plus .1\onelineskip \@minus 0.167\onelineskip}% \renewcommand*{\printchaptername}{}% \renewcommand*{\chapternamenum}{}% \renewcommand*{\chapnumfont}{\normalfont\Huge\itshape}% \renewcommand*{\printchapternum}{\raggedleft\chapnumfont \thechapter\quad}% \renewcommand*{\afterchapternum}{}% \renewcommand*{\chaptitlefont}{\chapnumfont}% \renewcommand*{\printchapternonum}{\raggedleft}} % \end{macrocode} % \end{macro} % % % \subsection{Lower level headings} % % These commands all make use of \cs{@startsection}. However, % for the purposes of the class the kernel version needs modification % to support: % \begin{itemize} % \item make short pages (where a section heading is moved to the top % of the next page) ragged bottom; % \item provide headings with two optional arguments. % \end{itemize} % % % We will tweak \cs{@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 \cs{raggedbottom}. % % \begin{macro}{\ifraggedbottomsection} % \begin{macro}{\raggedbottomsectiontrue} % \begin{macro}{\raggedbottomsectionfalse} % \begin{macro}{\raggedbottomsection} % \begin{macro}{\normalbottomsection} % \cs{raggedbottomsectiontrue} for ragged short pages. % \changes{v1.3}{2002/11/14}{Added \cs{ifraggedbottomsection}} % \changes{v1.61803}{2008/01/30}{Added \cs{raggedbottomsection} and % \cs{normalbottomsection}} % \begin{macrocode} \newif\ifraggedbottomsection \raggedbottomsectionfalse \newcommand*{\raggedbottomsection}{\raggedbottomsectiontrue} \newcommand*{\normalbottomsection}{\raggedbottomsectionfalse} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\bottomsectionskip} % Decreasing this length increases short page bottom flushness. % \changes{v1.3}{2002/11/14}{Added \cs{bottomsectionskip}} % \begin{macrocode} \newlength{\bottomsectionskip} \setlength{\bottomsectionskip}{10mm} % \end{macrocode} % \end{macro} % % We will add a second optional argument for \cs{section}, etc. % See the \ctt{} thread \textit{`Long headers'} 15 Jan 2003. % % The kernel \cs{@dblarg} is used in situations where the default % value for an optional argument is the same as the required argument. % Schematically, \\ % \verb?\@dblarg -> Main, Main? \\ % The macros \cs{@trplargomm} and \cs{@trplargoom} are extensions to this % idea for two optional arguments. % % \begin{macro}{\@trplargomm} % \begin{macro}{\@xtrplargomm} % \begin{macro}{\@xxtrplarg} % \verb?\@trplargomm -> Opt, Main, Main? % \begin{macrocode} \newcommand{\@trplargomm}[1]{% \@ifnextchar[{\@xtrplargomm{#1}}% {\@xxtrplarg{#1}}} \long\def\@xtrplargomm#1[#2]{\@dblarg{#1[#2]}} \newcommand{\@xxtrplarg}[2]{#1[{#2}][{#2}]{#2}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@trplargoom} % \begin{macro}{\@xtrplargoom} % \verb?\@trplargoom -> Opt, Opt, Main? % \begin{macrocode} \newcommand{\@trplargoom}[1]{% \@ifnextchar[{\@xtrplargoom{#1}}% {\@xxtrplarg{#1}}} \long\def\@xtrplargoom#1[#2]{% \@ifnextchar[{#1[{#2}]}% {#1[{#2}][{#2}]}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\memsecinfo} % \begin{macro}{\memsecstarinfo} % \verb?\memsecinfo{secname}{\thenum}{toc}{head}{title}? \\ % \verb?\memsecstarinfo{secname}{title}? \\ % \begin{macrocode} \newcommand{\memsecinfo}[5]{} \newcommand{\memsecstarinfo}[2]{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@startsection} % \begin{macro}{\m@msecn@me} % Change kernel \cs{@startsection} to: \\ % \begin{itemize} % \item Make short pages raggedbottom. This is based on the thread % \textit{Can \cs{flushbottom} and \cs{section} be made to live together?} % on \ctt{} in September 2002. % \changes{v1.3}{2002/11/14}{Modified \cs{@startsection} for raggedbottoming} % \item add an extra optional argument. % \changes{v1.4}{2003/11/22}{Added extra optional arg to \cs{@startsection} % (from patch v1.4)} % \item make sure it is not effected by a non-zero \cs{parskip} % \changes{v3.6j}{2011/03/02}{added the above feature} % \end{itemize} % The original is in \file{ltsect.dtx}. \\ % \cs{@startsection}\marg{name}\marg{level}\marg{indent} \\ % \hspace*{1.5in} \marg{beforeskip}\marg{afterskip}\marg{style} % \begin{macrocode} \renewcommand{\@startsection}[6]{% % \end{macrocode} % \changes{v3.6h}{2011/02/07}{Added float block hook} % \begin{macrocode} \@nameuse{#1block}% % \end{macrocode} % Do raggedbottom stuff. % \begin{macrocode} \ifraggedbottomsection\if@nobreak\else \vskip\z@\@plus\bottomsectionskip \penalty\z@ \vskip\z@\@plus -\bottomsectionskip \fi\fi % \end{macrocode} % Save the section name. % \begin{macrocode} \def\m@msecn@me{#1}% % \end{macrocode} % The original code. % \begin{macrocode} \if@noskipsec \leavevmode \fi \par \@tempskipa #4\relax \@afterindenttrue \ifdim \@tempskipa <\z@ \@tempskipa -\@tempskipa \@afterindentfalse \fi \if@nobreak \everypar{}% \else % \end{macrocode} % Slight change such that the effect of \cs{parskip} is cancelled % \changes{v3.6j}{2011/03/02}{Adding a negative \cs{parskip} seem to % be able to remove the effect of a non-zero \cs{parskip}} % \begin{macrocode} \addpenalty\@secpenalty\addvspace\@tempskipa \addvspace{-\parskip}% <--- added 2011/03/02 \fi % \end{macrocode} % For the extra optional argument, change the original \verb?\@dblarg{\@sect{...? % below to \verb?\@trplargoom{\M@sect{...?. % \begin{macrocode} \@ifstar {\@ssect{#3}{#4}{#5}{#6}}% {\@trplargoom{\M@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} % \end{macrocode} % \end{macro} % \end{macro} % % \changes{v3.6j}{2011/03/02}{Added the change of the kernel \cs{@xsect}} % \begin{macro}{\@xsect} % In order to fulfill removing the effect that a non-zero % \cs{parskip} has on the sectional spacing, we also have to patch % the kernel \cs{@xsect}. (The original is found in latex.ltx) % \begin{macrocode} \def\@xsect#1{% \@tempskipa #1\relax \ifdim \@tempskipa>\z@ \par \nobreak \vskip \@tempskipa \vskip-\parskip%<--- added 2011/03/02 \@afterheading \else \@nobreakfalse \global\@noskipsectrue \everypar{% \if@noskipsec \global\@noskipsecfalse {\setbox\z@\lastbox}% \clubpenalty\@M \begingroup \@svsechd \endgroup \unskip \@tempskipa #1\relax \hskip -\@tempskipa \else \clubpenalty \@clubpenalty \everypar{}% \fi}% \fi \ignorespaces} % \end{macrocode} % \end{macro} % % % \begin{macro}{\M@sect} % At least the \Lpack{hyperref} and \Lpack{nameref} packages, and % possibly other packages, modify the kernel \cs{@sect} assuming 8 args. % That's why I've called my version, which has 9 args, something % else (i.e., \cs{M@sect}). This version also has the support % for title referencing. \\ % \cs{M@sect}\marg{name}\marg{level}\marg{indent}\marg{beforeskip}\marg{afterskip}\marg{style}\\ \hspace*{0.5in} \oarg{toc}\oarg{head}\marg{title} % \changes{v1.4}{2003/11/22}{Added \cs{M@sect}} % \begin{macrocode} \def\M@sect#1#2#3#4#5#6[#7][#8]#9{% \ifheadnameref\M@gettitle{#8}\else\M@gettitle{#7}\fi \ifnum #2>\c@secnumdepth \let\@svsec\@empty \memsecinfo{#1}{}{#7}{#8}{#9}% \else \refstepcounter{#1}% \protected@edef\@svsec{\@seccntformat{#1}\relax}% \memsecinfo{#1}{\@nameuse{the#1}}{#7}{#8}{#9}% \fi \@tempskipa #5\relax \ifdim \@tempskipa>\z@ \begingroup #6{% \@hangfrom{\hskip #3\relax\@svsec}% \interlinepenalty \@M #9\@@par}% \endgroup \csname #1mark\endcsname{#8}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else \protect\numberline{\csname the#1\endcsname}% \fi #7}% \else \def\@svsechd{% #6{\hskip #3\relax \@svsec #9}% \csname #1mark\endcsname{#8}% \addcontentsline{toc}{#1}{% \ifnum #2>\c@secnumdepth \else \protect\numberline{\csname the#1\endcsname}% \fi #7}}% \fi \@xsect{#5}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@ssect} % Add hook for name reference to \cs{section*} etc. \\ % \cs{@ssect}\marg{indent}\marg{beforeskip}\marg{afterskip}\marg{style}\marg{title} % \changes{v1.61803}{2008/01/30}{Used corrected number of arguments to % \cs{memsecstarinfo} in \cs{@ssect} (Gabriel Guernik, mempatch v4.1)} % \begin{macrocode} \let\@mem@old@ssect\@ssect \def\@ssect#1#2#3#4#5{% \M@gettitle{#5}% \memsecstarinfo{\m@msecn@me}{#5}% \@mem@old@ssect{#1}{#2}{#3}{#4}{#5}} % \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 \verb?\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} % \cs{sechook} is called at the start of a \cs{section} and % \cs{setsechook}\marg{code} redefines it. % \begin{macrocode} \newcommand{\sechook}{} \newcommand{\setsechook}[1]{\renewcommand{\sechook}{#1}} % \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} % \cs{secindent} is the indentation of the section heading from the left margin, % \cs{beforesecskip} and \cs{aftersecskip} specify the white space before % and after the heading, and \cs{secheadstyle} specifies the heading style. % These are set to the default values for the \Lpack{book} class, % except that the heading will be \cs{raggedright}, thus preventing % hyphenation. The % \cs{set...} commands are for the user to change the values. % \changes{v1.61803398}{@009/07/17}{Added bidi support to default secheadstyle} % \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} \setsecheadstyle{\Large\bfseries\memRTLraggedright} % \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 \verb?\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} % \cs{subsechook} is called at the start of a \cs{subsection} and % \cs{setsubsechook}\marg{code} redefines it. % \begin{macrocode} \newcommand{\subsechook}{} \newcommand{\setsubsechook}[1]{\renewcommand{\subsechook}{#1}} % \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 \cs{subsection} headings. % \changes{v1.61803398}{2009/07/17}{Added bidi support to default subsec headstyle} % \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} \setsubsecheadstyle{\large\bfseries\memRTLraggedright} % \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 \verb?\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} % \cs{subsubsechook} is called at the start of a \cs{subsubsection} and % \cs{setsubsubsechook}\marg{code} redefines it. % \begin{macrocode} \newcommand{\subsubsechook}{} \newcommand{\setsubsubsechook}[1]{\renewcommand{\subsubsechook}{#1}} % \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 \cs{subsubsection} headings. % \changes{v1.61803398}{2009/07/17}{Added bidi support to default subsubsec headstyle} % \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} \setsubsubsecheadstyle{\normalsize\bfseries\memRTLraggedright} % \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 \verb?\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} % \cs{parahook} is called at the start of a \cs{paragraph} and % \cs{setparahook}\marg{code} redefines it. % \begin{macrocode} \newcommand{\parahook}{} \newcommand{\setparahook}[1]{\renewcommand{\parahook}{#1}} % \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 \cs{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 \verb?\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} % \cs{subparahook} is called at the start of a \cs{subparagraph} and % \cs{setsubparahook}\marg{code} redefines it. % \begin{macrocode} \newcommand{\subparahook}{} \newcommand{\setsubparahook}[1]{\renewcommand{\subparahook}{#1}} % \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 \cs{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 \cs{sethangfrom}\marg{code} is a user-level command % for changing the definition of \cs{@hangfrom}. Use \verb?#1? in \meta{code} % for the argument to \cs{@hangfrom} (or \verb?##1? if used inside another macro). % \changes{v0.2}{2001/06/03}{Added \cs{sethangfrom}} % \begin{macrocode} \newcommand{\sethangfrom}[1]{\renewcommand{\@hangfrom}[1]{#1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\setsecnumformat} % The macro \cs{setsecnumformat}\marg{code} is a user-level command % for changing the definition of \cs{@seccntformat}. Use \verb?#1? in \meta{code} % for the argument to \cs{@seccntformat} (or \verb?##1? if used inside another macro). % \changes{v0.2}{2001/06/03}{Added \cs{setsecnumformat}} % \begin{macrocode} \newcommand{\setsecnumformat}[1]{\renewcommand{\@seccntformat}[1]{#1}} % \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} % % \subsubsection{Anonymous headings} % % \begin{macro}{\plainbreak} % \cs{plainbreak}\marg{num} generates \meta{num} blanks lines and % suppresses the indentation of a following paragraph. The starred % version, \cs{plainbreak*}, does not suppress paragraph indentation. % \changes{v0.2}{2001/06/03}{Added starred version of \cs{plainbreak}} % \begin{macrocode} \newcommand{\plainbreak}{\@ifstar{\@spbreak}{\@pbreak}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@pbreak} % \begin{macro}{\@spbreak} % These are the internal forms for the two versions of \cs{plainbreak}. % The code for \cs{@pbreak} is almost a straight copy of code posted to % \ctt{} by Donald Arseneau on 2001/03/26. % \begin{macrocode} \newcommand*{\@pbreak}[1]{\par \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} % \cs{fancybreak}\marg{text} typesets \meta{text} centered. For example, % \verb?\fancybreak{{*}\\{* * *}\\{*}}?. It suppresses indentation of the % following paragraph. The starred version leaves indentation as is. % \changes{v0.2}{2001/06/03}{Added starred version of \cs{fancybreak}} % \changes{v1.3}{2002/11/14}{Tweaked \cs{fancybreak} to remove underfull hbox} % \changes{v1.61803}{2008/01/30}{Changed fancybreak code to end the paragraph % it started (Dan Leucking mempatch v4.5)} % \begin{macrocode} \newcommand{\fancybreak}{\@ifstar{\@sfbreak}{\@fbreak}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@fbreak} % \begin{macro}{\@sfbreak} % These are the internal forms for the two versions of \cs{fancybreak}. % \begin{macrocode} \newcommand{\@fbreak}[1]{\par \penalty -100 \noindent\parbox{\linewidth}{\centering #1}%%\null \par %% \penalty -20 %% \vskip -\onelineskip \@afterindentfalse \@afterheading} \newcommand{\@sfbreak}[1]{\par \penalty -100 \noindent\parbox{\linewidth}{\centering #1}%%\null \par %% \penalty -20 %% \vskip -\onelineskip \@afterindenttrue \@afterheading} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\plainfancybreak} % The \cs{plainfancybreak}\marg{space}\marg{num}\marg{text} acts % like \cs{plainbreak}\marg{num} in the middle of a page and like % \cs{fancybreak}\marg{text} at the bottom of a page. The \meta{space} % argument is the vertical space required for the \meta{num} blank lines % and some additional lines of text. From experiments, it seems that % \meta{space} should be at least (3+\meta{num}) lines (\cs{onelineskip}). % There is also a starred version, \cs{plainfancybreak*}, to match the other % starred break commands. % \changes{v0.2}{2001/06/03}{Added \cs{plainfancybreak} and supporting macros} % \begin{macrocode} \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 \cs{plainfancybreak}. They essentially do the same thing, except they call, % respectively, the unstarred and starred internal versions of \cs{plainbreak} % and \cs{fancybreak}. The code for checking the amount of space left on the % page is from an early, and abandoned, version of the code for \cs{needspace}. % \begin{macrocode} \newcommand{\@pfbreak}[3]{\par \@tempdimc\pagegoal \advance\@tempdimc-\pagetotal \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 \cs{plainfancybreak} may be fragile. % Donald Arseneau said that \cs{plainfancybreak} guessed at the amount % of space available and gave code based on a modified output routine % to make it more robust. The following code is based on that thread. % \changes{v1.3}{2002/11/14}{Added lots of code for new \cs{pfbreak}} % % \begin{macro}{\pen@ltyabovepfbreak} % \begin{macro}{\pen@ltybelowpfbreak} % 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 \cs{pfbreakskip} % vertical space. % \begin{macrocode} \newcommand{\pfbreakdisplay}{*\quad*\quad*} % \end{macrocode} % \end{macro} % % \begin{macro}{\pfbre@kdispl@y} % Typesets \cs{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 current output routine. % \begin{macrocode} \edef\nopfbreakOutput{\the\output} % \end{macrocode} % \end{macro} % % \begin{macro}{\pfbreakOutput} % Special output to handle the \cs{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 \cs{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 \cs{pfbreak}. % \changes{v3.6h}{2010/10/06}{fixed \cs{@pfbreakgab} kudos to DA for % the fix} % \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 \prevdepth\z@ % added \vskip\skip@ \penalty\pen@ltybelowpfbreak } \@afterindentfalse \@afterheading } % \end{macrocode} % \end{macro} % % \begin{macro}{\@spfbreakgap} % Starred version of \cs{pfbreak}. % \changes{v3.6h}{2010/10/06}{fixed \cs{@pfbreakgab} kudos to DA for % the fix} % \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 \prevdepth\z@ % added \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., \Lenv{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{Division head styles} % % The styles of the division heads should go together. As an aid the % class supplies some ready made collections. % \changes{v1.6180}{2008/01/30}{Added division head styles} % % \begin{macro}{\makeheadstyles} % \begin{macro}{\headstyles} % \begin{macro}{\@hds@def@ult} % \begin{macro}{\hds@default} % \cs{makeheadstyles}\marg{name}\marg{code} creates the \meta{name} collection % of division head styles, defined by \meta{code}. \cs{headstyles}\marg{name} % makes the \meta{name} division head styles the current styles. % \begin{macrocode} \newcommand{\makeheadstyles}[2]{% \@namedef{hds@#1}{\@hds@def@ult #2}} \newcommand*{\headstyles}[1]{\@nameuse{hds@#1}} % \end{macrocode} % \cs{@hds@def@ult} is the default set of division head styles. % \begin{macrocode} \newcommand*{\@hds@def@ult}{% % Default \cs{book} style % \begin{macrocode} % book \renewcommand*{\beforebookskip}{\null\vfil}% \renewcommand*{\midbookskip}{\par\vskip 20pt}% \renewcommand*{\afterbookskip}{\vfil\newpage}% \renewcommand*{\booknamefont}{\normalfont\huge\bfseries}% \renewcommand*{\booknumfont}{\normalfont\huge\bfseries}% \renewcommand*{\booktitlefont}{\normalfont\Huge\bfseries}% \renewcommand*{\printbookname}{\booknamefont \bookname}% \renewcommand*{\booknamenum}{\space}% \renewcommand*{\printbooknum}{\booknumfont \thebook}% \renewcommand*{\printbooktitle}[1]{\booktitlefont{##1}}% % \end{macrocode} % Default \cs{part} style % \begin{macrocode} % part \renewcommand*{\beforepartskip}{\null\vfil}% \renewcommand*{\midpartskip}{\par\vskip 20pt}% \renewcommand*{\afterpartskip}{\vfil\newpage}% \renewcommand*{\partnamefont}{\normalfont\huge\bfseries}% \renewcommand*{\partnumfont}{\normalfont\huge\bfseries}% \renewcommand*{\parttitlefont}{\normalfont\Huge\bfseries}% \renewcommand*{\printpartname}{\partnamefont \partname}% \renewcommand*{\partnamenum}{\space}% \renewcommand*{\printpartnum}{\partnumfont \thepart}% \renewcommand*{\printparttitle}[1]{\parttitlefont{##1}}% % \end{macrocode} % Default \cs{chapter} style. % \begin{macrocode} \@chs@def@ult% default chapterstyle % \end{macrocode} % Default \cs{section} style % \changes{v1.61803398}{2009/07/17}{Added bidi support to default sec headstyle} % \begin{macrocode} % section \setsechook{} \setsecindent{\z@}% \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}% \setaftersecskip{2.3ex \@plus .2ex}% %%% \setsecheadstyle{\Large\bfseries\raggedright}% \setsecheadstyle{\Large\bfseries\memRTLraggedright}% % \end{macrocode} % Default \cs{subsection} style % \changes{v1.61803398}{2009/07/17}{Added bidi support to default subsec headstyle} % \begin{macrocode} % subsection \setsubsechook{}% \setsubsecindent{\z@}% \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}% \setaftersubsecskip{1.5ex \@plus .2ex}% %%% \setsubsecheadstyle{\large\bfseries\raggedright}% \setsubsecheadstyle{\large\bfseries\memRTLraggedright}% % \end{macrocode} % Default \cs{subsubsection} style % \changes{v1.61803398}{2009/07/17}{Added bidi support to default subsubsec headstyle} % \begin{macrocode} % subsubsection \setsubsubsechook{}% \setsubsubsecindent{\z@}% \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}% \setaftersubsubsecskip{1.5ex \@plus .2ex}% %%% \setsubsubsecheadstyle{\normalsize\bfseries\raggedright}% \setsubsubsecheadstyle{\normalsize\bfseries\memRTLraggedright}% % \end{macrocode} % Default \cs{paragraph} style % \begin{macrocode} % paragraph \setparahook{}% \setparaindent{\z@}% \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}% \setafterparaskip{-1em}% \setparaheadstyle{\normalsize\bfseries}% % \end{macrocode} % Default \cs{paragraph} style % \begin{macrocode} % subparagraph \setsubparahook{}% \setsubparaindent{\parindent}% \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}% \setaftersubparaskip{-1em}% \setsubparaheadstyle{\normalsize\bfseries}} % \end{macrocode} % Set up and use the default head styles % \begin{macrocode} \makeheadstyles{default}{} \headstyles{default} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\addperiod} % Puts a period at the end of its argument. % \begin{macrocode} \newcommand*{\addperiod}[1]{#1.} % \end{macrocode} % \end{macro} % % \begin{macro}{\hds@memman} % Head styles used in the \textit{The Memoir Class} user guide. In this, % as the later ones, only changes from the defaults need specifying. % \changes{v1.61803398}{2009/07/17}{Added bidi support to the memman headstyles} % \begin{macrocode} \makeheadstyles{memman}{% % book changes \renewcommand*{\booknamefont}{\normalfont\huge\sffamily} \renewcommand*{\booknumfont}{\normalfont\huge\sffamily} \renewcommand*{\booktitlefont}{\normalfont\Huge\sffamily} \renewcommand*{\midbookskip}{\par\vskip 2\onelineskip}% % part changes \renewcommand*{\partnamefont}{\normalfont\huge\sffamily} \renewcommand*{\partnumfont}{\normalfont\huge\sffamily} \renewcommand*{\parttitlefont}{\normalfont\Huge\sffamily} \renewcommand*{\midpartskip}{\par\vskip 2\onelineskip}% % chapter \chapterstyle{demo3} % section \setbeforesecskip{-1.333\onelineskip \@plus -0.5\onelineskip \@minus -.5\onelineskip}% \setaftersecskip{0.667\onelineskip \@plus 0.1\onelineskip}% %%% \setsecheadstyle{\normalfont\scshape\raggedright}% \setsecheadstyle{\normalfont\scshape\memRTLraggedright}% % subsection \setbeforesubsecskip{-0.667\onelineskip \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% \setaftersubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}% %%% \setsubsecheadstyle{\normalfont\bfseries\raggedright}% \setsubsecheadstyle{\normalfont\bfseries\memRTLraggedright}% % subsubsection \setbeforesubsubsecskip{-0.667\onelineskip \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}% %%% \setsubsubsecheadstyle{\normalfont\normalsize\itshape\raggedright}% \setsubsubsecheadstyle{\normalfont\normalsize\itshape\memRTLraggedright}% % paragraph \setbeforeparaskip{1.0\onelineskip \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% \setafterparaskip{-1em}% \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}% % subparagraph \setsubparaindent{\parindent}% \setbeforesubparaskip{1.0\onelineskip \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% \setaftersubparaskip{-1em}% \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}} % \end{macrocode} % \end{macro} % % \begin{macro}{\hds@bringhurst} % Head styles based on Bringhurst's book % \changes{v1.61803398}{2009/07/17}{Added bidi support to bringhurst headstyles} % \begin{macrocode} \makeheadstyles{bringhurst}{% % chapter \chapterstyle{bringhurst} % section \setbeforesecskip{-1\onelineskip \@plus -0.5\onelineskip \@minus -.5\onelineskip}% \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}% %%% \setsecheadstyle{\normalfont\raggedright\scshape\MakeLowercase}% \setsecheadstyle{\normalfont\memRTLraggedright\scshape\MakeLowercase}% % subsection \setbeforesubsecskip{-1.0\onelineskip \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% \setaftersubsecskip{1.0\onelineskip \@plus 0.1\onelineskip}% %%% \setsubsecheadstyle{\sethangfrom{\noindent ####1}\normalfont\itshape\raggedright}% \setsubsecheadstyle{\sethangfrom{\noindent ####1}\normalfont\itshape\memRTLraggedright}% % subsubsection \setbeforesubsubsecskip{1.0\onelineskip \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% \setaftersubsubsecskip{-1em}% \setsubsubsecheadstyle{\normalfont\normalsize\scshape\MakeLowercase}% % paragraph \setbeforeparaskip{1.0\onelineskip \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% \setafterparaskip{-1em}% \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}% % subparagraph \setsubparaindent{\parindent}% \setbeforesubparaskip{1.0\onelineskip \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% \setaftersubparaskip{-1em}% \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}} % \end{macrocode} % \end{macro} % % \begin{macro}{\hds@crosshead} % Head styles based on one of Bringhurst's suggestions. % \begin{macrocode} \makeheadstyles{crosshead}{% \chapterstyle{crosshead} % section \setbeforesecskip{-1.25\onelineskip \@plus -0.5\onelineskip \@minus -.5\onelineskip}% \setaftersecskip{0.75\onelineskip \@plus 0.1\onelineskip}% \setsecheadstyle{\normalfont\centering\MakeUppercase}% % subsection \setbeforesubsecskip{-1.25\onelineskip \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% \setaftersubsecskip{0.75\onelineskip \@plus 0.1\onelineskip}% \setsubsecheadstyle{\normalfont\centering\bfseries}% % subsubsection \setbeforesubsubsecskip{-.667\onelineskip \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% \setaftersubsubsecskip{.333\onelineskip \@plus 0.1\onelineskip}% \setsubsubsecheadstyle{\normalfont\normalsize\centering\scshape\MakeLowercase}% % paragraph \setbeforeparaskip{-.667\onelineskip \@plus -02.5\onelineskip \@minus -0.25\onelineskip}% \setafterparaskip{.333\onelineskip \@plus 0.1\onelineskip}% \setparaheadstyle{\normalfont\normalsize\centering\itshape}% % subparagraph \setsubparaindent{\parindent}% \setbeforesubparaskip{1.0\onelineskip \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% \setaftersubparaskip{-1em}% \setsubparaheadstyle{\normalfont\normalsize\scshape\MakeLowercase}} % \end{macrocode} % \end{macro} % % \begin{macro}{\hds@dowding} % Head styles based on Dowding's \textit{Finer Points}. % \begin{macrocode} \makeheadstyles{dowding}{% % chapter \chapterstyle{dowding} % section \setbeforesecskip{-2\onelineskip \@plus -0.5\onelineskip \@minus -.5\onelineskip}% \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}% \setsecheadstyle{\normalfont\centering\MakeUppercase}% % subsection \setbeforesubsecskip{-1.2\onelineskip \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% \setaftersubsecskip{0.8\onelineskip \@plus 0.1\onelineskip}% \setsubsecheadstyle{\normalfont\scshape\centering\MakeLowercase}% % subsubsection \setbeforesubsubsecskip{-0.667\onelineskip \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}% \setsubsubsecheadstyle{\normalfont\normalsize\centering\itshape}% % paragraph \setbeforeparaskip{1.0\onelineskip \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% \setafterparaskip{-1em}% \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}% % subparagraph \setsubparaindent{\parindent}% \setbeforesubparaskip{1.0\onelineskip \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% \setaftersubparaskip{-1em}% \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}} % \end{macrocode} % \end{macro} % % \begin{macro}{\hds@komalike} % Head styles based on KOMA script classes (\texttt{scrbook.cls}). % \changes{v1.61803398}{2009/07/17}{Added bidi support to komalike headstyles} % \begin{macrocode} \makeheadstyles{komalike}{% % part \renewcommand*{\partnamefont}{\huge\sffamily\bfseries}% \renewcommand*{\partnumfont}{\huge\sffamily\bfseries}% \renewcommand*{\parttitlefont}{\huge\sffamily\bfseries}% % chapter \chapterstyle{komalike} % section \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}% \setaftersecskip{2.3ex \@plus .2ex}% %%% \setsecheadstyle{\normalfont\Large\sffamily\bfseries\raggedright}% \setsecheadstyle{\normalfont\Large\sffamily\bfseries\memRTLraggedright}% % subsection \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}% \setaftersubsecskip{1.5ex \@plus .2ex}% %%% \setsubsecheadstyle{\normalfont\large\sffamily\bfseries\raggedright}% \setsubsecheadstyle{\normalfont\large\sffamily\bfseries\memRTLraggedright}% % subsubsection \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}% \setaftersubsubsecskip{1.5ex \@plus .2ex}% %%% \setsubsubsecheadstyle{\normalfont\normalsize\sffamily\bfseries\raggedright}% \setsubsubsecheadstyle{\normalfont\normalsize\sffamily\bfseries\memRTLraggedright}% % paragraph \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}% \setafterparaskip{-1em}% \setparaheadstyle{\normalfont\normalsize\sffamily\bfseries}% % subparagraph \setsubparaindent{\parindent}% \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}% \setaftersubparaskip{-1em}% \setsubparaheadstyle{\normalfont\normalsize\sffamily\bfseries}} % \end{macrocode} % \end{macro} % % \begin{macro}{\hds@ntglike} % Head styles based on the NTG classes (\texttt{boek.cls}). % \begin{macrocode} \makeheadstyles{ntglike}{% % part \renewcommand*{\partnamefont}{\Large\bfseries\MakeUppercase}% \renewcommand*{\partnumfont}{\Large\bfseries}% \renewcommand*{\parttitlefont}{\Large\MakeUppercase}% % chapter \chapterstyle{ntglike} % section \setbeforesecskip{-2\onelineskip \@plus -1\onelineskip \@minus -.5\onelineskip}% \setaftersecskip{0.5\onelineskip}% \setsecheadstyle{\normalfont\large\bfseries}% % subsection \setbeforesubsecskip{-1\onelineskip \@plus -.5\onelineskip \@minus -.25\onelineskip}% \setaftersubsecskip{0.01\onelineskip}% \setsubsecheadstyle{\normalfont\normalsize\bfseries}% % subsubsection \setbeforesubsubsecskip{-1\onelineskip \@plus -.5\onelineskip \@minus -.25\onelineskip}% \setaftersubsubsecskip{0.01\onelineskip}% \setsubsubsecheadstyle{\normalfont\normalsize\slshape}% % paragraph \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}% \setafterparaskip{-1em}% \setparaheadstyle{\normalfont\normalsize\slshape}% % subparagraph \setsubparaindent{\parindent}% \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}% \setaftersubparaskip{-1em}% \setsubparaheadstyle{\normalfont\normalsize\slshape}} % \end{macrocode} % \end{macro} % % \begin{macro}{\hds@tandh} % Head styles based on Thames \& Hudson \textit{Typography}. % \changes{v1.61803398}{2009/07/17}{Added bidi support to tandh headstyles} % \begin{macrocode} \makeheadstyles{tandh}{% % chapter \chapterstyle{tandh} % section \setbeforesecskip{-2\onelineskip \@plus -0.5\onelineskip \@minus -.5\onelineskip}% \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}% %%% \setsecheadstyle{\normalfont\raggedright\MakeUppercase}% \setsecheadstyle{\normalfont\memRTLraggedright\MakeUppercase}% % subsection \setbeforesubsecskip{-1.2\onelineskip \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% \setaftersubsecskip{0.8\onelineskip \@plus 0.1\onelineskip}% %%% \setsubsecheadstyle{\normalfont\Large\itshape\raggedright}% \setsubsecheadstyle{\normalfont\Large\itshape\memRTLraggedright}% % subsubsection \setbeforesubsubsecskip{-0.667\onelineskip \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}% %%% \setsubsubsecheadstyle{\normalfont\normalsize\bfseries\raggedright}% \setsubsubsecheadstyle{\normalfont\normalsize\bfseries\memRTLraggedright}% % paragraph \setbeforeparaskip{1.0\onelineskip \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% \setafterparaskip{-1em}% \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}% % subparagraph \setsubparaindent{\parindent}% \setbeforesubparaskip{1.0\onelineskip \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% \setaftersubparaskip{-1em}% \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}} % \end{macrocode} % \end{macro} % % \begin{macro}{\hds@wilsondob} % Head styles based on Adrian Wilson's \textit{The Design of Books}. % \changes{v1.61803398}{2009/07/17}{Added bidi support to wilsondob headstyles} % \begin{macrocode} \makeheadstyles{wilsondob}{% % chapter \chapterstyle{wilsondob} % section \setbeforesecskip{-1.333\onelineskip \@plus -0.5\onelineskip \@minus -.5\onelineskip}% \setaftersecskip{0.667\onelineskip \@plus 0.1\onelineskip}% %%% \setsecheadstyle{\normalfont\raggedright\MakeUppercase}% \setsecheadstyle{\normalfont\memRTLraggedright\MakeUppercase}% % subsection \setbeforesubsecskip{-0.667\onelineskip \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% \setaftersubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}% %%% \setsubsecheadstyle{\normalfont\Large\itshape\raggedright}% \setsubsecheadstyle{\normalfont\Large\itshape\memRTLraggedright}% % subsubsection \setbeforesubsubsecskip{-0.667\onelineskip \@plus -0.25\onelineskip \@minus -0.25\onelineskip}% \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}% %%% \setsubsubsecheadstyle{\normalfont\normalsize\raggedright\scshape\MakeLowercase}% \setsubsubsecheadstyle{\normalfont\normalsize\memRTLraggedright\scshape\MakeLowercase}% % paragraph \setbeforeparaskip{1.0\onelineskip \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% \setafterparaskip{-1em}% \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}% % subparagraph \setsubparaindent{\parindent}% \setbeforesubparaskip{1.0\onelineskip \@plus 0.5\onelineskip \@minus 0.2\onelineskip}% \setaftersubparaskip{-1em}% \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}} % \end{macrocode} % \end{macro} % % % \subsection{Appendices} % % \begin{macro}{\ifanappendix} % \begin{macro}{\anappendixtrue} % \begin{macro}{\anappendixfalse} % \begin{macro}{\appendix} % In the standard \Lpack{book} class the \cs{appendix} command does the % following: % \begin{itemize} % \item Resets the chapter and section counters to zero % \item Sets \cs{@chapapp} to \cs{appendixname}. % \item Redefines \cs{thechapter} to produce alphabetic appendix numbers. % \end{itemize} % \changes{v1.618}{2005/09/03}{Added \cs{ifanappendix} (mempatch v3.12)} % \begin{macrocode} \newif\ifanappendix \anappendixfalse \newcommand{\appendix}{\par \setcounter{chapter}{0}% \setcounter{section}{0}% \gdef\@chapapp{\appendixname}% \gdef\thechapter{\@Alph\c@chapter}% \anappendixtrue} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \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 \cs{part} definition. The normal version % makes an entry in the ToC but the starred version does not. % \changes{v0.33}{2001/08/31}{Changed implementation of \cs{appendixpage}} % \begin{macrocode} \newcommand{\appendixpage}{% \@ifstar{\@sapppage}{\@apppage}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\memapppageinfo} % \begin{macro}{\memapppagestarinfo} % \verb?\memapppageinfo{\appendixpagename}? \\ % \verb?\memapppagestarinfo{\appendixpagename}? \\ % \begin{macrocode} \newcommand{\memapppageinfo}[1]{} \newcommand{\memapppagestarinfo}[1]{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@apppage} % \cs{@apppage} typesets an appendix page and makes an entry in the ToC. % \begin{macrocode} \def\@apppage{% \@setuppart \addappheadtotoc \partmark{\appendixpagename}% \memapppageinfo{\appendixpagename}% {\centering \interlinepenalty \@M \normalfont \printparttitle{\appendixpagename}\par}% \@endpart} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@sapppage} % \cs{@sapppage} typesets an appendix page and does not make an entry in the ToC. % \begin{macrocode} \def\@sapppage{% \@setuppart \partmark{\appendixpagename}% \memapppagestarinfo{\appendixpagename}% {\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. % \changes{v1.61803}{2008/01/30}{Added \cs{phantomsection} to \cs{addappheadtotoc} % (mempatch v4.9)} % \begin{macrocode} \def\addappheadtotoc{% \phantomsection\addcontentsline{toc}{chapter}{\appendixtocname}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@ppsavesec} % \begin{macro}{\@pprestoresec} % \begin{macro}{\@ppsaveapp} % \begin{macro}{\restoreapp} % For the \Lenv{appendices} environment we need to save and restore the % main document division number and the appendix number. The \cs{restoreapp} % command is the one for the user. % \begin{macrocode} \newcounter{@ppsavesec} \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 \cs{appendix} command does, except that it saves and % restores sectional numbering. It saves the sectional number at the start % and restores the appendix number at the end. % \begin{macrocode} \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 \cs{appendix} command but also save the main counters. At the % end of the environment save the appendix number and restore the main counters. % \begin{macrocode} \newenvironment{appendices}% {\@resets@pp\anappendixtrue}% {\@ppsaveapp\@pprestoresec\anappendixfalse} % \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 \cs{@resets@pp} except that it is for use within the % \Lenv{subappendices} environment; as such, it is a bit simpler. % \begin{macrocode} \newcommand{\@resets@ppsub}{ \par \setcounter{section}{0} \renewcommand{\thesection}{\setthesection} } % \end{macrocode} % \end{macro} % % \begin{macro}{\ifnamesubappendix} % \begin{macro}{\namesubappendixtrue} % \begin{macro}{\namesubappendixfalse} % \begin{macro}{\namedsubappendices} % \begin{macro}{\unnamedsubappendices} % Switch for adding an `appendix' name before subappendix numbers. % \changes{v1.0}{2001/11/13}{Added \cs{ifnamesubappendix}} % \changes{v1.61803}{2008/01/30}{Added \cs{namedsubappendices} and % \cs{unnamedsubappendices}} % \begin{macrocode} \newif\ifnamesubappendix \namesubappendixfalse \newcommand*{\namedsubappendices}{\namesubappendixtrue} \newcommand*{\unnamedsubappendices}{\namesubappendixfalse} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{environment}{subappendices} % The environment for subappendices. Start it off by doing the resetting % of the \cs{section} command. % \changes{v1.0}{2001/11/13}{Modified subappendices environment} % \begin{macrocode} \newenvironment{subappendices}{% \@resets@ppsub % \end{macrocode} % Change the definition of \cs{addappheadtotoc} to give a \texttt{section} entry. % \changes{v1.618}{2005/09/02}{Fixed bookmark for \cs{appendixpage} (mempatch v2.3)} % \begin{macrocode} \def\addappheadtotoc{\phantomsection \addcontentsline{toc}{section}{\appendixtocname}} % \end{macrocode} % To implement the naming we do cunning things with the % \cs{@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 \cs{sectionmark}. % \begin{macrocode} \newcommand{\@formatsecmark@pp}[1]{% \MakeUppercase{\appendixname\space \ifnum \c@secnumdepth >\z@ \thesection\quad \fi #1}} % \end{macrocode} % \end{macro} % % \subsection{Appendixpage-like pages} % \changes{v1.618}{2005/09/03}{Added \cs{newleadpage} and friends (mempatch v3.0)} % % % This capability was suggested to me by Lars Madsen on 2004/11/28. % % \begin{macro}{\leadpagetoclevel} % \begin{macro}{\newleadpage} % \begin{macro}{\renewleadpage} % \verb?\newleadpage[]{}{}? creates new macros % called \verb?\cmdname? and \verb?\cmdname*? that when called typeset a % page like an Appendixpage, with a title \verb?<title>? using % page style \verb?<page-style>? (default empty). The % plain version adds an entry to the ToC but the starred \verb?\cmdname*? % does not. \cs{renewleadpage} changes the definitions. % % The ToC entry style is set by \cs{leadpagetoclevel} (default chapter). To have a part-type entry: \\ % \verb?\renewcommand*{\leadpagetoclevel}{part}?. \\ % The \cs{partmark} command is used if you need to mark the title. % \begin{macrocode} \newcommand*{\leadpagetoclevel}{chapter} \newcommand*{\newleadpage}[3][empty]{% \@namedef{#2}{\@ifstar{\dlfm@msapppage{#1}{#2}{#3}}% {\dlfm@mapppage{#1}{#2}{#3}}}} \newcommand*{\renewleadpage}[3][empty]{% \@namedef{#2}{\@ifstar{\dlfm@msapppage{#1}{#2}{#3}}% {\dlfm@mapppage{#1}{#2}{#3}}}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\memleadpageinfo} % \begin{macro}{\memleadpagestarinfo} % \verb?\memleadpageinfo{pstyle}{name}{title}? \\ % \verb?\memleadpagestarinfo{pstyle}{name}{title}? \\ % \begin{macrocode} \newcommand{\memleadpageinfo}[3]{} \newcommand{\memleadpagestarinfo}[3]{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\dlfm@msapppage} % \begin{macro}{\dlfm@mapppage} % Implement the starred and regular versions of \verb?\(re)newleadpage? % \begin{macrocode} \newcommand*{\dlfm@msapppage}[3]{% \@setuppart \partmark{#3}% \memleadpagestarinfo{#1}{#2}{#3}% {\centering \interlinepenalty \@M \normalfont \printparttitle{#3}\par \thispagestyle{#1}}% \dlfm@m@endpart{#1}} \newcommand*{\dlfm@mapppage}[3]{% \@setuppart \phantomsection \addcontentsline{toc}{\leadpagetoclevel}{#3}% \partmark{#3}% \memleadpageinfo{#1}{#2}{#3}% {\centering \interlinepenalty \@M \normalfont \printparttitle{#3}\par \thispagestyle{#1}}% \dlfm@m@endpart{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\dlfm@m@endpart} % Finishes off a part-like page. % \begin{macrocode} \newcommand*{\dlfm@m@endpart}[1]{% \if@twoside \if@openright \null \thispagestyle{#1}% \newpage \fi \fi \if@tempswa \twocolumn \fi} % \end{macrocode} % \end{macro} % % \subsection{Paragraphs} % % Much of the code in this section is taken from my \textit{Glisterings} % columns~\cite{GLISTER07,GLISTER08}. % \changes{v1.6180339c}{2009/01/09}{Added several new paragraph types} % % \begin{macro}{\memorigdbs} % \begin{macro}{\memorigpar} % \begin{macro}{\atcentercr} % \cs{memorigdbs} saves the original definition of \verb?\\? and % \cs{memorigpar} saves the original \cs{par}. The macro \cs{atcentercr} % provides a user call to \cs{@centercr}. These could come in handy for % odd paragraph shapes. % \changes{v1.6180339c}{2009/01/09}{Added \cs{memorigdbs} and % \cs{memorigpar} \cs{atcentercr}} % \begin{macrocode} \let\memorigdbs\\ \let\memorigpar\par \let\atcentercr\@centercr % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \subsubsection{Normal (block) paragraphs} % % % \begin{macro}{\flushleftright} % Sets the paragraphing to \LaTeX's normal form. % \changes{v1.61803}{2008/01/30}{Used \cs{@flushglue} in \cs{flushleftright} and % \cs{centerlastline} (mempatch v4.7)} % \changes{v1.6180339c}{2009/01/09}{Extended \cs{flushleftright} to set all % the regular paragraphing controls} % \begin{macrocode} \newcommand*{\flushleftright}{% \let\\\memorigdbs \leftskip\z@skip \rightskip\leftskip \parfillskip\@flushglue \everypar{}} % \end{macrocode} % \end{macro} % % \begin{macro}{\linenottooshort} % This declaration \cs{linenottooshort}\oarg{length} specifies paragraphs % such that the last line is at least about \meta{length} long (the default % is 4em). % \changes{v1.6180339c}{2009/01/09}{Added \cs{linenottooshort} paragraph} % \begin{macrocode} \newcommand*{\linenottooshort}[1][4em]{% \@tempdima=\hsize \advance\@tempdima -#1 \leftskip\z@skip \rightskip\leftskip \parfillskip=\@tempdima \@minus \@tempdima} % \end{macrocode} % \end{macro} % % \begin{macro}{\russianpar} % Using \cs{russianpar} instead of \cs{par} to end a paragraph causes it % to be set according to Russian typography, where the last line of a % multiline paragraph must be either at least as % long as \cs{parindent} and have at least \cs{parindent} space at the % right, or it must be flushleft and flushright. % \changes{v1.6180339c}{2009/01/09}{Added \cs{russianpar} paragraph} % \begin{macrocode} \newcommand*{\russianpar}{\ifhmode\unskip \strut\vadjust{}\nobreak \discretionary{}% {\hbox{\hskip2\parindent \vrule depth 273sp width 0sp height \ht\strutbox}}% {\hbox{\hskip\parindent}}% \hskip-2\parindent \@minus 2\parindent \hskip\hsize \@minus \hsize \kern\z@ \parfillskip\z@ \memorigpar \ifdim\prevdepth=273sp \nobreak \vskip-2\baselineskip \hbox{\strut}% \fi\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\lastlineparrule} % \begin{macro}{\lastlinerulefill} % Using \cs{lastlinerulefill} instead of \cs{par} to end a paragraph % causes all short lines to be filled at the right by a rule % (\cs{lastlineparrule}) extending to the righthand margin. % \changes{v1.6180339c}{2009/01/09}{Added \cs{lastlineparrule} and % \cs{lastlinerulefill} paragraph} % \begin{macrocode} \newcommand*{\lastlineparrule}{% \hrule height 0.5ex depth \@tempdimb\relax} \newcommand*{\lastlinerulefill}{% \let\\\@centercr \@tempdimb=-0.5ex \advance\@tempdimb 0.4pt \unskip\nobreak\space \leaders\lastlineparrule\hskip\@flushglue \vadjust{}{\parfillskip\z@\memorigpar}} % \end{macrocode} % \end{macro} % \end{macro} % % % \subsubsection{Centered lines} % % \begin{macro}{\centerlastline} % This declaration specifies normal paragraphs except that the last line of % each is centered. % \changes{v1.61803398}{2009/07/17}{Added bidi support to \cs{centerlastline}} % \begin{macrocode} \newcommand*{\centerlastline}{% %%% \leftskip\@flushglue \memRTLleftskip\@flushglue %%% \rightskip=\z@ plus -1fil \memRTLrightskip=\z@ plus -1fil \parfillskip=\z@ plus 2fil} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\leftcenterright} % This declaration specifies paragraphs where the first line is flushleft % (raggedright), the % last is flushright (raggedleft) and all inbetween are centered. % Set \verb?\everypar{}? afterwards. % \changes{v1.6180339c}{2009/01/09}{Added \cs{leftcenterright} paragraph} % \begin{macrocode} \newcommand*{\leftcenterright}{%; \let\\\break \parindent\z@ \leftskip\@flushglue \rightskip\leftskip \parfillskip \z@ \@plus -1fil \everypar={\hskip \z@ \@plus -1fil}} % \end{macrocode} % \end{macro} % % \begin{macro}{\centerfloat} % This is a version of \cs{centering} that can be used to center a wide % float with respect to the text block (normally the left of a wide float % is aligned with the left of the textblock). This can only be used for % centering something where LaTeX knows the width (e.g., a figure or a % table / tabular). % % This is a modified version of code by Robin Fairbairns % (CTT, \textit{Re: Centering a table: problem with rotating.sty, maybe % a strange document class?}, 3 Jan 2009). % \changes{v1.6180339c}{2009/01/11}{Added \cs{centerfloat}} % \begin{macrocode} \newcommand*{\centerfloat}{% \parindent \z@ \leftskip \z@ \@plus 1fil \@minus \textwidth \rightskip\leftskip \parfillskip \z@skip} % \end{macrocode} % \end{macro} % % \subsubsection{Ragged} % % The kernel code for raggedright (in \file{ltmiscen.dtx}): % \begin{verbatim} % \def\raggedright{% % \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip % \leftskip\z@skip % \parindent\z@} % %% \@flushglue = 0pt plus 1fil %% from ltalloc.dtx % %% \z@skip = 0pt plus 0pt minus 0pt %% % \end{verbatim} % produces very ragged text with no paragraph indent. % % \begin{macro}{\ragrparindent} % \begin{macro}{\raggedyright} % \cs{raggedyright}\oarg{plus} provides controllable ragged right paragraphs. % \changes{v1.4}{2003/12/10}{Added \cs{raggedyright}} % \changes{v1.61803398}{2009/07/17}{Added bidi support to \cs{raggedyright}} % \begin{macrocode} \newdimen\ragrparindent \setlength{\ragrparindent}{\parindent} \newcommand{\raggedyright}[1][2em]{% \let\\\@centercr\@rightskip \z@ \@plus #1\relax %%% \rightskip\@rightskip \memRTLrightskip\@rightskip %%% \leftskip\z@skip \memRTLleftskip\z@skip \parindent\ragrparindent} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\justlastraggedleft} % This declaration specifies paragraphs where the lines are justified, % except for the last which is raggedleft (flushright).. % \changes{v1.6180339c}{2009/01/09}{Added \cs{justlastraggedleft} paragraph} % \changes{v1.61803398}{2009/07/17}{Added bidi support to \cs{justlastraggedleft}} % \begin{macrocode} \newcommand*{\justlastraggedleft}{% %%% \leftskip\@flushglue \memRTLleftskip\@flushglue %%% \rightskip-\leftskip \memRTLrightskip-\memRTLleftskip \parfillskip\leftskip \parindent \z@} % \end{macrocode} % \end{macro} % % % \begin{macro}{\raggedrightthenleft} % This declaration specifies paragraphs where the first line is raggedright % (flushleft) and all the rest are raggedleft (flushright). Note that % this alters \cs{everpar}, which may need to be reset afterwards to % \verb?\everypar{}?. % \changes{v1.6180339c}{2009/01/09}{Added \cs{raggedrightthenleft} paragraph} % \changes{v1.61803398}{2009/07/17}{Added bidi support to \cs{raggedrightthenleft}} % \begin{macrocode} \newcommand*{\raggedrightthenleft}{% \parindent \z@ %%% \leftskip \z@ \@plus 1fill \memRTLleftskip \z@ \@plus 1fill %%% \rightskip\@flushglue \memRTLrightskip\@flushglue \parfillskip \z@ \everypar{\hskip \z@ \@plus -1fill}} % \end{macrocode} % \end{macro} % % % \subsubsection{Hanging} % % \begin{macro}{\hangfrom} % This is a user-level % version of the kernel \cs{@hangfrom} macro (only the name is % changed) as defined in \file{ltsec.dtx}. % % \cs{hangfrom}\marg{text} puts \meta{text} in a box and makes a hanging % paragraph of the following material (a bit like a description item). % \changes{v1.4}{2003/11/22}{Added \cs{hangfrom} (from patch v1.9)} % \begin{macrocode} \newcommand{\hangfrom}[1]{% \setbox\@tempboxa\hbox{{#1}}% \hangindent \wd\@tempboxa\noindent\box\@tempboxa} % \end{macrocode} % \end{macro} % % \begin{macro}{\hangpara} % \cs{hangpara}\marg{indent}\marg{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} % \verb?\begin{hangparas}?\marg{indent}\marg{afternum} hangs % a series of paragraphs. % \begin{macrocode} \newenvironment{hangparas}[2]{\setlength{\parindent}{\z@} \everypar={\hangpara{#1}{#2}}}{\par} % \end{macrocode} % \end{environment} % % \subsubsection{Miscellaneous} % % \begin{macro}{\leftspringright} % \cs{leftspringright}\marg{leftfrac}\marg{rightfrac}\marg{lefttext}\marg{righttext} % sets the \meta{lefttext} flushleft (raggedright) in a column \meta{leftfrac} % of the current textwidth and the \meta{righttext} flushright (raggedleft) % in a column \meta{rightfrac} of the textwidth, with space % (1.0 - \meta{leftfrac} - \meta{rightfrac}) % of the textwidth between them. Both \meta{leftfrac} and \meta{rightfrac} % must be given as decimal numbers (e.g., \texttt{0.25} not \texttt{1/4}). % \changes{v1.6180339c}{2009/01/09}{Added \cs{leftspringright} paragraph} % \begin{macrocode} \newcommand{\leftspringright}[4]{% \@tempdimb=\hsize \par\noindent\hbox to\@tempdimb{% \vtop{\hsize=#1\@tempdimb \flushleft#3\par}\hss \vtop{\hsize=#2\@tempdimb \flushright#4\par}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\sourceatright} % Putting \cs{sourceatright}\oarg{length}\marg{text} at the end of a % paragraph will set \meta{text} flushright on the same line provided the line % is short enough to allow \meta{length} (default 2em) between the end of the % line and \meta{text}. If there is not enough space then \meta{text} is % set flushright on the following line. % \changes{v1.6180339c}{2009/01/09}{Added \cs{sourceatright} paragraph} % \begin{macrocode} \newcommand*{\sourceatright}[2][2em]{{% \unskip\nobreak\hfil\penalty50 \hskip#1\hbox{}\nobreak\hfil{#2} \parfillskip\z@\finalhyphendemerits=0\par}} % \end{macrocode} % \end{macro} % % % \section{Lists} % % \subsection{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, \cs{rightmargin}, % \cs{listparindent} and \cs{itemindent} are set to 0pt. Then, for a Kth % level list, the command \cs{@listK} is called, where `K' denotes `i', % '`i', ... , `vi'. (I.e., \cs{@listiii} is called for a third-level % list.) By convention, \cs{@listK} should set \cs{leftmargin} to % \cs{leftmarginK}. % % % \begin{macro}{\leftmargin} % \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 % \cs{@listi} is defined to set only \cs{leftmargin}. % % In two column mode the margins should be smaller than in one column typesetting. % \begin{macrocode} \if@twocolumn \setlength{\leftmargini}{2em} \else \setlength{\leftmargini}{2.5em} \fi % \end{macrocode} % The value of \cs{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 \cs{itemindent} which is the extra indentation before % a label. % \begin{macrocode} \setlength{\itemindent}{\z@} % \end{macrocode} % \end{macro} % % \begin{macro}{\labelsep} % \begin{macro}{\labelwidth} % \cs{labelsep} is the distance between the label and the text of an % item; \cs{labelwidth} is the width of the label. % \begin{macrocode} \setlength{\labelsep}{0.5em} \setlength{\labelwidth}{\leftmargini} \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}{\everylistparindent} % \begin{macro}{\list} % The kernel sets \cs{listparindent} to zero within a \cs{list}, where it % can be overridden in \cs{list}'s second argument. Here it is set to % \cs{everyparlistindent} by default, which in turn is 0pt. % \begin{macrocode} \newdimen\everylistparindent \everylistparindent \z@ \renewcommand*{\list}[2]{% \ifnum \@listdepth >5\relax \@toodeep \else \global\advance\@listdepth\@ne \fi \rightmargin\z@ \listparindent\everylistparindent \itemindent\z@ \csname @list\romannumeral\the\@listdepth\endcsname \def\@itemlabel{#1}% \let\makelabel\@mklab \@nmbrlistfalse #2\relax \@trivlist \parskip\parsep \parindent\listparindent \advance\linewidth -\rightmargin \advance\linewidth -\leftmargin \advance\@totalleftmargin \leftmargin \parshape \@ne \@totalleftmargin \linewidth \ignorespaces} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\parsepi} % \begin{macro}{\topsepi} % \begin{macro}{\itemsepi} % \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}{\itemsepii} % \begin{macro}{\itemsepiii} % \begin{macro}{\partopsepii} % \begin{macro}{\partopsepii} % We need some new lengths for lists to cater for non-zero \cs{parskip}. % \changes{v1.61803}{2008/01/30}{Added \cs{itemsepii}, \cs{itemsepiii} and % \cs{partopsepii} (mempatch v4.6)} % \begin{macrocode} \newlength{\itemsepii} \newlength{\itemsepiii} \newlength{\partopsepii} \newlength{\partopsepiii} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\setnzplist} % Common code for non-zero \cs{parskip} in lists. % \begin{macrocode} \newcommand*{\setnzplist}{% \partopsep \p@ \@plus\z@ \@minus\p@ \topsepi\z@ \parsepi\parskip \itemsepi\z@ \topsepii\z@ \parsepii\parskip \itemsepii\z@ \topsepiii\z@ %% \parsepiii\parskip \itemsepiii\z@} % \end{macrocode} % \end{macro} % % \begin{macro}{\defaultlists} % The standard \LaTeX\ classes have list parameters that give some % separation between lists and \cs{item}s in lists. This macro sets % those values. This is a simplification of memoir's original, and will % apply to any font size. % \changes{v1.61803}{2008/01/30}{Complete replacement of \cs{defaultlists} % (mempatch 4.5)} % \begin{macrocode} \newcommand*{\defaultlists}{% \setlength{\partopsep}{0.2\onelineskip \@plus 0.1\onelineskip \@minus 0.1\onelineskip}% \parsepi = 0.3333\onelineskip \@plus 0.1667\onelineskip \@minus \p@ \itemsepi = \parsepi \topsepi = 0.6667\onelineskip \@plus 0.3333\onelineskip \@minus 0.2\onelineskip \parsepii = 0.1667\onelineskip \@plus \p@ \@minus \p@ \topsepii = \parsepi \topsepiii = \parsepii \everylistparindent \listparindent % \end{macrocode} % Additional code to cater for non-zero \cs{parskip}s. % \changes{v1.61803}{2008/01/30}{Modified \cs{defaultlists} for % non-zero \cs{parskip} (memptach v4.6)} % \begin{macrocode} \itemsepii\parsepii \itemsepiii\topsepiii \partopsepiii \p@ \@plus\z@ \@minus\p@ \ifm@mnzpskip \setnzplist \fi} \defaultlists % \end{macrocode} % \end{macro} % % \begin{macro}{\firmlists} % \begin{macro}{\firmlists*} % \begin{macro}{\m@msfirmlists} % \begin{macro}{\m@mfirmlists} % These give approximately half the vertical spacing of the default lists, % with all spaces equal. The starred version allows slightly less space % before and after the list when it is preceded by a blank line. % \changes{v1.61803}{2008/01/30}{Added \cs{firmlists}, etc. (mempatch v4.5)} % \begin{macrocode} \newcommand*{\firmlists}{% \@ifstar{\m@msfirmlists}{\m@mfirmlists}} \newcommand*{\m@msfirmlists}{ \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}% \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@ \itemsepi = \parsepi \topsepi = \parsepi \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@ \topsepii = \parsepi \topsepiii = \parsepii \everylistparindent\listparindent} \newcommand*{\m@mfirmlists}{ \setlength{\partopsep}{0.1\onelineskip \@plus 0.05\onelineskip \@minus 0.05\onelineskip}% \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@ \itemsepi = \parsepi \topsepi = \parsepi \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@ \topsepii = \parsepi \topsepiii = \parsepii \everylistparindent\listparindent} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\tightlists} % \begin{macro}{\tightlists*} % \begin{macro}{\m@mstightlists} % \begin{macro}{\m@mtightlists} % This macro sets the parameters for lists that have less open vertical % space in them. I think that these look neater than the defaults. % Effectively, no additional vertical space is added. % The starred version allows slightly no extra space % before and after the list when it is preceded by a blank line, % whereas the unstarred version puts half a \cs{onelineskip} % before \emph{and} after. % \changes{v1.61803}{2008/01/30}{Revised \cs{tightlists}, etc. (mempatch v4.5)} % \changes{v1.61803}{2008/01/30}{Revised \cs{tightlists} for non-zero % \cs{parskip}(mempatch v4.6)} % \begin{macrocode} \newcommand*{\tightlists}{% \@ifstar{\m@mstightlists}{\m@mtightlists}} \newcommand*{\m@mstightlists}{% \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}% \parsepi = \z@ \@plus \p@ \@minus \p@ \itemsepi = \parsepi \topsepi = \z@ \@plus \p@ \@minus \p@ \parsepii = \z@ \@plus \p@ \@minus \p@ \topsepii = \parsepi \topsepiii = \parsepii \everylistparindent\parindent \ifm@mnzpskip \setnzplist \partopsepiii\partopsep \fi} \newcommand*{\m@mtightlists}{% \setlength{\partopsep}{0.5\onelineskip \@plus \p@ \@minus \p@}% \parsepi = \z@ \@plus \p@ \@minus \p@ \itemsepi = \parsepi \topsepi = \z@ \@plus \p@ \@minus \p@ \parsepii = \z@ \@plus \p@ \@minus \p@ \topsepii = \parsepi \topsepiii = \parsepii \everylistparindent\parindent \ifm@mnzpskip \setnzplist \partopsepiii\partopsep \fi} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\firmlist} % \begin{macro}{\tightlist} % These two macros can be used at the start of a list environment to % reduce the vertical gaps. \cs{tightlist} removes all interior spaces % while \cs{firmlist} only removes some. % \changes{v0.3}{2001/07/09}{Added \cs{firmlist} and reimplemented the % original \cs{tightlist}} % \begin{macrocode} \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} % % The space before and after a \Lenv{trivlist} environment is controlled % by the \cs{topsep} and \cs{partopsep} skips. There are several environments, % such as \Lenv{center}, that are defined as a \Lenv{trivlist}. % % \begin{macro}{\m@msavetopsep} % \begin{macro}{\m@msavepartopsep} % \begin{macro}{\savetrivseps} % \begin{macro}{\restoretrivseps} % Two skips to store the \cs{topsep} and \cs{partopsep} values and a means % of setting them and restoring them. % \changes{v1.6}{2004/01/28}{Added methods for adjusting the space around % a trivlist} % \begin{macrocode} \newskip\m@msavetopsep \newskip\m@msavepartopsep \newcommand*{\savetrivseps}{% \m@msavetopsep\topsep \m@msavepartopsep\partopsep} \newcommand*{\restoretrivseps}{% \topsep\m@msavetopsep \partopsep\m@msavepartopsep} % \end{macrocode} % Save the initial \cs{topsep} and \cs{partopsep} values. % \begin{macrocode} \savetrivseps % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\zerotrivseps} % A macro to zero \cs{topsep} and \cs{partopsep}. % \begin{macrocode} \newcommand*{\zerotrivseps}{% \topsep\z@ \partopsep\z@} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@listI} % \begin{macro}{\@listi} % \cs{@listI} defines top level and \cs{@listi} values of % \cs{leftmargin}, \cs{parsep}, \cs{topsep}, and \cs{itemsep} % % \begin{macrocode} \def\@listi{\leftmargin\leftmargini \parsep\parsepi \topsep\topsepi \itemsep\itemsepi} \let\@listI\@listi % \end{macrocode} % We should initialise these parameters to the standard defaults % \begin{macrocode} \defaultlists \@listi % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\@listii} % \begin{macro}{\@listiii} % \begin{macro}{\@listiv} % \begin{macro}{\@listv} % \begin{macro}{\@listvi} % Here are the same macros for the lower level lists. % \begin{macrocode} \def\@listii{\leftmargin\leftmarginii \labelwidth\leftmarginii \advance\labelwidth-\labelsep \topsep\topsepii \parsep\parsepii \itemsep\parsepii} \def\@listiii{\leftmargin\leftmarginiii \labelwidth\leftmarginiii \advance\labelwidth-\labelsep \topsep\topsepiii \parsep\z@ %%% \itemsep\topsep %%% \partopsep \p@ \@plus\z@ \@minus\p@ \itemsep\itemsepiii \partopsep\partopsepiii} \def\@listiv{\leftmargin\leftmarginiv \labelwidth\leftmarginiv \advance\labelwidth-\labelsep} \def\@listv{\leftmargin\leftmarginv \labelwidth\leftmarginv \advance\labelwidth-\labelsep} \def\@listvi{\leftmargin\leftmarginvi \labelwidth\leftmarginvi \advance\labelwidth-\labelsep} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \subsection{Enumerate} % % % 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\\ % \cs{labelenumi} \ldots\ \cs{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 \verb?\p@enumN\theenumN? defines the output of a % \cs{ref} command when referencing an item of the Nth level of an % enumerated list. % \begin{macrocode} \renewcommand{\p@enumii}{\theenumi} \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 \verb?A a I i? or \verb?1? produces the value % of the counter printed with (respectively) \verb?\Alph \alph \Roman \roman? % or \cs{arabic}. % % These letters may be surrounded by any strings involving any other % \TeX\ expressions, however the tokens \verb?A a I i 1? must be inside a % \verb?{ }? 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 `?'. \cs{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 \cs{@enLab}. They each end % with a call to \cs{@enloop}, which starts the processing of the next % token. % \begin{macro}{\@enLabel} % Add the counter to the label. \verb?#2? will be one of the `special' % tokens \verb?A a I i 1?, and is thrown away. \verb?#1? will be a command % like \cs{Roman}. % \begin{macrocode} \def\@enLabel#1#2{% \edef\@enThe{\noexpand#1{\@enumctr}}% \@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 \verb?{ }? 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 \cs{@tfor} lets you see % spaces and \textbf{all} braces. \cs{@tfor} would treat \verb?a? and % \verb?{a}? as special, but not \verb?{{a}}?. % \begin{macrocode} \def\@enloop{\futurelet\@entemp\@enloop@} % \end{macrocode} % \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 \verb?*?. % % To enable a new counter type based on a letter, you just need % to add a new \cs{ifx} clause by analogy with the code above. % So for example to make \verb?*? trigger footnote symbol counting. % a package should do the following. % % Initialise the hook, in case the package is loaded before % \textsf{enumerate}. %\begin{verbatim} % \providecommand\@enhook{} %\end{verbatim} % % Add to the hook a new \cs{ifx} clause that associates \verb?*? with the % \cs{fnsymbol} counter command. %\begin{verbatim} % \g@addto@macro\@enhook{% % \ifx *\@entemp % \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 % \cs{provide}d). % \begin{macrocode} %% \providecommand\@enhook{} \newcommand\@enhook{} % \end{macrocode} % \end{macro} % % \begin{macro}{\enumerate} % The new \Lenv{enumerate} environment. This is the first half of the % original enumerate environment. If there is an optional argument, call % \cs{@@enum@} to define the label commands, otherwise call % \cs{@enum@} which is the second half of the original definition. % \begin{macrocode} \def\enumerate{% \ifnum \@enumdepth >3 \@toodeep\else \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 \cs{@enlab}. % \cs{@enThe} will be used to define \cs{theenum}\,$n$. % \begin{macrocode} \@enLab{}\let\@enThe\@enQmark % \end{macrocode} % The \cs{@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 \cs{labelenum}$\,n$ and \cs{theenum}$\,n$. % \begin{macrocode} \expandafter\edef\csname label\@enumctr\endcsname{\the\@enLab}% \expandafter\let\csname the\@enumctr\endcsname\@enThe % \end{macrocode} % Set the counter to 7 so that we get the width of `vii' if roman % numbering is in force then set \cs{leftmargin}$\,n$. to the width of the % label plus \cs{labelsep}. % \begin{macrocode} \csname c@\@enumctr\endcsname7 \expandafter\settowidth \csname leftmargin\romannumeral\@enumdepth\endcsname {\the\@enLab\hspace{\labelsep}}% % \end{macrocode} % Finally call \cs{@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 \cs{list}. This % is taken straight from the original definition of \cs{enumerate}. % \begin{macrocode} \def\@enum@{\list{\csname label\@enumctr\endcsname}% {\usecounter{\@enumctr}\def\makelabel##1{\hss\llap{##1}}}} % \end{macrocode} % \end{macro} % % END OF DAVID CARLISLE'S CODE AND COMMENTARY % % % % \subsection{Itemize} % % % \begin{macro}{\labelitemi} % \begin{macro}{\labelitemii} % \begin{macro}{\labelitemiii} % \begin{macro}{\labelitemiii} % Itemization is controlled by the commands: \cs{labelitemi}, % \cs{labelitemii}, etc., which define % the labels of the various itemization levels: the symbols used are: % bullet (\textbullet), bold en-dash (\textbf{\textendash}), % centered asterisk (\textasteriskcentered), and centered dot % (\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 \Lenv{itemize} environment % an optional argument to match \Lenv{enumerate}. Fortunately this seems % to be much simpler and I might even be able to work it out for myself. % % \begin{environment}{itemize} % This is a hack at the kernel code for \Lenv{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} % % \subsection{Description} % % The class defines two description environment, the standard one and a `block' % one, and also two semi-configurable versions. % % \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 % \cs{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} % In order to change the formatting of the label, you must redefine % the macro \cs{blockdescriptionlabel}. % % \begin{macrocode} \newcommand*{\blockdescriptionlabel}[1]{%%% \hspace\labelsep \normalfont\bfseries #1} % \end{macrocode} % \end{macro} % % \begin{environment}{labelled} % This is a version of the description environment which takes the % name, without the backslash, of some \cs{labelcode} as its argument. % For example: % \begin{verbatim} % \newcommand*{\sflabel}[1]{\hspace\labelsep \normalfont\sffamily #1} % \begin{labelled}{sflabel} % \item[label] using a sans font for the labels % \end{verbatim} % \changes{v1.6180339f}{2009/04/25}{Added labelled environment} % \begin{macrocode} \newenvironment{labelled}[1]% {\list{}{\labelwidth\z@ \itemindent-\leftmargin \def\m@malabel{\@nameuse{#1}} \let\makelabel\m@malabel}}% {\endlist} % \end{macrocode} % \end{environment} % % \begin{environment}{flexlabelled} % \verb?\begin{flexlabelled}{labelcode}{labelwidth}{labelsep}{itemindent}{leftmargin}{rightmargin}? % lets you specify some of the parameters for a description-like list. % The first argument is as for the labelled environment. The others are all % lengths for the various parameters; a \verb?*? instead of a length means % that that argument is to be ignored. % \changes{v1.6180339f}{2009/04/25}{Added flexlabelled environment} % \begin{macrocode} \newenvironment{flexlabelled}[6]% {\list{}{\nametest{#2}{*}% \ifsamename\else \labelwidth #2 \fi \nametest{#3}{*}% \ifsamename\else \labelsep #3 \fi \nametest{#4}{*}% \ifsamename\else \itemindent #4 \fi \nametest{#5}{*}% \ifsamename\else \leftmargin #5 \fi \nametest{#6}{*}% \ifsamename\else \rightmargin #6 \fi \def\m@malabel{\@nameuse{#1}} \let\makelabel\m@malabel}}% {\endlist} % \end{macrocode} % \end{environment} % % % \subsection{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 \cs{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} % % \subsection{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} % % \subsection{Theorem} % % This document class does not define it's own theorem environments, % the defaults, supplied by \file{latex.dtx} are available. % % \subsection{Listing of symbols and abbreviations} % % Another 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 \Lenv{symbols} environment the command % \cs{symboldef}\marg{symbol}\marg{meaning} % is used to specify and explain each symbol or abbreviation. % \begin{macrocode} \newcommand{\symboldef}[2]{\item[#1] #2} % \end{macrocode} % \end{macro} % % \section{Abstracts} % % Books usually do not have abstracts, but I decided to add in the code % from the \Lpack{abstract} % package~\cite{ABSTRACT}. % \changes{v0.3}{2001/07/09}{Added code for abstracts} % % % We just have the \Lpack{report} or \Lpack{article} style for the % abstract with no \Lopt{titlepage} option. The original code, % from \file{classes.dtx} for this is: % \begin{verbatim} % \newenvironment{abstract}{% % \if@twocolumn % \section*{\abstractname} % \else % \small % \begin{center}% % {\bfseries \abstractname\vspace{-.5em}\vspace{\z@}}%% % \end{center}% % \quotation % \fi}% % {\if@twocolumn\else\endquotation\fi} % \end{verbatim} % % % The following \cs{if...} commands are for implementing various options. % \begin{macro}{\if@bsonecol} % \begin{macro}{\ifadd@bstotoc} % \begin{macro}{\ifnumber@bs} % \begin{macro}{\if@bsrunin} % \begin{macrocode} \newif\if@bsonecol \@bsonecoltrue \newif\ifadd@bstotoc \add@bstotocfalse \newif\ifnumber@bs \number@bsfalse \newif\if@bsrunin \@bsruninfalse % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\abstractcol} % \begin{macro}{\abstractintoc} % \begin{macro}{\abstractnum} % \begin{macro}{\abstractrunin} % These are the use-level commands for setting the options. If % the abstract is runin, then it must not be numbered otherwise % adding it to the ToC might result in something peculiar. % \begin{macrocode} \newcommand{\abstractcol}{\@bsonecolfalse} \newcommand{\abstractintoc}{\add@bstotoctrue} \newcommand{\abstractnum}{\number@bstrue\@bsruninfalse} \newcommand{\abstractrunin}{\@bsrunintrue\number@bsfalse} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % The next set of macros comprise the % implementation of the \Lenv{abstract} environment. % % \begin{macro}{\abstractnamefont} % \begin{macro}{\abstracttextfont} % These two macros are for specifying the fonts for typesetting the % abstract's title and text. They are initialised for the default case % (i.e., no class options). % \begin{macrocode} \newcommand{\abstractnamefont}{\normalfont\small\bfseries} \newcommand{\abstracttextfont}{\normalfont\small} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\abscolnamefont} % \begin{macro}{\abscoltextfont} % These two macros are for specifying the fonts for typesetting the % abstract's title and text in a two column document where the abstarct % is part of a column. % \changes{v1.61803}{2008/01/30}{Added \cs{abscolnamefont} and % \cs{abscoltextfont} (mempatch v4.8)} % \begin{macrocode} \newcommand{\abscolnamefont}{\normalfont\Large\bfseries} \newcommand{\abscoltextfont}{\normalfont} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\absnamepos} % \begin{macro}{\abstitleskip} % \cs{absnamepos} specifies the environment in which the abstract's title % name will be typeset, and the length \cs{abstitleskip} is an adjustement % to the vertical space between the title and the abstract's text. These % are initialised for the default case. % \begin{macrocode} \newcommand{\absnamepos}{center} \newlength{\abstitleskip} \setlength{\abstitleskip}{-0.5em} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\absleftindent} % \begin{macro}{\abs@leftindent} % \begin{macro}{\absrightindent} % \begin{macro}{\absparindent} % \begin{macro}{\absparsep} % The abstract's text is typeset as a single item list, called % \texttt{@bstr@ctlist}. These lengths set the left and right margin indents, the % paragraph indentation, and the inter-paragraph vertical space. Their % initial values are all class option-dependent. % \changes{v1.618}{2005/09/03}{Added \cs{abs@leftindent} per Lars Madsen (mempatch v3.0)} % \begin{macrocode} \newlength{\absleftindent} \absleftindent=\leftmargin \newdimen\abs@leftindent \abs@leftindent=\leftmargin \newlength{\absrightindent} \absrightindent=\leftmargin \newlength{\absparindent} \newlength{\absparsep} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\abslabeldelim} % \begin{macro}{\@bslabeldelim} % The contents of \cs{abslabeldelim} are typeset after a run-in heading. % \begin{macrocode} \newcommand{\abslabeldelim}[1]{\def\@bslabeldelim{#1}} \abslabeldelim{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@bsrunintitle} % This macro typeset the run-in heading. % \begin{macrocode} \newcommand{\@bsrunintitle}{% \hspace*{\abstitleskip}{\abstractnamefont\abstractname\@bslabeldelim}} % \end{macrocode} % \end{macro} % % \begin{macro}{\setup@bstract} % Now arrange to set all the class option-dependent values. % \changes{v1.618}{2005/09/03}{Used \cs{abs@leftindent} in \cs{setup@bstract} (mempatch v3.0)} % \changes{v1.61803}{2008/01/30}{Changed \cs{setup@bstract} to cater for % \cs{abscolnamefont}, etc., and don't set % \cs{absrightindent} to \cs{absleftindent}.} % \begin{macrocode} \newcommand{\setup@bstract}{% \abs@leftindent=\absleftindent \if@twocolumn % \end{macrocode} % Values for the \Lopt{twocolumn} class option. % \begin{macrocode} \if@bsonecol \else \abs@leftindent=\z@ \absrightindent=\z@ \renewcommand*{\abstractnamefont}{\abscolnamefont} \renewcommand*{\abstracttextfont}{\abscoltextfont} \renewcommand*{\absnamepos}{flushleft} \setlength{\abstitleskip}{-2ex} \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macrocode} \AtBeginDocument{\setlength{\absparindent}{\parindent} \setlength{\absparsep}{\parskip}} % \end{macrocode} % % \begin{environment}{@bstr@ctlist} % The abstract's text is typeset within the \Lenv{@bstr@ctlist} list environment. % \changes{v1.618}{2005/09/03}{Used \cs{abs@leftindent} in \cs{@bstr@ctlist} (mempatch v3.0)} % \begin{macrocode} \newenvironment{@bstr@ctlist}{% \list{}{% %%\topsep \z@ \partopsep \z@ \listparindent \absparindent \itemindent \listparindent \leftmargin \abs@leftindent \rightmargin \absrightindent \parsep \absparsep}% \item\relax} {\endlist} % \end{macrocode} % \end{environment} % % \begin{macro}{\put@bsintoc} % This macro adds the abstract's title to the ToC. It does nothing if % the abstract is being numbered. % \begin{macrocode} \newcommand{\put@bsintoc}{% \ifadd@bstotoc \ifnumber@bs\else \phantomsection \addcontentsline{toc}{chapter}{\abstractname} \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\num@bs} % This macro generates a numbered abstract heading. % \begin{macrocode} \newcommand{\num@bs}{\chapter{\abstractname}} % \end{macrocode} % \end{macro} % % \begin{environment}{abstract} % At last we are in position to define the \Lenv{abstract} environment. This % follows very much along the lines of the standard class definitions, but with % macros inserted at strategic points. % % The \Lopt{twocolumn} option and the default case. These use the same code % as any style differences are embedded in the new macros. % \begin{macrocode} \newenvironment{abstract}{% \setup@bstract \if@bsrunin\else \ifnumber@bs \num@bs \else \begin{\absnamepos}\abstractnamefont\abstractname\end\absnamepos% \vspace{\abstitleskip}% \fi \fi \put@bsintoc% \begin{@bstr@ctlist}\if@bsrunin\@bsrunintitle\fi\abstracttextfont}% {\par\end{@bstr@ctlist}} % \end{macrocode} % \end{environment} % % \begin{environment}{onecolabstract} % An environment for typesetting a single column abstract, % particularly as the optional argument to the \cs{twocolumn} command. % \begin{macrocode} \newenvironment{onecolabstract}{% \begin{@twocolumnfalse}\begin{abstract}}{% \end{abstract}\end{@twocolumnfalse}} % \end{macrocode} % \end{environment} % % \begin{macro}{\thanks} % \begin{macro}{\@bs@thanks} % We have to keep the contents of the \cs{thanks} commands as normally these % are emptied by the \cs{maketitle} command. I do this by extending the definition % of the \cs{thanks} (from \file{ltsect.dtx}) command, % so that \cs{@bs@thanks} has a copy of the contents % of \cs{@thanks}. % \begin{macrocode} \addtoiargdef{\thanks}{}{% \protected@xdef\@bs@thanks{\@bs@thanks \protect\footnotetext[\the\c@footnote]{#1}}% } \let\@bs@thanks\@empty % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\saythanks} % This macro typesets any \cs{thanks} commands \emph{after} using % \texttt{onecolabstract}. % \begin{macrocode} \newcommand{\saythanks}{\begingroup \renewcommand{\thefootnote}{\fnsymbol{footnote}}\@bs@thanks \endgroup\global\let\@bs@thanks\@empty} % \end{macrocode} % \end{macro} % % % \section{Verse} % % The class provides a more flexible \Lenv{verse} environment than the % standard classes. This is based on the \Lpack{verse} % package~\cite{VERSE}. % \changes{v1.0}{2001/10/30}{Complete rewrite of verse typesetting} % % \subsection{Environments} % % Before proceeding with the main, here are some macros for aspects % of line numbering. % % \begin{macro}{\c@vslineno} % \begin{macro}{\c@poemline} % \begin{macro}{\c@modulo@vs} % \begin{macro}{\c@memfvsline} % We need counters for stanza and poem lines. The \texttt{memfvsline} % counter is for adjusting the starting line for verse line numbers. % \changes{v1.1}{2002/03/10}{Added poemline and modulo@vs counters} % \changes{v1.61803}{2008/01/30}{Added memfvsline counter (mempatch v4.9)} % \begin{macrocode} \newcounter{vslineno} \newcounter{poemline} \newcounter{modulo@vs} \newcounter{memfvsline} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\poemlines} % \cs{poemlines}\marg{nth} specifies that every \meta{nth} line of % a poem is to be numbered. % \changes{v1.1}{2002/03/10}{Added \cs{poemlines}} % \changes{v1.2}{2002/07/27}{\cs{poemlines} now just calls \cs{linenumberfrequency}} % \changes{v1.61803}{2008/01/30}{Deleted \cs{poemlines}.} % \begin{macrocode} %%%\newcommand{\poemlines}[1]{\linenumberfrequency{#1}% %%% \@memwarn{Use \string\linenumberfrequency\space %%% instead of \string\poemlines}} % \end{macrocode} % \end{macro} % % \begin{macro}{\linenumberfont} % \begin{macro}{\vlvnumfont} % Set line numbering font(s). % \begin{macrocode} \newcommand{\linenumberfont}[1]{\def\vlvnumfont{#1}} %%% \linenumberfont{\small\rmfamily} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\ifbvcountlines} % \begin{macro}{\bvcountlinestrue} % \begin{macro}{\bvcountlinesfalse} % Looking ahead, TRUE for (boxed) verbatim line numbers to be printed. Default % is not to print them. Not that \cs{linenumberfrequency} twiddles with this. % \begin{macrocode} \newif\ifbvcountlines% TRUE to print line numbers of (boxed) verbatim lines \bvcountlinesfalse % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\linenumberfrequency} % \begin{macro}{\linemodnum} % Set numbering intervals (number modulo). Default is modulus 0. % \begin{macrocode} \newcommand{\linenumberfrequency}[1]{% \ifnum #1< \@ne \def\linemodnum{0\relax} \bvcountlinesfalse \else \def\linemodnum{#1\relax} \bvcountlinestrue \fi} %%%%\linenumberfrequency{0} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\setverselinenums} % \cs{setverselinenums}\marg{firstline}\marg{startnumsat} sets the first line % number to \meta{firstline} and the first line number to be printed is % \meta{startnumsat}. Use within the \Lenv{verse} environment before the % first verse. Note that \\ % \verb?firstline <= startnumsat < firstline + linenumberfrequency? % \changes{v1.61803}{2008/01/30}{Added \cs{setverselinenums} (mempatch v4.9)} % \begin{macrocode} \newcommand*{\setverselinenums}[2]{% \c@poemline #1\relax \advance\c@poemline \m@ne \refstepcounter{poemline}% \ifnum\z@<\linemodnum% we are printing line numbers \@tempcnta #2\relax \divide\@tempcnta\linemodnum \multiply\@tempcnta\linemodnum \c@memfvsline #2\relax \advance\c@memfvsline-\@tempcnta \fi} % \end{macrocode} % \end{macro} % % \changes{v1.1}{2002/03/24}{Added \cs{getmodulo@vs}} % \changes{v1.2}{2002/07/27}{Using \cs{getthelinenumber} instead of \cs{getmodulo@vs}} % % \begin{macro}{\getthelinenumber} % \cs{getthelinenumber}\marg{counter}\marg{start} returns \cs{thecounter} % if it is exactly divisible by \cs{linenumberfrequency}, provided this is % not zero. \meta{start} is the first number. % \changes{v1.61802}{2008/01/30}{Generalised \cs{getthelinenumber} to cater % for set of first line number.} % \begin{macrocode} \newcommand{\getthelinenumber}[2]{% \ifnum\@ne>\linemodnum% no line numbers \else \ifnum\@ne=\linemodnum% every line numbered \@nameuse{the#1}% \else \@tempcnta=\@nameuse{c@#1}% \advance\@tempcnta -\@nameuse{c@#2}% \divide\@tempcnta \linemodnum \multiply\@tempcnta \linemodnum \advance\@tempcnta \@nameuse{c@#2}% \ifnum\@tempcnta=\@nameuse{c@#1}\@nameuse{the#1}\fi \fi \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\ifaltindent} % This should be set TRUE for indenting alternate lines. % \begin{macrocode} \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 \Lenv{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} % \cs{flagverse}\marg{flag} inserts \meta{flag} at the left (of a line). % \changes{v1.1}{2002/03/24}{Added \cs{flagverse}} % \changes{v1.61803398}{2009/07/17}{Added bidi suport to \cs{flagverse}} % \begin{macrocode} \newcommand{\flagverse}[1]{% %%% \hskip-\vleftskip\llap{#1}\hskip\vleftskip\ignorespaces} \hskip-\memRTLvleftskip\llap{#1}\hskip\memRTLvleftskip\ignorespaces} % \end{macrocode} % \end{macro} % % \begin{macro}{\versewidth} % The length \cs{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 \cs{vgap} is used as the basis for spacing. \cs{vin} makes % a horizontal space of \cs{vgap} and \cs{vindent} is the indentation % of wrapped lines. % \begin{macrocode} \newlength{\vgap} \setlength{\vgap}{1.5em} \newcommand{\vin}{\hspace*{\vgap}} \newlength{\vindent} \setlength{\vindent}{2\vgap} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\vinphantom} % Macro to leave blank space coresponding to a string. % \changes{v1.4}{2003/02/27}{Added \cs{vinphantom} (patch 1.1)} % \begin{macrocode} \newcommand{\vinphantom}[1]{\leavevmode\phantom{#1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\vleftofline} % Macro to insert something immediately to the left of the start % of the line. % \changes{v1.618}{2005/09/14}{Added \cs{vleftofline}} % \begin{macrocode} \newcommand*{\vleftofline}[1]{\leavevmode\llap{#1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\vleftmargin} % Length to adjust the default left margin within a verse environment. % \changes{v1.618}{2005/09/18}{Added \cs{vleftmargin}} % \begin{macrocode} \newdimen\vleftmargin \vleftmargin=\leftmargini % \end{macrocode} % \end{macro} % % \begin{macro}{\verselinebreak} % Break a verse line by inserting \cs{newline}. % \changes{v1.1}{2002/03/28}{Modified \cs{verselinebreak}} % \changes{v1.61803}{2008/01/30}{Removed extraneous space from \cs{verselinebreak} (mempatch v4.4, Aaron Rendahl)} % \begin{macrocode} \newcommand{\verselinebreak}[1][\z@]{\newline\hspace*{#1}\ignorespaces} % \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 \cs{@ifstar} except it looks for an exclamation mark! % \changes{v1.1}{2002/03/24}{Added \cs{@vsifbang}} % \begin{macrocode} \newcommand{\@vsifbang}[1]{\@ifnextchar !{\@firstoftwo{#1}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@vsifgt} % Like the kernel \cs{@ifstar} except it looks for a \verb?>? character. % \changes{v1.1}{2002/03/28}{Added \cs{@vsifgt}} % \begin{macrocode} \newcommand{\@vsifgt}[1]{\@ifnextchar >{\@firstoftwo{#1}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\verselinenumbersright} % \begin{macro}{\verselinenumbersleft} % \begin{macro}{\@vstypelinenum} % Declarations for setting line numbers at the right (the default) % or the left.. % \changes{v1.61803}{2008/01/30}{Added \cs{verselinenumbersright} and % \cs{verselinenumbersleft} (mempatch v4.4, v4.9)} % \begin{macrocode} \newcommand*{\verselinenumbersright}{\def\@vstypelinenum{\@vslnumright}} \newcommand*{\verselinenumbersleft}{\def\@vstypelinenum{\@vslnumleft}} \verselinenumbersright % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@vslnumright} % \begin{macro}{\@vslnumleft} % Internal code for right/left line numbers. % \changes{v1.61803398}{2009/07/17}{Added bidi support to \cs{@vslnumright} % and \cs{@vslnumleft}} % \begin{macrocode} \newcommand*{\@vslnumright}{% \hfill\rlap{%\kern\vrightskip\kern\rightmargin% \kern\memRTLvrightskip\kern\rightmargin% \vlvnumfont\getthelinenumber{poemline}{memfvsline}}} \newcommand*{\@vslnumleft}{% \hfill\rlap{%\kern-\textwidth\kern-\vrightskip% \kern-\textwidth\kern-\memRTLvrightskip% \vlvnumfont\getthelinenumber{poemline}{memfvsline}}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@vscentercr} % This puts the poem line number in the margin, increments % the line numbers, and then deals with the options. It is based % on the kernel \cs{@centercr}. % This has to handle various forms of the \verb?\\? command: \verb?\\?, % \verb?\\*?, \verb?\\!?, and \verb?\\>?, together with an optional length argument. % \changes{v1.1}{2002/03/28}{Major rewrite of \cs{@vscentercr} and friends} % \changes{v1.2}{2002/07/27}{Changed \cs{@vscentercr} to use general % linenumbering} % \changes{v1.61803}{2008/01/30}{Changed \cs{@vscentercr} for left/right numbers % (mempatch v4.4)} % \begin{macrocode} \newcommand{\@vscentercr}{% \ifhmode \unskip\else \@nolnerr\fi \@vstypelinenum% % \end{macrocode} % For \verb?>? call \cs{verselinebreak} to process it. % \begin{macrocode} \@vsifgt{\verselinebreak}{% \incr@vsline % \end{macrocode} % If the call is \verb?\\*...? call \cs{@vsxcentercr} to handle the \verb?*...?. % If the call is \verb?\\!?, do nothing. % If the call is \verb?\\![...]?, call \cs{@vsicentercr} to handle the \verb?[...]?. % Otherwise, call \cs{@vsxcentercr}. % \begin{macrocode} \par\@ifstar{\nobreak\@vsxcentercr}{% % \end{macrocode} % \begin{macrocode} \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@vsxcentercr} % Processes \verb?\\*?, and either calls cs{@vsicentercr} to handle a \verb?[length]?, % or \cs{start@vsline}. % \changes{v1.1}{2002/03/24}{Added \cs{@vsxcentercr}} % \begin{macrocode} \newcommand{\@vsxcentercr}{\addvspace{-\parskip}% \@ifnextchar[ {\@vsicentercr}{\start@vsline}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@vsicentercr} % Processes \verb?(\\...)[length]? and then calls \cs{start@vsline}. % \changes{v1.1}{2002/03/24}{Added \cs{@vsicentercr}} % \begin{macrocode} \def\@vsicentercr[#1]{\vskip #1\ignorespaces \start@vsline} % \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}} % \changes{v1.61}{2004/03/21}{Used counter for vslineno, not \cs{thevslineno} % in \cs{start@vsline}} % \begin{macrocode} \newcommand{\start@vsline}{% \ifaltindent\ifodd\c@vslineno\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 way of distinguishing % lines of a poem. See the 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 \Lenv{verse} environment. It sets the verse line counter, % then defines the particular list environment adjusting the margins % to center according to the length parameter. If the length parameter % is at least the \cs{linewidth} then the `centering' defaults to % the original \Lenv{verse} layout. % \changes{v1.1}{2001/08/03}{Initialise the line counter to 1, not 0, in % all cases} % \changes{v1.1}{2002/03/28}{Changes to verse environment for line numbering} % \changes{v1.3}{2002/11/14}{Changes to verse environment for hyperref} % \changes{v1.4}{2002/02/27}{Let verses wider than the \cs{linewidth} % take the full width (patch(1.1)} % \changes{v1.618}{2005/09/03}{Fix vertical spacing in the verse environment (mempatch v3.3)} % \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 \leftmargin \vleftmargin \parsep \stanzaskip \ifdim #1<\linewidth% %% short line \rightmargin \z@ \leftmargin \linewidth \advance\leftmargin -#1\relax \advance\leftmargin -0.5\leftmargin \advance\leftmargin \vindent \else \ifdim #1>\linewidth% %% long line \rightmargin \z@ \leftmargin \vindent \else% %% default \rightmargin \leftmargin \advance\leftmargin \vindent \fi \fi} \item[]}{\endlist} % \end{macrocode} % \end{environment} % % \begin{environment}{altverse} % This sets \cs{altindenttrue} (afterwards false) and initialises the line counter. % \changes{v1.1}{2002/03/28}{Added \cs{starpatternfalse} to altverse} % \begin{macrocode} \newenvironment{altverse}% {\starpatternfalse\patternfalse\altindenttrue \setcounter{vslineno}{1}}% {\altindentfalse} % \end{macrocode} % \end{environment} % % % \subsection{Patterns} % % 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}{\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} % \cs{newarray}\marg{arrayname}\marg{low}\marg{high} defines % an array called \meta{arrayname} (no backslash e.g. \verb?MyArray?), % with low and high limts \meta{low} and \meta{high}. % \begin{macrocode} \newcommand{\newarray}[3]{% \@nameedef{#1-low}{#2}% \@nameedef{#1-high}{#3}% \ifnum #3<#2 \@memerror{Limits for array #1 are in reverse order}{\@ehc}% \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\stringtoarray} % \cs{stringtoarray}\marg{arrayname}\marg{string} puts each character % from \meta{string} sequentially into the \meta{arrayname} array, starting % with \meta{low} = 1. It checks for an empty \meta{string} and handles that % specially. % \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 \cs{@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} % \cs{setarrayelement}\marg{arrayname}\marg{index}\marg{value} sets % the \meta{arrayname} array's element at \meta{index} to \meta{value}. % \begin{macrocode} \newcommand{\setarrayelement}[3]{% \checkarrayindex{#1}{#2}% \@nameedef{#1-#2}{#3}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\getarrayelement} % \cs{getarrayelement}\marg{arrayname}\marg{index}\marg{value} % defines the parameterless macro \meta{value} (e.g., \cs{result}) to be % the value at \meta{index} in the \meta{arrayname} array. % \begin{macrocode} \newcommand{\getarrayelement}[3]{% \checkarrayindex{#1}{#2}% \protected@edef#3{\@nameuse{#1-#2}}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\checkarrayindex} % \cs{checkarrayindex}\marg{arrayname}\marg{index} checks that % the \meta{index} of the \meta{arrayname} array is valid. \cs{ifbounderror} % is set FALSE if everything is OK, otherwise it is set TRUE. % \begin{macrocode} \newcommand{\checkarrayindex}[2]{% \bounderrorfalse \expandafter\ifx\csname #1-low\endcsname\relax% \ifpattern\else \@memerror{No array called #1}{\@ehc}% \fi \bounderrortrue \fi \ifnum #2<\@nameuse{#1-low}\relax% \ifpattern\else \@memerror{Index #2 outside limits for array #1}{\@ehc}% \fi \bounderrortrue \fi \ifnum #2>\@nameuse{#1-high}\relax% \ifpattern\else \@memerror{Index #2 outside limits for array #1}{\@ehc}% \fi \bounderrortrue \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\arraytostring} % \cs{arraytostring}\marg{arrayname}\marg{string} converts the % characters in the \meta{arrayname} array into the parameterless macro % \meta{string} (e.g., \cs{MyString}). % \begin{macrocode} \newcommand{\arraytostring}[2]{% \def#2{}% \c@chrsinstr = \@nameuse{#1-low}% \@vsarraytostring{#1}{#2}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@vsarraytostring} % \cs{@vsarraytostring}\marg{arrayname}\marg{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} % \cs{checkifinteger}\marg{num} checks if \meta{num} is an integer. % If it is, then \cs{ifinteger} is set TRUE, otherwise it is set FALSE. % (Code based on Donald Arseneau's \Lpack{cite} package). % \begin{macrocode} \newcommand{\checkifinteger}[1]{% \protected@edef\@vsa{#1}% \ifcat _\ifnum9<1\gobm{#1} _\else A\fi \integertrue% \else \integerfalse% \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\gobm} % \cs{gobm}\marg{num} is defined as \meta{num}. It could be defined as: \\ % \verb?\newcommand{\gobm}[1]{\ifx-#1\expandafter\gobm\else#1\fi}? \\ % which would remove a leading minus sign (hyphen) from its argument % (\verb?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} % \cs{indentpattern}\marg{digits} stores \meta{digits} for use as % a verse indentation pattern. % \begin{macrocode} \newcommand{\indentpattern}[1]{% \stringtoarray{Array@vs}{#1}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\get@vsindent} % \cs{get@vsindent} gets the indent pattern digit for the \cs{thevslineno}, % then uses this to specify the line indentation as \verb?digit*\vgap?. % \changes{v1.61}{2004/03/21}{Changed \cs{get@vsindent} to use counter % value number instead of \cs{thevslineno}} % \begin{macrocode} \newcommand{\get@vsindent}{% \getarrayelement{Array@vs}{\number\value{vslineno}}{\@vspat}% \ifbounderror \arraytostring{Array@vs}{\@vsp@t}% \@memwarn{% Index `\thevslineno' for pattern `\@vsp@t' is out of bounds}% \def\@vspat{0}% \else \checkifinteger{\@vspat}% \ifinteger\else \arraytostring{Array@vs}{\@vsp@t}% \@memwarn{% `\@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} % \cs{getstar@vsindent} gets the indent pattern digit for the \Lenv{patverse*} % environment, % then uses this to specify the line indentation as \verb?digit*\vgap?. % It lets the pattern repeat by resetting the \texttt{vslineno} counter. % \changes{v1.1}{2002/03/28}{Added \cs{getstar@vsindent}} % \begin{macrocode} \newcommand{\getstar@vsindent}{% \expandafter\ifx\csname Array@vs-high\endcsname\relax \@memerror{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 \cs{ifpattern} TRUE, any other flags to FALSE, % and initialises the line number. It ends by setting \cs{ifpattern} FALSE. % \changes{v1.1}{2002/03/28}{Added \cs{starpatternfalse} to patverse} % \begin{macrocode} \newenvironment{patverse}% {\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 \cs{ifstarpattern} TRUE, any other flags to FALSE, % and initialises the line number. It ends by setting \cs{ifstarpattern} FALSE. % \changes{v1.1}{2002/03/28}{Added patverse* environment} % \begin{macrocode} \newenvironment{patverse*}% {\starpatterntrue\patternfalse\altindentfalse \setcounter{vslineno}{1}}% {\starpatternfalse} % \end{macrocode} % \end{environment} % % % \subsection{Titles} % % \begin{macro}{\poemtitle} % Typeset a poem title (like \cs{section} or other). The actual work % is done by \cs{@vsptitle} (plain) or \cs{@vssptitle} (starred). % \begin{macrocode} \newcommand{\poemtitle}{\par% \secdef\@vsptitle\@vssptitle} % \end{macrocode} % \end{macro} % % \begin{macro}{\poemtoc} % The kind of entry \cs{poemtitle} is to make in the ToC. % \begin{macrocode} \newcommand{\poemtoc}{section} % \end{macrocode} % \end{macro} % % \begin{macro}{\mempoeminfo} % \begin{macro}{\mempoemstarinfo} % \verb?\mempoeminfo{title}? \\ % \verb?\mempoemstarinfo{title}? \\ % \changes{v1.61803}{2008/01/30}{Made \cs{mempoeminfo} and fiends \cs{long} % (mempatch v4.9)} % \begin{macrocode} \newcommand{\mempoeminfo}[1]{} \newcommand{\mempoemstarinfo}[1]{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@vsptitle} % Typeset a \cs{poemtitle}. % \changes{v1.3}{2002/11/14}{Added \cs{phantomsection} to \cs{@vsptitle}} % \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{@vsptitle}} % \begin{macrocode} \long\def\@vsptitle[#1]#2{% \phantomsection \addcontentsline{toc}{\poemtoc}{#1}% \M@gettitle{#1}% \mempoeminfo{#1}% \poemtitlemark{#1}% \@vstypeptitle{#2}% \@afterheading} % \end{macrocode} % \end{macro} % % \begin{macro}{\@vssptitle} % Typeset a \cs{poemtitle*}. % \changes{v1.4}{2003/11/16}{Added \cs{M@gettitle} to \cs{@vssptitle}} % \begin{macrocode} \long\def\@vssptitle#1{% \M@gettitle{#1}% \mempoemstarinfo{#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 approximately \cs{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} % % % \begin{macro}{\if@numptitle} % \begin{macro}{\@numptitletrue} % \begin{macro}{\@numptitlefalse} % \begin{macro}{\NumberPoemTitle} % \begin{macro}{\PlainPoemTitle} % Following the \cs{NumberPoemTitle} declaration \cs{PoemTitle}s are numbered. % The \cs{PlainPoemTitle} declaration produces unnumbered titles. % \begin{macrocode} \newif\if@numptitle \newcommand*{\NumberPoemTitle}{\@numptitletrue} \newcommand*{\PlainPoemTitle}{\@numptitlefalse} \NumberPoemTitle % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\c@poem} % \begin{macro}{\thepoem} % \begin{macro}{\theHpoem} % Counter for poem titles. % \begin{macrocode} \newcounter{poem}\setcounter{poem}{0} \renewcommand*{\thepoem}{\@arabic\c@poem} \newcommand*{\theHpoem}{\arabic{poem}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\poemtitlestarmark} % \begin{macro}{\poemtitlepstyle} % \begin{macro}{\poemtitlestarpstyle} % \cs{poemtitlemark}\marg{poemf@rhdr} is used for marks for a \cs{PoemTitle} and % \cs{poemtitlestarmark}\marg{poemf@hdr} is for marks for \cs{PoemTitle*}. % The \cs{poemtitlepstyle} and \cs{poemtitlestarpstyle} macros are provided % as hooks so that, for example, pagestyles can be set for the regular % and starred versions of \cs{PoemTitle}. By default these macros do nothing. % \begin{macrocode} \newcommand*{\poemtitlestarmark}[1]{} \newcommand*{\poemtitlepstyle}{} \newcommand*{\poemtitlestarpstyle}{} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\PoemTitle} % The command to produce a article style chapter-like (numbered) poem title. % \changes{v1.618}{2005/09/09}{Added \cs{PoemTitle}} % \begin{macrocode} \newcommand\PoemTitle{% \par \@afterindentfalse \@ifstar{\@m@msPoemTitle}{\@m@mPoemTitle}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@m@mPoemTitle} % \begin{macro}{\poemt@c} % Intermediate and support macros for the extra optional argument % to \cs{PoemTitle}. Have to do this long windedly otherwise dear old % \Lpack{hyperref} barfs. % \begin{macrocode} \newcommand{\@m@mPoemTitle}[1][]{% \def\poemt@c{#1}% capture first optional arg \@ifnextchar[{\@PoemTitle}{\@PoemTitle[]}% } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\memPoemTitleinfo} % \begin{macro}{\memPoemTitlestarinfo} % \verb?\memPoemTitleinfo{num}{toc}{head}{full}? \\ % \verb?\memPoemTitlestarinfo{short}{full}? % \begin{macrocode} \newcommand{\memPoemTitleinfo}[4]{} \newcommand{\memPoemTitlestarinfo}[2]{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@PoemTitle} % \begin{macro}{\poemf@rtoc} % \begin{macro}{\poemf@rhdr} % \cs{@PoemTitle}\oarg{tocmark}\marg{title} % typesets the title of a \cs{PoemTitle}. % There is a number for \cs{@numptitletrue} and \cs{@mainmattertrue}. % \begin{macrocode} \def\@PoemTitle[#1]#2{% \phantomsection \ifx\poemt@c\@empty % no optional args \def\poemf@rtoc{#2}% \def\poemf@rhdr{#2}% \else % at least one opt arg \let\poemf@rtoc\poemt@c \ifx\@empty#1\@empty \let\poemf@rhdr\poemt@c \else \def\poemf@rhdr{#1}% \fi \fi \m@m@Andfalse \if@numptitle \if@mainmatter \m@m@Andtrue \fi \fi \ifm@m@And \refstepcounter{poem}% \fi % \end{macrocode} % Store the (short) title via \cs{poemtitlemark} and call % \cs{\@makePoemTitlehead} to do the typesetting. % \begin{macrocode} \@makePoemTitlehead{#2}% \@afterheading \poemtitlemark{\poemf@rhdr}% \poemtitlepstyle % \end{macrocode} % Add the title to the ToC. % \begin{macrocode} \ifm@m@And \addcontentsline{toc}{\poemtoc}{% \protect\numberline{\thepoem}\poemf@rtoc}% \memPoemTitleinfo{\thepoem}{\poemf@rtoc}{\poemf@rhdr}{#2}% \else \addcontentsline{toc}{\poemtoc}{\poemf@rtoc}% \memPoemTitleinfo{}{\poemf@rtoc}{\poemf@rhdr}{#2}% \fi % \end{macrocode} % Add hook for title referencing. % \begin{macrocode} \ifheadnameref\M@gettitle{\poemf@rhdr}\else\M@gettitle{\poemf@rtoc}\fi} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\@makePoemTitlehead} % This \emph{really} typesets a \cs{PoemTitle}. Leave some whitespace. % \begin{macrocode} \def\@makePoemTitlehead#1{{% \PoemTitleheadstart \parindent \z@ \normalfont % \end{macrocode} % If there is a number, typeset it, otherwise call \cs{printPoemTitlenonum}. % \begin{macrocode} \ifm@m@And \printPoemTitlenum \afterPoemTitlenum \else \printPoemTitlenonum \fi % \end{macrocode} % Typeset the title. % \begin{macrocode} \interlinepenalty\@M \printPoemTitletitle{#1}% \afterPoemTitle}} % \end{macrocode} % \end{macro} % % % % \begin{macro}{\@PTchs@def@ult} % This sets up all the definitions used in \cs{@makePoemTitlehead} % and \cs{@makesPoemTitlehead}. % \begin{macro}{\PoemTitleheadstart} % \begin{macro}{\printPoemTitlenum} % \begin{macro}{\afterPoemTitlenum} % \begin{macro}{\printPoemTitlenonum} % \begin{macro}{\printPoemTitletitle} % \begin{macro}{\afterPoemTitle} % \begin{macrocode} \newcommand{\@PTchs@def@ult}{% \def\PoemTitleheadstart{\vspace{\beforePoemTitleskip}} \def\printPoemTitlenum{\PoemTitlenumfont \thepoem} \def\afterPoemTitlenum{\par\nobreak\vskip \midPoemTitleskip} \def\printPoemTitlenonum{} \def\printPoemTitletitle##1{\PoemTitlefont ##1} \def\afterPoemTitle{\par\nobreak\vskip \afterPoemTitleskip}} \@PTchs@def@ult % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\PoemTitlenumfont} % \begin{macro}{\PoemTitlefont} % Fonts for setting the Poem Title number and title. % \begin{macrocode} \newcommand*{\PoemTitlenumfont}{\normalfont\large\centering} \newcommand*{\PoemTitlefont}{\normalfont\large\centering} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\beforePoemTitleskip} % \begin{macro}{\midPoemTitleskip} % \begin{macro}{\afterPoemTitleskip} % Lengths separating the various parts of a Poem Title heading. % \begin{macrocode} \newlength{\beforePoemTitleskip} \setlength{\beforePoemTitleskip}{1\onelineskip} \newlength{\midPoemTitleskip} \setlength{\midPoemTitleskip}{0pt} \newlength{\afterPoemTitleskip} \setlength{\afterPoemTitleskip}{1\onelineskip} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\@m@msPoemTitle} % This deals with the optional argument for starred PoemTitles. % \begin{macrocode} \newcommand{\@m@msPoemTitle}[2][\@empty]{% \@sPoemTitle{#2}% \ifx \@empty#1 \def\poemf@rhdr{#2}% \else % opt arg \def\poemf@rhdr{#1}% \fi \poemtitlestarmark{\poemf@rhdr}% \poemtitlestarpstyle \memPoemTitlestarinfo{\poemf@rhdr}{#2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@sPoemTitle} % \cs{@sPoemTitle}\marg{long} typesets the title of a % \cs{PoemTitle*}. It is easier than the \cs{@PoemTitle} as there is no number % or ToC entry to worry about. % \begin{macrocode} \newcommand{\@sPoemTitle}[1]{% \@makesPoemTitlehead{#1}% \@afterheading \M@gettitle{#1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@makesPoemTitlehead} % This \emph{really} typesets a \cs{PoemTitle*}, and is similar to % \cs{@makePoemTitlehead}. % \begin{macrocode} \def\@makesPoemTitlehead#1{{% \PoemTitleheadstart \parindent \z@ \normalfont \printPoemTitlenonum \interlinepenalty\@M \printPoemTitletitle{#1} \afterPoemTitle}} % \end{macrocode} % \end{macro} % % % % % \section{Setting parameters for existing environments} % % \subsection{Array and tabular} % % \begin{macro}{\arraycolsep} % The columns in an array environment are separated by % 2\cs{arraycolsep}. % \begin{macrocode} \setlength\arraycolsep{5\p@} % \end{macrocode} % \end{macro} % % \begin{macro}{\tabcolsep} % The columns in an tabular environment are separated by % 2\cs{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\\ \cs{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 \cs{doublerulesep}. % \begin{macrocode} \setlength\doublerulesep{2\p@} % \end{macrocode} % \end{macro} % % \subsection{Tabbing} % % \begin{macro}{\tabbingsep} % This controls the space that the \verb?\'? command puts in. (See % \LaTeX{} manual for an explanation.) % \begin{macrocode} \setlength\tabbingsep{\labelsep} % \end{macrocode} % \end{macro} % % \subsection{Minipage} % % \begin{macro}{\@minipagerestore} % The macro \cs{@minipagerestore} is called upon entry to a minipage % environment to set up things that are to be handled differently % inside a minipage environment. In the standard styles it does % nothing, as was the case originally for memoir. % % Memoir extends it to support verbatim footnotes (see later) in minipages % and also for abnormal parskips (see later). % \changes{v1.61803}{2008/01/30}{Collected \cs{@minipagerestore} modifications together} % \begin{macrocode} \newcommand{\@minipagerestore}{% % \end{macrocode} % For \cs{verbfootnote} to work in a minipage we have to use % \cs{@verbmpfootnotetext} instead of \cs{@verbfootnotetext}. % \begin{macrocode} \let\@verbfootnotetext\@verbmpfootnotetext % \end{macrocode} % The next is for enabling the extended footnotes in a minipage. % \begin{macrocode} \m@mdoextrafeetmini % \end{macrocode} % And this is for abnormal parskips. % \begin{macrocode} \ifm@mnzpskip \parskip=\m@mabparskip\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@mpfootins} % Minipages have their own footnotes; \verb?\skip\@mpfootins? plays % the same r\^ole for footnotes in a minipage as \verb?\skip\footins? does % for ordinary footnotes. % % \begin{macrocode} \skip\@mpfootins = \skip\footins % \end{macrocode} % \end{macro} % % \subsection{Framed boxes} % % \begin{macro}{\fboxsep} % The space left by \cs{fbox} and \cs{framebox} between the box and the % text in it. % \begin{macro}{\fboxrule} % The width of the rules in the box made by \cs{fbox} and \cs{framebox}. % \begin{macrocode} \setlength\fboxsep{3\p@} \setlength\fboxrule{.4\p@} % \end{macrocode} % \end{macro} % \end{macro} % % \subsection{Equation and eqnarray} % % \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 \cs{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} % \cs{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 \cs{@eqnnum} defines how equation numbers are to appear in % equations. Again the default is used. % % \begin{macrocode} % \def\@eqnnum{(\theequation)} % \end{macrocode} % \end{macro} % % % \section{Array and tabular} % % \subsection{Array}% % % The description and code are essentially copied from the \Lpack{array} % package~\cite{ARRAY}. % % \begin{macrocode} %%%%%%%%%% Array package code %%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% With acknowledgements to %%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% Frank Mittelbach & David Carlisle %%%%%%%%%%%%%%%%%%%%% % \end{macrocode} % % % \subsubsection{The construction of the preamble} % % \begin{PW} % PW: The original \Lpack{array} package has redundant code (caused by a quick % mashing of an early \Lpack{array} and the \Lpack{newarray} packages). I % have tried to remove the redundancies and overlaps. % \end{PW} % % It is obvious that those environments will consist mainly of an % \cs{halign}, because \TeX\ typesets tables using this primitive. % That is why we will now take a look at the algorithm which determines % a preamble for a \cs{halign} starting with a given user preamble % using the options mentioned above. % % The most interesting macros of this implementation are without doubt % those which are responsible for the construction of the preamble for % the \cs{halign}. The underlying algorithm was developed by % \textsc{Lamport} (resp.\ \textsc{Knuth}, see texhax V87\#??), and it % has been extended and improved. % % The user preamble will be read \textsf{token} by \textsf{token}. A % \textsf{token} is a single character like \texttt{c} or a block % enclosed in \verb?{...}?. For example the preamble of % \verb?\begin{tabular}?\linebreak[0]\verb?{lc||c@{\hspace{1cm}}}? consists of % the \textsf{token} \texttt{l}, \texttt{c}, \verb?|?, \verb?|?, % \texttt{@} and \verb?\hspace{1cm}?. % % The currently used \textsf{token} and the one, used before, are needed % to decide on how the construction of the preamble has to be % continued. % In the example mentioned above the \texttt{l} causes the preamble % to begin with \verb?\hskip\tabcolsep?. Furthermore % \verb?# \hfil? would be appended to define a flush left column. % The next \textsf{token} is a \texttt{c}. Because it was preceded by an % \texttt{l} it generates a new column. This is done with % \verb?\hskip \tabcolsep & \hskip \tabcolsep?. The column which is to % be centered will be appended with \verb?\hfil # \hfil?. % The \textsf{token} \verb?|? would then add a space of % \verb?\hskip \tabcolsep? % and a vertical line because the last % \textsf{tokens} was a \texttt{c}. % The following \textsf{token} \verb?|? would only add a space % \verb?\hskip \doublerulesep? because it was preceded by the % \textsf{token} \verb?|?. We will not discuss our example further but % rather take a look at the general case of constructing preambles. % % The example shows that the desired preamble for the % \cs{halign} can be constructed as soon as the action of all % combinations % of the preamble \textsf{tokens} are specified. There are 18 such % \textsf{tokens} % so we have $19 \cdot 18 = 342$ combinations if we count the % beginning of % the preamble as a special \textsf{token}. Fortunately, there are many % combinations which generate the same spaces, so we can define % \textsf{token} classes. We will identify a % \textsf{token} within a class with a number, so we can insert the % formatting (for example of a column). % Table~\ref{tab:Klassen} lists all \textsf{token} classes and % their corresponding numbers. % \begin{table}[ht] % \begin{center} \ttfamily % ^^A \begin{tabular}[t]{>{\ttfamily}ccc} % \begin{tabular}[t]{ccc} % \textsf{token} & \cs{@chclass} & \cs{@chnum} \\[2mm] % c & 0 & 0 \\ % l & 0 & 1 \\ % r & 0 & 2 \\ % p-arg & 0 & 3 \\ % t-arg & 0 & 4 \\ % b-arg & 0 & 5 \\ % \verb?|? & 1 & 0 \\ % !-arg & 1 & 1 \\ % <-arg & 2 & --- \\ % >-arg & 3 & --- % \end{tabular} % \kern3mm \vrule \kern3mm% % ^^A \begin{tabular}[t]{>{\ttfamily}ccc} % \begin{tabular}[t]{ccc} % \textsf{token} & \cs{@chclass} & \cs{@chnum} \\[2mm] % Start & 4 & --- \\ % @-arg & 5 & --- \\ % ! & 6 & --- \\ % @ & 7 & --- \\ % < & 8 & --- \\ % > & 9 & --- \\ % p & 10 & 3 \\ % t & 10 & 4 \\ % b & 10 & 5 % \end{tabular} % \end{center} % \caption{Classes of preamble \textsf{tokens}} % \label{tab:Klassen} % \end{table} % % % \begin{macro}{\@chclass} % \begin{macro}{\@chnum} % \begin{macro}{\@lastchclass} % The class and the number of the current \textsf{token} are saved in % the % \textsf{count} registers \cs{@chclass} % and \cs{@chnum}, while the class of the previous % \textsf{token} is stored in the % \textsf{count} register \cs{lastchclass}. % All of the mentioned registers are already allocated in % \texttt{latex.tex}, % which is the reason why the following three lines of code are % commented out. % Later throughout the text I will not mention it again explicitely % whenever I use a \verb?%? sign. These parts are already defined in % \texttt{latex.tex}. % \begin{macrocode} % \newcount \@chclass % \newcount \@chnum % \newcount \@lastchclass % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % % \begin{macro}{\@addtopreamble} % We will save the already constructed preamble for % the \cs{halign} % in the global macro \cs{@preamble}. This will then be % enlarged with % the command \cs{@addtopreamble}. % \begin{macrocode} \def\@addtopreamble#1{\xdef\@preamble{\@preamble #1}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@testpach} % With the help of \cs{@lastchclass} we can now define a macro % which determines the class and the number of a given preamble % \textsf{token} % and assigns them to the registers % \cs{@chclass} and \cs{@chnum}. % \begin{macrocode} \def\@testpach{\@chclass % \end{macrocode} % First we deal with the cases in which the \textsf{token} % (\verb?#1?) is the argument of \texttt{!}, \texttt{@}, \texttt{<} or % \texttt{>}. We can see this from the value of \cs{@lastchclass}: % \begin{macrocode} \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else \ifnum \@lastchclass=7 5 \else \ifnum \@lastchclass=8 \tw@ \else \ifnum \@lastchclass=9 \thr@@ % \end{macrocode} % Otherwise we will assume that the \textsf{token} belongs to the % class 0 % and assign the corresponding number to \cs{@chnum} if our % assumption is correct. % \begin{macrocode} \else \z@ % \end{macrocode} % If the last \textsf{token} was a \texttt{p}, \texttt{m} or a % \texttt{b}, \cs{@chnum} already has the right value. This is the % reason for the somewhat curious choice of the \textsf{token} % numbers in class 10. % \begin{macrocode} \ifnum \@lastchclass = 10 \else % \end{macrocode} % Otherwise we will check if \cs{@nextchar} is either a \texttt{c}, % \texttt{l} or an \texttt{r}. Some applications change the % catcodes of certain characters like ``\texttt{@}'' in % \texttt{amstex.sty}. As a result the tests below would fail since % they assume non-active character tokens. Therefore we evaluate % \cs{@nextchar} once thereby turning the first token of its % replacement text into a char. At this point here this should have % been the only char present in \cs{@nextchar} which put into via a % \cs{def}. % \begin{macrocode} \edef\@nextchar{\expandafter\string\@nextchar}% \@chnum \if \@nextchar c\z@ \else \if \@nextchar l\@ne \else \if \@nextchar r\tw@ \else % \end{macrocode} % If it is a different \textsf{token}, we know that the class was % not 0. We assign the value 0 to \cs{@chnum} because this value % is needed for the \verb?|?--\textsf{token}. Now we must check % the remaining classes. Note that the value of \cs{@chnum} is % insignificant here for most classes. % \begin{macrocode} \z@ \@chclass \if\@nextchar |\@ne \else \if \@nextchar !6 \else \if \@nextchar @7 \else \if \@nextchar <8 \else \if \@nextchar >9 \else % \end{macrocode} % The remaining permitted \textsf{tokens} are \texttt{p}, % \texttt{m} and \texttt{b} (class 10). % \begin{macrocode} 10 \@chnum \if \@nextchar m\thr@@\else \if \@nextchar p4 \else \if \@nextchar b5 \else % \end{macrocode} % Now the only remaining possibility is a forbidden \textsf{token}, % so we choose class 0 and number 0 and give an error message. % Then we finish the macro by closing all \cs{if}'s. % \begin{macrocode} \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi} % \end{macrocode} % \end{macro} % % The preamble will be enlarged with the help of \cs{xdef}, but the % arguments of \texttt{>}, \texttt{<},~\texttt{!}\ and \texttt{@} are % not supposed to be expanded during the construction (we want an % implementation that doesn't need a \cs{protect}). So we have to find a % way to inhibit the expansion of those arguments. % % We will solve this problem with \textsf{token} registers. We need % one register for every \texttt{!}\ and \texttt{@}, while we need two % for every \texttt{c}, \texttt{l}, \texttt{r}, \texttt{m}, \texttt{p} % or \texttt{b}. This limits the number of columns of a table because % there are only 256 \textsf{token} registers. But then, who needs % tables with more than 100 columns? % % So how do we proceed? Let us assume that we had \verb?!{foo}? in the % user preamble and say we saved \texttt{foo} in % \textsf{token} register 5. Then we call % \verb?\@addtopreamble{\the@toks5}? where % \cs{the@toks} is defined in a way that it does not expand % (for example it could be equivalent to \cs{relax}). Every % following call % of \cs{@addtopreamble} leaves \cs{the@toks5} unchanged in % \cs{@preamble}. If the construction of the preamble is completed % we change the definition of \cs{the@toks} to % \verb?\the\toks? and expand \cs{@preamble} for the last time. % During this process all parts of the form % \cs{the@toks}\meta{Number} % will be substituted by the contents of the respective \textsf{token} % registers. % % As we can see from this informal discussion the construction of the % preamble has to take place within a group, so that the % \textsf{token} registers we use will be freed later on. For that % reason we keep all assignments to \cs{@preamble} global; therefore the % replacement text of this macro will remain the same after we leave % the group. % % \begin{macro}{\count@} % We further need a \textsf{count} register to remember which % \textsf{token} register is to be used next. This will be % initialized with -1 if we want to begin with the \textsf{token} % register 0. We use the \PlainTeX\ scratch register \cs{count@} % because everything takes place locally. All we have to do is % insert \cs{the@toks} \cs{the} \cs{count@} into the preamble. % \cs{the@toks} will remain unchanged and \verb?\the\count@? expands into % the saved number. % \end{macro} % % \begin{macro}{\prepnext@tok} % The macro \cs{prepnext@tok} is in charge of preparing the next % \textsf{token} register. For that purpose we increase % \cs{count@} by 1: % \begin{macrocode} \def\prepnext@tok{\advance \count@ \@ne % \end{macrocode} % Then we locally delete any contents the % \textsf{token} register might have. % \begin{macrocode} \toks\count@{}} % \end{macrocode} % \end{macro} % % \begin{macro}{\save@decl} % During the construction of the preamble the current % \textsf{token} is always saved in the macro \cs{@nextchar} (see the % definition of \cs{@mkpream}). The macro % \cs{save@decl} saves it into the next free \textsf{token} register, % i.e.\ in \verb?\toks\count@?. % We do not assume that the token register is free, we add the new % declarations to the front of the register. This is to allow user % preambles of the form, \verb?>{foo}>{bar}..?. Users are not encouraged to % enter such expressions directly, but they may result from the % rewriting of \cs{newcolumntype}'s. % \begin{macrocode} \def\save@decl{\toks \count@ = \expandafter\expandafter\expandafter {\expandafter\@nextchar\the\toks\count@}} % \end{macrocode} % \end{macro} % % How does the situation look like, if we want to add another column % to the preamble, i.e.\ if we have found a \texttt{c}, \texttt{l}, % \texttt{r}, \texttt{p}, \texttt{m} or \texttt{b} in the user % preamble? In this case we have the problem of the \textsf{token} % register from \verb?>{..}? and \verb?<{..}? having to be inserted at this % moment because formating instructions like \cs{hfil} have to be set % around them. On the other hand it is not known yet, if any \verb?<{..}? % instruction will appear in the user preamble at all. % % We solve this problem by adding two \textsf{token} registers at a % time. This explains, why we have freed the \textsf{token} registers % in \cs{prepnext@tok}. % % \begin{macro}{\insert@column} % \begin{macro}{\@sharp} % We now define the macro \cs{insert@column} which will do % this work for us. % \begin{macrocode} \def\insert@column{% % \end{macrocode} % Here, we assume that the \textsf{count} register % \cs{@tempcnta} has saved the value \verb?\count@?-1. % \begin{macrocode} \the@toks \the \@tempcnta % \end{macrocode} % Next follows the \verb?#? sign which specifies the place % where the text of the column shall be inserted. To avoid % errors during the expansions in % \cs{@addtopreamble} we hide this sign in the command % \cs{@sharp} which is temporarily occupied with % \cs{relax} during the build-up of the preamble. % To remove unwanted spaces before and after the column text, we set % an \cs{ignorespaces} in front and a \cs{unskip} afterwards. % \begin{macrocode} \ignorespaces \@sharp \unskip % \end{macrocode} % Then the second \textsf{token} register follows whose number should % be saved in \cs{count@}. % We make sure that there will be no further expansion after reading % the number, by finishing with \cs{relax}. The case above is not % critical since it is ended by \cs{ignorespaces}. % \begin{macrocode} \the@toks \the \count@ \relax} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\m@mold@addamp} % \begin{macro}{\m@m@addamp} % \begin{macro}{\@addamp} % % In the preamble a \verb?&? has to be inserted between any two columns; % before the first column there should not be a \verb?&?. As the user % preamble may start with a \verb?|? we have to remember somehow % if we have already inserted a \verb?#? (i.e.\ a column). This is done % with the boolean variable \cs{if@firstamp} that we test in % \cs{@addamp}, the macro that inserts the \verb?&?. % % \begin{PW} % PW: Later on, for horizontal lines in `continuous' tabulars, % I need to know how many columns there are in a tabular. I need a modified % kernel's \cs{@addamp} to do this and use the kernel's \cs{@curtab} % (a counter used in tabbing) to store the number of columns. % % \cs{m@mold@addamp} stores the kernel's definition of \cs{@addamp}, and % \cs{m@m@addamp} is the revised definition. % \end{PW} % % \begin{macrocode} % \newif \@iffirstamp \let\m@mold@addamp\@addamp \newcommand*{\m@m@addamp}{% \if@firstamp \@firstampfalse \global\@curtab\@ne \else \@addtopreamble{&} \global\advance\@curtab\@ne \fi} \let\@addamp\m@m@addamp % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@acol} % \begin{macro}{\@acolampacol} % \begin{macro}{\col@sep} % We will now define some abbreviations for the extensions, % appearing most often in the preamble build-up. % Here \cs{col@sep} is a \textsf{dimen} register which is set % equivalent to \cs{arraycolsep} in an \textsf{array}--environment, % otherwise it is set equivalent to \cs{tabcolsep}. % \begin{macrocode} \newdimen\col@sep \def\@acol{\@addtopreamble{\hskip\col@sep}} % \def\@acolampacol{\@acol\@addamp\@acol} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@mkpream} % \begin{macro}{\the@toks} % Now we can define the macro which builds up the preamble for the % \cs{halign}. % First we initialize \cs{@preamble}, \cs{@lastchclass} % and the boolean variable \cs{if@firstamp}. % \begin{macrocode} \def\@mkpream#1{\gdef\@preamble{}\@lastchclass 4 \@firstamptrue % \end{macrocode} % During the build-up of the preamble we cannot directly use the % \verb?#? sign; this would lead to an error message in the next % \cs{@addtopreamble} call. % Instead, we use the command \cs{@sharp} at places where later % a \verb?#? will be. % This command is at first given the meaning \cs{relax}; % therefore it will not be expanded when the preamble % is extended. % In the macro \cs{@array}, shortly before the \cs{halign} % is carried out, \cs{@sharp} is given its final meaning. % % In a similar way, % we deal with the commands \cs{@startpbox} and % \cs{@endpbox}, although the reason is different here: these % macros expand in many \textsf{tokens} which would delay the % build-up of the preamble. % \begin{macrocode} \let\@sharp\relax \let\@startpbox\relax \let\@endpbox\relax % \end{macrocode} % Now we remove possible \verb?*?-forms and user-defined column % specifiers in the user preamble by repeatedly executing the list % \cs{NC@list} until the re-writes have no more effect. The % expanded preamble will then be in the token register % \cs{@temptokena}. Actually we need to know at this point that % this is not \cs{toks0}. % \begin{macrocode} \@temptokena{#1}\@tempswatrue \@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}% % \end{macrocode} % Afterwards we initialize all registers and macros, that we need % for the build-up of the preamble. % Since we want to start with the \textsf{token} register 0, % \cs{count@} has to contain the value -1. % \begin{macrocode} \count@\m@ne \let\the@toks\relax % \end{macrocode} % Then we call up \cs{prepnext@tok} in order to prepare the % \textsf{token} register 0 for use. % \begin{macrocode} \prepnext@tok % \end{macrocode} % Having expanded all tokens defined using \cs{newcolumntype} (including % \verb?*?), we evaluate the remaining tokens, which are saved in % \cs{@temptokena}. We use the \LaTeX--macro \cs{@tfor} to inspect each % token in turn. % The strange appearing construction with \cs{expandafter} is % based on the fact that we have to put the replacement text of % \cs{@tempa} and not the macro \cs{@tempa} to this % \LaTeX--macro. % \begin{macrocode} \expandafter \@tfor \expandafter \@nextchar \expandafter :\expandafter =\the\@temptokena \do % \end{macrocode} % The body of this loop (the group after the \cs{do}) % is executed for one \textsf{token} at a time, whereas % the current \textsf{token} is saved in \cs{@nextchar}. % At first we evaluate the current \textsf{token} with the already % defined macro \cs{@testpach}, i.e.\ we assign to % \cs{@chclass} the character class and to \cs{@chnum} % the character number of this \textsf{token}. % \begin{macrocode} {\@testpach % \end{macrocode} % Then we branch out depending on the value of \cs{@chclass} into % different macros that extend the preamble respectively. % \begin{macrocode} \ifcase \@chclass \@classz \or \@classi \or \@classii \or \save@decl \or \or \@classv \or \@classvi \or \@classvii \or \@classviii % \end{macrocode} % Class 9 is equivalent to class 10. % \begin{macrocode} \or \@classx \or \@classx \fi % \end{macrocode} % Two cases deserve our special attention: Since the current % \textsf{token} cannot have the character class 4 (start) we % have skipped this possibility. If the character class is 3, % only the content of \cs{@nextchar} has to be saved into the current % \textsf{token} register; therefore we call up \cs{save@decl} % directly and save a macro name. After the preamble has been % extended we assign the value of \cs{@chclass} to the counter % \cs{@lastchclass} to assure that this information will be available % during the next run of the loop. % \begin{macrocode} \@lastchclass\@chclass}% % \end{macrocode} % After the loop has been finished space must still be added to % the created preamble, depending on the last \textsf{token}. % Depending on the value of \cs{@lastchclass} we perform % the necessary operations. % \begin{macrocode} \ifcase\@lastchclass % \end{macrocode} % If the last class equals 0 we add a % \verb?\hskip \col@sep?. % \begin{macrocode} \@acol \or % \end{macrocode} % If it equals 1 we do not add any additional space so that the % horizontal lines do not exceed the vertical ones. % \begin{macrocode} \or % \end{macrocode} % Class 2 is treated like class 0 because a \verb?<{...}? can % only directly follow after class 0. % \begin{macrocode} \@acol \or % \end{macrocode} % Most of the other possibilities can only appear if the user % preamble was defective. Class 3 is not allowed since after a % \verb?>{..}? there must always follow a \texttt{c}, \texttt{l}, % \texttt{r}, \texttt{p},\texttt{m} or \texttt{b}. We report an % error and ignore the declaration given by \verb?{..}?. % \begin{macrocode} \@preamerr \thr@@ \or % \end{macrocode} % If \cs{@lastchclass} is 4 the user preamble has been empty. % To continue, we insert a \verb?#? in the preamble. % \begin{macrocode} \@preamerr \tw@ \@addtopreamble\@sharp \or % \end{macrocode} % Class 5 is allowed again. In this case % (the user preamble ends with \verb?@{..}?) we need not % do anything. % \begin{macrocode} \or % \end{macrocode} % Any other case means that the arguments to \verb?@?, \texttt{!}, % \texttt{<}, \texttt{>}, \texttt{p}, \texttt{m} or \texttt{b} have % been forgotten. So we report an error and ignore the last % \textsf{token}. % \begin{macrocode} \else \@preamerr \@ne \fi % \end{macrocode} % Now that the build-up of the preamble is almost finished we can % insert the \textsf{token} registers and therefore redefine % \cs{the@toks}. The actual insertion, though, is performed % later. % \begin{macrocode} \def\the@toks{\the\toks}} % \end{macrocode} % \end{macro} % \end{macro} % % The preamble is extended by the macros \cs{@classz} to % \cs{@classx} which are called by \cs{@mkpream} % depending on \cs{@lastchclass} % (i.e. the character class of the last \textsf{token}). % \begin{macro}{\@classx} % First we define \cs{@classx} because of its important r\^ole. % When it is called we find that the current % \textsf{token} is \texttt{p}, \texttt{m} or \texttt{b}. % That means that a new column has to start. % \begin{macrocode} \def\@classx{% % \end{macrocode} % Depending on the value of \cs{@lastchclass} different actions % must take place: % \begin{macrocode} \ifcase \@lastchclass % \end{macrocode} % If the last character class was 0 we separate the columns by % \verb?\hskip\col@sep? followed by \verb?&? and another % \verb?\hskip\col@sep?. % \begin{macrocode} \@acolampacol \or % \end{macrocode} % If the last class was class 1 --- that means that a vertical % line was % drawn, --- before this line a \verb?\hskip\col@sep? was inserted. % Therefore there has to be only a \verb?&? followed by % \verb?\hskip\col@sep?. But this \verb?&? may be inserted only % if this is not the first column. This process is controlled % by \cs{if@firstamp} in the macro \cs{addamp}. % \begin{macrocode} \@addamp \@acol \or % \end{macrocode} % Class 2 is treated like class 0 because \verb?<{...}? can only % follow after class 0. % \begin{macrocode} \@acolampacol \or % \end{macrocode} % Class 3 requires no actions because all things necessary have % been done by the preamble \textsf{token} \texttt{>}. % \begin{macrocode} \or % \end{macrocode} % Class 4 means that we are at the beginning of the preamble. % Therefore we start the preamble with \verb?\hskip\col@sep? and % then call \cs{@firstampfalse}. This makes sure that a later % \cs{@addamp} inserts the character % \verb?&? into the preamble. % \begin{macrocode} \@acol \@firstampfalse \or % \end{macrocode} % For class 5 \textsf{tokens} only the character \verb?&? is inserted % as a column separator. Therefore we call \cs{@addamp}. % \begin{macrocode} \@addamp % \end{macrocode} % Other cases are impossible. For an example % \verb?\@lastchclass = 6? ---a s it might appear in a % preamble of the form \verb?...!p...? --- \texttt{p} would have % been taken as an argument of \texttt{!} by \cs{@testpach}. % \begin{macrocode} \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@classz} % If the character class of the last \textsf{token} is 0 we have % \texttt{c}, \texttt{l}, \texttt{r} or an argument of \texttt{m}, % \texttt{b} or\ \texttt{p}. In the first three cases the preamble % must be extended the same way as if we had class 10. The % remaining two cases do not require any action because the space % needed was generated by the last \textsf{token} (i.e.\ % \texttt{m}, \texttt{b} or \texttt{p}). Since \cs{@lastchclass} has % the value 10 at this point nothing happens when \cs{@classx} is % called. So the macro \cs{@chlassz} may start like this: % \begin{macrocode} \def\@classz{\@classx % \end{macrocode} % According to the definition of \cs{insert@column} we must store % the number of the \textsf{token} register in which a preceding % \verb?>{..}? might have stored its argument into % \cs{@tempcnta}. % \begin{macrocode} \@tempcnta \count@ % \end{macrocode} % To have \verb?\count@ = \@tmpcnta + 1? we prepare % the next \textsf{token} register. % \begin{macrocode} \prepnext@tok % \end{macrocode} % Now the preamble must be extended with the column whose format % can be determinated by \cs{@chnum}. % \begin{macrocode} \@addtopreamble{\ifcase \@chnum % \end{macrocode} % If \cs{@chnum} has the value 0 a centered column has to be % generated. % So we begin with stretchable space. % \begin{macrocode} \hfil % \end{macrocode} % The command \cs{d@llarbegin} follows expanding into \cs{begingroup} % (in the \textsf{tabular}--environment) or into \verb?$?. Doing this % (provided an appropriate setting of \cs{d@llarbegin}) we achieve % that the contents of the columns of an \textsf{array}--environment % are set in math mode while those of a \textsf{tabular}--environment % are set in LR mode. % \begin{macrocode} \d@llarbegin % \end{macrocode} % Now we insert the contents of the two \textsf{token} registers % and the symbol % for the column entry (i.e.\ \verb?#? or % more precise \cs{@sharp}) using \cs{insert@column}. % \begin{macrocode} \insert@column % \end{macrocode} % We end this case with \cs{d@llarend} and \cs{hfil} where \cs{d@llarend} % again is either \verb?$? or \cs{endgroup}. % \begin{macrocode} \d@llarend \hfil \or % \end{macrocode} % The templates for \texttt{l} and \texttt{r} (i.e.\ \cs{@chnum} 1 % or 2) are generated the same way. Since one \cs{hfil} is % missing the text is moved to the relevant side. % The \verb?\kern\z@? is needed in case of an empty column % entry. Otherwise % the \cs{unskip} in \cs{insert@column} removes the % \cs{hfil}. Changed to \verb?\hskip1sp? so that it interacts better with % \cs{@bsphack}. % \begin{macrocode} \hskip1sp\d@llarbegin \insert@column \d@llarend \hfil \or \hfil\hskip1sp\d@llarbegin \insert@column \d@llarend \or % \end{macrocode} % The templates for \texttt{p}, \texttt{m} and \texttt{b} mainly % consist of a \textsf{box}. In case of \texttt{m} it is generated % by \cs{vcenter}. This command is allowed only in math % mode. Therefore we start with a~\verb?$?. % \begin{macrocode} $\vcenter%$ % \end{macrocode} % The part of the templates which is the same in all three cases % (\texttt{p}, \texttt{m} and \texttt{b}) % is built by the macros \cs{@startpbox} and % \cs{@endpbox}. \cs{@startpbox} has an argument: % the width of the column which is stored in the current % \textsf{token} (i.e.\ \cs{@nextchar}). % Between these two macros we find the well known % \cs{insert@column}. % \begin{macrocode} \@startpbox{\@nextchar}\insert@column \@endpbox $\or%$ % \end{macrocode} % The templates for \texttt{p} and \texttt{b} are generated in the % same way though we do not need the \verb?$? characters because we use % \cs{vtop} or \cs{vbox}. % \begin{macrocode} \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or \vbox \@startpbox{\@nextchar}\insert@column \@endpbox % \end{macrocode} % Other values for \cs{@chnum} are impossible. Therefore we % end the arguments to \cs{@addtopreamble} and \cs{ifcase}. % Before we come to the end of \cs{@classz} we have to % prepare the next \textsf{token} register. % \begin{macrocode} \fi}\prepnext@tok} % \end{macrocode} % \end{macro} % % \begin{macro}{\@classix} % Class 9 (\texttt{>}--\textsf{token}) prevented repeated % \verb?>? declarations for the same column. This restriction has been eased, % making class 9 equivalent to class 10. % \changes{v1.618}{2005/09/03}{Let \cs{@classix} to \cs{relax} (mempatch v3.10)} % \begin{macrocode} \let\@classix\relax % \end{macrocode} % \end{macro} % % \begin{macro}{\@classviii} % If the current \textsf{token} is a \texttt{<} the last character % class must be 0, or 2 (as repeated \verb?<? expressions are allowed). % In this case it is not necessary to extend the % preamble. Otherwise we output an error message, set \cs{@chclass} % to 6 and call \cs{@classvi}. By doing this we achieve that % \texttt{<} is treated like \texttt{!}. % \begin{macrocode} \def\@classviii{\ifnum \@lastchclass >\z@\ifnum\@lastchclass=\tw@\else \@preamerr 4\@chclass 6 \@classvi \fi\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@arrayrule} % There is only one incompatibility with the original definition: % the definition of \cs{@arrayrule}. In the original a line without % width (e.g., the space between \verb?cc? and \verb?c|c? % is equal) is created by multiple insertions of % \verb?\hskip .5\arrayrulewidth?. % We only insert a vertical line into the % preamble. This is done to prevent problems with \TeX's main % memory when generating tables with many vertical lines in them % (especially in the case of \textsf{floats}). % \begin{macrocode} \def\@arrayrule{\@addtopreamble \vline} % \end{macrocode} % \end{macro} % % \begin{macro}{\@classvii} % As a consequence it follows that in case of class 7 % (\verb?@? \textsf{token}) the preamble need not to be extended. % In the original definition \verb?\@lastchclass = 1? % is treated by inserting \verb?\hskip .5\arrayrulewidth?. % We only check if the last \textsf{token} was of class 3 which is % forbidden. % \begin{macrocode} \def\@classvii{\ifnum \@lastchclass = \thr@@ % \end{macrocode} % If this is true we output an error message and % ignore the declarations stored % by the last \verb?>{...}?, because these are overwritten % by the argument of \texttt{@}. % \begin{macrocode} \@preamerr \thr@@ \fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@classvi} % If the current \textsf{token} is a regular \texttt{!}\ and the % last class was 0 or 2 we extend the preamble with % \verb?\hskip\col@sep?. If the last \textsf{token} was of class 1 % (for instance \verb?|?) we extend with \verb?\hskip \doublerulesep? % because the construction \verb?!{...}? has to be treated like % \verb?|?. % \begin{macrocode} \def\@classvi{\ifcase \@lastchclass \@acol \or \@addtopreamble{\hskip \doublerulesep}\or \@acol \or % \end{macrocode} % Now \verb?\@preamerr...? should follow because a % user preamble of the form \verb?..>{..}!.? is not allowed. % To save memory we call \cs{@classvii} instead which also % does what we want. % \begin{macrocode} \@classvii % \end{macrocode} % If \cs{@lastchclass} is 4 or 5 nothing has to be done. % Class 6 to 10 are not possible. % So we finish the macro. % \begin{macrocode} \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@classii} % \begin{macro}{\@classiii} % In the case of character classes 2 and 3 (i.e.\ the argument % of \texttt{<} or \texttt{>}) we only have to store the current % \textsf{token} (\cs{@nextchar}) into the corresponding % \textsf{token} register since the preparation and % insertion of these registers % are done by the macro \cs{@classz}. % This is equivalent to calling \cs{save@decl} in the case of % class 3. To save command identifiers we do this call up % in the macro \cs{@mkpream}. % % Class 2 exhibits a more complicated situation: the % \textsf{token} registers have already been inserted by % \cs{@classz}. So the value of \cs{count@} is too high % by one. Therefore we decrease \cs{count@} by 1. % \begin{macrocode} \def\@classii{\advance \count@ \m@ne % \end{macrocode} % Next we store the current \textsf{token} into the correct % \textsf{token} register by calling \cs{save@decl} and then % increase the value of \cs{count@} again. At this point we % can save memory once more (at the cost of time) if we use the % macro \cs{prepnext@tok}. % \begin{macrocode} \save@decl\prepnext@tok} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@classv} % Class 5 is \texttt{@}-expressions (and is also called by class 1) % We do not expand the % \verb?@?-expression, but instead explicitly replace an % \cs{extracolsep} command by an assignment to \cs{tabskip} by a % method similar to the \cs{newcolumntype} system described later. % \begin{macrocode} \def\@classv{\save@decl \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@ \@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}% \prepnext@tok} % \end{macrocode} % \end{macro} % % \begin{macro}{\NC@ecs} % Rewrite the first occurrence of \verb?\extracolsep{1in}? to % \verb?\tabskip1in\relax?. As a side effect discard any tokens after a % second \cs{extracolsep}, there is no point in the user entering two of % these commands anyway, so this is not really a restriction. % \begin{macrocode} \def\NC@ecs#1\extracolsep#2#3\extracolsep#4\@@@{\def\@tempa{#2}% \ifx\@tempa\@empty\else\toks\count@={#1\tabskip#2\relax#3}\fi} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@classi} % In the case of class 0 we were able to generate the necessary % space between columns by using the macro \cs{@classx}. % Analogously the macro \cs{@classvi} can be used for class 1. % \begin{macrocode} \def\@classi{\@classvi % \end{macrocode} % Depending on \cs{@chnum} a vertical line % \begin{macrocode} \ifcase \@chnum \@arrayrule \or % \end{macrocode} % or (in case of \verb?!{...}?) the current \textsf{token} --- stored % in \cs{@nextchar} --- has to be inserted into the preamble. % This corresponds to calling \cs{@classv}. % \begin{macrocode} \@classv \fi} % \end{macrocode} % \end{macro} % % % % \begin{macro}{\@startpbox} % In \cs{@classz} the macro \cs{@startpbox} is used. % The width of the \textsf{parbox} is passed as an argument. % \cs{vcenter}, \cs{vtop} or \cs{vbox} are already in the % preamble. So we start with the braces for the wanted box. % \begin{macrocode} \def\@startpbox#1{\bgroup % \end{macrocode} % The argument is the width of the box. This information has to be % assigned to \cs{hsize}. % Then we assain default values to several parameters used in a % \textsf{parbox}. % \begin{macrocode} \setlength\hsize{#1}\@arrayparboxrestore % \end{macrocode} % Our main problem is to obtain the same distance between succeeding % lines of the \textsf{parbox}. % We have to remember that the distance between two \textsf{parboxes} % should be defined by \cs{@arstrut}. That means that it can be % greater than the distance in a \textsf{parbox}. % Therefore it is not enough to set a \cs{@arstrut} at the % beginning and at the end of the \textsf{parbox}. This would % dimension the distance % between first and second line and the distance between the two % last lines of the \textsf{parbox} wrongly. % To prevent this we set an invisible rule of height % \cs{@arstrutbox} % at the beginning of the \textsf{parbox}. This has no effect on the % depth of the first line. At the end of the \textsf{parbox} we set % analogously another invisible rule which only affects the depth % of the last line. It is necessary to wait inserting this strut % until the paragraph actually starts to allow for things like % \cs{parindent} changes via \verb?>{...}?. % \begin{macrocode} \everypar{% \vrule \@height \ht\@arstrutbox \@width \z@ \everypar{}}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\@endpbox} % If there are any declarations defined by \verb?>{...}? % and \verb?<{...}? % they now follow in the macro \cs{@classz} --- the contents % of the column in between. % So the macro \cs{@endpbox} must insert the \textsf{specialstrut} % mentioned earlier and then close the group opened by % \cs{@startpbox}. % \begin{macrocode} \def\@endpbox{\@finalstrut\@arstrutbox \egroup\hfil} % \end{macrocode} % \end{macro} % % % \subsubsection{Building and calling \texttt{\textbackslash halign}} % % \begin{macro}{\@array} % After we have discussed the macros needed for the evaluation % of the user preamble we can define the macro \cs{@array} % which uses these macros to create a \cs{halign}. % It has two arguments. The first one is a position argument % which can be \texttt{t}, \texttt{b} or \texttt{c}; the % second one describes the wanted preamble, % e.g.\ it has the form \verb?|c|c|c|?. % \begin{macrocode} \def\@array[#1]#2{% % \end{macrocode} % First we define a \textsf{strut} whose size basically corresponds % to a normal \textsf{strut} multiplied by the factor % \cs{arraystretch}. % This \textsf{strut} is then inserted into every row and enforces % a minimal distance between two rows. % Nevertheless, when using horizontal lines, large letters % (like accented capital letters) still collide with such lines. % Therefore at first we add to the height of a normal \textsf{strut} % the value of the parameter \cs{extrarowheight}. % \begin{macrocode} \@tempdima \ht \strutbox \advance \@tempdima by\extrarowheight \setbox \@arstrutbox \hbox{\vrule \@height \arraystretch \@tempdima \@depth \arraystretch \dp \strutbox \@width \z@}% % \end{macrocode} % Then we open a group, in which the user preamble is evaluated by % the macro \cs{@mkpream}. As we know this must happen locally. % This macro creates a preamble for a \cs{halign} and saves % its result globally in the control sequence \cs{@preamble}. % \begin{macrocode} \begingroup \@mkpream{#2}% % \end{macrocode} % We again redefine \cs{@preamble} so that a call up of \cs{@preamble} % now starts the \cs{halign}. Thus also the arguments of \texttt{>}, % \texttt{<}, \texttt{@} and \texttt{!}, saved in the % \textsf{token} registers are inserted into the preamble. The % \cs{tabskip} at the beginning and end of the preamble is set to % \textsf{0pt} (in the beginning by the use of \cs{ialign}). Also the % command \cs{@arstrut} is build in, which inserts the % \cs{@arstrutbox}, defined above. Of course, the opening brace after % \cs{ialign} has to be implicit as it will be closed in \cs{endarray} % or another macro. % % The \cs{noexpand} in front of \