diff options
author | Norbert Preining <preining@logic.at> | 2007-12-19 08:01:18 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-12-19 08:01:18 +0000 |
commit | adc5da0134dad5aa1c7bad0a8201c27a07d7013f (patch) | |
tree | 6da412d247e39a3eb6065326c158ea193af393e1 /Master/texmf-dist/source/latex/memoir/mempatch.dtx | |
parent | 47c0bc3c76d0a83396adaea8a055b18175dd1132 (diff) |
memoir update 07-12-19
git-svn-id: svn://tug.org/texlive/trunk@5807 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/memoir/mempatch.dtx')
-rwxr-xr-x | Master/texmf-dist/source/latex/memoir/mempatch.dtx | 1306 |
1 files changed, 1262 insertions, 44 deletions
diff --git a/Master/texmf-dist/source/latex/memoir/mempatch.dtx b/Master/texmf-dist/source/latex/memoir/mempatch.dtx index 687682ca40f..731c5294124 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{6253} +% \CheckSum{7275} % % \def\dtxfile{\texttt{mempatch.dtx}} % \def\fileversion{v1.0} \def\filedate{2003/10/04} @@ -56,6 +56,7 @@ % \def\fileversion{v4.6} \def\filedate{2006/12/11} % \def\fileversion{v4.7} \def\filedate{2006/12/23} % \def\fileversion{v4.8} \def\filedate{2007/01/22} +% \def\fileversion{v4.9} \def\filedate{2007/12/14} % % \title{The LaTeX \Lpack{memoir} class for configurable book % typesetting: Code patches\thanks{This @@ -152,6 +153,12 @@ \renewcommand{\MakeUppercase}[1]{#1} \pagestyle{headings} % \end{macrocode} +% Need more space for ToC subsection numbers +% \begin{macrocode} +\makeatletter +\renewcommand*{\l@subsection}{\@dottedtocline{2}{1.5em}{3.2em}} + +% \end{macrocode} % We may use many \file{docstrip} modules so we set the % \texttt{StandardModuleDepth} counter to 1. % \begin{macrocode} @@ -778,8 +785,9 @@ % ^^A \ProvidesFile{mempatch.sty}[2006/08/08 v4.5 Patches for memoir class v1.618] % ^^A \ProvidesFile{mempatch.sty}[2006/12/11 v4.6 Patches for memoir class v1.618] % ^^A \ProvidesFile{mempatch.sty}[2006/12/23 v4.7 Patches for memoir class v1.618] +% ^^A \ProvidesFile{mempatch.sty}[2007/01/22 v4.8 Patches for memoir class v1.618] % \begin{macrocode} -\ProvidesFile{mempatch.sty}[2007/01/22 v4.8 Patches for memoir class v1.618] +\ProvidesFile{mempatch.sty}[2007/12/14 v4.9 Patches for memoir class v1.618] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -807,6 +815,11 @@ %%% Version 4.7 fixes tiny bugs introduced in version 4.6 %%% %%% Version 4.8 fixes some more little bugs. +%%% +%%% Version 4.9 fixes yet more bugs. It also provides means of formatting +%%% page numbers in the ToC, etc., and improved control over line numbering +%%% for verses and boxed verbatims. +%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \end{macrocode} @@ -1897,6 +1910,14 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\midpartskip} +% \changes{v4.9}{2007/11/30}{Changed space in \cs{midpartskip}.} +% \begin{macrocode} +\renewcommand{\midpartskip}{\par\vskip 2\onelineskip} + +% \end{macrocode} +% \end{macro} +% % \subsection{Book document division} % % Frederic Connes tells me that in French typography there is often @@ -1948,7 +1969,7 @@ % \begin{macro}{\afterbookskip} % \begin{macrocode} \newcommand*{\beforebookskip}{\null\vfil} -\newcommand*{\midbookskip}{\par \vskip 2\baselineskip} +\newcommand*{\midbookskip}{\par \vskip 2\onelineskip} \newcommand*{\afterbookskip}{\vfil\newpage} % \end{macrocode} @@ -2011,9 +2032,11 @@ % % \begin{macro}{\membookinfo} % \begin{macro}{\membookstarinfo} +% \changes{v4.9}{2007/08/26}{Made \cs{membookinfo} and \cs{membookstarinfo} +% \cs{long}} % \begin{macrocode} -\newcommand*{\membookinfo}[3]{} -\newcommand*{\membookstarinfo}[1]{} +\newcommand{\membookinfo}[3]{} +\newcommand{\membookstarinfo}[1]{} % \end{macrocode} % \end{macro} @@ -2149,6 +2172,8 @@ % \begin{macro}{\cftbookpagefont} % \begin{macro}{\cftbookafterpnum} % \begin{macro}{\cftbookfillnum} +% \begin{macro}{\cftbookformatpnum} +% \changes{v4.9}{2007/08/20}{Added \cs{cftbookformatpnum}} % \begin{macrocode} % ToC layout parameters. \newlength{\cftbeforebookskip} @@ -2168,8 +2193,11 @@ \newcommand{\cftbookafterpnum}{} \newcommand{\cftbookfillnum}[1]{% {\cftbookleader}% - {\hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}}% +%%%% {\hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}}% + \cftbookformatpnum{#1}% \cftbookafterpnum\par} +\newcommand{\cftbookformatpnum}[1]{% + \hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}} % \end{macrocode} % \end{macro} @@ -2184,6 +2212,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\@setclcnt} % Add the book to \cs{@setclcnt} @@ -2315,7 +2344,7 @@ % \Lpack{hyperref} needs \verb?\tocdepth? set in the body not just in the ToC. % \begin{macrocode} \@ifundefined{toclevel@#1}{% - @memwarn{Unknown toclevel for #1}% + \@memwarn{Unknown toclevel for #1}% }{% \setcounter{tocdepth}{\@nameuse{toclevel@#1}}% } @@ -2605,6 +2634,11 @@ \fi \setbox0=\vtop to 0pt{% \begin{minipage}[t]{\marginparwidth}% +% \end{macrocode} +% Normalise the font (suggested by Lars Madsen). +% \changes{v4.9}{2007/05/02}{Normalised font in \cs{@sidepar}} +% \begin{macrocode} + \normalfont\normalsize \ifoddpage #2\else #1\fi% \end{minipage}% \vss}% @@ -3115,15 +3149,28 @@ \@namedef{cft#2pagefont}{\normalfont} \@namedef{cft#2afterpnum}{} \@namedef{cft#2toclevel@#2}{#4} + \@namedef{cft#2formatpnum}##1{% + \hb@xt@\@pnumwidth{\hfil\@nameuse{cft#2pagefont}##1}} \@namedef{cft#2fillnum}##1{% {\@nameuse{cft#2leader}}\nobreak - \hb@xt@\@pnumwidth{% - \hfil\@nameuse{cft#2pagefont}##1}\@nameuse{cft#2afterpnum}\par} +% \end{macrocode} +% Dan Luecking (\ctt{} \textit{Re: setting page numbers in toc in their +% natural-width box}, 15 August 2007) suggested that there should be a macro +% here instead of: +% \begin{verbatim} +% \hb@xt@\@pnumwidth{% +% \hfil\@nameuse{cft#2pagefont}##1} +% \end{verbatim} +% \changes{v4.9}{2007/08/20}{Changed \cs{newlistentry} to accomodate \cs{cftXformatpnum}} +% \begin{macrocode} + \@nameuse{cft#2formatpnum}{##1}% + \@nameuse{cft#2afterpnum}\par} }% end of \newlistentry % \end{macrocode} % \end{macro} % +% Now redo the \cs{newlistentry}s to effect the above changes. % \begin{macrocode} \let\cftbeforesectionskip\relax \let\cftsectionindent\relax @@ -3167,6 +3214,45 @@ % \end{macrocode} % +% \begin{macro}{\cftpartformatpnum} +% \begin{macro}{\cftpartfillnum} +% \begin{macro}{\cftchapterformatpnum} +% \begin{macro}{\cftchapterfillnum} +% \changes{v4.9}{2007/08/20}{Added \cs{cftpartformatpnum} and \cs{cftchapterformatpnum}} +% But we also have to change the \cs{part} and \cs{chapter} entries in the +% ToC for the new \cs{cftXformatpnum} macros. +% \begin{macrocode} +\newcommand{\cftpartformatpnum}[1]{% + \hb@xt@\@pnumwidth{\hss {\cftpartpagefont #1}}} +\renewcommand{\cftpartfillnum}[1]{% + {\cftpartleader}{\cftpartformatpnum{#1}}% + \cftpartafterpnum\par} +\newcommand{\cftchapterformatpnum}[1]{% + \hb@xt@\@pnumwidth{\hfil{\cftchapterpagefont #1}}} +\renewcommand{\cftchapterfillnum}[1]{% + {\cftchapterleader}\nobreak\cftchapterformatpnum{#1}% + \cftchapterafterpnum\par} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cftpagenumberson} +% We also have to change \cs{cftpagenumberson} to accomodate +% \cs{cftXformatpnum}. +% \changes{v4.9}{2007/08/20}{Modified \cs{cftpagenumberson} for \cs{cftXformatpnum}.} +% \begin{macrocode} +\DeclareRobustCommand{\cftpagenumberson}[1]{% + \@namedef{cft#1fillnum}##1{% + \@nameuse{cft#1leader}\nobreak + \@nameuse{cft#1formatpnum}{##1}% + \@nameuse{cft#1afterpnum}\par}} + +% \end{macrocode} +% \end{macro} +% % \subsection{Page layout} % % Morten H{\o}gholm suggested (2006/07/26) that instead of using TeX syntax I should use @@ -3429,7 +3515,7 @@ % \begin{macro}{\m@mnearestht} % The adjustment of the \cs{textheight} to get an integral number % of lines with the calculated height being as the closest to the given -% height. Algorithm supplied by Lars Madsen and Morten H{\o}lmgren on +% height. Algorithm supplied by Lars Madsen and Morten H{\o}gholm on % 2006/07/27. % \begin{macrocode} \newcommand*{\m@mnearestht}{% @@ -3448,7 +3534,7 @@ % \cs{checkthelayout}\oarg{text} is the user level macro for % checking the layout. The \meta{text} argument controls which % algorithm should be used to calculate the \cs{textheight}. -% +% \changes{v4.9}{2007/11/14}{Changed some page layout tests to negative from zero or negative} % \begin{macrocode} \renewcommand*{\checkthelayout}[1][classic]{% % \end{macrocode} @@ -3459,18 +3545,25 @@ \@memznegtest{\stockwidth} \@memznegtest{\paperwidth} \@memznegtest{\textwidth} - \@memznegtest{\spinemargin} - \@memznegtest{\foremargin} +%%% \@memznegtest{\spinemargin} + \@memnegtest{\spinemargin} +%%% \@memznegtest{\foremargin} + \@memnegtest{\foremargin} \@memznegtest{\marginparsep} \@memznegtest{\marginparwidth} \@memznegtest{\stockheight} \@memznegtest{\paperheight} \@memznegtest{\textheight} - \@memznegtest{\uppermargin} - \@memznegtest{\lowermargin} - \@memznegtest{\headheight} - \@memznegtest{\headsep} - \@memznegtest{\footskip} +%%% \@memznegtest{\uppermargin} + \@memnegtest{\uppermargin} +%%% \@memznegtest{\lowermargin} + \@memnegtest{\lowermargin} +%%% \@memznegtest{\headheight} + \@memnegtest{\headheight} +%%% \@memznegtest{\headsep} + \@memnegtest{\headsep} +%%% \@memznegtest{\footskip} + \@memnegtest{\footskip} % \end{macrocode} % % Carry on regardless. We may need to adjust the \cs{textheight} @@ -3633,7 +3726,7 @@ % \begin{macro}{\everylistparindent} % \begin{macro}{\list} % The kernel sets \cs{listparindent} to zero within a \cs{list}, where it -% can be overridden in \cs{lits}'s second argument. Here it is set to +% can be overridden in \cs{list}'s second argument. Here it is set to % \cs{everyparlistindent} by default, which in turn is 0pt. % \begin{macrocode} \newdimen\everylistparindent @@ -3668,6 +3761,8 @@ % \begin{macro}{\defaultlists} % This is a simplification of memoir's original, and will apply to any font % size. +% \changes{v4.9}{2007/11/24}{Set \cs{everyparlistindent} to \cs{parindent} in +% \cs{defaultlists} and \cs{firmlists}} % \begin{macrocode} \renewcommand*{\defaultlists}{% \setlength{\partopsep}{0.2\onelineskip \@plus 0.1\onelineskip @@ -3679,7 +3774,7 @@ \parsepii = 0.1667\onelineskip \@plus \p@ \@minus \p@ \topsepii = \parsepi \topsepiii = \parsepii - \everylistparindent \z@} + \everylistparindent \listparindent} \defaultlists % \end{macrocode} @@ -3714,7 +3809,7 @@ \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@ \topsepii = \parsepi \topsepiii = \parsepii - \everylistparindent\z@} + \everylistparindent\listparindent} \newcommand*{\m@mfirmlists}{ \setlength{\partopsep}{0.1\onelineskip \@plus 0.05\onelineskip @@ -3725,7 +3820,7 @@ \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@ \topsepii = \parsepi \topsepiii = \parsepii - \everylistparindent\z@} + \everylistparindent\listparindent} % \end{macrocode} % \end{macro} @@ -5099,7 +5194,7 @@ \@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 +% from Piet van Oostrum's \Lpack{fancyhdr} package. 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. @@ -5343,11 +5438,32 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\nouppercaseheads} +% \begin{macro}{\uppercaseheads} +% \begin{macro}{\memUChead} +% Spurred by Lars Madsen's \Lpack{memexsupp} v0.05 package here is +% a way of switching uppercasing in the headings pagestyle. +% \changes{v4.9}{2007/09/07}{Added uppercase switches for headings pagestyle} +% \begin{macrocode} +\newcommand*{\nouppercaseheads}{% + \let\memUChead\relax} +\newcommand*{\uppercaseheads}{% + \let\memUChead\MakeUppercase} +\uppercaseheads + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\ps@headings} % The \pstyle{headings} pagestyle behaves differently for % twosided and onesided printing. This is a rewrite of the % standard style. % \changes{v1.1}{2002/03/10}{Added \cs{tocmark} etc., to \cs{ps@headings}} +% \changes{v4.9}{2007/09/07}{Removed \cs{@mkboth} as is never used} +% \changes{v4.9}{2007/09/07}{Replaced \cs{MakeUppercase} by \cs{memUChead} in headings pagestyle} +% \changes{v4.9}{2007/11/11}{For twosided docs set both marks for ToC, etc (suggested by Lars Madsen)} % \begin{macrocode} \if@twoside % \end{macrocode} @@ -5356,22 +5472,22 @@ % \begin{macrocode} \makepagestyle{headings} \makepsmarks{headings}{% - \let\@mkboth\markboth +%%% \let\@mkboth\markboth \def\chaptermark##1{% - \markboth{\MakeUppercase{% + \markboth{\memUChead{% \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\tocmark{\markboth{\memUChead{\contentsname}}{\memUChead{\contentsname}}}% + \def\lofmark{\markboth{\memUChead{\listfigurename}}{\memUChead{\listfigurename}}}% + \def\lotmark{\markboth{\memUChead{\listtablename}}{\memUChead{\listtablename}}}% + \def\bibmark{\markboth{\memUChead{\bibname}}{\memUChead{\bibname}}}% + \def\indexmark{\markboth{\memUChead{\indexname}}{\memUChead{\indexname}}}% \def\sectionmark##1{% - \markright{\MakeUppercase{% + \markright{\memUChead{% \ifnum \c@secnumdepth > \z@ \thesection. \ % \fi @@ -5387,20 +5503,20 @@ % \begin{macrocode} \makepagestyle{headings} \makepsmarks{headings}{% - \let\@mkboth\markboth +%%% \let\@mkboth\markboth \def\chaptermark##1{% - \markright{\MakeUppercase{% + \markright{\memUChead{% \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}}}% + \def\tocmark{\markright{\memUChead{\contentsname}}}% + \def\lofmark{\markright{\memUChead{\listfigurename}}}% + \def\lotmark{\markright{\memUChead{\listtablename}}}% + \def\bibmark{\markright{\memUChead{\bibname}}}% + \def\indexmark{\markright{\memUChead{\indexname}}}% } \makeoddhead{headings}{\slshape\rightmark}{}{\thepage} \fi @@ -5429,7 +5545,7 @@ % \begin{macrocode} \makepagestyle{myheadings} \makepsmarks{myheadings}{% - \let\@mkboth\@gobbletwo +%%% \let\@mkboth\@gobbletwo \let\chaptermark\@gobble \let\sectionmark\@gobble \def\tocmark{}% @@ -5513,7 +5629,7 @@ % \changes{v1.1}{2002/03/10}{Changed \cs{@ruledmarks} to cater for tocbibind} % \begin{macrocode} \renewcommand*{\@ruledmarks}{% - \let\@mkboth\markboth +%%% \let\@mkboth\markboth \def\chaptermark##1{% \markboth{% \ifnum \c@secnumdepth >\m@ne @@ -5580,7 +5696,7 @@ \makeheadrule{companion}{\headwidth}{\normalrulethickness} \makeheadposition{companion}{flushright}{flushleft}{}{} \makepsmarks{companion}{% - \let\@mkboth\markboth +%%% \let\@mkboth\markboth \def\chaptermark##1{\markboth{##1}{##1}} % left mark & right marks \def\sectionmark##1{\markright{% \ifnum \c@secnumdepth>\z@ @@ -5821,6 +5937,7 @@ % \begin{macrocode} %% Stefano Bianchi, ctt 2003/12/09 `New chapter style: chapter vs chapter*' \makechapterstyle{bianchi}{% + \chapterstyle{default} \renewcommand*{\chapnamefont}{\normalfont\Large\sffamily\itshape} \renewcommand*{\chapnumfont}{\normalfont\huge} \renewcommand*{\printchaptername}{% @@ -5841,6 +5958,7 @@ % My bringhurst style. % \begin{macrocode} \makechapterstyle{bringhurst}{% + \chapterstyle{default} \renewcommand*{\chapterheadstart}{} \renewcommand*{\printchaptername}{} \renewcommand*{\chapternamenum}{} @@ -5860,6 +5978,7 @@ % 2006/12/09, \textit{An example of a novel?}. % \begin{macrocode} \makechapterstyle{brotherton}{% + \chapterstyle{default} \renewcommand*{\printchapternum}{\chapnumfont \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}} @@ -5870,6 +5989,7 @@ % My Chappell style % \begin{macrocode} \makechapterstyle{chappell}{% + \chapterstyle{default} \setlength{\beforechapskip}{0pt} \renewcommand*{\chapnamefont}{\large\centering} \renewcommand*{\chapnumfont}{\large} @@ -5888,12 +6008,14 @@ % 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. +% \changes{v4.9}{2007/11/14}{Changed culver chapterstyle to match description} % \begin{macrocode} \makechapterstyle{culver}{% + \chapterstyle{default} \chapterstyle{article}% -%%% \renewcommand*{\thechapter}{\Roman{chapter}} + \renewcommand*{\thechapter}{\Roman{chapter}} \renewcommand*{\printchapternum}{% center number/title - \centering\chapnumfont \thechapter\space}% + \centering\chapnumfont \thechapter\space\space}% \renewcommand*{\printchapternonum}{\centering} \renewcommand*{\clearforchapter}{}% no new page \aliaspagestyle{chapter}{headings}% no special pagestyle @@ -5906,6 +6028,7 @@ % A very simple style of mine but I couldn't think of a good name for it. % \begin{macrocode} \makechapterstyle{dash}{% + \chapterstyle{default} \setlength{\beforechapskip}{5\onelineskip} \renewcommand*{\printchaptername}{} \renewcommand*{\chapternamenum}{} @@ -5928,6 +6051,7 @@ % My second version of the demo chapterstyle. % \begin{macrocode} \makechapterstyle{demo2}{% + \chapterstyle{default} \renewcommand*{\printchaptername}{\centering} \renewcommand*{\printchapternum}{\chapnumfont \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi} @@ -5946,10 +6070,37 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\chs@demo3} +% My third version of the demo chapterstyle. +% \changes{v4.9}{2007/11/14}{Added demo3 chapterstyle} +% \begin{macrocode} +\makechapterstyle{demo3}{% + \chapterstyle{default} + \renewcommand*{\printchaptername}{\centering} + \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape} + \renewcommand*{\printchapternum}{\chapnumfont + \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi} + \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily} + \renewcommand*{\printchaptertitle}[1]{% + \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1} + \renewcommand*{\afterchaptertitle}{% + \vskip\onelineskip \hrule\vskip \afterchapskip} + \setlength{\beforechapskip}{0pt} + \setlength{\midchapskip}{2\onelineskip} + \setlength{\afterchapskip}{2\onelineskip} + \renewcommand*{\printchapternonum}{% + \vphantom{\chapnumfont One} + \afterchapternum% + \vskip\topskip}} + +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\chs@ell} % Another of my styles which I'll probably use for my next book. % \begin{macrocode} \makechapterstyle{ell}{% + \chapterstyle{default} \renewcommand*{\chapnumfont}{\normalfont\HUGE\sffamily} \renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily} \settowidth{\chapindent}{\chapnumfont 111} @@ -5980,6 +6131,7 @@ % \begin{macrocode} %% Gerardo Garcia, ctt 2002/04/12, `Fancy Headings, Chapter Headings \makechapterstyle{ger}{% + \chapterstyle{default} \renewcommand*{\chapterheadstart}{\vspace*{\beforechapskip} \mbox{}\\\mbox{}\rule[0pt]{\textwidth}{0.4pt}\par} \setlength{\midchapskip}{20pt} @@ -5995,6 +6147,7 @@ % new length and adjusted the unnumbered appearance. % \begin{macrocode} \makechapterstyle{lyhne}{% needs graphicx package + \chapterstyle{default} \setlength{\beforechapskip}{1.5cm} \setlength{\afterchapskip}{1cm} \setlength{\midchapskip}{2cm} @@ -6021,6 +6174,7 @@ %% posted to ctt, December 2003 %%%% \usepackage{graphicx} \makechapterstyle{madsen}{% + \chapterstyle{default} \renewcommand*{\chapnamefont}{% \normalfont\Large\scshape\raggedleft} \renewcommand*{\chaptitlefont}{% @@ -6051,6 +6205,7 @@ \newcommand*{\colorchapnum}{} \newcommand*{\colorchaptitle}{} \makechapterstyle{pedersen}{% + \chapterstyle{default} \setlength{\beforechapskip}{-20pt} \setlength{\afterchapskip}{10pt} \renewcommand*{\chapnamefont}{\normalfont\LARGE\itshape} @@ -6077,6 +6232,7 @@ % \begin{macrocode} %% Thomas Dye's southall chapter style \makechapterstyle{southall}{% + \chapterstyle{default} \setlength{\afterchapskip}{5\baselineskip} \setlength{\beforechapskip}{36pt}% \headindent \setlength{\midchapskip}{\textwidth}% \rightblock @@ -6108,6 +6264,7 @@ % it to cater for multiline titles, appendices, and unnumbered chapters. % \begin{macrocode} \makechapterstyle{thatcher}{% + \chapterstyle{default} \renewcommand*{\chapterheadstart}{} \renewcommand*{\printchaptername}{% \centerline{\chapnumfont{\@chapapp\ \thechapter}}} @@ -6136,6 +6293,7 @@ %% will not display accurately. It requires the graphicx package. %%%% \usepackage{graphicx} \makechapterstyle{veelo}{% + \chapterstyle{default} \setlength{\afterchapskip}{40pt} \renewcommand*{\chapterheadstart}{\vspace*{40pt}} \renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt} @@ -6172,6 +6330,7 @@ % Guy Verville. This version caters for unnumbered chapters. % \begin{macrocode} \makechapterstyle{verville}{% + \chapterstyle{default} \setlength{\beforechapskip}{0pt} \renewcommand*{\printchaptername}{} \renewcommand*{\printchapternum}{% @@ -6314,7 +6473,1066 @@ % \end{macro} % % -% The end of the patch file +% \section{Mempatch version 4.9} +% +% \begin{macrocode} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Version 4.9 (2007/05/02 and later) + +% \end{macrocode} +% +% \subsection{New floats} +% +% The original went badly wrong in assigning numbers to the different +% float types. (This was discovered by Flavian Lambert). +% +% \begin{macro}{\newfloat} +% \cs{newfloat}\oarg{within}\marg{fenv}\marg{ext}\marg{capname} +% creates the commands for a new float environment, \meta{fenv} (aka texttt{X}), +% using \meta{ext} (aka \texttt{Z}) as the +% file extension and \meta{capname} for the caption name. +% \changes{v4.9}{2007/05/02}{Changed setting of \cs{ftype@X} in \cs{newfloat}} +% \begin{macrocode} +\renewcommand{\newfloat}[4][\@empty]{% +% \end{macrocode} +% \begin{macro}{\ftype@X} +% Define the float type, set it to the float counter, and double +% the counter afterwards. +% \begin{macrocode} +%%%% \@namedef{ftype@#2}{\value{newflo@tctr}} +%%%% \addtocounter{newflo@tctr}{\value{newflo@tctr}} + \expandafter\edef\csname ftype@#2\endcsname{\the\c@newflo@tctr} + \advance\c@newflo@tctr \c@newflo@tctr +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\c@X} +% Create the counter for the caption, which must not have been previously +% defined. +% \begin{macrocode} + \@ifundefined{c@#2}{% counter is not defined + \ifx \@empty#1\relax + \newcounter{#2} + \else + \newcounter{#2}[#1] + \expandafter\edef\csname the#2\endcsname{% + \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}} + \fi}{} + \setcounter{#2}{0} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ext@X} +% \begin{macro}{Zdepth} +% Define \cs{ext@X} for the file extension and set the new \verb?Zdepth? +% depth counter to 1. +% \begin{macrocode} + \@namedef{ext@#2}{#3} % file extension + \@ifundefined{c@#3depth}{\newcounter{#3depth}}{} + \setcounter{#3depth}{1} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\fps@X} +% \begin{macro}{\fnum@X} +% \begin{macro}{\flegX} +% \begin{macro}{\flegtocX} +% \cs{fps@X} is the default float placement specification, \cs{fnum@X} +% typesets the caption name and number, and \cs{flegX} and \cs{flegtocX} +% are for named legends. +% \begin{macrocode} + \@namedef{fps@#2}{tbp} % position + \@namedef{fnum@#2}{#4~\@nameuse{the#2}} % caption naming + \@namedef{fleg#2}{#4} % legend naming + \@namedef{flegtoc#2}##1{} % legend name in ToC + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{environment}{X} +% \begin{environment}{X*} +% Finally define the new float environment, in both normal and starred +% forms. +% \begin{macrocode} + \newenvironment{#2}{\@float{#2}}{\end@float} + \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat} +% \end{macrocode} +% \end{environment} +% \end{environment} +% +% This ends the definition of \cs{newfloat}. +% \begin{macrocode} +} % end \newfloat + +% \end{macrocode} +% \end{macro} +% +% Now correct the settings for figures and tables, and prepare for +% user-defined floats. +% \begin{macrocode} +%%%% fix figure and table settings. +\def\ftype@figure{1} +\def\ftype@table{2} +\setcounter{newflo@tctr}{4} + +% \end{macrocode} +% +% \subsection{Boxed verbatims} +% +% Per Starb\"{a}ck had problems with the adjustwidth and boxedverbatim +% combination (see CTT \textit{Re: [memoir] adjustwidth + boxedverbatim} +% 2007/02/10) in which Lars Madsen came up with a suggestion to use +% \cs{linewidth}. +% +% \begin{macro}{\@@m@mline} +% \cs{@@line} is \verb?\def\@@line{\hb@xt@\hsize}? but I need one +% for \cs{linewidth}. +% \changes{v4.9}{2007/09/08}{Added \cs{@@m@mline}} +% \begin{macrocode} +\newcommand*{\@@m@mline}{\hb@xt@\linewidth} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setupboxverb@line} +% \begin{macro}{\boxedverbatim} +% Use \cs{linewidth} instead of \cs{hsize} in these two macros. +% \changes{v4.9}{2007/09/08}{Used \cs{linewidth} instead of \cs{hsize} in +% \cs{setupboxverb@line} and \cs{boxedverbatim}} +% \begin{macrocode} +\renewcommand*{\setupboxverb@line}{% + \par + \ifbvperpage + \output=\expandafter{\expandafter\boxverb@split \the\output} + \fi + \def\verbatim@processline{\leavevmode + \b@vdocount% + \bvleftsidehook\vbox{\advance% \hsize-.8\p@% changed to \linewidth + \linewidth-.8\p@ + \@@line + {\b@vdooutside\strut\kern\bvboxsep% + \b@vdoinside% + \ift@bs + \tabverbatim@processline + \else + \the\verbatim@line + \fi + \hss}% + \kern\bvboxsep}\bvrightsidehook\par}} +\renewcommand*{\boxedverbatim}{\begingroup + \let\@@line\@@m@mline%%% new in v4.9 + \setupboxverb@line + \@verbatim + \setupbox@verb + \verbatim@start} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\bvtoprulehook} +% \begin{macro}{\bvendrulehook} +% \begin{macro}{\bvendofpage} +% \changes{v4.9}{2007/05/02}{Added \cs{linewidth} to boxedverbatim lines} +% \begin{macrocode} +\renewcommand*{\bvtoprulehook}{\hrule width\linewidth \nobreak \vskip -0.1pt} +\renewcommand*{\bvendrulehook}{\hrule width\linewidth} +\renewcommand*{\bvendofpage}{\hrule width\linewidth\kern-0.4pt} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Chapter precis} +% +% Lars Madsen found that a chapter precis bumped into the chapter title +% when the article option was used. +% \changes{v4.9}{2007/08/18}{Changed chapter precis spacing} +% +% \begin{macro}{\prechapterprecisshift} +% (Negative) Space between chapter title and a precis. Need a different value +% for the article option. +% \begin{macrocode} +\newdimen\prechapterprecisshift +\ifartopt + \prechapterprecisshift=0pt +\else + \prechapterprecisshift=-2\baselineskip +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\precisfont} +% Font for precis typesetting. +% \begin{macrocode} +\newcommand*{\precisfont}{\normalfont\itshape} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\prechapterprecis} +% Set up for typesetting the precis text (in a quote environment). +% \begin{macrocode} +\renewcommand*{\prechapterprecis}{% + \vspace*{\prechapterprecisshift}% + \begin{quote}\precisfont} + +% \end{macrocode} +% \end{macro} +% +% \subsection{Sidebars} +% +% Another problem raised its head --- floats and sidebars didn't work well +% together with the sidebar starting at odd vertical positions. As ever, +% Donald Arseneau came to the rescue (email correspondence May 2007). +% Even with the changes, there are still unsolved problems with full width +% floats on top of double columns. +% \changes{v4.9}{2007/08/18}{Another revamping of sidebar code} +% +% \begin{macro}{\m@mopsidebar} +% This might be used more than once in the following code. +% \begin{macrocode} +\newcommand*{\m@mopsidebar}{% + \ifvoid\sideins\else + \setbox\@outputbox \vbox{% + \sidecontents + \unvbox\@outputbox} + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mem@makecol} +% In this version of \cs{mem@makecol} the sidebar insert is done +% after the other inserts and floats. +% \begin{macrocode} +\gdef\mem@makecol{% + \m@m@makecolintro + \ifvoid\footins + \setbox\@outputbox \box\@cclv + \else + \setbox\@outputbox \vbox{% + \boxmaxdepth\@maxdepth + \@tempdima\dp\@cclv + \unvbox\@cclv + \vskip-\@tempdima + \vskip \skip\footins + \color@begingroup + \normalcolor + \footnoterule + \unvbox\footins + \color@endgroup + } + \fi + \m@mdoextrafeet + \m@m@makecolfloats + \m@mopsidebar + \m@m@makecoltext + \global\maxdepth \@maxdepth} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mem@makecolbf} +% This is a placeholder for attempts fo fix the doublefloat problem. +% \begin{macrocode} +\gdef\mem@makecolbf{% + \m@m@makecolintro + \setbox\@outputbox \box\@cclv + \m@m@makecolfloats + \m@mopsidebar + \ifvoid\footins + \else + \setbox\@outputbox \vbox{% + \boxmaxdepth\@maxdepth + \unvbox\@outputbox + \vskip \skip\footins + \color@begingroup + \normalcolor + \footnoterule + \unvbox\footins + \color@endgroup + }% + \fi + \m@m@makecoltext + \global\maxdepth \@maxdepth} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@reinserts} +% A change here to use \cs{unvbox}\cs{sideins} instead of \cs{sidecontents}. +% \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 +} + +% \end{macrocode} +% \end{macro} +% +% \subsection{Float placement} +% +% \begin{macro}{\setfloatlocations} +% \cs{setfloatlocations}\marg{float}\marg{locs} sets the default +% location for the \meta{float} class of floats (e.g., \texttt{figure}) +% to \meta{locs} (initially \texttt{tbp}). For tables might use: \\ +% \verb?\setfloatlocations{table}{htbp}? +% \begin{macrocode} +\newcommand*{\setfloatlocations}[2]{\@namedef{fps@#1}{#2}} + +% \end{macrocode} +% \end{macro} +% +% \subsection{Setting secnumdepth} +% +% The interplay between setting the \Lcount{secnumdepth} counter and +% \Lcount{maxsecnumdepth} is not well understood. Perhaps this will help. +% +% \begin{macro}{\setsecnumdepth} +% In the preamble \cs{setsecnumdepth}\marg{sec} sets both \Lcount{secnumdepth} +% and \Lcount{maxsecnumdepth} to \meta{sec} while in the body it only sets +% \Lcount{secnumdepth}. +% \changes{v4.9}{2007/08/19}{Changed \cs{setsecnumdepth} to set both +% \Lcount{secnumdepth} and \Lcount{maxsecnumdepth} counters} +% \begin{macrocode} +\renewcommand*{\setsecnumdepth}[1]{% + \ifx\@nodocument\relax% after the preamble + \@setclcnt{#1}{secnumdepth}% + \else + \@setclcnt{#1}{secnumdepth}% + \@setclcnt{#1}{maxsecnumdepth}% + \fi} +\setsecnumdepth{section} + +% \end{macrocode} +% \end{macro} +% +% \subsection{Appendices} +% +% \begin{macro}{\addappheadtotoc} +% This needs a \cs{phantomsection} for when \Lpack{hyperref} is used. +% \changes{v4.9}{2007/08/19}{Added \cs{phantomsection} to \cs{addappheadtotoc}} +% \begin{macrocode} +\renewcommand*{\addappheadtotoc}{% + \phantomsection\addcontentsline{toc}{chapter}{\appendixtocname}} + +% \end{macrocode} +% \end{macro} +% +% \subsection{Formatting TOC page numbers} +% +% Dan Luecking (\ctt{} \textit{Re: setting page numbers in toc in their +% natural-width box} 15 August 2007) suggested that a macro like +% \cs{cftXformatpnum} should be used for controlling the typesetting +% of page numbers in the ToC instead of the `hard coded': \\ +% \verb?\hbox to \@pnumwidth{\hfil\cftXpagefont #1}? +% I have implemented this, but the code is scattered in earlier `patches' +% as much of the code to be modified was given in pre 4.9 patches. +% +% \subsection{Heading hooks} +% +% At least one person thinks it a good idea to use multi-paragraph captions. +% It therefore seems possible that others will want multi-paragraph sectional +% headings. +% +% \begin{macro}{\memcaptioninfo} +% \begin{macro}{\memlegendinfo} +% \begin{macro}{\memnamedlegendinfo} +% \begin{macro}{\membitwocaptioninfo} +% \begin{macro}{\membionecaptioninfo} +% \begin{macro}{\membicaptioninfo} +% \changes{v4.9}{2007/08/26}{Made \cs{memcaptioninfo} and friends \cs{long}} +% \begin{macrocode} +\renewcommand{\memcaptioninfo}[4]{} +\renewcommand{\memlegendinfo}[1]{} +\renewcommand{\memnamedlegendinfo}[3]{} +\renewcommand{\membitwonumcaptioninfo}[7]{} +\renewcommand{\membionenumcaptioninfo}[7]{} +\renewcommand{\membicaptioninfo}[6]{} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\mempartinfo} +% \begin{macro}{\mempartstarinfo} +% \begin{macro}{\memchapinfo} +% \begin{macro}{\memchapstarinfo} +% \begin{macro}{\memappchapinfo} +% \begin{macro}{\memappchapstarinfo} +% \begin{macro}{\memsecinfo} +% \begin{macro}{\memsecstarinfo} +% \changes{v4.9}{2007/08/26}{Made \cs{mempartinfo} and friends \cs{long}} +% \begin{macrocode} +\renewcommand{\mempartinfo}[3]{} +\renewcommand{\mempartstarinfo}[1]{} +\renewcommand{\memchapinfo}[4]{} +\renewcommand{\memchapstarinfo}[2]{} +\renewcommand{\memappchapinfo}[4]{} +\renewcommand{\memappchapstarinfo}[2]{} +\renewcommand{\memsecinfo}[5]{} +\renewcommand{\memsecstarinfo}[2]{} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\mempoeminfo} +% \begin{macro}{\mempoemstarinfo} +% \begin{macro}{\memPoemTitleinfo} +% \begin{macro}{\memPoemTitlestarinfo} +% \changes{v4.9}{2007/08/26}{Made \cs{mempoeminfo} and friends \cs{long}} +% \begin{macrocode} +\renewcommand{\mempoeminfo}[1]{} +\renewcommand{\mempoemstarinfo}[1]{} +\renewcommand{\memPoemTitleinfo}[4]{} +\renewcommand{\memPoemTitlestarinfo}[2]{} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\memapppageinfo} +% \begin{macro}{\memapppagestarinfo} +% \begin{macro}{\memleadpageinfo} +% \begin{macro}{\memleadpagestarinfo} +% \changes{v4.9}{2007/08/26}{Made \cs{memapppageinfo} and friends \cs{long}} +% \begin{macrocode} +\renewcommand{\memapppageinfo}[1]{} +\renewcommand{\memapppagestarinfo}[1]{} +\renewcommand{\memleadpageinfo}[3]{} +\renewcommand{\memleadpagestarinfo}[2]{} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Verse and Boxed Verbatims} +% +% Ignacio Fern\'{a}ndez Galv\'{a}n (email 2007/04/07) noticed that +% \cs{vrightskip} had no effect on the verse line number positioning. +% +% \begin{macro}{\@vslnumright} +% \begin{macro}{\@vslnumleft} +% \changes{v4.9}{2007/05/02}{Replaced \cs{rightskip} by \cs{vrightskip} +% in \cs{@vslnumright} and \cs{@vslnumleft}} +% \begin{macrocode} +\renewcommand*{\@vslnumright}{% + \hfill\rlap{\kern\vrightskip\kern\rightmargin% + \vlvnumfont\getthelinenumber{poemline}}} +\renewcommand*{\@vslnumleft}{% + \hfill\rlap{\kern-\textwidth\kern-\vrightskip% + \vlvnumfont\getthelinenumber{poemline}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% Somebody hiding behind the name and email address of +% `Person \verb?facetious_nickname@hotmail.com?' +% wanted to be able to set the first verse line number to other +% than 1, and also start printing line numbers with that line (\ctt{} +% \textit{verse package --- line numbering} 2 January 2007). I supplied +% code for this, asking the requestor to tell me if it worked or not but (s)he +% never replied. It makes you wonder whether it's worth +% bothering to try and help folk. +% +% \begin{macro}{\c@memfvsline} +% A new counter for adjustment to the starting line for printing verse +% line numbers. +% \begin{macrocode} +\newcounter{memfvsline} + \c@memfvsline=\z@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setverselinenums} +% \cs{setverselinenums}\marg{firstline}\marg{startnumsat} sets the first +% verse line number to \meta{firstline} and the first line number to be +% printed at +% line \meta{startnumsat}. Use this within the \texttt{verse} environment +% before the first verse. Note that this must hold: \\ +% \verb?firstline <= startnumsat < firstline+ poemlines? +% \changes{v4.9}{2007/09/05}{Added \cs{setverselinenums} and modified +% \cs{getthelinenumber} accordingly} +% \begin{macrocode} +\newcommand*{\setverselinenums}[2]{% + \c@poemline #1\relax \advance\c@poemline \m@ne + \refstepcounter{poemline}% + \ifnum\z@<\linemodnum% we are printing line numbers + \@tempcnta #2\relax + \divide\@tempcnta\linemodnum + \multiply\@tempcnta\linemodnum + \c@memfvsline #2\relax + \advance\c@memfvsline-\@tempcnta + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\getthelinenumber} +% Revise this to cater for \cs{setverselinenums}. +% \begin{macrocode} +\renewcommand*{\getthelinenumber}[1]{ + \ifnum\@ne>\linemodnum% no line numbers + \else + \ifnum\@ne=\linemodnum% every line numbered + \@nameuse{the#1}% + \else + \@tempcnta=\@nameuse{c@#1}% + \advance\@tempcnta -\c@memfvsline + \divide\@tempcnta \linemodnum + \multiply\@tempcnta \linemodnum + \advance\@tempcnta \c@memfvsline + \ifnum\@tempcnta=\@nameuse{c@#1}\@nameuse{the#1}\fi + \fi + \fi} + +% \end{macrocode} +% \end{macro} +% +% And while we're at it we might as well provide similar functionality +% for \texttt{boxedverbatim}s. Unfortunately the calculations are slightly +% different for the two cases, so we can't share the code. +% \begin{macro}{\c@memfbvline} +% A new counter for adjustment to the starting line for printing +% \texttt{boxedverbatim} line numbers. +% \begin{macrocode} +\newcounter{memfbvline} + \c@memfbvline=\z@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setbvlinenums} +% \cs{setbvlinenums}\marg{firstline}\marg{startnumsat} sets the first +% \texttt{boxedverbatim} line number to \meta{firstline} and the first +% line number to be printed at line \meta{startnumsat}. +% \changes{v4.9}{2007/09/05}{Added \cs{setbvlinenums} and \cs{getthebvlinenumber}} +% \begin{macrocode} +\newcommand*{\setbvlinenums}[2]{% + \c@bvlinectr #1\relax \advance\c@bvlinectr \m@ne + \ifnum\z@<\linemodnum% we are printing lines + \@tempcnta #2\relax + \divide\@tempcnta\linemodnum + \multiply\@tempcnta\linemodnum + \c@memfbvline #2\relax + \advance\c@memfbvline-\@tempcnta + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\getthebvlinenumber} +% \begin{macrocode} +\newcommand*{\getthebvlinenumber}[1]{% + \ifnum\@ne>\linemodnum% no line numbers + \else + \ifnum\@ne=\linemodnum% every line numbered + \@nameuse{the#1}% + \else + \@tempcnta=\@nameuse{c@#1}% + \advance\@tempcnta-\c@memfbvline + \divide\@tempcnta \linemodnum + \multiply\@tempcnta \linemodnum + \advance\@tempcnta \c@memfbvline + \ifnum\@tempcnta=\@nameuse{c@#1}\@nameuse{the#1}\fi + \fi + \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\theb@vlinenumber} +% \changes{v4.9}{2007/09/05}{Changed \cs{theb@vlinenumber} to use \cs{getthebvlinenumber}} +% \begin{macrocode} +\renewcommand*{\theb@vlinenumber}{\getthebvlinenumber{bvlinectr}} + +% \end{macrocode} +% \end{macro} +% +% \subsection{Input files into tabulars, and etex} +% +% M.J. Williams (CTT \textit{\cs{noalign} problem with \cs{input} and +% tabular in memoir class}, 28 Aug 2007) reported that using \cs{input} in a +% tabular resulted in errors. His example was: +% \begin{verbatim} +% ... +% \begin{tabular}{c|c} \hline +% 1 & 2 \\ \hline +% \input{data} \hline +% 5 & 6 \\ \hline +% \end{tabular} +% \end{verbatim} +% where \texttt{data.tex} contains the single line (and no newline) \\ +% \verb?3 & 4 \\? +% +% Morten H{\o}gholm noted that the problem +% was caused by \Lpack{memoir}'s extension to \cs{input} +% and gave a solution that depends on processing via +% \texttt{etex} rather than \texttt{tex}. +% +% \begin{macro}{\ifetex} +% \begin{macro}{\etextrue} +% \begin{macro}{\etexfalse} +% Check if \texttt{etex} is being used. This is based on the check for +% \texttt{pdf(latex)}. +% \begin{macrocode} +%%% \ifetex is TRUE if etex is used instead of tex as the basis. +\newif\ifetex + \etexfalse +\ifx\eTeXversion\@undefined\else + \ifx\eTeXversion\relax\else + \ifnum\eTeXversion>0\relax + \etextrue + \fi + \fi +\fi + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% Here's Morten's fix. Quoting, in part: +% \begin{quotation} +% \Lpack{memoir} extends the file loading mechanism by providing +% \cs{AtBeginFile} and \cs{AtEndFile} whose arguments are executed as +% the names indicate. \ldots after inputting a file the storage bins are +% emptied. The problem [in your case] is that this emptying is an +% assignment and so starts a new tabular cell and \cs{hline} is only +% allowed after \verb?\\? or other \cs{hline}s. +% +% \ldots the tabular environment wraps each tabular cell in additional +% groups so one can do an explicit test for which type of group we are in. +% If tested to be in an align group \emph{and} in vertical mode it means +% TeX hasn't found something to start a new cell and +% then \cs{noalign} can be used. +% \end{quotation} +% +% \begin{macrocode} +\ifetex + \renewcommand*{\killm@matf}[1]{% + \ifnum 6=\currentgrouptype + \ifvmode + \expandafter\expandafter\expandafter\@firstoftwo + \expandafter\expandafter\expandafter\noalign + \fi + \fi + \@firstofone + {\@namelet{#1-m@mfb}\relax + \@namelet{#1-m@mfe}\relax + }% + } +\fi + +% \end{macrocode} +% +% \subsection{Interaction with the \Lpack{float} package} +% +% The \Lpack{float} package also defines \cs{newfloat}. +% +% \begin{macro}{\newfloat} +% Kill \cs{newfloat} if the \Lpack{float} package is loaded. +% \changes{v4.9}{2007/09/14}{Kill \cs{newfloat} if float package is loaded} +% \begin{macrocode} +%%% kill \newfloat if the float package is used. +\AtBeginPackage{float}{\let\newfloat\relax} + +% \end{macrocode} +% \end{macro} +% +% \subsection{Interaction with the \Lpack{caption} package} +% +% Kill changes to the caption macros if the \Lpack{caption} package is used. +% The \Lpack{caption} package checks the definitions of the \cs{@makecaption}, +% \cs{caption} and \cs{@caption} macros. These need to be identical to the +% definitions in the standard classes for the package to disbelieve that +% the \Lpack{memoir} class is being used. +% +% \begin{macro}{\@makecaption} +% \begin{macro}{\caption} +% \begin{macro}{\@caption} +% \changes{v4.9}{2007/11/14}{Revert caption macros for the caption package} +% \begin{macrocode} +%%% revert changes to captioning macros if the caption package is used. +\AtBeginPackage{caption}{ +\ClassWarningNoLine{memoir}{% + You are using the caption package with the memoir \MessageBreak + class. This may cause unexpected or inconsistent \MessageBreak + results if you use memoir's captioning facilities} + +\long\def\@makecaption##1##2{% + \vskip\abovecaptionskip + \sbox\@tempboxa{##1: ##2}% + \ifdim \wd\@tempboxa >\hsize + ##1: ##2\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \vskip\belowcaptionskip} + +\def\caption{% + \ifx\@captype\@undefined + \@latex@error{\noexpand\caption outside float}\@ehd + \expandafter\@gobble + \else + \refstepcounter\@captype + \expandafter\@firstofone + \fi + {\@dblarg{\@caption\@captype}} +} + +\long\def\@caption##1[##2]##3{% + \par + \addcontentsline{\csname ext@##1\endcsname}{##1}% + {\protect\numberline{\csname the##1\endcsname}{\ignorespaces ##2}}% + \begingroup + \@parboxrestore + \if@minipage + \@setminipage + \fi + \normalsize + \@makecaption{\csname fnum@##1\endcsname}{\ignorespaces ##3}\par + \endgroup} +} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{XeTeX} +% +% Having supplied an \cs{ifpdf} to check if pdfLaTeX is being used, +% here's one for XeTeX. +% +% \begin{macro}{\ifxetex} +% Checks if XeTeX is being used. +% \changes{v4.9}{2007/11/14}{Added \cs{ifxetex}} +% \begin{macrocode} +%%% Use this to check if XeTeX is being used. +\newif\ifxetex +\expandafter\ifx\csname XeTeXrevision\endcsname\relax + \xetexfalse +\else + \xetextrue +\fi + +% \end{macrocode} +% \end{macro} +% +% \subsection{For package documentation} +% +% Some macros that may be useful for documenting LaTeX code. These +% have principally come from \texttt{doc.dtx}. +% +% \begin{macro}{\bs} +% Prints \verb?\? +% \begin{macrocode} +\def\bs{\texttt{\char`\\}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\l@nohyphenation} +% \begin{macro}{\meta} +% \begin{macro}{\meta@font@select} +% From \texttt{doc.dtx} \\ +% \cs{meta}\marg{arg} prints \meta{arg}. +% \begin{macrocode} +\ifx\l@nohyphenation\undefined + \newlanguage\l@nohyphenation +\fi +\DeclareRobustCommand{\meta}[1]{% + \ensuremath\langle + \ifmmode \expandafter \nfss@text \fi + {% + \meta@font@select + \edef\meta@hyphen@restore + {\hyphenchar\the\font\the\hyphenchar\font}% + \hyphenchar\font\m@ne + \language\l@nohyphenation + #1\/% + \meta@hyphen@restore + }\ensuremath\rangle +} +\def\meta@font@select{\itshape} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\marg} +% \begin{macro}{\oarg} +% \begin{macro}{\parg} +% Robust versions of the \texttt{doc.dtx} macros. \\ +% \cs{marg}\marg{arg} prints \marg{arg} \\ +% \cs{oarg}\marg{arg} prints \oarg{arg} \\ +% \cs{parg}\marg{arg} prints \parg{arg} \\ +% \begin{macrocode} +\DeclareRobustCommand{\marg}[1]{% + {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} +\DeclareRobustCommand{\oarg}[1]{% + {\ttfamily\char`\[}\meta{#1}{\ttfamily\char`\]}} +\DeclareRobustCommand{\parg}[1]{% + {\ttfamily\char`\(}\meta{#1}{\ttfamily\char`\)}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cs} +% \verb?\cs{arg}? prints \cs{arg}. +% \begin{macrocode} +\DeclareRobustCommand{\cs}[1]{\texttt{\char`\\#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\cmd} +% \verb?\cmd{\fred}? prints \cmd{\fred}. +% \begin{macrocode} +%%%%\providecommand*{\cmd}[1]{\cs{\expandafter\cmd@to@cs\string#1}} +%%%% \def\cmd@to@cs#1#2{\char\number`#2\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\cmdprint} +% \begin{macro}{\cmdpx} +% From Heiko Oberdiek CTT 2001/05/26 (print and index a command) \\ +% \verb?\cmdprint{\fred}? prints \verb?\fred? \\ +% \verb?\cmd{\fred}? prints and indexes \verb?\fred?. NOTE It assumes that +% \verb!?! is the `actual' character for MakeIndex (it is normally \verb!@! +% but that is not much use if a command includes \verb!@! as part of its name). +% \begin{macrocode} +\newcommand{\cmdprint}[1]{\texttt{\string#1}} +\newcommand{\cmd}[1]{\cmdprint{#1}% + \index{\expandafter\@gobble\string#1?\string\cmdprint{\string#1}}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Copying pagestyles} +% +% I missed some of the pagestyle elements in the original \cs{copypagestyle}. +% (Problem discovered by Erik Quaeghebeur on 2007/11/27 CTT) +% +% \begin{macro}{\copypagestyle} +% \changes{v4.9}{2007/11/28}{Added missing elements to \cs{copypagestyle}} +% \begin{macrocode} +\renewcommand*{\copypagestyle}[2]{% + \makepagestyle{#1}% + \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}}% + \makerunningwidth{#1}{\@nameuse{#2runwidth}}% +%%%% corrected these elements + \@namedef{#1evenhpl}{\@nameuse{#2evenhpl}}% + \@namedef{#1oddhpl}{\@nameuse{#2oddhpl}}% + \@namedef{#1evenhpr}{\@nameuse{#2evenhpr}}% + \@namedef{#1oddhpr}{\@nameuse{#2oddhpr}}% +%%%% added these elements + \@namedef{#1evenfpl}{\@nameuse{#2evenfpl}}% + \@namedef{#1oddfpl}{\@nameuse{#2oddfpl}}% + \@namedef{#1evenfpr}{\@nameuse{#2evenfpr}}% + \@namedef{#1oddfpr}{\@nameuse{#2oddfpr}}% +%%%% back to the original + \@namedef{#1headrule}{\@nameuse{#2headrule}}% + \@namedef{#1footrule}{\@nameuse{#2footrule}}% + \makepsmarks{#1}{\@nameuse{#2pshook}}% +} + +% \end{macrocode} +% \end{macro} +% +% \subsection{The extra font sizes} +% +% With Metafont fonts you can't effectively specify any font sizes other +% than Knuth's, but with outline fonts you can as they can be scaled on the +% fly. Here's and extension to enable these to be used. +% +% \begin{macro}{\@ivpt} +% \begin{macro}{\@xxxvivpt} +% \begin{macro}{\@xviiilpt} +% \begin{macro}{\@lxpt} +% \begin{macro}{\@lxxiipt} +% Macros for font sizes --- extensions to the kernel ones. +% \begin{macrocode} +\newcommand*{\@ivpt}{4} +\newcommand*{\@xxxvipt}{36} +\newcommand*{\@xviiilpt}{48} +\newcommand*{\@lxpt}{60} +\newcommand*{\@lxxiipt}{72} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\extendedfontsizes} +% \begin{macro}{\LARGE} +% \begin{macro}{\huge} +% \begin{macro}{\Huge} +% \begin{macro}{\HUGE} +% \begin{macro}{\miniscule} +% Makes all font sizes, from \cs{miniscule} to \cs{HUGE} unique. +% \begin{macrocode} +\newcommand*{\extendedfontsizes}{% +\ifcase\@ptsize % 0=10pt + \or % 11pt + \renewcommand*{\HUGE}{\@setfontsize\HUGE\@xxxvipt{48}} + \or % 12pt + \renewcommand*{\Huge}{\@setfontsize\Huge\@xxxvipt{48}} + \renewcommand*{\HUGE}{\@setfontsize\HUGE\@xviiilpt{60}} + \or \or % 14pt + \renewcommand*{\huge}{\@setfontsize\huge\@xxxvipt{48}} + \renewcommand*{\Huge}{\@setfontsize\Huge\@xviiilpt{60}} + \renewcommand*{\HUGE}{\@setfontsize\HUGE\@lxpt{72}} + \or \or \or % 17pt + \renewcommand*{\LARGE}{\@setfontsize\LARGE\@xxxvipt{44}} + \renewcommand*{\huge}{\@setfontsize\huge\@xviiilpt{60}} + \renewcommand*{\Huge}{\@setfontsize\Huge\@lxpt{72}} +% \renewcommand*{\HUGE}{\@setfontsize\HUGE\@lxxiipt{96}} + \renewcommand*{\HUGE}{\@setfontsize\HUGE\@lxxiipt{90}} + \or \or % 9pt + \renewcommand*{\miniscule}{\@setfontsize\miniscule\@ivpt{5}} +\fi} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Frontmatter amd mainmatter} +% +% If \cs{frontmatter} and \cs{mainmatter} are used with the article option, +% then a page numbering / margin problem can occur if the frontmatter ends +% on an odd page --- the first mainmatter next page is odd as well which throws +% puts two odd-margined pages together. +% +% One fix from Morten is to always \cs{cleardoublepage} for twosided articles. +% +% One fix from me is for the ...matter macros to just switch on/off section +% numbering. +% +% Morten's is simpler to implement. +% +% \begin{macro}{\@smemmain} +% \changes{v4.9}{2007/12/07}{Changed clear pages in \cs{@smemmain}} +% \begin{macrocode} +\renewcommand*{\@smemmain}{% + \@mainmattertrue + \setcounter{secnumdepth}{\value{maxsecnumdepth}} + \ifartopt + \if@twoside + \cleardoublepage + \else + \clearpage + \fi + \else + \cleardoublepage + \counterwithin{figure}{chapter} + \counterwithin{table}{chapter} + \fi} + +% \end{macrocode} +% \end{macro} +% +% \subsection{ToC hooks} +% +% This is a generalisation of a suggestion by Lars Madsen (private email, +% 2007/12/14). +% +% \begin{macro}{\cftinsert} +% \begin{macro}{\cftinsertcode} +% \begin{macro}{\cftinserthook} +% \changes{v4.9}{2007/12/14}{Added \cs{cftinsert} and friends} +% \begin{macrocode} +%%% +%%% Following code suggested by Lars Madsen +%%% Command inserted in a `List of' holding a hook for extra code +\newcommand*{\cftinsert}[1]{\@nameuse{cftinsert#1}} +%%% Create a hook to be executed in a `List of'. Since we use \@nameuse +%%% it does not matter if the hook does not exist +\newcommand{\cftinsertcode}[2]{\@namedef{cftinsert#1}{#2}} +%%% Insert a hook into the `List of' file +\newcommand*{\cftinserthook}[2]{% + \addtocontents{#1}{\protect\cftinsert\protect{#1\protect}}} +%%% +%%% Use like this: +%%% \cftinsertcode{A}{% +%%% \renewcommand*{\cftchapterfont}{\normalfont\scshape} +%%% ... +%%% } +%%% \cftinsertcode{F}{...} +%%% \cftinsertcode{G}{...} +%%% ... +%%% \frontmatter +%%% \tableofcontents +%%% \cftinserthook{lof}{G} +%%% \listoffigures +%%% \chapter{...} +%%% ... +%%% \mainmatter +%%% \cftinserthook{lof}{F} +%%% \cftinserthook{toc}{A} +%%% \chapter{...} +%%% + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Setting the ToC depth} +% +% \begin{macro}{\toclevel@part} +% \begin{macro}{\toclevel@chapter} +% Somehow I missed these out much earlier. +% \changes{v4.9}{2007/12/14}{Added \cs{toclevel@part} and \cs{toclevel@chapter}} +% \begin{macrocode} +\newcommand*{\toclevel@part}{-1} +\newcommand*{\toclevel@chapter}{0} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% The end of the patch file. % % \begin{macrocode} %</patch> |