summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-fixwidtab.html
blob: 7d32ef10711d45b172fab27cbbdf48dac5ec571a (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
<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 "<code>15cm</code>"
or "<code>\</code><code>columnwidth</code>" 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'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'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
"balancing" 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 "naturally" (i.e., on a piece of paper of unlimited width), and
allocates space to each column accordingly.  There are "sanity
checks" so that really large entries don't cause everything else to
collapse into nothingness (there's a "maximum width" that any column
can exert), and so that tiny entries can'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
"side-effects" (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> combines the features of the
<i>longtable</i> and <i>tabularx</i> packages: it's important to
read the documentation, since usage is distinctly odd.
<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>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>)
</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>