summaryrefslogtreecommitdiff
path: root/macros/latex-dev/required/tools/array.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex-dev/required/tools/array.dtx')
-rw-r--r--macros/latex-dev/required/tools/array.dtx61
1 files changed, 56 insertions, 5 deletions
diff --git a/macros/latex-dev/required/tools/array.dtx b/macros/latex-dev/required/tools/array.dtx
index ff963d7f51..1ca08036d9 100644
--- a/macros/latex-dev/required/tools/array.dtx
+++ b/macros/latex-dev/required/tools/array.dtx
@@ -1,8 +1,8 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2020
+% Copyright (C) 1993-2021
%
-% The LaTeX3 Project and any individual authors listed elsewhere
+% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the Standard LaTeX `Tools Bundle'.
@@ -33,7 +33,7 @@
%<+package>\DeclareCurrentRelease{}{2020-10-01}
%<+package>
%<+package>\ProvidesPackage{array}
-%<+package> [2020/10/01 v2.5c Tabular extension package (FMi)]
+%<+package> [2021/02/10 v2.5d Tabular extension package (FMi)]
%
% \fi
%
@@ -188,7 +188,7 @@
% David Carlisle\thanks{David kindly agreed on the inclusion
% of the \texttt{\textbackslash{}newcolumntype} implementation,
% formerly in
-% \texttt{newarray.sty} into this package }}
+% \texttt{newarray.sty} into this package.}}
%
% \date{Printed \today}
%
@@ -361,6 +361,56 @@
% columns have predefined widths.
% \end{itemize}
%
+%
+% \subsection{The behavior of the \texttt{\string\\} command}
+%
+% In the basic \texttt{tabular} implementation of \LaTeX{} the \cs{\bslash}
+% command ending the rows of the \texttt{tabular} or \texttt{array} has
+% a somewhat inconsistent behavior if its optional argument is used. The
+% result then depends on the type of rightmost column and as remarked in
+% Leslie Lamport's \LaTeX{} manual~\cite{bk:lamport} may not always produce the
+% expected extra space.
+%
+%
+% Without the \textsf{array} package the extra space requested by the
+% optional argument of \cs{\bslash} is measured from the last baseline of
+% the rightmost column (indicated by ``x'' in the following
+% example). As a result, swapping the column will give different
+% results:
+% \begin{verbatim}
+% \begin{tabular}[t]{lp{1cm}}
+% 1 & 1\newline x \\[20pt] 2 & 2 \end{tabular}
+% \begin{tabular}[t]{p{1cm}l}
+% 1\newline 1 & x \\[20pt] 2 & 2 \end{tabular}
+% \end{verbatim}
+% \pagebreak
+% If you run this without the \textsf{array} package you will get the
+% following result:
+% \begin{center}
+% \begin{tabular}[t]{lp{1cm}}
+% 1 & 1\newline x \\[32pt] 2 & 2 \end{tabular}
+% \begin{tabular}[t]{p{1cm}l}
+% 1\newline 1 & x \\[20pt] 2 & 2 \end{tabular}
+% \end{center}
+% In contrast, when the \textsf{array} package is loaded, the requested
+% space in the optional argument is always measured from the baseline of
+% the whole row and not from the last baseline of the rightmost column, thus
+% swapping columns doesn't change the spacing and we same table height
+% with an effective 8pt of extra space (as the second line already takes
+% up 12pt of the requested 20pt):
+% \begin{center}
+% \begin{tabular}[t]{lp{1cm}}
+% 1 & 1\newline x \\[20pt] 2 & 2 \end{tabular}
+% \begin{tabular}[t]{p{1cm}l}
+% 1\newline 1 & x \\[20pt] 2 & 2 \end{tabular}
+% \end{center}
+%
+% This correction of behavior only makes a difference if the rightmost column
+% is a \texttt{p}-column. Thus if you add the \textsf{array}
+% package to an existing document, you should verify the spacing in all
+% tables that have this kind of structure.
+%
+%
% \subsection{Defining new column specifiers}
%
% \DeleteShortVerb{\=}
@@ -1958,8 +2008,9 @@
% \changes{v2.2d}{1994/05/16}{Use \LaTeXe \cs{@finalstrut}}
% \changes{v2.3g}{1996/05/07}{Add \cs{hfil} for tools/2120}
% \changes{v2.4i}{2018/09/13}{Add group to prevent color leak (gh/72)}
+% \changes{v2.5d}{2021/02/10}{Explicitly run \cs{par} at the end of pboxes}
% \begin{macrocode}
-\def\@endpbox{\@finalstrut\@arstrutbox \color@endgroup \egroup\hfil}
+\def\@endpbox{\@finalstrut\@arstrutbox \par \color@endgroup \egroup\hfil}
% \end{macrocode}
% \end{macro}
%