From 82e26f27acac86b76d864486d11071bf51cd1e1a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 23 Apr 2015 21:16:25 +0000 Subject: memoir (23apr15) git-svn-id: svn://tug.org/texlive/trunk@37021 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/memoir/memoir.dtx | 304 +++++++++++++++++------ 1 file changed, 231 insertions(+), 73 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/memoir/memoir.dtx b/Master/texmf-dist/source/latex/memoir/memoir.dtx index 80ebb97512a..f7d554e4978 100644 --- a/Master/texmf-dist/source/latex/memoir/memoir.dtx +++ b/Master/texmf-dist/source/latex/memoir/memoir.dtx @@ -20,7 +20,7 @@ % This work consists of the files listed in the README file. % % \fi -% \CheckSum{30606} +% \CheckSum{30748} % % \changes{v0.1}{2001/05/20}{First public alpha release} % \changes{v0.2}{2001/06/03}{First beta release} @@ -110,7 +110,8 @@ % \changes{v3.6k}{2013/05/17}{Various fixes and long overdue maintenance} % \changes{v3.7}{2013/05/22}{Bumped version} % \changes{v3.7b}{2013/05/30}{Bugfix, sidecaption} -% \changes{v3.7c}{2013/05/30}{Bugfix} +% \changes{v3.7c}{2015/03/05}{Bugfix} +% \changes{v3.7d}{2015/04/23}{Misc. bugfixes} % % \def\dtxfile{memoir.dtx} % @@ -162,6 +163,7 @@ % \def\fileversion{v3.7} \def\filedate{2013/05/22} % \def\fileversion{v3.7b} \def\filedate{2013/05/30} % \def\fileversion{v3.7c} \def\filedate{2015/03/05} +% \def\fileversion{v3.7d} \def\filedate{2015/04/23} % \title{The LaTeX \Lpack{memoir} class for configurable book % typesetting: Source code\thanks{This % file (\texttt{\dtxfile}) has version number \fileversion, last revised @@ -391,11 +393,11 @@ % Announce the name, option files and version for LaTeX2e files: % \begin{macrocode} %\ProvidesClass{memoir}% -% [2015/03/05 v3.7c configurable book, report, article document class] +% [2015/04/23 v3.7d configurable book, report, article document class] % \end{macrocode} % In the manual it is useful to know the current version. % \begin{macrocode} -%\newcommand\memversion{v3.7c, 2015/03/05} +%\newcommand\memversion{v3.7d, 2015/04/23} %<9pt>\ProvidesFile{mem9.clo}% %<9pt> [2008/01/30 v0.4 memoir class 9pt size option] %<10pt>\ProvidesFile{mem10.clo}% @@ -4453,6 +4455,25 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\setfootins} +% \cs{setfootins}\marg{length}\marg{length} sets +% \cs{skip}\cs{footins} and its minipage counterpart. It will also +% set \cs{skip}\cs{footinsv@r} and similar for minipages to the same +% values. These are used by for example \cs{twocolumnfootnotes}. +% \begin{macrocode} +\newcommand\setfootins[2]{ + \setlength{\skip\footins}{#1} + \setlength{\skip\footinsv@r}{#1} + \setlength{\skip\@mpfootins}{#2} + % not explicitly used + \setlength{\skip\@mpfootinsv@r}{#2} +} + +% \end{macrocode} +% +% \end{macro} +% +% % Initialise the paper size and trimming to their default values. % \begin{macrocode} \settrimmedsize{\stockheight}{\stockwidth}{*} @@ -5755,16 +5776,18 @@ % \cs{makefootrule}\marg{style}\marg{width}\marg{height}\marg{skip} % specifies the width, height and skip for the footrule. % \changes{v1.61803398d}{2010/02/09}{Added safe change test} +% \changes{v3.7d}{2015/04/22}{Moved \cs{...(head|foot)ruleprefix} out and +% added them else where} % \begin{macrocode} \newcommand{\makeheadrule}[3]{% \mem@ps@safe@change{#1}% \@namedef{#1headrule}{% - \@nameuse{#1headruleprefix}\hrule\@width #2\@height #3 \vskip-#3}} + \hrule\@width #2\@height #3 \vskip-#3}} \newcommand{\makefootrule}[4]{% \mem@ps@safe@change{#1}% \@namedef{#1footrule}{% \vskip-#4\vskip-#3% - \@nameuse{#1footruleprefix}\hrule\@width #2\@height #3 \vskip #4}} + \hrule\@width #2\@height #3 \vskip #4}} % \end{macrocode} % \end{macro} @@ -6026,7 +6049,17 @@ % the main direction of the document.} % \begin{macrocode} \nametest{#2}{head}\ifsamename\let\mem@hfboxer\mem@hvboxm\else\let\mem@hfboxer\mem@fvboxm\fi% - \mem@hfboxer{\nametest{#2}{foot}\ifsamename\@nameuse{#1#2rule}\fi% +% \end{macrocode} +% \changes{v3.7d}{2015/04/22}{Moved \cs{...footruleprefix} outside +% \cs{...footrule}. Otherwise copy does not work correctly. Reported +% at http://tex.stackexchange.com/q/231454/3929} +% \begin{macrocode} + \mem@hfboxer{\nametest{#2}{foot}\ifsamename% + \begingroup% to prevent colors from bleeding into the footer + \@nameuse{#1#2ruleprefix}% + \@nameuse{#1#2rule}% + \endgroup% + \fi% \hbox{% \rlap{% \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{% @@ -6048,8 +6081,13 @@ % headline if \texttt{\#2} equals \texttt{head}. % \changes{v3.6k}{2012/05/31}{Forgot to separate head/foot position into the % factorization} +% \changes{v3.7d}{2015/04/22}{Moved \cs{...headruleprefix} outside +% \cs{...headrule}. Otherwise copy does not work correctly.} % \begin{macrocode} - \nametest{#2}{head}\ifsamename\@nameuse{#1#2rule}\fi% + \nametest{#2}{head}\ifsamename% + \@nameuse{#1#2ruleprefix}% + \@nameuse{#1#2rule}% + \fi% }}\@nameuse{#1#3#2pr}}% % \end{macrocode} % And end by letting the LaTeX head/foot use our version @@ -18817,28 +18855,44 @@ \@memlistsubcaptions{\@captype}\@memoldedblfloat} % \end{macrocode} -% Unfortunately the \Lpack{fixltx2e} package, version 1.1h (current as of 2005/09/03) makes assumptions -% about \cs{end@float} which do not hold for memoir. The code has to be reverted back to that in version 1.0b of \Lpack{fixltx2e}. -% \changes{v1.618}{2005/09/03}{Dealt with incompatibilities between fixltx2e and memoir's \cs{end@dblfloat} (mempatch v3.7)} +% Unfortunately the \Lpack{fixltx2e} package, version 1.1h (current as +% of 2005/09/03) makes assumptions about \cs{end@float} which do not +% hold for memoir. The code has to be reverted back to that in version +% 1.0b of \Lpack{fixltx2e}. +% \changes{v1.618}{2005/09/03}{Dealt with incompatibilities between +% fixltx2e and memoir's \cs{end@dblfloat} (mempatch v3.7)} +% % \changes{v3.7c}{2015/03/05}{Note quite sure why this fix is needed, -% so we add a trick so that it can be deleted by defining a macro -% before \cs{documentclass}, that makes it easier to test} +% so we add a trick (\cs{MEMOIROVERRIDE}) so that it can be deleted by +% defining a macro before \cs{documentclass}, that makes it easier to +% test} +% +% Update 2015: The problematic code from \Lpack{fixltx2e} is no +% longer present from version 1.1s and on. This version is to be +% build into the LaTeX2e kernel for the TeX Live 2015 release. We +% change the code reversion so it only happens if older \Lpack{fixltx2e} +% versions are being used. +% \changes{v3.7d}{2015/03/17}{Adding check for older \Lpack{fixltx2e} +% and removing \cs{MEMOIROVERRIDE}} % \begin{macrocode} -\@ifundefined{MEMOIROVERRIDE}{ -\AtBeginDocument{\@ifpackageloaded{fixltx2e}{% - \def\end@dblfloat{% - \if@twocolumn - \@endfloatbox - \ifnum\@floatpenalty<\z@ - \@largefloatcheck - \global\dp\@currbox1sp % - \@cons\@deferlist\@currbox - \fi - \ifnum\@floatpenalty=-\@Mii \@Esphack\fi - \else - \end@float - \fi}}{}} -}{\typeout{MEMOIROVERRIDE initiated, ignoring internal fixltx2e 'patch'}} +\AtBeginDocument{% + \@ifpackageloaded{fixltx2e}{% + \@ifpackagelater{fixltx2e}{2014/01/01}{}{% package older than 2014/01/01 + \def\end@dblfloat{% + \if@twocolumn + \@endfloatbox + \ifnum\@floatpenalty<\z@ + \@largefloatcheck + \global\dp\@currbox1sp % + \@cons\@deferlist\@currbox + \fi + \ifnum\@floatpenalty=-\@Mii \@Esphack\fi + \else + \end@float + \fi}% + } + }{} +} % \end{macrocode} % \end{macro} @@ -18862,6 +18916,10 @@ % \begin{macrocode} \def\mem@fb@botlist{\@botlist} \def\mem@fb@topblock{\suppressfloats[t]} +% \end{macrocode} +% \changes{v3.7d}{2015/03/12}{\cs{\@dbldeferlist} may be removed in a +% comming LaTeX kernel update} +% \begin{macrocode} \def\FloatBlock{\par\begingroup \let\@elt\relax \edef\@tempa{\mem@fb@botlist\@deferlist\@dbldeferlist}% \ifx\@tempa\@empty @@ -24383,21 +24441,30 @@ % \begin{macro}{\raggedbottom} % \begin{macro}{\flushbottom} % \begin{macro}{\@texttop} +% \begin{macro}{\mem@flshbot} % These kernel macros need changing because of the new \cs{@indexbox} % marginal insert. +% \changes{v3.7d}{2015/04/21}{It makes more sense to explicitly call +% \cs{flushbottom} than just let \cs{@texttop}. We also add a switch +% macro to see if \cs{flushbottom} is active. \cs{raggedbottom} and +% \cs{sloppybottom} sets the switch to false} % \begin{macrocode} \renewcommand{\raggedbottom}{% + \def\mem@flshbot{01}% \def\@textbottom{\vskip\z@ plus.0001fil}% \let\@texttop\@mkidx} \renewcommand{\flushbottom}{% + \def\mem@flshbot{00}% \let\@textbottom\relax \let\@texttop\@mkidx} \let\@texttop\@mkidx +\flushbottom % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \subsection{Widows and sloppybottom} % @@ -24428,8 +24495,10 @@ % ... % \end{verbatim} % \changes{v1.61803}{2008/01/30}{Added \cs{sloppybottom} (mempatch v4.6)} +% \changes{v3.7d}{2015/04/21}{Added flush bottom switch} % \begin{macrocode} \newcommand*{\sloppybottom}{% + \def\mem@flshbot{01}% \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}} @@ -26831,11 +26900,19 @@ % \end{macro} % % \begin{macro}{\m@make@footstart} -% \cs{m@make@footstart}\marg{series} creates \cs{@footstart} +% \cs{m@make@footstart}\marg{series} creates \cs{@footstart}. +% +% The footnote series should of course use +% the skip associated with that series not just +% \cs{vskip}\cs{bigskipamount}. +% \changes{v3.7d}{2015/04/22}{Changed the \cs{vskip}} +% \changes{v3.7d}{2015/04/22}{Added the feet at bottom part} % \begin{macrocode} \newcommand{\m@make@footstart}[1]{% \@namedef{@footstart#1}{% - \vskip\bigskipamount + %\vskip\bigskipamount + \mem@if@flushbottomF\m@mopfn@bottom + \vskip\skip\csname footins#1\endcsname \leftskip=\z@ \rightskip=\z@ \footnoterule}} @@ -27646,6 +27723,9 @@ % I thought that I could get away with using the kernel's % \cs{@doclearpage} but [RS] discovered that I couldn't. % \changes{v1.62}{2004/03/14}{Redid \cs{@doclearpage} using [RS] code} +% \changes{v3.7d}{2015/04/23}{Opdated \cs{mem@doclearpage} to match +% \Lpack{fixltx2e} v1.1s (which will be the base of the ltx kernel for +% TL15)} % \begin{macrocode} \let\memold@doclearpage\@doclearpage \newcommand{\mem@doclearpage}{% @@ -27654,36 +27734,72 @@ \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa \setbox\@tempboxa\box\@cclv \xdef\@deferlist{\@toplist\@botlist\@deferlist}% - \global\let\@toplist\@empty - \global\let\@botlist\@empty - \global\@colroom\@colht + \global \let \@toplist \@empty + \global \let \@botlist \@empty + \global \@colroom \@colht \ifx \@currlist\@empty \else - \@latexerr{Float(s) lost}\@ehb - \global\let\@currlist\@empty + \@latexerr{Float(s) lost}\@ehb + \global \let \@currlist \@empty \fi \@makefcolumn\@deferlist \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}% \if@twocolumn \if@firstcolumn - \xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}% - \global\let\@dbltoplist\@empty - \global\@colht\textheight + \xdef\@deferlist{\@dbltoplist\@deferlist}% + \global \let \@dbltoplist \@empty + \global \@colht \textheight \begingroup - \@dblfloatplacement - \@makefcolumn\@dbldeferlist - \@whilesw\if@fcolmade \fi{\@outputpage - \@makefcolumn\@dbldeferlist}% - \endgroup - \else + \@dblfloatplacement + \@makefcolumn\@deferlist + \@whilesw\if@fcolmade \fi{\@outputpage + \@makefcolumn\@deferlist}% + \endgroup + \else \vbox{}\clearpage \fi \fi + \ifx\@deferlist\@empty \else\clearpage \fi \else \setbox\@cclv\vbox{\box\@cclv\vfil}% \@makecol\@opcol \clearpage - \fi} + \fi + % older version + % \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa + % \setbox\@tempboxa\box\@cclv + % \xdef\@deferlist{\@toplist\@botlist\@deferlist}% + % \global\let\@toplist\@empty + % \global\let\@botlist\@empty + % \global\@colroom\@colht + % \ifx \@currlist\@empty + % \else + % \@latexerr{Float(s) lost}\@ehb + % \global\let\@currlist\@empty + % \fi + % \@makefcolumn\@deferlist + % \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}% + % \if@twocolumn + % \if@firstcolumn + % \xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}% + % \global\let\@dbltoplist\@empty + % \global\@colht\textheight + % \begingroup + % \@dblfloatplacement + % \@makefcolumn\@dbldeferlist + % \@whilesw\if@fcolmade \fi{\@outputpage + % \@makefcolumn\@dbldeferlist}% + % \endgroup + % \else + % \vbox{}\clearpage + % \fi + % \fi + % \else + % \setbox\@cclv\vbox{\box\@cclv\vfil}% + % \@makecol\@opcol + % \clearpage + % \fi +} % \end{macrocode} % Replace the kernel's \cs{@doclearpage}. % \begin{macrocode} @@ -27729,12 +27845,20 @@ % % \begin{macro}{\m@mopfootnote} % (footnote) code for possible use in \cs{@makecol}. +% \changes{v3.7d}{2015/04/21}{Added feature to force footnotes to the +% bottom of the page in a ragged context} % \begin{macrocode} \newcommand*{\m@mopfootnote}{\setbox\@outputbox \vbox{% \boxmaxdepth\@maxdepth \@tempdima\dp\@cclv \unvbox\@cclv \vskip-\@tempdima +% \end{macrocode} +% We then add a macro call that is only activated if we are not using +% \cs{flushbottom}. If \cs{feetatbottom} is active, then a +% \cs{vfill} is added. Solution inspired by \Lpack{footmisc}. +% \begin{macrocode} + \mem@if@flushbottomF\m@mopfn@bottom \vskip \skip\footins \color@begingroup \normalcolor @@ -27748,13 +27872,19 @@ % \begin{macro}{\m@mopfootnotebf} % (footnote) code in support of footnotes below floats. % Problem with original code noted by J{\o}rgen Larsen (\url{jl@ruc.dk}) -% on 2008/05/24. +% on 2008/05/24. Updated 2015. % \changes{v1.618033}{2008/06/02}{Added \cs{m@mopfootnotebf}} +% \changes{v3.7d}{2015/04/21}{Added feature to force footnotes to the +% bottom of the page in a ragged context} % \begin{macrocode} \newcommand*{\m@mopfootnotebf}{% \setbox\@outputbox \vbox{% \boxmaxdepth\@maxdepth \unvbox\@outputbox +% \end{macrocode} +% We then add a macro call as above. +% \begin{macrocode} + \mem@if@flushbottomF\m@mopfn@bottom \vskip\skip\footins \color@begingroup \normalcolor @@ -27782,48 +27912,50 @@ % \begin{macro}{\mem@makecol} % DA's latest version of \cs{@makecol} (giving the standard % footnote order (bottom floats after footnotes)) putting the sidebar -% insert after the others (from mempatch v4.9). +% insert after the others (from mempatch v4.9). The code is renewed on +% page~\pageref{makecol} onwards. % \begin{macrocode} -\gdef\mem@makecol{% - \m@m@makecolintro - \ifvoid\footins - \setbox\@outputbox \box\@cclv - \else - \m@mopfootnote - \fi - \m@mdoextrafeet - \m@m@makecolfloats - \m@mopsidebar - \m@m@makecoltext - \global \maxdepth \@maxdepth} + % \gdef\mem@makecol{% + % \m@m@makecolintro + % \ifvoid\footins + % \setbox\@outputbox \box\@cclv + % \else + % \m@mopfootnote + % \fi + % \m@mdoextrafeet + % \m@m@makecolfloats + % \m@mopsidebar + % \m@m@makecoltext + % \global \maxdepth \@maxdepth} % \end{macrocode} % \end{macro} % % \begin{macro}{\mem@makecolbf} % A version of \cs{@makecol} which puts footnotes at the bottom of the page -% (after any bottom floats). +% (after any bottom floats). The code is renewed on +% page~\pageref{makecol} onwards. % \changes{v1.618033}{2008/06/02}{Used \cs{m@mopfootnotebf} instead of % \cs{m@mopfootnote} in \cs{mem@makecolbf}} % \begin{macrocode} -\gdef\mem@makecolbf{% - \m@m@makecolintro - \setbox\@outputbox \box\@cclv - \m@m@makecolfloats - \ifvoid\footins\else - \m@mopfootnotebf - \fi - \m@mdoextrafeet - \m@mopsidebar - \m@m@makecoltext - \global\maxdepth \@maxdepth} + % \gdef\mem@makecolbf{% + % \m@m@makecolintro + % \setbox\@outputbox \box\@cclv + % \m@m@makecolfloats + % \ifvoid\footins\else + % \m@mopfootnotebf + % \fi + % \m@mdoextrafeet + % \m@mopsidebar + % \m@m@makecoltext + % \global\maxdepth \@maxdepth} % \end{macrocode} % \end{macro} % % \begin{macro}{\mem@makecoldblf} % A version of \cs{@makecol} which is a placeholder to fix the doublefloat -% problem. +% problem. % % \begin{macrocode} \gdef\mem@makecoldblf{% @@ -27857,6 +27989,32 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\feetatbottom} +% \begin{macro}{\feetbelowragged} +% \begin{macro}{\m@mopfn@bottom} +% \begin{macro}{\mem@if@flushbottomF} +% If a page is typeset with a ragged bottom then any footnotes are +% added directly under the text. It may look better if the footnotes +% are added to the text block from the bottom up. +% \begin{macrocode} +\newcommand\feetatbottom{\def\m@mopfn@bottom{\vfill\relax}} +\newcommand\feetbelowragged{\let\m@mopfn@bottom\relax} +\feetbelowragged +% \end{macrocode} +% Next we add a test to see if \cs{flushbottom} is active. This macro +% is used within \cs{m@mopfootnote} and \cs{m@mopfootnotebf} to +% force the footnotes to the bottom \emph{only} when \cs{flushbottom} +% is \emph{not} active, hince the \texttt{F} in the name. +% \begin{macrocode} +\newcommand\mem@if@flushbottomF[1]{% + \if\mem@flshbot\else#1\fi% +} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\@reinserts} % DA's final version from last patch. @@ -28177,7 +28335,7 @@ % \begin{macro}{\@reinserts} % \begin{macro}{\@mem@extranofeet} % \begin{macro}{@mem@testifnofoot} -% Revise these to cater for the new sidefoot insert. +% Revise these to cater for the new sidefoot insert.\label{makecol} % \changes{v3.7c}{2013/11/28}{Spurious space} % \begin{macrocode} \gdef\mem@makecol{% -- cgit v1.2.3