diff options
author | Karl Berry <karl@freefriends.org> | 2016-10-15 22:58:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-10-15 22:58:47 +0000 |
commit | aa6bd000fec765bbef2ae479183d3949fa2d2a5b (patch) | |
tree | ffbde4b35b7794585d144a56fac594cb2060e014 /Master/texmf-dist/source/latex/multirow | |
parent | 20d033ee630eb6f628a29fa51eeb753b1474922f (diff) |
multirow (11oct16)
git-svn-id: svn://tug.org/texlive/trunk@42279 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/multirow')
-rw-r--r-- | Master/texmf-dist/source/latex/multirow/multirow.dtx | 101 |
1 files changed, 72 insertions, 29 deletions
diff --git a/Master/texmf-dist/source/latex/multirow/multirow.dtx b/Master/texmf-dist/source/latex/multirow/multirow.dtx index aa814cbb627..073967b6958 100644 --- a/Master/texmf-dist/source/latex/multirow/multirow.dtx +++ b/Master/texmf-dist/source/latex/multirow/multirow.dtx @@ -32,7 +32,7 @@ %<multirow>\ProvidesPackage{multirow}% %<bigstrut>\ProvidesPackage{bigstrut} %<bigdelim>\ProvidesPackage{bigdelim} -%<multirow|bigstrut|bigdelim> [2016/09/27 v2.0 +%<multirow|bigstrut|bigdelim> [2016/10/11 v2.1 %<multirow> Span multiple rows of a table]% %<bigstrut> Provide larger struts in tabulars] %<bigdelim> Create big delimiters in tabular or array] @@ -45,6 +45,7 @@ \usepackage{tabulary} \usepackage{longtable} \usepackage{booktabs} +\usepackage{calc} \usepackage{url} \usepackage{tikz} \newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}} @@ -61,7 +62,7 @@ %</driver> % \fi % -% \CheckSum{440} +% \CheckSum{434} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -144,10 +145,11 @@ % rows and columns that the text spans the multirow block. Usually this % covers one column, but by combining it with \cs{multicolumn} more % columns can be covered. +% \changes{v2.1}{2016/10/06}{Rename \meta{fixup} to \meta{vmove} as in The LaTeX Companion.} % % The basic syntax is: % \begin{quote} -% \cmd{\multirow}\oarg{vpos}\marg{nrows}\oarg{bigstruts}\marg{width}\oarg{fixup}\marg{text} +% \cmd{\multirow}\oarg{vpos}\marg{nrows}\oarg{bigstruts}\marg{width}\oarg{vmove}\marg{text} % \end{quote} % where % \begin{description} @@ -177,8 +179,8 @@ % be used, and \texttt{=} to indicate that the specified width of the column in % which the \cs{multirow} entry is set should be used. % -% \item[\meta{fixup}] is a length used for fine tuning: the text will be -% raised (or lowered, if \meta{fixup} is negative) by that length +% \item[\meta{vmove}] is a length used for fine tuning: the text will be +% raised (or lowered, if \meta{vmove} is negative) by that length % above (below) wherever it would otherwise have gone. % % \item[\meta{text}] is the actual text of the construct. If the width @@ -375,7 +377,7 @@ % can make about the height is the number of rows${}\times{}$the normal % height of a row. It tries to center the text in that space, but that space % is too low in this example. Therefore the text is at the top of the -% box. If you want it to be centered, you have to supply a \meta{fixup} +% box. If you want it to be centered, you have to supply a \meta{vmove} % parameter to shift it down. % \item We have used an \cs{extrarowheight}\footnote{This is only % available with the \Package{array} package, which \Package{tabulary} @@ -434,7 +436,7 @@ % % In this case the text would be centered somewhere in the % bottom row, which would make it stick out of the bottom. Therefore we -% applied a \meta{fixup} of 12mm. The \meta{fixup} usually requires some experimentation. +% applied a \meta{vmove} of 12mm. The \meta{vmove} usually requires some experimentation. % % \subsection{Fine Tuning} % \label{sec:fine-tuning} @@ -442,22 +444,61 @@ % If any of the spanned rows are unusually large, or if you're using the % \Package{bigstrut} package and \cs{bigstrut}s are used asymetrically about the % centerline of the spanned rows, the vertical centering may not come -% out right. Use the \meta{fixup} parameter in this case. +% out right. Use the \meta{vmove} parameter in this case. % % It's just about impossible to deal correctly with descenders. The % text will be set up centred, but it may then have a baseline that % doesn't match the baseline of the stuff beside it, in particular if % the stuff beside it has descenders and \meta{text} does not. This may % result in a small misalignment. About all that can be done is to do a -% final touchup on \meta{text}, using the fixup optional parameter. +% final touchup on \meta{text}, using the \meta{vmove} optional parameter. % (Hint: If you use a measure like \texttt{.1ex}, there's a reasonable -% chance that the fixup will still be correct if you change the point +% chance that the \meta{vmove} will still be correct if you change the point % size.) % % \cs{multirow} is mainly designed for use with \environment{tabular}, as % opposed to \environment{array}, environments. It might not work well in an % array environment if there are big formulas in some rows; in that case you can use the -% \meta{fixup} parameter to refine the result. +% \meta{vmove} parameter to refine the result. +% +% In some cases you might want to align the multirow entry with the top +% of the other row cells, for example if you have a large capital in it. +% when you use \meta{vpos} = \texttt{[t]}, the baselines will be +% aligned, which is the wrong thing in this case. You can then do the +% positioning with the \meta{vmove} parameter and let \LaTeX{} calculate +% the amount. For example: +% +% \begin{quote} +% \begin{verbatim} +% \usepackage{calc} +% \newlength{\shiftdown} +% \setlength{\shiftdown}{\heightof{\Huge\bfseries B}-\heightof{f}} +% . . . +% \begin{tabular}{cll} +% \toprule +% \multirow[t]{5}{*}[-\shiftdown]{\Huge\bfseries B} +% & foo & Lorem ipsum dolor sit \\ +% & bar & Maecenas sed purus \\ +% & baz & Nullam luctus id tellus \\ +% & qux & Aenean consequat commodo \\ +% \bottomrule +% \end{tabular} +% \end{verbatim} +% \end{quote} +% +% \begin{quote} +% \newlength{\shiftdown} +% \setlength{\shiftdown}{\heightof{\Huge\bfseries B}-\heightof{f}} +% \begin{tabular}{cll} +% \toprule +% \multirow[t]{5}{*}[-\shiftdown]{\Huge\bfseries B} +% & foo & Lorem ipsum dolor sit \\ +% & bar & Maecenas sed purus \\ +% & baz & Nullam luctus id tellus \\ +% & qux & Aenean consequat commodo \\ +% \bottomrule +% \end{tabular} +% \end{quote} % % If you use \cs{multirow} with the \Package{colortbl} package you have % \index{colortbl=\Package{colortbl}|usage} @@ -769,7 +810,7 @@ % specifies that it should cover 3 rows. However, the second row is not % the vertical center in this case because the third row is much taller. % -% To remedy this, the \meta{fixup} parameter could be used. However, in +% To remedy this, the \meta{vmove} parameter could be used. However, in % this case it would be easier to pretend that \cs{multirow} spans 6 % rows (the total number of lines in the last column). So use % \verb+\multirow{6}+\ldots{} and we get: @@ -1391,7 +1432,7 @@ % First collect all the parameters and replace missing optional parameters by their default values. % \changes{v1.8}{2016/09/14}{Add the optional first parameter \meta{vpos}.} % \begin{macrocode} -%% \multirow [vpos] {nrows} [bigstruts] {width} [fixup] {text} +%% \multirow [vpos] {nrows} [bigstruts] {width} [vmove] {text} \newcommand\multirow[2][c]{\@multirow[#1]{#2}} \def\@multirow[#1]#2{\@ifnextchar[{\@@multirow[#1]#2}{\@@multirow[#1]#2[0]}} \def\@@multirow[#1]#2[#3]#4{\@ifnextchar[{\@xmultirow[#1]{#2}[#3]{#4}}% @@ -1461,12 +1502,9 @@ \fi \fi % \end{macrocode} % Now position the \cs{vbox} properly. More details are given in the -% appendix. We set the depth of the \cs{vbox} -% to 0, so that it will not influence the depth of the current row. The -% overview of the shift amount can be found in section~\ref{sec:overview}. -% \begin{macrocode} - \dp0=\z@ -% \end{macrocode} +% appendix. The overview of the calculation of the shift amount can be +% found in section~\ref{sec:overview}. +% % If \meta{nrows}${}> 0$: \\ % If \meta{vpos} = \texttt{[t]}, then the box is already positioned % correctly (the baseline is on the baseline of the row). However, later @@ -1489,7 +1527,8 @@ \fi % \end{macrocode} % If \meta{nrows}${}< 0$: \\ -% If \meta{vpos} = \texttt{[t]}, shift the box up $\textrm{H} - \textrm{h1} -\textrm{h2} + \textrm{h}$. See fig.~\ref{fig:bot-t}.\\ +% If \meta{vpos} = \texttt{[t]}, shift the box up $\textrm{H} - +% \textrm{h1} -\textrm{h2} + \textrm{h}$. See fig.~\ref{fig:bot-t}.\\ % If \meta{vpos} = \texttt{[c]}, shift the box up $\textrm{H} - \textrm{h2}$. See fig.~\ref{fig:bot-c}.\\ % If \meta{vpos} = \texttt{[b]}, shift the box up H. See fig.~\ref{fig:bot-b}.\\ % H is the current value of \cs{multirow@dima}. @@ -1505,17 +1544,20 @@ \fi \fi % \end{macrocode} -% Finally, we add the \meta{fixup} parameter (\verb+#5+), and go into +% \changes{v2.1}{2016/10/11}{Set depth of final \cs{vbox} to 0, to +% prevent a tall multirow line to push the following rows downwards.} +% Finally, we add the \meta{vmove} parameter (\verb+#5+), and go into % horizontal mode. Then we shift the box up by putting a \cs{vskip} above it, % and add it to the output. Because of the \cs{vskip} the resulting box -% will have a height 0. \\ +% will have a height 0. We set the depth of the \cs{vbox} +% to 0, so that it will not influence the depth of the current row.\\ % If \cs{multirowdebug} is true, we show the box. % \begin{macrocode} \advance\multirow@dima#5\relax \leavevmode - \ifmultirowdebug\setbox0\vtop{\vskip-\multirow@dima\box0\vss}% - {\showboxdepth=5 \showboxbreadth=10 \showbox0}\box0 - \else\vtop{\vskip-\multirow@dima\box0\vss}\fi + \setbox0\vtop{\vskip-\multirow@dima\box0\vss}\dp0=\z@ + \ifmultirowdebug{\showboxdepth=5 \showboxbreadth=10 \showbox0}\fi + \box0 } % \end{macrocode} % \end{macro} @@ -1610,7 +1652,7 @@ % % In this section we explain the \cs{vbox} positioning in \cs{multirow}. % The positioning depends on the \meta{nrows}, \meta{vpos}, -% \meta{bigstruts} and \meta{fixup} parameters. The box is constructed with \cs{vtop}. The +% \meta{bigstruts} and \meta{vmove} parameters. The box is constructed with \cs{vtop}. The % algorithm of \cs{vtop} is described in \emph{The \TeX{}book}, p.~81. % % Each case is described by a figure. In the figure the lefthand column @@ -1637,8 +1679,8 @@ % h2 = $\textrm{depth of a tabular row} + \textrm{botstrut}$ % % Note: the following descriptions describe the vertical shift of the -% box without taking the \meta{fixup} into account. In all cases -% \meta{fixup} has to be added if it is given. +% box without taking the \meta{vmove} into account. In all cases +% \meta{vmove} has to be added if it is given. % % \subsection{Case \meta{nrows}${}> 0$} % @@ -1656,7 +1698,8 @@ % % Alternatively, we could have omitted the \cs{vskip} in this case, % thereby leaving the baseline undisturbed, but this would make the code -% unsymmetrical. Therefore we choose to set the shift amount to h here. +% unsymmetrical. Moreover, this would not work when a non-zero +% \meta{vmove} is present. Therefore we choose to set the shift amount to h here. % % \begin{figure}[htpb] % \centering |