summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-fixwidtab.html
blob: f6093cf7cf3270d384fc751566ccc3c8abec6d06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<head>
<title>UK TeX FAQ -- question label fixwidtab</title>
</head><body>
<h3>Fixed-width tables</h3>
<p/>There are two basic techniques for making fixed-width tables in
LaTeX: you can make the gaps between the columns stretch, or you
can stretch particular cells in the table.
<p/>Basic LaTeX can make the gaps stretch: the <code>tabular*</code>
environment takes an extra argument (before the <code>clpr</code> layout one)
which takes a length specification: you can say things like &#8220;<code>15cm</code>&#8221;
or &#8220;<code>\</code><code>columnwidth</code>&#8221; here.  You must also have an <code>\</code><code>extracolsep</code>
command in the <code>clpr</code> layout argument, inside an <code>@</code>
directive.  So, for example, one might have
<pre>
\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}lllr}
</pre>

The <code>\</code><code>extracolsep</code> applies to all inter-column gaps to its right as
well; if you don&#8217;t want all gaps stretched, add
<code>\</code><code>extracolsep{0pt}</code> to cancel the original.
<p/>The <i>tabularx</i> package defines an extra <code>clpr</code> column
specification, <code>X</code>; <code>X</code> columns behave as <code>p</code>
columns which expand to fill the space available.  If there&#8217;s more
than one <code>X</code> column in a table, the spare space is distributed
between them.
<p/>The <i>tabulary</i> package (by the same author) provides a way of
&#8220;balancing&#8221; the space taken by the columns of a table.  The package
defines column specifications <code>C</code>, <code>L</code>, <code>R</code> and
<code>J</code>, giving, respectively, centred, left, right and
fully-justified versions of space-sharing columns.  The package
examines how long each column would be &#8220;naturally&#8221; (i.e., on a piece of paper of unlimited width), and
allocates space to each column accordingly.  There are &#8220;sanity
checks&#8221; so that really large entries don&#8217;t cause everything else to
collapse into nothingness (there&#8217;s a &#8220;maximum width&#8221; that any column
can exert), and so that tiny entries can&#8217;t get smaller than a
specified minimum.  Of course, all this work means that the package
has to typeset each row several times, so things that leave
&#8220;side-effects&#8221; (for example, a counter used to produce a row-number
somewhere) are inevitably unreliable, and should not even be tried.
<p/>The <i>ltxtable</i> package combines the features of the
<i>longtable</i> and <i>tabularx</i> packages.  It&#8217;s important
to read the documentation, since usage is distinctly odd; the
distribution contains no more than a file <i>ltxtable.tex</i>, which you
should process using LaTeX.  Processing will give you a <i>.sty</i>
file as well as the <i>.dvi</i> or <i>.pdf</i> output containing the
documentation.
<dl>
<dt><tt><i>ltxtable.sty</i></tt><dd>Distributed as part of <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/carlisle.zip">macros/latex/contrib/carlisle</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/carlisle/">browse the directory</a>); <a href="http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/ltxtable.html">catalogue entry</a>
<dt><tt><i>tabularx.sty</i></tt><dd>Distributed as part of <a href="http://www.tex.ac.uk/tex-archive/macros/latex/required/tools.zip">macros/latex/required/tools</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/required/tools/">browse the directory</a>); <a href="http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/tabularx.html">catalogue entry</a>
<dt><tt><i>tabulary.sty</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/tabulary.zip">macros/latex/contrib/tabulary</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/tabulary/">browse the directory</a>)
</dl>
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=fixwidtab">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=fixwidtab</a>
</body>