[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: fix for github #148 (87921dc2)

Frank Mittelbach frank.mittelbach at latex-project.org
Sat Aug 31 09:59:21 CEST 2019


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/87921dc21556237485fb12f8a4c90c813f1dd8b3

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

commit 87921dc21556237485fb12f8a4c90c813f1dd8b3
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sat Aug 31 09:59:21 2019 +0200

    fix for github #148


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

87921dc21556237485fb12f8a4c90c813f1dd8b3
 base/doc/ltnews30.tex                    | 13 +++++++++++++
 required/tools/array.dtx                 | 12 ++++++++++--
 required/tools/changes.txt               |  5 +++++
 required/tools/testfiles/github-0148.lvt | 28 ++++++++++++++++++++++++++++
 required/tools/testfiles/github-0148.tlg |  9 +++++++++
 5 files changed, 65 insertions(+), 2 deletions(-)

diff --git a/base/doc/ltnews30.tex b/base/doc/ltnews30.tex
index ff7f0ab2..de6da853 100644
--- a/base/doc/ltnews30.tex
+++ b/base/doc/ltnews30.tex
@@ -269,6 +269,19 @@ regardless of \pkg{trace} being loaded or not.
         
 \section{Changes to packages in the \pkg{tools} category}
 
+\subsection{\pkg{array}: Warn if primitive column specifiers are overwritten}
+
+With \cs{newcolumntype} it is possible to define your own column
+specifiers for a \texttt{tabular} preamble, it is also possible to
+change existing ones. However, doing that for a primitive column
+specifier, such a \texttt{c}, is seldom a good idea, since then its
+functionality becomes unavailable.  Therefore the package was supposed
+to warn the user in this case, but due to a missing \cs{expandafter}
+in the code it never did---now it does.
+
+\githubissue{148}
+
+
 \subsection{\pkg{multicol}: Introduce \texttt{minrows} counter for balancing}
 
 When there are only a few lines of text on a page at the end of a
diff --git a/required/tools/array.dtx b/required/tools/array.dtx
index 35eaa837..8331df9d 100644
--- a/required/tools/array.dtx
+++ b/required/tools/array.dtx
@@ -32,7 +32,7 @@
 %<+package>\DeclareCurrentRelease{}{2018-04-30}
 %<+package>
 %<+package>\ProvidesPackage{array}
-%<+package>         [2018/12/30 v2.4k Tabular extension package (FMi)]
+%<+package>         [2019/08/31 v2.4l Tabular extension package (FMi)]
 %
 % \fi
 %
@@ -2513,7 +2513,15 @@
 % the list "\NC at list".
 %    \begin{macrocode}
   \@ifundefined{NC at find@\NC at char}%
-    {\@tfor\next:=<>clrmbp@!|\do{\if\noexpand\next\NC at char
+    {\@tfor\next:=<>clrmbp@!|\do
+      {%
+%    \end{macrocode}
+%    We use \cs{noexpand} on the tokens from the list in case one or
+%    the other (typically \texttt{@}, \texttt{!} or \texttt{|}) has
+%    been made active.
+% \changes{v2.4l}{2019/08/31}{Add a necessary \cs{expandafter} (github/148)}
+%    \begin{macrocode}
+        \if\expandafter\noexpand\next\NC at char
         \PackageWarning{array}%
                        {Redefining primitive column \NC at char}\fi}%
      \NC at list\expandafter{\the\NC at list\NC at do#1}}%
diff --git a/required/tools/changes.txt b/required/tools/changes.txt
index 54013f85..a702ac74 100644
--- a/required/tools/changes.txt
+++ b/required/tools/changes.txt
@@ -5,6 +5,11 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 =======================================================================
 
+2019-08-31  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* array.dtx: Add a necessary \expandafter so that redefinitions
+	of primitive specifiers	give a warning (github/148)
+
 2019-03-01  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* multicol.dtx (subsection{The output routines}):
diff --git a/required/tools/testfiles/github-0148.lvt b/required/tools/testfiles/github-0148.lvt
new file mode 100644
index 00000000..c29995dc
--- /dev/null
+++ b/required/tools/testfiles/github-0148.lvt
@@ -0,0 +1,28 @@
+% https://github.com/latex3/latex2e/issues/148
+
+\documentclass{article}
+
+
+\catcode`!=\active  % for test below
+
+\usepackage{array}
+
+\input{test2e}
+
+
+\begin{document}
+
+\START
+
+\typeout{This should generate a warning}
+\newcolumntype{c}{l}
+
+\typeout{And so should these}
+\newcolumntype{w}{p}
+\newcolumntype{W}{p}
+
+\typeout{Active token}
+\newcolumntype{!}{b}
+
+\END
+
diff --git a/required/tools/testfiles/github-0148.tlg b/required/tools/testfiles/github-0148.tlg
new file mode 100644
index 00000000..8adfa7fc
--- /dev/null
+++ b/required/tools/testfiles/github-0148.tlg
@@ -0,0 +1,9 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+This should generate a warning
+Package array Warning: Redefining primitive column c on input line ....
+And so should these
+Package array Warning: Column w is already defined on input line ....
+Package array Warning: Column W is already defined on input line ....
+Active token
+Package array Warning: Redefining primitive column ! on input line ....





More information about the latex3-commits mailing list