summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-fixwidtab.html
blob: f72016b2eb16297772d048000e3f2504575079cc (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 &ldquo;<code>15cm</code>&rdquo;
or &ldquo;<code>\</code><code>columnwidth</code>&rdquo; 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&rsquo;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&rsquo;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
&ldquo;balancing&rdquo; 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 &ldquo;naturally&rdquo; (i.e., on a piece of paper of unlimited width), and
allocates space to each column accordingly.  There are &ldquo;sanity
checks&rdquo; so that really large entries don&rsquo;t cause everything else to
collapse into nothingness (there&rsquo;s a &ldquo;maximum width&rdquo; that any column
can exert), and so that tiny entries can&rsquo;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
&ldquo;side-effects&rdquo; (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&rsquo;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="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/carlisle.zip">macros/latex/contrib/carlisle</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/carlisle.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/carlisle/">browse</a>)
<dt><tt><i>tabularx.sty</i></tt><dd>Distributed as part of <a href="ftp://cam.ctan.org/tex-archive/macros/latex/required/tools.zip">macros/latex/required/tools</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/required/tools.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/required/tools/">browse</a>)
<dt><tt><i>tabulary.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/tabulary.zip">macros/latex/contrib/tabulary</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/tabulary.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/tabulary/">browse</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>