[latex3-commits] [latex3/latex2e] testmergearray: tagging support for maketitle in standard classes (f1b7bced)

github at latex-project.org github at latex-project.org
Sat Dec 23 00:50:27 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : testmergearray
Link       : https://github.com/latex3/latex2e/commit/f1b7bced2e57bed80c1476e07d42b7dd048d6958

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

commit f1b7bced2e57bed80c1476e07d42b7dd048d6958
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sat Dec 23 00:50:27 2023 +0100

    tagging support for maketitle in standard classes


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

f1b7bced2e57bed80c1476e07d42b7dd048d6958
 required/latex-lab/latex-lab-title.dtx | 240 +++++++++++++++++++++++++++++++++
 required/latex-lab/latex-lab.ins       |   3 +
 2 files changed, 243 insertions(+)

diff --git a/required/latex-lab/latex-lab-title.dtx b/required/latex-lab/latex-lab-title.dtx
new file mode 100644
index 00000000..0d2b5bf4
--- /dev/null
+++ b/required/latex-lab/latex-lab-title.dtx
@@ -0,0 +1,240 @@
+% \iffalse meta-comment
+%
+%% File: latex-lab-title.dtx (C) Copyright 2023 LaTeX Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version.  The latest version
+% of this license is in the file
+%
+%    https://www.latex-project.org/lppl.txt
+%
+%
+% The development version of the bundle can be found below
+%
+%    https://github.com/latex3/latex2e/required/latex-lab
+%
+% for those people who are interested or want to report an issue.
+%
+\def\ltlabtitledate{2023-12-22}
+\def\ltlabtitleversion{0.85a}
+
+%<*driver>
+\documentclass{l3doc}
+\EnableCrossrefs
+\CodelineIndex
+\begin{document}
+  \DocInput{latex-lab-title.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+%
+% \title{The \textsf{latex-lab-title} package\\
+% Changes related to the tagging of the title}
+% \author{\LaTeX{} Project\thanks{Initial implementation done by Ulrike Fischer}}
+% \date{v\ltlabtextversion\ \ltlabtextdate}
+%
+% \maketitle
+%
+% \newcommand{\xt}[1]{\textsl{\textsf{#1}}}
+% \newcommand{\TODO}[1]{\textbf{[TODO:} #1\textbf{]}}
+% \newcommand{\docclass}{document class \marginpar{\raggedright document class
+% customizations}}
+%
+% \providecommand\hook[1]{\texttt{#1}}
+%
+% \begin{abstract}
+% \end{abstract}
+%
+% \section{Introduction}
+%
+% The followings contains changes to improve the tagging of
+% the title created with the \cs{maketitle} command in the standard classes.
+% 
+% For basic tagging they are basically three main 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 \cs{maketitle} redefines footnote internals. These must be made tagging aware.
+% \end{itemize} 
+% 
+% \section{Implementation}
+%    \begin{macrocode}
+%<*package>
+%<@@=tag>
+%    \end{macrocode}
+%    \begin{macrocode}
+\ProvidesExplPackage {latex-lab-testphase-title} {\ltlabtitledate} {\ltlabtitleversion}
+  {Changes related to the tagging of the title}
+%    \end{macrocode}
+
+% \subsection{\cs{maketitle} in article class}
+% 
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_thanks:n #1
+  {
+    \rlap{\footnotemark}
+    \protected at xdef\@thanks{\@thanks
+      \protect\footnotetext[\the\c at footnote]{#1}}
+  }
+%    \end{macrocode}
+% The no-titlepage version of article, report and book
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_maketitle:
+  {
+    \par
+    \begingroup
+%    \end{macrocode}
+% Disable table tagging
+%    \begin{macrocode}
+      \cs_if_exist_use:N\__tag_tbl_disable:
+      \renewcommand\thefootnote{\@fnsymbol\c at footnote}%
+%    \end{macrocode}
+% the original definition redefines \cs{@makefnmark} and
+% \cs{@makefntext} to get an rlap-mark in the text without 
+% affecting the mark in the note (which gives by the way
+% a wrong link area with hyperref). There seem to be currently
+% no good way in the footnote to configure this, so we redefine 
+% \cs{thanks} instead 
+%    \begin{macrocode}
+      \cs_set_eq:NN \thanks \@@_patch_thanks:n
+      \if at twocolumn
+        \ifnum \col at number=\@ne
+          \@maketitle
+        \else
+          \twocolumn[\@maketitle]%
+        \fi
+      \else
+      \newpage
+        \global\@topnum\z@   % Prevents figures from going at top of page.
+        \@maketitle
+      \fi
+      \thispagestyle{plain}\@thanks
+    \endgroup
+    \setcounter{footnote}{0}%
+    \global\let\thanks\relax
+    \global\let\maketitle\relax
+    \global\let\@maketitle\relax
+    \global\let\@thanks\@empty
+    \global\let\@author\@empty
+    \global\let\@date\@empty
+    \global\let\@title\@empty
+    \global\let\title\relax
+    \global\let\author\relax
+    \global\let\date\relax
+    \global\let\and\relax
+  }
+%    \end{macrocode}
+% We must also change \cs{@maketitle} to insert a Title tag
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_ at maketitle:
+ {
+  \newpage
+  \null
+  \vskip 2em%
+  \begin{center}%
+  \let \footnote \thanks
+    {\LARGE \tagtool{paratag=Title}\@title \par}%
+    \vskip 1.5em%
+    {\large
+      \lineskip .5em%
+      \begin{tabular}[t]{c}%
+        \@author
+      \end{tabular}\par}%
+    \vskip 1em%
+    {\large \@date}%
+  \end{center}%
+  \par
+  \vskip 1.5em
+  }
+ 
+%    \end{macrocode}
+% The titlepage variant
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_maketitle_page:
+  {\begin{titlepage}%
+%    \end{macrocode}
+% disable table tagging
+%    \begin{macrocode}
+  \cs_if_exist_use:N\__tag_tbl_disable:
+  \let\footnotesize\small
+  \let\footnoterule\relax
+  \let \footnote \thanks
+  \null\vfil
+  \vskip 60\p@
+%    \end{macrocode}
+% use Title around the title. As in PDF 2.0 this is rolemapped to P
+% we change the text-unit tag here.
+%    \begin{macrocode}
+  \begin{center}%
+    {\LARGE \tagtool{paratag=Title}\@title\par}%
+    \vskip 3em%
+    {\large
+     \lineskip .75em%
+      \begin{tabular}[t]{c}%
+        \@author
+      \end{tabular}\par}%
+      \vskip 1.5em%
+    {\large \@date \par}%       % Set date in \large size.
+  \end{center}\par
+  \@thanks
+  \vfil\null
+  \end{titlepage}%
+  \setcounter{footnote}{0}%
+  \global\let\thanks\relax
+  \global\let\maketitle\relax
+  \global\let\@thanks\@empty
+  \global\let\@author\@empty
+  \global\let\@date\@empty
+  \global\let\@title\@empty
+  \global\let\title\relax
+  \global\let\author\relax
+  \global\let\date\relax
+  \global\let\and\relax
+  }
+
+%    \end{macrocode}
+% Map the new commands onto \cs{maketitle}:
+%    \begin{macrocode}
+\AddToHook{class/article/after}
+  {
+    \if at titlepage
+     \cs_set_eq:NN \maketitle \@@_patch_maketitle_page:
+    \else
+     \cs_set_eq:NN \maketitle \@@_patch_maketitle:
+     \cs_set_eq:NN \@maketitle \@@_patch_ at maketitle:
+    \fi
+  } 
+\AddToHook{class/report/after}
+  {
+    \if at titlepage
+     \cs_set_eq:NN \maketitle \@@_patch_maketitle_page:
+    \else
+    \cs_set_eq:NN \maketitle \@@_patch_maketitle:
+    \cs_set_eq:NN \@maketitle \@@_patch_ at maketitle:
+    \fi
+  } 
+\AddToHook{class/book/after}
+  {
+    \if at titlepage
+     \cs_set_eq:NN \maketitle \@@_patch_maketitle_page:
+    \else
+    \cs_set_eq:NN \maketitle \@@_patch_maketitle:
+    \cs_set_eq:NN \@maketitle \@@_patch_ at maketitle:   
+    \fi
+  } 
+%</package>  
+%    \end{macrocode}
+
+%    \begin{macrocode}
+%<*latex-lab>
+\ProvidesFile{title-latex-lab-testphase.ltx}
+        [\ltlabtitledate\space v\ltlabtitleversion\space
+         Changes related to the tagging of the title]
+
+\RequirePackage{latex-lab-testphase-title}
+
+%</latex-lab>
+%    \end{macrocode}
diff --git a/required/latex-lab/latex-lab.ins b/required/latex-lab/latex-lab.ins
index 9f600ab8..c7b55147 100644
--- a/required/latex-lab/latex-lab.ins
+++ b/required/latex-lab/latex-lab.ins
@@ -157,6 +157,9 @@ where one can also log issues in case there are any.
 \generate{\file{tabular-latex-lab-testphase.ltx}{\from{latex-lab-table.dtx}{latex-lab-alias}}}
 \generate{\file{latex-lab-testphase-table.sty}{\from{latex-lab-table.dtx}{package}}}
 
+%title
+\generate{\file{title-latex-lab-testphase.ltx}{\from{latex-lab-title.dtx}{latex-lab}}}
+\generate{\file{latex-lab-testphase-title.sty}{\from{latex-lab-title.dtx}{package}}}
 
 % stop docstrip adding \endinput
 \preamble





More information about the latex3-commits mailing list.