summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/memoir
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-09-10 21:21:03 +0000
committerKarl Berry <karl@freefriends.org>2020-09-10 21:21:03 +0000
commit67e9f00d61bf2bd2cb28a7843ab5733112cea855 (patch)
tree155862b1135aa708549ef0ad02b2fd57f6dfaf0c /Master/texmf-dist/source/latex/memoir
parenta1a059cb41146cfca1bb356bff185d946800c274 (diff)
memoir (10sep20)
git-svn-id: svn://tug.org/texlive/trunk@56313 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/memoir')
-rw-r--r--Master/texmf-dist/source/latex/memoir/memoir.dtx489
1 files changed, 326 insertions, 163 deletions
diff --git a/Master/texmf-dist/source/latex/memoir/memoir.dtx b/Master/texmf-dist/source/latex/memoir/memoir.dtx
index be0f5d3651f..37851064825 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{31157}
+% \CheckSum{31201}
%
% \changes{v0.1}{2001/05/20}{First public alpha release}
% \changes{v0.2}{2001/06/03}{First beta release}
@@ -122,6 +122,7 @@
% inside \cs{IfFileExists} \# needs to be doubled}
% \changes{v3.7k}{2020/03/25}{Maintenance}
% \changes{v3.7l}{2020/06/02}{Small preparation for october kernel update}
+% \changes{v3.7m}{2020/09/10}{More preparations for october kernel update}
%
% \def\dtxfile{memoir.dtx}
%
@@ -182,6 +183,7 @@
% \def\fileversion{v3.7j} \def\filedate{2019/11/21}
% \def\fileversion{v3.7k} \def\filedate{2020/03/25}
% \def\fileversion{v3.7l} \def\filedate{2020/06/02}
+% \def\fileversion{v3.7m} \def\filedate{2020/09/10}
% \title{The LaTeX \Lpack{memoir} class for configurable book
% typesetting: Source code\thanks{This
% file (\texttt{\dtxfile}) has version number \fileversion, last revised
@@ -412,11 +414,11 @@
% Announce the name, option files and version for LaTeX2e files:
% \begin{macrocode}
%<class>\ProvidesClass{memoir}%
-%<class> [2020/06/02 v3.7l configurable book, report, article document class]
+%<class> [2020/09/10 v3.7m configurable book, report, article document class]
% \end{macrocode}
% In the manual it is useful to know the current version.
% \begin{macrocode}
-%<class>\newcommand\memversion{v3.7l, 2020/06/02}
+%<class>\newcommand\memversion{v3.7m, 2020/09/10}
%<9pt>\ProvidesFile{mem9.clo}%
%<9pt> [2008/01/30 v0.4 memoir class 9pt size option]
%<10pt>\ProvidesFile{mem10.clo}%
@@ -579,6 +581,26 @@
% \end{macro}
% \end{macro}
%
+%
+% \changes{v3.7m}{2020/08/05}{Added \cs{IfFormatAtLeastTF}}
+% \begin{macro}{\IfFormatAtLeastTF}
+% Credit to Frank Mittelbach. Using
+% \cs{IfFormatAtLeastTF}\marg{date}\marg{true}\marg{false} we can
+% execute \meta{true} if the format is dated after the given
+% \meta{date} (in {\scriptsize\ttfamily YYYY/MM/DD} format) and
+% \meta{false} otherwise. The main use is for when we get info that
+% certain features are being added to the \LaTeX\ format, features
+% that we want to base class features on. Then this is an easy method
+% for providing the code only avaiable on newer formats and code left
+% over for those still using the older \LaTeX\ formats.\footnote{The \dots TF is a
+% \LaTeX3 convention.}
+% \begin{macrocode}
+\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{macro}{\ifsamename}
% \begin{macro}{\nametest}
% The macro \cs{nametest}\marg{name1}\marg{name2} tests whether the
@@ -878,7 +900,78 @@
% \end{macrocode}
% \end{macro}
-%
+%
+% \noindent
+% From 2020/10/01 format onwards we will implement file hooks via the
+% features provided by the \LaTeX\ kernel. This makes our code easier
+% to do (actually, users really ought to use these hook macros instead
+% of the ones the class provides) and it eliminates the need for us to
+% redefine \cmd{\InputIfFileExists}.
+% \changes{v3.7m}{2020/08/06}{Reimplemented file/package/class hooks}
+% \begin{macrocode}
+\IfFormatAtLeastTF{2020/10/01}{
+% \end{macrocode}
+% As mentioned in \cite{LTHOOKS,LTFILEHOOK} the kernel provides hooks
+% at the start of files, packages and classes. The class you implement
+% the latter via our definition of the file hook. We will now instead
+% use the separate hooks. Note that we will \emph{not} be adding any
+% extra labels to these hooks and will provide no interface to do
+% so. If more control is needed, please use the kernel interface directly.
+% \begin{macro}{\AtBeginFile}
+% \begin{macro}{\AtEndFile}
+% \cs{AtBeginFile}\marg{file}\marg{code} inserts \meta{code}
+% just before \meta{file} is input. Similarly \cs{AtEndFile} inserts
+% just after input.
+%
+% \textbf{Breaking change:} In the old implemenation
+% \verb!\AtEndFile{file}! worked for \texttt{file.tex} even if one
+% did not speficy the extension. Now you will need to use
+% \verb!\AtEndFile{file.tex}! explicitly.
+% \begin{macrocode}
+ \newcommand\AtBeginFile[2]{\AddToHook{file/before/#1}{#2}}
+ \newcommand\AtEndFile[2]{\AddToHook{file/after/#1}{#2}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\AtBeginPackage}
+% \begin{macro}{\AtEndPackage}
+% \begin{macro}{\RequireAtEndPackage}
+% \cs{AtBeginPackage}\marg{pack}\marg{code} inserts \meta{code}
+% just before the \meta{pack} package is input, and \cs{AtEndPackage}
+% is the equivalent for after input. \cs{RequireAtEndPackage} inserts
+% \meta{code} either at the end of \meta{pack}, or immediately if
+% \meta{pack} has already been input.
+% \begin{macrocode}
+ \newcommand\AtBeginPackage[2]{\AddToHook{package/before/#1}{#2}}
+ \newcommand\AtEndPackage[2]{\AddToHook{package/after/#1}{#2}}
+ \newcommand{\RequireAtEndPackage}[2]{%
+ \@ifpackageloaded{#1}{#2}{\AtEndPackage{#1}{#2}}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\AtBeginClass}
+% \begin{macro}{\AtEndClass}
+% \begin{macro}{\RequireAtEndClass}
+% \cs{AtBeginClass}\marg{class}\marg{code} and friends are the class
+% equivalents of \cs{AtBeginPackage} and friends.
+% \begin{macrocode}
+ \newcommand\AtBeginClass[2]{\AddToHook{class/before/#1}{#2}}
+ \newcommand\AtEndClass[2]{\AddToHook{class/after/#1}{#2}}
+ \newcommand{\RequireAtEndClass}[2]{%
+ \@ifclassloaded{#1}{#2}{\AtEndClass{#1}{#2}}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macrocode}
+}{% back to the code for older formats
+% \end{macrocode}
+% \noindent
+% Here follows the old code, which will still be used on older formats:
%
% Code, based on a hint from Morten H{\o}gholm\footnote{CTT posting
% 2005/11/08, \textit{Re: Checking for packages froma class...
@@ -913,26 +1006,26 @@
% \changes{3.7i}{2019/10/22}{Added latest kernel changes, special
% thanks to Phelype Oleinik}
% \begin{macrocode}
-\ifcsname InputIfFileExists \endcsname% looking for an explicit space
- % here aka the robust version
- \DeclareRobustCommand \InputIfFileExists[2]{%
- \IfFileExists{#1}%
- {%
- \expandafter\@swaptwoargs\expandafter
- {\@filef@und\m@matendf{#1}\killm@matf{#1}}{%
- #2\@addtofilelist{#1}\m@matbeginf{#1}\@@input%
+ \ifcsname InputIfFileExists \endcsname% looking for an explicit space
+ % here aka the robust version
+ \DeclareRobustCommand \InputIfFileExists[2]{%
+ \IfFileExists{#1}%
+ {%
+ \expandafter\@swaptwoargs\expandafter
+ {\@filef@und\m@matendf{#1}\killm@matf{#1}}{%
+ #2\@addtofilelist{#1}\m@matbeginf{#1}\@@input%
+ }%
}%
- }%
- }
-\else
- % Old definition
-\renewcommand{\InputIfFileExists}[2]{%
- \IfFileExists{#1}%
- {#2\@addtofilelist{#1}\m@matbeginf{#1}%
- \@@input \@filef@und
- \m@matendf{#1}%
- \killm@matf{#1}}}
-\fi
+ }
+ \else
+ % Old definition
+ \renewcommand{\InputIfFileExists}[2]{%
+ \IfFileExists{#1}%
+ {#2\@addtofilelist{#1}\m@matbeginf{#1}%
+ \@@input \@filef@und
+ \m@matendf{#1}%
+ \killm@matf{#1}}}
+ \fi
% \end{macrocode}
% \end{macro}
@@ -943,10 +1036,10 @@
% is defined. Similarly \cs{m@matendf}\marg{file} calls
% \cs{file-m@mfe} if it is defined.
% \begin{macrocode}
-\newcommand{\m@matbeginf}[1]{\@ifundefined{#1-m@mfb}{}%
- {\@nameuse{#1-m@mfb}}}
-\newcommand{\m@matendf}[1]{\@ifundefined{#1-m@mfe}{}%
- {\@nameuse{#1-m@mfe}}}
+ \newcommand{\m@matbeginf}[1]{\@ifundefined{#1-m@mfb}{}%
+ {\@nameuse{#1-m@mfb}}}
+ \newcommand{\m@matendf}[1]{\@ifundefined{#1-m@mfe}{}%
+ {\@nameuse{#1-m@mfe}}}
% \end{macrocode}
% \end{macro}
@@ -955,10 +1048,66 @@
% \begin{macro}{\killm@matf}
% \cs{killm@matf}\marg{file} undefines the \cs{file-m@mfb} and
% \cs{file-m@mfe} macros.
+% ^^A \begin{macrocode}
+% ^^A we use the better defintion below
+% ^^A % \newcommand*{\killm@matf}[1]{%
+% ^^A % \@namelet{#1-m@mfb}\relax
+% ^^A % \@namelet{#1-m@mfe}\relax}
+% ^^A
+% ^^A \end{macrocode}
+%
+% ^^A \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}.
+%
+% 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}
-\newcommand*{\killm@matf}[1]{%
- \@namelet{#1-m@mfb}\relax
- \@namelet{#1-m@mfe}\relax}
+ %% \ifetex
+ \newcommand*{\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}
% \end{macro}
@@ -969,12 +1118,12 @@
% just before \meta{file} is input. Similarly \cs{AtEndFile} inserts
% just after input.
% \begin{macrocode}
-\newcommand{\AtBeginFile}[2]{\@ifundefined{#1-m@mfb}%
- {\@namedef{#1-m@mfb}{#2}}%
- {\expandafter\addtodef\csname #1-m@mfb\endcsname{}{#2}}}
-\newcommand{\AtEndFile}[2]{\@ifundefined{#1-m@mfe}%
- {\@namedef{#1-m@mfe}{#2}}%
- {\expandafter\addtodef\csname #1-m@mfe\endcsname{}{#2}}}
+ \newcommand{\AtBeginFile}[2]{\@ifundefined{#1-m@mfb}%
+ {\@namedef{#1-m@mfb}{#2}}%
+ {\expandafter\addtodef\csname #1-m@mfb\endcsname{}{#2}}}
+ \newcommand{\AtEndFile}[2]{\@ifundefined{#1-m@mfe}%
+ {\@namedef{#1-m@mfe}{#2}}%
+ {\expandafter\addtodef\csname #1-m@mfe\endcsname{}{#2}}}
% \end{macrocode}
% \end{macro}
@@ -989,13 +1138,13 @@
% \meta{code} either at the end of \meta{pack}, or immediately if
% \meta{pack} has already been input.
% \begin{macrocode}
-\newcommand{\AtBeginPackage}[2]{%
- \AtBeginFile{#1.\@pkgextension}{#2}}
-\newcommand{\AtEndPackage}[2]{%
- \AtEndFile{#1.\@pkgextension}{#2}}
-\newcommand{\RequireAtEndPackage}[2]{%
- \@ifpackageloaded{#1}{#2}%
- {\AtEndFile{#1.\@pkgextension}{#2}}}
+ \newcommand{\AtBeginPackage}[2]{%
+ \AtBeginFile{#1.\@pkgextension}{#2}}
+ \newcommand{\AtEndPackage}[2]{%
+ \AtEndFile{#1.\@pkgextension}{#2}}
+ \newcommand{\RequireAtEndPackage}[2]{%
+ \@ifpackageloaded{#1}{#2}%
+ {\AtEndFile{#1.\@pkgextension}{#2}}}
% \end{macrocode}
% \end{macro}
@@ -1008,19 +1157,22 @@
% \cs{AtBeginClass}\marg{class}\marg{code} and friends are the class
% equivalents of \cs{AtBeginPackage} and friends.
% \begin{macrocode}
-\newcommand{\AtBeginClass}[2]{%
- \AtBeginFile{#1.\@clsextension}{#2}}
-\newcommand{\AtEndClass}[2]{%
- \AtEndFile{#1.\@clsextension}{#2}}
-\newcommand{\RequireAtEndClass}[2]{%
- \@ifclassloaded{#1}{#2}%
- {\AtEndFile{#1.\@clsextension}{#2}}}
+ \newcommand{\AtBeginClass}[2]{%
+ \AtBeginFile{#1.\@clsextension}{#2}}
+ \newcommand{\AtEndClass}[2]{%
+ \AtEndFile{#1.\@clsextension}{#2}}
+ \newcommand{\RequireAtEndClass}[2]{%
+ \@ifclassloaded{#1}{#2}%
+ {\AtEndFile{#1.\@clsextension}{#2}}}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
+% \begin{macrocode}
+} % end of els part of format check
+% \end{macrocode}
%
%
%
@@ -18626,61 +18778,6 @@
% \end{macrocode}
%
%
-% \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}.
-%
-% 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{Continuous tabulars}
%
@@ -30562,18 +30659,35 @@
% \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}}
+% \changes{v3.7m}{2020/08/05}{From the 2020/10/01 format, we don't
+% need the \cs{vskip}\texttt{-1in} and \cs{hskip}\texttt{-1in} as the
+% trimmarks are added in a different manner}
% \begin{macrocode}
\newcommand*\trimmarkscolor{}
+% \end{macrocode}
+% \changes{v3.7m}{2020/08/05}{Factored out two skips}
+% Factoring out two skips to make it easy to remove them in the
+% 2020/10/01 onwards.
+% \begin{macrocode}
+\newcommand\mem@trimmarks@initial@vskip{\vskip-1in}
+\newcommand\mem@trimmarks@initial@hskip{\hskip-1in}
\newcommand*{\trimmarks}{%
- \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page
- \hb@xt@\z@{\hskip-1in
+ \vbox to \z@{%
+ \mem@trimmarks@initial@vskip%
+ \vskip\trimtop % top of logical page
+ \hb@xt@\z@{%
+ \mem@trimmarks@initial@hskip%
\ifodd\c@page
- \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+ \hskip\stockwidth
+ \hskip-\trimedge
+ \hskip-\paperwidth
\else
\if@twoside
\hskip\trimedge % left of logical page
\else
- \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+ \hskip\stockwidth
+ \hskip-\trimedge
+ \hskip-\paperwidth
\fi
\fi
\vbox to \paperheight{%
@@ -30583,8 +30697,8 @@
\hb@xt@\paperwidth{\trimmarkscolor\tmarkml\hfil\tmarkmr}%
\vfil
\hb@xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
- \hss}%
- \vss}}
+ \hss}%
+ \vss}}
% \end{macrocode}
% \end{macro}
@@ -30661,47 +30775,78 @@
\put(-24,-24){\line(0,1){48}}
\put(-24,0){\oval(12,12)}
\end{picture}}}
-\renewcommand*{\trimmarks}{%
-%% \special{papersize=\the\stockwidth,\the\stockheight}
- {%
- \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page
- \hb@xt@\z@{\hskip-1in
- \ifodd\c@page
- \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
- \else
- \if@twoside
- \hskip\trimedge % left of logical page
- \else
- \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
- \fi
- \fi
- \vbox to \paperheight{%
- \let\protect\relax % <- v1.4 addition
+% \end{macrocode}
+%
+% \changes{v3.7m}{2020/08/05}{Removed redefinition of \cs{trimmarks}
+% inside \cs{quarkmarks}, it only adds an extra group compared to the
+% normal \cs{trimmarks}}
+% Removed redefintion of \cmd{\trimmarks}, seemingly no need for it.
+% \begin{macrocode}
+%% \renewcommand*{\trimmarks}{%
+%% %% \special{papersize=\the\stockwidth,\the\stockheight}
+%% {%
+%% \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page
+%% \hb@xt@\z@{\hskip-1in
+%% \ifodd\c@page
+%% \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+%% \else
+%% \if@twoside
+%% \hskip\trimedge % left of logical page
+%% \else
+%% \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+%% \fi
+%% \fi
+%% \vbox to \paperheight{%
+%% \let\protect\relax % <- v1.4 addition
% \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{\trimmarkscolor\tmarkml\hfil\tmarkmr}%
- \vfil
- \hb@xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
- \hss}%
- \vss}}%
-}}
+%% \hb@xt@\paperwidth{\trimmarkscolor\tmarktl\hfil\tmarktm\hfil\tmarktr}%
+%% \vfil
+%% \hb@xt@\paperwidth{\trimmarkscolor\tmarkml\hfil\tmarkmr}%
+%% \vfil
+%% \hb@xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
+%% \hss}%
+%% \vss}}%
+%% }
+}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
-% Any marks are put onto the pages by adding to the \cs{shipout}
+% As of the format update 2020/10/01 a hooking mechanism was added
+% to the kernel. One of these provides a hook into the background of
+% the shipped out pages, ideal for adding trimmarks. This hooking
+% system saves us from messing with \cmd{\shipout} direction (in
+% potentially incompatible ways).
+%
+% \changes{v3.7m}{2020/08/05}{Applying a format check and adding
+% trimmarks via hook if available}
+%
+% Note that the hook will be named \texttt{memoir/trimmarks} of easy
+% reference if one ever need to do some order readjustments. See
+% \cite{LTHOOKS,LTSHIPOUT} for more details on the hooking system. The
+% extra \cmd{\ifshowtrims} inside the hook is to accommodate for the
+% \cmd{\showtrimson}/\cmd{\showtrimsoff} commands.
+% \begin{macrocode}
+\IfFormatAtLeastTF{2020/10/01}{
+ \renewcommand\mem@trimmarks@initial@vskip{}
+ \renewcommand\mem@trimmarks@initial@hskip{}
+ \ifshowtrims
+ \AddToHook{shipout/background}[./trimmarks]{\ifshowtrims\put(0,0){\trimmarks}\fi}
+ \fi
+}{
+% \end{macrocode}
+% Here follows then the old code where Any marks are put onto the pages by adding to the \cs{shipout}
% routine.
%
% \begin{macro}{\mem@oldshipout}
% Keep a copy of the current version of \cs{shipout} in \cs{mem@oldshipout}.
% \begin{macrocode}
-\let\mem@oldshipout\shipout
+ \let\mem@oldshipout\shipout
% \end{macrocode}
% \end{macro}
%
@@ -30719,13 +30864,13 @@
% \changes{v1.6180339c}{2009/11/13}{Replaced Dans fix with a fix from
% Heiko Oberdiek}
% \begin{macrocode}
-\newcommand*{\mem@shipi}{%
- \ifvoid\@cclv\expandafter\aftergroup\fi\mem@shipii}
-\newcommand*\mem@shipii{%
- \ifvoid\@cclv
- \mem@oldshipout\box\@cclv
- \else
- \ifshowtrims
+ \newcommand*{\mem@shipi}{%
+ \ifvoid\@cclv\expandafter\aftergroup\fi\mem@shipii}
+ \newcommand*\mem@shipii{%
+ \ifvoid\@cclv
+ \mem@oldshipout\box\@cclv
+ \else
+ \ifshowtrims
% \end{macrocode}
% Heiko Oberdiek responded to a problem reported by Rolf
% Niepraschk. The earlier implementation might cause the output box to
@@ -30740,15 +30885,15 @@
% Heiko also provided the fix used below. Actually Heikos fix also
% fixes a problem that might cause glue settings to disappear.
% \begin{macrocode}
- \mem@oldshipout\vbox{%
- \trimmarks
- \nointerlineskip
- \box\@cclv
- }%
- \else
- \mem@oldshipout\box\@cclv
- \fi
- \fi}
+ \mem@oldshipout\vbox{%
+ \trimmarks
+ \nointerlineskip
+ \box\@cclv
+ }%
+ \else
+ \mem@oldshipout\box\@cclv
+ \fi
+ \fi}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -30758,13 +30903,15 @@
% \Lopt{showtrims} option. This adds \cs{mem@shipi} to the page box
% which then calls the original version of \cs{shipout}.
% \begin{macrocode}
-\ifshowtrims
- \renewcommand*{\shipout}{\afterassignment\mem@shipi\setbox\@cclv=}
-\fi
-
+ \ifshowtrims
+ \renewcommand*{\shipout}{\afterassignment\mem@shipi\setbox\@cclv=}
+ \fi
% \end{macrocode}
% \end{macro}
-%
+% \begin{macrocode}
+} % end format check, else part
+
+% \end{macrocode}
%
% \section{Verbatims, boxes, and files}
%
@@ -36471,11 +36618,12 @@
% \begin{macrocode}
%%% revert changes to captioning macros if the caption package is used.
\AtBeginPackage{caption}{
- \ClassWarningNoLine{memoir}{%
+ %\ClassWarningNoLine{memoir}{%
+ \ClassInfo{memoir}{%
For the caption package to function properly with memoir,
- we will now reset\string\caption\space and friends to
- kernel defaults and then let the caption package take over.
- Remember: all caption configuration now goves via the caption
+ we will now reset \string\caption\space and friends to
+ kernel defaults and then let the^^Jcaption package take over.
+ Remember: all caption configuration now goes via the caption
package interface, not the interface from the memoir class.
}
@@ -36769,7 +36917,7 @@ keyword "\\glossaryentry"
%
% \bibitem[GMS94]{GOOSSENS94}
% Michel Goossens, Frank Mittelbach, and Alexander Samarin.
-% \newblock {\em The LaTeX Companion}.
+% \newblock \emph{The LaTeX Companion}.
% \newblock Addison-Wesley Publishing Company, 1994.
%
%
@@ -36814,6 +36962,21 @@ keyword "\\glossaryentry"
% \newblock (Available from CTAN in
% \texttt{/macros/latex/required/tools})
%
+% \bibitem[Mit2020a]{LTFILEHOOK}
+% Frank Mittelbach
+% \newblock \emph{The ltfilehook package}
+% \newblock July 2020.
+%
+% \bibitem[Mit2020b]{LTHOOKS}
+% Frank Mittelbach
+% \newblock \emph{The lthooks package}
+% \newblock July 2020.
+%
+% \bibitem[Mit2020c]{LTSHIPOUT}
+% Frank Mittelbach
+% \newblock \emph{The ltshipout package}
+% \newblock July 2020.
+%
% \bibitem[Oos96]{FANCYHDR}
% Piet van Oostrum.
% \newblock \emph{Page layout in LaTeX}.