[latex3-commits] [latex3/latex2e] latex-lab/uf-review-05: add pdfsubtitle key (53f628f6)

github at latex-project.org github at latex-project.org
Sun Dec 31 01:20:35 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : latex-lab/uf-review-05
Link       : https://github.com/latex3/latex2e/commit/53f628f678c9bb9a97d3d257801c27a6dd48f3a5

>---------------------------------------------------------------

commit 53f628f678c9bb9a97d3d257801c27a6dd48f3a5
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sun Dec 31 01:20:35 2023 +0100

    add pdfsubtitle key


>---------------------------------------------------------------

53f628f678c9bb9a97d3d257801c27a6dd48f3a5
 required/latex-lab/latex-lab-title.dtx | 46 +++++++++++++++++++++++++---------
 1 file changed, 34 insertions(+), 12 deletions(-)

diff --git a/required/latex-lab/latex-lab-title.dtx b/required/latex-lab/latex-lab-title.dtx
index ede18466..04e40619 100644
--- a/required/latex-lab/latex-lab-title.dtx
+++ b/required/latex-lab/latex-lab-title.dtx
@@ -49,20 +49,21 @@
 %
 % \section{Introduction}
 %
-% The followings contains changes to improve the tagging of
-% the title created with the \cs{maketitle} command in the standard classes.
+% This module contains changes to improve the tagging (in the standard classes) of
+% the title created with the \cs{maketitle} command. It also improves the
+% setting of the metadata related to the title and the author.
 % 
-% For basic tagging they are basically three things to do:
+% For basic tagging of the printed title there are basically three things to do:
 % 
 % \begin{itemize}
 % \item The actual title should be tagged with the \texttt{Title} tag.
-% \item The tabular used to format the author list should not be tagged as a tabular.
+% \item The tabular used to format the author list should \emph{not} be tagged as a tabular.
 % \item \cs{maketitle} redefines footnote internals. These must be made tagging aware.
 % \end{itemize} 
 % 
 % A second task related to title is to store the authors and the title text 
-% (or a shorter version) inside the  XMP-metadata and to allow to show the
-% title as window title in the PDF viewer. Currently this can only be set if hyperref
+% (or a shorter version) inside the  XMP-metadata and (in PDF 1.7 or lower) in
+% the Info dictionary. Currently this can only be set if hyperref
 % is loaded and requires the use of the \texttt{pdftitle} and \texttt{pdfauthor} keys. 
 % The new code therefore extends the \cs{title} and \cs{author} commands: They
 % stores their argument and use them at the end of the document 
@@ -79,8 +80,18 @@
 %   {Document title} 
 % \end{verbatim}
 % 
-% If using the \texttt{pdfauthor} key it is recommended to separate
-% more than one author by commas, and to hide commas inside braces if needed:
+% It is also possible to set a subtitle which is then stored in the XMP-metadata:
+% 
+% \begin{verbatim}
+% \title
+%   [pdfsubtitle = 
+%      {[en]English Subtitle,[de] Deutscher Subtitel,[fr]{subtitre français, avec comma}}]
+%   {Document title} 
+% \end{verbatim}
+ 
+% 
+% If using the \texttt{pdfauthor} key authors should be separated
+% by commas, and to hide commas in a name inside braces if needed:
 %
 %  \begin{verbatim}
 %  \author[pdfauthor = {Bär, Peter Anteater, {Riley, the sloth}}]{\ldots}
@@ -319,7 +330,7 @@
 \RenewDocumentCommand\title{O{}m}
  {
     \gdef\@title{#2}
-    \cs_gset_eq:NN\g_@@_title_title_tl\@title
+    \tl_gset_eq:NN\g_@@_title_title_tl\@title
     \keys_set:nn {hyp}{#1}
  } 
 %    \end{macrocode}
@@ -331,7 +342,7 @@
 \cs_generate_variant:Nn \regex_extract_once:NnN{NVN}
 \cs_generate_variant:Nn \clist_item:nn {on}
 %    \end{macrocode}
-% and now the key.
+% and now the keys.
 %    \begin{macrocode}
 \keys_define:nn { hyp }
    {
@@ -362,6 +373,7 @@
            }
           \AddToDocumentProperties[hyperref]{pdftitle}{#1}
        }
+   ,pdfsubtitle .code:n = { \AddToDocumentProperties[hyperref]{pdfsubtitle}{#1} }    
    }
 %    \end{macrocode}
 %
@@ -381,7 +393,7 @@
 \RenewDocumentCommand\author{O{}m}
  {
     \gdef\@author{#2}
-    \cs_gset_eq:NN\g_@@_title_author_tl\@author
+    \tl_gset_eq:NN\g_@@_title_author_tl\@author
     \keys_set:nn {hyp}{#1}
  } 
 %    \end{macrocode}
@@ -421,7 +433,17 @@
        }
    }
 %    \end{macrocode}
-
+% \subsection{Fallback for classes and packages that redefine \cs{title} or \cs{author}}
+% If a class redefines \cs{author} and \cs{title} again, we try to retrieve at
+% least the values. 
+%    \begin{macrocode}
+\AddToHook{cmd/maketitle/before}
+  {
+   \tl_gset_eq:NN \g_@@_title_author_tl\@author
+   \tl_gset_eq:NN \g_@@_title_title_tl\@title
+  }  
+%    \end{macrocode}
+%
 % \subsection{Finalize document}
 % At last we set the title and the author at the end of document 
 % if that hasn't happened yet:





More information about the latex3-commits mailing list.