summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/memoir/memoir.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/memoir/memoir.dtx')
-rw-r--r--Master/texmf-dist/source/latex/memoir/memoir.dtx242
1 files changed, 180 insertions, 62 deletions
diff --git a/Master/texmf-dist/source/latex/memoir/memoir.dtx b/Master/texmf-dist/source/latex/memoir/memoir.dtx
index 48b374d2f88..2408ac87378 100644
--- a/Master/texmf-dist/source/latex/memoir/memoir.dtx
+++ b/Master/texmf-dist/source/latex/memoir/memoir.dtx
@@ -18,7 +18,7 @@
% This work consists of the files listed in the README file.
%
% \fi
-% \CheckSum{29407}
+% \CheckSum{29487}
%
% \changes{v0.1}{2001/05/20}{First public alpha release}
% \changes{v0.2}{2001/06/03}{First beta release}
@@ -98,6 +98,7 @@
% \cs{marginparmargin}\{left\} in twoside mode}
%
% \changes{v3.6}{2010/04/19}{Reversioned memoir to a more suitable scheme}
+% \changes{v3.6d}{2010/07/01}{Various bug fixes}
%
% \def\dtxfile{memoir.dtx}
%
@@ -138,6 +139,7 @@
% \def\fileversion{v1.618033988b} \def\filedate{2010/02/17}
% \def\fileversion{v1.618033988c} \def\filedate{2010/02/20}
% \def\fileversion{v3.6} \def\filedate{2010/04/19}
+% \def\fileversion{v3.6d} \def\filedate{2010/07/01}
% \title{The LaTeX \Lpack{memoir} class for configurable book
% typesetting: Source code\thanks{This
% file (\texttt{\dtxfile}) has version number \fileversion, last revised
@@ -365,7 +367,7 @@
% Announce the name, option files and version for LaTeX2e files:
% \begin{macrocode}
%<class>\ProvidesClass{memoir}%
-%<class> [2010/04/19 v3.6 configurable book, report, article document class]
+%<class> [2010/07/01 v3.6d configurable book, report, article document class]
%<9pt>\ProvidesFile{mem9.clo}%
%<9pt> [2008/01/30 v0.4 memoir class 9pt size option]
%<10pt>\ProvidesFile{mem10.clo}%
@@ -5604,6 +5606,56 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\mem@ps@HLH}
+% \changes{v3.6d}{20101/06/24}{Factored \cs{makepagestyle}}
+% The entries in the header used in \cs{makepagestyle} (below) are
+% more or less the same. It depends on \emph{head/foot},
+% \emph{odd/even} and a shorter \emph{o/e}. So to make the code more
+% maintainable we factor this out into a generator macro. The
+% explanation for the code being used is kept below (see
+% \cs{makepagestyle}).
+% \begin{macrocode}
+\newcommand\mem@ps@HLH[4]{%
+ % #1 ps name
+ % #2 type: head, foot
+ % #3 odd/even
+ % #4 odd/even short (o,e)
+ \@namedef{#1@#3#2}{%
+ \@nameuse{#1#3hpl}\hb@xt@\@nameuse{#1#2runwidth}{\m@mhe@dreset%
+% \end{macrocode}
+% In footers the line goes before the text, so we test and add the
+% footline if \texttt{\#2} equals \texttt{foot}.
+% \begin{macrocode}
+ \vbox{\nametest{#2}{foot}\ifsamename\@nameuse{#1#2rule}\fi%
+ \hbox{%
+ \rlap{%
+ \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{%
+ \raggedright\@nameuse{#1ps#2strut}%
+ \@nameuse{#1#4#2l}%
+ \@nameuse{#1ps#2strut}}}\hfill
+ \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{%
+ \centering\@nameuse{#1ps#2strut}%
+ \@nameuse{#1#4#2c}%
+ \@nameuse{#1ps#2strut}}\hfill
+ \llap{%
+ \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{%
+ \raggedleft\@nameuse{#1ps#2strut}%
+ \@nameuse{#1#4#2r}%
+ \@nameuse{#1ps#2strut}}}%
+ }%
+% \end{macrocode}
+% In the header the line goes under the text, so we test and add the
+% headline if \texttt{\#2} equals \texttt{head}.
+% \begin{macrocode}
+ \nametest{#2}{head}\ifsamename\@nameuse{#1#2rule}\fi%
+ }}\@nameuse{#1#3hpr}}%
+% \end{macrocode}
+% And end by letting the LaTeX head/foot use our version
+% \begin{macrocode}
+ \@namedef{@#3#2}{\@nameuse{#1@#3#2}}%
+}
+% \end{macrocode}
+% \end{macro}
%
% \begin{macro}{\makepagestyle}
% At last we can put everything together for defining a new pagestyle,
@@ -5627,9 +5679,16 @@
% \end{macrocode}
% First define the macro \cs{ps@style}, which in turn defines the macros
% \cs{@evenhead}, \cs{@oddhead}, \cs{@evenfoot} and \cs{@oddfoot}.
+% \changes{v3.6d}{20101/06/24}{Factored \cs{makepagestyle}, such
+% that \cs{#1@evenhead} and friends are made using \emph{one} single
+% macro. We keep the original code just in case.}
% \begin{macrocode}
\@namedef{ps@#1}{%
- \@namedef{#1@evenhead}{%
+ \mem@ps@HLH{#1}{head}{even}{e}%
+ \mem@ps@HLH{#1}{head}{odd}{o}%
+ \mem@ps@HLH{#1}{foot}{even}{e}%
+ \mem@ps@HLH{#1}{foot}{odd}{o}%
+ % \@namedef{#1@evenhead}{%
% \end{macrocode}
% The code for the definition of \cs{@evenhead} and friends is based on code
% from Piet van Oostrum's \Lpack{fancyhdr} package~\cite{FANCYHDR}. The three
@@ -5644,85 +5703,97 @@
% \changes{v1.6180339c}{2009/01/13}{Replaced \cs{parbox}\texttt[b]
% with \cs{parbox}\texttt{[\cs{nameuse{#1headvplacement}}]} etc.}
% \begin{macrocode}
- \@nameuse{#1evenhpl}\hb@xt@\@nameuse{#1headrunwidth}{\m@mhe@dreset%
- \vbox{\hbox{%
+ % \@nameuse{#1evenhpl}\hb@xt@\@nameuse{#1headrunwidth}{\m@mhe@dreset%
+ % \vbox{\hbox{%
% \end{macrocode}
% The left part of the header.
% \begin{macrocode}
- \rlap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
- \raggedright\@nameuse{#1eheadl}\strut}}\hfill
+ % \rlap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ % \raggedright\@nameuse{#1eheadl}\strut}}\hfill
% \end{macrocode}
% The center part of the header.
% \begin{macrocode}
- \parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
- \centering\@nameuse{#1eheadc}\strut}\hfill
+ % \parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ % \centering\@nameuse{#1eheadc}\strut}\hfill
% \end{macrocode}
% The right part of the header.
% \begin{macrocode}
- \llap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
- \raggedleft\@nameuse{#1eheadr}\strut}}}%
+ % \llap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ % \raggedleft\@nameuse{#1eheadr}\strut}}}%
% \end{macrocode}
% Finally, the header rule and finish with the right filler, which
% is either \cs{relax} or \cs{hss}.
% \begin{macrocode}
- \@nameuse{#1headrule}}}\@nameuse{#1evenhpr}}%
+ % \@nameuse{#1headrule}}}\@nameuse{#1evenhpr}}%
% \end{macrocode}
% The code for the \cs{@oddhead}, \cs{@evenfoot} and \cs{@oddfoot} follows
% a similar pattern. Here is \cs{@oddhead}.
% \begin{macrocode}
- \@namedef{#1@oddhead}{%
- \@nameuse{#1oddhpl}\hb@xt@\@nameuse{#1headrunwidth}{\m@mhe@dreset%
- \vbox{\hbox{%
- \rlap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
- \raggedright\@nameuse{#1oheadl}\strut}}\hfill
- \parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
- \centering\@nameuse{#1oheadc}\strut}\hfill
- \llap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
- \raggedleft\@nameuse{#1oheadr}\strut}}}%
- \@nameuse{#1headrule}}}\@nameuse{#1oddhpr}}%
+ % \@namedef{#1@oddhead}{%
+ % \@nameuse{#1oddhpl}\hb@xt@\@nameuse{#1headrunwidth}{\m@mhe@dreset%
+ % \vbox{\hbox{%
+ % \rlap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ % \raggedright\@nameuse{#1oheadl}\strut}}\hfill
+ % \parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ % \centering\@nameuse{#1oheadc}\strut}\hfill
+ % \llap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ % \raggedleft\@nameuse{#1oheadr}\strut}}}%
+ % \@nameuse{#1headrule}}}\@nameuse{#1oddhpr}}%
% \end{macrocode}
% And \cs{@evenfoot}. For the footers the rules come \emph{before} any foot
% entries.
% \begin{macrocode}
- \@namedef{#1@evenfoot}{%
- \@nameuse{#1evenfpl}\hb@xt@\@nameuse{#1footrunwidth}{\m@mhe@dreset%
- \vbox{\@nameuse{#1footrule}\hbox{%
- \rlap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
- \raggedright\@nameuse{#1efootl}\strut}}\hfill
- \parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
- \centering\@nameuse{#1efootc}\strut}\hfill
- \llap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
- \raggedleft\@nameuse{#1efootr}\strut}}}%
- }}\@nameuse{#1evenfpr}}%
+ % \@namedef{#1@evenfoot}{%
+ % \@nameuse{#1evenfpl}\hb@xt@\@nameuse{#1footrunwidth}{\m@mhe@dreset%
+ % \vbox{\@nameuse{#1footrule}\hbox{%
+ % \rlap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ % \raggedright\@nameuse{#1efootl}\strut}}\hfill
+ % \parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ % \centering\@nameuse{#1efootc}\strut}\hfill
+ % \llap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ % \raggedleft\@nameuse{#1efootr}\strut}}}%
+ % }}\@nameuse{#1evenfpr}}%
% \end{macrocode}
% Lastly the \cs{@oddfoot}.
% \begin{macrocode}
- \@namedef{#1@oddfoot}{%
- \@nameuse{#1oddfpl}\hb@xt@\@nameuse{#1footrunwidth}{\m@mhe@dreset%
- \vbox{\@nameuse{#1footrule}\hbox{%
- \rlap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
- \raggedright\@nameuse{#1ofootl}\strut}}\hfill
- \parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
- \centering\@nameuse{#1ofootc}\strut}\hfill
- \llap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
- \raggedleft\@nameuse{#1ofootr}\strut}}}%
- }}\@nameuse{#1oddfpr}}%
+ % \@namedef{#1@oddfoot}{%
+ % \@nameuse{#1oddfpl}\hb@xt@\@nameuse{#1footrunwidth}{\m@mhe@dreset%
+ % \vbox{\@nameuse{#1footrule}\hbox{%
+ % \rlap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ % \raggedright\@nameuse{#1ofootl}\strut}}\hfill
+ % \parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ % \centering\@nameuse{#1ofootc}\strut}\hfill
+ % \llap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ % \raggedleft\@nameuse{#1ofootr}\strut}}}%
+ % }}\@nameuse{#1oddfpr}}%
% \end{macrocode}
% Now we define \cs{@evenhead} etc., in terms of \verb?#1@evenhead?.
% \begin{macrocode}
- \def\@evenhead{\@nameuse{#1@evenhead}}%
- \def\@oddhead{\@nameuse{#1@oddhead}}%
- \def\@evenfoot{\@nameuse{#1@evenfoot}}%
- \def\@oddfoot{\@nameuse{#1@oddfoot}}%
+ % \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.
+% \changes{v3.6d}{2010/06/24}{Added strut initialization} Next we
+% initialize the struts being used. Remember the for the
+% \pstyle{empty} style, the strut should be empty.
+% \begin{macrocode}
+ \nametest{#1}{empty}%
+ \ifsamename%
+ \@namedef{#1psheadstrut}{}\@namedef{#1psfootstrut}{}%
+ \else%
+ \@namedef{#1psheadstrut}{\strut}\@namedef{#1psfootstrut}{\strut}%
+ \fi%
+% \end{macrocode}
+%
+% The final part of setting up the new pagestyle
+% is defining all the macros called by \cs{ps@style}, and giving them
+% default values. Make the headers and footers empty.
% \begin{macrocode}
\makeevenhead{#1}{}{}{}%
\makeoddhead{#1}{}{}{}%
@@ -5821,12 +5892,18 @@
\@namedef{#1headrule}{\@nameuse{#2headrule}}%
\@namedef{#1footrule}{\@nameuse{#2footrule}}%
% \end{macrocode}
-% And pick up the hook.
+% \changes{v3.6d}{2010/06/24}{Added strut copying to \cs{copypagestyle}}
+% And remember the struts
+% \begin{macrocode}
+ \@namedef{#1psheadstrut}{\@nameuse{#2psheadstrut}}
+ \@namedef{#1psfootstrut}{\@nameuse{#2psfootstrut}}
+% \end{macrocode}
+% \end{macro}
+% And pick up the hook. We end the macro here.
% \begin{macrocode}
\makepsmarks{#1}{\@nameuse{#2pshook}}}
% \end{macrocode}
-% \end{macro}
%
%
% \begin{macro}{\ifonlyfloats}
@@ -5878,6 +5955,19 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\makeheadfootstrut}
+% \changes{v3.6d}{2010/06/24}{Added \cs{makeheadfootstrut}}
+% In each `field' of the header a strut is added to keep alignment
+% right. This macro can be used to change a particular strut
+% configuration. Each combination is initialy set by
+% \cs{makepagestyle} to be equal to \cs{strut}, except the
+% \pstyle{empty} style, where the strut is empty by default.
+% \begin{macrocode}
+\newcommand*\makeheadfootstrut[3]{%
+ \@namedef{#1psheadstrut}{#2}\@namedef{#1psfootstrut}{#3}}
+% \end{macrocode}
+% \end{macro}
+%
% The pagestyles \pstyle{empty} and \pstyle{plain} are defined
% in \file{latex.dtx}. However, I will redefine them here, just in
% case someone takes a fancy to modifying them.
@@ -9116,6 +9206,9 @@
% This requires the \Lpack{graphicx} package,
% \changes{v1.61803398c}{2009/11/15}{Updated to provide a better
% unnumbered look}
+% \changes{v3.6d}{2010/05/13}{the unnumbered version may be executed
+% in a context where \cs{thechapter} is not weldefined, replaced with
+% a 1}
% \begin{macrocode}
\makechapterstyle{madsen}{% requires graphicx package
\chapterstyle{default}
@@ -9125,13 +9218,18 @@
\normalfont\Huge\bfseries\sffamily\raggedleft}
\renewcommand*{\chapternamenum}{}
\renewcommand*{\printchapternum}{%
- \makebox[0pt][l]{\hspace{0.4em}
+ \makebox[0pt][l]{\hspace{0.4em}%
\resizebox{!}{4ex}{%
- \chapnamefont\bfseries\sffamily\thechapter}
+ \chapnamefont\bfseries\sffamily\thechapter}%
}%
}%
\renewcommand*{\printchapternonum}{%
- \chapnamefont \phantom{\printchaptername \chapternamenum \printchapternum}
+ \chapnamefont \phantom{\printchaptername \chapternamenum%
+ \makebox[0pt][l]{\hspace{0.4em}%
+ \resizebox{!}{4ex}{%
+ \chapnamefont\bfseries\sffamily 1}%
+ }%
+ }%
\afterchapternum %
}%
\renewcommand*{\afterchapternum}{%
@@ -21953,6 +22051,14 @@
\newcommand{\precistocfont}{\normalfont\itshape}
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\precistocformat}
+% Macro for adding extra formatting to the precis toc text, formatting
+% that has nothiing to do with font. The default is \cs{noindent}.
+% \changes{v3.6d}{2010/06/09}{Added \cs{precistocformat}}
+% \begin{macrocode}
+\newcommand{\precistocformat}{\noindent}
+% \end{macrocode}
+% \end{macro}
%
% \begin{macro}{\chapterprecistoc}
% \begin{macro}{\precistoctext}
@@ -21985,8 +22091,9 @@
% Typeset \meta{text} using an italic font, then ensure that the paragraph
% is finished (to use the local skips). Finally close the group and we
% are done.
+% \changes{v3.6d}{2010/06/09}{Added \cs{precistocformat}}
% \begin{macrocode}
- \precistocfont #1\par}}
+ \precistocformat\precistocfont #1\par}}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -26589,12 +26696,14 @@
%
% \begin{macro}{\@reinserts}
% DA's final version from last patch.
+% \changes{v3.6d}{2010/06/30}{THere is a newer version further down
+% the code}
% \begin{macrocode}
-\gdef\@reinserts{%
- \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
- \m@mdodoreinextrafeet
- \ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi
- \ifvoid\sideins\else\insert\sideins{\unvbox\sideins}\fi}
+ % \gdef\@reinserts{%
+ % \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
+ % \m@mdodoreinextrafeet
+ % \ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi
+ % \ifvoid\sideins\else\insert\sideins{\unvbox\sideins}\fi}
% \end{macrocode}
% \end{macro}
@@ -26928,7 +27037,8 @@
\global \maxdepth \@maxdepth}
% \end{macrocode}
-%
+% \changes{v3.6d}{2010/06/30}{There should not be an \cs{else} on the
+% kludge line}
% \begin{macrocode}
\gdef\@reinserts{%
\ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
@@ -33244,9 +33354,17 @@
%
% \subsection{The page style and counters}
% We use the page style \pstyle{headings} by
-% default and arabic page numbering.
+% default and arabic page numbering. But if the \verb?article?
+% class option is in effect, we will use the \pstyle{plain} style
+% which is the default in the \verb?article? class.
+% \changes{v3.6d}{2010/05/13}{When emulating the article class the
+% plain page style should used instead of headings}
% \begin{macrocode}
+\ifartopt
+\pagestyle{plain}
+\else
\pagestyle{headings}
+\fi
\pagenumbering{arabic}
% \end{macrocode}