[latex3-commits] [latex3/latex2e] latex-lab/uf-review-05: make \@title and \@author robust (a457a929)
github at latex-project.org
github at latex-project.org
Sun Jan 21 20:42:24 CET 2024
Repository : https://github.com/latex3/latex2e
On branch : latex-lab/uf-review-05
Link : https://github.com/latex3/latex2e/commit/a457a9291e2db0ef219940c1cdb1e2429d70021d
>---------------------------------------------------------------
commit a457a9291e2db0ef219940c1cdb1e2429d70021d
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Sun Jan 21 20:42:24 2024 +0100
make \@title and \@author robust
>---------------------------------------------------------------
a457a9291e2db0ef219940c1cdb1e2429d70021d
required/latex-lab/changes.txt | 4 ++++
required/latex-lab/latex-lab-title.dtx | 13 +++++++++----
required/latex-lab/testfiles-title/title-empty.lvt | 11 +++++++++++
required/latex-lab/testfiles-title/title-empty.tlg | 18 ++++++++++++++++++
4 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/required/latex-lab/changes.txt b/required/latex-lab/changes.txt
index e8018c5b..f7b07719 100644
--- a/required/latex-lab/changes.txt
+++ b/required/latex-lab/changes.txt
@@ -1,3 +1,7 @@
+2024-01-18 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
+ * latex-lab-title.dtx: make \@title and \@author robust to avoid errors
+ if they are not set.
+
2024-01-18 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
* latex-lab-block.dtx: add support to set an attribute-class for para-main.
diff --git a/required/latex-lab/latex-lab-title.dtx b/required/latex-lab/latex-lab-title.dtx
index a8087a9c..75c26945 100644
--- a/required/latex-lab/latex-lab-title.dtx
+++ b/required/latex-lab/latex-lab-title.dtx
@@ -16,8 +16,8 @@
%
% for those people who are interested or want to report an issue.
%
-\def\ltlabtitledate{2023-12-22}
-\def\ltlabtitleversion{0.85a}
+\def\ltlabtitledate{2024-01-21}
+\def\ltlabtitleversion{0.85b}
%<*driver>
\documentclass{l3doc}
@@ -134,7 +134,7 @@
\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}
@@ -316,7 +316,12 @@
%
% A helper command to convert the title into a pdfstring similar to
% \cs{pdfstringdef}.
-%
+% As we use \cs{text_purify} we must ensure that the default definitions
+% of \cs{@title} and \cs{@author} are robust:
+% \begin{macrocode}
+\protected\def\@title{\@latex at error{No \noexpand\title given}\@ehc}
+\protected\def\@author{\@latex at warning@no at line{No \noexpand\author given}}
+% \end{macrocode}
% TODO: This should be improved and moved into the pdf module so that
% it is generally available.
% \begin{macrocode}
diff --git a/required/latex-lab/testfiles-title/title-empty.lvt b/required/latex-lab/testfiles-title/title-empty.lvt
new file mode 100644
index 00000000..ac99a5c2
--- /dev/null
+++ b/required/latex-lab/testfiles-title/title-empty.lvt
@@ -0,0 +1,11 @@
+\ExplSyntaxOn
+\debug_on:n { check-declarations , deprecation }
+\sys_gset_rand_seed:n{1000}
+\ExplSyntaxOff
+\DocumentMetadata{testphase={phase-III,title},pdfversion=2.0}
+\input{regression-test}
+\documentclass{article}
+\begin{document}
+\START
+\maketitle
+\end{document}
diff --git a/required/latex-lab/testfiles-title/title-empty.tlg b/required/latex-lab/testfiles-title/title-empty.tlg
new file mode 100644
index 00000000..48bb3594
--- /dev/null
+++ b/required/latex-lab/testfiles-title/title-empty.tlg
@@ -0,0 +1,18 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+! LaTeX Error: No\title given.
+See the LaTeX manual or LaTeX Companion for explanation.
+Type H <return> for immediate help.
+ ...
+l. ...\maketitle
+Try typing <return> to proceed.
+If that doesn't work, type X <return> to quit.
+LaTeX Font Info: External font `cmex10' loaded for size
+(Font) <12> on input line ....
+LaTeX Font Info: External font `cmex10' loaded for size
+(Font) <8> on input line ....
+LaTeX Font Info: External font `cmex10' loaded for size
+(Font) <6> on input line ....
+LaTeX Warning: No\author given.
+[1
+] (title-empty.aux)
More information about the latex3-commits
mailing list.