[latex3-commits] [latex3/latex2e] develop: fix for #1468 (#1473) (4e696def)
github at latex-project.org
github at latex-project.org
Tue Oct 1 12:07:50 CEST 2024
Repository : https://github.com/latex3/latex2e
On branch : develop
Link : https://github.com/latex3/latex2e/commit/4e696def98ec18e8aa949ef5c668c63d6c55a055
>---------------------------------------------------------------
commit 4e696def98ec18e8aa949ef5c668c63d6c55a055
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Tue Oct 1 12:07:50 2024 +0200
fix for #1468 (#1473)
* fix for #1468
* Update required/tools/changes.txt
Co-authored-by: Yukai Chou <muzimuzhi at gmail.com>
---------
Co-authored-by: Yukai Chou <muzimuzhi at gmail.com>
>---------------------------------------------------------------
4e696def98ec18e8aa949ef5c668c63d6c55a055
base/doc/ltnews40.tex | 12 ++++++++++++
required/tools/array.dtx | 13 ++++++++++---
required/tools/changes.txt | 6 ++++++
required/tools/testfiles/github-1468.lvt | 28 ++++++++++++++++++++++++++++
required/tools/testfiles/github-1468.tlg | 4 ++++
5 files changed, 60 insertions(+), 3 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 e0d4b479..61e4bcdb 100644
--- a/required/tools/changes.txt
+++ b/required/tools/changes.txt
@@ -5,6 +5,12 @@ 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-17 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
* multicol.dtx: add tagging support (tagging/705)
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.