summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/multirow/multirow.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/multirow/multirow.dtx')
-rw-r--r--Master/texmf-dist/source/latex/multirow/multirow.dtx258
1 files changed, 206 insertions, 52 deletions
diff --git a/Master/texmf-dist/source/latex/multirow/multirow.dtx b/Master/texmf-dist/source/latex/multirow/multirow.dtx
index a91cb832ec0..5e3f42c63ef 100644
--- a/Master/texmf-dist/source/latex/multirow/multirow.dtx
+++ b/Master/texmf-dist/source/latex/multirow/multirow.dtx
@@ -1,9 +1,9 @@
% \iffalse meta-comment
%
% Parts of this file, Copyright (C) 1994 by Jerry Leichter
-% Copyright (C) 2016, 2018, 2019 by Piet van Oostrum <piet@vanoostrum.org>
+% Copyright (C) 2016-2021 by Pieter van Oostrum <pieter@vanoostrum.org>
% -------------------------------------------------------
-%
+%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
@@ -11,7 +11,7 @@
%
% http://www.latex-project.org/lppl.txt
%
-% and version 1.3 or later is part of all distributions of LaTeX
+% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% \fi
@@ -21,10 +21,10 @@
\ProvidesFile{\jobname.dtx}
%</driver>
% This is the variable part of the preamble
-%
+%
%<multirow|bigstrut>%% Copyright (C) 1994 by Jerry Leichter
%<bigdelim>%% Copyright (C) 1994 by \O ystein Bache
-%% Copyright (C) 2016 , 2018, 2019 by Piet van Oostrum <piet@vanoostrum.org>
+%% Copyright (C) 2016-2021 by Pieter van Oostrum <pieter@vanoostrum.org>
%%
%
% \begin{macrocode}
@@ -32,7 +32,7 @@
%<multirow>\ProvidesPackage{multirow}%
%<bigstrut>\ProvidesPackage{bigstrut}
%<bigdelim>\ProvidesPackage{bigdelim}
-%<multirow|bigstrut|bigdelim> [2019/05/31 v2.5
+%<multirow|bigstrut|bigdelim> [2021/01/02 v2.6
%<multirow> Span multiple rows of a table]%
%<bigstrut> Provide larger struts in tabulars]
%<bigdelim> Create big delimiters in tabular or array]
@@ -42,6 +42,7 @@
\documentclass[a4paper]{ltxdoc}
\usepackage[T1]{fontenc}
\usepackage{multirow,bigstrut,bigdelim,colortbl}
+\usepackage[table]{xcolor}
\usepackage{tabulary}
\usepackage{longtable}
\usepackage{booktabs}
@@ -49,7 +50,6 @@
\usepackage{url}
\usepackage{tikz}
\usepackage{hhline}
-\usepackage{color}
\usepackage{etoolbox}
\AtBeginEnvironment{macrocode}{\color{red}}
\newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}}
@@ -102,7 +102,7 @@
% \title{The \Package{multirow},
% \Package{bigstrut} and
% \Package{bigdelim} packages}
-% \author{Piet van Oostrum\thanks{catalogued ``active author''}\\
+% \author{Pieter van Oostrum\thanks{catalogued ``active author''}\\
% \O ystein Bache\\
% Jerry Leichter\thanks{Documentation originally put together by Robin
% Fairbairns}}
@@ -115,7 +115,7 @@
%
% \section{Introduction}
% These packages offer a series of extensions to the standard \LaTeX{}
-% \texttt{tabular} environment. Their respective functions are:
+% \environment{tabular} environment. Their respective functions are:
% \begin{description}
% \item[\Package{multirow}] which provides a construction for table cells
% that span more than one row of the table;
@@ -129,6 +129,21 @@
% \section{Changes in version 2}
% \label{sec:changes-2}
%
+%\subsection*{version 2.6}
+%
+% \begin{itemize}
+% \item Make the \texttt{supertabular} option compatible with newer
+% versions of the \Package{supertabular} package
+% \item Initialize \cs{@arstrutbox} when not defined, to enable some
+% uses of the big delims outside of an \environment{array} or \environment{tabular}.
+% \end{itemize}
+%
+%\subsection*{version 2.5a}
+%
+% \begin{itemize}
+% \item Changed contact information
+% \end{itemize}
+%
%\subsection*{version 2.5}
%
% \begin{itemize}
@@ -155,7 +170,7 @@
% \begin{itemize}
% \item Support for fractional values of \meta{nrows}.
% \end{itemize}
-%
+%
%\subsection*{version 2.0}
%
% \begin{itemize}
@@ -229,7 +244,7 @@
%
% If the width was given as \texttt{*} the text will be set in LR
% mode. If you want a multiline entry in this case you could use a
-% \texttt{tabular} or \texttt{array} environment in the text
+% \environment{tabular} or \environment{array} environment in the text
% parameter. See for example the \environment{minitab} below.
%
% The width can also be given as \texttt{=} when the \cs{multirow} entry is given in a
@@ -526,7 +541,7 @@
% . . .
% \begin{tabular}{cll}
% \toprule
-% \multirow[t]{5}{*}[-\shiftdown]{\Huge\bfseries B}
+% \multirow[t]{5}{*}[-\shiftdown]{\Huge\bfseries B}
% & foo & Lorem ipsum dolor sit \\
% & bar & Maecenas sed purus \\
% & baz & Nullam luctus id tellus \\
@@ -541,7 +556,7 @@
% \setlength{\shiftdown}{\heightof{\Huge\bfseries B}-\heightof{f}}
% \begin{tabular}{cll}
% \toprule
-% \multirow[t]{5}{*}[-\shiftdown]{\Huge\bfseries B}
+% \multirow[t]{5}{*}[-\shiftdown]{\Huge\bfseries B}
% & foo & Lorem ipsum dolor sit \\
% & bar & Maecenas sed purus \\
% & baz & Nullam luctus id tellus \\
@@ -554,8 +569,10 @@
%
% \subsection{Multirow and colored cells}\label{sec:mult-color-cells}
%
-% If you use \cs{multirow} with the \Package{colortbl} package you have
+% If you use \cs{multirow} with the \Package{colortbl} package (or the
% \index{colortbl=\Package{colortbl}|usage}
+% \Package{xcolor} package with the \texttt{[table]} option) you have
+% \index{xcolor=\Package{xcolor}|usage}
% to take precautions if you want to color the column that has the
% \cs{multirow} in it. The \Package{colortbl} package works by coloring each cell
% separately. So if you use \cs{multirow} with a positive \meta{nrows}
@@ -646,7 +663,7 @@
%
% \cs{multirow} can calculate the height of the required multirow box
% from \meta{nrows} and \meta{bigstruts}, supposed that all the rows
-% don't have ``unusual heights. However, there are cases when this is
+% don't have ``unusual'' heights. However, there are cases when this is
% not enough to properly position the box, especially when there is a
% \cs{bigstrut} on top of the first row and/or one on the bottom of the
% last row. In that case \cs{multirow} should be given additional
@@ -1157,7 +1174,7 @@
% \DescribeMacro{\bigstrutjot}
% \cs{bigstrut}\oarg{x} produces a strut (a rule with width 0) which is \cs{bigstrutjot}
% (\texttt{2pt} by default) higher, lower, or both than the standard
-% array/tabular strut. Use it in table entries that are adjacent to
+% \environment{array}/\environment{tabular} strut. Use it in table entries that are adjacent to
% \cs{hline}s to leave an extra bit of space\,---\,according to the
% TeXbook (page 246), ``This is a little touch that improves the
% appearance of boxed tables; look for it as a mark of quality.''
@@ -1285,14 +1302,97 @@
% Also the commands may be
% used in the last row of the extension with a negative \meta{n}
% \index{colortbl=\Package{colortbl}|usage}
-% argument. This is useful in combination with \Package{colortbl} (see
-% the discussion in section \ref{sec:multirow} on \Package{multirow}).
+% argument. This is useful in combination with the \Package{colortbl}
+% \index{xcolor=\Package{xcolor}|usage}
+% or \Package{xcolor} packages
+% (see the discussion in section \ref{sec:multirow} on \Package{multirow}).
% If there are unusually tall rows you may have to enlarge \meta{n}
% (you can use fractional values).
% If you have horizontal lines that interact with the braces you are
% \index{hhline=\Package{hhline}|usage}
% advised to use the \Package{hhline} package to make the lines.
%
+% If you decrease or eliminate the intercolumn space with \verb|@{}| and
+% use colored backgrounds with the \Package{colortbl} or
+% \Package{xcolor} packages (commands \verb|\columncolor|,
+% \verb|\rowcolor|, \verb|\rowcolors| or \verb|\cellcolor|),
+% \index{columncolor=\verb!*+\columncolor+|usage}
+% \index{rowcolor=\verb!*+\rowcolor+|usage}
+% \index{rowcolors=\verb!*+\rowcolors+|usage}
+% \index{cellcolor=\verb!*+\cellcolor+|usage}
+% you will notice that part of the brace will be cut off. In reality it
+% will be overwritten with the color of the next cell. See this example:
+%
+% \begin{quote}
+% \begin{minipage}{0.6\linewidth}
+% \begin{verbatim}
+% \rowcolors{2}{green!25}{green!75}
+% \begin{tabular}{ c @{}c c c }
+% & 1 & 2 & 3 \\
+% & 4 & 5 & 6 \\
+% \ldelim\{{-3}{*} & 7 & 8 & 9 \\
+% \end{tabular}
+% \end{verbatim}
+% \end{minipage}
+% \begin{minipage}{0.35\linewidth}
+% \rowcolors{2}{green!25}{green!75}
+% \begin{tabular}{ c @{}c c c }
+% & 1 & 2 & 3 \\
+% & 4 & 5 & 6 \\
+% \ldelim\{{-3}{*} & 7 & 8 & 9 \\
+% \end{tabular}
+% \\[2ex]
+% \end{minipage}
+% \end{quote}
+%
+% This is not a problem of \Package{multirow} or \Package{bigdelim};
+% it will also happen if there is normal text in the column before the
+% \verb|@{}|. The reason is that these color commands extend the color
+% to cover the intercolumn spaces on both sides to prevent gaps in the
+% color. The size of these so-called \textit{overhangs} is \verb|\tabcolsep| (or
+% \verb|\arraycolsep| when an \environment{array} is used) on each side.
+% However, when \verb|@{}| is used there is no such intercolumn space
+% and the extension covers parts of the previous column.
+% This can be cured by setting the left \textit{overhang} explicitly to
+% 0pt with a \verb|\columncolor| command in the tabular header, like
+% \verb|>{\columncolor{white}[0pt][\tabcolsep]}|. Unfortunately the
+% explicit color \texttt{white}, removes the transparency of the column,
+% so if there are cells in that column that have no explicit color,
+% these cells are affected. If the background of the \environment{tabular} is
+% white, this normally will not be noticed, but if the background color
+% is changed, for example with the \verb|\pagecolor| command, then that color
+% should be used rather than \texttt{white}. Unfortunately, there is no
+% command to specify the \textit{overhangs} without also specifying a
+% color.
+%
+% In the following example we have done this. In order to keep the table
+% header compact, we put the deinition in a \verb|\newcolumn| command
+% (using the \Package{array} package).
+%
+% \begin{quote}
+% \begin{minipage}{0.6\linewidth}
+% \begin{verbatim}
+% \newcolumntype{z}{@{}>{\columncolor{white}[0pt][\tabcolsep]}}
+% \rowcolors{2}{green!25}{green!75}
+% \begin{tabular}{ c zc c c }
+% & 1 & 2 & 3 \\
+% & 4 & 5 & 6 \\
+% \ldelim\{{-3}{*} & 7 & 8 & 9 \\
+% \end{tabular}
+% \end{verbatim}
+% \end{minipage}
+% \begin{minipage}{0.35\linewidth}
+% \newcolumntype{z}{@{}>{\columncolor{white}[0pt][\tabcolsep]}}
+% \rowcolors{2}{green!25}{green!75}
+% \begin{tabular}{ c zc c c }
+% & 1 & 2 & 3 \\
+% & 4 & 5 & 6 \\
+% \ldelim\{{-3}{*} & 7 & 8 & 9 \\
+% \end{tabular}
+% \\[2ex]
+% \end{minipage}
+% \end{quote}
+%
% In case you want to have a paragraph type text as optional parameter you could put it in a \cs{parbox}.
% Alternatively you could add an extra column with the text in a \cs{multirow}, like in
% \begin{quote}
@@ -1313,7 +1413,17 @@
% pdf & & \\
% \end{tabular}
% \end{quote}
-% Note that we used \texttt{@\{\}} to eliminate the intercolumn space to get the text tight to the brace.
+% Note that we used \texttt{@\{\}} to eliminate the intercolumn space to
+% get the text tight to the brace.
+% \section{Contact Information}
+%
+% Pieter van Oostrum\\
+% email: \texttt{pieter@vanoostrum.org}\\
+% www: \url{http://pieter.vanoostrum.org}
+% \\[1ex]
+% The source code can be found on Github:\\
+% \url{https://github.com/pietvo/multirow}
+%
% \StopEventually{%
% \PrintChanges
% \PrintIndex}
@@ -1328,22 +1438,22 @@
% \fi
%
% \changes{multirow v1.0}{}{distributed anonymously, based on a Usenet posting}
-% \changes{multirow v1.1}{}{allow it to work without bigstrut.sty (Piet van Oostrum)}
+% \changes{multirow v1.1}{}{allow it to work without bigstrut.sty (Pieter van Oostrum)}
% \changes{multirow v1.2}{}{modified by Jerry Leichter for the same goal, but using a
% different approach which will work properly with bigstrut.sty}
-% \changes{multirow v1.2a}{}{modified by Piet van Oostrum to use \cs{vskip}
+% \changes{multirow v1.2a}{}{modified by Pieter van Oostrum to use \cs{vskip}
% instead of \cs{raise} in positioning, avoiding making rows too high
% when the adjustment is large}
-% \changes{multirow v1.3}{}{modified by Piet van Oostrum to work properly in a p{} column
+% \changes{multirow v1.3}{}{modified by Pieter van Oostrum to work properly in a p{} column
% (\cs{leavevmode} added)}
-% \changes{multirow v1.4}{}{modified by Piet van Oostrum to check for the special case that
+% \changes{multirow v1.4}{}{modified by Pieter van Oostrum to check for the special case that
% the width is given as an *. In this case the natural
% width of the text argument will be used and the argument
% is processed in LR-mode.}
-% \changes{multirow v1.5}{}{modified by Piet van Oostrum: Added a \texttt{\%} after \texttt{\cs{hbox}\{\#5\}\cs{vfill}}.\\
+% \changes{multirow v1.5}{}{modified by Pieter van Oostrum: Added a \texttt{\%} after \texttt{\cs{hbox}\{\#5\}\cs{vfill}}.\\
% Added \cs{strut}s around \#5 for better vertical positioning.
% Additional coding for negative value of \meta{nrows}.}
-% \changes{multirow v1.6}{2004/05/05}{modified by Piet van Oostrum: Replace a space by \cs{relax} after
+% \changes{multirow v1.6}{2004/05/05}{modified by Pieter van Oostrum: Replace a space by \cs{relax} after
% \texttt{\cs{advance}\cs{multirow@dima}\#4}}
%
% \changes{v1.9a}{2016/09/23}{Implement the \texttt{debug} option.}
@@ -1409,6 +1519,17 @@
% The package option \texttt{supertabular} redefines \verb+\\*+ inside a
% \environment{supertabular}.
% The redefinition is delayed until the \verb+\begin{document}+.
+%
+% \changes{v2.6}{2020/12/26}{Adapt the definition to be compatible with
+% modern versions of \texttt{supertabular}}
+% \texttt{Supertabular} version 4.1f and later need a call to
+% \cs{ST@save@lineno} to function properly, but earlier versions cannot
+% use this as it doesn't exist in these versions. So the definitions of
+% both \cs{ST@tabularcr} and \cs{MRST@cr} are different depending on whether
+% \cs{ST@save@lineno} is defined. There are also some other differences,
+% so some intermediate versions of \texttt{supertabular} might need more
+% subtle adaptations, but for now we leave it at that.
+%
% \begin{macrocode}
\DeclareOption{supertabular}{%
\AtBeginDocument{%
@@ -1417,11 +1538,58 @@
% This macro is the definition of \verb+\\+ inside a
% \environment{supertabular}. We check for a \verb+*+, and if it is
% present we call our own version, otherwise the
-% \environment{supertabular} version.
+% \environment{supertabular} version. First we get the older version for
+% pre-4.1f \texttt{supertabular}, then the newer version.
+% \begin{macrocode}
+\ifx\ST@save@lineno\undefined
+\def\ST@tabularcr{%
+ {\ifnum0=`}\fi
+ \@ifstar{\MRST@xtabularcr}{\ST@xtabularcr}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\MRST@cr}
+% \cs{MRST@cr} is a truncated copy of \cs{ST@cr}. It does all the bookkeeping
+% about the space the \environment{longtable} occupies, but it doesn't
+% do the pagebreaking part.
+% \begin{macrocode}
+\def\MRST@cr{%
+ \noalign{%
+ \ifnum\ST@pboxht<\ST@lineht
+ \global\advance\ST@pageleft -\ST@lineht
+ \global\ST@prevht\ST@lineht
+ \else
+ \global\advance\ST@pageleft -\ST@pboxht
+ \global\advance\ST@pageleft -0.1\ST@pboxht
+ \global\advance\ST@pageleft -\ST@stretchht
+ \global\ST@prevht\ST@pboxht
+ \global\ST@pboxht\z@
+ \fi
+ \global\advance\ST@pageleft -\ST@toadd
+ \global\ST@toadd=\z@}}
+\else
+% \end{macrocode}
+% These are the newer versions.
% \begin{macrocode}
\def\ST@tabularcr{%
{\ifnum0=`}\fi
+ \ST@save@lineno
\@ifstar{\MRST@xtabularcr}{\ST@xtabularcr}}
+\def\MRST@cr{%
+ \noalign{%
+ \ifnum\ST@pboxht<\ST@lineht
+ \global\advance\ST@pageleft -\ST@lineht
+ \global\ST@prevht\ST@lineht
+ \else
+ \ST@trace@cr\thr@@{Added par box with height \the\ST@pboxht}%
+ \global\advance\ST@pageleft -\ST@pboxht
+ \global\advance\ST@pageleft -0.1\ST@pboxht
+ \global\ST@prevht\ST@pboxht
+ \global\ST@pboxht\z@
+ \fi
+ \global\advance\ST@pageleft -\ST@toadd
+ \global\ST@toadd=\z@
+ \ST@trace@cr\thr@@{Space left for tabular: \the\ST@pageleft}}}
+\fi
% \end{macrocode}
% \end{macro}
% \begin{macro}{\MRST@xtabularc}
@@ -1448,33 +1616,12 @@
\noalign{\global\ST@toadd=#1}\MRST@cr}
\def\MRST@yargarraycr#1{%
\cr\noalign{\vskip #1\global\MRST@toadd=#1}\MRST@cr}
+}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
-% \begin{macro}{\MRST@cr}
-% This is a truncated copy of \cs{ST@cr}. It does all the bookkeeping
-% about the space the \environment{longtable} occupies, but it doesn't
-% do the pagebreaking part.
-% \begin{macrocode}
-\def\MRST@cr{%
- \noalign{%
- \ifnum\ST@pboxht<\ST@lineht
- \global\advance\ST@pageleft -\ST@lineht
- \global\ST@prevht\ST@lineht
- \else
- \global\advance\ST@pageleft -\ST@pboxht
- \global\advance\ST@pageleft -0.1\ST@pboxht
- \global\advance\ST@pageleft -\ST@stretchht
- \global\ST@prevht\ST@pboxht
- \global\ST@pboxht\z@
- \fi
- \global\advance\ST@pageleft -\ST@toadd
- \global\ST@toadd=\z@}}
-}
-% \end{macrocode}
-% \end{macro}
% \begin{macro}{\STneed}
% This macro can be used in a \environment{supertabular} to indicate how
% much space a multirow entry needs. See section~\ref{sec:use-with-supertabular}.
@@ -1723,7 +1870,7 @@
% at the beginning to force horizontal mode}
% \begin{macro}{\bigstrut}
% This macro inserts a strut. Depending on the optional parameter it extends
-% above and/or below the standard array/tabular strut.
+% above and/or below the standard \environment{array}/\environment{tabular} strut.
% \begin{macrocode}
\newcommand\bigstrut[1][x]{%
\leavevmode\unskip\@tempdima=\ht\@arstrutbox \@tempdimb=\dp\@arstrutbox
@@ -1751,12 +1898,17 @@
% This macro typesets a left delimiter. It calls \cs{multirow} with the proper arguments.
% The size of the delimiter is determined by putting a \cs{vbox} with the proper height and
% zero width next to it. The height is the one that \cs{multirow}
-% already has calculated in \cs{multirow@dima}.
+% already has calculated in \cs{multirow@dima}. That calculation uses
+% the size of \cs{@arstrutbox}, which is set by \texttt{tabular} or
+% \texttt{array} environments. In case it is not set, we initialize it
+% to a default value.
% \changes{bigdelim v2.3}{2018/08/03}{Replace \cs{textrm} by \cs{textnormal}}
+% \changes{bigdelim v2.6}{2020/12/26}{Initialize \cs{@arstrutbox} if not defined}
% \begin{macrocode}
\newcommand\ldelim[3]{\@ifnextchar[{\@ldelim{#1}{#2}{#3}}{\@ldelim{#1}{#2}{#3}[\null]}}
\def\@ldelim#1#2#3[#4]%
- {\multirow{#2}{#3}{%
+ {\ifvoid\@arstrutbox\setbox\@arstrutbox\hbox{\strut}\fi
+ \multirow{#2}{#3}{%
\ensuremath
{\left.\vcenter{\hsize=0pt\vrule height \multirow@dima width 0pt}%
\textnormal{#4}\right#1}}}
@@ -1767,10 +1919,12 @@
% This macro typesets a right delimiter. It calls \cs{multirow} with the
% proper arguments, similar to \cs{ldelim}.
% \changes{bigdelim v2.3}{2018/08/03}{Replace \cs{textrm} by \cs{textnormal}}
+% \changes{bigdelim v2.6}{2020/12/26}{Initialize \cs{@arstrutbox} if not defined}
% \begin{macrocode}
\newcommand\rdelim[3]{\@ifnextchar[{\@rdelim{#1}{#2}{#3}}{\@rdelim{#1}{#2}{#3}[\null]}}
\def\@rdelim#1#2#3[#4]%
- {\multirow{#2}{#3}{%
+ {\ifvoid\@arstrutbox\setbox\@arstrutbox\hbox{\strut}\fi
+ \multirow{#2}{#3}{%
\ensuremath
{\left#1\vcenter{\hsize=0pt\vrule height \multirow@dima width 0pt}%
\textnormal{#4}\right.}}}