diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/makecell/makecell.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/makecell/makecell.dtx | 633 |
1 files changed, 501 insertions, 132 deletions
diff --git a/Master/texmf-dist/source/latex/makecell/makecell.dtx b/Master/texmf-dist/source/latex/makecell/makecell.dtx index b26f47ba5b0..6e1b30b6ba1 100644 --- a/Master/texmf-dist/source/latex/makecell/makecell.dtx +++ b/Master/texmf-dist/source/latex/makecell/makecell.dtx @@ -1,7 +1,7 @@ % \iffalse % -% makecell.dtx - tabular column heads and multilined cells. -% (c) 2005--2006 Olga Lapko (Lapko.O@g23.relcom.ru) +% makecell.dtx - Managing of tabular column heads and cells. +% (c) 2005--2007 Olga Lapko (Lapko.O@g23.relcom.ru) % % This program is provided under the terms of the % LaTeX Project Public License distributed from CTAN @@ -16,7 +16,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{makecell} %<*package> - [2006/06/28 v0.1c Multilined Cells and Tabular Heads] + [2007/05/24 V0.1d Managing of Tab Column Heads and Cells] %</package> % %<*batchfile> @@ -36,7 +36,7 @@ \documentclass{ltxdoc} \usepackage{makecell} \IfFileExists{rotating.sty}{\usepackage{rotating}}{} -\IfFileExists{footmisc.sty}{\usepackage[perpage]{footmisc}}{} +\IfFileExists{footmisc.sty}{\usepackage[perpage,bottom]{footmisc}}{} \IfFileExists{multirow.sty}{\usepackage{multirow}}{} \IfFileExists{hyperref.sty}{\usepackage{hyperref}}{} \IfFileExists{hypcap.sty}{\usepackage{hypcap}}{} @@ -70,7 +70,7 @@ %</driver> % \fi % -% \CheckSum{887} +% \CheckSum{1238} % % \GetFileInfo{makecell.dtx} % @@ -92,16 +92,26 @@ % layout for tabular column heads in whole documentation. Another command, % |\makecell|, is offered for creation of multilined tabular cells. % -% Package also offers: \quad 1)\nobreak\enskip macro |\makegapedcells|, which -% changes vertical spaces around all cells in tabular, like in \pkg{tabls} -% package, but uses code of \pkg{array} package. (Macro |\makegapedcells| -% redefines macro |\@classz| from this package. Macro |\nomakegapedcells| -% cancels this redefinition.); \quad 2)\nobreak\enskip macros |\multirowhead| -% and |\multirowcell|, which use |\multirow| macro from \pkg{multirow} -% package.\smallskip +% Package also offers: \quad 1)\nobreak\enskip macro |\makegapedcells|, +% which changes vertical spaces around all cells in tabular, like in +% \pkg{tabls} package, but uses code of \pkg{array} package. (Macro +% |\makegapedcells| redefines macro |\@classz| from \pkg{array} package. +% Macro |\nomakegapedcells| cancels this redefinition.); +% \quad 2)\nobreak\enskip macros |\multirowhead| and |\multirowcell|, +% which use |\multirow| macro from \pkg{multirow} package; +% \quad 3)\nobreak\enskip numbered rows |\nline| or skipping cells |\eline| +% in tabulars; +% \quad 4)\nobreak\enskip diagonally divided cells (|\diaghead|); +% \quad 5)\nobreak\enskip |\hline| and |\cline| with defined thickness: +% |\Xhline| and |\Xcline| consequently. +% \smallskip % % \end{abstract} % +% \clearpage +% \tableofcontents +% +% \clearpage % \section{Tabular Cells and Column Heads} % % \subsection{Building Commands} @@ -109,8 +119,8 @@ % \DescribeMacro{\makecell} % Macro creates one-column tabular with predefined common settings of % alignment, spacing and vertical spaces around (see section~\ref{sec:sets}). -% This will be useful for creation of multilined cells. This macro allows optional -% alignment settings. +% This will be useful for creation of multilined cells. This macro allows +% optional alignment settings. % \begin{quote} % |\makecell|\oarg{vertical or/and horizontal alignment}\marg{cell text} % \end{quote} @@ -162,23 +172,25 @@ % \end{tabular}} % \end{table} % -% Starred form of command, |\makecell*|, creates vertical |\jot| spaces around. +% Starred form of command, |\makecell*|, creates vertical |\jot| spaces +% around. % -% \emph{Note}. When you define column alignment like |p{3cm}| in optional argument -% of |\makecell| (or |\thead|, see below), please follow these rules: \quad -% 1)\nobreak\enskip if -% vertical alignment defined, write column alignment in group, e.g. |[c{p{3cm}}]|; -% \quad 2)\nobreak\enskip if it is absent, write column alignment in double -% group---|[{{p{3cm}}}]|, or add empty group---|[{}{p{3cm}}]|. Be also careful -% with vertical alignment when you define column alignment as paragraph block: -% e.g., use |{{b{3cm}}}| for bottom alignment (and |{{m{3cm}}}| for centered -% vertical alignment). +% \emph{Note}. When you define column alignment like |{p{3cm}}| in optional +% argument of |\makecell| (or |\thead|, see below), please follow these +% rules: \quad 1)\nobreak\enskip if vertical +% alignment defined, write column alignment in group, e.g. |[c{p{3cm}}]|; +% \quad 2)\nobreak\enskip if vertical alignment is absent, +% write column alignment in double +% group---|[{{p{3cm}}}]|, or add empty group---|[{}{p{3cm}}]|. Be also +% careful with vertical alignment when you define column alignment as +% paragraph block: e.g., use |{{b{3cm}}}| for bottom alignment (and +% |{{m{3cm}}}| for centered vertical alignment). % % \DescribeMacro{\thead} % Macro creates one-column \texttt{tabular} for column heads with predefined -% common settings (see table~\ref{tab:thead}). This macro uses common layout for -% column heads: font, alignment, spacing, and vertical spaces around -% (see section~\ref{sec:sets}). +% common settings (see table~\ref{tab:thead}). This macro uses common layout +% for column heads: font, alignment, spacing, and vertical spaces around +% (see section~\ref{sec:tsets}). %\begin{verbatim} %\renewcommand\theadset{\def\arraystretch{.85}}% %\begin{tabular}{|l|c|} @@ -223,7 +235,7 @@ % \begin{quote} % |\settowidth\rotheadsize{\theadfont |\meta{Widest head text}|}| % \end{quote} -% like in following example: +% like in following example (table~\ref{tab:rotheads}): %\begin{verbatim} %\settowidth\rotheadsize{\theadfont Second multilined} %\begin{tabular}{|l|c|} @@ -237,7 +249,7 @@ %\end{verbatim} % \begin{table}[h] % \ttabbox -% {\caption{Example of rotated column heads}}% +% {\caption{Example of rotated column heads}\label{tab:rotheads}}%^^A% % {\settowidth\rotheadsize{\theadfont Second multilined}%^^A % \begin{tabular}{l|l} % \hline @@ -251,10 +263,10 @@ % % \subsection{Settings For Tabular Cells}\label{sec:sets} % -% This section describes macros, which make layout tuning for multilined cells, -% created by |\makecell| macro (and also |\multirowcell| and |\rotcell| macros). -% The |\cellset| macro also is used by |\thead| (|\rothead|, |\multirowtead|) -% macro. +% This section describes macros, which make layout tuning for multilined +% cells, created by |\makecell| macro (and also |\multirowcell| and +% |\rotcell| macros). The |\cellset| macro also is used by |\thead| +% (|\rothead|, |\multirowtead|) macro. % % \DescribeMacro{\cellset} % Spacing settings for cells. Here you could use commands like: @@ -262,8 +274,7 @@ % |\renewcommand\cellset{\renewcommand\arraytretch{1}%|\\ % | \setlength\extrarowheight{0pt}}| % \end{quote} -% as was defined in current package. These settings -% used by both |\makecell| and |\thead| (|\rothead|, |\multirowtead|) commands. +% as was defined in current package. % % \DescribeMacro{\cellalign} % Default align for cells. Package offers vertical and horizontal centering @@ -271,8 +282,10 @@ % \begin{quote} % |\renewcommand\cellalign{cc}| % \end{quote} -% Define vertical spaces around |\makecell|, using |\gape| command if necessary. -% It defined like: +% +% \DescribeMacro{\cellgape} +% Define vertical spaces around |\makecell|, using |\gape| command if +% necessary. It defined like: % \begin{quote} % |\renewcommand\cellgape{}| % \end{quote} @@ -284,17 +297,17 @@ % \begin{quote} % |\renewcommand\cellgape{\gape[t]}| % \end{quote} -% (See also section~\ref{sec:gape} about |\gape| command.) +% (See also section~\ref{sec:gape} about |\gape| and |\Gape| command.) % % \DescribeMacro{\cellrotangle} % The angle for rotated cells and column heads. The default value 90 % (counterclockwise). This value definition is used by both |\rotcell| and % |\rothead| macros. % -% \subsection{Settings For Column Heads} +% \subsection{Settings For Column Heads}\label{sec:tsets} % -% This section describes macros, which make layout tuning for tabular column heads, -% created by |\thead| (|\rothead|, |\multirowtead|) macro. +% This section describes macros, which make layout tuning for tabular column +% heads, created by |\thead| (|\rothead|, |\multirowtead|) macro. % % \DescribeMacro{\theadfont} % Sets a special font for column heads. It could be smaller size @@ -316,13 +329,15 @@ % \end{quote} % % \DescribeMacro{\theadalign} -% Default align for tabular column heads. Here also offered centering alignment: +% Default align for tabular column heads. Here also offered centering +% alignment: % \begin{quote} % |\renewcommand\theadalign{cc}| % \end{quote} % % \DescribeMacro{\theadgape} -% Define vertical spaces around, using |\gape| command if necessary. +% Define vertical spaces around column head (|\thead|), +% using |\gape| command if necessary. % It defined like: % \begin{quote} % |\renewcommand\theadgape{\gape}| @@ -334,20 +349,22 @@ % |\renewcommand\rotheadgape{}| % \end{quote} % +% \clearpage % \section{Changing of Height and Depth of Boxes}\label{sec:gape} % % Sometimes \env{tabular} or \env{array} cells, or some elements in text need a -% height/depth correction. The |\raisebox| command could help for it, but usage -% of that macro in these cases, especially inside math, is rather complex. -% Current package offers the |\gape| macro, which usage is similar to |\smash| -% macro. The |\gape| macro allows to change height and/or depth of included -% box with necessary dimension. +% height/depth correction. The |\raisebox| command could help for it, but +% usage of that macro in these cases, especially inside math, is rather +% complex. Current package offers the |\gape| macro, which usage is similar +% to |\smash| macro. The |\gape| macro allows to change height and/or depth +% of included box with necessary dimension. % % \DescribeMacro{\gape} -% This macro changes included box by |\jot| value (usually 3\,pt). It is defined -% with optional and mandatory arguments, like |\smash| macro, which (re)defined by -% \pkg{amsmath} package. Optional argument sets change of height only (\texttt{t}) -% or depth only~(\texttt{b}). Mandatory argument includes text. +% This macro changes included box by |\jot| value (usually 3\,pt). It is +% defined with optional and mandatory arguments, like |\smash| macro, which +% (re)defined by \pkg{amsmath} package. Optional argument sets change of +% height only (\texttt{t}) or depth only~(\texttt{b}). Mandatory argument +% includes text. % \begin{quote} % |\gape|\oarg{\texttt{t} or \texttt{b}}\marg{text} % \end{quote} @@ -372,14 +389,15 @@ % \end{quote} % % \DescribeMacro{\Gape} -% Another way of height/depth modification. This macro allows different correction -% for height and depth of box: +% Another way of height/depth modification. This macro allows different +% correction for height and depth of box: % \begin{quote} % |\Gape|\oarg{height corr}\oarg{depth corr}\marg{text} % \end{quote} % -% If both arguments absent, |\Gape| command works like |\gape|\marg{text}, in other -% words, command uses |\jot| as correction value for height and depth of box. +% If both arguments absent, |\Gape| command works like |\gape|\marg{text}, in +% other words, command uses |\jot| as correction value for height and depth +% of box. % % If only one optional argument exists, |\Gape| command uses value % from this argument for both height and depth box corrections. @@ -407,6 +425,9 @@ % \crcr}} % \end{quote} % +% You may also use |\height| and |\depth| parameters in optional arguments +% of |\Gape| macro, parameters was borrowed from |\raisebox| command. +% % \DescribeMacro{\bottopstrut} % \DescribeMacro{\topstrut} % \DescribeMacro{\botstrut} @@ -418,18 +439,20 @@ % % \emph{Note}. If you use % \pkg{bigstrut} package note that these macros duplicate \cmd{\bigstrut}, -% \cmd{\bigstrut[t]}, and \cmd{\bigstrut[b]} commands consequently. Please note -% that value, which increases strut in \cmd{\topstrut} etc. equals to \cmd{\jot}, -% but \cmd{\bigstrut} and others use a special dimension \cmd{\bigstrutjot}. +% \cmd{\bigstrut[t]}, and \cmd{\bigstrut[b]} commands consequently. Please +% note that value, which increases strut in \cmd{\topstrut} etc. equals to +% \cmd{\jot}, but \cmd{\bigstrut} and others use a special dimension +% \cmd{\bigstrutjot}. % -% \section{How to Change Vertical Spaces Around in Whole Table}\label{sec:beta} +% \clearpage +% \section{How to Change Vertical Spaces Around Cells +% in Whole Table}\label{sec:beta} % % This section describes macros which try to emulate one of possibilities of % \pkg{tabls} package: to get necessary vertical spacing around cells. % % \DescribeMacro{\setcellgapes} -% Sets the parameters for vertical spaces. It looks like |\gape*| command without -% \marg{text} argument: +% Sets the parameters for vertical spaces: % \begin{quote} % |\setcellgapes|\oarg{\texttt{t} or \texttt{b}}\marg{value} % \end{quote} @@ -437,8 +460,8 @@ % \begin{quote} % |\setcellgapes{5pt}| % \end{quote} -% You may also try to load negative values if you wish. This macro you may put in -% the preamble as common settings. +% You may also try to load negative values if you wish. This macro you may +% put in the preamble as common settings. % % \DescribeMacro{\makegapedcells} % \DescribeMacro{\nomakegapedcells} @@ -475,16 +498,17 @@ % \hline % \makecell*[{{p{3cm}}}]{Cell long text with predefined width} & 52--58\\ % \hline -% \makecell[{{>{\parindent1em}p{3cm}}}]{Cell long text with predefined width} -% & 52--58\\ +% \makecell[{{>{\parindent1em}p{3cm}}}]{Cell long text with +% predefined width} & 52--58\\ % \hline % \end{tabular}} % \end{table} % -% Please note that space defined in |\setcellgapes| and space which creates |\gape| -% mechanism -% in commands for tabular cells (usually |\thead| or |\makecell*|) are summarized. +% Please note that space defined in |\setcellgapes| and space which creates +% |\gape| mechanism in commands +% for tabular cells (usually |\thead| or |\makecell*|) are summarized. % +% \clearpage % \section{Multirow Table Heads and Cells} % % The next examples show usage of macros which use |\multirow| command from @@ -496,8 +520,8 @@ % \end{quote} % \marg{nrow} sets number of rows (i.e. text lines); % \oarg{njot} is mainly used if you've used \pkg{bigstrut} package: it makes -% additional tuning of vertical position (see comments in \pkg{multirow} -% package); +% additional tuning of vertical position (see comments in +% \pkg{multirow} package); % \marg{width} defines width of contents, the |*| sign used to indicate that % the text argument's natural width is to be used; % \oarg{vmove} is a length used for fine tuning: the text will be raised (or @@ -506,15 +530,16 @@ % % \DescribeMacro{\multirowcell} % \DescribeMacro{\multirowthead} -% These two macros use following arguments (example uses |\multirowcell| command): +% These two macros use following arguments (example uses |\multirowcell| +% command): % \begin{quote} % |\multirowcell|\marg{nrow}\oarg{vmove}\oarg{hor alignment}\marg{contents} % \end{quote} -% in these macros were skipped \oarg{njot} and \marg{width}. Instead of tuning -% optional argument \oarg{njot} for vertical +% in these macros were skipped \oarg{njot} and \marg{width}. Instead of +% tuning optional argument \oarg{njot} for vertical % correction used \oarg{vmove} optional argument. -% For the \marg{width} argument both |\multirowcell| and |\multirowthead| macros -% use natural width of contents (i.e. the |*| argument used). +% For the \marg{width} argument both |\multirowcell| and |\multirowthead| +% macros use natural width of contents (i.e. the |*| argument used). % % First example (table~\ref{tab:mrowI}) with ``|\multirow|'ed'' column heads % and cells: @@ -551,14 +576,16 @@ % \cline{1-2} % \makecell{Multilined\\Cell text} & B& \\ % \hline -% \makecell[l]{Left aligned\\ cell text} & C & \multirowcell{4}[1ex][l]{37--43}\\ +% \makecell[l]{Left aligned\\ cell text} & C +% & \multirowcell{4}[1ex][l]{37--43}\\ % \cline{1-2} % \makecell[r]{Right aligned\\ cell text} & D & \\ % \hline % \makecell[b]{Bottom aligned\\ cell text} & E & % \multirowcell{5}[1ex][r]{37--43\\52--58}\\ % \cline{1-2} -% \makecell[{{p{5cm}}}]{Cell long long long long text with predefined width} & F & \\ +% \makecell[{{p{5cm}}}]{Cell long long long long text with predefined width} +% & F & \\ % \cline{1-2} % \makecell[{{>{\parindent1em}p{5cm}}}]{Cell long long long long text with % predefined width} & G & \\ @@ -566,8 +593,9 @@ % \end{tabular}} % \end{table} % -% Second example (table~\ref{tab:mrowII}) with ``multirow'ed'' column heads and -% cells uses |\makegapedcells| command. The |\theadgape| command does nothing: +% Second example (table~\ref{tab:mrowII}) with ``multirow'ed'' column heads +% and cells uses |\makegapedcells| command. The |\theadgape| command does +% nothing: %\begin{verbatim} %\makegapedcells %\renewcommand\theadset{\def\arraystretch{.85}}% @@ -592,7 +620,8 @@ % \cline{1-2} % \makecell{Multilined \\Cell text} & B& \\ % \hline -% \makecell[l]{Left aligned \\ cell text} & C & \multirowcell{4}[0ex][l]{37--43}\\ +% \makecell[l]{Left aligned \\ cell text} & C +% & \multirowcell{4}[0ex][l]{37--43}\\ % \cline{1-2} % \makecell[r]{Right aligned \\ cell text} & D & \\ % \hline @@ -609,8 +638,8 @@ % \end{table} % \bigskip % -% The last example (table~\ref{tab:mrowIII}) uses \env{tabularx} environment with -% |\hsize| in the width argument. +% The last example (table~\ref{tab:mrowIII}) uses \env{tabularx} environment +% with |\hsize| in the width argument. %\begin{verbatim} %\makegapedcells %\renewcommand\theadset{\def\arraystretch{.85}}% @@ -650,7 +679,8 @@ % \cline{1-2} % \makecell{Multilined \\Cell text} & B& \\ % \hline -% \makecell[l]{Left aligned \\ cell text} & C & \multirowcell{4}[0ex][l]{37--43}\\ +% \makecell[l]{Left aligned \\ cell text} & C +% & \multirowcell{4}[0ex][l]{37--43}\\ % \cline{1-2} % \makecell[r]{Right aligned \\ cell text} & D & \\ % \hline @@ -677,6 +707,7 @@ % cells, which stay in one ``multi row'' will have the same value of this % negative space, in spite of different number of lines in their contents. % +% \clearpage\suppressfloats[t] % \section{Numbered Lines in Tabulars} % % The three commands |\eline|, |\nline|, |\rnline| allow to skip: @@ -702,7 +733,7 @@ % \end{tabular} %\end{verbatim} % -% \begin{table} +% \begin{table}[hbt] % \ttabbox % {\caption{Examples of filling of cells}\label{tab:elines}}% % {\begin{tabular}{|*{6}{c|}} @@ -715,6 +746,188 @@ % \end{tabular}} %\end{table} % +% \clearpage +% \section{Diagonally Divided Cell} +% +% This variant of head's positioning is not too popular nowadays, but in +% the some cases it could be used. Instead of creating of +% multicolumn head above a wide couple of all column heads except the +% very left column, the most left column head (upper left cell) +% divided by diagonal line. The lower head is usually head of very left +% column and upper head---``multicolumn'' to all other column heads of +% table to the right. +% +% This package offers macro based on possibilities of \env{picture} +% environment. +% \begin{quote} +% |\diaghead|\texttt{(}\meta{\texttt{\textup{H}} ratio,%^^A +% \textup{\texttt{V}} ratio}\texttt{)}%^^A +% \marg{Text set for column width}|%|\\ +% \phantom{/diaghead }\marg{First head}\marg{Second head} +% \end{quote} +% where \texttt{(}\meta{\textup{\texttt{H ratio}},%^^A +% \textup{\texttt{V ratio}}}\texttt{)} sets the ratios like in |\line| +% command (digits from~|1| up to~|6|). This argument is optional, +% the default ratio (|\line| +% direction) defined as~|(5,-2)|. +% +% The \marg{Text set for column width} +% defined by hand, for example: +% \quad 1)\nobreak\enskip sets the width, using longest text lines from +% both heads---in this case you must put |\theadfont| macro, if you use +% |\thead|'s; \quad 2)\nobreak\enskip the longest text from the rest of +% column; \quad 3)\nobreak\enskip |\hskip|\meta{value}, even |\hskip\hsize| +% the case of |p| column (or |X| column in \env{tabularx} environment). +% The \marg{First head} +% is head in lower corner (usually for first or very left column), +% \marg{Second head}---in the upper corner (head for the all right columns). +% +% Here is code of table~\ref{tab:diaghead}. +%\begin{verbatim}\makegapedcells +%\begin{tabular}{|l|c|c|}\hline +%\diaghead{\theadfont Diag ColumnmnHead II}% +% {Diag Column \\Head I}{Diag\\Column Head II}& +%\thead{Second\\column}&\thead{Third\\column}\\ +%\hline... +%\end{tabular}\medskip +% +%\begin{tabularx}{.62\hsize}{|X|c|c|}\hline +%\diaghead(-4,1){\hskip\hsize}% +% {Diag \\Column Head I}{Diag Column \\Head II}& +%\thead{Second\\column}&\thead{Third\\column}\\ +%\hline... +%\end{tabularx}\medskip +% +% \nomakegapedcells +% \begin{tabular}{|l|c|c|}\hline +% \diaghead(4,1){\hskip4.2cm}% +% {Diag \\Column Head I}{Diag Column \\Head II}& +% \thead{Second\\column}&\thead{Third\\column}\\ +%... +%\end{verbatim}% +% +% \begin{table}[!bp]\makegapedcells +% \begin{tabular}{|c|c|c|}% +% \hline +% \diaghead{\theadfont Diag ColumnmnHead II}%^^A +% {Diag \\Column Head I}{Diag Column\\ Head II}& +% \thead{Second\\column}&\thead{Third\\column}\\ +% \hline +% \makecell[l]{Left aligned \\ cell text} & A & 37--43\\ +% \hline +% \makecell*[r]{Right aligned \\ cell text} & B & 37--43\\ +% \hline +% \makecell[b]{Bottom aligned\\ cell text} & C & 52--58\\ +% \hline +% \end{tabular}% +% \medskip +% +% \begin{tabularx}{.62\hsize}{|X|c|c|}% +% \hline +% \diaghead(4,1){\hskip\hsize}% +% %^^A{\theadfont Diag ColuDiag Column}%^^A +% {Diag \\Column Head I}{Diag Column \\Head II}& +% \thead{Second\\column}&\thead{Third\\column}\\ +% \hline +% \makecell[l]{Left aligned \\ cell text} & A & 37--43\\ +% \hline +% \makecell*[r]{Right aligned \\ cell text} & B & 37--43\\ +% \hline +% \makecell[b]{Bottom aligned\\ cell text} & C & 52--58\\ +% \hline +% \end{tabularx}% +% \medskip +% +% \nomakegapedcells +% \begin{tabular}{|l|c|c|}% +% \hline +% \diaghead(-4,1){\hskip4.2cm}%^^A +% {Diag \\Column Head I}{Diag Column \\Head II}& +% \thead{Second\\column}&\thead{Third\\column}\\ +% \hline +% \makecell[l]{Left aligned \\ cell text} & A & 37--43\\ +% \hline +% \makecell*[r]{Right aligned \\ cell text} & B & 37--43\\ +% \hline +% \makecell[b]{Bottom aligned\\ cell text} & C & 52--58\\ +% \hline +% \end{tabular}% +% +% \caption{Examples of tabulars with diagonally divided +% cells}\label{tab:diaghead} +% +% \end{table}% +% The correct position of diagonal ends depends of width of column. If cell width +% is narrower then necessary +% column ends of diagonal don't touch corners of cell. +% +% \clearpage +% \section{Thick \cmd{\hline} and \cmd{\cline}} +% +% For horizontal rules in tabular there were added two commands +% \cmd{\Xhline} and \cmd{\Xcline} +% They use additional mandatory argument with defined rule width. +% +% The example, with result in table~\ref{tab:XmrowIII}. +%\begin{verbatim}% +%\begin{table} +%\renewcommand\theadset{\def\arraystretch{.85}}% +%\renewcommand\theadgape{} +%\ttabbox +%{\caption{...}\label{...}}% +%{\begin{tabular}{!{\vrule width1.2pt}c +% !{\vrule width1.2pt}c|c +% !{\vrule width1.2pt}} +%\Xhline{1.2pt} +%\multirowthead{4}{First Column head}& +%\multicolumn{2}{c!{\vrule width1.2pt}}{\thead{Multicolumn head}}\\ +%\Xcline{2-3}{1.2pt} +% & \thead{Second \\multlined \\ column head} & +% \thead{Third \\ column head}\\ +%\Xhline{1.2pt} +%Cell text & A &\multirowcell{4}{28--31}\\ +%... +%\Xhline{1.2pt} +%\end{tabular}} +%\end{table} +%\end{verbatim}% +% +% \begin{table}\makegapedcells\relax +%\renewcommand\theadset{\def\arraystretch{.85}}% +%\renewcommand\theadgape{} +% \ttabbox +% {\caption{Example of \env{tabular} environment with +% thick lines}\label{tab:XmrowIII}}% +% {\begin{tabular}{!{\vrule width1.2pt}c +% !{\vrule width1.2pt}c|c!{\vrule width1.2pt}} +% \Xhline{1.2pt} +% \multirowthead{4}{First Column head}& +% \multicolumn{2}{c!{\vrule width1.2pt}}{\thead{Multicolumn head}}\\ +% \Xcline{2-3}{1.2pt} +% & \thead{Second \\multlined \\ column head} & +% \thead{Third \\ column head}\\ +% \Xhline{1.2pt} +% Cell text & A &\multirowcell{4}{28--31}\\ +% \cline{1-2} +% \makecell{Multilined \\Cell text} & B& \\ +% \hline +% \makecell[l]{Left aligned \\ cell text} & C +% & \multirowcell{4}[0ex][l]{37--43}\\ +% \cline{1-2} +% \makecell[r]{Right aligned \\ cell text} & D & \\ +% \hline +% \makecell[b]{Bottom aligned \\ cell text} & E & +% \multirowcell{6}[0ex][r]{37--43\\52--58}\\ +% \cline{1-2} +% \makecell[{{p{5cm}}}]{Cell long long long long long long text with +% predefined width} & F & \\ +% \cline{1-2} +% \makecell[{{>{\parindent1em}p{5cm}}}]{Cell long long long long long +% long text with predefined width} & G & \\ +% \Xhline{1.2pt} +% \end{tabular}} +% \end{table} +% % \StopEventually{}\clearpage % % \section{Code of package} @@ -727,9 +940,9 @@ % \end{macrocode} % % \begin{macro}{\makecell} -% The definition of command for multilined cells. At first defined |\gape| stuff. -% Non-star form loads special setting for vertical space around (if it used). -% Star form always creates additional vertical |\jot|-spaces. +% The definition of command for multilined cells. At first defined |\gape| +% stuff. Non-star form loads special setting for vertical space around (if it +% used). Star form always creates additional vertical |\jot|-spaces. % \begin{macrocode} \newcommand\makecell{\@ifstar{\let\tabg@pe\gape\makecell@}% {\let\tabg@pe\cellgape\makecell@}} @@ -753,10 +966,10 @@ \newcommand\thead{\@ifstar{\let\tabg@pe\gape\thead@}% {\let\tabg@pe\theadgape\thead@}} % \end{macrocode} -% Next macro loads vertical and horizontal common alignment for column heads and -% loads redefined spacing parameters |\arraystretch| and |\extrarowheight| -% if these parameters were redefined. -% (First go settings for cells, as for |\makecell|, then special settings for column heads.) +% Next macro loads vertical and horizontal common alignment for column heads +% and loads redefined spacing parameters |\arraystretch| and |\extrarowheight| +% if these parameters were redefined. (First go settings +% for cells, as for |\makecell|, then special settings for column heads.) % % For column heads also loaded font settings. % \begin{macrocode} @@ -784,8 +997,8 @@ \let\tabg@pe\empty\let\t@bset\cellset\makecell@} {\@ifnextchar[{\@rotcell}{\@@rotcell}}} % \end{macrocode} -% For rotated cell default column setting is similar to |p{\rotheadsize}| (plus some -% additional justification settings) +% For rotated cell default column setting is similar to |p{\rotheadsize}| (plus +% some additional justification settings) % \begin{macrocode} \@ifdefinable\@rotcell{} \def\@rotcell[#1]#2{\makecell{\\[-.65\normalbaselineskip] @@ -799,8 +1012,8 @@ % \end{macro} % % \begin{macro}{\rothead} -% The macro for rotated tabular column heads. If no \pkg{rotating} package loaded -% this macro works like |\thead|. +% The macro for rotated tabular column heads. If no \pkg{rotating} package +% loaded this macro works like |\thead|. % \begin{macrocode} \newcommand\rothead{\@ifundefined{turn}% {\PackageWarning{makecell}{\string\rothead\space @@ -810,8 +1023,8 @@ {\let\theadgape\rotheadgape \@ifnextchar[{\@rothead}{\@@rothead}}} % \end{macrocode} -% For rotated column head default column setting is similar to |p{\rotheadsize}| -% (plus some additional justification settings) +% For rotated column head default column setting is similar to +% |p{\rotheadsize}| (plus some additional justification settings) % \begin{macrocode} \@ifdefinable\@rothead{} \def\@rothead[#1]#2{\thead{\\[-.65\normalbaselineskip] @@ -879,9 +1092,9 @@ % settings for |\makecell| (|\thead|) blocks. % \begin{macrocode} \newcommand\mcell@l{\def\mcell@ii{l}\let\mcell@c\mcell@ic - \global\let\mcell@left\empty} + \global\let\mcell@left\relax} \newcommand\mcell@r{\def\mcell@ii{r}\let\mcell@c\mcell@ic - \global\let\mcell@right\empty} + \global\let\mcell@right\relax} \newcommand\mcell@t{\def\mcell@i{t}\let\mcell@c\mcell@iic} \newcommand\mcell@b{\def\mcell@i{b}\let\mcell@c\mcell@iic} \newcommand\mcell@{} @@ -926,9 +1139,9 @@ \fi}\next} % \end{macrocode} % -% The |\mcell@@tabular| macro at first calls |\mcell@setalign| macro for sorting of -% alignment arguments, -% then calls |\mcell@@@tabular| macro, which created tabular cell or column head. +% The |\mcell@@tabular| macro at first calls |\mcell@setalign| macro for +% sorting of alignment arguments, then calls |\mcell@@@tabular| +% macro, which created tabular cell or column head. % \begin{macrocode} \def\mcell@@tabular#1#2\@nil#3{% \expandafter\mcell@setalign\mcell@align\@nil @@ -955,18 +1168,18 @@ \def\mcell@c{\def\mcell@ii{c}}% \mcell@ifinlist{#1}{l,r,t,b,c,}{\@nameuse{mcell@#1}}% % \end{macrocode} -% If argument is not \texttt{l}, \texttt{r}, \texttt{c}, \texttt{t}, or \texttt{b} -% it could define horizontal alignment only. +% If argument is not \texttt{l}, \texttt{r}, \texttt{c}, \texttt{t}, +% or \texttt{b} it could define horizontal alignment only. % \begin{macrocode} {\def\mcell@ii{#1}\let\mcell@c\mcell@ic - \let\mcell@left\empty\let\mcell@right\empty}% + \let\mcell@left\relax\let\mcell@right\relax}% \mcell@ifinlist{#2}{l,r,t,b,c,}{\@nameuse{mcell@#2}}% % \end{macrocode} -% If argument is not \texttt{l}, \texttt{r}, \texttt{c}, \texttt{t}, or \texttt{b} -% it could define horizontal alignment only. +% If argument is not \texttt{l}, \texttt{r}, \texttt{c}, \texttt{t}, +% or \texttt{b} it could define horizontal alignment only. % \begin{macrocode} {\def\mcell@ii{#2}\let\mcell@c\mcell@ic - \let\mcell@left\empty\let\mcell@right\empty}% + \let\mcell@left\relax\let\mcell@right\relax}% % \end{macrocode} % Here goes repeated check for first argument, if it is |c|-argument % we call |\mcell@c| command, which can be now redefined. @@ -980,7 +1193,8 @@ % First (and last) go commands which align |\makecell| and |\thead| % blocks like \texttt{l}, \texttt{r}, or \texttt{c} (if they loaded). % Then goes check whether math mode exists. -% The |\mcell@multirow| emulation macro transforms to |\multirow| when necessary. +% The |\mcell@multirow| emulation macro transforms to |\multirow| +% when necessary. % \begin{macrocode} \def\mcell@@@tabular#1#2\@nil#3{%\mcell@mstyle \ifdim\parindent<\z@\leavevmode\else\noindent\fi @@ -1031,8 +1245,8 @@ % \begin{macrocode} \newcommand\theadfont{\footnotesize} % \end{macrocode} -% Special spacing settings for tabular spacing in column heads (like |\arraystretch| -% or/and |\extrarowheight|). +% Special spacing settings for tabular spacing in column heads (like +% |\arraystretch| or/and |\extrarowheight|). % \begin{macrocode} \newcommand\theadset{} % \end{macrocode} @@ -1062,8 +1276,8 @@ % % \begin{macro}{\gape} % \begin{macro}{\setcellgapes} -% The macro itself. It uses analogous to |\smash| macro from \pkg{amsmath} package. -% Starred form has additional mandatory argument for value of |\gape|. +% The macro itself. It uses analogous to |\smash| macro from \pkg{amsmath} +% package. % \begin{macrocode} \newcommand\gape{\@ifnextchar[\@gape{\@gape[tb]}} % \end{macrocode} @@ -1080,15 +1294,23 @@ \@ifdefinable\@setcellgapes{} \def\mcell@setgapes#1[#2]#3{\expandafter\let\csname mcell@#1@\expandafter\endcsname\csname mcell@mb@#2\endcsname - \@namedef{mcell@#1jot}{#3}} + \@namedef{mcell@#1jot}{#3}% +% \end{macrocode} +% Negative compensate inside |\makegapedsells| area. +% \begin{macrocode} + \@namedef{mcell@#1negjot}{-#3}\@namedef{mcell@#1negtb}{#2}} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand\negjot[1]{{\jot\mcell@MBnegjot\gape[mcell@MBnegtb]{#1}}} % \end{macrocode} % % The macros which count advanced height and depth of boxes. % \begin{macrocode} -\newcommand\mcell@mb@t[2]{\@tempdima\ht#1\advance\@tempdima#2% - \ht#1\@tempdima} -\newcommand\mcell@mb@b[2]{\@tempdimb\dp#1\advance\@tempdimb#2% - \dp#1\@tempdimb} +\newcommand\mcell@mb@t[2]{% + \@tempdima\ht#1\advance\@tempdima#2\ht#1\@tempdima} +\newcommand\mcell@mb@b[2]{% + \@tempdimb\dp#1\advance\@tempdimb#2\dp#1\@tempdimb} \newcommand\mcell@mb@tb[2]{\mcell@mb@t{#1}{#2}\mcell@mb@b{#1}{#2}} % \end{macrocode} % @@ -1156,7 +1378,8 @@ % \begin{macrocode} \@ifdefinable\mcell@oriclassz{\let\mcell@oriclassz\@classz} % \end{macrocode} -% This macros redefine and restore the |\@classz| macro from \pkg{array} package. +% This macros redefine and restore the |\@classz| macro from \pkg{array} +% package. % \begin{macrocode} \newcommand\makegapedcells{\let\@classz\mcell@classz} \newcommand\nomakegapedcells{\let\@classz\mcell@oriclassz} @@ -1216,6 +1439,7 @@ % The rows of numbered cells. The |\rnline| command replaces |\Alph| and % |\alph| counter by |\Asbuk| and |\asbuk| consequently. % \begin{macrocode} +\newcounter{nlinenum} \newcommand\rnline{\gdef \TeXr@rus{\let\@Alph\@Asbuk\let\@alph\@asbuk}\@nline} \newcommand\nline{\gdef\TeXr@rus{}\@nline} @@ -1225,15 +1449,16 @@ \def\@@nline[#1]{\@ifnextchar[%] {\@@@nline[#1]}{\@@@nline[#1][1]}} \@ifdefinable\@@@nline{} -\def\@@@nline[#1][#2]#3{\count@ #3% +\def\@@@nline[#1][#2]#3{\count@ #3 + \def\TeXr@label{\TeXr@label@{nlinenum}}% \expandafter\TeXr@loop\@gobble{}#1\@@@ \xdef\Num{\the\TeXr@lab}% - \@tempcnta#2\relax% + \c@nlinenum#2\relax% \expandafter\@temptokena\expandafter{\Num - \global\advance\@tempcnta\@ne}% + \global\advance\c@nlinenum\@ne}% \advance\count@\m@ne \loop\@temptokena\expandafter{\the\@temptokena& - \Num \global\advance\@tempcnta\@ne}% + \Num \global\advance\c@nlinenum\@ne}% \advance\count@\m@ne \ifnum\count@>\z@ \repeat \the\@temptokena\ignorespaces} % \end{macrocode} @@ -1263,9 +1488,10 @@ % tokens |A a I i 1|, and is thrown away. |#1| will be a command % like |\Roman|. % \begin{macrocode} -\def\TeXr@label#1#2{% - \xdef\TeXr@the{\noexpand#1\@tempcnta}% - \TeXr@lab\expandafter{\the\TeXr@lab\TeXr@rus\TeXr@the}% +\def\TeXr@label@#1#2#3{% + \edef\TeXr@the{\noexpand#2{#1}}% + \TeXr@lab\expandafter + {\the\TeXr@lab\TeXr@rus\csname the#1\endcsname}% \advance\@tempcnta1 \TeXr@loop} % \end{macrocode} @@ -1312,11 +1538,11 @@ % \end{macrocode} % \begin{macrocode} \def\TeXr@loop@{% - \ifx A\TeXr@temp \def\@tempa{\TeXr@label\@Alph }\else - \ifx a\TeXr@temp \def\@tempa{\TeXr@label\@alph }\else - \ifx i\TeXr@temp \def\@tempa{\TeXr@label\@roman }\else - \ifx I\TeXr@temp \def\@tempa{\TeXr@label\@Roman }\else - \ifx 1\TeXr@temp \def\@tempa{\TeXr@label\@arabic}\else + \ifx A\TeXr@temp \def\@tempa{\TeXr@label\Alph }\else + \ifx a\TeXr@temp \def\@tempa{\TeXr@label\alph }\else + \ifx i\TeXr@temp \def\@tempa{\TeXr@label\roman }\else + \ifx I\TeXr@temp \def\@tempa{\TeXr@label\Roman }\else + \ifx 1\TeXr@temp \def\@tempa{\TeXr@label\arabic}\else \ifx \@sptoken\TeXr@temp \let\@tempa\TeXr@space \else \ifx \bgroup\TeXr@temp \let\@tempa\TeXr@group \else \ifx \@@@\TeXr@temp \let\@tempa\@gobble \else @@ -1337,5 +1563,148 @@ % \end{macrocode} % \end{macro} % +% \subsection{Diagonally separated column heads} +% +% \begin{macro}{\diaghead} +% Macro for diagonally separated column heads. +% \begin{macrocode} +\newcommand\diaghead{\@ifnextchar({\mcell@diaghead}{\mcell@diagheads}} +\@ifdefinable\mcell@diaghead{} +\def\mcell@diaghead(#1){\def\celldiagratio{(#1)}\mcell@diagheads} +% \end{macrocode} +% The default value of diagonal ratio. +% \begin{macrocode} +\newcommand\celldiagratio{(5,-2)} +% \end{macrocode} +% The building itself +% \begin{macrocode} +\newcommand\mcell@diagheads[3]{\hbox\bgroup\expandafter + \mcell@getcelldiagratios\celldiagratio\relax + \@tempswafalse +% \end{macrocode} +% depends of sign of ratios. +% \begin{macrocode} + \ifnum\mcell@Hratio<\z@\count@-\mcell@Hratio\relax + \edef\mcell@Hratio{\the\count@}\relax + \ifnum\mcell@Vratio<\z@\count@-\mcell@Vratio\relax + \edef\mcell@Vratio{\the\count@}\else\@tempswatrue + \fi + \else + \ifnum\mcell@Vratio<\z@\count@-\mcell@Vratio\relax + \edef\mcell@Vratio{\the\count@}\@tempswatrue\else + \fi + \fi + \settowidth\@tempdima{#1}\advance\@tempdima2\tabcolsep + \edef\mcell@diagH{\the\@tempdima}\divide\@tempdima\mcell@Hratio + \@tempdima\mcell@Vratio\@tempdima\edef\mcell@diagV{\the\@tempdima}% +% \end{macrocode} +% The |\unitlength| here is |\relaxed|, we use just real dimensions. +% \begin{macrocode} + \let\mcell@oriunitlength\unitlength\let\unitlength\relax + \kern-\tabcolsep\kern-\@wholewidth + \setbox\z@\hbox{\theadfont{\strut}}\@tempdima\dp\z@ +% \end{macrocode} +% The value of compensate vertical spacing defined here experimentally +% and equals to 2~default line thickness. +% \begin{macrocode} + \advance\@tempdima.8\p@%2\@wholewidth +% \end{macrocode} +% If |\makedgapedcells| switched on for the table there is +% compensate spacing. +% \begin{macrocode} + {\ifx\@classz\mcell@classz + \setbox\z@\hbox{#1}\ht\z@\z@\dp\z@\z@ + \mcell@MB@\z@\mcell@MBjot + \global\dimen@\@tempdima\global\@tempdimb\@tempdimb + \else\global\dimen@\z@\global\@tempdimb\z@\fi + }% + \advance\@tempdima\dimen@ + \edef\mcell@diagVoffset{\the\@tempdima}% + \@tempdima\mcell@diagV\advance\@tempdima-\mcell@diagVoffset + \advance\@tempdima-\@tempdimb + \edef\mcell@diagVcorr{\the\@tempdima}% + \noindent\nomakegapedcells\hbox{\begin{tabular}{@{}c@{}}% +% \end{macrocode} +% At least a~|\normallineskip| vertical space from top and bottom of cell. +% \begin{macrocode} + \ifdim\jot<2\p@\jot2\p@\fi + \if@tempswa +% \end{macrocode} +% For South-East or North-West directions. +% \begin{macrocode} + \begin{picture}(\mcell@diagH,\mcell@diagVcorr)(\z@,\mcell@diagVoffset)% + \put(\z@,\mcell@diagV){\makebox(\z@,\z@)[tl]% + {\edef\tempa{(\mcell@Hratio,-\mcell@Vratio)}\expandafter + \line\tempa{\mcell@diagH}}} + \put(\tabcolsep,\jot)% + {\makebox(\z@,\z@)[bl]{\theadfont + \let\cellset\theadset\makecell[bl]{\strut#2}}} + \@tempdima\mcell@diagH\advance\@tempdima-\tabcolsep + \@tempdimb\mcell@diagV\advance\@tempdimb-\jot + \put(\@tempdima,\@tempdimb)% + {\makebox(\z@,\z@)[tr]{\theadfont + \let\cellset\theadset\makecell[tr]{#3\strut}}} + \end{picture}% + \else +% \end{macrocode} +% For South-West or North-East directions. +% \begin{macrocode} + \begin{picture}(\mcell@diagH,\mcell@diagVcorr)(\z@,\mcell@diagVoffset)% + \put(\z@,\mcell@diagV){\makebox(\z@,\z@)[tl]% + {\edef\tempa{(\mcell@Hratio,\mcell@Vratio)}\expandafter + \line\tempa{\mcell@diagH}}} + \@tempdima\mcell@diagV\advance\@tempdima-\jot + \put(\tabcolsep,\@tempdima)% + {\makebox(\z@,\z@)[tl]{\theadfont + \let\cellset\theadset\makecell[tl]{\strut#3}}} + \@tempdima\mcell@diagH\advance\@tempdima-\tabcolsep + \put(\@tempdima,\jot)% + {\makebox(\z@,\z@)[br]% + {\theadfont + \let\cellset\theadset{\makecell[br]{#2\strut}}}} + \end{picture}% + \fi + \end{tabular}% + \kern-\tabcolsep\kern-\@wholewidth + }\let\unitlength\mcell@oriunitlength\egroup\par + \ifvmode\strut + \vspace*{-\normalbaselineskip}\vspace*{-\normallineskip} + \fi +} +% \end{macrocode} +% \end{macro} +% Macro used by previous one. Extracts ratios for defining of height of cell. +% \begin{macrocode} +\@ifdefinable\mcell@getcelldiagratios{} +\def\mcell@getcelldiagratios(#1,#2){\def\mcell@Hratio{#1}\def\mcell@Vratio{#2}} +% \end{macrocode} +% +% \subsection{The \cmd{\hline} and \cmd{\cline} with necessary thickness} +% +% \begin{macro}{\Xhline} +% The commands for |\hline| and |\cline| with necessary thickness. +% \begin{macrocode} +\newcommand\Xhline[1]{\noalign{\ifnum0=`}\fi\arrayrulewidth#1% + \hrule\@height\arrayrulewidth\futurelet\reserved@a\@xhline} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Xcline} +% \begin{macrocode} +\def\Xcline#1#2{\@Xcline#1;#2\@nil} +\def\@Xcline#1-#2;#3\@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#3\hfill + \cr + \noalign{\vskip-#3}} +% \end{macrocode} +% \end{macro} +% % \Finale \endinput |