[latex3-commits] [latex3/latex2e] gh1468: fix for #1468 (e1b87798)

github at latex-project.org github at latex-project.org
Wed Sep 18 20:33:34 CEST 2024


Repository : https://github.com/latex3/latex2e
On branch  : gh1468
Link       : https://github.com/latex3/latex2e/commit/e1b87798fe834d8a4ab1a5d8e2451405c36c62fb

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

commit e1b87798fe834d8a4ab1a5d8e2451405c36c62fb
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Wed Sep 18 18:33:34 2024 +0000

    fix for #1468


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

e1b87798fe834d8a4ab1a5d8e2451405c36c62fb
 base/doc/ltnews40.tex                    | 12 ++++++++++++
 required/tools/array.dtx                 | 13 ++++++++++---
 required/tools/changes.txt               | 20 +++++++++++++-------
 required/tools/testfiles/github-1468.lvt | 28 ++++++++++++++++++++++++++++
 required/tools/testfiles/github-1468.tlg |  4 ++++
 5 files changed, 67 insertions(+), 10 deletions(-)

diff --git a/base/doc/ltnews40.tex b/base/doc/ltnews40.tex
index 146a147c..22f23dae 100644
--- a/base/doc/ltnews40.tex
+++ b/base/doc/ltnews40.tex
@@ -458,6 +458,18 @@ unnumbered variant of longtable:
   {\endlongtable}
 \end{verbatim}
 
+
+\subsection{\pkg{array}: Improve \texttt{>\{...\}} specifier}
+
+If the argument of \texttt{>\{...\}} ended with a command accepting a
+trailing optional argument, e.g., defined for example with
+\verb=\NewDocumentCommand\foo{o}{...}=, one could get low-level
+parsing errors. This has now been corrected.
+%
+\githubissue{1468}
+
+
+
 %\section{Changes to files in the \pkg{cyrillic} category}
 
 \begin{thebibliography}{9}\frenchspacing
diff --git a/required/tools/array.dtx b/required/tools/array.dtx
index ca5e991b..c75bcd93 100644
--- a/required/tools/array.dtx
+++ b/required/tools/array.dtx
@@ -39,7 +39,7 @@
 %    \begin{macrocode}
 %<+package>\NeedsTeXFormat{LaTeX2e}[2024/06/01]
 %<+package>\ProvidesPackage{array}
-%<+package>         [2024/07/13 v2.6e Tabular extension package (FMi)]
+%<+package>         [2024/09/17 v2.6f Tabular extension package (FMi)]
 %
 % \fi
 %
@@ -1387,8 +1387,12 @@ Bug reports can be opened (category \texttt{#1}) at\\%
 %    \end{macrocode}
 %    Here, we assume that the \textsf{count} register
 %    =\@tempcnta= has saved the value $=\count@= - 1$.
+%
+%    We end with \cs{relax} to stop any parsing for optional
+%    arguments out of \verb=>{...}= at this point. 
+% \changes{v2.6f}{2024/09/13}{Stop parsing for optional argument (gh/1468)}
 %    \begin{macrocode}
-   \the at toks \the \@tempcnta
+   \the at toks \the \@tempcnta \relax
 %    \end{macrocode}
 %    Next follows the =#= sign which specifies the place
 %    where the text of the column shall be inserted. To avoid
@@ -1442,7 +1446,10 @@ Bug reports can be opened (category \texttt{#1}) at\\%
 %    \begin{macrocode}
 \def\insert at pcolumn{%
    \UseTaggingSocket{tbl/pcell/begin}%
-   \the at toks \the \@tempcnta
+%    \end{macrocode}
+% \changes{v2.6f}{2024/09/13}{Stop parsing for optional argument (gh/1468)}
+%    \begin{macrocode}
+   \the at toks \the \@tempcnta \relax
    \ignorespaces \@sharp \unskip
    \the at toks \the \count@ \relax
    \UseTaggingSocket{tbl/pcell/end}%
diff --git a/required/tools/changes.txt b/required/tools/changes.txt
index 4f4c60d7..05c455cb 100644
--- a/required/tools/changes.txt
+++ b/required/tools/changes.txt
@@ -1,3 +1,16 @@
+=======================================================================
+This file lists changes to the LaTeX2e files in reverse chronological order.
+It is provided for convenience only.  It therefore makes no claims to
+completeness or accuracy and it contains some references to files that
+are not part of the distribution.
+=======================================================================
+
+2024-09-18  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* array.dtx (section{The insertion of declarations):
+	Stop parsing too far for an optional argument if >{...} ends in a command
+	with a trailing optional arg(gh/1468)
+
 2024-09-12  David Carlisle  <David.Carlisle at latex-project.org>
 
 	* build.lua, tools.ins:
@@ -16,13 +29,6 @@
 	* array.dtx (subsection{Handling \cs{cline}}):
 	Support for tagging \cline (tagging/134)
 
-=======================================================================
-This file lists changes to the LaTeX2e files in reverse chronological order.
-It is provided for convenience only.  It therefore makes no claims to
-completeness or accuracy and it contains some references to files that
-are not part of the distribution.
-=======================================================================
-
 2024-07-04  Ulrike Fischer  <Ulrike.Fischer at latex-project.org>
 
 	* longtable.dtx:
diff --git a/required/tools/testfiles/github-1468.lvt b/required/tools/testfiles/github-1468.lvt
new file mode 100644
index 00000000..3bff2eb4
--- /dev/null
+++ b/required/tools/testfiles/github-1468.lvt
@@ -0,0 +1,28 @@
+% https://github.com/latex3/latex2e/issues/1468
+
+\documentclass{article}
+\usepackage{array}
+
+\input{test2e}
+
+
+\begin{document}
+
+$x$  % init fonts
+
+\START
+
+\newcommand\foo[1][]{x}
+
+\begin{tabular}{>{\foo}l<{\foo}>{\foo}p{2cm}<{\foo}}
+  Foo & Bar \\
+\end{tabular}
+
+\RenewDocumentCommand\foo{o}{x}
+
+\begin{tabular}{>{\foo}l<{\foo}>{\foo}p{2cm}<{\foo}}
+  Foo & Bar \\
+\end{tabular}
+
+\end{document}
+
diff --git a/required/tools/testfiles/github-1468.tlg b/required/tools/testfiles/github-1468.tlg
new file mode 100644
index 00000000..736c84e4
--- /dev/null
+++ b/required/tools/testfiles/github-1468.tlg
@@ -0,0 +1,4 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+[1
+] (github-1468.aux)





More information about the latex3-commits mailing list.