texlive[56313] Master/texmf-dist: memoir (10sep20)

commits+karl at tug.org commits+karl at tug.org
Thu Sep 10 23:21:04 CEST 2020


Revision: 56313
          http://tug.org/svn/texlive?view=revision&revision=56313
Author:   karl
Date:     2020-09-10 23:21:03 +0200 (Thu, 10 Sep 2020)
Log Message:
-----------
memoir (10sep20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/memoir/README
    trunk/Master/texmf-dist/doc/latex/memoir/memman.pdf
    trunk/Master/texmf-dist/doc/latex/memoir/memman.tex
    trunk/Master/texmf-dist/doc/latex/memoir/memsty.sty
    trunk/Master/texmf-dist/source/latex/memoir/memoir.dtx
    trunk/Master/texmf-dist/tex/latex/memoir/memoir.cls

Modified: trunk/Master/texmf-dist/doc/latex/memoir/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/memoir/README	2020-09-10 21:20:40 UTC (rev 56312)
+++ trunk/Master/texmf-dist/doc/latex/memoir/README	2020-09-10 21:21:03 UTC (rev 56313)
@@ -28,6 +28,54 @@
     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

Modified: trunk/Master/texmf-dist/doc/latex/memoir/memman.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/memoir/memman.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/memoir/memman.tex	2020-09-10 21:20:40 UTC (rev 56312)
+++ trunk/Master/texmf-dist/doc/latex/memoir/memman.tex	2020-09-10 21:21:03 UTC (rev 56313)
@@ -28144,8 +28144,8 @@
 
 \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 at math.au.dk $}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -28262,6 +28262,20 @@
 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 @@
   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 @@
 
 \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 @@
 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,7 +30288,15 @@
 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} \\
 \cmd{\AtEndClass}\marg{class}\marg{code} \\
@@ -30262,62 +30327,76 @@
 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}%
                               \edef\Margv{#5}}
@@ -39368,6 +39447,22 @@
   \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}

Modified: trunk/Master/texmf-dist/doc/latex/memoir/memsty.sty
===================================================================
--- trunk/Master/texmf-dist/doc/latex/memoir/memsty.sty	2020-09-10 21:20:40 UTC (rev 56312)
+++ trunk/Master/texmf-dist/doc/latex/memoir/memsty.sty	2020-09-10 21:21:03 UTC (rev 56313)
@@ -1132,7 +1132,10 @@
   \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}

Modified: trunk/Master/texmf-dist/source/latex/memoir/memoir.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/memoir/memoir.dtx	2020-09-10 21:20:40 UTC (rev 56312)
+++ trunk/Master/texmf-dist/source/latex/memoir/memoir.dtx	2020-09-10 21:21:03 UTC (rev 56313)
@@ -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 at 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,8 +900,79 @@
 
 %    \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... 
 % revisited}} that the \Lpack{scrlfile} package from 
@@ -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 at und\m at matendf{#1}\killm at matf{#1}}{%
-        #2\@addtofilelist{#1}\m at 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 at und\m at matendf{#1}\killm at matf{#1}}{%
+          #2\@addtofilelist{#1}\m at matbeginf{#1}\@@input%
+        }%
       }%
-    }%
-  }
-\else
-  % Old definition
-\renewcommand{\InputIfFileExists}[2]{%
-  \IfFileExists{#1}%
-    {#2\@addtofilelist{#1}\m at matbeginf{#1}%
-     \@@input \@filef at und
-     \m at matendf{#1}%
-     \killm at matf{#1}}}
-\fi
+    }
+  \else
+    % Old definition
+    \renewcommand{\InputIfFileExists}[2]{%
+      \IfFileExists{#1}%
+      {#2\@addtofilelist{#1}\m at matbeginf{#1}%
+        \@@input \@filef at und
+        \m at matendf{#1}%
+        \killm at matf{#1}}}
+  \fi
 
 %    \end{macrocode}
 % \end{macro}
@@ -943,10 +1036,10 @@
 % is defined. Similarly \cs{m at matendf}\marg{file} calls
 % \cs{file-m at mfe} if it is defined.
 %    \begin{macrocode}
-\newcommand{\m at matbeginf}[1]{\@ifundefined{#1-m at mfb}{}%
-  {\@nameuse{#1-m at mfb}}}
-\newcommand{\m at matendf}[1]{\@ifundefined{#1-m at mfe}{}%
-  {\@nameuse{#1-m at mfe}}}
+  \newcommand{\m at matbeginf}[1]{\@ifundefined{#1-m at mfb}{}%
+    {\@nameuse{#1-m at mfb}}}
+  \newcommand{\m at matendf}[1]{\@ifundefined{#1-m at mfe}{}%
+    {\@nameuse{#1-m at mfe}}}
 
 %    \end{macrocode}
 % \end{macro}
@@ -955,10 +1048,66 @@
 % \begin{macro}{\killm at matf}
 % \cs{killm at matf}\marg{file} undefines the \cs{file-m at mfb} and
 % \cs{file-m at mfe} macros.
+% ^^A    \begin{macrocode}
+% ^^A  we use the better defintion below
+% ^^A % \newcommand*{\killm at matf}[1]{%
+% ^^A %   \@namelet{#1-m at mfb}\relax
+% ^^A %   \@namelet{#1-m at 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 at matf}[1]{%
-  \@namelet{#1-m at mfb}\relax
-  \@namelet{#1-m at mfe}\relax}
+ %% \ifetex
+  \newcommand*{\killm at matf}[1]{%
+    \ifnum 6=\currentgrouptype
+      \ifvmode
+        \expandafter\expandafter\expandafter\@firstoftwo
+        \expandafter\expandafter\expandafter\noalign
+      \fi
+    \fi
+    \@firstofone
+    {\@namelet{#1-m at mfb}\relax
+     \@namelet{#1-m at 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 at mfb}%
-  {\@namedef{#1-m at mfb}{#2}}%
-  {\expandafter\addtodef\csname #1-m at mfb\endcsname{}{#2}}}
-\newcommand{\AtEndFile}[2]{\@ifundefined{#1-m at mfe}%
-  {\@namedef{#1-m at mfe}{#2}}%
-  {\expandafter\addtodef\csname #1-m at mfe\endcsname{}{#2}}}
+  \newcommand{\AtBeginFile}[2]{\@ifundefined{#1-m at mfb}%
+    {\@namedef{#1-m at mfb}{#2}}%
+    {\expandafter\addtodef\csname #1-m at mfb\endcsname{}{#2}}}
+  \newcommand{\AtEndFile}[2]{\@ifundefined{#1-m at mfe}%
+    {\@namedef{#1-m at mfe}{#2}}%
+    {\expandafter\addtodef\csname #1-m at 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,13 +1157,13 @@
 % \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}
@@ -1021,6 +1170,9 @@
 % \end{macro}
 % \end{macro}
 %
+%    \begin{macrocode}
+} % end of els part of format check
+%    \end{macrocode}
 %
 %
 %
@@ -18626,62 +18778,7 @@
 %    \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 at matf}[1]{%
-    \ifnum 6=\currentgrouptype
-      \ifvmode
-        \expandafter\expandafter\expandafter\@firstoftwo
-        \expandafter\expandafter\expandafter\noalign
-      \fi
-    \fi
-    \@firstofone
-    {\@namelet{#1-m at mfb}\relax
-     \@namelet{#1-m at mfe}\relax
-    }%
-  }
-\fi
-
-%    \end{macrocode}
-%
-%
 % \subsection{Continuous tabulars}
 %
 %    The standard \texttt{tabular} environment is wrapped inside a box
@@ -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 at trimmarks@initial at vskip{\vskip-1in}
+\newcommand\mem at trimmarks@initial at hskip{\hskip-1in}
 \newcommand*{\trimmarks}{%   
-  \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page
-    \hb at xt@\z@{\hskip-1in
+  \vbox to \z@{%
+    \mem at trimmarks@initial at vskip%
+    \vskip\trimtop % top of logical page
+    \hb at xt@\z@{%
+      \mem at trimmarks@initial at hskip%
       \ifodd\c at page 
-        \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+        \hskip\stockwidth
+        \hskip-\trimedge
+        \hskip-\paperwidth
       \else 
         \if at 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 at xt@\paperwidth{\trimmarkscolor\tmarkml\hfil\tmarkmr}%
         \vfil
         \hb at xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
-    \hss}%
-  \vss}}
+      \hss}%
+    \vss}}
 
 %    \end{macrocode}
 % \end{macro}
@@ -30661,34 +30775,42 @@
     \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 at xt@\z@{\hskip-1in
-      \ifodd\c at page
-        \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
-      \else
-        \if at 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 at xt@\z@{\hskip-1in
+%%       \ifodd\c at page
+%%         \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+%%       \else
+%%         \if at 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 at xt@\paperwidth{\trimmarkscolor\tmarktl\hfil\tmarktm\hfil\tmarktr}%
-        \vfil
-        \hb at xt@\paperwidth{\trimmarkscolor\tmarkml\hfil\tmarkmr}%
-        \vfil
-        \hb at xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
-      \hss}%
-    \vss}}%
-}}
+%%         \hb at xt@\paperwidth{\trimmarkscolor\tmarktl\hfil\tmarktm\hfil\tmarktr}%
+%%         \vfil
+%%         \hb at xt@\paperwidth{\trimmarkscolor\tmarkml\hfil\tmarkmr}%
+%%         \vfil
+%%         \hb at xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
+%%       \hss}%
+%%     \vss}}%
+%%   }
+}
 
 %    \end{macrocode}
 % \end{macro}
@@ -30695,13 +30817,36 @@
 % \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 at trimmarks@initial at vskip{}
+  \renewcommand\mem at trimmarks@initial at 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 at oldshipout}
 % Keep a copy of the current version of \cs{shipout} in \cs{mem at oldshipout}.
 %    \begin{macrocode}
-\let\mem at oldshipout\shipout
+  \let\mem at 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 at shipi}{%
-  \ifvoid\@cclv\expandafter\aftergroup\fi\mem at shipii}
-\newcommand*\mem at shipii{%
-  \ifvoid\@cclv
-    \mem at oldshipout\box\@cclv
-  \else
-    \ifshowtrims
+  \newcommand*{\mem at shipi}{%
+    \ifvoid\@cclv\expandafter\aftergroup\fi\mem at shipii}
+  \newcommand*\mem at shipii{%
+    \ifvoid\@cclv
+      \mem at 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 at oldshipout\vbox{%
-        \trimmarks
-        \nointerlineskip
-        \box\@cclv
-     }%
-    \else
-      \mem at oldshipout\box\@cclv
-    \fi
-  \fi}
+      \mem at oldshipout\vbox{%
+          \trimmarks
+          \nointerlineskip
+          \box\@cclv
+       }%
+      \else
+        \mem at oldshipout\box\@cclv
+      \fi
+    \fi}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -30758,14 +30903,16 @@
 % \Lopt{showtrims} option. This adds \cs{mem at shipi} to the page box
 % which then calls the original version of \cs{shipout}.
 %    \begin{macrocode}
-\ifshowtrims
-  \renewcommand*{\shipout}{\afterassignment\mem at shipi\setbox\@cclv=}
-\fi
+  \ifshowtrims
+    \renewcommand*{\shipout}{\afterassignment\mem at shipi\setbox\@cclv=}
+  \fi
+%    \end{macrocode}
+% \end{macro}
+%    \begin{macrocode}
+} % end format check, else part
 
 %    \end{macrocode}
-% \end{macro}
 %
-%
 % \section{Verbatims, boxes, and files}
 %
 % All the code in this section was added for version 1.2 of the class.
@@ -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 @@
 %
 % \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 @@
 %  \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}.

Modified: trunk/Master/texmf-dist/tex/latex/memoir/memoir.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/memoir/memoir.cls	2020-09-10 21:20:40 UTC (rev 56312)
+++ trunk/Master/texmf-dist/tex/latex/memoir/memoir.cls	2020-09-10 21:21:03 UTC (rev 56313)
@@ -28,8 +28,8 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{memoir}%
-  [2020/06/02 v3.7l configurable book, report, article document class]
-\newcommand\memversion{v3.7l, 2020/06/02}
+  [2020/09/10 v3.7m configurable book, report, article document class]
+\newcommand\memversion{v3.7m, 2020/09/10}
 \newcommand*{\@ptsize}{}
 \newcommand*{\@memptsize}{}
 \newlength{\onelineskip}
@@ -56,6 +56,8 @@
 \newcommand*{\@memerror}{\ClassError{memoir}}
 \newcommand*{\@memwarn}{\ClassWarning{memoir}}
 
+\providecommand\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
+
 \newif\ifsamename
 \newcommand{\nametest}[2]{%
   \samenamefalse%
@@ -135,59 +137,86 @@
   \@namelet{ver@#1.\@pkgextension}\relax}
 \@onlypreamble\DisemulatePackage
 
-\ifcsname InputIfFileExists \endcsname% looking for an explicit space
-                                % here aka the robust version
-  \DeclareRobustCommand \InputIfFileExists[2]{%
-    \IfFileExists{#1}%
-    {%
-      \expandafter\@swaptwoargs\expandafter
-      {\@filef at und\m at matendf{#1}\killm at matf{#1}}{%
-        #2\@addtofilelist{#1}\m at matbeginf{#1}\@@input%
+\IfFormatAtLeastTF{2020/10/01}{
+  \newcommand\AtBeginFile[2]{\AddToHook{file/before/#1}{#2}}
+  \newcommand\AtEndFile[2]{\AddToHook{file/after/#1}{#2}}
+
+  \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}}}
+
+  \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}}}
+
+}{% back to the code for older formats
+  \ifcsname InputIfFileExists \endcsname% looking for an explicit space
+                                  % here aka the robust version
+    \DeclareRobustCommand \InputIfFileExists[2]{%
+      \IfFileExists{#1}%
+      {%
+        \expandafter\@swaptwoargs\expandafter
+        {\@filef at und\m at matendf{#1}\killm at matf{#1}}{%
+          #2\@addtofilelist{#1}\m at matbeginf{#1}\@@input%
+        }%
       }%
+    }
+  \else
+    % Old definition
+    \renewcommand{\InputIfFileExists}[2]{%
+      \IfFileExists{#1}%
+      {#2\@addtofilelist{#1}\m at matbeginf{#1}%
+        \@@input \@filef at und
+        \m at matendf{#1}%
+        \killm at matf{#1}}}
+  \fi
+
+  \newcommand{\m at matbeginf}[1]{\@ifundefined{#1-m at mfb}{}%
+    {\@nameuse{#1-m at mfb}}}
+  \newcommand{\m at matendf}[1]{\@ifundefined{#1-m at mfe}{}%
+    {\@nameuse{#1-m at mfe}}}
+
+ %% \ifetex
+  \newcommand*{\killm at matf}[1]{%
+    \ifnum 6=\currentgrouptype
+      \ifvmode
+        \expandafter\expandafter\expandafter\@firstoftwo
+        \expandafter\expandafter\expandafter\noalign
+      \fi
+    \fi
+    \@firstofone
+    {\@namelet{#1-m at mfb}\relax
+     \@namelet{#1-m at mfe}\relax
     }%
   }
-\else
-  % Old definition
-\renewcommand{\InputIfFileExists}[2]{%
-  \IfFileExists{#1}%
-    {#2\@addtofilelist{#1}\m at matbeginf{#1}%
-     \@@input \@filef at und
-     \m at matendf{#1}%
-     \killm at matf{#1}}}
-\fi
+ %% \fi
 
-\newcommand{\m at matbeginf}[1]{\@ifundefined{#1-m at mfb}{}%
-  {\@nameuse{#1-m at mfb}}}
-\newcommand{\m at matendf}[1]{\@ifundefined{#1-m at mfe}{}%
-  {\@nameuse{#1-m at mfe}}}
+  \newcommand{\AtBeginFile}[2]{\@ifundefined{#1-m at mfb}%
+    {\@namedef{#1-m at mfb}{#2}}%
+    {\expandafter\addtodef\csname #1-m at mfb\endcsname{}{#2}}}
+  \newcommand{\AtEndFile}[2]{\@ifundefined{#1-m at mfe}%
+    {\@namedef{#1-m at mfe}{#2}}%
+    {\expandafter\addtodef\csname #1-m at mfe\endcsname{}{#2}}}
 
-\newcommand*{\killm at matf}[1]{%
-  \@namelet{#1-m at mfb}\relax
-  \@namelet{#1-m at mfe}\relax}
+  \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{\AtBeginFile}[2]{\@ifundefined{#1-m at mfb}%
-  {\@namedef{#1-m at mfb}{#2}}%
-  {\expandafter\addtodef\csname #1-m at mfb\endcsname{}{#2}}}
-\newcommand{\AtEndFile}[2]{\@ifundefined{#1-m at mfe}%
-  {\@namedef{#1-m at mfe}{#2}}%
-  {\expandafter\addtodef\csname #1-m at mfe\endcsname{}{#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}}}
 
-\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{\AtBeginClass}[2]{%
-  \AtBeginFile{#1.\@clsextension}{#2}}
-\newcommand{\AtEndClass}[2]{%
-  \AtEndFile{#1.\@clsextension}{#2}}
-\newcommand{\RequireAtEndClass}[2]{%
-  \@ifclassloaded{#1}{#2}%
-  {\AtEndFile{#1.\@clsextension}{#2}}}
-
+} % end of els part of format check
 \newcommand{\phantomsection}{}
 
  \renewcommand*{\nofiles}{%
@@ -6111,21 +6140,6 @@
 
 %%\@memfakeusepackage{booktabs}
 
-\ifetex
-  \renewcommand*{\killm at matf}[1]{%
-    \ifnum 6=\currentgrouptype
-      \ifvmode
-        \expandafter\expandafter\expandafter\@firstoftwo
-        \expandafter\expandafter\expandafter\noalign
-      \fi
-    \fi
-    \@firstofone
-    {\@namelet{#1-m at mfb}\relax
-     \@namelet{#1-m at mfe}\relax
-    }%
-  }
-\fi
-
 \newskip\ctableftskip \ctableftskip=\fill
 \newskip\ctabrightskip \ctabrightskip=\fill
 
@@ -10874,16 +10888,25 @@
   \let\tmarkbm\relax}
 
 \newcommand*\trimmarkscolor{}
+\newcommand\mem at trimmarks@initial at vskip{\vskip-1in}
+\newcommand\mem at trimmarks@initial at hskip{\hskip-1in}
 \newcommand*{\trimmarks}{%
-  \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page
-    \hb at xt@\z@{\hskip-1in
+  \vbox to \z@{%
+    \mem at trimmarks@initial at vskip%
+    \vskip\trimtop % top of logical page
+    \hb at xt@\z@{%
+      \mem at trimmarks@initial at hskip%
       \ifodd\c at page
-        \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+        \hskip\stockwidth
+        \hskip-\trimedge
+        \hskip-\paperwidth
       \else
         \if at 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{%
@@ -10893,8 +10916,8 @@
         \hb at xt@\paperwidth{\trimmarkscolor\tmarkml\hfil\tmarkmr}%
         \vfil
         \hb at xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
-    \hss}%
-  \vss}}
+      \hss}%
+    \vss}}
 
 \newcommand*{\registrationColour}[1]{#1}
 \newcommand*{\quarkmarks}{%
@@ -10952,52 +10975,61 @@
     \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 at xt@\z@{\hskip-1in
-      \ifodd\c at page
-        \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+%% \renewcommand*{\trimmarks}{%
+%% %%  \special{papersize=\the\stockwidth,\the\stockheight}
+%%   {%
+%%   \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page
+%%     \hb at xt@\z@{\hskip-1in
+%%       \ifodd\c at page
+%%         \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+%%       \else
+%%         \if at 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
+%%         \hb at xt@\paperwidth{\trimmarkscolor\tmarktl\hfil\tmarktm\hfil\tmarktr}%
+%%         \vfil
+%%         \hb at xt@\paperwidth{\trimmarkscolor\tmarkml\hfil\tmarkmr}%
+%%         \vfil
+%%         \hb at xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
+%%       \hss}%
+%%     \vss}}%
+%%   }
+}
+
+\IfFormatAtLeastTF{2020/10/01}{
+  \renewcommand\mem at trimmarks@initial at vskip{}
+  \renewcommand\mem at trimmarks@initial at hskip{}
+  \ifshowtrims
+    \AddToHook{shipout/background}[./trimmarks]{\ifshowtrims\put(0,0){\trimmarks}\fi}
+  \fi
+}{
+  \let\mem at oldshipout\shipout
+  \newcommand*{\mem at shipi}{%
+    \ifvoid\@cclv\expandafter\aftergroup\fi\mem at shipii}
+  \newcommand*\mem at shipii{%
+    \ifvoid\@cclv
+      \mem at oldshipout\box\@cclv
+    \else
+      \ifshowtrims
+      \mem at oldshipout\vbox{%
+          \trimmarks
+          \nointerlineskip
+          \box\@cclv
+       }%
       \else
-        \if at twoside
-          \hskip\trimedge % left of logical page
-        \else
-          \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
-        \fi
+        \mem at oldshipout\box\@cclv
       \fi
-      \vbox to \paperheight{%
-        \let\protect\relax %      <- v1.4 addition
-        \hb at xt@\paperwidth{\trimmarkscolor\tmarktl\hfil\tmarktm\hfil\tmarktr}%
-        \vfil
-        \hb at xt@\paperwidth{\trimmarkscolor\tmarkml\hfil\tmarkmr}%
-        \vfil
-        \hb at xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
-      \hss}%
-    \vss}}%
-}}
+    \fi}
+  \ifshowtrims
+    \renewcommand*{\shipout}{\afterassignment\mem at shipi\setbox\@cclv=}
+  \fi
+} % end format check, else part
 
-\let\mem at oldshipout\shipout
-\newcommand*{\mem at shipi}{%
-  \ifvoid\@cclv\expandafter\aftergroup\fi\mem at shipii}
-\newcommand*\mem at shipii{%
-  \ifvoid\@cclv
-    \mem at oldshipout\box\@cclv
-  \else
-    \ifshowtrims
-    \mem at oldshipout\vbox{%
-        \trimmarks
-        \nointerlineskip
-        \box\@cclv
-     }%
-    \else
-      \mem at oldshipout\box\@cclv
-    \fi
-  \fi}
-\ifshowtrims
-  \renewcommand*{\shipout}{\afterassignment\mem at shipi\setbox\@cclv=}
-\fi
-
 \newtoks\every at verbatim
   \every at verbatim={}
 \newtoks\afterevery at verbatim
@@ -13146,11 +13178,12 @@
 
 %%% 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.
     }
 



More information about the tex-live-commits mailing list.