diff options
author | Karl Berry <karl@freefriends.org> | 2016-09-27 21:06:23 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-09-27 21:06:23 +0000 |
commit | c14fe77571416f823736ed0c6deae5f4fc808b16 (patch) | |
tree | bbdc50477ca6b93b028e62c4f40ffbf5d3545b2b | |
parent | 56b3e6f789142cbecf567840f21d5525c0c50298 (diff) |
multirow (27sep16)
git-svn-id: svn://tug.org/texlive/trunk@42160 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/multirow/README | 43 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/multirow/miscdoc.sty | 108 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/multirow/multirow.pdf | bin | 289984 -> 604111 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/multirow/multirow.tex | 242 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/multirow/multirow.dtx | 1935 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/multirow/multirow.ins | 58 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/multirow/bigdelim.sty | 89 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/multirow/bigstrut.sty | 67 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/multirow/multirow.sty | 303 |
9 files changed, 2241 insertions, 604 deletions
diff --git a/Master/texmf-dist/doc/latex/multirow/README b/Master/texmf-dist/doc/latex/multirow/README index 51cd67a295a..75accccee51 100644 --- a/Master/texmf-dist/doc/latex/multirow/README +++ b/Master/texmf-dist/doc/latex/multirow/README @@ -1,15 +1,21 @@ - multirow.sty V1.6 version (5-May-2004) +multirow.sty V2.0 version (2016/09/27) +bigstruts.sty V2.0 version (2016/09/27) +bigdelim.sty V2.0 version (2016/09/27) - Author: Jerry Leichter <jerrold.leichter@smarts.com> - Piet van Oostrum <piet@cs.uu.nl> +Original Author: Jerry Leichter +Current Author: Piet van Oostrum <piet@vanoostrum.org> This file may be distributed under the terms of the LaTeX Project Public License, as described in lppl.txt in the base LaTeX distribution. Either version 1 or, at your option, any later version. +multirow.sty: + Make an entry that will span multiple rows of a table. -\multirow{nrows}[bigstruts]{width}[fixup]{text} +\multirow[vpos]{nrows}[bigstruts]{width}[fixup]{text} + +vpos is the vertical positioning: t. c. or b. nrows is the number of rows to span. It's up to you to leave the other rows empty, or the stuff created by \multirow will over-write it. @@ -24,15 +30,21 @@ bigstruts is mainly used if you've used bigstrut.sty. In that case it width is the width to which the text is to be set, or * to indicate that the text argument's natural width is to be used. - text is the actual text. If the width was set explicitly, the text will +text is the actual text. If the width was set explicitly, the text will be set in a parbox of that width; you can use \\ to force linebreaks where you like. - If the width was given as * the text will be set in LR mode. If you + If the width was given as * the text will be set in LR mode. If you want a multiline entry in this case you should use a tabular or array in the text parameter. - The text is centered vertically within the range spanned by nrows. + If the width is given as = the width will be taken from the + tabular column in which it appears. This only works for p{} + columns and similar, for example X columns in tabularx, and LCRJ + columns in tabulary. + + The text is centered vertically within the range spanned by nrows, + unless a vpos argument is given. fixup is a length used for fine tuning: The text will be raised (or lowered, if fixup is negative) by that length above (below) wherever @@ -110,4 +122,19 @@ Example: cccc & \\ dddd & \multirow{-3}*{bbbb}\\ \end{tabular} -
\ No newline at end of file + +bigstrut.sty: + +\bigstrut[pos] where pos is t or b + + Add a bit of space above, below, or both a tabular row. The amount + is determined by \bigstrutjot. + +bigdelim.sty: + +\ldelim({n}{width}[text] +\rdelim){n}{width}[text] + +Put a big delimiter over n rows in a tabular, optionally preceded +(\ldelim) or followed (rdelim) by text. + diff --git a/Master/texmf-dist/doc/latex/multirow/miscdoc.sty b/Master/texmf-dist/doc/latex/multirow/miscdoc.sty deleted file mode 100644 index f23796da2b8..00000000000 --- a/Master/texmf-dist/doc/latex/multirow/miscdoc.sty +++ /dev/null @@ -1,108 +0,0 @@ -\ProvidesPackage{miscdoc}[2010/01/20 v1.2 documentation macros misc latex pkgs] - -% miscdoc.sty -% Copyright 2010 Robin Fairbairns -% -% This work 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. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of LaTeX -% version 2005/12/01 or later. -% -% This work has the LPPL maintenance status `maintained'. -% -% The Current Maintainer of this work is Robin Fairbairns. -% -% This work consists of the file miscdoc.sty (only) - -\setcounter{errorcontextlines}{1274} - -% The package arose from a small exercise to document packages whose -% previous documentation consisted solely of comments in the package files. -% The macros here defined are lifted from the author's faq.sty -% (written for the UK TeX FAQ, CTAN:help/uk-tex-faq) or are inspired -% by others' work (credited where the author is known) ... except -% where they came as a flash of inspiration while actually writing the -% documentation. - -% this option suggested by Heiko Oberdiek, 2010-01-29 -\DeclareOption{hyper}{% - \AtEndOfPackage{% - \RequirePackage[pdfusetitle]{hyperref} - \RequirePackage{bookmark} - \bookmarksetup{numbered,open,openlevel=1} - } -} -\ProcessOptions\relax - -% note: T1 encoding assumed -\usepackage{lmodern} -\usepackage[T1]{fontenc} -\usepackage{booktabs} - -% from faq.sty -\newcommand\cs[1]{\texttt{\char`\\#1}} -\let\csx\cs -\def\bsbs{\cs{\char`\\}} - -% \cmdinvoke\cs<argument sequence> -% \cs typeset as above -% <argument sequence> may consist of optional or mandatory arguments; -% -% the `arguments' are simply typesett \texttt, as yet -- if something -% fancier is needed, there's a bunch of code needs rewriting here... -\DeclareRobustCommand\cmdinvoke{\@ifstar - {\let\@tempa\emph\@scmdinvoke}% - {\let\@tempa\relax\@scmdinvoke}% -} -\def\@scmdinvoke#1{\texttt{\symbol{92}#1}% - \futurelet\@let@token\@cmdinvoke -} -\def\@cmdinvoke{\ifx\@let@token\bgroup - \let\@tempb\@cmdinvoke@lbrace - \else - \ifx\@let@token[% ] - \let\@tempb\@cmdinvoke@lbrack - \else - \ifx\@let@token(% ) - \let\@tempb\@cmdinvoke@lparen - \else - \let\@tempb\@empty - \fi - \fi - \fi - \@tempb -} -\def\@cmdinvoke@lbrace#1{\penalty0\hskip0pt\relax - \texttt{\symbol{123}\@tempa{#1}\symbol{125}}% - \futurelet\@let@token\@cmdinvoke -} -\def\@cmdinvoke@lbrack[#1]{\penalty-150\hskip0pt\relax - \texttt{[\@tempa{#1}]}% - \futurelet\@let@token\@cmdinvoke -} -\def\@cmdinvoke@lparen(#1){\penalty-150\hskip0pt\relax - \texttt{(\@tempa{#1})}% - \futurelet\@let@token\@cmdinvoke -} -% and extension -- versions that take a single extra (delimiter) -% argument, such as \delcmdinvoke{lscrunge}( ... awful syntax, but... -\DeclareRobustCommand\delcmdinvoke{\@ifstar - {\let\@tempa\emph\@sdelcmdinvoke}% - {\let\@tempa\relax\@sdelcmdinvoke}% -} -\def\@sdelcmdinvoke#1#2{\texttt{\symbol{92}#1#2}% - \futurelet\@let@token\@cmdinvoke -} - -% sui generis -\newcommand\newitem{\par\addvspace{1ex}\noindent} - -% inspired by doc.sty in latex distribution -\newcommand\meta[1]{\ensuremath{\langle}\emph{#1}\ensuremath{\rangle}} - -% meaningful names, as in faq.sty -\let\environment\texttt -\let\Package\textsf diff --git a/Master/texmf-dist/doc/latex/multirow/multirow.pdf b/Master/texmf-dist/doc/latex/multirow/multirow.pdf Binary files differindex 947d7a41100..d1a20378433 100644 --- a/Master/texmf-dist/doc/latex/multirow/multirow.pdf +++ b/Master/texmf-dist/doc/latex/multirow/multirow.pdf diff --git a/Master/texmf-dist/doc/latex/multirow/multirow.tex b/Master/texmf-dist/doc/latex/multirow/multirow.tex deleted file mode 100644 index 66c14bfa66b..00000000000 --- a/Master/texmf-dist/doc/latex/multirow/multirow.tex +++ /dev/null @@ -1,242 +0,0 @@ -\documentclass[a4paper]{article} -\usepackage[a4paper]{geometry} -\usepackage{miscdoc,multirow,bigstrut,bigdelim,colortbl} -\newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}} - -\begin{document} -\title{The \Package{multirow}, - \Package{bigstrut} and - \Package{bigdelim} packages} -\author{Piet van Oostrum\thanks{catalogued ``active author''}\\ - \O{}ystein Bache\\ - Jerry Leichter\thanks{Documentation put together by Robin - Fairbairns}} -\maketitle - -\section{Introduction} -These packages offer a series of extensions to the standard \LaTeX{} -\texttt{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; -\item[\Package{bigdelim}] which creates an appropriately-sized - delimiter (for example, brace, parenthesis or bracket) to fit in a - single multirow, to indicate a relationship between other rows; and -\item[\Package{bigstrut}] which creates struts which (slightly) stretch - the table row in which they sit. -\end{description} - -\section{Using \Package{multirow}}\label{sec:multirow} - -The basic syntax is: -\begin{quote} - \cmdinvoke*{multirow}{nrows}[bigstruts]{width}[fixup]{text} -\end{quote} -where -\begin{description} -\item[\emph{nrows}] is the number of rows to span. It's up to you to - leave the other rows empty, or the stuff created by \cs{multirow} - will over-write it. With a positive value of \emph{nrows} the - spanned columns are this row and (\emph{nrows}-1) rows below - it. With a negative value of \emph{nrows} they are this row and - (1-\emph{nrows}) above it. -\item[\emph{bigstruts}] is mainly used if you've used the - \Package{bigstrut}. In that case it is the total number of uses of - \cs{bigstrut} within the rows being spanned. Count 2 uses for each - \cs{bigstrut}, 1 for each \cmdinvoke*{bigstrut}[x] where \emph{x} is - either \texttt{t} or \texttt{b}. The default is 0. -\item[\emph{width}] is the width to which the text is to be set, or - \texttt{*} to indicate that the text argument's natural width is to - be used. -\item[\emph{text}] is the actual text of the construct. If the width - was set explicitly, the text will be set in a \cs{parbox} of that - width; you can use \bsbs{} to force linebreaks where you like. - - 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 should use a - \texttt{tabular} or \texttt{array} environment in the text - parameter. -\item[\emph{fixup}] is a length used for fine tuning: the text will be - raised (or lowered, if \emph{fixup} is negative) by that length - above (below) wherever it would otherwise have gone. -\end{description} -For example (using both multirow and bigstrut): -\begin{quote} -\begin{verbatim} -\newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}} -\begin{tabular}{|c|c|} -\hline -\multirow{4}{1in}{Common g text} & Column g2a\\ - & Column g2b \\ - & Column g2c \\ - & Column g2d \\ -\hline -\multirow{3}[6]*{Common g text} & Column g2a\bigstrut\\\cline{2-2} - & Column g2b \bigstrut\\\cline{2-2} - & Column g2c \bigstrut\\ -\hline -\multirow{4}[8]{1in}{Common g text} & Column g2a\bigstrut\\\cline{2-2} - & Column g2b \bigstrut\\\cline{2-2} - & Column g2c \bigstrut\\\cline{2-2} - & Column g2d \bigstrut\\ -\hline -\multirow{4}*{\minitab[c]{Common \\ g text}} & Column g2a\\ - & Column g2b \\ - & Column g2c \\ - & Column g2d \\ -\hline -\end{tabular} -\end{verbatim} -\end{quote} -which will appear as: -\begin{quote} - \begin{tabular}{|c|c|} - \hline - \multirow{4}{1in}{Common g text} & Column g2a\\ - & Column g2b \\ - & Column g2c \\ - & Column g2d \\ - \hline - \multirow{3}[6]*{Common g text} & Column g2a\bigstrut\\\cline{2-2} - & Column g2b \bigstrut\\\cline{2-2} - & Column g2c \bigstrut\\ - \hline - \multirow{4}[8]{1in}{Common g text} & Column g2a\bigstrut\\\cline{2-2} - & Column g2b \bigstrut\\\cline{2-2} - & Column g2c \bigstrut\\\cline{2-2} - & Column g2d \bigstrut\\ - \hline - \multirow{4}*{\minitab[c]{Common \\ g text}} & Column g2a\\ - & Column g2b \\ - & Column g2c \\ - & Column g2d \\ - \hline - \end{tabular} -\end{quote} - -If any of the spanned rows are unusually large, or if you're using the -\Package{bigstrut} and \cs{bigstrut}s are used asymetrically about the -centerline of the spanned rows, the vertical centering may not come -out right. Use the fixup argument in this case. - -Just before \emph{text} is expanded, the \cs{multirowsetup} macro is -expanded to set up any special environment. Initially, -\cs{multirowsetup} contains just \cs{raggedright}. It may be -redefined with \cs{renewcommand}. - -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 \emph{text} does not. This may -result in a small misalignment. About all that can be done is to do a -final touchup on \emph{text}, using the fixup optional argument. -(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 -size.) - -\cs{multirow} is mainly designed for use with \environment{table}, as -opposed to \environment{array}, environments. It will not work well in an -array environment since the lines have an extra \texttt{jot} of space -between them which it won't account for. Fixing this is difficult in -general, and doesn't seem worth it. The \emph{bigstruts} argument may -be used to provide a semi-automatic fix: First set \cs{bigstrutjot} to -\texttt{.5}\cs{jot}. Then simply repeat \emph{nrows} as the bigstruts -argument. This will be close, but probably not exact; you can use the -fixup argument to refine the result. (If you do this repeatedly, -you'll probably want to wrap these steps up in a simple macro. Note -that the modified \cs{bigstrutjot} value will not give reasonable -results if you have bigstruts and use this argument for its intended -purpose elsewhere. In that case, you might want to set it locally.) - -If you use \cs{multirow} with the \Package{colortbl} package you have -to take precautions if you want to colour the column that has the -\cs{multirow} in it. \Package{colortbl} works by colouring each cell -separately. So if you use \cs{multirow} with a positive \emph{nrows} -value, \Package{colortbl} will first color the top cell, then -\cs{multirow} will typeset \emph{nrows} cells starting with this cell, -and later \Package{colortbl} will color the other cells, effectively -hiding the text in that area. This can be solved by putting the -\cs{multirow} in the last row with a negative \emph{nrows} value. -See, for example: -\begin{quote} -\begin{verbatim} -\begin{tabular}{l>{\columncolor{yellow}}l} - aaaa & \\ - cccc & \\ - dddd & \multirow{-3}*{bbbb}\\ -\end{tabular} -\end{verbatim} -\end{quote} -which will produce: -\begin{quote} - \begin{tabular}{l>{\columncolor{yellow}}l} - aaaa & \\ - cccc & \\ - dddd & \multirow{-3}*{bbbb}\\ - \end{tabular} -\end{quote} - -\section{Using \Package{bigstrut}} - -\cmdinvoke*{bigstrut}[x] produces a strut which is \cs{bigstrutjot} -(\texttt{2pt} by default) higher, lower, or both than the standard -array/table 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.'' - -Although you could use \cs{bigstrut} in an array, there isn't normally -much point since arrays are `opened up' by \cs{jot} anyway. - -\cmdinvoke{bigstrut}[t] adds height; \cmdinvoke{bigstrut}[b] adds -depth. Just \cs{bigstrut} adds both. So: Use -\cmdinvoke{bigstrut}[t] in the row just \emph{after} an \cs{hline}; -\cmdinvoke{bigstrut}[b] in the row just \emph{before}; and -\cs{bigstrut} if there are \cs{hline}s both before and after. - -Spaces after the \cs{bigstrut} are ignored, even if it has an optional -argument. Spaces before the \cs{bigstrut} are generally ignored (by a -single \unskip). - -Note: The \Package{multirow} package makes use of \cs{bigstrutjot}. If -both styles are used, they can be used in either order, as each checks -to see if the other has already defined \cs{bigstrutjot}. However, -the default values they set are different: if only \Package{multirow} -is used, \cs{bigstrutjot} will be set to \texttt{3pt}. If -\Package{bigstrut} is used, with or without \Package{multirow}, -\cs{bigstrutjot} will be \texttt{2pt}. - -\section{Using \Package{bigdelim}} - -The package is for working in a \environment{table} or \environment{array} -environment, in which the \Package{multirow} packages is also used. - -Syntax of use is -\begin{quote} - \delcmdinvoke*{ldelim}({n}{width}[text]\\ - \delcmdinvoke*{rdelim}){n}{width}[text] -\end{quote} -The commands are used in a column of a \environment{tabular} or -\environment{array}; they create a big parenthesis, brace or whatever -delimiter that extends over the \emph{n} rows starting at the one -containing the command. Corresponding cells in the following rows -must be explicitly given (as empty cells). - -The first parameter is a delimiter to be used, e.g., \cs{\char`\{} -\cs{\char`\}} \texttt{[} \texttt{]} \texttt{(} \texttt{)}\,---\,in fact, -anything that can be used with \cs{left} or \cs{right}, as appropriate. - -The optional \emph{text} is set centred to the left of \cs{ldelim} or -to the right of \cs{rdelim}. The \emph{width} is that reserved for -the delimiter and its text; with a current copy of the -\Package{multirow} package, the \emph{width} may be given as -\texttt{*}, but that may cause the delimiters to be too small. - -Also with a recent version of \Package{multirow} the commands may be -used in the last row of the extension with a negative \emph{n} -parameter. This is useful in combination with \Package{colortbl} (see -the discussion in section \ref{sec:multirow} on \Package{multirow}). -If there are unusually tall rows you may have to enlarge \emph{n} (you -can use non-integral values). - -\end{document} diff --git a/Master/texmf-dist/source/latex/multirow/multirow.dtx b/Master/texmf-dist/source/latex/multirow/multirow.dtx new file mode 100644 index 00000000000..aa814cbb627 --- /dev/null +++ b/Master/texmf-dist/source/latex/multirow/multirow.dtx @@ -0,0 +1,1935 @@ +% \iffalse meta-comment +% +% Parts of this file, Copyright (C) 1994 by Jerry Leichter +% Copyright (C) 2016 by Piet van Oostrum <piet@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. +% The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% \fi +% +% \iffalse +%<*driver> +\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 by Piet van Oostrum <piet@vanoostrum.org> +%% +% +% \begin{macrocode} +%<multirow|bigstrut|bigdelim>\NeedsTeXFormat{LaTeX2e} +%<multirow>\ProvidesPackage{multirow}% +%<bigstrut>\ProvidesPackage{bigstrut} +%<bigdelim>\ProvidesPackage{bigdelim} +%<multirow|bigstrut|bigdelim> [2016/09/27 v2.0 +%<multirow> Span multiple rows of a table]% +%<bigstrut> Provide larger struts in tabulars] +%<bigdelim> Create big delimiters in tabular or array] +% \end{macrocode} +% +%<*driver> +\documentclass[a4paper]{ltxdoc} +\usepackage[T1]{fontenc} +\usepackage{multirow,bigstrut,bigdelim,colortbl} +\usepackage{tabulary} +\usepackage{longtable} +\usepackage{booktabs} +\usepackage{url} +\usepackage{tikz} +\newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}} +\DisableCrossrefs +\CodelineIndex +\RecordChanges +\let\environment\texttt +\let\Package\textsf +\def\bsbs{\cs{\char`\\}} +\begin{document} + \DeleteShortVerb{\|} + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% \fi +% +% \CheckSum{440} +% +% \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 +% Lower-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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \changes{v1.7}{2016/09/13}{Give all the files the same version number} +% \changes{v2.0}{2016/09/27}{Release v2.0} +% +% \GetFileInfo{multirow.sty} +% +% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ } +% \DoNotIndex{\@ne} +% \DoNotIndex{\advance,\begingroup,\catcode,\closein} +% \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup} +% +% \title{The \Package{multirow}, +% \Package{bigstrut} and +% \Package{bigdelim} packages} +% \author{Piet van Oostrum\thanks{catalogued ``active author''}\\ +% \O ystein Bache\\ +% Jerry Leichter\thanks{Documentation originally put together by Robin +% Fairbairns}} +% +% \date{Released \filedate, version \fileversion} +% +% \maketitle +% +% \tableofcontents +% +% \section{Introduction} +% These packages offer a series of extensions to the standard \LaTeX{} +% \texttt{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; +% \item[\Package{bigstrut}] which creates struts which (slightly) stretch +% the table row in which they sit. +% \item[\Package{bigdelim}] which creates an appropriately-sized +% delimiter (for example, brace, parenthesis or bracket) to fit in a +% single multirow, to indicate a relationship between other rows; and +% \end{description} +% +% \section{Changes in version 2.0} +% \label{sec:changes-2} +% +% \begin{itemize} +% \item \cs{multirow} now has an first optional parameter \oarg{vpos}. +% \item The \meta{width} parameter can be specified as \texttt{=} to use +% the defined width of the column in which the \cs{multirow} appears. +% \item Optional prefix letters (\texttt{t}, \texttt{b}) for +% the \meta{bigstruts} parameter (see section~\ref{sect-refine-bigstrut}). +% \item Package option \texttt{debug}. +% \item Package option \texttt{longtable} to work around a bug in +% \Package{longtable}. See section~\ref{sec:use-with-longtable}. +% \item Package option \texttt{supertabular} to better support \Package{supertabular}. See +% section~\ref{sec:use-with-supertabular}. +% \item Better positioning in some cases. +% \item Lots of documentation. +% \item The distribution is now based on a \texttt{.dtx} file. +% \item Backwards compatible with v1.6. +% \end{itemize} +% +% \section{Using \Package{multirow}}\label{sec:multirow} +% +% \DescribeMacro{\multirow} +% \cs{multirow} sets a piece of text in a \environment{tabular} or +% similar environment, spanning multiple rows. We will call the block of +% 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. +% +% The basic syntax is: +% \begin{quote} +% \cmd{\multirow}\oarg{vpos}\marg{nrows}\oarg{bigstruts}\marg{width}\oarg{fixup}\marg{text} +% \end{quote} +% where +% \begin{description} +% \item[\meta{vpos}] defines the vertical positioning of the text in the multirow block. +% The default is \texttt{[c]} which means the text will be vertically centered. +% Other options are \texttt{[t]} for top alignment and \texttt{[b]} for bottom alignment. +% \item[\meta{nrows}] is the number of rows to span. You should +% leave the other rows empty at this column, otherwise the stuff created by \cs{multirow} +% will over-write it. With a positive value of \meta{nrows} the +% spanned columns are this row and (\meta{nrows}-1) rows below +% it. With a negative value of \meta{nrows} they are this row and +% (1-\meta{nrows}) above it. +% +% \item[\meta{bigstruts}] is mainly used if you've used the +% \Package{bigstrut} package. In that case it is the total number of uses of +% \cs{bigstrut} within the rows being spanned. Count 2 uses for each +% \cs{bigstrut}, 1 for each \cs{bigstrut}\oarg{x} where \meta{x} is +% either \texttt{t} or \texttt{b}. The default is 0. +% +% The \meta{bigstruts} parameter can optionally be preceded by a prefix +% letter \texttt{t}, \texttt{b} or \texttt{tb} for finer control. See +% section \ref{sect-refine-bigstrut} for details. The letter may be +% separated from the number by a space character. +% +% \item[\meta{width}] is the width to which the text is to be set. +% Special values are \texttt{*} to indicate that the text parameter's natural width is to +% 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 +% above (below) wherever it would otherwise have gone. +% +% \item[\meta{text}] is the actual text of the construct. If the width +% was set explicitly, the text will be set in a \cs{parbox} of that +% width; you can use \bsbs{} to force linebreaks where you like. +% +% 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 +% 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 +% column that has a defined width, for example in a \texttt{p\{\}} column, an +% \texttt{X} column in \environment{tabularx} or a \texttt{L}, \texttt{C}, +% \texttt{R} or \texttt{J} column in a \environment{tabulary} environment. +% The text will be set in a \cs{parbox} of that width. +% If you give ``\texttt{=}'' in other situations, you will get strange +% results (usually a too wide column). +% \end{description} +% +% N.B. \cs{multirow} can be used in the \environment{tabular} environment and +% most derivatives of it, for example \environment{tabularx}, +% \environment{tabulary}, \environment{supertabular}, +% \environment{xtab}, \environment{longtable}, \environment{tabu}, +% \environment{booktabs} and \environment{ctable}. For some of these you +% have to pay special attention to certain cases, see below. +% +% \DescribeMacro{\multirowsetup} +% Just before \meta{text} is expanded, the \cs{multirowsetup} macro is +% expanded to set up any special environment. Initially, +% \cs{multirowsetup} contains just \cs{raggedright}. It may be +% redefined with \cs{renewcommand}. +% +% If you want to use both \cs{multirow} and \cs{multicolumn} +% \index{multicolumn=\verb!*+\multicolumn+|usage} +% on the same entry, you must put the \cs{multirow} inside the \cs{multicolumn}. The other way around will not work. +% For example: +% \begin{verbatim} +% \multicolumn{2}{c}{\multirow{3}{*}{Multi-multi}} +% \end{verbatim} +% +% \subsection{Package Options} +% \label{sec:package-options} +% +% \DescribeMacro{multirowdebugtrue} +% \DescribeMacro{multirowdebugfalse} +% The following options are defined: +% \begin{description} +% \item[debug] +% This option causes information about multirow boxes +% to be written to the log file. This is done by the \TeX{} \cs{showbox} +% command. Note: this will cause the \LaTeX{} compilation to be considered +% failed, even if there is no real error. +% This option can also be activated anywhere in the document with the +% command \cs{multirowdebugtrue} and deactivated with +% \cs{multirowdebugfalse}. When such a command is placed just before a +% \cs{multirow}, it applies only to that specific \cs{multirow} entry. +% \item[longtable] +% The \texttt{longtable} option redefines the \cs{cline} macro to work +% around a bug in the \Package{longtable} package. See section \ref{sec:use-with-longtable}. +% \end{description} +% +%\subsection{Examples} +%\label{sec:examples} +% +% An example with both \Package{multirow} and \Package{bigstrut}): +% +% \begin{quote} +% \begin{verbatim} +% \newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}} +% \begin{tabular}{|c|c|} +% \hline +% \multirow{4}{1in}{Common g text} & Column g2a\\ +% & Column g2b \\ +% & Column g2c \\ +% & Column g2d \\ +% \hline +% \multirow{3}[6]*{Common g text} & Column g2a\bigstrut\\\cline{2-2} +% & Column g2b \bigstrut\\\cline{2-2} +% & Column g2c \bigstrut\\ +% \hline +% \multirow{4}[8]{1in}{Common g text, but a bit longer.} & +% Column g2a\bigstrut\\\cline{2-2} +% & Column g2b \bigstrut\\\cline{2-2} +% & Column g2c \bigstrut\\\cline{2-2} +% & Column g2d \bigstrut\\ +% \hline +% \multirow{4}*{\minitab[c]{Common \\ g text}} & Column g2a\\ +% & Column g2b \\ +% & Column g2c \\ +% & Column g2d \\ +% \hline +% \end{tabular} +% \end{verbatim} +% \end{quote} +% which will appear as: +% \begin{quote} +% \begin{tabular}{|c|c|} +% \hline +% \multirow{4}{1in}{Common g text} & Column g2a\\ +% & Column g2b \\ +% & Column g2c \\ +% & Column g2d \\ +% \hline +% \multirow{3}[6]*{Common g text} & Column g2a\bigstrut\\\cline{2-2} +% & Column g2b \bigstrut\\\cline{2-2} +% & Column g2c \bigstrut\\ +% \hline +% \multirow{4}[8]{1in}{Common g text, but a bit longer.} & +% Column g2a\bigstrut\\\cline{2-2} +% & Column g2b \bigstrut\\\cline{2-2} +% & Column g2c \bigstrut\\\cline{2-2} +% & Column g2d \bigstrut\\ +% \hline +% \multirow{4}*{\minitab[c]{Common \\ g text}} & Column g2a\\ +% & Column g2b \\ +% & Column g2c \\ +% & Column g2d \\ +% \hline +% \end{tabular} +% \quad +% \begin{tabular}{ll} +% \multirow{4}{*}{Normal case} & \\ +% & \\ +% & \\ +% & \\ +% \multirow{3}[6]*{With \cs{bigstrut}s and \texttt{*} as \meta{width}} & \bigstrut\\ +% & \bigstrut\\ +% & \bigstrut\\ +% \multirow{4}[8]{*}{With \cs{bigstrut}s and normal \meta{width}} & \bigstrut\\ +% & \bigstrut\\ +% & \bigstrut\\ +% & \bigstrut\\ +% \multirow{4}*{Multiline text in \cs{multirow}} & \\ +% & \\ +% & \\ +% & \\ +% \end{tabular} +% +% \end{quote} +% \vspace{1ex} +% An example with the ``\texttt{=}'' \meta{width} specifier in a +% \environment{tabulary} (Note: The braces around the \texttt{=} may be omitted): +% +% \begin{quote} +% \index{extrarowheight=\verb!*+\extrarowheight+|usage} +% \begin{verbatim} +% \setlength{\extrarowheight}{2pt} +% \begin{tabulary}{11cm}{|L|L|L|} +% \hline +% All human beings are born free and equal in dignity and rights. & +% \multirow{2}{=}{Everyone is entitled to all the rights and +% freedoms set forth in this Declaration, without distinction of +% any kind, such as race, colour, sex, language, religion, +% political or other opinion, national or social origin, property, +% birth or other status.} +% & Everyone has the right to life, liberty and security of person. \\ +% \cline{1-1}\cline{3-3} +% No one shall be held in slavery or servitude; slavery and the +% slave trade shall be prohibited in all their forms. & +% & No one shall be subjected to torture or to cruel, inhuman or +% degrading treatment or punishment. \\ +% \hline +% \end{tabulary} +% \end{verbatim} +% \end{quote} +% +% \begin{quote} +% \index{extrarowheight=\verb!*+\extrarowheight+|usage} +% \setlength{\extrarowheight}{2pt} +% \begin{tabulary}{11cm}{|L|L|L|} +% \hline +% All human beings are born free and equal in dignity and rights. & +% \multirow{2}{=}{Everyone is entitled to all the rights and +% freedoms set forth in this Declaration, without distinction of +% any kind, such as race, colour, sex, language, religion, +% political or other opinion, national or social origin, property, +% birth or other status.} +% & Everyone has the right to life, liberty and security of person. \\ +% \cline{1-1}\cline{3-3} +% No one shall be held in slavery or servitude; slavery and the +% slave trade shall be prohibited in all their forms. & +% & No one shall be subjected to torture or to cruel, inhuman or +% degrading treatment or punishment. \\ +% \hline +% \end{tabulary} +% \end{quote} +% +% A few observations about this example: +% \begin{enumerate} +% \item The middle column is the \cs{multirow}. You would expect it to +% be vertically centered, but it isn't. This is because \cs{multirow} +% doesn't know the height of the box. The only estimate \cs{multirow} +% 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} +% 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} +% includes automatically.} of 2pt, to make a bit room between the +% \cs{hline} and the following text. However, this is not applied to the +% \cs{multirow}, because this is thought to be centered. In this case +% you can give the \meta{vpos} parameter as \texttt{[t]}, in which case +% \cs{multirow} will do the proper positioning. +% \end{enumerate} +% +% Now with a negative \meta{nrows}. +% +% \begin{quote} +% \index{extrarowheight=\verb!*+\extrarowheight+|usage} +% \begin{verbatim} +% \setlength{\extrarowheight}{2pt} +% \begin{tabulary}{11cm}{|L|L|L|} +% \hline +% All human beings are born free and equal in dignity and rights. & +% & Everyone has the right to life, liberty and security of person. \\ +% \cline{1-1}\cline{3-3} +% No one shall be held in slavery or servitude; slavery and the +% slave trade shall be prohibited in all their forms. & +% \multirow{-2}{=}[12mm]{Everyone is entitled to all the rights and +% freedoms set forth in this Declaration, without distinction of +% any kind, such as race, colour, sex, language, religion, +% political or other opinion, national or social origin, property, +% birth or other status.} +% & No one shall be subjected to torture or to cruel, inhuman or +% degrading treatment or punishment. \\ +% \hline +% \end{tabulary} +% \end{verbatim} +% \end{quote} +% +% \begin{quote} +% \index{extrarowheight=\verb!*+\extrarowheight+|usage} +% \setlength{\extrarowheight}{2pt} +% \begin{tabulary}{11cm}{|L|L|L|} +% \hline +% All human beings are born free and equal in dignity and rights. & +% & Everyone has the right to life, liberty and security of person. \\ +% \cline{1-1}\cline{3-3} +% No one shall be held in slavery or servitude; slavery and the +% slave trade shall be prohibited in all their forms. & +% \multirow{-2}{=}[12mm]{Everyone is entitled to all the rights and +% freedoms set forth in this Declaration, without distinction of +% any kind, such as race, colour, sex, language, religion, +% political or other opinion, national or social origin, property, +% birth or other status.} +% & No one shall be subjected to torture or to cruel, inhuman or +% degrading treatment or punishment. \\ +% \hline +% \end{tabulary} +% \end{quote} +% +% 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. +% +% \subsection{Fine Tuning} +% \label{sec:fine-tuning} +% +% 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. +% +% 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. +% (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 +% 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. +% +% If you use \cs{multirow} with the \Package{colortbl} package you have +% \index{colortbl=\Package{colortbl}|usage} +% to take precautions if you want to colour the column that has the +% \cs{multirow} in it. The \Package{colortbl} package works by colouring each cell +% separately. So if you use \cs{multirow} with a positive \meta{nrows} +% value, \Package{colortbl} will first color the top cell, then +% \cs{multirow} will typeset \meta{nrows} cells starting with this cell, +% and later \Package{colortbl} will color the other cells, effectively +% hiding the text in that area. This can be solved by putting the +% \cs{multirow} in the last row with a negative \meta{nrows} value. +% See, for example: +% \begin{quote} +% \begin{verbatim} +% \begin{tabular}{l>{\columncolor{yellow}}l} +% aaaa & \\ +% cccc & \\ +% dddd & \multirow{-3}*{bbbb}\\ +% \end{tabular} +% \end{verbatim} +% \end{quote} +% which will produce: +% \begin{quote} +% \begin{tabular}{l>{\columncolor{yellow}}l} +% aaaa & \\ +% cccc & \\ +% dddd & \multirow{-3}*{bbbb}\\ +% \end{tabular} +% \end{quote} +% +% \subsection{Fine tuning the \meta{bigstruts} parameter} +% \label{sect-refine-bigstrut} +% +% \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 +% 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 +% information. This is done by prefixing the \meta{bigstruts} parameter +% with a letter (or two) indicating which of these two are present. +% +% See the following examples:\\ (in these examples we have +% \verb+\setlength{\bigstrutjot}{10pt}+ to make the effect clearly visible)\\[5mm] +% \begin{minipage}[c]{0.23\linewidth} +% \setlength{\bigstrutjot}{10pt} +% \begin{tabular}{|c|c|} +% \hline +% \multirow{3}[1]{*}{Multirow} & T \bigstrut[t] \\ +% \cline{2-2} +% & X \\ +% \cline{2-2} +% & B \\ +% \hline +% \end{tabular} \\[2mm] +% \begin{tabular}{|c|c|} +% \hline +% \multirow{3}[t 1]{*}{Multirow} & T \bigstrut[t] \\ +% \cline{2-2} +% & X \\ +% \cline{2-2} +% & B \\ +% \hline +% \end{tabular} +% \end{minipage} +% \begin{minipage}[c]{0.75\linewidth} +% \begin{verbatim} +% \begin{tabular}{|c|c|} +% \hline +% \multirow{3}[1]{*}{Multirow} & T \bigstrut[t] \\ +% \cline{2-2} +% & X \\ +% \cline{2-2} +% & B \\ +% \hline +% \end{tabular} +% \end{verbatim} +% \end{minipage} +% \\[5mm] +% In the top box in the above example the text ``Multirow'' should be centered, but it +% is a bit below the center, because of the \cs{bigstrut[t]} in the top +% row. We can correct this by giving the \meta{bigstruts} parameter as +% ``t 1'', indicating a bigstrut in the top. This is done in the bottom box, where +% \verb+\multirow{3}[t 1]{*}{Multirow}+ is used. +% +% A second example:\\[5mm] +% \begin{minipage}{0.23\linewidth} +% \setlength{\bigstrutjot}{10pt} +% \begin{tabular}{|c|c|} +% \hline +% & T \\ +% \cline{2-2} +% & X \\ +% \cline{2-2} +% \multirow[t]{-3}[1]{*}{Multirow} & B \bigstrut[b] \\ +% \hline +% \end{tabular} \\[2mm] +% \begin{tabular}{|c|c|} +% \hline +% & T \\ +% \cline{2-2} +% & X \\ +% \cline{2-2} +% \multirow[t]{-3}[b 1]{*}{Multirow} & B \bigstrut[b] \\ +% \hline +% \end{tabular} +% \end{minipage} +% \begin{minipage}{0.75\linewidth} +% \begin{verbatim} +% \begin{tabular}{|c|c|} +% \hline +% & T \\ +% \cline{2-2} +% & X \\ +% \cline{2-2} +% \multirow[t]{-3}[1]{*}{Multirow} & B \bigstrut[b] \\ +% \hline +% \end{tabular} +% \end{verbatim} +% \end{minipage} +% \\[5mm] +% In the top box the \verb+\multirow[t]+ should be positioned on the +% same height as the \texttt{T}, but it is too high, because there is a +% \cs{bigstrut} in the bottom. We can correct that by specifying the +% \meta{bigstruts} parameter as ``b 1'', i.e. using +% \verb+\multirow[t]{-3}[b 1]{*}{Multirow}+. +% \\[5mm] +% The possibilities for the prefix are: +% \begin{description} +% \item[\texttt{t}] There is a bigstrut in the top, i.e. a \cs{bigstrut} +% or \cs{bigstrut[t]} in the top row. +% \item[\texttt{b}] There is a bigstrut in the bottom, i.e. a \cs{bigstrut} +% or \cs{bigstrut[b]} in the bottom row. +% \item[\texttt{tb}] They are both present. Note: this cannot be given +% as \texttt{bt}. +% \end{description} +% The space between the letter(s) and the number is optional. +% Please note that the prefix does not depend on whether the +% \cs{multirow} is in the top or the bottom row. +% +% \subsection{Use with \Package{longtable}} +% \label{sec:use-with-longtable} +% +% \index{longtable=\environment{longtable}|usage} +% \index{longtabu=\environment{longtabu}|usage} +% It is possible to use \cs{multirow} in a \environment{longtable} +% environment (as well as in its descendent \environment{longtabu}). +% However, care must be taken that the longtable doesn't break the +% multirow entry when it is near the bottom of the page. For example: +% +% \noindent +% \begin{minipage}[t]{0.4\linewidth} +% \begin{longtable}{|l|l|l|} +% \ldots & \ldots & \ldots \\ +% \hline +% Sept. 21 & 09:00 & event 1 \\ +% \hline +% Sept. 22 & 10:00 & event 2 \\ +% \hline +% \multirow{3}*{Sept. 23} & 10:00 & event 3 \\ +% & 12:00 & event 4 \\ +% & 15:00 & event 5 \\ +% \hline +% Sept. 24 & 09:00 & event 6 \\ +% \hline +% \ldots & \ldots & \ldots \\ +% \end{longtable} +% \end{minipage} +% \begin{minipage}[t]{0.58\linewidth} +% \begin{verbatim} +% \begin{longtable}{|l|l|l|} +% \ldots & \ldots & \ldots \\ +% \hline +% Sept. 21 & 09:00 & event 1 \\ +% \hline +% Sept. 22 & 10:00 & event 2 \\ +% \hline +% \multirow{3}*{Sept. 23} & 10:00 & event 3 \\ +% & 12:00 & event 4 \\ +% & 15:00 & event 5 \\ +% \hline +% Sept. 24 & 09:00 & event 6 \\ +% \hline +% \ldots & \ldots & \ldots \\ +% \end{longtable} +% \end{verbatim} +% \end{minipage} +% +% In this case if the ``Sept. 23'' entry comes close to the bottom of the +% page, you want to prevent the pagebreak to occur in the middle of this +% entry. You can do this by ending the intermediate rows with \verb+\\*+ instead of \verb+\\+. +% +% \begin{verbatim} +% \multirow{3}*{Sept. 23} & 10:00 & event 3 \\* +% & 12:00 & event 4 \\* +% & 15:00 & event 5 \\ +% \end{verbatim} +% +% There is, however, a bug in \Package{longtable}, that causes the +% \verb+\\*+ not to work if it is followed by a \cs{cline}, like in the +% following example: +% +% \begin{verbatim} +% \multirow{3}*{Sept. 23} & 10:00 & event 3 \\* +% \cline{2-3} +% & 12:00 & event 4 \\* +% \cline{2-3} +% & 15:00 & event 5 \\ +% \end{verbatim} +% +% \Package{multirow} has a package option \texttt{longtable} that redefines +% \cs{cline} so that the \verb+\\*+ will also work when followed by +% \cs{cline}. The code comes from David Carlisle. +% +% \subsection{Use with \Package{supertabular}} +% \label{sec:use-with-supertabular} +% +% \index{supertabular=\environment{supertabular}|usage} +% \index{xtab=\environment{xtab}|usage} +% With the package \Package{supertabular} (or the augmented version +% \Package{xtab}) there is the same requirement +% to keep the rows of a multirow together when a pagebreak occurs. +% Unfortunately, \Package{supertabular} does not have a way to specify +% that a pagebreak should be suppressed. I.e. \verb+\\*+ does not +% suppress a pagebreak. +% Therefore \Package{multirow} provides a package option +% \texttt{supertabular} that redefines \verb+\\*+ inside a +% \environment{supertabular} to suppress the pagebreak. You should use +% this to end the intermediate rows in a multirow block. However, this +% does not cause \environment{supertabular} to consider breaking the +% page before the \cs{multirow}, contrary to \environment{longtable}. +% Thus the table may become too long. +% +% \DescribeMacro{\STneed} +% Therefore when the \texttt{supertabular} option is given, +% \Package{multirow} also provides a command \cs{STneed} to be used +% in a \environment{supertabular} that specifies how much space we need +% on the page. Then if there is not enough space, a pagebreak will occur +% at that place. For example: +% \begin{verbatim} +% \tabletail{\hline} +% \begin{supertabular}{|l|l|l|} +% \ldots & \ldots & \ldots \\ +% \hline +% Sept. 20 & 10:00 & event 1\\ +% \hline +% Sept. 21 & 10:00 & event 2\\ +% \hline +% Sept. 22 & 10:00 & event 3\\ +% \hline +% \STneed {2cm} +% \multirow{3}*{Sept. 23} & 10:00 & event 4\\* +% \cline{2-3} +% & 12:00 & event 5 \\* +% \cline{2-3} +% & 15:00 & event 6 \\ +% \hline +% Sept. 24 & 09:00 & event 7 \\ +% \hline +% \ldots & \ldots & \ldots \\ +% \end{verbatim} +% +% You will have to experiment a bit with the value to see +% what works. Sometimes it is better to exaggerate the required space a bit. +% +% \subsection{Dealing with tall entries} +% \label{sec:dealing-with-tall} +% +% Sometimes there are rows that are taller than what is expected. This +% section gives some hints how to deal with these situations. There are +% two cases: +% \begin{enumerate} +% \item When there is an exceptionally tall row outside of the multirow +% block the positioning of the \cs{multirow} might be wrong. This is +% because \cs{multirow} does not have information about the heights +% of the rows. This can happen for example when a large formula is +% entered in a cell, or a multi-line paragraph in a \texttt{[\{\}]} +% column. An example: +% +% \begin{quote} +% \begin{verbatim} +% \begin{tabular}{| l | l | p{4cm} |} +% \hline +% \multirow{3}*{Week 38} & Monday & Rain most of the day\\ +% \cline{2-3} +% & Tuesday & Sunny with some clouds\\ +% \cline{2-3} +% & Wednesday & A clear day with a lot of sunshine. +% However, the strong wind will bring down the +% temperature. \\ +% \hline +% \end{tabular} +% \end{verbatim} +% \end{quote} +% \begin{quote} +% \begin{tabular}{| l | l | p{4cm} |} +% \hline +% \multirow{3}*{Week 38} & Monday & Rain most of the day\\ +% \cline{2-3} +% & Tuesday & Sunny with some clouds\\ +% \cline{2-3} +% & Wednesday & A clear day with a lot of sunshine. +% However, the strong wind will bring down the +% temperature. \\ +% \hline +% \end{tabular} +% \end{quote} +% The \cs{multirow} is positioned on the second row, because it +% 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 +% 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: +% \begin{quote} +% \begin{tabular}{| l | l | p{4cm} |} +% \hline +% \multirow{6}*{Week 38} & Monday & Rain most of the day\\ +% \cline{2-3} +% & Tuesday & Sunny with some clouds\\ +% \cline{2-3} +% & Wednesday & A clear day with a lot of sunshine. +% However, the strong wind will bring down the +% temperature. \\ +% \hline +% \end{tabular} +% \end{quote} +% \item The second case is when the \cs{multirow} entry is taller than +% the surrounding normal rows. In that case the multirow text will stick +% out of its block. We must now enlarge the other rows, and that is +% something \cs{multirow} cannot do. +% +% An example: +% (Don't take this as a medical advice. The names are fake anyway.) +% \begin{verbatim} +% \begin{tabular}{| p{2mm} l | p{5cm} |} +% \hline +% \multicolumn{2}{|l|}{\textbf{Medicine \& dose}} +% & \textbf{Possible Side effects} \\ +% \hline +% \multicolumn{2}{|l|}{Spirino} +% & \multirow{3}={Confusion, +% hallucinations, rapid breathing, +% seizure (convulsions); +% upset stomach, heartburn; severe nausea, +% vomiting, or stomach pain or mild headache.} \\ +% \cline{1-2} +% & initial: 200 mg/day & \\ +% \cline{1-2} +% & maintenance: 100-400 mg/day & \\ +% \hline +% \multicolumn{2}{|l|}{Conzac} +% & \multirow{3}={Anxiety; nervousness; +% insomnia; anorexia; mild bradycardia; +% SA node slowing; weight loss; +% solar photosensitivity; hyponatremia; +% sexual dysfunction (both genders); may +% alter glycemic control in diabetic patients.} \\ +% \cline{1-2} +% & initial: 10 mg/day & \\ +% \cline{1-2} +% & maintenance: 10-40 mg/day & \\ +% \hline +% \end{tabular} +% \end{verbatim} +% \begin{tabular}{| p{2mm} l | p{5cm} |} +% \hline +% \multicolumn{2}{|l|}{\textbf{Medicine \& dose}} +% & \textbf{Possible Side effects} \\ +% \hline +% \multicolumn{2}{|l|}{Spirino} +% & \multirow{3}={Confusion, +% hallucinations, rapid breathing, +% seizure (convulsions); +% upset stomach, heartburn; severe nausea, +% vomiting, or stomach pain or mild headache.} \\ +% \cline{1-2} +% & initial: 200 mg/day & \\ +% \cline{1-2} +% & maintenance: 100-400 mg/day & \\ +% \hline +% \multicolumn{2}{|l|}{Conzac} +% & \multirow{3}={Anxiety; nervousness; +% insomnia; anorexia; mild bradycardia; +% SA node slowing; weight loss; +% solar photosensitivity; hyponatremia; +% sexual dysfunction (both genders); may +% alter glycemic control in diabetic patients.} \\ +% \cline{1-2} +% & initial: 10 mg/day & \\ +% \cline{1-2} +% & maintenance: 10-40 mg/day & \\ +% \hline +% \end{tabular} +% \\[2cm] +% Both \cs{multirow} entries are too high; the first sticks out into the +% second entry, and the second one sticks out of the table. +% +% There are two ways we can correct this: +% The simplest would be to add extra empty rows to cover the overlapping +% space. For the first entry that would be 2 extra rows; for the second +% 4. So we add twice \verb+ & & \\+ before the third \verb+\hline+, +% and four of these before the last \verb+\hline+. +% This gives us just the correct table: +% \\[5mm] +% \begin{tabular}{| p{2mm} l | p{5cm} |} +% \hline +% \multicolumn{2}{|l|}{\textbf{Medicine \& dose}} +% & \textbf{Possible Side effects} \\ +% \hline +% \multicolumn{2}{|l|}{Spirino} +% & \multirow{3}={Confusion, +% hallucinations, rapid breathing, +% seizure (convulsions); +% upset stomach, heartburn; severe nausea, +% vomiting, or stomach pain or mild headache.} \\ +% \cline{1-2} +% & initial: 200 mg/day & \\ +% \cline{1-2} +% & maintenance: 100-400 mg/day & \\ +% & & \\ +% & & \\ +% \hline +% \multicolumn{2}{|l|}{Conzac} +% & \multirow{3}={Anxiety; nervousness; +% insomnia; anorexia; mild bradycardia; +% SA node slowing; weight loss; +% solar photosensitivity; hyponatremia; +% sexual dysfunction (both genders); may +% alter glycemic control in diabetic patients.} \\ +% \cline{1-2} +% & initial: 10 mg/day & \\ +% \cline{1-2} +% & maintenance: 10-40 mg/day & \\ +% & & \\ +% & & \\ +% & & \\ +% & & \\ +% \hline +% \end{tabular} +% +% The second way is to stretch the normal rows vertically, such that +% they fit with the multirow entry. In this table, where the font size +% is 10pt, each row has a total +% height of 12pt. For the first entry we need 24pt extra (2 rows), +% Because this space must be divided over 3 rows that is 8pt per row, +% making the total height of the row 20pt. +% The normal row has a height of 8.4pt and a depth of 3.6pt (total +% 12pt). We can add 4pt on the top and 4pt on the bottom, or any other +% combination that adds up to 8pt. In this case I have chosen to make +% the height 12pt and the depth 8pt. We do this with a \cs{rule} with 0 width. +% \DescribeMacro{\mystrut} +% \verb+\newcommand{\mystrut}{\rule[-8pt]{0pt}{20pt}}+ +% and put \cs{mystrut} in each of the first 3 rows. By defining your own +% struts you have complete control over the layout. You can choose to +% give some rows more space than others, or to put all the space is the +% last row, for example. +% +% For the second entry we need 48pt extra (4 rows). We will use +% \cs{bigstrut} in each row, that is 16pt per row, and as a \cs{bigstrut} is +% 2\cs{bigstrutjot}s, we set \cs{bigstrutjot} to 8pt. The +% \Package{booktabs} package adds some extra vertical space around the rules, +% therefore when using the normal \environment{tabular} environment, it +% is probably better to make the struts a little bit bigger, or a bit +% smaller with \Package{booktabs}. After some experimentation it appeared +% that a \cs{bigstrutjot} of \texttt{7pt} was enough. Of course we added +% the \meta{bigstruts} parameter of \texttt{[tb6]} to the second +% multirow. Please note that this is not possible with our own struts, +% unless we cheat. +% +% \index{booktabs=\environment{booktabs}|usage} +% Now with \Package{booktabs} the code becomes: +% \begin{verbatim} +% \newcommand{\mystrut}{\rule[-8pt]{0pt}{20pt}} +% \setlength{\bigstrutjot}{7pt} +% \begin{tabular}{ p{2mm} l p{5cm} } +% \toprule +% \multicolumn{2}{l}{\textbf{Medicine \& dose}} +% & \textbf{Possible Side effects} \\ +% \cmidrule(r){1-2} \cmidrule(l){3-3} +% \multicolumn{2}{l}{Spirino} \mystrut +% & \multirow{3}={Confusion, +% hallucinations, rapid breathing, +% seizure (convulsions); +% upset stomach, heartburn; severe nausea, +% vomiting, or stomach pain or mild headache.} \\ +% \cmidrule(r){1-2} +% & initial: 200 mg/day \mystrut & \\ +% \cmidrule(r){1-2} +% & maintenance: 100-400 mg/day \mystrut & \\ +% \midrule +% \multicolumn{2}{l}{Conzac} \bigstrut +% & \multirow{3}[tb6]={Anxiety; nervousness; +% insomnia; anorexia; mild bradycardia; +% SA node slowing; weight loss; +% solar photosensitivity; hyponatremia; +% sexual dysfunction (both genders); may +% alter glycemic control in diabetic patients.} \\ +% \cmidrule(r){1-2} +% & initial: 10 mg/day \bigstrut & \\ +% \cmidrule(r){1-2} +% & maintenance: 10-40 mg/day \bigstrut & \\ +% \bottomrule +% \end{tabular} +% \end{verbatim} +% +% \newcommand{\mystrut}{\rule[-8pt]{0pt}{20pt}} +% \setlength{\bigstrutjot}{7pt} +% \begin{tabular}{ p{2mm} l p{5cm} } +% \toprule +% \multicolumn{2}{l}{\textbf{Medicine \& dose}} +% & \textbf{Possible Side effects} \\ +% \cmidrule(r){1-2} \cmidrule(l){3-3} +% \multicolumn{2}{l}{Spirino} \mystrut +% & \multirow{3}={Confusion, +% hallucinations, rapid breathing, +% seizure (convulsions); +% upset stomach, heartburn; severe nausea, +% vomiting, or stomach pain or mild headache.} \\ +% \cmidrule(r){1-2} +% & initial: 200 mg/day \mystrut & \\ +% \cmidrule(r){1-2} +% & maintenance: 100-400 mg/day \mystrut & \\ +% \midrule +% \multicolumn{2}{l}{Conzac} \bigstrut +% & \multirow{3}[tb6]={Anxiety; nervousness; +% insomnia; anorexia; mild bradycardia; +% SA node slowing; weight loss; +% solar photosensitivity; hyponatremia; +% sexual dysfunction (both genders); may +% alter glycemic control in diabetic patients.} \\ +% \cmidrule(r){1-2} +% & initial: 10 mg/day \bigstrut & \\ +% \cmidrule(r){1-2} +% & maintenance: 10-40 mg/day \bigstrut & \\ +% \bottomrule +% \end{tabular} +% \end{enumerate} +% +% \section{Using \Package{bigstrut}} +% +% \DescribeMacro{\bigstrut} +% \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 +% \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.'' +% +% Although you could use \cs{bigstrut} in an array, there isn't normally +% much point since arrays are `opened up' by \cs{jot} anyway. +% +% \cs{bigstrut[t]} adds height; \cs{bigstrut[b]} adds +% depth. Just \cs{bigstrut} adds both. So: Use +% \cs{bigstrut[t]} in the row just \emph{after} an \cs{hline}; +% \cs{bigstrut[b]} in the row just \emph{before}; and +% \cs{bigstrut} if there are \cs{hline}s both before and after. +% +% Spaces after the \cs{bigstrut} are ignored, even if it has an optional +% parameter. Spaces before the \cs{bigstrut} are generally ignored (by a +% single \cs{unskip}). +% +% \DescribeMacro{\bigstrutjot} +% Note: The \Package{multirow} package makes use of \cs{bigstrutjot}. If +% both packages are used, they can be used in either order, as each checks +% to see if the other has already defined \cs{bigstrutjot}. However, +% the default values they set are different: if only \Package{multirow} +% is used, \cs{bigstrutjot} will be set to \texttt{3pt}. +% If \Package{bigstrut} is used, with or without \Package{multirow}, +% \cs{bigstrutjot} will be \texttt{2pt}. +% +% \section{Using \Package{bigdelim}} +% +% The package is for working in a \environment{tabular} or \environment{array} +% environment, in which the \Package{multirow} package is also used. +% +% \DescribeMacro{\ldelim} +% \DescribeMacro{\rdelim} +% Syntax of use is +% \begin{quote} +% \cs{ldelim} ( \marg{n}\marg{width}\oarg{text}\\ +% \cs{rdelim} ) \marg{n}\marg{width}\oarg{text} +% \end{quote} +% The commands are used in a column of a \environment{tabular} or +% \environment{array}; they create a big parenthesis, brace or whatever +% delimiter that extends over the \meta{n} rows starting at the one +% containing the command. Corresponding cells in the following rows +% must be explicitly given as empty cells. +% +% The first parameter is a delimiter to be used, e.g., \cs{\char`\{} +% \cs{\char`\}} \texttt{[} \texttt{]} \texttt{(} \texttt{)}\,---\,in fact, +% anything that can be used with \cs{left} or \cs{right}, as appropriate. +% +% Here is an example: +% \begin{quote} +% \begin{verbatim} +% \begin{equation} +% \begin{array}{ccccccc} +% \ldelim({4}{4mm} & x & x & x & x & \rdelim){4}{4mm} \\ +% & x & x & x & x & & i \\ +% & x & x & x & x & & j \\ +% & x & x & x & x & \\ +% & & u & v & & +% \end{array} +% \end{equation} +% \end{verbatim} +% \end{quote} +% +% \begin{quote} +% \begin{equation} +% \begin{array}{ccccccc} +% \ldelim({4}{4mm} & x & x & x & x & \rdelim){4}{4mm} \\ +% & x & x & x & x & & i \\ +% & x & x & x & x & & j \\ +% & x & x & x & x & \\ +% & & u & v & & +% \end{array} +% \end{equation} +% \end{quote} +% +% When \cs{ldelim} is used, the optional \meta{text} is set centred to the left of \cs{ldelim}. +% If \cs{rdelim} is used it is set to the right of \cs{rdelim}. The +% \meta{width} parameter is the space that is reserved for +% the delimiter and its text; as with the +% \Package{multirow} package, the \meta{width} may be given as +% \texttt{*}. Compare for example these: +% \begin{quote} +% \begin{minipage}{0.6\linewidth} +% \begin{verbatim} +% \begin{tabular}{p{2em}l} +% \ldelim\{{3}{*}[type] & dvi \\ +% & ps \\ +% & pdf \\ +% \end{tabular} +% \end{verbatim} +% \end{minipage} +% \begin{minipage}{0.35\linewidth} +% \begin{tabular}{p{2em}l} +% \ldelim\{{3}{*}[type] & dvi \\ +% & ps \\ +% & pdf \\ +% \end{tabular} +% \\[2ex] +% \end{minipage} +% +% \begin{minipage}{0.6\linewidth} +% \begin{verbatim} +% \begin{tabular}{l@{\,}l} +% \ldelim\{{3}{*}[type] & dvi \\ +% & ps \\ +% & pdf \\ +% \end{tabular} +% \end{verbatim} +% \end{minipage} +% \begin{minipage}{0.35\linewidth} +% \begin{tabular}{l@{\,}l} +% \ldelim\{{3}{*}[type] & dvi \\ +% & ps \\ +% & pdf \\ +% \end{tabular} +% \\[2ex] +% \end{minipage} +% \end{quote} +% In the first example we cheated: by using a column width that is too +% small, we swallowed up some of the intercolumn space, at the cost of +% an ``Overfull \cs{hbox}'' message. In the second example we did it the +% proper way by inserting \verb+@{\,}+ to replace the default +% intercolumn space with a narrow space. +% +% Also the commands may be +% used in the last row of the extension with a negative \meta{n} +% \index{colortbl=\Package{colortbl}|usage} +% parameter. This is useful in combination with \Package{colortbl} (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 non-integral 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. +% +% 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} +% \begin{verbatim} +% \begin{tabular}{l@{}l@{}l} +% dvi & \rdelim\}{3}{1em} & \multirow{3}{4cm}{These are the output types, +% that are commonly used for \TeX.} \\ +% ps & & \\ +% pdf & & \\ +% \end{tabular} +% \end{verbatim} +% \end{quote} +% \begin{quote} +% \begin{tabular}{l@{}l@{}l} +% dvi & \rdelim\}{3}{1em} & \multirow{3}{4cm}{These are the output types, +% that are commonly used for \TeX.} \\ +% ps & & \\ +% pdf & & \\ +% \end{tabular} +% \end{quote} +% Note that we used \texttt{@\{\}} to eliminate the intercolumn space to get the text tight to the brace. +% \StopEventually{% +% \PrintChanges +% \PrintIndex} +% +% \section{Implementation} +% +% +%\subsection{The \Package{multirow} package} +%\label{sec:pack-multirow} +% \iffalse +%<*multirow> +% \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.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} +% 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 +% (\cs{leavevmode} added)} +% \changes{multirow v1.4}{}{modified by Piet van Oostrum to check for the special case that +% the width is given as an *. In this case the natural +% width of the text parameter will be used and the parameter +% is processed in LR-mode.} +% \changes{multirow v1.5}{}{modified by Piet 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 +% \texttt{\cs{advance}\cs{multirow@dima}\#4}} +% +% \changes{v1.9a}{2016/09/23}{Implement the \texttt{debug} option.} +% +% \begin{macro}{\ifmultirowdebug} +% \begin{macro}{\multirowdebugtrue} +% \begin{macro}{\multirowdebugfalse} +% This is a boolean to [de]activate debugging (showing the generated box +% contents). It is activated by the \texttt{debug} package option. The +% \cs{newif} initializes it to false. +% \begin{macrocode} +\newif\ifmultirowdebug +\DeclareOption{debug}{\multirowdebugtrue} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \changes{v1.9b}{2016/09/24}{Implement the \texttt{longtable} option.} +% \begin{macro}{\cline} +% The package option \texttt{longtable} redefines the \cs{cline} macro to +% work around a bug in \Package{longtable}. See section \ref{sec:use-with-longtable}\footnote{% +% Thanks to David Carlisle. See +% \url{http://tex.stackexchange.com/questions/52100/longtable-multirow-problem-with-cline-and-nopagebreak#answer-52101} }. +% \begin{macrocode} +\DeclareOption{longtable}{% +\AtBeginDocument{% +\def\@cline#1-#2\@nil{% + \omit + \@multicnt#1% + \advance\@multispan\m@ne + \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi + \@multicnt#2% + \advance\@multicnt-#1% + \advance\@multispan\@ne + \leaders\hrule\@height\arrayrulewidth\hfill + \cr + \noalign{\nobreak\vskip-\arrayrulewidth}} +}} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.9b}{2016/09/26}{Implement the \texttt{supertabular} option +% and the \cs{STneed} command.} +% The package option \texttt{supertabular} redefines \verb+\\*+ inside a +% \environment{supertabular}. +% The redefinition is delayed until the \verb+\begin{document}+. +% \begin{macrocode} +\DeclareOption{supertabular}{% +\AtBeginDocument{% +% \end{macrocode} +% \begin{macro}{\ST@tabularcr} +% 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. +% \begin{macrocode} +\def\ST@tabularcr{% + {\ifnum0=`}\fi + \@ifstar{\MRST@xtabularcr}{\ST@xtabularcr}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\MRST@xtabularc} +% \begin{macro}{\MRST@argtabularc} +% \begin{macro}{\MRST@xargtabularc} +% \begin{macro}{\MRST@yargtabularc} +% These are copies of the corresponding macros from +% \Package{supertabular}, but instead of \cs{ST@cr} they call \cs{MRST@cr}. +% \begin{macrocode} +\def\MRST@xtabularcr{% + \@ifnextchar[%] + {\MRST@argtabularcr}% + {\ifnum0=`{\fi}\cr\MRST@cr}} +\def\MRST@argtabularcr[#1]{% + \ifnum0=`{\fi}% + \ifdim #1>\z@ + \unskip\MRST@xargarraycr{#1} + \else + \MRST@yargarraycr{#1}% + \fi} +\def\MRST@xargarraycr#1{% + \@tempdima #1\advance\@tempdima \dp \@arstrutbox + \vrule \@height\z@ \@depth\@tempdima \@width\z@ \cr + \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}. +% \begin{macrocode} +\def\STneed#1{\ifdim\ST@pageleft<#1\ST@newpage\ST@next\fi} +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% +% \cs{multirow@colwidth} is a length that is used to implement the ``\texttt{=}'' variant of \meta{width}. +% +% \changes{v1.9}{2016/09/15}{Implement the ``\texttt{!=}'' option for \cs{multirow}'s \meta{width} parameter.} +% \begin{macro}{\multirow@colwidth} +% \cs{multirow@colwidth} is a length that is used to implement the ``\texttt{=}'' variant of \meta{width}. +% \begin{macrocode} +\newlength{\multirow@colwidth} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.9}{2016/09/15}{Give \Package{multirow} its own temp +% registers, so that we can safely pass the box height to \Package{bigdelim}.} +% \begin{macro}{\multirow@cnta} +% \begin{macro}{\multirow@cntb} +% \begin{macro}{\multirow@dima} +% Define two counters and a length for internal use in \cs{multirow}. +% \begin{macrocode} +\newcount\multirow@cnta +\newcount\multirow@cntb +\newlength\multirow@dima +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\multirow@setcolwidth} +% This macro calculates \cs{multirow@colwidth} for an entry that has the +% \meta{width} given as ``\texttt{=}''. We check if we are inside a +% \environment{tabulary} environment, by checking if \cs{TY@final} is defined. +% If not, then \cs{multirow@colwidth} = \cs{hsize}. The \environment{tabulary} +% environment will make two passes. On the first pass, we set \cs{multirow@colwidth} +% to the size that the text would have in LR mode (with newlines replaced +% by spaces), so that \environment{tabulary} will gives us enough space. +% On the second pass (characterized by \cs{TY@box} = \cs{TY@box@v}) we use +% the value that \environment{tabulary} has given us in \cs{hsize}. +% This algorithm is not perfect, but good enough in most cases. +% \begin{macrocode} +\def\multirow@setcolwidth#1{% + \ifx\TY@final\@undefined \multirow@colwidth=\hsize + \else + \ifx\TY@box\TY@box@v\multirow@colwidth=\hsize + \else \setbox0\hbox + {\let\\\space\let\newline\space #1}\multirow@colwidth=\wd0 + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\multirowsetup} +% \cs{multirowsetup} is executed at the beginning of each \cs{multirow}. +% \begin{macrocode} +\newcommand\multirowsetup{\raggedright} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\multirow@vbox} +% This creates the \cs{vbox}. Parameters:\\ +% \texttt{\#1} = \meta{vpos}, \texttt{\#2} = initialization code (for +% example to set the width of the \cs{parbox}), \texttt{\#3} = box contents.\\ +% Depending on the \meta{vpos} parameter, it will be top-aligned, +% vertically centered, or bottom-aligned. This is done by inserting +% \cs{vfill} in the proper places.\\ +% Note: the \cs{relax} is to protect against an empty \meta{vpos} +% parameter. +% \begin{macrocode} +\long\def\multirow@vbox#1#2#3{\setbox0\vtop to \multirow@dima{#2% + \if #1t\relax\else\vfill\fi + \multirowsetup #3\if #1b\relax\else\vfill\fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\multirow} +% Make an entry that will span multiple rows of a table.\\ +% 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} +\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}}% + {\@xmultirow[#1]{#2}[#3]{#4}[0pt]}} +% \end{macrocode} +% \changes{v1.9a}{2016/09/23}{Add the optional prefix to the \meta{bigstruts} parameter.} +% \begin{macro}{\multirow@piii} +% \begin{macro}{\ifmultirow@prefixt} +% \begin{macro}{\multirow@prefixttrue} +% \begin{macro}{\multirow@prefixtfalse} +% \begin{macro}{\ifmultirow@prefixb} +% \begin{macro}{\multirow@prefixbtrue} +% \begin{macro}{\multirow@prefixbfalse} +% This macro splits off a \texttt{t}, \texttt{b}, or \texttt{tb} prefix +% of the \meta{bigstruts} parameter, and sets \cs{multirow@cntb} to +% the numerical value. The prefix is remembered in two booleans: +% \cs{ifmultirow@prefixt} and \cs{ifmultirow@prefixb}. +% \begin{macrocode} +\newif\ifmultirow@prefixt +\newif\ifmultirow@prefixb +\def\multirow@piii#1#2#3\end{\multirow@prefixtfalse\multirow@prefixbfalse + \if t#1\multirow@prefixttrue + \if b#2\multirow@prefixbtrue \multirow@cntb=#3% + \else \multirow@cntb=#2#3% + \fi + \else + \if b#1\multirow@prefixbtrue \multirow@cntb=#2#3% + \else \multirow@cntb=#1#2#3% + \fi + \fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% This is the real workhorse. It starts with splitting the +% \meta{bigstruts} parameter, and then calculating the height of the multirow box. +% \meta{nrows} is saved in \cs{multirow@cnta}. +% \begin{macrocode} +\def\@xmultirow[#1]#2[#3]#4[#5]#6{\multirow@cnta=#2% + \expandafter\multirow@piii#3\relax\end% + \multirow@dima=\multirow@cnta\ht\@arstrutbox + \advance\multirow@dima\multirow@cnta\dp\@arstrutbox + \ifnum\multirow@cnta<0\multirow@dima=-\multirow@dima\fi + \advance\multirow@dima \multirow@cntb\bigstrutjot +% \end{macrocode} +% \changes{v1.9a}{2016/09/23}{Redo the \cs{vbox} calculation and positioning.} +% The text is set in a \cs{vbox} by calling \cs{multirow@vbox}. \\ +% If the \meta{width} parameter is \texttt{*} set just the text in the \cs{vbox}. +% \begin{macrocode} + \if*#4\multirow@vbox{#1}{}{\hbox{\strut#6\strut}}% +% \end{macrocode} +% Otherwise set it in a \cs{parbox} inside a \cs{vbox}. \\ +% If the \meta{width} parameter is given as ``\texttt{=}'', we calculate +% \cs{multirow@colwidth} and use that as width of the \cs{parbox}. +% \begin{macrocode} + \else \if=#4\multirow@setcolwidth{#6}% + \multirow@vbox{#1}{\hsize\multirow@colwidth\@parboxrestore}{\strut#6\strut\par}% +% \end{macrocode} +% Otherwise the given parameter is used as the width of the \cs{parbox}. +% \begin{macrocode} + \else \multirow@vbox{#1}{\hsize#4\@parboxrestore}{\strut#6\strut\par}% + \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} +% 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 +% the top of the box will be taken as the reference point (instead +% of the baseline), therefore we take +% the height of the box (h) as the shift amount. See fig.~\ref{fig:top-t}.\\ +% If \meta{vpos} = \texttt{[c]} we shift it up h1 (see fig.~\ref{fig:top-c}), where h1 = \cs{ht}\cs{@arstrutbox} +% + (\cs{bigstrutjot} \cs{ifmultirow@prefixt}).\\ +% If \meta{vpos} = \texttt{[b]} we shift it up h1 + h2 (see fig.~\ref{fig:top-b}), where h2 = \cs{dp}\cs{@arstrutbox} +% + (\cs{bigstrutjot} \cs{ifmultirow@prefixb}).\\ +% We calculate the required shift in \cs{multirow@dima}. +% \begin{macrocode} + \ifnum\multirow@cnta>0 + \if#1t\relax\multirow@dima=\ht0\else + \multirow@dima=\ht\@arstrutbox + \ifmultirow@prefixt \advance\multirow@dima\bigstrutjot\fi + \if#1b\relax \advance\multirow@dima\dp\@arstrutbox + \ifmultirow@prefixb \advance\multirow@dima\bigstrutjot\fi + \fi + \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{[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}. +% \begin{macrocode} + \else + \if#1b\relax\else + \advance\multirow@dima-\dp\@arstrutbox + \ifmultirow@prefixb \advance\multirow@dima-\bigstrutjot\fi + \if#1t\relax\advance\multirow@dima-\ht\@arstrutbox + \ifmultirow@prefixt \advance\multirow@dima-\bigstrutjot\fi + \advance\multirow@dima\ht0 + \fi + \fi + \fi +% \end{macrocode} +% Finally, we add the \meta{fixup} 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. \\ +% 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 +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\bigstrutjot} +% Define \cs{bigstrutjot} if not already defined. +% \begin{macrocode} +\@ifundefined{bigstrutjot}{\newdimen\bigstrutjot \bigstrutjot=\jot}{} +% \end{macrocode} +% \end{macro} +% \iffalse +%</multirow> +% \fi +% +% \subsection{The \Package{bigstrut} package} +% \label{sec:pack-bigstrut} +% +% \iffalse +%<*bigstrut> +% \fi +% \changes{bigstrut v1.0}{1994/05/31}{Initial version} +% \begin{macro}{\bigstrutjot} +% This is a length. By default it is set to 2pt. You can change it +% with the \cs{setlength} command. +% \begin{macrocode} +\@ifundefined{bigstrutjot}{\newdimen\bigstrutjot}{}\bigstrutjot=2pt +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bigstrut} +% This macro inserts a strut. Depending on the optional parameter it extends +% above and/or below the standard array/tabular strut. +% \begin{macrocode} +\newcommand\bigstrut[1][x]{% + \unskip\@tempdima=\ht\@arstrutbox \@tempdimb=\dp\@arstrutbox + \ifx #1b\relax \else \advance\@tempdima by \bigstrutjot\fi + \ifx #1t\relax \else \advance\@tempdimb by \bigstrutjot\fi + \hbox{\vrule \@height\@tempdima \@depth\@tempdimb \@width\z@}\ignorespaces} +% \end{macrocode} +% \end{macro} +% +% \iffalse +%</bigstrut> +% \fi +% +% \subsection{The \Package{bigdelim} package} +% \label{sec:pack-bigdelim} +% \iffalse +%<*bigdelim> +% \fi +% \changes{bigdelim v0.0}{1994/10/02}{bigbrace.sty by \O ystein Bache} +% \changes{bigdelim v1.0}{1999/11/05}{Initial version bigdelim.sty} +% \begin{macrocode} +\RequirePackage{multirow} +% \end{macrocode} +% \begin{macro}{\ldelim} +% This macro typesets a left delimiter. It calls \cs{multirow} with the proper parameters. +% 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}. +% \begin{macrocode} +\newcommand\ldelim[3]{\@ifnextchar[{\@ldelim{#1}{#2}{#3}}{\@ldelim{#1}{#2}{#3}[\null]}} +\def\@ldelim#1#2#3[#4]% + {\multirow{#2}{#3}{% + \ensuremath + {\left.\vcenter{\hsize=0pt\vrule height \multirow@dima width 0pt}% + \textrm{#4}\right#1}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\rdelim} +% This macro typesets a right delimiter. It calls \cs{multirow} with the +% proper parameters, similar to \cs{ldelim}. +% \begin{macrocode} +\newcommand\rdelim[3]{\@ifnextchar[{\@rdelim{#1}{#2}{#3}}{\@rdelim{#1}{#2}{#3}[\null]}} +\def\@rdelim#1#2#3[#4]% + {\multirow{#2}{#3}{% + \ensuremath + {\left#1\vcenter{\hsize=0pt\vrule height \multirow@dima width 0pt}% + \textrm{#4}\right.}}} +% \end{macrocode} +% \end{macro} +% \iffalse +%</bigdelim> +% \fi +% +% \appendix +% +% \section{Appendix} +% \label{sec:appendix} +% +% \index{vbox=\verb!*+\vbox+|usage} +% +% 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 +% 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 +% indicates the context of the tabular in which the multirow appears, +% i.e \meta{nrows} rows. The righthand column is the multirow box that +% is to be inserted. The baseline is the natural position where the material will be +% positioned in the first place. Later it will be shifted up +% to the desired location. +% +% H is the calculated height of the box: $\meta{nrows} \times +% \textrm{the natural height of a row} + \meta{bigstruts} \times +% \mathrm{\cs{bigstrutjot}} $. +% +% {topstrut} = \cs{bigstrutjot} if there is a \cs{bigstrut} on the top of +% the first row (as indicated by the \texttt{t} prefix in the +% \meta{bigstruts} parameter), otherwise 0. +% +% {botstrut} = \cs{bigstrutjot} if there is a \cs{bigstrut} on bottom of +% the last row (as indicated by the \texttt{b} prefix in the +% \meta{bigstruts} parameter), otherwise 0. +% +% h1 = $\textrm{height of a tabular row} + \textrm{topstrut}$ +% +% 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. +% +% \subsection{Case \meta{nrows}${}> 0$} +% +% \subsubsection*{\meta{vpos} = [t]} +% +% In this case the \cs{vbox} contains the text followed by a \cs{vfill}. +% Such a \cs{vbox} has a height that is the height of the top line of +% the text (h). H = height + depth of the box. This means that the box is +% already positioned correctly. However, later we will put the box +% inside another \cs{vbox}, with a \cs{vskip} on to of it, and this will +% make the top of the box its reference point. Therefore we will +% have to shift it up again over a distance h +% (which probably will be different from the height of the tabular row). +% So the total shift becomes h. See fig.~\ref{fig:top-t}. +% +% 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. +% +% \begin{figure}[htpb] +% \centering +% \begin{tikzpicture} +% \draw (2, -0.5) rectangle (5,4.5); +% \foreach \y in {0,...,4} \draw (2, \y) -- (5, \y); +% \draw (0, 4.2) node (topstrut) {topstrut}; +% \draw[->] (topstrut) -- (2, 4.2); +% \draw (0, -0.25) node (botstrut) {botstrut}; +% \draw[->] (botstrut) -- (2, -0.25); +% \draw[<->] (5.3, -0.5) -- (5.3, 4.5); +% \draw (5.5, 2) node {H}; +% \draw (0, 3.3) node (baseline) {baseline}; +% \draw[dashed] (1.7, 3.3) -- (5.9, 3.3); +% \draw[<->] (5.5, 3.3) -- (5.5, 4.5); +% \draw (5.9, 3.9) node {h1}; +% +% \draw (6.5, 4) rectangle (9.5, -1); +% \draw[<->] (9.7, -1) -- (9.7, 4); +% \draw (10, 1.5) node {H}; +% \draw[<->] (10, 3.3) -- (10, 4); +% \draw (10.3, 3.7) node {h}; +% \draw[fill=lightgray] (6.6, 1) rectangle (9.4, 3.9); +% \draw (8, 0) node[align=center] {\cs{vfill}}; +% \draw (8, 2) node[align=center] {text}; +% \draw[draw=gray] (6.6, 3) -- (9.4, 3); +% \draw[dashed] (6.2, 3.3) -- (9.8, 3.3); +% \draw[->, line width=4pt, draw=gray] (8, 3.3) -- (8, 4); +% \end{tikzpicture} +% \caption{Case \meta{nrows}${}> 0$, \meta{vpos} = [t]} +% \label{fig:top-t} +% \end{figure} +% +% \subsubsection*{\meta{vpos} = [c]} +% +% In this case the \cs{vbox} contains a \cs{vfill}, the text, and another \cs{vfill}. +% Such a \cs{vbox} has a height 0, i.e. the top of the box is on the +% baseline. Because both boxes have the same size (H), they can be +% aligned by shifting the \cs{vbox} up over h1. See fig.~\ref{fig:top-c}. +% +% \begin{figure}[htpb] +% \centering +%\begin{tikzpicture} +% \draw (2, -0.5) rectangle (5,4.5); +% \foreach \y in {0,...,4} \draw (2, \y) -- (5, \y); +% \draw (0, 4.2) node (topstrut) {topstrut}; +% \draw[->] (topstrut) -- (2, 4.2); +% \draw (0, -0.25) node (botstrut) {botstrut}; +% \draw[->] (botstrut) -- (2, -0.25); +% \draw[<->] (5.3, -0.5) -- (5.3, 4.5); +% \draw (5.5, 2) node {H}; +% \draw (0, 3.3) node (baseline) {baseline}; +% \draw[dashed] (1.7, 3.3) -- (5.9, 3.3); +% \draw[<->] (5.5, 3.3) -- (5.5, 4.5); +% \draw (5.9, 3.9) node {h1}; +% +% \draw (6.5, 3.3) rectangle (9.5, -1.7); +% \draw[<->] (9.7, -1.7) -- (9.7, 3.3); +% \draw (10, 0.8) node {H}; +% \draw[fill=lightgray] (6.6, -0.5) rectangle (9.4, 2.1); +% \draw (8, 2.7) node[align=center] {\cs{vfill}}; +% \draw (8, 0.8) node[align=center] {text}; +% \draw (8, -1) node[align=center] {\cs{vfill}}; +% \draw[->, line width=4pt, draw=gray] (8, 3.3) -- (8, 4.5); +% \draw[draw=gray] (6.5, 4.5) -- (9.5, 4.5); +% \end{tikzpicture} +% \caption{Case \meta{nrows}${}> 0$, \meta{vpos} = [c]} +% \label{fig:top-c} +% \end{figure} +% +% \subsubsection*{\meta{vpos} = [b]} +% +% Now the \cs{vbox} contains a \cs{vfill}, followed by the text. +% Because it ends with the text, it gets an additional depth equal to +% the depth of the last line of the text. +% Such a \cs{vbox} has a height 0, i.e. the top of the box is on the +% baseline, but its depth is H + that depth. In other words the baseline +% of the last text line is H below the top. +% +% Because \meta{vpos} = \texttt{[b]} we want the baseline of the last +% textline to shift to the baseline of the last tabular row. The amount +% of the shift is h1 + h2. See fig.~\ref{fig:top-b}. +% +% \begin{figure}[htpb] +% \centering +%\begin{tikzpicture} +% \draw (2, -0.5) rectangle (5,4.5); +% \foreach \y in {0,...,4} \draw (2, \y) -- (5, \y); +% \draw (0, 4.2) node (topstrut) {topstrut}; +% \draw[->] (topstrut) -- (2, 4.2); +% \draw (0, -0.25) node (botstrut) {botstrut}; +% \draw[->] (botstrut) -- (2, -0.25); +% \draw[<->] (5.3, -0.5) -- (5.3, 4.5); +% \draw (5.5, 2) node {H}; +% \draw (0, 3.3) node (baseline) {baseline}; +% \draw[dashed] (1.7, 3.3) -- (5.9, 3.3); +% \draw[<->] (5.5, 3.3) -- (5.5, 4.5); +% \draw (5.9, 3.9) node {h1}; +% \draw[<->] (5.5, -0.5) -- (5.5, 0.3); +% \draw (5.9, -0.1) node {h2}; +% +% \draw (6.5, 3.3) rectangle (9.5, -2.1); +% \draw[<->] (9.7, -1.7) -- (9.7, 3.3); +% \draw (10, 0.8) node {H}; +% \draw[fill=lightgray] (6.6, -2) rectangle (9.4, 1); +% \draw (8, 2) node[align=center] {{\cs{vfill}}}; +% \draw (8, -0.5) node[align=center] {text}; +% \draw (0, 0.3) node (baseline) {baseline}; +% \draw[dashed] (6.3, -1.7) -- (10, -1.7); +% \draw (3.5, -1.7) node (baseline) {baseline of last text line}; +% \draw[dashed] (1.7, 0.3) -- (10, 0.3); +% \draw[->, line width=4pt, draw=gray] (8.5, -1.7) -- (8.5, 0.3); +% \end{tikzpicture} +% \caption{Case \meta{nrows}${}> 0$, \meta{vpos} = [b]} +% \label{fig:top-b} +% \end{figure} +% +% \subsection{Case \meta{nrows}${}<0$} +% +% \meta{nrows}${}<0$ when the multirow is positioned in the last row of +% the multirow block. +% +% \subsubsection*{\meta{vpos} = [t]} +% +% In this case the \cs{vbox} contains the text followed by a \cs{vfill}. +% Such a \cs{vbox} has a height that is the height of the top line of +% the text. The baseline is aligned with the baseline of the last row. +% Because \meta{vpos} = [t], we want it to be aligned with the baseline +% of the first row. Therefore it has to be shifted up $\textrm{H} - +% \textrm{h1} - \textrm{h2}$. But because later the height of the box +% will be set to 0, we must also add the current height h. Therefore the +% total shift becomes $\textrm{H} - \textrm{h1} - \textrm{h2} + +% \textrm{h}$. See fig.~\ref{fig:bot-t}. +% +% \begin{figure}[htpb] +% \centering +% \begin{tikzpicture} +% \draw (2, -0.5) rectangle (5,4.5); +% \foreach \y in {0,...,4} \draw (2, \y) -- (5, \y); +% \draw (0, 4.2) node (topstrut) {topstrut}; +% \draw[->] (topstrut) -- (2, 4.2); +% \draw (0, -0.25) node (botstrut) {botstrut}; +% \draw[->] (botstrut) -- (2, -0.25); +% \draw[<->] (5.3, -0.5) -- (5.3, 4.5); +% \draw (5.5, 2) node {H}; +% \draw (0, 3.3) node (baseline) {baseline}; +% \draw[dashed] (1.7, 3.3) -- (9, 3.3); +% \draw[<->] (5.5, 3.3) -- (5.5, 4.5); +% \draw (5.9, 3.9) node {h1}; +% \draw[<->] (5.5, -0.5) -- (5.5, 0.3); +% \draw (5.9, -0.1) node {h2}; +% \draw (0, 0.3) node (baseline) {baseline}; +% \draw[dashed] (1.7, 0.3) -- (5.9, 0.3); +% +% \draw (6.5, 1) rectangle (9.5, -4); +% \draw[<->] (9.7, -4) -- (9.7, 1); +% \draw (10, -1.5) node {H}; +% \draw[<->] (10, 0.3) -- (10, 1); +% \draw (10.3, 0.7) node {h}; +% \draw[fill=lightgray] (6.6, -2) rectangle (9.4, 0.9); +% \draw (8, -3) node[align=center] {\cs{vfill}}; +% \draw (8, -1) node[align=center] {text}; +% \draw[draw=gray] (6.6, 0) -- (9.4, 0); +% \draw[dashed] (6.2, 0.3) -- (10.3, 0.3); +% \draw[->, line width=4pt, draw=gray] (8, 0.3) -- (8, 3.3); +% \end{tikzpicture} +% \caption{Case \meta{nrows}${} < 0$, \meta{vpos} = [t]} +% \label{fig:bot-t} +% \end{figure} +% +% \subsubsection*{\meta{vpos} = [c]} +% +% In this case the \cs{vbox} contains a \cs{vfill}, the text, and another \cs{vfill}. +% Such a \cs{vbox} has a height 0, i.e. the top of the box is on the +% baseline. Because both boxes have the same size (H), they can be +% aligned by shifting the \cs{vbox} up over $\textrm{H} - \textrm{h2}$. +% See fig.~\ref{fig:bot-c}. +% +% \begin{figure}[htpb] +% \begin{tikzpicture} +% \draw (2, -0.5) rectangle (5,4.5); +% \foreach \y in {0,...,4} \draw (2, \y) -- (5, \y); +% \draw (0, 4.2) node (topstrut) {topstrut}; +% \draw[->] (topstrut) -- (2, 4.2); +% \draw (0, -0.25) node (botstrut) {botstrut}; +% \draw[->] (botstrut) -- (2, -0.25); +% \draw[<->] (5.3, -0.5) -- (5.3, 4.5); +% \draw (5.5, 2) node {H}; +% \draw (0, 3.3) node {baseline}; +% \draw[dashed] (1.7, 3.3) -- (5.8, 3.3); +% \draw[<->] (5.5, 3.3) -- (5.5, 4.5); +% \draw (5.9, 3.9) node {h1}; +% \draw[<->] (5.5, -0.5) -- (5.5, 0.3); +% \draw (5.9, -0.1) node {h2}; +% \draw (0, 0.3) node {baseline}; +% \draw[dashed] (1.7, 0.3) -- (5.9, 0.3); +% +% \draw (6.5, 0.3) rectangle (9.5, -4.7); +% \draw[<->] (9.7, -4.7) -- (9.7, 0.3); +% \draw (10, -3.2) node {H}; +% \draw[fill=lightgray] (6.6, -3.5) rectangle (9.4, -0.9); +% \draw (8, -0.3) node[align=center] {\cs{vfill}}; +% \draw (8, -2.2) node[align=center] {text}; +% \draw (8, -4) node[align=center] {\cs{vfill}}; +% \draw[->, line width=4pt, draw=gray] (8, 0.3) -- (8, 4.5); +% \draw[draw=gray] (6.5, 4.5) -- (9.5, 4.5); +% \end{tikzpicture} +% \caption{Case \meta{nrows}${} < 0$, \meta{vpos} = [c]} +% \label{fig:bot-c} +% \end{figure} +% +% \subsubsection*{\meta{vpos} = [b]} +% +% The \cs{vbox} contains a \cs{vfill}, followed by the text. +% Because it ends with the text, it gets an additional depth equal to +% the depth of the last line of the text. +% Such a \cs{vbox} has a height 0, i.e. the top of the box is on the +% baseline, but its depth is H + that depth. In other words the baseline +% of the last text line is H below the top. +% +% Because \meta{vpos} = \texttt{[b]} we want the baseline of the last +% textline to shift to the baseline of the last tabular row. The amount +% of the shift is H. See fig.~\ref{fig:bot-b}. +% +% \begin{figure}[htpb] +% \begin{tikzpicture} +% \draw (2, -0.5) rectangle (5,4.5); +% \foreach \y in {0,...,4} \draw (2, \y) -- (5, \y); +% \draw (0, 4.2) node (topstrut) {topstrut}; +% \draw[->] (topstrut) -- (2, 4.2); +% \draw (0, -0.25) node (botstrut) {botstrut}; +% \draw[->] (botstrut) -- (2, -0.25); +% \draw[<->] (5.3, -0.5) -- (5.3, 4.5); +% \draw (5.5, 2) node {H}; +% \draw (0, 3.3) node {baseline}; +% \draw[dashed] (1.7, 3.3) -- (5.8, 3.3); +% \draw[<->] (5.5, 3.3) -- (5.5, 4.5); +% \draw (5.9, 3.9) node {h1}; +% \draw[<->] (5.5, -0.5) -- (5.5, 0.3); +% \draw (5.9, -0.1) node {h2}; +% \draw (0, 0.3) node {baseline}; +% \draw[dashed] (1.7, 0.3) -- (5.9, 0.3); +% +% \draw (6.5, 0.3) rectangle (9.5, -5.1); +% \draw[<->] (9.7, -4.7) -- (9.7, 0.3); +% \draw (10, -3.2) node {H}; +% \draw[fill=lightgray] (6.6, -5) rectangle (9.4, -2); +% \draw (8, -1) node[align=center] {{vfill}}; +% \draw (8, -3.5) node[align=center] {text}; +% \draw (0, 0.3) node (baseline) {baseline}; +% \draw[dashed] (1.7, 0.3) -- (10, 0.3); +% \draw[dashed] (6.3, -4.7) -- (10, -4.7); +% \draw (3.5, -4.7) node {baseline of last text line}; +% \draw[->, line width=4pt, draw=gray] (8.5, -4.7) -- (8.5, 0.3); +% \end{tikzpicture} +% \caption{Case \meta{nrows}${} < 0$, \meta{vpos} = [b]} +% \label{fig:bot-b} +% \end{figure} +% +% \subsection{Overview} +% \label{sec:overview} +% +% \begin{tabular}{| l | l | l |} +% \hline +% \meta{vpos} & \meta{nrows} > 0 & \meta{nrows} < 0 \\ +% \hline +% \texttt{[t]} & h & $\textrm{H} - \textrm{h1} -\textrm{h2} + \textrm{h}$ \\ +% \texttt{[c]} & h1 & $\textrm{H} - \textrm{h2}$ \\ +% \texttt{[b]} & h1 + h2 & H \\ +% \hline +% & x & $\textrm{H} - \textrm{h1} -\textrm{h2} + x$ \\ +% \hline +% \end{tabular} +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/multirow/multirow.ins b/Master/texmf-dist/source/latex/multirow/multirow.ins new file mode 100644 index 00000000000..1d103af45b9 --- /dev/null +++ b/Master/texmf-dist/source/latex/multirow/multirow.ins @@ -0,0 +1,58 @@ +%% +%% Copyright (C) 2016 by Piet van Oostrum <piet@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. The latest version of this +%% license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% + +\input docstrip.tex +\keepsilent + +\usedir{tex/latex/multirow} + +\preamble + +This is a generated file. + +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. The latest version of this +license is in: + + http://www.latex-project.org/lppl.txt + +and version 1.3 or later is part of all distributions of LaTeX version +2005/12/01 or later. + +\endpreamble + +\askforoverwritefalse +\generate{\file{multirow.sty}{\from{\jobname.dtx}{multirow}}} +\generate{\file{bigstrut.sty}{\from{\jobname.dtx}{bigstrut}}} +\generate{\file{bigdelim.sty}{\from{\jobname.dtx}{bigdelim}}} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* multirow.sty *} +\Msg{* bigstrut.sty *} +\Msg{* bigdelim.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file \jobname.dtx *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile diff --git a/Master/texmf-dist/tex/latex/multirow/bigdelim.sty b/Master/texmf-dist/tex/latex/multirow/bigdelim.sty index 72eda5ae2df..52ad8f2fb09 100644 --- a/Master/texmf-dist/tex/latex/multirow/bigdelim.sty +++ b/Master/texmf-dist/tex/latex/multirow/bigdelim.sty @@ -1,68 +1,43 @@ -% bigdelim.sty -% version 1.0 -% Nov 5, 1999 -% Piet van Oostrum <piet@cs.uu.nl> -% From bigbrace.sty : Oct 2, 1994 \Oystein Bache <bache@kjemi.unit.no> -% from: \dobrace by piet@cs.ruu.nl (Piet van Oostrum): %% -%% This file may be distributed under the terms of the LaTeX Project Public -%% License, as described in lppl.txt in the base LaTeX distribution. -%% Either version 1 or, at your option, any later version. +%% This is file `bigdelim.sty', +%% generated with the docstrip utility. %% -% -% Usage in a tabular or array: -% \usepackage{multirow} -% \usepackage{bigdelim} -% \ldelim({n}{w}[text] -% \rdelim){n}{w}[text] -% Use these commands in a column of a tabular or array. They generate a big -% parenthesis/brace extending over the next n rows (including this one). -% The corresponding entries in the next rows must explicitely be given as -% empty cells. The first parameter must be the delimiter to be used, e.g. -% \{ \} [ ] ( ), in fact any parameter that can be used with \left and -% \right. The text is optional and is set centered to the left of -% \ldelim and to the right of \rdelim. w must be the width reserved for -% the brace and text. If you have a recent version of multirow.sty {w} may -% be given as {*}, but this may cause the braces to be too small. Also with -% a recent version of multirow.sty the commands may be used in the last row -% of the extension with a negative n parameter. This is useful in -% combination with the colortbl package (see multirow.sty) -% If there are unusually large rows you may have to enlarge n (you can use -% non-integral values). -% If you have horizontal lines that interact with the braces you are -% advised to use the hhline package to make the lines. - -\def\ldelim#1#2#3{\@ifnextchar[{\@ldelim{#1}{#2}{#3}}{\@ldelim{#1}{#2}{#3}[\null]}} +%% The original source files were: +%% +%% multirow.dtx (with options: `bigdelim') +%% +%% This is a generated file. +%% +%% 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. The latest version of this +%% license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +%% Copyright (C) 1994 by \O ystein Bache +%% Copyright (C) 2016 by Piet van Oostrum <piet@vanoostrum.org> +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{bigdelim} + [2016/09/27 v2.0 + Create big delimiters in tabular or array] +\RequirePackage{multirow} +\newcommand\ldelim[3]{\@ifnextchar[{\@ldelim{#1}{#2}{#3}}{\@ldelim{#1}{#2}{#3}[\null]}} \def\@ldelim#1#2#3[#4]% {\multirow{#2}{#3}{% \ensuremath - {\left.\vcenter{\hsize=0pt\vrule height - \ifnum #2<0 -\fi#2\baselineskip width 0pt}% + {\left.\vcenter{\hsize=0pt\vrule height \multirow@dima width 0pt}% \textrm{#4}\right#1}}} -% -\def\rdelim#1#2#3{\@ifnextchar[{\@rdelim{#1}{#2}{#3}}{\@rdelim{#1}{#2}{#3}[\null]}} +\newcommand\rdelim[3]{\@ifnextchar[{\@rdelim{#1}{#2}{#3}}{\@rdelim{#1}{#2}{#3}[\null]}} \def\@rdelim#1#2#3[#4]% {\multirow{#2}{#3}{% \ensuremath - {\left#1\vcenter{\hsize=0pt\vrule height - \ifnum #2<0 -\fi#2\baselineskip width 0pt}% + {\left#1\vcenter{\hsize=0pt\vrule height \multirow@dima width 0pt}% \textrm{#4}\right.}}} -% \endinput -% -% Example: -\documentclass{article} -\usepackage{multirow} -\usepackage{bigdelim} -\begin{document} - -\begin{equation} - \begin{array}{ccccccc} - \ldelim({4}{4mm}& x & x & x & x &\rdelim){4}{4mm} \\ - & x & x & x & x & & i\\ - & x & x & x & x & & j\\ - & x & x & x & x & \\ - & & u & v & & - \end{array} -\end{equation} -\end{document} +%% +%% End of file `bigdelim.sty'. diff --git a/Master/texmf-dist/tex/latex/multirow/bigstrut.sty b/Master/texmf-dist/tex/latex/multirow/bigstrut.sty index 900e30895ad..379c581190a 100644 --- a/Master/texmf-dist/tex/latex/multirow/bigstrut.sty +++ b/Master/texmf-dist/tex/latex/multirow/bigstrut.sty @@ -1,41 +1,36 @@ %% -%% bigstrut.sty V1.0 (31-May-94) +%% This is file `bigstrut.sty', +%% generated with the docstrip utility. %% -%% Author: Jerry Leichter <jerrold.leichter@smarts.com> +%% The original source files were: %% -%% V1.0 Split out as a separate style file. +%% multirow.dtx (with options: `bigstrut') +%% +%% This is a generated file. +%% +%% 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. The latest version of this +%% license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +%% Copyright (C) 1994 by Jerry Leichter +%% Copyright (C) 2016 by Piet van Oostrum <piet@vanoostrum.org> %% -%% This file may be distributed under the terms of the LaTeX Project Public -%% License, as described in lppl.txt in the base LaTeX distribution. -%% Either version 1 or, at your option, any later version. -%% -% \bigstrut[x] produces a strut which is \bigstrutjot (2pt by default) higher, -% lower, or both than the standard array/table strut. Use it in table entries -% that are adjacent to \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." -% -% Although you could use \bigstrut in an array, there isn't normally much -% point since arrays are "opened up" by \jot anyway. -% -% \bigstrut[t] adds height; \bigstrut[b] adds depth. Just \bigstrut adds -% both. So: Use \bigstrut[t] in the row just *after* an \hline; \bigstrut[b] -% in the row just *before*; and \bigstrut if there are \hline's both before -% and after. -% -% Spaces after the \bigstrut are ignored, even if it has an optional argument. -% Spaces before the \bigstrut are generally ignored (by a single \unskip). -% -% Note: The multirow style file makes use of \bigstrutjot. If both styles -% are used, they can be used in either order, as each checks to see if the -% other has already defined \bigstrutjot. However, the default values they -% set are different: If only multirow is used, \bigstrutjot will be set to -% 3pt. If bigstrut is used, with or without multirow, \bigstrutjot will be -% 2pt. - -\@ifundefined{bigstrutjot}{\newdimen\bigstrutjot}{}\bigstrutjot2pt -\def\bigstrut{\relax\@ifnextchar [{\@bigstrut}{\@bigstrut[x]}} -\def\@bigstrut[#1]{\unskip\@tempdima\ht\@arstrutbox \@tempdimb\dp\@arstrutbox - \ifx #1b\else \advance\@tempdima by \bigstrutjot\fi - \ifx #1t\else \advance\@tempdimb by \bigstrutjot\fi +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{bigstrut} + [2016/09/27 v2.0 + Provide larger struts in tabulars] +\@ifundefined{bigstrutjot}{\newdimen\bigstrutjot}{}\bigstrutjot=2pt +\newcommand\bigstrut[1][x]{% + \unskip\@tempdima=\ht\@arstrutbox \@tempdimb=\dp\@arstrutbox + \ifx #1b\relax \else \advance\@tempdima by \bigstrutjot\fi + \ifx #1t\relax \else \advance\@tempdimb by \bigstrutjot\fi \hbox{\vrule \@height\@tempdima \@depth\@tempdimb \@width\z@}\ignorespaces} +\endinput +%% +%% End of file `bigstrut.sty'. diff --git a/Master/texmf-dist/tex/latex/multirow/multirow.sty b/Master/texmf-dist/tex/latex/multirow/multirow.sty index f52132fd150..91e4575b14d 100644 --- a/Master/texmf-dist/tex/latex/multirow/multirow.sty +++ b/Master/texmf-dist/tex/latex/multirow/multirow.sty @@ -1,159 +1,156 @@ %% -%% multirow.sty V1.6 version (5-May-2004) +%% This is file `multirow.sty', +%% generated with the docstrip utility. %% -%% Author: Jerry Leichter <jerrold.leichter@smarts.com> -%% Piet van Oostrum <piet@cs.uu.nl> +%% The original source files were: %% -%% This file may be distributed under the terms of the LaTeX Project Public -%% License, as described in lppl.txt in the base LaTeX distribution. -%% Either version 1 or, at your option, any later version. +%% multirow.dtx (with options: `multirow') +%% +%% This is a generated file. +%% +%% 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. The latest version of this +%% license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +%% Copyright (C) 1994 by Jerry Leichter +%% Copyright (C) 2016 by Piet van Oostrum <piet@vanoostrum.org> %% -%% V1.0 was distributed anonymously, based on a Usenet posting that was -%% not intended for stand-alone use. -%% V1.1 was modified by Piet van Oostrum <piet@cs.uu.nl> to allow it to -%% work without bigstrut.sty. -%% V1.2 was modified by Jerry Leichter for the same goal, but using a -%% different approach which will work properly in conjunction with -%% bigstrut.sty. -%% V1.2a was modified by Piet van Oostrum <piet@cs.uu.nl> to use \vskip -%% instead of \raise in positioning, avoiding making rows too high -%% when the adjustment is large. -%% V1.3 was modified by Piet van Oostrum to work properly in a p{} column -%% (\leavevmode added) -%% V1.4 was modified by Piet 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. -%% V1.5 was modified by Piet van Oostrum: Added a % after \hbox{#5}\vfill}. -%% Added \struts around #5 for better vertical positioning. -%% Additional coding for negative value of nrows. -%% V1.6 was modified by Piet van Oostrum: Replace a space by \relax after -%% \advance\@tempdima#4. -%% -% Make an entry that will span multiple rows of a table. -% -% \multirow{nrows}[bigstruts]{width}[fixup]{text} -% -% nrows is the number of rows to span. It's up to you to leave the other -% rows empty, or the stuff created by \multirow will over-write it. -% With a positive value of nrows the spanned colomns are this row and -% (nrows-1) rows below it. With a negative value of nrows they are -% this row and (1-nrows) above it. -% -% bigstruts is mainly used if you've used bigstrut.sty. In that case it -% is the total number of uses of \bigstrut within the rows being -% spanned. Count 2 uses for each \bigstrut, 1 for each \bigstrut[x] -% where x is either t or b. The default is 0. -% width is the width to which the text is to be set, or * to indicate that -% the text argument's natural width is to be used. -% -% text is the actual text. If the width was set explicitly, the text will -% be set in a parbox of that width; you can use \\ to force linebreaks -% where you like. -% -% If the width was given as * the text will be set in LR mode. If you -% want a multiline entry in this case you should use a tabular or array -% in the text parameter. -% -% The text is centered vertically within the range spanned by nrows. -% -% fixup is a length used for fine tuning: The text will be raised (or -% lowered, if fixup is negative) by that length above (below) wherever -% it would otherwise have gone. -% -% For example (using both multirow and bigstrut) -% -% \newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}} -% \begin{tabular}{|c|c|} -% \hline -% \multirow{4}{1in}{Common g text} & Column g2a\\ -% & Column g2b \\ -% & Column g2c \\ -% & Column g2d \\ -% \hline -% \multirow{3}[6]*{Common g text} & Column g2a\bigstrut\\\cline{2-2} -% & Column g2b \bigstrut\\\cline{2-2} -% & Column g2c \bigstrut\\ -% \hline -% \multirow{4}[8]{1in}{Common g text} & Column g2a\bigstrut\\\cline{2-2} -% & Column g2b \bigstrut\\\cline{2-2} -% & Column g2c \bigstrut\\\cline{2-2} -% & Column g2d \bigstrut\\ -% \hline -% \multirow{4}*{\minitab[c]{Common \\ g text}} & Column g2a\\ -% & Column g2b \\ -% & Column g2c \\ -% & Column g2d \\ -% \hline -% \end{tabular} -% -% If any of the spanned rows are unusually large, or if you're using -% bigstrut.sty and \bigstrut's are used assymetrically about the centerline of -% the spanned rows, the vertical centering may not come out right. Use the -% fixup argument in this case. -% -% Just before "text" is expanded, the \multirowsetup macro is expanded to -% set up any special environment. Initially, \multirowsetup contains just -% \raggedright. It can be redefined with \renewcommand. -% -% Bugs: It's just about impossible to deal correctly with descenders. The -% text will be set up centered, 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 "text" does not. This may result in a small -% missalignment. About all that can be done is to do a final touchup on -% "text", using the fixup optional argument. (Hint: If you use a measure -% like .1ex, there's a reasonable chance that the fixup will still be correct -% if you change the point size.) -% -% \multirow is mainly designed for use with table, as opposed to array, -% environments. It will not work well in an array environment since the lines -% have an extra \jot of space between them which it won't account for. Fixing -% this is difficult in general, and doesn't seem worth it. The bigstruts -% argument can be used to provide a semi-automatic fix: First set -% \bigstrutjot to .5\jot. Then simply repeat nrows as the bigstruts argument. -% This will be close, but probably not exact; you can use the fixup argument -% to refine the result. (If you do this repeatedly, you'll probably want to -% wrap these steps up in a simple macro. Note that the modified \bigstrutjot -% value will not give reasonable results if you have bigstruts and use this -% argument for its intended purpose elsewhere. In that case, you might want -% to set it locally.) -% -% If you use \multirow with the colortbl package you have to take -% precautions if you want to color the column that has the \multirow in it. -% colortbl works by coloring each cell separately. So if you use \multirow -% with a positive nrows value, colortbl will first color the top cell, then -% \multirow will typeset nrows cells starting with this cell, and later -% colortbl will color the other cells, effectively hiding the text in that -% area. This can be solved by putting the \multirow is the last row with a -% negative nrows value. -% Example: -% -% \begin{tabular}{l>{\columncolor{yellow}}l} -% aaaa & \\ -% cccc & \\ -% dddd & \multirow{-3}*{bbbb}\\ -% \end{tabular} -% -\def\multirowsetup{\raggedright} -\def\multirow#1{\relax\@ifnextchar - [{\@multirow{#1}}{\@multirow{#1}[0]}} -\def\@multirow#1[#2]#3{\@ifnextchar [{\@xmultirow{#1}[#2]{#3}}% - {\@xmultirow{#1}[#2]{#3}[0pt]}} -\def\@xmultirow#1[#2]#3[#4]#5{\@tempcnta=#1% - \@tempdima\@tempcnta\ht\@arstrutbox - \advance\@tempdima\@tempcnta\dp\@arstrutbox - \ifnum\@tempcnta<0\@tempdima=-\@tempdima\fi - \advance\@tempdima#2\bigstrutjot - \if*#3\setbox0\vtop to \@tempdima{\vfill\multirowsetup - \hbox{\strut#5\strut}\vfill}% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{multirow}% + [2016/09/27 v2.0 + Span multiple rows of a table]% +\newif\ifmultirowdebug +\DeclareOption{debug}{\multirowdebugtrue} +\DeclareOption{longtable}{% +\AtBeginDocument{% +\def\@cline#1-#2\@nil{% + \omit + \@multicnt#1% + \advance\@multispan\m@ne + \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi + \@multicnt#2% + \advance\@multicnt-#1% + \advance\@multispan\@ne + \leaders\hrule\@height\arrayrulewidth\hfill + \cr + \noalign{\nobreak\vskip-\arrayrulewidth}} +}} +\DeclareOption{supertabular}{% +\AtBeginDocument{% +\def\ST@tabularcr{% + {\ifnum0=`}\fi + \@ifstar{\MRST@xtabularcr}{\ST@xtabularcr}} +\def\MRST@xtabularcr{% + \@ifnextchar[%] + {\MRST@argtabularcr}% + {\ifnum0=`{\fi}\cr\MRST@cr}} +\def\MRST@argtabularcr[#1]{% + \ifnum0=`{\fi}% + \ifdim #1>\z@ + \unskip\MRST@xargarraycr{#1} \else - \setbox0\vtop to \@tempdima{\hsize#3\@parboxrestore - \vfill \multirowsetup \strut#5\strut\par\vfill}% - \fi - \ht0\z@\dp0\z@ - \ifnum\@tempcnta<0\advance\@tempdima-\dp\@arstrutbox - \else\@tempdima=\ht\@arstrutbox - \ifnum#2>0 \advance\@tempdima\bigstrutjot \fi + \MRST@yargarraycr{#1}% + \fi} +\def\MRST@xargarraycr#1{% + \@tempdima #1\advance\@tempdima \dp \@arstrutbox + \vrule \@height\z@ \@depth\@tempdima \@width\z@ \cr + \noalign{\global\ST@toadd=#1}\MRST@cr} +\def\MRST@yargarraycr#1{% + \cr\noalign{\vskip #1\global\MRST@toadd=#1}\MRST@cr} +\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@}} +} +\def\STneed#1{\ifdim\ST@pageleft<#1\ST@newpage\ST@next\fi} +} +\ProcessOptions +\newlength{\multirow@colwidth} +\newcount\multirow@cnta +\newcount\multirow@cntb +\newlength\multirow@dima +\def\multirow@setcolwidth#1{% + \ifx\TY@final\@undefined \multirow@colwidth=\hsize + \else + \ifx\TY@box\TY@box@v\multirow@colwidth=\hsize + \else \setbox0\hbox + {\let\\\space\let\newline\space #1}\multirow@colwidth=\wd0 + \fi + \fi} +\newcommand\multirowsetup{\raggedright} +\long\def\multirow@vbox#1#2#3{\setbox0\vtop to \multirow@dima{#2% + \if #1t\relax\else\vfill\fi + \multirowsetup #3\if #1b\relax\else\vfill\fi}} +%% \multirow [vpos] {nrows} [bigstruts] {width} [fixup] {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}}% + {\@xmultirow[#1]{#2}[#3]{#4}[0pt]}} +\newif\ifmultirow@prefixt +\newif\ifmultirow@prefixb +\def\multirow@piii#1#2#3\end{\multirow@prefixtfalse\multirow@prefixbfalse + \if t#1\multirow@prefixttrue + \if b#2\multirow@prefixbtrue \multirow@cntb=#3% + \else \multirow@cntb=#2#3% + \fi + \else + \if b#1\multirow@prefixbtrue \multirow@cntb=#2#3% + \else \multirow@cntb=#1#2#3% + \fi + \fi} +\def\@xmultirow[#1]#2[#3]#4[#5]#6{\multirow@cnta=#2% + \expandafter\multirow@piii#3\relax\end% + \multirow@dima=\multirow@cnta\ht\@arstrutbox + \advance\multirow@dima\multirow@cnta\dp\@arstrutbox + \ifnum\multirow@cnta<0\multirow@dima=-\multirow@dima\fi + \advance\multirow@dima \multirow@cntb\bigstrutjot + \if*#4\multirow@vbox{#1}{}{\hbox{\strut#6\strut}}% + \else \if=#4\multirow@setcolwidth{#6}% + \multirow@vbox{#1}{\hsize\multirow@colwidth\@parboxrestore}{\strut#6\strut\par}% + \else \multirow@vbox{#1}{\hsize#4\@parboxrestore}{\strut#6\strut\par}% + \fi \fi + \dp0=\z@ + \ifnum\multirow@cnta>0 + \if#1t\relax\multirow@dima=\ht0\else + \multirow@dima=\ht\@arstrutbox + \ifmultirow@prefixt \advance\multirow@dima\bigstrutjot\fi + \if#1b\relax \advance\multirow@dima\dp\@arstrutbox + \ifmultirow@prefixb \advance\multirow@dima\bigstrutjot\fi + \fi + \fi + \else + \if#1b\relax\else + \advance\multirow@dima-\dp\@arstrutbox + \ifmultirow@prefixb \advance\multirow@dima-\bigstrutjot\fi + \if#1t\relax\advance\multirow@dima-\ht\@arstrutbox + \ifmultirow@prefixt \advance\multirow@dima-\bigstrutjot\fi + \advance\multirow@dima\ht0 + \fi + \fi \fi - \advance\@tempdima#4\relax\leavevmode\vtop{\vskip-\@tempdima\box0\vss}} -\@ifundefined{bigstrutjot}{\newdimen\bigstrutjot \bigstrutjot\jot}{} + \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 +} +\@ifundefined{bigstrutjot}{\newdimen\bigstrutjot \bigstrutjot=\jot}{} +\endinput +%% +%% End of file `multirow.sty'. |