[latex3-commits] [latex3/latex2e] gh1072: add guard for bad alignment option #1072 (5d0f1b72)
github at latex-project.org
github at latex-project.org
Thu Oct 26 22:08:47 CEST 2023
Repository : https://github.com/latex3/latex2e
On branch : gh1072
Link : https://github.com/latex3/latex2e/commit/5d0f1b72e3035b3900a691d526b1a3420cf398b5
>---------------------------------------------------------------
commit 5d0f1b72e3035b3900a691d526b1a3420cf398b5
Author: David Carlisle <d.p.carlisle at gmail.com>
Date: Thu Oct 26 21:08:47 2023 +0100
add guard for bad alignment option #1072
>---------------------------------------------------------------
5d0f1b72e3035b3900a691d526b1a3420cf398b5
base/changes.txt | 9 +++++
base/ltboxes.dtx | 92 ++++++++++++++++++++++++++++++++++++++++--
base/testfiles/github-1072.lvt | 14 +++++++
base/testfiles/github-1072.tlg | 10 +++++
4 files changed, 121 insertions(+), 4 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index d84e25b0..1bcf3ec3 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,15 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================
+2023-10-26 David Carlisle <David.Carlisle at latex-project.org>
+
+ * ltboxes.dtx:
+ add check so \makebox[4cm][?]{abc} does not discard text (gh1072)
+
+2023-10-26 Joseph Wright <Joseph.Wright at latex-project.org>
+ * ltspace.tex:
+ Use a protected definition for tilde which is safe in csnames
+
2023-10-21 Yukai Chou <muzimuzhi at gmai.com>
* ltfssbas.dtx, ltplain.dtx, ltspace.dtx:
Correct typos
diff --git a/base/ltboxes.dtx b/base/ltboxes.dtx
index ff1717ca..cc0107f1 100644
--- a/base/ltboxes.dtx
+++ b/base/ltboxes.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltboxes.dtx}
- [2022/09/07 v1.4d LaTeX Kernel (Box Commands)]
+ [2023/10/26 v1.4e LaTeX Kernel (Box Commands)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltboxes.dtx}
@@ -342,13 +342,35 @@
% \begin{macro}{\@imakebox}
% \changes{v0.1a}{1993/12/03}
% {macro modified}
+% \changes{v1.4e}{2023/10/26}
+% {Guard against unknown alignment gh/1072}
% Internal form of |\makebox|.
% \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2023/11/01}%
+%<latexrelease> {\bm at c}{Unknown alignment warning}%
+%<*2ekernel|latexrelease>
\long\def\@imakebox[#1][#2]#3{%
\@begin at tempboxa\hbox{#3}%
\setlength\@tempdima{#1}% support calc
- \hb at xt@\@tempdima{\csname bm@#2\endcsname}%
+ \hb at xt@\@tempdima{%
+ \expandafter\ifx\csname bm@#2\endcsname\relax
+ \bm at c
+ \@latex at warning{Unexpected alignment #2}%
+ \else
+ \csname bm@#2\endcsname
+ \fi}%
\@end at tempboxa}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease>\long\def\@imakebox[#1][#2]#3{%
+%<latexrelease> \@begin at tempboxa\hbox{#3}%
+%<latexrelease> \setlength\@tempdima{#1}% support calc
+%<latexrelease> \hb at xt@\@tempdima{\csname bm@#2\endcsname}%
+%<latexrelease> \@end at tempboxa}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
@@ -748,19 +770,45 @@
% {\cs{leavevmode} moved to \cs{@frameb at x}}
% \changes{v1.0s}{1995/04/27}
% {Move \cs{leavevmode} for graphics/1512}
+% \changes{v1.4e}{2023/10/26}
+% {Guard against unknown alignment gh/1072}
% In order to set the whole box, including the frame to the
% specified dimension, we first determine that dimension
% from the natural size of the text, |#3|.
% calculated width.
% \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2023/11/01}%
+%<latexrelease> {\bm at c}{Unknown alignment warning}%
+%<*2ekernel|latexrelease>
\long\def\@iframebox[#1][#2]#3{%
\leavevmode
\@begin at tempboxa\hbox{#3}%
\setlength\@tempdima{#1}%
\setbox\@tempboxa\hb at xt@\@tempdima
- {\kern\fboxsep\csname bm@#2\endcsname\kern\fboxsep}%
+ {\kern\fboxsep
+ \expandafter\ifx\csname bm@#2\endcsname\relax
+ \bm at c
+ \@latex at warning{Unexpected alignment #2}%
+ \else
+ \csname bm@#2\endcsname
+ \fi
+ \kern\fboxsep}%
\@frameb at x{\kern-\fboxrule}%
\@end at tempboxa}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease>\long\def\@iframebox[#1][#2]#3{%
+%<latexrelease> \leavevmode
+%<latexrelease> \@begin at tempboxa\hbox{#3}%
+%<latexrelease> \setlength\@tempdima{#1}%
+%<latexrelease> \setbox\@tempboxa\hb at xt@\@tempdima
+%<latexrelease> {\kern\fboxsep\csname bm@#2\endcsname\kern\fboxsep}%
+%<latexrelease> \@frameb at x{\kern-\fboxrule}%
+%<latexrelease> \@end at tempboxa}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
@@ -881,9 +929,17 @@
% \changes{v1.1g}{2006/05/18}
% {Ensure \cs{@parboxto} holds the value of \cs{@tempdimb} not the
% register itself (pr/3867)}
+% \changes{v1.4e}{2023/10/26}
+% {Guard against unknown alignment gh/1072}
% The internal version of |\parbox|.
% \begin{macrocode}
\let\@parboxto\@empty
+% \end{macrocode}
+% \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2023/11/01}%
+%<latexrelease> {\bm at c}{Unknown alignment warning}%
+%<*2ekernel|latexrelease>
\long\def\@iiiparbox#1#2[#3]#4#5{%
\leavevmode
\@pboxswfalse
@@ -899,9 +955,37 @@
\else\@pboxswtrue $\vcenter
\fi\fi\fi
\@parboxto{\let\hss\vss\let\unhbox\unvbox
- \csname bm@#3\endcsname}%
+ \expandafter\ifx\csname bm@#3\endcsname\relax
+ \bm at c
+ \@latex at warning{Unexpected alignment #3}%
+ \else
+ \csname bm@#3\endcsname
+ \fi}%
\if at pboxsw \m at th$\fi
\@end at tempboxa}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease>\long\def\@iiiparbox#1#2[#3]#4#5{%
+%<latexrelease> \leavevmode
+%<latexrelease> \@pboxswfalse
+%<latexrelease> \setlength\@tempdima{#4}%
+%<latexrelease> \@begin at tempboxa\vbox{\hsize\@tempdima\@parboxrestore#5\@@par}%
+%<latexrelease> \ifx\relax#2\else
+%<latexrelease> \setlength\@tempdimb{#2}%
+%<latexrelease> \edef\@parboxto{to\the\@tempdimb}%
+%<latexrelease> \fi
+%<latexrelease> \if#1b\vbox
+%<latexrelease> \else\if #1t\vtop
+%<latexrelease> \else\ifmmode\vcenter
+%<latexrelease> \else\@pboxswtrue $\vcenter
+%<latexrelease> \fi\fi\fi
+%<latexrelease> \@parboxto{\let\hss\vss\let\unhbox\unvbox
+%<latexrelease> \csname bm@#3\endcsname}%
+%<latexrelease> \if at pboxsw \m at th$\fi
+%<latexrelease> \@end at tempboxa}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
% \end{macro}
% \end{macro}
diff --git a/base/testfiles/github-1072.lvt b/base/testfiles/github-1072.lvt
new file mode 100644
index 00000000..63bda551
--- /dev/null
+++ b/base/testfiles/github-1072.lvt
@@ -0,0 +1,14 @@
+\documentclass{article}
+\input{test2e}
+\begin{document}
+
+x
+
+\START
+\makebox[4cm][?]{\write300{makebox}x}
+
+\framebox[4cm][?]{\write300{framebox}x}
+
+\parbox[t][4cm][?]{4cm}{\write300{parbox}x}
+
+\end{document}
\ No newline at end of file
diff --git a/base/testfiles/github-1072.tlg b/base/testfiles/github-1072.tlg
new file mode 100644
index 00000000..1727f344
--- /dev/null
+++ b/base/testfiles/github-1072.tlg
@@ -0,0 +1,10 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+LaTeX Warning: Unexpected alignment ? on input line ....
+LaTeX Warning: Unexpected alignment ? on input line ....
+LaTeX Warning: Unexpected alignment ? on input line ....
+[1
+makebox
+framebox
+parbox
+] (github-1072.aux)
More information about the latex3-commits
mailing list.