diff options
author | Karl Berry <karl@freefriends.org> | 2011-02-15 00:53:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-02-15 00:53:04 +0000 |
commit | 73b76d6d7b5047bad09c2f43f6a99334e6d5a67c (patch) | |
tree | 0d6036237854e95ade2e585cbc305979271b4b35 /Master/texmf-dist/source/latex | |
parent | 82ac0ba9ed70499005296836d8be39181785d3ba (diff) |
memoir 3.6h (13feb11)
git-svn-id: svn://tug.org/texlive/trunk@21406 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/memoir/memoir.dtx | 905 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/memoir/mempatch.dtx | 12 |
2 files changed, 786 insertions, 131 deletions
diff --git a/Master/texmf-dist/source/latex/memoir/memoir.dtx b/Master/texmf-dist/source/latex/memoir/memoir.dtx index 7c73b4e7277..a3d9f3a9162 100644 --- a/Master/texmf-dist/source/latex/memoir/memoir.dtx +++ b/Master/texmf-dist/source/latex/memoir/memoir.dtx @@ -4,7 +4,7 @@ % Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net % Maintainer: Lars Madsen (daleif+memoir at imf dot au dot dk) % Copyright 2001--2010 Peter R. Wilson -% +% % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either % version 1.3 of this license or (at your option) any @@ -19,7 +19,7 @@ % This work consists of the files listed in the README file. % % \fi -% \CheckSum{29717} +% \CheckSum{30114} % % \changes{v0.1}{2001/05/20}{First public alpha release} % \changes{v0.2}{2001/06/03}{First beta release} @@ -147,6 +147,7 @@ % \def\fileversion{v3.6e} \def\filedate{2010/08/20} % \def\fileversion{v3.6f} \def\filedate{2010/08/22} % \def\fileversion{v3.6g} \def\filedate{2010/09/19} +% \def\fileversion{v3.6h} \def\filedate{2011/02/13} % \title{The LaTeX \Lpack{memoir} class for configurable book % typesetting: Source code\thanks{This % file (\texttt{\dtxfile}) has version number \fileversion, last revised @@ -294,6 +295,8 @@ \newcommand*{\ctt}{\textsc{ctt}} % comp.text.tex \newenvironment{PW}{\em}{} \newcommand*{\theTeXbook}{\textit{The \TeX book}} +\let\oldllap\llap +\def\llap#1{\oldllap{#1\quad}} % might be evil % \end{macrocode} % We want the full details printed. % \begin{macrocode} @@ -374,7 +377,7 @@ % Announce the name, option files and version for LaTeX2e files: % \begin{macrocode} %<class>\ProvidesClass{memoir}% -%<class> [2010/09/19 v3.6g configurable book, report, article document class] +%<class> [2011/02/13 v3.6h 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}% @@ -382,7 +385,7 @@ %<11pt>\ProvidesFile{mem11.clo}% %<11pt> [2008/01/30 v0.3 memoir class 11pt size option] %<12pt>\ProvidesFile{mem12.clo}% -%<12pt> [2008/01/30 v0.4 memoir class 12pt size option] +%<12pt> [2010/10/19 v0.4b memoir class 12pt size option] %<14pt>\ProvidesFile{mem14.clo}% %<14pt> [2008/01/30 v0.4 memoir class 14pt size option] %<17pt>\ProvidesFile{mem17.clo}% @@ -1598,7 +1601,17 @@ % \begin{macro}{\memRTLvrightskip} % \begin{macro}{\memRTLraggedright} % \begin{macro}{\memRTLraggedleft} -% These are the hooks required to support the \Lpack{bidi} package. +% \begin{macro}{\memRTLmainraggedright} +% \begin{macro}{\memRTLmainraggedleft} +% These are the hooks required to support the \Lpack{bidi} package, +% plus some we added that \Lpack{bidi} can use. The idea behind the +% \cs{XmainraggedX} macros are documents fully in RTL mode, then it +% makes sense to have the raggedness of the header and footer +% reversed. By default they do what the normally do, but in main RTL +% mode, \Lpack{bidi} can redefine them to reverse the order of the +% headers, i.e. the `left' part of the header is typeset as the +% `right' part. +% \changes{v3.6h}{2010/10/22}{Added \cs{mem@RTLmainraggedX} macros} % \begin{macrocode} \newcommand*{\memRTLleftskip}{\leftskip} \newcommand*{\memRTLrightskip}{\rightskip} @@ -1606,6 +1619,8 @@ \newcommand*{\memRTLvrightskip}{\rightskip} \newcommand*{\memRTLraggedright}{\raggedright} \newcommand*{\memRTLraggedleft}{\raggedleft} +\newcommand*{\memRTLmainraggedright}{\raggedright} +\newcommand*{\memRTLmainraggedleft}{\raggedleft} % \end{macrocode} % \end{macro} @@ -1614,8 +1629,10 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % -% It is expected that the \Lpack{bidi} package will redefine these as: +% It is expected that the \Lpack{bidi} package will redefine these as: % \begin{verbatim} % \renewcommand*{\memRTLleftskip}{\if@RTL\rightskip\else\leftskip\fi} % \renewcommand*{\memRTLrightskip}{\if@RTL\leftskip\else\rightskip\fi} @@ -1623,6 +1640,8 @@ % \renewcommand*{\memRTLvrightskip}{\if@RTL\vleftskip\else\vrightskip\fi} % \renewcommand*{\memRTLraggedright}{\if@RTL\raggedleft\else\raggedright\fi} % \renewcommand*{\memRTLraggedleft}{\if@RTL\raggedright\else\raggedleft\fi} +% \renewcommand*{\memRTLmainraggedright}{\if@RTLmain\raggedleft\else\raggedright\fi} +% \renewcommand*{\memRTLmainraggedleft}{\if@RTLmain\raggedright\else\raggedleft\fi} % \end{verbatim} % % \section{Declaration of Options} \label{sec:opt} @@ -3392,6 +3411,7 @@ % font size. % \changes{v0.11 (mem14.clo)}{2001/10/30}{Changed \cs{headheight} from 16pt to 17.5pt} % \changes{v0.11 (mem11.clo)}{2002/03/10}{Changed \cs{headheight} from 13pt to 13.6pt} +% \changes{v0.4b (mem12.clo)}{2010/10/19}{Changed \cs{headheight} from 14pt to 14.5pt} % \begin{macrocode} %</class> %<*9pt|10pt|11pt|12pt|14pt|17pt|20pt|25pt|30pt|36pt|48pt|60pt> @@ -3414,7 +3434,7 @@ \setlength\footskip{.38in} %</11pt> %<*12pt> -\setlength\headheight{14\p@} +\setlength\headheight{14.5\p@} \setlength\headsep{.275in} \setlength\topskip{12\p@} \setlength\footskip{30\p@} @@ -5608,12 +5628,12 @@ \newcommand{\makeheadrule}[3]{% \mem@ps@safe@change{#1}% \@namedef{#1headrule}{% - \hrule\@width #2\@height #3 \vskip-#3}} + \@nameuse{#1headruleprefix}\hrule\@width #2\@height #3 \vskip-#3}} \newcommand{\makefootrule}[4]{% \mem@ps@safe@change{#1}% \@namedef{#1footrule}{% - \vskip-#4\vskip-#3 - \hrule\@width #2\@height #3 \vskip #4}} + \vskip-#4\vskip-#3% + \@nameuse{#1footruleprefix}\hrule\@width #2\@height #3 \vskip #4}} % \end{macrocode} % \end{macro} @@ -5622,6 +5642,19 @@ % \end{macro} % \end{macro} % +% \changes{v3.6h}{2011/01/25}{Added this macro} +% \begin{macro}{\makeheadfootruleprefix} +% We insert a maro at the start of the head and foot rule. By default +% it does nothing, but it can be ised to specify a different color to +% the head or foot rules. +% \begin{macrocode} +\newcommand\makeheadfootruleprefix[3]{% + \@namedef{#1headruleprefix}{#2}% + \@namedef{#1footruleprefix}{#3}% +} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\makeheadposition} % \cs{makeheadposition}\marg{style}\marg{eheadpos}\marg{oheadpos}\marg{efootpos}\marg{ofootpos} % specifies the horizontal positioning of the even and odd headers and footers, @@ -5730,9 +5763,109 @@ % \end{macrocode} % \end{macro} +% \begin{macro}{\mem@maxheadheight} +% \begin{macro}{\mem@maxfootheight} +% \begin{macro}{\mem@sayonce@head} +% \begin{macro}{\mem@sayonce@foot} +% \begin{macro}{\mem@hf@measure@vbox} +% \begin{macro}{\mem@toolarge@header@message} +% \begin{macro}{\mem@toolarge@footer@message} +% \changes{v3.6h}{2010/10/21}{Added the above seven macros to be able +% to measure the headers and warn users if their design takes them outside.} +% \verb?\mem@maxheadheight? and \verb?\mem@maxfootheight? globally +% stores the max measured head and foot heights. Actually the footer +% ought to be measuring the total height and depth. We may add this +% later. The two XsayonceX macros are toggles used such that we can +% add a warning at only the first bad head/foot. We repeat the message +% at the end of the document. +% \begin{macrocode} +\newlength\mem@maxheadheight +\newlength\mem@maxfootheight +\newcommand\mem@sayonce@head{00} +\newcommand\mem@sayonce@foot{00} +% \end{macrocode} +% This is the work horse of this construction. First argument is the +% height to compare against, second should be \texttt{head} or +% \texttt{foot}, third is the warning message, and the fourth is the +% material to be measured. The idea to taken from \Lpack{fancyhdr}. +% \begin{macrocode} +\newcommand\mem@hf@measure@vbox[4]{% + \setbox0\vbox{#4}% + \ifdim\ht0>#1\relax% + \setlength\@tempdima{\@nameuse{mem@max#2height}}% + \ifdim\ht0>\@tempdima\relax% + \expandafter\global\@nameuse{mem@max#2height}=\ht0% + \expandafter\if\@nameuse{mem@sayonce@#2}\relax% + \@memwarn{#3}% + \global\@namedef{mem@sayonece@#2}{01}% + \fi% + \fi% + \fi% + \box0% +} +% \end{macrocode} +% Warning messages +% \begin{macrocode} +\newcommand\mem@toolarge@header@message{% + The material used in the headers is too large^^J% + (\the\mem@maxheadheight) for the given head height + (\the\headheight), it is recommended to^^J% + either increase the head height or redesign the header^^J% + (in both cases you will find help in the memoir manual).% +} +\newcommand\mem@toolarge@footer@message{% + The material used in the footer is too large^^J% + (\the\mem@maxfootheight) for the given foot skip + (\the\footskip), it is recommended to^^J% + either increase the foot skip or redesign the fotoer^^J% + (in both cases you will find help in the memoir manual).% +} +% \end{macrocode} +% To make things easier to read we make two short cut macros +% \begin{macrocode} +\newcommand\mem@hvboxm[1]{% + \mem@hf@measure@vbox\headheight{head}\mem@toolarge@header@message{#1}} +\newcommand\mem@fvboxm[1]{% + \mem@hf@measure@vbox\footskip{foot}\mem@toolarge@footer@message{#1}} +% \end{macrocode} +% Make sure to repeat the message at the end of the document. This +% will show the max value up until the point where the end of document +% stuff is executed. +% \begin{macrocode} +\AtEndDocument{ + \ifdim\mem@maxheadheight>\headheight + \@memwarn{\mem@toolarge@header@message} + \fi + \ifdim\mem@maxfootheight>\footskip + \@memwarn{\mem@toolarge@footer@message} + \fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % +% \begin{macro}{\mem@ps@entry@wrap} +% \changes{v3.6h}{2010/10/06}{Added this to help bidi control the +% typesetting direction of the header and footer} +% This macro is wrapped around eash entry in the headers and +% footers. By default it does nothing, but can be redefined by +% packages such as \Lpack{bidi} to control the typesetting direction +% in the header. Bidi for example has two modes such that headers +% can be RTL locally while the header stay at LTR. If this macro is +% changed, it will be a good idea to coordinate it with the bidi +% maintainer. +% \begin{macrocode} +\newcommand\mem@ps@entry@wrap{} +% \end{macrocode} +% +% \end{macro} % \begin{macro}{\mem@ps@HLH} -% \changes{v3.6d}{20101/06/24}{Factored \cs{makepagestyle}} +% \changes{v3.6d}{201010/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 @@ -5750,22 +5883,30 @@ % \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% +% \changes{v3.6h}{2010/10/06}{added the entry wrapper} +% \changes{v3.6h}{201010/10/21}{Added the header/footer measuring feature.} +% For the header/footer measuring stuff we look at \#2 and make the +% suiting macro from that value. +% \changes{v3.6h}{2010/10/22}{Added \cs{memRTLmainraggedX} macros such +% that \Lpack{bidi} can also change the order of the header if RTL is +% 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% \hbox{% \rlap{% \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{% - \raggedright\@nameuse{#1ps#2strut}% - \@nameuse{#1#4#2l}% + \memRTLmainraggedright\@nameuse{#1ps#2strut}% + \mem@ps@entry@wrap{\@nameuse{#1#4#2l}}% \@nameuse{#1ps#2strut}}}\hfill \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{% \centering\@nameuse{#1ps#2strut}% - \@nameuse{#1#4#2c}% + \mem@ps@entry@wrap{\@nameuse{#1#4#2c}}% \@nameuse{#1ps#2strut}}\hfill \llap{% \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{% - \raggedleft\@nameuse{#1ps#2strut}% - \@nameuse{#1#4#2r}% + \memRTLmainraggedleft\@nameuse{#1ps#2strut}% + \mem@ps@entry@wrap{\@nameuse{#1#4#2r}}% \@nameuse{#1ps#2strut}}}% }% % \end{macrocode} @@ -5925,14 +6066,16 @@ \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. +% 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. Also initialize the head/foot prefixes. +% \changes{v3.6h}{2011/01/25}{Added the \cs{makeheadfootruleprefix}} % \begin{macrocode} \makerunningwidth{#1}{\textwidth}% \makeheadposition{#1}{}{}{}{}% \makeheadrule{#1}{\textwidth}{0pt}% \makefootrule{#1}{\textwidth}{\footruleheight}{\footruleskip}% + \makeheadfootruleprefix{#1}{}{} % \end{macrocode} % Set the initial vertical header and footer positions. % \changes{v1.6180339c}{2009/01/13}{Added head/foot position initialisation} @@ -6012,10 +6155,13 @@ \@namedef{#1evenfpr}{\@nameuse{#2evenfpr}}% \@namedef{#1oddfpr}{\@nameuse{#2oddfpr}}% % \end{macrocode} -% Specify the head and foot rules. +% Specify the head and foot rules and the prefixes. +% \changes{v3.6h}{2011/01/25}{Added the \cs{makeheadfootruleprefix}} % \begin{macrocode} \@namedef{#1headrule}{\@nameuse{#2headrule}}% \@namedef{#1footrule}{\@nameuse{#2footrule}}% + \@namedef{#1headruleprefix}{\@nameuse{#2headruleprefix}}% + \@namedef{#1footruleprefix}{\@nameuse{#2footruleprefix}}% % \end{macrocode} % \changes{v3.6d}{2010/06/24}{Added strut copying to \cs{copypagestyle}} % And remember the struts @@ -8596,9 +8742,15 @@ % \changes{v1.2}{2002/07/27}{New optarg in \cs{chapter} for short heading} % \changes{v1.618}{2005/09/03}{Made article chapter start on a newline (mempatch v3.5)} % \changes{v3.6e}{2010/07/16}{Factored out the \cs{@afterindentfalse}} +% \changes{v3.6h}{2011/02/07}{Added the chapter block} % \begin{macrocode} \newcommand\chapter{% - \ifartopt\par\else +% \end{macrocode} +% The block macro can be defined to execute a \cs{FloatBlock} when we +% are in article mode. Outside article mode \cs{clearforchapter} is +% expected to be used for this. +% \begin{macrocode} + \ifartopt\par\@nameuse{chapterblock}\else \clearforchapter \thispagestyle{chapter} \global\@topnum\z@ @@ -9822,6 +9974,10 @@ % \begin{macrocode} \renewcommand{\@startsection}[6]{% % \end{macrocode} +% \changes{v3.6h}{2011/02/07}{Added float block hook} +% \begin{macrocode} + \@nameuse{#1block}% +% \end{macrocode} % Do raggedbottom stuff. % \begin{macrocode} \ifraggedbottomsection\if@nobreak\else @@ -10399,10 +10555,10 @@ % Donald Arseneau said that \cs{plainfancybreak} guessed at the amount % of space available and gave code based on a modified output routine % to make it more robust. The following code is based on that thread. -% \changes{v1.3}{2002/11/14}{Added lots of code for new \cs{fpbreak}} +% \changes{v1.3}{2002/11/14}{Added lots of code for new \cs{pfbreak}} % -% \begin{macro}{\pen@ltyabovefpbreak} -% \begin{macro}{\pen@ltybelowfpbreak} +% \begin{macro}{\pen@ltyabovepfbreak} +% \begin{macro}{\pen@ltybelowpfbreak} % Penalities for communication with the output routine. % \begin{macrocode} \newcommand*{\pen@ltyabovepfbreak}{2} @@ -10486,6 +10642,8 @@ % % \begin{macro}{\@pfbreakgap} % Unstarred version of \cs{pfbreak}. +% \changes{v3.6h}{2010/10/06}{fixed \cs{@pfbreakgab} kudos to DA for +% the fix} % \begin{macrocode} \newcommand{\@pfbreakgap}{% \par {% @@ -10501,6 +10659,7 @@ \advance\skip@ -1\skip@ \advance\skip@ 1\pfbreakskip \fi \penalty\pen@ltyabovepfbreak + \prevdepth\z@ % added \vskip\skip@ \penalty\pen@ltybelowpfbreak } @@ -10512,6 +10671,8 @@ % % \begin{macro}{\@spfbreakgap} % Starred version of \cs{pfbreak}. +% \changes{v3.6h}{2010/10/06}{fixed \cs{@pfbreakgab} kudos to DA for +% the fix} % \begin{macrocode} \newcommand{\@spfbreakgap}{% \par {% @@ -10527,6 +10688,7 @@ \advance\skip@ -1\skip@ \advance\skip@ 1\pfbreakskip \fi \penalty\pen@ltyabovepfbreak + \prevdepth\z@ % added \vskip\skip@ \penalty\pen@ltybelowpfbreak } @@ -18081,10 +18243,14 @@ % \begin{environment}{X} % \begin{environment}{X*} % Finally define the new float environment, in both normal and starred -% forms. +% forms. We also al an internal macro that can be used to globally +% adjust floats, e.g. making all tables in small size. +% \changes{v3.6h}{2011/02/01}{Added the calling of the adjustment +% macros, and changed the handling of optional arguments a little.} % \begin{macrocode} - \newenvironment{#2}{\@float{#2}}{\end@float} - \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat} + \newenvironment{#2}[1][\@nameuse{fps@#2}]{\@float{#2}[##1]\@nameuse{#2adjustment}}{\end@float} + \newenvironment{#2*}[1][\@nameuse{fps@#2}]{% + \@dblfloat{#2}[##1]\@nameuse{#2adjustment}\@nameuse{#2*adjustment}}{\end@dblfloat} % \end{macrocode} % \end{environment} % \end{environment} @@ -18107,6 +18273,19 @@ % \end{macrocode} % \end{macro} +% \changes{v3.6h}{2011/02/01}{Added \cs{setfloatadjustment}} +% \begin{macro}{\setfloatadjustment} +% \cs{setfloatadjustment}\marg{float}\marg{code} can be used to +% globally add internal adjustments to all floats of a certain +% type. For example to typeset the contents of all tables in +% \cs{small} use \verb|\setfloatadjustment{table}{\small}|. +% \begin{macrocode} +\newcommand*\setfloatadjustment[2]{\@namedef{#1adjustment}{#2}} + +% \end{macrocode} +% +% \end{macro} +% % % To define subcaptions for use in a new float environment, say \texttt{fenv}, the % following macros must be defined~\cite{SUBFIGURE}: @@ -18238,6 +18417,153 @@ % \end{macro} % \end{macro} % +% \changes{v3.6h}{2011/02/01}{Added \cs{FloatBlock}} +% \subsubsection{Float blockage} +% +% This is basically a slightly modified copy of \cs{FloatBarrier} from +% the \Lpack{placeins} package by Donald Arseneau, renamed such that +% both can be used in the same document. We could have emulated the +% \Lpack{placeins} package, but people might use it with options, so, +% since the code is so short we just copy it. Kudos to Donald Arseneau. +% For more defaults see +% \cite{PLACEINS}. +% \begin{macro}{\FloatBlock} +% \begin{macro}{\FloatBlockAllowAbove} +% \begin{macro}{\FloatBlockAllowBelow} +% The two \cs{XAllowY} macros is our way of supporting the +% \Lpack{placeins} package options. +% \begin{macrocode} +\def\mem@fb@botlist{\@botlist} +\def\mem@fb@topblock{\suppressfloats[t]} +\def\FloatBlock{\par\begingroup \let\@elt\relax + \edef\@tempa{\mem@fb@botlist\@deferlist\@dbldeferlist}% + \ifx\@tempa\@empty + \else + \ifx\@fltovf\relax % my indicator of recursion + \if@firstcolumn + \clearpage + \else + \null\newpage\FloatBlock + \fi + \else + \newpage \let\@fltovf\relax + \FloatBlock % recurse once only + \fi\fi \endgroup + \mem@fb@topblock} +\newcommand*\FloatBlockAllowAbove{\def\mem@fb@topblock{}} +\newcommand*\FloatBlockAllowBelow{\def\mem@fb@botlist{}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\setFloatBlockFor} +% This can be used to add \cs{FloatBLock} into various sectional +% macros. Supported: \cs{chapter} (when in article mode) and all +% sectional macros made using \cs{@startsection}. +% \begin{macrocode} +\newcommand\setFloatBlockFor[1]{% + \@namedef{#1block}{\FloatBlock}} +% \end{macrocode} +% +% \end{macro} +% +% \subsubsection{Margin floats} +% +% The next two constructions are inspired by \texttt{tufte-common.def} +% by Bil Kleb, Bill Wood, and Kevin Godby and provide a manner to +% insert figures or tables into the margin. Note that the +% \cs{setfloatadjustment} also applies here. +% \begin{macro}{\mem@margin@floatbox} +% Box to save the contents of a margin float in. +% \begin{macrocode} +\newsavebox{\mem@margin@floatbox} +% \end{macrocode} +% \end{macro} +% % \begin{environment}{mem@margin@float} +% \begin{environment}{marginfigure} +% \begin{environment}{margintable} +% \begin{macro}{\marginfloatmarginmacro} +% Since the two environments only differ in `name' a constructor is used. +% Since these margin floats are wrapped inside another type of float +% (\cs{marginpar}) they may cause problems when used combined with +% regular floats (the float order may be wrong). For that reason the +% margin float throws a \cs{FloatBlock} before issuing the \cs{marginpar}. +% \begin{macrocode} +\newcommand\marginfloatmarginmacro{\marginpar} +\newenvironment{mem@margin@float}[2][-1.2ex]% + {\FloatBlock% + \begin{lrbox}{\mem@margin@floatbox}% + \begin{minipage}{\marginparwidth}% + \def\@captype{#2}% + \hbox{}\vspace*{#1}% + \@nameuse{margin#2adjustment}% + \@nameuse{margin#2captionadjustment}% + \noindent% + } + {\end{minipage}% + \end{lrbox}% + \marginfloatmarginmacro{\usebox{\mem@margin@floatbox}}% + } +% \end{macrocode} +% The two environment is then just two applications of the +% constructor. The option can be used to move the margins float up and down. +% \begin{macrocode} +\newenvironment{marginfigure}[1][-1.2ex]{% + \begin{mem@margin@float}[#1]{figure}} + {\end{mem@margin@float}} +\newenvironment{margintable}[1][-1.2ex]{% + \begin{mem@margin@float}[#1]{table}} + {\end{mem@margin@float}} +\setfloatadjustment{marginfigure}{\centering} +\setfloatadjustment{margintable}{\centering} + +% \end{macrocode} +% \end{macro} +% \end{environment} +% \end{environment} +% \end{environment} +% \begin{macro}{\setmarginfloatcaptionadjustment} +% Because of the very narrow margin area, it may be fruitful to +% reconfigure the caption style when used in a margin float. This can +% be done globally for all captions (e.g. if all floats are margin +% floats, or just for margin floats. +% \begin{macrocode} +\newcommand*\setmarginfloatcaptionadjustment[2]{% + \@namedef{margin#1captionadjustment}{#2}} + +% \end{macrocode} +% \end{macro} +% \changes{v3.6h}{2011/02/06}{Added these two macros} +% \begin{macro}{\setmpjustification} +% \begin{macro}{\mpjustification} +% Can be just to use and configure a specialized justification. It +% follows the \verb?\marginpar? placement, and make use of the first +% argument when at the left of the text block and the other when at +% the right. It makes use of an internal setting from within +% \verb?\marginparmargin?, thus that need to have been executed. +% \begin{macrocode} +\newcommand\setmpjustification[2]{% + \@namedef{mem@mp@justification}{% + \ifm@msetmp\else\@memerror{In order to use + \string\marginCmdAdjust,^^J% + please make sure to specify into which margin the^^J% + \string\marginpar\space should go, using \string\marginparmargin}{}\fi + \m@mwhich@margin{\m@mmpar@margin}% + \ifmemtortm #2 \else #1\fi}% +} +% \end{macrocode} +% Default value +% \begin{macrocode} +\newcommand\mpjustification{% + \@nameuse{mem@mp@justification}} +\setmpjustification{\raggedleft}{\raggedright} + +% \end{macrocode} +% +% \end{macro} +% \end{macro} +% % \subsection{Captions} % % The caption styling @@ -18314,14 +18640,15 @@ % asking for separate controls for the short and long captions. \\ % \cs{captionstyle}\oarg{short}\marg{normal}. % \changes{v1.4}{2003/11/22}{Extended \cs{captionstyle} (from patch v1.5)} +% \changes{v3.6h}{2011/01/16}{Removed sporadic spaces} % \begin{macrocode} \renewcommand{\captionstyle}{% - \@ifnextchar[ {\@memcshort}{\@memcnorm}} + \@ifnextchar[{\@memcshort}{\@memcnorm}} \def\@memcshort[#1]#2{% - \def\@contcshortstyle{#1} + \def\@contcshortstyle{#1}% \def\@contcstyle{#2}} \def\@memcnorm#1{% - \def\@contcshortstyle{#1} + \def\@contcshortstyle{#1}% \def\@contcstyle{#1}} \captionstyle{} @@ -18486,9 +18813,11 @@ % and secondly to actually typeset it. To avoid problems caused by % a footnote in the caption getting processed twice, we temporarily % disable the expected relevant commands. +% \changes{v3.6h}{2011/01/20}{Provided the same for \cs{pagentote}} % \begin{macrocode} \let\@contfnote\footnote \renewcommand{\footnote}[2][]{} \let\@contfmark\footnotemark \renewcommand{\footnotemark}[1][]{} + \let\@contpnote\pagenote\renewcommand\pagenote[2][]{} % \end{macrocode} % \end{macro} % \end{macro} @@ -18498,6 +18827,7 @@ \sbox\@tempboxa{\@contnfont #1\@contdelim \@conttfont #2\@contfinal} \let\footnote\@contfnote \let\footnotemark\@contfmark + \let\pagenote\@contpnote % \end{macrocode} % If the caption is less than one % line, then the whole caption needs to be centered on the page (otherwise @@ -18508,9 +18838,12 @@ % \end{macrocode} % For typesetting at anything other than the normal width, put the caption % into a \cs{parbox} of the specified width. This must be centered. +% \changes{v3.6h}{2010/12/06}{Align inner parbox at top +% line. Vertically centered parbox cause different spacing when +% \cs{changecaptionwidth} compared when it is not used.} % \begin{macrocode} \centering - \parbox{\@contcwidth}{% + \parbox[t]{\@contcwidth}{% % \end{macrocode} % Henrik Holm\footnote{Email from \texttt{henrik@tele.ntnu.no} on % 2002/02/10.} proposed adding the next line to center short, narrow captions. @@ -24367,6 +24700,8 @@ % \changes{v1.61803398d}{2010/01/25}{\cs{@sidepar} changed to fit the % interface just added} % \changes{v1.61803398d}{2010/02/05}{added \cs{sideparform}} +% \changes{v3.6h}{2010/10/29}{The inserted text should have the same +% baseline stretch as the rest of the page notes.} % \begin{macrocode} \newcommand{\sidepar}{\@dblarg{\@sidepar}} \long\def\@sidepar[#1]#2{\leavevmode\@bsphack\strut\vadjust{% @@ -24385,6 +24720,7 @@ \fi \setbox0=\vtop to 0pt{% \begin{minipage}[t]{\marginparwidth}% + \def\baselinestretch{\m@m@footnote@spacing}% \sideparform\sideparfont% \ifmemtortm #2\else #1\fi \end{minipage}% @@ -24721,9 +25057,12 @@ % anything; see the code further on instead. % \changes{v1.61803398d}{2010/02/05}{removed % \cs{normalfont}\cs{normalsize}, as these are now in the \cs{sidebarfont}} +% \changes{v3.6h}{2010/10/29}{the text should have the same baseline +% stretch as the rest of the page notes.} % \begin{macrocode} \hsize\sidebarwidth \@parboxrestore + \def\baselinestretch{\m@m@footnote@spacing}% % \end{macrocode} % \changes{v1.61803398d}{2010/02/05}{Added margin placement check % inside \cs{sidebar}} @@ -25079,29 +25418,18 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@footnotetext} -% \begin{macro}{\m@mold@footnotetext} % \begin{macro}{\@footnotemark} -% We have to modify the kernel's \cs{@footnotetext} and \cs{@footnotemark} +% We have to modify the kernel's % \cs{@footnotetext} and +% \cs{@footnotemark} % to implement the separator. % \changes{v1.618}{2005/09/03}{Stop body font changes leaking into footnotes (mempatch v3.7)} % \changes{v1.61803}{2008/01/30}{Keep single spacing in footnotes (mempatch v4.6)} % \changes{v3.6g}{2010/09/19}{Made the 'single spacing' configurable.} +% \changes{v3.6h}{2010/20/22}{\cs{@footnotetext} is redefined later +% on, so the \cs{m@mold@footnotetext} needs to be moved, we also +% remove this version of \cs{@footnotetext} such that people do +% not mistake this for the `real' \cs{@footnotetext}}. % \begin{macrocode} -\renewcommand{\@footnotetext}[1]{\insert\footins{% - \def\baselinestretch{\m@m@footnote@spacing}% - \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} -\let\m@mold@footnotetext\@footnotetext \renewcommand*{\@footnotemark}{% \leavevmode \ifhmode @@ -25116,9 +25444,28 @@ % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % +% \begin{macro}{\mem@multiple@marker} +% \changes{v3.6h}{2010/12/07}{We copy the code above into a utility +% macro to be used else where} This code is rather handy, so we +% make an internal macro to reuse it later (for page notes). +% \begin{macrocode} +\newcommand{\mem@multiple@marker}[1]{% + \leavevmode + \ifhmode + \edef\@x@sf{\the\spacefactor}% + \m@mmf@check + \nobreak + \fi + #1% + \m@mmf@prepare + \ifhmode\spacefactor\@x@sf\fi + \relax} + +% \end{macrocode} +% +% \end{macro} +% % % \begin{macro}{\footmarkwidth} % \begin{macro}{\footmarksep} % \begin{macro}{\footparindent} @@ -25442,7 +25789,7 @@ % We are going to change some of the kernel footnote macros % % \begin{macro}{\@mpfootnotetext} -% \begin{macro}{\m@mold@mpfootnotetext} +% \begin{macro}{\@plainmpfootnotetext} % \changes{v1.6180}{2006/06/12}{Stop font changes leaking into footnotes. % The v1.618 change was too early} % \changes{v3.6g}{2010/09/19}{made 'single spacing' configurable'} @@ -25463,8 +25810,9 @@ % \end{macrocode} % Save our revised version of \cs{@mpfootnotetext} +% \changes{v3.6h}{2010/10/22}{\cs{m@mold@mpfootnotetext} renamed to \cs{@plainmpfootnotetext}} % \begin{macrocode} -\let\m@mold@mpfootnotetext\@mpfootnotetext +\let\@plainmpfootnotetext\@mpfootnotetext % \end{macrocode} % \end{macro} @@ -25532,10 +25880,12 @@ % \begin{macro}{\plainfootnotes} % The declaration for standard footnotes; easy, just use the saved % versions of \cs{@footnotetext} and \cs{@mpfootnotetext}. +% \changes{v3.6h}{2010/10/22}{\cs{m@mold@footnotetext} renamed +% \cs{@plainfootnotetext} and \cs{m@mold@mpfootnotetext} as \cs{@plainmpfootnotetext}} % \begin{macrocode} \newcommand{\plainfootnotes}{% - \let\@footnotetext\m@mold@footnotetext - \let\@mpfootnotetext\m@mold@mpfootnotetext} + \let\@footnotetext\@plainfootnotetext + \let\@mpfootnotetext\@plainmpfootnotetext} % \end{macrocode} % \end{macro} @@ -26954,6 +27304,7 @@ % several \cs{@footnotetext} in memoir, might be an idea to clean this % up at some point/daleif} % \begin{macro}{\@footnotetext} +% \begin{macro}{\m@mold@footnotetext} % Change \cs{@footnotetext} to enable footnotes to be put into the margin % by using \cs{marginpar}. % \begin{macrocode} @@ -26994,9 +27345,17 @@ \color@endgroup}% \fi% \m@mmf@prepare} +% \end{macrocode} +% Need to save this version of \cs{@footnotetext}, it is +% used within \cs{plainfootnotes}. +% \changes{v3.6h}{2010/10/22}{Moved \cs{m@mold@footnotetext} to this +% location, and renamed it to \cs{@plainfootnotetext}} +% \begin{macrocode} +\let\@plainfootnotetext\@footnotetext % \end{macrocode} % \end{macro} +% \end{macro} % % \subsection{Bottom aligned side footnotes} % @@ -27551,8 +27910,34 @@ % % \subsection{End notes} % -% This is from the \Lpack{pagenote} package, with minor amendments. -% \changes{v1.61803}{2008/01/30}{Added page notes (mempatch v4.5)} +% \changes{v3.6h}{2011/01/19+}{Reimplemented page notes} +% This used to be a copy of the \Lpack{pagenote} package, with minor +% amendments. But it turned out that the implementation used by +% \Lpack{pagenote} at that time, had a few serious flaws. In this +% implementation we will instead turn to the trick used by the +% \Lpack{endnotes} package to overcome the same problem. +% For the sake of history, let us summarise what the actual problem +% was. Basically the command \cs{pagenote}\marg{text} would write an +% entry to an external file in the following format +% \begin{verbatim} +% \noteentry{nom}{id}{text}{pagenum} +% \end{verbatim} +% and when typesetting the page notes, this file would be read into +% the document and \cs{noteentry} would typeset each page note. The +% main problem here is \verb|{text}| which is written verbatimly to +% the external file, but it is written on a single line!, thus an +% input like this +% \begin{verbatim} +% \pagenote{Test% +% test} +% \end{verbatim} +% would give us the entry +% \begin{verbatim} +% \noteentry{num}{id}{Test%test}{pagenum} +% \end{verbatim} +% oops! This is what we will solve using inspiration from +% \Lpack{endnotes}, kudos to John Lavagnino. +% % % \begin{macro}{\ifm@mpnpageopt} % \begin{macro}{\ifm@mpncontopt} @@ -27582,9 +27967,11 @@ % % \begin{macro}{\notepageref} % \begin{macro}{\continuousnotenums} -% Let the user change the default options. -% \cs{notepageref} makes page numbers available (the package \Lopt{page} option)% and \cs{continuousnotenums} means that notes will be numbered continuously -% throughout the document(the package \Lopt{continuous} option). +% \changes{v3.6h}{2011/01/19}{Removed references to pagenote package} +% Let the user change the default options. \cs{notepageref} makes +% page numbers available in the typeset list of page note and +% \cs{continuousnotenums} means that notes will be numbered +% continuously throughout the document. % \begin{macrocode} \newcommand*{\notepageref}{\m@mpnpageopttrue} \@onlypreamble\notepageref @@ -27617,13 +28004,28 @@ \mempagenotestrue % \end{macrocode} % \begin{macro}{\pagenote} -% Make sure that this has a useful definition. +% Make sure that this has a useful definition. +% \changes{v3.6h}{2011/01/19}{Made \cs{pagenote} robust} +% \begin{macrocode} + \DeclareRobustCommand\pagenote{\@bsphack\begingroup + \@sanitize + \m@m@wrpnote}% +% \end{macrocode} +% \end{macro} +% \changes{v3.6h}{2011/01/19}{Added the redefinition of \cs{mem@footto@pagenote}} +% \begin{macro}{\mem@footto@pagenote} +% The same as for \cs{pagenote} but here we use a special version of +% the writing macro that will ignore the optional argument. This will +% internally be used when the user ask for foot notes to be turned +% into page notes. % \begin{macrocode} - \def\pagenote{\@bsphack\begingroup + \DeclareRobustCommand\mem@footto@pagenote{\@bsphack\begingroup \@sanitize + \def\mem@pn@step{01}% \m@m@wrpnote}% % \end{macrocode} % \end{macro} +% At the end we make sure \cs{makepagenote} can only do something once. % \begin{macrocode} \typeout{Writing note file \jobname.ent}% \let\makepagenote\@empty} @@ -27647,15 +28049,13 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\m@m@pnwrite} -% If the \Lopt{page} option is used we cannot use an immediate write -% because the page number is only known in the output routine. +% \begin{macro}{\m@m@pnwrite} +% In the old implementation we used \cs{immediate@protected@write} +% unless the user asked for page numbers in the notes, the new +% implementation use the same writing method for all cases, for easy +% of notation we collect it in a macro. % \begin{macrocode} -\let\m@m@pnwrite\immediate@protected@write -\AtBeginDocument{% - \ifm@mpnpageopt - \let\m@m@pnwrite\protected@write - \fi} +\newcommand{\m@m@pnwrite}[3]{\immediate\write#1{#3}} % \end{macrocode} % \end{macro} @@ -27670,21 +28070,75 @@ % \end{macrocode} % \end{macro} % \end{macro} +% \begin{macro}{\c@pagenoteshadow} +% \begin{macro}{\mem@pn@step} +% \begin{macro}{\mem@pn@lastkern} +% Utilities, a counter to provide us with a unique name for each page +% note, a toggle macro and a length to hold a lastkern (because +% someone may hide it from us). +% \begin{macrocode} +\newcounter{pagenoteshadow} + \setcounter{pagenoteshadow}{0} +\newcommand\mem@pn@step{00} % i.e. true +\newlength\mem@pn@lastkern +% \end{macrocode} +% +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\m@m@wrpnote} % This writes the note information to the note file. If the optional argument % is empty it increments the % note counter and calls \cs{notenumintext} to handle its appearance in -% the body text. +% the body text. We write an entry of the following design +% \begin{verbatim} +% \startnoteentry{notenumber}{id}{auto label key} +% macro:->text +% \endnoteentry +% \end{verbatim} % \changes{v1.61803}{2008/05/25}{Made \cs{m@m@wrpnote} match the effect % described in memman regarding the optional argument.} +% \changes{v3.6h}{2011/01/19}{Changed the internal implementation} % \begin{macrocode} \newcommand{\m@m@wrpnote}[2][]{% - \@ifmtarg{#1}{\refstepcounter{pagenote}% - \notenumintext{\thepagenote}}{}% +% \end{macrocode} +% If \Lpack{hyperref} is loaded it issues a whatisit and thus +% hide/reset the last kern, which is needed for the algorithm used for +% the multiple notes in a row feature (adding commas). So we start by +% storing the last kern, and refstep a shadow counter such that we +% can generate more or less unique label keys. +% \begin{macrocode} + \mem@pn@lastkern=\lastkern% + \refstepcounter{pagenoteshadow}% +% \end{macrocode} +% If the user asks for it enable page back refs, we use labels and +% references for this (bonus: automatic support for hyperlinks if +% \Lpack{hyperref} is available). +% \begin{macrocode} + \ifm@mpnpageopt% + \phantomsection% + \label{pagenote\thepagenoteshadow-\thesheetsequence}% + \fi% +% \end{macrocode} +% Next we want to be able to reuse this macro just for writing the +% entry to disk, no writing a marker in the text (think replacement +% for \cs{footnotetext}), we use the toggle for this and also remember +% to re-insert the code needed for comma separated multiple markers +% \begin{macrocode} + \if\mem@pn@step% + \@ifmtarg{#1}{\refstepcounter{pagenote}% + % this enables the ^{1,2} feature + \ifdim\mem@pn@lastkern=\multiplefootnotemarker% + \m@mmf@prepare% rerun + \fi% + \mem@multiple@marker{\notenumintext{\thepagenote}}% + }{}% + \fi% % \end{macrocode} % Check if this is the first note in a division, and if so indicate this % in the file. +% \changes{v3.6h}{2011/01/25}{Added \cs{pagenotesubheadstarred}} % \begin{macrocode} \ifm@mpn@new@chap \global\m@mpn@new@chapfalse @@ -27692,27 +28146,53 @@ \fi \ifm@mpn@new@schap \global\m@mpn@new@schapfalse - \addtonotes{\string\pagenotesubhead{\@chapapp}{}{\pnschap}}% + \addtonotes{\string\pagenotesubheadstarred{\@chapapp}{}{\pnschap}}% \fi % \end{macrocode} -% Finally, write the entry. +% Next we write to the notes file. Instead of writing everything as a +% macro with arguments, we will use three writes. One to start a new +% entry with a few (non-text) arguments, then the text itself, and +% finally an end of entry marker macro. +% \begin{macrocode} + \m@m@pnwrite\@notefile{}% + {\string\startnoteentry{\thepagenote}{#1}% + {pagenote\thepagenoteshadow-\thesheetsequence}}% +% \end{macrocode} +% Store the text in a temp macro, change the endline char to force a +% line break at any space in the text, this also helps with line +% length limits on inputs. Getting the newline stuff to work require +% \verb|\immediate\write| which we defined earlier. We then write the +% text `verbatimly' using the trick that \Lpack{endnotes} makes use +% of: \cs{meaning}, works quite nicely. +% \begin{macrocode} + \def\next{#2}% + \begingroup% + \newlinechar='40% + \m@m@pnwrite\@notefile{}{\meaning\next}% + \endgroup% +% \end{macrocode} +% Remember to also write a marker that ends the entry. % \begin{macrocode} - \m@m@pnwrite\@notefile{} - {\string\noteentry{\thepagenote}{#1}{#2}{\thepage}}% + \m@m@pnwrite\@notefile{}% + {\string\endnoteentry}% \endgroup \@esphack} % \end{macrocode} % \end{macro} % -% % \begin{macro}{\pagenote} +% \begin{macro}{\mem@footto@pagenote} % The user command to generate a note. It is given substance -% by \cs{makepagenote}. +% by \cs{makepagenote}. Supplied with a special version used if the +% user asks for all footnotes to be turned into page notes. +% \changes{v3.6h}{2011/01/19}{Added \cs{mem@footto@pagenote}} % \begin{macrocode} \def\pagenote{\@bsphack\begingroup \@sanitize\m@m@pagenote} +\let\mem@footto@pagenote\pagenote % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\m@m@pagenote} % \begin{macrocode} @@ -27727,13 +28207,51 @@ % \begin{macro}{\memsavepagenote} % Let the user change pagenotes to footnotes, or vice-versa. In either % case the optional argument is ignored. +% \changes{v3.6h}{2010/12/07}{\cs{footnote} should be long} +% \changes{v3.6h}{2010/12/09}{because of the way +% \cs{pagenote} is defined, we cannot redefine \cs{footnote} to have +% any arguments, we need to go another route} +% \changes{v3.6h}{2010/12/09}{Added a check for the race condition} +% We have a race condition, if both \cs{pagetofootnote} and +% \cs{makepagenote} is issued in the same document, +% \cs{pagetofootnote} need to come last. % \begin{macrocode} \newcommand*{\pagetofootnote}{% \let\memsavepagenote\pagenote - \renewcommand{\pagenote}[2][]{\footnote{##2}}} + \renewcommand{\pagenote}[2][]{\footnote{##2}} +% \end{macrocode} +% Basic idea is, if pagenotes mode is on when \cs{pagetofootnote} is +% issued, everything is fine. Else we test at end document (because +% \cs{makepagenote} can go anywhere). +% \begin{macrocode} + \ifmempagenotes\else% + \AtEndDocument{% + \ifmempagenotes% + \@memerror{The use of \string\pagetofootnote\space before + \string\makepagenote\space^^Jdoes not make + sense. \string\makepagenote\space make some redefinitions that + are not picked up if \string\pagetofootnote\space is issued + before \string\makepagenote + }{} + \fi + } + \fi +} +% \end{macrocode} +% Next the more challenging one. We make the footnote counter act as +% the page note counter, this ensure that \cs{footnotemark} still work +% when the user ask to have footnotes converted into page +% notes. \cs{footnotetext} is the same as the page note writer macro, +% but without writing the marker, here we use the special page note macro. +% \begin{macrocode} \newcommand*{\foottopagenote}{% \let\memsavefootnote\footnote - \renewcommand*{\footnote}[2][]{\pagenote{##2}}} + % now also \footnotemark work + \letcountercounter{footnote}{pagenote} + % and this takes care of \footnotetext + \renewcommand\footnotetext[2][]{\mem@footto@pagenote{##2}} + \renewcommand{\footnote}[2][]{\pagenote{##2}} +} % \end{macrocode} % \end{macro} @@ -27753,12 +28271,14 @@ % % \begin{macro}{\notenumintext} % \begin{macro}{\notenuminnotes} -% \cs{notenumintext}\marg{notenum} typesets \meta{notenum} (in the body text). +% \cs{notenumintext}\marg{notenum} typesets \meta{notenum} (in the +% body text). % \begin{macrocode} \newcommand{\notenumintext}[1]{% \textsuperscript{#1}} % \end{macrocode} -% \cs{notenuminnotes}\marg{notenum} typesets \meta{notenum} (as part of the note). +% \cs{notenuminnotes}\marg{notenum} typesets \meta{notenum} (i.e. the +% very first item when typesetting a note). % \begin{macrocode} \newcommand{\notenuminnotes}[1]{% {\normalfont #1.}\space} @@ -27767,13 +28287,12 @@ % \end{macro} % % \begin{macro}{\noteentry} -% \cs{noteentry}\marg{notenum}\marg{id}\marg{pagenum}\marg{text} -% typesets a note. +% \changes{v3.6}{2010/12/14}{explanation was wrong} +% \changes{v3.6h}{2011/01/19}{removed} +% \cs{noteentry}\marg{notenum}\marg{id}\marg{text}\marg{pagenum} +% typesets a note. This macro is not used anymore. % \begin{macrocode} -\newcommand{\noteentry}[4]{% - \prenoteinnotes - \noteidinnotes{#1}{#2}\pageinnotes{#4}\noteinnotes{#3}% - \postnoteinnotes} + %\newcommand{\noteentry}[4]{} % not used any more! % \end{macrocode} % \end{macro} @@ -27799,25 +28318,33 @@ % % \begin{macro}{\pageinnotes} % \begin{macro}{\printpageinnotes} -% \cs{pageinnotes}\meta{pagenum} calls -% \cs{printpageinnotes}\marg{pagenum} to typeset the originating +% \begin{macro}{\printpageinnoteshyperref} +% \changes{v3.6h}{2011/01/19}{Changed to match new implementation} +% \cs{pageinnotes}\marg{key} calls +% \cs{printpageinnotes}\marg{key} to typeset the originating % page number (in the note), but only if the \cs{notepageref} declaration -% has been used (the page number is not trustworthy unless the -% \cs{notepageref} has been used). +% has been used. Remember we provide an automatically generated label +% key, thus we use \cs{pageref} to get the page number. We provide a +% \Lpack{hyperref} version which is automatically used whenever +% \Lpack{hyperref} is loaded. % \begin{macrocode} \newcommand{\pageinnotes}[1]{% \ifm@mpnpageopt \printpageinnotes{#1}\fi} \newcommand*{\printpageinnotes}[1]{% - (\pagerefname\ #1)\space} + (\pagerefname\ \pageref{#1})\space} +\newcommand\printpageinnoteshyperref[1]{% +(\hyperref[#1]{\pagerefname\ \pageref*{#1}})\space} % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\noteinnotes} % \cs{noteinnotes}\marg{text} is used to typeset the note's text -% (in the note list). +% (in the note list). This macro is not used any more, but doesn't do +% any harm to leave it here. % \begin{macrocode} -\newcommand{\noteinnotes}[1]{#1} +\newcommand{\noteinnotes}[1]{#1} % not used anymore! % \end{macrocode} % \end{macro} @@ -27834,6 +28361,19 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\prenotetext} +% \begin{macro}{\postnotetext} +% Thise two macros are executed just before and just after the note +% text. Does nothing by default. +% \begin{macrocode} +\newcommand\prenotetext{} +\newcommand\postnotetext{} + +% \end{macrocode} +% +% \end{macro} +% \end{macro} +% % \begin{macro}{\notesname} % \begin{macro}{\notedivision} % Heading for note list. @@ -27845,12 +28385,14 @@ % \end{macro} % \end{macro} % -% -% \begin{macro}{\printnotes} +% \changes{v3.6h}{2010/12/14}{typo} +% \changes{v3.6h}{2011/01/19}{There is no reason to use two macros to +% implement a starred and non starred version in this case.} +% \begin{macro}{\printpagenotes} % \begin{macro}{\printpagenotes*} % User commands to print the note file. % \begin{macrocode} -\newcommand*{\printpagenotes}{\@ifstar{\@sprintpagenotes}{\@printpagenotes}} +\newcommand*{\printpagenotes}{\@ifstar{\mem@printpagenotes{00}}{\mem@printpagenotes{01}}} % \end{macrocode} % \end{macro} % \end{macro} @@ -27863,51 +28405,126 @@ % \end{macrocode} % \end{macro} +% +% \begin{macro}{\startnoteentrystart} +% \begin{macro}{\endnoteentryend} +% Two utility macros making it easier for the user to change the order. +% \begin{macrocode} +\newcommand\startnoteentrystart[3]{% + \prenoteinnotes% + \noteidinnotes{#1}{#2}% + \pageinnotes{#3}% + \prenotetext% +} +\def\endnoteentryend{\postnotetext\postnoteinnotes} +% \end{macrocode} +% \end{macro} +% \end{macro} % -% \begin{macro}{\@sprintpagenotes} -% Macro implementing \cs{printpagenotes*}. +% \begin{macro}{\mem@make@gt@safe} +% Macro copied from \Lpack{endnotes}, in the notes file, the text +% begins with \verb|macro:->|, but some languages make \verb|>| +% active. For more information see the \Lpack{endnotes} +% implementation. % \begin{macrocode} -\newcommand*{\@sprintpagenotes}{% - \ifmempagenotes - \notedivision -\IfFileExists{\jobname.ent}{% - \immediate\closeout\@notefile - \input{\jobname.ent}% - \immediate\openout\@notefile=\jobname.ent% - }{% - \mempnofilewarn -}% -\fi} - +\newcommand\mem@make@gt@safe{% + \edef\@tempa{`\string >}% + \ifnum\catcode\@tempa=12% + \let\@ResetGT\relax% + \else% + \edef\@ResetGT{\noexpand\catcode\@tempa=\the\catcode\@tempa}% + \@makeother\>% + \fi% +} % \end{macrocode} % \end{macro} % -% \begin{macro}{\@printpagenotes} -% Macro implementing \cs{printpagenotes}. +% \begin{macro}{\mem@printpagenotes} +% \begin{macro}{\startnoteentry} +% \begin{macro}{\ednoteentry} +% The internal macro for printing the list of page notes. The two +% macros \cs{startnoteentry} and \cs{endnoteentry} are also defined here. % \begin{macrocode} -\newcommand*{\@printpagenotes}{% +\newcommand\mem@printpagenotes[1]{% \ifmempagenotes \notedivision \IfFileExists{\jobname.ent}{% + \begingroup + \mem@make@gt@safe% + \def\startnoteentry####1####2####3####4>{% + \begingroup + \@ResetGT + \startnoteentrystart{####1}{####2}{####3}% + } + \def\endnoteentry{\endnoteentryend\endgroup} \immediate\closeout\@notefile \input{\jobname.ent}% - }{% - \mempnofilewarn - } - \fi} + \if#1\immediate\openout\@notefile=\jobname.ent\fi% + \endgroup + }{% + \mempnofilewarn + }% + \fi% +} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@sprintpagenotes} +% Macro implementing \cs{printpagenotes*}. Removed +% \changes{v3.6h}{2011/01/20}{Removed} +% \begin{macrocode} + % \newcommand*{\@sprintpagenotes}{% + % \ifmempagenotes + % \notedivision + % \IfFileExists{\jobname.ent}{% + % \immediate\closeout\@notefile + % \input{\jobname.ent}% + % \immediate\openout\@notefile=\jobname.ent% + % }{% + % \mempnofilewarn + % }% + % \fi} + +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@printpagenotes} +% Macro implementing \cs{printpagenotes}. Removed +% \changes{v3.6h}{2011/01/20}{Removed} +% \begin{macrocode} + % \newcommand*{\@printpagenotes}{% + % \ifmempagenotes + % \notedivision + % \IfFileExists{\jobname.ent}{% + % \immediate\closeout\@notefile + % \input{\jobname.ent}% + % }{% + % \mempnofilewarn + % } + % \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\pagenotesubhead} +% \begin{macro}{\pagenotesubheadstarred} +% \changes{v3.6h}{2011/01/25}{Added \cs{pagenotesubheadstarred}} % The section heading before each set of notes. \\ % \cs{pagenotesubhead}\marg{chaptername}\marg{number}\marg{title} +% The \cs{pagenotesubheadstarred} macro is used for unnumbered +% devisions. By default it is the same as \cs{pagenotesubhead}, but +% the user can change this. For example it may look odd with an title +% like this: >>Chapter Title<< when there is no number. % \begin{macrocode} \newcommand*{\pagenotesubhead}[3]{% \section*{#1 #2 #3}} - +\newcommand\pagenotesubheadstarred{\pagenotesubhead} % \end{macrocode} % \end{macro} +% \end{macro} % % \section{Change marks} \label{sec:vct} % @@ -28276,18 +28893,23 @@ % \end{macro} % % \begin{macro}{\trimmarks} +% \begin{macro}{\trimmarkscolor} % This positions four marks (\cs{trimmark}) at the corners of a % logical page. It is basically a \cs{vbox} with zero height and width. % % Bastiaan Niels Veelo reported (2003/07/11) odd things (e.g., some % macros ignored) when changing trim marks. Turns out to be related -% to the use of \cs{protect}. +% to the use of \cs{protect}. The macro \cs{trimmarkscolor} can be +% used to change the color of the trimmarks. Despite its name, it is +% not a color but just an empty macro. % \changes{v1.1}{2002/03/10}{Changed \cs{trimmarks} to work properly with the oneside option} % \changes{v1.3}{2002/10/10}{Changed \cs{trimmarks} to use \cs{tmarktl}, etc., % instead of four \cs{trimmark}s} % \changes{v1.4}{2003/11/22}{Fiddled \cs{protect} in \cs{trimmaks} % (from patch v1.7)} +% \changes{v3.6h}{2010/12/05}{Added \cs{trimmarkscolor}} % \begin{macrocode} +\newcommand*\trimmarkscolor{} \newcommand*{\trimmarks}{% \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page \hb@xt@\z@{\hskip-1in @@ -28302,16 +28924,17 @@ \fi \vbox to \paperheight{% \let\protect\relax % <- v1.4 addition - \hb@xt@\paperwidth{\tmarktl\hfil\tmarktm\hfil\tmarktr}% + \hb@xt@\paperwidth{\trimmarkscolor\tmarktl\hfil\tmarktm\hfil\tmarktr}% \vfil - \hb@xt@\paperwidth{\tmarkml\hfil\tmarkmr}% + \hb@xt@\paperwidth{\trimmarkscolor\tmarkml\hfil\tmarkmr}% \vfil - \hb@xt@\paperwidth{\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}% + \hb@xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}% \hss}% \vss}} % \end{macrocode} % \end{macro} +% \end{macro} % % % \subsection{Quark marks} @@ -28323,6 +28946,9 @@ % \begin{macro}{\quarkmarks} % Trim marks on the style of Quark Express. % \changes{v1.61803}{2008/01/30}{Added \cs{quarkmarks} (mempatch v4.6)} +% \changes{v3.6h}{2010/12/05}{Added \cs{normalfont} such that font +% changes going over a page break does not effect the quarks +% text. Reported by Rasmus Villemoes.} % \begin{macrocode} \newcommand*{\registrationColour}[1]{#1} \newcommand*{\quarkmarks}{% @@ -28331,7 +28957,7 @@ \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\ \ + \put(3,27){\normalfont\ttfamily\fontsize{8bp}{10bp}\selectfont\jobname\ \ \today\ \ \printtime\ \ Page \thepage} \end{picture}}} \renewcommand*{\tmarktm}{\registrationColour{% @@ -28396,11 +29022,15 @@ \fi \vbox to \paperheight{% \let\protect\relax % <- v1.4 addition - \hb@xt@\paperwidth{\tmarktl\hfil\tmarktm\hfil\tmarktr}% +% \end{macrocode} +% We remember to add \cs{trimmarkscolor} +% \changes{v3.6h}{2010/12.05}{added \cs{trimmarkscolor}} +% \begin{macrocode} + \hb@xt@\paperwidth{\trimmarkscolor\tmarktl\hfil\tmarktm\hfil\tmarktr}% \vfil - \hb@xt@\paperwidth{\tmarkml\hfil\tmarkmr}% + \hb@xt@\paperwidth{\trimmarkscolor\tmarkml\hfil\tmarkmr}% \vfil - \hb@xt@\paperwidth{\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}% + \hb@xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}% \hss}% \vss}}% }} @@ -34046,6 +34676,14 @@ keyword "\\glossaryentry" % \newblock (Available from CTAN as % \texttt{macros/latex/contrib/misc/framed.sty}) % +% \bibitem[Ars05]{PLACEINS} +% Donald Arseneau. +% \newblock \emph{\Lpack{Placeins} package (version 2.2)}. +% \newblock May 2005. +% \newblock (Available from CTN as +% \texttt{macros/latex/contrib/placeins/placeins.sty}) +% +% % \bibitem[ArWi00]{IFMTARG} % Donald Arseneau and Peter Wilson. % \newblock \emph{The ifmtarg package}. @@ -34155,6 +34793,13 @@ keyword "\\glossaryentry" % \newblock % Addison-Wesley, Reading, Massachusetts, 1984. % +% +% \bibitem[KWG]{TUFTE} +% Bil Kleb, Bill Wood, and Kevin Godby. +% \newblock \emph{Tufte LaTeX}. +% \newblock December 2009. +% \newblock (Available from CTAN in \texttt{macros/latex/contrib/tufte-latex/}) +% % \bibitem[Lam94]{bk:lamport} % Leslie Lamport. % \newblock \emph{\LaTeX\ --- A Document Preparation System}. diff --git a/Master/texmf-dist/source/latex/memoir/mempatch.dtx b/Master/texmf-dist/source/latex/memoir/mempatch.dtx index c600a86386c..8888e87e972 100644 --- a/Master/texmf-dist/source/latex/memoir/mempatch.dtx +++ b/Master/texmf-dist/source/latex/memoir/mempatch.dtx @@ -20,7 +20,7 @@ % % % \fi -% \CheckSum{510} +% \CheckSum{514} % % \def\dtxfile{\texttt{mempatch.dtx}} % \def\fileversion{v1.0} \def\filedate{2003/10/04} @@ -787,6 +787,16 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\printpageinnoteshyperref} +% When \Lpack{hyperref} is active, page references in the page notes +% list looks better with a specialised macro. The macro is provided +% within the class, and here we activate it. +% \begin{macrocode} +\AtBeginDocument{% + \let\printpageinnotes\printpageinnoteshyperref% +} +% \end{macrocode} +% \end{macro} % % The end of the \Lpack{hyperref} related patches. % |