[latex3-commits] [git/LaTeX3-latex3-latex2e] gh322+gh319: fix for #322 (0a525ce4)

Frank Mittelbach frank.mittelbach at latex-project.org
Mon Jul 20 22:33:15 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : gh322+gh319
Link       : https://github.com/latex3/latex2e/commit/0a525ce4b26fc08ac3e871be233fb466acc9547f

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

commit 0a525ce4b26fc08ac3e871be233fb466acc9547f
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Mon Jul 20 22:33:15 2020 +0200

    fix for #322


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

0a525ce4b26fc08ac3e871be233fb466acc9547f
 base/doc/ltnews32.tex                              |  9 ++++
 required/tools/array.dtx                           | 25 ++++++---
 required/tools/changes.txt                         |  5 ++
 required/tools/testfiles/github-0322.lvt           | 63 ++++++++++++++++++++++
 .../tools/testfiles/github-0322.tlg                |  6 +--
 5 files changed, 97 insertions(+), 11 deletions(-)

diff --git a/base/doc/ltnews32.tex b/base/doc/ltnews32.tex
index 1befde91..b3a14067 100644
--- a/base/doc/ltnews32.tex
+++ b/base/doc/ltnews32.tex
@@ -640,6 +640,15 @@ in such documents.
 %
 \githubissue{297}
 
+\subsection{\pkg{array}: Fix for \cs{firsthline} and \cs{lasthline}}
+
+Replacing \cs{hline} with \cs{firsthline} or \cs{lasthline} could lead
+in some cases to an increase of the tabular width. This has now been
+corrected.
+%
+\githubissue{322}
+
+
 \subsection{\pkg{xr}: Support for spaces in filenames}
 
 The commannd \cs{externaldocument}, provided by \pkg{xr}, now also
diff --git a/required/tools/array.dtx b/required/tools/array.dtx
index 8e37064e..8b18ac46 100644
--- a/required/tools/array.dtx
+++ b/required/tools/array.dtx
@@ -33,7 +33,7 @@
 %<+package>\DeclareCurrentRelease{}{2020-10-01}
 %<+package>
 %<+package>\ProvidesPackage{array}
-%<+package>         [2020/10/01 v2.5b Tabular extension package (FMi)]
+%<+package>         [2020/10/01 v2.5c Tabular extension package (FMi)]
 %
 % \fi
 %
@@ -2215,7 +2215,7 @@
 %    \cs{@yargarraycr} is the same as in the \LaTeX{} kernel
 %    (depending on the date of the kernel with one of the two
 %    definitions below). We therefore do not define it again.
-% \changes{v2.5b}{200/04/22}{Don't define \cs{@yargarraycr} unnecessarily}
+% \changes{v2.5b}{2020/04/22}{Don't define \cs{@yargarraycr} unnecessarily}
 %    \begin{macrocode}
 %\def\@yargarraycr#1{\cr\noalign{\@vspace at calcify{#1}}} % 2020-10-01
 %\def\@yargarraycr#1{\cr\noalign{\vskip #1}}
@@ -2927,10 +2927,13 @@
 %
 %    We start by producing a single tabular row without any visible
 %    content that will produce the external reference point in case
-%    "[t]" is used.
+%    "[t]" is used.  We need to suppress the \cs{tabcolsep} in the
+%    \cs{multicolumn} in case there wasn't any in the real column.
+%
+% \changes{v2.5c}{2020/07/20}{Suppress all column space (gh/322)}
 %    \begin{macrocode}
 \newcommand{\firsthline}{%
-  \multicolumn1c{%
+  \multicolumn1{@{}c@{}}{%
 %    \end{macrocode}
 %    Within this row we calculate "\backup at length" to be the height
 %    plus depth of a standard line. In addition we have to add the
@@ -2947,6 +2950,10 @@
 %    \begin{macrocode}
      \raise\extratabsurround\copy\@arstrutbox
 %    \end{macrocode}
+%    And we should also cancel the guard otherwise we end up with two.
+%    \begin{macrocode}
+     \kern-1sp%
+%    \end{macrocode}
 %    Having done all this we end the line and back up by the value of
 %    "\backup at length" and then finally place our "\hline". This should
 %    place the line exactly at the right place but keep the reference
@@ -2968,9 +2975,12 @@
 %    depth of this last line increased by "\extratabsurround" without
 %    changing the placement "\hline".
 %
-%    We start by placing the rule followed by an invisible row.
+%    We start by placing the rule followed by an invisible row. We
+%    need to suppress the \cs{tabcolsep} in the multicol in case there
+%    wasn't any in the real column.
+% \changes{v2.5c}{2020/07/20}{Suppress all column space (gh/322)}
 %    \begin{macrocode}
-\newcommand{\lasthline}{\hline\multicolumn1c{%
+\newcommand{\lasthline}{\hline\multicolumn1{@{}c@{}}{%
 %    \end{macrocode}
 %    We now calculate "\backup at length" to be the height and depth of
 %    two lines plus the width of the rule.
@@ -2988,8 +2998,9 @@
 %    reference for the whole tabular). Since this row is invisible we
 %    can enlarge its depth by the desired amount.
 %    \begin{macrocode}
-    \multicolumn1c{%
+    \multicolumn1{@{}c@{}}{%
        \lower\extratabsurround\copy\@arstrutbox
+       \kern-1sp%
        }%
 }
 %    \end{macrocode}
diff --git a/required/tools/changes.txt b/required/tools/changes.txt
index 53c22c82..6c5d5916 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.
 =======================================================================
 
+2020-07-20  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* array.dtx (subsection{Support for \firsthline ...):
+	Ensure that the tabular width isn't changed (gh/322)
+
 2020-06-06  Johannes Braams  <Johannes.Braams at latex-project.org>
 
 	* verbatim.dtx: Save the value if \@filef at und before the call to
diff --git a/required/tools/testfiles/github-0322.lvt b/required/tools/testfiles/github-0322.lvt
new file mode 100644
index 00000000..71bc4c65
--- /dev/null
+++ b/required/tools/testfiles/github-0322.lvt
@@ -0,0 +1,63 @@
+\documentclass{article}
+\usepackage{array}
+
+\makeatletter
+
+
+\input{test2e}
+
+\begin{document}
+
+\START
+
+\setbox0=\hbox{%
+  \begin{tabular}{@{}c@{}c@{}}
+  \hline
+  &\null\hskip10pt\relax\null\\
+  \hline
+  \end{tabular}%
+}%
+\copy0 %
+With \verb|\hline|.\\
+Actual width (in sp unit):
+\number\wd0 \\ % as expected
+Expected:
+1st column 0\,sp +
+2nd column 1\,sp (guard) + 655360\,sp (content).
+
+\typeout{Actual width (in sp unit):
+\number\wd0 \space
+Expected:
+1st column 0 sp +
+2nd column 1 sp (guard) + 655360 sp (content)}
+
+\medskip
+
+\setbox0=\hbox{%
+  \begin{tabular}{@{}c@{}c@{}}
+  \firsthline
+  &\null\hskip10pt\relax\null\\
+  \lasthline
+  \end{tabular}%
+}%
+\copy0 %
+With \verb|\firsthline|.\\
+Actual width (in sp unit):
+\number\wd0 \ ???\\
+This turns out to be
+\verb|2*\tabcolsep| (\the\numexpr\tabcolsep*2\relax  sp) +
+1\,sp + 1\,sp + 655360\,sp.
+
+\typeout{Actual width (in sp unit):
+\number\wd0 \space ???
+This turns out to be
+2*\string\tabcolsep (\the\numexpr\tabcolsep*2\relax \space sp suppressed) +
+1 sp (+ 1 sp canceled) + 655360 sp.}
+
+\medskip
+
+There are two problems:
+(1)~\verb|\firsthline| should suppress \verb|\tabcolsep| on two sides;
+(2)~\verb|\firsthline| should NOT produce any extra guard (1\,sp).
+
+\END
diff --git a/base/testfiles/github-0203.tlg b/required/tools/testfiles/github-0322.tlg
similarity index 55%
copy from base/testfiles/github-0203.tlg
copy to required/tools/testfiles/github-0322.tlg
index b75dae15..d03e5eba 100644
--- a/base/testfiles/github-0203.tlg
+++ b/required/tools/testfiles/github-0322.tlg
@@ -1,10 +1,8 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
-Top-level: macro:->a\\b
-In box: macro:->a\\b
 LaTeX Font Info:    External font `cmex10' loaded for size
 (Font)              <7> on input line ....
 LaTeX Font Info:    External font `cmex10' loaded for size
 (Font)              <5> on input line ....
-Raggedright: macro:->a\\b
-Raggedleft: macro:->a\\b
+Actual width (in sp unit): 655361 Expected: 1st column 0 sp + 2nd column 1 sp (guard) + 655360 sp (content)
+Actual width (in sp unit): 655361 ??? This turns out to be 2*\tabcolsep(786432 sp suppressed) + 1 sp (+ 1 sp canceled) + 655360 sp.





More information about the latex3-commits mailing list.