| 1 |
% \iffalse |
| 2 |
% |
| 3 |
% makecell.dtx - Managing of tabular column heads and cells. |
| 4 |
% (c) 2005--2007 Olga Lapko ([email protected]) |
| 5 |
% |
| 6 |
% This program is provided under the terms of the |
| 7 |
% LaTeX Project Public License distributed from CTAN |
| 8 |
% archives in directory macros/latex/base/lppl.txt. |
| 9 |
% |
| 10 |
% \fi |
| 11 |
% |
| 12 |
% \iffalse |
| 13 |
%<*driver> |
| 14 |
\ProvidesFile{makecell.dtx} |
| 15 |
%</driver> |
| 16 |
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
| 17 |
%<package>\ProvidesPackage{makecell} |
| 18 |
%<*package> |
| 19 |
[2009/08/03 V0.1e Managing of Tab Column Heads and Cells] |
| 20 |
%</package> |
| 21 |
% |
| 22 |
%<*batchfile> |
| 23 |
\begingroup |
| 24 |
|
| 25 |
\input docstrip.tex |
| 26 |
|
| 27 |
\keepsilent |
| 28 |
\askforoverwritefalse |
| 29 |
|
| 30 |
\generate{\file{makecell.sty}{\from{makecell.dtx}{package}}} |
| 31 |
|
| 32 |
\endgroup |
| 33 |
%</batchfile> |
| 34 |
% |
| 35 |
%<*driver> |
| 36 |
\documentclass{ltxdoc} |
| 37 |
\IfFileExists{rotating.sty}{\usepackage{rotating}}{} |
| 38 |
\IfFileExists{footmisc.sty}{\usepackage[perpage,bottom]{footmisc}}{} |
| 39 |
\IfFileExists{multirow.sty}{\usepackage{multirow}}{} |
| 40 |
\IfFileExists{hyperref.sty}{\usepackage{hyperref}}{} |
| 41 |
\IfFileExists{hypcap.sty}{\usepackage{hypcap}}{} |
| 42 |
\usepackage{makecell} |
| 43 |
\IfFileExists{caption.sty} |
| 44 |
{\usepackage[font=small,labelfont=bf,labelsep=period]{caption}[2004/11/28] |
| 45 |
\IfFileExists{floatrow.sty} |
| 46 |
{\usepackage[font=small,style=plaintop,captionskip=5pt]{floatrow}} |
| 47 |
{}}{} |
| 48 |
\makeatletter |
| 49 |
\@ifundefined{ttabbox}{\let\ttabbox\relax}{} |
| 50 |
\makeatother |
| 51 |
\usepackage{tabularx} |
| 52 |
\usepackage{slashbox} |
| 53 |
\usepackage{hhline} |
| 54 |
\EnableCrossrefs |
| 55 |
\CodelineIndex |
| 56 |
\RecordChanges |
| 57 |
\makeatletter |
| 58 |
\@beginparpenalty10000 |
| 59 |
\widowpenalty10000 |
| 60 |
\clubpenalty10000 |
| 61 |
\makeatother |
| 62 |
\providecommand*{\file}[1]{\texttt{#1}} |
| 63 |
\providecommand*{\package}[1]{\textsf{#1}} |
| 64 |
\providecommand*{\cls}[1]{\textsf{#1}} |
| 65 |
\providecommand*{\env}[1]{\texttt{#1}} |
| 66 |
|
| 67 |
%\OnlyDescription |
| 68 |
\begin{document} |
| 69 |
\DocInput{makecell.dtx} |
| 70 |
\PrintChanges |
| 71 |
\end{document} |
| 72 |
%</driver> |
| 73 |
% \fi |
| 74 |
% |
| 75 |
% \CheckSum{1407} |
| 76 |
% |
| 77 |
% \GetFileInfo{makecell.dtx} |
| 78 |
% |
| 79 |
% \DoNotIndex{\newcommand,\newenvironment} |
| 80 |
% |
| 81 |
% |
| 82 |
% \title{The \textsf{makecell} package\thanks{This |
| 83 |
% file has version number \fileversion, |
| 84 |
% last revised \filedate.}} |
| 85 |
% \author{% |
| 86 |
% Olga Lapko\\ |
| 87 |
% {\tt [email protected]} } |
| 88 |
% \date{\filedate} |
| 89 |
% \maketitle |
| 90 |
% \begin{abstract} |
| 91 |
% This package helps to create common layout for tabular material. |
| 92 |
% The |\thead| command, based on one-column tabular environment, is offered |
| 93 |
% for creation of tabular column heads. This macro allows to support common |
| 94 |
% layout for tabular column heads in whole documentation. Another command, |
| 95 |
% |\makecell|, is offered for creation of multilined tabular cells. |
| 96 |
% There are also command |\makecellbox| command and |mcellbox| environment |
| 97 |
% usage of tabular cells inside text. |
| 98 |
% |
| 99 |
% Package also offers: \quad 1)\nobreak\enskip macro |\makegapedcells|, |
| 100 |
% which changes vertical spaces around all cells in tabular, like in |
| 101 |
% \package{tabls} package, but uses code of \package{array} package. (Macro |
| 102 |
% |\makegapedcells| redefines macro |\@classz| from \package{array} package. |
| 103 |
% Macro |\nomakegapedcells| cancels this redefinition.); |
| 104 |
% \quad 2)\nobreak\enskip macros |\multirowhead| and |\multirowcell|, |
| 105 |
% which use |\multirow| macro from \package{multirow} package; |
| 106 |
% \quad 3)\nobreak\enskip numbered rows |\nline| or skipping cells |\eline| |
| 107 |
% in tabulars; also are the skipping rows command |\erows| and |
| 108 |
% repeated rows command |\Xrows|; |
| 109 |
% \quad 4)\nobreak\enskip diagonally divided cells (|\diaghead|) |
| 110 |
% plus citation of sample file of \package{slashbox} package, which does the same; |
| 111 |
% \quad 5)\nobreak\enskip |\hline| and |\cline| with defined thickness: |
| 112 |
% |\Xhline| and |\Xcline| consequently. |
| 113 |
% \smallskip |
| 114 |
% |
| 115 |
% \end{abstract} |
| 116 |
% |
| 117 |
% \clearpage |
| 118 |
% \tableofcontents |
| 119 |
% |
| 120 |
% \clearpage |
| 121 |
% \section{Tabular Cells and Column Heads} |
| 122 |
% |
| 123 |
% \subsection{Building Commands} |
| 124 |
% |
| 125 |
% \DescribeMacro{\makecell} |
| 126 |
% Macro creates one-column tabular with predefined common settings of |
| 127 |
% alignment, spacing and vertical spaces around (see section~\ref{sec:sets}). |
| 128 |
% This will be useful for creation of multilined cells. This macro allows |
| 129 |
% optional alignment settings. |
| 130 |
% \begin{quote} |
| 131 |
% |\makecell|\oarg{vertical or/and horizontal alignment}\marg{cell text} |
| 132 |
% \end{quote} |
| 133 |
% For vertical alignment you use \texttt{t}, \texttt{b}, or \texttt{c}---%^^A |
| 134 |
% this letters you usually put in optional argument of \env{tabular} or |
| 135 |
% \texttt{array} environments. For horizontal alignment you may use alignment |
| 136 |
% settings like \texttt{r}, \texttt{l}, or \texttt{c}, or more complex, like |
| 137 |
% |{p{3cm}}|. Since this package loads \package{array} package, you may |
| 138 |
% use such alignment settings like |{>{\parindent1cm}p{3cm}}|. |
| 139 |
%\begin{verbatim} |
| 140 |
%\begin{tabular}{|c|c|} |
| 141 |
%\hline |
| 142 |
%Cell text & 28--31\\ |
| 143 |
%\hline |
| 144 |
%\makecell{Multilined \\ cell text} & 28--31\\ |
| 145 |
%\hline |
| 146 |
%\makecell[l]{Left aligned \\ cell text} & 37--43\\ |
| 147 |
%\hline |
| 148 |
%\makecell*[r]{Right aligned \\ cell text} & 37--43\\ |
| 149 |
%\hline |
| 150 |
%\makecell[b]{Bottom aligned \\ cell text} & 52--58\\ |
| 151 |
%\hline |
| 152 |
%\makecell*[{{p{3cm}}}]{Cell long text with predefined width} & 52--58\\ |
| 153 |
%\hline |
| 154 |
%\makecell[{{>{\parindent1em}p{3cm}}}]{Cell long...} & 52--58\\ |
| 155 |
%\hline |
| 156 |
%\end{tabular} |
| 157 |
%\end{verbatim} |
| 158 |
% \begin{table}[h] |
| 159 |
% \ttabbox |
| 160 |
% {\caption{Example of multilined cells}\label{tab:cells}}% |
| 161 |
% {\begin{tabular}{|c|c|} |
| 162 |
% \hline |
| 163 |
% Cell text & 28--31\\ |
| 164 |
% \hline |
| 165 |
% \makecell{Multilined \\ cell text} & 28--31\\ |
| 166 |
% \hline |
| 167 |
% \makecell[l]{Left aligned \\ cell text} & 37--43\\ |
| 168 |
% \hline |
| 169 |
% \makecell*[r]{Right aligned \\ cell text} & 37--43\\ |
| 170 |
% \hline |
| 171 |
% \makecell[b]{Bottom aligned\\ cell text} & 52--58\\ |
| 172 |
% \hline |
| 173 |
% \makecell*[{{p{3cm}}}]{Cell long text with predefined width} & 52--58\\ |
| 174 |
% \hline |
| 175 |
% \makecell[{{>{\parindent1em}p{3cm}}}]{Cell long text with predefined width} & |
| 176 |
% 52--58\\ |
| 177 |
% \hline |
| 178 |
% \end{tabular}} |
| 179 |
% \end{table} |
| 180 |
% |
| 181 |
% Starred form of command, |\makecell*|, creates vertical |\jot| spaces |
| 182 |
% around. |
| 183 |
% |
| 184 |
% \emph{Note}. When you define column alignment like |{p{3cm}}| in optional |
| 185 |
% argument of |\makecell| (or |\thead|, see below), please follow these |
| 186 |
% rules: \quad 1)\nobreak\enskip if vertical |
| 187 |
% alignment defined, write column alignment in group, e.g. |[c{p{3cm}}]|; |
| 188 |
% \quad 2)\nobreak\enskip if vertical alignment is absent, |
| 189 |
% write column alignment in double |
| 190 |
% group---|[{{p{3cm}}}]|, or add empty group---|[{}{p{3cm}}]|. Be also |
| 191 |
% careful with vertical alignment when you define column alignment as |
| 192 |
% paragraph block: e.g., use |{{b{3cm}}}| for bottom alignment (and |
| 193 |
% |{{m{3cm}}}| for centered vertical alignment). |
| 194 |
% |
| 195 |
% \DescribeMacro{\thead} |
| 196 |
% Macro creates one-column \texttt{tabular} for column heads with predefined |
| 197 |
% common settings (see table~\ref{tab:thead}). This macro uses common layout |
| 198 |
% for column heads: font, alignment, spacing, and vertical spaces around |
| 199 |
% (see section~\ref{sec:tsets}). |
| 200 |
%\begin{verbatim} |
| 201 |
%\renewcommand\theadset{\def\arraystretch{.85}}% |
| 202 |
%\begin{tabular}{|l|c|} |
| 203 |
%\hline |
| 204 |
%\thead{First column head}& |
| 205 |
% \thead{Second \\multlined \\ column head}\\ |
| 206 |
%\hline |
| 207 |
%Left column text & 28--31\\ |
| 208 |
%\hline |
| 209 |
%\end{tabular} |
| 210 |
%\end{verbatim} |
| 211 |
% \begin{table}[h] |
| 212 |
% \ttabbox |
| 213 |
% {\caption{Example of column heads}\label{tab:thead}} |
| 214 |
% {\renewcommand\theadset{\def\arraystretch{.85}} |
| 215 |
% \begin{tabular}{|l|c|} |
| 216 |
% \hline |
| 217 |
% \thead{First column head}& |
| 218 |
% \thead{Second \\multlined \\ column head}\\ |
| 219 |
% \hline |
| 220 |
% Long left column text & 28--31\\ |
| 221 |
% \hline |
| 222 |
% \end{tabular}} |
| 223 |
% \end{table} |
| 224 |
% |
| 225 |
% Starred form of command, |\thead*|, creates vertical |\jot| spaces around. |
| 226 |
% |
| 227 |
% \DescribeMacro{\rothead} |
| 228 |
% Creates table heads rotated by 90$^\circ$ counterclockwise. |
| 229 |
% Macro uses the same font and spacing settings as previous |
| 230 |
% one, but column alignment changed to |p{\rotheadsize}| with |\raggedright| |
| 231 |
% justification: in this case left side of all text lines ``lies'' |
| 232 |
% on one base line. |
| 233 |
% |
| 234 |
% \DescribeMacro{\rotheadsize} |
| 235 |
% This parameter defines the width of rotated tabular heads. You may define |
| 236 |
% that like: |
| 237 |
% \begin{quote} |
| 238 |
% |\setlength\rotheadsize{3cm}| |
| 239 |
% \end{quote} |
| 240 |
% or |
| 241 |
% \begin{quote} |
| 242 |
% |\settowidth\rotheadsize{\theadfont |\meta{Widest head text}|}| |
| 243 |
% \end{quote} |
| 244 |
% like in following example (table~\ref{tab:rotheads}): |
| 245 |
%\begin{verbatim} |
| 246 |
%\settowidth\rotheadsize{\theadfont Second multilined} |
| 247 |
%\begin{tabular}{|l|c|} |
| 248 |
%\hline |
| 249 |
%\thead{First column head}& |
| 250 |
% \rothead{Second multilined \\ column head}\\ |
| 251 |
%\hline |
| 252 |
%Left column text & 28--31\\ |
| 253 |
%\hline |
| 254 |
%\end{tabular} |
| 255 |
%\end{verbatim} |
| 256 |
% \begin{table}[h] |
| 257 |
% \ttabbox |
| 258 |
% {\caption{Example of rotated column heads}\label{tab:rotheads}}%^^A% |
| 259 |
% {\settowidth\rotheadsize{\theadfont Second multilined}%^^A |
| 260 |
% \begin{tabular}{l|l} |
| 261 |
% \hline |
| 262 |
% \thead{First column head}& |
| 263 |
% \rothead{Second multilined \\ column head}\\ |
| 264 |
% \hline |
| 265 |
% Long left column text & 28--31\\ |
| 266 |
% \hline |
| 267 |
% \end{tabular}} |
| 268 |
% \end{table} |
| 269 |
% |
| 270 |
% \subsection{Settings For Tabular Cells}\label{sec:sets} |
| 271 |
% |
| 272 |
% This section describes macros, which make layout tuning for multilined |
| 273 |
% cells, created by |\makecell| macro (and also |\multirowcell| and |
| 274 |
% |\rotcell| macros). The |\cellset| macro also is used by |\thead| |
| 275 |
% (|\rothead|, |\multirowtead|) macro. |
| 276 |
% |
| 277 |
% \DescribeMacro{\cellset} |
| 278 |
% Spacing settings for cells. Here you could use commands like: |
| 279 |
% \begin{quote} |
| 280 |
% |\renewcommand\cellset{\renewcommand\arraytretch{1}%|\\ |
| 281 |
% | \setlength\extrarowheight{0pt}}| |
| 282 |
% \end{quote} |
| 283 |
% as was defined in current package. |
| 284 |
% |
| 285 |
% \DescribeMacro{\cellalign} |
| 286 |
% Default align for cells. Package offers vertical and horizontal centering |
| 287 |
% alignment, it defined like: |
| 288 |
% \begin{quote} |
| 289 |
% |\renewcommand\cellalign{cc}| |
| 290 |
% \end{quote} |
| 291 |
% |
| 292 |
% \DescribeMacro{\cellgape} |
| 293 |
% Define vertical spaces around |\makecell|, using |\gape| command if |
| 294 |
% necessary. It defined like: |
| 295 |
% \begin{quote} |
| 296 |
% |\renewcommand\cellgape{}| |
| 297 |
% \end{quote} |
| 298 |
% You may define this command like |
| 299 |
% \begin{quote} |
| 300 |
% |\renewcommand\cellgape{\Gape[1pt]}| |
| 301 |
% \end{quote} |
| 302 |
% or |
| 303 |
% \begin{quote} |
| 304 |
% |\renewcommand\cellgape{\gape[t]}| |
| 305 |
% \end{quote} |
| 306 |
% (See also section~\ref{sec:gape} about |\gape| and |\Gape| command.) |
| 307 |
% |
| 308 |
% \DescribeMacro{\cellrotangle} |
| 309 |
% The angle for rotated cells and column heads. The default value 90 |
| 310 |
% (counterclockwise). This value definition is used by both |\rotcell| and |
| 311 |
% |\rothead| macros. |
| 312 |
% |
| 313 |
% \subsection{Settings For Column Heads}\label{sec:tsets} |
| 314 |
% |
| 315 |
% This section describes macros, which make layout tuning for tabular column |
| 316 |
% heads, created by |\thead| (|\rothead|, |\multirowtead|) macro. |
| 317 |
% |
| 318 |
% \DescribeMacro{\theadfont} |
| 319 |
% Sets a special font for column heads. It could be smaller size |
| 320 |
% \begin{quote} |
| 321 |
% |\renewcommand\theadfont{\foonotesize}| |
| 322 |
% \end{quote} |
| 323 |
% as was defined in current package (here we suppose that |
| 324 |
% \verb|\small| command used for tabular contents itself). |
| 325 |
% Next example defines italic shape |
| 326 |
% \begin{quote} |
| 327 |
% |\renewcommand\theadfont{\itshape}| |
| 328 |
% \end{quote} |
| 329 |
% |
| 330 |
% \DescribeMacro{\theadset} |
| 331 |
% Spacing settings for column heads. Here you could use commands like: |
| 332 |
% \begin{quote} |
| 333 |
% |\renewcommand\theadset{\renewcommand\arraytretch{1}%|\\ |
| 334 |
% | \setlength\extrarowheight{0pt}}| |
| 335 |
% \end{quote} |
| 336 |
% |
| 337 |
% \DescribeMacro{\theadalign} |
| 338 |
% Default align for tabular column heads. Here also offered centering |
| 339 |
% alignment: |
| 340 |
% \begin{quote} |
| 341 |
% |\renewcommand\theadalign{cc}| |
| 342 |
% \end{quote} |
| 343 |
% |
| 344 |
% \DescribeMacro{\theadgape} |
| 345 |
% Define vertical spaces around column head (|\thead|), |
| 346 |
% using |\gape| command if necessary. |
| 347 |
% It defined like: |
| 348 |
% \begin{quote} |
| 349 |
% |\renewcommand\theadgape{\gape}| |
| 350 |
% \end{quote} |
| 351 |
% |
| 352 |
% \DescribeMacro{\rotheadgape} |
| 353 |
% Analogous definition for rotated column heads. Default is absent: |
| 354 |
% \begin{quote} |
| 355 |
% |\renewcommand\rotheadgape{}| |
| 356 |
% \end{quote} |
| 357 |
% |
| 358 |
% \clearpage |
| 359 |
% \section{Changing of Height and Depth of Boxes}\label{sec:gape} |
| 360 |
% |
| 361 |
% Sometimes \env{tabular} or \env{array} cells, or some elements in text need a |
| 362 |
% height/depth correction. The |\raisebox| command could help for it, but |
| 363 |
% usage of that macro in these cases, especially inside math, is rather |
| 364 |
% complex. Current package offers the |\gape| macro, which usage is similar |
| 365 |
% to |\smash| macro. The |\gape| macro allows to change height and/or depth |
| 366 |
% of included box with necessary dimension. |
| 367 |
% |
| 368 |
% \DescribeMacro{\gape} |
| 369 |
% This macro changes included box by |\jot| value (usually 3\,pt). It is |
| 370 |
% defined with optional and mandatory arguments, like |\smash| macro, which |
| 371 |
% (re)defined by \package{amsmath} package. Optional argument sets change of |
| 372 |
% height only (\texttt{t}) or depth only~(\texttt{b}). Mandatory argument |
| 373 |
% includes text. |
| 374 |
% \begin{quote} |
| 375 |
% |\gape|\oarg{\texttt{t} or \texttt{b}}\marg{text} |
| 376 |
% \end{quote} |
| 377 |
% Examples of usage: |
| 378 |
% \begin{quote} |
| 379 |
% \noindent |
| 380 |
% \vbox{\halign{#\cr |
| 381 |
% \noalign{\hrule} |
| 382 |
% \gape{\cmd{\gape}\texttt{\{text\}}}\cr |
| 383 |
% \noalign{\hrule} |
| 384 |
% \crcr}}\qquad |
| 385 |
% \vbox{\halign{#\cr |
| 386 |
% \noalign{\hrule} |
| 387 |
% \gape[t]{\cmd{\gape}\texttt{[t]\{text\}}}\cr |
| 388 |
% \noalign{\hrule\vskip\jot} |
| 389 |
% \crcr}}\qquad |
| 390 |
% \vbox{\halign{#\cr |
| 391 |
% \noalign{\hrule} |
| 392 |
% \gape[b]{\cmd{\gape}\texttt{[b]\{text\}}}\cr |
| 393 |
% \noalign{\hrule} |
| 394 |
% \crcr}} |
| 395 |
% \end{quote} |
| 396 |
% |
| 397 |
% \DescribeMacro{\Gape} |
| 398 |
% Another way of height/depth modification. This macro allows different |
| 399 |
% correction for height and depth of box: |
| 400 |
% \begin{quote} |
| 401 |
% |\Gape|\oarg{height corr}\oarg{depth corr}\marg{text} |
| 402 |
% \end{quote} |
| 403 |
% |
| 404 |
% If both arguments absent, |\Gape| command works like |\gape|\marg{text}, in |
| 405 |
% other words, command uses |\jot| as correction value for height and depth |
| 406 |
% of box. |
| 407 |
% |
| 408 |
% If only one optional argument exists, |\Gape| command uses value |
| 409 |
% from this argument for both height and depth box corrections. |
| 410 |
% \begin{quote} |
| 411 |
% \noindent |
| 412 |
% \vbox{\halign{#\cr |
| 413 |
% \noalign{\hrule} |
| 414 |
% \Gape{\cmd{\Gape}\texttt{\{text\}}}\cr |
| 415 |
% \noalign{\hrule} |
| 416 |
% \crcr}}\texttt{\phantom{xxxxx}}\qquad |
| 417 |
% \vbox{\halign{#\cr |
| 418 |
% \noalign{\hrule} |
| 419 |
% \Gape[\jot]{\cmd{\Gape}\texttt{[\cmd{\jot}]\{text\}}}\cr |
| 420 |
% \noalign{\hrule} |
| 421 |
% \crcr}}\\[2ex] |
| 422 |
% \vbox{\halign{#\cr |
| 423 |
% \noalign{\hrule} |
| 424 |
% \Gape[6pt]{\cmd{\Gape}\texttt{[6pt]\{text\}}}\cr |
| 425 |
% \noalign{\hrule} |
| 426 |
% \crcr}}\qquad |
| 427 |
% \vbox{\halign{#\cr |
| 428 |
% \noalign{\hrule} |
| 429 |
% \Gape[6pt][-2pt]{\cmd{\Gape}\texttt{[6pt][-2pt]\{text\}}}\cr |
| 430 |
% \noalign{\hrule\vskip8pt} |
| 431 |
% \crcr}} |
| 432 |
% \end{quote} |
| 433 |
% |
| 434 |
% You may also use |\height| and |\depth| parameters in optional arguments |
| 435 |
% of |\Gape| macro, parameters was borrowed from |\raisebox| command. |
| 436 |
% |
| 437 |
% \DescribeMacro{\bottopstrut} |
| 438 |
% \DescribeMacro{\topstrut} |
| 439 |
% \DescribeMacro{\botstrut} |
| 440 |
% These three macros modify standard |\strut| by |\jot| value: |
| 441 |
% |\bottopstrut| changes both height and depth; |
| 442 |
% \nopagebreak|\topstrut| changes only height; |
| 443 |
% |\botstrut| changes only depth. |
| 444 |
% These commands could be useful, for example, in first and last table rows. |
| 445 |
% |
| 446 |
% \emph{Note}. If you use |
| 447 |
% \package{bigstrut} package note that these macros duplicate \cmd{\bigstrut}, |
| 448 |
% \cmd{\bigstrut[t]}, and \cmd{\bigstrut[b]} commands consequently. Please |
| 449 |
% note that value, which increases strut in \cmd{\topstrut} etc. equals to |
| 450 |
% \cmd{\jot}, but \cmd{\bigstrut} and others use a special dimension |
| 451 |
% \cmd{\bigstrutjot}. |
| 452 |
% |
| 453 |
% \clearpage |
| 454 |
% \section{How to Change Vertical Spaces Around Cells |
| 455 |
% in Whole Table}\label{sec:beta} |
| 456 |
% |
| 457 |
% This section describes macros which try to emulate one of possibilities of |
| 458 |
% \package{tabls} package: to get necessary vertical spacing around cells. |
| 459 |
% |
| 460 |
% \DescribeMacro{\setcellgapes} |
| 461 |
% Sets the parameters for vertical spaces: |
| 462 |
% \begin{quote} |
| 463 |
% |\setcellgapes|\oarg{\texttt{t} or \texttt{b}}\marg{value} |
| 464 |
% \end{quote} |
| 465 |
% The next examples with array and tabular use following settings: |
| 466 |
% \begin{quote} |
| 467 |
% |\setcellgapes{5pt}| |
| 468 |
% \end{quote} |
| 469 |
% You may also try to load negative values if you wish. This macro you may |
| 470 |
% put in the preamble as common settings. |
| 471 |
% |
| 472 |
% \DescribeMacro{\makegapedcells} |
| 473 |
% \DescribeMacro{\nomakegapedcells} |
| 474 |
% The first macro switches on vertical spacing settings. The second cancels |
| 475 |
% first~one. |
| 476 |
% |
| 477 |
% The \cmd{\makegapedcells} macro temporarily redefines macro |
| 478 |
% |\@classz| of \package{array} package, so use this mechanism carefully. |
| 479 |
% Load |\makegapedcells| inside group or inside environment |
| 480 |
% (see table~\ref{tab:gaped}): |
| 481 |
%\begin{verbatim} |
| 482 |
%\begin{table}[h] |
| 483 |
%\makegapedcells |
| 484 |
%... |
| 485 |
%\end{table} |
| 486 |
%\end{verbatim} |
| 487 |
% \setcellgapes{5pt} |
| 488 |
% \begin{table} |
| 489 |
% \makegapedcells |
| 490 |
% \ttabbox |
| 491 |
% {\caption{Example of multilined cells with additional vertical spaces}%^^A |
| 492 |
% \label{tab:gaped}}% |
| 493 |
% {\begin{tabular}{|c|c|} |
| 494 |
% \hline |
| 495 |
% Cell text & 28--31\\ |
| 496 |
% \hline |
| 497 |
% \makecell{Multilined \\ cell text} & 28--31\\ |
| 498 |
% \hline |
| 499 |
% \makecell[l]{Left aligned \\ cell text} & 37--43\\ |
| 500 |
% \hline |
| 501 |
% \makecell*[r]{Right aligned \\ cell text} & 37--43\\ |
| 502 |
% \hline |
| 503 |
% \makecell[b]{Bottom aligned \\ cell text} & 52--58\\ |
| 504 |
% \hline |
| 505 |
% \makecell*[{{p{3cm}}}]{Cell long text with predefined width} & 52--58\\ |
| 506 |
% \hline |
| 507 |
% \makecell[{{>{\parindent1em}p{3cm}}}]{Cell long text with |
| 508 |
% predefined width} & 52--58\\ |
| 509 |
% \hline |
| 510 |
% \end{tabular}} |
| 511 |
% \end{table} |
| 512 |
% |
| 513 |
% Please note that space defined in |\setcellgapes| and space which creates |
| 514 |
% |\gape| mechanism in commands |
| 515 |
% for tabular cells (usually |\thead| or |\makecell*|) are summarized. |
| 516 |
% |
| 517 |
% \clearpage |
| 518 |
% \section{Multirow Table Heads and Cells} |
| 519 |
% |
| 520 |
% The next examples show usage of macros which use |\multirow| command from |
| 521 |
% \package{multirow} package.\nopagebreak |
| 522 |
% |
| 523 |
% At first goes short repetition of arguments of |\multirow| macro itself: |
| 524 |
% \begin{quote} |
| 525 |
% |\multirow|\marg{nrow}\oarg{njot}\marg{width}\oarg{vmove}\marg{contents} |
| 526 |
% \end{quote} |
| 527 |
% \marg{nrow} sets number of rows (i.e. text lines); |
| 528 |
% \oarg{njot} is mainly used if you've used \package{bigstrut} package: it makes |
| 529 |
% additional tuning of vertical position (see comments in |
| 530 |
% \package{multirow} package); |
| 531 |
% \marg{width} defines width of contents, the |*| sign used to indicate that |
| 532 |
% the text argument's natural width is to be used; |
| 533 |
% \oarg{vmove} is a length used for fine tuning: the text will be raised (or |
| 534 |
% lowered, if \meta{vmove} is negative) by that length; |
| 535 |
% \marg{contents} includes ``|\multirow|'ed'' text.\smallskip |
| 536 |
% |
| 537 |
% \DescribeMacro{\multirowcell} |
| 538 |
% \DescribeMacro{\multirowthead} |
| 539 |
% These two macros use following arguments (example uses |\multirowcell| |
| 540 |
% command): |
| 541 |
% \begin{quote} |
| 542 |
% |\multirowcell|\marg{nrow}\oarg{vmove}\oarg{hor alignment}\marg{contents} |
| 543 |
% \end{quote} |
| 544 |
% in these macros were skipped \oarg{njot} and \marg{width}. Instead of |
| 545 |
% tuning optional argument \oarg{njot} for vertical |
| 546 |
% correction used \oarg{vmove} optional argument. |
| 547 |
% For the \marg{width} argument both |\multirowcell| and |\multirowthead| |
| 548 |
% macros use natural width of contents (i.e. the |*| argument used). |
| 549 |
% |
| 550 |
% First example (table~\ref{tab:mrowI}) with ``|\multirow|'ed'' column heads |
| 551 |
% and cells: |
| 552 |
%\begin{verbatim} |
| 553 |
%\renewcommand\theadset{\def\arraystretch{.85}}% |
| 554 |
%\begin{tabular}{|l|c|c|} |
| 555 |
% \multirowthead{4}{First ...}& |
| 556 |
% \multicolumn{2}{c|}{\thead{Multicolumn head}}\\ \cline{2-3} |
| 557 |
% & \thead{Second ...} & \thead{Third ...}\\ \hline |
| 558 |
% Cell text & A &\multirowcell{3}{28--31}\\ \cline{1-2} |
| 559 |
% \makecell{Multilined\\Cell text} & B& \\ \hline |
| 560 |
% \makecell[l]{Left ...} & C & \multirowcell{4}[1ex][l]{37--43}\\ \cline{1-2} |
| 561 |
% \makecell[r]{Right ...} & D & \\ \hline |
| 562 |
% \makecell[b]{Bottom ...} & E & \multirowcell{5}[1ex][r]{37--43\\52--58}\\ |
| 563 |
% \cline{1-2} |
| 564 |
% \makecell[{{p{5cm}}}]{Cell ...} & F & \\ \cline{1-2} |
| 565 |
% \makecell[{{>{\parindent1em}p{5cm}}}]{Cell ...} & G & \\ \hline |
| 566 |
% \end{tabular} |
| 567 |
%\end{verbatim} |
| 568 |
% |
| 569 |
% \begin{table}[p] |
| 570 |
%\renewcommand\theadset{\def\arraystretch{.85}}% |
| 571 |
% \ttabbox |
| 572 |
% {\caption{Example of ``\cmd{\multirow}'ed'' cells}\label{tab:mrowI}}% |
| 573 |
% {\begin{tabular}{|l|c|c|} |
| 574 |
% \hline |
| 575 |
% \multirowthead{4}{First Column head}& |
| 576 |
% \multicolumn{2}{c|}{\thead{Multicolumn head}}\\ |
| 577 |
% \cline{2-3} |
| 578 |
% & \thead{Second \\multlined \\ column head} & |
| 579 |
% \thead{Third \\ column head}\\ |
| 580 |
% \hline |
| 581 |
% Cell text & A &\multirowcell{3}{28--31}\\ |
| 582 |
% \cline{1-2} |
| 583 |
% \makecell{Multilined\\Cell text} & B& \\ |
| 584 |
% \hline |
| 585 |
% \makecell[l]{Left aligned\\ cell text} & C |
| 586 |
% & \multirowcell{4}[1ex][l]{37--43}\\ |
| 587 |
% \cline{1-2} |
| 588 |
% \makecell[r]{Right aligned\\ cell text} & D & \\ |
| 589 |
% \hline |
| 590 |
% \makecell[b]{Bottom aligned\\ cell text} & E & |
| 591 |
% \multirowcell{5}[1ex][r]{37--43\\52--58}\\ |
| 592 |
% \cline{1-2} |
| 593 |
% \makecell[{{p{5cm}}}]{Cell long long long long text with predefined width} |
| 594 |
% & F & \\ |
| 595 |
% \cline{1-2} |
| 596 |
% \makecell[{{>{\parindent1em}p{5cm}}}]{Cell long long long long text with |
| 597 |
% predefined width} & G & \\ |
| 598 |
% \hline |
| 599 |
% \end{tabular}} |
| 600 |
% \end{table} |
| 601 |
% |
| 602 |
% Second example (table~\ref{tab:mrowII}) with ``multirow'ed'' column heads |
| 603 |
% and cells uses |\makegapedcells| command. The |\theadgape| command does |
| 604 |
% nothing: |
| 605 |
%\begin{verbatim} |
| 606 |
%\makegapedcells |
| 607 |
%\renewcommand\theadset{\def\arraystretch{.85}}% |
| 608 |
%\renewcommand\theadgape{} |
| 609 |
%... |
| 610 |
%\end{verbatim} |
| 611 |
% \begin{table}[p]\makegapedcells |
| 612 |
%\renewcommand\theadset{\def\arraystretch{.85}}% |
| 613 |
%\renewcommand\theadgape{} |
| 614 |
% \ttabbox |
| 615 |
% {\caption{Example of ``\cmd{\multirow}'ed'' cells and additional vertical |
| 616 |
% spaces}\label{tab:mrowII}}% |
| 617 |
% {\begin{tabular}{|l|c|c|} |
| 618 |
% \hline |
| 619 |
% \multirowthead{4}{First Column head}& |
| 620 |
% \multicolumn{2}{c|}{\thead{Multicolumn head}}\\ |
| 621 |
% \cline{2-3} |
| 622 |
% & \thead{Second \\multlined \\ column head} & |
| 623 |
% \thead{Third \\ column head}\\ |
| 624 |
% \hline |
| 625 |
% Cell text & A &\multirowcell{4}{28--31}\\ |
| 626 |
% \cline{1-2} |
| 627 |
% \makecell{Multilined \\Cell text} & B& \\ |
| 628 |
% \hline |
| 629 |
% \makecell[l]{Left aligned \\ cell text} & C |
| 630 |
% & \multirowcell{4}[0ex][l]{37--43}\\ |
| 631 |
% \cline{1-2} |
| 632 |
% \makecell[r]{Right aligned \\ cell text} & D & \\ |
| 633 |
% \hline |
| 634 |
% \makecell[b]{Bottom aligned \\ cell text} & E & |
| 635 |
% \multirowcell{6}[0ex][r]{37--43\\52--58}\\ |
| 636 |
% \cline{1-2} |
| 637 |
% \makecell[{{p{5cm}}}]{Cell long long long long text with predefined width} |
| 638 |
% & F & \\ |
| 639 |
% \cline{1-2} |
| 640 |
% \makecell[{{>{\parindent1em}p{5cm}}}]{Cell long long long long text with |
| 641 |
% predefined width} & G & \\ |
| 642 |
% \hline |
| 643 |
% \end{tabular}} |
| 644 |
% \end{table} |
| 645 |
% \bigskip |
| 646 |
% |
| 647 |
% The last example (table~\ref{tab:mrowIII}) uses \env{tabularx} environment |
| 648 |
% with |\hsize| in the width argument. |
| 649 |
%\begin{verbatim} |
| 650 |
%\makegapedcells |
| 651 |
%\renewcommand\theadset{\def\arraystretch{.85}}% |
| 652 |
%\renewcommand\theadgape{} |
| 653 |
%\begin{tabularx}\hsize{|X|c|c|} |
| 654 |
%... |
| 655 |
%\cline{1-2} |
| 656 |
%\makecell[{{p{\hsize}}}]{Cell ...} & F & \\ |
| 657 |
%\cline{1-2} |
| 658 |
%\makecell[{{>{\parindent1em}p{\hsize}}}]{Cell ...} & G & \\ |
| 659 |
%\hline |
| 660 |
%\end{tabularx} |
| 661 |
%\end{verbatim} |
| 662 |
% As you may see the |\makecell|'s in last two rows defined as |
| 663 |
% \begin{quote} |
| 664 |
% |\makecell[{{p{\hsize}}}]{...}| |
| 665 |
% \end{quote} |
| 666 |
% and |
| 667 |
% \begin{quote} |
| 668 |
% |\makecell[{{>{\parindent1em}p{\hsize}}}]{...}| |
| 669 |
% \end{quote} |
| 670 |
% consequently. |
| 671 |
% \begin{table}\makegapedcells |
| 672 |
%\renewcommand\theadset{\def\arraystretch{.85}}% |
| 673 |
%\renewcommand\theadgape{} |
| 674 |
% \ttabbox |
| 675 |
% {\caption{Example of \env{tabularx} environment}\label{tab:mrowIII}}% |
| 676 |
% {\begin{tabularx}\hsize{|X|c|c|} |
| 677 |
% \hline |
| 678 |
% \multirowthead{4}{First Column head}& |
| 679 |
% \multicolumn{2}{c|}{\thead{Multicolumn head}}\\ |
| 680 |
% \cline{2-3} |
| 681 |
% & \thead{Second \\multlined \\ column head} & |
| 682 |
% \thead{Third \\ column head}\\ |
| 683 |
% \hline |
| 684 |
% Cell text & A &\multirowcell{4}{28--31}\\ |
| 685 |
% \cline{1-2} |
| 686 |
% \makecell{Multilined \\Cell text} & B& \\ |
| 687 |
% \hline |
| 688 |
% \makecell[l]{Left aligned \\ cell text} & C |
| 689 |
% & \multirowcell{4}[0ex][l]{37--43}\\ |
| 690 |
% \cline{1-2} |
| 691 |
% \makecell[r]{Right aligned \\ cell text} & D & \\ |
| 692 |
% \hline |
| 693 |
% \makecell[b]{Bottom aligned \\ cell text} & E & |
| 694 |
% \multirowcell{6}[0ex][r]{37--43\\52--58}\\ |
| 695 |
% \cline{1-2} |
| 696 |
% \makecell[{{p{\hsize}}}]{Cell long long long long long long text with |
| 697 |
% predefined width} & F & \\ |
| 698 |
% \cline{1-2} |
| 699 |
% \makecell[{{>{\parindent1em}p{\hsize}}}]{Cell long long long long long |
| 700 |
% long text with predefined width} & G & \\ |
| 701 |
% \hline |
| 702 |
% \end{tabularx}} |
| 703 |
% \end{table} |
| 704 |
% |
| 705 |
% \subsection{Multirow Table Heads and Cells: Second Variant} |
| 706 |
% |
| 707 |
% Another, simplified, variant of multirow cell: use |
| 708 |
% |\makecell| and |\thead| commands, and set |\\| with |
| 709 |
% negative space at the end, for example |
| 710 |
%\begin{quote} |
| 711 |
% |\thead{First Column head\\[-5ex]}| |
| 712 |
%\end{quote} |
| 713 |
% cells, which stay in one ``multi row'' will have the same value of this |
| 714 |
% negative space, in spite of different number of lines in their contents. |
| 715 |
% |
| 716 |
% \clearpage\suppressfloats[t] |
| 717 |
% \section{Numbered Lines in Tabulars} |
| 718 |
% |
| 719 |
% The three commands |\eline|, |\nline|, |\rnline| allow to skip: |
| 720 |
% \begin{quote} |
| 721 |
% |\eline|\marg{number of cells} |
| 722 |
% \end{quote} |
| 723 |
% and numbering (|\nline|) a few/all sells in the row: |
| 724 |
% \begin{quote} |
| 725 |
% |\nline|\oarg{numbering type}\oarg{start number}\marg{number of cells} |
| 726 |
% \end{quote} |
| 727 |
% Command |\rnline| does the same as |\nline|, but allows numbering by |
| 728 |
% Russian letters (it redefines |
| 729 |
% \LaTeX's |\Alph| and |\alph| with |\Asbuk| and |\asbuk| consequently). |
| 730 |
% (see table~\ref{tab:elines}) |
| 731 |
%\begin{verbatim} |
| 732 |
% \begin{tabular}{|*{12}{c|}} |
| 733 |
% \hline |
| 734 |
% \eline{6} \\ \hline |
| 735 |
% \nline{6} \\ \hline |
| 736 |
% \eline{3} & \nline[1][4]{3} \\ \hline |
| 737 |
% \nline[(a)]{6} \\ \hline |
| 738 |
% \nline[column I]{6} \\ \hline |
| 739 |
% \end{tabular} |
| 740 |
%\end{verbatim} |
| 741 |
% |
| 742 |
% \begin{table}[H] |
| 743 |
% \ttabbox |
| 744 |
% {\caption{Examples of filling of cells}\label{tab:elines}}% |
| 745 |
% {\begin{tabular}{|*{6}{c|}} |
| 746 |
% \hline |
| 747 |
% \eline{6} \\ \hline |
| 748 |
% \nline{6} \\ \hline |
| 749 |
% \eline{3} & \nline[1][4]{3} \\ \hline |
| 750 |
% \nline[(a)]{6} \\ \hline |
| 751 |
% \nline[column I]{6} \\ \hline |
| 752 |
% \end{tabular}} |
| 753 |
%\end{table} |
| 754 |
% |
| 755 |
% Two ``lazy'' commands: for empty table rows |
| 756 |
% (|\erows|) and for rows with repeated text (|\Xrows|) were added in the version V0.1e. |
| 757 |
% |
| 758 |
%\DeleteShortVerb{\|} |
| 759 |
%\begin{verbatim} |
| 760 |
% \begin{tabular}{|*{4}{c|}} |
| 761 |
% \hline |
| 762 |
% \thead{No}&\thead{First Data}&\thead{Second Data}&\thead{Third Data} \\ |
| 763 |
% \hline |
| 764 |
% \erows{4}{8} |
| 765 |
% \end{tabular}\quad |
| 766 |
% \begin{tabular}{||c||c||c||c||} |
| 767 |
% \hhline{|t:=:t:=:t:=:t:=:t|} |
| 768 |
% \thead{No}&\thead{First Data}&\thead{Second Data}&\thead{Third Data} \\ |
| 769 |
% \hhline{|:=::=::=::=:|} |
| 770 |
% \erows[\\ \hhline{|:=::=::=::=:|}]{4}{8} |
| 771 |
% \eline{4}\\ \hhline{|b:=:b:=:b:=:b:=:b|} |
| 772 |
% \end{tabular}\quad |
| 773 |
% \begin{tabular}{|*{4}{c|}} |
| 774 |
% \hline |
| 775 |
% \thead{No}&\thead{First Data}&\thead{Second Data}&\thead{Third Data} \\ |
| 776 |
% \hline |
| 777 |
% \Xrows{\refstepcounter{enumi}\arabic{enumi}.\eline{3}\\ \hline}{8} |
| 778 |
% \end{tabular} |
| 779 |
%\end{verbatim} |
| 780 |
% |
| 781 |
% \begin{table}[hbt]\extrarowheight1pt |
| 782 |
% \ttabbox[\hsize] |
| 783 |
% {\caption{Examples of filling of cells}\label{tab:elines}}% |
| 784 |
% {\begin{tabular}{|*{4}{c|}} |
| 785 |
% \hline |
| 786 |
% \thead{No}&\thead{First Data}&\thead{Second Data}&\thead{Third Data} \\ |
| 787 |
% \hline |
| 788 |
% \erows{4}{8} |
| 789 |
% \end{tabular}\par\bigskip |
| 790 |
% \begin{tabular}{||c||c||c||c||} |
| 791 |
% \hhline{|t:*3{=:t:}=:t|} |
| 792 |
% \thead{No}&\thead{First Data}&\thead{Second Data}&\thead{Third Data} \\ |
| 793 |
% \hhline{|:*3{=::}=:|} |
| 794 |
% \erows[\\ \hhline{|:*3{=::}=:|}]{4}{7} |
| 795 |
% \eline{4}\\ |
| 796 |
% \hhline{|b:*3{=:b:}=:b|} |
| 797 |
% \end{tabular}\par\bigskip |
| 798 |
% \begin{tabular}{|*{4}{c|}} |
| 799 |
% \hline |
| 800 |
% \thead{No}&\thead{First Data}&\thead{Second Data}&\thead{Third Data} \\ |
| 801 |
% \hline |
| 802 |
% \Xrows{\refstepcounter{enumi}\arabic{enumi}.\eline{4}\\ \hline}{8} |
| 803 |
% \end{tabular}} |
| 804 |
%\end{table} |
| 805 |
%\MakeShortVerb{\|} |
| 806 |
% |
| 807 |
% \section{Cells (One-Column Tabulars) in the Text} |
| 808 |
% |
| 809 |
% If the |\makecell| command appears in the text (outside outer tabular environment) |
| 810 |
% it could create wrong layout. The |\makecellbox| command |
| 811 |
% and |mcellbox| environment are created for one-column tabulars in the text. |
| 812 |
% |
| 813 |
% \section{Diagonally Divided Cell} |
| 814 |
% |
| 815 |
% This variant of head's positioning is not too popular nowadays, but in |
| 816 |
% the some cases it could be used. Instead of creating of |
| 817 |
% multicolumn head above a wide couple of all column heads except the |
| 818 |
% very left column, the most left column head (upper left cell) |
| 819 |
% divided by diagonal line. The lower head is usually head of very left |
| 820 |
% column and upper head---``multicolumn'' to all other column heads of |
| 821 |
% table to the right. |
| 822 |
% |
| 823 |
% This package offers macro based on possibilities of \env{picture} |
| 824 |
% environment. |
| 825 |
% \begin{quote} |
| 826 |
% |\diaghead|\texttt{(}\meta{\texttt{\textup{H}} ratio,%^^A |
| 827 |
% \textup{\texttt{V}} ratio}\texttt{)}%^^A |
| 828 |
% \marg{Text set for column width}|%|\\ |
| 829 |
% \phantom{/diaghead }\marg{First head}\marg{Second head} |
| 830 |
% \end{quote} |
| 831 |
% where \texttt{(}\meta{\textup{\texttt{H ratio}},%^^A |
| 832 |
% \textup{\texttt{V ratio}}}\texttt{)} sets the ratios like in |\line| |
| 833 |
% command (digits from~|1| up to~|6|). This argument is optional, |
| 834 |
% the default ratio (|\line| |
| 835 |
% direction) defined as~|(5,-2)|. |
| 836 |
% |
| 837 |
% The \marg{Text set for column width} |
| 838 |
% defined by hand, for example: |
| 839 |
% \quad 1)\nobreak\enskip sets the width, using longest text lines from |
| 840 |
% both heads---in this case you must put |\theadfont| macro, if you use |
| 841 |
% |\thead|'s; \quad 2)\nobreak\enskip the longest text from the rest of |
| 842 |
% column; \quad 3)\nobreak\enskip |\hskip|\meta{value}, even |\hskip\hsize| |
| 843 |
% the case of |p| column (or |X| column in \env{tabularx} environment). |
| 844 |
% The \marg{First head} |
| 845 |
% is head in lower corner (usually for first or very left column), |
| 846 |
% \marg{Second head}---in the upper corner (head for the all right columns). |
| 847 |
% |
| 848 |
% Here is code of table~\ref{tab:diaghead}. |
| 849 |
%\begin{verbatim}\makegapedcells |
| 850 |
%\begin{tabular}{|l|c|c|}\hline |
| 851 |
%\diaghead{\theadfont Diag ColumnmnHead II}% |
| 852 |
% {Diag Column \\Head I}{Diag\\Column Head II}& |
| 853 |
%\thead{Second\\column}&\thead{Third\\column}\\ |
| 854 |
%\hline... |
| 855 |
%\end{tabular}\medskip |
| 856 |
% |
| 857 |
%\begin{tabularx}{.62\hsize}{|X|c|c|}\hline |
| 858 |
%\diaghead(-4,1){\hskip\hsize}% |
| 859 |
% {Diag \\Column Head I}{Diag Column \\Head II}& |
| 860 |
%\thead{Second\\column}&\thead{Third\\column}\\ |
| 861 |
%\hline... |
| 862 |
%\end{tabularx}\medskip |
| 863 |
% |
| 864 |
% \nomakegapedcells |
| 865 |
% \begin{tabular}{|l|c|c|}\hline |
| 866 |
% \diaghead(4,1){\hskip4.2cm}% |
| 867 |
% {Diag \\Column Head I}{Diag Column \\Head II}& |
| 868 |
% \thead{Second\\column}&\thead{Third\\column}\\ |
| 869 |
%... |
| 870 |
%\end{verbatim}% |
| 871 |
% |
| 872 |
% \begin{table}[!bp]\makegapedcells |
| 873 |
% \begin{tabular}{|c|c|c|}% |
| 874 |
% \hline |
| 875 |
% \diaghead{\theadfont Diag ColumnmnHead II}%^^A |
| 876 |
% {Diag \\Column Head I}{Diag Column\\ Head II}& |
| 877 |
% \thead{Second\\column}&\thead{Third\\column}\\ |
| 878 |
% \hline |
| 879 |
% \makecell[l]{Left aligned \\ cell text} & A & 37--43\\ |
| 880 |
% \hline |
| 881 |
% \makecell*[r]{Right aligned \\ cell text} & B & 37--43\\ |
| 882 |
% \hline |
| 883 |
% \makecell[b]{Bottom aligned\\ cell text} & C & 52--58\\ |
| 884 |
% \hline |
| 885 |
% \end{tabular}% |
| 886 |
% \medskip |
| 887 |
% |
| 888 |
% \begin{tabularx}{.62\hsize}{|X|c|c|}% |
| 889 |
% \hline |
| 890 |
% \diaghead(4,1){\hskip\hsize}% |
| 891 |
% %^^A{\theadfont Diag ColuDiag Column}%^^A |
| 892 |
% {Diag \\Column Head I}{Diag Column \\Head II}& |
| 893 |
% \thead{Second\\column}&\thead{Third\\column}\\ |
| 894 |
% \hline |
| 895 |
% \makecell[l]{Left aligned \\ cell text} & A & 37--43\\ |
| 896 |
% \hline |
| 897 |
% \makecell*[r]{Right aligned \\ cell text} & B & 37--43\\ |
| 898 |
% \hline |
| 899 |
% \makecell[b]{Bottom aligned\\ cell text} & C & 52--58\\ |
| 900 |
% \hline |
| 901 |
% \end{tabularx}% |
| 902 |
% \medskip |
| 903 |
% |
| 904 |
% \nomakegapedcells |
| 905 |
% \begin{tabular}{|l|c|c|}% |
| 906 |
% \hline |
| 907 |
% \diaghead(-4,1){\hskip4.2cm}%^^A |
| 908 |
% {Diag \\Column Head I}{Diag Column \\Head II}& |
| 909 |
% \thead{Second\\column}&\thead{Third\\column}\\ |
| 910 |
% \hline |
| 911 |
% \makecell[l]{Left aligned \\ cell text} & A & 37--43\\ |
| 912 |
% \hline |
| 913 |
% \makecell*[r]{Right aligned \\ cell text} & B & 37--43\\ |
| 914 |
% \hline |
| 915 |
% \makecell[b]{Bottom aligned\\ cell text} & C & 52--58\\ |
| 916 |
% \hline |
| 917 |
% \end{tabular}% |
| 918 |
% |
| 919 |
% \caption{Examples of tabulars with diagonally divided |
| 920 |
% cells}\label{tab:diaghead} |
| 921 |
% |
| 922 |
% \end{table}% |
| 923 |
% The correct position of diagonal ends depends of width of column. If cell width |
| 924 |
% is narrower then necessary |
| 925 |
% column ends of diagonal don't touch corners of cell. |
| 926 |
% |
| 927 |
% \section{Comparison: Diagonally Divided Cell with the slashbox package} |
| 928 |
% |
| 929 |
% I didn't know about the \texttt{slashbox} package in time |
| 930 |
% when the code for the diagonal cells was created. This package uses also picture |
| 931 |
% |\line| mechanism, but calculates slopes automatically. It creates the |
| 932 |
% |\backslash| direction of diagonal lines only. (The |\slash| direction seems to be |
| 933 |
% not correct. Or direction depends to traditions of current publishing house?) |
| 934 |
% |
| 935 |
% Here is used citation of the sample file distributed with the \texttt{slashbox} package%^^A |
| 936 |
% \footnote{by Koichi Yasuoka, May 27, 1993; minor modification by Toru Sato, May 31, 1993}. |
| 937 |
% The verbatim of the table examples are added only in citation.\smallskip |
| 938 |
% |
| 939 |
% \begingroup\slshape |
| 940 |
% The usage is pretty straightforward, such as |
| 941 |
% |
| 942 |
%\begin{table}[H]% |
| 943 |
%\begin{verbatim} |
| 944 |
%\begin{tabular}{|l||*{5}{c|}}\hline |
| 945 |
%\backslashbox{Room}{Date} |
| 946 |
%&\makebox[3em]{5/31}&\makebox[3em]{6/1}&\makebox[3em]{6/2} |
| 947 |
%&\makebox[3em]{6/3}&\makebox[3em]{6/4}\\\hline\hline |
| 948 |
%Meeting Room &&&&&\\\hline |
| 949 |
%Auditorium &&&&&\\\hline |
| 950 |
%Seminar Room &&&&&\\\hline |
| 951 |
%\end{tabular} |
| 952 |
%\end{verbatim}% |
| 953 |
% |
| 954 |
% \noindent |
| 955 |
% \begin{tabular}{|l||*{5}{c|}}\hline |
| 956 |
% \backslashbox{Room}{Date} |
| 957 |
% &\makebox[3em]{5/31}&\makebox[3em]{6/1}&\makebox[3em]{6/2} |
| 958 |
% &\makebox[3em]{6/3}&\makebox[3em]{6/4}\\\hline\hline |
| 959 |
% Meeting Room &&&&&\\\hline |
| 960 |
% Auditorium &&&&&\\\hline |
| 961 |
% Seminar Room &&&&&\\\hline |
| 962 |
% \end{tabular} |
| 963 |
%\end{table}% |
| 964 |
% |
| 965 |
% You may include a newline (\verb+\\+) in `Room' and/or `Date'. |
| 966 |
% Note that you will get spaces aside the slash line if there is a |
| 967 |
% wider column in the same column of a different line. |
| 968 |
% In such a case, you need to specify the width of the slashed column |
| 969 |
% by saying |
| 970 |
% |
| 971 |
%\begin{table}[H]% |
| 972 |
%\begin{verbatim} |
| 973 |
%\begin{tabular}{|l||*{4}{c|}}\hline |
| 974 |
%\backslashbox[48mm]{Room}{Date} |
| 975 |
%&\makebox[3em]{5/31}&\makebox[3em]{6/1}&\makebox[3em]{6/2} |
| 976 |
%&\makebox[3em]{6/3}\\\hline\hline |
| 977 |
%Room With a Long Name &&&&\\\hline |
| 978 |
%Auditorium &&&&\\\hline |
| 979 |
%Seminar Room &&&&\\\hline |
| 980 |
%\end{tabular} |
| 981 |
%\end{verbatim}% |
| 982 |
% |
| 983 |
% \noindent |
| 984 |
% \begin{tabular}{|l||*{4}{c|}}\hline |
| 985 |
% \backslashbox[48mm]{Room}{Date} |
| 986 |
% &\makebox[3em]{5/31}&\makebox[3em]{6/1}&\makebox[3em]{6/2} |
| 987 |
% &\makebox[3em]{6/3}\\\hline\hline |
| 988 |
% Room With a Long Name &&&&\\\hline |
| 989 |
% Auditorium &&&&\\\hline |
| 990 |
% Seminar Room &&&&\\\hline |
| 991 |
% \end{tabular} |
| 992 |
%\end{table}% |
| 993 |
% |
| 994 |
% \bigskip |
| 995 |
% The specified width is neglected if it is narrower than the natural |
| 996 |
% width of the column. |
| 997 |
% |
| 998 |
% \verb+\(back)slashbox+ assumes by default that there is a blank space |
| 999 |
% of width \verb+\tabcolsep+ on both sides of the column. |
| 1000 |
% Thus the slash line might exceeds the boundary when you use \verb+@{}+ |
| 1001 |
% etc. |
| 1002 |
% |
| 1003 |
% You can avoid it by specifying |
| 1004 |
% |
| 1005 |
%\begin{table}[H]% |
| 1006 |
%\begin{verbatim} |
| 1007 |
%\begin{tabular}{|@{\ $\bullet$\hspace*{3mm}}l||*{5}{c|}}\hline |
| 1008 |
%\multicolumn{1}{|@{}l||}{\backslashbox[0pt][l]{Room}{Date}} |
| 1009 |
%&\makebox[3em]{5/31}&\makebox[4em]{6/1}&\makebox[3em]{6/2} |
| 1010 |
%&\makebox[3em]{6/3}&\makebox[3em]{6/4}\\\hline\hline |
| 1011 |
%Meeting Room &&&&&\\\hline |
| 1012 |
%Auditorium &&&&&\\\hline |
| 1013 |
%Seminar Room &&&&&\\\hline |
| 1014 |
%\end{tabular} |
| 1015 |
%\end{verbatim}% |
| 1016 |
% |
| 1017 |
% \bigskip |
| 1018 |
% |
| 1019 |
% \noindent |
| 1020 |
% \begin{tabular}{|@{\ $\bullet$\hspace*{3mm}}l||*{5}{c|}}\hline |
| 1021 |
% \multicolumn{1}{|@{}l||}{\backslashbox[0pt][l]{Room}{Date}} |
| 1022 |
% &\makebox[3em]{5/31}&\makebox[4em]{6/1}&\makebox[3em]{6/2} |
| 1023 |
% &\makebox[3em]{6/3}&\makebox[3em]{6/4}\\\hline\hline |
| 1024 |
% Meeting Room &&&&&\\\hline |
| 1025 |
% Auditorium &&&&&\\\hline |
| 1026 |
% Seminar Room &&&&&\\\hline |
| 1027 |
% \end{tabular} |
| 1028 |
%\end{table}% |
| 1029 |
% |
| 1030 |
% Here \verb+[l]+ tells the command that there is no extra space on the |
| 1031 |
% left of this column. You can use \verb+[r]+ and \verb+[lr]+ likewise. |
| 1032 |
% You have to also specify the width of the column in this case, but it |
| 1033 |
% can be~0pt. |
| 1034 |
% \endgroup |
| 1035 |
% |
| 1036 |
% The addition for the sample with |\slashbox| command. This example demonstrates that you may combine |
| 1037 |
% the \texttt{makecell} commands and |\backslashbox|. |
| 1038 |
% |
| 1039 |
%\begin{table}[H]% |
| 1040 |
%\begin{verbatim} |
| 1041 |
%\begin{tabular}{|l||*{5}{c|}}\hline |
| 1042 |
%\theadset\theadfont\backslashbox{Room}{Date} |
| 1043 |
%&\makebox[3em]{\thead{5/31}}&\makebox[3em]{\thead{6/1}}&\makebox[3em]{\thead{6/2}} |
| 1044 |
%&\makebox[3em]{6/3}&\makebox[3em]{\thead{6/4}}\\\hline\hline |
| 1045 |
%Meeting Room &&&&&\\\hline |
| 1046 |
%Auditorium &&&&&\\\hline |
| 1047 |
%Seminar Room &&&&&\\\hline |
| 1048 |
%\end{tabular} |
| 1049 |
%\end{verbatim}% |
| 1050 |
% |
| 1051 |
% \noindent |
| 1052 |
% \begin{tabular}{|l||*{5}{c|}}\hline |
| 1053 |
%\theadset\theadfont\backslashbox{Room}{Date} |
| 1054 |
%&\makebox[3em]{\thead{5/31}}&\makebox[3em]{\thead{6/1}}&\makebox[3em]{\thead{6/2}} |
| 1055 |
%&\makebox[3em]{6/3}&\makebox[3em]{\thead{6/4}}\\\hline\hline |
| 1056 |
% Meeting Room &&&&&\\\hline |
| 1057 |
% Auditorium &&&&&\\\hline |
| 1058 |
% Seminar Room &&&&&\\\hline |
| 1059 |
% \end{tabular} |
| 1060 |
%\end{table}% |
| 1061 |
% |
| 1062 |
%\begin{table}[H]% |
| 1063 |
%\begin{verbatim} |
| 1064 |
%\begin{tabular}{|l||*{4}{c|}}\hline |
| 1065 |
%\theadset\backslashbox[48mm]{Room}{Date} |
| 1066 |
%&\makebox[3em]{\thead{5/31}}&\makebox[3em]{\thead{6/1}}&\makebox[3em]{\thead{6/2}} |
| 1067 |
%&\makebox[3em]{\thead{6/3}}\\\hline\hline |
| 1068 |
%Room With a Long Name &&&&\\\hline |
| 1069 |
%Auditorium &&&&\\\hline |
| 1070 |
%Seminar Room &&&&\\\hline |
| 1071 |
%\end{tabular} |
| 1072 |
%\end{verbatim}% |
| 1073 |
% |
| 1074 |
% \noindent |
| 1075 |
% \begin{tabular}{|l||*{4}{c|}}\hline |
| 1076 |
% \theadset\backslashbox[48mm]{Room}{Date} |
| 1077 |
% &\makebox[3em]{\thead{5/31}}&\makebox[3em]{\thead{6/1}}&\makebox[3em]{\thead{6/2}} |
| 1078 |
% &\makebox[3em]{\thead{6/3}}\\\hline\hline |
| 1079 |
% Room With a Long Name &&&&\\\hline |
| 1080 |
% Auditorium &&&&\\\hline |
| 1081 |
% Seminar Room &&&&\\\hline |
| 1082 |
% \end{tabular} |
| 1083 |
%\end{table}% |
| 1084 |
% |
| 1085 |
% \clearpage |
| 1086 |
% \section{Thick Rules for the hline and cline Commands} |
| 1087 |
% |
| 1088 |
% For horizontal rules in tabular there were added two commands |
| 1089 |
% \cmd{\Xhline} and \cmd{\Xcline} |
| 1090 |
% They use additional mandatory argument with defined rule width. |
| 1091 |
% |
| 1092 |
% The example, with result in table~\ref{tab:XmrowIII}. |
| 1093 |
%\begin{verbatim}% |
| 1094 |
%\begin{table} |
| 1095 |
%\renewcommand\theadset{\def\arraystretch{.85}}% |
| 1096 |
%\renewcommand\theadgape{} |
| 1097 |
%\ttabbox |
| 1098 |
%{\caption{...}\label{...}}% |
| 1099 |
%{\begin{tabular}{!{\vrule width1.2pt}c |
| 1100 |
% !{\vrule width1.2pt}c|c |
| 1101 |
% !{\vrule width1.2pt}} |
| 1102 |
%\Xhline{1.2pt} |
| 1103 |
%\multirowthead{4}{First Column head}& |
| 1104 |
%\multicolumn{2}{c!{\vrule width1.2pt}}{\thead{Multicolumn head}}\\ |
| 1105 |
%\Xcline{2-3}{1.2pt} |
| 1106 |
% & \thead{Second \\multlined \\ column head} & |
| 1107 |
% \thead{Third \\ column head}\\ |
| 1108 |
%\Xhline{1.2pt} |
| 1109 |
%Cell text & A &\multirowcell{4}{28--31}\\ |
| 1110 |
%... |
| 1111 |
%\Xhline{1.2pt} |
| 1112 |
%\end{tabular}} |
| 1113 |
%\end{table} |
| 1114 |
%\end{verbatim}% |
| 1115 |
% |
| 1116 |
% \begin{table}\makegapedcells\relax |
| 1117 |
%\renewcommand\theadset{\def\arraystretch{.85}}% |
| 1118 |
%\renewcommand\theadgape{} |
| 1119 |
% \ttabbox |
| 1120 |
% {\caption{Example of \env{tabular} environment with |
| 1121 |
% thick lines}\label{tab:XmrowIII}}% |
| 1122 |
% {\begin{tabular}{!{\vrule width1.2pt}c |
| 1123 |
% !{\vrule width1.2pt}c|c!{\vrule width1.2pt}} |
| 1124 |
% \Xhline{1.2pt} |
| 1125 |
% \multirowthead{4}{First Column head}& |
| 1126 |
% \multicolumn{2}{c!{\vrule width1.2pt}}{\thead{Multicolumn head}}\\ |
| 1127 |
% \Xcline{2-3}{1.2pt} |
| 1128 |
% & \thead{Second \\multlined \\ column head} & |
| 1129 |
% \thead{Third \\ column head}\\ |
| 1130 |
% \Xhline{1.2pt} |
| 1131 |
% Cell text & A &\multirowcell{4}{28--31}\\ |
| 1132 |
% \cline{1-2} |
| 1133 |
% \makecell{Multilined \\Cell text} & B& \\ |
| 1134 |
% \hline |
| 1135 |
% \makecell[l]{Left aligned \\ cell text} & C |
| 1136 |
% & \multirowcell{4}[0ex][l]{37--43}\\ |
| 1137 |
% \cline{1-2} |
| 1138 |
% \makecell[r]{Right aligned \\ cell text} & D & \\ |
| 1139 |
% \hline |
| 1140 |
% \makecell[b]{Bottom aligned \\ cell text} & E & |
| 1141 |
% \multirowcell{6}[0ex][r]{37--43\\52--58}\\ |
| 1142 |
% \cline{1-2} |
| 1143 |
% \makecell[{{p{5cm}}}]{Cell long long long long long long text with |
| 1144 |
% predefined width} & F & \\ |
| 1145 |
% \cline{1-2} |
| 1146 |
% \makecell[{{>{\parindent1em}p{5cm}}}]{Cell long long long long long |
| 1147 |
% long text with predefined width} & G & \\ |
| 1148 |
% \Xhline{1.2pt} |
| 1149 |
% \end{tabular}} |
| 1150 |
% \end{table} |
| 1151 |
% |
| 1152 |
% \StopEventually{}\clearpage |
| 1153 |
% |
| 1154 |
% \section{Code of package} |
| 1155 |
% |
| 1156 |
% \subsection{Multilined cells} |
| 1157 |
% |
| 1158 |
% First goes request of \package{array} package. |
| 1159 |
% \begin{macrocode} |
| 1160 |
\RequirePackage{array} |
| 1161 |
% \end{macrocode} |
| 1162 |
% |
| 1163 |
% \begin{macro}{\makecell} |
| 1164 |
% The definition of command for multilined cells. At first defined |\gape| |
| 1165 |
% stuff. Non-star form loads special setting for vertical space around (if it |
| 1166 |
% used). Star form always creates additional vertical |\jot|-spaces. |
| 1167 |
% \begin{macrocode} |
| 1168 |
\newcommand\makecell{\@ifstar{\let\tabg@pe\gape\makecell@}% |
| 1169 |
{\let\tabg@pe\cellgape\makecell@}} |
| 1170 |
% \end{macrocode} |
| 1171 |
% Next macro loads vertical and horizontal common alignment for cells and |
| 1172 |
% loads redefined spacing parameters |\arraystretch| and |\extrarowheight| |
| 1173 |
% if these parameters were redefined. |
| 1174 |
% \begin{macrocode} |
| 1175 |
\newcommand\makecell@{\def\t@bset{\cellset}% |
| 1176 |
\let\mcell@align\cellalign |
| 1177 |
\@ifnextchar[\mcell@tabular |
| 1178 |
{\expandafter\mcell@@tabular\cellalign\@nil}} |
| 1179 |
% \end{macrocode} |
| 1180 |
% \end{macro} |
| 1181 |
% |
| 1182 |
% \begin{macro}{\thead} |
| 1183 |
% The macro for tabular column heads. At first defined |\gape| stuff. |
| 1184 |
% Non-star from loads special setting for vertical space around (if it used). |
| 1185 |
% Star form always creates additional vertical |\jot|-spaces. |
| 1186 |
% \begin{macrocode} |
| 1187 |
\newcommand\thead{\@ifstar{\let\tabg@pe\gape\thead@}% |
| 1188 |
{\let\tabg@pe\theadgape\thead@}} |
| 1189 |
% \end{macrocode} |
| 1190 |
% Next macro loads vertical and horizontal common alignment for column heads |
| 1191 |
% and loads redefined spacing parameters |\arraystretch| and |\extrarowheight| |
| 1192 |
% if these parameters were redefined. (First go settings |
| 1193 |
% for cells, as for |\makecell|, then special settings for column heads.) |
| 1194 |
% |
| 1195 |
% For column heads also loaded font settings. |
| 1196 |
% \begin{macrocode} |
| 1197 |
\newcommand\thead@{\def\t@bset{\cellset\theadfont\theadset}% |
| 1198 |
\let\mcell@align\theadalign |
| 1199 |
\@ifnextchar[\mcell@tabular |
| 1200 |
{\expandafter\mcell@@tabular\theadalign\@nil}} |
| 1201 |
% \end{macrocode} |
| 1202 |
% \end{macro} |
| 1203 |
% |
| 1204 |
% \begin{macro}{\rotheadsize} |
| 1205 |
% The width dimension for rotated cells. |
| 1206 |
% \begin{macrocode} |
| 1207 |
\@ifdefinable\rotheadsize{\newdimen\rotheadsize} |
| 1208 |
% \end{macrocode} |
| 1209 |
% \end{macro} |
| 1210 |
% |
| 1211 |
% \begin{macro}{\rotcell} |
| 1212 |
% The macro for rotated cell. If no \package{rotating} package loaded |
| 1213 |
% this macro works like |\makecell|. |
| 1214 |
% \begin{macrocode} |
| 1215 |
\newcommand\rotcell{\@ifundefined{turn}% |
| 1216 |
{\PackageWarning{makecell}% |
| 1217 |
{\string\rotcell\space needs rotating package}% |
| 1218 |
\let\tabg@pe\empty\let\t@bset\cellset\makecell@} |
| 1219 |
{\@ifnextchar[{\@rotcell}{\@@rotcell}}} |
| 1220 |
% \end{macrocode} |
| 1221 |
% For rotated cell default column setting is similar to |p{\rotheadsize}| (plus |
| 1222 |
% some additional justification settings) |
| 1223 |
% \begin{macrocode} |
| 1224 |
\@ifdefinable\@rotcell{} |
| 1225 |
\def\@rotcell[#1]#2{\makecell*{\\[-.65\normalbaselineskip] |
| 1226 |
\turn{\cellrotangle}\makecell[#1]{#2}\endturn}} |
| 1227 |
\newcommand\@@rotcell[1]{\makecell*{\\[-.65\normalbaselineskip] |
| 1228 |
\turn{\cellrotangle}\makecell[c{>{\rightskip0explus |
| 1229 |
\rotheadsize\hyphenpenalty0\pretolerance-1% |
| 1230 |
\noindent\hskip\z@}p{\rotheadsize} |
| 1231 |
}]{#1}\endturn}} |
| 1232 |
% \end{macrocode} |
| 1233 |
% \end{macro} |
| 1234 |
% |
| 1235 |
% \begin{macro}{\rothead} |
| 1236 |
% The macro for rotated tabular column heads. If no \package{rotating} package |
| 1237 |
% loaded this macro works like |\thead|. |
| 1238 |
% \begin{macrocode} |
| 1239 |
\newcommand\rothead{\@ifundefined{turn}% |
| 1240 |
{\PackageWarning{makecell}{\string\rothead\space |
| 1241 |
needs rotating package}% |
| 1242 |
\let\tabg@pe\theadgape |
| 1243 |
\def\t@bset{\cellset\theadfont\theadset}\thead@}% |
| 1244 |
{\let\theadgape\rotheadgape |
| 1245 |
\@ifnextchar[{\@rothead}{\@@rothead}}} |
| 1246 |
% \end{macrocode} |
| 1247 |
% For rotated column head default column setting is similar to |
| 1248 |
% |p{\rotheadsize}| (plus some additional justification settings) |
| 1249 |
% \begin{macrocode} |
| 1250 |
\@ifdefinable\@rothead{} |
| 1251 |
\def\@rothead[#1]#2{\thead{\\[-.65\normalbaselineskip] |
| 1252 |
\turn{\cellrotangle}\thead[#1]{#2@{}}\endturn}} |
| 1253 |
\newcommand\@@rothead[1]{\thead{\\[-.65\normalbaselineskip] |
| 1254 |
\turn{\cellrotangle}\thead[c{>{\rightskip0explus |
| 1255 |
\rotheadsize\hyphenpenalty0\pretolerance-1% |
| 1256 |
\noindent\hskip\z@}p{\rotheadsize} |
| 1257 |
@{}}]{#1}\endturn}} |
| 1258 |
% \end{macrocode} |
| 1259 |
% \end{macro} |
| 1260 |
% |
| 1261 |
% \begin{macro}{\multirowcell} |
| 1262 |
% The macro for multirow cells. If no \package{multirow} package loaded |
| 1263 |
% this macro works like |\makecell|. |
| 1264 |
% \begin{macrocode} |
| 1265 |
\newcommand\multirowcell{\@ifundefined{multirow}% |
| 1266 |
{\PackageWarning{makecell}{\string\multirowcell\space |
| 1267 |
needs multirow package}}% |
| 1268 |
{\let\mcell@multirow\multirow}\mcell@mrowcell@} |
| 1269 |
% \end{macrocode} |
| 1270 |
% These macros define settings for |\multirow| arguments. |
| 1271 |
% \begin{macrocode} |
| 1272 |
\newcommand\mcell@mrowcell@[1]{\@ifnextchar |
| 1273 |
[{\mcell@mrowcell@@{#1}}{\mcell@mrowcell@@{#1}[0pt]}} |
| 1274 |
\@ifdefinable\mcell@mrowcell@@{} |
| 1275 |
\def\mcell@mrowcell@@#1[#2]{\edef\mcell@nrows{#1}\edef\mcell@fixup{#2}% |
| 1276 |
\let\tabg@pe\cellgape\makecell@} |
| 1277 |
% \end{macrocode} |
| 1278 |
% \end{macro} |
| 1279 |
% |
| 1280 |
% \begin{macro}{\multirowthead} |
| 1281 |
% The macro for multirow column heads. If no \package{multirow} package loaded |
| 1282 |
% this macro works like |\thead|. |
| 1283 |
% \begin{macrocode} |
| 1284 |
\newcommand\multirowthead{\@ifundefined{multirow}% |
| 1285 |
{\PackageWarning{makecell}{\string\multirowthead\space |
| 1286 |
needs multirow package}}% |
| 1287 |
{\let\mcell@multirow\multirow}\mcell@mrowhead@} |
| 1288 |
% \end{macrocode} |
| 1289 |
% These macros define settings for |\multirow| arguments. |
| 1290 |
% \begin{macrocode} |
| 1291 |
\newcommand\mcell@mrowhead@[1]{\@ifnextchar |
| 1292 |
[{\mcell@mrowhead@@{#1}}{\mcell@mrowhead@@{#1}[0pt]}} |
| 1293 |
\@ifdefinable\mcell@mrowhead@@{} |
| 1294 |
\def\mcell@mrowhead@@#1[#2]{\edef\mcell@nrows{#1}\edef\mcell@fixup{#2}% |
| 1295 |
\let\tabg@pe\theadgape\thead@} |
| 1296 |
% \end{macrocode} |
| 1297 |
% \end{macro} |
| 1298 |
% |
| 1299 |
% \begin{macro}{\mcell@multirow} |
| 1300 |
% By default |\mcell@multirow| macro gobbles |\multirow|'s arguments. |
| 1301 |
% \begin{macrocode} |
| 1302 |
\@ifdefinable\mcell@multirow{} |
| 1303 |
\def\mcell@multirow#1#2[#3]{}% |
| 1304 |
% \end{macrocode} |
| 1305 |
% \end{macro} |
| 1306 |
% |
| 1307 |
% Definitions for horizontal and vertical alignments, which use by \env{tabular} |
| 1308 |
% and \env{array} environments. |
| 1309 |
% |
| 1310 |
% For \texttt{l}, \texttt{r}, \texttt{t}, and \texttt{b} alignments commands |
| 1311 |
% set |c|-argument as vertical or horizontal centering alignment if necessary. |
| 1312 |
% For \texttt{l} and \texttt{r} alignments also redefined alignment |
| 1313 |
% settings for |\makecell| (|\thead|) blocks. |
| 1314 |
% \begin{macrocode} |
| 1315 |
\newcommand\mcell@l{\def\mcell@ii{l}\let\mcell@c\mcell@ic |
| 1316 |
\global\let\mcell@left\relax} |
| 1317 |
\newcommand\mcell@r{\def\mcell@ii{r}\let\mcell@c\mcell@ic |
| 1318 |
\global\let\mcell@right\relax} |
| 1319 |
\newcommand\mcell@t{\def\mcell@i{t}\let\mcell@c\mcell@iic} |
| 1320 |
\newcommand\mcell@b{\def\mcell@i{b}\let\mcell@c\mcell@iic} |
| 1321 |
\newcommand\mcell@{} |
| 1322 |
% \end{macrocode} |
| 1323 |
% If alone |c|-argument loaded it is used for horizontal alignment. |
| 1324 |
% \begin{macrocode} |
| 1325 |
\newcommand\mcell@c{\def\mcell@ii{c}} |
| 1326 |
\newcommand\mcell@ic{\def\mcell@i{c}} |
| 1327 |
\newcommand\mcell@iic{\def\mcell@ii{c}} |
| 1328 |
% \end{macrocode} |
| 1329 |
% Default vertical and horizontal alignment is centered. |
| 1330 |
% \begin{macrocode} |
| 1331 |
\newcommand\mcell@i{c} |
| 1332 |
\newcommand\mcell@ii{c} |
| 1333 |
% \end{macrocode} |
| 1334 |
% |
| 1335 |
% Default horizontal alignment of |\makecell| (|\thead|) blocks is centered. |
| 1336 |
% \begin{macrocode} |
| 1337 |
\@ifdefinable\mcell@left{\let\mcell@left\hfill} |
| 1338 |
\@ifdefinable\mcell@right{\let\mcell@right\hfill} |
| 1339 |
% \end{macrocode} |
| 1340 |
% |
| 1341 |
% \begin{macro}{\mcell@tabular} |
| 1342 |
% \begin{macro}{\mcell@@tabular} |
| 1343 |
% \begin{macro}{\mcell@@@tabular} |
| 1344 |
% The core macros for tabular building. |
| 1345 |
% |
| 1346 |
% Next few macros for sorting of |\makecell| (|\thead|) arguments. |
| 1347 |
% \begin{macrocode} |
| 1348 |
\@ifdefinable\mcell@tabular{}\@ifdefinable\mcell@@tabular{} |
| 1349 |
\@ifdefinable\mcell@@@tabular{} |
| 1350 |
\def\mcell@tabular[#1]#2{\mcell@@tabular#1\@nil{#2}} |
| 1351 |
% \end{macrocode} |
| 1352 |
% The code for this macro borrowed from \package{caption} 3.x package (AS). |
| 1353 |
% \begin{macrocode} |
| 1354 |
\newcommand\mcell@ifinlist[2]{% |
| 1355 |
\let\next\@secondoftwo |
| 1356 |
\edef\mcell@tmp{#1}% |
| 1357 |
\@for\mcell@Tmp:={#2}\do{% |
| 1358 |
\ifx\mcell@tmp\mcell@Tmp |
| 1359 |
\let\next\@firstoftwo |
| 1360 |
\fi}\next} |
| 1361 |
% \end{macrocode} |
| 1362 |
% |
| 1363 |
% The |\mcell@@tabular| macro at first calls |\mcell@setalign| macro for |
| 1364 |
% sorting of alignment arguments, then calls |\mcell@@@tabular| |
| 1365 |
% macro, which created tabular cell or column head. |
| 1366 |
% \begin{macrocode} |
| 1367 |
\def\mcell@@tabular#1#2\@nil#3{% |
| 1368 |
\expandafter\mcell@setalign\mcell@align\@nil |
| 1369 |
\mcell@setalign{#1}{#2}\@nil |
| 1370 |
\expandafter\mcell@@@tabular\expandafter\mcell@i\mcell@ii\@nil{#3}} |
| 1371 |
% \end{macrocode} |
| 1372 |
% |
| 1373 |
% \begin{macro}{\mcell@setalign} |
| 1374 |
% This macro sorts arguments for vertical and horizontal alignment. |
| 1375 |
% |
| 1376 |
% First argument has second check at the end of macro for the case if |
| 1377 |
% it is |c|-argument. |
| 1378 |
% \begin{macrocode} |
| 1379 |
\@ifdefinable\mcell@setalign{} |
| 1380 |
\def\mcell@setalign#1#2\@nil{\def\@tempa{#1}\def\@tempc{c}% |
| 1381 |
% \end{macrocode} |
| 1382 |
% Restore default alignment for |\makecell| and |\thead| blocks. |
| 1383 |
% \begin{macrocode} |
| 1384 |
\global\let\mcell@left\hfill\global\let\mcell@right\hfill |
| 1385 |
% \end{macrocode} |
| 1386 |
% If in optional argument appears alone |c|-argument it defines |
| 1387 |
% horizontal centering only. |
| 1388 |
% \begin{macrocode} |
| 1389 |
\def\mcell@c{\def\mcell@ii{c}}% |
| 1390 |
\mcell@ifinlist{#1}{l,r,t,b,c,}{\@nameuse{mcell@#1}}% |
| 1391 |
% \end{macrocode} |
| 1392 |
% If argument is not \texttt{l}, \texttt{r}, \texttt{c}, \texttt{t}, |
| 1393 |
% or \texttt{b} it could define horizontal alignment only. |
| 1394 |
% \begin{macrocode} |
| 1395 |
{\def\mcell@ii{#1}\let\mcell@c\mcell@ic |
| 1396 |
\let\mcell@left\relax\let\mcell@right\relax}% |
| 1397 |
\mcell@ifinlist{#2}{l,r,t,b,c,}{\@nameuse{mcell@#2}}% |
| 1398 |
% \end{macrocode} |
| 1399 |
% If argument is not \texttt{l}, \texttt{r}, \texttt{c}, \texttt{t}, |
| 1400 |
% or \texttt{b} it could define horizontal alignment only. |
| 1401 |
% \begin{macrocode} |
| 1402 |
{\def\mcell@ii{#2}\let\mcell@c\mcell@ic |
| 1403 |
\let\mcell@left\relax\let\mcell@right\relax}% |
| 1404 |
% \end{macrocode} |
| 1405 |
% Here goes repeated check for first argument, if it is |c|-argument |
| 1406 |
% we call |\mcell@c| command, which can be now redefined. |
| 1407 |
% \begin{macrocode} |
| 1408 |
\ifx\@tempa\@tempc\mcell@c\fi |
| 1409 |
} |
| 1410 |
% \end{macrocode} |
| 1411 |
% \end{macro} |
| 1412 |
% |
| 1413 |
% This macro builds tabular itself. |
| 1414 |
% First (and last) go commands which align |\makecell| and |\thead| |
| 1415 |
% blocks like \texttt{l}, \texttt{r}, or \texttt{c} (if they loaded). |
| 1416 |
% Then goes check whether math mode exists. |
| 1417 |
% The |\mcell@multirow| emulation macro transforms to |\multirow| |
| 1418 |
% when necessary. |
| 1419 |
% \begin{macrocode} |
| 1420 |
\def\mcell@@@tabular#1#2\@nil#3{%\mcell@mstyle |
| 1421 |
\ifdim\parindent<\z@\leavevmode\else\noindent\fi |
| 1422 |
\null\mcell@left |
| 1423 |
\ifmmode |
| 1424 |
\mcell@multirow\mcell@nrows*[\mcell@fixup]{\tabg@pe |
| 1425 |
{\hbox{\t@bset$\array[#1]{@{}#2@{}}#3\endarray$}}}% |
| 1426 |
\else |
| 1427 |
\mcell@multirow\mcell@nrows*[\mcell@fixup]{\tabg@pe |
| 1428 |
{\hbox{\t@bset\tabular[#1]{@{}#2@{}}#3\endtabular}}}% |
| 1429 |
\fi\mcell@right\null} |
| 1430 |
% \end{macrocode} |
| 1431 |
% \end{macro} |
| 1432 |
% \end{macro} |
| 1433 |
% \end{macro} |
| 1434 |
% |
| 1435 |
% \begin{environment}{\mcellbox} |
| 1436 |
% \begin{macro}{\makecellbox} |
| 1437 |
% \begin{macrocode} |
| 1438 |
\@ifdefinable\mcell@start{}\@ifdefinable\mcell@stop{} |
| 1439 |
\newcommand\mcellbox[1][c]{% |
| 1440 |
\expandafter\mcell@setalign\cellalign\@nil |
| 1441 |
\expandafter\mcell@setalign#1\@nil |
| 1442 |
\expandafter\mcell@box\expandafter\mcell@i\mcell@ii\@nil} |
| 1443 |
\@ifdefinable\mcell@box{} |
| 1444 |
\def\mcell@box#1#2\@nil{% |
| 1445 |
\ifdim\parindent<\z@\leavevmode\else\noindent\fi |
| 1446 |
\ifmmode\def\mcell@start{$\array}\def\mcell@stop{\endarray$}\else |
| 1447 |
\def\mcell@start{\tabular}\def\mcell@stop{\endtabular}\fi |
| 1448 |
\hbox\bgroup\cellset\mcell@start[#1]{@{}#2@{}}}% |
| 1449 |
\def\endmcellbox {\mcell@stop\egroup} |
| 1450 |
\newcommand\makecellbox[2][c]{\begin{mcellbox}[#1]#2\end{mcellbox}} |
| 1451 |
% \end{macrocode} |
| 1452 |
% \end{macro} |
| 1453 |
% \end{environment} |
| 1454 |
% |
| 1455 |
% \begin{macro}{\cellset} |
| 1456 |
% \begin{macro}{\cellgape} |
| 1457 |
% \begin{macro}{\cellalign} |
| 1458 |
% \begin{macro}{\cellrotangle} |
| 1459 |
% \begin{macro}{\theadfont} |
| 1460 |
% \begin{macro}{\theadset} |
| 1461 |
% \begin{macro}{\theadgape} |
| 1462 |
% \begin{macro}{\rotheadgape} |
| 1463 |
% \begin{macro}{\theadalign} |
| 1464 |
% The layout macros for tabular building settings.\nopagebreak |
| 1465 |
% |
| 1466 |
% Spacing settings for tabular spacing inside cells (like |\arraystretch| |
| 1467 |
% or |\extrarowheight|).\nopagebreak |
| 1468 |
% \begin{macrocode} |
| 1469 |
\newcommand\cellset{\def\arraystretch{1}\extrarowheight\z@ |
| 1470 |
\nomakegapedcells} |
| 1471 |
% \end{macrocode} |
| 1472 |
% Vertical space around cells (created by |\gape| stuff). |
| 1473 |
% \begin{macrocode} |
| 1474 |
\newcommand\cellgape{} |
| 1475 |
% \end{macrocode} |
| 1476 |
% Vertical and horizontal alignment of cell text. |
| 1477 |
% \begin{macrocode} |
| 1478 |
\newcommand\cellalign{cc} |
| 1479 |
% \end{macrocode} |
| 1480 |
% Angle for rotated column heads and cells. |
| 1481 |
% \begin{macrocode} |
| 1482 |
\newcommand\cellrotangle{90} |
| 1483 |
% \end{macrocode} |
| 1484 |
% |
| 1485 |
% Font for column heads |
| 1486 |
% \begin{macrocode} |
| 1487 |
\newcommand\theadfont{\footnotesize} |
| 1488 |
% \end{macrocode} |
| 1489 |
% Special spacing settings for tabular spacing in column heads (like |
| 1490 |
% |\arraystretch| or/and |\extrarowheight|). |
| 1491 |
% \begin{macrocode} |
| 1492 |
\newcommand\theadset{} |
| 1493 |
% \end{macrocode} |
| 1494 |
% Vertical space around column heads (created by |\gape| stuff). |
| 1495 |
% \begin{macrocode} |
| 1496 |
\newcommand\theadgape{\gape} |
| 1497 |
% \end{macrocode} |
| 1498 |
% Vertical space around rotated column heads. |
| 1499 |
% \begin{macrocode} |
| 1500 |
\newcommand\rotheadgape{} |
| 1501 |
% \end{macrocode} |
| 1502 |
% Vertical and horizontal alignment of column head text. |
| 1503 |
% \begin{macrocode} |
| 1504 |
\newcommand\theadalign{cc} |
| 1505 |
% \end{macrocode} |
| 1506 |
% \end{macro} |
| 1507 |
% \end{macro} |
| 1508 |
% \end{macro} |
| 1509 |
% \end{macro} |
| 1510 |
% \end{macro} |
| 1511 |
% \end{macro} |
| 1512 |
% \end{macro} |
| 1513 |
% \end{macro} |
| 1514 |
% \end{macro} |
| 1515 |
% |
| 1516 |
% \subsection{Gape commands} |
| 1517 |
% |
| 1518 |
% \begin{macro}{\gape} |
| 1519 |
% \begin{macro}{\setcellgapes} |
| 1520 |
% The macro itself. It uses analogous to |\smash| macro from \package{amsmath} |
| 1521 |
% package. |
| 1522 |
% \begin{macrocode} |
| 1523 |
\@ifdefinable\gape{} |
| 1524 |
\DeclareRobustCommand\gape{\@ifnextchar[\@gape{\@gape[tb]}} |
| 1525 |
% \end{macrocode} |
| 1526 |
% |
| 1527 |
% The |\setcellgapes| defines settings used by |\makegapedcells| command. |
| 1528 |
% |
| 1529 |
% First goes check for optional argument. |
| 1530 |
% \begin{macrocode} |
| 1531 |
\newcommand\setcellgapes{\@ifnextchar[%] |
| 1532 |
{\mcell@setgapes{MB}}{\mcell@setgapes{MB}[tb]}} |
| 1533 |
% \end{macrocode} |
| 1534 |
% Then body of settings. |
| 1535 |
% \begin{macrocode} |
| 1536 |
\@ifdefinable\@setcellgapes{} |
| 1537 |
\def\mcell@setgapes#1[#2]#3{\expandafter\let\csname |
| 1538 |
mcell@#1@\expandafter\endcsname\csname mcell@mb@#2\endcsname |
| 1539 |
\@namedef{mcell@#1jot}{#3}% |
| 1540 |
% \end{macrocode} |
| 1541 |
% Negative compensate inside |\makegapedsells| area. |
| 1542 |
% \begin{macrocode} |
| 1543 |
\@namedef{mcell@#1negjot}{-#3}\@namedef{mcell@#1negtb}{#2}} |
| 1544 |
% \end{macrocode} |
| 1545 |
% |
| 1546 |
% \begin{macrocode} |
| 1547 |
\newcommand\negjot[1]{{\jot\mcell@MBnegjot\gape[mcell@MBnegtb]{#1}}} |
| 1548 |
% \end{macrocode} |
| 1549 |
% |
| 1550 |
% The macros which count advanced height and depth of boxes. |
| 1551 |
% \begin{macrocode} |
| 1552 |
\newcommand\mcell@mb@t[2]{% |
| 1553 |
\@tempdima\ht#1\advance\@tempdima#2\ht#1\@tempdima} |
| 1554 |
\newcommand\mcell@mb@b[2]{% |
| 1555 |
\@tempdimb\dp#1\advance\@tempdimb#2\dp#1\@tempdimb} |
| 1556 |
\newcommand\mcell@mb@tb[2]{\mcell@mb@t{#1}{#2}\mcell@mb@b{#1}{#2}} |
| 1557 |
% \end{macrocode} |
| 1558 |
% |
| 1559 |
% The body of |\gape| macros. |
| 1560 |
% \begin{macrocode} |
| 1561 |
\@ifdefinable\@gape{}\@ifdefinable\@@gape{} |
| 1562 |
\def\@gape[#1]{\mcell@setgapes{mb}[#1]{\jot}\@@gape} |
| 1563 |
\def\@@gape{% |
| 1564 |
\ifmmode \expandafter\mathpalette\expandafter\mathg@pe |
| 1565 |
\else \expandafter\makeg@pe |
| 1566 |
\fi} |
| 1567 |
% \end{macrocode} |
| 1568 |
% \end{macro} |
| 1569 |
% \end{macro} |
| 1570 |
% |
| 1571 |
% \begin{macro}{\makeg@pe} |
| 1572 |
% The macros which put box with necessary parameters in text and math mode. |
| 1573 |
% \begin{macrocode} |
| 1574 |
\newcommand\makeg@pe[1]{\setbox\z@ |
| 1575 |
\hbox{\color@begingroup#1\color@endgroup}\mcell@mb@\z@\mcell@mbjot\box\z@} |
| 1576 |
\newcommand\mathg@pe[2]{\setbox\z@ |
| 1577 |
\hbox{$\m@th#1{#2}$}\mcell@mb@\z@\mcell@mbjot\box\z@} |
| 1578 |
% \end{macrocode} |
| 1579 |
% \end{macro} |
| 1580 |
% |
| 1581 |
% \begin{macro}{\Gape} |
| 1582 |
% The macros which put box with necessary parameters in text and math mode. |
| 1583 |
% \begin{macrocode} |
| 1584 |
\@ifdefinable\Gape{} |
| 1585 |
\DeclareRobustCommand\Gape{\@ifnextchar[\@Gape{\@Gape[\jot]}} |
| 1586 |
\@ifdefinable\@Gape{}\@ifdefinable\@@Gape{} |
| 1587 |
\def\@Gape[#1]{\@ifnextchar[{\@@Gape[#1]}{\@@Gape[#1][#1]}} |
| 1588 |
\def\@@Gape[#1][#2]{\def\depth{\dp\z@}\def\height{\ht\z@}% |
| 1589 |
\edef\mcell@mb@##1##2{% |
| 1590 |
\@tempdima\ht\z@\advance\@tempdima#1\ht\z@\@tempdima |
| 1591 |
\@tempdimb\dp\z@\advance\@tempdimb#2\dp\z@\@tempdimb}% |
| 1592 |
\@@gape} |
| 1593 |
% \end{macrocode} |
| 1594 |
% \end{macro} |
| 1595 |
% |
| 1596 |
% \begin{macro}{\topstrut} |
| 1597 |
% \begin{macro}{\botstrut} |
| 1598 |
% \begin{macro}{\bottopstrut} |
| 1599 |
% The macros abbreviations for |\strut| which changed by value of |\jot|. |
| 1600 |
% First enlarges both depth and height. |
| 1601 |
% \begin{macrocode} |
| 1602 |
\newcommand\bottopstrut{\gape{\strut}} |
| 1603 |
% \end{macrocode} |
| 1604 |
% Second enlarges only height. |
| 1605 |
% \begin{macrocode} |
| 1606 |
\newcommand\topstrut{\gape[t]{\strut}} |
| 1607 |
% \end{macrocode} |
| 1608 |
% Third enlarges only depth. |
| 1609 |
% \begin{macrocode} |
| 1610 |
\newcommand\botstrut{\gape[b]{\strut}} |
| 1611 |
% \end{macrocode} |
| 1612 |
% \end{macro} |
| 1613 |
% \end{macro} |
| 1614 |
% \end{macro} |
| 1615 |
% |
| 1616 |
% \subsection{Modification of command from \package{array} package} |
| 1617 |
% |
| 1618 |
% \begin{macro}{\makegapedcells} |
| 1619 |
% \begin{macro}{\nomakegapedcells} |
| 1620 |
% At first is saved |\@classz| macro. |
| 1621 |
% \begin{macrocode} |
| 1622 |
\@ifdefinable\mcell@oriclassz{\let\mcell@oriclassz\@classz} |
| 1623 |
% \end{macrocode} |
| 1624 |
% This macros redefine and restore the |\@classz| macro from \package{array} |
| 1625 |
% package. |
| 1626 |
% \begin{macrocode} |
| 1627 |
\newcommand\makegapedcells{\let\@classz\mcell@classz} |
| 1628 |
\newcommand\nomakegapedcells{\let\@classz\mcell@oriclassz} |
| 1629 |
% \end{macrocode} |
| 1630 |
% \end{macro} |
| 1631 |
% \end{macro} |
| 1632 |
% |
| 1633 |
% \begin{macro}{\mcell@agape} |
| 1634 |
% Following macro creates tabular/array cells with changed vertical spaces. |
| 1635 |
% \begin{macrocode} |
| 1636 |
\newcommand\mcell@agape[1]{\setbox\z@\hbox{#1}\mcell@MB@\z@\mcell@MBjot |
| 1637 |
\null\mcell@left\box\z@\mcell@right\null} |
| 1638 |
% \end{macrocode} |
| 1639 |
% \end{macro} |
| 1640 |
% |
| 1641 |
% \begin{macro}{\mcell@classz} |
| 1642 |
% Redefined |\@classz| macro from \package{array} package. |
| 1643 |
% \begin{macrocode} |
| 1644 |
\newcommand\mcell@classz{\@classx |
| 1645 |
\@tempcnta \count@ |
| 1646 |
\prepnext@tok |
| 1647 |
\@addtopreamble{%\mcell@mstyle |
| 1648 |
\ifcase\@chnum |
| 1649 |
\hfil |
| 1650 |
\mcell@agape{\d@llarbegin\insert@column\d@llarend}\hfil \or |
| 1651 |
\hskip1sp |
| 1652 |
\mcell@agape{\d@llarbegin\insert@column\d@llarend}\hfil \or |
| 1653 |
\hfil\hskip1sp |
| 1654 |
\mcell@agape{\d@llarbegin \insert@column\d@llarend}\or |
| 1655 |
$\mcell@agape{\vcenter |
| 1656 |
\@startpbox{\@nextchar}\insert@column\@endpbox}$\or |
| 1657 |
\mcell@agape{\vtop |
| 1658 |
\@startpbox{\@nextchar}\insert@column\@endpbox}\or |
| 1659 |
\mcell@agape{\vbox |
| 1660 |
\@startpbox{\@nextchar}\insert@column\@endpbox}% |
| 1661 |
\fi |
| 1662 |
\global\let\mcell@left\relax\global\let\mcell@right\relax |
| 1663 |
}\prepnext@tok} |
| 1664 |
% \end{macrocode} |
| 1665 |
% \end{macro} |
| 1666 |
% |
| 1667 |
% \subsection{Rows of skipped and numbered cells} |
| 1668 |
% |
| 1669 |
% \begin{macro}{\eline} |
| 1670 |
% The row of empty cells. |
| 1671 |
% \begin{macrocode} |
| 1672 |
\@ifdefinable\eline{} |
| 1673 |
\DeclareRobustCommand\eline[1]{\@temptokena{}\count@ #1% |
| 1674 |
\advance\count@\m@ne |
| 1675 |
\loop \@temptokena\expandafter{\the\@temptokena&}% |
| 1676 |
\advance\count@\m@ne \ifnum\count@>\z@\repeat |
| 1677 |
\the\@temptokena\ignorespaces} |
| 1678 |
% \end{macrocode} |
| 1679 |
% \end{macro} |
| 1680 |
% |
| 1681 |
% \begin{macro}{\erows} |
| 1682 |
% \begin{macro}{\Xrows} |
| 1683 |
% Lazy macros for filling few rows. |
| 1684 |
% \begin{macrocode} |
| 1685 |
%\newtoks\@temptokenb\newtoks\@temptokenc |
| 1686 |
%\newcommand\erows[3][\\ \hline]{\relax\@temptokenb{}\@temptokenc{}\@tempcnta#3\relax |
| 1687 |
% \count@#2\advance\count@\m@ne\loop\showthe\@temptokenc |
| 1688 |
% \@temptokenc\expandafter{\the\@temptokenc&}% |
| 1689 |
% \advance\count@\m@ne \ifnum\count@>\z@\repeat |
| 1690 |
% \loop |
| 1691 |
% \global\@temptokenb\expandafter{\the\expandafter\@temptokenb\expandafter\the\@temptokenc#1}% |
| 1692 |
% \advance\@tempcnta\m@ne \ifnum\@tempcnta>\z@\repeat |
| 1693 |
% \the\@temptokenb\showthe\@temptokenb} |
| 1694 |
\newcommand\erows[3][\\ \hline]{\@temptokena{}\count@ #3% |
| 1695 |
\loop \@temptokena\expandafter{\the\@temptokena\eline{#2}#1}% |
| 1696 |
\advance\count@\m@ne \ifnum\count@>\z@\repeat |
| 1697 |
\the\@temptokena} |
| 1698 |
\newcommand\Xrows[2]{\@temptokena{}\count@ #2% |
| 1699 |
\loop \@temptokena\expandafter{\the\@temptokena#1}% |
| 1700 |
\advance\count@\m@ne \ifnum\count@>\z@\repeat |
| 1701 |
\the\@temptokena} |
| 1702 |
% \end{macrocode} |
| 1703 |
% \end{macro} |
| 1704 |
% \end{macro} |
| 1705 |
% |
| 1706 |
% \begin{macro}{\rnline} |
| 1707 |
% \begin{macro}{\nline} |
| 1708 |
% The rows of numbered cells. The |\rnline| command replaces |\Alph| and |
| 1709 |
% |\alph| counter by |\Asbuk| and |\asbuk| consequently. |
| 1710 |
% \begin{macrocode} |
| 1711 |
\newcounter{nlinenum} |
| 1712 |
\@ifdefinable\rnline{} |
| 1713 |
\DeclareRobustCommand\rnline{\gdef |
| 1714 |
\TeXr@rus{\let\@Alph\@Asbuk\let\@alph\@asbuk}\@nline} |
| 1715 |
\@ifdefinable\nline{} |
| 1716 |
\DeclareRobustCommand\nline{\gdef\TeXr@rus{}\@nline} |
| 1717 |
\newcommand\@nline{\@ifnextchar[%] |
| 1718 |
{\@@nline}{\@@nline[1]}} |
| 1719 |
\@ifdefinable\@@nline{} |
| 1720 |
\def\@@nline[#1]{\@ifnextchar[%] |
| 1721 |
{\@@@nline[#1]}{\@@@nline[#1][1]}} |
| 1722 |
\@ifdefinable\@@@nline{} |
| 1723 |
\def\@@@nline[#1][#2]#3{\count@ #3 |
| 1724 |
\def\TeXr@label{\TeXr@label@{nlinenum}}% |
| 1725 |
\expandafter\TeXr@loop\@gobble{}#1\@@@ |
| 1726 |
\xdef\Num{\the\TeXr@lab}% |
| 1727 |
\c@nlinenum#2\relax% |
| 1728 |
\expandafter\@temptokena\expandafter{\Num |
| 1729 |
\global\advance\c@nlinenum\@ne}% |
| 1730 |
\advance\count@\m@ne |
| 1731 |
\loop\@temptokena\expandafter{\the\@temptokena& |
| 1732 |
\Num \global\advance\c@nlinenum\@ne}% |
| 1733 |
\advance\count@\m@ne \ifnum\count@>\z@ \repeat |
| 1734 |
\the\@temptokena\ignorespaces} |
| 1735 |
% \end{macrocode} |
| 1736 |
% \end{macro} |
| 1737 |
% \end{macro} |
| 1738 |
% |
| 1739 |
% [Borrowed code stuff and explanation from \package{enumerate}/\package{paralist} |
| 1740 |
% packages just with changes of command names.] |
| 1741 |
% |
| 1742 |
% Internal token register used to build up the label command from the |
| 1743 |
% optional argument. |
| 1744 |
% \begin{macrocode} |
| 1745 |
\newtoks\TeXr@lab |
| 1746 |
% \end{macrocode} |
| 1747 |
% This just expands to a `?'. |\ref| will produce this, if no counter |
| 1748 |
% is printed. |
| 1749 |
% \begin{macrocode} |
| 1750 |
\def\TeXr@qmark{?} |
| 1751 |
% \end{macrocode} |
| 1752 |
% The next four macros build up the command that will print the item |
| 1753 |
% label. They each gobble one token or group from the optional argument, |
| 1754 |
% and add corresponding tokens to the register |\@enLab|. They each end |
| 1755 |
% with a call to |\@enloop|, which starts the processing of the next |
| 1756 |
% token. |
| 1757 |
% \begin{macro}{\TeXr@label} |
| 1758 |
% Add the counter to the label. |#2| will be one of the `special' |
| 1759 |
% tokens |A a I i 1|, and is thrown away. |#1| will be a command |
| 1760 |
% like |\Roman|. |
| 1761 |
% \begin{macrocode} |
| 1762 |
\def\TeXr@label@#1#2#3{% |
| 1763 |
\edef\TeXr@the{\noexpand#2{#1}}% |
| 1764 |
\TeXr@lab\expandafter |
| 1765 |
{\the\TeXr@lab\TeXr@rus\csname the#1\endcsname}% |
| 1766 |
\advance\@tempcnta1 |
| 1767 |
\TeXr@loop} |
| 1768 |
% \end{macrocode} |
| 1769 |
% The only foreign command in this stuff. It indicates whether |
| 1770 |
% the list has numeration by Russian letters. |
| 1771 |
% \begin{macrocode} |
| 1772 |
\def\TeXr@rus{} |
| 1773 |
% \end{macrocode} |
| 1774 |
% \end{macro} |
| 1775 |
% |
| 1776 |
% \begin{macro}{\TeXr@space} |
| 1777 |
% \begin{macro}{\TeXr@sp@ce} |
| 1778 |
% Add a space to the label. The tricky bit is to gobble the space token, |
| 1779 |
% as you can not do this with a macro argument. |
| 1780 |
% \begin{macrocode} |
| 1781 |
\def\TeXr@space{\afterassignment\TeXr@sp@ce\let\@tempa= } |
| 1782 |
\def\TeXr@sp@ce{\TeXr@lab\expandafter{\the\TeXr@lab\space}\TeXr@loop} |
| 1783 |
% \end{macrocode} |
| 1784 |
% \end{macro} |
| 1785 |
% \end{macro} |
| 1786 |
% |
| 1787 |
% \begin{macro}{\TeXr@group} |
| 1788 |
% Add a |{ }| group to the label. |
| 1789 |
% \begin{macrocode} |
| 1790 |
\def\TeXr@group#1{\TeXr@lab\expandafter{\the\TeXr@lab{#1}}\TeXr@loop} |
| 1791 |
% \end{macrocode} |
| 1792 |
% \end{macro} |
| 1793 |
% |
| 1794 |
% \begin{macro}{\TeXr@other} |
| 1795 |
% Add anything else to the label |
| 1796 |
% \begin{macrocode} |
| 1797 |
\def\TeXr@other#1{\TeXr@lab\expandafter{\the\TeXr@lab#1}\TeXr@loop} |
| 1798 |
% \end{macrocode} |
| 1799 |
% \end{macro} |
| 1800 |
% |
| 1801 |
% \begin{macro}{\TeXr@loop} |
| 1802 |
% \begin{macro}{\TeXr@loop@} |
| 1803 |
% The body of the main loop. |
| 1804 |
% Eating tokens this way instead of using |\@tfor| lets you see |
| 1805 |
% spaces and {\bf all} braces. |\@tfor| would treat {\tt a} and |
| 1806 |
% |{a}| as special, but not |{{a}}|. |
| 1807 |
% \begin{macrocode} |
| 1808 |
\def\TeXr@loop{\futurelet\TeXr@temp\TeXr@loop@} |
| 1809 |
% \end{macrocode} |
| 1810 |
% \begin{macrocode} |
| 1811 |
\def\TeXr@loop@{% |
| 1812 |
\ifx A\TeXr@temp \def\@tempa{\TeXr@label\Alph }\else |
| 1813 |
\ifx a\TeXr@temp \def\@tempa{\TeXr@label\alph }\else |
| 1814 |
\ifx i\TeXr@temp \def\@tempa{\TeXr@label\roman }\else |
| 1815 |
\ifx I\TeXr@temp \def\@tempa{\TeXr@label\Roman }\else |
| 1816 |
\ifx 1\TeXr@temp \def\@tempa{\TeXr@label\arabic}\else |
| 1817 |
\ifx \@sptoken\TeXr@temp \let\@tempa\TeXr@space \else |
| 1818 |
\ifx \bgroup\TeXr@temp \let\@tempa\TeXr@group \else |
| 1819 |
\ifx \@@@\TeXr@temp \let\@tempa\@gobble \else |
| 1820 |
\let\@tempa\TeXr@other |
| 1821 |
% \end{macrocode} |
| 1822 |
% Hook for possible extensions |
| 1823 |
% \begin{macrocode} |
| 1824 |
\TeXr@hook |
| 1825 |
\fi\fi\fi\fi\fi\fi\fi\fi |
| 1826 |
\@tempa} |
| 1827 |
% \end{macrocode} |
| 1828 |
% \end{macro} |
| 1829 |
% \end{macro} |
| 1830 |
% |
| 1831 |
% \begin{macro}{\TeXr@hook} |
| 1832 |
% \begin{macrocode} |
| 1833 |
\providecommand\TeXr@hook{} |
| 1834 |
% \end{macrocode} |
| 1835 |
% \end{macro} |
| 1836 |
% |
| 1837 |
% \subsection{Diagonally separated column heads} |
| 1838 |
% |
| 1839 |
% \begin{macro}{\diaghead} |
| 1840 |
% Macro for diagonally separated column heads. |
| 1841 |
% \begin{macrocode} |
| 1842 |
\newcommand\diaghead{\@ifnextchar({\mcell@diaghead}{\mcell@diagheads}} |
| 1843 |
\@ifdefinable\mcell@diaghead{} |
| 1844 |
\def\mcell@diaghead(#1){\def\celldiagratio{(#1)}\mcell@diagheads} |
| 1845 |
% \end{macrocode} |
| 1846 |
% The default value of diagonal ratio. |
| 1847 |
% \begin{macrocode} |
| 1848 |
\newcommand\celldiagratio{(5,-2)} |
| 1849 |
% \end{macrocode} |
| 1850 |
% The building itself |
| 1851 |
% \begin{macrocode} |
| 1852 |
\newcommand\mcell@diagheads[3]{\hbox\bgroup\expandafter |
| 1853 |
\mcell@getcelldiagratios\celldiagratio\relax |
| 1854 |
\@tempswafalse |
| 1855 |
% \end{macrocode} |
| 1856 |
% depends of sign of ratios. |
| 1857 |
% \begin{macrocode} |
| 1858 |
\ifnum\mcell@Hratio<\z@\count@-\mcell@Hratio\relax |
| 1859 |
\edef\mcell@Hratio{\the\count@}\relax |
| 1860 |
\ifnum\mcell@Vratio<\z@\count@-\mcell@Vratio\relax |
| 1861 |
\edef\mcell@Vratio{\the\count@}\else\@tempswatrue |
| 1862 |
\fi |
| 1863 |
\else |
| 1864 |
\ifnum\mcell@Vratio<\z@\count@-\mcell@Vratio\relax |
| 1865 |
\edef\mcell@Vratio{\the\count@}\@tempswatrue\else |
| 1866 |
\fi |
| 1867 |
\fi |
| 1868 |
\settowidth\@tempdima{#1}\advance\@tempdima2\tabcolsep |
| 1869 |
\edef\mcell@diagH{\the\@tempdima}\divide\@tempdima\mcell@Hratio |
| 1870 |
\@tempdima\mcell@Vratio\@tempdima\edef\mcell@diagV{\the\@tempdima}% |
| 1871 |
% \end{macrocode} |
| 1872 |
% The |\unitlength| here is |\relaxed|, we use just real dimensions. |
| 1873 |
% \begin{macrocode} |
| 1874 |
\let\mcell@oriunitlength\unitlength\let\unitlength\relax |
| 1875 |
\kern-\tabcolsep\kern-\@wholewidth |
| 1876 |
\setbox\z@\hbox{\theadfont{\strut}}\@tempdima\dp\z@ |
| 1877 |
% \end{macrocode} |
| 1878 |
% The value of compensate vertical spacing defined here experimentally |
| 1879 |
% and equals to 2~default line thickness. |
| 1880 |
% \begin{macrocode} |
| 1881 |
\advance\@tempdima.8\p@%2\@wholewidth |
| 1882 |
% \end{macrocode} |
| 1883 |
% If |\makedgapedcells| switched on for the table there is |
| 1884 |
% compensate spacing. |
| 1885 |
% \begin{macrocode} |
| 1886 |
{\ifx\@classz\mcell@classz |
| 1887 |
\setbox\z@\hbox{#1}\ht\z@\z@\dp\z@\z@ |
| 1888 |
\mcell@MB@\z@\mcell@MBjot |
| 1889 |
\global\dimen@\@tempdima\global\@tempdimb\@tempdimb |
| 1890 |
\else\global\dimen@\z@\global\@tempdimb\z@\fi |
| 1891 |
}% |
| 1892 |
\advance\@tempdima\dimen@ |
| 1893 |
\edef\mcell@diagVoffset{\the\@tempdima}% |
| 1894 |
\@tempdima\mcell@diagV\advance\@tempdima-\mcell@diagVoffset |
| 1895 |
\advance\@tempdima-\@tempdimb |
| 1896 |
\edef\mcell@diagVcorr{\the\@tempdima}% |
| 1897 |
\noindent\nomakegapedcells\hbox{\begin{tabular}{@{}c@{}}% |
| 1898 |
% \end{macrocode} |
| 1899 |
% At least a~|\normallineskip| vertical space from top and bottom of cell. |
| 1900 |
% \begin{macrocode} |
| 1901 |
\ifdim\jot<2\p@\jot2\p@\fi |
| 1902 |
\if@tempswa |
| 1903 |
% \end{macrocode} |
| 1904 |
% For South-East or North-West directions. |
| 1905 |
% \begin{macrocode} |
| 1906 |
\begin{picture}(\mcell@diagH,\mcell@diagVcorr)(\z@,\mcell@diagVoffset)% |
| 1907 |
\put(\z@,\mcell@diagV){\makebox(\z@,\z@)[tl]% |
| 1908 |
{\edef\tempa{(\mcell@Hratio,-\mcell@Vratio)}\expandafter |
| 1909 |
\line\tempa{\mcell@diagH}}} |
| 1910 |
\put(\tabcolsep,\jot)% |
| 1911 |
{\makebox(\z@,\z@)[bl]{\theadfont |
| 1912 |
\let\cellset\theadset\makecell[bl]{\strut#2}}} |
| 1913 |
\@tempdima\mcell@diagH\advance\@tempdima-\tabcolsep |
| 1914 |
\@tempdimb\mcell@diagV\advance\@tempdimb-\jot |
| 1915 |
\put(\@tempdima,\@tempdimb)% |
| 1916 |
{\makebox(\z@,\z@)[tr]{\theadfont |
| 1917 |
\let\cellset\theadset\makecell[tr]{#3\strut}}} |
| 1918 |
\end{picture}% |
| 1919 |
\else |
| 1920 |
% \end{macrocode} |
| 1921 |
% For South-West or North-East directions. |
| 1922 |
% \begin{macrocode} |
| 1923 |
\begin{picture}(\mcell@diagH,\mcell@diagVcorr)(\z@,\mcell@diagVoffset)% |
| 1924 |
\put(\z@,\mcell@diagV){\makebox(\z@,\z@)[tl]% |
| 1925 |
{\edef\tempa{(\mcell@Hratio,\mcell@Vratio)}\expandafter |
| 1926 |
\line\tempa{\mcell@diagH}}} |
| 1927 |
\@tempdima\mcell@diagV\advance\@tempdima-\jot |
| 1928 |
\put(\tabcolsep,\@tempdima)% |
| 1929 |
{\makebox(\z@,\z@)[tl]{\theadfont |
| 1930 |
\let\cellset\theadset\makecell[tl]{\strut#3}}} |
| 1931 |
\@tempdima\mcell@diagH\advance\@tempdima-\tabcolsep |
| 1932 |
\put(\@tempdima,\jot)% |
| 1933 |
{\makebox(\z@,\z@)[br]% |
| 1934 |
{\theadfont |
| 1935 |
\let\cellset\theadset{\makecell[br]{#2\strut}}}} |
| 1936 |
\end{picture}% |
| 1937 |
\fi |
| 1938 |
\end{tabular}% |
| 1939 |
\kern-\tabcolsep\kern-\@wholewidth |
| 1940 |
}\let\unitlength\mcell@oriunitlength\egroup\par |
| 1941 |
\ifvmode\strut |
| 1942 |
\vspace*{-\normalbaselineskip}\vspace*{-\normallineskip} |
| 1943 |
\fi |
| 1944 |
} |
| 1945 |
% \end{macrocode} |
| 1946 |
% \end{macro} |
| 1947 |
% Macro used by previous one. Extracts ratios for defining of height of cell. |
| 1948 |
% \begin{macrocode} |
| 1949 |
\@ifdefinable\mcell@getcelldiagratios{} |
| 1950 |
\def\mcell@getcelldiagratios(#1,#2){\def\mcell@Hratio{#1}\def\mcell@Vratio{#2}} |
| 1951 |
% \end{macrocode} |
| 1952 |
% |
| 1953 |
% \subsection{The \cmd{\hline} and \cmd{\cline} with necessary thickness} |
| 1954 |
% |
| 1955 |
% \begin{macro}{\Xhline} |
| 1956 |
% The commands for |\hline| and |\cline| with necessary thickness. |
| 1957 |
% Added code for the |longtable| environment. |
| 1958 |
% \begin{macrocode} |
| 1959 |
\newcommand\Xhline[1]{\noalign{\ifnum0=`}\fi\arrayrulewidth#1% |
| 1960 |
\ifx\hline\LT@hline\let\@xhline\LT@@hline\fi |
| 1961 |
\hrule\@height\arrayrulewidth\futurelet\reserved@a\@xhline} |
| 1962 |
% \end{macrocode} |
| 1963 |
% \end{macro} |
| 1964 |
% |
| 1965 |
% \begin{macro}{\Xcline} |
| 1966 |
% \begin{macrocode} |
| 1967 |
\def\Xcline#1#2{\@Xcline#1;#2\@nil} |
| 1968 |
\def\@Xcline#1-#2;#3\@nil{% |
| 1969 |
\omit |
| 1970 |
\@multicnt#1% |
| 1971 |
\advance\@multispan\m@ne |
| 1972 |
\ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi |
| 1973 |
\@multicnt#2% |
| 1974 |
\advance\@multicnt-#1% |
| 1975 |
\advance\@multispan\@ne |
| 1976 |
\leaders\hrule\@height#3\hfill |
| 1977 |
\cr |
| 1978 |
\noalign{\vskip-#3}} |
| 1979 |
% \end{macrocode} |
| 1980 |
% \end{macro} |
| 1981 |
% |
| 1982 |
% \Finale |
| 1983 |
\endinput |