summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/memoir
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-09-11 03:02:42 +0000
committerNorbert Preining <norbert@preining.info>2020-09-11 03:02:42 +0000
commit026bcd88f082ea4bb3f2ddbac395339309f00a63 (patch)
treecd37f4299d38f8630b60c5c47bd1b60c5851ef98 /macros/latex/contrib/memoir
parent7453287d9233f42e36d981105bc93baf3e2b3a6a (diff)
CTAN sync 202009110302
Diffstat (limited to 'macros/latex/contrib/memoir')
-rw-r--r--macros/latex/contrib/memoir/README48
-rw-r--r--macros/latex/contrib/memoir/doc-src/memman.tex231
-rw-r--r--macros/latex/contrib/memoir/doc-src/memsty.sty5
-rw-r--r--macros/latex/contrib/memoir/memman.pdfbin2779593 -> 2779439 bytes
-rw-r--r--macros/latex/contrib/memoir/memoir.dtx489
5 files changed, 541 insertions, 232 deletions
diff --git a/macros/latex/contrib/memoir/README b/macros/latex/contrib/memoir/README
index d50c43f474..ce656d845c 100644
--- a/macros/latex/contrib/memoir/README
+++ b/macros/latex/contrib/memoir/README
@@ -28,6 +28,54 @@ o Backmatter:
Bibliography, indexes ~ 50 pages
+Changed (2020/09/10)
+
+o memoir v3.7m
+
+In preparation for the LaTeX format/kernel update (2020/10/01) several
+class hook features have been changed to use these new features, see
+the manuals for lthooks, ltfilehook, ltshipout for details on these
+new hooks.
+
+Thus from the 2020/10/01 LaTeX forward onwards we have the changes
+below. Until 2020/10/01 the new format can be tested via
+e.g. pdflatex-dev
+
+-- trimmarks are now added via the shipout/background hook, and is
+ labeled memoir/trimmarks
+
+ See the ltshipout manual for more details.
+
+-- \AtBeginFile{filename}{code} and \AtEndFile{filename}{code} are now
+ implemented via the file/before/filename and
+ file/after/filename hooks.
+
+ **Breaking change:** In the old implementation of
+ \AtBegin/EndFile{file}: if file is a `.tex` file, then one could use
+ \AtEndFile{test}{code} to add code at the end of inputting
+ `test.tex`. Now you will have to use \AtEndFile{test.tex}{code}.
+
+ See the manual for ltfilehook for more details.
+
+-- \AtBeginPackage{name}{code}, \AtEndPackage{name}{code} and
+ \RequireAtEndPackage{name}{code} are now implemented via the
+ package/before/name and package/after/name hooks.
+
+-- \AtBeginClass{name}{code}, \AtEndClass{name}{code} and
+ \RequireAtEndClass{name}{code} are implemented via
+ class/before/name and class/after/name
+
+-- the redefinition of \trimmarks inside the definition of \quarkmarks
+ have been removed
+
+-- Whenever the caption package is loaded, memoir will reset it self
+ so the caption package can take over. We issue some information to
+ the user at this point. In this update we have changed this
+ information from a class warning to a class info as the warning
+ confused a ot of users.
+
+
+
Changed (2020/06/02)
o memoir v3.7l
diff --git a/macros/latex/contrib/memoir/doc-src/memman.tex b/macros/latex/contrib/memoir/doc-src/memman.tex
index 5ed8b9935c..8c24a50322 100644
--- a/macros/latex/contrib/memoir/doc-src/memman.tex
+++ b/macros/latex/contrib/memoir/doc-src/memman.tex
@@ -28144,8 +28144,8 @@ pdflatex memman
\svnidlong
{$Ignore: $}
-{$LastChangedDate: 2019-11-11 16:55:48 +0100 (Mon, 11 Nov 2019) $}
-{$LastChangedRevision: 661 $}
+{$LastChangedDate: 2020-08-06 14:38:28 +0200 (Thu, 06 Aug 2020) $}
+{$LastChangedRevision: 693 $}
{$LastChangedBy: daleif@math.au.dk $}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -28262,6 +28262,20 @@ declaration switches off the trim marks; the \cmd{\showtrimson} declaration,
which is the default, switches on the trim marks. These declarations do
nothing if the \Lopt{showtrims} option has not been used.
+
+\begin{Changed}
+ From the \LaTeX\ format dated 2020/10/01 we changed the way
+ trimmarks are added to the pages. It will now go through the
+ »\texttt{shipout/background}« hook instead of changing the
+ \cmd{\shipout} routine directly. This also have the advantage that
+ the hooks can be reordered if say you want something to be added to
+ \texttt{shipout/background} \emph{before} the trimmarks are added.
+ For more details about the hooks see \cite{LTHOOKS,LTSHIPOUT}.
+
+ The trimmarks will have the hook label »\texttt{memoir/trimmarks}«.
+\end{Changed}
+
+
\LMnote{2013/05/01}{added caveat}
\begin{caveat}
Most modern \LaTeX\ editors make use of the \emph{synctex} features
@@ -28275,10 +28289,17 @@ nothing if the \Lopt{showtrims} option has not been used.
line one is referred back to may be off by tens of lines.
Currently, there is no known workarounds for this deficiency.
+
+ NB: We have yet to see if the 2020/10/01 format update and change to
+ the trimmarks implementation will fix this issue.
+
\end{caveat}
+
+
+
Trim marks can be placed at each corner of the (trimmed) page, and also
at the middle of each side of the page.
@@ -30161,6 +30182,16 @@ in your preamble.
\subsection{Inserting code before and after a file, package or class}
+\begin{Changed}
+ As of \LaTeX\ format dated 2020/10/01 these \cs{At...} macros
+ described below will be implemented using kernel hooks as layed out
+ via \cite{LTFILEHOOK}. Which also means the order of the hooks can
+ actually be changed. See \cite{LTHOOKS} for general information
+ about the hooking feature.
+\end{Changed}
+
+
+
The kernel provides two commands, \cmd{\AtBeginDocument}
and \cmd{\AtEndDocument} which can only be used in the preamble,
for inserting code at the start and end
@@ -30176,31 +30207,57 @@ The class provides a more comprensive set of macros for code
insertions, which should be used before the relevant file is called for.
\begin{syntax}
-\cmd{\AtBeginFile}\marg{file}\marg{code} \\
-\cmd{\AtEndFile}\marg{file}\marg{code} \\
+\cmd{\AtBeginFile}\marg{filename}\marg{code} \\
+\cmd{\AtEndFile}\marg{filename}\marg{code} \\
\end{syntax}
\glossary(AtBeginFile)%
- {\cs{AtBeginFile}\marg{file}\marg{code}}%
- {Inserts \meta{code} just before the \meta{file} is input
+ {\cs{AtBeginFile}\marg{filename}\marg{code}}%
+ {Inserts \meta{code} just before the \meta{filename} is input
(or included, etc.).}%
\glossary(AtEndFile)%
- {\cs{AtEndFile}\marg{file}\marg{code}}%
- {Inserts \meta{code} just after the \meta{file} is input
- (or included, etc.).}%
-The \cmd{\AtBeginFile} macro inserts \meta{code} just before the \meta{file}
-file is \cmd{\input} (or \cmd{\include}d, etc.). Similarly
-\cmd{\AtEndFile} inserts the \meta{code} immediately after the
-\meta{file}. The \meta{file} argument must be the same as used in the
-corresponding \cmd{\input} command. If \meta{file} includes an
-extension, for example \texttt{fred.def}, then that is taken as
-the complete name, otherwise if there is no extension,
-for instance \texttt{fred}, then the \texttt{.tex} extension is
-automatically appended making the full name \texttt{fred.tex}.
+ {\cs{AtEndFile}\marg{filename}\marg{code}}%
+ {Inserts \meta{code} just after the \meta{filename} is input
+ (or included, etc.).}%
+The \cmd{\AtBeginFile} macro inserts \meta{code} just before the
+\meta{filename} file is \cmd{\input} (or \cmd{\include}d,
+etc.). Similarly \cmd{\AtEndFile} inserts the \meta{code}
+immediately after the \meta{filename}. The \meta{filename} argument
+must be the same as used in the corresponding \cmd{\input}
+command. If \meta{filename} includes an extension, for example
+\texttt{fred.def}, then that is taken as the complete name,
+otherwise if there is no extension, for instance \texttt{fred}, then
+the \texttt{.tex} extension is automatically appended making the
+full name \texttt{fred.tex}.
The \cs{At...File} commands
-must be issued \emph{before} the corresponding \meta{file} is input
+must be issued \emph{before} the corresponding \meta{filename} is input
otherwise nothing will happen.
+\begin{caveat}
+ As of \LaTeX\ format 2020/10/01 this is \textbf{no longer true!} You
+ will now have to provide the \texttt{.tex} extension if it is a
+ \texttt{.tex} file you want to hook into, as in:
+\begin{verbatim}
+\AtEndFile{test.tex}{\typeout{test.tex is done}}
+\end{verbatim}
+ Also note that the 2020/10/01 format will have some specific hooks
+ what apply to \cmd{\include}. The class does not provide an
+ interface for this and instead refers to \cite{LTFILEHOOK}.
+
+ Note that \cmd{\At...File} actually did not work correctly for
+ \cmd{\include} in the old implementation, it still needed the
+ extension! In this new implementation both \cmd{\input} and
+ \cmd{\include} trigger.
+\end{caveat}
+\begin{Changed}
+ By the 2020/10/01 format this is now implemented via the
+ \texttt{file/before/filename} and \texttt{file/after/filename}
+ hooks. We are not adding any hook label.
+\end{Changed}
+
+
+
+
\begin{syntax}
\cmd{\AtBeginPackage}\marg{pack}\marg{code} \\
\cmd{\AtEndPackage}\marg{pack}\marg{code} \\
@@ -30231,6 +30288,14 @@ at the end of the \meta{pack} package if it has not yet been used.
If the package has already been used then the \meta{code} is
called immediately.
+\begin{Changed}
+ By the 2020/10/01 format this is now implemented via the
+ \texttt{package/before/pack} and \texttt{package/after/pack}
+ hooks. We are not adding any hook label.
+\end{Changed}
+
+
+
\begin{syntax}
\cmd{\AtBeginClass}\marg{class}\marg{code} \\
@@ -30262,61 +30327,75 @@ at the end of the \meta{class} class if it has not yet been used.
If the class has already been used then the \meta{code} is
called immediately.
- There is an unfortunate interaction between the kernel's
-\cmd{\AtEndOfPackage} and the class's \cmd{\AtEndPackage}, and similarly
-for the \cmd{\AtEndOfClass} and \cmd{\AtEndClass}. I discovered this when
-I tried to automate using the \Lpack{memhfixc} package if \Lpack{hyperref}
-was being used by putting the following into the \Pclass{memoir} code
-\begin{lcode}
-\AtEndPackage{hyperref}{\usepackage{memhfixc}}
-\end{lcode}
-which caused all sorts of problems.
+\begin{Changed}
+ By the 2020/10/01 format this is now implemented via the
+ \texttt{class/before/pack} and \texttt{class/after/pack}
+ hooks. We are not adding any hook label.
+\end{Changed}
- The kernel scheme looks like this:
-\begin{lcode}
-\newcommand{\usepackage}[1]{%
- ...
- \InputIfFileExists{#1}
-<AtEndOfPackage code>}
-\end{lcode}
- The basic mechanism for implementing the class macros is by modifying
-the kernel's \cmd{\InputIfFileExists} macro, which internally uses a form of
-\cs{input} to read in the file, so that the inserted \meta{code} comes
-immediately before and after the \cs{input}, somewhat like:
-\begin{lcode}
-\renewcommand{\InputIfFileExists}[1]{%
- ...
- <before code> \input{#1} <after code>}
-\end{lcode}
- If \cmd{\AtEndPackage} is applied to a package that has an internal
-\cmd{\AtEndOfPackage} then the result can be sketched as:
-\begin{lcode}
-\newcommand{\usepackage}[1]{%
- ...
- <before code>
- \input{#1}
- <after code>
- <AtEndOfPackage code>
-}
-\end{lcode}
-In other words the body of the package is read in, the \cmd{\AtEndPackage} code
-is called, and then \emph{after} that the \cmd{\AtEndOfPackage} code is called.
- The \Lpack{hyperref} package internally uses \cmd{\AtEndOfPackage} to read
-some files and \Lpack{memhfixc} had to be input after these. A way to automate
-\Lpack{memhfixc} after \Lpack{hyperref} is:
-\begin{lcode}
-\AtEndPackage{hyperref}{%
- \AtBeginDocument{\usepackage{memhfixc}}}
-\end{lcode}
-but this seems more trouble than it's worth especially since
-Heiko\index{Oberdiek, Heiko} Oberdiek has kindly updated \Lpack{hyperref}
-so that versions after 2006/11/15 will automatically load the
-\Lpack{memhfixc} package.
+% There is an unfortunate interaction between the kernel's
+% \cmd{\AtEndOfPackage} and the class's \cmd{\AtEndPackage}, and similarly
+% for the \cmd{\AtEndOfClass} and \cmd{\AtEndClass}. I discovered this when
+% I tried to automate using the \Lpack{memhfixc} package if \Lpack{hyperref}
+% was being used by putting the following into the \Pclass{memoir} code
+% \begin{lcode}
+% \AtEndPackage{hyperref}{\usepackage{memhfixc}}
+% \end{lcode}
+% which caused all sorts of problems.
+
+% The kernel scheme looks like this:
+% \begin{lcode}
+% \newcommand{\usepackage}[1]{%
+% ...
+% \InputIfFileExists{#1}
+% <AtEndOfPackage code>}
+% \end{lcode}
+
+% The basic mechanism for implementing the class macros is by modifying
+% the kernel's \cmd{\InputIfFileExists} macro, which internally uses a form of
+% \cs{input} to read in the file, so that the inserted \meta{code} comes
+% immediately before and after the \cs{input}, somewhat like:
+% \begin{lcode}
+% \renewcommand{\InputIfFileExists}[1]{%
+% ...
+% <before code> \input{#1} <after code>}
+% \end{lcode}
+
+% If \cmd{\AtEndPackage} is applied to a package that has an internal
+% \cmd{\AtEndOfPackage} then the result can be sketched as:
+% \begin{lcode}
+% \newcommand{\usepackage}[1]{%
+% ...
+% <before code>
+% \input{#1}
+% <after code>
+% <AtEndOfPackage code>
+% }
+% \end{lcode}
+% In other words the body of the package is read in, the \cmd{\AtEndPackage} code
+% is called, and then \emph{after} that the \cmd{\AtEndOfPackage} code is called.
+
+% The \Lpack{hyperref} package internally uses \cmd{\AtEndOfPackage} to read
+% some files and \Lpack{memhfixc} had to be input after these. A way to automate
+% \Lpack{memhfixc} after \Lpack{hyperref} is:
+% \begin{lcode}
+% \AtEndPackage{hyperref}{%
+% \AtBeginDocument{\usepackage{memhfixc}}}
+% \end{lcode}
+% but this seems more trouble than it's worth especially since
+% Heiko\index{Oberdiek, Heiko} Oberdiek has kindly updated \Lpack{hyperref}
+% so that versions after 2006/11/15 will automatically load the
+% \Lpack{memhfixc} package.
+The 2020/10/01 format hooking features will solve a lot of issues we
+have had with file hooking, especially when things are delayed via
+\cmd{\AtBeginDocument} and you want to have your code to run after
+someone else's code. The hooking feature now offers users to add rules
+to reorder how the hooks are executed. See \cite{LTHOOKS} for details.
\renewcommand{\memsecinfo}[5]{\edef\Margi{#1}\edef\Margii{#2}%
\edef\Margiii{#3}\edef\Margiv{#4}%
@@ -39368,6 +39447,22 @@ I.~D. Faux and M.~J. Pratt.
\newblock (Available from CTAN (the \texttt{multicol} package) via
\CTANurl{/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.
+
+
%%keep
\LMnote{2018/09/06}{Updated year}
\bibitem[MC18]{ARRAY}
diff --git a/macros/latex/contrib/memoir/doc-src/memsty.sty b/macros/latex/contrib/memoir/doc-src/memsty.sty
index b3362e981e..dfe40dc0b2 100644
--- a/macros/latex/contrib/memoir/doc-src/memsty.sty
+++ b/macros/latex/contrib/memoir/doc-src/memsty.sty
@@ -1132,7 +1132,10 @@ it to use the new width for the margin par}
\fancybreak{}
}
-\newenvironment{caveat}{\par\medskip\noindent\textbf{\textit{Caveat.}}\enskip\itshape}{\par\medskip}
+%\newenvironment{caveat}{\par\medskip\noindent\textbf{\textit{Caveat.}}\enskip\itshape}{\par\medskip}
+\newenvironment{caveat}{\begin{leftbar}\noindent\textbf{\textit{Caveat.}}\enskip}{\end{leftbar}}
+%\newenvironment{Changed}{\par\medskip\noindent\textbf{\textit{Changed.}}\enskip}{\par\medskip}
+\newenvironment{Changed}{\begin{leftbar}\noindent\textbf{\textit{Changed.}}\enskip}{\end{leftbar}}
\newenvironment{note}{\par\medskip\noindent\textbf{\textit{Note.}}\enskip\itshape}{\par\medskip}
\newenvironment{note*}[1]{\par\medskip\noindent\textbf{\textit{#1.}}\enskip\itshape}{\par\medskip}
\newenvironment{hint}{\par\medskip\noindent\textbf{\textit{Hint.}}\enskip\itshape}{\par\medskip}
diff --git a/macros/latex/contrib/memoir/memman.pdf b/macros/latex/contrib/memoir/memman.pdf
index 17ba03ba7a..1dfc60a1df 100644
--- a/macros/latex/contrib/memoir/memman.pdf
+++ b/macros/latex/contrib/memoir/memman.pdf
Binary files differ
diff --git a/macros/latex/contrib/memoir/memoir.dtx b/macros/latex/contrib/memoir/memoir.dtx
index be0f5d3651..3785106482 100644
--- a/macros/latex/contrib/memoir/memoir.dtx
+++ b/macros/latex/contrib/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}.