[latex3-commits] [latex3/latex2e] develop: fix for #1323 (#1324) (a8498ded)

github at latex-project.org github at latex-project.org
Mon Apr 8 17:01:29 CEST 2024


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

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

commit a8498ded7f5d8e4a4ec32fbc4583405f9a0db19e
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Mon Apr 8 17:01:29 2024 +0200

    fix for #1323 (#1324)


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

a8498ded7f5d8e4a4ec32fbc4583405f9a0db19e
 base/doc/ltnews39.tex                    | 102 +++++++++++++++++--------------
 required/tools/array.dtx                 |  12 +++-
 required/tools/changes.txt               |   8 ++-
 required/tools/testfiles/github-1323.lvt |  32 ++++++++++
 required/tools/testfiles/github-1323.tlg |   9 +++
 5 files changed, 115 insertions(+), 48 deletions(-)

diff --git a/base/doc/ltnews39.tex b/base/doc/ltnews39.tex
index 92c83592..8a06a7cd 100644
--- a/base/doc/ltnews39.tex
+++ b/base/doc/ltnews39.tex
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright 2023
+% Copyright 2024
 % The LaTeX Project and any individual authors listed elsewhere
 % in this file.
 %
@@ -175,7 +175,7 @@ found in various other places, e.g., \texttt{tagpdf.pdf}.
 
 We also added support for a few missing commands 
 described in Leslie Lamport's \emph{\LaTeX{}
-Manual}~\cite{38:Lamport}: If \texttt{phase-III} is used 
+Manual}~\cite{39:Lamport}: If \texttt{phase-III} is used 
 the \cs{marginpar} command will be properly tagged (depending on
 the PDF version) as an \texttt{Aside} or a \texttt{Note} structure.
 In the standard classes \cs{maketitle} will be tagged if the additional
@@ -263,37 +263,6 @@ Details about the implementation can be found in \texttt{texdoc
   ltmarks-code} or in the shorter \texttt{texdoc ltmarks-doc} (which
 only describes the general concepts and  the command interfaces).
 
-\section{New or improved commands}
-
-\subsection{\pkg{doc}: provide \cs{ProvideDocElement}}
-
-Beside \cs{NewDocElement} and \cs{RenewDocElement} we now also offer a
-\cs{ProvideDocElement} declaration that does nothing unless the doc
-element could be declared with \cs{NewDocElement}. This can be useful
-if documentation files are processed both individually as well as
-combined.
-
-
-\subsection{\pkg{doc}: better support for \pkg{upquote}}
-
-In \LaTeX{} News~37~\cite{39:ltnews37} we wrote that support for the
-\pkg{upquote} package was added to the \pkg{doc} package, but back
-then this was only done for \cs{verb}, and the \env{verbatim}
-environments. However, the bulk of code in a typical \texttt{.dtx} file is
-within \env{macrocode} or \env{macrocode*} environments which were not
-affected by adding \pkg{upquote}. We have now updated those, such that
-\pkg{upquote} alters the quote characters in these environments as
-well.
-%
-\githubissue{1230}
-
-\subsection{\pkg{ifthen}: guard against active characters in comparisons}
-The \cs{ifthenelse} command now ensures that \verb|<|, \verb|=| and
-\verb|>| are safe
-in numeric tests, even if they have been made active
-(typically by \pkg{babel} language shorthands.)
-%
-\githubissue{756}
 
 \section{Providing \pkg{xtemplate} in the format}
 
@@ -348,6 +317,40 @@ To support existing package authors, we have released an updated version of
 existing commands provided in \pkg{xtemplate} will continue to work, but
 we encourage programmers to move to the set above.
 
+
+\section{New or improved commands}
+
+\subsection{\pkg{doc}: Provide \cs{ProvideDocElement}}
+
+Beside \cs{NewDocElement} and \cs{RenewDocElement} we now also offer a
+\cs{ProvideDocElement} declaration that does nothing unless the doc
+element could be declared with \cs{NewDocElement}. This can be useful
+if documentation files are processed both individually as well as
+combined.
+
+
+\subsection{\pkg{doc}: Better support for \pkg{upquote}}
+
+In \LaTeX{} News~37~\cite{39:ltnews37} we wrote that support for the
+\pkg{upquote} package was added to the \pkg{doc} package, but back
+then this was only done for \cs{verb}, and the \env{verbatim}
+environments. However, the bulk of code in a typical \texttt{.dtx} file is
+within \env{macrocode} or \env{macrocode*} environments which were not
+affected by adding \pkg{upquote}. We have now updated those, such that
+\pkg{upquote} alters the quote characters in these environments as
+well.
+%
+\githubissue{1230}
+
+\subsection{\pkg{ifthen}: Guard against active characters in comparisons}
+The \cs{ifthenelse} command now ensures that \verb|<|, \verb|=| and
+\verb|>| are safe
+in numeric tests, even if they have been made active
+(typically by \pkg{babel} language shorthands.)
+%
+\githubissue{756}
+
+
 \section{Code improvements}
 
 \subsection{Loading packages at the top level}
@@ -570,7 +573,7 @@ This has now been corrected.
 
 \section{Changes to packages in the \pkg{amsmath} category}
 
-\subsection{\pkg{amsmath}: correct equation tag placement}
+\subsection{\pkg{amsmath}: Correct equation tag placement}
 
 If there is not enough space to place an equation tag on the same line
 as the equation \pkg{amsmath} calculates a suitable offset and then
@@ -591,7 +594,7 @@ been corrected.
 \section{Changes to packages in the \pkg{tools} category}
 
 
-\subsection{\pkg{array}, \pkg{longtable}, \pkg{tabularx}: support tagging}
+\subsection{\pkg{array}, \pkg{longtable}, \pkg{tabularx}: Support tagging}
 
 The three packages are now extended to enable producing tagged tabulars upon
 request. This is done by adding a number of sockets (see
@@ -602,6 +605,17 @@ In the previous \LaTeX{} release this was handled in
 \texttt{latex-lab} patching the packages when tagging was requested.
 
 
+\subsection{\pkg{array}: No \cs{unskip} in math cells}
+
+Math cells in the standard \env{array} environment of the kernel are
+not subject to space removal at the right end of the cell, i.e., explicit
+spaces from \cs{hspace} or \verb*|\ |, etc.\ are honored
+(normal spaces are automatically ignored in math). In the \pkg{array}
+package all spaces got removed by calling \cs{unskip} unconditionally,
+regardless of the type of cell. This difference in behavior has been
+now been corrected.
+%
+\githubissue{1323}
 
 
 \subsection{\pkg{verbatim}: \cs{verb} showed visible spaces}
@@ -666,20 +680,18 @@ didn't get this treatment. This oversight has now been corrected.
 %\fontsize{9.3}{11.3}\selectfont
 
 
-%\bibitem{39:Lamport}
-%Leslie Lamport.
-%\newblock \emph{{\LaTeX}: {A} Document Preparation System: User's Guide and Reference
-%  Manual}.
-%\newblock \mbox{Addison}-Wesley, Reading, MA, USA, 2nd edition, 1994.
-%\newblock ISBN 0-201-52983-1.
-%\newblock Reprinted with corrections in 1996.
-%
+\bibitem{39:Lamport}
+Leslie Lamport.
+\newblock \emph{{\LaTeX}: {A} Document Preparation System: User's Guide and Reference
+  Manual}.
+\newblock \mbox{Addison}-Wesley, Reading, MA, USA, 2nd edition, 1994.
+\newblock ISBN 0-201-52983-1.
+\newblock Reprinted with corrections in 1996.
 
 \bibitem{39:ltnews} \LaTeX{} Project Team.
   \emph{\LaTeXe{} news 1--39}. June, 2024.
   \url{https://latex-project.org/news/latex2e-news/ltnews.pdf}
-%
-%
+
 \bibitem{39:ltnews31} \LaTeX{} Project Team.
   \emph{\LaTeXe{} news 31}. February, 2020.
   \url{https://latex-project.org/news/latex2e-news/ltnews31.pdf}
diff --git a/required/tools/array.dtx b/required/tools/array.dtx
index 66c40a52..45a86667 100644
--- a/required/tools/array.dtx
+++ b/required/tools/array.dtx
@@ -38,7 +38,7 @@
 %    \begin{macrocode}
 %<+package>\NeedsTeXFormat{LaTeX2e}[2024/06/01]
 %<+package>\ProvidesPackage{array}
-%<+package>         [2023/12/11 v2.6a Tabular extension package (FMi)]
+%<+package>         [2024/04/08 v2.6b Tabular extension package (FMi)]
 %
 % \fi
 %
@@ -1371,6 +1371,7 @@ Bug reports can be opened (category \texttt{#1}) at\\%
 %
 % \begin{macro}{\insert at column}
 % \begin{macro}{\@sharp}
+% \begin{macro}{\textonly at unskip}
 %    We now define the macro =\insert at column= which will do
 %    this work for us.
 %    \begin{macrocode}
@@ -1399,8 +1400,9 @@ Bug reports can be opened (category \texttt{#1}) at\\%
 % \changes{v2.0e}{1991/02/07}{Added \{\} around \cs{@sharp} for new ftsel}
 % \changes{v2.0h}{1992/06/22}{Removed \{\} again in favour of
 %                             \cs{d at llarbegin}}
+% \changes{v2.6b}{2024/04/08}{Do not \cs{unskip} if in math mode (gh/1323)}
 %    \begin{macrocode}
-   \ignorespaces \@sharp \unskip
+   \ignorespaces \@sharp \textonly at unskip
 %    \end{macrocode}
 %    Then the second \textsf{token} register follows whose number should
 %    be saved in =\count@=.
@@ -1420,6 +1422,12 @@ Bug reports can be opened (category \texttt{#1}) at\\%
    \UseTaggingSocket{tbl/cell/end}%
 }
 %    \end{macrocode}
+%    Do the unskip only if we are in hmode:
+% \changes{v2.6b}{2024/04/08}{Do not \cs{unskip} if in math mode (gh/1323)}
+%    \begin{macrocode}
+\protected\def\textonly at unskip{\ifhmode\unskip\fi}
+%    \end{macrocode}
+% \end{macro}
 % \end{macro}
 % \end{macro}
 %
diff --git a/required/tools/changes.txt b/required/tools/changes.txt
index 4339d8e7..de627630 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-04-08  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* array.dtx (section{The insertion of declarations):
+	Do not \unskip if in math mode, this way explicit spaces at the
+	end of the math cell remain as it is with array env in core LaTeX (gh/1323)
+
 2024-03-13  David Carlisle  <David.Carlisle at latex-project.org>
 
 	* l3sys-query.dtx
@@ -16,7 +22,7 @@ are not part of the distribution.
 
 2023-12-16  David Carlisle  <David.Carlisle at latex-project.org>
 
-	* showkeys.dtx: avoid adding extra box to \@lables gh/1123
+	* showkeys.dtx: avoid adding extra box to \@labels gh/1123
 
 2023-12-16  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
diff --git a/required/tools/testfiles/github-1323.lvt b/required/tools/testfiles/github-1323.lvt
new file mode 100644
index 00000000..1a987835
--- /dev/null
+++ b/required/tools/testfiles/github-1323.lvt
@@ -0,0 +1,32 @@
+\documentclass{article}
+\input{regression-test}
+\usepackage{array}
+
+\newlength\mylength
+
+\begin{document}
+
+\START
+
+\settowidth\mylength{%
+$
+\begin{array}{cccccccccc}
+  1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9
+\end{array}
+$}
+
+\typeout{This should not give identical widths:}
+
+\typeout{without spaces: \space\space\space\space\space\space\the\mylength}
+
+\settowidth\mylength{%
+$
+\begin{array}{cccccccccc}
+  1~& 2~& 3~& 4~& 5~& 6~& 7~& 8~& 9
+\end{array}
+$}
+
+\typeout{with explicit spaces: \the\mylength}
+
+\END
+
diff --git a/required/tools/testfiles/github-1323.tlg b/required/tools/testfiles/github-1323.tlg
new file mode 100644
index 00000000..7f2aad01
--- /dev/null
+++ b/required/tools/testfiles/github-1323.tlg
@@ -0,0 +1,9 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+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 ....
+This should not give identical widths:
+without spaces:       135.00027pt
+with explicit spaces: 161.6669pt





More information about the latex3-commits mailing list.