The tabulary package^{∗}

David Carlisle

2003/09/14

1 User Documentation

\begin{tabulary}{⟨length⟩}{⟨pream⟩} . . . \end{tabulary}

The rather daft name may change in a later release but it is a pun on tabularx, which itself was a pun on tabular*…

These environments work pretty much like the standard tabular environment (or more correctly, the enhanced version from the array package) except that there are more possibilities for the column types.

LCRJ These new ‘uppercase’ column types are only activated in the tabulary environment. In order to make the total table width equal to ⟨length⟩ the LCRJ columns are converted to p columns (with \raggedright, \centering, or \raggedleft or normal justification respectively applied). The width of these converted columns is proportional to the natural width of the longest entry in each column.

To stop very narrow columns being too ‘squeezed’ by this process any columns that are narrower than \tymin are set to their natural width. This length may be set with \setlength and is arbitrarily initialised to 10 pt. (If you know that a column will be narrow, it may be preferable to use, say, c rather than C so that the tabulary mechanism is never invoked on that column.)

Similarly one very large entry can force its column to be too wide. So to prevent this, all columns with natural length greater than \tymax are set to the same width (with the proportion being taken as if the natuaral length was equal to \tymax). This is initially set to twice the text width..

Narrow p columns are sometimes quite hard to set, and so you may redefine the command \tyformat to be any declarations to make just after the \centering or \ragged… declaration. By default it redefines \everypar to insert a zero space at the start of every paragraph, so the first word may be hyphenated. (See DogBook).

As the environment makes a standard L^{A}TEX box, it will be indented by the paragraph indent at the start of a paragraph, and so will not fit on a line if given argument \textwidth unless it is preceded by \noindent or is in a center environment or some other environment with zero paragraph indent.

∗This file has version number v0.8, last revised 2003/09/14.

2 Features

You can use \multicolumn but if the multicolumn text turns out to be longer than the final calculated widths of the columns that it spans, then the final table will be too wide.

\verb doesnt work. (except in restricted version as in tabularx)

The whole table is evaluated twice, so take care with some TEX constructions that may have side effects like writing to files.

3 Options

The following package option is defined:

debugshow Causes a lot of stuff to appear on the terminal. I find this invaluable, you may find it less so.

4 Examples

With C columns

1 the rain in spain falls mainly on the plain (an @ expr.) the rain in spain falls mainly on the

plain the rain in spain falls mainly on the plain

a  b  (an @ expr.)  c
{a \atop a}  b b  (an @ expr.)  c c

With J columns

1 the rain in spain falls mainly on the plain (an @ expr.) the rain in spain falls mainly on the

plain the rain in spain falls mainly on the plain

a b  (an @ expr.) c
{a \atop a} b b  (an @ expr.) c c

With L, R and C columns, and a \multicolumn

1 the rain in spain falls mainly on

the plain the rain in spain falls mainly on the plain the rain in spain falls mainly on the plain

and now for something completely different

x  some multicolumn text across columns 2–4
a  b c  d
{a \atop a}  b b c c  d d

The following examples attempt to show the effect of the \tymin and \tymax parameters. One should also perhaps note that \tymax refers to the total column width (inluding any inter-column space, rules etc) but \tymin just refers to the width of the column entry (like the argument to the standard p column).

\tymin=0pt
\tymax=\maxdimen

Note how the first column is ‘squeezed’. In fact it is in such a narrow column that even ‘a’ produces an overfull box warning!

a b b b b c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d

\tymin=20pt
\tymax=\maxdimen

Here increase \tymin so that columns b and a are not so narrow. ‘a’ is set to its natural width, and ‘b’ is set to \tymin.

a {b b b \atop b} c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d

\tymin=20pt
\tymax=200pt

In the previous example, the large d column dominated the table, being a lot wider than the c column. By reducing \tymax can limit the width of column d producing more even column widths, but now producing an entry for d that is longer than that for c.

a

{b b b \atop b}

c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c

d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d

d d d d d d d

5 The Code

1 ⟨∗package⟩

 2 \RequirePackage{array}
 3 \catcode`\Z=14
 4 \DeclareOption{debugshow}{\catcode`\Z=9\relax}
 5 \ProcessOptions

\arraybackslash Borrowed from tabularx.

 6 \def\arraybackslash{\let\\=\@arraycr}

\@finalstrut Bug fixed version from December 1995 L^{A}TEX release. Old bug going back to L^{A}TEX2.09…

 7 \def\@finalstrut#1{%
 8 \unskip\ifhmode\nobreak\fi\vrule\@width\z@\@height\z@\@depth\dp#1}

\TY@count Counter so that we know what column we are hacking around in.

 9 \newcount\TY@count

\tabulary Top level macro for standard form.

10 \def\tabulary{%
11 \let\TY@final\tabular
12 \let\endTY@final\endtabular
13 \TY@tabular}

\TY@tabular Looks a lot like tabularx at this stage. Grab everything into a token register.

14 \def\TY@tabular#1{%
15 \edef\TY@{\@currenvir}%
16 {\ifnum0=`}\fi

At this point need to save locally things that tabulary will globally mess up. These are restored at the end of the environment.

17 \@ovxx\TY@linewidth
18 \@ovyy\TY@tablewidth
19 \count@\z@
20 \@tempswatrue
21 \@whilesw\if@tempswa\fi{%
22 \advance\count@\@ne
23 \expandafter\ifx\csname TY@F\the\count@\endcsname\relax
24  \@tempswafalse
25 \else
26  \expandafter\let\csname TY@SF\the\count@\expandafter\endcsname
27  \csname TY@F\the\count@\endcsname
28  \global\expandafter\let\csname TY@F\the\count@\endcsname\relax
29  \expandafter\let\csname TY@S\the\count@\expandafter\endcsname
30  \csname TY@\the\count@\endcsname
31 \fi}%
32  \global\TY@count\@ne
33  \TY@width\xdef{0pt}%
34  \global\TY@tablewidth\z@
35  \global\TY@linewidth#1\relax
36 Z\message{^^J^^JTable^^J%

37 Z        Target Width: \the\TY@linewidth^^J%
38 Z        \string\tabcolsep: \the\tabcolsep\space
39 Z        \string\arrayrulewidth: \the\arrayrulewidth\space
40 Z        \string\doublerulesep: \the\doublerulesep^^J%
41 Z        \string\tymin: \the\tymin\space
42 Z        \string\tymax: \the\tymax^^J}%

Placing this here means that nested tabulars will get this definition but that’s probably OK, the extra code for LCR etc shouldn’t do any harm

43  \let\@classz\TY@classz
44  \let\verb\TX@verb
45  \toks@{}\TY@get@body}

\TY@@mkpream Saved version.

46 \let\TY@@mkpream\@mkpream
\TY@mkpream TY version.
47 \def\TY@mkpream{%
48  \def\@addamp{%
49  \if@firstamp \@firstampfalse \else
50  \global\advance\TY@count\@ne
51  \edef\@preamble{\@preamble &}\fi
52  \TY@width\xdef{0pt}}%
53  \def\@acol{%
54  \TY@subwidth\col@sep
55  \@addtopreamble{\hskip\col@sep}}%
56  \let\@arrayrule\TY@arrayrule
57  \let\@classvi\TY@classvi
58  \def\@classv{\save@decl
59  \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@
60  \sbox\z@{\d@llarbegin\@nextchar\d@llarend}%
61  \TY@subwidth{\wd\z@}%
62  \@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}%
63  \prepnext@tok}%
64 \global\let\@mkpream\TY@@mkpream
65 \TY@@mkpream}

\TY@arrayrule Pull this out so the colortbl support below can redefine

66 \def\TY@arrayrule{%
67 \TY@subwidth\arrayrulewidth
68 \@addtopreamble \vline}

\TY@classvi Pull this out so the colortbl support below can redefine

69 \def\TY@classvi{\ifcase \@lastchclass
70 \@acol \or
71 \TY@subwidth\doublerulesep
72 \@addtopreamble{\hskip \doublerulesep}\or
73 \@acol \or
74 \@classvii
75 \fi}

\TY@tab First run a tabular with all the column types fudged so that the widths of any rules or @-expresions are noted.

76 \def\TY@tab{%
77 \setbox\z@\hbox\bgroup

Support displaymath by making it non-display in the first pass. (Other display environments defined in terms of $$ would need to be added here by packages that define them.)

78 \let\[$\let\]$%
79 \let\equation$\let\endequation$%
80  \col@sep\tabcolsep
81  \let\d@llarbegin\begingroup\let\d@llarend\endgroup
82  \let\@mkpream\TY@mkpream
83  \def\multicolumn##1##2##3{\multispan##1\relax}%
84  \CT@start\TY@tabarray}
\TY@tabarray
85 \def\TY@tabarray{\@ifnextchar[{\TY@array}{\@array[t]}}
86 \def\TY@array[#1]{\@array[t]}

\TY@width Just a shorthand to access a column width macro.

87 \def\TY@width#1{%
88 \expandafter#1\csname TY@\the\TY@count\endcsname}

\TY@subwidth Subtract a width from the current column width and also The total line table width and the target line width.

89 \def\TY@subwidth#1{%
90 \TY@width\dimen@
91 \advance\dimen@-#1\relax
92 \TY@width\xdef{\the\dimen@}%
93 \global\advance\TY@linewidth-#1\relax}

\endtabulary First run one modified tabular, making sure to add a blank row (cf longtable) to the end in case the user supplied last row is hidden by an hline or something.

94 \def\endtabulary{%
95 \gdef\@halignto{}%
96 \expandafter\TY@tab\the\toks@
97 \crcr\omit
98 {\xdef\TY@save@row{}%
99  \loop
100  \advance\TY@count\m@ne
101  \ifnum\TY@count>\z@
102  \xdef\TY@save@row{\TY@save@row&\omit}%
103  \repeat}\TY@save@row
104 \endarray\global\setbox1=\lastbox\setbox0=\vbox{\unvbox1
105  \unskip\global\setbox1=\lastbox}\egroup

Check that \tymin is not too large.

106 \dimen@\TY@linewidth
107 \divide\dimen@\TY@count
108 \ifdim\dimen@<\tymin
109  \TY@warn{tymin too large (\the\tymin), resetting to \the\dimen@}%
110  \tymin\dimen@
111 \fi

Now take the last row apart, cf longtable or appendix D.

112 \setbox\tw@=\hbox{\unhbox\@ne
113  \loop
114 \@tempdima=\lastskip
115 \ifdim\@tempdima>\z@
116 Z   \message{ecs=\the\@tempdima^^J}%
117 \global\advance\TY@linewidth-\@tempdima
118 \fi
119  \unskip
120  \setbox\tw@=\lastbox
121  \ifhbox\tw@
122 Z     \message{Col \the\TY@count: Initial=\the\wd\tw@\space}%
123  \ifdim\wd\tw@>\tymax
124  \wd\tw@\tymax
125 Z       \message{> max\space}%
126 Z     \else
127 Z       \message{ \@spaces\space}%
128  \fi
129 \TY@width\dimen@
130 Z \message{\the\dimen@\space}%
131 \advance\dimen@\wd\tw@
132 Z \message{Final=\the\dimen@\space}%
133 \TY@width\xdef{\the\dimen@}%
134  \ifdim\dimen@<\tymin
135 Z        \message{< tymin}%
136  \global\advance\TY@linewidth-\dimen@
137  \expandafter\xdef\csname TY@F\the\TY@count\endcsname
138  {\the\dimen@}%
139  \else
140  \expandafter\ifx\csname TY@F\the\TY@count\endcsname\z@
141 Z        \message{***}%
142  \global\advance\TY@linewidth-\dimen@
143  \expandafter\xdef\csname TY@F\the\TY@count\endcsname
144  {\the\dimen@}%
145  \else
146 Z        \message{> tymin}%
147  \global\advance\TY@tablewidth\dimen@
148  \global\expandafter\let\csname TY@F\the\TY@count\endcsname
149  \maxdimen
150  \fi\fi
151  \advance\TY@count\m@ne
152  \repeat}%

A bit cheap just doing this four times, but prevents any possibilities of looping. …

153  \TY@checkmin
154  \TY@checkmin
155  \TY@checkmin
156  \TY@checkmin

Reset the counter.

157  \TY@count\z@

Reset the LCRJ column definition to set paragraphs to the calculated widths.

158  \let\TY@box\TY@box@v

Run a second tabular, and for the star form, unbox it.

159 {\expandafter\TY@final\the\toks@\endTY@final}%

Finish off by restoring global commands.

160 \count@\z@
161 \@tempswatrue
162 \@whilesw\if@tempswa\fi{%
163 \advance\count@\@ne
164 \expandafter\ifx\csname TY@SF\the\count@\endcsname\relax
165  \@tempswafalse
166 \else
167  \global\expandafter\let\csname TY@F\the\count@\expandafter\endcsname
168  \csname TY@SF\the\count@\endcsname
169  \global\expandafter\let\csname TY@\the\count@\expandafter\endcsname
170  \csname TY@S\the\count@\endcsname
171 \fi}%
172 \TY@linewidth\@ovxx
173 \TY@tablewidth\@ovyy
174  \ifnum0=`{\fi}}

\TY@checkmin Check that no column is squeezed below \tymin. If it is, fix the width of that column to \tymin and try again re-computing the ratio. (The new ratio will be smaller, and may squeeze yet more rows, so need to iterate this, currently just do it four times.)

175 \def\TY@checkmin{%
176 \let\TY@checkmin\relax
177 \ifdim\TY@tablewidth>\z@
178 \Gscale@div\TY@ratio\TY@linewidth\TY@tablewidth
179 \ifdim\TY@tablewidth <\linewidth
180 \def\TY@ratio{1}%
181 \fi
182 \else
183 \TY@warn{No suitable columns!}%
184 \def\TY@ratio{1}%
185 \fi
186 \count@\z@
187 Z \message{^^JLine Width: \the\TY@linewidth,
188 Z             Natural Width: \the\TY@tablewidth,
189 Z             Ratio: \TY@ratio^^J}%
190 \@tempdima\z@
191 \loop
192 \ifnum\count@<\TY@count
193 \advance\count@\@ne
194 \ifdim\csname TY@F\the\count@\endcsname>\tymin
195  \dimen@\csname TY@\the\count@\endcsname
196  \dimen@\TY@ratio\dimen@
197  \ifdim\dimen@<\tymin
198 Z     \message{Column \the\count@\space ->}%
199  \global\expandafter\let\csname TY@F\the\count@\endcsname\tymin
200  \global\advance\TY@linewidth-\tymin
201  \global\advance\TY@tablewidth-\csname TY@\the\count@\endcsname
202  \let\TY@checkmin\TY@@checkmin
203  \else

204  \expandafter\xdef\csname TY@F\the\count@\endcsname{\the\dimen@}%
205  \advance\@tempdima\csname TY@F\the\count@\endcsname
206  \fi
207 \fi
208 Z \dimen@\csname TY@F\the\count@\endcsname\message{\the\dimen@, }%
209 \repeat
210 Z \message{^^JTotal:\the\@tempdima^^J}%

211 }

\TY@@checkmin Saved value
212 \let\TY@@checkmin\TY@checkmin

TY@linewidth Stores the target width.

213 \newdimen\TY@linewidth

\tyformat What to do with columns

214 \def\tyformat{\everypar{{\nobreak\hskip\z@skip}}}

tymin Columns narrower than this are not fudged.

215 \newdimen\tymin
216 \tymin=10pt

tymin Columns wider than this are all treated alike and set to the same width, to stop one particularly long entry hijacking the entire table.

217 \newdimen\tymax
218 \tymax=2\textwidth

\@testpatch Also add LCRJ although these don’t do anything useful except in tabulary.

219 \def\@testpach{\@chclass
220 \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
221 \ifnum \@lastchclass=7 5 \else
222 \ifnum \@lastchclass=8 \tw@ \else
223  \ifnum \@lastchclass=9 \thr@@
224 \else \z@
225 \ifnum \@lastchclass = 10 \else
226 \edef\@nextchar{\expandafter\string\@nextchar}%
227 \@chnum
228 \if \@nextchar c\z@ \else
229  \if \@nextchar l\@ne \else
230  \if \@nextchar r\tw@ \else
231 %     \if \@nextchar s6 \else
232 \if \@nextchar C7 \else
233  \if \@nextchar L8 \else
234  \if \@nextchar R9 \else
235  \if \@nextchar J10 \else
236 \z@ \@chclass
237 \if\@nextchar |\@ne \else
238  \if \@nextchar !6 \else
239  \if \@nextchar @7 \else
240  \if \@nextchar <8 \else
241  \if \@nextchar >9 \else

242 10

243 \@chnum

244 \if \@nextchar m\thr@@\else
245 \if \@nextchar p4 \else
246  \if \@nextchar b5 \else
247 \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi\fi \fi \fi\fi \fi
248 %   \fi
249  \fi  \fi  \fi  \fi  \fi  \fi \fi \fi \fi \fi \fi}

\TY@classz Here hacked around without the respect Frank’s code deserves…

250 \def\TY@classz{%
251 \@classx
252 \@tempcnta\count@
253 \ifx\TY@box\TY@box@v
254  \global\advance\TY@count\@ne
255 \fi
256 \let\centering c%
257 \let\raggedright\noindent
258 \let\raggedleft\indent
259 \let\arraybackslash\relax
260 \prepnext@tok
261 \ifnum\@chnum<4
262  \global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@
263 \fi
264 \ifnum\@chnum=6
265  \global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@
266 \fi
267 \@addtopreamble{%
268  \ifcase\@chnum
269  \hfil \d@llarbegin\insert@column\d@llarend \hfil \or
270  \kern\z@
271  \d@llarbegin \insert@column \d@llarend \hfil \or
272  \hfil\kern\z@ \d@llarbegin \insert@column \d@llarend \or
273  $\vcenter\@startpbox{\@nextchar}\insert@column \@endpbox $\or
274  \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
275  \vbox \@startpbox{\@nextchar}\insert@column \@endpbox \or
276  \d@llarbegin \insert@column \d@llarend \or% dubious "s" case
277  \TY@box\centering\or
278  \TY@box\raggedright\or
279  \TY@box\raggedleft\or
280  \TY@box\relax
281  \fi}\prepnext@tok}

\TY@box The argument is \centering etc depending on whether LCRJ is used. However in this version the entries are set in horizontal mode with definitions mimicing the standard lcr columns. Later \TY@box will be redefined to \TY@box@v which really sets the entries in vertical mode.

282 \def\TY@box#1{%
283 \ifx\centering#1%
284  \hfil \d@llarbegin\insert@column\d@llarend \hfil \else
285 \ifx\raggedright#1%
286  \kern\z@%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
287  \d@llarbegin \insert@column \d@llarend \hfil \else
288 \ifx\raggedleft#1%
289  \hfil\kern\z@ \d@llarbegin \insert@column \d@llarend \else
290 \ifx\relax#1%

291  \d@llarbegin \insert@column \d@llarend
292 \fi  \fi  \fi  \fi}

\TY@box@v The version to use in a final run, set the CLRJ columns in a parbox of the appropriate width.

293 \def\TY@box@v#1{%
294  \vtop \@startpbox{\csname TY@F\the\TY@count\endcsname}%
295  #1\arraybackslash\tyformat
296  \insert@column\@endpbox}

\TY@tablewidth The natural width of the table on the first run.

297 \newdimen\TY@tablewidth

\Gscale@div Stolen from graphics package.

298 \def\Gscale@div#1#2#3{%
299 \setlength\dimen@{#3}%
300 \ifdim\dimen@=\z@
301  \PackageError{graphics}{Division by 0}\@eha
302  \dimen@#2%
303 \fi
304 \edef\@tempd{\the\dimen@}%
305 \setlength\dimen@{#2}%
306 \count@65536\relax
307 \ifdim\dimen@<\z@
308  \dimen@-\dimen@
309  \count@-\count@
310 \fi
311 \loop
312  \ifdim\dimen@<8192\p@
313  \dimen@\tw@\dimen@
314  \divide\count@\tw@
315 \repeat
316 \dimen@ii=\@tempd\relax
317 \divide\dimen@ii\count@
318 \divide\dimen@\dimen@ii
319 \edef#1{\strip@pt\dimen@}}

\TY@get@body Place all tokens as far as the first \end into a token register. Then call

 \TY@find@end to see if we are at \end{tabulary}.
320 \long\def\TY@get@body#1\end
321 {\toks@\expandafter{\the\toks@#1}\TY@find@end}
\TY@find@end If we are at \end{tabulary}, call \end{tabulary}, otherwise add \end{...} to

the register, and call \TY@get@body again.

322 \def\TY@find@end#1{%
323 \def\@tempa{#1}%
324 \ifx\@tempa\TY@\def\@tempa{\end{#1}}\expandafter\@tempa
325 \else\toks@\expandafter
326  {\the\toks@\end{#1}}\expandafter\TY@get@body\fi}

\TY@warn Warning messages.

327 \def\TY@warn{%
328 \PackageWarning{tabulary}}

329 \catcode`\Z=11

colortbl support.

330 \AtBeginDocument{
331 \@ifpackageloaded{colortbl}{%
332 \expandafter\def\expandafter\@mkpream\expandafter#\expandafter1%
333 \expandafter{%
334  \expandafter\let\expandafter\CT@setup\expandafter\relax
335  \expandafter\let\expandafter\CT@color\expandafter\relax
336  \expandafter\let\expandafter\CT@do@color\expandafter\relax
337  \expandafter\let\expandafter\color\expandafter\relax
338  \expandafter\let\expandafter\CT@column@color\expandafter\relax
339  \expandafter\let\expandafter\CT@row@color\expandafter\relax
340  \@mkpream{#1}}
341 \let\TY@@mkpream\@mkpream
342 \def\TY@classz{%
343 \@classx
344 \@tempcnta\count@
345 \ifx\TY@box\TY@box@v
346  \global\advance\TY@count\@ne
347 \fi
348 \let\centering c%
349 \let\raggedright\noindent
350 \let\raggedleft\indent
351 \let\arraybackslash\relax
352 \prepnext@tok
353 \expandafter\CT@extract\the\toks\@tempcnta\columncolor!\@nil
354 \ifnum\@chnum<4
355  \global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@
356 \fi
357 \ifnum\@chnum=6
358  \global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@
359 \fi
360 \@addtopreamble{%
361  \setbox\z@\hbox\bgroup\bgroup
362  \ifcase\@chnum
363  \hskip\stretch{.5}\kern\z@
364  \d@llarbegin\insert@column\d@llarend\hskip\stretch{.5}\or
365  \kern\z@%<<<<<<<<<<<<<<<<<<<<<<<<<<<
366  \d@llarbegin \insert@column \d@llarend \hfill \or
367  \hfill\kern\z@ \d@llarbegin \insert@column \d@llarend \or
368  $\vcenter\@startpbox{\@nextchar}\insert@column \@endpbox $\or
369  \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
370  \vbox \@startpbox{\@nextchar}\insert@column \@endpbox \or
371  \d@llarbegin \insert@column \d@llarend \or" dubious s case
372  \TY@box\centering\or
373  \TY@box\raggedright\or
374  \TY@box\raggedleft\or
375  \TY@box\relax
376  \fi
377 \egroup\egroup
378 \begingroup
379 \CT@setup
380 \CT@column@color

381 \CT@row@color
382 \CT@do@color
383 \endgroup
384  \@tempdima\ht\z@
385  \advance\@tempdima\minrowclearance
386  \vrule\@height\@tempdima\@width\z@
387 \unhbox\z@
388 }\prepnext@tok}%
389  \def\TY@arrayrule{%
390  \TY@subwidth\arrayrulewidth
391  \@addtopreamble{{\CT@arc@\vline}}}%
392  \def\TY@classvi{\ifcase \@lastchclass
393  \@acol \or
394  \TY@subwidth\doublerulesep
395  \ifx\CT@drsc@\relax
396  \@addtopreamble{\hskip\doublerulesep}%
397  \else
398  \@addtopreamble{{\CT@drsc@\vrule\@width\doublerulesep}}%
399  \fi\or
400  \@acol \or
401  \@classvii
402  \fi}%
403 }{%
404 \let\CT@start\relax

405 }

end of at begin document

406 }

\TX@warn \verb support, uses same csnames as in TX so they share code if both loaded (this version names tabulary in the warning though). See tabularx for documentation.

407 {\uccode`\*=`\ %
408 \uppercase{\gdef\TX@verb{%
409 \leavevmode\null\TX@vwarn
410 {\ifnum0=`}\fi\ttfamily\let\\\ignorespaces
411 \@ifstar{\let~*\TX@vb}{\TX@vb}}}}
412 \def\TX@vb#1{\def\@tempa##1#1{\toks@{##1}\edef\@tempa{\the\toks@}%
413  \expandafter\TX@v\meaning\@tempa\\ \\\ifnum0=`{\fi}}\@tempa!}
414 \def\TX@v#1!{\afterassignment\TX@vfirst\let\@tempa= }
415 \begingroup
416 \catcode`\*=\catcode`\#
417 \catcode`\#=12
418 \gdef\TX@vfirst{%
419 \if\@tempa#%
420  \def\@tempb{\TX@v@#}%
421 \else
422  \let\@tempb\TX@v@
423  \if\@tempa\space~\else\@tempa\fi
424 \fi
425 \@tempb}
426 \gdef\TX@v@*1 *2{%
427 \TX@v@hash*1##\relax\if*2\\\else~\expandafter\TX@v@\fi*2}
428 \gdef\TX@v@hash*1##*2{*1\ifx*2\relax\else#\expandafter\TX@v@hash\fi*2}

429 \endgroup
430 \def\TX@vwarn{%
431 \@warning{\noexpand\verb may be unreliable inside tabularx/y}%
432 \global\let\TX@vwarn\@empty}

433 ⟨/package⟩

Index

Numbers written in italic refer to the page where the corresponding entry is described; numbers underlined refer to the code line of the definition; numbers in roman refer to the code lines where the entry is used.

Symbols

\# . . . . . . . . . . 416, 417 \* . . . . . . . . . . 407, 416 \@@@ . . . . . . . . . . . . . 59 \@acol 53, 70, 73, 393, 400 \@addamp . . . . . . . . . 48

\@addtopreamble 55,

62, 68, 72, 267, 360, 391, 396, 398

\@array . . . . . . . . 85, 86 \@arraycr . . . . . . . . . 6

\@arrayrule . . . . . . . 56

\@chclass . 219, 236, 247 \@chnum … 220, 227,

243, 261, 264, 268, 354, 357, 362

\@classv . . . . . . . . . 58 \@classvi . . . . . . . . 57

\@classvii . . . . 74, 401

\@classx . . . . . 251, 343 \@classz . . . . . . . . . 43

\@currenvir . . . . . . . 15

\@depth . . . . . . . . . . . 8 \@eha . . . . . . . . . . . . 301 \@empty . . . . . . . . . . 432

\@endpbox . . . . 273–

275, 296, 368–370

\@finalstrut . . . . . . . \underline{7}
\@firstampfalse . . . 49
\@halignto . . . . . . . 95

\@height . . . . . . . 8, 386

\@ifnextchar . . . . . . 85
\@ifpackageloaded . 331

\@ifstar . . . . . . . . . 411

\@lastchclass . . 69,

220–223, 225, 392

\@mkpream . . . . . 46,

64, 82, 332, 340, 341 \@ne . 22, 32, 50, 112,

163, 193, 220, 229, 237, 254, 346

                          \@nextchar 59, 60, 226,

228–235, 237– 241, 244–246, 273–275, 368–370

\@nil . . . . . . . . . . . . 353 \@ovxx . . . . . . . . 17, 172 \@ovyy . . . . . . . . 18, 173

                          \@preamble . . . . . . . 51
                          \@preamerr . . . . . . . 247

\@spaces . . . . . . . . . 127

                          \@startpbox . . . 273–

275, 294, 368–370 \@tempa … 323, 324,

412–414, 419, 423 \@tempb … 420, 422, 425 \@tempcnta 252, 344, 353 \@tempd . . . . . . 304, 316

                          \@tempdima . . . . . . .

. 114–117, 190, 205, 210, 384–386

                          \@tempswafalse . 24, 165
                          \@tempswatrue . . 20, 161
                          \@testpach . . . . . . . 219
                          \@testpatch . . . . . . . \underline{219}

\@warning . . . . . . . . 431 \@whilesw . . . . . 21, 162 \@width …. 8, 386, 398 \[ . . . . . . . . . . . . . . 78 \\ . . . . . 6, 410, 413, 427 \] . . . . . . . . . . . . . . 78

\␣ . . . . . . . . . . . . . . 407

A \advance …. 22, 50,

91, 93, 100, 117, 131, 136, 142, 147, 151, 163, 193, 200, 201, 205, 254, 346, 385

                                                   \afterassignment . . 414
                                                   \arraybackslash . . .

. . \underline{6}, 259, 295, 351

                                                   \arrayrulewidth . . .

. . . . . . 39, 67, 390

                                                   \AtBeginDocument . . 330

B

                                                   \begingroup 81, 378, 415

\bgroup . . . . . . . 77, 361

C \catcode . . . . . . . . .

3, 4, 329, 416, 417

                                                   \centering . . . 256,

277, 283, 348, 372 \col@sep …. 54, 55, 80 \color . . . . . . . . . . . 337

                                                   \columncolor . . . . . . 353

\count@ . . 19, 22, 23, 26–30, 62, 160, 163, 164, 167– 170, 186, 192– 195, 198, 199, 201, 204, 205, 208, 252, 306, 309, 314, 317, 344

\crcr . . . . . . . . . . . . 97 \csname 23, 26–30, 88,

137, 140, 143, 148, 164, 167– 170, 194, 195, 199, 201, 204, 205, 208, 262, 265, 294, 355, 358

\CT@arc@ . . . . . . . . . 391 \CT@color . . . . . . . . 335

\CT@column@color . .

. . . . . . . . 338, 380

\CT@do@color . . 336, 382

\CT@drsc@ …. 395, 398

\CT@extract . . . . . . . 353
\CT@row@color . 339, 381

\CT@setup …. 334, 379 \CT@start . . . . . 84, 404

D

\d@llarbegin . . . 60,

62, 81, 269, 271, 272, 276, 284, 287, 289, 291, 364, 366, 367, 371

\d@llarend . . . . 60,

62, 81, 269, 271, 272, 276, 284, 287, 289, 291, 364, 366, 367, 371

\DeclareOption . . . . . 4

\def . . . . . . . . . . . 6, 7, 10, 14, 47, 48, 53, 58, 66, 69, 76, 83, 85–87, 89, 94, 175, 180, 184, 214, 219, 250, 282, 293, 298, 320, 322– 324, 327, 332, 342, 389, 392, 412, 414, 420, 430

\dimen@ . . . . . . . 90– 92, 106–110, 129–134, 136, 138, 142, 144, 147, 195–197, 204, 208, 299, 300, 302, 304, 305, 307, 308, 312, 313, 318, 319

\dimen@ii …. 316–318 \divide 107, 314, 317, 318

\doublerulesep . 40,

71, 72, 394, 396, 398 \dp . . . . . . . . . . . . . . 8

E

\edef . . . . . . . 15, 51,

226, 304, 319, 412 \egroup . . . . . . 105, 377 \else . . . . . . . 25, 49,

126, 139, 145, 166, 182, 203, 220–222, 224, 225, 228–235, 237–241, 244– 246, 284, 287, 289, 325, 397, 421, 423, 427, 428

\end . . . . . . 320, 324, 326 \endarray . . . . . . . . 104

\endcsname . . . . . . .

. 23, 26–30, 88, 137, 140, 143, 148, 164, 167– 170, 194, 195, 199, 201, 204, 205, 208, 262, 265, 294, 355, 358

\endequation . . . . . . 79

\endgroup . 81, 383, 429

\endtabular . . . . . . . 12
\endtabulary . . . . . . \underline{94}
\endTY@final . . . 12, 159

\equation . . . . . . . . 79 \everypar . . . . . . . . 214

\expandafter . . . 23,

26, 28, 29, 59, 88, 96, 137, 140, 143, 148, 159, 164, 167, 169, 199, 204, 226, 262, 265, 321, 324–326, 332– 339, 353, 355, 358, 413, 427, 428

\extracolsep . . . . . . 59

F

\fi … 8, 16, 21, 31, 51, 75, 111, 118, 128, 150, 162, 171, 174, 181, 185, 206, 207, 247–249, 255, 263, 266, 281, 292, 303, 310, 326, 347, 356, 359, 376, 399, 402, 410, 413, 423, 424, 427, 428

G

\gdef . . . . . . . . . 95,

408, 418, 426, 428 \global . . . . . . . 28,

32, 34, 35, 50, 64, 93, 104, 105, 117, 136, 142, 147, 148, 167, 169, 199–201, 254, 262, 265, 346, 355, 358, 432

                   \Gscale@div . . . 178, \underline{298}

H \hbox . . . . . 77, 112, 361 \hfil . . . . . 269, 271,

272, 284, 287, 289 \hfill . . . . . . . 366, 367 \hskip . . . . . . 55, 72,

214, 363, 364, 396 \ht . . . . . . . . . . . . . 384

I \if . . . . . . 228–235,

237–241, 244– 246, 419, 423, 427

                   \if@firstamp . . . . . . 49
                   \if@tempswa . . . . 21, 162

\ifcase 69, 268, 362, 392 \ifdim . . . . . . . 108,

115, 123, 134, 177, 179, 194, 197, 300, 307, 312

\ifhbox . . . . . . . . . . 121 \ifhmode . . . . . . . . . . 8 \ifnum . 16, 101, 174,

192, 220–223, 225, 261, 264, 354, 357, 410, 413

\ifx . . . . . . . 23, 140, 164, 253, 283, 285, 288, 290, 324, 345, 395, 428

                   \ignorespaces . . . . . 410

\indent . . . . . . 258, 350

                   \insert@column 269,

271–276, 284, 287, 289, 291, 296, 364, 366–371

K \kern . 270, 272, 286,

289, 363, 365, 367

L \lastbox . . 104, 105, 120 \lastskip . . . . . . . . 114

                   \leavevmode . . . . . . . 409

\let … 6, 11, 12, 26, 28, 29, 43, 44, 46, 56, 57, 64, 78, 79, 81, 82, 148, 158, 167, 169, 176, 199, 202, 212, 256– 259, 262, 265, 334–339, 341, 348–351, 355, 358, 404, 410, 411, 414, 422, 432

\linewidth . . . . . . . 179

\long . . . . . . . . . . . . 320 \loop . . 99, 113, 191, 311

M

\m@ne . . . . . . . . 100, 151 \maxdimen . . . . . . . . 149 \meaning . . . . . . . . . 413 \message . . . . . . 36,

116, 122, 125, 127, 130, 132, 135, 141, 146, 187, 198, 208, 210

\minrowclearance . . 385
\multicolumn . . . . . . 83
\multispan . . . . . . . 83

N

\NC@ecs . . . . . . . . . . 59 \newcount . . . . . . . . . 9

\newdimen . . . . . . . .

. 213, 215, 217, 297 \nobreak . . . . . . . 8, 214 \noexpand . . . . . . . . 431 \noindent …. 257, 349 \null . . . . . . . . . . . . 409

O

\omit . . . . . . . . . 97, 102 \or . . . . . . . . . . 70,

72, 73, 269, 271– 279, 364, 366– 374, 393, 399, 400

P

\p@ . . . . . . . . . . . . . 312

\PackageError . . . . . 301
\PackageWarning . . . 328
\prepnext@tok . . 63,

260, 281, 352, 388

\ProcessOptions . . . . 5

R

\raggedleft . . . 258,

279, 288, 350, 374

\raggedright . . 257,

278, 285, 349, 373 \relax . . . . . . 4, 23,

28, 35, 62, 83, 91, 93, 164, 176, 259, 280, 290, 306, 316, 334– 339, 351, 375, 395, 404, 427, 428

\repeat 103, 152, 209, 315

\RequirePackage . . . . 2

S

\save@decl . . . . . . . 58

\sbox . . . . . . . . . . . . 60 \setbox …. 77, 104,

105, 112, 120, 361

\setlength . . . 299, 305

\space … 38, 39, 41, 122, 125, 127, 130, 132, 198, 423

\stretch . . . . . 363, 364 \string …. 38–42, 226 \strip@pt . . . . . . . . 319

T

\tabcolsep . . . . . 38, 80

\tabular . . . . . . . . . 11 \tabulary . . . . . . . . \underline{10}

\textwidth . . . . . . . 218

\the 23, 26–30, 37–42, 62, 88, 92, 96, 109, 116, 122, 130, 132, 133, 137, 138, 140, 143, 144, 148, 159, 164, 167– 170, 187, 188, 194, 195, 198, 199, 201, 204, 205, 208, 210, 262, 265, 294, 304, 321, 326, 353, 355, 358, 412

\the@toks . . . . . . . . 62 \thr@@ . . . . . . . 223, 244 \toks . . . . . . . . . . . . 353 \toks@ . . 45, 96, 159,

321, 325, 326, 412 \ttfamily . . . . . . . . 410 \tw@ 112, 120–124, 131,

222, 230, 313, 314 \TX@v . . . . . . . . 413, 414 \TX@v@ 420, 422, 426, 427

\TX@v@hash . . . 427, 428

\TX@vb . . . . . . . 411, 412 \TX@verb . . . . . . 44, 408

\TX@vfirst . . . 414, 418

\TX@vwarn . 409, 430, 432 \TX@warn . . . . . . . . . \underline{407} \TY@ . . . . . . . . . . 15, 324

\TY@@checkmin . 202, \underline{212}
\TY@@mkpream . . . . . .

… \underline{46}, 64, 65, 341 \TY@array . . . . . . 85, 86

\TY@arrayrule 56, \underline{66}, 389

\TY@box . . . . . . 158, 253, 277–280, \underline{282}, 345, 372–375

\TY@box@v . . . . . . . .

. 158, 253, \underline{293}, 345

\TY@checkmin . . . . . .

. 153–156, \underline{175}, 212

\TY@classvi . 57, \underline{69}, 392
\TY@classz 43, \underline{250}, 342
\TY@count . . . \underline{9}, 32,

50, 88, 100, 101, 107, 122, 137, 140, 143, 148, 151, 157, 192, 254, 262, 265, 294, 346, 355, 358

\TY@final . . . . . 11, 159

\TY@find@end . . 321, \underline{322}
\TY@get@body 45, \underline{320}, 326
\TY@linewidth . . . . .

. 17, 35, 37, 93, 106, 117, 136, 142, 172, 178, 187, 200, 213, \underline{213}

\TY@mkpream . . . . . \underline{47}, 82
\TY@ratio . . . . 178,

180, 184, 189, 196

\TY@save@row 98, 102, 103
\TY@subwidth . 54, 61,

67, 71, \underline{89}, 390, 394 \TY@tab . . . . . . . . \underline{76}, 96

\TY@tabarray . . . . 84, \underline{85}
\TY@tablewidth 18, 34,

147, 173, 177– 179, 188, 201, \underline{297}

\TY@tabular . . . . . 13, \underline{14}

\TY@warn . . 109, 183, \underline{327}

\TY@width . . . 33, 52,

\underline{87}, 90, 92, 129, 133 \tyformat …. \underline{214}, 295 \tymax . . . . . . . . 42,

123, 124, 217, 218 \tymin …. 41, 108–

110, 134, 194, 197, 199, 200, 215, \underline{215}, 216, \underline{217}

U

\uccode . . . . . . . . . . 407 \unhbox . . . . . . 112, 387 \unskip …. 8, 105, 119 \unvbox . . . . . . . . . . 104

\uppercase . . . . . . . 408

V

\vbox . . . . . 104, 275, 370 \vcenter . . . . . 273, 368 \verb . . . . . . . . . 44, 431 \vline . . . . . . . . 68, 391 \vrule . . . . . 8, 386, 398 \vtop . . . . . 274, 294, 369

W \wd … 61, 122–124, 131

X \xdef . . . . . . . . . 33,

52, 92, 98, 102, 133, 137, 143, 204

Z \Z . . . . . . . . . . 3, 4, 329 \z@ . . . . . . 8, 19, 34,

60, 61, 77, 101, 115, 140, 157, 160, 177, 186, 190, 224, 228, 236, 247, 262, 265, 270, 272, 286, 289, 300, 307, 355, 358, 361, 363, 365, 367, 384, 386, 387

\z@skip . . . . . . . . . . 214

Change History

v0.1

General: Initial version . . . . . . . . 1 v0.2

General: Changed everything ex-

cept the name . . . . . . . . . . . . . 1 v0.3

General: Changed everything except the name: s and CLRS added . . . . . . . . . . . . . . . . . . . 1

v0.4

   \TY@checkmin: \global added . . . 9

\xdef not \edef . . . . . . . . . . 10 \TY@tabular: Locally preserve

global commands . . . . . . . . . . 5 v0.5

General: Further SPQR modifica-

tions to multi pass table env . . 1 v0.6

General: Remove multi pass table

env and unboxed star form … 1 \TX@warn: macro added . . . . . . . 14 \TY@arrayrule: macro added …. 6 \TY@classvi: macro added . . . . . . 6

v0.7

\TY@tabarray: new macro to sup-

port [t] optional arg . . . . . . . . 7 v0.8

General: Rename S to J and ‘hide’ s (until it works) . . . . . . . . . . . 1