summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/revtex/ltxutil.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/revtex/ltxutil.dtx')
-rw-r--r--Master/texmf-dist/source/latex/revtex/ltxutil.dtx171
1 files changed, 146 insertions, 25 deletions
diff --git a/Master/texmf-dist/source/latex/revtex/ltxutil.dtx b/Master/texmf-dist/source/latex/revtex/ltxutil.dtx
index 1ca98f82cc0..4ce6464c839 100644
--- a/Master/texmf-dist/source/latex/revtex/ltxutil.dtx
+++ b/Master/texmf-dist/source/latex/revtex/ltxutil.dtx
@@ -15,7 +15,8 @@
% installation, typeset this document with \LaTeX.
% Maintenance Status
% This work has the LPPL maintenance status "maintained";
-% Current Maintainer of this work is Arthur Ogawa.
+% Current Maintainer of this work is Arthur Ogawa
+% changes for version 4.2d and 4.2e by Phelype Oleinik.
%
% This work consists of the main source file ltxutil.dtx
% and the derived files
@@ -108,17 +109,16 @@ License
%</ignore>
% \fi
%
-% \GetFileInfo{ltxutil.dtx}\CheckSum{4291}
+% \GetFileInfo{ltxutil.dtx}
%
% \iffalse ltxdoc klootch
%<*package>
%%% @LaTeX-file{
%%% filename = "ltxutil.dtx",
-%%% version = "4.2c",
-%%% date = "2019/01/18",
-%%% time = "14:29:48 UT-5",
-%%% checksum = "4291",
+%%% version = "4.2e",
+%%% date = "2020/10/03",
%%% author = "Arthur Ogawa (mailto:arthur_ogawa at sbcglobal.net),
+%%% Phelype Oleinik (mailto:phelype.oleinik at latex-project.org),
%%% commissioned by the American Physical Society. Minor changes by Mark Doyle for version 4.2a-c.
%%% ",
%%% copyright = "Copyright (C) 1999, 2009 Arthur Ogawa,
@@ -135,7 +135,6 @@ License
%%% keywords = "latex, page grid, main vertical list",
%%% supported = "yes",
%%% abstract = "utilities package",
-%%% docstring = "The checksum field above generated by ltxdoc",
%%% }
%</package>
% \fi
@@ -224,7 +223,7 @@ ltxutil%
% \begin{macrocode}
%<*doc|package|kernel>
%<version>
- [2019/01/18/14:29:48 4.2c utilities package (portions licensed from W. E. Baxter web at superscript.com)]% \fileversion
+ [2020/10/03 4.2e utilities package (portions licensed from W. E. Baxter web at superscript.com)]% \fileversion
%</doc|package|kernel>
%<kernel&!package&!doc>}%
% \end{macrocode}
@@ -259,6 +258,10 @@ ltxutil%
\RequirePackage{ltxdocext}%
\let\url\undefined
\RequirePackage[colorlinks=true,linkcolor=blue]{hyperref}%
+\pdfstringdefDisableCommands{%
+ \let\file\relax
+ \let\sc\relax
+}
%\expandafter\ifx\csname package@font\endcsname\@undefined\else
% \expandafter\RequirePackage\expandafter{\csname package@font\endcsname}%
%\fi
@@ -310,7 +313,7 @@ ltxutil%
last revised \filedate.%
}%
\thanks{%
- Version \fileversion\ \copyright\ 2019 American Physical Society
+ Version \fileversion\ \copyright\ 2019--2020 American Physical Society
}%
}%
\author{%
@@ -451,6 +454,7 @@ now put a \cmd\usepackage\texttt{\{ltxutil\}} in your document preamble!
\changes{4.1p}{2010/02/24}{(AO, 582) A patch of \classname{hyperref.sty} to provide backward compatibility to \TeX Live 2007's version 6.75r}%
\changes{4.2a}{2017/11/21}{(MD) Use updated best practice to use https and doi.org}%
\changes{4.2a}{2018/12/12}{(MD) Updated name of README file and use standard fonts when typesetting}%
+\changes{4.2d}{2020/09/19}{(PHO) Adapt \cs{document} and \cs{enddocument} hooks to the 2020-10-01 \LaTeX{} release.}%
\end{filecontents*}
% \end{macrocode}
@@ -786,6 +790,22 @@ now put a \cmd\usepackage\texttt{\{ltxutil\}} in your document preamble!
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\rvtx@ifformat@geq}
+% Some changes in the \LaTeX{} kernel requires us to conditionally
+% define some macros depending on the version of the kernel.
+% \cmd\rvtx@ifformat@geq{} will check if the release date of the
+% currently-running \LaTeXe{} kernel is greater or equal to the
+% argument (the argument should be in the format \texttt{yyyy-mm-dd}).
+% \changes{4.2d}{2020/09/17}{(PHO) Add \cs{rvtx@ifformat@geq}.}%
+% \begin{macrocode}
+\ifx\IfFormatAtLeastTF\undefined
+ \def\rvtx@ifformat@geq{\@ifl@t@r\fmtversion}%
+\else
+ \let\rvtx@ifformat@geq\IfFormatAtLeastTF
+\fi
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\@boolean}
% \begin{macro}{\@boole@def}
% In order to define \cmd\@ifx, we first must create the
@@ -931,25 +951,35 @@ now put a \cmd\usepackage\texttt{\{ltxutil\}} in your document preamble!
% column grid command at \cmd\AtBeginDocument\ time, since the MVL has nothing in it
% at that time that would be problematical.
%
-% The facility depends on the stability of this part
-% of \LaTeX's kernel code (the first token of \cmd\document),
-% which could change, you see. But considering that \LaTeX\ is
-% at this point essentially stagnant once more, we risk it.
-%
% \begin{macro}{\document}
% We begin by installing hooks into \cmd\document\ that
% we will manage ourselves.
-% First, we do as \cmd\document\ does: end the group
-% begun by \cmd\begin. Last, we conclude our shenanigans by absorbing
+%
+% The 2020-10-01 \LaTeX{} release got a new hook management system and
+% several new hooks (several previously provided by \textsf{etoolbox}).
+% The one we want here is \texttt{begindocument/before}, the first thing
+% executed by \cmd\document{}, right after ending the group started by
+% \cmd\begin{}.
+%
+% Thus, if the \LaTeX{} kernel date is 2020-10-01 we just add to that
+% hook, otherwise resort to the old method, patching \cmd\document:
+% end the group started by \cmd\begin, apply our hook, and
+% conclude our shenanigans by absorbing
% the first token of the expansion of \cmd\document, which
-% we assume to be \cmd\endgroup.
+% we assume to be \cmd\endgroup{} (true until the aforementioned release).
% \changes{4.1a}{2008/08/12}{Get rid of \cs{set@typesize@hook} \cs{set@pica@hook} and the \cs{normalsize} directive}%
+% \changes{4.2d}{2020/09/17}{(PHO) Use \LaTeX's hook management system, if possible.}%
% \begin{macrocode}
-\prepdef\document{%
- \endgroup
- \document@inithook
- \true@sw{}%
-}%
+\rvtx@ifformat@geq{2020-10-01}%
+ {%
+ \AddToHook{begindocument/before}{\document@inithook}%
+ }{%
+ \prepdef\document{%
+ \endgroup
+ \document@inithook
+ \true@sw{}%
+ }%
+ }
% \end{macrocode}
% \end{macro}
%
@@ -996,7 +1026,15 @@ now put a \cmd\usepackage\texttt{\{ltxutil\}} in your document preamble!
% We will do this to ensure that the \cmd\@mainaux\ stream is not closed until
% the last page of the job is shipped out, and that can only be done by coordinating
% with the output routine.
+%
+% \changes{4.2d}{2020/09/17}{(PHO) Only redefine \cs{enddocument} in older versions.}%
+% This approach, however, will only be done for older versions of the
+% \LaTeX{} kernel:
% \begin{macrocode}
+\rvtx@ifformat@geq{2020-10-01}{%
+ % <definitions for newer LaTeX later>
+}{%
+ % <definitions for older LaTeX>
\def\enddocument{%
% \end{macrocode}
% \changes{4.1n}{2009/12/06}{(AO) Incorporate change to ltmiscen.dtx v1.1i 2000/05/19}%
@@ -1044,7 +1082,7 @@ now put a \cmd\usepackage\texttt{\{ltxutil\}} in your document preamble!
\@if@sw\if@tempswa\fi{%
\@latex@warning@no@line{%
Label(s) may have changed.
- Rerun to get cross-references right
+ Rerun to get cross-references right%
}%
}{}%
}{%
@@ -1052,8 +1090,86 @@ now put a \cmd\usepackage\texttt{\{ltxutil\}} in your document preamble!
}%
}{}%
}%
+}
+% \end{macrocode}
+%
+% \changes{4.2d}{2020/09/17}{(PHO) Patch \cs{enddocument} at runtime in newer versions.}%
+% \begin{macro}{\rvtx@enddocument@patch}
+% For newer \LaTeX{} we'll try to be a bit more future-proof
+% (no miracle though). The code for \cmd\enddocument{}
+% (in pre-2020-10-01 \LaTeX) is roughly:
+% \begin{verbatim}
+% \def\enddocument{%
+% <hooks and bookkeeping>
+% \clearpage
+% <read main .aux and final checks>
+% \@@end
+% }
+% \end{verbatim}
+% and the patches above replace the \cmd\clearpage{} by its own
+% \cmd\clear@document, and \verb|<read main .aux and final checks>| by
+% \cmd\do@check@aux, which it can later control the timing.
+%
+% Now we will apply the same changes, but this time without redefining
+% \cmd\enddocument: we will instead replace tokens on-the-fly, when
+% \cmd\enddocument{} is expanded. This will grant us a slightly safer
+% approach that won't depend so much on the internals of
+% \cmd\enddocument.
+%
+% This entire patch should work with the previous definition of
+% \cmd\enddocument{} as well (except it cannot be used in the hook),
+% but for now leave previous versions untouched.
+%
+% The entire patching will reside in the \texttt{enddocument} hook:
+% \begin{macrocode}
+\rvtx@ifformat@geq{2020-10-01}{%
+ \AddToHook{enddocument}{\rvtx@enddocument@patch{}}%
+}{}
+% \end{macrocode}
+%
+% This macro will be executed after \cmd\enddocument{} has expanded,
+% so all its tokens are now exposed. Here we will assume that
+% \cmd\enddocument{} contains the tokens \verb|\@checkend{document}|
+% and \cmd\endgroup, and use them as delimiters:
+% \begin{macrocode}
+\protected\long\def\rvtx@enddocument@patch#1#2\@checkend#3{%
+ \begingroup
+ \edef\x{\detokenize{#3}}%
+ \edef\y{\detokenize{document}}%
+ \expandafter\endgroup
+ \ifx\x\y
+ \expandafter\rvtx@enddocument@patch@end
+ \else
+ \expandafter\rvtx@enddocument@patch@more
+ \fi
+ {#1#2}{#3}}
+\def\rvtx@enddocument@patch@more#1#2{%
+ \rvtx@enddocument@patch{#1\@checkend{#2}}}
+% \end{macrocode}
+%
+% When the \verb|\@checkend{document}| is reached, use \cmd\clearpage{}
+% and \cmd\enddocument{} as delimiters for the
+% \verb|<read main .aux and final checks>| part, and save it in
+% \cmd\do@check@aux{}:
+% \begin{macrocode}
+\long\def\rvtx@enddocument@patch@end#1#2\clearpage#3\endgroup{%
+ \def\do@check@aux{#3\endgroup}%
+% \end{macrocode}
+% Then execute the code consumed in the previous step:
+% \begin{macrocode}
+ #1%
+ \@checkend{#2}%
+% \end{macrocode}
+% Do \cmd\clear@document{} instead of \cmd\clearpage{} and
+% \cmd\check@aux{} instead of the code grabbed.
+% \begin{macrocode}
+ \clear@document
+ \check@aux}
+\def\check@aux{\do@check@aux}%
% \end{macrocode}
% \end{macro}
+%
+% \end{macro}
% \end{macro}
% \end{macro}
%
@@ -4308,9 +4424,14 @@ now put a \cmd\usepackage\texttt{\{ltxutil\}} in your document preamble!
\endgroup
}%
\@ifx{\typeout\typeout@org}{%
- \class@info{Making \string\typeout\space \string\long}%
\let\typeout\typeout@ltx
-}{}%
+ \true@sw
+}{%
+ \rvtx@ifformat@geq{2020-10-01}%
+ {\true@sw}{\false@sw}%
+}%
+ {\class@info{Making \string\typeout\space \string\long}}%
+ {}%
% \end{macrocode}
% \end{macro}
%