summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-12-18 01:42:25 +0000
committerKarl Berry <karl@freefriends.org>2006-12-18 01:42:25 +0000
commit7fc8fcceed56744d8819f2f6d4b161e4c0ab0c8c (patch)
tree167eddad6b8d916f73a9062aab831e13a463ea4e /Master/texmf-dist/source
parentccf854d76f6934910055d7aef79003558819348b (diff)
memoir update 15dec06
git-svn-id: svn://tug.org/texlive/trunk@2773 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rwxr-xr-xMaster/texmf-dist/source/latex/memoir/mempatch.dtx2459
1 files changed, 2453 insertions, 6 deletions
diff --git a/Master/texmf-dist/source/latex/memoir/mempatch.dtx b/Master/texmf-dist/source/latex/memoir/mempatch.dtx
index 89458384cc0..6f2eeb6f762 100755
--- a/Master/texmf-dist/source/latex/memoir/mempatch.dtx
+++ b/Master/texmf-dist/source/latex/memoir/mempatch.dtx
@@ -19,7 +19,7 @@
%
%
% \fi
-% \CheckSum{3392}
+% \CheckSum{6168}
%
% \def\dtxfile{\texttt{mempatch.dtx}}
% \def\fileversion{v1.0} \def\filedate{2003/10/04}
@@ -53,6 +53,7 @@
% \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}
+% \def\fileversion{v4.6} \def\filedate{2006/12/11}
%
% \title{The LaTeX \Lpack{memoir} class for configurable book
% typesetting: Code patches\thanks{This
@@ -282,6 +283,10 @@
%% \usepackage[...]{hyperref}
%% \usepackage{memhfixc}
%%
+%% With thanks to Heiko Oberdiek, if you use hyperref dated 2006/11/15
+%% or later, memhfixc will be automatically loaded after hyperref.
+%%
+%% Version 1.9 2006/11/22
%% Version 1.8 2006/01/21
%% Version 1.7 2005/11/15
%% Version 1.6 2004/05/13
@@ -296,7 +301,7 @@
%
%
% \begin{macrocode}
-\ProvidesPackage{memhfixc}[2006/01/21 v1.8 nameref/hyperref package fixes for memoir class]
+\ProvidesPackage{memhfixc}[2006/11/22 v1.9 nameref/hyperref package fixes for memoir class]
% \end{macrocode}
%
% \begin{macro}{\M@hfixcfinish}
@@ -480,8 +485,10 @@
% \begin{macro}{\@@writetorep}
% Change \Lpack{hyperref}'s \cs{@@writetorep} as memoir uses \cs{partnumberline} and
% \cs{chapternumberline} as well as the normal \cs{numberline}
-%
+% \changes{v1.9}{2006/11/22}{\cs{@@writetorep} now in hyperref 2006/11/15}
% \begin{macrocode}
+\@ifpackagelater{hyperref}{2006/11/15}{%
+}{%
\def\@@writetorep#1#2#3#4#5{%
\begingroup
\def\Hy@tempa{#5}%
@@ -535,7 +542,7 @@
{\Hy@tempa}{\Hy@tempb}%
}%
\fi
- \endgroup
+ \endgroup}
}
% \end{macrocode}
@@ -765,8 +772,11 @@
% ^^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]
+% ^^A \ProvidesFile{mempatch.sty}[2006/07/10 v4.5 Patches for memoir class v1.618]
+% ^^A \ProvidesFile{mempatch.sty}[2006/08/08 v4.5 Patches for memoir class v1.618]
% \begin{macrocode}
-\ProvidesFile{mempatch.sty}[2006/08/08 v4.5 Patches for memoir class v1.618]
+\ProvidesFile{mempatch.sty}[2006/12/11 v4.6 Patches for memoir class v1.618]
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Version 4.0 was released simultaneously with version 1.618 of memoir.
@@ -784,6 +794,11 @@
%%% and a \DisemulatePackage macro to negate a prior \EmulatedPackage.
%%% It also provides the functions of the pagenote package for end notes.
%%% See the code (near the end) for details.
+%%%
+%%% Version 4.6 fixes all known bugs and provides means of increasing
+%%% the interlinear and interparagraph spacing, adds some minor new commands,
+%%% and provides about a dozen more built-in chapterstyles.
+%%% See the code (near the end) for details.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \end{macrocode}
@@ -1693,6 +1708,8 @@
% in a CTT posting \textit{memoir, openleft and \cs{clear*page} commands} on
% 2006/01/04 that an index did not start on a verso page when the
% \textsf{openleft} option is in effect.
+% On 2006/12/06 Lars Madsen asked for an `indexpagestyle'. It's easier
+% to add it here than under version 4.6.
% \begin{macrocode}
\renewenvironment{theindex}{%
\clearforchapter% <- added
@@ -1716,7 +1733,8 @@
\phantomsection
\addcontentsline{toc}{chapter}{\indexname}
\fi
- \thispagestyle{chapter}\parindent\z@
+%%% \thispagestyle{chapter}\parindent\z@ % <- changed in v4.6
+ \thispagestyle{indextitlepagestyle}\parindent\z@
\parskip\z@ \@plus .3\p@\relax
\let\item\@idxitem}%
{\if@restonecol\onecolumn\else\twocolumn\fi}
@@ -2304,6 +2322,18 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\toclevel@none}
+% \begin{macro}{\toclevel@all}
+% Couple of extras for hypperef to cater for \texttt{all} and \texttt{none}
+% as `division levels'.
+% \begin{macrocode}
+\newcommand*{\toclevel@none}{-10}
+\newcommand*{\toclevel@all}{50}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \section{Mempatch version 4.5}
%
% \begin{macrocode}
@@ -2331,6 +2361,7 @@
\renewcommand{\@nameedef}[1]{%
\expandafter\protected@edef\csname #1\endcsname}
+
% \end{macrocode}
% \end{macro}
%
@@ -3733,6 +3764,2422 @@
% \end{macro}
% \end{macro}
%
+%
+%
+% \section{Mempatch version 4.6}
+%
+% \begin{macrocode}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% Version 4.6 (2006/11/22 and later)
+
+% \end{macrocode}
+%
+%
+% \subsection{Double spacing}
+%
+% This is an embedding of the code from the \Lpack{setspace} package, with
+% names changed.
+%
+% \begin{macrocode}
+\EmulatedPackage{setspace}
+
+% \end{macrocode}
+%
+% \begin{macro}{\setSpacing}
+% \cs{setSpacing}\marg{num} effectively increases the \cs{baselineskip} to \meta{num}*\cs{baselineskip}
+% \begin{macrocode}
+\newcommand{\setSpacing}[1]{%
+ \def\baselinestretch{#1}%
+ \@currsize}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setSingleSpace}
+% \cs{setSingleSpace}\marg{num} effectively increases the \cs{baselineskip} for single
+% spacing to \meta{num}*\cs{baselineskip} (\meta{num} should be close to 1.0).
+% \begin{macrocode}
+\newcommand*{\setSingleSpace}[1]{%
+ \def\m@m@singlespace{#1}}
+\setSingleSpace{1}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SingleSpacing}
+% \cs{SingleSpacing} starts single spacing.
+% \begin{macrocode}
+%%% start single spacing
+\newcommand*{\SingleSpacing}{%
+ \setSpacing{\m@m@singlespace}%
+ \vskip\baselineskip% correction for coming into single spacing
+}
+\SingleSpacing
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\OnehalfSpacing}
+% \cs{OnehalfSpacing} starts `one and a half' spacing, which to most thesis nitpickers
+% will look like double spacing.
+% \begin{macrocode}
+%%% start `one and a half spacing', the elegant version of double spacing.
+\newcommand*{\OnehalfSpacing}{
+ \setSpacing{1.25}% default (10pt)
+ \ifcase \@ptsize \relax % 10pt
+ \setSpacing{1.25}%
+ \or% 11pt
+ \setSpacing{1.213}%
+ \or% 12pt
+ \setSpacing{1.241}%
+ \or\or% 14pt
+ \setSpacing{1.20}%
+ \or\or\or% 17pt
+ \setSpacing{1.16}%
+ \or\or% 9pt
+ \setSpacing{1.35}%
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DoubleSpacing}
+% \cs{DoubleSpacing} starts double spacing, which to most thesis nitpickers
+% will look far too spaced out.
+% \begin{macrocode}
+%%% start double spacing, which looks terrible.
+\newcommand*{\DoubleSpacing}{
+ \setSpacing{1.667}% default (10pt)
+ \ifcase \@ptsize \relax % 10pt
+ \setSpacing{1.667}%
+ \or% 11pt
+ \setSpacing{1.618}%
+ \or% 12pt
+ \setSpacing{1.655}%
+ \or\or% 14pt
+ \setSpacing{1.60}%
+ \or\or\or% 17pt
+ \setSpacing{1.545}%
+ \or\or% 9pt
+ \setSpacing{1.8}%
+ \fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@setsize}
+% Modify the kernel command.
+% \begin{macrocode}
+\renewcommand*{\@setsize}[4]{%
+ \@nomath#1%
+ \let\@currsize#1%
+ \baselineskip #2%
+ \baselineskip \baselinestretch\baselineskip
+ \parskip \baselinestretch\parskip
+ \setbox\strutbox \hbox{%
+ \vrule height.7\baselineskip
+ depth .3\baselineskip
+ width \z@}%
+ \skip\footins \baselinestretch\skip\footins
+ \normalbaselineskip\baselineskip#3#4}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{environment}{SingleSpace}
+% Environment form of \cs{SingleSpacing}.
+% \begin{macrocode}
+%%% Environment form of \SingleSpacing.
+\newenvironment{SingleSpace}{%
+ \vskip\baselineskip
+ \setSpacing{\m@m@singlespace}%
+ \vskip -\baselineskip
+}{\par}
+
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{SingleSpace*}
+% Don't use this; it's only here to match the \Lpack{setspace} package.
+% \begin{macrocode}
+\newenvironment{SingleSpace*}{%
+% \vskip\baselineskip
+ \setSpacing{\m@m@singlespace}%
+ \vskip 0.5\baselineskip
+}{\vskip -0.5\baselineskip}
+
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\m@mrestore@spacing}
+% \begin{macrocode}
+\newcommand*{\m@mrestore@spacing}{%
+ \par
+ \vskip \parskip
+ \vskip \baselineskip
+ \endgroup
+ \vskip -\parskip
+ \vskip -\baselineskip}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{Spacing}
+% \begin{macrocode}
+%%% \begin{Spacing}{num} baselineskip is increased to num*baselineskip.
+\newenvironment{Spacing}[1]{%
+ \par
+ \begingroup
+ \setSpacing{#1}}{\m@mrestore@spacing}
+
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{OnehalfSpace}
+% \begin{macrocode}
+%%% Environment form of \OnehalfSpacing
+\newenvironment{OnehalfSpace}{%
+ \begingroup
+ \OnehalfSpacing}{\m@mrestore@spacing}
+
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{DoubleSpace}
+% \begin{macrocode}
+%%% Environment form of \DoubleSpacing
+\newenvironment{DoubleSpace}{%
+ \begingroup
+ \DoubleSpacing}{\m@mrestore@spacing}
+
+% \end{macrocode}
+% \end{environment}
+%
+% Deal with spacing around displays.
+%
+% \begin{macro}{\memdskipstretch}
+% \begin{macro}{\setDisplayskipStretch}
+% \begin{macro}{\noDisplayskipStretch}
+% \begin{macrocode}
+%%% \setDisplayskipStretch{num} changes space around displays by the factor
+%%% (1+num).
+%%% \noDisplayskipStretch keeps the regular space around displays.
+\newcommand*{\memdskipstretch}{0.0}
+\newcommand*{\setDisplayskipStretch}[1]{%
+ \renewcommand*{\memdskipstretch}{#1}}
+\newcommand*{\noDisplayskipStretch}{\setDisplayskipStretch{0.0}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\memdskips}
+% Macro added to \cs{everydisplay}, changing the settings of displayskips
+% \begin{macrocode}
+\newcommand*{\memdskips}{%
+ \advance\abovedisplayskip \memdskipstretch\abovedisplayskip
+ \advance\belowdisplayskip \memdskipstretch\belowdisplayskip
+ \advance\abovedisplayshortskip \memdskipstretch\abovedisplayshortskip
+ \advance\belowdisplayshortskip \memdskipstretch\belowdisplayshortskip
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\everydisplay}
+% \begin{macrocode}
+\everydisplay\expandafter{%
+ \the\everydisplay
+ \memdskips}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@xfloat}
+% Reset \cs{baselinestretch} in floats.
+% \begin{macrocode}
+\let\m@m@xfloat\@xfloat
+\def\@xfloat #1[#2]{%
+ \m@m@xfloat #1[#2]%
+ \def\baselinestretch{\m@m@singlespace}%
+ \normalsize}
+
+% \end{macrocode}
+% \end{macro}
+%
+% The extra spacing does not add space before and after a minipage.
+% The solution, hinted at by Donald Arseneau, is to create a new
+% environment. I came up with a solution which DA then much improved upon
+% (CTT \textit{setspace and minipages}, 2006/11/28).
+% This is like minipage from an author's view, except that it is
+% always top positioned and acts like a paragraph.
+% \begin{macro}{\memPD}
+% \begin{macrocode}
+\newdimen\memPD
+% \end{macrocode}
+% \end{macro}
+% \begin{environment}{vminipage}
+% The user view, just as for \texttt{minipage}, but ensures the \texttt{t}
+% position and as a new paragraph.
+% \begin{macrocode}
+%%% vminipage is like minipage but with better fore and aft spacing.
+\newenvironment{vminipage}{%
+ \par
+ \@ifnextchar[%]
+ \@ivminipage
+ {\@iiiminipage t\relax[s]}
+}{%
+ \par\global\memPD=\prevdepth
+ \endminipage
+ \par
+ \kern-\memPD% no pagebreak allowed here
+ \hbox{\vrule depth \memPD width \z@}}
+
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\@ivminipage}
+% Deal with first optional argument to \texttt{vminipage}.
+% \begin{macrocode}
+ \def\@ivminipage[#1]{%
+ \@ifnextchar[%]
+ {\@iiminipage{t}}{\@iiiminipage{t}\relax[s]}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% We want single spacing in footnotes. Memoir has redone much of the footnote
+% stuff, so we have to modify the modified versions.
+%
+% \begin{macro}{\@footnotetext}
+% \begin{macro}{\@mpfootnotetext}
+% \begin{macro}{\m@mold@footnotetext}
+% \begin{macro}{\m@mold@mpfootnotetext}
+% Single spacing in footnotes.
+% \begin{macrocode}
+%%% Ensure single spacing in footnotes
+%%%
+
+\renewcommand{\@footnotetext}[1]{%
+ \insert\footins{%
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\foottextfont
+ \@preamfntext
+ \hsize\columnwidth
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark
+ }%
+ \color@begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces{\foottextfont #1}%
+ \@finalstrut\strutbox}%
+ \color@endgroup}\m@mmf@prepare}
+
+\renewcommand{\@mpfootnotetext}[1]{%
+ \global\setbox\@mpfootins\vbox{%
+ \unvbox \@mpfootins
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\foottextfont
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark
+ }%
+ \color@begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces{\foottextfont #1}
+ \@finalstrut\strutbox}%
+ \color@endgroup}\m@mmf@prepare}
+
+\let\m@mold@footnotetext\@footnotetext
+\let\m@mold@mpfootnotetext\@mpfootnotetext
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\plainfootnotes}
+% \begin{macrocode}
+\renewcommand{\plainfootnotes}{%
+ \let\@footnotetext\m@mold@footnotetext
+ \let\@mpfootnotetext\m@mold@mpfootnotetext}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\m@make@footnotetext}
+% \begin{macro}{\m@make@mpfootnotetext}
+% \begin{macrocode}
+\renewcommand{\m@make@footnotetext}[1]{%
+ \@namelongdef{@footnotetext#1}##1{%
+ \insert\@nameuse{footins#1}{%
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\@nameuse{foottextfont#1}%
+ \@preamfntext
+ \hsize\columnwidth
+ \protected@edef\@currentlabel{%
+ \csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}%
+ }%
+ \color@begingroup
+ \@nameuse{@makefntext#1}{%
+ \rule\z@\footnotesep\ignorespaces{\@nameuse{foottextfont#1} ##1}%
+ \@finalstrut\strutbox}%
+ \color@endgroup}\m@mmf@prepare}}
+
+\renewcommand{\m@make@mpfootnotetext}[1]{%
+ \@namelongdef{@mpfootnotetext#1}##1{%
+ \global\setbox\@nameuse{@mpfootins#1}\vbox{%
+ \unvbox \@nameuse{@mpfootins#1}%
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\@nameuse{foottextfont#1}%
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}%
+ }%
+ \color@begingroup
+ \@nameuse{@makefntext#1}{%
+ \rule\z@\footnotesep\ignorespaces{\@nameuse{foottextfont#1} ##1}
+ \@finalstrut\strutbox}%
+ \color@endgroup}\m@mmf@prepare}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@twocolfootnotetext}
+% \begin{macro}{\@mptwocolfootnotetext}
+% \begin{macrocode}
+\renewcommand{\@twocolfootnotetext}[1]{%
+ \insert\footinsv@r{%
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\foottextfont
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark
+ }%
+ \color@begingroup
+ \@twocolfootfmt{#1}%
+ \color@endgroup}\m@mmf@prepare}
+
+\renewcommand{\@mptwocolfootnotetext}[1]{%
+ \global\setbox\@mpfootinsv@r\vbox{%
+ \unvbox \@mpfootinsv@r
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\foottextfont
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark
+ }%
+ \color@begingroup
+ \@twocolfootfmt{#1}%
+ \color@endgroup}\m@mmf@prepare}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\m@maketwocolfootnotetext}
+% \begin{macro}{\m@make@mptwocolfootnotetext}
+% \begin{macrocode}
+\renewcommand{\m@make@twocolfootnotetext}[1]{%
+ \@namelongdef{@twocolfootnotetext#1}##1{%
+ \insert\@nameuse{footins#1}{%
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\@nameuse{foottextfont#1}%
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}%
+ }%
+ \color@begingroup
+ \@nameuse{@twocolfootfmt#1}{##1}
+ \color@endgroup}\m@mmf@prepare}}
+
+\renewcommand{\m@make@mptwocolfootnotetext}[1]{%
+ \@namelongdef{@mptwocolfootnotetext#1}##1{%
+ \global\setbox\@nameuse{@mpfootins#1}\vbox{%
+ \unvbox \@nameuse{@mpfootins#1}%
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\@nameuse{foottextfont#1}%
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}%
+ }%
+ \color@begingroup
+ \@nameuse{@twocolfootfmt#1}{##1}%
+ \color@endgroup}\m@mmf@prepare}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@threecolfootnotetext}
+% \begin{macro}{\@mpthreecolfootnotetext}
+% \begin{macrocode}
+\renewcommand{\@threecolfootnotetext}[1]{%
+ \insert\footinsv@r{%
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\foottextfont
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark
+ }%
+ \color@begingroup
+ \@threecolfootfmt{#1}%
+ \color@endgroup}\m@mmf@prepare}
+
+\renewcommand{\@mpthreecolfootnotetext}[1]{%
+ \global\setbox\@mpfootinsv@r\vbox{%
+ \unvbox \@mpfootinsv@r
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\foottextfont
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark
+ }%
+ \color@begingroup
+ \@threecolfootfmt{#1}%
+ \color@endgroup}\m@mmf@prepare}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\m@makethreecolfootnotetext}
+% \begin{macro}{\m@make@mpthreecolfootnotetext}
+% \begin{macrocode}
+\renewcommand{\m@make@threecolfootnotetext}[1]{%
+ \@namelongdef{@threecolfootnotetext#1}##1{%
+ \insert\@nameuse{footins#1}{%
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\@nameuse{foottextfont#1}%
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}%
+ }%
+ \color@begingroup
+ \@nameuse{@threecolfootfmt#1}{##1}
+ \color@endgroup}\m@mmf@prepare}}
+
+\renewcommand{\m@make@mpthreecolfootnotetext}[1]{%
+ \@namelongdef{@mpthreecolfootnotetext#1}##1{%
+ \global\setbox\@nameuse{@mpfootins#1}\vbox{%
+ \unvbox \@nameuse{@mpfootins#1}%
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\@nameuse{foottextfont#1}%
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}%
+ }%
+ \color@begingroup
+ \@nameuse{@threecolfootfmt#1}{##1}%
+ \color@endgroup}\m@mmf@prepare}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@parafootnotetext}
+% \begin{macro}{\@mpparafootnotetext}
+% \begin{macrocode}
+\renewcommand{\@parafootnotetext}[1]{%
+ \insert\footinsv@r{%
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\foottextfont
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark
+ }%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@parafootfmt{#1}%
+ \color@endgroup}\m@mungebox}%
+ \m@mmf@prepare}
+
+\renewcommand{\@mpparafootnotetext}[1]{%
+ \global\setbox\@mpfootinsv@r\vbox{%
+ \unvbox \@mpfootinsv@r
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\foottextfont
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark
+ }%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@parafootfmt{#1}%
+ \color@endgroup}\m@mungebox}%
+ \m@mmf@prepare}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\m@makeparafootnotetext}
+% \begin{macro}{\m@make@mpparafootnotetext}
+% \begin{macrocode}
+\renewcommand{\m@make@parafootnotetext}[1]{%
+ \@namelongdef{@parafootnotetext#1}##1{%
+ \insert\@nameuse{footins#1}{%
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\@nameuse{foottextfont#1}%
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}%
+ }%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@nameuse{@parafootfmt#1}{##1}
+ \color@endgroup}\m@mungebox}\m@mmf@prepare}}
+
+\renewcommand{\m@make@mpparafootnotetext}[1]{%
+ \@namelongdef{@mpparafootnotetext#1}##1{%
+ \global\setbox\@nameuse{@mpfootins#1}\vbox{%
+ \unvbox \@nameuse{@mpfootins#1}%
+ \def\baselinestretch{\m@m@singlespace}
+ \reset@font\@nameuse{foottextfont#1}%
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}%
+ }%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@nameuse{@parafootfmt#1}{##1}%
+ \color@endgroup}\m@mungebox}\m@mmf@prepare}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsection{Abnormal parskips}
+%
+% Non-zero, positive \cs{parskip}, which is not to be encouraged. Code
+% based on Robin Fairbairns \Lpack{parskip} package and the NTG classes.
+%
+% Prevent loading of the \Lpack{parskip} package.
+% \begin{macrocode}
+\EmulatedPackage{parskip}
+
+% \end{macrocode}
+%
+% \begin{macro}{\ifm@mnzpskip}
+% \begin{macro}{\m@mnzpskiptrue}
+% \begin{macro}{\m@mnzpskipfalse}
+% \cs{ifm@mnzpskip} is TRUE if \cs{parskip} set to antything but 0pt.
+% \begin{macrocode}
+\newif\ifm@mnzpskip
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\traditionalparskip}
+% \begin{macro}{\m@mabparskip}
+% \begin{macro}{\abnormalparskip}
+% \begin{macro}{\nonzeroparskip}
+% \begin{macrocode}
+%%% \traditionalparskip set \parskip to 0pt.
+\newcommand*{\traditionalparskip}{%
+ \parskip \z@
+ \m@mnzpskipfalse}
+\newskip\m@mabparskip
+%%% \abnormalparskip{length} sets \parskip to length.
+\newcommand*{\abnormalparskip}[1]{%
+ \setlength{\parskip}{#1}\m@mabparskip=#1\relax
+ \m@mnzpskiptrue}
+%%% \nonzeroparskip sets \parskip to a non-zero value that might be
+%%% not too bad (any non-zero \parskip is not good).
+\newcommand*{\nonzeroparskip}{\abnormalparskip{%
+ 0.5\baselineskip
+ \@plus .1\baselineskip \@minus .1\baselineskip% NTG
+%% 0.5/baselineskip \@plus 2pt% RF
+}}
+\traditionalparskip
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\defaultlists}
+% \begin{macro}{\tightlists}
+% Change these to cater for abnormal \cs{parskip}s
+% \begin{macrocode}
+%%% Change lists to cater for non-zero \parskip.
+\newlength{\itemsepii}
+\newlength{\itemsepiii}
+\newlength{\partopsepiii}
+%%%\newskip\parsepiii
+\let\m@mold@defaultlists\defaultlists
+\renewcommand*{\defaultlists}{%
+ \m@mold@defaultlists
+ \itemsepii\parsepii
+ \itemsepiii\topsepiii
+ \partopsepiii \p@ \@plus\z@ \@minus\p@
+ \ifm@mnzpskip
+ \partopsep \p@ \@plus\z@ \@minus\p@
+ \topsepi\z@
+ \parsepi\parskip
+ \itemsepi\z@
+ \topsepii\z@
+ \parsepii\parskip
+ \itemsepii\z@
+ \topsepiii\z@
+%% \parsepiii\parskip
+ \itemsepiii\z@
+ \fi}
+
+\let\m@mold@tightlists\tightlists
+\renewcommand*{\tightlists}{%
+ \m@mold@tightlists
+ \ifm@mnzpskip
+ \partopsep \p@ \@plus\z@ \@minus\p@
+ \topsepi\z@
+ \parsepi\parskip
+ \itemsepi\z@
+ \topsepii\z@
+ \parsepii\parskip
+ \itemsepii\z@
+ \topsepiii\z@
+%% \parsepiii\parskip
+ \itemsepiii\z@
+ \partopsepiii\partopsep
+ \fi}
+
+\let\@listI\@listi
+\defaultlists
+\@listi
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\@listii}
+% \begin{macro}{\@listiii}
+% \begin{macrocode}
+\renewcommand*{\@listii}{%
+ \leftmargin\leftmarginii
+ \labelwidth\leftmarginii
+ \advance\labelwidth-\labelsep
+ \topsep\topsepii
+ \parsep\parsepii
+ \itemsep\itemsepii}
+\renewcommand*{\@listiii}{%
+ \leftmargin\leftmarginiii
+ \labelwidth\leftmarginiii
+ \advance\labelwidth-\labelsep
+ \topsep\topsepiii
+ \parsep\z@
+ \itemsep\itemsepiii
+ \partopsep\partopsepiii}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+%
+% \begin{macro}{\verbatim}
+% From NTG, where it is a \cs{def}
+% \begin{macrocode}
+\providecommand*{\verbatim}{%
+ \topsep=-0.5\parskip
+ \@verbatim
+ \frenchspacing\@vobeyspaces \@xverbatim}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@minpagerestore}
+% From NTG
+% \begin{macrocode}
+\providecommand*{\@minipagerestore}{%
+ \parskip=.5\baselineskip \@plus .1\baselineskip \@minus .1\baselineskip}
+% \end{macrocode}
+% But there are two conflicting earlier definitions which I'll now combine.
+% \begin{macrocode}
+\renewcommand*{\@minipagerestore}{%
+ \let\@verbfootnotetext\@verbmpfootnotetext% for \verbfootnotein a minipage
+ \m@mdoextrafeetmini% footnotes in minipages
+ \ifm@mnzpskip \parskip=\m@mabparskip\fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% Use zero \cs{parskip} in ToC listing. Already done in memoir.
+%
+%
+%
+%
+% \subsection{Side captions}
+%
+% \begin{macro}{\setsidecaps}
+% Ivars Finvers (\texttt{ifinvers@ucalgary.ca}) noted (2006/09/26)
+% that the settings for
+% \cs{sidecapwidth} and \cs{sidecapsep} didn't change if the marginal note
+% settings were changed via \cs{checkandfixthelayout}. These settings get
+% checked at setting time, not at \cs{checkand...}.
+% \begin{macrocode}
+%%% \setsidecaps{<sep>}{<width>} sets sidecaption lengths
+\newcommand*{\setsidecaps}[2]{%
+ \setlength{\sidecapsep}{#1}\@memznegtest{\sidecapsep}%
+ \setlength{\sidecapwidth}{#2}\@memznegtest{\sidecapwidth}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Sidebars}
+%
+% Donald Arseneau came up with some improvements to sidebars. The impetus
+% for this came from a CTT thread, \textit{whitespace after my command},
+% 2006/11/30 and earlier. In email to me on 2006/11/30 he said:
+% \begin{quotation}
+% For \Lclass{memoir} \cs{sidebar}, it seems the rules are expanding
+% to fill the space for the sidebar, so here is my suggested change
+% to \cs{sidecontents}.
+%
+% It occurs to me that a separate \cs{sidetsep} (or \cs{sidetopsep})
+% would be more valuable than having an explicit 1\cs{onelineskip}.
+%
+% I grouped common code into two macros, and altered \cs{sidebarform} too.
+% \end{quotation}
+%
+% Since then we have been going back and forth, with the result that
+% practically all the complex code is Donald's.
+%
+% \begin{macro}{\m@sideb@left}
+% \begin{macro}{\m@sideb@right}
+% Some common code for use later.
+% \begin{macrocode}
+\newcommand*{\m@sideb@left}{%
+ \@tempdimc \sidebarwidth
+ \advance\@tempdimc\sidebarhsep
+ \kern-\@tempdimc}
+\newcommand*{\m@sideb@right}{%
+ \@tempdimc \columnwidth% or \hsize
+ \advance\@tempdimc\sidebarhsep
+ \kern\@tempdimc}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\sidebartopsep}
+% New length for separation at the top of a sidebar.
+% \begin{macrocode}
+\newlength{\sidebartopsep}
+ \setlength{\sidebartopsep}{0pt}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sidebarfont}
+% \begin{macrocode}
+\renewcommand*{\sidebarfont}{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setsidebarheight}
+% The macro \cs{setsidebarheight}\marg{height} sets the total height
+% of sidebars on a page to \meta{height}. This is an interface for
+% controlling \verb?\dimen\sideins? properly, taking account of \cs{topskip}
+% and the sidebar font size (and therefore should be invoked \emph{after}
+% declaring \cs{sidebarfont}).
+%
+% Note that \cs{sidebartopsep} is \emph{not} included as part of the
+% allocated height.
+% \begin{macrocode}
+\renewcommand*{\setsidebarheight}[1]{%
+ \setlength{\dimen\sideins}{#1}%
+ \advance\dimen\sideins-\topskip
+ \advance\dimen\sideins\ht\strutbox}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setsidebars}
+% Macro to set the main sidebar parameters.
+% \begin{macrocode}
+%%% \setsidebars{hsep}{width}{vsep}{topsep}{font}{height}
+%%% A * argument means leave the setting as is.
+\newcommand*{\setsidebars}[6]{%
+ \nametest{#1}{*}\ifsamename\else
+ \setlength{\sidebarhsep}{#1}\@memznegtest{\sidebarhsep}%
+ \fi
+ \nametest{#2}{*}\ifsamename\else
+ \setlength{\sidebarwidth}{#2}\@memznegtest{\sidebarwidth}%
+ \fi
+ \nametest{#3}{*}\ifsamename\else
+ \setlength{\sidebarvsep}{#3}\@memnegtest{\sidebarvsep}%
+ \fi
+ \nametest{#4}{*}\ifsamename\else
+ \setlength{\sidebartopsep}{#4}%
+ \fi
+ \nametest{#5}{*}\ifsamename\else
+ \def\sidebarfont{#5}%
+ \fi
+ \nametest{#6}{*}\ifsamename\else
+ \setsidebarheight{#6}%
+ \ifdim\dimen\sideins>\z@\else
+ \@memerror{\protect\sidebarheight\space is zero or negative}{\@ehd}%
+ \fi
+ \fi}
+ \setsidebars{\marginparsep}% sidebarhsep
+ {\marginparwidth}% sidebarwidth
+ {\onelineskip}% sidebarvsep
+ {0pt}% sidebartopsep
+ {\normalsize\normalfont}% sidebarfont
+ {\textheight}% sidebarheight
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sidecontents}
+% \begin{macrocode}
+\renewcommand{\sidecontents}{\hbox to \z@{%
+ \if@twocolumn% %% put outside nearest column
+ \if@firstcolumn% %% move to left
+ \m@sideb@left
+ \else% %% move to right
+ \m@sideb@right
+ \fi
+ \else% %% put into foremargin?
+ \ifsidebaroneside% %% move to right
+ \m@sideb@right
+ \else% %% pick the margin
+ \ifcase\m@msidebar@margin% 0 to left
+ \m@sideb@left
+ \or% 1 to right
+ \m@sideb@right
+ \or% 2 to outer
+ \ifodd\c@page% %% move to right
+ \m@sideb@right
+ \else% %% move to left
+ \m@sideb@left
+ \fi
+ \or% 3 to inner
+ \ifodd\c@page% %% move to left
+ \m@sideb@left
+ \else %% move to right
+ \m@sideb@right
+ \fi
+ \fi
+ \fi
+ \fi
+% \end{macrocode}
+% DA and I have gone to and fro on the next bit of code trying to get
+% the top alignment correct. DA has the last word.
+% \begin{verbatim}
+% \vtop to0pt{%
+% \vskip\sidebartopsep
+% \unvbox\sideins \vss}%
+% \end{verbatim}
+% \begin{macrocode}
+% \vbox to0pt{%
+% \vskip\onelineskip \vskip-\topskip
+% \vskip\sidebartopsep
+% \unvbox\sideins \vss}%
+% \end{verbatim}
+% \begin{macrocode}
+ \vtop to0pt{%
+ \normalsize\normalfont\sidebarfont % select font so we know the strut size
+ \vskip\topskip \vskip-\ht\strutbox
+ \vskip\sidebartopsep % extra vertical shift
+ \unvbox\sideins \vss}%
+ \hss
+}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sidebar}
+% DA says that having stacked insertions position properly is difficult.
+% Here he uses the size of the strut to regulate both the height and the
+% depth of each insertion (much as for footnotes). The following is his
+% code and commentary.
+% \begin{macrocode}
+\renewcommand{\sidebar}[1]{%
+ \insert\sideins{%
+% \end{macrocode}
+% Begin the insertion with settings. The height of the strut box
+% (dependant on the font) will determine the top alignment both initially
+% and after a page break. The setting for maximum depth does not control
+% anything; see the code further on instead.
+% \begin{macrocode}
+ \hsize\sidebarwidth
+ \@parboxrestore
+ \sidebarform \normalsize\normalfont\sidebarfont
+ \splittopskip=\ht\strutbox
+ \splitmaxdepth=\dp\strutbox % doesn't do anything useful
+% \end{macrocode}
+% Allow a free split at the top (so this whole insertion moves
+% to the next page if it does not fit).
+% \begin{macrocode}
+ \allowbreak
+% \end{macrocode}
+% Control the (vertical) positioning of non-split entries. Footnotes (and
+% previous versions of \cs{sidebar}) us a strut at the beginning of the text,
+% but we will allow a baseline-skip to perform the same function. This
+% method also introduces a \cs{parskip} when the paragraph begins, so we
+% counteract that. (The problem with an initial strut is that it messes'
+% up entries that begin with vertical space.)
+% \begin{macrocode}
+ \prevdepth=\dp\strutbox % supersedes a "top-strut"
+ \vskip-\parskip
+% \end{macrocode}
+% Now the user's sidebar entry:
+% \begin{macrocode}
+ #1%
+% \end{macrocode}
+% If the entry ended still in a paragraph, take the chance to insert a
+% final strut; then end the paragraph.
+% \begin{macrocode}
+ \ifvmode\else
+ \unskip\@finalstrut\strutbox
+ \fi\par
+% \end{macrocode}
+% Explicitly force the effect of \cs{maxdepth} (\cs{splitmaxdepth}),
+% but using the depth of the strut in the r\^{o}le of \cs{maxdepth}.
+% \begin{macrocode}
+ \ifdim\prevdepth>\dp\strutbox \prevdepth=\dp\strutbox \fi
+% \end{macrocode}
+% Now control how adjacent entries abut (whether or not a final strut got
+% inserted) and how an entry fits at the bottom of the page. Use \cs{vskip}s
+% to move from the text bottom to where a strut would bottom out,
+% but insert an allowed breakpoint at the baseline position
+% (so that the entry baseline may match the page's baseline). Finally
+% insert the extra separation between entries.
+% \begin{macrocode}
+ \ifdim\prevdepth>99\p@
+ \nobreak
+ \vskip-\prevdepth
+ \allowbreak
+ \vskip\dp\strutbox
+ \fi
+ \vskip\sidebarvsep}}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Typeout the layout}
+%
+% Update this for sidecaptions and sidebars.
+%
+% \begin{macro}{\typeoutlayout}
+% Include the sidecap and sidebar settings.
+% \begin{macrocode}
+\renewcommand*{\typeoutlayout}{%
+ \typeout{}
+ \typeout{******************************************************}
+ \typeout{Stock height and width:
+ \the\stockheight\space by \the\stockwidth}
+ \typeout{Top and edge trims:
+ \the\trimtop\space and \the\trimedge}
+ \typeout{Page height and width:
+ \the\paperheight\space by \the\paperwidth}
+ \typeout{Text height and width:
+ \the\textheight\space by \the\textwidth}
+ \typeout{Spine and edge margins:
+ \the\spinemargin\space and \the\foremargin}
+ \typeout{Upper and lower margins:
+ \the\uppermargin\space and \the\lowermargin}
+ \typeout{Headheight and headsep:
+ \the\headheight\space and \the\headsep}
+ \typeout{Footskip:
+ \the\footskip}
+ \typeout{Columnsep and columnseprule:
+ \the\columnsep\space and \the\columnseprule}
+ \typeout{Marginparsep and marginparwidth:
+ \the\marginparsep\space and \the\marginparwidth}
+ \typeout{Sidecapsep and sidecapwidth:
+ \the\sidecapsep\space and \the\sidecapwidth}
+ \typeout{Sidebarhsep and sidebarwidth:
+ \the\sidebarhsep\space and \the\sidebarwidth}
+ \typeout{Sidebarvsep and sidebartopsep:
+ \the\sidebarvsep\space and \the\sidebartopsep}
+ \typeout{Sidebarheight:
+ \the\dimen\sideins}
+ \typeout{******************************************************}
+ \typeout{}}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Footnotes}
+%
+% Per Starb\"{a}ck found (CTT \textit{feetbelowfloat in memoir}, 2006/11/24)
+% that this didn't effect anything in \cs{raggedbottom}, contrary to the
+% claim in the manual.
+%
+% \begin{macro}{\setfootnoterule}
+% \cs{setfootnoterule}\oarg{vfill}\marg{uplift}\marg{width}\marg{thickness}
+% defines the \cs{footnoterule}.
+% \begin{macrocode}
+%%% user command to set the \footnoterule
+%%% \setfootnoterule[<fill>]{<uplift>}{<width>}{<thickness>}
+\newcommand*{\setfootnoterule}[4][]{%
+ \def\footnoterule{\kern -#2\relax #1\relax
+ \hrule width #3\relax
+ \kern #2\kern-#4}}
+%%%% memoir's default setting is:
+\setfootnoterule{3pt}{0.4\columnwidth}{\normalrulethickness}
+%%%% to force footnotes to the bottom after a \raggedbottom
+%%%% \setfootnoterule[\vfill]{3pt}{0.4\columnwidth}{\normalrulethickness}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Widows and sloppybottom}
+%
+% There was a discussion \textit{widow handling?} on CTT in
+% May 2006. \texttt{ivowel@gmail.com} wrote
+% \begin{quote}
+% in experimenting with raggedbottom, widowpenalty, and clubpenalty,
+% I think that I have not found a solution that strikes me as
+% particularly desirable. I think what I would really like is that
+% widows (i.e., left-over single lines that begin on the following
+% page) are resolved not by pushing one extra line from the same
+% paragraph also onto the next page, but by stretching the
+% \cs{textheight} to allow this one extra at the bottom of the
+% same page.
+% \end{quote}
+% Donald Arseneau, as he so often does, came up with a solution he
+% termed \cs{sloppybottom}. Here is a generalised version.
+%
+% \begin{macro}{\sloppybottom}
+% Allow an extra line on a page to save a widow.
+% \begin{macrocode}
+%%% \sloppybottom allows an extra line on a page to save a widow.
+%%% You must increase the \topskip (by 60\% is reasonable) and this
+%%% will push the text lower on the page. Run \checkandfixthelayout
+%%% after the change. For example:
+%%% \setlength{\topskip}{1.6\topskip}
+%%% \checkandfixthelayout
+%%% \sloppybottom
+%%% ...
+\newcommand*{\sloppybottom}{%
+ \def\@textbottom{\vskip \z@ \@plus.0001fil \@minus .95\topskip}%
+ \topskip=1\topskip \@plus 0.625\topskip \@minus .95\topskip
+ \def\@texttop{\vskip \z@ \@plus -0.625\topskip \@minus -0.95\topskip}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Quark marks}
+%
+% William Adams (2006/08/28) supplied the following code to use trim marks
+% along the style of Quark Xpress. He also supplied a basis for
+% \cs{printime} but I have used one from \textit{TeX for the Impatient}
+% as it saves some counters.
+% \begin{macro}{\m@mcalchm}
+% Calculate the hours and minutes from \cs{time}.
+% \begin{macrocode}
+%%% \m@mcalchm calculates the time of day. (Code basis from TeX for the Impatient)
+\newcommand*{\m@mcalchm}{%
+ \count0 = \time \divide \count0 by 60\relax
+ \count2 = \count0\relax% the hour
+ \count4 = \time \multiply\count0 by 60\relax
+ \advance\count4 by -\count0\relax% the minute
+ \ifnum\count4<10 \toks1 = {0}% make a leading zero
+ \else \toks1 = {}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hmpunct}
+% \begin{macro}{\amname}
+% \begin{macro}{\pmname}
+% User format controls for \cs{printtime}
+% \begin{macrocode}
+%%% punctuation, am and pm for \printtime
+\newcommand*{\hmpunct}{:}% hours minutes separator
+\newcommand*{\amname}{am}% ante meridiem
+\newcommand*{\pmname}{pm}% post meridiem
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\printtime}
+% \begin{macro}{\printtime*}
+% Print the time of day as 24 hour clock or 12 hour clock
+% \begin{macrocode}
+%%% \printtime prints time per 24 hour clock
+%%% \printtime* prints time per 12 hour clock
+\newcommand*{\printtime}{%
+ \@ifstar{\m@msprtime}{\m@mprtime}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\m@mprtime}
+% \begin{macro}{\m@msprtime}
+% These implement time printing: \cs{m@mprtime} as 24 hour clock and
+% \cs{m@msprtime} as 12 hour clock
+% \begin{macrocode}
+\newcommand*{\m@mprtime}{\begingroup
+ \m@mcalchm
+ \number\count2\hmpunct\the\toks1 \number\count4
+ \endgroup}
+\newcommand*{\m@msprtime}{\begingroup
+ \m@mcalchm
+ \def\@mpm{\pmname}%
+ \ifnum\count2<1\relax% early in the morning
+ \count2=12\relax
+ \ifnum\count4>0\relax% not midnight
+ \def\@mpm{\amname}%
+ \fi
+ \else
+ \ifnum\time<721\relax% noon or earlier
+ \def\@mpm{\amname}%
+ \else
+ \ifnum\time>779\relax% 1300 hrs or later
+ \advance\count2 by -12\relax
+ \fi
+ \fi
+ \fi
+ \number\count2\hmpunct\the\toks1 \number\count4\ \@mpm
+ \endgroup}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\registrationColour}
+% \begin{macro}{\quarkmarks}
+% \begin{macrocode}
+%%% \quarkmarks generates trim marks in the style of Quark Xpress
+%%% (Code supplied by William Adams)
+%%%
+\newcommand*{\registrationColour}[1]{#1}
+\newcommand*{\quarkmarks}{%
+\renewcommand*{\tmarktl}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-36,0){\line(1,0){24}}
+ \put(0,12){\line(0,1){24}}
+ \put(3,27){\ttfamily\fontsize{8bp}{10bp}\selectfont\jobname\ \
+ \today\ \ \printtime\ \ Page \thepage}
+ \end{picture}}}
+\renewcommand*{\tmarktm}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-24,24){\line(1,0){48}}
+ \put(0,12){\line(0,1){24}}
+ \put(0,24){\oval(12,12)}
+ \end{picture}}}
+\renewcommand*{\tmarktr}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(12,0){\line(1,0){24}}
+ \put(0,12){\line(0,1){24}}
+ \end{picture}}}
+\renewcommand*{\tmarkmr}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(12,0){\line(1,0){24}}
+ \put(24,-24){\line(0,1){48}}
+ \put(24,0){\oval(12,12)}
+ \end{picture}}}
+\renewcommand*{\tmarkbr}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(12,0){\line(1,0){24}}
+ \put(0,-36){\line(0,1){24}}
+ \end{picture}}}
+\renewcommand*{\tmarkbm}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-24,-24){\line(1,0){48}}
+ \put(0,-36){\line(0,1){24}}
+ \put(0,-24){\oval(12,12)}
+ \end{picture}}}
+\renewcommand*{\tmarkbl}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-36,0){\line(1,0){24}}
+ \put(0,-36){\line(0,1){24}}
+ \end{picture}}}
+\renewcommand*{\tmarkml}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-36,0){\line(1,0){24}}
+ \put(-24,-24){\line(0,1){48}}
+ \put(-24,0){\oval(12,12)}
+ \end{picture}}}
+\renewcommand*{\trimmarks}{%
+%% \special{papersize=\the\stockwidth,\the\stockheight}
+ {%
+ \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page
+ \hb@xt@\z@{\hskip-1in
+ \ifodd\c@page
+ \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+ \else
+ \if@twoside
+ \hskip\trimedge % left of logical page
+ \else
+ \hskip\stockwidth \hsip-\trimedge \hskip-\paperwidth
+ \fi
+ \fi
+ \vbox to \paperheight{%
+ \let\protect\relax % <- v1.4 addition
+ \hb@xt@\paperwidth{\tmarktl\hfil\tmarktm\hfil\tmarktr}%
+ \vfil
+ \hb@xt@\paperwidth{\tmarkml\hfil\tmarkmr}%
+ \vfil
+ \hb@xt@\paperwidth{\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
+ \hss}%
+ \vss}}%
+}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \subsection{Pagestyles}
+%
+% Lars Madsen (2006/11/03) noted that there were some missing \verb?%?
+% at the end of some lines in \cs{makepagestyle} that would cause
+% extraneous spaces in something like: \\
+% \verb?X\pagestyle{plain}X? \\
+% though I can't think that many would do this. In any case here is the
+% entire revised section from \texttt{memoir.dtx} \ldots
+%
+%
+% \begin{macro}{\makepagestyle}
+% At last we can put everything together for defining a new pagestyle,
+% via the macro \cs{makepagestyle}\marg{style} which initially sets up
+% a new pagestyle \meta{style} corresponding the the \LaTeX{} \texttt{empty}
+% pagestyle. The prior macros can then be used to make modifications
+% to the style.
+% \changes{v1.0}{2001/11/15}{Now 2 stage process for defining \cs{@evenhead}
+% and friends}
+% \changes{v1.61}{2004/03/14}{Added \cs{m@mhe@dreset} at several points in
+% \cs{makepagestyle} (from patch 2.1)}
+% \begin{macrocode}
+%%% Remove extraneous spaces from pagestyle code
+%%%
+\renewcommand*{\makepagestyle}[1]{%
+% \end{macrocode}
+% First define the macro \cs{ps@style}, which in turn defines the macros
+% \cs{@evenhead}, \cs{@oddhead}, \cs{@evenfoot} and \cs{@oddfoot}.
+% \begin{macrocode}
+ \@namedef{ps@#1}{%
+ \@namedef{#1@evenhead}{%
+% \end{macrocode}
+% The code for the definition of \cs{@evenhead} and friends is based on code
+% from Piet van Oostrum's \Lpack{fancyhdr} package~\cite{FANCYHDR}. The three
+% parts of the header are put into parboxes, with fills between them, and
+% the whole lot is put into a box the width of the header. Fillers are put
+% before and after the main box which control the header position.
+%
+% First the left filler which is either \cs{relax} or \cs{hss}, and then
+% start the main box.
+% \begin{macrocode}
+ \@nameuse{#1evenhpl}\hb@xt@\@nameuse{#1runwidth}{\m@mhe@dreset%
+ \vbox{\hbox{%
+% \end{macrocode}
+% The left part of the header.
+% \begin{macrocode}
+ \rlap{\parbox[b]{\@nameuse{#1runwidth}}{%
+ \raggedright\@nameuse{#1eheadl}\strut}}\hfill
+% \end{macrocode}
+% The center part of the header.
+% \begin{macrocode}
+ \parbox[b]{\@nameuse{#1runwidth}}{%
+ \centering\@nameuse{#1eheadc}\strut}\hfill
+% \end{macrocode}
+% The right part of the header.
+% \begin{macrocode}
+ \llap{\parbox[b]{\@nameuse{#1runwidth}}{%
+ \raggedleft\@nameuse{#1eheadr}\strut}}}%
+% \end{macrocode}
+% Finally, the header rule and finish with the right filler, which
+% is either \cs{relax} or \cs{hss}.
+% \begin{macrocode}
+ \@nameuse{#1headrule}}}\@nameuse{#1evenhpr}}%
+% \end{macrocode}
+% The code for the \cs{@oddhead}, \cs{@evenfoot} and \cs{@oddfoot} follows
+% a similar pattern. Here is \cs{@oddhead}.
+% \begin{macrocode}
+ \@namedef{#1@oddhead}{%
+ \@nameuse{#1oddhpl}\hb@xt@\@nameuse{#1runwidth}{\m@mhe@dreset%
+ \vbox{\hbox{%
+ \rlap{\parbox[b]{\@nameuse{#1runwidth}}{%
+ \raggedright\@nameuse{#1oheadl}\strut}}\hfill
+ \parbox[b]{\@nameuse{#1runwidth}}{%
+ \centering\@nameuse{#1oheadc}\strut}\hfill
+ \llap{\parbox[b]{\@nameuse{#1runwidth}}{%
+ \raggedleft\@nameuse{#1oheadr}\strut}}}%
+ \@nameuse{#1headrule}}}\@nameuse{#1oddhpr}}%
+% \end{macrocode}
+% And \cs{@evenfoot}. For the footers the rules come \emph{before} any foot
+% entries.
+% \begin{macrocode}
+ \@namedef{#1@evenfoot}{%
+ \@nameuse{#1evenfpl}\hb@xt@\@nameuse{#1runwidth}{\m@mhe@dreset%
+ \vbox{\@nameuse{#1footrule}\hbox{%
+ \rlap{\parbox[b]{\@nameuse{#1runwidth}}{%
+ \raggedright\@nameuse{#1efootl}\strut}}\hfill
+ \parbox[b]{\@nameuse{#1runwidth}}{%
+ \centering\@nameuse{#1efootc}\strut}\hfill
+ \llap{\parbox[b]{\@nameuse{#1runwidth}}{%
+ \raggedleft\@nameuse{#1efootr}\strut}}}%
+ }}\@nameuse{#1evenfpr}}%
+% \end{macrocode}
+% Lastly the \cs{@oddfoot}.
+% \begin{macrocode}
+ \@namedef{#1@oddfoot}{%
+ \@nameuse{#1oddfpl}\hb@xt@\@nameuse{#1runwidth}{\m@mhe@dreset%
+ \vbox{\@nameuse{#1footrule}\hbox{%
+ \rlap{\parbox[b]{\@nameuse{#1runwidth}}{%
+ \raggedright\@nameuse{#1ofootl}\strut}}\hfill
+ \parbox[b]{\@nameuse{#1runwidth}}{%
+ \centering\@nameuse{#1ofootc}\strut}\hfill
+ \llap{\parbox[b]{\@nameuse{#1runwidth}}{%
+ \raggedleft\@nameuse{#1ofootr}\strut}}}%
+ }}\@nameuse{#1oddfpr}}%
+% \end{macrocode}
+% Now we define \cs{@evenhead} etc., in terms of \verb?#1@evenhead?.
+% \begin{macrocode}
+ \def\@evenhead{\@nameuse{#1@evenhead}}%
+ \def\@oddhead{\@nameuse{#1@oddhead}}%
+ \def\@evenfoot{\@nameuse{#1@evenfoot}}%
+ \def\@oddfoot{\@nameuse{#1@oddfoot}}%
+% \end{macrocode}
+% To finish off the definition of \cs{ps@style}, add in a hook which can be
+% defined so that it adds additional code, if required.
+% \begin{macrocode}
+ \@nameuse{#1pshook}%
+ }%
+% \end{macrocode}
+% The final part of setting up the new pagestyle is defining all the macros
+% called by \cs{ps@style}, and giving them default values. Make the headers
+% and footers empty.
+% \begin{macrocode}
+ \makeevenhead{#1}{}{}{}%
+ \makeoddhead{#1}{}{}{}%
+ \makeevenfoot{#1}{}{}{}%
+ \makeoddfoot{#1}{}{}{}%
+% \end{macrocode}
+% Make the headers/footers the same width as the \cs{textwidth}, center
+% them, and ensure
+% that the rules have zero height so that they will be invisible.
+% \begin{macrocode}
+ \makerunningwidth{#1}{\textwidth}%
+ \makeheadposition{#1}{}{}{}{}%
+ \makeheadrule{#1}{\textwidth}{0pt}%
+ \makefootrule{#1}{\textwidth}{\footruleheight}{\footruleskip}%
+% \end{macrocode}
+% Finally, there is no addtional code needed, so make the hook empty, and
+% we are done.
+% \begin{macrocode}
+ \makepsmarks{#1}{}%
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\aliaspagestyle}
+% The command \cs{aliaspagestyle}\marg{aliasl}\marg{original}
+% defines the \meta{alias} pagestyle to be an alias for the
+% \meta{original} pagestyle.
+% \begin{macrocode}
+\renewcommand*{\aliaspagestyle}[2]{%
+ \@namedef{ps@#1}{\@nameuse{ps@#2}}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\copypagestyle}
+% The command \cs{copypagestyle}\marg{new}\marg{original}
+% defines the \meta{new} pagestyle to be a copy of the
+% \meta{original} pagestyle.
+%
+% It first makes the \meta{new} (empty) pagestyle then defines the internals
+% in terms of the \meta{original} internals.
+% \changes{v1.2}{2002/08/10}{Added \cs{copypagestyle}}
+% \begin{macrocode}
+\renewcommand*{\copypagestyle}[2]{%
+ \makepagestyle{#1}%
+% \end{macrocode}
+% Do the headers and footers.
+% \begin{macrocode}
+ \makeevenhead{#1}{\@nameuse{#2eheadl}}%
+ {\@nameuse{#2eheadc}}{\@nameuse{#2eheadr}}%
+ \makeoddhead{#1}{\@nameuse{#2oheadl}}%
+ {\@nameuse{#2oheadc}}{\@nameuse{#2oheadr}}%
+ \makeevenfoot{#1}{\@nameuse{#2efootl}}%
+ {\@nameuse{#2efootc}}{\@nameuse{#2efootr}}%
+ \makeoddfoot{#1}{\@nameuse{#2ofootl}}%
+ {\@nameuse{#2ofootc}}{\@nameuse{#2ofootr}}%
+% \end{macrocode}
+% Set the width.
+% \begin{macrocode}
+ \makerunningwidth{#1}{\@nameuse{#2runwidth}}%
+% \end{macrocode}
+% Specify the \cs{headposition}.
+% \begin{macrocode}
+ \@namedef{#1evenhpl}{\@nameuse{#2evenhpl}}%
+ \@namedef{#1oddhpl}{\@nameuse{#2oddhpl}}%
+ \@namedef{#1evenfpl}{\@nameuse{#2evenfpl}}%
+ \@namedef{#1oddfpl}{\@nameuse{#2oddfpl}}%
+% \end{macrocode}
+% Specify the head and foot rules.
+% \begin{macrocode}
+ \@namedef{#1headrule}{\@nameuse{#2headrule}}%
+ \@namedef{#1footrule}{\@nameuse{#2footrule}}%
+% \end{macrocode}
+% And pick up the hook.
+% \begin{macrocode}
+ \makepsmarks{#1}{\@nameuse{#2pshook}}%
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\ifonlyfloats}
+% \cs{ifonlyfloats}\marg{yes}\marg{no} processes \meta{yes} if the macro is
+% called on a page consisting only of floats, otherwise \meta{no} is
+% processed. \cs{if@fcolmade} is specified in \file{ltoutput.dtx}.
+% \changes{v1.0}{2001/11/14}{Added \cs{ifonlyfloats}}
+% \begin{macrocode}
+\renewcommand*{\ifonlyfloats}[2]{\if@fcolmade #1\else #2\fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\mergepagefloatstyle}
+% \cs{mergepagefloatstyle}\marg{style}\marg{textstyle}\marg{floatstyle}
+% makes a new page style \meta{style} that is \meta{textstyle} on normal
+% pages but uses \meta{floatstyle} on float-only pages. Both \meta{textstyle}
+% and \meta{floatstyle} must have been previously defined.
+% \changes{v1.0}{2001/11/15}{Added \cs{mergepagefloatstyle}}
+% \begin{macrocode}
+\renewcommand*{\mergepagefloatstyle}[3]{%
+% \end{macrocode}
+% Make sure that the two styles have been called, otherwise we get some
+% undefined errors.
+% \begin{macrocode}
+ \@nameuse{ps@#3}\@nameuse{ps@#2}%
+% \end{macrocode}
+% Specify the pagestyle's headers and footers.
+% \begin{macrocode}
+ \@namedef{ps@#1}{%
+ \def\@evenhead{\ifonlyfloats{\@nameuse{#3@evenhead}}%
+ {\@nameuse{#2@evenhead}}}%
+ \def\@oddhead{\ifonlyfloats{\@nameuse{#3@oddhead}}%
+ {\@nameuse{#2@oddhead}}}%
+ \def\@evenfoot{\ifonlyfloats{\@nameuse{#3@evenfoot}}%
+ {\@nameuse{#2@evenfoot}}}%
+ \def\@oddfoot{\ifonlyfloats{\@nameuse{#3@oddfoot}}%
+ {\@nameuse{#2@oddfoot}}}%
+% \end{macrocode}
+% Set the hook to the \meta{textstyle} on the assumption that that is
+% more complex that required for a float page.
+% \begin{macrocode}
+ \@namedef{#1pshook}{\@nameuse{#2pshook}}%
+% \end{macrocode}
+% That's it.
+% \begin{macrocode}
+}}
+% \end{macrocode}
+% \end{macro}
+%
+% The pagestyles \pstyle{empty} and \pstyle{plain} are defined
+% in \file{latex.dtx}. However, I will redefine them here, just in
+% case someone takes a fancy to modifying them.
+%
+% \begin{macro}{\ps@empty}
+% The \pstyle{empty} pagestyle is simple, it's just what we get when
+% we call \cs{makepagestyle}.
+% \begin{macrocode}
+\makepagestyle{empty}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ps@plain}
+% The \pstyle{plain} pagestyle is also simple, it just puts the
+% page number at the bottom middle of the page.
+% We call \cs{makepagestyle{plain}} and then adjust as required.
+% \begin{macrocode}
+\makepagestyle{plain}
+ \makeevenfoot{plain}{}{\thepage}{}
+ \makeoddfoot{plain}{}{\thepage}{}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ps@headings}
+% The \pstyle{headings} pagestyle behaves differently for
+% twosided and onesided printing. This is a rewrite of the
+% standard style.
+% \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@headings}}
+% \begin{macrocode}
+\if@twoside
+% \end{macrocode}
+% The footer is empty and the header contains the page number and
+% one of the marks.
+% \begin{macrocode}
+ \makepagestyle{headings}
+ \makepsmarks{headings}{%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markboth{\MakeUppercase{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \@chapapp\ \thechapter. \ %
+ \fi
+ \fi
+ ##1}}{}}%
+ \def\tocmark{\markboth{\MakeUppercase{\contentsname}}{}}%
+ \def\lofmark{\markboth{\MakeUppercase{\listfigurename}}{}}%
+ \def\lotmark{\markboth{\MakeUppercase{\listtablename}}{}}%
+ \def\bibmark{\markboth{\MakeUppercase{\bibname}}{}}%
+ \def\indexmark{\markboth{\MakeUppercase{\indexname}}{}}%
+ \def\sectionmark##1{%
+ \markright{\MakeUppercase{%
+ \ifnum \c@secnumdepth > \z@
+ \thesection. \ %
+ \fi
+ ##1}}}%
+ }%
+ \makeevenhead{headings}{\thepage}{}{\slshape\leftmark}
+ \makeoddhead{headings}{\slshape\rightmark}{}{\thepage}
+\else
+% \end{macrocode}
+% For one sided printing even and odd pages are treated the same,
+% so no need to bother with the evenhead, and
+% just the \cs{rightmark} is used.
+% \begin{macrocode}
+ \makepagestyle{headings}
+ \makepsmarks{headings}{%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markright{\MakeUppercase{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \@chapapp\ \thechapter. \ %
+ \fi
+ \fi
+ ##1}}}%
+ \def\tocmark{\markright{\MakeUppercase{\contentsname}}}%
+ \def\lofmark{\markright{\MakeUppercase{\listfigurename}}}%
+ \def\lotmark{\markright{\MakeUppercase{\listtablename}}}%
+ \def\bibmark{\markright{\MakeUppercase{\bibname}}}%
+ \def\indexmark{\markright{\MakeUppercase{\indexname}}}%
+ }
+ \makeoddhead{headings}{\slshape\rightmark}{}{\thepage}
+\fi
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ps@myheadings}
+% The \pstyle{myheadings} page style is simpler because the user
+% has to specify the contents using \cs{markboth} and \cs{markright}
+% commands. This is the definition used in the standard classes.
+% \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@myheadings}}
+% \begin{verbatim}}
+% \newcommand{\ps@myheadings}{%
+% \let\@oddfoot\@empty\let\@evenfoot\@empty
+% \def\@evenhead{\thepage\hfil{\slshape\leftmark}}%
+% \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
+% \let\@mkboth\@gobbletwo
+% \let\chaptermark\@gobble
+% \let\sectionmark\@gobble
+% }
+% \end{verbatim}
+% Translating that into our terms we get:
+% \changes{v1.0}{2001/11/15}{Changed the code for creating the myheadings pagestyle}
+% \changes{v1.4}{2003/11/22}{Further change to myheadings pagestyle code}
+% \begin{macrocode}
+\makepagestyle{myheadings}
+ \makepsmarks{myheadings}{%
+ \let\@mkboth\@gobbletwo
+ \let\chaptermark\@gobble
+ \let\sectionmark\@gobble
+ \def\tocmark{}%
+ \def\lofmark{}%
+ \def\lotmark{}%
+ \def\bibmark{}%
+ \def\indexmark{}%
+ }
+ \makeevenhead{myheadings}{\thepage}{}{\slshape\leftmark}
+ \makeoddhead{myheadings}{\slshape\rightmark}{}{\thepage}
+
+% \end{macrocode}
+% (Kai von Fintel (\texttt{fintel@mit.edu}) emailed me on 2003/02/24
+% saying that the original \verb?\let\tocmark\@gobble? in the myheadings
+% pagestyle did nasty things
+% to the ToC, etc. Now using \verb?\def\tocmark{}?.)
+% \end{macro}
+%
+% \begin{macro}{\ps@chapter}
+% \begin{macro}{\ps@part}
+% \begin{macro}{\ps@cleared}
+% The standard classes use the \pstyle{plain} pagestyle for the first page
+% of a chapter. This class uses the \pstyle{chapter} instead, which is
+% aliased to \pstyle{plain}. Similarly for parts.
+% Further, \cs{cleardoublepage} uses whatever
+% pagestyle is in effect for the empty verso page. I find that this
+% looks odd if the header contains a chapter name. This class uses
+% the \pstyle{cleared} pagestyle in this case. I have aliased this
+% to \pstyle{empty}; the \pstyle{plain} would be another reasonable choice.
+% \begin{macrocode}
+\aliaspagestyle{chapter}{plain}
+\aliaspagestyle{part}{plain}
+\aliaspagestyle{cleared}{empty}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\cleardoublepage}
+% A slight adjustment to the kernel definition to set a pagestyle.
+% \begin{macrocode}
+\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
+ \hbox{}\thispagestyle{cleared}%
+ \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\ps@ruled}
+% Partly to show how it is done, the class provides a \pstyle{ruled} pagestyle.
+% In this style the headers and footers are the same width as the textblock,
+% there is a rule under the header, page numbers are set in the footers
+% at the outside of the page. Even page headers have the chapter number
+% and title at the left, and odd page headers have the section title
+% at the right.
+%
+% Start by making the (empty) \pstyle{ruled} pagestyle.
+% \begin{macrocode}
+\makepagestyle{ruled}
+% \end{macrocode}
+% There is no need to change the default width (which is the \cs{textwidth}),
+% nor the default positions (centered),
+% nor to make the footrule visible. We do, though, have to put the page
+% numbers into the footers.
+% \begin{macrocode}
+\makeevenfoot{ruled}{\thepage}{}{}
+\makeoddfoot{ruled}{}{}{\thepage}
+% \end{macrocode}
+% Make the header rule visible and equal to the \cs{textwidth}.
+% \begin{macrocode}
+\makeheadrule{ruled}{\textwidth}{\normalrulethickness}
+% \end{macrocode}
+%
+% \begin{macro}{\@ruledmarks}
+% We have to make sure that the \cs{chapter} and \cs{section} commands make
+% the appropriate marks for use in the headers. We use the hook for this.
+% Note that contrary to normal \LaTeX{} practice, the titles are not
+% automatically upper-cased. The marks for the tocbibinds also need adjusting.
+% \changes{v1.1}{2002/03/10}{Changed \cs{@ruledmarks} to cater for tocbibind}
+% \begin{macrocode}
+\renewcommand*{\@ruledmarks}{%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markboth{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \thechapter. \ %
+ \fi
+ \fi
+ ##1}{}}
+ \def\sectionmark##1{\markright{##1}}%
+ \def\tocmark{\markboth{\contentsname}{}}%
+ \def\lofmark{\markboth{\listfigurename}{}}%
+ \def\lotmark{\markboth{\listtablename}{}}%
+ \def\bibmark{\markboth{\bibname}{}}%
+ \def\indexmark{\markboth{\indexname}{}}%
+}
+\makepsmarks{ruled}{\@ruledmarks}
+% \end{macrocode}
+% \end{macro}
+%
+% We can now define the even page header which is to have the chapter title
+% at the left. As the chapter mark did no upper-casing we will print it
+% using small caps, but just use the normal font for section title on
+% the odd page header.
+% \begin{macrocode}
+\makeevenhead{ruled}{\scshape\leftmark}{}{}
+\makeoddhead{ruled}{}{}{\rightmark}
+
+% \end{macrocode}
+% \end{macro}
+% This is all that we need to do for the \pstyle{ruled} pagestyle.
+%
+% \begin{macro}{\ps@Ruled}
+% Also define a \pstyle{Ruled} pagestyle similar to \pstyle{ruled} except that the
+% headers and footers are 10\% wider than the textblock, sticking out
+% into the fore edge.
+% \begin{macrocode}
+\makepagestyle{Ruled}
+\makerunningwidth{Ruled}{1.1\textwidth}
+\makeheadposition{Ruled}{flushright}{flushleft}{flushright}{flushleft}
+\makeevenfoot{Ruled}{\thepage}{}{}
+\makeoddfoot{Ruled}{}{}{\thepage}
+\makeheadrule{Ruled}{1.1\textwidth}{\normalrulethickness}
+\makepsmarks{Ruled}{\@ruledmarks}
+\makeevenhead{Ruled}{\scshape\leftmark}{}{}
+\makeoddhead{Ruled}{}{}{\rightmark}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\headwidth}
+% \begin{macro}{\ps@companion}
+% A \pstyle{companion} pagestyle like the one in the
+% \textit{\LaTeX{} Companion} series.
+% We need the \cs{headwidth} length for this.
+% \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@companion}}
+% \begin{macrocode}
+%%%%\newlength{\headwidth} % don't use in the patch file
+
+\makepagestyle{companion}
+\setlength{\headwidth}{\textwidth}
+ \addtolength{\headwidth}{\marginparsep}
+ \addtolength{\headwidth}{\marginparwidth}
+\makerunningwidth{companion}{\headwidth}
+\makeheadrule{companion}{\headwidth}{\normalrulethickness}
+\makeheadposition{companion}{flushright}{flushleft}{}{}
+\makepsmarks{companion}{%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{\markboth{##1}{##1}} % left mark & right marks
+ \def\sectionmark##1{\markright{%
+ \ifnum \c@secnumdepth>\z@
+ \thesection. \ %
+ \fi
+ ##1}}
+ \def\tocmark{\markboth{\contentsname}{\contentsname}}%
+ \def\lofmark{\markboth{\listfigurename}{\listfigurename}}%
+ \def\lotmark{\markboth{\listtablename}{\listtablename}}%
+ \def\bibmark{\markboth{\bibname}{\bibname}}%
+ \def\indexmark{\markboth{\indexname}{\indexname}}%
+}
+\makeevenhead{companion}{\normalfont\bfseries\thepage}{}%
+ {\normalfont\bfseries\leftmark}
+\makeoddhead{companion}{\normalfont\bfseries\rightmark}{}%
+ {\normalfont\bfseries\thepage}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%% \subsection{Theindex}
+%
+% On 2006/12/05 Lars Madsen asked for an `indextitlepagestyle' (he wanted
+% to put a hyperlink bar with links to each letter startpoint into the
+% header).
+% \begin{macro}{\ps@indextitlepagestyle}
+% Here is half of it, the other half is in the definition of \cs{theindex}.
+% \begin{macrocode}
+\aliaspagestyle{indextitlepagestyle}{chapter}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{New Listof...}
+%
+% Ignacio Fern\'{a}ndez Galv\'{a}n (aka Jellby) noted a problem with
+% changing chapter styles and the ToC heading
+% (ctt, \textit{Inconsistency in memoir}, 2006/11/04). Unfortunately the
+% fix involves repeating much prior code. Essentially, I got the
+% setting of \cs{parskip} equal to \cs{cftparskip} in the wrong place.
+% The following has been copied from \file{memoir.dtx} and appropriate
+% changes made.
+%
+% \begin{macro}{\newlistof}
+% \cs{newlistof}\marg{listofcmmd}\marg{ext}\marg{listofname}
+% creates the command \cs{listofcmmd} to typeset a new List of, where the
+% external file has the extension \file{.ext} and the heading title is
+% \meta{listofname}. The code for this is a heavily modified part
+% of the \Lpack{tocloft} package.
+%
+% \begin{macrocode}
+%%%%%%% Fix for inconsistent chapter styles and ToC, etc style.
+\renewcommand*{\newlistof}[3]{%
+% \end{macrocode}
+%
+% In the following, \verb?X? stands for the value of \meta{listofcmmd} and
+% \verb?Z? stands for the value of \meta{ext}.
+%
+% \begin{macro}{\ext@Z}
+% \begin{macro}{\Zdepth}
+% The file extension and listing depth, which is set to level~1.
+% \begin{macrocode}
+ \@namedef{ext@#2}{#2}
+ \@ifundefined{c@#2depth}{\newcounter{#2depth}}{}
+ \setcounter{#2depth}{1}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\Zmark}
+% The heading marks for the listing.
+% \changes{v1.1}{2002/03/10}{Changed \cs{@mkboth} to \cs{markboth} in \cs{Zmark}}
+% \begin{macrocode}
+ \@namedef{#2mark}{\markboth{#3}{#3}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\X}
+% Typeset the listing title and entries,
+% with both a normal and starred version.
+% \begin{macrocode}
+ \@namedef{#1}{\@ifstar{\@nameuse{@star#2}}{\@nameuse{@plain#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@starZ}
+% The starred listof version
+% \begin{macrocode}
+ \@namedef{@star#2}{%
+ \ensureonecol
+ \par
+ \begingroup
+%%%%%%% \parindent\z@ \parskip\cftparskip
+ \@nameuse{@#2maketitle}
+ \@starttoc{#2}%
+ \endgroup
+ \restorefromonecol}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@plainZ}
+% The unstarred listof version
+% \begin{macrocode}
+ \@namedef{@plain#2}{%
+ \ensureonecol
+ \par
+ \begingroup
+%%%%%%% \parindent\z@ \parskip\cftparskip
+ \@nameuse{@#2maketitle}
+ \phantomsection
+ \addcontentsline{toc}{chapter}{#3}
+\parskip\cftparskip
+ \@starttoc{#2}%
+ \endgroup
+ \restorefromonecol}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@Zmaketitle}
+% This macro typesets the title.
+% \changes{v1.3}{2002/10/10}{Added \cs{printZnonum} to \cs{@Zmaketitle}}
+% \begin{macrocode}
+ \@namedef{@#2maketitle}{%
+ \@nameuse{#2headstart}
+ {\parindent\z@
+%%%%%%%% \parskip\cftparskip
+ \interlinepenalty\@M
+% \end{macrocode}
+% \changes{v1.3}{2002/11/14}{Added printZnonum to \cs{newlistof}}
+% \begin{macrocode}
+ \@nameuse{print#2nonum}%
+ \@nameuse{print#2title}{#3}%
+ \@nameuse{#2mark}%
+ \thispagestyle{chapter}%
+ \@nameuse{after#2title}
+ }
+ \@afterheading}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Zheadstart}
+% \begin{macro}{\afterZtitle}
+% The macros \cs{Zheadstart} and \cs{afterZtitle}
+% control what goes before and after the title. They
+% default to the corresponding macros for chapters.
+% \begin{macrocode}
+ \@namedef{#2headstart}{\chapterheadstart}
+ \@namedef{after#2title}{\afterchaptertitle}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\printZnonum}
+% This typesets something before the title and defaults
+% to \cs{printchapternonum}.
+% \changes{v1.3}{2002/10/10}{Added \cs{printZnonum} macro}
+% \begin{macrocode}
+ \@namedef{print#2nonum}{\printchapternonum}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\printZtitle}
+% The title is typeset by the macro \cs{printZtitle}\marg{title}
+% which defaults to \cs{printchaptertitle}.
+% \begin{macrocode}
+ \@namedef{print#2title}##1{\printchaptertitle{##1}}
+% \end{macrocode}
+% \end{macro}
+%
+% This is the end of the definition of \cs{newlistof}.
+% \begin{macrocode}
+} % end \newlistof
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@starttoc}
+% A list of macro calls \cs{@starttoc} to read the appropriate file. I have
+% changed the kernel definition to allow a file to be read multiple times
+% by delaying killing the file until the end of the document.
+% \changes{v1.3}{2002/11/14}{Changed \cs{@starttoc}}
+% \begin{macrocode}
+\renewcommand*{\@starttoc}[1]{%
+ \begingroup\makeatletter
+ \@input{\jobname.#1}%
+ \if@filesw
+ \AtEndDocument{%
+ \expandafter\newwrite\csname tf@#1\endcsname
+ \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
+ }%
+ \fi
+ \@nobreakfalse
+ \endgroup}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\newlistof{tableofcontents}{toc}{\contentsname}
+\newlistof{listoffigures}{lof}{\listfigurename}
+\newlistof{listofables}{lot}{\listtablename}
+%%% remove subfigure support
+\renewcommand*{\@cftl@subfigtab}{}
+
+% \end{macrocode}
+%
+% \subsection{Chapter styles}
+%
+% I have added some further chapter styles. These have either been sent to me,
+% published on CTT or are my own invention.
+%
+% \begin{macro}{\chs@default}
+% A reimplementation of the default chapter style which sets everything.
+% \begin{macrocode}
+\makechapterstyle{default}{%
+ \setlength{\beforechapskip}{50pt}
+ \def\chapterheadstart{\vspace*{\beforechapskip}}
+ \def\chapnamefont{\normalfont\huge\bfseries}
+ \def\printchaptername{\chapnamefont \@chapapp}
+ \def\chapternamenum{\space}
+ \def\chapnumfont{\normalfont\huge\bfseries}
+ \def\printchapternum{\chapnumfont \thechapter}
+ \setlength{\midchapskip}{20pt}
+ \def\afterchapternum{\par\nobreak\vskip \midchapskip}
+ \def\printchapternonum{}
+ \def\chaptitlefont{\normalfont\Huge\bfseries}
+ \def\printchaptertitle##1{\chaptitlefont ##1}
+ \setlength{\afterchapskip}{40pt}
+ \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@bianchi}
+% Posted to CTT on 2003/12/09, \textit{New chapter style: chapter vs chapter*}
+% by Stefano Bianchi.
+% \begin{macrocode}
+%% Stefano Bianchi, ctt 2003/12/09 `New chapter style: chapter vs chapter*'
+\makechapterstyle{bianchi}{%
+ \renewcommand*{\chapnamefont}{\normalfont\Large\sffamily\itshape}
+ \renewcommand*{\chapnumfont}{\normalfont\huge}
+ \renewcommand*{\printchaptername}{%
+ \chapnamefont\centering\@chapapp}
+ \renewcommand*{\printchapternum}{\chapnumfont \textit{\thechapter}}
+ \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \centering \chaptitlefont\textbf{##1}\par}
+ \renewcommand*{\afterchaptertitle}{\vskip\onelineskip \hrule\vskip
+ \afterchapskip}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\chapnumfont \textit{9}}\afterchapternum}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@bringhurst}
+% My bringhurst style.
+% \begin{macrocode}
+\makechapterstyle{bringhurst}{%
+ \renewcommand*{\chapterheadstart}{}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{}
+ \renewcommand*{\afterchapternum}{}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \raggedright\Large\scshape\MakeLowercase{##1}}
+ \renewcommand*{\afterchaptertitle}{%
+ \vskip\onelineskip \hrule\vskip\onelineskip}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@brotherton}
+% An extremely simple chapterstyle created by William Adams for Mike
+% Brotherton's science fiction novel \textit{Star Dragon}, posted to CTT
+% 2006/12/09, \textit{An example of a novel?}.
+% \begin{macrocode}
+\makechapterstyle{brotherton}{%
+ \renewcommand*{\printchapternum}{\chapnumfont
+ \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@chappell}
+% My Chappell style
+% \begin{macrocode}
+\makechapterstyle{chappell}{%
+ \setlength{\beforechapskip}{0pt}
+ \renewcommand*{\chapnamefont}{\large\centering}
+ \renewcommand*{\chapnumfont}{\large}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\printchaptername \chapnumfont 1}
+ \afterchapternum
+ \vskip \onelineskip \vskip -\topskip}
+ \renewcommand*{\chaptitlefont}{\Large\itshape}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \centering\chaptitlefont ##1}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@culver}
+% By me in an answer to Christopher Culver on CTT,
+% \textit{"Biblical" formatting, how?} on 2004/03/29,where I called it
+% the `biblical' style.
+% \begin{macrocode}
+\makechapterstyle{culver}{%
+ \chapterstyle{article}%
+%%% \renewcommand*{\thechapter}{\Roman{chapter}}
+ \renewcommand*{\printchapternum}{% center number/title
+ \centering\chapnumfont \thechapter\space}%
+ \renewcommand*{\printchapternonum}{\centering}
+ \renewcommand*{\clearforchapter}{}% no new page
+ \aliaspagestyle{chapter}{headings}% no special pagestyle
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@dash}
+% A very simple style of mine but I couldn't think of a good name for it.
+% \begin{macrocode}
+\makechapterstyle{dash}{%
+ \setlength{\beforechapskip}{5\onelineskip}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\chapnumfont}{\normalfont\large}
+ \settoheight{\midchapskip}{\chapnumfont 1}
+ \renewcommand*{\printchapternum}{\centering \chapnumfont
+ \rule[0.5\midchapskip]{1em}{0.4pt} \thechapter\
+ \rule[0.5\midchapskip]{1em}{0.4pt}}
+ \renewcommand*{\afterchapternum}{\par\nobreak\vskip 0.5\onelineskip}
+ \renewcommand*{\printchapternonum}{\centering
+ \vphantom{\chapnumfont 1}\afterchapternum}
+ \renewcommand*{\chaptitlefont}{\normalfont\Large}
+ \renewcommand*{\printchaptertitle}[1]{\centering \chaptitlefont ##1}
+ \setlength{\afterchapskip}{2.5\onelineskip}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@demo2}
+% My second version of the demo chapterstyle.
+% \begin{macrocode}
+\makechapterstyle{demo2}{%
+ \renewcommand*{\printchaptername}{\centering}
+ \renewcommand*{\printchapternum}{\chapnumfont
+ \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}
+ \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
+ \renewcommand*{\afterchaptertitle}{%
+ \vskip\onelineskip \hrule\vskip \afterchapskip}
+ \setlength{\beforechapskip}{3\baselineskip}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\chapnumfont One}
+ \afterchapternum%
+ \vskip\topskip}
+ \setlength{\beforechapskip}{2\onelineskip}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@ell}
+% Another of my styles which I'll probably use for my next book.
+% \begin{macrocode}
+\makechapterstyle{ell}{%
+ \renewcommand*{\chapnumfont}{\normalfont\HUGE\sffamily}
+ \renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily}
+ \settowidth{\chapindent}{\chapnumfont 111}
+ \renewcommand*{\chapterheadstart}{\begingroup
+ \vspace*{\beforechapskip}%
+ \begin{adjustwidth}{}{-\chapindent}%
+ \hrulefill
+ \smash{\rule{0.4pt}{15mm}}
+ \end{adjustwidth}\endgroup}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{%
+ \begin{adjustwidth}{}{-\chapindent}
+ \hfill
+ \raisebox{10mm}[0pt][0pt]{\chapnumfont \thechapter}%
+ \hspace*{1em}
+ \end{adjustwidth}\vspace*{-3.0\onelineskip}}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \vskip\onelineskip
+ \raggedleft {\chaptitlefont ##1}\par\nobreak}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@Ger}
+% Posted to CTT on 2002/04/12 \textit{Fancy Headings, Chapter Headings} by Gerardo Garcia.
+% \begin{macrocode}
+%% Gerardo Garcia, ctt 2002/04/12, `Fancy Headings, Chapter Headings
+\makechapterstyle{Ger}{%
+ \renewcommand*{\chapterheadstart}{\vspace*{\beforechapskip}
+ \mbox{}\\\mbox{}\rule[0pt]{\textwidth}{0.4pt}\par}
+ \setlength{\midchapskip}{20pt}
+ \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1
+ \\\mbox{}\rule[5pt]{\textwidth}{0.4pt}}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@lyhne}
+% Posted to CTT 2006/02/09 \textit{Glossary}, by Anders Lyhne.
+% It requires the \Lpack{graphicx} package. I have modified it to remove the
+% new length and adjusted the unnumbered appearance.
+% \begin{macrocode}
+\makechapterstyle{lyhne}{% needs graphicx package
+ \setlength{\beforechapskip}{1.5cm}
+ \setlength{\afterchapskip}{1cm}
+ \setlength{\midchapskip}{2cm}
+ \renewcommand*{\chapnamefont}{\normalfont\normalsize\scshape\raggedleft}
+ \renewcommand*{\chaptitlefont}{\normalfont\normalsize\bfseries\sffamily\raggedleft}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{\makebox[0pt][l]{\hspace{0.2em}%
+ \resizebox{!}{2ex}{\chapnamefont\bfseries\sffamily\thechapter}}}
+ \renewcommand*{\afterchapternum}{\par\hspace{1.5cm}\hrule\vspace{0.2cm}}
+ \renewcommand*{\printchapternonum}{\vphantom{\chapnamefont 1}\afterchapternum}
+ \renewcommand*{\afterchaptertitle}{\vskip 0.2cm
+ \hrule\vskip\afterchapskip}}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\chs@madsen}
+% Posted to CTT on 2003/12/09, \textit{New chapter style: chapter vs chapter*}
+% by Lars Madsen.
+% This requires the \Lpack{graphicx} package,
+% \begin{macrocode}
+%% posted to ctt, December 2003
+%%%% \usepackage{graphicx}
+\makechapterstyle{madsen}{%
+ \renewcommand*{\chapnamefont}{%
+ \normalfont\Large\scshape\raggedleft}
+ \renewcommand*{\chaptitlefont}{%
+ \normalfont\Huge\bfseries\sffamily}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{%
+ \makebox[0pt][l]{\hspace{0.4em}
+ \resizebox{!}{4ex}{%
+ \chapnamefont\bfseries\sffamily\thechapter}
+ }%
+ }%
+ \renewcommand*{\afterchapternum}{%
+ \par\hspace{1.5cm}\hrule\vskip\midchapskip}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\colorchapnum}
+% \begin{macro}{\colorchaptitle}
+% \begin{macro}{\chs@pedersen}
+% Posted to CTT 2006/01/31, \textit{Chapter style}, by Troels Pedersen.
+% It requires the \Lpack{graphicx} package and possibly the \Lpack{color}
+% package. I have used a \cs{sidebar} instead of the original \cs{marginpar},
+% and eliminated a new length. The original color specification, the same for
+% the title and nunmber, can now be set via \cs{colorchapnum} and
+% \cs{colorchaptitle}.
+% \begin{macrocode}
+\newcommand*{\colorchapnum}{}
+\newcommand*{\colorchaptitle}{}
+\makechapterstyle{pedersen}{%
+ \setlength{\beforechapskip}{-20pt}
+ \setlength{\afterchapskip}{10pt}
+ \renewcommand*{\chapnamefont}{\normalfont\LARGE\itshape}
+ \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape\colorchapnum}
+ \renewcommand*{\chaptitlefont}{\normalfont\huge\itshape\colorchaptitle}
+ \renewcommand*{\afterchapternum}{}
+ \renewcommand*{\printchaptername}{}
+ \setlength{\midchapskip}{20mm}% was \numberheight
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{%
+ \sidebar{\raisebox{0pt}[0pt][0pt]{\makebox[0pt][l]{%
+ \resizebox{!}{\midchapskip}{\chapnumfont\thechapter}}}}}
+ \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1}
+}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\chs@southall}
+% Style provided by Thomas Dye. I have modified the original to eliminate
+% the use of new lengths.
+% \begin{macrocode}
+%% Thomas Dye's southall chapter style
+\makechapterstyle{southall}{%
+ \setlength{\afterchapskip}{5\baselineskip}
+ \setlength{\beforechapskip}{36pt}% \headindent
+ \setlength{\midchapskip}{\textwidth}% \rightblock
+ \addtolength{\midchapskip}{-\beforechapskip}
+ \renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}}
+ \renewcommand*{\chaptitlefont}{\huge\rmfamily\raggedright}
+ \renewcommand*{\chapnumfont}{\chaptitlefont}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\afterchapternum}{}
+ \renewcommand*{\printchapternum}{%
+ \begin{minipage}[t][\baselineskip][b]{\beforechapskip}
+ {\vspace{0pt}\chapnumfont%%%\figureversion{lining}
+ \thechapter}
+ \end{minipage}}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hfill\begin{minipage}[t]{\midchapskip}
+ {\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}}
+ \renewcommand*{\afterchaptertitle}{%
+ \par\vspace{\baselineskip}%
+ \hrulefill \par\nobreak\noindent \vskip \afterchapskip}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@thatcher}
+% Original posted to CTT on 2006/01/18 by Scott Thatcher,
+% \textit{memoir: chapter headings capitalize math symbols}. I have modified
+% it to cater for multiline titles, appendices, and unnumbered chapters.
+% \begin{macrocode}
+\makechapterstyle{thatcher}{%
+ \renewcommand*{\chapterheadstart}{}
+ \renewcommand*{\printchaptername}{%
+ \centerline{\chapnumfont{\@chapapp\ \thechapter}}}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\chapnumfont}{\normalfont\scshape\MakeLowercase}
+ \renewcommand*{\printchapternum}{}
+ \renewcommand*{\afterchapternum}{%
+ \par\centerline{\parbox{0.5in}{\hrulefill}}\par}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\chapnumfont \@chapapp 1}\par
+ \parbox{0.5in}{}\par}
+ \renewcommand*{\chaptitlefont}{\normalfont\large}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \centering \chaptitlefont\MakeUppercase{##1}}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@veelo}
+% This, from Baastian Veelo, has been noted in the documentation for
+% quite a time.
+% I have modified the original to eliminate the need for extra lengths.
+% \begin{macrocode}
+%% A new chapter style, that suits well for trimmed documents.
+%% We are scaling the chapter number, which most DVI viewers
+%% will not display accurately. It requires the graphicx package.
+%%%% \usepackage{graphicx}
+\makechapterstyle{veelo}{%
+ \setlength{\afterchapskip}{40pt}
+ \renewcommand*{\chapterheadstart}{\vspace*{40pt}}
+ \renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt}
+ \renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright}
+ \renewcommand*{\chapnumfont}{\normalfont\HUGE}
+ \renewcommand*{\chaptitlefont}{\normalfont\HUGE\bfseries\flushright}
+ \renewcommand*{\printchaptername}{%
+ \chapnamefont\MakeUppercase{\@chapapp}}
+ \renewcommand*{\chapternamenum}{}
+% \setlength{\numberheight}{18mm}
+% \setlength{\barlength}{\paperwidth}
+% \addtolength{\barlength}{-\textwidth}
+% \addtolength{\barlength}{-\spinemargin}
+ \setlength{\beforechapskip}{18mm}% \numberheight
+ \setlength{\midchapskip}{\paperwidth}% \barlength
+ \addtolength{\midchapskip}{-\textwidth}
+ \addtolength{\midchapskip}{-\spinemargin}
+ \renewcommand*{\printchapternum}{%
+ \makebox[0pt][l]{%
+ \hspace{.8em}%
+ \resizebox{!}{\beforechapskip}{\chapnumfont \thechapter}%
+ \hspace{.8em}%
+ \rule{\midchapskip}{\beforechapskip}%
+ }%
+ }%
+ \makeoddfoot{plain}{}{}{\thepage}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chs@verville}
+% I posted the original to CTT on 2005/01/18, \textit{Headers and special
+% formatting of sections}, in answer to a question by
+% Guy Verville. This version caters for unnumbered chapters.
+% \begin{macrocode}
+\makechapterstyle{verville}{%
+ \setlength{\beforechapskip}{0pt}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\printchapternum}{%
+ \hrule \vskip 0.5\onelineskip
+ \Huge \centering \thechapter.\ }
+ \renewcommand*{\printchapternonum}{%
+ \hrule \vskip 0.5\onelineskip
+ \Huge \centering}
+ \renewcommand*{\afterchapternum}{}
+ \setlength{\midchapskip}{0pt}
+ \renewcommand*{\printchaptertitle}[1]{%
+ ##1 \par
+ \vskip 0.5\onelineskip
+ \hrule}}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
% The end of the patch file
%
% \begin{macrocode}