diff options
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/memoir/README | 42 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/memoir/memmanadd.pdf | bin | 325355 -> 527346 bytes | |||
-rwxr-xr-x | Master/texmf-dist/source/latex/memoir/mempatch.dtx | 3803 | ||||
-rwxr-xr-x | Master/texmf-dist/source/latex/memoir/mempatch.ins | 79 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/memoir/memhfixc.sty | 85 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/memoir/mempatch.sty | 1364 | ||||
-rw-r--r-- | Master/texmf-dist/tpm/memoir.tpm | 10 |
7 files changed, 5353 insertions, 30 deletions
diff --git a/Master/texmf-dist/doc/latex/memoir/README b/Master/texmf-dist/doc/latex/memoir/README index 068aa9f901d..557d07b96b7 100644 --- a/Master/texmf-dist/doc/latex/memoir/README +++ b/Master/texmf-dist/doc/latex/memoir/README @@ -1,16 +1,19 @@ - Memoir is a flexible class for typesetting general fiction, + Memoir is a flexible class for typesetting poetry, fiction, non-fiction and mathematical works as books, reports, articles or manuscripts. Documents can use 9pt, 10pt, 11pt, 12pt, 14pt or 17pt as the normal font size. Many methods are provided to let you create -your particular design. +your particular design. The class incorporates over 30 of the more +popular packages. NOTE: In order to provide fixes for any problems that may arise between major releases, you may find a file called mempatch.sty which contains any current fixes for the memoir class. The class will automatically include this so DO NOT \usepackage{mempatch}. +The Change lists below do not neccessarily note each release of +the patch or addendum files. NOTE: Similarly, there may be a file called memmanadd.* which provides -amemdments to the current version of the User Manual. +amendments to the current version of the User Manual. NOTE: If you are using the hyperref package, use the memhfixc package after the hyperref package, e.g., @@ -19,6 +22,10 @@ after the hyperref package, e.g., \usepackage{memhfixc} ... +Changes (2006/08/09) +o New version 4.5 of mempatch.sty +o New version memmanadd.pdf + Changes (2005/09/25) o New version of memoir.dtx which will generate the new version v1.618 of memoir.cls, the *.clo files (which are unchanged), @@ -219,8 +226,8 @@ o First public experimental alpha release README (this file) memoir.dtx memoir.ins -mempatch.sty -memhfixc.sty +mempatch.dtx +mempatch.ins and the derived files memoir.cls mem9.clo @@ -229,22 +236,25 @@ mem11.clo mem12.clo mem14.clo mem17.clo +mempatch.sty +memhfixc.sty basic.gst. ------------------------------------------------------------------- The distribution consists of the following files: README (this file) -memoir.(dtx|ins) Class source and installation files -mempatch.sty Patch file for memoir class -memhfixc.sty Patch file for hyperref package -memman.tex LaTeX source for the user manual - (requires the memoir class and the alltt, - fixltx2e, layouts, and url packages for - processing) -memman.pdf User manual in PDF -memmanadd.pdf Addendum (in PDF) to the User Manual (if required) -memman.ist MakeIndex style file for memman.tex +memoir.(dtx|ins) Class source and installation files +mempatch.(dtx|ins) Source and installation for patch files +mempatch.sty Patch file for memoir class +memhfixc.sty Patch file for hyperref package +memman.tex LaTeX source for the user manual + (requires the memoir class and the alltt, + fixltx2e, layouts, and url packages for + processing) +memman.pdf User manual in PDF +memmanadd.pdf Addendum (in PDF) to the User Manual (if required) +memman.ist MakeIndex style file for memman.tex To install the package: @@ -270,6 +280,6 @@ o Run (pdf)latex twice more on memman.tex o Print the manual -2005/09/25 +2006/08/09 Peter Wilson herries dot press at earthlink dot net diff --git a/Master/texmf-dist/doc/latex/memoir/memmanadd.pdf b/Master/texmf-dist/doc/latex/memoir/memmanadd.pdf Binary files differindex 4b306f836c7..d9025d6526c 100644 --- a/Master/texmf-dist/doc/latex/memoir/memmanadd.pdf +++ b/Master/texmf-dist/doc/latex/memoir/memmanadd.pdf diff --git a/Master/texmf-dist/source/latex/memoir/mempatch.dtx b/Master/texmf-dist/source/latex/memoir/mempatch.dtx new file mode 100755 index 00000000000..89458384cc0 --- /dev/null +++ b/Master/texmf-dist/source/latex/memoir/mempatch.dtx @@ -0,0 +1,3803 @@ +% \iffalse meta-comment +% +% mempatch.dtx +% Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net +% Copyright 2001 --- 2006 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 "author-maintained". +% +% This work consists of the files listed in the README file. +% +% +% \fi +% \CheckSum{3392} +% +% \def\dtxfile{\texttt{mempatch.dtx}} +% \def\fileversion{v1.0} \def\filedate{2003/10/04} +% \def\fileversion{v1.1} \def\filedate{2003/10/07} +% \def\fileversion{v1.2} \def\filedate{2003/11/16} +% \def\fileversion{v2.0a} \def\filedate{2004/02/19} +% \def\fileversion{v2.1} \def\filedate{2004/03/01} +% \def\fileversion{v2.3} \def\filedate{2004/03/28} +% \def\fileversion{v2.4} \def\filedate{2004/04/26} +% \def\fileversion{v2.5} \def\filedate{2004/04/27} +% \def\fileversion{v2.6} \def\filedate{2004/04/30} +% \def\fileversion{v2.7} \def\filedate{2004/05/10} +% \def\fileversion{v2.8} \def\filedate{2004/05/13} +% \def\fileversion{v3.0} \def\filedate{2004/12/14} +% \def\fileversion{v3.1} \def\filedate{2004/12/19} +% \def\fileversion{v3.2} \def\filedate{2005/01/01} +% \def\fileversion{v3.3} \def\filedate{2005/01/17} +% \def\fileversion{v3.4} \def\filedate{2005/01/18} +% \def\fileversion{v3.5} \def\filedate{2005/02/01} +% \def\fileversion{v3.6} \def\filedate{2005/02/07} +% \def\fileversion{v3.7} \def\filedate{2005/02/26} +% \def\fileversion{v3.8} \def\filedate{2005/03/06} +% \def\fileversion{v3.9} \def\filedate{2005/03/23} +% \def\fileversion{v3.10} \def\filedate{2005/05/16} +% \def\fileversion{v3.11} \def\filedate{2005/05/23} +% \def\fileversion{v3.12} \def\filedate{2005/06/06} +% \def\fileversion{v4.1} \def\filedate{2005/10/06} +% \def\fileversion{v4.1h} \def\filedate{2005/11/15} +% \def\fileversion{v4.2} \def\filedate{2005/11/21} +% \def\fileversion{v4.3} \def\filedate{2005/12/13} +% \def\fileversion{v4.4} \def\filedate{2006/01/21} +% \def\fileversion{v4.4a} \def\filedate{2006/01/23} +% \def\fileversion{v4.5} \def\filedate{2006/08/08} +% +% \title{The LaTeX \Lpack{memoir} class for configurable book +% typesetting: Code patches\thanks{This +% file (\dtxfile) has version number \fileversion, last revised +% \filedate.}} +% +% \author{% +% Peter Wilson\thanks{\texttt{herries dot press at earthlink dot net}}\\ +% The Herries Press +% } +% \date{\filedate} +% \maketitle +% +% ^^A \MakeShortVerb{\=} +% +% \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. +% +% Because of its newness not all packages work well with \Lpack{memoir}. +% Also, as more users beat on it, subtle flaws are discovered in \Lpack{memoir} +% itself. Patching code is supplied to resolve known problems. +% +% Code is also provided for new functionality that will later be +% folded into the class code. +% \end{abstract} +% +% \tableofcontents +% \listoftables +% +% \StopEventually{} +% +% +% +% \section{Introduction} +% +% This document provides the commented source for packages that patch +% the LaTeX \Lpack{memoir} class~\cite{MEMOIR}. +% This class 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. +% +% +% Section~\ref{sec:docstrip} describes some +% administrative elements and code for general use later in the +% specification. +% The macros forming the package files are defined in section~\ref{sec:hyper} +% and in section~\ref{sec:class} onwards. +% +% 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{url} +% \end{macrocode} +% +% We do want an index, using linenumbers, but not update information. +% \begin{macrocode} +\makeatletter + \@mparswitchfalse +\makeatother +\EnableCrossrefs +\CodelineIndex +%% \RecordChanges +% \end{macrocode} +% Don't use the default Short Verb. +% \begin{macrocode} +\AtBeginDocument{\DeleteShortVerb{\|}} +% \end{macrocode} +% We had better have page headings to aid navigation, but I don't +% like Uppercased titles. +% \begin{macrocode} +\renewcommand{\MakeUppercase}[1]{#1} +\pagestyle{headings} +% \end{macrocode} +% We may use many \file{docstrip} modules so 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}} +\newcommand{\Lclass}[1]{\textsf{#1}} +\newcommand{\ledmac}{ledmac} +\newcommand{\Ledmac}{\Lpack{\ledmac}} +\newcommand{\edmac}{\texttt{EDMAC}} +\newcommand{\tabmac}{\texttt{TABMAC}} +\newcommand{\PWcomment}[1]{} +\newenvironment{PW}{\itshape}{} +\renewenvironment{PW}{\sffamily}{} +\newcommand{\texbook}{\textit{TeXbook}} +\newcommand{\thetexbook}{\textit{The TeXbook}} +\newcommand{\egstart}{} +\newcommand{\egmid}{} +\newcommand{\egend}{} +\renewcommand{\egstart}{% + \par + \begingroup + \centering + \begin{minipage}{0.45\textwidth}} +\renewcommand{\egmid}{% + \end{minipage}\hfill\begin{minipage}{0.45\textwidth}} +\renewcommand{\egend}{% + \end{minipage}\par\endgroup} +% \end{macrocode} +% We want the full details printed. +% \begin{macrocode} +\begin{document} +\DocInput{mempatch.dtx} +\PrintIndex +%% \PrintChanges +\end{document} +%</driver> +% \end{macrocode} +% +% +% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath} +% \DoNotIndex{\@centercr,\@cite}\ +% \DoNotIndex{\@dotsep,\@empty,\@gobble,\@gobbletwo,\@ignoretrue} +% \DoNotIndex{\@input,\@ixpt,\@m} +% \DoNotIndex{\@minus,\@ne,\@nil,\@nomath,\@plus,\@set@topoint} +% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb} +% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt} +% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt} +% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace} +% \DoNotIndex{\advance,\Alph,\alph} +% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box} +% \DoNotIndex{\bullet} +% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption} +% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass} +% \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist} +% \DoNotIndex{\EnableCrossrefs,\end,\endgroup} +% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter} +% \DoNotIndex{\fbox} +% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef} +% \DoNotIndex{\global,\halign,\hbox,\hfil,\hfill,\hrule} +% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi} +% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi} +% \DoNotIndex{\input} +% \DoNotIndex{\jobname,\kern,\leavevmode,\let} +% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th} +% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment} +% \DoNotIndex{\NeedsTeXFormat,\newdimen} +% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number} +% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@} +% \DoNotIndex{\par,\paragraph,\paragraphmark,\parfillskip} +% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions} +% \DoNotIndex{\protect,\ProvidesClass} +% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font} +% \DoNotIndex{\rightskip,\rlap,\rmfamily,\roman} +% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength} +% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space} +% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase} +% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt} +% \DoNotIndex{\viipt,\vipt,\vskip,\vspace} +% \DoNotIndex{\wd,\xiipt,\year,\z@} +% \DoNotIndex{\@namedef,\@nameuse,\csname,\endcsname} +% +% +% +% \section{Patches for hyperref and friends} \label{sec:hyper} +% +% The \Lpack{hyperref} package~\cite{HYPERREF} is a marvel of macro coding but it does +% seem to have a habit of not working too well with classes or packages +% that contain anything out of the +% ordinary. +% +% \begin{macrocode} +%<*hyper> +% \end{macrocode} +% +% +% The \Lpack{memhfixc} package provides \Lpack{hyperref} related temporary +% fixes and extensions for version v1.618 of the \Lpack{memoir} class. +% \begin{itemize} +% \item hyperref fix for part and chapter entries in the ToC (v1.0) +% \item Other fixes as and when +% \end{itemize} +% Only use this package in conjunction with the hyperref package. +% Call the package without options after the hyperref package as: +% \begin{verbatim} +% \documentclass[...]{memoir} +% ... +% \usepackage[...]{hyperref} +% \usepackage{memhfixc} +% \end{verbatim} +% +% \begin{macrocode} +%% +%% The memhfixc package provides hyperref related temporary +%% fixes and extensions for version v1.3a of the memoir class. +%% o hyperref fix for part and chapter entries in the ToC (v1.0) +%% o Other fixes as and when +%% +%% Only use this package in conjunction with the hyperref package. +%% Call the package without options after the hyperref package as: +%% \documentclass[...]{memoir} +%% ... +%% \usepackage[...]{hyperref} +%% \usepackage{memhfixc} +%% +%% Version 1.8 2006/01/21 +%% Version 1.7 2005/11/15 +%% Version 1.6 2004/05/13 +%% Version 1.5 2003/10/14 +%% Version 1.4 2003/09/26 +%% Version 1.3 2003/02/20 +%% Version 1.2 2003/02/02 +%% Version 1.1 2003/01/22 +%% Version 1.0 2002/10/22 +%% +% \end{macrocode} +% +% +% \begin{macrocode} +\ProvidesPackage{memhfixc}[2006/01/21 v1.8 nameref/hyperref package fixes for memoir class] +% \end{macrocode} +% +% \begin{macro}{\M@hfixcfinish} +% The \Lpack{memhfixc} package is only useful with the memoir class +% \begin{macrocode} +\let\M@hfixcfinish\relax +\@ifclassloaded{memoir}{}% + {\let\M@hfixcfinish\endinput + \typeout{No memoir class: memhfixc does nothing}} +\M@hfixcfinish + +% \end{macrocode} +% \end{macro} +% +% \subsection{Patches for nameref} +% +% \begin{macro}{\M@sect} +% \begin{macro}{\NR@sectm@m} +% The \Lpack{nameref} package~\cite{NAMEREF} fiddles with \cs{@sect} (which memoir replaces +% by \cs{M@sect}). Note that the \Lpack{hyperref} package may call +% \Lpack{nameref} via: +% \verb?\AtBeginDocument{\usepackage{nameref}}? +% \begin{macrocode} +\AtBeginDocument{% + \@ifpackageloaded{nameref}{% nameref loaded + \@ifundefined{NR@sectm@m}{% haven't fiddled with \M@sect + \typeout{Redoing nameref's sectioning} + \let\NR@sectm@m\M@sect + \def\M@sect#1#2#3#4#5#6[#7][#8]#9{% + \setcounter{section@level}{#2}% + \def\@currentlabelname{#7}% + \NR@sectm@m{#1}{#2}{#3}{#4}{#5}{#6}[{#7}][{#8}]{\Sectionformat{#9}{#2}}}% + }% + {% \NR@sectm@m has already been defined + } + }% + {% no nameref + } +} % end of \AtBeginDocument + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\label} +% \begin{macro}{\MNR@label} +% The \Lpack{nameref} package replaces \cs{label}, which (which memoir has added to). +% Make the memoir addition again. +% +% \begin{macrocode} +\AtBeginDocument{% + \@ifpackageloaded{nameref}{% nameref loaded + \@ifundefined{MNR@label}{% haven't fiddled with \label + \typeout{Redoing nameref's label} + \let\MNR@label\label + \def\label#1{\@bsphack\begingroup + \protected@edef\@currentlabel{\protect\M@TitleReference + {\@currentlabel}{\M@currentTitle}}% + \MNR@label{#1}% + \endgroup \@esphack}% + \let\MNR@old@caption\@caption + \long\def\@caption#1[#2]#3{% + \MNR@old@caption{#1}[{#2}]{#3}% + \def\@currentlabelname{#2}% + \M@gettitle{#2}% + }% + }% + {% \MNR@label has already been defined + } + }% + {% no nameref + } +} % end of \AtBeginDocument + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% We are done unless the \Lpack{hyperref} package has been loaded +% \begin{macrocode} +%% We are done unless the hyperref package has been loaded +\@ifpackageloaded{hyperref}{}{\let\M@hfixcfinish\endinput} +\M@hfixcfinish + +% \end{macrocode} +% +% \subsection{Patches for hyperref} +% +% \begin{macro}{\H@old@sbook} +% \begin{macro}{\@sbook} +% Possibly this will provide some hyperref bookmarks support for +% the \cs{book*} document division (see page +% 206 in the \textit{Hypertext marks in LaTeX} manual that I processed +% on 2002/10/23 (cunningly it was internally dateless). It is based on +% hyperref's code for \cs{@spart}, which uses \cs{H@old@spart} to hold +% its original definition. +% \begin{macrocode} +\let\H@old@sbook\@sbook +\def\@sbook#1{% + \H@old@sbook{#1}% + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{book*.\the\Hy@linkcounter}% + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% +} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Hy@captionsenglish} +% \begin{macro}{\HyLang@english} +% Not sure what these do. I do know I have one version of \Lpack{hyperref} +% that defines \cs{Hy@captionsenglish} and a later one that +% defines \cs{HyLang@english} instead. +% \begin{macrocode} +\@ifundefined{Hy@captionsenglish}{}{% + \g@addto@macro{\Hy@captionsenglish}{\def\bookautorefname{Book}}} +\@ifundefined{HyLang@english}{}{% + \g@addto@macro{\HyLang@english}{\def\bookautorefname{Book}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Hy@captionsgerman} +% \begin{macro}{\HyLang@german} +% \begin{macrocode} +\@ifundefined{Hy@captionsgerman}{}{% + \g@addto@macro{\Hy@captionsgerman}{\def\bookautorefname{Buch}}} +\@ifundefined{HyLang@german}{}{% + \g@addto@macro{\HyLang@german}{\def\bookautorefname{Buch}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Hy@captionsportuges} +% \begin{macro}{\HyLang@portuges} +% \begin{macrocode} +\@ifundefined{Hy@captionsportuges}{}{% + \g@addto@macro{\Hy@captionsportuges}{\def\bookautorefname{Livro}}} +\@ifundefined{HyLang@portuges}{}{% + \g@addto@macro{\HyLang@portuges}{\def\bookautorefname{Livro}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Hy@captionsspanish} +% \begin{macro}{\HyLang@spanish} +% \begin{macrocode} +\@ifundefined{Hy@captionsspanish}{}{% + \g@addto@macro{\Hy@captionsspanish}{\def\bookautorefname{Libro}}} +\@ifundefined{HyLang@spanish}{}{% + \g@addto@macro{\HyLang@spanish}{\def\bookautorefname{Libro}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Hy@captionsafrikaans} +% \begin{macro}{\HyLang@afrikaans} +% \begin{macrocode} +\@ifundefined{Hy@captionsafrikaans}{}{% + \g@addto@macro{\Hy@captionsafrikaans}{\def\bookautorefname{Boek}}} +\@ifundefined{HyLang@afrikaans}{}{% + \g@addto@macro{\HyLang@afrikaans}{\def\bookautorefname{Boek}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bookautorefname} +% \begin{macrocode} +\providecommand{\bookautorefname}{Book} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@writetorep} +% Change \Lpack{hyperref}'s \cs{@@writetorep} as memoir uses \cs{partnumberline} and +% \cs{chapternumberline} as well as the normal \cs{numberline} +% +% \begin{macrocode} +\def\@@writetorep#1#2#3#4#5{% + \begingroup + \def\Hy@tempa{#5}% + \ifx\Hy@tempa\Hy@bookmarkstype + \edef\Hy@level{#4}% + \ifx\Hy@levelcheck Y% + \@tempcnta\Hy@level\relax + \advance\@tempcnta by -1 + \ifnum\Hy@currentbookmarklevel<\@tempcnta + \advance\@tempcnta by -\Hy@currentbookmarklevel\relax + \advance\@tempcnta by 1 + \Hy@Warning{% + Difference (\the\@tempcnta) between bookmark levels is % + greater \MessageBreak than one, level fixed% + }% + \@tempcnta\Hy@currentbookmarklevel + \advance\@tempcnta by 1 + \edef\Hy@level{\the\@tempcnta}% + \fi + \else + \global\let\Hy@levelcheck Y% + \fi + \global\let\Hy@currentbookmarklevel\Hy@level + \@tempcnta\Hy@level\relax + \expandafter\xdef\csname Parent\Hy@level\endcsname{#3}% + \advance\@tempcnta by -1 + \edef\Hy@tempa{#3} + \edef\Hy@tempb{\csname Parent\the\@tempcnta\endcsname}% + \ifx\Hy@tempa\Hy@tempb + \Hy@Warning{% + The anchor of a bookmark and its parent's must not% + \MessageBreak be the same. Added a new anchor% + }% + \phantomsection + \fi + \ifHy@bookmarksnumbered + \let\numberline\Hy@numberline + \let\booknumberline\Hy@numberline % <- added + \let\partnumberline\Hy@numberline % <- added + \let\chapternumberline\Hy@numberline % <- added + \else + \let\numberline\@gobble + \let\booknumberline\@gobble % <- added + \let\partnumberline\@gobble % <- added + \let\chapternumberline\@gobble % <- added + \fi + \pdfstringdef\Hy@tempa{#2}% + \protected@write\@outlinefile{}{% + \protect\BOOKMARK + [\Hy@level][\@bookmarkopenstatus{\Hy@level}]{#3}% + {\Hy@tempa}{\Hy@tempb}% + }% + \fi + \endgroup +} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\M@sect} +% \Lpack{hyperref} fix for memoir's redefinition of \cs{@sect} +% \begin{macrocode} +\@ifundefined{H@old@sectm@m}{% haven't fiddled with \M@sect + \let\H@old@sectm@m\M@sect + \def\M@sect#1#2#3#4#5#6[#7][#8]#9{% + \ifnum #2>\c@secnumdepth + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{section*.\the\Hy@linkcounter}% + \fi + \H@old@sectm@m{#1}{#2}{#3}{#4}{#5}{#6}[{#7}][{#8}]{#9}% + \ifnum #2>\c@secnumdepth + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% + \fi}% + }% + {% already fiddled \M@sect + } + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@resets@pp} +% \Lpack{hyperref} fix for memoir's \texttt{appendices} environment +% (discovered by Lars Hoemke, \url{hoemke@nikocity.de}, +% private email 20 Feb 2003) +% \begin{macrocode} +\let\MH@old@resets@pp\@resets@pp +\renewcommand*{\@resets@pp}{% + \MH@old@resets@pp + \def\theHchapter{\Alph{chapter}}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@resets@ppsub} +% \Lpack{hyperref} fix for memoir's \texttt{subappendices} environment +% (Problem reported by Ignasi Furio, \url{ignasi.furio@uib.es}, +% private email 13 May 2004) +% \changes{v1.6}{2004/05/13}{Added \cs{@resets@ppsub} to memhfixc} +% \begin{macrocode} +\let\MH@old@resets@ppsub\@resets@ppsub +\renewcommand*{\@resets@ppsub}{% + \MH@old@resets@ppsub + \def\theHsection{\theHchapter.\Alph{section}}} +\def\endsubappendices{\def\theHsection{\theHchapter.\arabic{section}}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\cftaddtitleline} +% \begin{macro}{\cftaddnumtitleline} +% \Lpack{hyperref} fix for memoir's add to contents macros +% (discovered by Martin Siegumfeldt, \ctt{} 2003/09/25 +% \textit{`Combinig [sic] Tocloft and hyperref'} +% \begin{macrocode} +\renewcommand{\cftaddtitleline}[4]{% + \addtocontents{#1}{\protect\contentsline{#2}{#3}{#4}{\@currentHref}}} +\renewcommand{\cftaddnumtitleline}[5]{\addtocontents{#1}{% + \protect\contentsline{#2}{\protect\numberline{#3}#4}{#5}{\@currentHref}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\caption} +% Yet another little jolly (fixed in version 1.5). \Lpack{hyperref}'s +% \verb?\def? of \verb?\caption? cunningly messes up \Lpack{memoir}'s, +% thereby screwing up the labels for subcaptions. +% \begin{macrocode} +\let\m@moldhypcaption\caption +\renewcommand{\caption}{\donemaincaptiontrue\m@moldhypcaption} + +% \end{macrocode} +% \end{macro} +% +% More tweaks are needed for continued captions and sidecaptions. +% The need for these discovered by +% \v{Z}arko F \v{C}u\v{c}ej\footnote{\texttt{zarko.cucej@uni-mb.si}} +% (for \cs{contcaption}) and by +% J{\o}rgen Larsen\footnote{\texttt{jl@ruc.dk}} (for \cs{sidecaption}). +% \changes{v1.7}{2005/11/15}{Added tweaks for \cs{contcaption}, +% \cs{sidecaption} and \cs{sidecontcaption}} +% +% \begin{macro}{\c@memhycontfloat} +% \begin{macro}{\thememhycontfloat} +% \begin{macro}{\theHmemhycontfloat} +% We need an extra marker for continued captions. +% \changes{v1.7}{2005/11/15}{Added extra counter for continued captions} +% \begin{macrocode} +\newcounter{memhycontfloat} +\renewcommand*{\thememhycontfloat}{\arabic{memhycontfloat}} +\renewcommand{\theHmemhycontfloat}{\arabic{memhycontfloat}} +\setcounter{memhycontfloat}{0} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\contcaption} +% Tweak the \cs{contcaption} macro. +% \begin{macrocode} +\renewcommand{\contcaption}{% + \refstepcounter{memhycontfloat}% + \addtocounter{\@captype}{\m@ne}\H@refstepcounter{\@captype}% + \@contcaption\@captype} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endsidecaption} +% Tweak the \texttt{sidecaption} environment. I don't know why it +% works but it took a lot of time trying all sorts of combinations +% of commands to get it to do so (if it really does). +% \begin{macrocode} +\def\endsidecaption{% + \m@mscapend@fbox + \H@refstepcounter{\@captype}% + \hyper@makecurrent{\@captype}% + \m@mscaplabel + \begin{lrbox}{\m@mscap@capbox}% + \begin{minipage}[c]{\sidecapwidth}% + \sidecapstyle + \@caption\@captype[\m@mscap@fortoc]{\m@mscap@forcap}% + \end{minipage}% + \end{lrbox}% + \m@mscapopboxes} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sidecontcaption} +% \begin{macro}{\endsidecontcaption} +% Tweaks for the \texttt{sidecontcaption} environment. Again it was +% a miss, miss, \ldots hit method to get something that appears +% to work. +% \begin{macrocode} +\renewcommand*{\sidecontcaption}{% + \refstepcounter{memhycontfloat}% + \@sidecontcaption} +\def\endsidecontcaption{% + \m@mscapend@fbox + \addtocounter{\@captype}{\m@ne}\H@refstepcounter{\@captype}% + \hyper@makecurrent{memhycontfloat}% + \m@mscaplabel + \begin{lrbox}{\m@mscap@capbox}% + \begin{minipage}[c]{\sidecapwidth}% + \sidecapstyle + \@contcaption\@captype{\m@mscap@forcap}% + \end{minipage}% + \end{lrbox}% + \m@mscapopboxes} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% The end of the \Lpack{hyperref} related patches. +% +% \begin{macrocode} +%</hyper> +% \end{macrocode} +% +% +% \section{Patches for the class code} \label{sec:class} +% +% At this date, 2005/09/25, with the simultaneous release of memoir v1.618 +% and the patch file, by definition there are no patches. +% +% Subsequently code patches were found to be required. +% +% \subsection{Identification} \label{sec:id} +% +% \changes{v2.0}{2004/01/31}{No code in mempatch.sty} +% \changes{v2.1}{2004/02/12}{Code now required in mempatch.sty} +% \changes{v2.1a}{2004/02/19}{Extra pagestyle code for handling \cs{linespread}} +% \changes{v2.4}{2004/04/26}{Removed extraneous spaces} +% \changes{v2.4+}{2004/04/26}{Stopped noting general changes} +% +% \begin{macrocode} +%<*patch> +% \end{macrocode} +% +% ^^A \typeout{mempatch.sty 2002/12/12 v1.1 Patches for memoir class v1.3a} +% ^^A \typeout{mempatch.sty 2003/01/06 v1.2 Patches for memoir class v1.3a} +% ^^A \typeout{mempatch.sty 2003/01/22 v1.3 Patches for memoir class v1.3a} +% ^^A \typeout{mempatch.sty 2003/02/13 v1.4 Patches for memoir class v1.3a} +% ^^A \typeout{mempatch.sty 2003/04/26 v1.5 Patches for memoir class v1.3a} +% ^^A \typeout{mempatch.sty 2003/06/28 v1.6 Patches for memoir class v1.3a} +% ^^A \typeout{mempatch.sty 2003/07/23 v1.7 Patches for memoir class v1.3a} +% ^^A \typeout{mempatch.sty 2003/09/16 v1.8 Patches for memoir class v1.3a} +% ^^A \typeout{mempatch.sty 2003/10/06 v1.8a Patches for memoir class v1.3a} +% ^^A \typeout{mempatch.sty 2003/11/16 v1.9 Patches for memoir class v1.3a} +% ^^A \typeout{mempatch.sty 2004/01/31 v2.0 Patches for memoir class v1.6} +% ^^A \typeout{mempatch.sty 2004/02/12 v2.1 Patches for memoir class v1.6} +% ^^A \typeout{mempatch.sty 2004/02/19 v2.1a Patches for memoir class v1.6} +% ^^A \typeout{mempatch.sty 2004/03/01 v2.2 Patches for memoir class v1.6} +% ^^A \typeout{mempatch.sty 2004/03/28 v2.3 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2004/04/26 v2.3 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2004/04/27 v2.3a Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2004/04/30 v2.3b Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2004/05/10 v2.3c Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2004/05/14 v2.3d Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2004/12/14 v3.0 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2004/12/19 v3.1 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2005/01/01 v3.2 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2005/01/17 v3.3 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2005/01/18 v3.4 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2005/02/01 v3.5 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2005/02/07 v3.6 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2005/02/26 v3.7 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2005/03/06 v3.8 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2005/03/23 v3.9 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2005/05/16 v3.10 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2005/05/23 v3.11 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2005/06/06 v3.12 Patches for memoir class v1.61} +% ^^A \typeout{mempatch.sty 2005/09/25 v4.0 Patches for memoir class v1.618} +% ^^A \ProvidesFile{mempatch.sty}[2005/10/06 v4.1 Patches for memoir class v1.618] +% ^^A \ProvidesFile{mempatch.sty}[2005/11/21 v4.2 Patches for memoir class v1.618] +% ^^A \ProvidesFile{mempatch.sty}[2005/12/13 v4.3 Patches for memoir class v1.618] +% ^^A \ProvidesFile{mempatch.sty}[2006/01/21 v4.4 Patches for memoir class v1.618] +% ^^A \ProvidesFile{mempatch.sty}[2006/01/23 v4.4a Patches for memoir class v1.618] +% \begin{macrocode} +\ProvidesFile{mempatch.sty}[2006/08/08 v4.5 Patches for memoir class v1.618] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Version 4.0 was released simultaneously with version 1.618 of memoir. +%%% By definition there were no patches. +%%% Most of the subsequent additions are noted in the Addendum. +%%% +%%% Version 4.3 introduces the \reparticle macro which is not in the +%%% Addendum. +%%% +%%% Version 4.4 introduces several additional commands, in particular +%%% the \book command provides a document division above Part. See the +%%% code (towards the end) for details of the new commands. +%%% +%%% Version 4.5 introduces commands for switching trim marks off and on +%%% and a \DisemulatePackage macro to negate a prior \EmulatedPackage. +%%% It also provides the functions of the pagenote package for end notes. +%%% See the code (near the end) for details. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% \end{macrocode} +% +% +% \section{Mempatch version 4.1} +% +% \begin{macrocode} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Version 4.1 (2005/10/03 and later) + +% \end{macrocode} +% +% \begin{macro}{\@ssect} +% Gabriel Guernik on 2005/10/03 discovered that I had made a boo-boo with \cs{memsecstarinfo} +% in \cs{@ssect} by calling it with 3 arguments when it only has two. +% \changes{v4.1}{2005/10/03}{Fixed problem with \cs{memsecstarinfo} in +% \cs{@ssect}} +% \begin{macrocode} +%%%% Use correct number of arguments for \memsecstarinfo (2 not 3). +\def\@ssect#1#2#3#4#5{% + \M@gettitle{#5}% + \memsecstarinfo{\m@msecn@mame}{#5}% + \@mem@old@ssect{#1}{#2}{#3}{#4}{#5}} + +% \end{macrocode} +% \end{macro} +% +% \subsection{Side captions} +% \changes{v4.1}{2005/10/03}{Added all the code for side captions} +% +% \begin{macrocode} +%%%%%%%%%%%% +%%%%%%%%%%%% Side captions +%%%%%%%%%%%% + +% \end{macrocode} +% +% \begin{macro}{\m@mscap@capbox} +% \begin{macro}{\m@mscap@fbox} +% We need two save boxes, one to hold the caption and the other +% for the float material. +% \begin{macrocode} +\newsavebox{\m@mscap@capbox} +\newsavebox{\m@mscap@fbox} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\sidecapsep} +% \begin{macro}{\sidecapwidth} +% \cs{sidecapsep} is the space between the text and the caption, which +% is set in a box \cs{sidecapwidth} wide. These are initialized to +% the \cs{marginpar...} values. +% \begin{macrocode} +\newdimen\sidecapsep + \sidecapsep=\marginparsep +\newdimen\sidecapwidth + \sidecapwidth=\marginparwidth + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\m@m@tempdima} +% \begin{macro}{\m@mscapraise} +% Lengths for internal use. \cs{m@m@tempdima} is meant for general +% temporary use. +% \begin{macrocode} +\newdimen\m@m@tempdima +\newdimen\m@mscapraise + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\sidecapraise} +% Length to make (small) adjustments to the position of the caption wrt the float. +% \begin{macrocode} +\newdimen\sidecapraise + \sidecapraise \z@ + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setsidecappos} +% \begin{macro}{\m@mscappos} +% \cs{setsidecappos}\marg{pos}, where \meta{pos} is one of \texttt{t}, +% \texttt{c}, or \texttt{b}, sets the vertical position of the caption +% in relation to the float and the result is saved as \cs{m@mscappos}. +% The default is \texttt{c}. +% \begin{macrocode} +\newcommand*{\setsidecappos}[1]{% + \def\m@mscappos{#1}\def\@tempb{t}% + \ifx\@tempb\m@mscappos + \else + \def\@tempb{b}% + \ifx\@tempb\m@mscappos + \else + \def\@tempb{c}% + \ifx\@tempb\m@mscappos + \else + \@memerror{Argument to \string\setsidecappos\space is not t or c or b. + \MessageBreak Set to c}{\@ehc}% + \def\m@mscappos{c}% + \fi + \fi + \fi} +\setsidecappos{c} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\sidecapmargin} +% \begin{macro}{\m@mscapmarg} +% \cs{sidecapmargin}\marg{margin}, where \meta{marg} is one of +% \texttt{left}, \texttt{right}, \texttt{inner}, or \texttt{outer}, +% controls the margin where the caption will be put. The result +% is saved as \cs{m@mscapmarg} as a number. The default +% is \texttt{left}. +% \begin{macrocode} +\newcommand{\sidecapmargin}[1]{% + \def\@tempa{#1}\def\@tempb{left}% + \ifx\@tempb\@tempa + \def\m@mscapmarg{0}% left + \else + \def\@tempb{right}% + \ifx\@tempb\@tempa + \def\m@mscapmarg{1}% right + \else + \def\@tempb{outer}% + \ifx\@tempb\@tempa + \def\m@mscapmarg{2}% outer + \else + \def\@tempb{inner}% + \ifx\@tempb\@tempa + \def\m@mscapmarg{3}% inner + \else + \@memerror{Unrecognized argument for \string\sidecapmargin}% + {\@ehc}% + \def\m@mscapmarg{-1}% error + \fi + \fi + \fi + \fi} +\sidecapmargin{left} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\ifscapmargleft} +% \begin{macro}{\scapmarglefttrue} +% \begin{macro}{\scapmargleftfalse} +% \cs{ifscapmargleft} is TRUE the caption should be in the left hand margin, +% otherwise in the right hand margin. +% \begin{macrocode} +\newif\ifscapmargleft + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\sidecapfloatwidth} +% \begin{macro}{\m@mscapmainwidth} +% \cs{sidecapfloatwidth} is the width of the box holding the float. +% Note that this is a macro, +% not a length, so must be changed using \cs{renewcommand*}. +% The default is \cs{linewidth}. Later, \cs{m@mscapmainwidth} will be set +% to the current length specification from \cs{sidecapfloatwidth}. +% \begin{macrocode} +\def\sidecapfloatwidth{\linewidth} +\newdimen\m@mscapmainwidth + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\m@mscaplkern} +% \begin{macro}{\setm@mscaplkern} +% \cs{setm@mscaplkern} is a utility macro to calculate the kern +% (\cs{m@mscaplkern}) required when the caption is in the left margin. +% \begin{macrocode} +\newdimen\m@mscaplkern +\newcommand*{\setm@mscaplkern}{% + \m@mscaplkern=\sidecapwidth + \advance\m@mscaplkern \sidecapsep + \advance\m@mscaplkern \m@mscapmainwidth} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\sidecapstyle} +% \cs{sidecapstyle} is called just before the caption is set. It can +% be redefined to set different caption style parameters. The default +% is raggedleft for left margin captions and raggedright for right +% margin captions. +% \begin{macrocode} +\newcommand*{\sidecapstyle}{% +%%% \captionnamefont{\bfseries}% + \ifscapmargleft + \captionstyle{\raggedleft}% + \else + \captionstyle{\raggedright}% + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sidecaption} +% The whole shebang is in the \texttt{sidecaption} environment but +% it is more convenient to specify this via macros rather than +% directly as an environment. +% +% \cs{sidecaption}\oarg{fortoc}\marg{title}\oarg{label} is what it +% looks like to the user, but internally further macros handle +% all the arguments. +% \begin{macrocode} +\newcommand*{\sidecaption}{% + \@ifnextchar [{\@sidecaption}{\@sidecaption[]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@sidecaption} +% \cs{@sidecaption}\oarg{fortoc}\marg{title} grabs the first +% two arguments. +% \begin{macrocode} +\def\@sidecaption[#1]#2{% + \@ifnextchar [{\@@sidecaption{#1}{#2}}{\@@sidecaption{#1}{#2}[]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@sidecaption} +% \cs{@@sidecaption}\marg{fortoc}\marg{title}\oarg{label} is the +% last macro in the chain and handles all three arguments. +% This does all the work for \verb?\begin{sidecaption}? +% \begin{macro}{\m@mscap@fortoc} +% \begin{macro}{\m@mscap@forcap} +% \begin{macro}{\m@mscaplabel} +% First, save all the arguments as macros. +% \begin{macrocode} +\def\@@sidecaption#1#2[#3]{% + \ifx\@empty#1\@empty + \def\m@mscap@fortoc{#2}% + \else + \def\m@mscap@fortoc{#1}% + \fi + \def\m@mscap@forcap{#2}% + \ifx\@empty#3\@empty + \def\m@mscaplabel{}% + \else + \def\m@mscaplabel{\@bsphack\label{#3}\@esphack}% + \fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% Set the float width, calculate the left margin kern, and start +% a \texttt{minipage} to hold the float, saving it in box +% \cs{m@mscap@fbox}. +% \begin{macrocode} + \m@mscapstart@fbox} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mscapstart@fbox} +% \begin{macro}{\m@mscapend@fbox} +% \cs{m@mscapstart@fbox} is the macro that actually sets the float width, +% calculates the left margin kern, and starts the float's \texttt{minipage}. +% The macro \cs{m@mscapend@fbox} ends the box. +% \begin{macrocode} +\newcommand*{\m@mscapstart@fbox}{% + \setlength{\m@mscapmainwidth}{\sidecapfloatwidth}% + \setm@mscaplkern + \begin{lrbox}{\m@mscap@fbox}% + \begin{minipage}[c]{\m@mscapmainwidth}} +\newcommand*{\m@mscapend@fbox}{% + \end{minipage}% + \end{lrbox}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\endsidecaption} +% \cs{endsidecaption} does the work for \verb?\end{sidecaption}?. +% +% Finish the float minipage, then increment the caption counter and +% call \cs{label} via \cs{m@mscaplabel}. +% \begin{macrocode} +\def\endsidecaption{% + \m@mscapend@fbox + \refstepcounter\@captype + \m@mscaplabel +% \end{macrocode} +% Set the caption inside a minipage, saving it in box \cs{m@mscap@capbox}. +% \begin{macrocode} + \begin{lrbox}{\m@mscap@capbox}% + \begin{minipage}[c]{\sidecapwidth}% + \sidecapstyle + \@caption\@captype[\m@mscap@fortoc]{\m@mscap@forcap} + \end{minipage}% + \end{lrbox}% +% \end{macrocode} +% Output the float and caption. +% \begin{macrocode} + \m@mscapopboxes} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mscapopboxes} +% Having determined how high the caption box must be raised with +% respect to the float box, output the boxes. +% \begin{macrocode} +\newcommand*{\m@mscapopboxes}{% + \m@mcalcscapraise +% \end{macrocode} +% Set the float (from box \cs{m@mscap@fbox}) then the caption (from +% box \cs{m@mscap@capbox}) kerning it to the left or right as +% appropriate. +% \begin{macrocode} + \usebox{\m@mscap@fbox}\m@mscapcheckside + \ifscapmargleft% + \rlap{\kern-\m@mscaplkern + \raisebox{\m@mscapraise}{\usebox{\m@mscap@capbox}}}% + \else% + \rlap{\kern\sidecapsep + \raisebox{\m@mscapraise}{\usebox{\m@mscap@capbox}}}% + \fi +% \end{macrocode} +% Finally, make \cs{m@mscapthisside} a no-op. +% \begin{macrocode} + \gdef\m@mscapthisside{}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mcalcscapraise} +% Calculate the amount the caption might have to be raised wrt the +% float. This depends on the position: \\ +% \texttt{t:} raise by the difference in heights \\ +% \texttt{c:} shouldn't have to do anything as the minipages are meant +% to center aligned \\ +% \texttt{b:} lower by the difference in depths \\ +% +% However, experiments showed that a little bit of tweaking might +% help. The final adjustment, \cs{sidecapraise} is controlled by +% the user. +% \begin{macrocode} +\newcommand*{\m@mcalcscapraise}{% + \def\@tempb{t}% + \ifx\m@mscappos\@tempb + \settoheight{\m@m@tempdima}{\strut\usebox{\m@mscap@capbox}}% + \settoheight{\m@mscapraise}{\usebox{\m@mscap@fbox}}% + \advance\m@mscapraise -\m@m@tempdima + \advance\m@mscapraise 0.5ex + \else + \def\@tempb{b}% + \ifx\m@mscappos\@tempb + \settodepth{\m@m@tempdima}{\usebox{\m@mscap@fbox}}% + \settodepth{\m@mscapraise}{\strut\usebox{\m@mscap@capbox}}% + \advance\m@mscapraise -\m@m@tempdima + \else + \m@mscapraise=\z@ + \advance\m@mscapraise 0.25ex + \fi + \fi + \advance\m@mscapraise \sidecapraise} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mscapcheckside} +% This macro determines whether the caption should be set in the +% left or right margin. In twocolumn documents the caption for a single +% column float is always set in the adjacent margin. Starred floats +% are treated as regular floats as in a onecolumn document. +% \begin{macrocode} +\newcommand*{\m@mscapcheckside}{% + \if@twocolumn + \ifdim\hsize=\textwidth% float* + \m@mscapcheckregside + \else + \if@firstcolumn + \scapmarglefttrue + \else + \scapmargleftfalse + \fi + \fi + \else + \m@mscapcheckregside + \fi +% \end{macrocode} +% Finally apply any user's override. +% \begin{macrocode} + \m@mscapthisside} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mscapcheckregside} +% This performs the margin calculation for onecolumn documents. +% \changes{v4.1}{2005/11/21}{Fixed missing t in \cs{marglefttrue}, courtesy Jorgen Larsen} +% \begin{macrocode} +\newcommand*{\m@mscapcheckregside}{% + \if@twoside + \checkoddpage + \ifnum\m@mscapmarg<\@ne% % left + \scapmarglefttrue + \else + \ifnum\m@mscapmarg=\@ne% % right + \scapmargleftfalse + \else + \ifnum\m@mscapmarg=\tw@% % outer + \scapmarglefttrue + \ifoddpage + \scapmargleftfalse + \fi + \else% % inner + \scapmargleftfalse + \ifoddpage + \scapmarglefttrue + \fi + \fi + \fi + \fi + \else% oneside + \scapmarglefttrue + \ifnum\m@mscapmarg>\@ne + \ifnum\m@mscapmarg<\thr@@ + \scapmargleftfalse + \fi + \fi + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\overridescapmargin} +% \begin{macro}{\m@mscapthisside} +% User macro to override the calculated caption margin. Call as either:\\ +% \verb?\overridescapmargin{left}? or \verb?\overridescapmargin{right}? \\ +% \begin{macrocode} +\newcommand*{\overridescapmargin}[1]{% + \def\@tempb{#1}\def\@tempa{left}% + \ifx\@tempa\@tempb + \def\m@mscapthisside{\scapmarglefttrue}% + \else + \def\@tempa{right}% + \ifx\@tempa\@tempb + \def\m@mscapthisside{\scapmargleftfalse}% + \else + \@memerror{Argument to \string\overridescapmargin\space neither + left nor right}{\@ehc}% + \def\m@mscapthisside{}% + \fi + \fi} +\newcommand*{\m@mscapthisside}{} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Now for the other kinds of captions. +% +% \begin{macro}{\sidecontcaption} +% \cs{sidecontcaption}\marg{title}\oarg{label} is for +% a continuation sidecaption. +% \begin{macrocode} +\newcommand*{\sidecontcaption}{% + \@sidecontcaption} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@sidecontcaption} +% \cs{@sidecontcaption}\marg{title} grabs the first +% argument. +% \begin{macrocode} +\def\@sidecontcaption#1{% + \@ifnextchar [{\@@sidecontcaption{#1}}{\@@sidecontcaption{#1}[]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@sidecontcaption} +% \cs{@@sidecontcaption}\marg{title}\oarg{label} is the +% last macro in the chain and handles all two arguments. +% This does all the work for \verb?\begin{sidecontcaption}? +% \begin{macrocode} +\def\@@sidecontcaption#1[#2]{% + \def\m@mscap@forcap{#1}% + \ifx\@empty#2\@empty + \def\m@mscaplabel{}% + \else + \def\m@mscaplabel{\@bsphack\label{#2}\@esphack}% + \fi + \m@mscapstart@fbox} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endsidecontcaption} +% \cs{endsidecontcaption} does the work for \verb?\end{sidecontcaption}?. +% +% \begin{macrocode} +\def\endsidecontcaption{% + \m@mscapend@fbox + \addtocounter{\@captype}{\m@ne}\refstepcounter\@captype + \m@mscaplabel + \begin{lrbox}{\m@mscap@capbox}% + \begin{minipage}[c]{\sidecapwidth}% + \sidecapstyle + \@contcaption\@captype{\m@mscap@forcap} + \end{minipage}% + \end{lrbox}% + \m@mscapopboxes} + +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\sidenamedlegend} +% \begin{macro}{\@sidenamedlegend} +% \cs{sidenamedlegend}\oarg{fortoc}\marg{title} is for +% a namedlegend sidecaption. +% \begin{macrocode} +\newcommand*{\sidenamedlegend}{% + \@ifnextchar [{\@sidenamedlegend}{\@sidenamedlegend[]}} +\def\@sidenamedlegend[#1]#2{% + \@@sidenamedlegend{#1}{#2}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@sidenamedlegend} +% \cs{@@sidenamedlegend}\marg{fortoc}\marg{title} is the +% last macro in the chain and handles all arguments. +% This does all the work for \verb?\begin{sidenamedlegend}? +% \begin{macrocode} +\def\@@sidenamedlegend#1#2{% + \ifx\@empty#1\@empty + \def\m@mscap@fortoc{#2}% + \else + \def\m@mscap@fortoc{#1}% + \fi + \def\m@mscap@forcap{#2}% + \def\m@mscaplabel{}% + \m@mscapstart@fbox} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endsidenamedlegend} +% \cs{endsidenamedlegend} does the work for \verb?\end{sidenamedlegend}?. +% \begin{macrocode} +\def\endsidenamedlegend{% + \m@mscapend@fbox + \begin{lrbox}{\m@mscap@capbox}% + \begin{minipage}[c]{\sidecapwidth}% + \sidecapstyle + \@legend\@captype[\m@mscap@fortoc]{\m@mscap@forcap} + \end{minipage}% + \end{lrbox}% + \m@mscapopboxes} + +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\sidelegend} +% \cs{sidelegend}\marg{title} is for +% a legend sidecaption. +% \begin{macrocode} +\newcommand*{\sidelegend}{% + \@@sidelegend} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@sidelegend} +% \cs{@@sidelegend}\marg{title} is the +% last macro in the chain and handles all arguments. +% This does all the work for \verb?\begin{sidelegend}? +% \begin{macrocode} +\def\@@sidelegend#1{% + \def\m@mscap@forcap{#1}% + \m@mscapstart@fbox} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endsidelegend} +% \cs{endsidelegend} does the work for \verb?\end{sidelegend}?. +% \begin{macrocode} +\def\endsidelegend{% + \m@mscapend@fbox + \begin{lrbox}{\m@mscap@capbox}% + \begin{minipage}[c]{\sidecapwidth}% + \sidecapstyle + \legend{\m@mscap@forcap} + \end{minipage}% + \end{lrbox}% + \m@mscapopboxes} + +% \end{macrocode} +% \end{macro} +% +% \section{Mempatch version 4.2} +% +% \begin{macrocode} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Version 4.2 (2005/11/21 and later) + +% \end{macrocode} +% +% \subsection{AtBegin/End...} +% +% Code, based on a hint from Morten H{\o}gholm\footnote{CTT posting +% 2005/11/08, \textit{Re: Checking for packages froma class... +% revisited}} that the \Lpack{scrlfile} package from +% \Lpack{koma-script} includes commands such as \\ +% \cs{AfterFile}\marg{file}\marg{code} \\ +% plus before and after classes and packages. +% +% \begin{macrocode} +%%%%%%%%%%%% +%%%%%%%%%%%% Extensions to \AtBeginDocument +%%%%%%%%%%%% + +% \end{macrocode} +% +% Extend the \cs{InputIfFileExists} macro to call hooks before and +% the actual inputting. The kernel version (as of 2005/11/21) is: +% \begin{verbatim} +% \newcommand{\InputIfFileExists}[2]{% +% \IfFileExists{#1}% +% {\#2\@addtofilelist{#1}\@@input \@filef@und}} +% \end{verbatim} +% +% \begin{macro}{\InputIfFileExists} +% Effectively all file input is handled by this macro. Extend it +% by adding pre- and post- input hooks. +% \begin{macrocode} +\renewcommand{\InputIfFileExists}[2]{% + \IfFileExists{#1}% + {#2\@addtofilelist{#1}\m@matbeginf{#1}% + \@@input \@filef@und + \m@matendf{#1}% + \killm@matf{#1}}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@matbeginf} +% \begin{macro}{\m@matendf} +% \cs{m@matbeginf}\marg{file} calls macro \cs{file-m@mfb} if it +% is defined. Similarly \cs{m@matendf}\marg{file} calls +% \cs{file-m@mfe} if it is defined. +% \begin{macrocode} +\newcommand{\m@matbeginf}[1]{\@ifundefined{#1-m@mfb}{}% + {\@nameuse{#1-m@mfb}}} +\newcommand{\m@matendf}[1]{\@ifundefined{#1-m@mfe}{}% + {\@nameuse{#1-m@mfe}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\killm@matf} +% \cs{killm@matf}\marg{file} undefines the \cs{file-m@mfb} and +% \cs{file-m@mfe} macros. +% \begin{macrocode} +\newcommand*{\killm@matf}[1]{% + \@namelet{#1-m@mfb}\relax + \@namelet{#1-m@mfe}\relax} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\AtBeginFile} +% \begin{macro}{\AtEndFile} +% \cs{AtBeginFile}\marg{file}\marg{code} inserts \meta{code} +% just before \meta{file} is input. Similarly \cs{AtEndFile} inserts +% just after input. +% \begin{macrocode} +\newcommand{\AtBeginFile}[2]{\@ifundefined{#1-m@mfb}% + {\@namedef{#1-m@mfb}{#2}}% + {\expandafter\addtodef\csname #1-m@mfb\endcsname{}{#2}}} +\newcommand{\AtEndFile}[2]{\@ifundefined{#1-m@mfe}% + {\@namedef{#1-m@mfe}{#2}}% + {\expandafter\addtodef\csname #1-m@mfe\endcsname{}{#2}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\AtBeginPackage} +% \begin{macro}{\AtEndPackage} +% \begin{macro}{\RequireAtEndPackage} +% \cs{AtBeginPackage}\marg{pack}\marg{code} inserts \meta{code} +% just before the \meta{pack} package is input, and \cs{AtEndPackage} +% is the equivalent for after input. \cs{RequireAtEndPackage} inserts +% \meta{code} either at the end of \meta{pack}, or immediately if +% \meta{pack} has already been input. +% \begin{macrocode} +\newcommand{\AtBeginPackage}[2]{% + \AtBeginFile{#1.\@pkgextension}{#2}} +\newcommand{\AtEndPackage}[2]{% + \AtEndFile{#1.\@pkgextension}{#2}} +\newcommand{\RequireAtEndPackage}[2]{% + \@ifpackageloaded{#1}{#2}% + {\AtEndFile{#1.\@pkgextension}{#2}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\AtBeginClass} +% \begin{macro}{\AtEndClass} +% \begin{macro}{\RequireAtEndClass} +% \cs{AtBeginClass}\marg{class}\marg{code} and friends are the class +% equivalents of \cs{AtBeginPackage} and friends. +% \begin{macrocode} +\newcommand{\AtBeginClass}[2]{% + \AtBeginFile{#1.\@clsextension}{#2}} +\newcommand{\AtEndClass}[2]{% + \AtEndFile{#1.\@clsextension}{#2}} +\newcommand{\RequireAtEndClass}[2]{% + \@ifclassloaded{#1}{#2}% + {\AtEndFile{#1.\@clsextension}{#2}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \section{Mempatch version 4.3} +% +% \begin{macrocode} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Version 4.3 (2005/12/13 and later) + +% \end{macrocode} +% +% \subsection{reparticle chapter style} +% +% The \verb?reparticle? chapterstyle replicates the appearance +% of a \cs{section} in an \Lpack{article} class. +% +% \begin{macrocode} +%%% Replicate the appearance of a \section in the article class +\makechapterstyle{reparticle}{% + \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex}% + \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}% + \setlength{\afterchapskip}{2.3ex \@plus .2ex}% + \renewcommand*{\printchaptername}{}% + \renewcommand*{\chapternamenum}{}% + \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries}% + \renewcommand*{\chapnumfont}{\chaptitlefont}% + \renewcommand*{\printchapternum}{\@hangfrom{\chapnumfont \thechapter\quad}}% + \renewcommand*{\afterchapternum}{}} + +% \end{macrocode} +% +% \begin{macro}{\reparticle} +% Call this to get division heads to replicate the \Lpack{article} class. +% For example: \\ +% \verb?\ifartopt \reparticle \fi? +% \begin{macrocode} +%%% \reparticle redefines the higher level division heads fonts and spacing +%%% to replicate the article class (but \chapter must still be used). +%%% Use, for example like: \ifartopt \reparticle \fi +\newcommand*{\reparticle}{% + \chapterstyle{reparticle}% + \setsecheadstyle{\large\bfseries\raggedright}% + \setsubsecheadstyle{\normalsize\bfseries\raggedright}% +} + +% \end{macrocode} +% \end{macro} +% +% \section{Mempatch version 4.4} +% +% \begin{macrocode} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Version 4.4 (2006/01/06 and later) + +% \end{macrocode} +% +% \subsection{Captiontitlefinal} +% +% \begin{macro}{\captiontitlefinal} +% \begin{macro}{\@makecaption} +% \cs{captiontitlefinal}\marg{stuff} puts \meta{stuff} immediately at the +% end of the caption's title text, but it will not appear the the LoF/LoT/etc. +% The code was supplied by Frederic +% Connes\footnote{\texttt{frederic@connes.org}} in an email to me on +% 2005/12/28. +% \changes{v4.4a}{2006/01/23}{Fixed \cs{@tewmpboxa} typo in \cs{@makecaption}} +% \begin{macrocode} +%%% \captiontitlefinal{<stuff>} will put <stuff> immediately at the +%%% end of a \caption's title text and it will not appear in the +%%% LoF/LoT/etc. For example: \captiontitlefinal{.} +%%% (Code supplied by Frederic Connes) +\newcommand*{\captiontitlefinal}[1]{\def\@contfinal{#1}} +\captiontitlefinal{} + +\renewcommand{\@makecaption}[2]{\let\@memtempa\relax + \ifdim\prevdepth>-99\p@ \vskip\abovecaptionskip + \else \def\@memtempa{\vbox to\topskip{}}\fi + \let\@contfnote\footnote \renewcommand{\footnote}[2][]{}% + \let\@contfmark\footnotemark \renewcommand{\footnotemark}[1][]{}% + \sbox\@tempboxa{\@contnfont #1\@contdelim \@conttfont #2\@contfinal}% + \let\footnote\@contfnote + \let\footnotemark\@contfmark + \ifdim\wd\@tempboxa<\linewidth \centering\fi + \if@contcw + \centering + \parbox{\@contcwidth}{% + \ifdim\wd\@tempboxa<\@contcwidth \centering\fi + \fi + \if@conthang + \sbox\@tempboxa{\@contnfont #1\@contdelim}% + \@contpre% + {\@contcstyle\hangindent=\wd\@tempboxa + \noindent\box\@tempboxa\@memtempa \@conttfont #2\@contfinal\par}% + \else + \if@contindent + \@contpre% + {\@contnfont #1\@contdelim}\@memtempa + {\@contcstyle\hangindent=\@contindw + \hangafter=\@ne\@conttfont #2\@contfinal\par}% <- v1.4 + \else + \@contpre% + {\@contnfont #1\@contdelim}\@memtempa + {\ifdim\wd\@tempboxa<\linewidth + \@contcshortstyle\else \@contcstyle\fi% <- v1.4 + \@conttfont #2\@contfinal\par}% + \fi + \fi + \@contpost + \if@contcw + \par + }% end of the parbox + \fi + \vskip\belowcaptionskip} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{xindy and theindex} +% +% \begin{macro}{\ifm@mxindy} +% \begin{macro}{\m@mxindytrue} +% \begin{macro}{\m@mxindyfalse} +% \begin{macro}{\xindyindex} +% \begin{macro}{\@@wrspindexhyp} +% Use \cs{xindyindex} when you are going to use the xindy program rather +% than makeindex. hyperrefed entries won't work with xindy. +% The code was supplied by Frederic +% Connes\footnote{\texttt{frederic@connes.org}} in an email to me on +% 2006/01/08. +% \begin{macrocode} +%%% Use the declaration \xindyindex if you will be using the xindy program +%%% instead of MakeIndex to process index entries. As yet, xindy will not +%%% hyperref any entries. +%%% (Code supplied by Frederic Connes) +\newif\ifm@mxindy +\m@mxindyfalse +\newcommand*{\xindyindex}{\m@mxindytrue} +\def\@@wrspindexhyp#1|#2|#3\\{% + \ifshowindexmark\@showidx{#1}\fi + \ifx\\#2\\% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}% + \ifm@mxindy{#1}\else{#1|hyperspindexpage(\thepage)}\fi + {\@nameuse{the\@sptheidx}}}% + \else + \def\Hy@temp@A{#2}% + \ifx\Hy@temp@A\HyInd@ParenLeft + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}% + \ifm@mxindy{#1|#2}\else{#1|#2hyperspindexpage(\thepage)}\fi + {\@nameuse{the\@sptheidx}}}% + \else + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|#2}% + {\@nameuse{the\@sptheidx}}}% + \fi + \fi + \endgroup + \@esphack} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{environment}{theindex} +% Problem noted by Erik Quaeghebeur\footnote{\texttt{equaeghe@nospammail.net}} +% in a CTT posting \textit{memoir, openleft and \cs{clear*page} commands} on +% 2006/01/04 that an index did not start on a verso page when the +% \textsf{openleft} option is in effect. +% \begin{macrocode} +\renewenvironment{theindex}{% + \clearforchapter% <- added + \if@twocolumn + \@restonecolfalse + \else + \@restonecoltrue + \fi + \ifonecolindex + \onecolumn + \chapter*{\indexname} + \preindexhook + \else + \setlength{\columnseprule}{\indexrule}% + \setlength{\columnsep}{\indexcolsep}% + \twocolumn[\@makeschapterhead{\indexname} + \preindexhook]% + \fi + \indexmark + \ifnoindexintoc\else + \phantomsection + \addcontentsline{toc}{chapter}{\indexname} + \fi + \thispagestyle{chapter}\parindent\z@ + \parskip\z@ \@plus .3\p@\relax + \let\item\@idxitem}% + {\if@restonecol\onecolumn\else\twocolumn\fi} + +% \end{macrocode} +% \end{environment} +% +% \subsection{Verse numbering} +% +% \begin{macro}{\verselinebreak} +% Aaron Rendahl (\texttt{arendahl@stat.umn.edu}) provided the \cs{ignorespaces} +% fix for an extra indent when using \verb?\\>[0pt]? to end a verse line. +% \changes{v4.4}{2006/01/14}{Added \cs{ignorespaces} to \cs{verselinebreak}} +% \begin{macrocode} +%%% \ignorespaces fix by Aaron Rendahl to remove extraneous space +%%% with \\>[0pt] ending a verse line +\renewcommand*{\verselinebreak}[1][\z@]{\newline\hspace*{#1}\ignorespaces} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\verselinenumbersright} +% \begin{macro}{\verselinenumbersleft} +% \begin{macro}{\@vslnumright} +% \begin{macro}{\@vslnumleft} +% \begin{macro}{\@vscentercr} +% New declarations for setting verse line numbers at the right (default) +% or at the left. +% \changes{v4.4}{2006/01/15}{Added code for switching verse line numbers left/right} +% \begin{macrocode} +%%% Use the \verselinenumbersleft declaration to set verse line numbers +%%% at the left. To later return to the default of setting them at the right +%%% use the \verselinenumbersright declaration. +\newcommand*{\verselinenumbersright}{\def\@vstypelinenum{\@vslnumright}} +\newcommand*{\verselinenumbersleft}{\def\@vstypelinenum{\@vslnumleft}} +\verselinenumbersright + +\newcommand*{\@vslnumright}{% + \hfill\rlap{\kern\rightskip\kern\rightmargin% + \vlvnumfont\getthelinenumber{poemline}}} +\newcommand*{\@vslnumleft}{% + \hfill\rlap{\kern-\textwidth\kern-\rightskip% + \vlvnumfont\getthelinenumber{poemline}}} +\renewcommand*{\@vscentercr}{% + \ifhmode \unskip\else \@nolnerr\fi + \@vstypelinenum% + \@vsifgt{\verselinebreak}{% + \incr@vsline + \par\@ifstar{\nobreak\@vsxcentercr}{% + \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Wrapped verbatims} +% +% \begin{macro}{\raggedwrap} +% \begin{macro}{\wrappingon} +% Paul (\texttt{paulaugust2003@yahoo.com}) found that wrapped verbatims in +% a list environment (e.g. \texttt{itemize}) were not indented although +% regular verbatims were. +% +% \cs{raggedwrap} is a variation on \cs{raggedright} (\cs{leftskip} is set +% to \cs{@totalleftmargin} instead of 0pt). Hopefully this fix will not +% mess up any existing wrapped verbatims. +% \changes{v4.4}{2006/01/16}{Fixed surprise in wrapped verbatims} +% \begin{macrocode} +%%% Fix for wrapped verbatims in list environments. +\newcommand*{\raggedwrap}{% + \@rightskip\@flushglue + \rightskip\@rightskip + \leftskip\@totalleftmargin + \parindent\ragrparindent} +\renewcommand*{\wrappingon}{% + \def\@xobeysp{~\discretionary{\verbatimbreakchar}% + {\kern\verbatimindent}{}}% + \def\wrapright{\raggedwrap}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Page after a Part heading} +% +% \begin{macro}{\partblankpage} +% \begin{macro}{\nopartblankpage} +% \begin{macro}{\ifm@mnopartnewpage} +% \begin{macro}{\m@mnopartnewpagetrue} +% \begin{macro}{\m@mnopartnewpagefalse} +% \begin{macro}{\@endpart} +% Code to prevent a \cs{part} outputting a blank page. Provided by +% Frederic Connes. +% \changes{v4.4}{2006/01/15}{Added controls for \cs{part} blank pages} +% \begin{macrocode} +%%% Use the \nopartblankpage declaration if you don't want a blank +%%% page after a Part title page. The default is set by \partblankpage. +\newif\ifm@mnopartnewpage +\newcommand*{\partblankpage}{\m@mnopartnewpagefalse} +\newcommand*{\nopartblankpage}{\m@mnopartnewpagetrue} + +\renewcommand*{\@endpart}{\afterpartskip + \ifm@mnopartnewpage + \else + \if@twoside + \if@openright + \null + \thispagestyle{afterpart}% + \newpage + \fi + \fi + \fi + \if@tempswa + \twocolumn + \fi} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\partnumberline} +% Let's make sure that there is a space between the part number and +% title in the ToC. +% \changes{v4.4}{2006/01/16}{Added space after part number in ToC} +% \begin{macrocode} +\renewcommand{\partnumberline}[1]{% + \hb@xt@\@tempdima{% + \cftpartname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb\space} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ps@afterpart} +% \begin{macro}{\ps@book} +% \begin{macro}{\ps@afterbook} +% Some new page styles for the page after a Part page, and a Book and +% its following page. +% \begin{macrocode} +\aliaspagestyle{afterpart}{empty} +\aliaspagestyle{book}{empty} +\aliaspagestyle{afterbook}{empty} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Book document division} +% +% Frederic Connes tells me that in French typography there is often +% a sectional division above Part. He called this \cs{superpart} but +% I think that \cs{book} more closely resembles the English usage. +% He provided code for implementing his \cs{superpart}. (I have just +% checked and the Chicago Manual of Style does have an example of +% a Book, Part, Chapter, Subsection hierarchy). +% +% \begin{macro}{\book} +% \begin{macro}{\book*} +% Here we go with a \cs{book} division. +% \changes{v4.4}{2006/01/15}{Added a \cs{book} division with all that that entails} +% \begin{macrocode} +%%% The \book (and \book*) document division is one level higher than +%%% a \cs{part}. It has the same kind of controls over its appearance in +%%% the body of the document and in the ToC as \part has. +\newcommand*{\book}{% + \@setupbook + \secdef\@book\@sbook} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bookmark} +% \begin{macro}{\c@book} +% \begin{macro}{\thebook} +% \begin{macro}{\theHbook} +% \begin{macro}{\toclevel@book} +% Start of the setting up. \cs{theHbook} and \cs{toclevel@book} are for +% \Lpack{hyperref} +% \begin{macrocode} +\newcommand*{\bookmark}[1]{} +\newcounter{book} \setcounter{book}{0} +\renewcommand*{\thebook}{\Roman{book}} +\newcommand*{\theHbook}{\arabic{book}} +\newcommand*{\toclevel@book}{-2} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\beforebookskip} +% \begin{macro}{\midbookskip} +% \begin{macro}{\afterbookskip} +% \begin{macrocode} +\newcommand*{\beforebookskip}{\null\vfil} +\newcommand*{\midbookskip}{\par \vskip 2\baselineskip} +\newcommand*{\afterbookskip}{\vfil\newpage} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@setupbook} +% Start off the book page. +% \begin{macrocode} +\newcommand*{\@setupbook}{% + \if@openright + \cleardoublepage + \else + \clearpage + \fi + \thispagestyle{book}% + \if@twocolumn + \@tempswatrue + \else + \@tempswafalse + \fi + \beforebookskip} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bookname} +% \begin{macro}{\booknamefont} +% \begin{macro}{\booknumfont} +% \begin{macro}{\booktitlefont} +% Specify the typesetting styles. +% \begin{macrocode} +\newcommand*{\bookname}{Book} +\newcommand*{\booknamefont}{\normalfont\huge\bfseries} +\newcommand*{\booknumfont}{\normalfont\huge\bfseries} +\newcommand*{\booktitlefont}{\normalfont\Huge\bfseries} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\printbookname} +% \begin{macro}{\booknamenum} +% \begin{macro}{\printbooknum} +% \begin{macro}{\printbooktitle} +% \begin{macrocode} +\newcommand*{\printbookname}{\booknamefont \bookname} +\newcommand*{\booknamenum}{\space} +\newcommand*{\printbooknum}{\booknumfont \thebook} +\newcommand{\printbooktitle}[1]{\booktitlefont #1} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\membookinfo} +% \begin{macro}{\membookstarinfo} +% \begin{macrocode} +\newcommand*{\membookinfo}[3]{} +\newcommand*{\membookstarinfo}[1]{} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@book} +% \begin{macro}{\@sbook} +% \begin{macrocode} +\long\def\@book[#1]#2{% + \M@gettitle{#1}% + \phantomsection + \ifnum\c@secnumdepth > -3\relax + \refstepcounter{book}% + \addcontentsline{toc}{book}% + {\protect\booknumberline{\thebook}#1}% + \membookinfo{\thebook}{#1}{#2}% + \else + \addcontentsline{toc}{book}{#1}% + \membookinfo{}{#1}{#2}% + \fi + \bookmark{#1}% + {\centering + \interlinepenalty \@M + \normalfont + \ifnum \c@secnumdepth >-3\relax + \printbookname \booknamenum \printbooknum + \midbookskip + \fi + \printbooktitle{#2}\par}% + \@endbook} + +\def\@sbook#1{% + \M@gettitle{#1}% + \phantomsection + \membookstarinfo{#1}% + {\centering + \interlinepenalty \@M + \normalfont + \printbooktitle{#1}\par}% + \@endbook} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bookblankpage} +% \begin{macro}{\nobookblankpage} +% \begin{macro}{\ifm@mnobooknewpage} +% \begin{macro}{\m@mnobooknewpagetrue} +% \begin{macro}{\m@mnobooknewpagefalse} +% \begin{macro}{\@endbook} +% Code to prevent a \cs{book} outputting a blank page. Provided by +% Frederic Connes. +% \changes{v4.4}{2006/01/15}{Added controls for \cs{book} blank pages} +% \begin{macrocode} +%%% Use the \nobookblankpage declaration if you don't want a blank +%%% page after a Book title page. The default is set by \bookblankpage. +\newif\ifm@mnobooknewpage +\newcommand*{\bookblankpage}{\m@mnobooknewpagefalse} +\newcommand*{\nobookblankpage}{\m@mnobooknewpagetrue} + +\newcommand*{\@endbook}{\afterbookskip + \ifm@mnobooknewpage + \else + \if@twoside + \if@openright + \null + \thispagestyle{afterbook}% + \newpage + \fi + \fi + \fi + \if@tempswa + \twocolumn + \fi} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cftbookname} +% \begin{macro}{\l@book} +% \begin{macro}{\booknumberline} +% Now for the ToC entry. +% \begin{macrocode} +\newcommand*{\cftbookname}{} +\newcommand*{\l@book}[2]{% + \ifnum\c@tocdepth >-3\relax + \addpenalty{-\@highpenalty}% + \addvspace{\cftbeforebookskip}% + \begingroup + {\leftskip \cftbookindent\relax + \rightskip \@tocrmarg + \parfillskip -\rightskip + \parindent \cftbookindent\relax\@afterindenttrue + \interlinepenalty\@M + \leavevmode + \settowidth{\@tempdima}{\cftbookfont\cftbookname}% + \addtolength{\@tempdima}{\cftbooknumwidth}% + \let\@cftbsnum \cftbookpresnum + \let\@cftasnum \cftbookaftersnum + \let\@cftasnumb \cftbookaftersnumb + \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip + {\cftbookfont #1}% + \cftbookfillnum{#2}} + \nobreak + \global\@nobreaktrue + \everypar{\global\@nobreakfalse\everypar{}}% + \endgroup + \fi} +\newcommand{\booknumberline}[1]{% + \hb@xt@\@tempdima{% + \cftbookname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb\space} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cftbeforebookskip} +% \begin{macro}{\cftbookindent} +% \begin{macro}{\cftbooknumwidth} +% \begin{macro}{\cftbookfont} +% \begin{macro}{\cftbookpresnum} +% \begin{macro}{\cftbookaftersnum} +% \begin{macro}{\cftbookaftersnumb} +% \begin{macro}{\cftbookleader} +% \begin{macro}{\cftbookdotsep} +% \begin{macro}{\cftbookpagefont} +% \begin{macro}{\cftbookafterpnum} +% \begin{macro}{\cftbookfillnum} +% \begin{macrocode} +% ToC layout parameters. +\newlength{\cftbeforebookskip} + \setlength{\cftbeforebookskip}{2.25em \@plus\p@} +\newdimen\cftbookindent + \setlength{\cftbookindent}{0em} +\newdimen\cftbooknumwidth + \setlength{\cftbooknumwidth}{1.5em} +\newcommand*{\cftbookfont}{\large\bfseries} +\newcommand*{\cftbookpresnum}{} +\newcommand*{\cftbookaftersnum}{} +\newcommand*{\cftbookaftersnumb}{} +\newcommand*{\cftbookleader}{% + \large\bfseries\cftdotfill{\cftbookdotsep}} +\newcommand*{\cftbookdotsep}{\cftnodots} +\newcommand*{\cftbookpagefont}{\large\bfseries} +\newcommand{\cftbookafterpnum}{} +\newcommand{\cftbookfillnum}[1]{% + {\cftbookleader}% + {\hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}}% + \cftbookafterpnum\par} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@setclcnt} +% Add the book to \cs{@setclcnt} +% \begin{macrocode} +\renewcommand*{\@setclcnt}[2]{% + \@tempswafalse + \nametest{#1}{none}% + \ifsamename + \setcounter{#2}{-10}% + \@tempswatrue + \fi + \nametest{#1}{book}% + \ifsamename + \setcounter{#2}{-2}% + \@tempswatrue + \fi + \nametest{#1}{part}% + \ifsamename + \setcounter{#2}{-1}% + \@tempswatrue + \fi + \nametest{#1}{chapter}% + \ifsamename + \setcounter{#2}{0}% + \@tempswatrue + \fi + \nametest{#1}{section}% + \ifsamename + \setcounter{#2}{1}% + \@tempswatrue + \fi + \nametest{#1}{subsection}% + \ifsamename + \setcounter{#2}{2}% + \@tempswatrue + \fi + \nametest{#1}{subsubsection}% + \ifsamename + \setcounter{#2}{3}% + \@tempswatrue + \fi + \nametest{#1}{paragraph}% + \ifsamename + \setcounter{#2}{4}% + \@tempswatrue + \fi + \nametest{#1}{subparagraph}% + \ifsamename + \setcounter{#2}{5}% + \@tempswatrue + \fi + \nametest{#1}{all}% + \ifsamename + \setcounter{#2}{50}% + \@tempswatrue + \fi + \if@tempswa\else + \@memerror{% + Unknown document division name (#1) + }{% + I'll ignore it. + Type \space <return> and I'll continue.\MessageBreak + If you haven't mistyped the name then use + \protect\setcounter\space instead.}% + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\settocdepth} +% Add \cs{book} to ToC depth setting. +% \begin{macrocode} +\renewcommand*{\settocdepth}[1]{% + \@tempswafalse + \nametest{#1}{none}% + \ifsamename + \addtocontents{toc}{\changetocdepth{-10}}% + \@tempswatrue + \fi + \nametest{#1}{book}% + \ifsamename + \addtocontents{toc}{\changetocdepth{-2}}% + \@tempswatrue + \fi + \nametest{#1}{part}% + \ifsamename + \addtocontents{toc}{\changetocdepth{-1}}% + \@tempswatrue + \fi + \nametest{#1}{chapter}% + \ifsamename + \addtocontents{toc}{\changetocdepth{0}}% + \@tempswatrue + \fi + \nametest{#1}{section}% + \ifsamename + \addtocontents{toc}{\changetocdepth{1}}% + \@tempswatrue + \fi + \nametest{#1}{subsection}% + \ifsamename + \addtocontents{toc}{\changetocdepth{2}}% + \@tempswatrue + \fi + \nametest{#1}{subsubsection}% + \ifsamename + \addtocontents{toc}{\changetocdepth{3}}% + \@tempswatrue + \fi + \nametest{#1}{paragraph}% + \ifsamename + \addtocontents{toc}{\changetocdepth{4}}% + \@tempswatrue + \fi + \nametest{#1}{subparagraph}% + \ifsamename + \addtocontents{toc}{\changetocdepth{5}}% + \@tempswatrue + \fi + \nametest{#1}{all}% + \ifsamename + \addtocontents{toc}{\changetocdepth{50}}% + \@tempswatrue + \fi + \if@tempswa +% \end{macrocode} +% The next bit is from Heiko Oberdiek (CTT {\itshape Re: Memoir, \verb?\settocdepth? +% and pdflatex \verb?=>? problem with PDF bookmarks}, 2006/07/21) as +% \Lpack{hyperref} needs \verb?\tocdepth? set in the body not just in the ToC. +% \begin{macrocode} + \@ifundefined{toclevel@#1}{% + @memwarn{Unknown toclevel for #1}% + }{% + \setcounter{tocdepth}{\@nameuse{toclevel@#1}}% + } + \else + \@memerror{% + Unknown document division name (#1) + }{% + I'll ignore it. + Type \space <return> and I'll continue.}% + \fi} + +% \end{macrocode} +% \end{macro} +% +% \section{Mempatch version 4.5} +% +% \begin{macrocode} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Version 4.5 (2006/02/11 and later) + +% \end{macrocode} +% +% \subsection{Odds and ends} +% +% \begin{macro}{\DisemulatePackage} +% Undoes an \cs{EmulatedPackage} +% \begin{macrocode} +%%% \DisemulatePackage{pack} undoes a previous \EmulatedPackage{pack}. +%%% For example \DisemulatePackage{index} if you need to use the index package. +\providecommand*{\DisemulatePackage}[1]{% + \@namelet{ver@#1.\@pkgextension}\relax} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@nameedef} +% Add a missing \verb?%? (noticed by Lars Madsen). +% \begin{macrocode} +\renewcommand{\@nameedef}[1]{% + \expandafter\protected@edef\csname #1\endcsname} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@smemmain} +% Change the timing of \cs{clear[double]page}. Problem noted by David Wilson +% \url{David.Wilson@murdoch.edu.au} in email dated 2006/01/29. It now matches +% the other \cs{...matter} macros. +% \begin{macrocode} +%%% change timing of \@mainmattertrue in \@smemmain +\renewcommand*{\@smemmain}{% + \ifartopt + \clearpage + \else + \cleardoublepage + \counterwithin{figure}{chapter}% + \counterwithin{table}{chapter}% + \fi + \@mainmattertrue + \setcounter{secnumdepth}{\value{maxsecnumdepth}}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@footnotetext} +% This was fixed in v1.618, except that I unfixed it later in the class file. +% This really should be done in a new class release, but it's not time for +% that yet. +% \begin{macrocode} +\renewcommand{\@footnotetext}[1]{% + \reset@font\m@mold@footnotetext{#1}\m@mmf@prepare} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifm@mpn@new@chap} +% \begin{macro}{\m@mpn@new@chapfalse} +% \begin{macro}{\m@mpn@new@chaptrue} +% \begin{macro}{\ifm@mpn@new@schap} +% \begin{macro}{\m@mpn@new@schapfalse} +% \begin{macro}{\m@mpn@new@schaptrue} +% These are for supporting the page/end notes, flagging that a +% \verb?\chapter(*)? has been called. +% \begin{macrocode} +\newif\ifm@mpn@new@chap + \m@mpn@new@chapfalse +\newif\ifm@mpn@new@schap + \m@mpn@new@schapfalse + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@chapter} +% \begin{macro}{\f@rbdy} +% Fix from Lars Madsen for mistiming \verb?\chaptermark? in articles. +% Also adding \verb?\m@m@new@chap? flag, and setting \verb?\f@rbdy? +% to the chapter title for the body of the text. +% \begin{macrocode} +%%% Fix for mistiming of \chaptermark with article option +\def\@chapter[#1]#2{% + \m@mpn@new@chaptrue + \def\f@rbdy{#2}% + \ifx\ch@pt@c\@empty % no optional args + \def\f@rtoc{#2}% + \def\f@rhdr{#2}% + \else % at least one opt arg + \let\f@rtoc\ch@pt@c + \ifx\@empty#1\@empty + \let\f@rhdr\ch@pt@c + \else + \def\f@rhdr{#1}% + \fi + \fi + \m@m@Andfalse + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \m@m@Andtrue + \fi + \fi + \ifm@m@And + \refstepcounter{chapter}% + \fi + \ifartopt + \@makechapterhead{#2}% + \@afterheading + \chaptermark{\f@rhdr}% + \else + \chaptermark{\f@rhdr}% + \insertchapterspace + \if@twocolumn + \@topnewpage[\@makechapterhead{#2}]% + \else + \@makechapterhead{#2}% + \fi + \@afterheading + \fi + \ifm@m@And + \ifanappendix + \addcontentsline{toc}{appendix}{% + \protect\chapternumberline{\thechapter}\f@rtoc}% + \memappchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}% + \else + \addcontentsline{toc}{chapter}{% + \protect\chapternumberline{\thechapter}\f@rtoc}% + \memchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}% + \fi + \else + \addcontentsline{toc}{chapter}{\f@rtoc}% + \ifanappendix + \memappchapinfo{}{\f@rtoc}{\f@rhdr}{#2}% + \else + \memchapinfo{}{\f@rtoc}{\f@rhdr}{#2}% + \fi + \fi + \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{\f@rtoc}\fi} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@schapter} +% \begin{macro}{\@m@mschapter} +% Make the same page/end note extensions to \verb?\@schapter?. +% \begin{macrocode} +\renewcommand{\@schapter}[1]{% + \m@mpn@new@schaptrue + \def\f@rbdy{#1}% + \ifartopt + \@makeschapterhead{#1}% + \else + \if@twocolumn + \@topnewpage[\@makeschapterhead{#1}] + \else + \@makeschapterhead{#1}% + \fi + \fi + \@afterheading} +\renewcommand{\@m@mschapter}[2][\@empty]{% + \@schapter{#2}% + \ifx \@empty#1 + \def\f@rhdr{#2}% + \else + \def\f@rhdr{#1}% + \setcounter{secnumdepth}{-10}% + \chaptermark{#1}% + \setcounter{secnumdepth}{\value{maxsecnumdepth}}% + \fi + \ifanappendix + \memappchapstarinfo{\f@rhdr}{#2}% + \else + \memchapstarinfo{\f@rhdr}{#2}% + \fi + \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{#2}\fi} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \subsection{Switch trims on/off} +% +% \begin{macro}{\showtrimson} +% \begin{macro}{\showtrimsoff} +% \begin{macro}{\mem@shipii} +% Switch trimming marks off and on. Requested by a James Hunt on CTT, +% \emph{Are crop marks needed on every page?}, February 2006. +% \begin{macrocode} +%%%% Use \showtrimsoff and \showtrimson to switch trim marks off and on. +%%%% If the showtrims option has not been used, these do nothing. +\newcommand*{\showtrimsoff}{\showtrimsfalse} +\newcommand*{\showtrimson}{\showtrimstrue} +\renewcommand*{\mem@shipii}{% + \ifvoid\@cclv + \mem@oldshipout\box\@cclv + \else + \ifshowtrims + \mem@oldshipout\vbox{\trimmarks\unvbox\@cclv}% + \else + \mem@oldshipout\box\@cclv + \fi + \fi} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Sidepars} +% +% \begin{macro}{\@sidepar} +% Sidepars have a nasty habit of moving up or down depending on whether +% characters in the sidepar and the main text line have ascenders and/or +% descenders. The length \verb?\sideparvshift? was provided to +% enable adjustments. This code from Dan Luecking +% (CTT \textit{Re: sidepars drift up a point}, 2006/04/11) does a much +% better job, +% and the default for \verb?\sideparvshift? is now 0pt. +% \begin{macrocode} +%%%% Fix to stop \sidepars moving up or down +\long\def\@sidepar[#1]#2{\@bsphack\strut\vadjust{% + \checkoddpage + \ifsideparswitch + \ifreversesidepar + \ifoddpage + \oddpagefalse + \else + \oddpagetrue + \fi + \fi + \else + \oddpagetrue + \ifreversesidepar + \oddpagefalse + \fi + \fi + \rlap{\kern-\parindent + \if@twocolumn + \if@firstcolumn% put at left + \kern -\marginparsep \kern -\marginparwidth + \else% put at right + \kern \columnwidth \kern \marginparsep + \fi + \else + \ifoddpage% put at right + \kern \textwidth \kern \marginparsep + \else% put at left + \kern -\marginparsep \kern -\marginparwidth + \fi + \fi + \setbox0=\vtop to 0pt{% + \begin{minipage}[t]{\marginparwidth}% + \ifoddpage #2\else #1\fi% + \end{minipage}% + \vss}% + \vtop to 0pt{\kern\sideparvshift% default should be 0pt + \kern-\dp\strutbox + \kern-\ht0 + \box0 \vss}}}% + \@esphack} +\setlength{\sideparvshift}{0pt} + +% \end{macrocode} +% \end{macro} +% +% \subsection{Anonymous divisions} +% +% \begin{macro}{\@fbreak} +% \begin{macro}{\@sfbreak} +% The \verb?\fancybreak? macros start a paragraph and so should end it as well, +% as noted by Dan Luecking (CTT \textit{Re: Appendix Package - adding +% semicolon ``:'' after appendix letter in ToC} 2006/04/20). +% +% \begin{macrocode} +%%%% Ensure that fancybreaks close the paragraph they start +\renewcommand{\@fbreak}[1]{\par + \penalty -100 + \noindent\parbox{\linewidth}{\centering #1}% + \par +% \penalty -20 + \@afterindentfalse + \@afterheading} +\renewcommand{\@sfbreak}[1]{\par + \penalty -100 + \noindent\parbox{\linewidth}{\centering #1}% + \par +% \penalty -20 + \@afterindenttrue + \@afterheading} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Vertically center text} +% +% \begin{environment}{vplace} +% An environment which centers its body vertically. This is more robust +% than that proposed in the manual. The optional argument, which is a +% (decimal) number, increases ($>1.0$) or decreases ($<1.0$) the space +% above the body with respect to that below. +% \begin{macrocode} +%%%% \begin{vplace}[<num>] vertically centered stuff \end{vplace} +%%%% <num> adjusts above space wrt to below space +\newenvironment{vplace}[1][1]{% + \par\vspace*{\stretch{#1}}% +}{% + \vspace*{\stretch{1}}% + \par} + +% \end{macrocode} +% \end{environment} +% +% \subsection{End notes} +% +% This is from the \Lpack{pagenote} package, with minor amendments. +% +% \begin{macrocode} +%%%% +%%%% Include the functions of the pagenote package +%%%% + +% \end{macrocode} +% +% \begin{macro}{\ifm@mpnpageopt} +% \begin{macro}{\ifm@mpncontopt} +% We need two flags for the options. +% \begin{macrocode} +\newif\ifm@mpnpageopt + \m@mpnpageoptfalse +\newif\ifm@mpncontopt + \m@mpncontoptfalse +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\notepageref} +% \begin{macro}{\continuousnotenums} +% Let the user change the default options. +% \begin{macrocode} +\newcommand*{\notepageref}{\m@mpnpageopttrue} +\newcommand*{\continuousnotenums}{% + \counterwithout{pagenote}{chapter} + \renewcommand{\thepagenote}{\arabic{pagenote}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\c@pagenote} +% \begin{macro}{\thepagenote} +% We need a counter for the notes. Just how it is defined depends on the +% \Lopt{continuous} option. +% \begin{macrocode} +%\ifm@mpncontopt +% \newcounter{pagenote} +%\else + \newcounter{pagenote}[chapter] +%\fi +\renewcommand{\thepagenote}{\arabic{pagenote}} +\setcounter{pagenote}{0} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\ifmempagenotes} +% Need to check if notes are required. +% \begin{macrocode} +\newif\ifmempagenotes + \mempagenotesfalse + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\makepagenote} +% This sets up the note file. At the end it emasculates itself so it can only +% be used once. +% \begin{macrocode} +\newcommand*{\makepagenote}{% + \newwrite\@notefile + \immediate\openout\@notefile=\jobname.ent + \mempagenotestrue +% \end{macrocode} +% \begin{macro}{\pagenote} +% Make sure that this has a useful definition. +% \begin{macrocode} + \def\pagenote{\@bsphack\begingroup + \@sanitize + \m@m@wrpnote}% +% \end{macrocode} +% \end{macro} +% \begin{macrocode} + \typeout{Writing note file \jobname.ent}% + \let\makepagenote\@empty} + +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\immediate@protected@write} +% We might have to do some immediate writes. This is an immediate +% version of the kernel \verb?\protected@write?. +% \begin{macrocode} +\newcommand{\immediate@protected@write}[3]{% + \begingroup + #2% + \let\protect\@unexpandable@protect + \edef\reserved@a{\immediate\write#1{#3}}% + \reserved@a + \endgroup + \if@nobreak\ifvmode\nobreak\fi\fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@m@pnwrite} +% If the \Lopt{page} option is used we cannot use an immediate write +% because the page number is only known in the output routine. +% \begin{macrocode} +\ifm@mpnpageopt + \let\m@m@pnwrite\protected@write +\else + \let\m@m@pnwrite\immediate@protected@write +\fi + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pnchap} +% \begin{macro}{\pnschap} +% Redefine these for different subheadings in the notes list. +% \begin{macrocode} +\newcommand*{\pnchap}{\f@rtoc} +\newcommand*{\pnschap}{\f@rbdy} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\m@m@wrpnote} +% This writes the note information to the note file. It first increments the +% note counter and calls \verb?\notenumintext? to handle its appearance in +% the body text. +% \begin{macrocode} +\newcommand{\m@m@wrpnote}[2][]{% + \refstepcounter{pagenote}% + \notenumintext{\thepagenote}% +% \end{macrocode} +% Check if this is the first note in a division, and if so indicate this +% in the file. +% \begin{macrocode} + \ifm@mpn@new@chap + \global\m@mpn@new@chapfalse + \addtonotes{\string\pagenotesubhead{\@chapapp}{\thechapter}{\pnchap}}% + \fi + \ifm@mpn@new@schap + \global\m@mpn@new@schapfalse + \addtonotes{\string\pagenotesubhead{\@chapapp}{}{\pnschap}}% + \fi +% \end{macrocode} +% Finally, write the entry. +% \begin{macrocode} + \m@m@pnwrite\@notefile{} + {\string\noteentry{\thepagenote}{#1}{#2}{\thepage}}% + \endgroup + \@esphack} + +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\pagenote} +% The user command to generate a note. It is given substance +% by \verb?\makepagenote?. +% \begin{macrocode} +\def\pagenote{\@bsphack\begingroup \@sanitize\m@m@pagenote} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@m@pagenote} +% \begin{macrocode} +\newcommand{\m@m@pagenote}[2][]{\endgroup\@esphack} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pagetofootnote} +% \begin{macro}{\foottopagenote} +% \begin{macro}{\memsavefootnote} +% \begin{macro}{\memsavepagenote} +% Let the user change pagenotes to footnotes, or vice-versa. In either +% case the optional argument is ignored. +% \begin{macrocode} +\newcommand*{\pagetofootnote}{% + \let\memsavepagenote\pagenote + \renewcommand{\pagenote}[2][]{\footnote{##2}}} +\newcommand*{\foottopagenote}{% + \let\memsavefootnote\footnote + \renewcommand*{\footnote}[2][]{\pagenote{##2}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\addtonotes} +% \verb?\addtonotes?\marg{text} puts \meta{text} into the notes file. +% \begin{macrocode} +\newcommand{\addtonotes}[1]{% + \ifmempagenotes + \IfFileExists{\jobname.ent}{\m@m@pnwrite\@notefile{}{#1}}{\mempnofilewarn}% +\fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\notenumintext} +% \begin{macro}{\notenuminnotes} +% \verb?\notenumintext?\marg{notenum} typesets \meta{notenum} (in the body text). +% \begin{macrocode} +\newcommand{\notenumintext}[1]{% + \textsuperscript{#1}} +% \end{macrocode} +% \verb?\notenuminnotes?\marg{notenum} typesets \meta{notenum} (as part of the note). +% \begin{macrocode} +\newcommand{\notenuminnotes}[1]{% + {\normalfont #1.}\space} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\noteentry} +% \verb?\noteentry?\marg{notenum}\marg{id}\marg{pagenum}\marg{text} +% typesets a note. +% \begin{macrocode} +\newcommand{\noteentry}[4]{% + \prenoteinnotes + \noteidinnotes{#1}{#2}\pageinnotes{#4}\noteinnotes{#3}% + \postnoteinnotes} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\idtextinnotes} +% \verb?\idtextinnotes?\marg{id text} typesets the note's \meta{id text}. +% \begin{macrocode} +\newcommand{\idtextinnotes}[1]{% + [#1]\space} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\noteidinnotes} +% \verb?\noteidinnotes?\marg{notenum}\marg{id} is used to typeset the note +% identification (in the note listing). It is set so that it typesets the +% \meta{id} if it is not empty, otherwise it sets the \meta{notenum}. +% \begin{macrocode} +\newcommand{\noteidinnotes}[2]{% + \@ifmtarg{#2}{% + \notenuminnotes{#1}}{\idtextinnotes{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pageinnotes} +% \begin{macro}{\printpageinnotes} +% \verb?\pageinnotes?\meta{pagenum} calls +% \verb?\printpageinnotes?\marg{pagenum} to typeset the originating +% page number (in the note), but only if the \verb?\notepageref? declaration +% has been used (the page number is not trustworthy unless the +% \verb?\notepageref? has been used). +% \begin{macrocode} +\newcommand{\pageinnotes}[1]{% + \ifm@mpnpageopt \printpageinnotes{#1}\fi} +\newcommand*{\printpageinnotes}[1]{% + (\pagerefname\ #1)\space} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\noteinnotes} +% \verb?\noteinnotes?\marg{text} is used to typeset the note's text +% (in the note list). +% \begin{macrocode} +\newcommand{\noteinnotes}[1]{#1} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\prenoteinnotes} +% \begin{macro}{\postnoteinnotes} +% These are called immediately before and after the note information is +% typeset. +% \begin{macrocode} +\newcommand{\prenoteinnotes}{\par\noindent} +\newcommand{\postnoteinnotes}{\par} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\notesname} +% \begin{macro}{\notedivision} +% Heading for note list. +% \begin{macrocode} +\providecommand*{\notesname}{Notes} +\newcommand*{\notedivision}{\chapter{\notesname}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\printnotes} +% \begin{macro}{\printpagenotes*} +% User commands to print the note file. +% \begin{macrocode} +\newcommand*{\printpagenotes}{\@ifstar{\@sprintpagenotes}{\@printpagenotes}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\mempnofilewarn} +% Warning when the notes file does not exist. +% \begin{macrocode} +\newcommand*{\mempnofilewarn}{% + \ClassWarning{memoir}{There is no .ent file}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@sprintpagenotes} +% Macro implementing \verb?\printpagenotes*?. +% \begin{macrocode} +\newcommand*{\@sprintpagenotes}{% + \ifmempagenotes + \notedivision +\IfFileExists{\jobname.ent}{% + \immediate\closeout\@notefile + \input{\jobname.ent}% + \immediate\openout\@notefile=\jobname.ent% + }{% + \mempnofilewarn +}% +\fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@printpagenotes} +% Macro implementing \verb?\printpagenotes?. +% \begin{macrocode} +\newcommand*{\@printpagenotes}{% + \ifmempagenotes + \notedivision + \IfFileExists{\jobname.ent}{% + \immediate\closeout\@notefile + \input{\jobname.ent}% + }{% + \mempnofilewarn + } + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pagenotesubhead} +% The section heading before each set of notes. \\ +% \verb?\pagenotesubhead?\marg{chaptername}\marg{number}\marg{title} +% \begin{macrocode} +\newcommand*{\pagenotesubhead}[3]{% + \section*{#1 #2 #3}} + +% \end{macrocode} +% \end{macro} +% +% Prevent loading of the \Lpack{pagenote} package. +% \begin{macrocode} +\EmulatedPackage{pagenote} + +% \end{macrocode} +% +% \subsection{ToC, LoF, etc lists} +% +% Lars Madsen suggested that macros like \verb?\cftfigurename? be added for use +% in the LoF, and so on. +% +% \begin{macro}{\@cftn@me} +% \begin{macro}{\numberline} +% \begin{macrocode} +\newcommand*{\@cftn@me}{} +\renewcommand*{\numberline}[1]{% + \hb@xt@\@tempdima{\@cftn@me\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\newlistentry} +% Extend \cs{newlistentry} to add \cs{cftXname}. +% \begin{macrocode} +\renewcommand*{\newlistentry}[4][\@empty]{% + \@ifundefined{c@#2}{% check & set the counter + \ifx \@empty#1\relax + newcounter{#2}% + \else + \newcounter{#2}[#1]% + \expandafter\edef\csname the#2\endcsname{% + \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}% + \fi}{} + \setcounter{#2}{0} + \@namedef{l@#2}##1##2{% + \ifnum \@nameuse{c@#3depth} > #4\relax + \vskip \@nameuse{cftbefore#2skip}% + {\leftskip \@nameuse{cft#2indent}\relax + \rightskip \@tocrmarg + \parfillskip -\rightskip + \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue + \interlinepenalty\@M + \leavevmode + \settowidth{\@tempdima}{\@nameuse{cft#2font}\@nameuse{cft#2name}}% + \addtolength{\@tempdima}{\@nameuse{cft#2numwidth}}% +\expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname +\expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname +\expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname +\expandafter\let\expandafter\@cftn@me\csname cft#2name\endcsname + \advance\leftskip\@tempdima \null\nobreak\hskip -\leftskip + {\@nameuse{cft#2font}##1}\nobreak + \@nameuse{cft#2fillnum}{##2}} + \fi + }% end of \l@#2 + \expandafter\newlength\csname cftbefore#2skip\endcsname + \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@} + \expandafter\newlength\csname cft#2indent\endcsname + \expandafter\newlength\csname cft#2numwidth\endcsname + \ifcase #4\relax% 0 (level 1) + \setlength{\@nameuse{cft#2indent}}{0em} + \setlength{\@nameuse{cft#2numwidth}}{2.3em} + \or% 1 (level 2) + \setlength{\@nameuse{cft#2indent}}{2.3em} + \setlength{\@nameuse{cft#2numwidth}}{3.2em} + \or% 2 (level 3) + \setlength{\@nameuse{cft#2indent}}{5.5em} + \setlength{\@nameuse{cft#2numwidth}}{4.1em} + \or% 3 (level 4) + \setlength{\@nameuse{cft#2indent}}{8.5em} + \setlength{\@nameuse{cft#2numwidth}}{5.0em} + \else% anything else + \setlength{\@nameuse{cft#2indent}}{10.5em} + \setlength{\@nameuse{cft#2numwidth}}{6.0em} + \fi + \@namedef{cft#2font}{\normalfont} + \@namedef{cft#2name}{} + \@namedef{cft#2presnum}{} + \@namedef{cft#2aftersnum}{} + \@namedef{cft#2aftersnumb}{} + \@namedef{cft#2dotsep}{\cftdotsep} + \@namedef{cft#2leader}{\normalfont\cftdotfill{\@nameuse{cft#2dotsep}}} + \@namedef{cft#2pagefont}{\normalfont} + \@namedef{cft#2afterpnum}{} + \@namedef{cft#2toclevel@#2}{#4} + \@namedef{cft#2fillnum}##1{% + {\@nameuse{cft#2leader}}\nobreak + \hb@xt@\@pnumwidth{% + \hfil\@nameuse{cft#2pagefont}##1}\@nameuse{cft#2afterpnum}\par} +}% end of \newlistentry + +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\let\cftbeforesectionskip\relax +\let\cftsectionindent\relax +\let\cftsectionnumwidth\relax +\newlistentry[chapter]{section}{toc}{0} + \cftsetindents{section}{1.5em}{2.3em} +\let\cftbeforesubsectionskip\relax +\let\cftsubsectionindent\relax +\let\cftsubsectionnumwidth\relax +\newlistentry[section]{subsection}{toc}{1} + \cftsetindents{subsection}{3.8em}{3.2em} +\let\cftbeforesubsubsectionskip\relax +\let\cftsubsubsectionindent\relax +\let\cftsubsubsectionnumwidth\relax +\newlistentry[subsection]{subsubsection}{toc}{2} + \cftsetindents{subsubsection}{7.0em}{4.1em} +\let\cftbeforeparagraphskip\relax +\let\cftparagraphindent\relax +\let\cftparagraphnumwidth\relax +\newlistentry[subsubsection]{paragraph}{toc}{3} + \cftsetindents{paragraph}{10.0em}{5.0em} +\let\cftbeforesubparagraphskip\relax +\let\cftsubparagraphindent\relax +\let\cftsubparagraphnumwidth\relax +\newlistentry[paragraph]{subparagraph}{toc}{4} + \cftsetindents{subparagraph}{12.0em}{6.0em} + +% \end{macrocode} +% +% \begin{macrocode} +\let\cftbeforefigureskip\relax +\let\cftfigureindent\relax +\let\cftfigurenumwidth\relax +\newlistentry[chapter]{figure}{lof}{0} + \cftsetindents{figure}{0em}{2.3em} +\let\cftbeforetableskip\relax +\let\cfttableindent\relax +\let\cfttablenumwidth\relax +\newlistentry[chapter]{table}{lot}{0} + \cftsetindents{table}{0em}{2.3em} + +% \end{macrocode} +% +% \subsection{Page layout} +% +% Morten H{\o}gholm suggested (2006/07/26) that instead of using TeX syntax I should use +% \verb?\setlength? when setting up the page layout so that the \Lpack{calc} +% package can be used, e.g. \\ +% \verb?\settypeblocksize{41\baselineskip+\topskip}{310pt}{*}? +% +% +% \begin{macro}{\setrectanglesize} +% The macro \cs{setrectanglesize}\marg{H}\marg{W}\marg{r} +% calculates the height and width of a rectangle given any two out of +% the three arguments. An unvalued argument is denoted by \texttt{*}. +% +% Table~\ref{tab:setrect} shows the argument combinations and the result +% for each combination. +% \begin{table} +% \centering +% \caption{Arguments and results for \cs{setrectanglesize}}\label{tab:setrect} +% \begin{tabular}{ccc|l} \hline +% H & W & r & Result \\ \hline +% * & W & r & $H = rW$ \\{} +% * & W & * & $H = W$ \\{} +% * & * & r & ambiguous \\{} +% * & * & * & ambiguous \\{} +% H & W & r & $H, W$ \\ +% H & W & * & $H, W$ \\ +% H & * & r & $W = rH$ \\ +% H & * & * & $W = H$ \\ +% \hline +% \end{tabular} +% \end{table} +% +% The +% calculated height and width are stored in \cs{@tempdima} and \cs{@tempdimb} +% respectively. Both lengths are set to zero if there is an error. +% \begin{macrocode} +\renewcommand*{\setrectanglesize}[3]{% + \nametest{#1}{*}% + \ifsamename % H = * + \nametest{#2}{*}% + \ifsamename % W = * + \@memerror{% + The combination of argument values is ambiguous.\MessageBreak + The lengths will be set to zero}{\@ehd} + \setlength{\@tempdima}{0pt}% + \setlength{\@tempdimb}{0pt}% + \else % W + \nametest{#3}{*}% + \ifsamename % r = * + \setlength{\@tempdimb}{#2}% + \setlength{\@tempdima}{\@tempdimb}% + \else % r + \setlength{\@tempdimb}{#2} + \setlength{\@tempdima}{#3\@tempdimb} + \fi + \fi + \else % H + \nametest{#2}{*}% + \ifsamename % W = * + \nametest{#3}{*}% + \ifsamename % r = * + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{\@tempdima}% + \else % r + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{#3\@tempdima}% + \fi + \else % W + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{#2}% + \fi + \fi +} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setfillsize} +% Consider a set of 4 lengths, $T$, $L$, $C$, and $R$, such that +% $T = L + C + R$, where $T$ is a fixed size and normally $C$ is also fixed. +% Also $L$ and $R$ may be specified independently of each other or as a +% ratio (i.e., $L = rR$ or $R = rL$). +% The macro +% \cs{setfillsize}\marg{T}\marg{C}\marg{L}\marg{R}\marg{r} +% maintains these constraints among the variables, where an unvalued +% argument is denoted by \texttt{*}. +% +% Table~\ref{tab:setfill} shows the argument combinations and the result +% for each combination. +% \begin{table} +% \centering +% \caption{Arguments and results for \cs{setfillsize}}\label{tab:setfill} +% \begin{tabular}{cccc|ll} \hline +% C & L & R & r & Result & \\ \hline +% * & * & R & r & $L = rR$, & $C = T - L - R$ \\{} +% * & * & R & * & $L = R$, & $C = T - L - R$ \\{} +% * & * & * & r & ambigous & \\{} +% * & * & * & * & ambiguous & \\{} +% * & L & R & r & $L$, $R$, & $C = T - L - R$ \\{} +% * & L & R & * & $L$, $R$, & $C = T - L - R$ \\{} +% * & L & * & r & $R = rL$, & $C = T - L - R$ \\{} +% * & L & * & * & $R = L$, & $C = T - L - R$ \\{} +% C & * & R & r & $L = T - C - R$ & $C$ \\ +% C & * & R & * & $L = T - C - R$, & $C$ \\ +% C & * & * & r & $L + R = T - C$, $R = rL$, & $C$ \\ +% C & * & * & * & $L + R = T - C$, $R = L$, & $C$ \\ +% C & L & R & r & ambiguous & $C$ \\ +% C & L & R & * & ambiguous & $C$ \\ +% C & L & * & r & $R = T - C - L$, & $C$ \\ +% C & L & * & * & $R = T - C - L$, & $C$ \\ +% \hline +% \end{tabular} +% \end{table} +% +% +% The +% calculated values of \meta{C}, \meta{L} and \meta{R} are stored in +% \cs{@tempdimc}, \cs{@tempdima} and \cs{@tempdimb} respectively. +% If there is an error the lengths are set to zero. +% \begin{macrocode} +\renewcommand*{\setfillsize}[5]{% + \nametest{#2}{*}% + \ifsamename % C = * + \nametest{#3}{*}% + \ifsamename % L = * + \nametest{#4}{*}% + \ifsamename % R = * + \@memerror{% + The combination of argument values is ambiguous.\MessageBreak + The lengths will be set to zero}{\@ehd} + \setlength{\@tempdima}{0pt}% + \setlength{\@tempdimb}{0pt}% + \setlength{\@tempdimc}{0pt}% + \else % R + \nametest{#5}{*}% + \ifsamename % r = * + \setlength{\@tempdimb}{#4}% + \setlength{\@tempdima}{\@tempdimb}% + \setlength{\@tempdimc}{#1}% + \advance\@tempdimc -\@tempdima + \advance\@tempdimc -\@tempdimb + \else % r + \setlength{\@tempdimb}{#4}% + \setlength{\@tempdima}{#5\@tempdimb}% + \setlength{\@tempdimc}{#1}% + \advance\@tempdimc -\@tempdima + \advance\@tempdimc -\@tempdimb + \fi + \fi + \else % L + \nametest{#4}{*}% + \ifsamename % R = * + \nametest{#5}{*}% + \ifsamename % r = * + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{\@tempdima}% + \setlength{\@tempdimc}{#1}% + \advance\@tempdimc -\@tempdima + \advance\@tempdimc -\@tempdimb + \else % r + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{#5\@tempdima}% + \setlength{\@tempdimc}{#1}% + \advance\@tempdimc -\@tempdima + \advance\@tempdimc -\@tempdimb + \fi + \else % R + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{#4}% + \setlength{\@tempdimc}{#1}% + \advance\@tempdimc -\@tempdima + \advance\@tempdimc -\@tempdimb + \fi + \fi + \else % C is valued + \nametest{#3}{*}% + \ifsamename % L = * + \nametest{#4}{*}% + \ifsamename % R = * + \nametest{#5}{*}% + \ifsamename % r = * + \setlength{\@tempdimc}{#2}% + \setlength{\@tempdima}{#1}% + \advance\@tempdima -\@tempdimc + \@tempdima = 0.5\@tempdima + \@tempdimb = \@tempdima + \else % r (CODE PERHAPS FIXED) + \setlength{\@tempdimc}{#2}% + \setlength{\@tempdimb}{#1}% % T + \advance\@tempdimb -\@tempdimc % T - C + \@tempdima = 1000sp + \@tempdima = #5\@tempdima % 1000r sp + \advance\@tempdima by 1000sp % 1000(1+r)sp + \@tempcnta = \@tempdima % 1000(1+r) + \@tempdima = \@tempdimb % T - C + \divide\@tempdima by \@tempcnta % (T-C)/1000(1+r) pts + \@tempdima = 1000\@tempdima % (T-C)/(1+r) pts = L + \advance\@tempdimb by -\@tempdima % = R + \fi + \else % R + \setlength{\@tempdimc}{#2}% + \setlength{\@tempdimb}{#4}% + \setlength{\@tempdima}{#1}% + \advance\@tempdima -\@tempdimc + \advance\@tempdima -\@tempdimb + \fi + \else % L + \nametest{#4}{*}% + \ifsamename % R = * + \setlength{\@tempdimc}{#2}% + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{#1}% + \advance\@tempdimb -\@tempdimc + \advance\@tempdimb -\@tempdima + \else % R + \@memerror{% + The combination of argument values is ambiguous.\MessageBreak + The lengths will be set to zero}{\@ehd}% + \setlength{\@tempdima}{0pt}% + \setlength{\@tempdimb}{0pt}% + \setlength{\@tempdimc}{#2}% + \fi + \fi + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mclassicht} +% The classic adjustment of the \cs{textheight} to get an integral number +% of lines (given an integral number of baselineskips returns a height +% giving one more line in the block). +% \begin{macrocode} +\newcommand*{\m@mclassicht}{% + \setlength{\@tempdima}{\textheight}% + \divide\@tempdima \baselineskip + \@tempcnta=\@tempdima + \setlength{\textheight}{\@tempcnta\baselineskip}% + \addtolength{\textheight}{\topskip}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mlinesht} +% The adjustment of the \cs{textheight} to get an integral number +% of lines (given an inegral number of baselineskips returns a height +% giving that number of lines). +% \begin{macrocode} +\newcommand*{\m@mlinesht}{% + \setlength{\@tempdima}{\textheight}% + \advance\@tempdima -\baselineskip + \divide\@tempdima \baselineskip + \@tempcnta=\@tempdima + \setlength{\textheight}{\@tempcnta\baselineskip}% + \addtolength{\textheight}{\topskip}} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\m@mnearestht} +% The adjustment of the \cs{textheight} to get an integral number +% of lines with the calculated height being as the closest to the given +% height. Algorithm supplied by Lars Madsen and Morten H{\o}lmgren 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}. +% +% \begin{macrocode} +\renewcommand*{\checkthelayout}[1][classic]{% +% \end{macrocode} +% First check the dimensions are not negative. +% \begin{macrocode} + \@memnegtest{\trimedge} + \@memnegtest{\trimtop} + \@memznegtest{\stockwidth} + \@memznegtest{\paperwidth} + \@memznegtest{\textwidth} + \@memznegtest{\spinemargin} + \@memznegtest{\foremargin} + \@memznegtest{\marginparsep} + \@memznegtest{\marginparwidth} + \@memznegtest{\stockheight} + \@memznegtest{\paperheight} + \@memznegtest{\textheight} + \@memznegtest{\uppermargin} + \@memznegtest{\lowermargin} + \@memznegtest{\headheight} + \@memznegtest{\headsep} + \@memznegtest{\footskip} +% \end{macrocode} +% +% Carry on regardless. We may need to adjust the \cs{textheight} +% to get an integral number of lines. +% \begin{macrocode} + \nametest{#1}{classic}% + \ifsamename + \m@mclassicht + \else + \nametest{#1}{lines}% + \ifsamename + \m@mlinesht + \else + \nametest{#1}{nearest}% + \ifsamename + \m@mnearestht + \else + \nametest{#1}{fixed} + \ifsamename + \else% not classic, lines, nearest, or fixed + \@memerror{Optional argument is not one of:\MessageBreak + classic, fixed, lines, or nearest. \MessageBreak + I will assume the default}% + {\@ehc}% + \fi + \fi + \fi + \fi + \setulmargins{\uppermargin}{*}{*} +% \end{macrocode} +% +% Check that all the sums add up correctly, or +% at least to within a small (\cs{@tempdimb}) error. +% \begin{macrocode} + \@tempdimb = -1pt + \@tempdima=\stockwidth + \advance\@tempdima -\trimedge + \advance\@tempdima -\paperwidth + \ifdim\@tempdima<\@tempdimb + \@tempdima = -\@tempdima + \@memerror{\protect\paperwidth\space and/or + \protect\trimedge\space + are too large for \protect\stockwidth\space + by \the\@tempdima}% + {\@ehd} + \fi + \@tempdima = \paperwidth + \advance\@tempdima -\foremargin + \advance\@tempdima -\textwidth + \advance\@tempdima -\spinemargin + \ifdim\@tempdima<\@tempdimb + \@tempdima = -\@tempdima + \@memerror{\protect\spinemargin\space and/or + \protect\textwidth\space and/or + \protect\foremargin\space + are too large for \protect\paperwidth\space + by \the\@tempdima}% + {\@ehd} + \fi + \@tempdima = \stockheight + \advance\@tempdima -\trimtop + \advance\@tempdima -\paperheight + \ifdim\@tempdima<\@tempdimb + \@tempdima = -\@tempdima + \@memerror{\protect\paperheight\space and/or + \protect\trimtop\space + are too large for \protect\stockheight\space + by \the\@tempdima}% + {\@ehd} + \fi + \@tempdima = \paperheight + \advance\@tempdima -\uppermargin + \advance\@tempdima -\textheight + \advance\@tempdima -\lowermargin + \ifdim\@tempdima<\@tempdimb + \@tempdima = -\@tempdima + \@memerror{\protect\uppermargin\space and/or + \protect\textheight\space and/or + \protect\lowermargin\space + are too large for \protect\paperheight\space + by \the\@tempdima}% + {\@ehd} + \fi + \@tempdima = \uppermargin + \advance\@tempdima -\headheight + \advance\@tempdima -\headsep + \ifdim\@tempdima<\@tempdimb + \@tempdima = -\@tempdima + \@memerror{\protect\headheight\space and/or + \protect\headsep\space + are too large for \protect\uppermargin\space + by \the\@tempdima}% + {\@ehd} + \fi + \@tempdima = \lowermargin + \advance\@tempdima -\footskip + \ifdim\@tempdima<\z@ + \@tempdima = -\@tempdima + \@memerror{\protect\footskip + is too large for \protect\lowermargin\space + by \the\@tempdima}% + {\@ehd} + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\checkandfixthelayout} +% This macro checks and fixes the layout, and reports the result. It takes the +% same optional argument as \cs{checkthelayout}. +% \begin{macrocode} +\renewcommand*{\checkandfixthelayout}[1][classic]{% + \checkthelayout[#1]% + \fixthelayout + \typeoutlayout} + +% \end{macrocode} +% \end{macro} +% +% \subsection{Overlong lines} +% +% LaTeX provides \cs{fussy} and \cs{sloppy} to control the amount of slack +% in a line while trying to make justified lines. Their definitions are: +% \begin{verbatim} +% \def\fussy{% +% \emergencystretch\z@ +% \tolerance 200% +% \hfuzz .1\p@ +% \vfuzz\hfuzz} +% \def\sloppy{% +% \tolerance 9999% +% \emergencystretch 3em% +% \hfuzz .5\p@ +% \vfuzz\hfuzz} +% \end{verbatim} +% +% \begin{macro}{\midsloppy} +% Somewhere between \cs{fussy} and \cs{sloppy}. +% \begin{macrocode} +\newcommand*{\midsloppy}{% + \tolerance 5000% + \hbadness 4000% + \emergencystretch 1.5em% + \hfuzz .1\p@ + \vfuzz\hfuzz} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{midsloppypar} +% A paragraph form of \cs{midsloppy}; equivalent to \verb?\par \midsloppy ... \par}? +% \begin{macrocode} +\newenvironment{midsloppypar}{\par\midsloppy}{\par} + +% \end{macrocode} +% \end{environment} +% +% \subsection{Lists} +% +% \begin{macro}{\everylistparindent} +% \begin{macro}{\list} +% The kernel sets \cs{listparindent} to zero within a \cs{list}, where it +% can be overridden in \cs{lits}'s second argument. Here it is set to +% \cs{everyparlistindent} by default, which in turn is 0pt. +% \begin{macrocode} +\newdimen\everylistparindent + \everylistparindent \z@ +\renewcommand*{\list}[2]{% + \ifnum \@listdepth >5\relax + \@toodeep + \else + \global\advance\@listdepth\@ne + \fi + \rightmargin\z@ + \listparindent\everylistparindent + \itemindent\z@ + \csname @list\romannumeral\the\@listdepth\endcsname + \def\@itemlabel{#1}% + \let\makelabel\@mklab + \@nmbrlistfalse + #2\relax + \@trivlist + \parskip\parsep + \parindent\listparindent + \advance\linewidth -\rightmargin + \advance\linewidth -\leftmargin + \advance\@totalleftmargin \leftmargin + \parshape \@ne \@totalleftmargin \linewidth + \ignorespaces} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\defaultlists} +% This is a simplification of memoir's original, and will apply to any font +% size. +% \begin{macrocode} +\renewcommand*{\defaultlists}{% + \setlength{\partopsep}{0.2\onelineskip \@plus 0.1\onelineskip + \@minus 0.1\onelineskip}% + \parsepi = 0.3333\onelineskip \@plus 0.1667\onelineskip \@minus \p@ + \itemsepi = \parsepi + \topsepi = 0.6667\onelineskip \@plus 0.3333\onelineskip + \@minus 0.2\onelineskip + \parsepii = 0.1667\onelineskip \@plus \p@ \@minus \p@ + \topsepii = \parsepi + \topsepiii = \parsepii + \everylistparindent \z@} +\defaultlists + +% \end{macrocode} +% \end{macro} +% +% These are the original versions of \cs{firmlist} and \cs{tightlist}. +% \begin{verbatim} +% \newcommand*{\firmlist}{% +% \setlength{\itemsep}{0.5\itemsep}\setlength{\parskip}{0.5\parskip}} +% +% \newcommand*{\tightlist}{% +% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} +% \end{verbatim} +% +% \begin{macro}{\firmlists} +% \begin{macro}{\firmlists*} +% \begin{macro}{\m@msfirmlists} +% \begin{macro}{\m@mfirmlists} +% These give approximately half the vertical spacing of the default lists, +% with all spaces equal. The starred version allows slightly less space +% before and after the list when it is preceded by a blank line. +% +% \begin{macrocode} +\newcommand*{\firmlists}{% + \@ifstar{\m@msfirmlists}{\m@mfirmlists}} + +\newcommand*{\m@msfirmlists}{ + \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}% + \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@ + \itemsepi = \parsepi + \topsepi = \parsepi + \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@ + \topsepii = \parsepi + \topsepiii = \parsepii + \everylistparindent\z@} + +\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\z@} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\tightlists} +% \begin{macro}{\tightlists*} +% \begin{macro}{\m@mstightlists} +% \begin{macro}{\m@mtightlists} +% These give zero vertical spacing of the default lists. +% The starred version allows slightly no extra space +% before and after the list when it is preceded by a blank line, +% whereas the unstarred version puts half a \cs{onelineskip} +% before and after. +% +% \begin{macrocode} +\renewcommand*{\tightlists}{% + \@ifstar{\m@mstightlists}{\m@mtightlists}} + +\newcommand*{\m@mstightlists}{% + \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}% + \parsepi = \z@ \@plus \p@ \@minus \p@ + \itemsepi = \parsepi + \topsepi = \z@ \@plus \p@ \@minus \p@ + \parsepii = \z@ \@plus \p@ \@minus \p@ + \topsepii = \parsepi + \topsepiii = \parsepii + \everylistparindent\parindent} + +\newcommand*{\m@mtightlists}{% + \setlength{\partopsep}{0.5\onelineskip \@plus \p@ \@minus \p@}% + \parsepi = \z@ \@plus \p@ \@minus \p@ + \itemsepi = \parsepi + \topsepi = \z@ \@plus \p@ \@minus \p@ + \parsepii = \z@ \@plus \p@ \@minus \p@ + \topsepii = \parsepi + \topsepiii = \parsepii + \everylistparindent\parindent} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% The end of the patch file +% +% \begin{macrocode} +%</patch> +% \end{macrocode} +% +% +% \bibliographystyle{alpha} +% \begingroup +% \raggedright +% \begin{thebibliography}{GMSN94A} +% +% +% \bibitem[GMS94]{GOOSSENS94} +% Michel Goossens, Frank Mittelbach, and Alexander Samarin. +% \newblock \emph{The LaTeX Companion}. +% \newblock Addison-Wesley Publishing Company, 1994. +% +% +% \bibitem[Rah01]{NAMEREF} +% Sebastian Rahtz. +% \newblock \emph{Section name references in LaTeX}. +% \newblock January 2001. +% \newblock (Available from CTAN in +% \texttt{/macros/latex/contrib/hyperref}) +% +% \bibitem[Rah02]{HYPERREF} +% Sebastian Rahtz. +% \newblock \emph{Hypertext marks in LaTeX}. +% \newblock March 2002. +% \newblock (Available from CTAN in +% \texttt{/macros/latex/contrib/hyperref}) +% +% \bibitem[Wil04]{MEMOIR} +% Peter Wilson. +% \newblock \emph{The LaTeX \Lpack{memoir} class for configurable +% typesetting: Source code}. +% \newblock January 2004. +% \newblock (Available from CTAN in +% \texttt{macros/latex/contrib/memoir}) +% +% +% \end{thebibliography} +% \endgroup +% +% \Finale +% +\endinput + +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + diff --git a/Master/texmf-dist/source/latex/memoir/mempatch.ins b/Master/texmf-dist/source/latex/memoir/mempatch.ins new file mode 100755 index 00000000000..9ec01baf512 --- /dev/null +++ b/Master/texmf-dist/source/latex/memoir/mempatch.ins @@ -0,0 +1,79 @@ +%% mempatch.ins +%% Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net +%% Copyright 2001 --- 2006 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 "author-maintained". +%% +%% This work consists of the files listed in the README file. +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this work when run through +%% LaTeX. +%% +%% +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\batchfile{mempatch.ins} +\input docstrip.tex +\preamble + + Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net + Copyright 2001 --- 2006 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 "author-maintained". + + This work consists of the files listed in the README file. + +\endpreamble + +\keepsilent + +%% \Msg{*** Generating the driver file ***} + +%% \generateFile{mempatch.drv}{t}{\from{mempatch.dtx}{driver}} + +\Msg{*** Generating the LaTeX2e package files ***} + +\generateFile{memhfixc.sty}{t}{\from{mempatch.dtx}{hyper}} +\generateFile{mempatch.sty}{t}{\from{mempatch.dtx}{patch}} + +\Msg{***********************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* files into a directory searched by LaTeX. See the FAQ on} +\Msg{* CTAN at /help/uk-tex-faq for more on this.} +\Msg{*} +\Msg{* \space\space memhfixc.sty} +\Msg{* \space\space mempatch.sty} +\Msg{*} +\Msg{*} +\Msg{* To produce the documented source run the files ending with} +\Msg{* `.dtx' through LaTeX.} +\Msg{* For an index process any name.idx file by:} +\Msg{* \space\space\space\space makeindex -s gind.ist name} +\Msg{* Process any name.glo file by:} +\Msg{* \space\space\space\space makeindex -s gglo.ist -o name.gls name.glo} +\Msg{*} +\Msg{* Happy TeXing} +\Msg{***********************************************************} + +\endinput diff --git a/Master/texmf-dist/tex/latex/memoir/memhfixc.sty b/Master/texmf-dist/tex/latex/memoir/memhfixc.sty index f0b20bdfebb..15502dd75fe 100644 --- a/Master/texmf-dist/tex/latex/memoir/memhfixc.sty +++ b/Master/texmf-dist/tex/latex/memoir/memhfixc.sty @@ -6,9 +6,8 @@ %% %% mempatch.dtx (with options: `hyper') %% -%% Author: Peter Wilson (CUA) now at peter.r.wilson@boeing.com until June 2004 -%% (or at: pandgwilson at earthlink dot net) -%% Copyright 2001 --- 2004 Peter R. Wilson +%% Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net +%% Copyright 2001 --- 2006 Peter R. Wilson %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -36,6 +35,8 @@ %% \usepackage[...]{hyperref} %% \usepackage{memhfixc} %% +%% Version 1.8 2006/01/21 +%% Version 1.7 2005/11/15 %% Version 1.6 2004/05/13 %% Version 1.5 2003/10/14 %% Version 1.4 2003/09/26 @@ -44,7 +45,7 @@ %% Version 1.1 2003/01/22 %% Version 1.0 2002/10/22 %% -\ProvidesPackage{memhfixc}[2004/05/13 v1.6 package fixes for memoir class] +\ProvidesPackage{memhfixc}[2006/01/21 v1.8 nameref/hyperref package fixes for memoir class] \let\M@hfixcfinish\relax \@ifclassloaded{memoir}{}% {\let\M@hfixcfinish\endinput @@ -96,6 +97,41 @@ \@ifpackageloaded{hyperref}{}{\let\M@hfixcfinish\endinput} \M@hfixcfinish +\let\H@old@sbook\@sbook +\def\@sbook#1{% + \H@old@sbook{#1}% + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{book*.\the\Hy@linkcounter}% + \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% +} + +\@ifundefined{Hy@captionsenglish}{}{% + \g@addto@macro{\Hy@captionsenglish}{\def\bookautorefname{Book}}} +\@ifundefined{HyLang@english}{}{% + \g@addto@macro{\HyLang@english}{\def\bookautorefname{Book}}} + +\@ifundefined{Hy@captionsgerman}{}{% + \g@addto@macro{\Hy@captionsgerman}{\def\bookautorefname{Buch}}} +\@ifundefined{HyLang@german}{}{% + \g@addto@macro{\HyLang@german}{\def\bookautorefname{Buch}}} + +\@ifundefined{Hy@captionsportuges}{}{% + \g@addto@macro{\Hy@captionsportuges}{\def\bookautorefname{Livro}}} +\@ifundefined{HyLang@portuges}{}{% + \g@addto@macro{\HyLang@portuges}{\def\bookautorefname{Livro}}} + +\@ifundefined{Hy@captionsspanish}{}{% + \g@addto@macro{\Hy@captionsspanish}{\def\bookautorefname{Libro}}} +\@ifundefined{HyLang@spanish}{}{% + \g@addto@macro{\HyLang@spanish}{\def\bookautorefname{Libro}}} + +\@ifundefined{Hy@captionsafrikaans}{}{% + \g@addto@macro{\Hy@captionsafrikaans}{\def\bookautorefname{Boek}}} +\@ifundefined{HyLang@afrikaans}{}{% + \g@addto@macro{\HyLang@afrikaans}{\def\bookautorefname{Boek}}} + +\providecommand{\bookautorefname}{Book} + \def\@@writetorep#1#2#3#4#5{% \begingroup \def\Hy@tempa{#5}% @@ -133,10 +169,12 @@ \fi \ifHy@bookmarksnumbered \let\numberline\Hy@numberline + \let\booknumberline\Hy@numberline % <- added \let\partnumberline\Hy@numberline % <- added \let\chapternumberline\Hy@numberline % <- added \else \let\numberline\@gobble + \let\booknumberline\@gobble % <- added \let\partnumberline\@gobble % <- added \let\chapternumberline\@gobble % <- added \fi @@ -184,6 +222,45 @@ \let\m@moldhypcaption\caption \renewcommand{\caption}{\donemaincaptiontrue\m@moldhypcaption} +\newcounter{memhycontfloat} +\renewcommand*{\thememhycontfloat}{\arabic{memhycontfloat}} +\renewcommand{\theHmemhycontfloat}{\arabic{memhycontfloat}} +\setcounter{memhycontfloat}{0} + +\renewcommand{\contcaption}{% + \refstepcounter{memhycontfloat}% + \addtocounter{\@captype}{\m@ne}\H@refstepcounter{\@captype}% + \@contcaption\@captype} + +\def\endsidecaption{% + \m@mscapend@fbox + \H@refstepcounter{\@captype}% + \hyper@makecurrent{\@captype}% + \m@mscaplabel + \begin{lrbox}{\m@mscap@capbox}% + \begin{minipage}[c]{\sidecapwidth}% + \sidecapstyle + \@caption\@captype[\m@mscap@fortoc]{\m@mscap@forcap}% + \end{minipage}% + \end{lrbox}% + \m@mscapopboxes} + +\renewcommand*{\sidecontcaption}{% + \refstepcounter{memhycontfloat}% + \@sidecontcaption} +\def\endsidecontcaption{% + \m@mscapend@fbox + \addtocounter{\@captype}{\m@ne}\H@refstepcounter{\@captype}% + \hyper@makecurrent{memhycontfloat}% + \m@mscaplabel + \begin{lrbox}{\m@mscap@capbox}% + \begin{minipage}[c]{\sidecapwidth}% + \sidecapstyle + \@contcaption\@captype{\m@mscap@forcap}% + \end{minipage}% + \end{lrbox}% + \m@mscapopboxes} + \endinput %% %% End of file `memhfixc.sty'. diff --git a/Master/texmf-dist/tex/latex/memoir/mempatch.sty b/Master/texmf-dist/tex/latex/memoir/mempatch.sty index 124029e6113..b2dc44a17d8 100644 --- a/Master/texmf-dist/tex/latex/memoir/mempatch.sty +++ b/Master/texmf-dist/tex/latex/memoir/mempatch.sty @@ -7,7 +7,7 @@ %% mempatch.dtx (with options: `patch') %% %% Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net -%% Copyright 2001 --- 2005 Peter R. Wilson +%% Copyright 2001 --- 2006 Peter R. Wilson %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -22,11 +22,24 @@ %% %% This work consists of the files listed in the README file. %% -\ProvidesFile{mempatch.sty}[2005/10/06 v4.1 Patches for memoir class v1.618] +\ProvidesFile{mempatch.sty}[2006/08/08 v4.5 Patches for memoir class v1.618] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Version 4.0 was released simultaneously with version 1.618 of memoir. +%%% Version 4.0 was released simultaneously with version 1.618 of memoir. %%% By definition there were no patches. +%%% Most of the subsequent additions are noted in the Addendum. +%%% +%%% Version 4.3 introduces the \reparticle macro which is not in the +%%% Addendum. +%%% +%%% Version 4.4 introduces several additional commands, in particular +%%% the \book command provides a document division above Part. See the +%%% code (towards the end) for details of the new commands. +%%% +%%% Version 4.5 introduces commands for switching trim marks off and on +%%% and a \DisemulatePackage macro to negate a prior \EmulatedPackage. +%%% It also provides the functions of the pagenote package for end notes. +%%% See the code (near the end) for details. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -38,6 +51,10 @@ \memsecstarinfo{\m@msecn@mame}{#5}% \@mem@old@ssect{#1}{#2}{#3}{#4}{#5}} +%%%%%%%%%%%% +%%%%%%%%%%%% Side captions +%%%%%%%%%%%% + \newsavebox{\m@mscap@capbox} \newsavebox{\m@mscap@fbox} @@ -62,7 +79,7 @@ \def\@tempb{c}% \ifx\@tempb\m@mscappos \else - \@memerror{Argument to \string\setsidecappos\space not t, c, or b. + \@memerror{Argument to \string\setsidecappos\space is not t or c or b. \MessageBreak Set to c}{\@ehc}% \def\m@mscappos{c}% \fi @@ -210,7 +227,7 @@ \scapmargleftfalse \else \ifnum\m@mscapmarg=\tw@% % outer - \scapmargleftrue + \scapmarglefttrue \ifoddpage \scapmargleftfalse \fi @@ -312,7 +329,1342 @@ \end{lrbox}% \m@mscapopboxes} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Version 4.2 (2005/11/21 and later) + +%%%%%%%%%%%% +%%%%%%%%%%%% Extensions to \AtBeginDocument +%%%%%%%%%%%% + +\renewcommand{\InputIfFileExists}[2]{% + \IfFileExists{#1}% + {#2\@addtofilelist{#1}\m@matbeginf{#1}% + \@@input \@filef@und + \m@matendf{#1}% + \killm@matf{#1}}} + +\newcommand{\m@matbeginf}[1]{\@ifundefined{#1-m@mfb}{}% + {\@nameuse{#1-m@mfb}}} +\newcommand{\m@matendf}[1]{\@ifundefined{#1-m@mfe}{}% + {\@nameuse{#1-m@mfe}}} + +\newcommand*{\killm@matf}[1]{% + \@namelet{#1-m@mfb}\relax + \@namelet{#1-m@mfe}\relax} + +\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}}} + +\newcommand{\AtBeginPackage}[2]{% + \AtBeginFile{#1.\@pkgextension}{#2}} +\newcommand{\AtEndPackage}[2]{% + \AtEndFile{#1.\@pkgextension}{#2}} +\newcommand{\RequireAtEndPackage}[2]{% + \@ifpackageloaded{#1}{#2}% + {\AtEndFile{#1.\@pkgextension}{#2}}} + +\newcommand{\AtBeginClass}[2]{% + \AtBeginFile{#1.\@clsextension}{#2}} +\newcommand{\AtEndClass}[2]{% + \AtEndFile{#1.\@clsextension}{#2}} +\newcommand{\RequireAtEndClass}[2]{% + \@ifclassloaded{#1}{#2}% + {\AtEndFile{#1.\@clsextension}{#2}}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Version 4.3 (2005/12/13 and later) + +%%% Replicate the appearance of a \section in the article class +\makechapterstyle{reparticle}{% + \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex}% + \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}% + \setlength{\afterchapskip}{2.3ex \@plus .2ex}% + \renewcommand*{\printchaptername}{}% + \renewcommand*{\chapternamenum}{}% + \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries}% + \renewcommand*{\chapnumfont}{\chaptitlefont}% + \renewcommand*{\printchapternum}{\@hangfrom{\chapnumfont \thechapter\quad}}% + \renewcommand*{\afterchapternum}{}} + +%%% \reparticle redefines the higher level division heads fonts and spacing +%%% to replicate the article class (but \chapter must still be used). +%%% Use, for example like: \ifartopt \reparticle \fi +\newcommand*{\reparticle}{% + \chapterstyle{reparticle}% + \setsecheadstyle{\large\bfseries\raggedright}% + \setsubsecheadstyle{\normalsize\bfseries\raggedright}% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Version 4.4 (2006/01/06 and later) + +%%% \captiontitlefinal{<stuff>} will put <stuff> immediately at the +%%% end of a \caption's title text and it will not appear in the +%%% LoF/LoT/etc. For example: \captiontitlefinal{.} +%%% (Code supplied by Frederic Connes) +\newcommand*{\captiontitlefinal}[1]{\def\@contfinal{#1}} +\captiontitlefinal{} + +\renewcommand{\@makecaption}[2]{\let\@memtempa\relax + \ifdim\prevdepth>-99\p@ \vskip\abovecaptionskip + \else \def\@memtempa{\vbox to\topskip{}}\fi + \let\@contfnote\footnote \renewcommand{\footnote}[2][]{}% + \let\@contfmark\footnotemark \renewcommand{\footnotemark}[1][]{}% + \sbox\@tempboxa{\@contnfont #1\@contdelim \@conttfont #2\@contfinal}% + \let\footnote\@contfnote + \let\footnotemark\@contfmark + \ifdim\wd\@tempboxa<\linewidth \centering\fi + \if@contcw + \centering + \parbox{\@contcwidth}{% + \ifdim\wd\@tempboxa<\@contcwidth \centering\fi + \fi + \if@conthang + \sbox\@tempboxa{\@contnfont #1\@contdelim}% + \@contpre% + {\@contcstyle\hangindent=\wd\@tempboxa + \noindent\box\@tempboxa\@memtempa \@conttfont #2\@contfinal\par}% + \else + \if@contindent + \@contpre% + {\@contnfont #1\@contdelim}\@memtempa + {\@contcstyle\hangindent=\@contindw + \hangafter=\@ne\@conttfont #2\@contfinal\par}% <- v1.4 + \else + \@contpre% + {\@contnfont #1\@contdelim}\@memtempa + {\ifdim\wd\@tempboxa<\linewidth + \@contcshortstyle\else \@contcstyle\fi% <- v1.4 + \@conttfont #2\@contfinal\par}% + \fi + \fi + \@contpost + \if@contcw + \par + }% end of the parbox + \fi + \vskip\belowcaptionskip} + +%%% Use the declaration \xindyindex if you will be using the xindy program +%%% instead of MakeIndex to process index entries. As yet, xindy will not +%%% hyperref any entries. +%%% (Code supplied by Frederic Connes) +\newif\ifm@mxindy +\m@mxindyfalse +\newcommand*{\xindyindex}{\m@mxindytrue} +\def\@@wrspindexhyp#1|#2|#3\\{% + \ifshowindexmark\@showidx{#1}\fi + \ifx\\#2\\% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}% + \ifm@mxindy{#1}\else{#1|hyperspindexpage(\thepage)}\fi + {\@nameuse{the\@sptheidx}}}% + \else + \def\Hy@temp@A{#2}% + \ifx\Hy@temp@A\HyInd@ParenLeft + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}% + \ifm@mxindy{#1|#2}\else{#1|#2hyperspindexpage(\thepage)}\fi + {\@nameuse{the\@sptheidx}}}% + \else + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|#2}% + {\@nameuse{the\@sptheidx}}}% + \fi + \fi + \endgroup + \@esphack} + +\renewenvironment{theindex}{% + \clearforchapter% <- added + \if@twocolumn + \@restonecolfalse + \else + \@restonecoltrue + \fi + \ifonecolindex + \onecolumn + \chapter*{\indexname} + \preindexhook + \else + \setlength{\columnseprule}{\indexrule}% + \setlength{\columnsep}{\indexcolsep}% + \twocolumn[\@makeschapterhead{\indexname} + \preindexhook]% + \fi + \indexmark + \ifnoindexintoc\else + \phantomsection + \addcontentsline{toc}{chapter}{\indexname} + \fi + \thispagestyle{chapter}\parindent\z@ + \parskip\z@ \@plus .3\p@\relax + \let\item\@idxitem}% + {\if@restonecol\onecolumn\else\twocolumn\fi} + +%%% \ignorespaces fix by Aaron Rendahl to remove extraneous space +%%% with \\>[0pt] ending a verse line +\renewcommand*{\verselinebreak}[1][\z@]{\newline\hspace*{#1}\ignorespaces} + +%%% Use the \verselinenumbersleft declaration to set verse line numbers +%%% at the left. To later return to the default of setting them at the right +%%% use the \verselinenumbersright declaration. +\newcommand*{\verselinenumbersright}{\def\@vstypelinenum{\@vslnumright}} +\newcommand*{\verselinenumbersleft}{\def\@vstypelinenum{\@vslnumleft}} +\verselinenumbersright + +\newcommand*{\@vslnumright}{% + \hfill\rlap{\kern\rightskip\kern\rightmargin% + \vlvnumfont\getthelinenumber{poemline}}} +\newcommand*{\@vslnumleft}{% + \hfill\rlap{\kern-\textwidth\kern-\rightskip% + \vlvnumfont\getthelinenumber{poemline}}} +\renewcommand*{\@vscentercr}{% + \ifhmode \unskip\else \@nolnerr\fi + \@vstypelinenum% + \@vsifgt{\verselinebreak}{% + \incr@vsline + \par\@ifstar{\nobreak\@vsxcentercr}{% + \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}}}} + +%%% Fix for wrapped verbatims in list environments. +\newcommand*{\raggedwrap}{% + \@rightskip\@flushglue + \rightskip\@rightskip + \leftskip\@totalleftmargin + \parindent\ragrparindent} +\renewcommand*{\wrappingon}{% + \def\@xobeysp{~\discretionary{\verbatimbreakchar}% + {\kern\verbatimindent}{}}% + \def\wrapright{\raggedwrap}} + +%%% Use the \nopartblankpage declaration if you don't want a blank +%%% page after a Part title page. The default is set by \partblankpage. +\newif\ifm@mnopartnewpage +\newcommand*{\partblankpage}{\m@mnopartnewpagefalse} +\newcommand*{\nopartblankpage}{\m@mnopartnewpagetrue} + +\renewcommand*{\@endpart}{\afterpartskip + \ifm@mnopartnewpage + \else + \if@twoside + \if@openright + \null + \thispagestyle{afterpart}% + \newpage + \fi + \fi + \fi + \if@tempswa + \twocolumn + \fi} + +\renewcommand{\partnumberline}[1]{% + \hb@xt@\@tempdima{% + \cftpartname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb\space} + +\aliaspagestyle{afterpart}{empty} +\aliaspagestyle{book}{empty} +\aliaspagestyle{afterbook}{empty} + +%%% The \book (and \book*) document division is one level higher than +%%% a \cs{part}. It has the same kind of controls over its appearance in +%%% the body of the document and in the ToC as \part has. +\newcommand*{\book}{% + \@setupbook + \secdef\@book\@sbook} + +\newcommand*{\bookmark}[1]{} +\newcounter{book} \setcounter{book}{0} +\renewcommand*{\thebook}{\Roman{book}} +\newcommand*{\theHbook}{\arabic{book}} +\newcommand*{\toclevel@book}{-2} + +\newcommand*{\beforebookskip}{\null\vfil} +\newcommand*{\midbookskip}{\par \vskip 2\baselineskip} +\newcommand*{\afterbookskip}{\vfil\newpage} + +\newcommand*{\@setupbook}{% + \if@openright + \cleardoublepage + \else + \clearpage + \fi + \thispagestyle{book}% + \if@twocolumn + \@tempswatrue + \else + \@tempswafalse + \fi + \beforebookskip} + +\newcommand*{\bookname}{Book} +\newcommand*{\booknamefont}{\normalfont\huge\bfseries} +\newcommand*{\booknumfont}{\normalfont\huge\bfseries} +\newcommand*{\booktitlefont}{\normalfont\Huge\bfseries} + +\newcommand*{\printbookname}{\booknamefont \bookname} +\newcommand*{\booknamenum}{\space} +\newcommand*{\printbooknum}{\booknumfont \thebook} +\newcommand{\printbooktitle}[1]{\booktitlefont #1} + +\newcommand*{\membookinfo}[3]{} +\newcommand*{\membookstarinfo}[1]{} + +\long\def\@book[#1]#2{% + \M@gettitle{#1}% + \phantomsection + \ifnum\c@secnumdepth > -3\relax + \refstepcounter{book}% + \addcontentsline{toc}{book}% + {\protect\booknumberline{\thebook}#1}% + \membookinfo{\thebook}{#1}{#2}% + \else + \addcontentsline{toc}{book}{#1}% + \membookinfo{}{#1}{#2}% + \fi + \bookmark{#1}% + {\centering + \interlinepenalty \@M + \normalfont + \ifnum \c@secnumdepth >-3\relax + \printbookname \booknamenum \printbooknum + \midbookskip + \fi + \printbooktitle{#2}\par}% + \@endbook} + +\def\@sbook#1{% + \M@gettitle{#1}% + \phantomsection + \membookstarinfo{#1}% + {\centering + \interlinepenalty \@M + \normalfont + \printbooktitle{#1}\par}% + \@endbook} + +%%% Use the \nobookblankpage declaration if you don't want a blank +%%% page after a Book title page. The default is set by \bookblankpage. +\newif\ifm@mnobooknewpage +\newcommand*{\bookblankpage}{\m@mnobooknewpagefalse} +\newcommand*{\nobookblankpage}{\m@mnobooknewpagetrue} + +\newcommand*{\@endbook}{\afterbookskip + \ifm@mnobooknewpage + \else + \if@twoside + \if@openright + \null + \thispagestyle{afterbook}% + \newpage + \fi + \fi + \fi + \if@tempswa + \twocolumn + \fi} + +\newcommand*{\cftbookname}{} +\newcommand*{\l@book}[2]{% + \ifnum\c@tocdepth >-3\relax + \addpenalty{-\@highpenalty}% + \addvspace{\cftbeforebookskip}% + \begingroup + {\leftskip \cftbookindent\relax + \rightskip \@tocrmarg + \parfillskip -\rightskip + \parindent \cftbookindent\relax\@afterindenttrue + \interlinepenalty\@M + \leavevmode + \settowidth{\@tempdima}{\cftbookfont\cftbookname}% + \addtolength{\@tempdima}{\cftbooknumwidth}% + \let\@cftbsnum \cftbookpresnum + \let\@cftasnum \cftbookaftersnum + \let\@cftasnumb \cftbookaftersnumb + \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip + {\cftbookfont #1}% + \cftbookfillnum{#2}} + \nobreak + \global\@nobreaktrue + \everypar{\global\@nobreakfalse\everypar{}}% + \endgroup + \fi} +\newcommand{\booknumberline}[1]{% + \hb@xt@\@tempdima{% + \cftbookname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb\space} + +\newlength{\cftbeforebookskip} + \setlength{\cftbeforebookskip}{2.25em \@plus\p@} +\newdimen\cftbookindent + \setlength{\cftbookindent}{0em} +\newdimen\cftbooknumwidth + \setlength{\cftbooknumwidth}{1.5em} +\newcommand*{\cftbookfont}{\large\bfseries} +\newcommand*{\cftbookpresnum}{} +\newcommand*{\cftbookaftersnum}{} +\newcommand*{\cftbookaftersnumb}{} +\newcommand*{\cftbookleader}{% + \large\bfseries\cftdotfill{\cftbookdotsep}} +\newcommand*{\cftbookdotsep}{\cftnodots} +\newcommand*{\cftbookpagefont}{\large\bfseries} +\newcommand{\cftbookafterpnum}{} +\newcommand{\cftbookfillnum}[1]{% + {\cftbookleader}% + {\hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}}% + \cftbookafterpnum\par} + +\renewcommand*{\@setclcnt}[2]{% + \@tempswafalse + \nametest{#1}{none}% + \ifsamename + \setcounter{#2}{-10}% + \@tempswatrue + \fi + \nametest{#1}{book}% + \ifsamename + \setcounter{#2}{-2}% + \@tempswatrue + \fi + \nametest{#1}{part}% + \ifsamename + \setcounter{#2}{-1}% + \@tempswatrue + \fi + \nametest{#1}{chapter}% + \ifsamename + \setcounter{#2}{0}% + \@tempswatrue + \fi + \nametest{#1}{section}% + \ifsamename + \setcounter{#2}{1}% + \@tempswatrue + \fi + \nametest{#1}{subsection}% + \ifsamename + \setcounter{#2}{2}% + \@tempswatrue + \fi + \nametest{#1}{subsubsection}% + \ifsamename + \setcounter{#2}{3}% + \@tempswatrue + \fi + \nametest{#1}{paragraph}% + \ifsamename + \setcounter{#2}{4}% + \@tempswatrue + \fi + \nametest{#1}{subparagraph}% + \ifsamename + \setcounter{#2}{5}% + \@tempswatrue + \fi + \nametest{#1}{all}% + \ifsamename + \setcounter{#2}{50}% + \@tempswatrue + \fi + \if@tempswa\else + \@memerror{% + Unknown document division name (#1) + }{% + I'll ignore it. + Type \space <return> and I'll continue.\MessageBreak + If you haven't mistyped the name then use + \protect\setcounter\space instead.}% + \fi} + +\renewcommand*{\settocdepth}[1]{% + \@tempswafalse + \nametest{#1}{none}% + \ifsamename + \addtocontents{toc}{\changetocdepth{-10}}% + \@tempswatrue + \fi + \nametest{#1}{book}% + \ifsamename + \addtocontents{toc}{\changetocdepth{-2}}% + \@tempswatrue + \fi + \nametest{#1}{part}% + \ifsamename + \addtocontents{toc}{\changetocdepth{-1}}% + \@tempswatrue + \fi + \nametest{#1}{chapter}% + \ifsamename + \addtocontents{toc}{\changetocdepth{0}}% + \@tempswatrue + \fi + \nametest{#1}{section}% + \ifsamename + \addtocontents{toc}{\changetocdepth{1}}% + \@tempswatrue + \fi + \nametest{#1}{subsection}% + \ifsamename + \addtocontents{toc}{\changetocdepth{2}}% + \@tempswatrue + \fi + \nametest{#1}{subsubsection}% + \ifsamename + \addtocontents{toc}{\changetocdepth{3}}% + \@tempswatrue + \fi + \nametest{#1}{paragraph}% + \ifsamename + \addtocontents{toc}{\changetocdepth{4}}% + \@tempswatrue + \fi + \nametest{#1}{subparagraph}% + \ifsamename + \addtocontents{toc}{\changetocdepth{5}}% + \@tempswatrue + \fi + \nametest{#1}{all}% + \ifsamename + \addtocontents{toc}{\changetocdepth{50}}% + \@tempswatrue + \fi + \if@tempswa + \@ifundefined{toclevel@#1}{% + @memwarn{Unknown toclevel for #1}% + }{% + \setcounter{tocdepth}{\@nameuse{toclevel@#1}}% + } + \else + \@memerror{% + Unknown document division name (#1) + }{% + I'll ignore it. + Type \space <return> and I'll continue.}% + \fi} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Version 4.5 (2006/02/11 and later) + +%%% \DisemulatePackage{pack} undoes a previous \EmulatedPackage{pack}. +%%% For example \DisemulatePackage{index} if you need to use the index package. +\providecommand*{\DisemulatePackage}[1]{% + \@namelet{ver@#1.\@pkgextension}\relax} + +\renewcommand{\@nameedef}[1]{% + \expandafter\protected@edef\csname #1\endcsname} + +%%% change timing of \@mainmattertrue in \@smemmain +\renewcommand*{\@smemmain}{% + \ifartopt + \clearpage + \else + \cleardoublepage + \counterwithin{figure}{chapter}% + \counterwithin{table}{chapter}% + \fi + \@mainmattertrue + \setcounter{secnumdepth}{\value{maxsecnumdepth}}} + +\renewcommand{\@footnotetext}[1]{% + \reset@font\m@mold@footnotetext{#1}\m@mmf@prepare} + +\newif\ifm@mpn@new@chap + \m@mpn@new@chapfalse +\newif\ifm@mpn@new@schap + \m@mpn@new@schapfalse + +%%% Fix for mistiming of \chaptermark with article option +\def\@chapter[#1]#2{% + \m@mpn@new@chaptrue + \def\f@rbdy{#2}% + \ifx\ch@pt@c\@empty % no optional args + \def\f@rtoc{#2}% + \def\f@rhdr{#2}% + \else % at least one opt arg + \let\f@rtoc\ch@pt@c + \ifx\@empty#1\@empty + \let\f@rhdr\ch@pt@c + \else + \def\f@rhdr{#1}% + \fi + \fi + \m@m@Andfalse + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \m@m@Andtrue + \fi + \fi + \ifm@m@And + \refstepcounter{chapter}% + \fi + \ifartopt + \@makechapterhead{#2}% + \@afterheading + \chaptermark{\f@rhdr}% + \else + \chaptermark{\f@rhdr}% + \insertchapterspace + \if@twocolumn + \@topnewpage[\@makechapterhead{#2}]% + \else + \@makechapterhead{#2}% + \fi + \@afterheading + \fi + \ifm@m@And + \ifanappendix + \addcontentsline{toc}{appendix}{% + \protect\chapternumberline{\thechapter}\f@rtoc}% + \memappchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}% + \else + \addcontentsline{toc}{chapter}{% + \protect\chapternumberline{\thechapter}\f@rtoc}% + \memchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}% + \fi + \else + \addcontentsline{toc}{chapter}{\f@rtoc}% + \ifanappendix + \memappchapinfo{}{\f@rtoc}{\f@rhdr}{#2}% + \else + \memchapinfo{}{\f@rtoc}{\f@rhdr}{#2}% + \fi + \fi + \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{\f@rtoc}\fi} + +\renewcommand{\@schapter}[1]{% + \m@mpn@new@schaptrue + \def\f@rbdy{#1}% + \ifartopt + \@makeschapterhead{#1}% + \else + \if@twocolumn + \@topnewpage[\@makeschapterhead{#1}] + \else + \@makeschapterhead{#1}% + \fi + \fi + \@afterheading} +\renewcommand{\@m@mschapter}[2][\@empty]{% + \@schapter{#2}% + \ifx \@empty#1 + \def\f@rhdr{#2}% + \else + \def\f@rhdr{#1}% + \setcounter{secnumdepth}{-10}% + \chaptermark{#1}% + \setcounter{secnumdepth}{\value{maxsecnumdepth}}% + \fi + \ifanappendix + \memappchapstarinfo{\f@rhdr}{#2}% + \else + \memchapstarinfo{\f@rhdr}{#2}% + \fi + \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{#2}\fi} + +%%%% Use \showtrimsoff and \showtrimson to switch trim marks off and on. +%%%% If the showtrims option has not been used, these do nothing. +\newcommand*{\showtrimsoff}{\showtrimsfalse} +\newcommand*{\showtrimson}{\showtrimstrue} +\renewcommand*{\mem@shipii}{% + \ifvoid\@cclv + \mem@oldshipout\box\@cclv + \else + \ifshowtrims + \mem@oldshipout\vbox{\trimmarks\unvbox\@cclv}% + \else + \mem@oldshipout\box\@cclv + \fi + \fi} + +%%%% Fix to stop \sidepars moving up or down +\long\def\@sidepar[#1]#2{\@bsphack\strut\vadjust{% + \checkoddpage + \ifsideparswitch + \ifreversesidepar + \ifoddpage + \oddpagefalse + \else + \oddpagetrue + \fi + \fi + \else + \oddpagetrue + \ifreversesidepar + \oddpagefalse + \fi + \fi + \rlap{\kern-\parindent + \if@twocolumn + \if@firstcolumn% put at left + \kern -\marginparsep \kern -\marginparwidth + \else% put at right + \kern \columnwidth \kern \marginparsep + \fi + \else + \ifoddpage% put at right + \kern \textwidth \kern \marginparsep + \else% put at left + \kern -\marginparsep \kern -\marginparwidth + \fi + \fi + \setbox0=\vtop to 0pt{% + \begin{minipage}[t]{\marginparwidth}% + \ifoddpage #2\else #1\fi% + \end{minipage}% + \vss}% + \vtop to 0pt{\kern\sideparvshift% default should be 0pt + \kern-\dp\strutbox + \kern-\ht0 + \box0 \vss}}}% + \@esphack} +\setlength{\sideparvshift}{0pt} + +%%%% Ensure that fancybreaks close the paragraph they start +\renewcommand{\@fbreak}[1]{\par + \penalty -100 + \noindent\parbox{\linewidth}{\centering #1}% + \par + \@afterindentfalse + \@afterheading} +\renewcommand{\@sfbreak}[1]{\par + \penalty -100 + \noindent\parbox{\linewidth}{\centering #1}% + \par + \@afterindenttrue + \@afterheading} + +%%%% \begin{vplace}[<num>] vertically centered stuff \end{vplace} +%%%% <num> adjusts above space wrt to below space +\newenvironment{vplace}[1][1]{% + \par\vspace*{\stretch{#1}}% +}{% + \vspace*{\stretch{1}}% + \par} + +%%%% +%%%% Include the functions of the pagenote package +%%%% + +\newif\ifm@mpnpageopt + \m@mpnpageoptfalse +\newif\ifm@mpncontopt + \m@mpncontoptfalse +\newcommand*{\notepageref}{\m@mpnpageopttrue} +\newcommand*{\continuousnotenums}{% + \counterwithout{pagenote}{chapter} + \renewcommand{\thepagenote}{\arabic{pagenote}}} + + \newcounter{pagenote}[chapter] +\renewcommand{\thepagenote}{\arabic{pagenote}} +\setcounter{pagenote}{0} +\newif\ifmempagenotes + \mempagenotesfalse + +\newcommand*{\makepagenote}{% + \newwrite\@notefile + \immediate\openout\@notefile=\jobname.ent + \mempagenotestrue + \def\pagenote{\@bsphack\begingroup + \@sanitize + \m@m@wrpnote}% + \typeout{Writing note file \jobname.ent}% + \let\makepagenote\@empty} + +\newcommand{\immediate@protected@write}[3]{% + \begingroup + #2% + \let\protect\@unexpandable@protect + \edef\reserved@a{\immediate\write#1{#3}}% + \reserved@a + \endgroup + \if@nobreak\ifvmode\nobreak\fi\fi} + +\ifm@mpnpageopt + \let\m@m@pnwrite\protected@write +\else + \let\m@m@pnwrite\immediate@protected@write +\fi + +\newcommand*{\pnchap}{\f@rtoc} +\newcommand*{\pnschap}{\f@rbdy} + +\newcommand{\m@m@wrpnote}[2][]{% + \refstepcounter{pagenote}% + \notenumintext{\thepagenote}% + \ifm@mpn@new@chap + \global\m@mpn@new@chapfalse + \addtonotes{\string\pagenotesubhead{\@chapapp}{\thechapter}{\pnchap}}% + \fi + \ifm@mpn@new@schap + \global\m@mpn@new@schapfalse + \addtonotes{\string\pagenotesubhead{\@chapapp}{}{\pnschap}}% + \fi + \m@m@pnwrite\@notefile{} + {\string\noteentry{\thepagenote}{#1}{#2}{\thepage}}% + \endgroup + \@esphack} + +\def\pagenote{\@bsphack\begingroup \@sanitize\m@m@pagenote} +\newcommand{\m@m@pagenote}[2][]{\endgroup\@esphack} + +\newcommand*{\pagetofootnote}{% + \let\memsavepagenote\pagenote + \renewcommand{\pagenote}[2][]{\footnote{##2}}} +\newcommand*{\foottopagenote}{% + \let\memsavefootnote\footnote + \renewcommand*{\footnote}[2][]{\pagenote{##2}}} + +\newcommand{\addtonotes}[1]{% + \ifmempagenotes + \IfFileExists{\jobname.ent}{\m@m@pnwrite\@notefile{}{#1}}{\mempnofilewarn}% +\fi} + +\newcommand{\notenumintext}[1]{% + \textsuperscript{#1}} +\newcommand{\notenuminnotes}[1]{% + {\normalfont #1.}\space} +\newcommand{\noteentry}[4]{% + \prenoteinnotes + \noteidinnotes{#1}{#2}\pageinnotes{#4}\noteinnotes{#3}% + \postnoteinnotes} + +\newcommand{\idtextinnotes}[1]{% + [#1]\space} +\newcommand{\noteidinnotes}[2]{% + \@ifmtarg{#2}{% + \notenuminnotes{#1}}{\idtextinnotes{#2}}} +\newcommand{\pageinnotes}[1]{% + \ifm@mpnpageopt \printpageinnotes{#1}\fi} +\newcommand*{\printpageinnotes}[1]{% + (\pagerefname\ #1)\space} +\newcommand{\noteinnotes}[1]{#1} + +\newcommand{\prenoteinnotes}{\par\noindent} +\newcommand{\postnoteinnotes}{\par} + +\providecommand*{\notesname}{Notes} +\newcommand*{\notedivision}{\chapter{\notesname}} + +\newcommand*{\printpagenotes}{\@ifstar{\@sprintpagenotes}{\@printpagenotes}} +\newcommand*{\mempnofilewarn}{% + \ClassWarning{memoir}{There is no .ent file}} + +\newcommand*{\@sprintpagenotes}{% + \ifmempagenotes + \notedivision +\IfFileExists{\jobname.ent}{% + \immediate\closeout\@notefile + \input{\jobname.ent}% + \immediate\openout\@notefile=\jobname.ent% + }{% + \mempnofilewarn +}% +\fi} + +\newcommand*{\@printpagenotes}{% + \ifmempagenotes + \notedivision + \IfFileExists{\jobname.ent}{% + \immediate\closeout\@notefile + \input{\jobname.ent}% + }{% + \mempnofilewarn + } + \fi} + +\newcommand*{\pagenotesubhead}[3]{% + \section*{#1 #2 #3}} + +\EmulatedPackage{pagenote} + +\newcommand*{\@cftn@me}{} +\renewcommand*{\numberline}[1]{% + \hb@xt@\@tempdima{\@cftn@me\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb} + +\renewcommand*{\newlistentry}[4][\@empty]{% + \@ifundefined{c@#2}{% check & set the counter + \ifx \@empty#1\relax + newcounter{#2}% + \else + \newcounter{#2}[#1]% + \expandafter\edef\csname the#2\endcsname{% + \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}% + \fi}{} + \setcounter{#2}{0} + \@namedef{l@#2}##1##2{% + \ifnum \@nameuse{c@#3depth} > #4\relax + \vskip \@nameuse{cftbefore#2skip}% + {\leftskip \@nameuse{cft#2indent}\relax + \rightskip \@tocrmarg + \parfillskip -\rightskip + \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue + \interlinepenalty\@M + \leavevmode + \settowidth{\@tempdima}{\@nameuse{cft#2font}\@nameuse{cft#2name}}% + \addtolength{\@tempdima}{\@nameuse{cft#2numwidth}}% +\expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname +\expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname +\expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname +\expandafter\let\expandafter\@cftn@me\csname cft#2name\endcsname + \advance\leftskip\@tempdima \null\nobreak\hskip -\leftskip + {\@nameuse{cft#2font}##1}\nobreak + \@nameuse{cft#2fillnum}{##2}} + \fi + }% end of \l@#2 + \expandafter\newlength\csname cftbefore#2skip\endcsname + \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@} + \expandafter\newlength\csname cft#2indent\endcsname + \expandafter\newlength\csname cft#2numwidth\endcsname + \ifcase #4\relax% 0 (level 1) + \setlength{\@nameuse{cft#2indent}}{0em} + \setlength{\@nameuse{cft#2numwidth}}{2.3em} + \or% 1 (level 2) + \setlength{\@nameuse{cft#2indent}}{2.3em} + \setlength{\@nameuse{cft#2numwidth}}{3.2em} + \or% 2 (level 3) + \setlength{\@nameuse{cft#2indent}}{5.5em} + \setlength{\@nameuse{cft#2numwidth}}{4.1em} + \or% 3 (level 4) + \setlength{\@nameuse{cft#2indent}}{8.5em} + \setlength{\@nameuse{cft#2numwidth}}{5.0em} + \else% anything else + \setlength{\@nameuse{cft#2indent}}{10.5em} + \setlength{\@nameuse{cft#2numwidth}}{6.0em} + \fi + \@namedef{cft#2font}{\normalfont} + \@namedef{cft#2name}{} + \@namedef{cft#2presnum}{} + \@namedef{cft#2aftersnum}{} + \@namedef{cft#2aftersnumb}{} + \@namedef{cft#2dotsep}{\cftdotsep} + \@namedef{cft#2leader}{\normalfont\cftdotfill{\@nameuse{cft#2dotsep}}} + \@namedef{cft#2pagefont}{\normalfont} + \@namedef{cft#2afterpnum}{} + \@namedef{cft#2toclevel@#2}{#4} + \@namedef{cft#2fillnum}##1{% + {\@nameuse{cft#2leader}}\nobreak + \hb@xt@\@pnumwidth{% + \hfil\@nameuse{cft#2pagefont}##1}\@nameuse{cft#2afterpnum}\par} +}% end of \newlistentry + +\let\cftbeforesectionskip\relax +\let\cftsectionindent\relax +\let\cftsectionnumwidth\relax +\newlistentry[chapter]{section}{toc}{0} + \cftsetindents{section}{1.5em}{2.3em} +\let\cftbeforesubsectionskip\relax +\let\cftsubsectionindent\relax +\let\cftsubsectionnumwidth\relax +\newlistentry[section]{subsection}{toc}{1} + \cftsetindents{subsection}{3.8em}{3.2em} +\let\cftbeforesubsubsectionskip\relax +\let\cftsubsubsectionindent\relax +\let\cftsubsubsectionnumwidth\relax +\newlistentry[subsection]{subsubsection}{toc}{2} + \cftsetindents{subsubsection}{7.0em}{4.1em} +\let\cftbeforeparagraphskip\relax +\let\cftparagraphindent\relax +\let\cftparagraphnumwidth\relax +\newlistentry[subsubsection]{paragraph}{toc}{3} + \cftsetindents{paragraph}{10.0em}{5.0em} +\let\cftbeforesubparagraphskip\relax +\let\cftsubparagraphindent\relax +\let\cftsubparagraphnumwidth\relax +\newlistentry[paragraph]{subparagraph}{toc}{4} + \cftsetindents{subparagraph}{12.0em}{6.0em} + +\let\cftbeforefigureskip\relax +\let\cftfigureindent\relax +\let\cftfigurenumwidth\relax +\newlistentry[chapter]{figure}{lof}{0} + \cftsetindents{figure}{0em}{2.3em} +\let\cftbeforetableskip\relax +\let\cfttableindent\relax +\let\cfttablenumwidth\relax +\newlistentry[chapter]{table}{lot}{0} + \cftsetindents{table}{0em}{2.3em} + +\renewcommand*{\setrectanglesize}[3]{% + \nametest{#1}{*}% + \ifsamename % H = * + \nametest{#2}{*}% + \ifsamename % W = * + \@memerror{% + The combination of argument values is ambiguous.\MessageBreak + The lengths will be set to zero}{\@ehd} + \setlength{\@tempdima}{0pt}% + \setlength{\@tempdimb}{0pt}% + \else % W + \nametest{#3}{*}% + \ifsamename % r = * + \setlength{\@tempdimb}{#2}% + \setlength{\@tempdima}{\@tempdimb}% + \else % r + \setlength{\@tempdimb}{#2} + \setlength{\@tempdima}{#3\@tempdimb} + \fi + \fi + \else % H + \nametest{#2}{*}% + \ifsamename % W = * + \nametest{#3}{*}% + \ifsamename % r = * + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{\@tempdima}% + \else % r + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{#3\@tempdima}% + \fi + \else % W + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{#2}% + \fi + \fi +} + +\renewcommand*{\setfillsize}[5]{% + \nametest{#2}{*}% + \ifsamename % C = * + \nametest{#3}{*}% + \ifsamename % L = * + \nametest{#4}{*}% + \ifsamename % R = * + \@memerror{% + The combination of argument values is ambiguous.\MessageBreak + The lengths will be set to zero}{\@ehd} + \setlength{\@tempdima}{0pt}% + \setlength{\@tempdimb}{0pt}% + \setlength{\@tempdimc}{0pt}% + \else % R + \nametest{#5}{*}% + \ifsamename % r = * + \setlength{\@tempdimb}{#4}% + \setlength{\@tempdima}{\@tempdimb}% + \setlength{\@tempdimc}{#1}% + \advance\@tempdimc -\@tempdima + \advance\@tempdimc -\@tempdimb + \else % r + \setlength{\@tempdimb}{#4}% + \setlength{\@tempdima}{#5\@tempdimb}% + \setlength{\@tempdimc}{#1}% + \advance\@tempdimc -\@tempdima + \advance\@tempdimc -\@tempdimb + \fi + \fi + \else % L + \nametest{#4}{*}% + \ifsamename % R = * + \nametest{#5}{*}% + \ifsamename % r = * + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{\@tempdima}% + \setlength{\@tempdimc}{#1}% + \advance\@tempdimc -\@tempdima + \advance\@tempdimc -\@tempdimb + \else % r + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{#5\@tempdima}% + \setlength{\@tempdimc}{#1}% + \advance\@tempdimc -\@tempdima + \advance\@tempdimc -\@tempdimb + \fi + \else % R + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{#4}% + \setlength{\@tempdimc}{#1}% + \advance\@tempdimc -\@tempdima + \advance\@tempdimc -\@tempdimb + \fi + \fi + \else % C is valued + \nametest{#3}{*}% + \ifsamename % L = * + \nametest{#4}{*}% + \ifsamename % R = * + \nametest{#5}{*}% + \ifsamename % r = * + \setlength{\@tempdimc}{#2}% + \setlength{\@tempdima}{#1}% + \advance\@tempdima -\@tempdimc + \@tempdima = 0.5\@tempdima + \@tempdimb = \@tempdima + \else % r (CODE PERHAPS FIXED) + \setlength{\@tempdimc}{#2}% + \setlength{\@tempdimb}{#1}% % T + \advance\@tempdimb -\@tempdimc % T - C + \@tempdima = 1000sp + \@tempdima = #5\@tempdima % 1000r sp + \advance\@tempdima by 1000sp % 1000(1+r)sp + \@tempcnta = \@tempdima % 1000(1+r) + \@tempdima = \@tempdimb % T - C + \divide\@tempdima by \@tempcnta % (T-C)/1000(1+r) pts + \@tempdima = 1000\@tempdima % (T-C)/(1+r) pts = L + \advance\@tempdimb by -\@tempdima % = R + \fi + \else % R + \setlength{\@tempdimc}{#2}% + \setlength{\@tempdimb}{#4}% + \setlength{\@tempdima}{#1}% + \advance\@tempdima -\@tempdimc + \advance\@tempdima -\@tempdimb + \fi + \else % L + \nametest{#4}{*}% + \ifsamename % R = * + \setlength{\@tempdimc}{#2}% + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{#1}% + \advance\@tempdimb -\@tempdimc + \advance\@tempdimb -\@tempdima + \else % R + \@memerror{% + The combination of argument values is ambiguous.\MessageBreak + The lengths will be set to zero}{\@ehd}% + \setlength{\@tempdima}{0pt}% + \setlength{\@tempdimb}{0pt}% + \setlength{\@tempdimc}{#2}% + \fi + \fi + \fi} + +\newcommand*{\m@mclassicht}{% + \setlength{\@tempdima}{\textheight}% + \divide\@tempdima \baselineskip + \@tempcnta=\@tempdima + \setlength{\textheight}{\@tempcnta\baselineskip}% + \addtolength{\textheight}{\topskip}} + +\newcommand*{\m@mlinesht}{% + \setlength{\@tempdima}{\textheight}% + \advance\@tempdima -\baselineskip + \divide\@tempdima \baselineskip + \@tempcnta=\@tempdima + \setlength{\textheight}{\@tempcnta\baselineskip}% + \addtolength{\textheight}{\topskip}} + +\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}} + +\renewcommand*{\checkthelayout}[1][classic]{% + \@memnegtest{\trimedge} + \@memnegtest{\trimtop} + \@memznegtest{\stockwidth} + \@memznegtest{\paperwidth} + \@memznegtest{\textwidth} + \@memznegtest{\spinemargin} + \@memznegtest{\foremargin} + \@memznegtest{\marginparsep} + \@memznegtest{\marginparwidth} + \@memznegtest{\stockheight} + \@memznegtest{\paperheight} + \@memznegtest{\textheight} + \@memznegtest{\uppermargin} + \@memznegtest{\lowermargin} + \@memznegtest{\headheight} + \@memznegtest{\headsep} + \@memznegtest{\footskip} + \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}{*}{*} + \@tempdimb = -1pt + \@tempdima=\stockwidth + \advance\@tempdima -\trimedge + \advance\@tempdima -\paperwidth + \ifdim\@tempdima<\@tempdimb + \@tempdima = -\@tempdima + \@memerror{\protect\paperwidth\space and/or + \protect\trimedge\space + are too large for \protect\stockwidth\space + by \the\@tempdima}% + {\@ehd} + \fi + \@tempdima = \paperwidth + \advance\@tempdima -\foremargin + \advance\@tempdima -\textwidth + \advance\@tempdima -\spinemargin + \ifdim\@tempdima<\@tempdimb + \@tempdima = -\@tempdima + \@memerror{\protect\spinemargin\space and/or + \protect\textwidth\space and/or + \protect\foremargin\space + are too large for \protect\paperwidth\space + by \the\@tempdima}% + {\@ehd} + \fi + \@tempdima = \stockheight + \advance\@tempdima -\trimtop + \advance\@tempdima -\paperheight + \ifdim\@tempdima<\@tempdimb + \@tempdima = -\@tempdima + \@memerror{\protect\paperheight\space and/or + \protect\trimtop\space + are too large for \protect\stockheight\space + by \the\@tempdima}% + {\@ehd} + \fi + \@tempdima = \paperheight + \advance\@tempdima -\uppermargin + \advance\@tempdima -\textheight + \advance\@tempdima -\lowermargin + \ifdim\@tempdima<\@tempdimb + \@tempdima = -\@tempdima + \@memerror{\protect\uppermargin\space and/or + \protect\textheight\space and/or + \protect\lowermargin\space + are too large for \protect\paperheight\space + by \the\@tempdima}% + {\@ehd} + \fi + \@tempdima = \uppermargin + \advance\@tempdima -\headheight + \advance\@tempdima -\headsep + \ifdim\@tempdima<\@tempdimb + \@tempdima = -\@tempdima + \@memerror{\protect\headheight\space and/or + \protect\headsep\space + are too large for \protect\uppermargin\space + by \the\@tempdima}% + {\@ehd} + \fi + \@tempdima = \lowermargin + \advance\@tempdima -\footskip + \ifdim\@tempdima<\z@ + \@tempdima = -\@tempdima + \@memerror{\protect\footskip + is too large for \protect\lowermargin\space + by \the\@tempdima}% + {\@ehd} + \fi +} +\renewcommand*{\checkandfixthelayout}[1][classic]{% + \checkthelayout[#1]% + \fixthelayout + \typeoutlayout} + +\newcommand*{\midsloppy}{% + \tolerance 5000% + \hbadness 4000% + \emergencystretch 1.5em% + \hfuzz .1\p@ + \vfuzz\hfuzz} +\newenvironment{midsloppypar}{\par\midsloppy}{\par} + +\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} + +\renewcommand*{\defaultlists}{% + \setlength{\partopsep}{0.2\onelineskip \@plus 0.1\onelineskip + \@minus 0.1\onelineskip}% + \parsepi = 0.3333\onelineskip \@plus 0.1667\onelineskip \@minus \p@ + \itemsepi = \parsepi + \topsepi = 0.6667\onelineskip \@plus 0.3333\onelineskip + \@minus 0.2\onelineskip + \parsepii = 0.1667\onelineskip \@plus \p@ \@minus \p@ + \topsepii = \parsepi + \topsepiii = \parsepii + \everylistparindent \z@} +\defaultlists + +\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\z@} + +\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\z@} + +\renewcommand*{\tightlists}{% + \@ifstar{\m@mstightlists}{\m@mtightlists}} + +\newcommand*{\m@mstightlists}{% + \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}% + \parsepi = \z@ \@plus \p@ \@minus \p@ + \itemsepi = \parsepi + \topsepi = \z@ \@plus \p@ \@minus \p@ + \parsepii = \z@ \@plus \p@ \@minus \p@ + \topsepii = \parsepi + \topsepiii = \parsepii + \everylistparindent\parindent} + +\newcommand*{\m@mtightlists}{% + \setlength{\partopsep}{0.5\onelineskip \@plus \p@ \@minus \p@}% + \parsepi = \z@ \@plus \p@ \@minus \p@ + \itemsepi = \parsepi + \topsepi = \z@ \@plus \p@ \@minus \p@ + \parsepii = \z@ \@plus \p@ \@minus \p@ + \topsepii = \parsepi + \topsepiii = \parsepii + \everylistparindent\parindent} + \endinput %% %% End of file `mempatch.sty'. diff --git a/Master/texmf-dist/tpm/memoir.tpm b/Master/texmf-dist/tpm/memoir.tpm index 9d5c0077c2a..993a0ba8779 100644 --- a/Master/texmf-dist/tpm/memoir.tpm +++ b/Master/texmf-dist/tpm/memoir.tpm @@ -3,7 +3,7 @@ <rdf:Description about="http://texlive.dante.de/texlive/Package/memoir.zip"> <TPM:Name>memoir</TPM:Name> <TPM:Type>Package</TPM:Type> - <TPM:Date>2006/01/11 23:55:00</TPM:Date> + <TPM:Date>2006/08/13 23:42:26</TPM:Date> <TPM:Version>3.11</TPM:Version> <TPM:Creator>rahtz</TPM:Creator> <TPM:Title> @@ -22,7 +22,7 @@ hyphenation, typewriter font). Documents can use 9pt, 10pt, <TPM:Author>Peter R. Wilson</TPM:Author> <TPM:Size>4025857</TPM:Size> <TPM:Build/> - <TPM:RunFiles size="306774"> + <TPM:RunFiles size="349863"> texmf-dist/makeindex/memoir/memman.ist texmf-dist/tex/latex/memoir/mem10.clo texmf-dist/tex/latex/memoir/mem11.clo @@ -35,16 +35,18 @@ texmf-dist/tex/latex/memoir/memoir.cls texmf-dist/tex/latex/memoir/mempatch.sty texmf-dist/tpm/memoir.tpm </TPM:RunFiles> - <TPM:DocFiles size="2891339"> + <TPM:DocFiles size="3093675"> texmf-dist/doc/latex/memoir/README texmf-dist/doc/latex/memoir/basic.gst texmf-dist/doc/latex/memoir/memman.pdf texmf-dist/doc/latex/memoir/memman.tex texmf-dist/doc/latex/memoir/memmanadd.pdf </TPM:DocFiles> - <TPM:SourceFiles size="827744"> + <TPM:SourceFiles size="946342"> texmf-dist/source/latex/memoir/memoir.dtx texmf-dist/source/latex/memoir/memoir.ins +texmf-dist/source/latex/memoir/mempatch.dtx +texmf-dist/source/latex/memoir/mempatch.ins </TPM:SourceFiles> <TPM:Provides>Package/memoir</TPM:Provides> </rdf:Description> |