summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx')
-rw-r--r--Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx77
1 files changed, 47 insertions, 30 deletions
diff --git a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
index 9be837cf2aa..10045102c16 100644
--- a/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
+++ b/Master/texmf-dist/source/latex/hyperxmp/hyperxmp.dtx
@@ -22,7 +22,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{hyperxmp}
%<*package>
- [2023/09/10 v5.12 Store hyperref metadata in XMP format]
+ [2024/03/17 v5.13 Store hyperref metadata in XMP format]
%</package>
%
%<*driver>
@@ -131,7 +131,7 @@
%</driver>
% \fi
%
-% \CheckSum{2848}
+% \CheckSum{2859}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -206,10 +206,6 @@
% \protect\cs{AtEndPreamble}, as is done by
% \protect\pkgname{doclicense}~v2.2.0. Thanks to Tommaso Pecorella
% for the bug report and help testing}
-% \changes{v5.6}{2020/10/05}{Make conditional the loading of the
-% \protect\pkgname{ifdraft} package. Thanks to Tobias Pape for
-% reporting the incompatibility between \protect\pkgname{hyperxmp} and
-% \protect\pkgname{ifdraft}}
%
% ^^A \GetFileInfo{hyperxmp.dtx}
%
@@ -2274,33 +2270,52 @@ sub mycmd {
% \end{macro}
%
% \begin{macro}{\ifdraft}
+% \changes{v5.2}{2020/04/18}{Define \protect\cs{ifdraft} only locally, at
+% Niklas Beisert's request}
+% \changes{v5.6}{2020/10/05}{Make conditional the loading of the
+% \protect\pkgname{ifdraft} package. Thanks to Tobias Pape for
+% reporting the incompatibility between \protect\pkgname{hyperxmp} and
+% \protect\pkgname{ifdraft}}
+% \changes{v5.13}{2024/03/17}{Rewrite \protect\pkgname{ifdraft} handling
+% to avoid loading a package within a group, which \protect\LaTeX\
+% soon will stop supporting. Thanks to Ulrike Fischer and Boris Veytsman
+% for bringing this to my attention}
% \begin{macro}{\next}
% Use the \pkgname{ifdraft} package to determine if this is a draft or
% final document. The challenge here is that we want to use
% \pkgname{ifdraft} if it's already loaded, load it if not, and not
% break any incompatible, author-defined \cs{ifdraft} macros that may
% occur either before or after the |\usepackage{hyperxmp}|. Our
-% solution begins by defining a new group. Then, if \pkgname{ifdraft}
-% is not yet loaded, we locally undefine \cs{ifdraft} and load the
-% package. In this case, we later ``unload'' the package by setting
-% \cs{ver@ifdraft.sty} to \cs{relax}.
-% \changes{v5.2}{2020/04/18}{Define \protect\cs{ifdraft} only locally, at
-% Niklas Beisert's request}
+% solution works as follows:
+%
+% \begin{itemize}
+% \item If \pkgname{ifdraft} is already loaded, \cs{next} is defined
+% as a no-op.
+% \item If \pkgname{ifdraft} is not (yet) loaded, the code backs up
+% then undefines \cs{ifdraft}, which may be author-defined. It then
+% loads \pkgname{ifdraft} and defines \cs{next} to ``unload'' the
+% package by setting the package's author-visible commands to
+% \cs{relax}.
+% \item Below, after \cs{ifdraft} is used to define
+% \cs{@pdfrendition}, \cs{next} is invoked to unload a
+% \pkgname{hyperxmp}-loaded \pkgname{ifdraft}. Finally, \cs{ifdraft}
+% is restored to its original definition.
+% \end{itemize}
% \begin{macrocode}
-\begingroup
- \@ifpackageloaded{ifdraft}{%
- \let\next=\relax
- }{%
+\let\hyxmp@orig@ifdraft=\ifdraft
+\@ifpackageloaded{ifdraft}{%
+ \let\next=\relax
+}{%
+ \let\ifdraft=\relax
+ \RequirePackage{ifdraft}%
+ \def\next{%
+ \expandafter\let\csname ver@ifdraft.sty\endcsname=\relax
\let\ifdraft=\relax
- \RequirePackage{ifdraft}%
- \def\next{%
- \expandafter\global\expandafter\let\csname ver@ifdraft.sty\endcsname=\relax
- }%
+ \let\ifoptiondraft=\relax
+ \let\ifoptionfinal=\relax
}%
+}%
% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
% \begin{macro}{\@pdfrendition}
% \changes{v5.0}{2020/02/27}{Added the \protect\optname{pdfrendition}
% option}
@@ -2310,16 +2325,18 @@ sub mycmd {
% |\documentclass[draft]|, for which |\@pdfrendition| defaults to
% |draft|.
% \begin{macrocode}
- \ifdraft{%
- \gdef\@pdfrendition{draft}%
- }{%
- \gdef\@pdfrendition{default}%
- }
- \next
-\endgroup
+\ifdraft{%
+ \def\@pdfrendition{draft}%
+}{%
+ \def\@pdfrendition{default}%
+}
+\next
+\let\ifdraft=\hyxmp@orig@ifdraft
\define@key{Hyp}{pdfrendition}{\hyxmp@pdfstringdef\@pdfrendition{#1}}
% \end{macrocode}
% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@pdfpublication}
% Prepare to store the name of the publication in which the