Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/lib/texmf/tex/latex/misc/multirow.sty

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


%%
%% multirow.sty  V1.2 (27-May-94)
%%
%% Author:  Jerry Leichter (leichter@cs.rutgers.edu)
%%
%% 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.ruu.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.
%
% 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 the user to leave the
%       rows empty, or the stuff created by \multirow will over-write 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.
% text is the actual text.  It will be set in LR mode.  You can use \\
%       within text to force linebreaks where you like.  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:
%
% \begin{tabular}{|c|c|}
% \hline
% \multirow{4}{1in}{Common g text} & Column g2a\\
%       & Column g2b \\
%       & Column g2c \\
%       & Column g2d \\
% \hline
% \multirow{3}[6]{1in}{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
% \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 will 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
% when if you change the point size.)
%
% \multirow probably isn't too useful in array, as opposed to table, environ-
% ments.  It will not work well there 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 (mis)used
% to provide a semi-automatic fix:  Set \bigstrutjot to \jot (only needed if
% your're actually using bigstrut.sty) and then use a value of half the number
% of rows spanned for bigstruts.  This will be close, but probably not exact.
%
\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
  \advance\@tempdima#2\bigstrutjot
  \setbox0\vtop to \@tempdima{\hsize#3\@parboxrestore
                \vfill \multirowsetup #5\par\vfill}%
  \ht0\z@\dp0\z@
  \@tempdima\ht\@arstrutbox \ifnum#2>0 \advance\@tempdima\bigstrutjot \fi
  \advance\@tempdima#4 \vtop{\vskip-\@tempdima\box0\vss}}
\@ifundefined{bigstrutjot}{\newdimen\bigstrutjot \bigstrutjot\jot}{}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.