diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/ctable/ctable.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/ctable/ctable.dtx | 802 |
1 files changed, 439 insertions, 363 deletions
diff --git a/Master/texmf-dist/source/latex/ctable/ctable.dtx b/Master/texmf-dist/source/latex/ctable/ctable.dtx index 9e3bccc919a..ecd989cd471 100644 --- a/Master/texmf-dist/source/latex/ctable/ctable.dtx +++ b/Master/texmf-dist/source/latex/ctable/ctable.dtx @@ -1,17 +1,31 @@ + +% \iffalse meta-comment +% +% Copyright (C) 2005 by Wybo Dekker <wybo@servalys.nl> +% ------------------------------------------------------- +% +% This file may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.2 +% of this license or (at your option) any later version. +% The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.2 or later is part of all distributions of LaTeX +% version 1999/12/01 or later. +% +% \fi +% % \iffalse -% $Id: ctable.dtx,v 1.32 2005/08/09 13:21:31 wybo Exp $ -%%% File: ctable.dtx -\NeedsTeXFormat{LaTeX2e} -%<*dtx> +%<*driver> \ProvidesFile{ctable.dtx} -%</dtx> +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{ctable} -%<driver>\ProvidesFile{ctable.drv} -%<+abstract> easy centered table and figure floats with footnotes for LaTeX -% \fi -%\ProvidesFile{ctable} - [2005/08/09 v1.7 LaTeX package ctable] -%\iffalse +%<*package> + [2006/10/12 v1.8 ctable package] +%</package> +% %<*driver> \documentclass[a4paper]{ltxdoc} \usepackage{carom,txfonts,ctable} @@ -22,356 +36,401 @@ bottom=35mm, nohead ]{geometry} - \parindent0pt +\EnableCrossrefs +\CodelineIndex \begin{document} \DocInput{ctable.dtx} +\PrintIndex \end{document} %</driver> % \fi % -% \changes{v1.0}{2000/06/01}{First release.} -% \changes{v1.1}{2001/03/17}{Making use of booktabs package} -% \changes{v1.2}{2002/06/24}{Using keyval to reduce args to 4} -% \changes{v1.3}{2002/07/16}{Many syntactic correction, -% thanks to Johannes Braams} -% \changes{v1.4}{2003/08/11}{Caption, if empty, will not be typeset -% rotate option added -% star option added to use table* and figure* -% environments} -% \changes{v1.5}{2003/10/03}{maxwidth option added} -% \changes{v1.6}{2004/03/20}{left, right and center options added -% frame{sep,rule,fg,bg} options added -% error in width-setting corrected} -% \changes{v1.6a}{2004/04/01}{two errors corrected: -% made setting fboxsep and fboxrule only temporary -% removed superfluous space after tabulars} -% \changes{v1.6b}{2004/06/19}{Added several % at eol to remove superfluous -% whitespace occurring sometimes} -% \changes{v1.7}{2005/08/09}{Added option sideways, option rotate now obsolete; -% added option captionskip} -% \GetFileInfo{ctable} -% \MakeShortVerb{\|} -% \title{The |ctable| package\thanks -% {This file has version number \fileversion, dated \filedate.}\\ -% for use with \LaTeX2e} -% \author{Wybo Dekker\\ |wybo@servalys.nl|} -% \date{\filedate} -% \maketitle -% \tableofcontents -% \listoftables -% \listoffigures -% -% \section{Purpose} The |ctable| package lets you easily typeset -% captioned table and figure floats with optional -% footnotes. Both caption and footnotes will be forced within the -% width of the table. -% -% If the width of the table is specified, then tabularx will be used -% to typeset it, and the |X| column specifier can be used. Otherwise -% tabular will be used. -% -% This package defines the commands |\ctable|, -% |\tnote| and |\tmark|, as well as four |\tabularnewline| generating -% commands. The latter generate reasonable amounts of whitespace -% around horizontal rules and are also useful for tabulars outside -% this package. -% -% Since the |ctable| package imports the |array| and |booktabs| -% packages, all commands from those packages are available as well. -% -% Note that, in line with the comments that Simon Fear made -% describing his |booktabs| package, vertical rules for column -% separation can be produced with |\ctable|, but no provisions are -% made to have them make contact with horizontal rules. -% -% \section{Usage} -% \DescribeMacro{\ctable} -% |\ctable| is called with 4 parameters, of which the first is optional: \\ -% -% |\ctable[options] % key=value,...|\\ -% | {coldefs} % for \begin{tabular}|\\ -% | {foottable} % zero or more \tnote commands (see below)|\\ -% | {table lines} % lines for the table|\\ -% -% Options are given as key=value pairs, separated by comma's. -% Extra comma's, including one behind the last pair, don't hurt. -% Arguments to option should be put between braces if they contain -% comma's or equals signs. -% Currently the following option keys have been defined: -% \\[2ex] -% \begin{tabularx}{\hsize}{@{}lX@{}} -% |caption={...}|& table caption; the braces are needed only if your -% caption contains a comma or an equals sign.\NN -% -% |cap={...}| & for a short caption to go to the |\tableofcontents|.\NN -% -% |captionskip=...| & set the whitespace between the caption and the table; -% default is |2ex|.\NN -% -% |pos=...| & float position, default: |tbp|.\NN -% -% |label=...| & for |\label|\NN -% -% |width=...| & tabularx will be used to typeset the table at the -% specified width\,---\,one or more |X| column -% specifiers must be provided.\NN -% -% |maxwidth=...| & like the \textsl{width} option, but any |X| column -% specifiers will be replaced with |l| if the resulting -% table width would thus stay within the specified -% maximum width. This is especially useful where the -% \LaTeX\ source is generated by a script.\NN -% -% |center| & center the table in the available text width; this is -% the default.\NN -% -% |left| & left align the table in the available text width.\NN -% -% |right| & right align the table in the available text width.\NN -% -% |figure| & produce a figure float instead of a table float.\NN -% -% |botcap| & put the caption at the bottom of the float instead -% of on top of it.\NN -% -% |sideways| & rotate table or figure by 90 degrees anticlockwise -% and put it on a separate page. With the twoside option -% for the standard \LaTeX\ document classes, rotation -% will be -90 on even pages. If you use this option, -% the |pos| option is not allowed.\NN -% -% |star| & use the starred versions of the |table| and |figure| -% environments, which place the float over two columns -% when the |twocolumn| option or the |\twocolumn| -% command is active.\NN -% -% |framerule=...|& draw a frame around the table with the given rule -% thickness. The default is |0pt|, so that no frame -% will be seen.\NN -% -% |framesep=...| & set the distance between the frame and the table -% to the given dimension. The default is |0pt|.\NN -% -% |framefg=|\sl r g b & set the foreground color of the frame (the -% rule color) to the given triplet of -% \textsl{rgb}-values. The values should be numbers -% between 0 and 1. The default is |0 0 0| (black).\NN -% -% |framebg=|\sl r g b & set the background color of the frame (the -% color inside the frame) to the given triplet of -% \textsl{rgb}-values. The values should be numbers -% between 0 and 1. The default is |1 1 1| (white).\NN -% \end{tabularx} -% \\[2ex] -% The footnotes are placed under the table, without a rule. -% You therefore probably will want to use the |\LL| (last line) -% command if you use footnotes. -% \DescribeMacro{\tnote} -% |\tnote[label]{footnote text}| places {\footnotesize -% \textsuperscript{\normalfont\textit{label}}\,footnote text} -% under the table. -% Can only be used in the foottable parameter described above. The -% label is optional, the default label is a single $a$. For more -% detailed control, you can also replace this command with something -% like |labeltext&footnotetext\NN|. -% \par -% \DescribeMacro{\tmark} -% |\tmark[label]| this command places the superscripted label in the -% table. It is equivalent with |$^{label}$|. -% The label is optional, the default label is a single $a$. -% \par -% The newline generating commands are a combination of -% |\tabularnewline| and zero or one of |booktabs|' |\toprule|, -% |\midrule| or |\bottomrule|. These combinations have been made, and -% short names have been defined, because source texts for complex -% tables often become very crowded: -% \par -% \DescribeMacro{\NN} Normal Newline, generates just a normal new line. -% An optional dimen parameter inserts extra vertical space under the -% line\\ -% \DescribeMacro{\FL} First Line, generates a new line and a thick -% rule with some extra space under it. -% An optional dimen parameter sets the line width; the default is 0.08em \\ -% \DescribeMacro{\ML} Middle Line: generates a new line and a thin -% rule with some extra space over and under it. -% An optional dimen parameter sets the line width; the default is 0.05em \\ -% \DescribeMacro{\LL} Last Line: generates a new line and a thick -% rule with some extra space over it. -% An optional dimen parameter sets the line width; the default is 0.08em \\ -% These macros can be used outside |\ctable| constructs. -% \par -% Finally, for completeness, here are some of |booktabs|' commands -% that may be useful:\\ -% \DescribeMacro{\toprule} |\toprule[<wd>]| -% where |<wd>| is the optional thinkness of the rule\\ -% \DescribeMacro{\midrule} |\midrule[<wd>]|\\ -% \DescribeMacro{\bottomrule} |\bottomrule[<wd>]|\\ -% \DescribeMacro{\cmidrule} |\cmidrule[<wd>](<trim>){a-b}| -% where |<trim>| can be |r|, |l|, or |rl| -% and the rule is drawn over columns |a| through |b|\\ -% \DescribeMacro{\morecmidrules} |\morecmidrules| -% must be used to separate two successive cmidrules\\ -% \DescribeMacro{\addlinespace} |\addlinespace[<wd>]| -% inserts extra space between rows\\ -% \DescribeMacro{\specialrule} -% |\specialrule{<wd>}{<abovespace>}{<belowspace>}|\\ -% See the |booktabs| documentation for details. -% \ctable[ -% cap = The Skewing Angles, -% caption = The Skewing Angles ($\beta$) for -% $\fam0 Mu(H)+X_2$ and $\fam0 Mu(H)+HX$~\tmark, -% label = tab:nowidth, -% ]{rlcc}{ -% \tnote{for the abstraction reaction, -% $\fam0 Mu+HX \rightarrow MuH+X$.} -% \tnote[b]{1 degree${} = \pi/180$ radians.} -% \tnote[c]{this is a particularly long note, showing that -% footnotes are set in raggedright mode as we don't like -% hyphenation in table footnotes.} -% }{ \FL -% & & $\fam0 H(Mu)+F_2$ & $\fam0 H(Mu)+Cl_2$ \ML -% &$\beta$(H) & $80.9^\circ$\tmark[b] & $83.2^\circ$ \NN -% &$\beta$(Mu) & $86.7^\circ$ & $87.7^\circ$ \LL -% } -% -% \subsection{The width and maxwidth options} -% When \LaTeX-sources containing tables are generated automatically by a -% script, it is often not known in advance what the maximum size of an l -% column will be. A good solution for this is to use an |X| specifier, -% typesetteing the table at the text width with the tabularx package. -% However, this will result in too much white space in cases where the -% column contains small texts only. This problem can be solved by using -% the maxwidth option instead of the width option. The |X| specifiers will -% then be replaced with |l| as long as the width of the resulting table -% stays with the specified maximum width. -% -% -% \section{Examples} -% \subsection{Tables} -% Table~\ref{tab:nowidth} is an example taken from the related package -% threeparttable.sty by Donald Arseneau, with an extra footnote. -% It was typeset with: -% \begin{verbatim} -% \ctable[ -% cap = The Skewing Angles, -% caption = The Skewing Angles ($\beta$) for -% $\fam0 Mu(H)+X_2$ and $\fam0 Mu(H)+HX$~\tmark, -% label = tab:nowidth, -% ]{rlcc}{ -% \tnote{for the abstraction reaction, -% $\fam0 Mu+HX \rightarrow MuH+X$.} -% \tnote[b]{1 degree${} = \pi/180$ radians.} -% \tnote[c]{this is a particularly long note, showing that -% footnotes are set in raggedright mode as we don't like -% hyphenation in table footnotes.} -% }{ \FL -% & & $\fam0 H(Mu)+F_2$ & $\fam0 H(Mu)+Cl_2$ \ML -% &$\beta$(H) & $80.9^\circ$\tmark[b] & $83.2^\circ$ \NN -% &$\beta$(Mu) & $86.7^\circ$ & $87.7^\circ$ \LL -% } -% \end{verbatim} -% \ctable[ -% caption = Example with a specified width of 100mm, -% width = 100mm, -% pos = b, -% label = tab:width, -% left -% ]{c>{\raggedright}Xc>{\raggedright}X}{ -% \tnote{footnotes are placed under the table} -% }{ \FL -% \multicolumn{4}{c}{Example using tabularx} \ML -% \multicolumn{2}{c}{Multicolumn entry!} & THREE & FOUR \NN -% \cmidrule(r){1-2}\cmidrule(rl){3-3}\cmidrule(l){4-4} -% one& -% The width of this column depends on the width of the -% table.\tmark & -% three& -% Column four will act in the same way as -% column two, with the same width. \LL -% } -% -% Table~\ref{tab:width} is an example with a width specification, -% taken from the |tabularx| documentation, with the vertical rules -% removed. By using the trimming parameters of the |\LR|, |\MR|, and -% |\RR| commands of the |booktabs| package, some of the horizontal -% splitting was regained. By using the |left| option, the table has -% been left aligned. It was typeset with: -% \begin{verbatim} -% \ctable[ -% caption = Example with a specified width of 100mm, -% width = 100mm, -% pos = b, -% label = tab:width, -% left -% ]{c>{\raggedright}Xc>{\raggedright}X}{ -% \tnote{footnotes are placed under the table} -% }{ \FL -% \multicolumn{4}{c}{Example using tabularx} \ML -% \multicolumn{2}{c}{Multicolumn entry!} & THREE & FOUR \NN -% \cmidrule(r){1-2}\cmidrule(rl){3-3}\cmidrule(l){4-4} -% one& -% The width of this column depends on the width of the -% table.\tmark & -% three& -% Column four will act in the same way as -% column two, with the same width. \LL -% } -% \end{verbatim} -% -% \subsection{Figures} -% Figures, even single ones, are always put in tabular cells. This is not -% particularly handy for single pictures, but it eases the construction -% of arrays of pictures, including sub-captions, delineation, and spacing. -% Figure~\ref{fig} shows a figure that has been produced with the |\ctable| -% command, in combination with |\usepackage{carom}|; -% it has been typeset with: -% \begin{verbatim} -% \ctable[ -% caption = The di- and tri-bromobenzenes, -% label = fig, -% botcap, -% framebg = .53 .81 .92, -% framerule = 1pt, -% framesep = 4ex, -% figure, -% ]{ccc}{}{ \NN -% \bzdrv{1==Br;2==Br}& -% \bzdrv{1==Br;3==Br}& -% \bzdrv{1==Br;4==Br} \NN -% 1,2 & 1,3 & 1,4 \NN[3ex] -% \bzdrv{1==Br;2==Br;3==Br}& -% \bzdrv{1==Br;2==Br;4==Br}& -% \bzdrv{1==Br;3==Br;5==Br} \NN -% 1,2,3 & 1,2,4 & 1,3,5 -% } -% \end{verbatim} -% \ctable[ -% caption = The di- and tri-bromobenzenes, -% label = fig, -% botcap, -% framebg = .53 .81 .92, -% framerule = 1pt, -% framesep = 4ex, -% figure, -% ]{ccc}{}{ \NN -% \bzdrv{1==Br;2==Br}& -% \bzdrv{1==Br;3==Br}& -% \bzdrv{1==Br;4==Br} \NN -% 1,2 & 1,3 & 1,4 \NN[3ex] -% \bzdrv{1==Br;2==Br;3==Br}& -% \bzdrv{1==Br;2==Br;4==Br}& -% \bzdrv{1==Br;3==Br;5==Br} \NN -% 1,2,3 & 1,2,4 & 1,3,5 -% } -% (The excessive whitespace at the left of the figure is caused by -% the bounding boxes generated by the \textsl{carom} package.) -% \StopEventually{}\newpage -% \section{Implementation} -% \parskip2ex -% \begin{macrocode} -%<*package> -\RequirePackage{color,xkeyval,array,tabularx,booktabs,rotating} +% \CheckSum{321} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \changes{v1.0}{2000/06/01}{First release.} +% \changes{v1.1}{2001/03/17}{Making use of booktabs package} +% \changes{v1.2}{2002/06/24}{Using keyval to reduce args to 4} +% \changes{v1.3}{2002/07/16}{Many syntactic correction, +% thanks to Johannes Braams} +% \changes{v1.4}{2003/08/11}{Caption, if empty, will not be typeset +% rotate option added +% star option added to use table* and figure* +% environments} +% \changes{v1.6}{2004/03/20}{left, right and center options added +% frame{sep,rule,fg,bg} options added +% error in width-setting corrected} +% \changes{v1.5}{2003/10/03}{maxwidth option added} +% \changes{v1.6a}{2004/04/01}{two errors corrected: +% made setting fboxsep and fboxrule only temporary +% removed superfluous space after tabulars} +% \changes{v1.6b}{2004/06/19}{Added several % at eol to remove superfluous +% whitespace occurring sometimes} +% \changes{v1.7}{2005/08/09}{Added option sideways, option rotate now obsolete; +% added option captionskip} +% \changes{v1.8}{2006/04/10}{Standardized file setup following +% http://www.ctan.org/tex-archive/info/dtxtut/dtxtut.pdf +% mincapwidth option added +% Moved newdimen definition outside ctable macro +% } +% +% \GetFileInfo{ctable.dtx} +% +% \DoNotIndex{ \newcommand, \\, \,, +% \def, \definecolor, \hbox, \raggedright, +% \FL, \else, \ifdim, \sbox, +% \LL, \empty, \ifx, \setkeys, +% \ML, \end, \label, \specialrule, +% \NN, \fboxrule, \let, \tabularnewline, +% \PackageError, \fboxsep, \newbox, \textit, +% \PackageWarning, \fcolorbox, \newcolumntype, \usebox, +% \RequirePackage, \fi, \newdimen, \vspace, +% \begin, \footnotesize, \normalfont, \wd, +% \define@key, +% } +% +% \title{The \textsf{ctable} package\thanks{This document +% corresponds to \textsf{ctable}~\fileversion, dated \filedate.}} +% \author{Wybo Dekker \\ \texttt{wybo@servalys.nl}} +% +% \maketitle +% +% \section{Purpose} The |ctable| package lets you easily typeset +% captioned table and figure floats with optional +% footnotes. Both caption and footnotes will be forced within the +% width of the table. +% +% If the width of the table is specified, then tabularx will be used +% to typeset it, and the |X| column specifier can be used. Otherwise +% tabular will be used. +% +% This package defines the commands |\ctable|, +% |\tnote| and |\tmark|, as well as four |\tabularnewline| generating +% commands. The latter generate reasonable amounts of whitespace +% around horizontal rules and are also useful for tabulars outside +% this package. +% +% Since the |ctable| package imports the |array| and |booktabs| +% packages, all commands from those packages are available as well. +% +% Note that, in line with the comments that Simon Fear made +% describing his |booktabs| package, vertical rules for column +% separation can be produced with |\ctable|, but no provisions are +% made to have them make contact with horizontal rules. +% +% \section{Usage} +% \DescribeMacro{\ctable} +% |\ctable| is called with 4 parameters, of which the first is optional: \\ +% +% |\ctable[options] % key=value,...|\\ +% | {coldefs} % for \begin{tabular}|\\ +% | {foottable} % zero or more \tnote commands (see below)|\\ +% | {table lines} % lines for the table|\\ +% +% Options are given as key=value pairs, separated by comma's. +% Extra comma's, including one behind the last pair, don't hurt. +% Arguments to option should be put between braces if they contain +% comma's or equals signs. +% Currently the following option keys have been defined: +% \\[2ex] +% \begin{tabularx}{\hsize}{@{}lX@{}} +% |caption={...}|& table caption; the braces are needed only if your +% caption contains a comma or an equals sign.\NN +% +% |cap={...}| & for a short caption to go to the |\tableofcontents|.\NN +% +% |captionskip=...| & set the whitespace between the caption and the table; +% default is |2ex|.\NN +% +% |mincapwidth=...| & sets the minimum width of the caption. +% Useful for very narrow tables. If the given width +% is larger than de caption's actual width, only that width +% will be used, so that any footnotes stay within the caption's +% width.\NN +% +% |pos=...| & float position, default: |tbp|.\NN +% +% |label=...| & for |\label|\NN +% +% |width=...| & tabularx will be used to typeset the table at the +% specified width\,---\,one or more |X| column +% specifiers must be provided.\NN +% +% \end{tabularx} +% \\[2ex] +% \begin{tabularx}{\hsize}{@{}lX@{}} +% |maxwidth=...| & like the \textsl{width} option, but any |X| column +% specifiers will be replaced with |l| if the resulting +% table width would thus stay within the specified +% maximum width. This is especially useful where the +% \LaTeX\ source is generated by a script.\NN +% +% |center| & center the table in the available text width; this is +% the default.\NN +% +% |left| & left align the table in the available text width.\NN +% +% |right| & right align the table in the available text width.\NN +% +% |figure| & produce a figure float instead of a table float.\NN +% +% |botcap| & put the caption at the bottom of the float instead +% of on top of it.\NN +% +% |sideways| & rotate table or figure by 90 degrees anticlockwise +% and put it on a separate page. With the twoside option +% for the standard \LaTeX\ document classes, rotation +% will be -90 on even pages. If you use this option, +% the |pos| option is not allowed.\NN +% +% |star| & use the starred versions of the |table| and |figure| +% environments, which place the float over two columns +% when the |twocolumn| option or the |\twocolumn| +% command is active.\NN +% +% |framerule=...|& draw a frame around the table with the given rule +% thickness. The default is |0pt|, so that no frame +% will be seen.\NN +% +% |framesep=...| & set the distance between the frame and the table +% to the given dimension. The default is |0pt|.\NN +% +% |framefg=|\sl r g b & set the foreground color of the frame (the +% rule color) to the given triplet of +% \textsl{rgb}-values. The values should be numbers +% between 0 and 1. The default is |0 0 0| (black).\NN +% +% |framebg=|\sl r g b & set the background color of the frame (the +% color inside the frame) to the given triplet of +% \textsl{rgb}-values. The values should be numbers +% between 0 and 1. The default is |1 1 1| (white).\NN +% \end{tabularx} +% \\[2ex] +% The footnotes are placed under the table, without a rule. +% You therefore probably will want to use the |\LL| (last line) +% command if you use footnotes. +% \DescribeMacro{\tnote} +% |\tnote[label]{footnote text}| places {\footnotesize +% \textsuperscript{\normalfont\textit{label}}\,footnote text} +% under the table. +% Can only be used in the foottable parameter described above. The +% label is optional, the default label is a single $a$. For more +% detailed control, you can also replace this command with something +% like |labeltext&footnotetext\NN|. +% \par +% \DescribeMacro{\tmark} +% |\tmark[label]| this command places the superscripted label in the +% table. It is equivalent with |$^{label}$|. +% The label is optional, the default label is a single $a$. +% \par +% The newline generating commands are a combination of +% |\tabularnewline| and zero or one of |booktabs|' |\toprule|, +% |\midrule| or |\bottomrule|. These combinations have been made, and +% short names have been defined, because source texts for complex +% tables often become very crowded: +% \par +% \DescribeMacro{\NN} Normal Newline, generates just a normal new line. +% An optional dimen parameter inserts extra vertical space under the +% line\\ +% \DescribeMacro{\FL} First Line, generates a new line and a thick +% rule with some extra space under it. +% An optional dimen parameter sets the line width; the default is 0.08em \\ +% \DescribeMacro{\ML} Middle Line: generates a new line and a thin +% rule with some extra space over and under it. +% An optional dimen parameter sets the line width; the default is 0.05em \\ +% \DescribeMacro{\LL} Last Line: generates a new line and a thick +% rule with some extra space over it. +% An optional dimen parameter sets the line width; the default is 0.08em \\ +% These macros can be used outside |\ctable| constructs. +% \par +% Finally, for completeness, here are some of |booktabs|' commands +% that may be useful:\\ +% \DescribeMacro{\toprule} |\toprule[<wd>]| +% where |<wd>| is the optional thinkness of the rule\\ +% \DescribeMacro{\midrule} |\midrule[<wd>]|\\ +% \DescribeMacro{\bottomrule} |\bottomrule[<wd>]|\\ +% \DescribeMacro{\cmidrule} |\cmidrule[<wd>](<trim>){a-b}| +% where |<trim>| can be |r|, |l|, or |rl| +% and the rule is drawn over columns |a| through |b|\\ +% \DescribeMacro{\morecmidrules} |\morecmidrules| +% must be used to separate two successive cmidrules\\ +% \DescribeMacro{\addlinespace} |\addlinespace[<wd>]| +% inserts extra space between rows\\ +% \DescribeMacro{\specialrule} +% |\specialrule{<wd>}{<abovespace>}{<belowspace>}|\\ +% See the |booktabs| documentation for details. +% \ctable[ +% cap = The Skewing Angles, +% caption = The Skewing Angles ($\beta$) for +% $\fam0 Mu(H)+X_2$ and $\fam0 Mu(H)+HX$~\tmark, +% label = tab:nowidth, +% ]{rlcc}{ +% \tnote{for the abstraction reaction, +% $\fam0 Mu+HX \rightarrow MuH+X$.} +% \tnote[b]{1 degree${} = \pi/180$ radians.} +% \tnote[c]{this is a particularly long note, showing that +% footnotes are set in raggedright mode as we don't like +% hyphenation in table footnotes.} +% }{ \FL +% & & $\fam0 H(Mu)+F_2$ & $\fam0 H(Mu)+Cl_2$ \ML +% &$\beta$(H) & $80.9^\circ$\tmark[b] & $83.2^\circ$ \NN +% &$\beta$(Mu) & $86.7^\circ$ & $87.7^\circ$ \LL +% } +% +% \subsection{The width and maxwidth options} +% When \LaTeX-sources containing tables are generated automatically by a +% script, it is often not known in advance what the maximum size of an l +% column will be. A good solution for this is to use an |X| specifier, +% typesetteing the table at the text width with the tabularx package. +% However, this will result in too much white space in cases where the +% column contains small texts only. This problem can be solved by using +% the maxwidth option instead of the width option. The |X| specifiers will +% then be replaced with |l| as long as the width of the resulting table +% stays with the specified maximum width. +% +% +% \section{Examples} +% \subsection{Tables} +% Table~\ref{tab:nowidth} is an example taken from the related package +% threeparttable.sty by Donald Arseneau, with an extra footnote. +% It was typeset with: +% \begin{verbatim} +% \ctable[ +% cap = The Skewing Angles, +% caption = The Skewing Angles ($\beta$) for +% $\fam0 Mu(H)+X_2$ and $\fam0 Mu(H)+HX$~\tmark, +% label = tab:nowidth, +% ]{rlcc}{ +% \tnote{for the abstraction reaction, +% $\fam0 Mu+HX \rightarrow MuH+X$.} +% \tnote[b]{1 degree${} = \pi/180$ radians.} +% \tnote[c]{this is a particularly long note, showing that +% footnotes are set in raggedright mode as we don't like +% hyphenation in table footnotes.} +% }{ \FL +% & & $\fam0 H(Mu)+F_2$ & $\fam0 H(Mu)+Cl_2$ \ML +% &$\beta$(H) & $80.9^\circ$\tmark[b] & $83.2^\circ$ \NN +% &$\beta$(Mu) & $86.7^\circ$ & $87.7^\circ$ \LL +% } +% \end{verbatim} +% \ctable[ +% caption = Example with a specified width of 100mm, +% width = 100mm, +% pos = b, +% label = tab:width, +% left +% ]{c>{\raggedright}Xc>{\raggedright}X}{ +% \tnote{footnotes are placed under the table} +% }{ \FL +% \multicolumn{4}{c}{Example using tabularx} \ML +% \multicolumn{2}{c}{Multicolumn entry!} & THREE & FOUR \NN +% \cmidrule(r){1-2}\cmidrule(rl){3-3}\cmidrule(l){4-4} +% one& +% The width of this column depends on the width of the +% table.\tmark & +% three& +% Column four will act in the same way as +% column two, with the same width. \LL +% } +% +% Table~\ref{tab:width} is an example with a width specification, +% taken from the |tabularx| documentation, with the vertical rules +% removed. By using the trimming parameters of the |\LR|, |\MR|, and +% |\RR| commands of the |booktabs| package, some of the horizontal +% splitting was regained. By using the |left| option, the table has +% been left aligned. It was typeset with: +% \begin{verbatim} +% \ctable[ +% caption = Example with a specified width of 100mm, +% width = 100mm, +% pos = b, +% label = tab:width, +% left +% ]{c>{\raggedright}Xc>{\raggedright}X}{ +% \tnote{footnotes are placed under the table} +% }{ \FL +% \multicolumn{4}{c}{Example using tabularx} \ML +% \multicolumn{2}{c}{Multicolumn entry!} & THREE & FOUR \NN +% \cmidrule(r){1-2}\cmidrule(rl){3-3}\cmidrule(l){4-4} +% one& +% The width of this column depends on the width of the +% table.\tmark & +% three& +% Column four will act in the same way as +% column two, with the same width. \LL +% } +% \end{verbatim} +% +% \subsection{Figures} +% Figures, even single ones, are always put in tabular cells. This is not +% particularly handy for single pictures, but it eases the construction +% of arrays of pictures, including sub-captions, delineation, and spacing. +% Figure~\ref{fig} shows a figure that has been produced with the |\ctable| +% command, in combination with |\usepackage{carom}|; +% it has been typeset with: +% \begin{verbatim} +% \ctable[ +% caption = The di- and tri-bromobenzenes, +% label = fig, +% botcap, +% framebg = .53 .81 .92, +% framerule = 1pt, +% framesep = 4ex, +% figure, +% ]{ccc}{}{ \NN +% \bzdrv{1==Br;2==Br}& +% \bzdrv{1==Br;3==Br}& +% \bzdrv{1==Br;4==Br} \NN +% 1,2 & 1,3 & 1,4 \NN[3ex] +% \bzdrv{1==Br;2==Br;3==Br}& +% \bzdrv{1==Br;2==Br;4==Br}& +% \bzdrv{1==Br;3==Br;5==Br} \NN +% 1,2,3 & 1,2,4 & 1,3,5 +% } +% \end{verbatim} +% \ctable[ +% caption = The di- and tri-bromobenzenes, +% label = fig, +% botcap, +% framebg = .53 .81 .92, +% framerule = 1pt, +% framesep = 4ex, +% figure, +% ]{ccc}{}{ \NN +% \bzdrv{1==Br;2==Br}& +% \bzdrv{1==Br;3==Br}& +% \bzdrv{1==Br;4==Br} \NN +% 1,2 & 1,3 & 1,4 \NN[3ex] +% \bzdrv{1==Br;2==Br;3==Br}& +% \bzdrv{1==Br;2==Br;4==Br}& +% \bzdrv{1==Br;3==Br;5==Br} \NN +% 1,2,3 & 1,2,4 & 1,3,5 +% } +% (The excessive whitespace at the left of the figure is caused by +% the bounding boxes generated by the \textsl{carom} package.) +% \StopEventually{} +% +% \section{Implementation} +% \parskip2ex +% \begin{macrocode} +\RequirePackage{xspace,color,xkeyval,array,tabularx,booktabs,rotating} \def\NN{\tabularnewline} \def\FL{\toprule} \def\ML{\NN\midrule} @@ -383,7 +442,11 @@ \newdimen\@ctblwidth \newdimen\@ctblcaptionskip \newdimen\@ctblmaxwidth +\newdimen\@ctblmincapwidth \newdimen\@ctblw % the final width +\newdimen\@ctblww +\newdimen\@ctbloldsep +\newdimen\@ctbloldrule % \end{macrocode} % Allocate box registers so that we can determine the widths of the % tables @@ -404,9 +467,13 @@ \define@key{ctbl}{pos}{\def\@ctblpos{#1}\def\@ctblbegin{\@ctblbeg[#1]}}% \define@key{ctbl}{width}{\@ctblwidth=#1}% \define@key{ctbl}{maxwidth}{\@ctblmaxwidth=#1}% +\define@key{ctbl}{mincapwidth}{\@ctblmincapwidth=#1}% \define@key{ctbl}{botcap}[]{\def\@ctblbotcap{1}}% \define@key{ctbl}{sideways}[]{\def\@ctblsideways{sideways}}% -\define@key{ctbl}{rotate}[]{\def\@ctblsideways{sideways}\PackageWarning{ctable}{using obsolete option 'rotate', use 'sideways' instead}}% +\define@key{ctbl}{rotate}[]{\def\@ctblsideways{sideways}% + \PackageWarning{ctable}{% + using obsolete option 'rotate', use 'sideways' instead} + }% \define@key{ctbl}{figure}[]{\def\@ctbltaborfig{figure}}% \define@key{ctbl}{center}[]{\def\@ctblalign{center}}% \define@key{ctbl}{right}[]{\def\@ctblalign{flushright}}% @@ -426,8 +493,6 @@ \caption[\@ctblcap]{\label{\@ctbllabel}\@ctblcaption} \fi } -\newdimen\@ctbloldsep -\newdimen\@ctbloldrule \def\@ctblframe#1#2#3{% \@ctbloldsep\fboxsep\fboxsep\@ctblframesep% \@ctbloldrule\fboxrule\fboxrule\@ctblframerule% @@ -436,7 +501,7 @@ \newcommand{\tnote}[2][a]{% \hbox{\@textsuperscript{\normalfont\textit{#1}}}\NN} \newcommand{\tmark}[1][a]{% - \hbox{\@textsuperscript{\normalfont\textit{#1}}}} + \hbox{\@textsuperscript{\normalfont\textit{#1\xspace}}}} \newcommand{\ctable}[4][]{% \def\@ctbltaborfig{table}% \def\@ctblalign {center}% @@ -457,6 +522,7 @@ \@ctblframesep0pt \@ctblwidth=0pt \@ctblmaxwidth=0pt + \@ctblmincapwidth=0pt \setkeys{ctbl}{#1}% % \end{macrocode} % It makes no sense to use \textsl{width} together with \textsl{maxwidth} or @@ -537,21 +603,30 @@ \fi % \end{macrocode} % the |ctbl@t| box now contains the table as we want to typeset it; -% deternmine its width: +% determine its width: % \begin{macrocode} \@ctblw=\wd\ctbl@t % \end{macrocode} +% If mincapwidth was set, +% make only as wide as needed for the caption so that any footnotes +% stay within the caption width +% \begin{macrocode} + \ifdim\@ctblmincapwidth=0pt\@ctblww=\@ctblw\else% + \settowidth{\@ctblww}{Table 1: \@ctblcaption} + \ifdim\@ctblww>\@ctblmincapwidth\@ctblww=\@ctblmincapwidth\fi% + \fi +% \end{macrocode} % |\@ctblbegin| is now defined as something like |\begin{table}[tbp]|. % \begin{macrocode} \@ctblbegin \begin{\@ctblalign} - \begin{minipage}{\@ctblw} + \begin{minipage}{\@ctblww} \ifx\@ctblbotcap\empty\@ctblCaption\vspace{\@ctblcaptionskip}\fi - \usebox\ctbl@t % insert the tabular + \centering{\usebox\ctbl@t} % insert the tabular \def\@ctblfootnotes{#3} \ifx#3\empty\else % append footnotes, if any \\ - \begin{tabularx}{\@ctblw}{r@{\,}>{\footnotesize\raggedright}X} + \begin{tabularx}{\hsize}{r@{\,}>{\footnotesize\raggedright}X} #3 \end{tabularx} \fi @@ -560,6 +635,7 @@ \end{\@ctblalign} \@ctblend } -%</package> % \end{macrocode} % \Finale +\endinput +$Id: ctable.dtx,v 1.36 2006/10/12 11:17:43 wybo Exp $ |