Вы находитесь на странице: 1из 255

Typesetting tables

with LATEX

O utstations Staff

O verall B reakdow n

to grou p m em bers
<D ---------------------------------
n
g By qualification
fem ale

MSc P rim ary


total

total

o
Sb degree

C a m b rid g e 90 24 11 79 15 64
B e r lin 37 12 8 29 7 22

T okyo 30 8 2 28 6 22
P asad en a 36 13 3 33 8 25

Herbert Voss
Typesetting Tables w ith IATe X
Typesetting Tables w ith IATe X

Herbert Voss

UIT
CAMBRIDGE, ENGLAND
Published by
UIT Cambridge Ltd.
PO Box 145
Cambridge
CB4 1 GQ
England

Tel: +44 1223 302 041


Web: www.uit.co.uk

ISBN 978-1-906860-25-7

Copyright © 2011 Herbert Voss


All rights reserved.
This book was previously published in German by
Lehmanns Media (www.lehmanns.de) in 2009.

The right of Herbert Voss to be identified as the author of


this work has been asserted by him in accordance with
the Copyright, Designs and Patents Act 1988.
The programs and instructions in this book have been
included for their instructional value. Neither the
publisher nor the author offers any warranties or
representations in respect of their fitness for a particular
purpose, nor do they accept accept any liability for any
loss or damage arising from their use.
The publication is designed to provide accurate and
authoritative information in regard to the subject matter
covered. Neither the publisher nor the author makes any
representation, express or implied, with regard to the
accuracy of information contained in this book, nor do
they accept any legal responsibility or liability for any
errors or omissions that may be made. This work is
supplied with the understanding that UIT Cambridge Ltd
and its authors are supplying information, but are not
attempting to render engineering or other professional
services. If such services are required, the assistance of an
appropriate professional should be sought.
Many of the designations used by manufacturers and
sellers to distinguish their products are claimed as
trade-marks. UIT Cambridge Ltd acknowledges
trademarks as the property of their respective owners.

10 9 8 7 6 5 4 3 2 1
Contents

1 Introduction 3
1.1 The tabular environment................................................................................ 3
1.2 The tabbing environment................................................................................ 12
1.3 Notes................................................................................................................ 17

2 Packages 19
2.1 a r r a y ................................................................................................................ 21
2.2 a ry d s h ln .......................................................................................................... 27
2.3 bigdelim, bigstrut, m ultirow ....................................................................... 30
2.4 b lk a r r a y .......................................................................................................... 38
2.5 booktab s.......................................................................................................... 46
2.6 c e lls p a c e ....................................................................................................... 53
2.7 c ta b le ............. 54
2.8 d a t a to o l.......................................................................................................... 58
2.9 e a s y ta b le ....................................................................................................... 62
2.10 h h lin e .............................................................................................................. 64
2.11 m a k e ce ll.......................................................................................................... 65
2.12 mdwtab.............................................................................................................. 72
2.13 sla sh b o x .......................................................................................................... 74
2.14 sp re a d ta b ....................................................................................................... 76
2.15 t a b ls ................................................................................................................ 82
2.16 t a b u la r h t ....................................................................................................... 84
2.17 ta b u la r k v ....................................................................................................... 86
2.18 ta b u la r x .......................................................................................................... 87
2.19 ta b u la r y .......................................................................................................... 90
C o ntents

2.20 th re e p a rtta b le .............................................................................................. 91


2.21 th re e p a rtta b le x ............................................................................................ 93
2.22 w arp co l............................................................................................................ 96
2.23 w id e ta b le ....................................................................................................... 97
2.24 dcolumn............................................................................................................ 98
2.25 r c c o l................................................................................................................ 100
2.26 s i u n i t x ............................................................................................................ 102
2.27 p o ly t a b le ....................................................................................................... 107
2.28 ta b to ................................................................................................................ 108
2.29 Tabbing............................................................................................................ 109

3 Colour in tables 111


3.1 c o l o r t b l .......................................................................................................... 111
3.2 x c o lo r .............................................................................................................. 116
3.3 T[rXnicalities....................................................................................................... 122

4 Multi-page tables 125


4.1 lo n g ta b le ....................................................................................................... 125
4.2 l t a b le x ............................................................................................................ 139
4.3 l t x t a b l e .......................................................................................................... 141
4.4 s t a b u la r ......................................................................................................... 145
4.5 su p ertab u lar................................................................................................... 149
4.6 xtab ................................................................................................................... 157

5 Tips and tricks 167


5.1 Tables - general................................................................................................ 167
5.2 tabbing environments....................................................................................... 170
5.3 Two-column mode.............................................................................................. 170
5.4 Table captions................................................................................................... 171
5.5 Math mode....................................................................................................... 173
5.6 Excel and OpenOffice files............................................................................. 175

6 Examples 177

7 Questions and answers 213


7.1 Documentation................................................................................................... 213
7.2 Tables as floating objects................................................................................... 215

Bibliography 217

Index of commands and concepts 221

People 231
Preface

You might be surprised that we’ve dedicated a whole book to typesetting tables in fflgX
but a quick glance at the volume of questions and contributions online about this topic
highlights the need for a publication of this kind. The IfljpC Companion [42] offers only a short
introduction to the basics of tables and the use of the most widely known packages in its
40-page chapter on the subject. More useful was the tabsatz [50] document created by Axel
Reichert just over a decade ago, providing a general reference for problems with tables; we’ve
included all of Axel’s examples or adaptations of them in this publication.
Time has moved on since tabsatz was published, however, and more and more packages
have been developed that support creating tables in many different ways. This book introduces
all existing packages to you, though sometimes the scope of this publication limited the
coverage we could give each package, especially for the datatool package by Nicola Talbot.
In principle, TgX does not distinguish between a table and a matrix (array). Nevertheless,
this book only deals with tables containing normal text. If you want to find out more about
typesetting tables containing mathematical elements, look in M athematics with BTpX [56].
You can download all the examples as complete FIpX documents at CTAN (Comprehensive
TgX Archive Network - h ttp : //www. ctan. org) in the directory CTAN: //inf o/examples/
Tabellen/. Only use them for experimenting; often loading packages or general code has
been moved into the non-visible preamble in the examples for space reasons; for example
loading the package eurosym when using the € symbol. The omitted parts are never important
to understand the examples though. Some of the examples use non-standard packages or
further external programs; they are available in the same CTAN directory.
If nothing else has been specified, the packages from T^XLive 2007 or the packages from
CTAN from the end of 2007 are used. Newer versions of TjgXLive should not cause any
problems unless individual packages have made extreme changes to the syntax. Sometimes
explanations of different packages will seem similar; we decided it would be better to restate
Preface

them instead of referring the reader to the appropriate explanation given for a different
package. It is always difficult to evaluate which individual packages are best, but loading the
array, booktabs, tabularx, and (for external data) datatool packages should always be a
sensible default. Identifying preferences between the other packages is left to the reader.
Conventions used in this book:
> Names of commands, environments, packages etc. when referred to in the text are set
in a monospace font, like longtable.
> Throughout the book we have referred to mathematics as math.
> Optional symbols or parameters are signified in syntax by being set against a
jjj^pbackground. For environments, this applies especially to the starred variant (* ).
> In some cases parts of a preamble have been moved to the non-visible part of an
example’s coding to save space. There is always a note in the text where this has
CTAN been done. This will not limit the user’s understanding; the entire source code of all
the examples can be downloaded from c t a n at any time (h ttp : //mirror. CTAN. org/
info/examples/Tabulars-E/).
> The symbol <<*>in the margin indicates an issue that the user should bear in mind as it
can cause a problem.
My thanks, as always, go to Klaus Hoppner, Lutz Ihlenburg, Christoph Kaeder, Rolf
Niepraschk, Uwe Ziegenhagen, and especially Volker RW Schaa, who kindly looked over the
manuscript, pointed out errors, and gave valuable feedback. And last but not least a big thank
you to Lars Kotthoff, who translated this English version from the German original and to
Catherine Jagger for her excellent job of proof reading.

Berlin, November 2010 Herbert Vofi


C h a p t e r

In t r o d u c t io n
1.1 The tabular environment................................................................................... 3
1.2 The tabbing environment.................................................................................. 12
1.3 N otes................................................................................................................ 17

When you display information in a table, the typography you choose is very important; tables
containing the same information can be typeset in many different ways, but some layouts
will be much clearer than others. It’s difficult (and subjective) to define conventions that will
always result in a table that is easily understood, but the following points are good guidelines:
> no vertical lines
> no double lines
> rows not too narrow
> columns not too far apart
> rows left- and right-aligned with horizontal lines
> horizontal lines of different widths
This first chapter looks at the two environments supported in standard KTeX for typesetting
tables: the tabular environment and the tabbing environment. Chapters 2-4 introduce all
the additional packages that provide support for typesetting tables, with chapter 3 focusing
on the use of colour and chapter 4 on multi-page tables. Chapters 5 and 7 cover some general
points that are not package specific, while chapter 6 provides a large and useful set of examples
to help the reader.

1 .1 The tabular environment


The default tabular environment corresponds to the mathematical array environment (not
to be confused with the array package cf. Section 2.1 on page 21). The syntax of the tabular
environment and its alternative starred version are:
Introduction

\begin{tabular} [position] {column definition }

\end{tabular}
\begin{ tabular* }{widf/i} [position] {column definition}

\end{tabular*}

Valid notations for the column definition are:


1 left-aligned column (without line break!),
c centred column (without line break!),
r right-aligned column (without line break!).
p{ length } corresponds to the definition \parbox [ c] { length }; it is always typeset
justified and with line breaks.
@{column separator } inserts @{column separator} before and after each column; by default,
this uses the \tabcolsep space (cf. Table 1.1 for further explanation).
| vertical line, can be extended arbitrarily to ||...
T^X can measure the width of a table exactly, as shown in the following example, which
means you can predetermine the exact width of a table. Table 1.1 has a column definition of
{ 11 1r |p{3cm} |} and is followed by a list of the widths of each component of the table.

Table 1.1: This example illustrates the use of left right p{3cm} foi-oi-i~]
the \tabcolsep space; the lighter block marks
the left side of a column and the darker block l e f t ® right!|p{3cm} |
the right.
width value
\tabcolsep 6 .Opt
\widthof {left} 1 3 .36996pt
2 \tabcolsep 1 2 .Opt
\widthof {right} 1 9 .96996pt
2 \tabcolsep 1 2 .Opt
p{3cm} 8 5 .35826pt
Ytabcolsep 6 .Opt
full width 1 5 4 .69818pt

If the whole table is put into a box, the resulting width is 156.29816pt when using the
array package at the same time; this corresponds to a difference of 1.59998pt, or rounded
1 .6pt. This is the sum of the width of the four vertical lines in Table 1 .1 , which is given by the
width of \arrayrulewidth=0.4pt. If these vertical lines are omitted, or the array package is
not used, the width of the box is 154.69818pt. All of the lengths specified here were measured
by TgX and output with \the\<length> to ensure that the calculation was correct.

4
1.1 T h e t a b u la r en viro n m en t

Being able to determine the exact width of a table is especially useful when you want a
table to span several pages, using the whole width of each page. However, actually achieving
this is only possible through reading an external file or using other packages, as shown in
Section 4.3 on page 141. Without any extension package, there are only two special symbols
that you can use for extended column definitions, * and @:
*{number} {colum n type}, where num ber is the repetition factor and colum n type an
arbitrary code sequence.

1 1 1 r r r r \usepackage{array}
L L L R R R R \b eg in {ta b u la r}
{ I * { 3 } { 1 } |* { 4 } { r |} } \c lin e { l- 3 }
l&l&l&r&r&r&rW L&L&L&R&R&R&RX\\cline{l-3}
\end {tab ular}

©{...}, where “... ” stands for an arbitrary code sequence that is now inserted on each line
instead of the column spacing. There is no space to the left and right between two columns.
In the following example, firstly a colon and then an arrow are inserted instead of the column
space.

left right:centred- box \begin{tabular}%


i r: c ->p{l.5cm} {@{}1|r@{: }c@ {$\rightarrow$}p{l.5cm}@{}}
l e f t & r ig h t & centred & b o x \\\c lin e { 2 - 4 }
1 & r & c & p \ { l .5 c m \ } \ \ \ c l i n e { l - l }
\end {tab ular}

Using the starred version of the tabular environment lets you specify a certain table
width; however, only adapts the width of the last column to achieve the specification.
The following example shows this clearly; the last column of the second table is right-aligned,
but this has no effect as the space that follows remains the same as in the first table.

1 2 3 \b e g in { ta b u la r * } { \lin e w id th } { lll}
A B left 1 & 2 & 3 \\\h lin e A & B & le ft \\\h lin e
\en d {ta b u la r* }\p a r\b ig sk ip
\b e g in { ta b u la r * } { \lin e w id th } { llr }
1 2 3
1 & 2 & 3 \ \ \ h l i n e A & B & r ig h t \ \ \ h l i n e
A B right \end {tab ular*}

This doesn’t usually produce a satisfactory result, but if you also use the ©operator and
the \extracolsep command, an even distribution of the “column widths” can be achieved.
The syntax of the \extracolsep command is:

\extracolsep{ len gth}

To achieve an even distribution of columns, you have to pass the dynamic length \ f i l l
as the { len gth } or column distance. The difference between enlarging the column width
and the spacing between columns (\tabcolsep) becomes visible when using vertical lines;
the following examples clearly illustrate that the tabular* environment only changes the
spacing between columns.
In tro d u c tio n

1 2 3 \b e g in { ta b u la r* } { \lin e w id th } %
{ | M { \ e x t r a c o l s e p { \ f i l l } } 11 11 1}
A B c 1 & 2 & 3 \\\h lin e A & B & C \\\h lin e
\e n d { t a b u la r * } \ p a r \b i g s k i p
1 2 3 \b e g in { ta b u la r* } { \lin e w id th } %
A B c { | 1 | 1 |@ { \ e x t r a c o l s e p { \ f i l l } } r |}
1 & 2 & 3 \\\h lin e A & B & C \\\h lin e
\e n d { ta b u la r * }

As the first table above showed, inserting @ { \e x t r a c o ls e p { \f ill} } after the first table
column distributes the additional column spacing evenly. Alternatively you can insert it
before the first column if you don’t want a \t a b c o ls e p space at the left-aligned border, as
shown below.

1 2 3 \b e g in { ta b u la r* } { \lin e w id th } %
{ |@ { \ e x t r a c o l s e p { \ f i l l } } l 1 1 11@{} I}
A B C
1 & 2 & 3 \\\h lin e A & B & C \\\h lin e
\e n d { t a b u la r * }\ p a r \ b i g s k i p
1 2 3 \b e g in { ta b u la r* } { \lin e w id th } %
left left right { |@ { \ e x t r a c o l s e p { \ f i l l } } l |1 |r@ { } |}
1 & 2 & 3 \\\h lin e
le f t & le f t & rig h t \\\h lin e
\e n d { ta b u la r * }

To achieve better results, you should use the ta b u la rx environment from the package
tabu larx of the same name when creating tables o f a certain width; corresponding examples can be
found in Section 2.18 on page 87. Alternatively, the widths of the columns can be calculated
manually, as shown already in Table 1.1 on page 4. The advantage of this is that it is the
widths o f the columns that cire adapted to achieve the specified width and not the spacing
between the columns.

1 . 1.1 L in e s
You should always bear in mind that lines usually do not improve the clarity o f a table and
using them is often counterproductive. This is especially true for vertical lines. Therefore,
the following examples are explicitly not intended as a guide, but only as examples of how to
create lines. Horizontal lines spanning the whole table width Eire created with \h lin e , or you
can use \ c l i n e to add a horizontal line across a specified range of columns.

\h lin e
\ c l i n e {sta rt column-end column}

You usually need to precede either of these commands with \ \ or \ta b u la r n e w lin e; the only
exception is when you want to get a line above a table, in which case the relevant command is
placed immediately after the column definition. If the values for start column and end column
are the same, the line spans only this single column.

6
1.1 T h e ta b u la r e n v iro n m e n t

Horizontal lines always take precedence over vertical lines (particularly important to
remember if you are using double lines). This results from the fact that TgK typesets the
vertical lines line by line, only taking the line height into account. The following example
shows how to use \ h l i n e to create borders and multiple lines:

left p-column right \ b e g i n { t a b u l a r } { |1 ||| p { 4 c m } | r | | } \ h l i n e


01-01-7 |
l e f t & p — column & r i g h t \ \
A Now this column has a fixed B \h lin e \h lin e \h lin e
width and a \ A & Now t h i s column h a s a f i x e d w id th
and a \L c s { \n e w lin e } \n e w lin e
creates a new row in c r e a t e s a new row in
this column t h i s column & B \ \ \ h l i n e \ h l i n e
1 & 2 & 3 \\\h lin e \h lin e
1 2 3
\e n d { ta b u la r }

The next example also uses the \ c l i n e command:

left p-colum n right*1 \b e g in { ta b u la r} { lp { 4 c m } r}


01-01-8 l e f t & p — column & r i g h t \ \
A Now this column has a B
fixed width and a \ \ c l i n e { l - 2 } \ h l i n e % s e e t e x t below
A & Now t h i s column h a s a f i x e d w id th
and a \L c s { \n e w lin e } \n e w lin e
creates a new row in
c r e a t e s a new row i n t h i s
this column column & B \ \ \ c l i n e { 2 - 2 }
1 “2 3 1 & 2 & 3 \\\c lin e { 2 -3 }
\e n d { ta b u la r }

\ c l i n e { 2-2} creates a line only below the second column and \c lin e { 2 -3 } below the
second and third columns. If a \ c l i n e command is preceded or followed by a \h l i n e
command, it has no effect as it is overwritten by \h lin e . \ c l i n e may occur several times
in a row, but behaves like a single \ c l i n e without code modifications! However, you can
use \ c l i n e several times in a row to achieve horizontal lines over various ranges of columns,
as in Example 01-01-11 on the next page. To find out how to colour horizontal lines, see
Section 3.3 on page 122.
Very thick lines can look bad as can’t join them neatly at the corners and doesn’t
take the width of the lines into account when determining the line spacing, as illustrated here: thick lines

\s e t l e n g t h \ a r r a y r u l e w i d t h { 5 p t }
01-01-9
\ b e g i n { t a b u l a r } { |c |c |} \ h l i n e
A & B \\\c lin e { l-l}
C & D \\\h lin e
\e n d { ta b u la r }

You can easily influence the height of an individual row by inserting a \r u l e command in
one o f its cells. Setting the width to null makes the inserted line invisible. Vertical lines are
more problematic as their width does not affect the horizontal width of a table; the lines are
drawn “on top” o f the text. Bear this in mind especially for thick vertical lines. The array vertical lines
package (cf. Section 2.1 on page 21) fixes the corner connections and produces better results
with thick vertical lines (cf. Section 2. 1.1 on page 26). This example uses both the array
package and the \ r u l e command to produce a better result:

7
In tro d u c tio n

\u s e p a c k a g e { a r r a y }

\s e tle n g th \a r r a y r u le w id th { 5 p t}
\ b e g i n { t a b u l a r } { |c |c |} \ h l i n e
A & B \\\c lin e { l-l}
\ru le { 0 p t} { 3 .2 e x } C & D \ \ \ h l i n e
\e n d { ta b u la r }

1 . 1.2 C e ll s c o v e r i n g s e v e r a l c o l u m n s
The \m u lticolum n command allows you to merge several cells within a row into one cell
with an independent column definition, including the possibility of adding vertical lines that
are only valid for this cell. It can also be used for an individual cell to change the column type.
The syntax is:

\multicolumn{nwmfcer o f columns} {colum n definition} {content}

For the column definition , you can use any o f the notations valid for the standard ta b u la r
environment. More options are available when using the array package, (cf. Section 2.1 on
page 21).

\b eg in { tab u lar} { @ { }cc cc@ { }} \ h l i n e


\m u ltic o lu m n { 2 } { |@ { } c } { \te x tb f{ p e o p le } } &
\m u ltic o lu m n { 2 } { @ { } c |} { \te x tb f { p r o f e s s io n } } \\\h lin e
number& sex & em ployed & f r e e l a n c e \ \ \ h l i n e
222 & m & 160 & 62 \\
2 & n & \te x tb f{ l} & 2 \\[5 p t]
97 & w & 70 & 27 \\\h lin e
\m ulticolum n{ 4} { c}{ su m s} \\\c lin e { l-l}
\m u ltic o lu m n { l} { @ { } |c |@{>>{319} & & 230 & 89 \ \ \ c l i n e { l - l } \ c l i n e { 3 - 4 }
& & \m u ltic o lu m n { 2 } { |c |} { 3 1 9 } \\\c lin e { 3 - 4 }
\e n d { ta b u la r }

people profession
number sex employed freelance
222 m 160 62
2 n 1 2
97 w 70 27
sums
319 230 89
319

Using the \m u lticolum n command is fairly straightforward, but you need to take a little
care over vertical lines. The table’s overall column definition, controlling each column’s type
and vertical lines, is ignored through \m ulticolum n, so part of a vertical line will be missing
unless you remember to repeat the line definition within \m ulticolum n. Normally this only
1 .1 T h e ta b u la r e n v iro n m e n t

applies when a column followed by a vertical line is included in a \m ulticolum n command,


but in the case where the first column is incorporated as well, any lefthand vertical line that
borders the cell must also be redefined within the command. The following examples show col
the different effects of vertical line definitions when the \m ulticolum n command is used:

people profession \ b e g i n { t a b u l a r } { |c c |c c |} \ h l i n e
|~01-01-12 |
\m u ltic o lu m n { 2 } { |c } { \te x tb f{ p e o p le } } &
\m u ltic o lu m n { 2 } { c |} { \te x tb f { p r o f e s s io n } } \ \ \ h l i n e
number sex employed freelance
\m u ltic o lu m n { 4 } { c } { } \\% empty l i n e w ith o u t |
222 m 160 62 num bers sex& employedS f r e e l a n c e \ \ \ h l i n e
2 n 1 2 222 & m & 160 & 62 \ \
97 w 70 27 2 & n & \te x tb f{ l} & 2 \ \ [ 5 p t ]
97 & w & 70 & 27 \ \ \ h l i n e
sums
\m u ltico lu m n { 4 } { c}{ su m s} \\\c lin e { l-l}
319 230 89
\m u lt ic o l u m n { l} { |c |>{319} & & 230 & 89
319 \\\c lin e { l-l} \c lin e { 3 - 4 }
& & \m u ltic o lu m n { 2 } { c |} { 3 1 9 } \\\c lin e { 3 -4 }
\e n d { ta b u la r }

people profession \ b e g i n { t a b u l a r } { |c c |c c |}
\m u ltic o lu m n { 2 } { |c |} { \e m p h { p e o p le } } &
number sex employed freelance \m u ltic o lu m n { 2 } { c |} { \e m p h { p ro f e s s io n } } \\[5 p t]
222 m 160 62 number & se x & em ployed & f r e e l a n c e \ \ \ h l i n e
2 n 1 2 222 & m & 160 & 62 \ \
2 & n & \te x tb f{ l} & 2 \ \ [ 5 p t ]
97 w 70 27 97 & w & 70 & 27 \ \ \ h l i n e
sums \m u ltic o lu m n { 4 } { |c |} { s u m s} \\\c lin e { l-l}
319 230 89 \m u lt ic o l u m n { l} { |c |>{319} & & 230 & 89
319 \\\c lin e { l-l} \c lin e { 3 - 4 }
\m u ltic o lu m n { l} { c } { }
& & \m u ltic o lu m n { 2 } { c |} { 3 1 9 } \ \ \ c l i n e { 3 - 4 }
\e n d { ta b u la r }

1 .1 .3 N e ste d ta b le s
Tables can be nested arbitrarily. We recommend that you align the code clearly though, as
nestings frequently make it harder to get an overview and errors are introduced more easily,
which are then very hard to find. Nesting tables lets you typeset any complex arrangement
without having to resort to using the m ultirow package (cf. Section 2.3 on page 30), which
doesn’t always produce the desired result. In the following example, the cells with lowercase
characters are part of a nested table, which can be framed easily with the \ h l i n e or \ c l i n e
command.

\b e g in { ta b u la r } { c c c c c }
A1 & A1 & A1 & A1 & A l \ \ \ h l i n e
A2 & \ b e g i n { t a b u l a r } { |c |} \ h l i n e
a l\\a l\\a l\\\h lin e
\e n d { ta b u la r }

9
In tro d u c tio n

& \b e g in { ta b u la r} { c } a 2 \\a 2 \\a 2 \\\e n d { ta b u la r }


& A & \ b e g i n { t a b u l a r } { |c |} \ h l i n e
a 3 \\a 3 \\a 4 \\\h lin e
\e n d { ta b u la r} \\
A3 & A3 & A3 & A3 & A 3 \\\c lin e { 3 - 4 }
A4 & A4 & \m u ltic o lu m n { 2 } { |c |} { A 4 * } & A 4 \\\ c li n e { 3 - 4 }
A5 & A5 & A5 & A5 & A 5 \\
\e n d { ta b u la r }

Al Al Al Al Al
al a2 a3
A2 al a2 A a3
al a2 a4
A3 A3 A3 A3 A3
A4 A4 A4* A4
A5 A5 A5 A5 A5

The following example shows an unsatisfactory result, with the spacing between the
columns much too large. This is caused by the \ta b c o ls e p space that precedes every table,
leading to additional space when a table is nested inside another table. According to Table 1.1
on page 4, in this example there is a space of 3 \ta b c o ls e p or 4 \ta b c o ls e p between any two
columns.

col 11 co 2 ll co3 ll \ b e g i n { t a b u l a r } { |c c c |}
c o l 11 & co2 11 & co3 1 1 \ \
col 12 c o 4 12
co2 12/3 \b e g i n { ta b u l a r } { c } c o l 1 2 \ \ c o l 1 3 \e n d { ta b u la r}
col 13 c o 4 13
& \ b e g i n { t a b u l a r } ! I c |} \ h l i n e
col 14 co2 14 co3 14
co2 1 2 / 3 \ \ \ h l i n e \e n d { ta b u la r }
& \b e g in { ta b u la r} { c } c o 4 1 2 \\c o 4 1 3 \ e n d { t a b u la r } \ \
c o l 14 & co2 14 & co3 14
\e n d { ta b u la r }

Using the @column operator corrects these additional spaces, as shown in the following ex­
ample. In this case the superordinate table uses a column definition of { | @{ }c @{ }c@{} c@{ } | }
to ensure that all the columns have no extra space (as can be seen on the outside of the
external columns). Nevertheless, there is still a space of 2\ta b c o ls e p between the inner
columns, caused by the inner (nested) tables.

col ll co2ll co3 ll \b e g in { ta b u la r} !|@ { } c @!}c@!} c@ !}|} r


c o l 11 & co2 11 & co3 1 1 \ \ L:
col 12 co4 12
C02 12/3 \b e g i n ! t a b u l a r } ! c } c o l 1 2 \ \ c o l 13 \ e n d ! ta b u l a r } &
col 13 co4l3
\ b e g i n ! t a b u l a r } ! I c |} \ h l i n e
col 14 co2 14 co3 14 co2 1 2 / 3 \ \ \ h l i n e \e n d ! t a b u l a r } &
\ b e g i n ! t a b u l a r } ! c } co4 1 2 \\c o 4 13 \ e n d ! t a b u l a r } \ \
c o l 14 & co2 14 & co3 14
\ e n d ! ta b u l a r }

l @{ } an d The order o f | and @f } has to be observed; at the start of a column definition you must
<a{} / are jl specify first the vertical line, then no additional space. If you did the reverse, (@{ } then | ), @{ }
different

10
1.1 T h e ta b u la r e n v iro n m e n t

would have no effect - it is cancelled by the vertical line, which is then followed by either the
default \t a b c o ls e p or whatever else is specified next.
You can take different approaches, depending on what structure of table and placement of
lines you want to produce. For example inner tables can be typeset without spacing between
the columns, or the frame of an inner table can be put around it from the outside, as illustrated
in the following example.

col ll co 2 ll co3 ll \b e g in { ta b u la r} { @ { } c @{}c@{} c@{}}


col 12 co4 12 c o l 11 & co2 11 & co3 l l \ \ \ c l i n e { 2 - 2 }
co2 12/3 \ b e g i n { t a b u l a r } { c |} c o l 1 2 \ \ c o l 13 \e n d { ta b u la r } &
col 13 co4 13
\b e g in { ta b u la r } { c } co2 1 2 /3 \e n d { ta b u la r } &
col 14 co2 14 co3 14
\ b e g i n { t a b u l a r } ! |c } co4 1 2 \\c o 4 13 \e n d { ta b u la r }
\\\c lin e { 2 -2 }
c o l 14 & co2 14 & co3 14
\e n d { ta b u la r }

It is also a good idea to define abbreviations to make your code clearer and therefore
reduce the likelihood of errors with nested tables. For example we define:

\newcommand\Btab{}% make s u r e t h a t i t d o es n o t e x i s t
\r e n e w c o m m a n d \B ta b [2 ][ c ]{ \ta b u la r [# l] { # 2 } }
\newcommand\Etab{}% d i t t o
\renew com m and\Et a b { \e n d t a b u l a r }

We will define and use these commands in the following example. Also in this case the
first line is extended upwards and the last line downwards to achieve a better placement of
the frame; this is done using \r u le .

\newcomm and\Btab{}
| 01-01-18 | col ll co2 ll co3 ll \r e n e w c o m m a n d \B ta b [2 ][c ]{ \ta b u la r[# l]{ # 2 } }
col 12 C0412 \n ew co m m an d \E tab {}\ren ew co m m an d \E tab {\en d tab u lar}
co2 12/3
col 13 C0413
\B tab{|@ {}c @{}c@{} c @ { } |} \h lin e
col 14 C02 14 C03 14
\ru le { 0 p t} { 3 e x } % b e t t e r s p a c in g above
c o l 11 & co2 11 & co3 l l \ \ \ c l i n e { 2 - 2 }
\ B t a b { c |} c o l 1 2 \ \ c o l 13 \E ta b &
\B ta b { c } co2 1 2 / 3 \ \ \E ta b &
\B ta b { |c } co4 1 2 \\c o 4 13 \E ta b \ \ \ c l i n e { 2 - 2 }
\r u le [ - l.5 e x ] { 0 p t} { 2 e x } % b e t t e r s p a c in g below
c o l 14 & co2 14 & co3 1 4 \ \ \ h l i n e
\E ta b

Further explanations on producing specific types of lines can be found in:


> Example 03-03-1 on page 122 for coloured lines.
> Section 2.2 on page 27 for dashed lines.
> Section 2.10 on page 64 for non-overlapping double (sub-)lines.

11
In tro d u c tio n

1 .1 .4 F o o t n o t e s

The \ f o o tn o te command doesn’t work as expected within a table as the text of the footnote
doesn’t display. Instead, there are packages that support footnotes in tables or you can use
the \footn otem ark and \f o o t n o t e t e x t combination o f commands. The latter works in
virtually all cases where the \f o o t n o t e command fails.

\footn otem ark [number] \f o o t n o t e t e x t [number] {text}

\footn otem ark increments the footnote counter fo o tn o te and only typesets the number of
the footnote, while \f o o t n o t e t e x t only typesets the text of the footnote without changing
the counter. If the optional argument is given, the footnote counter is not changed and number
is taken as the footnote, where number must be a positive number.

L1 C R \b e g in { c e n te r } ,---------
\b e g in { ta b u la r} { lc r} \h lin e 101—
L C R
L \fo o tn o te m a rk & C & R \\
L c2 R
L & C & R \\
L C R L & C \fo o tn o te m a rk & R \\
L c R3 L & C & R \\
L & C & R \f o o t n o te m a r k \ \\h l in e
Normal line of text after the centred table with \e n d { ta b u la r }
normal footnote4. \a d d to c o u n te r { f o o tn o te } { - 2 }
\f o o tn o te te x t{ le f t-a lig n e d }
\s te p c o u n t e r { f o o tn o t e } \f o o t n o te t e x t{ c e n t r e d }
^eft-aligned \s te p c o u n te r{ fo o tn o te } \fo o tn o te te x t{ rig h t- a lig n e d }
2centred \e n d { c e n te r }
3right-aligned Normal l i n e o f t e x t a f t e r th e c e n tr e d t a b l e w ith
4normal footnote no rm al f o o tn o te \f o o tn o te { n o r m a l f o o tn o te } .

1.2 The tabbing environment


Standard E^IfcXs tab b in g environment doesn’t actually create a table, but allows for tabular
alignments, so w e are covering it here in conjunction with tables. Its major advantages are
that it allows footnotes and page breaks. The name of the environment harks back to the old
tabulator key present on even the earliest typewriters; the principle of this “tabulator key”
has been preserved in the tab b in g environment. Several short commands are defined for
controlling the tabulators; these are summarized in Table 1.2 on the next page.

\b e g in { ta b b in g }
A \=example lin e ... \ k i l l \ \
\>formatted lin e s \\

\en d {ta b b in g }

12
1 .2 T h e ta b b in g e n v iro n m e n t

T able 1.2: Summary of th e tabulator comm ands for th e ta b b in g environment.

command meaning
\= Puts a tab at the current position.
\> Jumps to the next tab.
\< Puts text to the left o f the left margin without changing it.
\+ The left margin is moved one tab to the right.
\- The left margin is moved one tab to the left.
\ ’ The text before the \ ’ command is right-aligned and the text after it is
left-aligned.
V The text after the \ ‘ command is right-aligned on the line.
\a To typeset accents within the tab b in g environment; for example \ a ’ e
displays as e.
\k ill Deletes the current (example) line and keeps the tabs defined in it.
\p u sh ta b s Saves all current tabs.
\p o p ta b s Loads all last saved tabs.

The example line pan be “killed” \u s e p a c k a g e { p s t-n o d e }


01-02-1
nrst tab \b e g in { ta b b in g }
secic nd tab The \= \rn o d e{A }{}ex am p le l i n e \= \rn o d e { B } { } c a n
xhi nd \= \rn o d e { C } { } b e \= \rn o d e { D } { } ‘ ‘k i l l e d ’ ’\ \
fourth \> \ r n o d e { a } { } f i r s t t a b \ \
\> \> \rn o d e { b } { } s e c o n d t a b \ \
\> \> \ > \ r n o d e { c } { } t h i r d \ \
\> \> \> \> \r n o d e { d } { } f o u r th
\e n d { ta b b in g }
\ p s s e t { n o d e se p A = -le x , nodesepB =lex}
\n c lin e { -> } { A } { a } \n c lin e { -> } { B } { b }
\n c lin e { -> } { C } { c } \n c lin e { -> } { D } { d }

The example line in conjunction with the \ k i l l command lets you specify the individual
tabs easily; \ k i l l deletes the line, but not the positions specified through \=.

first tab \b e g in { ta b b in g }
second tab The \= ex am p le l i n e \= c a n
\= b e \ = “ k i l l e d ” \ k i l l \ \
third
\ > f i r s t t a b \ \ \> \> s e c o n d t a b \ \
fourth
\> \> \> th ir d \\ \> \> \> \> fo u rth \\
0 1 2 3 4
0 \>1 \>2 \>3 \>4
\e n d { ta b b in g }

Current tab positions can be saved and reloaded with the \p u sh ta b s and \p op tab s
commands. They work like a LIFO-system: last in, first out.

13
In tro d u c tio n

12 3 4 \b e g in { ta b b in g }
01-02-3
1 2 3 4 0 0 \= 0 0 0 \= 0 0 0 0 \= \k ill
1 2 3 \p u s h ta b s % sa v e ta b b in g p o s i t i o n s

1 2 3 4 1\> 2\> 3\> 4\\


0 0 0 0 \= 0 0 0 \= 0 0 \= \k ill % new ta b p o s i t i o n s
12 3 4
\p u s h ta b s % sa v e a ls o t h i s on es
1\> 2\> 3\> 4\\
0 0 0 0 \= 0 0 0 0 0 \= \k ill% new ta b p o s i t i o n s
1\> 2 \> 3 \\
\p o p ta b s % g e t l a s t sa v e d ta b s
1\> 2\> 3\> 4\\
\p o p ta b s % g e t p re v io u s sa v e d ta b s
1\> 2\> 3\> 4\\
\e n d { ta b b in g }

accents Problems can arise when using some short commands if they are defined as accents at the
same time. In these cases the accents within a tab b in g environment have to be introduced
by \a ; an alternative is to use the Tabbing package (cf. Section 2.29 on page 109).

first café \b e g in { ta b b in g }
01-02-4
second café The \= exam ple l i n e \= c a n \= b e \ = ‘ ‘k i l l e d ’ ’\ k i l l \ \
mâitre \ > f i r s t c a f \ a ’e \ \ \> \> s e c o n d c a f \ a ’e \ \
\> \> \> m \a Aa i t r e \ \
crème brûlée
\ > c r \ a ‘e m e \> \> \> b r\a Au l \ a ’ee
\e n d { ta b b in g }

If the following lines need to be inset, the \+ command can be used to set the left margin
for the next (and future) lines one tab position further in. This saves you coding a \> at the
start of the next (and future) lines as the current left margin o f the text now corresponds
to the position o f that tab. This effect can be reversed through \ - ; the current left margin
is moved to the left by exactly one tab. These two commands are especially useful when
typesetting algorithms if you are unable to use the usual l i s t i n g s package.
As with a normal table, the individual elements between the tabs are typeset as a group,
so if you want to change the font for a whole tab b in g environment you must do it before
the environment. Extra tab stops can be added after the example line by inserting \= at the
appropriate place; however these new tabs are always added to the available list, existing ones
are not deleted.

A normal line ... A no rm al l i n e \ l d o t s \ t t f a m i l y \ s m a l l


01-02-5
\b e g in { ta b b in g }
f u n c t i o n fa ct ( n : integer): in te ge r; f u n c t io n \ = \ t e x t b f { f a c t ( n : i n t e g e r ) } : i n t e g e r ; \ \
be g i n \> b e g in \= \+ \\% l e f t m arg in to ta b
if n > 1 t h en \> i f \= n $>$ 1 th e n \+ \ \
f a c t : = n * fa ct (n -l ) fa c t:= n * f a c t( n - l) \ - \ \
else e l s e \+ \ \
f a c t : = 1; f a c t : = 1; \ - \ - \ \ % b ack 2 ta b s
end; end;
\e n d { ta b b in g } \n o r m a lf o n t\n o r m a ls iz e
A normal line ... A n orm al l i n e \ l d o t s

14
1 .2 T h e ta b b in g e n v iro n m e n t

You don’t need to use example text to specify tabs; you can also use \h sp ace, as in this
example:

A norm al l i n e \ l d o t s
\b e g i n g r o u p \ s m a l l \ t t f a m i l y % keep change o f f o n t l o c a l
\b e g in { ta b b in g }
\= \h s p a c e { 0 .2 5 in } \= \h s p a c e { 0 .2 5 in } \= \h s p a c e { 0 .2 5 in } \ = \ h s p a c e { 0 . 2 5 i n } \ k i l l
\> < categ o ry > \+ \ \
\> <pattern>WHAT IS A * < /p a tte r n > \+ \ \
\> < te m p la te x sra i> D E F IN E < s t a r in d e x = " l " x / s r a i > \ \
\> < /te m p la te > \ - \ - \ \
\> < /c a te g o ry > \ \ [ 0 .5 \ n o r m a l b a s e l i n e s k i p ]
\> < categ o ry > \+ \ \
\> <pattern>D O YOU KNOW WHAT A * I S < /p a tte r n > \+ \ \
\> < te m p la te x sra i> D E F IN E < s t a r in d e x =,,l ,,x / s r a i x / t e m p l a t e > \ - \ - \ \
\> < /c a te g o ry >
\e n d { ta b b in g }
\e n d g ro u p
A norm al l i n e \ l d o t s

| 01-02-6I A normal line ...

<category>
< p a t t e r n > W H A T IS A * < / p a t t e r n >
<template><srai>DEFINE <star index ="l"></srai>
</template>
</category>

<category>
< p a t t e r n > D 0 YO U K N O W W H A T A * I S < / p a t t e r n >
< t e m p l a t e > < s r a i > D E F I N E < s t a r i n d e x = " l ,,x / s r a i > < / t e m p l a t e >
</category>

A normal line ...

You can use the \ ’ and \ ‘ tab commands to left- or right-align words. The right-alignment
of text after the \ ‘ command always refers to the line as a whole; further tabs after \ ‘
are ignored. The \ 1 command, however, refers to the current tab, right-aligning the se­
quence o f characters before the command and left-aligning the sequence that follows it;
the difference can be seen clearly in the following examples. When using the \ ’ command,
the space between the right- and left-aligned sequences o f characters is specified through
\tabbingsep=5.0ptThis spacing can be changed arbitrarily, but this must be done globally
within the tab b in g environment, as the material between two tabs is held locally internally
and a change of the length here would have no visible effect.

15
In tro d u c tio n

0 1 2 3 4 \b e g in { ta b b in g }
01-02-7
2 left-aligned The \= exam ple l i n e \= c a n
2 left-aligned \= b e \ = ‘ ‘ k i l l e d ’ ’\ k i l l \ \
1 left-aligned 0 \>1 \>2 \>3 \>4\\
\> \> 2 \ ’l e f t - a l i g n e d \ \
0 left-aligned
\g l o b a l \ s e t l e n g t h \ t a b b i n g s e p { 2 0 p t }
\> \> 2 \ ’l e f t - a l i g n e d \ \
\g l o b a l\ s e t le n g th \ ta b b i n g s e p { O p t }
\> 1 \ ’l e f t - a l i g n e d \ \
0 \ ’l e f t - a l i g n e d \ \
\e n d { ta b b in g }

0 1 2 3 4 \b e g in { ta b b in g }
01-02-8
2 right-aligned on the line The \= exam ple l i n e \= c a n
1 right-aligned \= b e \ = ‘ ‘k i l l e d ’ ’\ k i l l \ \
0 right 0 \>1 \>2 \>3 \>4\\
\> \> 2 \ ‘r i g h t - a l i g n e d on th e l i n e \ \
\> 1 \ ‘r i g h t - a l i g n e d \ \
0 V rig h t \ \
\e n d { ta b b in g }

Horizontal centring of tabbing environments is surpriginly easy - just insert the envi­
ronment into a minipage of maximal width; this “clips” it to the required width after the
creation of the tabbing environment.

This is a normal text in a text line of normal width. T h is i s a no rm al t e x t i n a t e x t


[ 01-02-9J
l i n e o f no rm al w id th .
\b e g in { c e n te r } \b e g in { m in ip a g e } { \lin e w id th }
0 1 2 3 4 \b e g in { ta b b in g }
right-aligned left-aligned The \= exam ple l i n e \= c a n
\= b e \ = “ k i l l e d ” \ k i l l \ \
0 \>1 \>2 \>3 \>4\\
This is a normal text in a text line of normal width. \> \> r i g h t - a l i g n e d \ ’l e f t - a l i g n e d \ \
\e n d { ta b b in g }
\e n d { m in ip a g e } \e n d { c e n te r}
T h is i s a no rm al t e x t i n a t e x t
l i n e o f no rm al w id th .

footn ote Footnotes in the tabbing environment behave similarly to footnotes in the tabular
environment (cf. Section 1.1.4 on page 12); in theory they are not possible but can be achieved
through the combination \footnotemark - \footnotetext or with special packages.
Remember when you use this combination of commands that \f ootnotemark increments
the footnote counter, so it has to be reset before the text of the footnote is written with
\footnotetext. This is shown in the following example:

16
1 .3 N o te s

f fb fbb \b e g in { ta b b in g }
f1 fb fbb fo o \= fo o b a r \= f o o b a r b a z \ k i l l
f fb fbb f \> fb \> f b b \ \
f\f o o tn o te m a r k \> fb \> f b b \ \
f fb*2 fbb
f \> fb \> f b b \ \
f fb fbb
f \> fb \fo o tn o te m a r k \> f b b \ \
f fb fbb3 f \> fb \> f b b \ \
f \> fb \> fb b \fo o tn o te m a r k
Normal line of text after the ta b b in g envi­ \e n d { ta b b in g } \a d d to c o u n te r { f o o tn o te } { - 2 }
ronment with normal footnote4. \ f o o t n o t e te x t { f o o } \ s t e p c o u n te r { f o o t n o te }
\ f o o tn o t e te x t { f o o b a r } \s t e p c o u n te r { f o o tn o t e }
Too \f o o tn o t e te x t { f o o b a r b a z }
2foobar
3foobarbaz
Normal l i n e o f t e x t a f t e r th e
4normal footnote
\ t e x t t t { t a b b i n g } en v iro n m e n t w ith norm al
f o o tn o te \f o o tn o te { n o r m a l f o o t n o t e } .

Special packages for tabs are covered in Section 2.28 on page 108. They allow for easier
setting of tabs and simplify the handling of accents.

1.3 Notes
This section summarizes some important facts and frequently made mistakes when using the
ta b u la r or tab b in g environments:
> All definitions within a table cell are local to the cell; internally the contents of a table
cell is enclosed in a \b e g in g r o u p ... \endgroup sequence.
> Vertical line segments may be missing if rows are terminated prematurely by \ \ or
\ta b u la r n e w lin e when using the array package. Empty cells should be marked as
&&.
> A common mistake is caused by too few defined designators for column types. The
following error message was caused by using three columns where only two were
defined:
! E x tra a lig n m e n t ta b h a s been changed t o \ c r .
< r e c e n tly rea d > \e n d te m p la te

1 .7 te x t & te x t &
\\
?
> The space between two columns is 2\ta b c o ls e p by default; the space to the left and
right of each column is \ta b c o ls e p .
> \m u lticolum n overwrites the existing specification for the right hand side of the
column or columns by default. This should be kept in mind especially for vertical lines.
In the case of the first column, the left margin is affected as well.
> The tab b in g environment has the advantage that it can be used in two-column mode
(\twocolumn) and additionally allows for page breaks.

17
Introduction
C h a p t e r

Packages

2.1 a r r a y ..........................................21 2.16 t a b u l a r h t .......................................... 84


2.2 arydshln..................................... 27 2.17 t a b u l a r k v .......................................... 86
2.3 bigdelim, b igstrut, multirow 30 2.18 t a b u l a r x ............................................. 87
2.4 b lk array.....................................38 2.19 t a b u l a r y ............................................. 90
2.5 booktabs.....................................46 2.20 t h r e e p a r t t a b l e .............................. 91
2.6 c e llsp a c e ...................................53
2.21 t h r e e p a r t t a b l e x ........................... 93
2.7 c t a b le ....................................... 54
2.22 w a r p c o l ................................................ 96
2.8 d atato o l.....................................58
2.23 w i d e t a b l e .......................................... 97
2.9 ea syta b le...................................62
2.24 d c o lu m n ................................................ 98
2.10 hhline....................................... 64
2.25 r c c o l ............................................. 100
2.11 m akecell.................................. 65
2.12 mdwtab....................................... 72 2.26 s i u n i t x .......................................... 102

2.13 slashbox...................................74 2.27 p o l y t a b l e .................................... 107


2.14 spreadtab................................ 76 2.28 t a b t o ............................................. 108
2.15 t a b l s ....................................... 82 2.29 T a b b i n g .......................................... 109

This chapter describes all packages related to tables that are currently available on ctan
except for packages that support tables across several pages, which are covered in Chapter 4
on page 125. It’s always worth checking before you use a package whether it has been updated
in the meantime. To help you, the following table lists all packages with their respective
version and date. Some packages are certainly more important than others, though as this is
fairly subjective we’ve listed them mostly alphabetically, just distinguishing between certain
thematic areas: “general - decimal numbers - colour - tabs - page break”, and left it up to
you to decide which packages are important and necessary.
2 Packages

T ab le 2.1: Summary of all I5Te;X packages related to tables.

nam e d a te v e r sio n d e s c r ip tio n

a rra y 2008/09/09 2.4c Extension o f the a r r a y and t a b u l a r environm ents.


a ry d s h ln 2004/08/31 1.71 H orizontal and vertical dashed lines.
b ig s tru t 1994/05/31 1.0 Vertical lengths for better line spacing.
b lk a r r a y 1999/03/24 0.05 Extension of the a r r a y and t a b u l a r environm ents.
b o o k ta b s 2005/04/14 1.6183 B etter table layout.
c e ll s p a c e 2009/07/31 1.6 Simple arrangem ent of cell contents w ithin a table.
c ta b le 2009/09/17 1.15 Centred, left-, or right-aligned tables.
d a ta to o l 2009/11/15 2.03 C om prehensive package to read and process external
data (CSV) and display as a table.
d e la rra y 1994/03/14 1.01 Several delimiters for the a r r a y and t a b u l a r environ­
ments.
e a s y t a b le 2001/06/13 1.0 Tables w ith equal colum n w id th or row h eight and
various vertical and horizontal lines.
h h lin e 1994/05/23 V2.03 Extended horizontal “lines” in tables.
m a k e c e ll 2009/08/03 O.le Support for special headers and m ulti-line cells.
mdwtab 1998/04/28 1.9 A reim plem entation of the t a b u l a r and a r r a y envi­
ronm ents.
m u ltiro w 2004/05/05 1.6 M ulti-line cells w ithin a table.
s la s h b o x 1993/05/31 Split cells w ithin a table.
s p r e a d ta b 2009/11/01 0.1 Tables w ith a functionality like Excel.
ta b ls 2006/01/13 3.5 Im proved vertical spacing in a table (tabular lineskip).
ta b u la r h t 2007/04/11 2.5 t a b u l a r environm ent w ith fixed height.
ta b u la r k v 2006/02/20 1.1 t a b u l a r environm ent w ith a “k ey-value” interface.
ta b u l a r x 1999/01/07 2.07 Tables w ith variable colum n widths.
ta b u l a r y 2008/12/01 0.9 Tables w ith equal height and different w idths.
th r e e p a rtta b le 2003/06/13 3.0 Supports tables w ith headers, footers, and footnotes of
the same w idth.
th r e e p a r tta b le x 2009/12/28 0.06 Better support o f notes.
w arp co l 2007/11/21 1.0c Relative alignm ent o f cells w ith num erical contents.
w id e ta b le 2009/10/26 1.1 Extension of the lo n g ta b le * environm ent.
dcolum n 2001/05/28 1.06 Align decimal num bers at the decimal separator.
rc c o l 2005/11/12 1.2c Align decimal numbers at the decimal separator; places
after the separator can be rounded.
s iu n itx 2010/10/08 2.0x Typesetting o f columns o f num bers w ith or w ithout a
unit.
c o lo r tb l 2001/02/13 0-lj Coloured table columns, rows, and cells.
x c o lo r 2007/01/21 v2.11 Extensions for coloured table columns, rows, and cells.
p o ly t a b le 2005/04/26 0.8.2 ta b u la r- lik e environm ent w ith symbolic colum n
names.
ta b to 2006/09/12 1.0 “Tab” to defined places on a line.
T abbing 1997/12/18 1.0 ta b b in g environm ent that allows accents in the usual
notation.
lo n g t a b le 2004/02/01 4.11 S upport for page breaks w ith in tables. M ore flexible
th an the s u p e r t a b u l a r package.
co n tin u ed ...

20
2.1 a rra y

... continued

nam e d a te v e r sio n d e s c r ip tio n

lta b le x 1995/11/06 1.0 E xtension o f the t a b u l a r x environm ent to support


page breaks w ithin the table similar to the lo n g t a b le
package.
ltx ta b le 1995/12/11 0.2 C om bination o f the lo n g t a b le and t a b u l a r x pack­
ages.
s ta b u la r 1998/03/19 Tables th at allow page breaks.
s u p e r ta b u la r 2004/02/20 4.1e M ulti-page tables, similar to the lo n g t a b le package.
x ta b 2008/07/26 2.3c Extended version of the s u p e r t a b u l a r package.

2.1 array
The array package by Frank Mittelbach and David Carlisle offers several better ways to
typeset tables. The use of booktabs is recommended as well. The following table is laid out
firstly with “normal” column definitions, and then each new method is shown for comparison.
Again please note that we are only using horizontal and vertical lines in these tables to
highlight the differences between the layouts; lines do not improve the readability of a table
and, in principle, we recommend that you never use vertical lines and only use horizontal
lines sparingly (cf. guidelines on page 3).

right centred \ b e g i n { t a b u l a r } { |1 |r |c |p { 2 c m } |} \ h l i n e
|02-01-1 | left box
l e f t & r i g h t & c e n tr e d & b o x \ \ \ h l i n e
i r c p{2cm}
1 &r & c & p \{ 2 c m \} \\\h lin e
\e n d { ta b u la r }

\extrarowheight increases the height of the line without affecting the depth; therefore
this space should not be set too large. Its main use is to avoid capital letters “hitting” an upper
line.
\u s e p a c k a g e { a rra y }
left right centred box
\ s e tl e n g th \ e x tr a r o w h e i g h t{ 8 p t}
i r c p{l.75cm} \ b e g i n { t a b u l a r } ! |1 |r |c |p { l . 7 5 c m } |} \ h l i n e
l e f t & r i g h t & c e n tr e d & b o x \ \ \ h l i n e
1 & r & c & p \ { 1 .7 5 c m \ } \ \ \ h l i n e
\e n d { ta b u la r }

\arraybackslash redefines the standard double backslash command for a table line
break (\\). Without this redefinition it would not retain its meaning when using one of
the formatting commands, \raggedright, \raggedleft or \centering, in a p (\parbox)
column. Now for a new row w ith in a colu m n use the \newline command and for a new ta b le
ro w use \\ or the \tabularnewline command:

21
Packages

L R c box \usepackage{array} ,--------


[ 02-01-3
i r c p{2.5cm} \begin{tab u lar}{ 11 1r|c|>{\raggedright%
new line with \arraybackslash}p{ 2.5cm }|}\hline
\newline L & R & C & b o x \\\h lin e
i r c new table row 1 & r & c & p \{ 2.5cm\}\newline
with \\ new lin e with \verb+\newline+\\
what now 1 & r & c & new table row with \v erb + \\+ \\
what now &&& \\\h lin e
\end{tabular}

When using the ragged2e package, however, you don’t have to insert the \arraybackslash
command explicitly:

L R c box \usepackage{array,ragged 2e} ,--------


[ 02-01-4
i r c p{2.5cm} \b eg in {tab u lar}! 11 1r |c |
new line with >{\RaggedRight}p{2. 5cm }|}\hline
\newline L & R & C & box\tabularnewline\hline
i r c new table 1 & r & c & p\{2.5cm\}
row with \newline new lin e with \verb+\newline+\\
\tabularnewline 1 & r & c & new table row
what now with {\sm all\verb=\tabularnew line=}\\
what now&&&\tabularnewline\hline
\end{tabular}

>{...}, where “... ” is any arbitrary code sequence, executes this code b efo re th e s ta r t of
the respective column in each row. In the following example, bold font is selected for the first
column:

left right centred box \usepackage{array} ,--------


[ 02-01-5
1 r c p{1.5cm} \b e g in {ta b u la r }{|> {\b fse r ie s}l|r |c |p {l.5 c m }|}
l e f t & right & centred & b ox\\
1 & r & c & p\{1.5cm\}
\end{tabular}

<{...}, where “... ” again is any arbitrary code sequence, executes this code before th e e n d
of the respective column in each row this time. In the following example, math mode was
selected by switching on inline mode through >{$} and off again through the following <{$}:

left r ig h t centred box \usepackage{array}


| 02-01-6|
1 r c p{l.5cm} \begin{tabular}{l> {$}r< {$}c|p{l.5cm }|}
l e f t & right & centred & b o x \\\h lin e
1 & r & c & p\{1.5cm\}
\end{tabular}

!{...}, where “...” is any arbitrary code sequence, inserts this code in s te a d o f a separator
in each row. The space to the left and right of the two columns remains the same. In this
example, a colon and an arrow are inserted instead of the separator:

22
2.1 a rra y

left right : centred — box \usepackage{array}


! 02-01-7 1
-------- l r : c - p{l.5cm} \begin{tab u lar}{l ! { \v lin e }r !{:} c
!{$\rightarrowS} p{1.5cm}}
l e f t & right & centred & b o x \\\h lin e
1 & r & c & p\{1.5cm\}
\end{tabular}

m{...}, where “... ” is an arbitrary length (e.g. m{3cm}), centres (middle) a box aligned
with the base line of the current row vertically.

left right a m-parbox \usepackage{array}


02-01-8 |
m{2cm} this \begin{tabular }{|1 | r | m{2cm }|}\hline
1 right cell is verti- l e f t & right & a m-parbox \\\h lin e
cally centered 1 & right & m\{2cm\} th is c e ll i s
v e r tic a lly cen tered \\\h lin e
\end{tabular}

b{...}, where “. . . ” is an arbitrary length (e.g. b{3cm}), aligns a box with the bottom of
the current row.

left r a b-parbox \usepackage{array}


02-01-9 |
b{2cm} this \begin{tabular }{|1 | r | b{ 2cm }|}\hline
cell is verti­ l e f t & r & a b-parbox \\\h lin e
cally alligned 1 & right & b \{ 2cm\} th is c e ll i s v e r tic a lly
i right at the bottom alligned at the bottom \\\hline
\end{tabular}

2.1.1 \newcolumntype
\newcolumntype{ ch a ra c te r } j|||;{ co lu m n d e fin itio n }

The \newcolumntype command lets you define arbitrary new column types that can then be
used in their abbreviated form as column definitions in the table head. You can only use a
single case sensitive letter as the ch a ra cter ; and it must be different from ones already defined
unless you don’t mind the earlier definition being overwritten, n specifies the number of
parameters; it has no effect if the definition uses no parameters. The c o lu m n d e fin itio n must
refer to a column type that exists already. The following example shows how to use the
command:

\usepackage{array} \newcolumntype{L}{>{$}l<{$}} \newcolumntype{T}{>{\ttfamily\small}l}


\begin{t abular}{@{}1LT@{\qquad}1LT@{} } \h lin e
sine & \sin (\a lp h a ) &<value> sin &cosine & \cos(\alp h a) & <value> cos \ \
tangent&\tan(\alpha)&<value> tan &arcus tangent&\arctan(x)&<valuel> <value 2> a ta n \\\h lin e
\end{tabular}

23
2 Packages

sine sin (a) <value> sin cosine cos(ot) <value> cos


tangent tan(oc) <value> tan arcus tangent arctan(x) <valuel> <value 2> atan

In the next example, the headers are rotated so as not to widen the columns needlessly,
which would decrease the readability of the table. If a column has a header of multiple rows,
it’s better to use the varw idth package by Donald Arseneau and the environment of the same
name. Its advantage over the m inipage environment is that you don’t need to specify the
required width explicitly.

\usepackage{array,rotating}
\newcolumntype{B}{>{\bfseries}c}
\newcolumntype{T}{>{\ttfamily}l}
\newcolumntype{R}[1 ]{>{\begin{turn}{#l}}l<{\end{turn}}}
\begin{tab u lar}[b ]{BT1}
\multicolumn{l}{R{45}}{abbreviation} & \m ulticolumn{l}{R{45}}{reference column} &
\m ulticolum n{l}{R{45}}{param eter}\\\hline B & c & - \ \ T & 1 & - \ \ R & 1 & l \ \ \ h l i n e
\end{tabular} \qquad
\begin{tabular}[b]{@{}BTl@{}}
\multicolumn{l}{R{90}}{abbreviated} & \multicolumn{l}{R{90}}{reference column} &
\multicolumn{l}{R{90}}{parameter}\\ B & c & - \ \ T & 1 & - \ \ R & 1 & 1
\end{tabular}

02-01-11
o
<u o
<
C L
J> B
tí (Ü
8 ,<aL>

B
3 Í3
Oh
B c
T T 1
R 1 R 1

hyphenation T^X is set not to hyphenate the first word o f a paragraph. However, sometimes hyphen­
ation is desirable in a narrow column, and the workaround is to define a column type that
starts the column by writing a \h s p a c e { 0p t}; this is recognised as a word of length zero by
T^X, which then will be able to hyphenate the following regular word. This is clearly visible
in the following example; the first table has an error in the last column, the second one is
correct.

\usepackage{array} \newcolumntype{P}[1 ]{>{\hspace{0pt}}p{#l}}


\b eg in {ta b u la r}[t ]{11 r c | p{lcm }|}
l e f t & right & centred & box \ \ \h l i n e
1 &r &c & c o r r e c t ilif ic
\end{tabular} \qquad
\b eg in {ta b u la r}[t]{1 1 r c | P{lcm}|}

24
2.1 a rra y

l e f t & right & centred & b o x \\\h lin e


1 &r &c & c o r r e c t ilif ic
\end{tabular}

left right centred box left right centred box


1 r c correctil Ific 1 r c cor­
rec­
tilific

Horizontal alignment can be adjusted with the three commands mentioned earlier:
\raggedleft, \centering, and \raggedright. Alternatively you can use the modified
commands \RaggedLeft, \Centering, and \RaggedRight from the ragged2e package by
Martin Schroder, which allow hyphenation.

\usepackage{array, ragged2e}
\newcolumntype{L}[1 ]{>{\hspace{Opt}\RaggedRight}p{#l}}
\newcolumntype{C}[1 ]{>{\hspace{Opt}\Centering}p{#l}}
\newcolumntype{R}[l]{>{\hspace{Opt}\RaggedLeft}p{#l}}
\begin{tabular}{@{}L{3cm}C{3cm}R{3cm}@{}}\hline
A l e f t aligned column with ragged right margin
& A centred column with ragged l e f t and ragged right margin
& A right aligned column with ragged l e f t margin\\
L & C & R \\\h lin e
\end{tabular>

02-01-13 A left aligned col­ A centred column A right aligned


umn with ragged with ragged left and column with
right margin ragged right margin ragged left margin
L C R

\newcolumntype may define more than one column type as well; for example the defini­
tion \newcolumntype{x}{llcll} defines five columns. Here it is in use:

R L L C L L \usepackage{array} \newcolum ntype{x}{llcll}


RR LL LL CC LL LL
\begin{tabular}{ r x }
R & L & L & C & L & L \\
RR& LL& LL& CC& LL& LL
\end{tabular}

Especially when using larger packages, it can sometimes be helpful to set the defined
column types to be output into the log file through \showcols.

\showcols

The log file for Example 02-01-13 contains the following lines:

25
2 Packages

Column L#1 -> >{\hspace {Opt}\RaggedRight }p{#l}


Column C#1 -> >{\hspace {Opt}\Centering }p{#l}
Column R#1 -> >{\hspace {Opt}\RaggedLeft }p{#l}

Vertical lines

When using the \multicolumn command, you need to be careful about the definition of
vertical lines, especially if this definition is done in the parent column definition as well as in
the argument of \multicolumn. In the following example, we have made the affected vertical
line very wide to illustrate the potential problem:

L \usepackage{array} ,---------
L I I |c |l [ 02-01-15
llJ1 CCC L \b eg in {ta b u la r}{|1 !{\vru le width 3 p t } l|c |1 |1 |} \h lin e
L & L & C & L & L \\
LL&\multicolumn{3}{!{\vrule width 3pt}c|}{CCC} & L \\\h lin e
\end{tabular}

This shows that the vertical line was drawn by both the normal column definition as
well as by the \multicolumn one. This only occurs when using the array package, because
this considers vertical lines with their real width. In the normal tab ular environment of
standard ETgX, the lines are not considered when determining the horizontal spacing - the
lines are drawn on top of each other. The exception is a \multicolumn environment that
starts in the first column though; in this case both left and right vertical lines have to be
drawn if requried. Otherwise a line only has to be placed on the right hand side of the column
definition. Remember, lines are always assigned to the previous column except for the first
column.

L L C L L \usepackage{array> ,---------
I02-01-16
CCC L L \begin {tab u lar}{!{\vru le width 3 p t } l|1 | c | 1 | 1 |} \h lin e
L L right L&L&C&L&L \\ \c li n e { l - 3 }
\m ulticolum n{3}{!{\vrule width 3pt}c|}{CCC} & L & L \\\h lin e
L & L & \m ulticolum n{3}{r|}{right} \\\h lin e
\end{tabular}

H o r i z o n t a l lines

As long as a framed table is in its own paragraph or centred vertically on a line, for example
like this table, there are no problems with the display - apart from the typographically
adverse line spacing. If, however, you align the upper edge of a table with the base line of
the current line through the optional argument [ t ] , for example like this_____ table, then
one
two
there is a problem with the first horizontal line of the table, which is a long way below the
current text line. The fact that the bottom line is too close to the following fine of text is only
a small problem in comparison. The array package has two special commands to help you
align both the first and last horizontal lines more appropriately:

26
2 .2 a ry d s h ln

\ firs th lin e
\ lasth lin e

In the following example the first table has the usual alignment, the second is shifted up
using the \ firs th lin e command to align the first text line with the existing text, and the
third one has a small amount of additional space inserted before the following line using the
\ lasth lin e command.
\usepackage{array}

lin e
\b egin {tab u lar}[t]{ |c |} \h lin e
o n e\\tw o \\\h lin e
\end{tabular} lin e \ \
a new lin e in the paragraph\par lin e
\b eg in {ta b u la r}[t]{ |c |} \f ir s t h lin e
o n e\\tw o \\\h lin e
\end{tabular} lin e \ \
a new lin e in the paragraph\par lin e
a new line in the paragraph \b e g in {ta b u la r }[t]{|c |} \f ir s t h lin e
o n e\\tw o \\\la sth lin e
\end{tabular} lin e \ \
a new lin e in the paragraph

You can change the spacing above and below the table using the \extratabsurround
length. The default value of this length is 2.0pt.
\usepackage{array}
02-01-18 A line in the paragraph before the table,
line one line A lin e in the paragraph before the tab le.
two \par lin e
A line in a paragraph after the table. \b eg in {ta b u la r}[t]{ |c |} \f ir s t h lin e
A line in a paragraph before the table and o n e \\tw o \\\la sth lin e
\addtolength\extratabsurround{10pt}. \end{tabular} lin e \ \
A lin e in a paragraph after the tab le.\p ar
line one line A lin e in a paragraph before the table and\\
\verb+\addtolength\extratabsurround{ 10pt}+.
two
\par lin e
\addtolength\extratabsurround{ 10pt}
A line in a paragraph after the table. \b eg in {ta b u la r}[t]{ |c |} \f ir s t h lin e
o n e\\tw o \\\la sth lin e
\end{tabular} lin e \ \
A lin e in a paragraph after the tab le.

2.2 arydshln
The arydshln package by Hiroshi Nakashima lets you use dashed vertical or horizontal lines; load
it works in conjunction with the normal line commands. If you are loading several table- a r y d s h ln
specific packages, make sure to always load arydshln last, in order to avoid interferences last
with other packages.

27
2 Packages

\usepackage{arydshln} .--------
left | right |\ centred j box I02-02-1
1 1 r 1i c i p{l.5cm} \b eg in {tab u lar}{| 1 :r : | :c :p { l . 5cm }|}\hline
1 1 r !| c 1 p{l.5cm} l e f t & right & centred & box\\\hdashline
1 & r & c & p \{ l.5 c m \} \\\h lin e
1 & r & c & p \{l.5cm \}\\\h d ash lin e\h d ash lin e
\end{tabular}

The example above shows that a colon defines a vertical dashed line and \hdashline a
horizontal dashed line; they are used in the usual way. Instead of the colon, you can also
use a semicolon, which has an argument that lets you modify the the lengths of the dashes
and the gaps. And similarly to the standard lines, you can use \cdashline to draw a partial
horizontal line across a subset of columns. Both \hdashline and \cdashline also have
optional arguments, allowing you to define the appearance of the dashed line. This box shows
the syntax for each:

v e rtic a l h o r iz o n ta l
i \hdashline [dash/gap]
; { d a s h /g a p } \cdashline{/rom-
to } [dash/gap]

This example shows all four lines in use:

box \usepackage{arydshln} r--------


left | rig h t | \ c e n tre d | 02-02-2
1 i r II c p{ 1.5cm} \begin{tabular}
1 T p{ 1.5cm} { 11 :r : |:c;{2pt/2p t}p {l.5cm };{2pt/4p t}}
\hd ash lin e[3 p t / l . 5pt]
1 i r |i c p{ 1.5cm}
i I r i p{ 1.5cm} l e f t & right & centred & b ox\\
1 c
\cd a sh lin e{2 -3 }[lp t/3 p t]
1 & r & c & p \{l.5 cm \}\\\h d a sh lin e[5 p t/3 p t]
1 & r & c & p \{ l.5 c m \} \\\h lin e
1 & r & c & p \{l.5 cm \}\\\h d a sh lin e[3 p t/5 p t]
i
1 & r & c & p \{ l.5 c m \} \\\h lin e
I
\end{tabular}

When using the array package (N.B. you m u s t load it before loading arydshln), there
are also corresponding versions of \ firs th lin e and \ lasth lin e available (cf. Section 2.1.1
on page 26). They have an optional argument to specify the lengths of the gaps and dashes as
well. Here is the syntax followed by an example:

\ firsth d ash lin e [dash/gap]


\lasthdashline [dash/gap]

28
2 .2 a ry d s h ln

Q2Q23] a new line on the paragraph \usepackage{array, arydshln}

line \ one | line a new lin e on the paragraph\par lin e


1Ltwo \b e g in {ta b u la r}[t]{ : c : }\firsth d a sh lin e
__ —J1 one\\tw o\\\hdashline
a new line on the paragraph
\end{tabular} lin e \ \
line i one i line a new lin e on the paragraph\par lin e
1 two | \begin{tabular} [ t ] { : c :}\fir sth d a sh lin e [3 p t/lp t]
o n e\\tw o \\\la sth d a sh lin e[lp t/3 p t]
a new line on the paragraph
\end{tabular} lin e \ \
a new lin e on the paragraph

You can change the line style globally through the \d a sh lin e d a sh and \d a sh lin e g a p
lengths. Both are set internally to a length of 4 pt.

left : right :! centred box \usepackage{arydshln}


| 02-02-4 |
\setlength\dashlinedash{ 2pt}
1 ; r ;! c p{1.5cm}
\setlength\dashlinegap{ 2pt}
1 ; r ;! c p{1.5cm}
\b egin {tab u lar}{|1:r : | :c :p { l . 5cm}:}
\hdashline
l e f t & right & centred & box\\
\cdashline{2-3}
1 & r & c & p \{l.5 cm \}\\\h d a sh lin e
1 & r & c & p \{1.5cm \}\\\h d ashlin e
\end{tabular}

The different behaviour o f standard KT^X and the array package when creating ver­
tical lines has already been mentioned in sections 1. 1.1 on page 6 and 2. 1.1 on page 26.
The aryd sh ln package provides two commands that let you switch between the different
behaviours:

\ADLnullwide \ADLsomewide

\ADLnullwide enables the behaviour of standard Fl^X: the width of the row has no effect
on the width of the table. \ADLsomewide has the opposite effect. In general you w on’t need
to worry about the distinction as the line width will usually be less than 1 pt. However, in
the following example we have set the line width to be excessively large to illustrate the
difference between the two commands:

J ■ ■ L \usepackage{arydshln}
02-02-5 u one a
u two ■ \setlength\arrayrulew idthf 5pt}
JL ■ ■ L \begin{tab u lar}{:c :}\hdashline
L" ■ "J one\\tw o\\\hdashline
u one u \end{tabular}\par\medskip
u two ■ \ADLsomewide% switch to array sty le
\b egin{tab u lar}{:c :}\hdashline
one\\tw o\\\hdashline
\end{tabular}

29
2 Packages

In some circumstances the dashed lines may not end properly at the right or lower
margin. If this happens, you can change the character mode to improve the joins using
\ADLdrawingmode:

\ADLdrawingmodef mode }

There are three different modes available (numbered 1, 2, and 3); in many cases the results of
the first (default) one will be perfectly satisfactory. The following example uses each mode in
turn for the same table; you have to look closely at the intersections of the dashed lines to see
the difference.

\usepackage{arydshln}
\setlen gth \d ash linedash {3.01p t}\setlen gth \dashlinegap{3. Olpt}
\newcomraand\Tabelle[l]{\begin{tabular}[b]{ | c :c ;{2 p t/2 p t}c |}\h lin e
\noalign{\vskip-\arrayrulew idth}
\mb{A}&\mb{A}&\mb{A}\\[-\arrayrulewidth]\hdashline
\mb{B}&\mb{B}&\mb{B}\\[-\arrayrulew idth]\hdashline[2pt/2pt]
\mb{C}&\mb{C}&\mb{C}\\[-\arrayrulewidth]\hline
\multicolumn3c{(#1)}
\end{tabular}}
\begin{center}
\Tabellel\qquad\ADLdrawingmode{2}\Tabelle2\qquad\ADLdrawingmode{3}\Tabelle3
\end{center}

[ 02-02-6

2.3 bigdelim, bigstrut, and multirow


These three packages by Jerry Leichter and Piet van Oostrum are actually one unit and mainly
offer support for creating table cells across several rows.
In general, every \m u ltirow arrangement can be replaced by a nested table, as shown in
Example 1.1.3 on page 9. This is often even the better way. The other two packages provide
functionality to create delimiters around tables or parts of tables.

2.3.1 multirow
The \m u ltirow package provides just one command, with the following alternatives as its
syntax:

\m ultirow {row s} [su m \b i g s t r u t ] {w id th } [shift] {te x t}


\m ultirow {row s} [sum \b ig s t r u t ] * [shift] {te x t}

30
2.3 b ig d e lim , b i g s t r u t , m u lt ir o w

The meaning of the individual mandatory and optional parameters is explained below:
rows Number of table rows that are combined to a m ultirow cell.
sum \ b i g s t r u t This optional parameter can be helpful especially in the array environment
to achieve better spacing of the rows.
width The column type of the superior table is ignored and changed locally to a p
column of the specified width.
* Assumes the column type of the superior table.
shift The optional specification of a length makes fine-tuning of the vertical
position of the text possible.
text The contents of the \m u ltiro w cell; may be another table or other complex
objects, for example a parbox.

c o ll rowO col2 rowO col3 rowO \usepackage{multirow}


c o ll r o w l col2 ro w l \b egin {tab u lar}{| 1 | 1 | 1 |} \h lin e
c o ll row 2 col2 row 2 col 3 c o ll rowO & col2 rowO & col3 rowO\\
c o ll row 3 col 2 c o ll rowl & co l 2 rowl
c o ll row 4 and col3 ro w 4 & \multirow{3}{2cm}{col 3 } \ \\ c li n e { l - l }
more c o ll row2 & co l 2 row2 & \ \ \ c l i n e { l - 2}
text c o ll row3
& \multirow{ 2}{lcm }{col 2 and more tex t} &\\
\c lin e { l- l} \c lin e { 3 - 3 }
c o ll row4 & & col3 row 4\\\hline
\end{tabular}

The principle is easily understood - you place the \m u ltirow command in the cell of the
table that marks the start of the multi-row cell. A fter that , i.e. in the next rows of the table,
you leave cells empty according to the definition of the \m ultirow . By default, the text is
inserted left-aligned horizontally and centred vertically if a column width has been given for
\m ultirow ; the cell then corresponds to the p column type. There is no check to see whether
the given text fits into the specified number o f rows, as is shown in the example above; the
required number of rows must be provided manually, as below:

c o ll rowO col2 rowO col3 rowO \usepackage{multirow, b ig stru t}


02-03-2 1
c o ll ro w l col2 ro w l \b egin {tab u lar}{| 1 | 1 | 1 |} \h lin e
c o ll row 2 col2 row 2 col 3 c o ll rowO & col2 rowO & col3 rowO\\
c o ll row 3 col 2 c o ll rowl & co l 2 rowl &
c o ll row 4 and col3 ro w 4 \multirow{3}{2cm}{col 3 } \ \\ c li n e { l - l }
m o re c o ll row2 & co l 2 row2 & \ \ \ c l i n e { l - 2}
te x t c o ll row3
& \multirow{4}{lcm}{col 2 and more tex t} &\\
\c lin e { l- l} \c lin e { 3 - 3 }
c o ll row4 & & col3 row4\\
& & \\
& & \\\h lin e
\end{tabular}

31
Packages

Using the star in the \multirow command instead of specifying a width simply means
that the type of the current column as declared in the header of the table is used, as in the
following example:

coll rowO col2 rowO col3 rowO \usepackagelmultirowj-


| 02-03-3 |
coll rowl col2 rowl \b eg in {ta b u lar}! 111r |c |} \h lin e
coll row 2 col2 row 2 col 3 c o ll rowO & col2 rowO & col3 row0\\
coll row3 c o ll rowl & c o l 2 rowl
col 2
coll row4 col3 row4 & \m ultirow{3}*{col 3 } \ \\ c li n e { l - l }
c o ll row2 & c o l 2 row2 & \ \ \ c l i n e { l - 2}
c o ll row3 & \multirow{2}*{col 2} & \ \
\c lin e { l- l} \c lin e { 3 - 3 }
c o ll row4 & & col3 row 4\\\hline
\end{tabular}

The horizontal lines look bad as they appear very close to the text, especially in the left
column. You can increase the space by specifying an additional line feed, \\[Dim]. To do
this, you should use the \bigstrut command from the b ig stru t package to make multirow
aware of the change, \bigstrut corresponds to a box of a specific height and depth in
relation to the base line, but zero width (height above base line 2.0pt, depth below base line
2.0ptand width O.Opt.). Then if you also use the optional sum \bigstrut argument to tell the
\multirow command how many such \bigstrut commands there are, you will still be able
to centre the text vertically.
The following example shows what happens when the optional argument is not used.
This leads to a result where the \multirow entries are not centred vertically anymore.

coll rowO col2 rowO col3 rowO \usepackage{mult irow, b ig stru t} ,---------
[ 02-03-4 I
coll rowl col2 rowl \b eg in {ta b u lar}{| 1 |r |c |} \h lin e
col2 row2 col 3 c o ll rowO & col2 rowO & col3 row0\\
coll row2
c o ll rowl & c o l 2 rowl &
coll row3 \m ultirow{3}{l.25cm }{col 3 } \b ig s t r u t \\\c lin e { l- l}
col 2
coll row4 col3 row4 c o ll row2 & c o l 2 row2 & \b ig s t r u t \\\c lin e { l- 2>
c o ll row3 & \multirow{2}{1.25cm}{col 2} & \b ig s tr u t \\
\c lin e { l- l} \c lin e { 3 - 3 }
c o ll row4 & & col3 row 4\b igstru t\\\h lin e
\end{tabular}

If you do use the optional argument to tell \multirow the number of additional ac­
tive \bigstruts, then the appopriate adjustment will be made for them. The number
of “active” \bigstrut commands results from the way the command is used. With
\bigstrut I p o s itio n ] , where position may take the values t for top and b for bottom,
additional space is only inserted above, or below, so this command is only counted once.
Without an optional argument, however, space is inserted above and below, so the command
counts twice.
In the following example, the first \multirow command extends across three rows and
the second one across two rows. This determines the values of the optional arguments;
\bigstrut was used in each respective row.

32
2.3 b ig d e lim , b i g s t r u t , m u lt ir o w

c l rO c2 rO c3 rO \usepackage{multirow,b ig stru t}
c lrl c2 r l \b eg in {tab u lar}{| 1 |r |c |} \h lin e
c l r2 c2 r2 c3 c l rO & c2 rO & c3 r 0 \\
c l r l & c2 r l &
c l r3 \multirow{3}[6]{1.25cm}{c 3 } \b ig s t r u t \\\c lin e { l- l}
c2
c l r4 c 3 r4 c l r 2 & c 2 r 2 & \b ig s t r u t \\\c lin e { l- 2}
c l r3 & \multirow{2}[4]{1.25cm}{c 2} & \b ig s tr u t \\
\c lin e { l- l} \c lin e { 3 - 3 }
c l r4 & & c3 r 4 \b ig s tr u t\\\h lin e
\end{tabular}

Fine-tuning is usually necessary when using displayed mathematical environments be­


cause they insert vertical space themselves, which leads to incorrect vertical centring.

c l rO c2 rO c3 rO \usepackage{multirow,b ig stru t}
cl rl c2 r l \b egin {tab u lar}{ 11 1r |c |} \h lin e
c l r2 c2 r2 c3 c l rO & c2 rO & c3 r 0 \\
c l r l & c2 r l & \multirow{3}[6]{1.25cm}{c 3}
c l r3 \b ig s t r u t \\\c lin e { l- l}
c l r4 f ( x , y ) = x -y c3 r4 c l r 2 & c 2 r 2 & \b ig s t r u t \\\c lin e { l- 2}
c l r3 & \m ultirow {2}[4]{2cm }{\[f(x,y)=x\cdot y \]}
& \b ig s t r u t \\\c lin e { l- l} \c lin e { 3 - 3 }
c l r4 & & c3 r 4 \b ig s tr u t\\\h lin e
\end{tabular}

We can correct this using the \a b o v e d isp la y sk ip space, which is already defined in
E^X and the factor 0.8, which has been determined through trial and error here.

c l rO c2 rO c3 rO \usepackage{multirow,b ig stru t}
cl rl c2 r l \b egin {tab u lar}{ 11 1r |c |} \h lin e
c l r2 c2 r2 c3
c l rO & c2 rO & c3 r 0 \\ c l r l & c2 r l &
\multirow{3}[6]{1.25cm}{c 3 } \b ig s t r u t \\\c lin e { l- l}
c l r3 c l r 2 & c 2 r 2 & \b ig s t r u t \\\c lin e { l- 2}
f (x, y ) = x - y
c l r4 c 3 r4 c l r3 &
\m ultirow{2}[4 ]{2cm}[ 0 . 8\abovedisplayskip]{%
\[f(x ,y )= x \c d o t y \]} &
\b ig s t r u t \\\c lin e { l- l} \c lin e { 3 - 3 }
c l r4 & & c3 r 4 \b ig s tr u t\\\h lin e
\end{tabular}

We mentioned earlier that \m u ltiro w assumes a p column type by default unless you
use the star, in which case \m u ltiro w assumes the superior column definition. A p column
is by definition always typeset left-aligned and justified. You can change this behaviour by
redefining the \m u ltiro w setu p command. This makes horizontal centring within a r column
possible, as can be seen in column 3 in the following example.

33
P ackages

c l rO c2 rO c3 rO \usepackage{multirow,bigstrut}
02-03-8
\renewcommand\multirowsetup{\centering}
cl rl c2 r l
c2 r2 c3
\begin{tabular}{| 1 | r | r |} \h lin e
c l r2
c l rO & c2 rO & c3 rO\\ c l r l & c2 r l
c l r3 & \m u ltir o w {3 }[6 ]{l.5 cm }{c3 }\b ig stru t\\\c lin e{l-l}
f(x ,y ) = x-y
c l r4 c3 r4 c l r 2 & c 2 r 2 & \b ig s t r u t \\\c lin e { l- 2}
c l r3 &
\m ultirow{2}[4 ]{2cm}[0 . 8\abovedisplayskip]{%
\[f(x ,y )= x \c d o t y \ ] } &
\b ig s t r u t \\\c lin e { l- l} \c lin e { 3 - 3 }
c l r4 & & c3 r 4 \b ig s tr u t\\\h lin e
\end{tabular}

The column definition has no impact on the display of the equation as displayed formulae
are always centred horizontally.

2.3.2 bigstrut
The b ig s t r u t package just defines the \ b i g s t r u t command, and can be used on its own
without the \m u ltiro w package. As mentioned before (see on page 32), it defines a box of a
specific height and depth above and below the base line, but with width zero.

\ b i g s t r u t [p o s itio n ]

The optional argument lets you restrict the invisible box to height or depth only, by specifying
t or b. In these cases, the counting for the optional argument per row has to be adjusted
as well - single instead o f double counting. In the following example, the left table with
\b i g s t r u t was typeset without optional argument ( | ), the middle one with t and the
right one with b ( , j.1

\usepackage{multirow, b ig stru t}
\b eg in {ta b u la r}{| 1 |r |c |} \h lin e
11 & 21 & \m u ltir o w {3 }[6 ]{lc m }{3 }\b ig str u t\\\c lin e{l-l}
12 & 22& \b ig s t r u t \\\c lin e { l- 2}
13 & \multirow{2}[4]{lcm }{2} & \b ig s t r u t \\\c lin e { l- l} \c lin e { 3 - 3 }
14 & & 34 \b ig s tr u t \\\h lin e
\end{tabular}\quad
\begin{tabular}{@ {}|1 |r|c|@ {}}\h lin e
11 & 21 & \m u ltiro w {3 }[3 ]{lc m }{3 }\b ig str u t[t]\\\c lin e{l-l>
12 & 22& \b ig s tr u t[ t ] \ \ \ c l i n e { l - 2>
13 & \multirow{2}[2]{lcm }{2} & \b ig s tr u t[ t ] \\\c lin e { l- l} \c lin e { 3 - 3 >
14 & & 34 \b ig s t r u t [ t ] \\\h lin e
\end{tabular}\quad
1The “frames” inside the brackets here were created with \fbox and a \fboxsep of 0 pt to make the boxes visible
and show their position relative to the base line.

34
2.3 b ig d e lim , b i g s t r u t , m u lt ir o w

\begin{tabular}{@ {}|1 |r|c|@ {}}\h lin e


11 & 21 & \m u ltir o w {3 }[3 ]{lc m }{3 }\b ig str u t[b ]\\\clin e{l-l}
12 & 22 & \b ig s tr u t[ b ] \ \ \ c l in e { l - 2}
13 & \multirow{2}[2]{lcm }{2} & \b ig s tr u t[b ] \\\c lin e { l- l} \c lin e { 3 - 3 }
14 & & 34 \b ig s tr u t [b ]\\\h lin e
\end{tabular}

| 02-03-9 | 11 21 11 21 11 21
12 22 3 12 22 3 12 22 3
13 13 13
2 2 2
14 34 14 34 14 34

You can change the spacing by redefining \bigstrut or by changing the \bigstrut jo t
length, which is used to determine the box. The default for this length is O.Opt. By increasing
it by 2 pt, the tables would look like this:

02-03-10 | 11 21
11 21
12 22 3 12 22 3
13 13
2 2
14 34 14 34

In theory you can also use \multirow and \bigstrut within the eqnarray environment.
However, its not straightforward as KflpX already inserts a space of size \jot=3.0pt before
and after each line, which may lead to small vertical shifts as \multirow can’t use this length
for vertical centring. In fact it’s best to avoid using eqnarray anyway as there can be other
problems with the vertical spacing. Use the corresponding commands from the amsmath
package in preference. [56] am sm ath

i 1 1 1 \usepackage{bigstrut.multirow}
2 2 2 2 \begin{minipage}{ 2cm}
3 3 3 3 \begin{eqnarray*}
1&1\\2&2\\3&3\\
4 4
8 \multirow{5}*{8} &4\\ &5\\ &6\ \ &7\\ &8\ \
5 5 9&9\\10&10
6 8 6 \end{eqnarray*}
\en d{m in ip age}\setlen gth \b igstru tjot{\jot}
7 7 \begin{minipage}{ 2cm}
8 8 \begin{eqnarray*}
9 9 9 9 1&1\\2&2\\3&3\\
\m ultirow{5}[20]*{ 8} &4\\ &5\\ &6\ \ &7\\ &8\ \
10 10 10 10 9&9\\10&10
\end{eqnarray*}
\end{minipage}

35
Packages

2.3.3 bigdelim
The \b ig d e lim package is a special application of the \m u ltirow command and lets you
typeset brackets across multiple rows, for tables and matrices. Its syntax is:

\ldelim { b r a c k e t s y m b o l } { r o w s } { s p a c e } [text] \ldelim{brac/cef s y m b o l} { r o w s } * [ text]


\rdelim { b r a c k e t s y m b o l } { r o w s } { s p a c e } [text] \rdelim { b r a c k e t s y m b o l} { r o w s } * [ text]

b ra c k e t sy m b o l Any delimiter can be used as the bracket symbol. They are also allowed
for \ le ft and \right in math mode; in principle curly, round, angled, and
square brackets.
row s Number of rows enclosed by the left or right bracket.
sp a ce Determines the space between the bracket and the table or matrix; the column
width of the bracket is set to space.
The star assumes the column type of the enclosing tabular or array envi­
ronment. The number of lines is not taken into account; the height of the
symbol is only one line.
te x t Optional text, inserted outside the bracket.

0 ... \usepackage{multirow,bigdelim}
02-03-12
1 then do...
\b e g in {ta b u la r}{lll}
2 then do... & 0 & \ld o ts\\
3 then do... \ld elim \{{6 }{1 .9 cm }[if $f(n)=$]
if f ( n ) =-
& 1 & then d o \ld o ts\\
4 then do...
5 then do... & 2 & then d o \ld o ts\\
& 3 & then d o \ld o ts\\
6 ...
& 4 & then d o \ld o ts\\
7 ... & 5 & then d o \ld o ts\\
& 6 & \ld o ts\\
& 7 &\ldots
\end{tabular}

0 ... \usepackage{multirow,bigdelim}
02-03-13 ]
1 then do.. \b e g in {ta b u la r}{lllr}
2 then do.. foo & 0 & \ld o ts &\\
3 then do.. \ld e lim {\{}{6 }{1 .9 cm }[if $f(n)=$]
if f i n ) =- & 1 & then do\ldots & \rd elim {]}{3 }{lcm }[fo o ]\\
4 then do..
5 then do.. & 2 & then do\ldots &\\
& 3 & then do\ldots & \ \
6 ... ]bar
& 4 & then do\ldots &\\
& 5 & then do\ldots & \rd elim {]}{3 }{* }[b a r]\\
& 6 &\ldots &\\
\end{tabular}

These two examples show how \b ig d e lim works; the brackets including the optional
text are simply part of a \m u ltiro w command and as such part of a normal table column.

36
2 .3 b ig d e lim , b ig s t r u t , m u ltiro w

Therefore the cells before and after the \ld e lim and \r d e lim commands must remain empty.
This is especially important for the first column, otherwise the corresponding content would
appear in those cells. You must bear in mind whether you need special columns for \ld e lim
and \r d e lim when defining the columns of a table; if there are going to be three normal
columns and a right bracket, you need to define four columns in the header of ta b u la r or
array.

2 .3 .4 Coloured table rows


When using either the c o lo r t b l or x c o lo r packages, you need to adapt the way you use
\m ultirow , \b ig d e lim , or \rd elira. This is because the colouring packages colour individual
cells one by one, rather than colouring whole columns or rows. So the current cell is first ^ Using
coloured and then the text is inserted. With \m ultirow , this text is inserted across several -5- colour
cells, but only the first one has been coloured so far. When the colouring process reaches the
respective column’s cell in the next row, the colouring of the cell hides the text. This can be
seen in the left hand table in the following example.

\usep ackage{m ultiro w ,b igstrut} \usepackage[ta b le ]{ x c o lo r}


\renewcommand\multirowsetup{\centering}
\b egin{tab ular}{|1 |>{\columncolor{black!30}}r|>{\columncolor{black! 20}}r|}\hline
c o ll row l & co l2 row l & \m ultirow {3}[6]{l.5cm }{col3} \ b ig s tru t\ \ \ c lin e { l-l}
c o ll row2 & co l2 row2 & \ b ig s tr u t \ \ \ clin e{ l-2 }
c o ll row3 & \ m ultiro w {2}[4]{2cm }[0.8\ ab o vedisp layskip ]{\[f(x,y)= x\cdo t y \ ]} &
\ b ig stru t\ \ \ c lin e { l-l} \ c lin e { 3 -3 }
c o ll row4 & & col3 ro w 4\ b igstrut\ \ \ h lin e
\end{tabular} \quad
\ b egin { tab u lar} { [ 1 |>{\columncolor{black!30}}r|>{\columncolor{black! 20}}r|}\hline
c o ll row l & co l2 row l & \ b ig s tr u t \ \ \ c lin e { l-l}
c o ll row2 & co l2 row2 & \ b ig s tr u t \ \ \ clin e{ l-2 }
c o ll row3 & & \m ultirow {-3}[6]{l.5cm }{col3} \ b ig s tru t \ \ \ c lin e { l-l} \ c lin e { 3 -3 }
c o ll row4 & \ m u ltiro w {-2}[4]{2cm }[0.8\ ab o vedisp layskip ]{\[f(x,y)= x\cdo t y \ ]}
& col3 row4 \ b ig stru t\ \ \ h lin e
\end{tabular}

coll rowl col2 rowl coll rowl col2 rowl


coll row 2 col2 row2 coll row 2 col2 row 2 col3
coll row3 coll row3
f (V /v ' l — V • 3/ f(x,y) = x-y
coll row4 col3 row4 coll row4 col3 row4

The second part of the example illustrates the way round this problem is to specify a
negative value for the number of rows in the \m u ltirow command. This means that they are
counted from bottom to top, rather than from top to bottom. By reversing the order, all cells
that are affected by the \m u ltirow command are already coloured before \m u ltirow inserts
the text. In principle, negative numbers could always be used, but it can be confusing, so it
only makes sense to do this if you are colouring the table cells.

13 7
Packages

2.4 b lk array
The b lk array package by David Carlisle lets you form custom blocks (blockarray) within
a ta b u la r or array environment and provides commands to define cells that span more
than one column. The package never went past the experimental stage, but has some very
interesting features that are not provided by any other package.
m ath m ode The package requires the size of the math font to be specified; this means that before using
•5- the b lock array environment for the first time, math mode must have been active at least
once. In cases where this was not taken care of by other commands already - for example the
default ta b u la r environment - it has to be done manually by the user. You can do this in the
document preamble by just inserting the following code:

\usepackage{blkarray}
\AtBeginDocument{\setboxO\hbox{$ $}}

Of course, if the b lock array environment is embedded in a math environment anyway,


you w on’t need to do this. The syntax for the b lockarray environment is:

\b e g in {b lo c k a r r a y } [position] {colum n definition}

\en d {b lo ck a rra y }

We discussed the problems that can occur when using the \m ulticolum n command and
vertical lines in Section 2.1.1 on page 26. b lk array offers a special way of defining columns
that avoids problems. You simply prefix a line definition with & in the column definition,
and then use the \BAmulticolumn command, which cannot overwrite vertical lines. The
syntax o f \BAmulticolumn is identical to the usual \m ulticolum n command in standard
EflfeX. The following example shows you the difference between using the \m ulticolum n com­
mand in a ta b u la r environment and using the \BAmulticolumn command in a b lockarray
environment:

11 \usepackage{blkarray}
21 1 31 ! 02-04-1 |
12 22 32 \begin{tabular}{c|c|c}
13 23 | 33 11 & 21 & 31\\
12 & \multicolumn{l}{r}{22} & 32\\
11 21 31 13 & 23 & 33
12 22 32 \end{tabular}
13 23 33
\begin{blockarray}{cIc&|c}
11 & 21 & 31\\
12 & \BAmulticolumn{l}{r}{22} & 32\\
13 & 23 & 33
\end{blockarray}

b lk array supports nested tables through a special b lo ck environment, though this has
to refer to an entire row of the superordinate table. The syntax is:

38
2.4 blkarray

\begin{blockarray} [position] { column definition}

\b egin {b lock * }{column definition}

\end{block * }

\end{blockarray}

21 | 31 \usepackage{blkarray}
02-04-2 11
12 23--32 \begin{blockarray}{c|c|c}
13 23--33 11 & 21 & 31\\
14 1 24 1 34 \begin{block}{>{\itshape}c\BAmulticolumn{2}{>{\itshape}r}}
12 & 23—32\\ 13 & 23—33\\
\end{block}
14 & 24 & 34
\end{blockarray}

The above example showed how to use the b lock environment, but its advantage only
becomes apparent when using the extended column types that let you insert delimiters at
arbitrary positions, as in the following example. This can only be done in math mode though; ^ m ath m ode

you have to use \ t e x t from the amsmath package or \mbox from standard to enter text.

11 21 31 41 \usepackage{blkarray}
02-04-3
12 22 32) 42
\begin{blockarray}{cccc}
13 23 33J 43
11 & 21 & 31 & 41\\
14 24 34 44 \begin{block}{c | cc \} c}
12 & 22 & 32 & 42 \\ 13 & 23 & 33 & 43\\
\end{block}
14 & 24 & 34 & 44
\end{blockarray}

The starred version of the b lo ck environment adopts the superordinate delimiter defini­
tion, which is then not interrupted by the b lo ck environment anymore.

11 [21 31] 41 \usepackage{blkarray}


02-04-4
12 23-32 42
\begin{blockarray}{c \{ c c \} c}
13 23-33 43
11 & 21 & 31 & 41\\
14 i.24 34J 44 \begin{block*}{c \BAmulticolumn{2}{c} c}
12 & 23\mbox{—}32 & 42\\13 & 23\mbox{—}33 & 43\\
\end{block*}
14 & 24 & 34 & 44
\end{blockarray}

The blockarray and block environment are particularly useful for numbering individual
rows or columns of a matrix. In contrast to the normal \borderm atrix (see [56]), you can
apply simple font changes for the numbers.

39
Packages

1 2 3 4 \usepackage{blkarray}
2 /22 32 42\ 02-04-5 j
3 23 33 43 \begin{blockarray}{>{\scriptsize}cccc}
4 \24
\begin{block}{*{4}{>{\scriptsize}c}}
34 44/
1 & 2 & 3 & 4 \\
\end{block} \begin{block}{>{\scriptsize}c(ccc)}
2 & 22 & 32 & 42\\ 3 & 23 & 33 & 43\\
4 & 24 & 34 & 44\\
\end{block}
\end{blockarray}

The following additional commands make marking blocks with text easier:

\R ight { delimiter} { text} \L e f t { text} { delimiter}


\BAmultirow{ width}{text} \BAnoalign *
\BAenum \BAt ablenot es

\R ig h t Text right of the delimiter.


\L e f t Text left of the delimiter.
\BAmultirow Similar to \m u ltirow (cf. Section 2.3 on page 30) but with specified width;
the height is specified by the block.
\B A noalign Block of text that spans the whole width of the block.
\B A noalign* Ditto, but superordinate delimiters are not interrupted.
\BAenum Increments the internal line counter BAenumi and outputs the result for­
matted with \theBAenumi. A subsequent ! operator can be used to get
right-aligned space.
\B A ta b len o tes By setting \B A ta b len o testru e, the footnotes appear underneath the table
and within its width. \B A ta b le n o te s fa ls e achieves the standard foot­
note behaviour o f appearing at the bottom of the page. This command is
discussed in Section 2.4.1 on page 42.
\R ig h t and \L e f t need to be placed in the respective column definition for the b lock
environment.

i 2 3 4 columns \usepackage{blkarray} .--------


j 02-04-6
'2 22 32 42'
demo- 3 23 33 43 -3x3 matrix
\begin{blockarray}{>{\scriptsize}ccccl}
\begin{block}{*{5}{>{\scriptsize}c}}
A 24 34 44.
1 & 2 & 3 & 4 & columns\\
rows \end{block}
\begin{block}{\Left{demo} \{ >{\scriptsize}cccc
\Right\}{3$\times$3 matrix} 1}
2 & 22 & 32 & 42\\ 3 & 23 & 33 & 43\\
4 & 24 & 34 & 44\\
\end{block}
\m akebox[0pt][l]{\scriptsize rows}
\end{blockarray}

40
2.4 blkarray

\BA noalign * can be used to insert arbitrary text that spans all columns. It corresponds
to a \m u lt icolumn command defining a \parbox that spans the whole width of the specified
table. Delimiters are only not interrupted with the starred version, similar to block*.
In the following example, the ! operator in the definition of the table is used for formatting
as well as making space. \BAenum! { . \quad} means that the value of the counter BAenumi
is printed and the dot with space \quad is used as the next “column separator”. Within a
table, all cells are local; any changes that should affect subsequent rows must be done globally.
In the example, \gdef\theBAenumi{\Roman{BAenumi}} sets the counter output to Roman
numerals.

\usepackage{blkarray,ragged2e}
\begin{blockarray}{\BAenum! { .\quad}cc\Right{\}}{\texttt{block 1}}}
ccc & cc \\
c & ccccccccc \ \
\BAnoalign*{\texttt{\textbackslash BAnoalign*} typesets the text exactly in the
width of the tab le.}
\begin{block}{\BAenum! { .\quad}(rr\Right{\}}
{\parbox{3cm}{block 2, with a nested \texttt{block*}}}}
\phantom{XX}rrr & rr \ \
rrr & r \ \ % next row empty "field" for BAenum
\begin{block*}{!{\quad}ll}
& 11 & ll\phantom{XX}\\
& 1 & 1\ \
\end{block*}
r & r \ \ \end{block}
ccc \ \
\begin{block}{\BAenum! { .\quad}>{\bfseries}l \{c\R ight{\}}{\texttt{b lock 3}}}
\gdef\theBAenumi{\Roman{BAenumi}}
LLL & \BAmultirow{50pt}{\Centering All columns in one block.} \ \
LL & \\
L &\\
\end{block}
\begin{block}{\BAenum \{l\}l\R ig h t{\}}{\tex ttt{b lo c k 4}}}
11 & 1 \\ \BAnoalign{In contrast to \texttt{\textbackslash BAnoalign*},
\texttt{\textbackslash BAnoalign} interrupts a ll delimiters in the current block.}
1 & 111 \ \
\end{block}
c &c
\end{blockarray}

41
Packages

1. ccc cc
02-04-7
2. c ccccccccc
\BAnoa lig n * typesets the text -block 1
exactly in the width of the table.

3. frr rr
4. rr r
11 11 block 2, with
1 1 nested b lock *
7. \r
8. ccc j b lo c k 1
9. LLL f All columns
X. LL i in one -block 3
XI. L L block. .
Kll
11 I !} 3b lo c k 4
In contrast to \B A noalign*
\BAnoa l i g n interrupts all de­
limiters in the current block.
XIII 1 I 4 b lo c k 4
XIV. b lo c k 1

2 .4.1 Footnotes
In standard filpX you can’t typeset footnotes in a table, but this is possible with blkarray.
There are two variants: specifying \B A ta b le n o testru e lets you insert footnotes within the
respective current block; specifying \B A ta b le n o testru e puts the footnotes at the bottom of
the page as usual. The following two examples illustrate the two options:

\usepackage{blkarray}
\BAtablenotestrue
\begin{blockarray}{|c||c|}
I\footnotetext[\textsc{sourceA:} ]{Chicago Manual of S tyle.}
& II\footnote{Note on II. This is a particularly long footnote to demonstrate a lin e break
in the fo o tn ote.}\\
\begin{blockarray}{(11)}
\footnotetext[\textsc{sourceB:} ] {Chicago Manual of S tyle.}
\footnotetext[\textsc{noteA:}]{The statement above is incorrect.}
le f t column—1 & l e f t —2 \ \
l e f t —3\footnote{Footnote on le f t - 3 .} & l e f t —4 \\
\end{blockarray} & \begin{blockarray}{(ll)}
\footn otetext[\textsc{sourceC:} ] {Chicago Manual of S tyle.}
\footnotetext[\textsc{noteB:}]{The statement above is incorrect.}
right column—1 & right—2 \ \
right—3\footnote{Footnote on righ t-3.} & right—4 \\
\end{blockarray}\\

42
2.4 blkarray

III\footnote{Note on THREE.} & IV \ \


\end{blockarray}

02-04-8 I II*
/ left column - 1 le ft- 2\
( right column - 1 right- 2\
\left-3* left—4 J
frig h t-3* right-4/
sourceB: Chicago Manual of
sourceC: Chicago Manual of Style.
Style.
noteB: The statement above is
noteA: The statement above is
incorrect.
incorrect.
* Footnote on right-3.
* Footnote on left-3.
m+ IV

sourceA: Chicago Manual of Style.


* Note on II. This is a particularly long footnote to demonstrate a line break in
the footnote.
+ Note on THREE.

r I1 II2 1 \usepackage{blkarray} \BAtablenotesfalse


02-04-9
\begin{blockarray}{[c c]}
I\footnote{Chicago Manual of Style (CMoS).} &
II\footnote{This is a long footnote to demonstrate
the lin e break.}\\
\begin{blockarray}{(11)}
l-l\footnote{Chicago Manual of S tyle.} & 1-2 \ \
C hicago Manual of Style (CMoS). l-3\footnote{Footnote on 1-3.} & 1-4 \ \
2This is a long footnote to demon­ \end{blockarray}
strate the line break.
& \begin{blockarray}{(ll)}
3Chicago Manual of Style.
4Footnote on 1- 3.
r-l\footnote{CMoS}
5CMoS & r-2\\r-3\footn ote{\ld ots} & r -4 \\
6 \end{blockarray}\\
7Note on HI. III\footnote{Note on I I I .} & IV \ \
\end{blockarray}

2 .4 .2 Lines
Vertical lines are created similarly to standard ^IfeX; you can also use the extensions known
from the h h lin e package (cf. Section 2.10 on page 64). However, you can’t use \ h l i n e for
horizontal lines, but b lk array provides its own commands instead. There are also two further
commands for improving vertical spacing as well.

\BAhline \BAhhline{ line notation}


\BAextrarowheight \B A extrah eigh tafterh lin e

The following notation applies to vertical and horizontal lines; it is an extension of the
notation from the h h lin e package.

43
Packages

- A single line of column width.


= A double line of column width.
. A single dashed line of column width.
" A double dashed line of column width.
~ A column without line.
| A vertical line which intersects double horizontal lines.
: Ditto, but not intersecting double horizontal lines.
# A single line between two vertical ones.
t The upper half of a double horizontal line,
b The lower half of a double horizontal line.
* Repetition operator. * {3 }{==#} expands to ==#==#==#; similar to the definition of several
equal column types.
You can only use the t and b notation between two types of vertical lines.

\usepackage{blkarray} ,--------- .
0 1 2 3 4 5 [ 02-04-loJ
0 1 2 3 4 5 \b e g in { b lo c k a r r a y } { ||c |I c |c c ||c c ||}
0 1 2 3 4 5
\BAhhline{|t:=:t :=|==#==:t | }
0 & 1 & 2 & 3 & 4 & 5\\\BAhline
0 1 2 3 4 5
0 & 1 & 2 & 3 & 4 & 5\\\BAhline\BAhline
0 1 2 3 4 5 0 & 1 & 2 & 3 & 4 & 5 \\\B A h h lin e { ||-||-.. | | .-}
0 & 1 & 2 & 3 & 4 & 5 \ \ \ B A h h l i n e { = : ::"=}
0 & 1 & 2 & 3 & 4 & 5\\\BAhhline{| b:=:b b | }
\end{blockarray}

The individual lines o f this example are explained in depth below; it can be difficult to
understand especially the corners and intersections.
| | c | | c | cc | | cc | | t> The default vertical Lines.
\B A h h lin e { |t := :t := | ==#==:t | }
11 : > A vertical line ( | ), the upper half of a double horizontal (t), and a vertical
line (:) which does not intersect horizontal lines: In conjunction with the
column definition this produces: [j
= > A default double horizontal line: , together with the previous lines this
produces: 11
: t : > A vertical (:), upper half of a horizontal one (t), and again a vertical line (:),
where these do not intersect the horizontal ones: Together with the previous
lines this produces: || ||
==#== > Two columns with double lines (==), a double line between two
vertical ones (#), and again two columns with double horizontal lines:
|| Together with the previous lines this produces: || || | ||
: 1 1 > A vertical fine (:), the upper half of a double horizontal one (t), and a vertical
line (t^ which intersects horizontal lines. The whole is the mirrored start of the
table: Together with the previous lines this produces:

44
2.4 blkarray

\B A hline > Creates a line across the whole width of the table:

\B A h lin e\B A h lin e > Creates a double line across the whole width of the table:

\BAhhline{||-||-..||.-} > The middle line of the table.


| | - | | -] > Two vertical lines each ( | | ), followed by a simple line of column
width: . Together with the previous lines this produces:

. . | | . - > Two dashed lines across the width of the column each ( ..) , followed
by two vertical lines ( | | ), a dashed line (.), and a single solid line (-), of column
width each: ___ Together with the previous lines this produces:

= A double horizontal line (=), followed by two vertical ones (::


another horizontal line (=), a double dashed line ("), and finally a normal double

line (=): : Together with the previous lines this produces:

| b : = :b b | > A vertical line ( | ), the lower half of a double one (b), a


vertical one (:), a double horizontal one (=), a vertical line (:), the lower half
of a double one (b), a vertical one (:), a double horizontal line (=), two double
dashed ones two vertical ones (: :), a double dashed line ("), a double
horizontal one (=), a vertical one (:), the lower half o f a double one (b), and
finally a vertical line ( I): I----- :::::::::::::::::::: : = J . Everything together yields
Example 02-04-10 on the preceding page, given before.

2 .4 .3 Vertical alignm ent


The position optional argument o f the b lock array environment can have the same values
tcb as the standard ta b u la r environment. However, the next example shows that the result
of applying one of these values for this optional argument is not what you might expect:

45
Packages

\usepackage{blkarray}
Text \begin{blockarray}[t ] { | c | } 1 \\2 \\3 \end{blockarray} text
\begin{blockarray} [c] { | c | } 1 \\2 \\3 \end{blockarray} text
\begin{blockarray}[b]{ | c | } 1 \\2 \\3 \end{blockarray} text

1 02-04-11
2
3
Text text text text
1
2
3

2.5 booktabs
The booktabs package by Simon Fear certainly belongs to the “highly recommended” category
and should always be used. It primarily refers to typographical conventions to be kept in
mind when creating tables, which are valid in general and have already been mentioned in
Chapter 1 on page 3. These specifications are applied by booktabs, especially for vertical
lines; they are not supported by the package in any special way. An example from [34, page
73] is given as starting point for a typographically bad table.

gnome pound €13.65 \begin{tabular}{|11 1 l r ||} \hline


piece .01 gnome & pound & \eu rol3.65\\
\cline{2-3}
gnu filled 92.50
& piece & .01 \\\h lin e
emu 33.33 gnu & fille d & 92.50 \ \
duckbill frozen 8.99 \c lin e { l-l} \c lin e { 3 -3 }
emu & & 33.33 \\\h lin e
duckbill & frozen & 8.99 \\\h lin e
\end{tabular}

Of course the original point o f this example was to discuss applications of commands
and not typographical questions. Nevertheless this table is suitable as a starting point for a
discussion of good and less good options for a table layout. For comparison, let us take a look
at the same table without vertical lines.

gnome pound €13.65 \usepackage{eurosym} .--------


[ 02-05-2
piece .01 \begin{tabular}{@{}llr@{}} \hline
gnu filled 92.50 gnome & pound &\eu rol3.65\\\clin e{2-3}
emu 33.33 & piece &.01 \\\h lin e
duckbill frozen 8.99 gnu & fille d & 92.5 0 \\\c lin e {l-l}\c lin e {3 -3 }
emu & &33.33\\\h lin e
duckbill & frozen & 8.99 \\\h lin e
\end{tabular}

46
2.5 booktabs

The text becomes easier to see, which is always a worthwhile aim. We can also omit
some of the horizontal lines, and use the \m ultirow or \ra iseb o x command to shift the one
common entry “filled” and centre it vertically.

gnome pound €13.65 \usepackage{eurosym,multirow}


piece .01 \begin{tabular}{@{}llr@{}} \hline
gnu 92.50 gnome & pound & \eurol3.65 \\
filled
emu 33.33 & piece & .01 \\
duckbill frozen 8.99 gnu & \multirow{2}*{filled} & 92.50\\
emu & & 33.33 \\
duckbill & frozen & 8 .9 9 \\\h lin e
\end{tabular}

The booktabs package offers further to improve this table. In particular, it lets you
employ different line widths more easily, several commands defined:

\to p ru le [width]
\m idrule [width]
\cm idrule [width] (horizontal trim) {from-to }
\morecmidrules
\bottom rule [width]
\add linespace [space]
\s p e c ia lr u le{width}{ space above}{space below}

The default values for the widths of the individual lines, with their associated lengths and
space above/below and for \cm idrule with the optional horizontal trim are summarized in
Table 2 .2 .

Table 2.2: Summary of the relevant lengths and their assignment to commands; the column c u rr e n t
gives the values for the class used here.

length default current line type


\heavyrulew idth 0.08 em 0 . 79982pt \to p ru le, \bottom rule
\lig h tr u le w id th 0.05 em 0.4999pt \m idrule
\cmidrulewidth 0.03 em 0 . 29991pt \cm idrule
\below rulesep 0.65 ex 2 . 7979pt \to p ru le, \m idrule, \cm idrule
\belowbottomsep Opt O.Opt \bottom rule
\aboverulesep 0. 4ex 1 . 72177pt \m idrule, \cm idrule, \bottom rule
\abovetopsep Opt O.Opt \to p ru le
\cm idrulesep 2 \p@ 2. Opt \cm idrule, \morecmidrules
\cm idrulekern 0 . 5em 4.99878pt \cm idrule
\defaultaddspace 0 . 5em 4.99878pt \add linespace

47
P a ck a g e s

W e c a n im p ro v e o u r ex am p le tab le f u rth e r b y u sin g th e b o o k t a b s lin e ty p e s a n d ad d in g a


c a p tio n . In m a n y fo n ts , th e d ig its all h a v e th e sa m e w id th ; so r ig h t- a lig n in g is su ffic ie n t to
fo rm a t th e c o lu m n o f n u m b e rs.

\u s e p a c k a g e { e u ro sy m , a r r a y , m u ltir o w , b o o k ta b s}
m e ats ¡02-05-4

\b eg in { tab u la r} { @ { }ll> {$ } r< { $ } @ { }} \ t o p r u l e


an im al u n it p rice in €
\m u ltic o lu m n { 2 } { c } { m e a ts } \\\c m id r u le (r ){ l- 2 }
gnom e pound 1 3 .6 5 a n im a ls u n i t & \te x trm { p ric e i n \ e u r o } \ \ \ m i d r u l e
piece 0.01 gnome & pound & 1 3 .6 5 \\
gnu 9 2 .5 0 & p ie c e & 0 .0 1 \\
filled gnu & \m u ltir o w { 2 } * { f ille d } & 9 2 .5 0 W
em u 3 3 .3 3
emu & & 3 3 .3 3 \\
duckbill frozen 8 .9 9
d u c k b i ll & f ro z e n & 8 .9 9 \ \ \ b o t t o m r u l e
\e n d { ta b u la r }

U sin g b o o k ta b s , y o u c a n a lso c re a te s im p le b a r c h a r ts w ith ta b le s a s w ell, w ith o u t th e


n e e d fo r o th e r p a c k a g e s o r e x te rn a l p ro g ra m s:

\u s e p a c k a g e { x c o lo r,b o o k ta b s }
\n e w le n g th { \b a s is } \s e tle n g th { \b a s is } { 1 0 c m } \n e w le n g th { \b a rle n g th }
\newcom m and*{\Bar}[1]{%
\s e tle n g t h { \ b a r l e n g t h } { 0 .0 1 \ b a s i s } \ s e t l e n g t h { \ b a r l e n g t h } { # l \ b a r l e n g t h } %
\ t e x t c o l o r { b l a c k !4 0 } { \ r u l e { \ b a r l e n g t h } { l . 5ex}} # 1 \ , \%}

\b e g in { ta b u la r} { @ { } ll@ { } } \to p ru le
\m u ltic o lu m n { 2 } { c } { G e n e ra l o p in io n on s o c i a l d i f f e r e n c e s i n Germany (n=509)}
\\\m id ru le
\B ar{ 5 7 } & v e ry la r g e \ \ \B ar{ 2 3 } & l a r g e \ \
\B ar{12} & l e s s l a r g e \ \ \B a r{ 8 } & s m a ll\\\b o tto m ru le
\e n d { ta b u la r }

G en e ra l o p in io n o n social d ifferences in G e rm a n y (n=509) i 02-05-5

57% v e ry large
23% large
12% less large
8% sm all

T h e \ c m i d r u l e c o m m a n d gives y o u m o re c o n tro l o v er a lig n m e n t th a n th e d e fa u lt \ c l i n e


c o m m a n d , as th e v a lu e s 1 a n d r c re a te h o r iz o n ta l a d ju s tm e n t. T h e fo llo w in g tw o sim p le
e x a m p le s illu s tra te u s in g th e c o m m a n d : th e firs t d iffe rs fro m th e s e c o n d o n ly b y th e ta b le
h e a d e r in th e co d e - in th e se c o n d case th e ta b le is le ft-/rig h t-a lig n e d .

48
2.5 booktabs

two three four \usepackage{booktabs}


one
one two three four \begin{tabular}{cccc}
one two
one& two& three& four\\\cmidrule{l-2}\cmidrule{3-4}
three four
one& two& three& four\\\cm idrule{l-l}\cm idrule{2-2}
one two three four \cmidrule{3-3}\cmidrule{4-4}
one& two& three& four\\\cm idrule(lr){l-2}\cm idrule(lr){3-4}
one two three four
one& two& three& four\\\cm idrule(lr){l-l}\cm idrule(lr){2-2}
one two three four \cm idrule(lr){3-3}\cm idrule(lr){4-4}
one& two& three& four\\\cm idrule(r){l-2}\cm idrule(l){3-4}
one& two& three& four\\\cm idrule(r){l-l}\cm idrule(lr){2-2}
\cm idrule(lr){3-3}\cm idrule(l){4-4}
\end{tabular}

one two three four \usepackage{booktabs}


I02-05-7 |
one two three four \begin{tabular}{@{}cccc@{}}
one& two& three& four\\\cmidrule{l-2}\cmidrule{3-4}
one two three four
one& two& three& four\\\cm idrule{l-l}\cm idrule{2-2}
one two three four \cmidrule{3-3}\cmidrule{4-4}
one& two& three& four\\\cm idrule(lr){l-2}\cm idrule(lr){3-4}
one two three four
one& two& three& four\\\cm idrule(lr){l-l}\cm idrule(lr){2-2}
one two three four \cmidrule(l r ){3-3}\cmidrule(l r ){4-4}
one& two& three& four\\\cm idrule(r){l-2}\cm idrule(l){3-4}
one& two& three& four\\\cm idrule(r){l-l}\cm idrule(lr){2-2}
\cinidrule(lr){3-3}\cm idrule(l){4-4}
\end{tabular}

You can see various differences in how the layout differs between the two tables. The
first two rows show that neighbouring \cm id ru le commands that don’t use the horizontal
alignment notation form a series of joined lines in the table. If on the other hand one or more
of the optional trim parameters 1 or r are used, the partial line is shortened by the value
\cm idrulekern. \cm id ru le doesn’t distinguish between cells in the centre of the table and
at the edge, which is why the display in the second, left-/right-aligned table is different to the
first table.
\cm id ru lek ern defaults to 0.5 em and can be changed at any time. Alternatively, a length
can be specified explicitly as a parameter to 1 and r; for example r { \ t a b c o l s e p } shortens
by \ta b c o ls e p . Negative values extend the line to the left or right.
The following example is a rather complex application of the booktabs commands. By
setting @ {\kern-30pt} (negative column spacing) in the head of the table between the first
and second column, we achieve an “attraction” of the following column. It is getting nearer to
the first column.

\usepackage{eurosym, array,booktabs}
\begin{tabular}{@{}>{\raggedright}p{4.5cm}@{\kern-30pt}*{6}{>{\small}r}@{}}\toprule
\ t e x t it {alternative 1} & time of & year\\[-2pt]
& investment & 2006 & 2007 & 2008 & 2009 & 2010 \ \

49
Packages

\cm idrule(lr){3-3}\cm idrule(lr){4-4}\cm idrule(lr){5-5}


\craidrule(lr){6-6}\cmidrule(l){7-7}
introductory payments &0& 0& 0& 0& 0& 0 \\
current personnel cost & 0 & 7.187 & 7.187 & 7.187 & 7.187 & 7.187 \ \
current cost for\newline
system maintenance & 0 & 13.572 & 13.572 & 13.572 & 13.572 & 13.572W
\cmidrule[0 .8pt] (r){l-2}\cm idrule(lr){3-3}\cm idrule(lr){4-4}\cm idrule(lr){5-5}
\cmidrule(lr){6-6}\cm idrule(l){7-7}
to ta l payments for the investment
& 0 & 20.759 & 20.759 & 20.759 & 20.759 & 20.759\\\bottomrule
%
\multicolumn{7}{c}{\rule{0pt}{3ex}\small(all amounts in \euro)}
\end{tabular}

alternative 1 time of year


investment 2006 2007 2008 2009 2010

introductory payments 0 0 0 0 0 0
current personnel cost 0 7.187 7.187 7.187 7.187 7.187
current cost for 0 13.572 13.572 13.572 13.572 13.572
system maintenance
total payments for the 0 20.759 20.759 20.759 20.759 20.759
investment

(ail amounts in € )

As with the default KEl£X \ c l i n e command, calling \cm id ru le several times consecutively
does not draw multiple lines. However, inserting the \m orecm idrules command between
two identical \cm id ru le commands gets round this; repeating the sequence creates more
lines. The line spacing is specified by \d o u b le r u le se p = 2.0pt and can be changed as usual
through a length command.

one two three four \usepackage{booktabs}


02-05-9
one two three four \begin{tabular}{cccc}
one & two & three & four\\\cmidrule{2-3}\cmidrule{2-3}
one two three four one & two & three & fou r\\

one & two & three & four\\\cmidrule{2-3}\morecmidrules


\cmidrule{2-3}\morecmidrules\cmidrule{2-3}
\end{tabular}

The \ s p e c i a l r u l e command is helpful for colour tables, as it lets you create lines that
colour tables don’t have any vertical space before or after them and therefore can be placed immediately
after coloured blocks. This also makes using vertical lines possible, which would otherwise
be interrupted before and after horizontal lines because of the additional vertical spacing
associated with booktabs line types.

50
2.5 b o o ktab s

\u s e p a c k a g e { a r r a y , b o o k ta b s}
\u s e p a c k a g e [ ta b le ] { x c o lo r } \d e f i n e c o l o r { c L ig h t R e d } { r g b } { l ,.7 0 ,.7 0 }
\d e fin e c o lo r{ c L ig h tY e llo w } { r g b } { . 9 0 , . 8 5 , . 5 5 } \d e f in e c o lo r{ c L ig h tG ra y } { rg b } { . 9 0 ,. 9 0 ,. 9 0 }
\d e fin eco lo r{ cM e d iu m G ra y } { rg b } { .7 0 ,. 7 0 ,. 7 0 } \d e fin e c o lo r{ c D a rk G r a y } { r g b } { .5 0 ,.6 0 ,.7 0 }
\n e w c o m m a n d \th ic k c [l][ 0 . 5 p t ] { \ v r u l e w id th #1}
\n e w c o m m a n d \m y M id ru le { \sp e c ia lru le { 0 . 6 p t} { 0 p t} { 0 p t}}

\re n e w c o m m a n d { \a r ra y s tr e tc h } { l.35}
\ b e g i n { t a b u l a r } { |1 |c |c |m { 4 c r a } |} \s p e c i a lr u le { 2 p t} { 5 p t} { 0 p t}
\m u ltic o lu m n { 4 } { ! { \ t h i c k c [2 p t] }c ! { \ t h i c k c [2 p t ]}}{%
\ l a r g e \te x tb f { B o o t L oader H eader T a b l e } } \\ \s p e c ia lr u l e { 2 p t} { 0 p t} { 0 p t}
\ra u ltic o lu m n { 4 } { ! { \ t h i c k c [ l p t ] } > { \c o lu m n c o lo r{ c L ig h tY e llo w } } r! { \ t h i c k c [ l p t ]}}{%
\ l a r g e V e rsio n In d e p e n d e n t } \ \ \ s p e c i a l r u l e { l p t } { 0 p t } { 0 p t }
\m u ltic o lu m n { l} { !{ \th ic k c [ lp t]} > { \c o lu m n c o lo r{ c D a rk G ra y } } c |} { E n try }
& \m u ltic o lu m n { l} { |> { \c o lu ra n c o lo r{ c D a rk G ra y } } c |} { L o c a tio n }
& \m u ltic o lu m n { l} { |> { \c o lu ra n c o lo r{ c D a rk G ra y } } c |} { S iz e }
& \m u ltic o lu m n { l} { |> { \c o lu ra n c o lo r{ c D a rk G ra y } } c ! { \th ic k c [lp t]} } { C o m m e n ts} \ \
\s p e c ia lru le { lp t} { 0 p t} { 0 p t}
\rowcolor{cLightGray} JmpTrap & 0 & Word & OEBFEh (JMP \$)\\\myMidrule
\rowcolor{cMediuraGray} MagicNuraber & 2 & Word & 0AA55h \\\myMidrule
\rowcolor{cLightGray} Name & 4 & 4 B ytes & ’ EBLH’ \\\myMidrule
\rowcolor{cMediumGray} V ersion & 8 & Word & V ersion of BLH table\\\myMidrule
\rowcolor{cLightGray} S iz e & 10 & Byte & S iz e of BLH ta b le \\\myMidrule
\rowcolor{cMediumGray}SizeVDT & 11 & Byte & S iz e of fo llo w in g v ersio n
dependent table\\\myM idrule
\m u ltic o lu m n { 4 } { ! { \ t h i c k c [lp t] } > { \c o lu m n c o lo r{ c L ig h tY e llo w } } r ! { \ t h i c k c [ l p t ]}}{%
\ l a r g e V e rsio n 1 .x } \\\m y M id ru le
\ro w c o lo r{ c L ig h tG ra y } Empty & 0 & 0 & No D ata f o r l.x \\\m y M id r u le
\m u ltic o lu m n { 4 } { ! { \ t h i c k c [ 2 p t ] } c ! { \ t h i c k c [ 2 p t ]}}{%
\ l a r g e \te x tb f { E n d o f Boot L oader H eader T a b l e } } \ \ [ - 2 p t ] \ b o t t o m r u l e [ 2 p t ]
\e n d { ta b u la r }

Boot Loader Header Table


Version Independent
E ntry Location Size Com ments
JmpTrap 0 W ord OEBFEh (JMP $)
M agicNumber 2 W ord 0AA55h
Name 4 4 Bytes ’EBLH’
Version 8 W ord Version of BLH table
Size 10 Byte Size of BLH table
Size o f following version
SizeVDT 11 Byte
dependent table
Version 1.x
Empty 0 0 No D ata for 1.x
End o f Boot Loader Header Table

51
P a ck a g e s

I n th e a b o v e e x a m p le , a d d itio n a l v e r tic a l s p a c in g w a s n o t d e s ire d b e c a u s e o f u s in g c o lo u re d


c e lls . I n t h e n e x t e x a m p l e , h o w e v e r , t h e e x a c t o p p o s i t e i s w a n t e d : w e c a n i n s e r t a d d i t i o n a l
v e r tic a l sp a c e a r b itr a r ily a t a n y p la c e in th e ta b le u s in g \ a d d l i n e s p a c e . W h e n u s in g a
l o n g t a b l e e n v i r o n m e n t ( S e c t i o n 4 . 1 o n p a g e 1 2 5 ), \ s p e c i a l r u l e a l s o h e l p s t o c o n t r o l t h e
lo n g ta b le /¿ y s p a c e a f te r a ta b le c a p tio n . H o w e v e r, r e m e m b e r th a t w h e n u s in g l o n g t a b l e a n d b o o k t a b s
5 - t o g e t h e r , t h e s y n t a x o f t h e c o m m a n d s is s l i g h t l y d i f f e r e n t :

\to p ru le (h o rizo n ta l trim ) [w id th ]

\m id ru le (h o rizo n ta l trim ) [w id th ]

\b o tto m ru le (h o rizo n ta l trim ) [w id th ]

\s p e c ia lru le (h o rizo n ta l trim ) {w id th }{s p a c e a b o v e }{s p a c e b elo w }

T h e o p tio n a l a r g u m e n t fo r th e h o r iz o n ta l tr im is n o w p o s s ib le fo r all c o m m a n d s . T h is is
im p o r ta n t to k n o w b e c a u s e fo r e x a m p le in th e fo llo w in g co d e, th e \ r e l a x a f te r th e la s t
\ m i d r u l e is re q u ire d . O th e rw is e th e p a r e n th e s is in th e fo llo w in g lin e w o u ld c a u se a n e r ro r
m e ssa g e - \ m i d r u l e w o u ld r e g a rd it as th e s ta r t o f a n o p tio n a l a rg u m e n t.

\u s e p a c k a g e { lo n g ta b le } \u se p a c k a g e { b o o k ta b s}
\b e g in { lo n g tab le } { @ { } lrc c c c r@ { } }
\c ap tio n { S u m m a ry . } \ \ \s p e c i a l r u l e { l p t } { 5 p t } { 5 p t }
\rau ltico lu ran { l} { l} { c o ra p o u n d } & \r a u ltic o lu ra n { l} { c } { L it.}
& \m ultico lu m n { l}{ c }{ X -R ay } & \ra u ltic o lu ra n { l} { c } { L sm .}
& \m u ltic o lu m n { l} { c } { $ A{ 1 2 5 } $ T e -s h ift}
& \m u ltic o lu m n { l} { c } { $ A{ 1 9 } $ F -s h ift} \ \ \ m i d r u l e
\ a d d l i n e s p a c e [ 0 . 3em]
\e n d h e a d
%
\ a d d l i n e s p a c e [ 0 . 5em]
\e n d f o o t
%
\b o tto m r u le
\e n d la s tfo o t
%
(CF$_3$C$_6$F$_4$) $_2$Te$_2$ &— &— &— &— &— \ \ \ m i d r u l e
Ph$_2$Te &— &— &— &729&— \ \ \ m i d r u l e \ r e l a x
(C$_6$F$_4$)$_2$Te$_2$ &— & ja& — &762& $ -1 0 8 ,0 $ ; $ -1 5 2 ,0 $
\e n d { lo n g ta b le }

T a b le 1 : S u m m a ry . i------------
' | 02-05-11

com pound L it. X -R ay L sm . 125T e - s h i f t 19F - s h i f t


(C F 3 C 6 F 4 ) 2 T e 2 - - - - -

P h 2T e - - - 729 -

( C e F 4 ) 2T e 2 ja 762 - 1 0 8 , 0 ; - 1 5 2 ,0

52
2.6 c e lls p a c e

2.6 c e lls p a c e
The c e lls p a c e package by Josselin Noirel automatically loads the i f then, array, and c a lc
packages and provides better line spacing for displayed equations in tables and matrices.
Otherwise, especially when using fractions, roots, or exponents in ta b u la r environments,
problems can occur such as the one in the following example:

\begin{tabular}{c}\hline
/(* > = $ f(x)=\frac{\sq rt{xA2-l}}{xA2+l}$ \\\h lin e
/(* > = $ f(x)=\frac{\sq rt{xA2-l}}{xA2+\frac{l}{xA2}}$\\\h lin e
\end{tabular}

In general, you could just use the \a r r a y s t r e tc h command to stretch the table. But
this doesn’t always lead to equal spacing across different tables, because the value for
\a r r a y s t r e t c h has to be adjusted. Furthermore a lot o f experience is required to come
up with sensible values, which nevertheless still do not always yield the expected solution.

\renewcommand\arraystretch{2.5}
02-06-2 i
— Vx2-1 \begin{tabular}{c}\hline
/(* ) - $ f(x)=\frac{\sq rt{xA2-l}}{xA2+l}$ \\\h lin e
$ f(x)=\frac{\sq rt{xA2 -l}}{x A2+\frac{l}{xA2 }}$\\\h lin e
f(x ) = \end{tabular}
J(

The c e lls p a c e package tries to determine sensible spacings above and below by calculat­
ing the required height of the cell. To achieve this, a new S column type was defined through
the \newcolumntype command. It takes the actual type as a parameter; possible values are
1, c, r, p, m, and b. For the simple types, no parentheses are necessary and the following
character is automatically assumed to be the argument, i.e. SI and S{1} are identical.

\usepackage{cellspace}
02-06-3 /<*> -
\begin{tabular}{Sc}\hline
/<*> - jXg+72-
?
$ f(x)=\frac{\sqrt{xA2-l}}{xA2+l}$ \\\h lin e
$ f(x)=\frac{\sq rt{xA2-l}}{xA2+\frac{l}{xA2}}S\\\hlin e
\end{tabular}

The space above and below a tabular cell is controlled by the package-defined lengths
\c e lls p a c e t o p lim it = lp t and \c e lls p a c e b o tt o m lim it= l pt. These default values are
quite small, so we recommende you change them. You can do this by using either \s e t le n g t h
or \a d d to le n g th .

\usepackage{cellspace}\addtolength\cellspacetoplimit{3pt}
02-06-4 fix) = ^ \addtolength\cellspacebottomlimit{3pt}
\begin{tabular}{Sc}\hline
M $ f(x)=\frac{\sq rt{xA2 -l}}{xA2+l}$ \\\h lin e
$ f(x)=\frac{\sq rt{xA2 -l}}{xA2+\frac{l}{xA2}}$\\\h lin e
\end{tabular}

53
P a ck a g e s

c e l l s p a c e le ts y o u a d d f u r th e r c o lu m n ty p e s w ith th e \ a d d p a r a g r a p h c o l u m n t y p e s
c o m m a n d . T h is m o s tly r e fe rs to c u s to m ty p e s d e fin e d b y th e u se r, w h ic h a re n o t k n o w n
to c e l l s p a c e o th e rw is e . A ty p ic a l c a se is th e a d d itio n o f a X c o lu m n ty p e w h e n u s in g th e
p a c k a g e t a b u l a r x (cf. S e c tio n 2.18 o n p a g e 87).

\usepacK agei.am sm atn, c e l l s p a c e , taD u iarx j-


X th e in d e p e n d e n t v a ria b le
\a d d p arag rap h c o lu m n ty p e s{ X } i 02-06 5 '
w h ic h c a n b e a s s ig n e d a rb i­ \a d d to l e n g t h \ c e l l s p a c e t o p l i m i t { 3 p t }
tra rily \ a d d to le n g th \c e lls p a c e b o tto m lim i t{ 3 p t }
y th e d e p e n d e n t v a ria b le \b e g in { ta b u la rx } { \lin e w id th } { S { p { 3 e m } } S X } \h lin e
$x$ & th e in d e p e n d e n t v a r i a b l e w hich can be
f i x ) th e fu n c tio n y =f ( x ) -j=
a s s ig n e d a r b i t r a r i l y \ \ \ h l i n e
xJX
$y$ & th e d ep e n d en t v a r i a b l e \ \ \ h l i n e
$ f ( x ) $ & th e f u n c ti o n
$ y = f(x )\d fra c { l} { \s q rt{ x } } $ \\\h lin e
\e n d { ta b u la r x }

2.7 c t a b le
T h e c t a b l e p a c k a g e b y W y b o D e k k e r c o m b in e s th e f u n c tio n a lity o f th e a r r a y , t a b u l a r x ,
a n d b o o k t a b s p ac k ag e s. A d d itio n a lly , th e r o t a t i n g , x s p a c e , c o l o r , a n d x k e y v a l p a c k a g e s
a re lo ad ed , c t a b l e d e fin e s th e c o m m a n d o f th e sa m e n a m e , w h ic h is u s e d to c h a n g e th e
la y o u t o f a table, c o n tro lle d b y k ey w o rd s. It also p ro v id e s a d d itio n a l co m m a n d s fo r fo o tn o te s
a n d lines.

In th e s im p le s t case, th e c t a b l e c o m m a n d is u s e d w ith o u t o p tio n s a n d w ith a n e m p ty


a r g u m e n t fo r th e fo o tn o te s:

le ft cen tre rig h t \u s e p a c k a g e { c ta b le } ,---------


02-07-1
1 c 7
\c ta b le { lc r } { } { % <— em pty f o o tn o te argum ent!
left ce n te r rig h t
\e m p h { le ft} & \e m p h { c e n tre } & \ e m p h { r i g h t } \ \ \ h l i n e
1 &c &r \\
l e f t & c e n te r & r ig h t }

T ab le 2.3 su m m a riz e s a ll p o ssib le o p tio n a l p a r a m e te r s a n d a lso g iv e s th e c o rre s p o n d in g


d efa u lt v alues. S everal o f th e o p tio n s re fe r to th e ta b le as th e flo atin g e n v iro n m e n t; th is is n o t
im p o r ta n t h e re th o u g h a n d w ill n o t b e e x p la in e d fu rth e r. [42]

54
2.7 ct able

Table 2.3: Summary of the options for the \c t a b le command.

name description
ca p tio n Table caption (above or below); m ust be enclosed in parentheses if the text
contains a comma or an equals sign.
cap Alternative short form for the list of tables ( \ l i s t o f t a b l e s ) .
ca p tio n sk ip Space between caption and table, default is 2ex.
mincapwidth Minimum width of the table caption. Useful for very narrow tables; footnotes
are always typeset with the “caption” width.
pos Float position, default is tbp.
la b e l Requires a table caption. Corresponds to the \ l a b e l command.
width If a width is specified, the ta b u la rx environment is used to typeset the
table; therefore the X column type is used for at least one column.
maxwidth If the table does not extend to the maximum width, each X column is con­
verted to a normal 1 column.
ce n ter Centres the table on the current line (default).
le ft Left-aligns the table on the current line.
r ig h t Right-aligns the table on the current line.
fig u r e A fig u r e floating environment is used for the table instead of the ta b le
environment.
botcap Places the caption at the bottom.
sidew ays Rotates the table counter-clockwise (oneside) or clockwise (twoside) by 90
degrees and places it on its own page. The pos option must not be used in
this case.
nosuper Typesets the footnote symbols not in “superscript” mode.
n otesp ar Typesets all footnote texts consecutively in one paragraph.
s ta r Uses the starred versions of the floating environments; this only makes sense
in \twocolumn mode to have the table span both columns.
fram erule The table is alw ays fitted with a frame; the line width is Opt by default
though - it is invisible unless another value is specified.
framesep Corresponds to \fb o x se p and determines the spacing between frame and
table; default is Opt.
fram efg Expects three values separated by spaces (RGB), each from the range [0 ... 1]
for the frame colour; default is 0 0 0for black.
framebg Expects three values separated by spaces (RGB), each from the range [0 ... 1]
for the background colour of the frame; default is 1 1 1 for white.

Footnotes are always placed underneath the table and their width (mark and text) depends
on the table caption. If there is no caption, the width of the table itself is taken. A separating
line is drawn when using the standard \ f o o tn o te te x t command. The counting is done in the
usual m inipage form; i.e. \tm ark is to be replaced by the “real” letter and \f o o t n o t e t e x t
the corresponding number ( f - 6). If \tm ark and \t n o t e are used without optional argument,
the label a is assumed automatically. The footnote counter is not incremented automatically.

55
P a ck a g e s

JS O U R C E :
IP \u s e p a c k a g e { c ta b le }
; 02-07-2 l
left c o l-1 rig h t co l-1 \ c t a b l e [ n o t e s p a r = t r u e ] { |c [ | c | }{%
le ft-2 rig h t-2 \ t n o t e [ \ t e x t s c { s o u r c e : } ] { C h i c a g o Manual o f S t y l e . }%
le ft-3 r ig h t-3 * \tn o te { N o te on I I . T h is i s a v e ry lo n g f o o tn o te to
le ft-4 r ig h t- 4 d e m o n s tra te th e l i n e b re a k i n a f o o t n o t e . }%
IIP IV / \tn o t e [ b ] { F o o tn o te on l e f t - 3 . }%
source:Chicago Manual of Style. \tn o t e [ * ] { F o o tn o te on rig h t-3 } %
“ Note on II. This is a very long \tn o t e [ c ] { F o o t n o t e on I II .} %
footnote to demonstrate the line \f o o tn o te te x t [ 6 ] { A n o th e r ‘ ‘r e a l ’ ’ f o o tn o te on I II .} %
break in a footnote. bFootnote on
left-3. Footnote on right-3
}{%
c Footnote on III. I \ t m a r k [ \ t e x t s c { s o u r c e : }] & I I \ t m a r k \ \
l e f t c o l—1 &r i g h t c o l— 1 \\
/Another “real” footnote on l e f t —2 &r i g h t — 2 \\
III. l e f t — 3 \tm a rk [b ]& r i g h t — 3 \tm a rk [* ] \ \
l e f t —4 &r i g h t — 4 \\
I II\tm a rk [c ] & I V \tm a rk [ f] }

F ram es are o n ly d ra w n a ro u n d th e ta b le; th e fo o tn o te s a p p e a r o u tsid e it. W h e n sp e cify in g


th e lin e w id th y o u n e e d to ta k e in to a c c o u n t th a t v e ry th in lin e s a re so m e tim e s n o t visible o n
xcolor/^y th e sc re e n . In th is c a se th e d o c u m e n t c a n b e m a g n ifie d o r p r in te d . C o lo u r sp e c ific a tio n s in
J - o n e o f th e e x te n d e d x c o l o r n o ta tio n s lik e r e d ! 70! b l u e ! 30 a re n o t p o ssib le.

\u s e p a c k a g e { c ta b le }
JSOURCE: IP
left c o lu m n - 1 rig h t c o lu m n - 1 \ c t a b l e [ fra m e r u le = 0 . 5 p t , fra m e s e p = 5 p t,
le ft-2 rig h t- 2 fram eb g = 0 .8 0 .5 0 . 6 ] {@{}c||c@{}}{%
le ft— rig h t-3 * \ t n o t e [ \ t e x t s c { s o u r c e : } ] { C h i c a g o Manual o f S t y l e . }%
\tn o te { N o te on I I . T h is i s a v e ry lo n g f o o tn o te
le ft-4 rig h t- 4
t o d e m o n s tra te th e l i n e b re a k
IIP IV /
i n th e f o o t n o t e . }%
source:Chicago Manual of Style. \ t n o t e [ b ] { F o o tn o te on l e f t - 3 . }%
“ Note on II. This is a very long \tn o t e [ * ] { F o o tn o te on rig h t-3 } %
footnote to demonstrate the line \t n o t e [ c ] { F o o t n o t e on I II .} %
break in the footnote.
\ f o o t n o t e t e x t [ 6 ] {A nother ‘ ‘r e a l ’ ’ f o o tn o te on I II .} %
bFootnote on left-3.
Footnote on right-3 }{%
cFootnote on III. I\tm a rk [ \te x ts c { s o u r c e :} ] & I I \t m a r k \\
l e f t colum n— 1 & r i g h t colum n— 1 \ \
l e f t —2 &r i g h t — 2 \\
{Another “real” footnote on III. l e f t — 3 \tm ark [b ]& r i g h t — 3 \tm a rk [* ] \ \
l e f t —4 &r i g h t — 4 \\
I II\tm a rk [c ] & I V \tm a rk [f]

T h e s id e w a y s p a ra m e te rs alw a y s p u t th e tab le o n its o w n p ag e so u sin g th e m o n ly m ak es


se n se fo r la rg e ta b le s . If th e ta b le is v e r y w id e b u t n o t v e r y h ig h , its b e tte r to u s e a sim p le
ro ta tio n w ith \ r o t a t e b o x .

I n s te a d o f th e s ta n d a r d lin e b r e a k c o m m a n d s lik e \ \ o r \ t a b u l a r n e w l i n e , c t a b l e p r o ­
v id e s a lte r n a tiv e v a r ia n ts lik e \NN ( n o rm a l n e w lin e ); th e y a re lis te d o n p a g e 54. All lin e

56
2.7 c t a b le

commands must be within the table block. For lines, the \FL (first line), \ML (middle line),
\ FL<£\ and \LL (last line) commands refer to the booktabs versions, \to p r u le , \m id ru le, and
\b otto m ru le, with the option of specifying the width of the line.

\usepackage{ctable}
Here is some pretty useless text before the following table, which w ill appear
on i t s own page because of the \texttt{sideways} option.

\cta b le[sideways,maxwidth=\textheight,
caption=A table with \texttt{\textbackslash ctable}. ]{@{}>{\ttfamily}l X@{}
}{\tnote[*]{A demonstration with \texttt{\textbackslash cta b le}.}}%
{\FL% FirstLine with default width
sideways\tmark[*] & Rotates the table counter-clockwise (oneside) or clockwise
(twoside) by 90 degrees and places i t on it s own table. The \texttt{p os}
option must not be used in th is case.\ML[0.1pt]% MidLine
star & Uses the starred version as floating environment; this only makes
sense in \texttt{\textbackslash twocolumn} mode to have the table span both
columns.\LL[0 .5pt]% LastLine
}% end of the table argument

02-07-4 |

Here is some pretty useless text before


the following table, which will appear
on its own page because of the sideways
option.

The maxwidth option is helpful when tables are generated by external scripts or programs
where the content of the table is not necessarily known before. The general use of a X column
in conjunction with the ta b u la r x package can be irritating if the specified width of the table
(mandatory) is larger than necessary. By specifying a maximum width through maxwidth, a X
column can be converted automatically to a 1 column if the table as a whole is narrower than
the maximum width.

57
Packages

T h e h o riz o n ta l a lig n m e n t o f th e table, w h ic h is c e n tre d o n th e c u rr e n t lin e b y d efau lt, ca n


b e c h a n g e d th r o u g h th e o p tio n s l e f t , c e n t e r , a n d r i g h t .

le ft c e n tr e d r ig h t \usepackage{ctable} ,-------
L02-07'5
\ c r \ctable{@{}lcr@{}}{}{%
left c e n te r rig h t \emph{left} & \emph{centred}
& \emph{right}\\\hline
1 &c & r \\
le f t & center & right }
\ctable[left]{@{}lcr@{}}{}{%
le ft c e n tr e d r ig h t
\emph{left} & \emph{centred}
1 c r & \emph{right}\\\hline
left c e n te r rig h t 1 &c & r \\
le f t & center & right }
\ctable[right]{@{}lcr@{}}{}{%
\emph{left} & \emph{centred}
& \emph{right}\\\hline
le ft c e n tr e d r ig h t 1 &c & r \\
1 c r le f t & center & right }
left c e n te r rig h t

2.8 d a ta to o l
T h e d a t a t o o l p a c k a g e b y N ic o la T a lb o t su p e rs e d e s th e o ld c s v t o o l s p a c k a g e b y th e sam e
a u th o r, d a t a t o o l is a c tu a lly a c o lle c tio n o f se v e ra l p a c k a g e s, all o f w h ic h re a d e x te rn a l files
a n d d is p la y th e m in so m e fo r m o r a n o th e r - a s ta b le , p ie c h a rt, o r fu n c tio n g ra p h . A ll d a ta
sets a re re a d lin e b y lin e a n d m u s t h a v e a c o n s is te n t se p a ra to r, w h ic h c a n be sp ec ifie d b y th e
user.
In th e s ta n d a r d case, th e e x te r n a l file c o n ta in s a c o m m a -s e p a ra te d list. A d d itio n a lly ,
in d iv id u a l e n tr ie s c a n b e e n c lo s e d in q u o te s i f th e y c o n ta in a c o m m a th e m s e lv e s , a s c a n b e
s e e n in th e s e c o n d lin e o f th e fo llo w in g d a ta set. T h e firs t lin e o f a d a ta s e t m u s t c o n ta in
id e n tifie rs fo r th e in d iv id u a l c o lu m n s, w h ic h m a y th e n b e re fe re n c e d w ith \D T L fo r e a c h .

givenN am e, su rn a m e , p a s s p o rtN o , age


H annes, "W ader, s e n . " ,1 0 2 6 8 9 ,6 8
J a n e , A u s te n ,1 0 2 6 4 7 ,7 5
Jam es, Brown,1 0 3 5 6 9 ,4 2
J a n a , V o ss,1 0 5 4 8 8 ,2 6
R o g e r, D a l t r y ,1 0 6 8 7 2 ,5 8
C l a i r e ,W a ld o ff,1 0 4 3 5 6 ,4 5
F e l i x ,V o s s ,513110,29

\D T L lo a d d b { lis t o f d a ta } { f il e n a m e }
\D T L f o r e a c h * [c o n d itio n ] { lis t o f d a ta } { id e n tif ie r lis t} { ta b l e row}

58
2.8 datatool

given name surname age \usepackage{datatool}


Hannes Wader, sen. 68
\DTLloaddb{list}{dataO. csv}
Jane Austen 75
\begin{tabular}{llc}
James Brown 42 \b fseries given name & \b fseries surname
Jana Voss 26 & \b fseries age
Roger Daltry 58 \DTLforeach{l i s t }{\givenName=givenName,
Claire Waldoff 45 \surname=surname,\age=age}{%
Felix Voss 29 \ \ \givenName & \surname & \age}
\end{tabular}

The starred version works faster, so is better for larger data sets, but it provides the
data read only, allowing no changes to the individual entries. The first required argument
of \DTLforeach expects the logical file name, the second one specifies the assignment of
individual columns to macro names, and the last argument specifies the formatting of an
individual row in the table. The double backslash can be inserted before or after the new
row. We can number the individual rows easily with the internal counter DTLrowi; it can be
queried in the usual way and also used for labels. This allows it to reference the individual
rows of the table.

no given name surname age \usepackage{datatool}


1. Hannes Wader, sen. 68 \DTLloaddb{list}{data0.csv}
2. Jane Austen 75
\begin{tabular}{cllc}
3. James Brown 42 \emph{no} & \emph{given name} &
4. Jana Voss 26 \emph{surname} & \emph{age}
5. Roger Daltry 58 \DTLforeach{list}{\givenName=givenName,
6. Claire Waldoff 45 \surname=surname, \age=age}{%
7. Felix Voss 29 \lab el{tab :\surname}\\ \theDTLrowi.
The entry for James Brown can be found in & \givenName & \surname & \age}
row 3 of the table and the one for Claire in \end{tabular}\par
row 6. The entry for James Brown can be found in
row~\ref{tab:Brown} of the table and the
one for Claire in row~\ref{tab:Waldoff}.

You can then reference items in the usual way with the \ r e f command. You must
add the label before the line break \ \ to keep the reference to the internal command
\ r e f stepcounterDTLrowi; all counters are set at the beginning of the argument table row
(cf. syntax of the command). The counters are assigned to the elements of identifier list and
similar to the normal list denoted with consecutive lowercase Roman numerals. The first one
is DTLrowi, the second one DTLrowii, etc.

\DTLisopenbetween {list}{start symbol}{end symbol}


\DTLif oddrowf true} {false}
\D T L iffirstrow {true}{false}

The optional argument of \DTLforeach can be used to specify a condition for filtering entries;
for example each person whose surname starts with “W”. The \DTLisopenbetween command

59
P a ck a g e s

defines the region for which the list of data is “open”; the start is inclusive and the end is
exclusive.

no given name surname age \u s e p a c k a g e { d a ta to o l} \D T L lo a d d b { lis t} { d a ta 0 .c s v } .


j 02-08-3
1. Hannes Wader, sen. 68
\b e g i n { t a b u l a r } { c l l c }
2. Claire Waldoff 45
\emph{no} & \em p h {g iv en name} &
\em ph{surnam e} & \em ph{age}
\D TLforeach[\D TLisopenbetw een{\surnam e}{W }{X }]%
{ list} { \g iv e n N a m e= g iv en N am e,
\su rn am e= su rn am e, \a g e = a g e } { \\
\th e D T L ro w i.&\givenNam e&\surname& \age}
\e n d { ta b u la r }

no given name surname age \u s e p a c k a g e { d a ta to o l}


1. Hannes Wader, sen. 68 \u s e p a c k a g e [ ta b le ] { x c o lo r }
2. Jane Austen 75
\D T L lo a d d b { lis t} { d a ta O .c s v }
3. James Brown 42
\b e g i n { t a b u l a r } { c l l c }
4. Jana Voss 26 \emph{no} & \em p h {g iv en name} &
5. Roger Dal try 58 \em ph{surnam e} & \em ph{age}
6. Claire Waldoff 45 \DTLfo re a c h flist} { \g iv e n N a m e = g iv e n N a m e ,
7. Felix Voss 29 \su rn am e= su rn am e, \a g e = a g e } { \\
\DTLifoddrow%
{ \ro w c o lo r { b la c k !2 0 } } { \ro w c o lo r{ b la c k ! 40}}
\th e D T L ro w i.&\givenNam e&\surname& \age}
\e n d { ta b u la r }

The \D TLifoddrow command helps you create a “double” table, by inserting a line break
\ \ or a column separator & depending on the row. The order is important here; first, the
missing line break for the header must be created. The counting of rows is done the same
way as the data list; the first line contains the column identifiers (cf. the data set on page 58).

\u s e p a c k a g e { d a ta to o l} \D T L lo a d d b { lis t} { d a ta 0 .c s v }

\b e g in { ta b u la r} { c llc @ { \q q u a d } c llc }
\emph{no} & \em ph{given name} & \em ph{surnam e} & \em ph{age} &
\emph{no} & \em ph{given name} & \em ph{surnam e} & \em ph{age}
\D T L fo reach { list} { \g iv e n N am e = g iv en N a m e, \su rn am e= su rn am e, \age=age}%
{\D T L ifoddrow {\\}{& } \th eD T L ro w i. & \givenN am e & \su rn am e & \a g e }
\e n d { ta b u la r }

no given name surname age no given name surname age


1. Hannes Wader, sen. 68 2. Jane Austen 75
3. James Brown 42 4. Jana Voss 26
5. Roger Daltry 58 6. Claire Waldoff 45
7. Felix Voss 29

Use \D T L iff ir s tr o w for example to insert a horizontal line after the first row.

60
2.8 datatool

no given name surname age \usepackage{datatool}


1. Hannes Wader, sen. 68 \DTLloaddb{list}{dataO. csv}
2. Jane Austen 75 \begin{tabular}{cllc}
3. James Brown 42 \emph{no} & \emph{given name} &
4. Jana Voss 26 \emph{surname} & \emph{age}
5. Roger Daltry 58 \DTLforeach{list}{\givenName=givenName,
6. Claire Waldoff 45 \surname=surname,\age=age}{%
7. Felix Voss 29 \D T L iffirstrow {\\\hline}{\\}
\theDTLrowi.&\givenName&\surname&\age}
\end{tabular}

Another interesting feature of the d atatool package is its ability to sort the data rows.

\DTLsort * [sorting order] {sorting criteria} {list of data}

The optional specification of the sorting order is only interesting in the case where the actual
sorting criteria fails because there is no corresponding entry in the column of the list of data,
similar to a null entry in a SQL database. In the following example, we are sorting primarily
on age in descending order; the optional specification of descending sorts in descending order
while ascending sorts in the default ascending order, surname is given as an alternative sorting
order to the age sorting criteria.

given name surname age \usepackage{datatool}\DTLloaddb{list}{dataO.csv}


Jane Austen 75
\DTLsort[surname]{age=descending}{list}
Hannes Wader, sen. 68
\begin{tabular}{@{}cllc@{}}
Roger Daltry 45 \emph{no} & \emph{given name} &
Claire Waldoff 45 \emph{surname} & \emph{age}
James Brown 42 \DTLforeach{list}{\givenName=givenName,
Felix Voss 29 \surname=surname, \age=age}{%
Jana Voss 26 \D T L iffirstrow {\\\hline}{\\}
\theDTLrowi.&\givenName&\surname&\age}
\end{tabular}

When using \DTLsort to sort, whether text is upper- or lowercase does matter. However,
in the starred version all strings are converted to lowercase before sorting, so then case doesn’t
matter.

given name surname age \usepackage{datatool}\DTLloaddb{list}{dataO. csv}


Jane Austen 75
\DTLsort*{surname}{list}
James Brown 42 \begin{tabular}{@{}cllc@{}}
Roger Daltry 58 \emph{no} & \emph{given name} &
Jana Voss 26 \emph{surname} & \emph{age}
Felix Voss 29 \DTLforeach{list}{\givenName=givenName,
Hannes Wader, sen. 68 \surname=surname,\age=age}{%
Claire Waldoff 45 \D T L iffirstrow {\\\hline}{\\}
\theDTLrowi.&\givenName&\surname&\age}
\end{tabular}

61
Packages

The functionality of the d a ta to o l package is much larger than what we can present here.
You can find many further examples in the documentation of the package. [53]

2.9 e a sy ta b le
The e a s y ta b le package by Enrico Bertolazzi provides a simplified method for drawing tables.
The package is part of the ea sy package series and automatically loads the main ea sy package.
The general line width is set when loading the package, but there are two package options -
t h i n l i n e s and t h ic k lin e s . The default values for these options are shown in Figure 2.4 on
the next page. If you get the KTeX error message “no room for a new dimen” when loading
etex additional packages, you need to load the e t e x package, which allows for more than the usual
dimension registers.

Figure 2.1: Specification of the line width through the package option.

Option \@tab@size@rule \@tab@size@dash


th in lin e s 0.7 pt 0.5 pt
t h ic k lin e s 1.5 pt 1.2 pt

The e a s y ta b le package provides a simplified version of the ta b u la r environment with


its TAB environment, though it also offers some additional functionality. The syntax takes
some getting used to:

\begin{TAB }^ typ e ,xMiniyM in ) [margin,xMin,yMin] {co lu m n s}{ro w s}

type ,xMin,yMin Must be one of the following values:


@ No effect.
r Equal row heights.
c Equal column widths.
b Equal row heights and column widths.
e Equal row heights and column widths (identical values).
The optional values xMin, yMin enforce a minimum size of the box and
have to be specified as a length with a TgC unit, for example 10pt,30pt.
margin ,xMin,yMin Optionally specifies the outer margin of the individual cells, similar
to \ f boxsep, and defaults to 2pt. The additional optioned arguments
xMin, yMin specify the minimum size of the whole table, for example
10cm,5cm.
columns These are the default column definitions of ETeX; they may only take
the three standard values 1, c, and r, however.
rows The alignment of the rows must be specified here; possible values are
c, t, and b. The number of rows m ust be fixed at the beginning of the
environment, or changed afterwards if the number of rows increases.
Internally the maximum number of columns and rows is fixed to 30.

62
2.9 easytable

e a s y ta b le uses different syntax for horizontal lines, so it can’t be used together with the no \hlin e
booktabs package. jl and no
\ c lin e
When you want to format columns and rows uniformly, e a s y ta b le offers clear advantages.
The following example creates a table with quadratic cells, achieved by assigning column type
with value e. Within these cells, the cells and rows are aligned according to the specifications
lr c and ctb. Not having the \ h l i n e and \ c l i n e commands available is no restriction; you
can set up the horizontal lines in the row formattin definition with the same notation as for
vertical lines in column definitions.
\usepackage[thinlines]{easytable}
1 r c i r c
AA BB tt \begin{TAB}(e){lrc}{ctb}
AA BB tt
1 & r &c \ \
AA &BB &t t \ \
1 r b i r b 1 & r &b
\end{TAB}\qquad
\begin{TAB}Ce){ | 1 | r | c | } { | c | t | b | }
1 & r & c\\AA & BB & t t \ \ l & r & b
\end{TAB}
The example above shows that the format specification for the row always applies to all
columns of a table. In the first row only the 1 can be vertically centred correctly; r and c do
not have an upper length like the 1, so are not centred vertically.
\usepackage[thinlines]{easytable}
\fbox{%
\begin{TAB}(e, 12pt,12pt) [ 5pt,2 .5cm,2 .5cm]{1:r :c }{c:t :b}
1 &r &c \ \
AA &BB &tt \ \
1 &r &b
\end{TAB}}

Horizontal and vertical lines don’t need different commands or symbols for their own
syntax anymore. The syntax provided by the TAB environment treats columns and rows the
same; all lines can, and must, be specified with the same symbols. The symbols listed in
Table 2.4 are valid for lines.
Table 2.4: Summary of
sym bol description sym bol description
the symbols for horizontal
i solid line dashed line and vertical lines.
» dash-dot line dotted line
0 like | , Vs of the width 1 like | , V4of the width
2 like | , V3of the width 3 like | , V4of the width
4 like | 5 like | , double width
6 like | , triple width 7 like | , quadruple width
8 like | , quintuple width 9 like | , sextuple width

You can’t insert partial lines in the TAB environment, but environments can be nested
arbitrarily, which can be used to achieve the same effect:
2 Packages

r \usepackage[thicklines]{easytable} r-------
| 02-09-3
1 r c
\begin{TAB}(e){ ;l r c ;}{;ctb;}
;b b ; 1 &r & c \\
AA tt AA & \begin{TAB}(e){ . r . } { .t . }BB\end{TAB} & t t \ \
1 &r &b
i r b \end{TAB}\\[\medskipamount]
\begin{TAB}(@)[10pt]{01r0}{0tt0}
\begin{TAB}(@){ : l r :}{:c t :}
1 & r \ \ AA & BB
\end{TAB} &
\begin{TAB}(@){lcl}{2bb2}
c \\tt
\end{TAB}\\
\begin{TAB}(@){lr}{c}
1 &r
\end{TAB} & \begin{TAB}(@){ . c .} { . c .} b \end{TAB}
\end{TAB}

2.10 h h lin e
The h h lin e package by David Carlisle extends the standard line commands. The blkarray
package by the same author was presented earlier in Section 2.4 on page 38; it also provides
line extensions, partly with the same syntax, h h lin e defines the command of the same name,
which expects only one parameter:

\h h l i n e {lin e definition}

The symbols listed in Table 2.5 are valid for lines.

Table 2.5: Symbols for creating the line ^ m e a n in g


styles for rows, columns, and cells. ----------------------------------------------------------------------------------------------------------
A single line of column width.
= A double line of column width.
~ A column without line.
| A vertical line that intersects double horizontal lines.
: Ditto, but not intersecting double horizontal lines.
# A single line between two vertical ones.
t The upper half of a double horizontal line,
b The lower half of a double horizontal line.
* Repetition operator; *{3}{==#} expands to ==#==#==#,
similar to the definition of multiple equal column types.

The following example can be understood with the help of the very elaborate explanations
for Example 02-04-10 on page 44; no further explanations will be provided here.

64
2.11 m a k e c e ll

\usepackage{hhline}
0 1 2 3 4 5
0 1 2 3 4 5 \begin{tabular}{11 c | | c | cc 1 1 c c ||}
0 1 2 3 4 5 \h h lin e { |t:=:t :=|==#==:t | }
0 & 1 & 2 & 3 & 4 & 5 \\\h lin e
0 1 2 3 4 5
0 & 1 & 2 & 3 & 4 & 5\\\hhline{======}
0 1 2 3 4 5 0 & 1 & 2 & 3 & 4 & 5 \ \ \h h li n e { ||- |I - .. | | .-}
0 & 1 & 2 & 3 & 4 & 5\\\h h lin e{= ::=—::-=}
0 & 1 & 2 & 3 & 4 & 5 \\\h h lin e{|b := :b:=— : :— = :b | }
\end{tabular}

2.11 m akecell
The m ak ecell package by Olga Lapko is particularly suitable for formatting individual table
cells separately. In principle, the functionality of all the special commands that this package
provides can be achieved with commands from other packages as well.

\m akecell * [column/row type] {cell contents}

The name of the command already indicates that it is designed for the formatting of an
individual cell. The parameter for the horizontal alignment may take any value allowed
by the array package: 1, c, r, p, m, and b. The last three expect a separate parameter for
the column width, so they must be enclosed in parentheses again, for example {p{4cm}}
or { > { \ t t f amily}m{4em}}. The mandatory parameter for the horizontal alignment maybe
empty ({}) but must be specified. For the vertical alignment, the usual three values b, c, and t
are allowed, \m akecell creates a cell which consists of a single-column table. If the optional
values are missing, the contents are centred horizontally and vertically. The starred version of
\m akecell adds the vertical space l\jot=3.0p t before and after the current cell. The order of
the parameter values doesn’t matter.

1 st without parameter \usepackage{makecell}


02-11-1
without parameter \begin{tab u lar}{|c|c|}\h line
2nd
but on two lines 1 st& \makecell{without parameter} \\\h lin e
3rd horizontal left 2nd & \makecell{without parameter\\
horizontal but on two lin e s}\\\h lin e
4th 3rd & \makecell[l]{horizontal le ft} \\\h lin e
left
5th horizontal right 4th & \m akecell[l]{horizontal\\ le ft} \\\h lin e
5th & \makecell[r]{horizontal right} \\\h lin e
horizontal
6th 6th & \m akecell[r]{horizontal\\ rig h t}\\\h lin e
right \end{tabular}\\[5pt]
7th fixed width \begin{tab u lar}{|c|c|}\h line
7th & \makecell[{}{p{3cm}}]{fixed width} \\\h lin e
fixed
8th 8th & \makecell[{}{p{3cm }}]{fixed\\width}\\\hline
width
\end{tabular}

65
Packages

without parameter \usepackage{makecell}


1 st 02-11-2
2nd vertical top \begin{tab u lar}{|c|c|}\h line
3rd vertical 1 st & \makecell{without parameter} \\\h lin e
top 2 nd & \m akecell[t]{vertical top} \\\h lin e
4th vertical bottom 3rd & \m ak ecell[t]{vertical\\ top} \\\h lin e
vertical 4th & \m akecell[b]{vertical bottom} \\\h lin e
5th bottom 5th & \m akecell[b]{vertical\\ bottom}\\\hline
\end{tabular}

1 st without parameter \usepackage{makecell}

2nd vertical top \begin{tabular}{|c | c |}\h lin e


horizontal left 1 st & \makecell{without parameter}\\\hline
2 nd & \m akecell*[tl]{vertical top \\
3rd vertical top
horizontal le ft } \\\h lin e
horizontal right 3rd & \m akecell[tr]{vertical top \\
vertical bottom horizontal rig h t}\\\h lin e
4th horizontal left 4th & \m akecell*[bl]{vertical bottom\\
horizontal le ft } \\\h lin e
vertical bottom
5th & \m akecell[br]{vertical bottom\\
5th horizontal right horizontal rig h t}\\\h lin e
\end{tabular}

In contrast to \m a k ecell, the \th e a d command uses predefined values to format headers
of a table.

\th ead [column type] {text} \rothead {text} \th ea d f ont text

Title for \usepackage{makecell} r--------


column 2 column 3 | 02-11-4
column 1
\begin{tabular}{ccc}
A vertical top B \thead{Title for\\column 1}
horizontal left & \thead[l]{column 2}
C vertical top RIGHT & \thead[r]{column 3} \\\h lin e
horizontal right A & \m akecell*[tl]{vertical top \\
horizontal le ft } & B\\
C & \m akecell[tr]{vertical top \\
horizontal right} & RIGHT \\\h lin e
\end{tabular}

The optional parameter only affects the horizontal alignment; everything else is deter­
mined by the following commands:

\ c e l l s e t { definition} \ c e l l a l i g n {horizontal/vertical column type}


\cellro ta n g le{fln g/e} \th e a d a lig n {horizontal/vertical column type}
\th ea d fo n t {font size macro} \th e a d se t{ definition}

66
2.11 makecell

The package defines the following default values for the individual commands, but you
can of course use \renewcommand to modify them:

\newcommand\cellset{\def\arraystretch{l}\extrarowheight\z@\nomakegapedcells}
\newcommand\cellgape{}
\newcommand\cellalign{cc}
\newcommand\cellrotangle{90}
\newcommand\theadfont{\footnotesize}
\newcommand\theadset{}
\newcommand\theadgape{\gape}
\newcommand\rotheadgape{}
\newcommand\theadalign{cc}
\newcommand\bottopstrut{\gape{\strut}}
\newcommand\top stru t{\g a p e [t ] { \ s t r u t } }
\newc ommand\bot s t r u t {\g a p e[b] { \ s t r u t }}

The individual commands execute the respective commands listed below:


\m a k ece ll \c e lla lig n \c e lls e t
\th e a d \t h e a d a lig n \c e lls e t \t h e a d f o n t \t h e a d s e t
\r o th e a d \ c e l l s e t \t h e a d f o n t \t h e a d s e t
The following example specifies new values for \ c e l l a l i g n , \th e a d a lig n , and
\th e a d fo n t. The changes were made globally, which is recommended for the title row. All
cells are formatted with I t (left/top) and the captions with lb (left/bottom).

Title for \usepackage{makecell}


co lu m n 1 co lu m n 2 co lu m n 3
\renewcommand\cellalign{lt}
A vertical top B \renewcommand\theadalign{lb}
LEFT \renewcommand\theadfont{\itshape\small}
\begin{tabular}{@{}ccc@{}}
C vertical top RIGHT
\thead{Title for\\column 1}
LEFT
& \thead{column 2}
& \thead{column 3} \\\h lin e
A & \makecell*{vertical top\\LEFT} & B\\
C & \m akecell{vertical top \\ LEFT}
& RIGHT \\\h lin e
\end{tabular}

For rotated captions, you m u s t specify the height of the text beforehand by assigning a
length to \r o th e a d s iz e . This is easy to do with the \s e tt o w id t h command, by passing it ^ l o a d
the longest line in the desired font. If \r o th e a d s iz e is not assigned a length, 0pt is assumed -5- rotating
automatically, which leads to output that makes no sense. The rotation angle is specified by PackaSe
\c e l l r o t a n g l e , which can be changed with \renewcommand. If the r o t a tin g package were
not loaded for the rotation, a warning would be written to the log file.

67
Packages

\usepackage{makecell,rotating} ,--------
[ 02-11-6
^ I \renewcommand\cellalign{lt}
+2 ^
H o column 2 \renewcommand\theadalign{lb}
\renewcommand\theadfont{\itshape\normalsize}
A \settowidth\rotheadsize{\theadfont T itle for}
■a B
\begin{tabular}{@{}ccc@{}}\hline
3<D oe gW \rothead{Title for\\column 1}
> & hJ
& \thead{column 2}
C vertical top RIGHT & \renewcommand\cellrotangle{45}
LEFT \rothead{column 3} \\\h lin e
A & \ro tc ell{v e rtic a l top\\LEFT} & B\\
C & \makecell*{vertical top \\ LEFT}
& RIGHT \\\h lin e
\end{tabular}

2 . 11.1 Cell size


You can move the contents of individual table cells up and down with respect to the base line
with the standard \r a is e b o x command. However, the m ak ecell package simplifies the task
by defining two special commands for vertical translations.

\g a p e [position] {te x t}
\Gape [height] [depth] {te x t}

The \g a p e command is the same as \sm ash from the amsmath package and changes the
vertical size of the box of text. Without arguments, the depth as well as the height of the
box are increased by \jot= 3.0p t. The optional argument can take the values b and t; b adds
size only to the depth of the box and likewise t adds size only to the height of the box. The
respective other length is minimized so that text just fits the box.

\usepackage{makecell}
\rule{lem}{0.5pt}\fbox{good text}\rule{lem}{0.5pt}\fbox{\gape{good text}}%
\rule{lem }{0. 5pt}\fbox{\gape[b]{good text}}\rule{lem }{0. 5pt}
\fbox{\gape[t]{good text}}\rule{lem }{0.5pt}

__|good text]__good text__Igood text]__[good texl 02-11-7 |

While \g a p e translates the box taking its current size into account, you can make individ-
iual adjustments with \Gape:

\usepackage{makecell}
\rule{lem}{0.5pt}\fbox{good text}\rule{lem}{0.5pt}\fbox{\Gape{good text}}%
\rule{lem}{0.5pt}\fbox{\Gape[5pt]{good text}}\rule{lem }{0.5pt}
\fbox{\Gape[5pt][-5pt]{good text}}\rule{lem }{0.5pt}

68
2.11 makecell

I02-11-8 __[good text)__good text__good text

So using \g a p e and \Gape lets you change the depth and height of one cell, but the
following commands let you do this for one or all of the cells of a row or the whole of a table.

\b o t to p s tr u t
\t o p s t r u t
\b o t s t r u t
\s e t c e l l g a p e s [position] { length }
\m ak egap ed cells
\nom akegapedcells

The first three commands increase the default value for \ s t r u t by \jo t= 3 .0 p t respectively,
either for depth and height (\b o tto p s tr u t), only the depth (\b o ts tr u t), or only the height
(\to p s tr u t).

normal row \usepackage{makecell}


top and bottom \begin{tabular}{@{}c@{}}\hline
normal row \\\hline
only bottom
\bottopstrut top and bottom\\\hline
only top \botstrut only bottom\\\hline
\topstrut only top \\\h lin e
\end{tabular}

\ s e t c e l l g a p e s lets you adjust the height and/or depth of all cells of a table by a man­
ually chosen length. If you don’t use an optional parameter (b or t), both the height
and depth are increased by the specified length. The two switches \m ak egap ed cells and
\nom akegapedcells activate and deactivate the additional insertion of vertical space.

\usepackage{makecell}
02-11-10 normal row
\setcellgapes{5pt}\makegapedcells
top and bottom
\begin{tabular}{@{}c@{}}\hline
top and bottom normal row\\\hline
top and bottom\\\hline
top and bottom\\\hline
normal row \end{tabular}\\[10pt]
top and bottom \nomakegapedcells
top and bottom \begin{tabular}{@{}c@{}}\hline
normal row \\\hline
top and bottom\\\hline
top and bottom\\\hline
\end{tabular}

69
Packages

2 .1 1 .2 M u l t i - l i n e c e l l s
The \m u ltirow command, already described in Section 2.3 on page 30, is reimplemented by load
the m ak ecell package through two of its own commands. It does however use other internal f m ultirow
package
commands of the m ultirow package, which therefore has to be loaded as well.

\m u ltir o w c e ll{ rows} [vertical shift] [p os].{ text}


\m ultirowhead{rows} [vertical shift] .[pos] {te x t}

The behaviour of these two commands is similar to \m a k ece ll and \th ea d , as shown in
Example 02-11-6 on page 68.

\usepackage{multirow,makecell}
\begin{tabular}{ 1 c c } \h lin e
\multirowthead{4}{First column head}
& \multicolumn{2}{c}{\thead{Multi-column h ea d }}\\\clin e{2 -3 }
& \thead{Second and\\m ulti-line\\colum n head} & \thead{Third\\column h ea d }\\\h lin e
c e ll tex t & A &\multirowcell{4}{28—3 1 } \\ \c lin e { l- 2 }
\m akecell{m ulti-line \ \ c e ll te x t} & B & \ \ \h lin e
\m a k e c e ll[l]{le ft-a lig n e d \ \ c e ll te x t} & C
& \m u ltirow cell{4}[ . 5\norm albaselineskip][1]{37—4 3 } \\\c lin e { l-2 }
\m ak ecell[r]{righ t-align ed \ \ c e ll te x t} & D & \ \\h lin e
\m akecell[b]{bottom -aligned \ \ c e ll te x t} & E
& \m u ltirow cell{6}[\norm albaselineskip][r ]{37—43 \\52—5 8 } \\\c lin e { l-2 }
\m akecell[{{p{5cm }}}]{long long long c e ll text with fixed width} & F & \\ \c li n e { l - 2 }
\m ak ecell[{{> {\setlen gth \p arindent{lem}}p{5cm}} } ] { long long long
c e ll tex t with fixed width} & G & \ \\h lin e
\end{tabular}

Multi-column head

First column head Second and


Third
multi-line
column head
column head
cell text A
multi-line
B 28-31
cell text
left-aligned
C
cell text
37-43
right-aligned
D
cell text
bottom-aligned
cell text E
long long long cell text with fixed 37-43
F
width 52-58
long long long cell text with
G
fixed width

70
2.11 m a k e c e ll

\usepackage{booktabs, m ultirow ,m akecell}


\renewcomm and\theadfont{\itshape\footnotesize}
\begin{tabular}{@ {}llr@ {—}rrlr@ {—}rrl@ {}}\toprule
& \m ulticolum n{8}{l}{\thead{to convert}} & \\\cm idruleC lr){2-9}
& \multicolumn{4}{l}{\thead{from fre q u e n c ie s in the}}
& \m ulticolum n{4}{l}{\thead{to fre q u e n c ie s in the}}\\
\ c m id ru le (lr){ 2 -5 } \ c m id ru le (lr){ 6 -9 }
\th ead [b ]{typ e} & \ th e a d [t]{ te le v isio n \ \ ra n g e } & \m ulticolum n{2}{l}{\thead{channel}}
& \thead{MHz} & \ th e a d [t]{ te le v isio n \ \ ra n g e } & \m ulticolum n{2}{l}{\thead{channel}}
& \thead{MHz} & \ th e a d [t]{ c o n fig u ra tio n } \ \ \ c m id ru le(r){ l-l} \ c m id ru le (lr){ 2 -2 }
\ c m id ru le (lr){ 3 -4 } \ c m id ru le (lr){ 5 -5 } \ c m id ru le (lr){ 6 -6 } \ c m id ru le (lr){ 7 -8 }
\ c m id ru le (lr){ 9 -9 } \ c m id ru le (l){10-10}
SAFE 381 WK& F I & 2 & 4 & 174 & F I I I & 5 & 12 & 174 & DO\\
SAFE 382 WK& F II & 5 & 12 & 68 & F I & 2 & 4 & 47 & DO\\
SAFE 383 WK& F I I I & 21 & 38 & 174 & F I I I & 5 & 12 & 174 & ES \\
SAFE 384 WK& F IV & 42 & 48 & 47 & F I I I & 5 & 12 & 174 & ET \\\bottomrule
\end{tabular}

to con vert

fr o m fr eq u en cies in the to freq iu encies in the

type television ch a n n el MHz television chan nel MHz configuration


ran ge ran ge

S A FE 381 W K FI 2- 4 174 F ill 5 - 12 174 DO


S A FE 382 W K F II 5 - 12 68 FI 2- 4 47 DO
S A FE 383 W K F ill 2 1 -3 8 174 F ill 5 - 12 174 ES
S A FE 384 W K F IV 4 2-4 8 47 F ill 5 - 12 174 ET

2 .1 1 . 3 Column numbering
You can also use the m a k e c e ll package to autom atically number columns, using the \ n l i n e
command; \ e l i n e lets you skip a specified number of columns. You can choose the numbering
format through the optional argument t y p e , w hich can make use of the common KTj?X formats:
a r a b ic (6), a lp h (f), A lp h (F), roman (vi), and Roman (VI).

\ e l i n e { c o lu m n s }
\ n l i n e [type] [start] { c o l u m n s }
\ r n l i n e [type] [start] { c o lu m n s }

\ r n l i n e is sim ilar to \ n l in e , except that the counting is done w ith C y r illic symbols.

71
Packages

1 2 4 6 8 9 10 \usepackage{makecell} ,-------
3 5 7 102-11-
2 A z \begin{tabular}{@{}c|*{9}{c}@ {}}
3 1 2 1 2 1 & \n lin e [ l] [ 2 ] { 9 } \\\h lin e
4 S4 S5 S6 S7 S8 S9 S 10 S ll S 12 2 & A & \e lin e {7 } & Z \\
5 (2) (3) (4) (5) (6) (7) 3 & \n lin e{2 } & \e lin e {5 } & \n lin e { 2 } \\
6 4 5 6 4 & \n lin e [ S l] [4]{9} \ \
5 & \n lin e [ ( a ) ] [ 2 ] { 6 } \\
6 & \e lin e {4 } & \ n l i n e [ l ] [4]{3}
\end{tabular}

2 . 12 m d w t a b
The mdwtab package by Mark Wooding is part of a whole series of mdwtools. The package is
not an extension of the standard ta b u la r and array environments as such, but reimplements
them from scratch. Therefore you might encounter problems when using mdwtab in con­
junction with other packages that extend these two environments, but assume the standard
definition.
Here are the main differences in how the environments work:
> A major innovation is the way the column definitions are read and interpreted. You can
use an expression like { I@{} I } in standard IfipX, but not when using mdwtab. The “abuse”
of ©{} to avoid \d o u b le r u le se p between two vertical lines is explicitly forbidden. If you
tried to use it, you would get this error message:

! Package mdwtab Error: Missing column type.


See the mdwtab package documentation for explanation.

On the other hand, constructs like {c@ * {4 }{{: }@ }{-}c} are allowed when using mdwtab.
This particular example expands to the expression {c@ {: }©{: }©{: }©{: }@ {-}c}.
> If a © expression follows a vertical line, it refers to the next column and not the current one.
> mdwtab defines some new column types in addition to the usual ones:
Ml, Me, Mr Mstands for Math and denotes columns with mathematical expressions;
1, c, and r have the usual meaning.
Tl, Tc, Tr The same for pure text.
# {p r e } {p o s t } User-defined column type that can be specified additionally through pre
(code before cell) and post (code after cell).
Several new commands are available in mdwtab:

\ta b p a u se{tex i} \ v l i n e [length] \v g a p .[length] \h lx {a rg u m e n ts}

\ta b p a u se provides an easy way to break a table in order to draw lines or insert text across all
columns, without having to use the \m u lticolum n command. The text is typeset in paragraph
mode, so line breaks are possible. You can use \ v l i n e with an optional argument to insert a
vertical line of specified width, \vgap inserts vertical space at any arbitrary position on a table

72
2.12 mdwtab

row, though using \ h l x is more effective; this command is discussed in more detail below.
In the following example, the column type is set to Me, which means that the mathematical
expressions don’t have to be enclosed in $ ... $. However, this has no effect on the argument
of \ta b p a u se, which is always typeset in text mode.

\usepackage{mdwtab}
e q u a tio n s
\b egin {tab u lar}!!{\vlin e[3pt]}l@ {\qu ad }|M c|}\hlx{sh v[l, 2]}
& eq u a tio n s\\\h lx {v [l][1 0 p t]h v [][5 p t]}
1st f(x) = ^ r lst& f(x )= \fr a c {\sq r t{x A2- l} } { x A2+l> \\\h lx {v h v }
2nd fix) = 2nd& f(x )= \fr a c {\sq r t{x A2- l} } { x A2+ \fr a c{l}{x A2}}\\\h lx{vh >
\tabpause{Now the same equations\\
again!}\hlx{hv}
Now the same equations 3rd& f(x )= \fr a c {\sq r t{x A2 -l} } { x A2+l> \\\h lx {v h v }
again! 4th& f(x )= \fr a c {\sq r t{x A2 -l} } { x A2 + \fra c{l}{x A2}}\\\h lx{vh >
\end{tabular}
3rd fix) - ^

4th fix) =

The special line command \ h l x (\h lin eexten d ed ) lets you manipulate the row spacing
without any additional commands. The following arguments are available for \h lx :

h Effect like \h lin e ; several h correspond to as many \ h l i n e commands.


v [line] [H] Inserts a vertical space of H; all vertical lines, apart from the ones specified,
are extended accordingly. If the optional specification of the height is
missing, \d o u b le r u le se p = 2.0pt is assumed. In the example above, the
command \ h l x { v [ l ] [ 10p t]h v [] [5 p t]} means that a vertical space of
10pt is inserted on top o f the tabular row and the vertical line no 1 is not
stretched. The the horizontal line is drawn with a following vertical space
o f 5 pt and all vertieval lines are stretched. The vertical lines are counted
from 0to n (number of columns). Several lines can be excluded by giving a
comma-separated list, a from-to specification, or both.
s [H ] Like the option v, but without extension of the vertical lines.
c [from-to] Similar to \ c l i n e .
b Adds a negative horizontal feed (backspace) of the line width; usually only
required for the lo n g ta b le environment.
/ [number] Similar to the normal \pagebreak [ number] command, where number spec­
ifies the priority of the page break.
Starts a new table row immediately afterwards and is only required in special
cases. You can’t place a table-specific command like \ h l i n e immediately
after the dot.

In Example 02-12-1, the individual arguments, which always must be interpreted one after
the other, have the following meaning:

73
Packages

s h v [ l , 2] vertical space without extending the lines, \h lin e , vertical space,


do not extend line number 1 and 2
v [ l ] [1 0 p t]h v [] [5 p t] vertical space o f lOpt without extending line 1, \h lin e , vertical
space of 5pt
vhv vertical space, \h l i n e , vertical space
vh vertical space, \ h l i n e
hv \h l i n e , vertical space
vhv vertical space, \h l i n e , vertical space
vh vertical space, \ h l i n e

When using mdwtab, the \newcolumntype command also has a different syntax. In
contrast to array, mdwtab allows an optional argument.

\newcolum ntype{ character} [number o f parameters] [default]


{ number o f columns} {colum n type} {contents}

\usepackage{mdwtab}
arbi- arbitrary text
\newcolumntype{P}[ 1 ] [ 2cm] {%
trary again
>{\raggedright\hspace{Opt}}p{#l}}
text
\begin{tabular}{| P[lcm] | P | }\hlx{hv}
arbitrary text & arbitrary text again\\\hlx{vh}
\end{tabular}

2 .1 3 s la s h b o x

The sla sh b o x package by Koichi Yasuoka provides support for divided cells. A common use
is to specify both a column label and a row label in the upper left cell of a table:

\usepackage{slashbox}
\usepackage{pict 2e}
\b e g in {ta b u la r}{l|* {5 }{c}}
\backslashbox{holiday}{year} & 2007 & 2008 & 2009 & 2010 & 20 1 1 \\\h lin e
Easter & 08.04. & 23.03. & 12.04. & 04.04. & 2 4 .0 4 .\\
Pentecost & 27.05. & 11.05. & 31.05. & 23.05. & 12.06.
\end{tabular}

year
h o lid a y ^ \^
2007 2008 2009 2010 2011
Easter 08.04. 23.03. 12.04. 04.04. 24.04.
Pentecost 27.05. 11.05. 31.05. 23.05. 12.06.

It’s a good idea to load sla sh b o x package together with the p ic t2 e package by Hubert
Gafilein and Rolf Niepraschk to produce better lines, sla sh b o x has two commands:

74
2.13 slashbox

\s la s h b o x [width] [position] {L tex t}{R text }


\b a c k sla sh b o x [width] [position] {L tex t}{R text }

The only difference between the commands is where the line is drawn: \s la sh b o x draws it
from the lower left corner to the upper right corner and \b a ck sla sh b o x from the upper left
to the lower right.

\usepackage{slashbox,pict 2e}
\b eg in {ta b u la r}{r|* {5 }{c }|1}
\backslashbox{holiday}{year}& 2007& 2008& 2009& 2010& 2011&
\slash b ox{year}{h olid ay}\\\h lin e
Easter & 08.04. & 23.03. & 12.04. & 04.04. & 24.04. & E aster\\
Pentecost & 27.05. & 11.05. & 31.05. & 23.05. & 12.06. & Pentecost
\end{tabular}

year year
h o li d a y ^ - ^ ^
2007 2008 2009 2010 2011
^ ^ ^ " ^ n olid ay
Easter 08.04. 23.03. 12.04. 04.04. 24.04. Easter
Pentecost 27.05. 11.05. 31.05. 23.05. 12.06. Pentecost

The arguments o f L text and R text are typeset in paragraph mode; therefore \ \ can be
used. This automatically makes the column wider however. Using the optional argument
for the width can make sense; it only has an effect if it is larger than the width calculated
internally. In the following example the specification o f 20 mm is not taken into account
because it is smaller than the calculated width.

\usepackage{slashbox,p ic t 2e}
\b eg in {ta b u la r}{l|* {5 }{c}}
\backslashbox[20mm]{two\\ holidaysH year} & 2007 & 2008 & 2009 & 2010 & 20 1 1 \\\h lin e
Easter & 08.04. & 23.03. & 12.04. & 04.04. & 2 4 .0 4 .\\
Pentecost & 27.05. & 11.05. & 31.05. & 23.05. & 12.06.
\end{tabular}

year
two 2007 2008 2009 2010 2011
holidays
Easter 08.04. 23.03. 12.04. 04.04. 24.04.
Pentecost 27.05. 11.05. 31.05. 23.05. 12.06.

\s la s h b o x and \b a c k sla sh b o x assume by default that the space \ta b c o ls e p is present


to the left and right o f the table. If the @{} operator is used when defining columns, the
resulting line is exactly \ta b c o ls e p too far to the left or right. However, you can use the two
optional arguments to correct this; they tell the command how much space is available. The
argument for the position may be 1 for left (i. e. there is no \ta b c o ls e p to the left), r for right,
or l r for both.

75
Packages

\usepackage{slashbox,p ic t 2e}
\begin{tab u lar}{|@ {}r|*{5}{c}|1@ {}|}\hlin e
\backslashbox[Opt] [ 1 ] {holiday}{year} & 2007 & 2008 & 2009 & 2010 & 2011
& \slash b ox[O p t][r]{year}{h olid ay}\\\h line
Easter & 08.04. & 23.03. & 12.04. & 04.04. & 24.04. & EasterW
Pentecost & 27.05. & 11.05. & 31.05. & 23.05. & 12.06. & P en teco st\\\h lin e
\end{tabular}

year year
2007 2008 2009 2010 2011
h o lid a y " ^ \^ ^ ^ ^ n o lid a y
Easter 08.04. 23.03. 12.04. 04.04. 24.04. Easter
Pentecost 27.05. 11.05. 31.05. 23.05. 12.06. Pentecost

2 .1 4 sp r e a d ta b

The spreadtab package by Christian Tellechea provides a simple spreadsheet and makes
it possible to sum numerical values in columns. The spreadtab environment replaces the
ta b u la r environment.

\b e g in {sp r e a d ta b } [settings] {{n a m e o f the table} {colum n definition}}


... table rows and columns...
\en d {sp rea d ta b }
\STautoroundnwmber o f digits

A table cell is uniquely identified by its row and column. The columns are designated by
[a..z] and the rows by [ 1 .]. The case is not significant for the column; more than 26 columns
are not possible. If a \m ulticolum n command is used, the combined cells are identified by
the identifier of the leftmost cell. The following diagram illustrates the structure:

al bl Cl dl el fi \b egin {tab u lar}!I*7{c|}}\h lin e


gl
al&bl&cl&dl&el&fl&gl\\\hline
a2 b2 d2 e2 f2 g2 a2&\multicolumn{2} { l|} { b 2}
a3 d3 e3 g3 &d2&e2&f2&g2\\\h lin e
\m ulticolum n{3}{|1 |}{a3}&d3&
\m ulticolum n{2}{l|}{e3}& g3\\\hline
\end{tabular}

You can apply the usual arithmetic operators to perform operations on the contents of
cells, as shown in the following example. Internally, the fp package is used; divisions can be
done with precision of up to 18 digits after the decimal point.

76
2.14 spreadtab

27 54 81 \usepackage{spreadtab}
58 45 13 \begin{spreadtab}{{tabular}{rr |r}}
50 25 1250 27 & 54 & al+bl \ \
60 47 1.276595744680851063 58 & 45 & a2-b2 \ \
135 146 0.924657534246575342 50 & 25 & a3*b3 \ \
60 & 47 & a4/b4 \\\h lin e
al+a2+a3 & bl+b2+b4 &a5/b5
\end{spreadtab}

However, visually it’s a good idea to use ; \STautoround command to limit the number
of digits after the decimal point, especially divisions.

27 54 81 \usepackage{spreadtab} \STautoround{3}
[()2-14-3
58 45 13 \begin{spreadtab}{{tabular}{rr |r}}
50 25 1250 27 & 54 & al+bl \ \
60 47 1.277 58 & 45 & a2-b2 \ \
135 146 281 50 & 25 & a3*b3 \ \
60 & 47 & a4/b4 \\\h lin e
al+a2+a3 & bl+b2+b4 &a5+b5
\end{spreadtab}

2 .1 4 .1 R e la t iv e r e f e r e n c e s t o t a b l e c e ll s
Starting from the current cell, relative cell addresses can be given through two numerical
values in square brackets. The specification [ - 1 ,3 ] denotes the cell that is one column to the
left and three rows down. Using this functionality means we can produce Pascal’s triangle by
specifying just one number; the m atrix math environment then determines the number of
columns automatically. In this case no column definitions are needed.

\usepackage{spreadtab, amsmath}
$\begin{spreadtab}{{m atrix}{}}
1\ \
[ 0, - 1 ] & [ - 1 , - 1 ] \ \
[ 0, - 1 ] &[ - l , - l ] + [ 0, - l ] &[ - 1 , - 1] \ \
[ 0, - 1 ] &[ - l , - l ] + [ 0, - l ] & [ - l , - l ] + [ 0, - l ] & [ - 1 , - 1 ] \ \
[ 0, - 1 ] &[ - l , - l ] + [ 0, - l ] & [ - l , - l ] + [ 0, - l ] & [ - l , - l ] + [ 0, - l ] & [ - 1 , - 1 ] \ \
[ 0, - 1 ] &[ - l , - l ] + [ 0, - l ] & [ - l , - l ] + [ 0, - l ] & [ - l , - l ] + [ 0, - l ] & [ - l , - l ] + [ 0, - l ] &
\end{spreadt ab}$

[ 02-14-4
1
1 1
1 2 i
1 3 3 1
1 4 6 4 1
1 5 10 10 5

77
Packages

2 .1 4 .2 T ext c o lu m n s

By default, the spreadtab package assumes that a table cell contains either purely numerical
contents, a command, or a relative reference. If you want a cell to contain text, you must
insert a @symbol at the beginning o f the cell.

month income tax \usepackage{spreadtab}


1 5409 1622.7 \begin{spreadtab}{{tabular}{rr |r}}
2 4523 1356.9 @ month & @ income & @ tax \\\h lin e
3 4711 1413.3 1 & 5409 & b2*0.3 \ \
14643 4392.9 2 & 4523 & b3*0.3 \ \
3 & 4711 & b4*0.3 \\\h lin e
& b2+b3+b4 & B5*0.3
\end{spreadtab}

If the @symbol can’t be used for TgXnical reasons, you can use \S T t e x t c e ll instead; it is
identical to the @symbol.

2 .1 4 .3 M ix e d c e lls

If a cell contains text as well as code specific to spreadtab, you must separate the numerical
contents from the text part by the assignment operator : =. The general syntax for mixed cells
is

<text>: ={ numerical field } <end text>

The numerical content has to be enclosed in curly braces. The \ST num ericfieldm arker
command is an alternative to the assignment operator, if the : = symbol can’t be used for
TpXnical reasons (for example when activating French, where the colon is an active symbol).

month income tax \usepackage{spreadtab, eurosym}


1 5409 1622.7 \begin{spreadtab}{{tabular}{rr |r}}
2 4523 1356.9 @ month &@ income & @ tax \\\h lin e
3 4711 1413.3 1 & 5409 &b2*0.3 \ \
sum: 14643 € 4392.9 2 & 4523 &b3*0.3 \ \
3 & 4711 &b4*0.3 \\\h lin e
& \llap{sum: :={b2+b3+b4} \euro}
& $\sum$: :={B5*0.3}
\end{spreadtab}

2 . 1 4 .4 O m ittin g r o w s o r c o lu m n s
You can omit individual rows or columns from the output using the corresponding command
in the row or column:

\SThiderow \S T h id e co l
2.14 spreadtab

An omitted column also does not appear in the column definition of the table. In the
following example there are five columns internally, but with the spreadtab environment,
only the four “active” columns r | ccc are defined. Hiding a row may be useful if the values
need to be taken into account but shouldn’t be visible to the user.

\usepackage{spreadtab}
\begin{spreadtab}{{tabular}{r | c c c}}\h lin e
@ $x$ \emph{values} &-1 &0 \SThidecol & 2 &3 \\\h lin e
@ $f(x)= 2\cdot x -l$ &2*[ 0,-l]-l& 2*[ 0, - l ] - l & 2*[ 0, - l ] - l &2*[ 0, - l ] - l \ \
@ $g(x)=x-10$\SThiderow& [0 ,-2 ]-1 0 & [0 ,-2 ]-1 0 & [0 ,-2 ]-1 0 & [0 ,-2 ]-1 0 \ \
@ Sh(x)=l-x$ &l - [ 0 ,- 3 ] &l - [ 0 ,- 3 ] & l- [ 0 ,- 3 ] &l- [ 0 ,- 3 ] \\\h lin e
@ $j(x)=xA2$ &[0 ,-4 ]* [0 ,-4 ] & [0 ,-4 ]* [0 ,-4 ] & [0 ,-4 ]* [0 ,-4 ]
& [0 ,-4 ]* [0 ,-4 ] \ \\h lin e
\end{spreadtab}

x values -1 2 3
f ( x ) = 2- x - l -3 3 5
h(x) = 1 - x 2 -1 -2
j ( x ) = X2 1 4 9

2 .1 4 .5 S a v i n g o f c e ll c o n t e n t s
If you want to use the contents of a cell outside the current cell, you can use the \S T s a v e c e ll
command to save the contents of the cell in a macro name, which can be chosen arbitrarily. It
has to be specified in the optional argument of spreadtab.

\S T s a v e c e ll \< m acro> { cell}

The cell must be defined as an absolute reference, i. e. the unique combination of column and
row, for example h3.

10 20 30 60 cell cl : 30 \usepackage{spreadtab}

\begin{spreadtab}[\STsavecell\result{cl}]%
cell cl had the value 30 { { t a b u la r } ! |c |c |c |c |c |} } \h lin e
10 & a l +10 & b l +10 & al+bl+cl
& ©cell c l : \r e s u lt \\\h lin e
\end{spreadtab}\par\medskip
\medskip
c e ll c l had the value \r e su lt

There is no limit to the number of cells that can be saved in spreadtab; you just need to
list them all one after the other in the optional argument.

79
Packages

month income tax \usepackage{spreadtab,eurosym} f--------


[02-14-9
1 5409 1622.7 \begin{spreadtab}[\STsavecell\EK{b5}%
2 4523 1356.9 \ST savecell\ST {c5}]{{tabular}{rr |r}}
3 4711 1413.3 @ month & @ income & @ tax \\\h lin e
sum: 14643 € I : 4392.9 1 & 5409 &b2*0.3 \ \
2 & 4523 &b3*0.3 \ \
The income was 14643 € and the tax was 3 & 4711 &b4*0.3 \\\h lin e
4392.9 €! & \llap{sum: :={b2+b3+b4} \euro}
& $\sum$: :={B5*0.3}
\end{spreadtab}\par\medskip
The income was \EK~\euro\ and the tax was \ST~\euro!

2 . 1 4 .6 M a th a n d d a te fu n c tio n s
spreadtab provides the following mathematical and date operations for manipulating cell
contents:
sum (< reg io n l> \< reg io n 2 > \. . . ) Sum the cells, starting with the first region and ending with
the nth region. A region can be
> a single cell or
> a fr o m -to region o f the form <from>:<to> ; a rectangular region that contains
several rows and columns is possible as well.

month income tax \usepackage{spreadtab, eurosym}


1 5409 1622.7 \begin{spreadtab}{{tabular}{rr |r}}
2 4523 1356.9 @ month & @ income & @ tax \\\h lin e
3 4711 1413.3 1 & 5409 & b2*0. 3 \ \
sum: 14643 € X: 4392.9 2 & 4523 & b3*0.3 \ \
3 & 4711 & b4*0.3 \\\h lin e
& \llap{sum: :={sum(b2:b4)} '
& S\sum$: :={sum(C2:C4)}
\end{spreadtab}

Ï2iCt(<number>) Outputs the factorial of number.

\usepackage{spreadtab} \setlen g th \ta b co lsep { 2pt}


\begin{spreadtab}{{tabular}{@{} *9{p{3em}} @{}}}
0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 &8\\\h lin e
fa ct(a l)& fact(b l)& fact(cl)& fact(d l)& fact(el)& fact(fl)& fact(gl)& fact(h l)& fact(il)
\end{spreadtab}

0 1 2 3 4 5 6 7 8
1 Ï 2 6 24 120 720 5040 40320

sumprod (< region l> \< region 2> \. . . ) The corresponding cells are first multiplied (first cell in
region 1 by first cell in region 2, etc.) and then the products are added. All regions
need to be the same length and correspond to the syntax given above. Cells that do not

80
2.14 spreadtab

contain a numerical value or that don’t exist because of a \m ulticolum n command are
assigned the value zero.

\usepackage{spreadtab}
\begin{spreadtab}{{tabular}{ @{} r *6c @{}}}
@age & 10 & 11 & 12 & 13 & 14 & 1 5 \\
©number & 5& 8 & 2 0 & 5 5 & 9 & 3 \\\h lin e
\multicolumn{7}{@{}l}{mean age: :={sumprod(bl:g l;b 2 :g2)/sum(b2:g2)}}
\end{spreadtab}

age 10 11 12 13 14 15
number 5 8 20 55 9 3
mean age: 12.64

rand Outputs a random number between 0 and 1. If you need to output the same random
series more than once, the internal \ST@seed command must be overwritten:
\makeatletter\renewcommand\ST@seed{}\makeatletter
Now the random number generator can be started individually with \F P seed =<number>.
If you set the number to be the same, the same series will be output.
randint( min, max) Outputs a random integer between min and max. If min is not given, an
integer between 0 and m ax is produced.

\usepackage{spreadtab} \STautoround{4}
\begin{spreadtab}{{tabular}{@{} l|c c c c ©{}}}
©random number $ \in [ 0;1 ] S &rand() &rand() &rand() &rand() \\
©random number $ \in [—5;5]S &randint(-5,5)&randint(-5,5)&randint(-5, 5)& randint(-5,5)\\
©random number $ \in [ 0; 20]$ &randint(20) &randint(20) &randint(20) &randint(20) \ \
\end{spreadtab}

| 02-14-13 | random number e [0; 1 ] 0.6515 0.7522 0.1592 0.8468


random number e [-5 ; 5] 1 1 -1 -5
random number e [0; 20] 15 1 14 15

ifeq(numberl,number2,number3,number4) If number l=num ber2, then number3 , else num­


ber4.
ifgt(numberl,number2,number3,number4) If num berl>num ber2) then number3 , else num­
ber^
iflt(numberl,number2,number3,number4) If num berl<num ber2i then number3, else num­
ber^
engshortdatetonum(cell) Converts a date in the short form YYYY/MM/DD to its correspond­
ing number (the number o f days that have passed since the first of March in the year
zero) to allow you to compare dates and calculate timespans. cell can be an absolute
or relative reference to a cell that must contain a date in short form. It may also be a
command that yields a date in short form, for example \tod ay.
englongdatetonum(cell) Converts a date o f the long form name o f month DD, YYYY to the
number of the day in the year.

81
Packages

\usepackage{spreadtab}
\begin{spreadtab}{{tabular}{cc}}
@1789/7/14 & engshortdatetonum(al)\\
2001/ 1/1 :={} & engshortdatetonum ([-l, 0] ) \ \
engshortdatetonum(0/3/l) & engshortdatetonum(\number\year/\number\month/\number\day)\\
englongdatetonum(February 13, 2005) & englongdatetonum(\today)\\
©July 1, 1970 & englongdatetonum (a5)\\\hline
@2010/11/23 & engshortdatetonum([ - 1 , 0] ) \ \
@2010/ 1/1 & engshortdatetonum ([-l, 0] ) \ \
©difference & :={[ 0, - 2] —[0, —1 ]} days
\end{spreadtab}

1789/7/14 653554
2001/1/1 730791
0 734213
732295 734213
July 1, 1970 719649
2010/11/23 734404
2010/1/1 734078
difference 326 days

numtoengshortdate(number) Converts a number to a date in the short form YYYY/MM/DD.


numtoenglongdate(number) Converts a number to a date in the long form name o f month
DD, YYYY.
numtoengmonth(number) Converts a number to the name of the month that corresponds
to the date.
numtoengday(number) Converts a number to the name of the day that corresponds to the
date.

2010/3/17 \usepackage{spreadtab}
02-14-15
365 2011/3/17 \begin{spreadtab}{{tabular}{cc}}\hline
365 March 17, 2011 \m ulticolum n{2}{|c|>{@2010/3/17} \\\h lin e
365 March 365 & num toengshortdate(engshortdatetonum (al)+[-l,0])\\
365 thursday 365 & numtoenglongdate(engshortdatetonum(al)+[-l,0]) \ \
-365 2009/3/17 365 & nuratoengmonth(engshortdatetonum(al)+[-l,0]) \\
-365 March 17, 2009 365 & numtoengday(engshortdatetonum(al)+[-l,0]) \\\h lin e
-365 March -365 & num toengshortdate(engshortdatetonum (al)+[-l,0])\\
-365 & numtoenglongdate(engshortdatetonum(al)+[-l,0]) \ \
-365 tuesday
-365 & numtoengmonth(engshortdatetonum(al)+[-l,0]} \\
-365 & numtoengday(engshortdatetonum(al)+[-l,0])
\end{spreadtab>

2 .1 5 ta b ls

The t a b ls package by Donald Arseneau has the sole aim of optimizing the vertical row
spacing, which is often not good with the standard KHeX tables, ta b ls defines three additional

82
2.15 tabls

lengths and modifies the \ h l i n e command to insert optioned vertical space of a chosen length
like the one for \ \ .

\t a b lin e s e p \a r r a y lin e s e p \e x tr a r u le s e p
\ h l i n e [length]

\t a b lin e s e p Minimal space between two adjacent cells in a ta b u la r environment;


negative values and 0pt don’t alter the standard behaviour. The default is
1 pt and text within @{. . .} is not taken into account when determining
the spacing.
\a r r a y lin e s e p The same for the array environment.
\e x tr a r u le s e p Vertical space that is inserted before and after the line commands \ h l i n e
and \ c l i n e . The minimum space between a line and text is then
\e x tr a r u le s e p + 0 .5 \ta b lin e se p . Negative values are possible, but only
as long as no line touches the text. The default for \e x tr a r u le s e p is 3 pt.
The default EdgK behaviour is achieved with the following settings:

\setlength\tablinesep{O pt}
\setlength\arraylinesep{O pt}
\setlength\extrarulesep{O pt}

The following example firstly uses the default lengths in t a b ls and then repeats the table
using the standard KdpX settings for comparison.

\usepackage{tabls}

fix) = ^ 2~11 \b eg in {ta b u lar}{c}\h lin e[ 10pt]


------------ 2 —• $ f(x )= \fr a c {\sq r t{x A2- l} } { x A2+ l} $ \\\h lin e
/ (x) = x 2 + "i1 $ f(x )= \fr a c {\sq r t{x A2- l} } { x A2+ \fr a c {l}{x A2} } $ \\\h lin e
----------------—— \en d {ta b u la r}\\[ 10pt]
7*2-1
f ( x ) = *2-|-l \setlength\tablinesep{Opt}% Standard-LaTeX
V*2—1 \setlength\arraylinesep{Opt}% Standard-LaTeX
f ( x ) = *2H
—tt
\setlength\extrarulesep{Opt}% Standard-LaTeX
\b egin {tab u lar}{c}\hline
$ f(x )= \fr a c {\sq r t{x A2- l} } { x A2+l}$ \\\h lin e
$ f(x )= \fr a c {\sq r t{x A2- l} } { x A2+ \fr a c {l}{x A2} } $ \\\h lin e
\end{tabular}

The t a b ls package works in conjunction with many packages, but you don’t necessarily
get the results that you expect. For example, for the sla sh b o x package it fails to take account f using
of any changed spacings, so the diagonals don’t end in the corners: ta b ls ai
slashbox

\usepackage{tabls, slashbox,p ic t 2e}


\begin{tab u lar}{|@ {}r|*{5}{c}|1@ {}|}\hlin e
\backslashbox[Opt] [ 1 ] {holiday}{year} & 2007 & 2008 & 2009 & 2010 & 2011
& \sla sh b o x [0 p t][r]{y ea r}{h o lid a y }\\\h lin e[3 p t]

83
Packages

Easter & 08.04. & 23.03. & 12.04. & 04.04. & 24.04. & E aster\\
Pentecost & 27.05. & 11.05. & 31.05. & 23.05. & 12.06. & P en te co st\\\h lin e
\end{tabular}

year year | 02-15-2


2007 2008 2009 2010 2011
h o lid a y '^ ^ ^ ^ holiday

Easter 08.04. 23.03. 12.04. 04.04. 24.04. Easter


Pentecost 27.05. 11.05. 31.05. 23.05. 12.06. Pentecost

The following table makes use of the extra space provided by the tab I s package; without
this space it would have been much harder to read.

\usepackage{tabls}
\newcommand{\T}{\textsf{T}}\newcommand{\Z}{\mathcal{Z}}\newcommand{\C}{\textsf{c}}
\begin{tabular}{@ {}c|c|ccccc@ {}}\hline
BV \rule[-0.3cm]{0cm}{0.8cm}& R & $d$ & $u_\Z$
& $u_{\ZA\C}$ & $v_\Z$ & $v_{\ZA\C }$ \\\h lin e
$u_\Z$ \r u le [ - 0 .3cm]{0cm}{0. 8cm}& $y_\Z$&$A_\Z$ & $1$ & $0$ & $-1$ & $0$ \ \
$u_{\ZA\C}$ \rule[-0.3cm]{0cm}{0.8cm}& $y_{\ZA\C}$
& SA_{\ZA\C}$&$0$ & SI$ & $0$ & $ -I $ \\\h lin e
ZF/GK & $e_mA\T
\le ft(\b e g in {a rra y }{c } y_\Z \ \ y_{\ZA\C }\end{array}\right)$
& $e_jnA\T \left(\begin{array}{c}A _\Z \\A _{\ZA\C }\end{array}\right) S
& $0$ & $0$ & $-2e_nA\T$ & S-2e_{m-n}A\T$ \\\h lin e
\end{tabular}

I02-15-3
BV R d Uz uzc Vz v zc

uz yz AZ i 0 -/ 0

UZC A zc 0 i 0 -/

ZF/GK 0 0 —2eJi - 2^e m


T -n
* ( £ ) * ( £ )

2 .1 6 ta b u la r h t

The ta b u la r h t package by Heiko Oberdiek lets you specify the height of the table and
therefore a variable row height to achieve the respective height.
The package can be loaded with the option v lin e s , which offers - albeit experimental -
support for correct vertical lines if additional vertical space was inserted. This option requires

84
2.16 tabularht

E-T^X, which is standard in current TgX distributions. Additional possible options concern the
sPecify <£> output driver, e.g. d vip s, p d f te x ,__ It must only be specified however if there are problems
p s driver jl w ith the automatic detection (for example for dvips).
The package supports the following environments:

\b e g in { ta b u la r h t}{ opizons} [pos] { column definition } ... \e n d {ta b u la r h t}


\b e g in { ta b u la r h t * } { options} ¡pos] {w id th }{co lu m n definition } ... \e n d {ta b u la rh t * }
\b e g in { a r r a y h t} { options} |p os] { column definition } ... \en d {a rra y h t}
\b e g in { ta b u la r h tx } { option s}{w idth }{colu m n definition } ... \e n d {ta b u la rh tx }

The ta b u la r h t environment is similar to the ta b u la r environment, while arrayht cor­


responds to the array environment. The ta b u la r h tx environment is only defined if the
ta b u la r x package has been loaded as well.
If the c a lc package is loaded, the corresponding c a lc length definitions are also consid­
ered by ta b u la rh t. Possible options are \ t o and \sp read ; both can be assigned a length and
\ t o defines the height of the table (standard) and \sp r ea d extends it by the specified length.
\b e g in { ta b u la r h t} { lcm } - height is 1cm
\b eg in {ta b u la r h t}{io = lc m } - height is lcm
\b e g in { ta b u la r h.t}{spread=O cm } - normal height, corresponds to \b e g in { ta b u la r }
\begin {tab u larh t}{sp read = lcm } — normal height, extended by lcm
Within the table, you can use the following three commands: \in terr o w sp a c e and
\ i n t e r r o w f i l l insert additional fixed or dynamic vertical space, while an arbitrary com­
mand sequence can be inserted between \in t e r r o w s ta r t and \in te r r o w sto p . The comma-
separated fist of lines specifies which of them are extended across the inserted space; all other
lines are discontinued. If you want all lines to be discontinuous, set 0 as the argument.

\in te r r o w sp a c e []ineljfine 2,‘. .. ] { length }


\ i n t e r r o w f i l l [lin elslme 25... ]

\in t e r r o w s ta r t [linel,line 2j ...] ...\in te r r o w s to p

The \in te r r o w sp a c e command is identical to \n o a lig n { \v s p a c e { le n g th } } , and the


\ i n t e r r o w f i l l command is identical to \in te r r o w sp a c e { \ f i l l } , which is also iden­
tical to \n o a l i g n { \v f i l l } .

\usepackage{booktabs}
\usepackage{tabularht}
\fbox{%
\begin{tabularht*}{0.8in}{4in}{@ {} 1 @ {\e x tra co lsep {\fill}} r @{}}
top left& top r ig h t\\\in te r r o w f ill
\multicolumn{2}{@{}c@{}}{bounding b o x }\\\in te r r o w fill
bottom l e f t & bottom right
\end{tabularht*}}

85
Packages

top left top right | 02-16-1 |

bounding box

bottom left bottom right

Vertical lines are counted starting at 1 on the left. In the following example, only the
second and third line are set to be continuous.

column 1 column 2 column 3 column 4 \usepackage[vlines]{tabularht}

\b eg in {tab u larh t}{l.75cm }{*{4}{|c}|}\h lin e


column 1 & column 2 & column 3
column 1 column 2 column 3 column 4 & column 4 \\\h lin e
\interrow fi l l [ 2,3 ]\h lin e
column 1 & column 2 & column 3
& column 4 \\\h lin e
\end{tabularht}

The last example uses a fixed \in te r r o w sp a c e and a command called in an \in te r r o w s ta r t-
\in te r r o w s to p sequence:

first line \usepackage{booktabs}


\usepackage[p d ftex,vlin es]{tab u larh t}% sp ecify driver

\begin{tabularht}{spread=Opt}{ 11 11 1}\h lin e


f i r s t & lin e \\\h lin e
second line
\interrow start \addlinespace[ 10mm]\interrowstop\hline
third line second & l i n e \ \
\interrow start \h lin e \h lin e \interrowstop
third & lin e \\\h lin e
\interrow space[1 ,3 ]{15mm}\hline
fourth & lin e \\\h lin e
fourth line \end{tabularht}

2 .1 7 ta b u la r k v

The tab u lark v package by Heiko Oberdiek is virtually identical to the ta b u la r h t package
(which is loaded automatically, cf. Section 2.16 on page 84), but it uses the “key-value” interface
and therefore also loads the k ey v a l package. The optional parameters are:

name type description


w idth length Width of the table, automatically uses tab u larh t*.
X Use tab u larh tx; don’t forget to load the ta b u la rx package
before using this.
h e ig h t length Height of a table.
v a lig n top/bottom /c e n te r Vertical position.

86
2.18 tabularx

For all options, you use a tab u lark v environment, and the package automatically selects
the table environment that corresponds to the parameters that you have assigned. The second
optional argument for the vertical position pos (t, b, c) isn’t really necessary, as you can easily
specify the vertical position through v a lig n in the options.

\b e g in {ta b u la r k v } [settings] [pos] {colum n definition } ... \en d {ta b u la rk v }

\usepackage{booktabs, tabularkv}
02-17-1 | top left top right
\fbox{%
bounding box \begin{tabularkv}[width=2. 25in, height=0. 75in ,
valign=center]{@ {}l@ {\extracolsep{\fill}}r@ {}
bottom left bottom right top left& top right \\\in te r r o w f ill
\multicolumn{ 2}{@{}c@{}}{bounding b ox}\\
\in te r r o w fill
bottom l e f t & bottom right
\end{tabularkv}}

2 .1 8 ta b u la r x

The ta b u la r x package by David Carlisle is used frequently, because it provides an easy way
to adapt the width o f the table to the width o f the current row. The package defines the X
column type, which stands for a p column o f variable width depending on the width o f the
table to be specified by the user. The syntax is almost identical to a normal table, though the
width of the table has to be given as well.

\b e g in { ta b u la r x } [position] { table w idth}{colum n definition }


...& ...& ...W
...& ...& ...W

\en d {ta b u la r x }

You can combine the X column type arbitrarily with other standard or user-defined types. The
main difference to the ta b u la r* environment is that ta b u la rx adjusts the column width
whereas ta b u la r* adjusts the space between the columns.

Text before the table, which spans the whole \usepackage{tabularx}


line to show that the table is that wide as well.
Text before the tab le, which spans the whole lin e
A bar next to the text can be created easily show that the table i s that wide as w ell.\p a r
now. \begin{tab u larx}{\lin ew id th }{!{\vrule width 2pt}X
A bar next to the text can be created e a sily now.
It can also span several paragraphs,
\par\medskip It can also span several paragraphs,
but page breaks are not possible with
but page breaks are not p ossib le with
t a b u la r x (see l t x t a b l e package).
\tex ttt{ta b u la rx } (see \te x t tt{ ltx ta b le } package).
Text after the table, which spans the whole line \end{t abularx}\par
to show that the table is that wide as well. Text after the tab le, which spans the whole lin e 1
show that the table i s that wide as w ell.

87
2 Packages

All the X columns within a table have the same width, regardless o f whether they are
adjacent or separated by other column types, as shown here:

Text before the table, which spans the whole \usepackage{tabularx} r--------
02-18-2
line to show that the table is that wide as well.
Text before the tab le, which spans the whole lin e to
The width of This The width show that the table i s that wide as w ell.\p a r
this column column o f this col­ \begin{tabularx}{\linew idth}{|X | p{lcm} | X |}
is determined is 1 cm umn is also The width of th is column i s determined autom atically.
automatically. wide. determined & This column i s l\,cm wide.
automatically. & The width of th is column i s also determined
autom atically.
Text after the table, which spans the whole line
\end{tabularx}\par
to show that the table is that wide as well.
Text a fter the tab le, which spans the whole lin e to
show that the table is that wide as w ell.

However, you can adjust the X columns individually using \ h s i z e by specifying a decimal
fraction of the total width of the X columns. In the following example, the first X column is set
to be 0.7 times the normal width and the second one 1.3 times it.

\usepackage{tabularx}
Text before the tab le, which spans the whole lin e to show that the table is
that wide as w ell.\p a r
\b e g in {ta b u la rx }{\lin ew id th }{|> {\setlen g th \h size{ 0. 7\hsize}}X |p{lcm }|
> { \s e tle n g th \h s iz e { l. 3 \h size}}X |}
The width of th is column i s determined autom atically. & This column i s l\,cm wide.
& The width o f th is column i s determined autom atically.
\end{tabularx}\par
Text after the ta b le, which spans the whole lin e to show that the table i s
that wide as w ell.

Text before the table, which spans the whole


line to show that the table is that wide as well.

The This The width of


width column this column
of this is 1 cm is determined
column wide. automatically.
is deter­
mined
automati­
cally.

Text after the table, which spans the whole line


to show that the table is that wide as well.

\h size ^ With three X columns, the sum of all \ h s i z e lengths has to add up to three, and so on.
In all these examples for tab u larx, the justification of the text in narrow columns doesn’t
look good. In these situations, you should also use \r a g g e d r ig h t or \RaggedRight from the
ragged2e package by Martin Schröder; the latter saves the explicit \a rra y b a ck sla sh call.

88
2.18 tabularx

Text before the table, which spans the whole \usepackage{tabularx,ragged2e}


line to show that the table is that wide as well.
Text before the ta b le, which spans the
The This The width o f this whole lin e to show that the table is
width column column is deter­ that wide as w ell.\p a r
o f this is 1 cm mined automati­ \begin{tabularx}{\linew idth}{|
column wide. cally. > {\setle n g th \h siz e{0 . 7\hsize}\RaggedRight}X|
is deter­ >{\RaggedRight}p{lcm}|
mined > {\se tle n g th \h siz e {l.3 \h siz e }
automati­ \RaggedRight}X|}
cally. The width of th is column i s determined
autom atically. & This column i s l\,cm
Text after the table, which spans the whole line
wide. & The width of th is column is
to show that the table is that wide as well.
determined automatically.
\end{tabularx}\par
Text after the tab le, which spans the
whole lin e to show that the table i s
that wide as w ell.

All X columns correspond to the p column type, but you can transform them into a
different type by redefining the assignment. In the following example we change from a p to
a m column and reduce the font size. The output is a bit hard to understand at first glance;
both X columns are centred vertically to each other and to the start of the middle p column.

Text before the table, which spans the whole \ u s e p a ck a g e {ta b u la r x , ragged2e}
line. \renew com m and\tabularxcolum n[l]{>{\sm all}m {#l}}

The Text before the ta b le, which spans the whole lin e .
width
of this The width o f this \begin{tabularx}{\linewidth}{@ {}
column column is deter­ > {\se tle n g th \h siz e{0 . 7\hsize}\RaggedRight}X |
This
is deter­ mined automati­ >{\RaggedRight}p{lcm} |
column
mined cally. >{\setlength\hsize{1.3\hsize}\RaggedRight}X@ {}}
is 1 cm
automati­ The width of th is column i s determined autom atically.
wide.
cally. & This column i s l\,cm wide.
& The width of th is column i s determined
Text after the table, which spans the whole
autom atically.
line. \end{tabularx}\par
Text a fter the ta b le, which spans the whole lin e .

Here are some points to bear in mind when using tabularx:


t> ta b u la r x typesets the table several times internally to determine the optimal width of the X
columns. Therefore having many ta b u la r x tables can slow down a ETpX run significantly.
> You can use \v e r b and \v erb * within the table, but the resulting horizontal spaces may be
wrong.
> You can nest ta b u la r x tables arbitrarily, but you must group the internal tables by enclosing
them in {...}, \b g r o u p ... \egroup, or \b e g in g r o u p ... \endgroup.

89
Packages

2 .1 9 ta b u la r y

The ta b u la ry package by David Carlisle is the complement of the ta b u la rx package by the


same author. The only fixed specification is the table width; the columns are then calculated
so that they all have the same height depending on this specification. The columns have to be
o f type L, R, C, or J. The first three correspond to the usual types of standard KT^X and J to
normal justification. The latter can be seen in Example 02-19-2, which shows three J columns
that correspond to the normal p columns. But first an example using the other three types:

Text before the table, which spans the whole \usepackage{tabulary} ,--------
[ 0 2 - 19-1
line.
Text before the ta b le, which spans the whole lin e .\p a r
The height This The \begin{tabulary}{\linew idth}{|L | C | R |}
of this column height is The height of th is column i s determined
column is is of un­ also deter­ autom atically.
& This column i s of unknown width.
determined known mined
& The height i s also determined
automati­ width. automati­
autom atically.
cally. cally. \end{tabulary}\par
Text after the table, which spans the whole Text a fter the ta b le, which spans the whole lin e .
line.

\usepackage{tabulary}
Text before the tab le, which w ill span the whole width of the lin e with an
additional linebreak but without sense.\par
\begin{tabulary}{\linewidth}{@ {}J | J | J@{}}
The height of th is column i s determined autom atically.
& This column i s ?\,cm wide, but how wide exactly i s unknown.
& The height of th is column i s determined automatically such that a ll columns
have the same height for the given width.
\end{tabulary}\par
Text after the ta b le, which w ill span the whole width of the lin e with an
additional linebreak but without sense.

Text before the table, which will span the whole width of the line [ 02-19-2
with an additional linebreak but without sense.
The height of This column The height of this column
this column is ? cm wide, is determined automatically
is determined but how wide such that all columns have
automati­ exactly is the same height for the given
cally. unknown. width.

Text after the table, which will span the whole width of the line
with an additional linebreak but without sense.

This package uses the two lengths \ty m in and \tym ax internally so as not to let the widths
of the columns become too small or too large. The default values are 10pt and 2\te x tw id th ,

90
2.20 threeparttable

but you can change them if appropriate. If you are using narrow columns, it is better to work
with the standard 1, r, or c column types anyway. These types can be combined arbitrarily
with the types of tab u lary.

2.20 t h r e e p a r t t a b l e
The th r e e p a r tta b le package by Donald Arseneau lets you add captions and notes to tables.
To achieve this, a standard ta b u la r environment is put into a th r e e p a r tta b le environment,
which works like t a b le environment, but does not float.
If it should float, the ta b le environment must be used additionally . The package allows the
global options summarized in Table 2.7. They can be overwritten locally in the ta b le n o te s
environment.

Table 2.7: Summary of the package options for threeparttable.

name description

para All footnotes consecutively in a single paragraph.


flu s h le ft No left indent.
o n lin e The argument of \ite m is typeset in normal font instead of vertically shifted.
normal Assume default options of the package.

\b e g in { th r e e p a r tt a b le } [position]
\ c a p t i o n { . .. }
\b e g in { t a b u la r } ... (or \b e g in { ta b u la r * } ... )
... \ t n o t e { number } & ...& ... \ \

\e n d { ta b u la r } (o r \e n d { ta b u la r * })
\b e g in { ta b le n o te s } [settings]
\it e m [number] text

\e n d { ta b le n o te s }
\e n d { th r e e p a r tta b le }

The optional parameter position refers to the vertical alignment and can take one of the usual
options: t (default), b, or c. For the ta b le n o te s environment, the package options described
above are possible as well. If inserted here, they override the corresponding global options.
The package does not increase the numbers of footnotes automatically; you have to take care
of this yourself.
The first of the following two examples uses the second footnote (\item ) as a caption for
the following ones. To make this caption appear in normal font size and bold, the \t n o t e
command is redefined locally with \renewcommand.

91
Packages

\usepackage{threeparttable, array, booktabs, calc}


\begin{threeparttable}
\caption{Summary of the signs for the most important trigonometric
fu n ction s. \tn o te { l} }
\begin{tabular}{@ {}rc*{ 6}{>{$}c<{$}}}\toprule
\emph{quadrant} & angle & \sin \tn o te {a } & \co s\tn o te{a } & \tan \tnote{b }
& \mathrm{cot}\tnote{b} & \mathrm{sec}\tnote{c} & \mathrm{csec}\tnote{c} \\\m idrule
I & $0A\c ir c $ to $90A\c ir c $ &+ &+ &+ &+ &+ &+ \\
II & $90A\c ir c $ to $180A\c ir c $ & + & - & - & - & - & + \ \
III & $180A\c ir c $ to $270A\c ir c $ & - & - & + & + &- &- \ \
IV & $270A\c ir c $ to S360A\c ir c $ & - & + & - & - & + & - \\\bottom rule
\end{tabular}
\begin{tablenotes}
\ite m [l] Conversion to radian i s easy.
\begingroup% keep lo ca l
\renewcommand\tnote[1 ]{\n orm alsize\b fs e r ie s# l}
\item [range:] ~ \endgroup
\item [a] \makebox[1 . 8em ][r]{$-l$} to $+1$
\item [b] \makebox[1 . 8em ][r]{$ -\in fty $ } to $+\infty$
\item [c] \makebox[1 . 8em ][r]{$ -\in fty $ } to $- 1$ and $+1$ to $+\infty$
\end{tablenotes}
\end{threeparttable}

Table 1: Summary of the signs for the most important trigonometric


functions.1

quadrant angle s in a c o s a t a n b co tb secc csecc

I 0° to 90° + + + + + +
II 90° to 180° + - - - - +
III 180° to 270° - - + + - -

IV 270° to 360° - + - - + -

1 Conversion to radian is easy,


range:
a —1 to +1
b —00 to + 0 0
c -oo t o - 1 a n d +1 to+oo

\usepackage[para]{threeparttable}
\begin{threeparttable} \caption{D ifferent gas analyses.}
\begin{tabular} [ t ] { r |c |c |c } \h lin e
& PI & P2\tnote{A} & P 3 \\\h lin e
decrease in pressure & 0.149 & 0.494 & 0.199 \ \
winding & 0.146 & 0.480 & 0.240 \ \
heat extraction & 0.164\tnote{a} & 0.508 & 0.209 \\\h lin e
\end{tabular}
\b e g in {ta b len o tes}[flu sh left]

92
2.21 threeparttablex

\item[A] uncertain measurement \item [a] disturbance during measurement


\end{tablenotes}
\end{threeparttable}

Table 1: Different gas analyses.

PI P2a P3
decrease in pressure 0.149 0.494 0.199
winding 0.146 0.480 0.240
heat extraction 0.164a 0.508 0.209
A uncertain measurement
a disturbance during measurement

Further commands that are of interest in th r e e p a r tta b le are shown in Table 2.8:

Table 2.8: Summary of the most important lengths and commands for threeparttable.

name description
\TPTminimum Minimal width of \ c apt io n (default 4 em).
\TPTr la p { argument } Takes the margin o f the table into account for footnotes in
right-aligned columns.
\T P T tagStyle{ argument} Formatting of the label of \ t n o t e (default {}).
\TPTnoteLabel{ argument} Formatting of the label of \ite m (default \tn o te ).
\T P T n oteS ettin gs Sets all defaults for ta b le n o te s ( l i s t environment).

2.21 t h r e e p a r t t a b l e x
The th r e e p a r tta b le x package by Lars Madsen is an extension of the th r e e p a r tta b le pack­
age, which is loaded as well by default. The aim of the package is to extend the functionality to
support tables with a page break, th r e e p a r tta b le x allows the use of ta b le n o te s together
with lo n g ta b le (cf. Section 4.1 on page 125). In addition to the functionality described in
Section 2.20 on page 91, there are the following extensions:
> The T hreePartTable environment is a container for the new TableN otes and
lo n g ta b le environments.
> The T ableN otes environment has the same functionality as the ta b le n o te s environ­
ment from th r e e p a r tta b le , but must appear before the lo n g ta b le environment.
> The \in s e r tT a b le N o te s command can also be used within lo n g ta b le , unlike the
T ableN otes environment. \in se r tT a b le N o te s uses the \m ulticolum n command.

\usepackage{longtable, threeparttablex}
\begin{ThreePartTable}
\begin{TableNotes}
\item [a] A remark to the tab le.

93
Packages

\item [b] This tab le i s only a demo.


\end{TableNotes}
\begin{longtable}{@ {}l c r p{1.5cm}@{}}
L & C & R & b o x \\\h lin e
\endfirsthead
\m ulticolum n{4}{@ {}l}{\sm all\ldots\em ph{continued}}\\\hline
L & C & R & b o x \\\h lin e
\endhead
\h lin e
\multicolumn{4}{r@{}}{\small\emph{continued on next page} \ l d o t s } \ \
\endfoot
\h lin e
\insertTableNotes
\en d lastfoot
1 & c & r & 1st row\\ 1 & c & r & 2nd row\\ 1 & c &r &3rd row\\
1 & c\tn ote{a} & r & 4th row\\ 1 & c & r\tn ote{b} &5th row\\
1 & c & r & 6th row\\ 1 & c & r & 7th row\\ 1 & c &r &8th row\\
1 & c & r & 9th row\\ 1 & c & r &10th row\\ 1 & c &r&llth row\\
1 & c & r &12th row
\end{longtable}
\end{ThreePartTable}

threeparttablex d e m o th re eparttablex d e m o 02-21-1

L C R box ... continued


1 c r 1st row L C R box
1 c r 2nd row 1 c r 12th row
1 c r 3rd row
a A remark to the table.
1 ca r 4th row
b This table is only a
1 c rb 5th row
demo.
1 c r 6th row
1 c r 7th row
1 c r 8th row
1 c r 9th row
1 c r 10th row
1 c r 11th row
continued on next page

page 1 page 2

You can label the remarks within the T ableN otes environment and then reference them
with the \ t n o t e x command (though to use this feature you must load the package with the
r e fe r a b le option set). If you have the h yp erref package loaded, use the starred version
\tn o te x * if you don’t want these references to be converted into links.

94
2.21 threeparttablex

\usepackage{longtable} \usepackage[referable]{threeparttablex}
\begin{ThreePartTable}
\begin{TableNotes}
\ite m [a ]\la b e l{tn :a } A remark to the tab le.
\item [b ]\la b el{tn :b } This tab le i s only a demo.
\end{TableNotes}
\begin{longtable}{@ {}l c r p{1.5cm}@{}}
L & C & R & b o x \\\h lin e
\endfirsthead
\m ulticolum n{4}{@ {}l}{\sm all\ldots\em ph{continued}}\\\hline
L & C & R & b o x \\\h lin e
\endhead
\h lin e
\multicolumn{4}{r@{}}{\small\emph{continued on next page} \ld o t s } \ \
\endfoot
\h lin e
\insertTableNotes
\en d lastfoot
1 & c & r & 1st row\\ 1 & c & r & 2nd row\\ 1 & c & r & 3rd row\\
1 & c\tn otex{tn :a} & r & 4th row\\ 1 & c & r\tn otex{tn:b} & 5th row\\
1 & c & r & 6th row\\ 1 & c & r & 7th row\\ 1 & c & r & 8th row\\
1 & c & r & 9th row\\ 1 & c & r &10th row\\ 1 & c & r &llth row\\
1 & c & r &12th row
\end{longtable}
\end{ThreePartTable}

The remarks~\ref{tn:a} and~\ref{tn:b} in the ta b le \ld o ts.

threeparttablex d e m o threeparttablex d e m o

L C R box ... continued


1 c r 1st row L C R box
1 c r 2nd row 1 c r 12th row
1 c r 3rd row a A remark to the table.
1 ca r 4th row b This table is only a
1 c rb 5th row demo.
1 c r 6th row
1 c r 7th row
The remarks a and b in the table—
1 c r 8th row
1 c r 9th row
1 c r 10th row
1 c r 11th row
continued on next page

page 1 page 2

95
Packages

2.22 w a r p c o l
th mode The warpcol package by Wayne A. Rochester provides an alternative to the dcolumn package
(cf. Section 2.24 on page 98) to format columns of numbers. Like dcolumn, warpcol typesets
the columns in math mode by default; so when adding captions in columns, you must switch to
text mode, easily done by using the \m u lticolum n command, warpcol defines the P column
type, which expects the formatting for decimal numbers in the form S xy as a parameter,
where S stands for a negative sign, x for the number of digits of the whole number part, and
y for the number o f decimal places. This defines the basic width of the column, before any
caption is added. In Example 02- 22- 1, the first column is formatted with P {3 .1 }, i.e. with
three digits in front or the decimal point and one digit after. The second column is set to span
the width of the sign, two whole number digits, and one decimal place.

\usepackage{warpcol}
column 1 column 2 | 02-22-1 |
123.4 -1 2 .3 \begin{tabular}{P{3.1} P {-2. l} } \h lin e
12.3 12.3 \multicolumn{l}{c}{\emph{column 1 }}
1.2 1.2 & \multicolumn{l}{c}{\emph{column 2} } \\\h lin e
123.4 & -12.3W 12.3 & 12.3W 1.2 & 1 . 2\\\h lin e
\end{tabular}

It’s a good idea to format column captions correctly regardless o f their length, even if
afterwards there is only a column o f numbers. Usually, you’ll set up the definition using a
\m ulticolum n command and one o f the three standard column types: 1, c, or r. warpcol
provides further support for the formatting through the following two commands:

\p c o lb e g in { type } { argument} \p c o le n d

The first parameter of \p c o lb e g in expects one of the standard column types and the second
one the definition of the format of the column of numbers. This is only of interest for a left-
or right-aligned column, which could not be aligned correctly with the P column type. The
following example illustrates the use of these commands:

\usepackage{warpcol}\newcolum ntype{L}[l]{>{\pcolbegin{r}{#l}}l<{\pcolend}}
\newcolumntype{R}[1 ]{>{\pcolbegin{r}{#l}}r<{\pcolend}}
\begin{tabular}{@{} L{3.1}L{3.1}P{3.1}P{3.1}R{3.1}R{3.1} ©{}} \h lin e
\multicolumn{l}{l}{KT} & \m ulticolum n{l}{l}{long t i t l e }
& \multicolumn{l}{c}{KT} & \m ulticolum n{l}{c}{long t i t l e }
& \multicolumn{l}{r}{KT} & \m ulticolum n{l}{r}{long t i t l e } \ \ \h lin e
123.4 & 123.4 & 123.4 & 123.4 & 123.4 & 123.4 \ \
12.3 & 12.3 & 12.3 & 12.3 & 12.3 & 12.3 \ \
1.2 & 1.2& 1.2 & 1.2 & 1.2 & 1.2 \\\h lin e
\end{tabular}

KT long title KT long title KT long title


123.4 123.4 123.4 123.4 123.4 123.4"
12.3 12.3 12.3 12.3 12.3 12.3
1.2 1.2 1.2 1.2 1.2 1.2

96
2.23 widetable

With \p c o lb e g in ... \p co len d , you can left-align, right-align, or centre the columns of
numbers arbitrarily.

left-aligned right-aligned centred \usepackage{warpcol}


123.4 123.4 123.4 \begin{tabular}{@{}
12.3 12.3 12.3 > {\p colb egin {l}{3. l}}c<{\pcolend}P{3.1}
1.2 1.2 1.2 >{\pcolbegin{c}{3.1}}c<{\pcolend} @ {}}\hline
\m ulticolum n{l}{@ {}c}{left-aligned}
& \m ulticolum n{l}{c}{right-aligned}
& \m ulticolum n{l}{c@ {}}{centred}\\ \h lin e
123.4&123.4&123.4 \\1 2 . 3&12. 3&12. 3 \ \ 1 . 2&1. 2&1. 2 \\\h lin
\end{tabular}

When formatting the columns, you can pass anything as an argument that makes sense
for a column o f numbers. In the following example, the first column is formatted with the
expression L{< 1 .3 } , which specifies a comparison operator, a space, one digit before the
decimal point, and three digits after it. The second column is formatted as P {3 \ ,3 .2 } : three
digits, a space of \ ,, a further three digits, and two decimal places.

cost (€ ) \usepackage{warpcol} \usepackage{eurosym}


02-22-4] p
\newcolumntype{L}[1 ]{> {\pcolbegin {l}{#l}}l< {\pcolend }}
> 0.1 123456.78
< 0.1 23456.78 \begin{tabular}{@{} L{< 1.3} P {3 \,3 .2 } @ {}}\hline
< 0.01 4523.45 \multicolumn{l}{@{}c}{\emph{p}}
< 0.001 345.67 & \multicolumn{l}{c@{}}{\emph{cost (\e u r o )} } \\\h lin e
> 0 .1 & 123\,456.78 \ \ < 0.1 & 2 3 \,456.78 \ \
< 0.01 & 4 \ , 523.45 \ \ < 0.001 & 345.67 \\\h lin e
\end{tabular}

2 .2 3 w id e ta b le

The w id eta b le package by Claudio Beccari is a combination of the ta b u la r* and ta b u la rx


environments; it tries to adapt the width of each column to achieve the specified width.

\b eg in {w id eta b le}{ta fc/e w idth }{colu m n definition }


...& ...& ...W
\e n d {w id e ta b le }

The following three examples show the main difference between the lo n g ta b le * , tab u larx,
and w id eta b le environments; only the latter distributes the required space evenly over all
columns.
\usepackage{tabularx,widetable}
\begin {tab u lar*}{\lin ew id th }{| 1 |c @ {\k e rn \ta b co lsep \v ru le\ex tra co lsep {\fill}}c|}\h lin e
column A & wider column B & lo n g ta b le * \\\h lin e
\end{tabular*}\par\bigskip
\begin {tab u larx}{\lin ew id th }{| 1 |X |X |}\h lin e

197
Packages

column A & wider column B & ta b u la r x \\\h lin e


\end{tabularx}\par\bigskip
\begin {w id etab le}{\lin ew id th }{| 1 |c |c |} \h lin e
column A & wider column B & w id eta b le\\\h lin e
\end{widetable}

column A wider column B longtable*

column A wider column B tabularx

column A wider column B widetable

2 .2 4 d c o lu m n

The dcolumn package by David Carlisle provides formatting help for columns of numbers,
which can be aligned at the decimal point or decimal comma, dcolumn defines the D column
type for this:

D{ 7g£ separator} {ou tpu t} {n u m ber o f decimal places}


D{T$C separator} {o u tp u t} {n u m ber left.number right}

TfX separator Corresponds to the separator within the TpX source and may only
be a single character. Will usually be a dot (3.1412) or a comma
(3,1242), but may also be a hyphen (3-1234).
output Corresponds to the character that is to appear as the decimal sepa­
rator in the output. May be any arbitrary mathematical sequence
of characters, for example \c d o t; however, it will usually be a dot
or a comma.
number o f decimal places Defines the maximum number of decimal places. If the value is
negative, the output is centred at the separator; otherwise it is
right-aligned with the maximum number of decimal places.
number left.number right Defines the maximum number of decimal places left and right of
the separator. The two numbers may be separated by either a
comma or a dot.
dcolumn always operates in math mode, so bear this in mind when inputting separator
math mode characters and selecting the font. This also means that you can’t use the mathematical
operator $ in the columns of the table; if you do, the decimal separator w on’t be determined
correctly. The first example uses vertical lines to highlight the effect of the D column’s third
parameter.

98
2.24 dcolumn

\usepackage{dcolumn}
\begin{tabular}{| c | D {.}{,}{5 } | D { ,}{.}{-1 } | }
\textit{name}& \te x tit{ v a lu e } & \tex tit{sta n d ard form }\\\h lin e
e & 2.71828 & 0 ,271828\cdotlOA{ l } \ \ $\pi$ & 3.1416 & 0 ,31416\cdotlOA{ l } \ \
v & 0.21 & 0,21 \\ Q &0 &0
\end{tabular}

name value standard form


e 2,71828 0.271828 • 10 1
TT 3,1416 0.31416 ■10 1
V 0,21 0.21
Q 0 0

The centre column defines the dot as internal separator character, the comma as output
character, and the maximum number of decimal places as 5. The third column defines the
comma as internal separator, the dot as output, and a centred display in the table. However,
the combination o f centring with the standard form content of this third column is not
advantageous for its layout, as there is too much content after the separator for it to look
good to have the separator centred. Furthermore the “text” of the table caption for the two D
columns is typeset in italics; math mode applies here, too. This has fatal consequences for the
third column - the words are interpreted as a number and because there is no comma as a
separator, it is assumed that all the letters are leading digits and the words are place to end
immediately before the virtual separator character. The same applies to the centre column,
only the effect is not so visible. The same table with modified cells looks much better:

\usepackage{dcolumn}
\begin{tabular}{| c | D {.}{,}{5 } | | }
\textit{name}& \m u ltico lu m n {l}{c|}{\tex tit{v a lu e}}
& \m u lticolu m n {l}{c|}{\textit{stan d ard fo rm }}\\\h lin e
e & 2.71828 & 0,271828\cdotl0A{ l } \ \ $\pi$ & 3.1416 & 0,31416\cdotl0A{ l } \ \
v & 0.21 & 0,21 \\ Q &0 &0
\end{tabular}

name value standard form


e 2,71828 0.271828 • 10 1
TT 3,1416 0.31416 • 10 1
V 0,21 0.21
Q 0 0

Now the centre column looks much better. For the right column, the centring at the
decimal separator still makes it look bad because in the standard form content there is always
only one leading digit. In cases like this, it would look better if a D column was not used at all
but a normal left-aligned column used instead; however, an exception would be if you were
using a font where not all o f the digits had the same width. Of course, if you don’t use a D
column, you can’t modify the separator automatically.

99
2 Packages

\usepackage{dcolumn}
\begin{tabular}{| c | D {.}{,}{5 } | >{$}1<{$} | }
\textit{name}& \m u ltico lu m n {l}{c|}{\tex tit{v a lu e}}
& \m u lticolum n {l}{c|}{\textit{stan d ard form }}\\\h lin e
e & 2.71828 & 0,271828\cdotl0A{ l } \ \ $\pi$ & 3.1416 & 0, 31416\cdotlOA{l}\\
v & 0.21 & 0,21 \\ Q &0 &0
\end{tabular}

name value standard form


e 2,71828 0 ,2 7 1 8 2 8 -101
TT 3,1416 0 ,3 1 4 1 6 -101
V 0,21 0,21
Q 0 0

Use the left.right notation for the selection of decimal places if either the maximum number
of digits before and after the separator is approximately the same or you are getting problems
with the formatting otherwise. In principle it is best to define a custom column type that
references the D type. The following example shows several variants and their effect on the
layout; the vertical lines have only been added to make the effects clearer.

\usepackage{dcolumn}
\newcolumntype{d}[1 ]{D{. } { . }{#1}}
\newcommand\mc[l]{\multicolumn{l}{c|}{# 1 }}
\newcommand\Mc[1]{\m u ltico lu m n {l}{|c|}{# !}}
\begin{tab u lar}!| d { -l} | d { l} | d{2}| d {3.2}| d{5.2}|}
\Mc{d \{ - 1 \} }&\mc{d \{ 1 \} }&\mc{d \{ 2 \} }&\mc{d \{ 3 .2 \ } }&\mc{d \{ 5 .2 \}}\\\h lin e
-13.02 & -13.02 & -13.02 &-13.02 & -13.02 \ \
-13.02 & -13.02 & -13.02 &-13.02 & -13.02 \ \
-13.02 & -13.02 & -13.02 &-13.02 & -13.02 \ \
-13.02 & -13.02 & -13.02 &-13.02 &-13.02
\end{tabular}

d{-l} d{l} d{2} d{3.2} d{5.2}


-13.02 -13.02 -13.02 -13.02 -13.02
-13.02 -13.02 -13.02 -13.02 -13.02
-13.02 -13.02 -13.02 -13.02 -13.02
-13.02 -13.02 -13.02 -13.02 -13.02

2 .2 5 rcco l

The r c c o l package by Eckhart Guthohrlein is an alternative to dcolumn for formatting


columns of numbers, r c c o l supports the following package options:

100
2 .2 5 rcco l

rounding Rounds numerical values to the number of digits specified by the column
definition (default behaviour).
norounding No rounding.
comma Globally sets the comma as decimal separator (default behaviour). The option
german has the same effect.
p o in t Globally sets the dot as decimal separator. The options e n g lis h and
U S en glish have the same effect.
The package defines the R column type, which takes two mandatory parameters: one for
the number of digits left of the decimal separator and the other one for the number of decimal
places.

R{in teger d ig its}{decim alplaces}


R - [TpX separator] [output] { integer digits} { decimal places}

By default the package expects the comma as decimal separator. If no comma is present, the
formatting assumes that the entire number is an integer; dots are not recognized as separators
unless the option is changed. This case can be seen in the last column of the following
example; the “integer” is formatted according to the specification {3 } { 2 } and the dot simply
appended. This makes the number appear incorrectly and too far to the left in the column.

\usepackage{rccol}
\newcommand\mc[2]{\mult icolu m n {1 }{ # 1 } { \ ttfa m ily # 2 } }

\begin{tabular}{| R{1}{5} | R{1}{6} @{$\cdotlOAl$\hspace{\tabcolsep}} | c | R{3}{2} |}


\m c { |c |} { R \{ 1 \} \{ 5 \} } & \m c {c |}{R \{1 \}\{6 \}} & c & \m c { c |} { R \{ 3 \} \{ 2 \} } \\\h lin e
2,71828 & 0,271828 & $\pi$ & 314.16W 0,21 & 0,21 & Q & 0 . 3 \ \
\end{tabular}

R U M 5} R{ 1H 6> c R-C3H2}
2,71828 0,271828-101 IT 31416,00.
0,21000 0,210000-101 Q 03,00.

Setting @ {$\cdotlO Al$ \h s p a c e { \t a b c o ls e p } } as the column separator makes it pos­


sible to display the exponents ($ \cd o tlO Al$ ) and produce the usual column spacing
(\h s p a c e { \ta b c o ls e p } ). The @operator is especially suited to constructs like this. The R
column type also takes two optional arguments, which you can use to control the decimal
separator. If only one argument is given, it is used for both the input and output separator. If
the minus sign is given (without parentheses), is also taken into account when centring
the number.

\usepackage{rccol} \newcommand\mc[2] {\m u lticolum n{l}{#l}{\ttfam ily# 2}}


\begin{tabular}{| R-{1}{4} | R{1}{6} @{$\cdotlOAl$\hspace{\tabcolsep}}
I c | R [. ] [ ,] { 3} { 2} |}
\ m c { |c |} { R -\ { 1 \ } \ {4 \ } } & \ m c {c |}{R \ {1 \ }\ {6 \ }} & c & \ m c { c |} { R [ . ] [ , ]\ { 3 \ } \ { 2 \ } }\ \ \ h lin e
-2,71828 & 0,271828 & $\pi$ & 314.16\\ -0 ,2 1 & 0 ,2 1 & Q & 0 .3 \ \
\end{tabular}

101
Packages

R-il}{4> R-C1H6} c R[.][,]{3H2>


-2,7183 0,271828-1 0 1 71 314,16
-0,2100 0,210000-1 0 1 Q 0,30

math R columns are not automatically typeset in math mode; this does not apply for the minus
mode jl though because the input is scanned for it. You must ensure that the numerical values
s ig n

are entered correctly; rcco l accepts almost any combination of alphanumerical characters.
You must also make sure that the last row ends with a \\. rccol automatically loads the
packages array and fltp o in t; both of these packages are usually contained in any current
TgX distribution.

2 .2 6 s iu n itx

The siu n itx package by Joseph Wright is primarily intended to display SI emits, but also
offers support for formatting decimal numbers in tables. It provides the S column type
to achieve this. Every entry in a cell is interpreted as a number by siunitx; captions or
comments must either appear as part of a command or be enclosed in curly braces. Table 2.9
shows a summary of the parameters that are of interest for tables. All the other ones are
described in the documentation of the package. [61]

\ s i s e t u p {list of parameters}

T h e parameters ca n be set as optional a r g u m e n t s w h e n loading the pa ck ag e after the \ si se t u p


c o m m a n d , or b y passing t h e m to the appropriate c o m m a n d s . T h e n a m e s of nearly all optional
a r g u m e n t s c h a n g e d f r o m version 1.x of s i u n i t x to the current version 2. H o w e v e r , if y o u
prefer to use the old n a m e s , y o u c a n set the l o a d - c o n f i g u r a t i o n a r g u m e n t to v e r s i o n - 1 .

Table 2.9: Some of the possible parameters of the s iu n itx package, when used for a table ( litera l
stands for an arbitrary string).

name type description


retain-zero-exponent Boolean A l l o w 10°.
output-decimal-marker Symbol D e c i m a l symbol.
group-separator Code S p ac e b e t w e e n the digits for large nu m b e r s .
round-precision Number N u m b e r of digits to output.
exponent-base Literal B a s e for exponential notation.
exponent-product Literal Multiplication s y m b o l for exponential notation.
round-mode Literal C a n be n o n e or p l a c e s for fixed point display.
i n p u t - dec i m a l - m a r k e r s Literal D e c i m a l s y m b o l for nu m b e r s .
input-digits Literal N u m b e r of digits for nu mb e r s .
input-quotient Literal Division s y m b o l for nu m b e r s .
input-exponent-marker s Literal Exponentiation s y m b o l for n u m b e r s .
input-ignore Literal N u m b e r of characters to ignore.

continued...

102
2.26 siunitx

... continued
name type description
input-product Literal Multiplication s y m b o l for n u m b e r s .
input-signs Literal Sign s y m b o l for n u m b e r s .
add-decimal-zero List P a d n u m b e r s w i t h zeros.
explicit-sign Literal Sign s y m b o l for n u m b e r s .
table-alignment Type A l i g n m e n t of the table c o l u m n , valid values are
cent er , left, a n d right.
table-auto-round Boolean S w i t c h to r o u n d i n g n u m b e r s automatically to
achieve the number of digits specified by
table-format.
table-format Number S y m b o l i c specifier for decimal n u m b e r s in table
columns.
table-number-alignment List Alignment of S colu mn s, valid values are
center-decimal-marker, ce nt er , left, and
right.
table-parse-only Boolean D o not align S c o l u m n s at the decimal separator.
table-text-numbers Type A l i g n m e n t of text in S columns, possible values are
ce nter, left, a n d right.
table-unit-alignment Type A l i g n m e n t of unit s co lu mn s, possible values are
ce nt er , left, a n d r i g h t (cf. E x a m p l e 02-26-6 o n
p a g e 106).
tight-spacing Boolean R e d u c e spacing b y ±.
inter-unit-separator Literal Separator for units.
unit-value-separator Literal S p ac e b e t w e e n n u m b e r a n d unit.
use-xspace Boolean U s e the \ x s p a c e c o m m a n d f r o m the p a c k a g e of
the s a m e n a m e after a unit.

2 .2 6 .1 C o lu m n s o f n u m b e rs

C o l u m n s of n u m b e r s are aligned b y default at the decimal point such that all dots in a c o l u m n
are aligned a n d centred (first c o l u m n in the E x a m p l e 02-26-1). This case corresponds to the
pa r a m e t e r setting t a b l e - n u m b e r - a l i g n m e n t = c e n t e r - d e c i m a l - m a r k e r .

T h e s e c o n d c o l u m n in the following e x a m p l e is typeset w i t h the k e y w o r d setting


t a b l e - n u m b e r - a l i g n m e n t = c e n t e r , w h i c h first aligns the dots but th en centres the c o l u m n
as a whole. T h e third a n d fourth c o l u m n s h o w right- a n d left-aligned columns, again w i th the
dots aligned first a n d t h en the c o l u m n aligned left or right as a whole. Y o u c a n c h a n g e the
decimal point to b e a c o m m a t h r o u g h the o u t p u t - d e c i m a l - m a r k e r = { ,} option.

\u s e p a c k a g e {s iu n itx , booktabs}

\s is e tu p { ta b le -fig u r e s -in te g e r = 2 , ta b le -fig u re s -d e c im a l= 4 }


\b e g in {ta b u la r}{ S | % d e fa u lt column s e ttin g
S [tab le-n u m b e r-alig n m e n t= ce n te r] |
S [ta b le -n u m b e r-a lig n m e n t= rig h t] |

103
2 Packages

S [ta b le -n u m b e r-a lig n m e n t= le ft, o u tp u t-d e c im a l-m a rk e r= {, } ] } \t o p r u le


\e ra p h {d e fa u lt}& \e ra p h {c e n tre d }& \e m p h {rig h t-a lig n e d }& \e m p h {le ft-a lig n e d }\\\m id ru le
2.3456 & 2.3456 & 2.3456 & 2.3456 \\
34.25 & 34.25 & 34.25 & 34.25 \\
6.7835 & 6.7835 & 6.7835 & 6.7835 \\
90.473 & 90 .473 & 90.473 & 90.473 \\\b o tto m r u le
\e n d { ta b u la r }

d e fa u lt c e n tre d rig h t-a lig n e d le ft-a lig n e d

2.3456 2.3456 2.3456 2,3456


34.25 34.25 34.25 34,25
6.7835 6.7835 6.7835 6,7835
90.473 90.473 90.473 90,473

T h e t a b l e - f o r m a t option formats the c o l u m n of n u m b e r s . T h e f o rm at for this option is


< n u m b e r > < d e c im a l s e p a r a to r < n u m b e r > , for e x a m p l e 2.4, w h i c h specifies t w o digits before
the decimal separator a n d four digits after. T h e s a m e applies for exponents: 2 . 2e l. 1 takes
four digits for the mantissa (2.2) a n d t w o digits for the e x p o n e n t (1.1). T h e e x p o n e n t will not
h a v e a n y digits after the d eci ma l separator in the logarithmic notation. A sign in front of
the f o r m a t specification (as in the c o l u m n definition of the s e c o n d c o l u m n in the following
example) advises the pa ck ag e to take the possible presence of a sign in the input into account
w h e n determining alignment.

\u s e p a c k a g e [e x p o n e n t-p ro d u c t= \c d o t]{s iu n itx } \usepackage{booktabs}

\s is e tu p {ta b le -n u m b e r-a lig n m e n t= c e n te r}


\b e g in { ta b u la r } { S [ ta b le -fo rm a t= 2 . 2e2]
S [ta b le -fo rm a t= + 2 .2 e 2 ]
S[ ta b le -fo rm a t= 2 . 2 e l .1 ]
S }\to p r u le
\em ph{very la rg e va lu e s} & \em ph{very la rg e v a lu e s } &
\em ph{very la rg e va lu e s} & \e m p h {v a lu e s }\\\m id ru le
2 .3 e l & 2 .34el & + - 2 .3 4 e l & + 2 .3 1 \ \
- 3 4 . 23e45 &-3 4 .2 3 e 4 5 & -3 4 .2 3 e 4 5 & 34.23 \ \
-5 6 .7 8 &-5 6 .7 8 & -5 6 .7 8 & -5 6 .7 8 \ \
1.0e34 & 1.0e34 & + 1.0e34 & + -1 .0 \\\b o tto m r u le
\e n d { ta b u la r }

v e r y la rg e va lu es v e r y la rg e v a lu e s v e r y la rg e v a lu e s v a lu e s

2.3 -101 2.34 • 1 0 1 ±2.34 • 1 0 1 2.31


- 3 4 . 2 3 • 1045 -3 4 . 2 3 • 1 0 45 - 3 4 . 2 3 • 1045 34.23
- 5 6. 78 - 5 6. 78 -56.78 - 5 6. 78
1.0 • 1034 1.0 - 1 0 34 1.0 - 1 0 34 ±1.0

104
2.26 siunitx

In the exponential notation, the format ca n be specified w i t h the t a b l e - s i g n - e x p o n e n t


option. T h e value t r u e causes the n u m b e r s to b e aligned at the decimal separator as well as
the decimal power, f a l s e causes the decimal p o w e r to appear immediately after the mantissa.

Y o u c a n use the t a b l e - a u t o - r o u n d option to f o r m a t n u m b e r s automatically t h r o u g h


roun di ng or p a dd in g to achieve the n u m b e r of digits specified b y t a b l e - f o r m a t . This option
is ignored, ho we ve r, if the c o l u m n is also set to b e centred at the decimal separator t h r o u g h
t a b l e - n u m b e r - a l i g n m e n t = c e n t e r - d e c i m a l - m a r k e r , as s h o w n in the following example:

\u s e p a c k a g e [e x p o n e n t-p ro d u c t= \c d o t]{s iu n itx }


| 02 -26-3 | column column column \usepackage{booktabs}
1.2 1.200 1.2 \s is e t u p { t a b le - f o r m a t = l. 3 , ta b le -a lig n m e n t= c e n te r}
1.234 1.235 1.234
\b e g in {ta b u la r}{%
5
S [ta b le -a u to -ro u n d ]
S [ta b le -a u to -ro u n d ,
ta b le -n u m b e r-a lig n m e n t= c e n te r-d e c im a l-m a rk e r]}\to p ru le
\emph{column} & \emph{column}
6 \emph{column} \\\ m i d r u le
1 .2 & 1 .2 & 1 .2 \\
1 .2 34 & 1.2345 & 1 . 2 3 4 \ \
\b o tto m ru le
\e n d { ta b u la r }

Y o u ca n prevent n u m b e r s aligning at the decimal separator or the e x p o n e n t b y specifying


t a b l e - p a r s e - o n l y ; then the c o l u m n s are aligned solely according to t a b l e - n u m b e r - a l i g n m e n t .

\u s e p a c k a g e [e x p o n e n t-p ro d u c t= \c d o t]{s iu n itx }


| 02 -26-4 | centred left-aligned right-aligned \s is e tu p { ta b le -p a r s e -o n ly }
14.2 14.2 14.2 \usepackage{booktabs}
1.23456 1. 2 3 4 5 6 1. 2 3 4 5 6
\b e g in { ta b u la r } { S S [ta b le -n u m b e r-a lig n m e n t= le ft]
co
C'Q
r—1
O
t—1

1.2 • 1 0 3 1.2 • 1 0 3 S [ta b le -n u m b e r-a lig n m e n t= rig h t]}\to p ru le


\em ph{centred} & \e m p h {le ft-a lig n e d }
& \e m p h {rig h t-a lig n e d } \\\ m i d r u le
1 4 .2 & 1 4 .2 & 1 4 .2 \ \
1.23456 & 1.23456 & 1 .2 3 4 5 6 \\
1.2 e3 & 1.2 e3 & 1 .2 e 3 \\\b o tto m r u le
\e n d { ta b u la r }

A s w i th the d c o l u m n pack ag e (Section 2.24 o n p a ge 98), y o u can also align entries in a table
e v e n if th ey a r e n ’t purely numerical, for e x a m p l e 2 . 3 4 5 6 ± 0 . 0 2 for a n u m b e r w i t h error
margin. T o d o this, y o u n e e d to define the following options appropriately: g r o u p - s e p a r a t o r
for the spacing b e t w e e n the digits, o u t p u t - d e c i m a l - m a r k e r for the output decimal separator,
i n p u t - d i g i t s for the digits a n d s y mb ol s of the input, a n d i n p u t - d e c i m a l - m a r k e r s for the
input decimal separator. If the format b e c o m e s ve ry complex, it’s a g o o d idea to define a n e w
c o l u m n type b a se d o n S using \ n e w c o l u m n t y p e .

105
Packages

\u s e p a c k a g e {s iu n itx }
numbers \usepackage{booktabs}
2.3456 ± 0.02
\b e g in { ta b u la r } {
34.2345 ± 0.001
S [g ro u p -s e p a ra to r= {},
56.7835 ± 0 . 0 6 7 o u tp u t-d e c im a l-m a rk e r= {\, \p m \, } ,
90.473 ± 0 . 0 2 1 in p u t-d ig its = {0 1 2 3 4 5 6 7 8 9 . } ,
in p u t-d e c im a l-m a rk e rs = {+ }] } \t o p r u le
\em p h {n um bers}\\\m id ru le
2.3456 + 0 .0 2 \ \
34.2345 + 0 .0 0 1 \ \
56.7835 + 0.0 6 7 \ \
90 .473 + 0 .0 2 1 \\\b o tto m r u le
\e n d { ta b u la r }

2 .2 6 .2 C o lu m n s o f n u m b e rs w ith u n its

A s well as the S c o l u m n type, there is the s type, w h i c h is u s e d to f o r m a t units a n d output


t h e m as a n o r m a l c o l u m n w i t h space \ t a b c o l s e p to the previous one.

\u s e p a c k a g e {s iu n itx } \usepackage{booktabs}
value unit 02 -26-6 !

\b e g in { ta b u la r } {
2.16 x l O “ 5 m 2 s-1
S[ t a b le -fo r m a t= l. 2 e - l , ta b le -a lig n m e n t= c e n te r]
I—‘
1
to
CO

2.83 x 1 0 -6
s

s [ t a b le - u n it - a lig n m e n t = le f t ] } \t o p r u le
7.39 x 10 3 P a m 3 mol 1 {\e m p h {v a lu e }} & \e m p h { u n it} \\\m id r u le
1.0 xlO5 Pa 2 .1 6 e -5 & \m etre\sq u are d \p er\s eco n d \\
2 .8 3 e -6 & \m etre\sq u are d \p er\s eco n d \\
7.39e3 & \p a s c a l\c u b ic \m e tr e \p e r \m o le \\
1.0 e 5 & \p a s c a l \\\b o tto m r u le
\e n d { ta b u la r }

Setting the c o l u m n i » the unit closer to the value.

\u s e p a c k a g e {s iu n itx } \usepackage{booktabs}
value unit 02 - 26-7 I

\b e g in { ta b u la r } { S [ta b le -fo r m a t= l. 2 e - l ,
2.16 x 1 0 " 5 m 2 s-1
tab le-n u m b e r-alig n m e n t= ce n te r]@ {\kern 5 p t}
2.83 x 10-® m 2 s_1
s [ t a b le - u n it - a lig n m e n t = le f t ] } \t o p r u le
7.39 x 1 0 3 P a m 3 m o l -1 {\e m p h {v a lu e }} & \e m p h { u n it} \\\m id r u le
lO
t—
o

O
i—i

Pa
X

2 .1 6 e -5 & \m etre\sq u are d \p er\s eco n d \\


1

2 .8 3 e -6 & \m etre\sq u are d \p er\s eco n d \\


7.39e3 & \p a s c a l\c u b ic \m e tr e \p e r \m o le \\
1.0 e 5 & \p a s c a l \\\b o tto m r u le
\e n d { ta b u la r }

If the unit is a l w a y s the same, y o u c a n specify it in the c o l u m n definition instead, but


r e m e m b e r that th en it m u s t b e enclosed in double curly braces < { { . . . } } !

106
2.27 polytable

\usepackage[exp o n en t-p ro d u ct= \cd o t] { s iu n itx }


0 2 -2 6 -8 ~| no mass mass/103 kg
\usepackage{booktabs}
1 4.56 • 103 k g 4.56 \s is e tu p {ta b le -a lig n m e n t= c e n te r}
2 2.40 • 103 k g 2.40
\b e g in { ta b u la r } { c
3 1 . 34 5-104 k g 13.45
S [ t a b le - f o r m a t = 1 .3 e l] < { { \,\s i{ \k ilo g r a m } } }
4 4.5 • 102 k g 0.45 S [ta b le -fo rm a t= 2 . 2 ] } \t o p r u le
\emph{no} & \m u ltic o lu m n {l}{c }{\e m p h {m a s s }}
& { m a s s /\S I{ e 3 } { \k ilo g r a m } } \\\m id r u le
1 & 4 . 56e3 & 4 .5 6 w
2 & 2.40e3 & 2 .4 0 w
3 & 1 . 345e4 & 13.45 w
4 & 4 . 5e2 & 0.4 5 \\\b o tto m r u le
\e n d { ta b u la r }

2 .2 7 p o ly ta b le

T h e p o l y t a b l e pa c k a g e b y A n d r e s L o h is a very particular application. It is especially helpful


w h e n y o u are formatting source code but c a n ’t use the standard l i s t i n g s pa ck ag e for source
c o d e listings. W i t h p o l y table, y o u c a n assign sy mb ol ic n a m e s to individual c o l u m n s a n d
then refer to them.

\begin{pboxed} \end{pboxed}
\begin{ptboxed} ... \end{ptboxed}
\begin{pmboxed} ... \end{pmboxed}
\ d e f a u l t c o l u m n { column type} \nodefaultcolumn

\column{ name}{type} \ f r o m t o {from}{to}{text}

\={from} [formatting] \> [from] [formatting] \ < [from]

T h e t e r m “b o x e d ” d o es not d e no te a f r a m e here, but that the r o w s are p u t into horizontal


boxes of the natural width. For p b o x e d , this is d o n e in p a r a g r a p h m o d e , so this e n v i r o n m e n t
can therefore contain p a g e breaks. For p t b o x e d , the r o w s are additionally put into a t a b u l a r
environment, a n d for p m b o x e d into a n a r r a y environment; w i t h these environments, a p a g e
break is not possible. T h e c o m m a n d s k n o w n f r o m the t a b b i n g e n v i r o n m e n t for setting tabs
are redefined b y the p o l y t a b l e p a c k a g e to w o r k in the s a m e w a y as the \ f r o m t o c o m m a n d .

Valid definitions for c o l u m n s are for e x a m p l e \ c o l u m n{foo}{r} or \column{fcar}{/}: the


c o l u m n with n a m e foo is of type r (right-aligned) a n d bar of type 1 (left-aligned). W i t h
the \ f r o m t o c o m m a n d , y o u c a n typeset text starting at the from c o l u m n (tab) across to
the to c o l u m n (tab). T h e modus operandi of p o l y t a b l e takes a bit of getting u s e d to, but
provides s o m e a d v a nt ag es over the n o r m a l t a b b i n g e n v i r o n m e n t o n c e it is understood. In
the following example, the four c o l u m n s A - D are defined; the w i d t h of the c o l u m n results
f r o m the following tab. This is also the reason w h y the c o l u m n s C a n d D are only defined in
the s e c o n d r o w - the entry w o u l d be too w i d e for the B c o l u m n in the first row.

107
2 Packages

function fact(n: integer): integer; \u s ep ac kag e {p o lyta b le}


begin \begin{pboxed}
if n > 1 then \c o lu m n {A }{l}\c o lu m n {B }{l}\c o lu m n {C }{l}\c o lu m n {D }{l}
fact:= n * fact(n-l) \= {A } fu n c tio n
else \> [B ] \ t e x t b f { f a c t ( n : i n t e g e r ) } : i n t e g e r ; \ \
fact:= 1; \> [B ] begin \> [C ]\q q u a d \> [D ]\q q u a d \\
end; \= { C } i f $n>l$ then \ \
\= { D } f a c t : = n * f a c t ( n - l ) \ \
\> [C ] els e \ \ \> [D ] f a c t : = 1; \ \ \> [B ] end;
\end{pboxed}

A more complex example can be found in the documentation of the package.

2 .2 8 ta b to

The tabto package by Donald Arseneau is available in two different versions, for plain
TeX and for ETeX. Usually the KT£X version is shipped with a TeX distribution like T£XLive;
therefore only the package named tabto can be found. The same package is called ta b to -ltx
on CTAN however. The package defines four new commands:

\tab \tabto * { le n g th }
\TabPositions{posl, p o s 2 ,. . . p o s n } \NumTabs{ m/mber}

The \tabto command lets you jump to a specific distance without explicitly having defined a
tab there. If the jump to the specified place is not possible, a line break is inserted automatically
to make it possible. Paragraph indents are considered accordingly.

A jump to 3 cm. \u sep ackag e{tab to }

A\tabto{3cm }jum p to 3 \ , c m . \ \
A long text at the beginning \m a k e b o x [3 c m ][r]{ $ \rig h ta rro w $ }\\
jump to 3 cm. A long t e x t a t th e beginning
\tabto{3cm }jum p to 3 \ , c m . \ \
\m a k e b o x [3 c m ][r]{$ \rig h ta rro w $ }

The starred version \tabto* places the tab regardless of the current position in the text;
the text in the second line in the following example is overwritten twice. In both cases, a
jump back to the specified position is performed, first to 3 cm, then to 1 cm.

A jump to 3 cm. \u sep ackag e{tab to }


0 2 -28-2

A \tabto*{3cm }jum p to 3 \ , c m . \ \
A long l o s t at the begiimjng) 3 cm. \makebox[3 cm] [ r ] { $ \ r i g h t arrow $ } \ \
A long te x t a t th e beginning
\tab to*{3cm }ju m p to 3\,cm .%
\ t a b t o * { l c m } l \ , cm \\
\m a k e b o x [lc m ][r] {$ \rig h ta rro w $ }%
\m a k e b o x [2 c m ][r]{$ \rig h ta rro w $ }

108
2.29 Tabbing

You can place tabs using the two commands \TabPositions and \NumTabs. In the first
case, the argument is a comma-separated list of spaces; in the second case the argument is
the number of tabs, which are then distributed evenly across the whole line. The jump to the
next position is triggered through the \tab command. The spaces are always relative to the
default left text margin.

A jump to 3 cm. \usep ackag e{tab to}

\TabP o sition s{lcm ,3cm }


A long text at the beginning A \ta b \ta b jump to 3 \ , c m . \ \
line break! \makebox[3 cm] [ r ] { $ \ r i g h t arrow$} \ \
0 1cm 3 cm A long te x t a t the beginning%
\t a b lin e b r e a k ! \\
0 \ta b l\,c m \t a b 3\,cm

If a defined tab on the line is not possible with a \tab command because of the current
position in the text, the tab is automatically replaced by a line break; the following text then
starts at the beginning of the next line. The \NumTabs command is somewhat unclear; in
theory the specified number defines the number of the tabs, but the first tab is placed at the
beginning of the line at Opt and not reachable through \tab. Therefore \NumTabs{4} defines
tabs at Opt, 0.25\linewidth, 0.5\linewidth, and 0.75\linewidth. Thus the following
example produces a line break in the second line because a third tab within that single line
was not possible.
______ 1 2 3 end \usep ackag e{tab to}
1 02 -28-4 1
1 2
\NumTabs{4}
3 end \ t a b l\t a b 2 \t a b 3 \ h f i l l end\par
\NumTabs{3}
\ t a b l\t a b 2 \t a b 3 \ h f i l l end

2 .2 9 T a b b in g

The Tabbing package by Jean-Pierre F. Drucbert lets you use accents within the Tabbing
environment. This means that the \a workaround for the standard tabbing environment
is not necessary (cf. Example 01-02-4 on page 14), but instead you have to give each tab
command as an argument to the \TAB command. It is up to you to decide which method you
find less cumbersome.
The example line can be “killed” \usepackage{Tabbing}
first café \b eg in {T ab b in g }
second café The \TAB{=}example lin e \TAB{=}can
mâitre \TAB{=}be \T A B {= }“ k i l l e d ’ * \ \
crème brûlée \T A B { > } fir s t c a f \ ’ e \ \
\TAB{>}\TAB{>}second c a f \ ’ e \ \
\TA B {>}\TAB{>}\TAB {>}m \Aa i t r e \ \
\TA B {>}cr Verne
\TA B {> }\T A B {> }\T A B {> }b r\Au l \ ’ ee
\end{Tabbing}

109
2 Packages

110
C h a p t e r

C o lo u r in ta b le s
3.1 c o lo rtb l.......................................................................................................... 111
3.2 x c o lo r ............................................................................................................ 116
3.3 T^Xiiicalities............................................................................................................................. 122

With colour printers now widespread, using colours in tables is becoming more significant
- they are an additional stylistic device to make tables more readable. This chapter covers
the packages that support using colours in tables. If you want to use colour, always load the
xcolor package; it is loaded by the c o lo rtb l package anyway and its support for selecting
colours is much better.

3 .1 c o lo r tb l

The c o lo rtb l package by David Carlisle stands for “colour table” and lets you add colour to
tables in the form of coloured columns, rows, cells, or lines. The color package is required for
that and is loaded automatically. The xcolor package extends the capabilities of this package
by some additional commands. Further information can be found in Section 3.2 on page 116.

3 .1 .1 C o lu m n s

To colour columns, you must use the \columncolor command in the column definition of
the table. The command has the following syntax:

\columncolor [colour model] { co lo u r} [overhang left] [overhang right]

The c o lo u r m o d e l denotes one of the models defined by the color or xcolor packages, for
example rgb or cmyk (cf. Section 3.2 on page 116). For c o lo u r , you can use the predefined
3 Colour in tables

nam e of a colour, for example re d , or the colour m odel’s respective num erical values for a
colour. You can use the tw o optional argum ents, o v e r h a n g le f t and o v e r h a n g r ig h t, to make
the column wider - this only refers to the colour though and does not affect the actual width
of the column. If no overhang is specified, b o th values are set to \ta b c o ls e p . If only o n e
o verh a n g optional argum ent is given, it also automatically refers to both\ Specifying [O pt] is identical
to [O pt] [Opt] (cf. Example 03-01-7 on page 114).

one two three \u s e p a c k a g e { c o lo r tb l}


\d e f in e c o lo r{ g ra y 7 0 } { g r a y } { 0 .7}
A B C
\d e fin e c o lo r{ g ra y 9 0 } { g r a y } { 0 .9 }

\b e g in { ta b u la r} { > { \c o lu m n c o lo r{ g ra y 7 0 } } c
> { \c o lu m n c o lo r [ rg b ] { 1 , 0 , 0}}c
> { \c o lu m n c o lo r{ g ra y 9 0 } } c }
one & two & t h r e e \ \ A &B &C
\e n d { ta b u la r }

As can be seen from the above example, the whole w idth of the respective column is
coloured; the overhang defined internally defaults to adding \ t a b c o ls e p to the left and right
of the norm al w idth. If in fact you only w ant to colour the actual w idth of the text in the
column, set the overhangs to [O pt]. This is illustrated in the next example; the vertical lines
have only been added to make the effect clearer.

one two three \u s e p a c k a g e { c o lo r tb l}


A B \d e f in e c o lo r{ g ra y 7 0 } { g r a y } { 0 .7}
C
\d e f in e c o lo r{ g ra y 9 0 } { g r a y } { 0 .9}

\b e g in { ta b u la r} { |> { \c o lu m n c o lo r { g r a y 7 0 } [ O p t] } c|
> { \c o lu m n c o lo r [ rg b ] { 1 ,0 , 0 } [O p t] } c |
> { \c o lu m n c o lo r{ g ra y 9 0 } [0 p t]} c | }
one & two & t h r e e \ \ A &B &C
\e n d { ta b u la r }

If a table is left- and right-aligned through @{}, you m ust take this into account for the
columns: there must be no overhang on the left in the first column, and similarly on the right
in the last column. This is show n in the following example:

one two three \u s e p a c k a g e { c o lo r tb l} r-----


A B C \ d e f i n e c o l o r { g ra y 7 0 } { g ra y } { 0 .7} i 03"c
\d e f in e c o lo r{ g ra y 9 0 } { g r a y } { 0 .9}

\b e g in { ta b u la r} { @ { } > { \c o lu m n c o lo r{ g ra y 7 0 } [0 p t][ \ t a b c o l s e p ] }c
> { \c o lu m n c o lo r [ rg b ] { 1 , 0 , 0}}c
> { \c o lu m n c o lo r{ g ra y 9 0 } [\ta b c o ls e p ][O p t]} c @ { } }
one & two & t h r e e \ \ A &B &C
\e n d { ta b u la r }

112
3 .1 c o lo r t b l

3.1.2 Rows
Rows are always coloured after the colum ns have been coloured, i.e. the colour o f a row
overw rites the colour of the respective column. This results from the fact th at coloured
columns are specified in the header already. The \ro w c o lo r command colours a whole row
of a table, but you can also use the \ c e l l c o l o r command to colour individual cells of a row
(cf. Section 3.1.3 on the next page).

\ro w c o lo r [colour model] { c o lo u r } [overhang left] [overhang right]

\ro w c o lo r has the same syntax as \c o lu m n c o lo r, but w ith different effects, \ro w c o lo r
must always be at the beginning of the first column of the particular row, and only affects that
row. \ro w c o lo r is in fact simply a concatenation of individual \c o lu m n c o lo r or \ c e l l c o l o r
commands.

one two three \u s e p a c k a g e [ ta b le ] { x c o lo r }


1 03 -01-4 |
A B C \b e g in { ta b u la r } { c c c }
uno due tre \r o w c o lo r [ g ra y ]{ 0 .6 } o n e & two & t h r e e \ \
\r o w c o lo r[g ra y ]{ 0 .7 } A &B &C \\
\ro w c o lo r [ g ra y ]{ 0 .9 } u n o &due & t r e
\e n d { ta b u la r} \\[6 p t]
%
\ b e g i n { t a b u l a r } { |> { \c o lu m n c o lo r{ g ra y !7 0 } [O p t] } c |
> { \c o lu m n c o lo r [rg b ] { 1 ,0 ,0 } [O p t] }c |
> { \c o lu m n c o lo r { g ra y !9 0 } [0 p t]} c |}
\r o w c o lo r [ g r a y ] { 0 .6 } th r e e & two & t h r e e \ \
\ro w c o lo r{ c y a n } A &B &C \\
uno &due & t r e
\e n d { ta b u la r }

one two three \u s e p a c k a g e { c o lo r tb l}


A B C \b e g in { ta b u la r} { ||@ { }
uno due tre > { \c o lu m n c o lo r [ g r a y ] { .7 } [ 0 p t] [ \ t a b c o l s e p ] }ccc@{} | | }
\r o w c o lo r [ g ra y ]{ 0 .6 } o n e & two& t h r e e \ \
one two three \ro w c o lo r{ c y a n } A & B & C \\ uno & due & t r e
A B C \e n d { ta b u la r} \\[8 p t]
uno due tre \b e g in { ta b u la r} { ||@ { }
> { \c o lu m n c o lo r [ g r a y ] { .7 } [ 0 p t] [ \ t a b c o l s e p ] }ccc@ {> I|}
one two three \r o w c o lo r [ g r a y ] { 0 .6 } [ 0 p t] o n e & two& t h r e e \ \
A B C \r o w c o lo r{ c y a n } [0 p t] A & B & C \\ uno & due & t r e
uno due tre \e n d { ta b u la r} \\[8 p t]
\b e g in { ta b u la r} { ||@ { }
> { \c o lu m n c o lo r [ g ra y ]{ . 7 } [ 0 p t ] [ \ t a b c o l s e p ] }cc
> { \c o lu m n c o lo r { w h ite } [\ta b c o ls e p ][ 0 p t] } c @ { } ||}
\ r o w c o lo r [ g r a y ] { 0 .6}one & two& t h r e e \ \
\ro w c o lo r{ c y a n } A & B & C \\ uno & due & t r e
\e n d { ta b u la r }

113
Colour in tables

The optional argum ents of \ro w c o lo r d on’t refer to the left and right o f the row, but
as before to the columns, m aking them unusable for colouring row s effectively. In the first
table of example 03-01-5 on the preceding page \ro w c o lo r leads to a correct left margin, but
incorrect right one; it doesn’t take the final @operator into account, but simply takes the
internal value for the right overhang, which defaults to \ta b c o ls e p . The second table shows
that if the optional arguments of \ro w c o lo r are used, it affects the individual columns as well.
Only the third table shows the desired result - achieved by defining the third colum n w ith
colour w hile and optional argum ents [ \ t a b c o l s e p ] [O pt], and using \ro w c o lo r w ithout
an optional argum ent. The same w ould have to be done for the first colum n if it w ere not
coloured.

3.1.3 Cells
In the order of colouring, cells are last. Therefore they overw rite any colours for columns
and rows. In principle, the \ c e l l c o l o r com m and is only a shortcut for the \m u ltic o lu m n
command, which assumes the current column type and sets a colour through \ro w c o lo r.

\ c e l l c o l o r [colour model] { c o lo u r }

Unlike the colour commands for columns and rows, \ c e l l c o l o r doesn’t have any optional
argum ents for the overhang, but assumes the current values. W hen colouring the first cell in
a column, the \ c e l l c o l o r command m ust come after any \ro w c o lo r command.

one two three 1 \u s e p a c k a g e { c o lo r tb l} .---------


[ 03 -01-6
A B C \b e g in { ta b u la r } { c c c }
uno due tre \r o w c o lo r [ g ra y ]{ 0 .6 } o n e & two & t h r e e \ \
\r o w c o lo r[g ra y ]{ 0 .7 } A & \c e llc o lo r { w h ite } B & C \ \
\r o w c o lo r [ g r a y ] { 0 .9 } \c e llc o lo r { r e d } u n o & due
& \c e llc o lo r{ w h ite } tre
\e n d { ta b u la r }

one two three \u s e p a c k a g e { c o lo r tb l}


B \d e f i n e c o lo r{ g ra y 7 0 } { g r a y } { 0 .7}
A C
\d e fin e c o lo r{ g ra y 9 0 } { g r a y } { 0 .9 }
uno •dud tre
\b e g in { ta b u la r } { |> { \c o lu m n c o lo r { g r a y 7 0 } [ 0 p t] } c |
> { \c o lu m n c o lo r [ rg b ] { 1 ,0 , 0 } [O p t] } c |
> { \c o lu r a n c o lo r { g r a y 9 0 } [ 0 p t]} c |}
\r o w c o lo r [ g ra y ]{ 0 .6 } o n e & two & \ c e l l c o l o r { w h i t e } t h r e e \ \
\ro w c o lo r{ c y a n } A & \c e llc o lo r { w h ite } B &C \\
\c e llc o lo r { w h ite } u n o & due & tre
\e n d { ta b u la r }

114
3 .1 c o lo r t b l

one two three \u s e p a c k a g e { c o lo r tb l}


03-01-8
A в C \d e fin e c o lo r{ g ra y 7 0 } { g r a y } { 0 .7 } \d e fin e c o lo r{ g ra y 9 0 } { g r a y } { 0 .9 }
uno due tre \b e g in { ta b u la r} { @ { } > { \c o lu m n c o lo r{ g ra y 7 0 } [0 p t][ \ t a b c o l s e p ] }c
> { \c o lu m n c o lo r [ rg b ] { l,0 ,0 } } c
> { \c o lu m n c o lo r{ g ra y 9 0 } [\ta b c o ls e p ][O p t]} c @ { } }
\c e ll c o lo r { w h it e } o n e & two & t h r e e \ \
\ro w c o lo r{ c y a n } A & \c e llc o lo r { w h ite } B &C \\
\r o w c o lo r [ g ra y ]{ 0 .9 } u n o & due & \ c e l l c o l o r { w h i t e } t r e
\e n d { ta b u la r }

3.1.4 Lines
Coloured vertical lines are the easiest ones to achieve - just replace the usual | operator with
! { \c o lo r { c o lo u r } \v lin e } , inserting an appropriate value for the c o lo u r.

one two three \u s e p a c k a g e { c o lo r tb l}


03-01-9
A В C \b e g i n { t a b u l a r } { ! { \ c o l o r [ g r a y ] { 0 . 2 } \v lin e } c
uno due tre ! { \ c o l o r [ g r a y ] { 0 .4 } \ v l i n e } c ! { \ c o l o r [ g r a y ] { 0 . 6 } \v lin e } c
! { \ c o l o r [ g r a y ] { 0 . 7 } \v lin e } ! { \ c o l o r [ g r a y ] { 0 .9 } \v lin e } }
one & two & t h r e e \ \ A & B & C \ \
uno & due & t r e
\e n d { ta b u la r }

If you create double lines, the space betw een them remains white. If you w ant this space
filled in, use a single thicker line of w idth 2 \a r r a y r u le w id th + \d o u b le r u le s e p instead, as
in the following example:

one two three \u s e p a c k a g e { c o lo r tb l}


03-01-10 I
A в \n e w le n g th \D ic k e \s e tle n g th \D ic k e { 2 \a r r a y r u le w id th }
C
\a d d to le n g th \D ic k e { \d o u b le r u le s e p }
uno due tre
\ b e g in { ta b u la r } !
! ( \ c o l o r [ g r a y ] { 0 .2 } \ v l i n e } ! { \ c o l o r [ g r a y ] { 0 . 2 } \v lin e } c
! { \ c o l o r [ g r a y ] { 0 .2 } \ v r u l e w id th \D ic k e } c
!{ \ c o l o r { r e d } \ v l i n e } ! { \c o l o r { r e d } \ v lin e } c
! { \c o l o r { c y a n } \v r u le w id th \D ic k e} }
one & two & t h r e e \ \ A & B & C \ \ uno & due & t r e
\e n d { ta b u la r }

c o l o r t b l provides the following two commands:

\ a r r a y r u l e c o l o r [colour model] { c o lo u r}
\d o u b le r u le s e p c o lo r [colour model] { c o lo u r }

These set the colours globally for all line types; they m ay therefore occur anyw here. They
only apply to lines after their declaration; if you insert them after the table header, they w on’t
affect the colour of the vertical lines, as shown here:

115
Colour in tables

\u s e p a c k a g e { c o lo r tb l}
| one | | two | ^ t h r e ^ l \s e tle n g th \a rra y ru le w id th { 2 p t}
1 A Im 1 c | \ a r r a y r u le c o lo r { r e d } \d o u b l e r u le s e p c o l o r { b lu e }

| uno P | due Ц tre \ b e g i n { t a b u l a r } { ||c |||c |||c ||} \ h l i n e \ h l i n e


one & two & t h r e e \ \ \ h l i n e \ a r r a y r u l e c o l o r [ g r a y ] { 0 .9 }
A & В &C \\\h lin e \h lin e
uno & due & t r e \ \ \ h l i n e \ h l i n e
\e n d { ta b u la r }

\u s e p a c k a g e { c o lo r tb l} -------
\s e tle n g t h \ a r r a y r u l e w i d t h { 2 p t } -0-3-0?"
\ a r r a y r u l e c o l o r { r e d } \d o u b l e r u le s e p c o lo r [ g r a y ] { 0 .6 }

\ b e g i n { t a b u l a r } { ||c |||c |||c ||} \ h l i n e \ h l i n e


one& two& t h r e e \ \ \ c l i n e { l - 2 } \ a r r a y r u l e c o l o r [ g r a y ] {0 .9 }
A & B& C \ \ \ c l i n e { l - l } \ c l i n e { 3 - 3 } \ a r r a y r u l e c o l o r { b l a c k }
uno& due& t r e \ \ \ c l i n e { 2 - 2 }
\e n d { ta b u la r }

The example above shows th at corners d on’t always look great, especially w hen using
\ c l i n e . The h h lin e package works better here.

3 .2 x c o lo r
The m ain difference betw een the x c o lo r package by Uwe Kern and the c o lo r package by
David Carlisle is that the latter always activates the option dvipsnam es if one of the drivers
dvips, oztex, or xdvi is chosen. This can cause problems if the docum ent is compiled w ith
pdftex, which will report undefined colours. This is why x c o lo r expects the user to explicitly
specify the option dvipsnam es if the corresponding predefined colours are to be used.
\u se p a c k a g e [ d v ip s n a m e s ,p ro lo g u e ] { x c o lo r }
The c o l o r t b l package, described in Section 3.1 on page 111, is loaded automatically by
x c o lo r if the package option t a b l e is given (cf. Table 3.1).

T able 3.1: Summary of th e package options of x c o lo r.

o p tio n d e s c rip tio n

n a tu ra l (default) Uses all colours w ithin their model, except RGB (converted to
rgb), HSB (converted to hsb), and Gray (converted to gray).
rg b Converts all colours into the rgb model.
cmy Converts all colours into the cmy model.
cmyk Converts all colours into the cmyk model.
hsb Converts all colours into the hsb model.
g ra y Converts all colours into the gray model.
c o n t i n u e d ...

116
3.2 xcolor

... c o n tin u e d

o p tio n d e sc rip tio n

RGB Converts all colours into the RGB model and then into the rgb model.
HTML Converts all colours into the HTML model and then into the rgb model.
HSB Converts all colours into the HSB model and then into the hsb model.
Gray Converts all colours into the Gray model and then into the gray model.
dvipsnames Loads the predefined DVIPS colours.
svgnames Loads the predefined SVG colours.
prologue Writes the list of colour names (dvipsnames) in the PostScript header;
this is important when creating documents through DVIPS.
tab le Loads the c o lo rtb l package to enable coloured table rows.
hyperref Support for hyperref.
showerrors (default) Outputs a message for undefined colours.
hideerrors Only outputs an error message if an undefined colour is used, and sets
it to black.

xcolor extends the functionality of c o lo rtb l especially when colouring alternate table
rows with different colours. The other advantage primarily concerns the definition of colours;
this is not specific to tables however and also applies to other uses. The colour models that
are supported by the current version of xcolor are summarized in Table 3.2.

Table 3.2: Supported colour models ( I , M , JV are natural numbers).

nam e b a se colours p a r a m e te r ran ge d e fa u lt

rgb red, green, blue [0,1]


cmy cyan, magenta, yellow [0,1]
cmyk cyan, magenta, yellow, black [0,1]
hsb hue, satu ratio n , brightness [0,1]
gray gray [0,1]
RGB Red, Green, Blue {0,1......1} L =255
HTML RRGGBB {000000,..., FFFFFF}
HSB Hue, Saturation, Brightness {0,1,..., M] M =240
Gray Gray {0,1,... ,1V} N =15
wave lambda (nm) [363,814]

In principle there is no difference between colouring the individual cells of a table or


matrix.

117
Colour in tables

B c \ \u s e p a c k a g e [ ta b le ] { x c o lo r } ,---------
i 03 -02-1
( A
A = A BBB C \ [ \u n d e rlin e { A } =
V A * C ) \ l e f t (\b e g in { a rra y } { c > { \c o lu m n c o lo r{ m a g e n ta } } c c }
A & B & C \\
\ro w c o lo r{ c y a n } A & \ c e l l c o l o r { w h i t e } BBB & C \\
A &B & C
\e n d { a rr a y } \r ig h t) \ ]

Using the \c o lu m n c o lo r, \ro w c o lo r, and \ c e l l c o l o r commands, you can achieve


any arbitrary com bination of colours. A n alternative to using \ c e l l c o l o r is to define an
individual cell w ith \m u ltic o lu m n and then use \c o lu m n c o lo r for it. The syntax of the three
colour com m ands in \ x c o l o r is the same as for the ones from c o l o r t b l , though \x c o lo r
also defines three additional commands for colouring rows w ith alternating colours.

\c o lu m n c o lo r [colour model] { c o lo u r } [overhang left] [overhang right]


\ro w c o lo r [colour model] { c o lo u r } [overhang left] [overhang right]
\c e llc o lo r[ c o lo u r m o d e l] { c o lo u r }
\ro w c o lo r s * [command] { s t a r t r o w } { c o lo u r - o d d r o w } { c o lo u r - even ro w }
\sh o w ro w co lo rs
\h id e r o w c o lo r s

The optional argum ent of \ro w c o lo r s lets you execute the usual commands th at are valid
here, for example \ h l i n e or \n o a lig n { ... }. The advantage of the optional argum ent is that
the execution of these com m ands can be suppressed for rows for w hich \ro w c o lo rs is not
active by using the starred version (cf. Example 03-02-7 on page 121). For alternating coloured
and uncoloured rows, you can leave one of the arguments for the colour of the odd and even
rows empty.

\u s e p a c k a g e [ t a b l e ] { x c o lo r }
03 -02-2

\r o w c o lo r s { l} { } { b lu e !30}
\ b e g i n { t a b u l a r } { |c c c ] } \ h l i n e
\m u ltic o lu m n { 3 } { |c |{ { ta b le l } \ \ \ h l i n e
A & BBB & C \ \ \ h l i n e A & B & C \ \ \ h l i n e
\e n d { ta b u la r } \ p a r \ b i g s k i p
\ r o w c o l o r s * [ \ h l i n e ] { l} { } { b lu e !30}
\ b e g i n { t a b u l a r } { |c c c |}
\m u ltic o lu m n { 3 } { |c |{ { ta b le 2 } \ \ \h id e r o w c o lo r s
A & BBB & C \\ A & B & C \\
\e n d { ta b u la r }

The following example shows an application of the simple colour commands for rows,
columns, and cells. As the individual cells only contain m athematical content, we have used
an a r r a y environment.

118
3 .2 x c o lo r

\usepackage[ta b le ]{ x c o lo r } \definecolor{um bra}{rgb}{0.8 ,0 .8 ,0 .5 }


\newcommand*\zero{\multicolumn{l}{>{\columncolor{white}}c}{0}}
\newcommand*\colCell[2]{\multicolumn{l}{>{\colurancolor{#l}}c}{#2}}
\t \ le f t [ \ ,
\begin{array}{*{5}{> {\colum ncolor[gray]{0.95}}c}}
h _ { k ,l,0 } (n ) &h _ { k ,l,l} (n ) & h _ { k ,l,2 } (n ) & \zero & \zero \\
h _ {k,2,0}(n ) &h _ { k ,2 ,l} (n ) & h _ {k,2,2}(n ) & \zero & \zero \\
h _ {k,3,0}(n ) &h _ { k ,3 ,l} (n ) & h_{k,3 ,2}(n) & \zero & \zero \\
h _ {k,4,0}(n ) &\colC ell{um b ra}{h _ {k,4,l}(n )} & h _ { k,4,2} (n ) & \zero & \zero \\
\zero & h _ { k ,l,0 } (n - l) & h_{k,1 , l } ( n - l ) & h _ { k ,l,2 } (n - l) &\zero \\
\zero & h _ { k ,2 ,0 } (n -l) & h _ { k ,2 ,l} (n - l) & h _ { k ,2 ,2 } (n -l) &\zero \\
\zero & h _ { k ,3 ,0 } (n -l) & h _{k,3 ,l } ( n - l) & h _ { k ,3 ,2 } (n -l) &\zero \\
\zero & \ co lC ell{um b ra}{h _ {k,4,0}(n -l)} & h _ { k ,4 ,l} (n - l) &h _ { k ,4 ,2 } (n -l) & \zero \\
\zero & \zero & h _ { k ,l,0 } (n -2 ) & h _ { k ,l,l} (n - 2 ) & h _ { k ,l,2 } (n -2 )\ \
\row color[gray]{0.75}\zero& \zero& h _ { k ,2 ,0 } (n -2 ) & h _ { k ,2 ,l} (n -2 ) & h _{k,2,2}(n -2)\\
\zero & \zero & h _{k,3 ,0 } (n -2 ) & h_{k,3 ,l} (n -2 ) & h _{k,3,2}(n-2)\\
\zero & \zero & h _ { k ,4 ,0 } (n -2 ) & h _ { k ,4 ,l} (n -2 ) & h _ { k ,4 ,2 } (n -2 )
\end{array} \ ,\ righ t]_ { 1 2 \ tim es 5} \]

03 -02-3 ! hfc,i,o(n) h fc,i,i(n ) hk,i,2(n) 0 0


__ -___I
hfc, 2,o(M) hk,2,i(n) hk, 2,2 (™) 0 0
hk,3,o(n) hk,3,i W hk,3,2(n) 0 0
hfc,4,0<n ) hk,i,i(n) hk, 4,2<W) 0 0
0 hk, i , o ( n - 1 ) hk, 1,1 (n - 1 ) h kii,2 ( n - 1 ) 0
0 hk,2,o(n - 1 ) hk,2,i(n- 1 ) hk, 2,2(n- 1 ) 0
0 hfc,3,o (« - 1 ) hfc,3,i(n - 1 ) hk,3,2(n ~ 1 ) 0
0 hfc,4,o(M - 1) h fe,4 il(n - 1 ) h kj4,2 (n - 1 ) 0
0 0 hfc, i , o ( n - 2 ) hk, 1,1 I n - 2 ) hk,i,2 ( n - 2 )
0 0 hk,2,0 171 ~ 2 ) hk,2,i(n-2) hk,2,2(n - 2 )
0 0 hk,3 ,o ( t t - 2 ) hk,3,1 (n - 2 ) hfe,3,2 (n _ 2 )
0 0 h k,4,0 ( n - 2 ) hk,4,i ( n - 2 ) hfc,4,2 ( n - 2 )
J 12x5

For an alternating colouring of the rows, you m ust call the \ro w c o lo rs command b e fo re
the table, w ith the appropriate arguments.

\usepackage[ta b le ]{ x c o lo r} \definecolor{um bra}{rgb}{0.8 ,0 .8 ,0 .5 }


\newcommand*\zero{\multicolumn{l}{>{\columncolor{white}}c}{0}}
\[ \ le f t [ \ , \rowcolors{l}{urabra}{blue!10}
\begin{array}{*{5}{c}}
h _ { k ,l,0 } (n ) &h _ { k ,l,l} (n ) & h _ { k ,l,2 } (n ) & \zero & \zero\\
h _ {k,2,0}(n ) &h _ { k ,2 ,l} (n ) & h _ {k,2,2}(n ) & \zero & \zero\\
h _{k,3 ,0 } (n ) &h _ { k ,3 ,l} (n ) & h _ {k,3,2}(n ) & \zero & \zero\\
h _ {k,4,0}(n ) &h _ { k ,4 ,l} (n ) & h _ {k,4,2}(n ) & \zero & \zero\\
\zero & h _ { k ,l,0 } (n - l) & h _ { k ,l,l} ( n - l) & h _ { k ,l,2 } (n - l) & \zero\\
\zero & h _ { k ,2 ,0 } (n -l) & h _ { k ,2 ,l} (n - l) & h _ { k ,2 ,2 } (n -l) & \zero\\
\zero & h _{k,3 ,0 } (n -l) & h _{k,3 ,l } ( n - l ) & h _ { k ,3 ,2 } (n -l) & \zero\\

119
Colour in tables

\ z e r o & h _ { k ,4 ,0 } ( n - l ) & h _ { k , 4 , l } ( n - l ) & h _ { k ,4 ,2 } ( n - l ) & \ z e r o \ \


\ z e r o & \z e r o & h _ { k ,l,0 } ( n - 2 ) & h _ { k , l , l } ( n - 2 ) & h _ { k , l , 2 } ( n - 2 ) \ \
\ z e r o & \ z e r o & h _ { k ,2 ,0 } ( n -2 ) & h _ { k ,2 ,l} ( n - 2 ) & h _ { k ,2 , 2 } ( n - 2 ) \ \
\z e r o & \ z e r o & h _ { k ,3 ,0 } ( n -2 ) & h _ { k ,3 , l} ( n - 2 ) & h _ { k ,3 , 2 } ( n - 2 ) \ \
\z e r o & \ z e r o & h _ { k ,4 ,0 } ( n -2 ) & h _ { k ,4 , l} ( n - 2 ) & h _ { k ,4 ,2 } ( n -2 )
\e n d { a rr a y } \ , \ r i g h t ] _ { 1 2 \ t i m e s 5} \ ]

hk, 1,0 (71) hk.i.iW hk,i,2(n) 0 0

hk,2 , o ( w ) h fc ,2 ,l(n ) hk,2,2(n) 0 0

hk.s.ain) h fc ,3 ,i(n ) hk,3,2 M 0 0

hkA.o(n) hk, 4 , i ( t i ) h-kA^M 0 0

0 hk,ifi(n- 1 ) hk,i , i ( n - 1 ) h fc,i,2 ( n - l ) 0

0 hk, 2,0 ( n - 1 ) hk,2,1 - 1 ) hk, 2,2 ( w - 1 ) 0

0 hk,3 ,o ( n -l) hk,3,i(n- 1 ) hk, 3 , 2 ( w - 1 ) 0

0 hk,4,o(n - 1 ) hk,4 , i ( n - 1 ) hk, 4,2(n- 1 ) 0

0 0 hk.i, o ( n - 2 ) hk, 1,1 ( n - 2 ) hk,i,2(n-2)


0 0 hk,2,o(n-2) hk, 2 , i ( n - 2 ) hk,2,2(n- 2)
0 0 hk,3,o(n-2) h fc ,3 ,i(n -2 ) hk,3,2 ( ^ - 2 )
0 0 ^ k ,4 ,o (w -2 ) hk,4 , 2 ( ^ - 2 )
J 12x 5

The following tw o examples show again the use of the \ro w c o lo rs com m and and also
the m eaning of the starred version. They also dem onstrate the use o f the rownum counter,
w hich saves the num ber of the respective row internally. The rows 8-10 are not coloured;
\h id e r o w c o lo r s and \sh o w ro w c o lo rs w ere used here. The \m u ltic o lu m n com m and can
also be used to prevent colouring of individual cells. The \ a r r a y r u l e c o l o r command from
c o l o r t b l changes the colour of the lines at any tim e in the table. We defined the \No
com m and in the examples to save space; the first row o f the table uses the substitution
\num ber\rownum for comparison purposes.

column 1 row 1 \u s e p a c k a g e [ ta b l e ] { x c o lo r }
03 -02-5
column 1 row 2 \r o w c o lo r s [ \h lin e ] { 3 } { g r e e n ! 2 5 } { y e llo w ! 50}
column 1 row 3 \ a r r a y r u l e c o l o r { r e d !7 5 !gray}\newcommand*\No{\num ber\rownum}
column 1 row 4 \b e g i n { t a b u l a r } { l l }
column 1 row 5 column 1 & row \n u m b er\ro w n u m \\
column 1 row 6 column 1 & row \N o \\ column 1 & row \N o \\
column 1 & row \N o \\\ a r r a y r u l e c o l o r { b l a c k }
column 1 row 7
column 1 & row \N o \\ column 1 & row \N o \\
column 1 row 8
\ro w c o lo r{ b lu e !2 5 } column 1 & row \N o \\
column 1 row 9 \h id e ro w c o lo rs% p r e v e n t c o lo u rin g
column 1 row 10 column 1 & row \N o \\ column 1 & row \N o \\
column 1 row 11 column 1 & row \N o \\
column 1 row 12 \show row colors% c o lo u r in g : a c t i v a t e !
column 1 row 13 column 1 & row \N o \\ column 1 & row \N o \\
\m u ltic o lu m n { l} { > { \c o lu m n c o lo r{ re d !4 0 } } l} { c o lu m n 1}
& row \n u m b er\ro w n u m \\
\e n d { ta b u la r }

120
3 .2 x c o lo r

The use of the starred version o f \ro w c o lo rs now discards the optional argum ent if
the respective row is before the start row of \ro w c o lo rs or betw een \h id e ro w c o lo rs and
\sh o w ro w co lo rs. W ithout the starred version, the optional argument is considered for e v e ry
row.

column 1 row 1 \u s e p a c k a g e [ ta b l e ] { x c o lo r }
03 -02-6
column 1 row 2 \newcommand*\No{\nuraber\rownum}
column 1 row 3 \r o w c o lo r s * [ \h lin e ] { 3 } { g r e e n ! 2 5 } { y e llo w ! 50}
column 1 row 4 \ a r r a y r u l e c o l o r f r e d !7 5 !g ray }
column 1 row 5 \b e g i n { t a b u l a r } { l l }
column 1 row 6 colum n 1 & row \n u m b er\ro w n u m \\
column 1 row 7 colum n 1 & row \N o \\ column 1 & row \N o \\
column 1 & row \N o \\\ a r r a y r u l e c o l o r { b l a c k }
column 1 row 8
colum n 1 & row \N o \\ column 1 & row \N o \\
column 1 row 9
\r o w c o lo r { b lu e !25}
column 1 row 10
colum n 1 & row \N o \\ column 1 & row \N o \\
column 1 row 11 \h id e r o w c o lo r s
column 1 row 12 column 1 & row \N o \\ column 1 & row \N o \\
column 1 row 13 \sh o w ro w c o lo rs
colum n 1 & row \N o \\ column 1 & row \N o \\
\m u ltic o lu m n { l} { > { \c o lu m n c o lo r{ re d !4 0 } } l} { c o lu m n 1}
& row \N o \\
\e n d { ta b u la r }

For colouring rows, you can also use colour series. They can be defined through the
\ d e f i n e c o l o r s e r i e s com m and and increm ented through the \ro w c o lo rs com m and and
the argum ent { C S ! !+ } . Further inform ation can be found in the m anual of the x c o lo r
package. [29]

\u s e p a c k a g e [ t a b l e ] { x c o l o r }
\u s e p a c k a g e { a rra y }
\newcommand*\No{\makebox[lcm]{%
\te x tc o lo r { C L ! !+}{\num ber\rownum }}}

\d e fin e c o lo rs e r ie s { C S } { r g b } { la s t} { y e llo w } { b lu e }
\ d e f i n e c o l o r s e rie s !C L } { rg b } { la s t} { b lu e } { y e llo w }
\ r e s e t c o l o r s e r i e s ! 1 3 ] {CS}
\ r e s e t c o l o r s e r i e s [ 1 3 ] {CL}
\r o w c o lo r s [ \h lin e ] { 1 } { C S ! !+}{C S!!+}
\b e g in { ta b u la r } { c }
\N o \\ \N o \\ \N o \\ \N o \\ \N o \\
\N o \\ \N o \\ \N o \\ \N o \\ \N o \\
\N o \\ \N o \\ \No
\e n d { ta b u la r }

121
C o lo u r in t a b le s

3 .3 T[j;Xnicalities
The c o lo rtb l package provides the \arrayru lecolo r { c o lo u r } command; its effect is global.
Each change of the line colour therefore affects all following line commands, regardless of
whether \arrayrulecolor is called locally within a group. The second line typeset with
\hline in the following example is therefore red, as the first \Chline command changed the
colour globally.

Egypt 30.06.1995 \usepackage[ta b le ]{ x c o lo r }


\n e w c o m m a n d \C h lin e [l]{ \a rr a y ru le c o lo r{ # l}\h lin e }
Albania 08.09.2000
Angola 23.11.1996 \b e g in { t a b u la r } { @ { } ll@ { } } \\\h lin e
Argentina 01.01.1995 Egypt & 3 0 .0 6 .1 9 9 5 \\\ C h l in e { r e d }
Antilles 21.01.1996 A lb an ia & 0 8 .0 9 .2 0 0 0 \\\h lin e
Angola & 2 3 .1 1 .1 9 9 6 \ \\C h lin e { b lu e }
A rgentin a & 0 1 .0 1 .1 9 9 5 \\\C h lin e { r e d ! 4 0 }
A n t ille s & 2 1 .0 1 .1 9 9 6 \\\h lin e \h lin e
\e n d { ta b u la r }

However, we can define the new command to reset the colour to the default value (black)
so that changes are not global anymore, as in the following example:

marching band AN 9.80 \usepackage[ ta b le ]{ x c o lo r }


\n e w c o m m a n d \C h lin e [l]{\a rra y ru le c o lo r{# l}%
presentation AN 8.66
\h lin e \a r r a y r u le c o lo r { b la c k } }
commity AN 13.31
\n e w c o m m a n d \C c lin e [2 ]{\a rra y ru le c o lo r{# l}%
\c lin e { # 2 } \a r r a y r u le c o lo r { b la c k } }

\ b e g in { t a b u la r } { l r r } \ \ \ C h li n e { b l u e }
marching band & AN & 9 . 8 0 \ \ \ h l i n e
p re s e n ta tio n & AN & 8 . 6 6 \ \\ C c li n e { r e d } { l- 2 }
commity & AN & 1 3 .3 1 \\\C c lin e { b lu e } { 2 - 3 }
\e n d { ta b u la r }

b e a m e r <A ) When using the beamer class, you must pass the option tab le to the xcolor package,
which is loaded by beamer by default, either through the class option of the document class
or with the \PassOptionsToPackage command before loading the document class.

\d o cu m e n tc la ss [xc o lo r=ta b le ]{b e am er}


\usetheme{Malmoe} \u s eo u te rth em e{s id eb a r} \usecolorthem e{dove}
\n e w c o m m a n d \C h lin e [l]{ \a rr a y ru le c o lo r{ # l}\h lin e \a rr a y ru le c o lo r{ b la c k } }

\b e g in {fra m e } {Example} {Coloured l in e s }


\b e g in {c e n te r}\L a rg e
\ b e g in { t a b u la r } { l > {\c o lu m n c o lo r{re d !3 0 }}r r } \\ \ C h li n e { b l u e }
\ro w colo r{m ag en ta!40} \emph{Name} & \emph{Type} & \e m p h {V a lu e }\\\C h lin e {b lu e }
marching band & AN & 9 .8 0 \\\C h lin e { r e d } p re s e n ta tio n & AN & 8 .6 6 \\\C h lin e { g r e e n }
commity & AN & 1 3 .3 1 \\\C h lin e { b lu e } food & AN & 1 1 .0 1 \\\h lin e
\e n d { ta b u la r }
\e n d {c e n te r}
\en d {fram e}

122
3.3 T g X n ic a lit ie s

i о з - о з -з :
Exam ple
C o lo u re d lin e s

Nam e T yp e V alue
m a r c h in g b an d AN 9 .8 0
p r e s e n ta t io n AN 8 .6 6

c o m m ity AN 13.31
foo d AN 1 1 .0 1

The following example shows the relations between the RGB and CMYK notation and the
Germ an so-called traffic colours, w hich are used for the traffic signs.

\ u s e p a c k a g e [ ta b le ] { x c o lo r } \u s e p a c k a g e { r a g g e d 2 e}% s e e p re a m b le -> CTAN!

\b e g i n { t a b u l a r } { > { \ C e n t e r i n g } p { l . 7 5 cm } > { \co lu m n co lo r{ cy an } } c> { \co lu m n co lo r{ m ag en ta} } c


> { \c o lu m n c o lo r{ y e llo w } } c > { \c o lu m n c o lo r{ b la c k } } c > { \C e n te rin g } p { 2 . 5 cm}
> { \c o lu m n c o lo r{ re d } } c > { \c o lu m n c o lo r{ g re e n } } c > { \c o lu m n c o lo r{ b lu e } } c > { \C e n te rin g } p { 1 . 7 5 cm}}
CMYK & C & M & Y & \c o lo r { w h ite } K & name & R & G & \c o lo r { w h ite } B & R G B \\\h lin e
\TZ eile{R A L 1 0 2 3 }{ 0 }{ 1 0 }{ 9 0 }{ 0 } { t r a f f i c y e llo w } { 1 0 0 }{ 9 0 }{ 1 0 } & \ c e l l c o l o r [ r g b ] { l , 0 . 9 , 0 . 1 } \ \
\TZ eile{R A L 2 0 0 9 } { 5 }{ 7 0 }{ 1 0 0 }{ 0 } { t r a f f i c o ra n g e } { 9 5 } { 3 0 }{ 0 } & \ c e l l c o l o r [ r g b ] { 0 . 9 5 , 0 . 3 , 0 } \ \
\T Z eile{R A L 3 0 2 0 }{ 0 }{ 1 0 0 }{ 1 0 0 }{ 1 0 } { t r a f f i c r e d } { 9 0 }{ 0 }{ 0 } & \ c e l l c o l o r [ r g b ] { 0 . 9 , 0 , 0 } \ \
\TZ eile{R A L 4 0 0 6 }{ 5 0 }{ 1 0 0 }{ 0 }{ 1 0 } { t r a f f i c p u r p le } { 4 0 }{ 0 }{ 9 0 } & \ c e l l c o l o r [ r g b ] { 0 . 4 , 0 , 0 . 9 } \ \
\T Z eile{R A L 5 0 1 7 }{ 1 0 0 }{ 2 0 }{ 5 }{ 4 0 } { t r a f f i c b lu e } { 0 }{ 4 0 }{ 5 5 } & \ c e l l c o l o r [ r g b ] { 0 , 0 . 4 , 0 . 5 5 } \ \
\TZ eile{R A L 6 0 2 4 }{ 9 0 }{ 1 0 }{ 8 0 }{ 1 0 } { t r a f f i c g re e n } { 0 }{ 8 0 }{ 1 0 } & \ c e l l c o l o r [ r g b ] { 0 , 0 . 8 , 0 . 1 } \ \
\TZ eile{R A L 7 0 4 2 }{ 3 0 }{ 1 0 }{ 2 0 }{ 4 0 } { t r a f f i c g r e y A}{ 3 0 }{ 5 0 }{ 4 0 } & \ c e l l c o l o r [ r g b ] { 0 . 3 , 0 . 5 , 0 . 4 } \ \
\TZ eile{R A L 7 0 4 3 }{ 3 0 }{ 1 0 }{ 2 0 }{ 8 0 } { t r a f f i c g r e y B}{ 0 }{ 1 0 }{ 0 } & \ c e l l c o l o r [ r g b ] { 0 , 0 . 1 , 0 } \ \
\TZ eile{R A L 9 0 1 6 }{ 3 }{ 0 }{ 0 }{ 0 } { t r a f f i c w h ite } { 9 7 }{ 1 0 0 }{ 1 0 0 } & \ c e l l c o l o r [ r g b ] { 0 . 9 7 , l , l } \ \
\TZ eile{R A L 9 0 1 7 }{ 1 0 0 }{ 9 0 }{ 1 0 0 }{ 9 5 } { t r a f f i c b la c k } { 0 }{ 0 }{ 0 } & \ c e l l c o l o r [ r g b ] { 0 , 0 , 0 }
\e n d { t a b u l a r }

CMYK M
10 90 RAL 1023
traffic yellow
70 1 00 RAL2009
traffic orange
100 1 00 10 RAL 3 020 traffic red
1 00 0 10 RAL 400 6
traffic purple
20 5 40 RAL 501 7 traffic blue
10 80 RAL6 0 2 4 traffic green
10 20 40 RAL 7042
traffic grey A
10 20 RAL 7043
traffic grey B
0 RAL901 6 traffic white
90 100 RAL 901 7 traffic black

123
C o l o u r in t a b l e s

\ u s e p a c k a g e { a r r a y , b o o k ta b s , ra g g ed 2 e}
\u s e p a c k a g e [ta b le ]{ x c o lo r} \ d e f i n e c o l o r { g o ld } { r g b } { . 9 9 , 1 , . 9 }
\ d e f i n e c o l o r { lg r e y } { g r a y } { . 9 5 } \ d e f i n e c o l o r { l b l u e } { r g b } { . 9 2 , . 9 7 , 1 }
\n e w c o lu m n ty p e { C } [ l] { > { \c o lu m n c o lo r { # l} [ O p t][ \ta b c o ls e p ]\C e n te rin g $ } c < { $ } }
\new colum ntype{M }[ 2 ] { > { \c o lu m n c o lo r{ # l} [ 2 \ t a b c o l s e p ] [ 0 p t] \C e n te r in g $ } m { # 2 }<{$}}

\b e g in { ta b u la r} { @ { } C { y e llo w ! 4 0 }*{ 1 0 }{>{$}m{ 1 2 p t}< {$ }} M {lg rey }{ 1 4 p t} M { lg rey } { 1 2 p t} @ { } } \to p ru le


\ r o w c o l o r { b l u e ! 4 0 } T a b e lle & \m a th s f{ l} & \m a th s f{ 2 } & \m ath sf{ 3 }& \m ath sf{ 4 } & \m ath sf{ 5 } & \m ath sf{ 6 }
& \m a th sf{ 7 } & \m ath sf{ 8 }& \m ath sf{ 9 } & \m ath sf{ 1 0 }&Y_{t} & Z _ { t} \\\m id r u le
0 & \ c i r c & \ c ir c & \ c i r c & \ c i r c & \ c i r c & \c lr c & \c ir c & \a s t & \c ir c & \circ& l& \rabox{— } \ \
1 & \ c i r c & \ c ir c & \ c i r c & \ c i r c & \ c i r c & \c ir c & \c irc & \d a g g e r& \a s t & \c ir c & l& l\\
2 & \c i r c & \ c ir c & \ c i r c & \ c i r c & \ a s t & \a s t & \c irc & \d a g g e r& \d a g g e r& \c irc & 2 & 2 \\
3 & \c ir c & \c ir c & \c ir c & \c ir c & \d a g g e r & \a s t & \c irc & \d a g g e r& \d a g g e r& \c irc & l& 0 \ \
4 & \c irc & \c irc & \c irc & \c irc & \d a g g e r& \d a g g e r& \c irc & \d a g g e r& \d a g g e r& \c irc & 0 &0 \ \ \ b o t t o m r u l e
\e n d { t a b u l a r }
CO

CO
Ta belle 1 2 4 5 6 7 9 10 Yt zt

0 O o o o o o o * o o 1 —

1 O o o o o o o t * o 1 1
2 o o o o * * o t t o 2 2
CO

o o o o t * o t t o 1 0
4 o o o o t t o t t o 0 0

W hen using the b o o k ta b s package, it’s also easy to create coloured lines:

\u s e p a c k a g e [ t a b l e ] { x c o l o r }
\u s e p a c k a g e { b o o k ta b s } \ a r r a y r u l e c o l o r { r e d }

\b e g in { ta b u la r } { @ { } llr @ { } } \to p r u le
\m u ltic o lu m n { 2 } { c } { I t e m } \ \ \ c m i d r u l e ( r ) { l - 2 } \ m o r e c m i d r u l e s \ c m i d r u l e ( r ) { l - 2 }
A nim al & D e s c r i p t i o n & P r i c e ( \ $ ) \ \ \ a r r a y r u l e c o l o r { b l u e } \ c m i d r u l e ( r ) { l - l }
\c m id ru le [2 p t](l{ le m } r{ le m } ){ 2 - 2 } \c m id r u le (l) { 3 - 3 >
G nat & p e r gram & 1 3 .6 5 \ \ & ea c h & 0 . 0 1 \ \ \ a d d l i n e s p a c e [ 2 ex]
Gnu & s tu ffe d & 9 2 .5 0 \\\m id r u le Emu & s t u f f e d & 3 3 . 3 3 \ \ \ s p e c i a l r u l e { 2 p t} { le x } { le x }
A rm a d illo & f r o z e n & 8 . 9 9 \ \ \ a r r a y r u l e c o l o r { g r e e n } \ b o t t o m r u l e
\e n d { ta b u la r}

Item

Animal Description Price ($)


Gnat per gram 13.65
each 0.01

Gnu stuffed 92.50


Emu stuffed 33.33

Armadillo frozen 8.99

12 4
C h a p t e r

M u lt i- p a g e ta b le s

4.1 lon g tab le....................................................................................................... 125


4.2 l t a b l e x .......................................................................................................... 139
4.3 ltx ta b le .......................................................................................................... 141
4.4 sta b u lar......................................................................................................... 145
4.5 su p e rta b u la r................................................................................................ 149
4.6 x ta b ................................................................................................................ 157

Multi-page tables have to be handled differently. They can’t be part of a floating envi­
ronment because these don’t allow page breaks but, on the other hand, multi-page tables
also contain captions that are typeset differently to the ones in the standard ETjnX table
environment. This chapter looks at some of the packages that can handle multi-page tables.
There is no single, best package for longer tables, but longtable is the most popular as it is
easy to use.
4 .1 lo n g ta b le

The longtable package offers many possibilities for creating tables spanning several pages.
The syntax corresponding to the normal tabular environment is the easiest case:

\begin{longtable} [HPos] { c o lu m n d e fin itio n }


...& ...& ...W

\end{longtable}

Specification of an optional argument for vertical alignment within a line doesn’t make sense
for longtable as it is a lw a y s typeset as a separate paragraph. So in contrast to the tabular
environment, only the horizontal alignment is important: the possible values for HPos are 1, c
(default), and r.
M u lt i- p a g e t a b le s

left centred right \usepackage{longtable}


04 -01-1
l e f t \ h f i l l centred \ h f i l l rig h t
left centred right box
i c r p{1.7cm) \b e g in { lo n g ta b le } { |1 |c |r|p { l.7 c m } |} \h lin e
l e f t & cen tred & rig h t & b o x \\\h lin e
1 & c & r & p \{ 1 .7 c m \} \\\h lin e
\end{longtable}
left centred right box % rig h t-a lig n e d
r p{1.7cm} \b e g in { lo n g ta b le } [r]{ |l|c |r|p { 1 .7 c m } |} \h lin e
i c
l e f t & centred & rig h t & b o x \\\h lin e
1 & c & r & p \{ 1 .7 c m \} \\\h lin e
\end{longtable}
left centred right box % le f t-a lig n e d
\b e g in { lo n g ta b le } [l]{ |l|c |r|p { 1 .7 c m > |} \h lin e
1 c r p{1.7cm} l e f t & centred & rig h t & b o x \\\h lin e
1 & c & r & p \{ 1 .7 c m \} \\\h lin e
\end{longtable}

4 .1 .1 Page b reak

A page break for longtable is by definition only possible a fte r a table row (cf. Example 04-
automatic 01-2), not within a row. It is either inserted automatically or you can force one by inserting
page break x \newpage (cf. Example 04-01-5 on page 129). You can also prevent a potential page break at
the end of a row by inserting \\* or \nopagebreak.
The resulting layout can look bad, especially when you have uneven columns or rows, as
demonstrated in Example 04-01-2. This table consists of only three rows, but the height of the
third row is very large in comparison to the other two. The page break therefore has to be
inserted after just two rows because the third (last) row wouldnit fit onto the page. In such
extreme cases, only manual intervention helps. In this example, a page break after the last
but five line of te x t or thereabouts within the third ta b le row would make sense. In principle,
you could terminate the table row here and start a new one, so that a page break would be
inserted inbetween; however, then the last line of the third row would not be justified, as
shown in Example 04-01-3 on the facing page.

\usepackage{array, longtable}
\begin{longtable}{@{} 1 c r p{2.5cm} @{}}
1 & c & r & 1 st ro w \\\h lin e
1 & c & r & 2nd ro w \\\h lin e
1 & c & r & A row w ith a lo t of te x t th a t r e s u lts in a page break a f t e r ju s t the
second ta b le row because th e te x t included in the th ir d lin e i s too
high to f i t on th e f i r s t page. Pagebreaks are only p o ssib le between
ta b le lin e s and not in sid e a c e ll \ld o ts
\end{longtable}

126
4.1 longtable

04-01-2 [ Page break demo Page break demo

1 c r 1st row
1 c r 2nd row 1 c r A row with a
lot of text that
results in a page
break after just
the second table
row because the
text included in
the third line is
too high to fit
on the first page.
Pagebreaks are
only possible
between table
lines and not
inside a cell...
page 1 page 2

\u s e p a c k a g e {a rra y , lo n g ta b le }

\b e g in {lo n g ta b le }{@ {}l c r p{2.5cm }@ {}}


1 & c & r & 1 s t r o w \\\h lin e 1 & c & r & 2nd r o w \\\h lin e
1 & c & r & A row w ith a l o t o f te x t th a t r e s u lts in a page break a f t e r ju s t the
second ta b le row because th e te x t inclu d ed in th e t h ir d l in e is too
high to f i t on th e f i r s t p a g e .\\% in s e rte d
& & & Pagebreaks are only p o s s ib le between ta b le lin e s and not in s id e a c e l l \ld o t s
\e n d {lo n g ta b le }

Page break demo Page break demo

1 c r 1st row Pagebreaks are


1 c r 2nd row only possible
1 c r A row with a lot between table
of text that re­ lines and not
sults in a page inside a cell...
break after just
the second table
row because the
text included in
the third line is
too high to fit on
the first page.

page 1 page 2

127
4 M u lt i- p a g e ta b le s

So the last row of text on the first page doesn’t appear to have been filled correctly before
the page break, due to the manual insertion of a new row to allow the page break. However,
there is a small trick with which we can stretch the last row so that manual breaks remain
invisible in the output.

\n e w c o m m a n d \N e w L in e {\s e tle n g th \p a rfills k ip {O p t}\ta b u la rn e w lin e }}

The \NewLine command sets the \ p a rfills k ip length to Opt before the end of the row
of the table so that the final cell’s paragraph is not filled with whitespace and appears left and
right justified. There is no difference now to the table without this manual page break in the
output. The change is made within the table cell, which therefore doesn’t overwrite other
definitions; all table cells are put into a group such that all changes remain local. If two or
more columns have long text in the last row, requiring two or more cells to be split across the
page break, you must insert the \NewLine command for each column/cell that needs the last
line of its paragraph justified.

\u s e p a c k a g e {a rra y , lo n g ta b le }
\n e w c o m m a n d \N e w L in e {\s e tle n g th \p a rfills k ip {O p t}\ta b u la rn e w lin e }

\b e g in {lo n g ta b le }{@ {} 1 c r p{2.5cm } @{}}


1 & c & r & 1 s t r o w \\\h lin e
1 & c & r & 2nd r o w \\\h lin e
1 & c & r & A row w ith a l o t o f te x t th a t r e s u lts in a page break a f t e r ju s t the
second ta b le row because th e te x t inclu d ed in th e t h ir d l in e i s too
high to f i t on th e f i r s t page. \NewLine% in s e rte d
& & & Pagebreaks are o nly p o s sib le between complete
ta b le lin e s and not in s id e a c e l l \ld o t s
\e n d {lo n g ta b le }

Page break demo Page break demo

1 c r 1st row Pagebreaks are


1 c r 2nd row only possible be­
1 c r A row w ith a lot tw een complete
of text that re­ table lines and
sults in a page not inside a cell
break after just
the second table
row because the
text included in
the third line is
too high to fit
on the first page.

page 1 page 2

128
4.1 longtable

A f te r a table row, you can use the normal \newpage command at any time to force a page \n e w p a g e

break:

\u s ep ac kag e {lo n g ta b le }

\b e g in {lo n g ta b le }{@ {}l c r p{1.5cm }@ {}}


L & C & R & b o x \\ \ h l i n e
1 & c & r & 1 s t r o w \\ 1 & c & r & 2nd r o w \\ 1 & c & r & 3rd r o w \\
1 & c & r & 4 th r o w \\ 1 & c & r & 5th r o w \\ 1 & c & r & 6th r o w \\
\newpage
1 & c & r & 7th r o w \\ 1 & c & r & 8th r o w \\ 1 & c & r & 9th r o w \\
1 & c & r &10th r o w \\ 1 & c & r & llth r o w \\ 1 & c & r &12th row
\e n d {lo n g ta b le }

newpage demo newpage demo

L C R box 1 c r 7th row


1 c r 1st row 1 c r 8th row
1 c r 2nd row 1 c r 9th row
1 c r 3rd row 1 c r 10th row
1 c r 4th row 1 c r 11th row
1 c r 5th row 1 c r 12th row
1 c r 6th row

page 1 page 2

4 .1 .2 H o riz o n ta l a n d v e rtic a l s p a c in g

Table 4.1 on the next page shows a summary of the length parameters that can be used to
change the horizontal and vertical spacing of a longtable. The defaults depend both on the
package, and also on the used document class, which may define custom values. The values
given in the table are the ones that are generally valid, where \big skip amount is equal to
12. Opt plus 4. Opt minus 4. Opt and \f i l l is equal to 0. Opt plus 1. Ofi l l here. It is
important to assign a dynamic length to at least one of the horizontal or vertical spacings so
that the table can be typeset correctly within the text.
We recommend that you only set the horizontal spacings manually if none of the options
seem sensible - they are equivalent to the values shown in Table 4.2 on the following page. \ L T le f t

\ L T r ig h t
The arrangement demonstrated here only works as long as the width of the table is not
larger than the width of the current text line. For wider tables, it has to be saved first into a

129
4 M u lt i- p a g e t a b le s

Table 4.1: The hor­


nam e d e sc rip tio n d e fa u lt
izontal and vertical
margin lengths of a \LTleft space between the table and the left text area \ fill
lo n g ta b le . \LTright space between the table and the right text area \ fill
\LTpre space between the table and the upper text area \bigskipamount
\LTpost space between the table and the lower text area \bigskipamount

box as a default tabular to get the width of the tabular with \wd\myTabBox. This length can
then be used accordingly to set the length \LTleft, defined internally by longtable. The
table is left-aligned by default, but this method makes other alignments possible as well (cf.
Example 04-01-6).

Table 4.2: Relationship between the optional argument of the


o p tio n v a lu e \LTleft \LTright
lo n g ta b le environment and the horizontal lengths \ L T l e f t
and \L T rig h t. 1 Opt \ fill
c \ fill \ fill
r \ fill Opt

left centred right \u s e p a c k a g e {lo n g ta b le , c a lc }


| 04 -01-6
l e f t \ h f i l l centred \ h f i l l r ig h t
left centred right box \s e tle n g th \L T le ft{ O p t}
1 c r p{ 1.5cm} \b e g in { lo n g ta b le } { |1 | c | r | p { l . 5 c m } |}\h lin e
l e f t & centred & r ig h t & b o x \\\h lin e
right-aligned 1 & c & r & p \{ l.5 c m \} \\\h lin e
\e n d {lo n g ta b le }
left centred right box \ s e t l e n g t h \ L T l e f t { \f i l l} \s e t l e n g t h \ L T r i g h t { O p t }
i c r p{1.5cm} \ h f i l l r ig h t-a lig n e d
\b e g in { lo n g ta b le } { |1 | c | r | p { l . 5 c m } |}\h lin e
l e f t & centred & r ig h t & b o x \\ \ h l i n e
centred 1 & c & r & p \{ l.5 c m \} \\\h lin e
\e n d {lo n g ta b le }
left centred right box
\s e tle n g th \L T le ft{ \fill} \s e tle n g th \L T r ig h t{ \fill}
1 c r p{1.5cm} \c e n te r lin e { c e n tr e d }
\b e g in { lo n g ta b le } { |1 | c | r | p { l . 5 c m } |}\h lin e
l e f t & centred & r ig h t & b o x \\\h lin e
1 & c & r & p \{ l.5 c m \} \\\h lin e
\e n d {lo n g ta b le }

Usually, you won’t need to change the space before and after a longtable; the default
\ L T p r e of \bigskipamount should be sufficient already. Furthermore, the spacing is not defined to
\ L T p o s t be symmetrical before and after the table, as can be seen from the following example, which
means changing the spacing is not as simple as just modifying \LTpre and \LTpost by the
same amount. Different values must be chosen, depending on whether the text is typeset
with a paragraph indent (\parindent) or a paragraph space (\parskip), and whether with
or without table caption. The example shows, for one paragraph spacing, first the default
values and then modified values for \LTpre and \LTpost.

130
4 .1 lo n g t a b le

A line of text before the table. \u s e p a c k a g e { lo n g ta b le }

A l i n e o f t e x t b e f o r e th e t a b l e .
left centred right box
\b e g i n { l o n g t a b l e } { |1 |c | r |p { l . 5 c m } |} \ h l i n e
1 c r p{1.5cm}
l e f t & c e n tr e d & r i g h t & b o x \ \ \ h l i n e
1 & c & r & p \{ l.5 c m \} \\\h lin e
\e n d { lo n g ta b le }
A line of text after the table.
A l i n e o f t e x t a f t e r th e t a b l e . \ p a r
A l i n e o f t e x t b e f o r e th e t a b l e .
left centred right box \s e tle n g th \L T p re { O p t} %
1 c r p{1.5cm} \s e tle n g th \L T p o s t{ O p t} %
\b e g i n { l o n g t a b l e } { |1 | c | r | p { l . 5 c m } |} \h lin e
A line of text after the table. l e f t & c e n tr e d & r i g h t & b o x \ \ \ h l i n e
1 & c & r & p \{ l.5 c m \} \\\h lin e
\e n d { lo n g ta b le }
A l i n e o f t e x t a f t e r th e t a b l e .

4.1.3 Headers and footers


The general syntax for a lo n g ta b le environm ent is som ew hat more involved th an for a
norm al table. C aptions can be placed above or below the table; for further explanation on
captions see Section 4.1.4. Here it is only im portant to note that depending on the arrangement,
you can incorporate these captions in the header or footer so that they would therefore be
repeated on every page. All four specifications of \ e n d f ir s th e a d , \en d h ead , \ e n d l a s t f o o t ,
and \e n d f o o t are optional and the order may be arbitrary: they only have to be given before
the table rows.

If the specification of a \ e n d f i r s t h e a d or \ e n d l a s t f o o t is missing, they are automatically


assigned w ith the values of \e n d h e a d and \e n d f o o t. If you only need the table to have a
first header row and a last footer row, you don’t need to use this extended functionality at all;
it can be created w ith norm al table rows.

I 13 1
4 M u lt i- p a g e t a b le s

\u s ep ac kag e {lo n g ta b le }

\b e g in {lo n g ta b le }{@ {}l c r p {l.5 cm }@ {}}


L & C & R & b o x \\\h lin e
\e n d firs th e a d
\m u ltic o lu m n { 4 }{ @ { }l}{\s m a ll\ld o ts \e m p h { c o n tin u e d } }\\\h lin e L& C& R& b o x \\\h lin e
\endhead
\h lin e
\m u ltic o lu m n {4 }{r@ {}}{\s m a ll\e m p h {c o n tin u e d on th e next page} \ l d o t s } \ \
\e n d fo o t
\h lin e
\e n d la s tfo o t
1 & c& r & 1 s t r o w \\ 1 & c& r & 2nd r o w \\ 1 & c &r & 3rd r o w \\
1 & c& r & 4 th r o w \\ 1 & c& r & 5th r o w \\ 1 & c &r & 6th r o w \\
1 & c& r & 7th r o w \\ 1 & c& r & 8th r o w \\ 1 & c &r & 9 th r o w \\
1 & c& r &10th r o w \\ 1 & c& r & llt h r o w \\ 1 & c &r &12th r o w \\
1 & c& r &13th r o w \\ 1 & c& r &14th r o w \\ 1 & c &r &15th row
\e n d {lo n g ta b le }

Header and footer demo Header and footer demo [ 04 -01-8

L C R box ... continued


1 c r 1st row L C R box
1 c r 2nd row 1 c r 12th row
1 c r 3rd row 1 c r 13th row
1 c r 4th row 1 c r 14th row
1 c r 5th row 1 c r 15th row
1 c r 6th row
1 c r 7th row
1 c r 8th row
1 c r 9th row
1 c r 10th row
1 c r 11th row
continued on the next page...

page 1 page 2

4 .1 .4 T a b le c a p tio n s

The syntax for the \caption was given in the longtable environment definition on page 131.
> The starred version suppresses the numbering and therefore an entry in the list of tables
(lot).
> If the optional argument is empty (\caption[ ] {...}), no entry is made into the list of
tables (lot).

132
4.1 longtable

> A single optional argument is added to the list of tables (lot). This is the normal
behaviour.
In general, using \c apt ion in conjunction with longtable is equivalent to using
\multicolumn, because the table caption is a part of the environment and not a separate
paragraph as it would be using the “normal” \caption command. Therefore the line has to
be terminated with \\ or \tabularnewline.

\u s ep ac kag e {lo n g ta b le }

\b e g in {lo n g ta b le }{@ {}l c r p{1.5cm }@ {}}


\c a p tio n { ta b le c a p t io n } \la b e l{ t a b : 1 1 } \ \
L & C & R & b o x \\\h lin e
\e n d firs th e a d
\m u ltic o lu m n { 4 }{ @ { }l}{\s m a ll\ld o ts \e m p h { c o n tin u e d } }\\\h lin e
L & C & R & b o x \\\h lin e
\endhead
\h lin e
\m u ltic o lu m n {4 }{r@ {}}{\s m a ll\e m p h {c o n tin u e d on th e next page} \ l d o t s } \ \
\e n d fo o t
\h lin e
\e n d la s tfo o t
1 &c &r & 1st row \\ 1 & c & r & 2nd row \\ 1 & c &r & 3rd row \\
1 &c &r & 4th row \\ 1 & c & r & 5th row \\ 1 & c &r & 6th row \\
1 &c &r & 7th row \\ 1 & c & r & 8th row \\ 1 & c &r & 9th row \\
1 &c &r &10th row \\ 1 & c & r & llth row \\ 1 & c &r &12th row
\e n d {lo n g ta b le }
As shown in T a b l e ~ \ r e f { t a b : l l } , \ld o t s

04 -01-9 \ c a p tio n demo \ c a p tio n demo

Table 1 : table caption ... continued


L C R box
L C R box 1 c r 10th ro w
1 c r 1st ro w 1 c r 11th row
1 c r 2nd ro w 1 c r 12th ro w
1 c r 3rd ro w
1 c r 4th ro w
A s sh ow n in Table 1, . . .
1 c r 5th row
1 c r 6th ro w
1 c r 7th ro w
1 c r 8th ro w
1 c r 9th ro w
continued on the next p a g e ...

page 1 page 2

133
4 Multi-page tables

As the \c apt ion command is in principle part of the table, it can also be inserted into
the header or footer, so that they appear repeatedly without incrementing the internal table
counter. In this context it is important that a \label command should only occur once,
\la b e l either in the first header, in the last footer, or alternatively somewhere within the actual table.
Otherwise you may get the error message: “multiply defined labels”.

\usepackage{longtable}
Text without sense before the now inserted \texttt{longtable}.

\begin{longtable}{@{}l c r p{1.5cm}@{}}
L & C & R & box\\\hline
\endfirsthead
\multicolumn{4}{@{}l}{\small\ldots\emph{continued}}\\\hline
L & C & R & box\\\hline
\endhead
\hline
\multicolumn{4}{r@{}}{\small\emph{continued on the next page} \ldots}\\
\caption{table caption}\\
\endfoot
\hline
\\[-2ex]
\caption{table caption}
\endlastfoot
1 & c &r & 1st row\\ 1 &c & r & 2nd row\\ 1 &c &r & 3rd row\\
1 & c &r & 4th row\\ 1 &c & r & 5th row\\ 1 &c &r & 6th row\\
1 & c &r &7th row\\ 1 &c & r & 8th row\\ 1 &c &r & 9th row\\
1 & c &r &10th row\\ 1 &c & r &llth row\\ 1 &c &r &12th row\\
\end{longtable}

\ c a p tio n demo \ c a p tio n demo 04-01-10

Text without sense before the ... continued


now inserted lo n g ta b le . L C R box
1 c r 8th row
L C R box 1 c r 9th row
1 c r 1st row 1 c r 10th row
1 c r 2nd row 1 c r 11th row
1 c r 3rd row 1 c r 12th row
1 c r 4th row Table 1: table caption
1 c r 5th row
1 c r 6th row
1 c r 7th row
continued on the next p a g e. . .
Table 1: table caption

page 1 page 2

134
4.1 longtable

When table captions are set below the table, you can sometimes get differing spaces
above the caption if lines are used in one place and not in the other. This was catered for
in Example 04-01-10 by inserting a new row for the last table caption and at the same time
reducing the space resulting from this by \\[-2ex]. You can alter the width of the table
caption using the \LTcapwidth length. The default is 4 inches, or the width of the enclosing \LTcapw idth
\parbox, which is part of the \multicolumn:

\multicolumn{ (n) }{c}{\parbox{\LTcapwidth}{(text >}}

(n) is the automatically determined number of columns of the longtable and (text) is the
normal caption.
\usepackage{longtable} \setlength\LTcapwidth{lin}% <— change length
Text without sense before the now inserted \texttt{longtable}.
\begin{longtable}{@{}l c r p{l.5cm}@{}}
L & C & R & box\\\hline
\endfirsthead
\multicolumn{4}{@{}l}{\small\ldots\emph{continued}}\\\hline
L & C & R & box\\\hline
\endhead
\hline
\multicolumn{4}{r@{}}{\small\emph{continued on the next page} \ldots}
\endfoot
\endlastfoot% empty last footer, no line after caption
1 & c& r &lst row\\l & c & r & 2nd row\\l & c &r & 3rd row\\l & c & r & 4th row\\
1 & c& r &5th row\\l & c & r & 6th row\\l & c &r & 7th row\\l & c & r & 8th row\\
1 & c& r &9th row\\l & c & r &10th row\\l & c &r &llth row\\l & c & r &12th row\\\hline
\caption{Table caption with l\,inch width}\label{tab:14}
\end{longtable}

I 04-01-11 \ c a p tio n demo \ c a p tio n demo

Text without sense before the ... continued


now inserted lo n g ta b le . L C R box
1 c r 9th row
L C R box 1 c r 10th row
1 c r 1st row 1 c r 11th row
1 c r 2nd row 1 c r 12th row
1 c r 3rd row Table 1: Table
1 c r 4th row caption with
1 c r 5th row 1 inch width
1 c r 6th row
1 c r 7th row
1 c r 8th row
continued on the next page...

page 1 page 2

135
4 Multi-page tables

\usepackage{longtable}
\usepackage[labelfont=bf]{caption}
\setlength\LTcapwidth{2.75cm}% <--- change length
\begin{longtable}{@{}l c r p{1.5cm}@{}}
\caption{Table caption with 2.75\,cm width.\label{tab:14}}\\[5pt]
L & C & R & box\\\hline
1 & c& r &1st row\\ 1 & c & r & 2nd row\\ 1 &c & r & 3rd row\\
1 & c& r &4th row\\ 1 & c & r & 5th row\\ 1 &c & r & 6th row\\
1 & c& r &7th row\\ 1 & c & r & 8th row\\ 1 &c & r & 9th row\\
1 & c& r &10th row\\ 1 & c & r &llth row\\ 1 &c & r &12th row\\\hline
\end{longtable}

\caption demo \caption demo 1 04-01-12 i

Table 1: Table cap- 1 c r 9th row


tion with 2.75 cm 1 c r 10th row
width. 1 c r 11th row
1 c r 12th row
L C R box
1 c r 1st row
1 c r 2nd row
1 c r 3rd row
1 c r 4th row
1 c r 5th row
1 c r 6th row
1 c r 7th row
1 c r 8th row

page 1 page 2

4 . 1 .5 F o o tn o te s
In a longtable environment, you can use the normal \footnote command. It also continues
the normal footnote counting. If you want a different counting used within the table, you
must set the counter before starting the table, for example using \set counter {footnote} {0}
to reset to zero. After the table, you must then set the counter back to the number it had
reached if the old counter will be used in the text again. As the footnotes appear at the bottom
of the page together with the normal footnotes, changing the counting is not really useful.

\ u s e p a ck a g e {lo n g ta b le }

A d em o \fo o tn o te {lin e o f t e x t } fo r fo o t n o t e s .
\ b e g in {lo n g ta b le }{@ {}l c r p{1.5cm }@ {}}
L \ fo o tn o te {c a p tio n } & C & R & b o x \\\h lin e
1 & c \ f o o t n o t e { f i r s t row, second column} & r & 1 s t row

136
4.1 longtable

\\ 1 & c & r\footnote{second row, third column} & 2nd row\\


1 & c & r & 3rd row\\ 1 & c & r & 4th row\\ 1 & c & r & 5th row
\\ 1 & c & r & 6th row\\ 1 & c & r & 7th row\\
1 & c & r & 8th row\footnote{eighth row, last column}\\ 1 & c & r & 9th row\\
1 & c & r &10th row\\ l\footnote{eleventh row, fir s t column} & c & r &llth row\\\hline
\end{longtable}
A demo\footnote{line of text} for footnotes.

\ c a p tio n demo \ c a p tio n demo

A demo1 for footnotes. 1 c r 7th row


1 c r 8th row5
L2 C R box 1 c r 9th row
1 c3 r 1st row 1 c r 10th row
1 c r4 2nd row l6 c r 11th row
1 e r 3rd row
1 c r 4th row
A demo7 for footnotes.
1 c r 5th row
1 c r 6th row

1line of text
2caption 5eighth row, last column
3first row, second column 6eleventh row, first column
4second row, third column 7line of text

page 1 page 2

4 . 1 .6 T E X n ic a litie s...
To determine the width of the table, the package writes the required information about the \ L T ch u n k size
individual columns in the . aux file and therefore needs at least two WTjDi runs; an exception
is a “short” longtable without a page break. The number of table rows that T^X reads and
evaluates to determine the width of the columns at one time is determined by \LTchunksize
and defaults to 20 . If this value is larger than the number of table rows, T^X needs fewer
runs to determine the width. The default value is relatively small, which means that if you
set up a large number of individual headers or footers, T^X struggles to compute the table
sensibly. On modern computers, the value of \LTchunksize can be increased tenfold without
any problems. The following example shows two pages of a table that have been produced
after only one EH^X run. The log file contains a corresponding note:

Package lo n g ta b le Warning: Column w idths have changed


(lo n g ta b le ) in ta b le 1 on in pu t l i n e 39.
Package lo n g ta b le Warning: T able w idths have changed. Rerun LaTeX.
[7] ( ./ 3 - 1 - 1 3 .aux)
LaTeX Warning: L a b e l( s ) may have changed. Rerun to g e t c r o s s -r e fe r e n c e s r i g h t .

137
Multi-page tables

The . aux file now contains the largest width of each of the individual columns and in
which chunk it was found:
\gdef \LT@i {\LT@entry
{2}{17.11958pt}\LT@entry
{2}{29.75977pt}\LT@entry
{2}{25. 31984pt}\LT@entry
{1}{48.67912pt}}

The largest width of the first three columns was in the second chunk and the width of the
fourth column was fixed anyway with p { l. 5cm} - its width was determined at the beginning
(chunk 1 ) already. In a consecutive run, K^pX reads these values and typesets the table, which
now has the correct column widths on each page. Only the result after the first run is shown
below for space reasons. \LTchunksize was deliberately set to the value 7 to illustrate the
effect. The first chunk consists of the table caption and the following six rows. The first three
columns in the second chunk are wider; but T^X only notices this after the page break. The
table would be typeset correctly after another ET^X run.

\usepackage{longtable} \setcounter{LTchunksize}{7}\setlength\LTcapwidth{2.75cm}
\begin{longtable}{@{}l c r p{1.5cm}@{}}
\caption{Table caption with 2.75\,cm width.\label{tab:14}}\\[5pt]
L & C & R & box\\\hline 1 & c & r & lst\\ 11 & c & r & 2nd\\ 1 & c & r & 3rd\\
1 & c & r & 4th\\ 111 & c & rr & 5th\\ 1 & cc & r & 6th\\ 1 &c & r & 7th\\
1111 & c & r r r & 8th row \\ 1 & ccc & r & 9th row \\ 1 & c & r &10th row\\
1111 & c & r r r r &llth row\\ 1 & cccc & r &12th row\\\hline
\end{longtable}
This example was only run once through \LaTeX. This is the reason why the
table isn ’t typeset correctly.

\LTchunksize demo \LTchunksize demo 04-01-14 |

Table 1: Table cap­ 1 ccc r 9th row


tion with 2.75 cm 1 c r 10th row
width. 1111 c rrrr 11th row
1 cccc r 12th row
L C R box
1 c r 1st
This example was only run once
11 c r 2nd
through ETgX. This is the rea­
1 c r 3rd
son why the table isn’t typeset
1 c r 4th
correctly.
111 c rr 5th
1 cc r 6th
1 c r 7th
1111 c rrr 8th row

page 1 page 2

138
4.2 ltablex

You can’t use the \n ofiles option in conjunction with longtable, as it would prevent
the output of the auxiliary files and thus the output of the auxiliary information, which ^ . auxfile
longtable requires for calculating the width of the table. When using the \multicolumn
command, several runs may be necessary until TpX has determined the correct width, \multicolumn
Further information on this can be found in the package documentation. [17]
You can use the \ k ill command to delete an example row that has been used to determine
the table columns. Example rows, discussed in the tabbing environment (cf. Section 1.2 on
page 12 ), can sometimes be helpful when creating centred or right-aligned columns of a fixed
width.

\usepackage{longtable}
\begin{longtable}{@{}l c r p{1.5cm}@{}}
L & XXXX & right & p \kill
L & C&R & box\\\hline
1 & c&r & lst\\ 11 & c & r &2nd\\ 1 & c & r & 3rd\\
1 & c&r &4th\\ 111 & c & rr & 5th\\ 1 & cc & r & 6th\\
1 & c&r & 7th\\ 1111 & c &rr r & 8th row\\ 1 & ccc & r &9th row\\
1 & c&r &10th row\\ 1111 & c &r r rr &llth row\\ 1 & cccc & r &12th row\\\hline
\end{longtable}

04-01-15 \ k i l l demo \ k i ll demo

L c R box 1 cccc r 12th row


1 c r 1st
11 c r 2nd
1 c r 3rd
1 c r 4th
111 c rr 5th
1 cc r 6th
1 c r 7th
nil c rrr 8th row
1 ccc r 9th row
1 c r 10th row
mi c rrrr 11th row

page 1 page 2

4.2 lt a b le x
The lta b le x package by Anil K. Goel extends the ta b u la rx environment with possible page
breaks. In contrast to the similar ltx ta b le package (cf. Section 4.3 on page 141 ), no external
files are required; the table can be used in the usual manner. Captions are possible, too.

139
4 Mufti-page tables

\begin{tabularx}{taè/e width}{column definition}


\c a p tio n * {text}\\

...\\
\end{tabularx}

The package works similarly to the well-known longtable (cf. Section 4.1 on page 125)
package, and therefore needs at least two DIp;X runs to determine the correct width of the
columns.

\usepackage{ltablex}
\usepackage{ragged2e}
\begin{tabularx}{\linewidth}{@{}>{\ttfamily}l>{\RaggedRight}X@{}}
\caption{File extensions. }\\
aux & (auxiliary) Auxiliary file , contains links etc. \\
bbl & (bibliography) Auxiliary file , contains the entries for the bibliography.\\
bib & (bibtex) Contains the literature database.\\
big & (bibliography log) Contains the output of a Bib\TeX\ run.\\
cfg & (config) Configuration file.\\
clo & (class options) Definitions for the document class and the corresponding
class options.\\
els & (class) Document class file.\\
\end{tabularx}

\lta b le x demo \ l t a b l e x demo

Table 1: file extensions cfg (config) Configuration


file.
aux (auxiliary) Auxiliary c lo (class options) Defini­
file, contains links etc. tions for the document
bbl (bibliography) Auxil­ class and the corre­
iary file, contains the sponding class options.
entries for the bibliog­ e ls (class) Document class
raphy. file.
b ib (bibtex) Contains the
literature database.
b ig (bibliography log) Con­
tains the output of a
BibTpX run.

page 1 page 2

The specification of headers and footers is the same as for the longtable package (cf.
Section 4.1.3 on page 131).

140
4.3 ltxtable

\usepackage{ltablex,ragged2e}
\begin{tabularx}{\linewidth}{@{}>{\ttfamily}l>{\RaggedRight}X@{}}
\caption*{File extensions. }\\
.ext & description\\\hline
\endfirsthead
\multicolumn{2}{@{}l}{\ldots\ \small continued}\\\hline
.ext & description\\\hline
\endhead
\hline
\multicolumn{2}{r@{}}{\small continued\ldots}\\
\endfoot
\hline
\endlastfoot
aux & (auxiliary) Auxiliary f ile , contains links etc. \\
bbl & (bibliography) Auxiliary f ile , contains the entries for the bibliography.\\
bib & (bibtex) Contains the literature database.\\
big & (bibliography log) Contains the output of a Bib\TeX\ run.\\
cfg & (config) Configuration file.\\
clo & (class options) Definitions for the document class and the corresponding
class options.\\
\end{tabularx}

04-02-2 \ l t a b l e x demo \ l t a b l e x demo

file extensions continued


.e x t description
. e x t description b ig (bibliography log) Con­
aux (auxiliary) Auxiliary file, tains the output of a
contains links etc. Biblj?X run.
b b l (bibliography) Auxiliary c fg (config) Configuration
file, contains the entries file.
for the bibliography. c lo (class options) Defini­
b ib (bibtex) Contains the tions for the document
literature database. class and the corre­
continued... sponding class options.

page 1 page 2

4.3 lt x t a b l e
The ltx ta b le package by David Carlisle unites the features of tabularx and longtable,
hence the name of the package. In contrast to those packages, the table has to be saved as an

141
4 Multi-page tables

external file; the easiest way to achieve this is through the file co n te n ts environment.

foo bar baz \begin{filecontents}{demoFile.tex}


bar
%% LaTeX2e file ‘demoFile.tex5
%% generated by the ‘filecontents5 environment
\end{filecontents}
%% from source ‘04-03-15 on 2009/12/26. \usepackage{verbatim}
%% % End Preamble
bar
foo \inputfdemoFile.tex} baz

\small\verbatiminput{demoFile.tex}

\begin{filecontents * }{file nam e }

\en d{filecon ten ts* }

This is written during the Tjÿi run and can be read back in immediately afterwards. The starred
file c o n t e n t s version suppresses the output of commented lines (cf. Example 04-03-1). The file co n te n ts
environment environment may only be used in the preamble and not in the text body and never overwrites
existing files. You should also load the file co n te n ts package of the same name; this saves
having to delete the external file if the contents change.
You can’t use the file c o n te n ts environment at the current position in the text; this is a
restriction for longer documents - it is harder to keep the overview over the text. If you have
several such tables, use separate files and read them through \input{/i/e} in the preamble or
make a completely separate file without using the file c o n te n ts environment.
The syntax of a “tabularx-longtable” is also a combination of the two. The outer form
corresponds to tabularx and the inner to longtable. The file is read through the \LTXtable
command. In Example 04-03-2, the file is saved as part of the preamble and written to disk
during the E^X run.

\LTXtable{ta£?/e width}{file nam e }

\usepackage{ltxtable,filecontents,ragged2e}
\begin{f ilecontentsKLTXtabO. tex}
\begin{longtable}{@{}>{\ttfamily}l>{\RaggedRight}X@{}}
\caption{File extensions and their meaning.}\\
aux & (auxiliary) Auxiliary file , contains links etc. \\
bbl & (bibliography) Auxiliary file , contains the entries for the bibliography. \\
bib & (bibtex) Contains the literature database.\\
big & (bibliography log) Contains the output of a Bib\TeX\ run.\\
cfg & (config) Configuration file.\\
clo & (class options) Definitions for the document class and the corresponding
class options.\\
els & (class) Document class file.\\
\end{longtable}
\end{filecontents}

142
4.3 ltxtable

\rule{lcm}{0.5pt}\hfill text width\hfill\rule{lcm}{0.5pt}

\LTXtable{\linewidth}{LTXtabO}

\rule{lcm}{0.5pt}\hfill text width\hfill\rule{lcm}{0.5pt}

\LTXtable d e m o \LTXtable d e m o

text width b ig (bibliography log) Con­


tains the output of a
Table 1: File extensions and BibTgX run.
their meaning. c fg (config) Configuration
file.
aux (auxiliary) Auxiliary
c lo (class options) Defini­
file, contains links etc.
tions for the document
bbl (bibliography) Auxil­
class and the corre­
iary file, contains the
sponding class options.
entries for the bibliog­
e ls (class) Document class
raphy.
file.
b ib (bibtex) Contains the
literature database. text width

page 1 page 2

The external file is identical to a longtable apart from being able to use the X column
type as well. The behaviour of footnotes is significantly different however; they are still footn ote
possible, but require special attention.
> Within the normal longtable environment, the footnote symbols must be set with
\footnotemark (cf. Example 04-03-3); they are counted as usual. If you want it to start at
one in the table, you must reset the footnote counter before the table starts.
> Outside the table, i.e. after inserting it into the text through \ltablex, the footnote counter
must be decreased by the number of inserted \f ootnotemarks; four in Example 04-03-3 -
\addtocounter { footnote} { -4 } .
> The actual footnotes are specified through
\stepcounter{footflote}\footnotetext{texi}.
The counter must be incremented manually through \stepcounter. The number of the
footnote could also be specified through the optional argument \f ootnotetext [number] { text},
but this needs to be changed manually every time a new footnote is inserted before the
table because the numbering changes.
> The footnotes always appear a fter the table, i.e. potentially several pages after the corre­
sponding number.

143
4 Multi-page tables

\usepackage{ltxtable,filecontents}
\begin{filecontents}{LTXtabl.tex}
\begin{longtable}{@{}>{\ttfamily}l>{\raggedright\arraybackslash}X@{}}
aux \footnotemark& (auxiliary) Auxiliary file , contains links, refs, etc. \\
bbl \footnotemark& (bibliography) Auxiliary file , contains the
entries for the bibliography.\\
cfg & (config) Configuration file.\\
clo \footnotemark& (class options) Definition file for the document class
and the corresponding class options.\\
els \footnotemark& (class) Document class file , e.g. \texttt{book.els}.\\
\end{longtable}
\end{filecontents}
\rule{lcm}{0.5pt}\hfill text width\footnote{start}\hfill\rule{lcm}{0.5pt}

\LTXt able{\linewidth}{LTXt abl}


\addtocounter{footnote}{-4}
\stepcounter{footnote}\footnotetext{auxiliary}%
\stepcounter{footnote}\footnotetext{bibliography}
\stepcounter{footnote}\footnotetext{class options}%
\stepcounter{footnote}\footnotetext{class}
\ v fill
\rule{lcm}{0. 5pt}\hfill text width\footnote{foo}\hfill\rule{lcm}{0. 5pt}

\f ootnote d e m o \f ootnote de m o

text wi dt h1 e ls 5 (class) Document class file, e.£


book. e ls .
aux 2 (auxiliary) Auxiliary file, contains
links, refs, etc.
bbl 3 (bibliography) Auxiliary file,
contains the entries for the
bibliography.
c fg (config) Configuration file.
c lo 4 (class options) Definition file for text width6
the document class and the
Auxiliary
corresponding class options. 3bibliography
4class options
5class
1start 6foo

page 1 page 2

144
4.4 stabular

4.4 sta b u la r
The stabular package by Sigitas Tolusis is part of the s tto o ls and extends the internal fflgX
tabular and array environments so that they may contain a page break. Additionally, two
similar environments and two new commands are defined. The two environments have the
same syntax as the ones in standard ETeX, but are prefixed with an “s”.

\begin{st abular}

\end{stabular}
\begin{ st abular * }{ width}

\end{stabular*}
\emptyrow [length] \tabrow{ Text} [height]

The \emptyrow command creates an empty table row of height zero with optional line feed
(vertical space after the row); \tabrow creates a row of normal height of the argument, but
also with optional line feed. Both commands must be last in a table row; the argument of
\tabrow is usually only used to determine the height of the respective table row. Line breaks
with an optional \hline are of course allowed afterwards.
To make the effect of the \emptyrow and \tabrow commands obvious, both have been
used with and without optional line feed in the following example. The non-existent line feed
results in row 2 “missing”.

1st table row 1 \usepackage{stabular}


3 rd table row 3 \begin{stabular}{lc}\\\hline
1 st & table row 1 \\\hline
5th table row 5 \emptyrow\hline
text____________ 3rd & table row 3 \\\hline
7th table row 7 \emptyrow[lOpt]\hline
text
5th & table row 5 \\\hline
9 th table row 9 \tabrow{text}\hline
7th & table row 7 \\\hline
\tabrow{text}[5pt]\hline
9th & table row 9 \\\hline
\end{stabular}

\usepackage{stabular}
A normal \texttt{stabular} environment, containing a page break, which cannot be
centred.

% the following \texttt{center} environment only demonstrates that i t has no


% effect on \texttt{stabular}.
\begin{center}

145
4 Multi-page tables

\begin{stabular}{@{}p{0.55\linewidth} r@{}}
\emph{country} & \emph{entry}\\\hline
Egypt & 30.06.1995W Albania & 08.09.2000 \\
Angola & 23.11.1996W Antigua and Barbuda& 01.01.1995 \\
Antilles & 2 1.0 1.1996\\ Arab Emirates & 10.04.1996 \\
Argentina & 01.01.1995W Armenia & 05.02.2003\\Australia & 01.01.1995W
Bahrain & 01.01.1995W Bangladesh & 01.01.1995\\Barbados& 01.01.1995W
Belgium & 01.01.1995W Belize & 01.01.1995 \\
\end{stabular}
\end{center}

stabular demo stabular demo 04-04-2

A normal s t a b u la r environment, contain- Bangladesh 01.01.1995


ing a page break, which cannot be centred. Barbados 01.01.1995
Belgium 01.01.1995
country entry Belize 01.01.1995
Egypt 30.06.1995
Albania 08.09.2000
Angola 23.11.1996
Antigua and Barbuda 01.01.1995
Antilles 21.01.1996
Arab Emirates 10.04.1996
Argentina 01.01.1995
Armenia 05.02.2003
Australia 01.01.1995
Bahrain 01.01.1995

page 1 page 2

The example clearly shows some advantages and disadvantages of the stabular envi­
ronment. Its simplicity to use is an advantage: the only difference to the standard ETpX
environment is the “sMprefix. However, being unable to centre the environment and to define
intermediate headers and footers are disadvantages. The reason is the internal definition of
the environment; it doesn’t write its contents into a box to be able to determine the width of
the table. This can’t be rectified by using a minipage because that may not contain a page
break. Through some trial and error and an empty p column, an according left indentation
can be achieved, as can be seen in the following example. The first (empty) column is defined
by p { l. 5em}.

\usepackage{stabular}
A normal \texttt{stabular} environment, containing a page break, which cannot be
centred automatically.

\begin{stabular}{@{}p{l.5em}@{} p{0.55\linewidth} r@{}}

146
4.4 stabular

& \emph{country} & \emph{entry}\\\cline{2-3}


& Egypt & 30.06.1995W & Albania & 08.09.2000 \\
& Angola & 23.11.1996W &Antigua and Barbuda& 01.01.1995 \\
& Antilles & 21.01.1996\\ &Arab Emirates & 10.04.1996 \\
& Argentina & 01.01.1995W & Armenia & 05.02.2003W& Australia & 01.01.1995W
& Bahrain & 01.01.1995W &Bangladesh & 0 1.0 1.1995\\& Barbados& 01.01.1995W
& Belgium & 01.01.1995W &Belize & 01.01.1995 \\
\end{stabular}

stabular d e m o stabular d e m o
04-04-3

A normal s t a b u la r environment, contain- Bangladesh 01.01.1995


ing a page break, which cannot be centred Barbados 01.01.1995
automatically. Belgium 01.01.1995
country entry Belize 01.01.1995
Egypt 30.06.1995
Albania 08.09.2000
Angola 23.11.1996
Antigua and Barbuda 01.01.1995
Antilles 21.01.1996
Arab Emirates 10.04.1996
Argentina 01.01.1995
Armenia 05.02.2003
Australia 01.01.1995
Bahrain 01.01.1995

page 1 page 2

A table across the whole width of the page is no problem; the stabular* environment
is similar to tabular*. However, in these cases it actually makes more sense to use the
tabularx environment or the \LTXtable command, as they increase the width of the column
while the starred version of stabular just increases the space between two columns (cf.
Section 1.1 on page 5).

\usepackage{stabular}
A normal \texttt{stabular} environment, containing a page break, which w ill
extend across the whole width of the page.

\begin{stabular*}{\linewidth}{@{}p{0.55\linewidth} @{\extracolsep{\fill}} r@{}}


\emph{country} & \emph{entry}\\\hline
Egypt & 30.06.1995\\ Albania & 08.09.2000 \\
Angola & 23.11.1996W Antigua and Barbuda& 01.01.1995 \\
Antilles & 21.01.1996W Arab Emirates & 10.04.1996 \\
Argentina & 01.01.1995\\ Armenia & 05.02.2003\\Australia & 01.01.1995W
Bahrain & 01.01.1995W Bangladesh & 01.01.1995\\Barbados& 01.01.1995\\

147
4 Multi-page tables

Belgium & 01.01.1995W Belize & 01.01.1995 \\


\end{stabular*}

stabular* demo stabular* demo

A normal s t a b u la r environment, contain­ Bahrain 01.01.1995


ing a page break, which will extend across Bangladesh 01.01.1995
the whole width of the page. Barbados 01.01.1995
Belgium 01.01.1995
country entry Belize 01.01.1995
Egypt 30.06.1995
Albania 08.09.2000
Angola 23.11.1996
Antigua and Barbuda 01.01.1995
Antilles 21.01.1996
Arab Emirates 10.04.1996
Argentina 01.01.1995
Armenia 05.02.2003
Australia 01.01.1995

page 1 page 2

If, for some reason, you can’t use either of the other packages for tables with page breaks,
but headers and footers are required on each page, you can insert them after typesetting the
table. In the example above, “Australia” was in the last row on the first page; therefore it can
be replaced by a footer.1

\usepackage{stabular}
A normal \texttt{stabular} environment, containing a page break, which w ill
extend across the whole width of the page.

\begin{stabular*}{\linewidth}{@{}p{0.55\linewidth} @{\extracolsep{\fill}} r@{}}


\emph{country} & \emph{entry}\\\hline
Egypt &30.06.1995W Albania &08.09.2000W
Angola &23.11.1996W Antigua andBarbuda& 01.01.1995W
Antilles &21.01.1996W Arab Emirates &10.04.1996W
Argentina &01.01.1995W Armenia &05.02.2003\\\hline
\multicolumn{2}{r@{}}{\small\emph{continued}\ldots}\\
% page break
\multicolumn{2}{@{}l}{\ldots\small\emph{continued}}\\\hline
Australia &01.01.1995W Bahrain &01.01.1995W
Bangladesh &01.01.1995W Barbados &01.01.1995W
Belgium &01.01.1995W Belize &01.01.1995W
\end{stabular*}
]Such “handicraft work” should only be done with final versions of a document.

148
4.5 supertabular

stabular* demo stabular* demo

A normal s t a b u la r environment, contain­ . . . continued


ing a page break, which will extend across Australia 01.01.1995
the whole width of the page. Bahrain 01.01.1995
Bangladesh 01.01.1995
country entry Barbados 01.01.1995
Egypt 30.06.1995 Belgium 01.01.1995
Albania 08.09.2000 Belize 01.01.1995
Angola 23.11.1996
Antigua and Barbuda 01.01.1995
Antilles 21.01.1996
Arab Emirates 10.04.1996
Argentina 01.01.1995
Armenia 05.02.2003
continued...

page 1 page 2

4.5 supertabular
The main difference between the supertabular package by Johannes Braams and Theo
Jurriens and the longtable package (cf. Section 4.1 on page 125) is the syntax; for a
supertabular, all captions, headers, and footers have to be specified outside the actual
table, supertabular can be loaded with the options listed in Table 4.3.

name m eaning Table 4.3: Summary of


the package options of
errorshow Does not write additional information into the log file (default), supertabular.
pageshow Outputs information on the determined page breaks,
debugshow Every row that is output is also added to the log.

The new supertabular and supertabular* environments have the same syntax as the
general tabular and tabular* environments. The mpsupertabular and mpsupertabular*
environments behave similarly to the environments without the “mp” prefix, which stands for
minipage. The “mp” versions have the advantage that footnotes are definitely counted and
output page-wise; cf. Section 4.5.4 on page 155.

149
4 Multi-page tables

\begin{supertabular}{co/wmn definition }

\end{supertabular}
\begin{supertabular*}{iaWe 'width}{column definition }

\end{supert abular*}
\begin{mpsupertabular}{colum n definition}

\end{mpsupertabular}
\begin{mpsupertabular*}{table width}{column definition}

\end{mpsupertabular*}

\usepackage[pageshow]{supertabular}
\begin{center}\begin{supertabular}{@{}l r@{}}
\emph{country} & \emph{entry}\\\hline
Egypt & 30.06.1995 \\ Albania & 08.09.2000 \\
Angola & 23.11.1996 \\ Antigua and Barbuda & 01.01.1995 \\
Antilles & 21.01.1996 \\ Arab Emirates & 10.04.1996 \\
Argentina &01.01.1995 \\ Armenia & 05.02.2003 \\
Australia & 01.01.1995 \\ Bahrain & 01.01.1995 \\
Bangladesh & 01.01.1995 \\ Barbados & 01.01.1995 \\
Belgium & 01.01.1995 \\ Belize & 01.01.1995 \\
Benin & 22.02.1996 \\
\end{supertabular}\end{center}

supertabular demo supertabular demo

country entry Bangladesh 01.01.1995


Egypt 30.06.1995 Barbados 01.01.1995
Albania 08.09.2000 Belgium 01.01.1995
Angola 23.11.1996 Belize 01.01.1995
Antigua and Barbuda 01.01.1995 Benin 22.02.1996
Antilles 21.01.1996
Arab Emirates 10.04.1996
Argentina 01.01.1995
Armenia 05.02.2003
Australia 01.01.1995
Bahrain 01.01.1995

page 1 page 2

150
4.5 supertabular

The last row of the table m ust be terminated with a line end command, either \\ or
\tabularnewline; otherwise Tj?X will give an error message. The example above already ^ last row;
shows a disadvantage of the supertabular environment; the parts of the table can have table wu
different widths on different pages. In contrast to the longtable environment, no information
is written to the . aux file that could be evaluated for the following pages. To avoid this effect,
either insert a header or footer or use the starred version. The starred version has the
advantage that the ltx ta b le package (cf. Section 4.3 on page 141) does not have to be used,
but the disadvantage that the corresponding column has to be filled manually (cf. Section 1.1
on page 3). To achieve this, the array package must be loaded in this case because otherwise
the column separator ! is unknown and the \extracolsep command can’t be used.

\usepackage{array,supertabular}
\begin{supertabular*}{\linewidth}{@{}l!{\extracolsep{\fill}} r@{}}
\emph{country} & \emph{entry}\\\hline
Egypt & 30.06.1995 \\ Albania & 08.09.2000 \\
Angola & 23.11.1996 \\ Antigua and Barbuda & 01.01.1995 \\
Antilles & 21.01.1996 \\ Arab Emirates & 10.04.1996 \\
Argentina & 01.01.1995 \\ Armenia & 05.02.2003 \\
Australia & 01.01.1995 \\ Bahrain & 01.01.1995 \\
Bangladesh & 01.01.1995 \\ Barbados & 01.01.1995 \\
Belgium & 01.01.1995 \\ Belize & 01.01.1995 w
Benin & 22.02.1996 \\
\end{supertabular*}

supertabular demo supertabular demo

country entry Bangladesh 01.01.1995


Egypt 30.06.1995 Barbados 01.01.1995
Albania 08.09.2000 Belgium 01.01.1995
Angola 23.11.1996 Belize 01.01.1995
Antigua and Barbuda 01.01.1995 Benin 22.02.1996
Antilles 21.01.1996
Arab Emirates 10.04.1996
Argentina 01.01.1995
Armenia 05.02.2003
Australia 01.01.1995
Bahrain 01.01.1995

page 1 page 2

151
4 Multi-page tables

4 .5.1 P age b r e a k
super tabular determines the remaining space on the page after each row and inserts a
page break if required. In some cases this is not optimal, however, as shown in the previous
examples. You can use the \shrinkheight command to increase or decrease the comparison
value for the page. The command must be at the beginning of a row and may be given
arbitrary lengths and units. In the following example, the page is extended by three lines at
the beginning of the table (first row) already to achieve a better page break. If this value were
further decreased, however, an empty page would occur as TpX would move the block, which
would then be too large, to the next page. A positive value assigned to \shrinkheight would
instead shrink the page so that the page break would occur earlier.

\shr inkhe igh t { length}

\usepackage{array,supertabular}
\begin{supertabular*}{\linewidth}{@{}l!{\extracolsep{\fill}} r@{}}
\emph{country} & \emph{entry}\\\hline \shrinkheight{-3\normalbaselineskip}
Egypt & 30.06.1995 \\ Albania & 08.09.2000 \\
Angola & 23.11.1996 \\ Antigua and Barbuda & 01.01.1995 \\
Antilles & 21.01.1996 \\ Arab Emirates & 10.04.1996 \\
Argentina & 01.01.1995 \\ Armenia & 05.02.2003 \\
Australia & 01.01.1995 \\ Bahrain & 01.01.1995 \\
Bangladesh & 01.01.1995 \\ Barbados & 01.01.1995 \\
Belgium & 01.01.1995 \\ Belize & 01.01.1995 \\
Benin & 22.02.1996 \\
\end{supertabular*}

supertabular d e m o supertabular demo

country entry Belize 01.01.1995


Egypt 30.06.1995 Benin 22.02.1996
Albania 08.09.2000
Angola 23.11.1996
Antigua and Barbuda 01.01.1995
Antilles 21.01.1996
Arab Emirates 10.04.1996
Argentina 01.01.1995
Armenia 05.02.2003
Australia 01.01.1995
Bahrain 01.01.1995
Bangladesh 01.01.1995
Barbados 01.01.1995
Belgium 01.01.1995

page 1 page 2

152
4.5 supertabular

4 .5 .2 H ea d er s a n d fo o te r s
All specifications must be done before the table itself. The following commands can be used:

\ tablef± T sthead{definition} \ ta b leh ea d { definition}


\t ablet a i l { d e f i n i t i o n } \ ta b le la s tta il { d e f i n i t i o n }

All d e f in itio n s must correspond to at least one table row each and may contain a \hline
in the simplest case. If \ tab lefirsth ead or \ t a b le la s tta il are not defined, they are
automatically substituted by \tablehead and \ ta b le ta il respectively.

\usepackage{supertabular}
\tablefirsthead{\hline \emph{country} & \emph{entry}\\\hline}
\tablehead{\emph{country} & \emph{entry}\\\hline}
\tabletail{\hline \multicolumn{2}{r@{}}{continued \ldots}\\}
\tablelasttail{\hline}
\begin{center} \begin{supertabular}{@{}p{0.55\linewidth} r@{}}
Egypt & 30.06.1995 \\ A lb a n ia & 08.09.2000 \\
Angola & 23.11.1996 \\ A n tigu a and Barbuda & 01.01.1995 \\
Antilles & 21.01.1996 \\ Arab Em irates & 10.04.1996 \\
Argentina & 01.01.1995 \\ Armenia & 05.02.2003 \\
Australia & 01.01.1995 \\ Bahrain & 01.01.1995 \\
Bangladesh & 01.01.1995 \\ Barbados & 01.01.1995 \\
Belgium & 01.01.1995 \\ B e liz e & 01.01.1995 \\
Benin & 22.02.1996 \\
\end{supertabular} \end{center}

04-05-4 I supertabular demo supertabular demo

country entry country entry


Egypt 30.06.1995 Bahrain 01.01.1995
Albania 08.09.2000 Bangladesh 01.01.1995
Angola 23.11.1996 Barbados 01.01.1995
Antigua and Barbuda 01.01.1995 Belgium 01.01.1995
Antilles 21.01.1996 Belize 01.01.1995
Arab Emirates 10.04.1996 Benin 22.02.1996
Argentina 01.01.1995
Armenia 05.02.2003
Australia 01.01.1995
continued. . .

page 1 page 2

153
4 Multi-page tables

4 .5 .3 T ab le c a p tio n s
There are three different commands to add captions:

\tablecaption [LOTentry] {text} \topcaption [LOTentry] { text}


\bottomcaption [LOTentry] {text}

The optional argument LOT entry replaces the default entry of text into the table of contents
(.toe) if used. When using \tablecaption, the document class determines the position of
the label by specifying either \@topcaptionfalse or \@topcaptiontrue. This specification
can be overwritten at any time, however, by using one of the other two commands, which
force the caption to be above or below the table, respectively. The caption package also
supports the super tabular package.

\usepackage{supertabular} \usepackage[labelfont=bf]{caption}
\tablecaption{Demonstration of a table caption.}
\tablefirsthead{\hline \emph{country} & \emph{entry}\\\hline}
\tablehead{\emph{country} & \emph{entry}\\\hline}
\tabletail{\hline \multicolumn{2}{r@{}}{continued \ldots}\\} \tablelasttail{\hline}
\begin{center}\begin{supertabular}{@{}p{0.55\linewidth} r@{}}
Egypt & 30.06.1995W Albania & 08.09.2000\\Angola & 23.11.1996W
Antigua and Barbuda& 01.01.1995\\Antilles& 21.01.1996\\Arab Emirates & 10.04.1996W
Argentina & 01.01.1995W Armenia & 05.02.2003\\Australia &01.01.1995\\
Bahrain & 01.01.1995W Bangladesh & 01.01.1995\\Barbados &01.01.1995W
Belgium & 01.01.1995W Belize & 01.01.1995\\Benin &22.02.1996W
\end{supertabular}\end{center}

s u p e rta b u la r demo s u p e r ta b u la r demo

Table 1: Demonstration of a table caption. country entry


Armenia 05.02.2003
country entry Australia 01.01.1995
Egypt 30.06.1995 Bahrain 01.01.1995
Albania 08.09.2000 Bangladesh 01.01.1995
Angola 23.11.1996 Barbados 01.01.1995
Antigua and Barbuda 01.01.1995 Belgium 01.01.1995
Antilles 21.01.1996 Belize 01.01.1995
Arab Emirates 10.04.1996 Benin 22.02.1996
Argentina 01.01.1995
continued. . .

page 1 page 2

154
4.5 supertabular

4 .5 .4 F o o tn o te s
If you use footnotes within the normal supertabular environment, they appear as a sym­
bol in the table, but the text of the footnote is missing. Therefore \footnotemark and
\f ootnotetext have to be used separately again, as shown in Example 04-03-3 on page 143.

\usepackage{supertabular}
\tablefirsthead{\hline \emph{country} & \emph{entry}\\\hline}
\tablehead{\emph{country} & \emph{entry}\\\hline}
\tabletail{\hline \multicolumn{2}{r@{}}{continued \ldots}\\}
\tablelasttail{\hline}
Text\footnote{before the text} and footnote.
\begin{center}\begin{supertabular}{@{}p{0. 55\linewidth} r@{}}
Egypt\footnotemark &30.06.1995 \\ Albania & 08.09.2000\\Angola & 23.11.1996W
Antigua and Barbuda &01.01.1995 \\ Antilles\footnotemark & 21.01.1996 \\
Arab Emirates &10.04.1996 \\ Argentina & 01.01.1995\\Armenia & 05.02.2003W
Australia &01.01.1995 \\ Bahrain & 01.01.1995 \\
Bangladesh &01.01.1995 \\ Barbados & 01.01.1995 \\
Belgium &01.01.1995 \\ Belize\footnotemark & 01.01.1995 \\
\end{supertabular}\addtocounter{footnote}{-3}
\stepcounter{footnote}\footnotetext{first footnote}
\stepcounter{footnote}\footnotetext{second footnote}
\stepcounter{footnote}\footnotetext{third footnote}
\end{center}
Text\footnote{after the text} and footnote.

s u p e rta b u la r demo s u p e r ta b u la r demo

Text1 and footnote. country entry


Australia 01.01.1995
country entry Bahrain 01.01.1995
Egypt2 30.06.1995 Bangladesh 01.01.1995
Albania 08.09.2000 Barbados 01.01.1995
Angola 23.11.1996 Belgium 01.01.1995
Antigua and Barbuda 01.01.1995
Belize4 01.01.1995
Antilles3 21.01.1996
Arab Emirates 10.04.1996 Text5 and footnote.
Argentina 01.01.1995
Armenia 05.02.2003
continued. . . 2first footnote
3second footnote
4third footnote
before the text 5after the text

page 1 page 2

155
4 Multi-page tables

This has the disadvantage that the footnotes all appear together after the table, which can
be bad for large tables where there are several pages between footnote mark and corresponding
text. It is better therefore to use the mpsupertabular environment as long as no other
footnotes (apart from the table footnotes) appear on the first or last page of the table. Within
the minipage, the footnotes are typeset with a footnote rule immediately after the table and
are counted with letters. As can be seen in the following example, this results in a clear
differentiation, but the appearance is unsatisfactory. The footnotes immediately before and
after the table should be removed.

\usepackage{supertabular}
\tablefirsthead{\hline \emph{country} & \emph{entry}\\\hline}
\tablehead{\emph{country} & \emph{entry}\\\hline}
\tabletail{\hline \multicolumn{2}{r@{}}{continued \ldots}\\} \tablelasttail{\hline}
Text\footnote{before the text} and footnote.\par\bigskip
\begin{mpsupertabular}{@{}p{0.55\linewidth} r@{}}
Egypt\footnote{first foonote}& 30.06.1995 \\ Albania & 08.09.2000 \\
Angola & 23.11.1996 \\ Antigua and Barbuda & 01.01.1995 \\
Antilles\footnote{second footnote}& 21.01.1996 \\ Arabian Emirates & 10.04.1996 \\
Argentina & 01.01.1995 \\ Armenia &05.02.2003 \\
Australia & 01.01.1995 \\ Bahrain &01.01.1995 \\
Bangladesh & 01.01.1995 \\ Barbados &01.01.1995 \\
Belgium & 01.01.1995 \\ Belize\footnotefthird footnote} & 01.01.1995 \\
\end{mpsupertabular}\par\bigskip
Text\footnote{after the text} and footnote.

supertabular demo supertabular demo supertabular demo


! 04-05-7

Text1 and footnote. c o u n tr y e n try c o u n tr y e n try


Egypt* 30.06.1995 Armenia 05.02.2003
Albania 08.09.2000 Australia 01.01.1995
Angola 23.11.1996 Bahrain 01.01.1995
Antigua and Barbuda 01.01.1995 Bangladesh 01.01.1995
Antilles* 21.01.1996 Barbados 01.01.1995
Arabian Emirates 10.04.1996 Belgium 01.01.1995
Argentina 01.01.1995 Belize* 01.01.1995
continued...
“thirdfootnote
“first foonote
^secondfootnote Text2 and footnote.

page 1 page 2 Page 3

\usepackage{supertabular}
\tablefirsthead{\hline \emph{country} & \emph{entry}\\\hline}
\tablehead{\emph{country} & \emph{entry}\\\hline}
\tabletail{\hline \multicolumn{2}{r@{}}{continued \ldots}\\}
\tablelasttail{\hline}

156
4.6 xtab

Text without footnote.\par\medskip


\begin{mpsupertabular*}{\linewidth}{@{}p{0.55\linewidth} @{\extracolsep{\fill}} r@{}}
Egypt\footnote{first footnote} & 30.06.1995 \\ Albania & 08.09.2000 \\
Angola & 23.11.1996 \\ Antigua and Barbuda& 01.01.1995 \\
Antilles\footnote{second footnote}& 21.01.1996 \\ Arabische Emirate & 10.04.1996 \\
Argentina & 01.01.1995 \\ Armenia & 05.02.2003 \\
Australia & 01.01.1995 \\ Bahrain & 01.01.1995 \\
Bangladesh & 01.01.1995 \\ Barbados & 01.01.1995 \\
Belgium & 01.01.1995 \\ Belize\footnote{third footnote} & 01.01.1995 \\
\end{mpsupert abular*}\par\medskip
Text without footnote.

supertabular d e m o supertabular d e m o

Text without footnote. country entry


Armenia 05.02.2003
country entry
Australia 01.01.1995
Egypt" 30.06.1995
Bahrain 01.01.1995
Albania 08.09.2000
Bangladesh 01.01.1995
Angola 23.11.1996
Barbados 01.01.1995
Antigua and Barbuda 01.01.1995
Belgium 01.01.1995
Antilles^ 21.01.1996
Belize0 01.01.1995
Arabische Emirate 10.04.1996
Argentina 01.01.1995 “third footnote
continued. . .
Text without footnote.
“first footnote
^second footnote

page 1 page 2

4.6 xtab
The xtab package by Peter Wilson is an extension of the super tabular package (cf. Sec­
tion 4.6). It is meant to provide better functionality especially regarding page breaks. The
syntax is in principle the same as for the environments from super tabular. The use of
the xtabular and xtabular* environments is otherwise completely identical to the usual
tabular and tabular* environments. The mpxtabular and mpxtabular* environments are
likewise similar to the environments without the mp prefix, which stands for minipage. This
has the advantage that footnotes can be counted and output per page, cf. Section 4.5.4 on
page 155.

157
4 Multi-page tables

\begin{xtabular}{ column definition}

\end{xtabular}
\begin{xtabular* }{ table width}{column definition}

\end{xtabular*}
\begin{mpxtabular}{ co/wmn definition}

\end{mpxt abular}
\begin{mpxtabular*}{taWe width}{column definition}

\end{mpxtabular*}

\usepackage{xtab}
\begin{center}\begin{xtabular}{@{}l r@{}}
\emph{country} & \emph{entry}\\\hline
Egypt & 30.06.1995W Albania & 08.09.2000\\Angola & 23.11.1996W
Antigua and Barbuda & 01.01.1995\\Antilles& 21.01.1996\\Arab Emirates & 10.04.1996W
Argentina &01.01.1995W Armenia &05.02.2003\\Australia &01.01.1995W
Bahrain &01.01.1995W Bangladesh &01.01.1995\\Barbados &01.01.1995\\
Belgium &01.01.1995W Belize &01.01.1995\\Benin &22.02.1996W
\end{xtabular}\end{center}

xtab demo xtab demo

country entry Armenia 05.02.2003


Egypt 30.06.1995 Australia 01.01.1995
Albania 08.09.2000 Bahrain 01.01.1995
Angola 23.11.1996 Bangladesh 01.01.1995
Antigua and Barbuda 01.01.1995 Barbados 01.01.1995
Antilles 21.01.1996 Belgium 01.01.1995
Arab Emirates 10.04.1996 Belize 01.01.1995
Argentina 01.01.1995 Benin 22.02.1996

page 1 page 2

la s t ro w The last row of the table m ust be terminated with a line end command, either \\ or
ta b le w id th x . \tabular newline; otherwise you will get an error message. The example above already
shows one of the disadvantages of the xtab package; the parts of the table can have different

158
4.6 xtab

widths on different pages. In contrast to the longtable environment, no information is


written to the . aux file that could be evaluated for the following pages. To avoid this effect,
either insert a header or footer or use the starred version. The starred version has the
advantage that the ltx ta b le package (cf. Section 4.3 on page 141) does not have to be used,
but the disadvantage that the corresponding column has to be filled manually (cf. Section 1.1
on page 3). To achieve this, the array package must be loaded because otherwise the column
operator ! is unknown and the \extracolsep command can’t be used.

\usepackage{array,xtab}
\begin{xtabular*}{\linewidth}{@{}l!{\extracolsep{\fill}} r@{}}
\emph{country} & \emph{entry}\\\hline
Egypt & 30.06.1995 \\ Albania & 08.09.2000 \\
Angola & 23.11.1996 \\ Antigua and Barbuda & 01.01.1995 \\
Antilles & 21.01.1996 \\ Arab Emirates & 10.04.1996 \\
Argentina & 01.01.1995 \\ Armenia & 05.02.2003 \\
Australia & 01.01.1995 \\ Bahrain & 01.01.1995 \\
Bangladesh & 01.01.1995 \\ Barbados & 01.01.1995 \\
Belgium & 01.01.1995 \\ Belize & 01.01.1995 \\
Benin & 22.02.1996 \\
\end{xtabular*}

04-06-2 x ta b u la r demo x ta b u la r demo

country entry Armenia 05.02.2003


Egypt 30.06.1995 Australia 01.01.1995
Albania 08.09.2000 Bahrain 01.01.1995
Angola 23.11.1996 Bangladesh 01.01.1995
Antigua and Barbuda 01.01.1995 Barbados 01.01.1995
Antilles 21.01.1996 Belgium 01.01.1995
Arab Emirates 10.04.1996 Belize 01.01.1995
Argentina 01.01.1995 Benin 22.02.1996

page 1 page 2

4 .6 .1 P age b r e a k
xtabular determines the remaining space on the page after each row and inserts a page break
if required. In some cases this is not optimal, however, as shown in the previous example. You

159
4 Multi-page tables

can use the \shrinkheight command to increase or decrease the comparison value for the
page.

\shrinkheight { length}

The command m ust be at the beginning of a row and may be given arbitrary lengths and
units. In the following example, the page is extended by three lines at the beginning of the
table (first row) already to achieve a better page break. If this value were further decreased,
however, an empty page would occur as TgX would move the block, which would then be too
large, to the next page. A positive value assigned to \shrinkheight would instead shrink
the page so that the page break would occur earlier.

\usepackage{array,xtab}
\begin{xtabular*}{\linewidth}{@{}l! {\extracolsep{\fill}} r@{}}
\emph{country} & \emph{entry}\\\hline
\shrinkheight{-3. l\normalbaselineskip}
Egypt & 30.06.1995 \\ Albania & 08.09.2000 \\
Angola & 23.11.1996 \\ Antigua and Barbuda & 01.01.1995 \\
Antilles & 21.01.1996 \\ Arab Emirates & 10.04.1996 \\
Argentina & 01.01.1995 \\ Armenia & 05.02.2003 \\
Australia & 01.01.1995 \\ Bahrain & 01.01.1995 \\
Bangladesh & 01.01.1995 \\ Barbados & 01.01.1995 \\
Belgium & 01.01.1995 \\ Belize & 01.01.1995 \\
Benin & 22.02.1996 \\
\end{xtabular*}

xtabular demo xtabular demo 04-06-3

country entry Bahrain 01.01.1995


Egypt 30.06.1995 Bangladesh 01.01.1995
Albania 08.09.2000 Barbados 01.01.1995
Angola 23.11.1996 Belgium 01.01.1995
Antigua and Barbuda 01.01.1995 Belize 01.01.1995
Antilles 21.01.1996 Benin 22.02.1996
Arab Emirates 10.04.1996
Argentina 01.01.1995
Armenia 05.02.2003
Australia 01.01.1995

page 1 page 2

160
4.6 xtab

4 .6 .2 H ea d er s a n d fo o te r s
All specifications must be done before the table itself. The following commands can be used:

\ tab lefirsth ead {definition} \t ablet a i l {definition}


\tablehead {definition} \ ta b lela stta ± l{ d efin ition }

All definitions must correspond to at least one table row each and may contain a \hline
in the simplest case. If \ tab lefirsth ead or \ t a b le la s tta il are not defined, they are
automatically substituted by \tablehead and \ ta b le ta il respectively.

\usepackage[table]{xcolor} \usepackage{xtab}
\tablefirsthead{\hline \emph{country} & \emph{entry}\\\hline}
\tablehead{\emph{country} & \emph{entry}\\\hline}
\tabletail{\hline \multicolumn{2}{r@{}}{continued \ldots}\\}
\tablelasttail{\hline}
\begin{center}
\begin{xtabular}{@{}p{0.55\linewidth} r@{}}
Egypt & 30.06.1995 \\ Albania & 08.09.2000 \\
Angola & 23.11.1996 \\ Antigua and Barbuda & 01.01.1995 \\
Antilles & 21.01.1996 \\ Arab Emirates & 10.04.1996 \\
Argentina & 01.01.1995 \\ Armenia & 05.02.2003 \\
Australia & 01.01.1995 \\ Bahrain & 01.01.1995 \\
Bangladesh & 01.01.1995 \\ Barbados & 01.01.1995 \\
Belgium & 01.01.1995 \\ Belize & 01.01.1995 \\
Benin & 22.02.1996 \\
\end{xtabular}
\end{center}

04-06-4 x ta b u la r demo x ta b u la r demo

country entry country entry


Egypt 30.06.1995 Antilles 21.01.1996
Albania 08.09.2000 Arab Emirates 10.04.1996
Angola 23.11.1996 Argentina 01.01.1995
Antigua and Barbuda 01.01.1995 Armenia 05.02.2003
continued. . . Australia 01.01.1995
Bahrain 01.01.1995
continued. . .

page 1 page 2

161
Multi-page tables

4 .6 .3 T ab le c a p tio n s
The xtab package also has three different commands to set captions:

\tablecaption: [LOTentry] { text} \topcaption [LOT entry] { text}


\bottomcaption [LOTentry] {text}

The optional argument LOT entry substitutes the default entry of text into the table of contents
if used. When using \tablecaption, the document class determines the position of the label
by specifying either \@topcaptionf alse or \@topcaptiontrue. This specification can be
overwritten at any time, however, by using one of the other two commands, which force the
caption to be above or below the table, respectively. The caption package supports the xtab
package with all its functionality.

\usepackage{xtab} \usepackage[labelfont=bf]{caption}
\tablecaption{Demonstration of a table caption.}
\tablefirsthead{\hline \emph{country} & \emph{entry}\\\hline}
\tablehead{\emph{country} & \emph{entry}\\\hline}
\tabletail{\hline \multicolumn{2}{r@{}}{continued \ldots}\\}
\tablelasttail{\hline}
\begin{xtabular}{@{}p{0.55\linewidth} r@{}}
Egypt & 30.06.1995W Albania & 08.09.2000\\Angola & 23.11.1996W
Antigua and Barbuda & 01.01.1995\\Antilles& 21.01.1996\\Arab Emirates & 10.04.1996W
Argentina & 0 1.0 1.1995\\ Armenia &05.02.2003\\Australia & 01.01.1995W
Bahrain & 0 1.0 1.1995\\ Bangladesh &01.01.1995\\Barbados & 01.01.1995W
Belgium & 01.01.1995W Belize &01.01.1995\\Benin & 22.02.1996\\
\end{xtabular}

xtabular d e m o xtabular demo

Table 1: Demonstration of a table caption. country entry


Angola 23.11.1996
country entry Antigua and Barbuda 01.01.1995
Egypt 30.06.1995 Antilles 21.01.1996
Albania 08.09.2000 Arab Emirates 10.04.1996
continued. . . Argentina 01.01.1995
Armenia 05.02.2003
continued. . .

page 1 page 2

162
4.6 xtab

4 .6 .4 F o o tn o te s
In principle, Section 4.5.4 on page 155 applies here as well. Again you have to use the footnote
commands \footnotemark and \footnotetext, as already shown in Example 04-03-3 on
page 143.

\usepackage{xtab}
\tablefirsthead{\hline \emph{country} & \emph{entry}\\\hline}
\tablehead{\emph{country} & \emph{entry}\\\hline}
\tabletail{\hline \multicolumn{2}{r@{}}{continued \ldots}\\}
\tablelasttail{\hline}
Text\footnote{before the table} and footnote.\par
\begin{xtabular}{@{}p{0.55\linewidth} r@{}}
Egypt\footnotemark & 30.06.1995 \\ Albania & 08.09.2000 \\
Angola & 23.11.1996 \\ Antigua and Barbuda & 01.01.1995 \\
Antilles\footnotemark& 21.01.1996 \\ Arab Emirates & 10.04.1996 \\
Argentina & 01.01.1995 \\ Armenia & 05.02.2003 \\
Australia & 01.01.1995 \\ Bahrain & 01.01.1995 \\
Bangladesh & 01.01.1995 \\ Barbados & 01.01.1995 \\
Belgium & 01.01.1995 \\ Belize\footnotemark & 01.01.1995 \\
\end{xtabular}
\addtocounter{footnote}{-3}
\stepcounter{footnote}\footnotetext{first footnote}
\stepcounter{footnote}\footnotetext{second footnote}
\stepcounter{footnote}\footnotetext{third footnote}
Text\footnote{after the table} and footnote.

xtabular demo xtabular demo

Text1 and footnote. country entry


country entry Antilles3 21.01.1996
Egypt2 30.06.1995 Arab Emirates 10.04.1996
Albania 08.09.2000 Argentina 01.01.1995
Angola 23.11.1996 Armenia 05.02.2003
Antigua and Barbuda 01.01.1995 Australia 01.01.1995
continued. . . Bahrain 01.01.1995
continued. . .

before the table

page 1 page 2

163
Multi-page tables

This has the disadvantage that the footnotes all appear together at the end of the table -
for long tables, there can be several pages between the footnote mark and the footnote text. It
is better therefore to use the mpxtabular environment as long as no other footnotes (apart
from the table footnotes) appear on the first or last page of the table. Within the minipage,
the footnotes are typeset with their own footnote rule immediately after the table and are
counted with letters. As shown in the following example, this provides a clear distinction,
but the the appearance is unsatisfactory. The footnotes immediately before or after the table
should be omitted.

\usepackage{xtab}
\tablefirsthead{\hline \emph{country} & \emph{entry}\\\hline}
\tablehead{\emph{country} & \emph{entry}\\\hline}
\tabletail{\hline \multicolumn{2}{r@{}}{continued \ldots}\\}
\tablelasttail{\hline}
Text\footnote{before the table} and footnote.
\begin{center}
\begin{mpxtabular}{@{}p{0.55\linewidth} r@{}}
Egypt\footnote{first footnote} & 30.06.1995 \\ Albania & 08.09.2000 \\
Angola & 23.11.1996 \\ Antigua and Barbuda & 01.01.1995 \\
Antilles\footnote{second footnote}& 21.01.1996 \\ Arab Emirates & 10.04.1996 \\
Argentina & 01.01.1995 \\ Armenia & 05.02.2003 \\
Australia & 01.01.1995 \\ Bahrain & 01.01.1995 \\
Bangladesh & 01.01.1995 \\ Barbados & 01.01.1995 \\
Belgium & 01.01.1995 \\ Belize\footnote{third footnote} & 01.01.1995 \\
\end{mpxtabular}
\end{center}
Text\footnote{after the table} and footnote.

x ta b u la r demo xtabular demo

Text1 and footnote. country entry


Antigua and Barbuda 01.01.1995
country entry
Antilles0 21.01.1996
Egypt0 30.06.1995
Arab Emirates 10.04.1996
Albania 08.09.2000
Argentina 01.01.1995
Angola 23.11.1996
Armenia 05.02.2003
continued. . . Australia 01.01.1995
“first footnote continued. . .

“second footnote

b efo re the table

page 1 page 2

164
4.6 xtab

\usepackage{xtab}
\tablefirsthead{\hline \emph{country} & \emph{entry}\\\hline}
\tablehead{\emph{country} & \emph{entry}\\\hline}
\tabletail{\hline \multicolumn{2}{r@{}}{continued \ldots}\\}
\tablelasttail{\hline}
Text without footnote.

\medskip
\begin{mpxtabular*}{\linewidth}{@{}p{0.55\linewidth} @{\extracolsep{\fill}} r@{}}
EgYPt\footnote{first footnote} & 30.06.1995 \\ Albania & 08.09.2000 \\
Angola & 23.11.1996 \\ Antigua and Barbuda & 01.01.1995 \\
Antilles\footnote{second footnote}& 21.01.1996 \\ Arab Emirates & 10.04.1996 \\
Argentina & 01.01.1995 \\ Armenia &05.02.2003 \\
Australia & 01.01.1995 \\ Bahrain &01.01.1995 \\
Bangladesh & 01.01.1995 \\ Barbados &01.01.1995 \\
Belgium & 01.01.1995 \\ Belize\footnote{third footnote} & 01.01.1995 \\
\end{mpxt abular *}

\medskip
Text without footnote.

x t a b u l a r demo x t a b u l a r demo

Text without footnote. country entry


Antigua and Barbuda 01.01.1995
country entry
Antilles0 21.01.1996
Egypt“ 30.06.1995
Arab Emirates 10.04.1996
Albania 08.09.2000
Argentina 01.01.1995
Angola 23.11.1996
Armenia 05.02.2003
continued. . .
Australia 01.01.1995
"first footnote continued. . .

"second footnote

page 1 page 2

4 .6 .5 T ^X nicalities
The page break can be controlled through the \shrinkheight command to achieve a better
breakdown into pages. The command must be called after the first row of the table with a
length as parameter. A positive length decreases the amount of space available on a page and a
negative value increases it. In general you should use multiples of \normalbaselineskip for

165
M ulti-page tables

the value, as within the table \b a s e lin e s k ip is set to Opt internally. The following example
is identical to Example 04-06-5 on page 162 apart from the removal of footnotes and the use
of the \s h r in k h e ig h t command.

\s h r in k h e ig h t { length}

\usepackage{xtab} \usepackage[labelfont=bf]{caption}
\tablecaption{Demonstration of a table caption.}
\ta b le fir sth e a d {\h lin e \emph{country} & \em ph{entry}\\\hline}
\tablehead{\emph{country} & \em ph{entry}\\\hline}
\ta b le t a il{ \h lin e \multicolumn{ 2}{r@{}}{continued \ld o t s } \\}
\ta b le la s t t a il{ \h lin e }
\begin{center}
\begin{xtabular}{@ {}p{0.55\linewidth} r@{}}
Egypt & 30.06.1995 \\\shrinkheight{-7\norm albaselineskip}
Albania & 08.09.2000 \ \
Angola & 23.11.1996 \ \ Antigua and Barbuda & 01.01.1995 \ \
A n tilles & 21.01.1996 \ \ Arab Emirates & 10.04.1996 \ \
Argentina & 01.01.1995 \ \ Armenia & 05.02.2003 \ \
Australia & 01.01.1995 \ \ Bahrain & 01.01.1995 \ \
Bangladesh & 01.01.1995 \ \ Barbados & 01.01.1995 \ \
Belgium & 01.01.1995 \ \ B elize & 01.01.1995 \ \
\end{xtabular}
\end{center}

x-caouiar aemo x r a D u i a r aemo

Table 1: Demonstration of a table caption. co u n try en try


Australia 01.01.1995
cou n try en try Bahrain 01.01.1995
Egypt 30.06.1995 Bangladesh 01.01.1995
Albania 08.09.2000 Barbados 01.01.1995
Angola 23.11.1996 Belgium 01.01.1995
Antigua and Barbuda 01.01.1995 Belize 01.01.1995
Antilles 21.01.1996
Arab Emirates 10.04.1996
Argentina 01.01.1995
Armenia 05.02.2003
continued...

page 1 page 2

The length for \s h r in k h e ig h t depends on the internal calculation of the required vertical
space. Specifying a multiple o f \n o r m a lb a se lin esk ip is not the same as saying “7 more
lines” - it is just trial and error to find the correct setting.

16 6
C h a p t e r

T ip s a n d t r ic k s

5.1 Tables - g e n e r a l............................................................................................................. 167


5.2 tab b in g environments.................................................................................................. 170
5.3 Two-column mode.......................................................................................................... 170
5.4 Table captions.................................................................................................................. 171
5.5 Math m o d e ..................................................................................................................... 173
5.6 Excel and OpenOffice f i l e s .......................................................................................... 175

This chapter describes various tips and tricks that have not been listed so far or are not directly
supported by one package. Some of the tricks have been taken from the usual T^X mailing
lists and newsgroups. In these cases, the respective author is given.

5 .1 Tables - general
At the beginning o f a table row, Tj?X searches internally for specific primitive commands trick
that affect the formatting, for example \span , \o m it, and \n o a lig n . This can lead to error
messages if the first column’s column type is defined to change the encoding for that column.
While searching for specific commands in the row, T^X expands the commands in the first
column, and only then considers the column type, with its explicit change of encoding.
In the following example by Bernd Raichle, the \ r e la x command prevents the following
\t e x t e p s il o n from the t ip a package from being expanded.
Tips and tricks

\usepackage[T3, T l]{fontenc}
\usepackage[la t i n i ] { inputenc}
\usepackage{array, dcolumn, tabularx, textcomp,ragged2e}
\usepackage[noenc] { tipa}
\newcolumntype{C}{>{\Centering}X}
\begin{tabularx}{0. 85\linewidth}%
{ |> {\tipaencodin g}c|1 |>{\RaggedRight}X|D{. } { . } { - l} |} \h lin e
\m ulticolum n{l}{|c|}{Sound} & \multicolumn{l}{c|}{Exaraples}
& \multicolum n{l}{C|}{Place and manner of a rticu lation }
& \multicolumn{l}{C|HOccurrence frequency (\%)} \\\h lin e
\r e la x \te x tepsilon & l a i t , jou et, merci & front, half-open & 5.3 \\\h lin e
\end{tabularx}

Sound Examples Place and manner Occurrence fre­


of articulation quency (%)
£ lait, jouet, merci front, half-open 5.3

tip If your table contains empty or not completely filled rows and makes use of vertical lines,
you must list all columns, or a vertical line will be missing:

foo bar I baz | \b e g in { ta b u la r } { |c |c |c |} \h lin e ,---------,


foo & bar & b az\\
foo
foo \ \
foo bar baz |
foo & bar & b a z\\\h lin e
foo bar baz \end{tabular}\par\medskip
foo
\b e g in { ta b u la r } { |c |c |c |} \h lin e
foo bar baz
foo & bar & b az\\
foo & & \ \
foo & bar & b a z\\\h lin e
\end{tabular}\par\medskip

trick At the end of a row in a table, you can insert arbitrary vertical space by using the optional
argument of \ \ . However, if a horizontal line is added as well, the processing order of T^X
“first line feed, then line” leads to an unsatisfactory result. The T^X \n o a lig n command lets
you insert vertical material at the end of a row such that the horizontal line is drawn first and
then the vertical line feed is inserted.

Egypt 30.06.1995 \begin{tabular}{@ {}ll@ {}}\\\hline


Egypt & 30.06.1995 \\[1 0 p t]\h lin e
Albania 08.09.2000 Albania & 08.09.2000 \ \
\h lin e\n oalign {\vsp ace{ 10p t}}
Angola 23.11.1996 Angola & 23.11.1996 \ \
\hline\noalign{\vspace{15pt}}
Argentina & 01.01.1995 \ \
Argentina 01.01.1995 A n tilles & 21.01.1996
Antilles 21.01.1996 \end{tabular}

168
5.1 Tables - general

trick A lo n g ta b le usually requires several runs because it writes information about the current
width in the . aux file and reads it back in. To reference this width, for example to typeset the
caption or surrounding text with the same width as the table, you can use this trick by Heiko
Oberdiek. The code for setting the length \LongTableWidth is in the preamble, which is not
visible here.

Table 1: Caption for a \usepackage{longtable}


lo n g t a b le ................................... \newlength\LongtableWidth% Siehe Beispielcode

\b eg in {lon gtab le}{ 1111}


Hello world and some more \caption{Caption for a \t e x t t t { lo n g t a b le } \d o t f ill} \\
foo bar Hello & world and some more\\
foo & bar
Here we have text with the same \end{longtable}
width as the lo n g ta b le . \begin{center}
\begin{minipage}{\LongtableWidth}
Here we have tex t with the same width as
the \te x ttt{ lo n g ta b le } .
\end{minipage}
\end{center}

If a table should be read through the \in p u t command, the entire table should be contained tip
in the external file. Otherwise, problems may occur. Here is an example:

\begin{tabular}{ c c }
\in p u t{tab le rows}
\end{tabular}

This sequence generates the following error message if the first row of the external file
table rows contains a \m ulticolum n command:

! Misplaced \om it.


\multispan ->\omit
\@multispan
1.1 \multicolumn{2}{c}{A}
\\

This can be prevented by putting \b e g in { ta b u la r } and \e n d {ta b u la r } into the file as


well:

A \b e g in {filec o n ten ts* }{ta b le. tex}


[o5-01-5
a b \begin{tabular}{c c}
a b \m ulticolum n{2}{c}{A}\\
a & b \\ a & b
\end{tabular}
\en d{filecon ten ts*}

\in p u t{tab le}

169
Tips and tricks

5 .2 tabbing environm ents


trick The problem with filling the space to the next tab within a tab b in g environment with
\ d o t f i l l or \ h r u l e f i l l is that the fill w on’t be visible; this is because it is put inside a box
of natural width, which in the case of these two commands is 0pt. Heiko Oberdiek suggested
a \r t a b command to be used instead of \>; alternatively, the internal \@rtab command can
be overwritten with \r ta b so that \> behaves the same way as \r ta b . Both options are
illustrated here:

blabla blabla % see preamble in example for \rtab


05-02-lj
bla blabla \begin{tabbing}
blablabla \= \ k i l l \ \
blabla \ d o t f i l l \> blabla\\% no effe c t!
blabla. . . blabla b la \h r u le fill \> blabla %no effe c t!
bla_____ blabla \end{tabbing}
\begin{tabbing}
blablabla \= \k ill\\b la b la \d o t f ill\r t a b b la b la \\b la \h r u le fill\r ta b blabla
blabla. . . blabla \end{tabbing}
bla_____ blabla \m akeatletter\let\@ rtab\rtab\m akeatother
\begin{tabbing}
blablabla \ = \ k ill\\b la b la \d o t f ill\> b la b la \\b la \h r u le fill\> b la b la
\end{tabbing}

5 .3 Tw o-colum n mode
tip The only environment that lets you typeset tables across columns in \twocolumn mode is
su p erta b u la r from the package o f the same name (cf. Section 4.5 on page 149). When
using the m u ltic o l package, you can’t use \twocolumn mode anymore, and have to use the
tab b in g environment instead.

\usepackage{supertabular}
two column-Demo 05-03-1
twocolumn mode \twocolumn[\centering%
\texttt{twocolumn} mode\bigskip]
L Z R 1 c r \begin{supertabular}{l c r }\h lin e
i c r 1 c r L & Z & R \\\h lin e
i c r 1 c r l & c & r \ \ l & c & r \ \ l & c & r w
l & c & r \ \ l & c & r \ \ l & c & r w
i c r 1 c r
l & c & r \ \ l & c & r \ \ l & c & r \\
i c r 1 c r
l & c & r \ \ l & c & r \ \ l & c & r \\
i c r \end{supertabular}
i c r
i c r

Seite 1

17 0
5.4 Table captions

The tab b in g environment has the disadvantage that it is always left-aligned, but the tip
advantage that it can be used either in \twocolumn mode or within the m u ltic o ls environ­
ment.

\twocolumn[\centering%
two column-demo
\texttt{twocolum n} mode\bigskip]
twocolumn mode \b egin {tab b in g}
L \=z \=R \ k i l l
LZR 1c r L \>Z \>R\ \
1c r 1c r 1 \>c \>r \ \ 1 \>c \>r \\ 1 \>c \>r \\
1 er 1c r 1 \>c \>r \ \ 1 \>c \>r \\ 1 \>c \>r \\
1c r 1 \>c \>r \ \ 1 \>c \>r \\ 1 \>c \>r \\
1c r 1 \>c \>r \ \ 1 \>c \>r \\ 1 \>c \>r \\
\end{tabbing}
1 CT
1 er
1c r
1c r
1c r

Seite 1

\usepackage{multicol}
two column-Demo
\su b sectio n * {\tex ttt{m u ltico ls} mode}
m u ltic o ls m ode \begin{m u lticols}{ 2}
\begin{tabbing}
LZR 1c r L \=Z \=R \ k i l l
1c r 1c r L \>Z \>R \ \
1c r 1c r 1 \>c \>r \ \ 1 \>c \>r \ \ 1 \>c \>r \ \
1c r 1c r 1 \>c \>r \ \ 1 \>c \>r \ \ 1 \>c \>r \ \
1 er 1c r 1 \>c \>r \ \ 1 \>c \>r \ \ 1 \>c \>r \ \
1c r 1c r 1 \>c \>r \ \ 1 \>c \>r \ \ 1 \>c \>r \ \
1 er \end{tabbing}
\end{m ulticols}\par
Normal one-column te x t.
Normal one-column text.

Seite 1

5 .4 Table captions
When typesetting a table that crosses a page break, it is possible that the break could be tip
inserted between the table caption and the following table. To avoid this, you must ensure
that the remaining space on the page when you start the table is sufficient for the caption

171
Tips and tricks

and at least three table rows. Donald Arseneau created the \n eed command, which checks
whether there is sufficient space left on the page and inserts a page break straightaway if not.

\n e e d {le n g th }

You could also extend the definition of the corresponding table environment to integrate the
\n e ed command. The following two examples show the first two pages of a document; in
the first example, the standard behaviour without the \n eed command is shown and in the
second one, the behaviour with the command. The choice of size for the required length takes
some experience to assess exactly, but \ n e e d { 6 \n o r m a lb a s e lin e s k ip } will usually succeed
in preventing a page break between table caption and body.

\usepackage{supertabular}
\newcommand\demoText{In theory, the d efin itio n of the table environment could be
extended to integrate the \p r o te c t\te x ttt{\te x tb a c k sla sh need} command. These two
examples show the f i r s t two pages of a document, where the f ir s t page has
(without \p r o te c t\te x ttt{\te x tb a c k sla sh need}) or does not have (with
\p r o te c t\te x ttt{\te x tb a c k sla sh need}) a page break.}
\section{A tab le}
\demoText \begin{center}
\tablecaption{C aption.}
\tab leh ead {\h lin e columnl & column2 \ \ }
\b e g in {su p e r ta b u la r }{|c l|c l|}\h lin e
yyy & xxx \ \ \h l i n e yyy & xxx \\ \h l i n e yyy & xxx \\\h lin e
\end{supertabular} \end{center}

need-dem o need-dem o 1 A TABLE

1 A table columnl column2


yyy xxx
In theory, the definition of the ta­ yyy xxx
ble environment could be extended yyy xxx
to integrate the \need command.
These two examples show the first
two pages of a document, where
the first page has (without \need)
or does not have (with \need) a
page break.

Table 1: Caption.

page 1 page 2

172
5.5 Math mode

\usepackage{supert abular}
\m akeatletter
\newcommand\need[l]{\par \p en alty -100 \begingroup % preserve \dimen@
\dimen@\pagegoal \advance\dimen@-\pagetotal % space le f t
\ifd im #l>\dimen@ % not enough space l e f t
% only do \ v f i l i f some space l e f t on page
\ifdim\dimen@>\z@ \vskip -\pagedepth plus l f i l \ f i
\break
\ f i \endgroup}
\makeatother
\section{A table}
\demoText% see other example
\need{ 6\normalbaselineskip}
\begin{center}
\tablecaption{C aption.}
\tab leh ead {\h lin e columnl & column2 \ \ }
\b e g in {su p e r ta b u la r }{|c l|c l|}\h lin e
yyy & xxx \ \ \h l in e yyy & xxx \ \ \h l i n e yyy & xxx \\\h lin e
\end{supert abular}
\end{center}

n eed demo n eed demo 1 A TABLE

1 A table Table 1: Caption.

In theory, the definition of the ta­ columnl column2


ble environment could be extended yyy xxx
to integrate the \n eed command. yyy xxx
These two examples show the first yyy xxx
two pages of a document, where
the first page has (without \need)
or does not have (with \need) a
page break.

page 1 page 2

5 .5 Math mode
The typesetting o f columns o f numbers aligned at the decimal separator is actually done trick
internally by treating the decimal separator as column separator and separating the integer

173
Tips and tricks

part and the decimal places into two columns. However, as individual table rows are always
typeset as separate groups to keep the definitions local, this means that definitions before a D
column are not known anymore when the decimal places (in the second internal column) are
typeset. The following trick enables you to typeset all digits in a different font; this example
by Heiko Oberdiek sets the digits in sans-serif.

test test 1.0 test 1.2 test3.1 \usepackage{dcolumn} ,---------.


test i 1,22 333,1 \m akeatletter \newcolumntype{s}[l]{%
test 2 3,44 444,1 >{\DC@{. } {\sf\a fte r g r o u p \s f, }{#l}\sf}l<{\DC@end}}
\makeatother
0123456789
\sffa m ily
\begin{tabular}{ 1 s{1 .0 } s{1 .2 } s{3 .1 } }
te s t & \m u lticolum n{l}{l}{testl.O } &
\m u ltico lu m n {l}{l}{te stl. 2} &
\m u lticolu m n {l}{l}{test3. 1 } \\\h lin e
te s t & 1 & 1.22 & 333.1 \ \ te s t & 2 & 3.44 & 444.1
\end{tabular}\par\medskip
$\mathsf{0123456789}$

tip If you want to display content o f D columns centred at the decimal separator through -1
and with a constant added, you can’t use the . column type or the < operator - for example
\new colum ntype{a}{ .<{+6240}} in the following example. This column type is used to
format the second column of the table; it results in +6240 being appended first and then the
number being centred on the decimal separator. The resulting space on the left of the second
column is too large.
Using the internal commands \DC@ for the beginning and \DC@end, you can first centre
the number and after that append a constant, as seen in the example for the columns 55
(column type b) and S6 (column type B).

\usepackage{dcolumn}
\m akeatletter \newcolumntype{. }{D{. } { . } { - l} } \newcolumntype{a}{.<{+6240}}
\newcolumntype{b}{>{\DC@{. } { . }{-l}}c<{\DC@end+6240}}
\newcolumntype{B}{>{\DC@{. } { . }{-l}}c<{\DC@end+25530}}
\newcoramand\interval[l]{\multicolumn{l}{c}{#l}} \makeatother
\begin{tabular}{@{}la.,bB@{}}
\interval{Sl}& \interval{S2}& \interval{S3}& \interval{S4}& \interval{S5}& \interval{S6}\\
9 9 .0 \ , \% & 14.40& 438& 5256& 375.60&182.70\\99.9 \,\% & 1.59& 44 & 526 & 37.60&18. 3 0 \\
9 9 .9 9 \, \%& 0.15& 4.4& 0.53& 3.76 & 1.83
\end{tabular}

SI S2 S3 S4 S5 S6
05-05-2 |
99.0 % 14.40 + 6240 438 5256 375.60 +6240 182.70 +25530
99.9 % 1.59 + 6240 44 526 37.60+6240 18.30+25530
99.99 % 0.15 + 6240 4.4 0.53 3.76+6240 1.83+25530

174
5.6 Excel and OpenOffice files

5 .6 Excel and OpenOffice files


In general, there are always problems converting Excel or OpenOffice files into a I ^ X -
compatible format. It is only successful for files whose cells don’t contain arithmetics and can
therefore be saved in csv format (comma separated values). Such files can then be read and
processed with the d a ta to o l package, usually without problems (cf. Section 2.8). You can
convert tables with arithmetics into tables without such operations in Excel and OpenOffice
through copy and paste and “insert values”; then you can convert these to csv format and use
the d a ta to o l package for them too.
There is a software tool on CTAN by Joachim Marder and George Pearson that provides tip
an extension for Excel on W indows to support arithmetic for the output. It only supports
versions up to and including Excel 97, however (h ttp://w w w .dante.de/C T A N 7/support/
e x c e l2 1 a te x /). The e x c e lt e x package by Hans-Peter Doerr offers another way and is a
combination of a normal Efl^X package and an external Perl program of the same name. The
table is not converted before, but read from within a 12IeX document; you can specify the
region to be used. The actual conversion is done by the Perl script, which has to be called
between two i?l£X runs.

la tex example
exceltex example
la tex example

The Perl program exceltex requires the Perl module S p rea d sh eet: :P arseE xcel, which
is available on CPAN h ttp ://s e a r c h .c p a n .o r g /~ sz a b g a b /S p r e a d sh e e t-P a r se E x c e l-O .
3 2 /lib /S p r e a d sh e e t/P a r se E x c e l.p m . The e x c e lt e x package isn’t available in T£XLive
2007; it must be installed separately. The Perl program must be executable. The package
supports reading individual cells or several rows:

\ in c c e 11 { x/s file!sheet!cell}
\± n c ta b { x ls file!sheet!first cellllast cell}

Reading o f a cell: Nadine Hafiemer \usepackage{exceltex}

Reading of a c e ll:
\ i n c c e l l { t e s t .x l s !Z eu g n isliste!C3}
\ i n c c e l l { t e s t .x l s !Z eu g n isliste!D3}

\usepackage{exceltex,booktabs}
Reading of a tab le:\p ar\setlen gth \tab colsep {2p t}
\begin{tabular}{@{} *{16}{1} @{}}\toprule
given name & surname & DOB & \m ulticolum n{13}{c@ {}}{subjects}\\
& & &D &U &T &E &F &L &G &K &M &P &C &B &S\\\midrule
\in c ta b { te s t.x l s !Z eu g n isliste!C2!R5}\bottomrule
\end{tabular}

175
Tips and tricks

Reading of a table: [ 05-06-2]


given name surname DOB subjects
DUTEFLGKMPCBS
Victoria Hoene 06.08.80 x x
Nadine Hafiemer 18.12.78 x x
So-Young Lee 20.07.80 x x
Sebastian Weigmann 12.06.79 x x

exceltex also creates subdirectories with the file names followed by - e x c lt x . The individ­
ual entries are saved into these files with, for example, the following content:
\t e x t c o lo r [ r g b ] { 0 , 0, 0}{N adine}.
Additional information can be taken from the package description, especially regarding
the further functionality of the Perl program. The documentation can’t be displayed through
texdoc (cf. Section 7 on page 213), however, because the name is not the same as the package
name.

\usepackage{exceltex,booktabs} \ttfa m ily


\begin{tabular}{@{} *{ 8}{r} @{}}\toprule
\multicolumn{8}{c}{C ourses}\\\m idrule

\in c ta b { t e s t. x l s !T a b e lle l!G2!N19}\bottomrule

\end{tabular}

Courses 105-06-3]
DE-1 de-1 DE-2 de-2 DE-3 de-3 DE-4 de-4
Mu-1 mu -1 Mu-2 mu -2 Mu-3 mu-3 Mu-4 mu-4
Ku-1 ku-1 Ku-2 ku -2 Ku-3 ku-3 Ku-4 ku-4
E l -1 e l -1 E l -2 e l -2 El-3 el-3 El-4 el-4
F2-1 f 2-l F2-2 f 2-2 F2-3 f2-3 F2-4 f2-4
L3-1 13-1 L3-2 13-2 L3-3 13-3 L3-4 13-4
tü-1 tü -2 tü-3 tü-4
ds-1 ds-2 ds-3 ds-4
pw -1 pw -2 pw-3 pw-4
GE-1 ge -1 GE-2 ge -2 GE-3 ge-3 GE-4 ge-4
phil-1 phil-2 phil-3 phil-4
MA-1 ma-1 MA-2 ma-2 MA-3 ma-3 MA-4 ma-4
PH -1 ph -1 PH -2 ph -2 PH-3 ph-3 PH-4 ph-4
CH-1 ch-1 CH-2 ch -2 CH-3 ch-3 CH-4 ch-4
BI-1 bi-1 BI-2 bi-2 BI-3 bi-3 BI-4 bi-4
in -1 in -2 in-3 in-4
SP-1 sp-1 SP-2 sp -2 SP-3 sp-3 SP-4 sp-4
EK-1 EK-2 EK-3 EK-4

176
C h a p t e r

E x a m p le s

T h is c h a p te r lis ts d iffe re n t e x a m p le s th a t w e r e ta k e n fr o m th e u su a l n e w s g r o u p s a n d m a ilin g


lists. T h e r e s p e c tiv e a u th o r is lis te d a s w e ll. A lm o s t all e x a m p le s h a v e b e e n a d a p ted to m e e t
th e a u th o r ’s id e a s o f g o o d ty p o g r a p h y - u s u a lly o n ly th e c o n te n ts o f th e c e lls are th e sa m e as
in th e o r ig in a l. M o s t o f th e e x a m p le s h a v e b e e n ta k e n fr o m [ 50], th e sta n d a r d lite r a tu r e fo r
th e ty p o g r a p h y o f ta b le s o n ctan.

Table 6 .1: Summary of the authors of the individual examples.

author example(s)
U w e B o r ch er t 03- 03-4
J e a n -C ô m e C h a rp en tie r 06- 00- 1, 06- 00-8
C h ristia n e G eig e r 06- 00-26
M o rte n H o g h o lm 05- 05-2
S te fa n Ju n ge 06- 00- 28, 06- 00-41
K ai-M artin K n aak 06- 00-32
M ark u s K o h m 06- 00-2
R o lf N ie p r a sc h k 06- 00- 25, 06- 00- 29, 06- 00- 30, ??, 06- 00- 34, 06- 00- 42,
06- 00- 43, 06- 00-45
H e ik o O b erd iek 05- 01-4
B ern d R a ic h le 05- 01-1
A x e l R e ich er t 06- 00- 9, 06- 00- 10, 06- 00- 11, 06- 00- 12, 06- 00- 13, 06- 00- 14,
06- 00- 15, 06- 00- 14, 06- 00- 15, 06- 00- 16, 06- 00- 17, 06- 00- 18,
06- 00- 19, 06- 00- 20, 06- 00- 21, 06- 00- 22, 03- 03- 5, 06- 00- 36,
06- 00-37
C h ristia n T e lle c h e a 06- 00- 39, 06- 00-40
U w e Z ie g e n h a g e n 06- 00-46
Examples

\usepackage{array, ragged2e ,booktabs, ca p t-o f}


\newcolumntype{C}[1 ]{>{\Centering}b{#l}}
\begin{tabular}{@ {}l C{2cm} C{2.7cm} C{1.8cm}@{}}\toprule
\b fs e r ie s Pratiques & \b fs e r ie s Nombre de d ossiers
& \b fs e r ie s Cas où le gouvernement a eu gain de cause
& \b fs e r ie s Cessions ordonnées \\\m id ru le
& \itsh a p e \b fse r ie s 1890-1939 \\\m idrule
\b fs e r ie s Concentrations & 57 & 46 & 20 \ \
\quad Marché national & 33 & 25 & 12 \ \
\quad Marché régional ou lo c a l & 24&21&9\ \
\b fs e r ie s Pratiques a n titru st & \b fseries9 7 & \b fseries7 9 & \b fs e r ie s 8 \ \
\quad Marché national & 54 & 43 & 5 \ \
\quad Marché régional ou lo c a l & 43&36&3\ \
\emph{Total} &154 &125 &\textbf{28} \\\m idrule
& \itsh a p e \b fser ies 1940-1999 \\\m idrule
\b fs e r ie s Concentrations & 28 & 25 & 9 \ \
\quad Marché national & 14 & 12 & 4 \ \
\quad Marché régional ou lo c a l & 14&13&5\ \
\b fs e r ie s Pratiques an titru st & \b fseries9 1 & \b fseries7 5 & \b fseries7 \ \
\quad Marché national & 52 & 42 & 2 \ \
\quad Marché régional ou lo c a l & 39&33&5\ \
\emph{Total} &119 &100 &\textbf{16} \\\bottom rule
\multicolum n{4}{@ {}l}{\scriptsize\emph{Source}: adapté de Posner (2001,p. 106).}
\end{tabular}

Cas où le
Nombre de gouvernement a Cessions
Pratiques dossiers eu gain de cause ordonnées
1890-1939

Concentrations 57 46 20
Marché national 33 25 12
Marché régional ou local 24 21 9
Pratiques antitrust 97 79 8
Marché national 54 43 5
Marché régional ou local 43 36 3
Total 154 125 28
1940-1999

Concentrations 28 25 9
Marché national 14 12 4
Marché régional ou local 14 13 5
Pratiques antitrust 91 75 7
Marché national 52 42 2
Marché régional ou local 39 33 5
Total 119 100 16
Source : adapté de Posner (2001,p. 106).

178
Examples

\usepackage{tabularx, booktabs,ragged2e}
\newcomraand\raggedcolumn{\RaggedRight\hspace{Opt}}
\newcommand\centercolumn{\Centering\hspace{Opt}}
\renewcomraand*{\tabularxcolumn}[ 1 ] {b{#l}}%
\begin{tabularx}{\textwidth}{@{}*{3}{>{\raggedcolumn}X}*{3}
{>{\raggedcolumn}X}@{}}\toprule
header lin e 1 & headerlin e 2 & header lin e 3 &
header lin e 4 & headerlin e 5 & header lin e 6,
which i s a b it longer as usual \\\m id ru le
foo & bar & baz & gg & gg &gg\\\m idrule
foo & bar & baz & gg & gg &dd\\\bottom rule
\end{tabularx}

header
line 6,
which
is a bit
header header header header header longer as
line 1 line 2 line 3 line 4 line 5 usual
foo bar baz gg gg gg
foo bar baz gg gg dd

\usepackage{array,booktabs}
\newcounter{Platz}
\begin{tabular}{@{}>{\ifnum\thePlatz>0 \th e P la tz .\ f i } r
1 rrr c@{ :}c c<{\stepcounter{Platz}} @ {}}\\\toprule
\multicolumn{ 8}{c}{%
\bfseries\rule[-2ex]{0pt}{5ex}G erm an fo o tb a ll league 1986/87.} \ \ \midrule
\multicolumn{l}{@{}c}{}
& club & S & U & N &\multicolumn{2}{c}{point:
& Bayern München & 20 & 13 & 1 & 53 & 15 & championW
& Hamburger SV & 19 & 9 & 6 & 47 & 21 & cup winner\\
& Bor. M’Gladbach & 18 & 7 & 9 & 43 & 21 & s ta r te r \\
& Bor. Dortmund & 15 & 10 & 9 & 40 & 28 & in th e \\
& Werder Bremen & 17 & 6 & 11 & 40 & 28 & UEFA cup\\
& Bayer Leverkusen & 16 & 7 & 11 & 39 & 29 & cup\\\raidrule
& l.FC Kaiserslautern& 15 & 7 & 12 & 37 & 31 & \ \
& Bayer Uerdingen & 12 & 11 & 11 & 35 & 33 & \ \
& l.FC Nürnberg & 12 & 11 & 11 & 35 & 33 & \ \
& l.FC Köln & 13 & 9 & 12 & 35 & 33 & \ \
& VfL Bochum & 9 & 14 & 11 & 32 & 36 & raid f i e l d \ \
& VfB Stuttgart & 13 & 6 & 15 & 32 & 36 & \ \
& Schalke 04 & 12 & 8 & 14 & 32 & 36 & \ \
& Waldhof Mannheim & 10 & 8 & 16 & 28 & 40 & \ \
& Eintracht Frankfurts 8 & 9 & 17 & 25 & 43 & \\\m idrule

179
6 Examples

& FC Homburg & 6 & 9 & 19 & 21 & 47 &r e l. S t.Pauli\\\m idrule
& Fortuna Düsseldorf & 7 & 6 & 21 & 20 & 48 &\ \
& BW 90 Berlin & 3 & 12 & 19 & 18 &50
& \r a is e b o x { 1 .5 e x } [-l.5 e x ]{ r e le g a te d } \\\b o tto m r u le
\en d {tabular}

German football league 1986/87.

club S u N points comment


1. Bayern München 20 13 1 53 :15 champion
2. Hamburger SV 19 9 6 47 :21 cup winner
3. Bor. M’Gladbach 18 7 9 43 :21 starter
4. Bor. Dortmund 15 10 9 40 :28 in the
5. Werder Bremen 17 6 11 40 :28 UEFA cup
6. Bayer Leverkusen 16 7 11 39 :29 cup
7. 1.FC Kaiserslautern 15 7 12 37 :31
8. Bayer Uerdingen 12 11 11 35 :33
9. 1.FC Nürnberg 12 11 11 35 :33
10. l.FC Köln 13 9 12 35 :33
11. VfL Bochum 9 14 11 32 :36 mid field
12. VfB Stuttgart 13 6 15 32 :36
13. Schalke 04 12 8 14 32 :36
14. Waldhof Mannheim 10 8 16 28 :40
15. Eintracht Frankfurt 8 9 17 25 :43
16. FC Homburg 6 9 19 21 :47 rel. St.Pauli
17. Fortuna Düsseldorf 7 6 21 20 :48 relegated
18. BW 90 Berlin 3 12 19 18 :50

\usepackage[ta b le ]{p strick s} ,--------


\usepackage{pst-3d, pst-node}\SpecialCoor 1--------
\b egin {t abular} { 1}
\p stilt{6 0 }{\b eg in {ta b u lar}{|p {lem }|p {lem }|p {lem }|}\h lin e
\rowcolor{magenta!10}\p sro ta teleft{\rn o d e{co ll}{\h sp a ce{ 2cm}}} &
\p sr o ta te le ft{\rn o d e{co l 2}{\hspace{ 2cm}}} &
\psrotateleft{\rnode{col3}{\hspace{2cm }}}
\end{tabular}}\\% end head
\r p u t [t]{60}(coll){colum n l} \r p u t [ t ] {60}(c o l2 ){column 2}%
\r p u t [t]{60}(c o l3 ){column 3}%
\b egin {ta b u la r }!Ip{lem }|p{lem }|p{lem }|}\hline
\rowcolor{green!10} 1 & 2 & 3 \\\row color{b lu e!10} 4 & 5 & 6 \ \
\rowcolor{green!10} 7 & 8 & 9 \\\h lin e
\end{tabular}
\end{tabular}

180
E x a m p le s

\usep ackage{p stricks}


\setlength\tabcolsep{2mm}\psset{xunit=12ram, yunit= \baselineskip}%
\pspolygon[lin e c o lo r= re d , lin ew id th = 2p t]
( 0 , - 3 .3 ) ( 0 ,2 .7 ) ( 2 ,2 . 7 ) ( 2 ,1 . 7 ) ( 4 , 1 .7 ) ( 4 , 0 .7 ) ( 6 ,0 .7 ) ( 6 ,- 1 .3 ) ( 7 ,- 1 .3 )
( 7 , - 2 .3 ) ( 5 ,- 2 .3 ) ( 5 ,- 3 .3 ) ( 4 ,- 3 .3 ) ( 4 ,- 2 .3 ) ( 3 , - 2 . 3 ) ( 3 , - 3 . 3 )
\begin{tabular}{*{8}{p{8mm}}}
H & & & & & & & He\\ Li & Be & B & C & N & 0 & F & Ne\\
Na & Mg & A1 & S i & p & s & Cl & Ar\\ K & Ca & Ga & Ge & As & Se & Br & Kr\\
Rb & Sr & In & Sn & Sb & Te & I & Xe\\ Cs & Ba & T1 & Pb & Bi & Po & At & Rn\\
Fr & Ra & 112& & 114& & &\\
\end{tabular}

H He
Li Be |B C N o F Ne
Na Mg A1 Si P s Cl Ar
K Ca Ga Ge As Se Br Kr
Rb Sr In Sn Sb Te I Xe
Cs Ba T1 Pb Bi Po At j Rn
Fr Ra 112
J 114 r

\usep ackage{p stricks}


\setlength\tabcolsep{2mra}\psset{xunit=12ram, yunit= \baselineskip}%
\pspolygon[ f illc o lo r = lig h t g r a y , f i l l s t y l e = s o l i d , lin e s t y le = n o n e ] ( 0 ,- 3 .3 ) ( 0 ,2 .7 ) ( 2 ,2 .7 )
( 2 ,1 .7 ) ( 4 ,1 . 7 ) ( 4 , 0 . 7 ) ( 6 , 0 .7 ) ( 6 ,- 1 .3 ) ( 7 , - 1 . 3 ) ( 7 , - 2 . 3 ) ( 5 , - 2 . 3 ) ( 5 , - 3 . 3 ) ( 4 , - 3 . 3 )
( 4 ,- 2 .3 ) ( 3 ,- 2 .3 ) ( 3 ,- 3 .3 )
\begin{tabular}{*{8}{p{8ram}}}
H & & & & & & & He\\ L i & Be & B & C & N & 0 & F & Ne\\
Na & Mg & A1 & S i & P & s & Cl & Ar\\ K & Ca & Ga & Ge & As & Se & Br & Kr\\
Rb & Sr & In & Sn & Sb & Te & I & Xe\\ Cs & Ba & T1 & Pb & Bi & Po & At & Rn\\
Fr & Ra & 112& & 114& & &\\
\end{tabular}

H He
Li Be B C N 0 F Ne
Na Mg A1 Si P s Cl Ar
K Ca Ga Ge As Se Br Kr
Rb Sr In Sn Sb Te I Xe
Cs Ba T1 Pb Bi Po At Rn
Fr Ra 112 114

\usepackage{pst-node}\SpecialCoor
\setlength\tabcolsep{2mra}
\begin{tabular}{*{8}{p{4mm}}}
H & & & & &\rnode{A}{—}&& He\\ L i & Be & B & C &N &0 & F & Ne\\

181
6 Examples

Na & Mg & Al & Si & P & S & Cl & A r\\


\rnode{B}{K}& Ca & Ga & Ge & As & Se & Br & \rnode{b}{Kr}\\
Rb & Sr & In & Sn & Sb & Te & I & X e\\ Cs & Ba & TI & Pb & Bi & Po & At & Rn\\
Fr & Ra & 112& & 114 & \rnode{a}{~~} &&
\end{tabular}
\p sset{lin ecolor=red,linew idth =l.5pt,n odesep=-lem }\pcline(A )(a)\pcline(B )(b)

¡06-00-7

text \usepackage{array}
text | 06-00-8
• tex t••• *tex t........ \parbox[0cm ][ 0 . 5ex][s]{0mm}{\makebox[42mm]{\dotfill}}%
text
text \begin{tabular}{|b{9m m }|m {9mm }|p{9mm }|}\hline
te x t te x t & te x t te x t & te x t te x t \ \ \ h l i n e
\end {tab ular}

\usepackage{dcolumn,booktabs,ragged2e} \newcolumntype{d}[1 ]{D{. } { , }{#1}}


\newcolum ntype{P}[l]{>{\scriptsize\C entering\hspace{Opt}}p{#l}}
\begin{tabular}{@{} 1 *{3}{d{7.0}} @{}}\toprule
\s c r ip ts iz e c ity
& \multicolum n{l}{P{ 6em}@{}}{total number of lo c a l and national c a lls }
& \multicolum n{l}{P{ 6em}@{}}{calls from public telefo n s}
& \multicolum n{l}{P{ 6em}@{}}{national and international c a lls from home} \ \
\cm id ru le(r){l-l}\cm id ru le(lr){2 -2 }\cm id ru le(lr){3 -3 }\cm id ru le(l){4 -4 }
London & 723849 & 436322 & 287527 \ \ Exeter & 957365 & 593146 & 364219 \ \
Newcastle& 1242212 & 1115321 & 1326861 \ \ Dover & 1641050 & 942316 & 698734 \ \
Edinburgh & 1351204 & 651223 & 442747 \ \ Glasgow & 1274714 & 394613 & 915853 \ \
\bottomrule
\end{tabular}

city total number of local calls from national and [ 06-00-9


and national calls public telefons international
calls from home

London 723849 436322 287527


Exeter 957365 5 9 3 14 6 36 4 219
Newcastle 12 4 2 2 12 1115 3 2 1 13 2 6 8 6 1
Dover 16 4 10 5 0 9 4 2 3 16 698734
Edinburgh 13 5 12 0 4 6 5 12 2 3 442747
Glasgow 12 7 4 7 14 3 9 4 6 13 9 15 8 5 3

182
Examples

\usepackage{dcolumn, booktabs, tabularx}\let\addLS\addlinespace


\begin{tabularx}{0.85\linew idth}{@ {} X 1 c D { .}{,}{2 .2 } @{}}\toprule
\sm all Schmelzeinsätze & \sm all Schalter & \sm all kg & \m ulticolum n{l}{c@ {}}{\euro}\\
\cm idrule(r ) {l-l}\c m id r u le ( l r ) {2-2}\cm idrule( l r ){3 -3 }\cm idrule(1 )(4-4}\addLS
Pilzdruckknopf mit Rastung und Drehentriegelung & rot& 54 &13.$— $\\\addLS
Pilzdruckknopf mit Rastung und Schloss &rot &32 &21.60\\\addLS
Schlüsselantrieb mit abziehbarem Schlüssel & schwarz&43 &1 5 .10\\\addLS
Knebel mit 3~Schaltstellungen & schwarz&23 & 5.40\\\addLS\bottomrule
\end{tabularx}

Schmelzeinsätze Schalter kg €

Pilzdruckknopf mit Rastung und Drehentriegelung rot 54 1 3 ,-


Pilzdruckknopf mit Rastung und Schloss rot 32 21,60
Schlüsselantrieb mit abziehbarem Schlüssel schwarz 43 15,10
Knebel mit 3 Schaltstellungen schwarz 23 5,40

\usepackage{dcolumn,booktabs,ragged2e} \newcolumntype{d}[l]{D{. } { , }{#1}}


\newcolumntype{P}[1 ]{>{\RaggedRight\hspace{Opt}}p{#l}}
\begin{tabular}{@{} P{12.5em} 1 c d{2.2} @{}}\toprule
\sm all Schmelzeinsätze & \sm all Schalter & \sm all kg & \m ulticolum n{l}{c}{\euro}\\
\cm id ru le(r){l-l}\cm id ru le(lr){2 -2 }\cm id ru le(lr){3 -3 }\cm id ru le(l){4 -4 }
Pilzdruckknopf mit Rastung und Drehentriegelung & rot & 54 & 13.$----$ \ \
\cm id ru le(r){l-l}\cm id ru le(lr){2 -2 }\cm id ru le(lr){3 -3 }\cm id ru le(l){4 -4 }
Pilzdruckknopf mit Rastung und Schloss & rot & 32 & 21.60 \ \
\cm id ru le(r){l-l}\cm id ru le(lr){2 -2 }\cm id ru le(lr){3 -3 }\cm id ru le(l){4 -4 }
Schlüsselantrieb mit abziehbarem Schlüssel & schwarz & 43 & 15.10 \ \
\cm id ru le(r){l-l}\cm id ru le(lr){2 -2 }\cm id ru le(lr){3 -3 }\cm id ru le(l){4 -4 }
Knebel mit 3~Schaltstellungen & schwarz & 23 & 5.40\\\bottom rule
\end{tabular}

Schmelzeinsätze Schalter kg €
Pilzdruckknopf mit Rastung rot 54 1 3 ,-
und Drehentriegelung
Pilzdruckknopf mit Rastung rot 32 21,60
und Schloss
Schlüsselantrieb mit abziehba­ schwarz 43 15,10
rem Schlüssel
Knebel mit 3 Schaltstellungen schwarz 23 5,40

18 3
Examples

\usepackage{array,booktabs} \newcolumntype{C}{>{\small}c}
\begin{tabular}{@ {}l *{4}{c} @{}}\toprule
\sm all month & \multicolumn{2}{C}{women} & \multicolumn{2}{C@{}}{men}\\
\cm id ru le(lr){2-3}\cm id ru le(l){4-5}
& \sm all 1967 & \sm all 1968 & \sm all 1967 & \sm all 1968\\
\cm id ru le(r){l-l}\cm id ru le(lr){2 -2 }\cm id ru le(lr){3-3}\cm id ru le(lr){4-4}\cm id ru le(l){5-5}
Septembers 2000 & 1700 & 2300 & 1900\\ October & 1500 & 1800 & 1900 & 3000\\
november & 2500 & 2800 & 4700 & 3200\\ december & 2300 & 2000 & 3600 & 2700\\\bottomrule
\end{tabular}

month women men


1967 1968 1967 1968
September 2000 1700 2300 1900
October 1500 1800 1900 3000
november 2500 2800 4700 3200
december 2300 2000 3600 2700

\usepackage{array,booktabs,multirow,ragged2e , eurosym}
\renewcommand\multirowsetup{\RaggedRight\footnotesize}
\newcolumntype{N}{>{\footnotesize}l} \newcolumntype{C}{>{\footnotesize}c}
\newcommand\mc[3]{\multicolum n{#l}{#2}{#3}}
\begin{tabular}{@{} *{5}{1} @{}}\toprule
& & \mc{2}{N}{0hne Sicherungen} & \multirow{3}{7em}{%
Höchstzulässiger Erdungswider\-stand bei Berüh\-rungsspannung}\\\cm idrule(lr){3-4}
\mc{l}{C}{Reihe} & \mc{l}{C}{Spannung} & \mc{l}{C}{Type} & \m c{l}{C}{Preis} \ \
& \mc{l}{C}{V} & & \m c{l}{C}{\euro} \\\c m id r u le (r){l-l}\cm id ru le(lr){2 -2 }
\cm id ru le(lr){3-3}\cm id ru le(lr){4-4}\cm id ru le(l){5-5} \ld o ts \\\bottom rule
\end{tabular}

Ohne Sicherungen Höchstzulässiger 06-00-13


Erdungswider­
Reihe Spannung Type Preis stand bei Berüh­
V € rungsspannung

\usepackage{array,booktabs,ragged2e , ro ta tin g , eurosym}


\newcolumntype{N}{>{\small}l} \newcommand\mc[l]{\multicolumn{l}{R{4.5em}}{#l}}
\newcolumntype{R}[1 ]{>{\begin{turn}{90}\begin{m inipage}{#l}
\footnotesize\RaggedRight\hspace{Opt}} 1 <{\end{minipage}\end{turn}}}
\begin{tabular}{@{} *{ 8} { 1} @{}}\toprule
\sm all Typ&\multicolumn{6}{N}{Anlagen mit Freileitungen}&\small P reis\\\cm id ru le(lr){2 -7 }
& \mc{Betriebsspannung~kV} & \mc{Löschspannung~kV} & \mc{Wechselspannung~kV}

18 4
o
© ©
o
©
o ©
©
Ul 4^
/ Ä SC z ßo ßo ßo ßo __ z / z

\end{tabular}
\ld o ts \\\bottom rule
\cm id ru le(lr){4-4}\cm id ru le(lr){5-5}\cm id ru le(lr){6-6}\cm id ru le(lr){7-7}\cm id ru le(l){8-8}
p ßo 3 ßo ßo 3 / er 3 3 3 3

& \m u ltico lu m n {l}{c}{\sm all\eu ro}\\\cm id ru le(r){l-l}\cm id ru le(lr){2-2}\cm id ru le(lr){3-3 }


& \mc{Ansprechspannung~kV} & \mc{RestSpannung kV} & \mc{Nettogewicht~ kg}
3 4- 4* n 3 3 3 p z p p p cn
(-S / z yS 3 3 3
n
Di 00 00
y“ 3 3 OQ 3 £ £ £ p
yS 4^ n 3 <S) 3 3 © l—k M I—1 1—k H-
4^ o n n n 13
3 1 3 n
1 n n yS 3 3 3 3 3 o o o o p
CU 1 H- yS S-k yS rS s-k H- H- H- H- yS
1 3 h-> 1—1 1—1 n
er CO HDi z kz-yk 5ö 53 z o o n n 3 3 c•3 3 3 *-
3 3 Sk yS S-k o o o o P o ¡3 3 3 p
1—1 3 3-, r-S 4^ 4^ yS 1—1 1—1 1 h-k
e—1 c er
3 ¡3 3 OQ
P 1—1 zr er H c 3 p 3 3 3 p
3 ßo CD\ k<-yk D Ul Ul < 3 3 3 3 M cn c *< •< yS
S-k ßo N CD p 13 3 3 3 3 p H- 13 13 13 P
COM 1—1 (0 3 3 p rS rS rS yS 3 N p P p 3
H ßo H- S-k k-yk 3 ro ro Ul Ul k-yk p—1yS yS yS 3
er Ul V-/ n S-k S-k 1 S-k k-yk S-k S-k yS SO Di 33 p
X : X <
T> yS / sr yS yS k-yk yS yS yS yS © so Sk k-yk k-yk <
400*- 4^ N >6 ßoßo 4^ 3 3 ro M hd •o Z z yS p (—11—11— 1
1 n 3 3 3 yS rS k-yk k-yk k-yk OQ H M er
4>
Il-
00
4^
1l |
CD
CO
Ul
H Sk4^ yS 3 M1 1—1 ßo Ul Ul yS yS
z O Q P: p:
H / k-Y-k k-yk W W / S-k
p p t“* CA 1—1
3 S-k3 P 13
OQ
P yS yS ys o
Di V ö V
o £
U> i— k 3 Ul n C-k-l SO yS yS r-S
0Q 3
W W 3
ßo H- H- n S-k S-k 3 3 yS
H- p D.
H- / 3 p Betriebsspan­
ßo ßo H- P /k OQ OQ yS yS rS p 3 M 0Q er Sk 3» er
Di 3 P P 5« 00 z 3 3 3 “ p yS o cn nung kV
CO M H H 3 4 3 yS 3 H- co 3 M 3 OQ - o -
Normale Lei­ ca r* CO 3 O n 4^ p n 13 OQ S-k H- Sk 3 Di
co k ?? g 2. 00 ro M Sk y*-> GÖ Öd
Ul P y " 2! <D P Ul 3 3 3 cn *
3 3 “ p cn 3 “ 3 yS 3 n
cn yS =tfc o O
cn terspannung 3 C T
* nT 1 \ / k—yk i-i 3 P 3 n yS 13 3 H 3 1—1 Löschspan­
03 § ßo ßo M (~k-l P P 3 OQ OQ 3 3 “ CO p 3 Sk p c
ft
ro CT h o H- H- S-k P p 3 3 S-k n 3 k-yk cn 3 nung kV
00 4^ H v—/ 3 < p n S-k P p OQ 3 yS p 3 H- 3
co h-1 5 Zulässiger r3-
t>
U
Ui
oi
/—*—i H- W-» 3“ 3“ rS 3 3
CO 4> Ul Di k-yk S-k z Di Di p N Di
rS k-yk
o yS / p 3
N
cn H- 1 Bereich nT 00§ C T“ Ul 1 H ßo o P p 3 3» M 13 CD 3 y " p
Cn d Ul 3 ßo ßo 3 3 3 3: 3 O p 5« OQ Wechselspan­
N ßo ßo Sk M / 3 p p Di 3 kro Sk Sk £ P OQ nung kV
S 3? / P 3 / p 3 3 P -yk Sk / n OQ P
CO M n y—\ n 3 3 1—1 3 z k-yk
co H S Normale Lei­
co co 0Q)- 3 vu H r-*-> n n p CA CA p
er o
1—1 p 3 3 OPQ Di ro
oo to i-l H- SS rS 3 3 tn 3 Di OQ Di P Ansprech­
cn terspannung 1 M ? Di /-k-l k-yk ?o so t-* p p H- N yS A H- p 53 -
1 <?§ 5‘ s ßo ßo H R 1—*“1 yS rS p 3 3 3 kP-yk M yS 3 3 H- 3
_^ yS Di OQ o spannung kV
rt 3 1 rr 4* 4^ H- 3 3 er „—■
Cü ro ro h-1 M < 3 13 13 p M P 3 3“ 3
4^ 1—k < Zulässiger 3- C Oi ro P k-yk S-k Ul Ul p 3 3 3 S-k 3 H- 5 y* 3 p
rc Ui 4^ o /—■s / p P 3 3 3 cn Di 3 i—i n 3 I Restspannung
co 4^ Bereich a nT M n ßo 3 3 w 5*T 3 D. yS H- 3- H-
cn CA CA »-i 3 Sy» k-yk 13 3 3 p yS 3 13 1_ ro cn 3
1 1 S / H- S-k S-k p k-yk S-k M CO H- p 113 OQ | kV
1 1 yS Di 3 yS yS 3 M 3 OQ / yS p Sk
1 1 Ol 3 o z Z 3 p ro H- P n /
CA CA 1 3 rS p o 3 k-yk S-k 13 Sk 3 p 3
co 1—k <: Nennspan­ / y^ kOl M z 3 3 3 o p yS 3 p Nettoge­
-yk (0 S r-» 3 3 O Q © OQ =tfe h-> o £
nung ,y f-\ yS w k-yk 3H- / yS P I-1 3 13 o wicht kg
n 1—1 ?r T3 pi—1 Di n S-k Sk Sk H- 3 o
er 3 '_/ H < p p 3 3 S~< / n Sk h-1
to to db U o / H- k-yk 3 3 H- Z P o Sk 3
3 M Di (-k-1 3 1—1 Di 3 3 M 13 3
Oi
4^
to
o rS
So’ 3 Di H IO ßo 3 t-* p p 3 o Di c yS 3 dl) sp
n>
O O 3 1 3 H- / "~\ 3 13 yS § 3 oo'
~l "I 3 3 i—1 ro / OQ 3 r—1 1—1 3 3 3 H k<
R CO P k-v» 3 S-k p 3
vu
p 3 3 yS k-yk 13
3 /—s / n 3 /—\ 1—1 3 3* k-yk p
Sk
1—1 1—1 n /-S ßo w yS M p 3 yS
CD V—' 3 Z ro 3 Sk yS z
rS H- S-k 3 p 1 k-yk =«: Sk
Sj Di yS n 3 co yS k-yk I-1 yS
1 3 yS S-k ro Sk V
■Vj c < z 3 3 Z 1 yS yS
W-> 1—1 k-yk S-k 3 n oo y“
<D yS OQ 3 k-yk ro 35
hd S-k H- Sk o
1—1 3 Di Sk o
3
S3—k P 3
H- 3 3
<—*—» w l-j o
CO S-k p 3
1 z /—s p
co 1—1 co
k-r-’ 1— 1 3 H-
00
Ul
1
ro
k—k
yS
N
P
13 4k Sk
r+ 1 l-k
1— 1 Ul Sk
S-k
Examples

\usepackage{array,booktabs,dcolumn,ragged2e} \newcolumntype{N}{>{\footnotesize}l}
\newcolumntype{P}[l]{>{\footnotesize\RaggedRight\hspace{Opt}}p{#l}}
\newcolumntype{d}[1 ]{D{. } { , }{#1}} \newcommand\mc[2]{\m ulticolum n{l}{#l}{#2}}
\begin{tabular}{@ {}l *{6}{d{3.0}} @{}}\toprule
\mc{@{}N}{Zeit} & \multicolumn{2}{N}{Material von Drischel}
& \multicolumn{2}{N}{Material von Bauer} & \multicolumn{2}{N@{}}{Eigenes M aterial}\\
\cm id ru le(lr){2-3}\cm id ru le(lr){4-5}\cm id ru le(l){6-7}
& \mc{P{3.5em}}{Häufigster Wert} & \mc{P{3.5em}}{Extremwert}
& \mc{P{3.5em}}{Häufigster Wert} & \mc{P{3.5em}}{Extremwert}
& \mc{P{3.5em}}{Häufigster Wert} & \mc{P{3.5em}@{}}{Extremwert}\\
\cm id ru le(r){l-l}\cm id ru le(lr){2-2}\cm id ru le(lr){3-3}\cm id ru le(lr){4-4}%
\cm id ru le(lr){5-5}\cm id ru le(lr){6-6}\cm id ru le(l){7-7}\ad d lin esp ace
Latenzzeit & 220 & 330 & 245 & 325 & 235 & 320 w
& & 150 & & 155 & & 160 \\\ad d lin esp ace
Halbwertszeit & 210 & 380 & 145 & 535 & 180 & 320 w
des Abstiegs & & 90 & & 95 & & 70 \\\ad d lin esp ace
G ip felzeit & 485 & 700 & 375 & 535 & 420 & 600 w
& & 260 & & 315 & & 290 \\\ad d lin esp ace
Halbwertszeit & 855 & 870 & 665 & 945 & 775 & 820 w
des Abstiegs & & 590 & & 575 & & 490 \\\addlinespace\bottom rule
\end{tabular}

Zeit Material von Drischel Material von Bauer Eigenes Material [ 0 6 -0 0 -1 6 j

Häufigster Extrem­ Häufigster Extrem­ Häufigster Extrem­


Wert wert Wert wert Wert wert

Latenzzeit 220 330 245 325 235 320


150 155 160
Halbwertszeit 210 380 145 535 180 320
des Abstiegs 90 95 70
Gipfelzeit 485 700 375 535 420 600
260 315 290
Halbwertszeit 855 870 665 945 775 820
des Abstiegs 590 575 490

\usepackage{booktabs, dcolumn,ragged2e, eurosym} \newcolumntype{N}{>{\footnotesize}l}


\newcolumntype{P}[1 ]{>{\footnotesize\RaggedRight}p{#l}}
\newcolumntype{d}[1 ]{D{ . } { , } { # ! } } \newcommand\mc[2]{\m ulticolum n{l}{#l}{#2}}
\begin{tabular}{@ {}l *{2}{d{3.0}d{2.2}} @{}}\toprule
\mc{@{}N}{Gegenstand} & \multicolum n{2}{N}{Vierleitersystem}
& \multicolumn{2}{N@{}}{FUnf"|leitersy stem }\\\cm id ru le(lr){2 -3 }\cm id ru le(l){4 -5 }
& \m c{N }{B estell-} & \mc{N}{Preis} & \m c{N}{Bestell} & \mc{N@{}}{Preis} \\[-2 p t]
& \mc{N}{Nr.} & \mc{P{2em}}{\euro} & \mc{N}{Nr.} & \mc{P{2.5em}@{}}{\euro}\\
\cm id ru le(r){l-l}\cm id ru le(lr){2 -2 }\cm id ru le(lr){3-3}\cm id ru le(lr){4-4}\cm id ru le(l){5-5}

186
Examples

Schienenkasten & 103 & 70.$----$ & 107 & 83.$-$ \ \


Schiene für H auptleiter & 104 & 9.50 & 108 &9.50 \\
Verbindungsklemme & 105 & 1.25 & 109 &1.25 \\
Schienenkastenöffnung & 106 & 1.55 & 110 &1.55 \\\bottom rule
\end{tabular}

Gegenstand Vierleitersystem Fünfleitersystem

Bestell- Preis Bestell Preis


Nr. € Nr. €
Schienenkasten 103 7 0 ,- 107 8 3 ,-
Schiene für Hauptleiter 104 9,50 108 9,50
Verbindungsklemme 105 1,25 109 1,25
Schienenkastenöffnung 106 1,55 110 1,55

\usepackage{booktabs, dcolumn,ragged2e} \newcolumntype{N}{>{\footnotesize}l}


\newcolumntype{P}[l]{>{\footnotesize\RaggedRight\hspace{Opt}}p{#l}}
\newcolumntype{d}[1 ]{D{. } { , }{#1}} \newcommand\mc[2 ]{\m ulticolum n{l}{#l}{#2}}
\begin{tabular}{@ {}lld{ 2. 0}@{$\!$—}d{ 2. 0}d{3. 0} l d { l . 0}@{$\!$—}d{ 2. 0}d{3. 0} 1@{ }}\toprule
& \multicolumn{8}{N}{Zum Umsetzen} & \\\c m id r u le (lr){2 -9 }
& \multicolumn{4}{N}{von Frequenzen im} & \multicolumn{4}{N}{auf Frequenzen im} \ \
\cm idrule( l r ) { 2-5 }\cm idrule( l r ){6-9}
\mc{@{}N}{Type} & \mc{P{3em}}{Fernsehbereich} & \multicolumn{2}{N}{Kanal} & \mc{N}{MHz}
& \mc{P{3em}}{Fernsehbereich} & \multicolumn{2}{N}{Kanal} & \mc{N}{MHz}
& \mc{P{2em}@{}}{Bauform}\\
\cm id ru le(r){l-l}\cm id ru le(lr){2 -2 }\cm id ru le(lr){3 -4 }\cm id ru le(lr){5 -5 }
\cm id ru le(lr){6 -6 }\cm id ru le(lr){7 -8 }\cm id ru le(lr){9-9}\cm id ru le(l){10-10}
SAFE 381 WK&F I & 2 & 4 & 174 & F III & 5 & 12 & 174 &DO \ \
SAFE 382 WK&F II & 5 & 12 & 68 & F I & 2 & 4 & 47 &DO \ \
SAFE 383 WK&F III & 21 & 38 & 174 & F III & 5 & 12 & 174 &ES \ \
SAFE 384 WK&F IV & 42 & 48 & 47 & F III & 5 & 12 & 174 &ET \\\bottom rule
\end{tabular}

06-00-18 [ Zum Umsetzen

von Frequenzen im auf Frequenzen im

Type Femseh- Kanal MHz Femseh- Kanal MHz Bau­


bereich bereich form

SAFE 381 WK FI 2- 4 174 FIII 5 -1 2 174 DO


SAFE 382 WK FII 5 -1 2 68 FI 2- 4 47 DO
SAFE 383 WK F ill 2 1 -3 8 174 F III 5 -1 2 174 ES
SAFE 384 WK FIV 4 2 -4 8 47 FIII 5 -1 2 174 ET

187
oo
oo
X*" / z z /
\mc{@{}N}{mit Bügel-} & \mc{N}{mit Mantel-} & \mc{N}{mit Block-}
3 er 3 3 3 3 H 3
ß® 3 CD 3 3 3 3 3 CO
& & & \mc{N}{unten} & \mc{N}{oben} \\[ - 3 p t ]
1—1Oq :> s s 3 3
\cm id ru le(r){l-3}\cm id ru le(lr){6-7 } / H H- n n n n 3 T3
3 H- rS3 og o o o s 3
c n n 3
1—1 O Pt g 3 1e—1 ic—1 o ZT
1
— 1
rt H —13 3 3 g g g 3
H- 3g er 3Cb rt 3 rt 5 3 g oq
n 3 rt CD 3
O 5 M z* < •< *< 3 rS
M rs 3 3 *3 Cu Cb
C CO H n 3 3 3 o
g SH SH
5 r-S r-S
1— 1 r-S r-S rS 3 o
N) C b
1—1 SH SH SH z 3 3 M 03 tO I—l Schaltergröße
r-S © © 1—1 3
M r-S rS r-S 1— 1 r-S rS rt g
s~» V SH z V V H- -3
rS
z
Z
s-* *
3 r-S r-S r-S
3
H
/ fee o er -q co H-1 tn x*
s-; r-S r-S ö Hl SH s o
1—1 r-S CO to ox to £ 5'* H
rS tr1 CO rt o h-1 CO o CO o o N
> H- SH H- o A 3 ?r Sc ö
ft
3 CO r-S n SH rt r-S rt rt o- ^B-
CO rt Cb o r-S 3 fee 3 3 C
o CD r-S H-J - o SH *3 er a3 o* 3
3* 3 CO 3 SH rt SH rS CO n>
1—1 1 3 r-S 3 .Z <* co> to H-1 h-1 8 §’
3 z o
CO 3 s~»
3
«~s ** M H-
CO JÖ 3
3 3 to I—1 o o tr 3 &
CO S~» H SH N oq 1—1 o o o o £L 3
s-> S-» 3 oq rt
er CD Cb HS '-H 3 H-
H- H r-S =& 1—1 3- H
CO S-J N3 M SH so o
SH H- s
g ß® o r-S oq 1—l flP fi>
g
fee x^
s~» =*fc
ro
3* H
rt 3 o 03 co 1—^ £ - 8
> 3 * SH Z oq o o 03 03 5- *-
N) o H-i SH Hi oq _ Q
fee HS CO O 3
S"' Z SH O Cb £ g
s~> rS rt N3
ß° rs SH 3 3 3 9<T># 3
s
2: o SH co H-l 1—1
/ CD rt
3 3 M 3 03 00 to 03
3 3 r-S © CO
i—1 CO H-
rt H w-< N
H- H SH 3
H O z SH
O 3 rt
s-*-1 SH o to to 1—1
<
CO ß® H
*G to to t—1 to
S~» 3 o o o
r-s 1—1
CO 3 3
n to H-i t—1 t—>•
Ul r-S co co Ol to Mehrpreis für
CD Z
3 s~» abweichende
SH r-S Spannung
rS *-d
hd O
OQ f—1
N
Hi 3
3: 3 “
H 1—1
SH
>
er
CTQ
3
3
Oq
O
er
CD
3
S-» oo
oo
VO
/ ^Г-
о\
Ф и /

\newcolumntype{C}{>{\footnotesize}c}
\usepackage{dcolumn,booktabs,ragged2e ,ro ta tin g , eurosym}
Ф ß® ß® 3 СГ 3 3 3 3 3
3 ß ® о ß® ß® ß ® ß ® ß ® ф ф ф ф Ф Ф
Dj CO и г-Ч и 0Q s: s:
гЧ Ф N3 / © 03 / Н- n о о S о О
4 ГО О о 3 г-Ч гз н- 3 3 3 3 3 3 о О о о о
03 ß® ß® 3 г-Ч о Ч~/ 3 со гз гз С 3 С гЧ з з 1—1 1—1 м
cr н- ГЗ н- ф гЧ гЧ м 1—1 I—1 ч з з с с с
e N3 и Сь гз Ч -» сь СГ гз ГЗ ч г+ ч 03 оз 0J з зз 3
1—' К о и Ч-» г-Ч и о © Ч-» н- н- н- СГ 3 3 3 3
Ш о о 3 г-Ч г-" с г-Ч гЧ гЧ п о ГЗ с СЬ СЬ ч ч ч
ч м / ГО м X Ч-* / о о О м / ► < *< с
Ч-1 ßo ß® ф ф о ф 1 Чг-* Ч м м м оз ГО 3 43 43 43
03 и Г— ч с Ч г— ч ф гЧ 03 с с с ч О n ф Ф Ф
о 03 1—1 и 03 м ф Н- 3 э з ч-> ч i—i гЧ гЧ гЧ
ß® ß® и О Ч чч 3 и СО гЧ 3 гЧ 3 ¡3 гЧ Оз 1_го СЬ из Z
1Ч-i Ч-i Ч-i
Ч-* Ф Чг-* 03 ф гЧ © ч
и г-*“* г-Ч г-Ч гЧ н- СГ го го ф гЧ ф гЧ 1—1г—1 гЧ
(X> 03 ф СО ю со о Ч-» Ч-» Ч г-» Ч-» 1—1 И И V
ß® ß® 1 ГЗ 1 ГО ф X гЧ гЧ гЧ Di н 3 гЧ гЧ гЧ
ro Ч
Ф гз ¡3- со о СГ г-Ч гЧ
~ > Ч-1
•-о 1J ч->
гЧ Z гЧ гЧ С
оз Ч о 1 М гЧ V HD
ro го _" н- 1—1 _■ 03 X ф 4J 41 гЧ И
3 ч СЗ гЧ О
о ф о Qj Ч о Ч гЧ ф ф ф 14 b СГ н- о
ß° ß° 3 Ч Ф 3 гЧ ф 1 3 3 3 ф ч~> ф о Чг-* HD ч
н- С И н- ф ч~* Ч-» ч~* н- «• ста о гЧ О 3
и и Oj м ста сь 03 ф гЧ Ч -* Ч-» со гЧ н- 1£—1 - О о
CO 143 и /— ф\ ч и СГ 3 / гЧ г-Ч ч слз 3 Ч-* ч ч
с О: с S Ч-1 го 3 X- с Ч-» гЧ з гЧ 3 ф
ь*з Ь-1 __'ч Е7ч> м ф гЧ о 3 с 3 гЧ ч 3 Чк о со
1 1 /— Ф Ф ф н- / н- гз Ч CTQ Di с гЧ И ч н-
1 1 "Чг-Ч Ч-» ГЧ п го РЗ гг N со гЧ ч И ч-> ф N
1 1 М И Ч-» 1—1 гг о г+ N D со 3 ч-» Чг* со Ч-i Ф
V» И 1 ßo ч_г ч ф г+ ф сь ф с Ч г* гЧ н-
г"" / W и гз D гЧ ф Н- Ч) ь гЧ N 1—1
/ гЧ ч-> 3 г-Ч Di г+ со 3 ч 3 Ч-» со И /Ф Ч-i
СП п ф ф ф 43 н- 03 Ч-' о Ч— ’
03 N5 1 гз г-Ч 1 Чг* гЧ 03 а 0Q 3 “ гЧ D. Ч-» гЧ ГО
ß° ßo СП 3 о СП ч~* 3 3 3 / =«: D
Ч-i н- Ч-» Ч~> / ф 3 со СГ ф N3 Ч ГО СО
4| И сь г-Ч £Г 3 п Ф Ч-» м Ч-> ста
CO СП о и < и Ч 3 3* Н- b D ч-> ф
CO О 3 3 > 03 43 0Q оз 3 ß® ч-/ 43 Di
ß® ßo н- м Ч-/ н- Ч Ч-* м Di rS го
Oj фч ßo со Ф Ч-» rt м гЧ
ß® слз =«: н-
CO И ч г— ф Н- Ч-* ф н* к 0Q
N) о с М 3 СГ СО 3 3Z Чг-* гг
О о м V Ч-/ гз о ь / ч
ß® ßo Ф г-Ч г-Ч X Нэ н- г / Чг* Ф
Г“\ ГЗ гЧ С: 3 г п гЧ Di 3 гг
И 1—1 N3 Ч~» 1 ч с 3 С Ь со
О СО И 1 г-Ч ф Чг* Di 3 н- N3 гЧ 43
О 03 N3 s: ф Чг* Н- Di Di ч 03
ß® ßo гЧ /Ч-* Ч-» 3
Ч-'
Ф ч N)
c=¡ С ч— * с n
03 ч ф
СО и 1 о /ß® гЧ а со 3 м гЧ © 3 гЧ
03 N3 03 3 3 __ ч ф Ч— ' о
ß® ß® Ч-* н- г-Ч гз го ф о ГЧ Ч-» ч-* 43
сь о н- гг М Ч-» ч
ГО И гз ч О г+ ф D ч / Чг-*
N) и 3 с Ч-' оз о 1—1 N — г ч Ч-i
О о н- м г-Ч г+ X* ч гЧ о 43
гЧ
ß® ßo сь ГЧ ф < ф со ф го »3
и >-* гЧ с+ 3 1 ч
N) и с 1—1Ч со С Ч-» ч-> СП 3 И
СО СП i—1 чг и ßo 4d м Ч-i
ф 0 3 Ф ф Чг-*
сл /Ч гЧ 3 э ч~*
1 1 b"1 СО о D
1 1 чг 1 г-Ч с
1 1 гЧ СО ГЗ
сл 4J ч-> Ч— 1 с3та
1 г-Ч Ч-'
“vj s: ч-*
Ч— ’ Ч~» Ч-'
СГ ß®
О
р+ 3
Ч гз
О
3 гз
3
3 гЧ
м <
ф >’
Ч—
Examples

\mc{@{}N}{klemme} & \mc{N}{klemme} & \mc{N}{klemme} & A & & & \ \


\cm id ru le(r){l-l}\cm id ru le(lr){2-2}\cm id ru le(lr){3-3}\cm id ru le(lr){4-4}%
\cm id ru le(lr){5-5}\cm id ru le(lr){6-6}\cm id ru le(lr){7-7}\cm id ru le(l){8-8}\ad dlin esp ace
406 & 416 & 426 & 25 &3+\mathrm{Mp}& 4\timesl6& 4\timesl6& Pg 2 1 \\
407 & 417 & 427 & & & & & Pg 29\\\addlinespace
408 & 418 & 428 & 60 &3+\mathrm{Mp}& 4\times35& 4\timesl6& Pg 2 9 \\
409 & 419 & 429 & & & & & Pg 3 6 \\ \addlinespace
456 & 466 & 476 & 90 &3+\mathrm{Mp}& 4\times70& 4\times70& Pg 3 6 \\
457 & 467 & 477 & & & & & Pg 42\\\addlinespace
\bottomrule
\end{tabular}

06-00-20] Listen-Nummer Nennstrom Polzahl Anschluss bis mm2 Pgfür


Abgang
mit Bügel­ mit Mantel­ mit Block­ unten oben
oben
klemme klemme klemme A

406 416 426 25 3 + Mp 4x16 4x16 Pg 21


407 417 427 Pg 29
408 418 428 60 3 + Mp 4x35 4x16 Pg 29
409 419 429 Pg36
456 466 476 90 3 + Mp 4x70 4x70 Pg36
457 467 477 Pg 42

\usepackage{dcolumn,booktabs, ragged2e ,rotating}


\newcom m and\Rotate[l]{\raisebox{-3ex}{\begin{turn}{90}\rlap{#l}\end{turn}}}
\newcolumntype{C}{>{\footnotesize}c}
\newcolumntype{N}{>{\footnotesize}l}
\newcolumntype{P}[l]{>{\footnotesize\RaggedRight\hspace{Opt}}p{#l}}
\newcommand\mc[ 2] {\m ulticolum n{l}{#l}{# 2}}
\begin{tabular}{@ {}l *{5}{r} c@{}}\toprule
\mc{@{}N}{Heilanstalten} & \multicolumn{ 6}{N}{Ärzte} \\\c m id r u le (l){2 -7 }
& \multicolumn{2}{N}{insgesamt} & \multicolumn{4}{N@{}}{davon}\\
\cm id ru le(lr){2-3}\cm id ru le(l){4-7}
& & & & \multicolumn{3}{N@{}}{nachgeordnete Ärzte} \\\cm id r u le (l){5 -7 }
& & & & & \m ulticolum n{2}{C}{davon}\\\cm idrule(l){6-7}
& \mc{C}{\Rotate{zusammen}} & \mc{C}{\Rotate{davon weiblich}}
& \m c{C}{\Rotate{leitende Ärzte}} & \mc{C}{\Rotate{insgesamt}}
& \mc{P{2em}@{}}{0ber"-ärzte} & \mc{P{3. 5em}@{}}{Assistenz"-ärzte} \ \
\cm id ru le(r){l-l}\cm id ru le(lr){2-2}\cm id ru le(lr){3-3}\cm id ru le(lr){4-4}%
\cm idrule( l r ){5 -5 }\cm idrule( l r ) { 6- 6}\cm idrule( 1){7-7}
J o s e f s s t if t , Bad Brückenau & 90 & 24 & 11 & 79 & 15 &64 \ \
Tannenheim, Schlüchtern & 37 & 12 & 8 & 27 & 7 &22 \ \
Waldfrieden, S elters & 24 & 8 & 2 & 22 & 6 &22 \ \
Habichtshöhe, Lauterbach & 36 & 13 & 3 & 33 & 8 &25 \\\bottom rule
\end{tabular}

189
Examples

Heilanstalten Ärzte

insgesamt davon

Xo <L> nachgeordnete Ärzte


;=3
£
ö
davon
% <U S

in
c
Ö
o 'S
0)
«3
03
b fl Ober­ Assistenz­
X%
w
3 ju C ärzte ärzte

Josefsstift, Bad Brückenau 90 24 11 79 15 64


Tannenheim, Schlüchtern 37 12 8 27 7 22
Waldfrieden, Selters 24 8 2 22 6 22
Habichtshöhe, Lauterbach 36 13 3 33 8 25

\usepackage{dcolumn,booktabs, ragged2e , ro ta tin g ,n icefrac}


\newcolumntype{C}{>{\footnotesize}c}
\newcolumntype{N}{>{\footnotesize}l}
\makeatletter\newcolumntype{B}[1 ]{>{\boldmath\DC@{. } { , }{#1}} c <{\DC@end}}\makeatother
\newcolumntype{P}[l]{>{\footnotesize\RaggedRight\hspace{Opt}}p{#l}}
\newcolumntype{d}[1 ]{D{. } { , }{#1}}
\newcommand\mc[2] {\m ulticolum n{l}{#l}{# 2}}
\begin{tabular}{@{} d{4.0} d{2.0} d{2.1} B{2} d{2.1} @ {\,\,} l@ {}}\toprule
\mc{@{}N}{Capacity} & \mc{N}{Power}
& \mc{P{4.5em}}{Acceleration 0\,\nicefrac{km }{h} to 100\,\nicefrac{km }{h}}
& \mc{>{\bfseries}P{4em}}{Maximum speed}
& \multicolumn{2}{P{4em}@{}}{Fuel consumption per 100\,km }\\
\mc{@{}C}{cm$A3$} & \mc{C}{kW} & \mc{C}{s} & \m c{>{\bfseries}C}{\nicefrac{km }{h}}
& \m u lticolum n{2}{C @ {}}{l}\\\cm idrule(r){l-l}\cm idrule(lr){2-2}\cm idrule(lr){3-3}
\cm id ru le(lr){4-4}\cm idrule(l){5-6}
1288 & 37& 22.7 & 133 & 8.6 \ \ 1488 & 44 &18.8 & 140 &8.7 \ \
1688 & 55& 13.7 & 155 & 9.4 & Super\\ 1985 & 66 &11.7 & 165 &9.9 & Super\ \
2274 & 80& 9.8 & 178 & 10.1 & Super\\\bottomrule
\end{tabular}

Capacity Power Acceleration Maximum Fuel con­ 06-00-22


0 km/h tO speed sumption
1 0 0 Wh per 1 0 0 km
cm3 kW s Wh 1

1288 37 22,7 133 8,6


1488 44 18,8 140 8,7
1688 55 13,7 155 9,4 Super
1985 66 11,7 165 9,9 Super
2274 80 9,8 178 10,1 Super

190
E x a m p le s

------- i first column second column \begin{tabular}{11}


06-00-23 I
second line--- more-text------- f i r s t column & second columnW
third line lower right second lin e & more te x t
\\[ —. 5\ n o rm alb aselin eskip ]\h lin e\n o align {\vsp ace{lex}}
th ir d lin e & lower r ig h t
\end{tabular}

\ u sep ackage{ array, slash b o x , ragged2e}


Un
£ + 00 — 00
Vn \renew com m and\arraystretch{l.6}
\begin{tabular}{|*{4}{>{%
r £ + £' + 00 — 00
\Centering$}m{12mm}<{$}|}}\hline
+ 00 + 00 + 00 F.I. \m ulticolum n{l}{|c|}{%
\backslashbox{$v_n$}{$u_n$}}
— 00 — oo F.I. — 00 & \ ell& + \in fty& -\in fty\\\h line
\ e l l ’ & \ e ll+ \ e ll’ & + \infty& -\infty\\\hline
+\infty&+\infty&+\infty&$F. I . $\\\hline
-\ in fty& -\ in fty& $F . I . $& -\infty\\\hline
\end{tabular}

2 Tu \ u se p a c k a g e { ta b u la rx ,lo n g ta b le , amsmath}
06-00-25 !
______ I 3 We \usepackage[ta b le ]{ x c o lo r}
-Seminar \newcommand*\RMarker{.}
4 Th
\newcommand*\SeminarOn[l][Weekend]{%
5 Fr
\def\RMarker{ \ rb race\ tex t{#1}}}
6 Sa round table
Weekend \newcommand*\SeminarOff{\def\RMarker{.}}
7 So \newcommand*\SA{\rowcolor{black!20}}
8 Mo \newcommand*\SO{\rowcolor{black!30}}
9 Tu
\ b egin { lo n gtab le} { > { $ \ left. }l<{\right\RMarker$}}
\SeminarOn[Sem inar]
\ b egin { tab u larx} { . 6\linew idth}{rlX }
2 & Tu & \\ 3 & We & \\
4 & Th & \\ 5 & Fr & \\
\end{tabularx} \\\SeminarOn
\ b egin { tab u larx} { . 6\linew idth}{rlX }
\SA 6 & Sa & round tab le\ \
\S0 7 & So & \\
\end{tabularx} \\\SeminarOff
\b egin { tab ularx}{ .6\lin ew idth }{ rlX }
8 & Mo &\\ 9 & Tu &
\end{tabularx}
\end{longtable}

The following two figures show two floating environments, which appear on pages that
face each other. To make the two tables start at the same height, a \phantom instruction
is used for the right table. They can also be moved towards the centre to emphasize their
connection.

19 1
Examples

The source code for this example was omitted for space reasons; it can be found as
0 6 -0 0 -2 6 . l t x on CTAN.

1 D O U B LE P A G E 1 D O U B LE P A G E

1 A Section title, which is a bit longer to make it go


over two lines in the heading.

1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988
Zeile 1 1 3 1 1 1 0 1 1 0 ZI 0 0 0 20 0 2 2 2
Zeile2 1 1 3 1 0 0 0 0 0 Z2 0 2 1 3 4 4 6 4
Zeile3 2 1 2 1 0 0 0 0 0 Z3 0 0 1 5 3 1 7 7
Zeile4 1 0 5 1 2 0 0 0 0 Z4 2 1 0 1 0 3 7 2
Zeile6 2 1 1 0 0 0 0 0 0 Z6 1 2 0 5 2 2 5 4
Zeile5 0 0 4 2 1 2 2 1 0 Z5 0 0 1 1 0 2 5 4
Zeile8 0 1 1 0 0 0 1 1 0 Z8 3 2 1 2 1 3 5 3
Zeile9 0 0 0 0 0 1 2 1 0 Z9 0 0 0 4 2 1 4 5
Zeile10 0 1 3 0 1 0 1 0 0 Z10 1 1 0 1 1 1 4 4
Zeilell 0 2 2 1 1 0 1 0 0 Zll 0 0 2 6 1 0 2 1
Zeile12 2 0 2 4 1 0 4 0 0 Zl2 0 0 0 0 0 0 1 0
Lärm 2 3 0 0 0 0 0 0 0 Lärm 0 1 0 2 0 0 2 2
Zeile13 0 1 0 0 1 0 3 0 0 Z13 0 0 0 2 0 1 3 0
Zeile14 0 1 0 0 0 0 0 0 0 Z14 0 0 0 3 3 2 1 1
Zeile15 0 0 0 0 0 0 0 0 0 Z15 1 0 0 4 0 0 3 1
Zeile16 0 0 0 0 0 1 0 0 0 Z16 0 0 0 0 0 3 5 0
Artikel gesamt 2 6 13 8 4 3 5 4 0 Artikel gesamt 6 3 5 23 10 8 15 13

Table1:Tablecapiton,partI.*
& Table1:Tablecaption,partII.

\usepackage{tabularx}
\begin{tabularx}{\linewidth}{@ {}X|p{ 2mm}@{}|}\cline{ 2- 2}
DANTE, Deutschsprachige Anwendervereinigung \TeX\ e . \ , V . , has been founded on April 14,
1989 in Heidelberg, Germany. The principal aim of the association i s to encourage advice
and cooperation among German language TeX users. This includes consulting via WWW,
electro n ic mail, and usual le t t e r mail concerning purchase, implementation, and \ld o ts
& \r u le { 2mm}{0p t } \ \\ c li n e { 2- 2}
\end{tabularx}

DANTE, Deutschsprachige Anwendervereinigung


TgX e.V., has been founded on April 14, 1989 in
Heidelberg, Germany. The principal aim of the as­
sociation is to encourage advice and cooperation
among German language TeX users. This includes
consulting via WWW, electronic mail, and usual
letter mail concerning purchase, implementation,
a n d ...

192
Autor Fläche Airgap Empfindl.

mm2 pm mV/Pa

Schellin 1 0,3
van der Donk
Bernstein 0,57 2,2 10,77
Chen - 2 40
Dehé 0 1 .2 1 3,2
Hsu 2 4 -
Kronast 2 1,3 11
Li 1 - 9,6
Pedersen 4,84 3,6 -
Rombach 1 0,9 14
Kovacs 0,25 1,5 -
Torkkeli 1 1,3 2

Bay 4 0,4 27
Füldner
Tajima 4 15 7

Kressmann 1 1 2,9
Thielemann
Hsieh 64 4,5 40
Murphy - - 8
Zou 1 2,6 14,2
o
O'
oo

Frequenz Rauschen Materialien Quellen Aufbauart


Membran, Elektrode
Hz-kHz dBA SPL

_ Poly-Si, Poly-Si [6,7,9] ]


[12]
-20 - Nitrid, Gold [13]
50-15 - Poly-Si, Mono-Si [17,18]
100-10 30 Poly-Si, Epi-Poly [19,10]
200-10 Poly-Si, Mono-Si [7]
-1 Chip
300-20 - Nitrid+Alu, Mono-Si [20,21,22]
100-19 - Poly-Si, Poly-Si [1,24]
100-15 60 Gold, Polymid [2,6]
20-10 22,5 Poly-Si, Poly-Si [17,18]
- - Poly-Si, Poly-Si [25,26]
10-12 35 Poly-Si, Poly-Si [26] J

[26,27,28,30]
-2 Chip
75-24 - Oxid, Mono-Si [29] J

100-10 39 Oxid+Nitrid, Poly-Si [11,12] 1


[8]
100-10 60 Nitrid, Nitrid [1,2,4] -Elektret
100-15 - AI + Nitrid, Mono-Si [3]
9 -16 - Poly-Si , Mono-Si [7] J
Examples
Examples

\usepackage{tabularx}
\makeatletter\newcolumntype{M}{>{\@minipagetrue}X}\makeatother
\begin{tab u larx}{\lin ew id th }{|X |M |}\h lin e
l e f t & r ig h t\\\h lin e
The righ t l i s t now sta r ts at the same height as th is column.
& \begin{item ize} \item a \item b \item c \en d {ite m ize}\\\h lin e
\begin{item ize} \item a \item b \item c \end{item ize}
& The l e f t column i s not an M-column now and therefore has v e r tic a l space at the
beginning. \ \ \h l i n e
\end{tabularx}

left right
The right list now • a
starts at the same
height as this column. • b

• c

The left column is not


• a an M-column now
and therefore has
• b vertical space at the
beginning.
• C

\usepackage{array} ,—
Table 1: Automatic counting of lines \newcounter{tabline} I— -
in a table. \newcolumntype{n}{>{%
\refstep cou n ter{tab lin e}\th etab lin e\en sp ace}l}
No. anim al
1 gelse \b egin{table}
\centering
2 chamois
\caption{Automatic counting of lin e s
3 skunk
in a table.}\label{BA Z}
4 anteater \begin{tabular}{n}\hline
5 armadillo \multicolumn{l}{l}{\emph{No. a n im al}}\\\h lin e
g else \\
chamois \label{FOO} \\
See line 2 or alternatively line 5 in Ta­ skunk \\
ble 1 on page 1. anteater \\
armadillo \label{BAR} \\\h lin e
\end{tabular}
\end{table}

\medskip
See line~\ref{FOO} or a ltern a tiv ely
line~\ref{BAR} in Table~\ref{BAZ}
on page~\pageref{BAR}.

194
Examples

\usepackage{array,booktabs,ragged2e} \def\xstru t{\ru le{O pt}{3ex}}


\newcolumntype{P}[l]{>{\RaggedRight}p{#l}}
\begin{tabular}{@{}ccc@{\qquad}rrrr@{}}\toprule
\multicolumn{l}{@{}P{1.25cm}}{Tipo de a v i \ ’on}
& \m ulticolum n{l}{P {l.75cm}}{Capacidad (pasajeros)}
& \multicolumn{l}{P{1.75cm}}{N\’umero de aviones}
& \multicolumn{4}{@{}p{4cm}@{}}{%
\x stru t N \’umero de v ia je s diarios en la ru ta}\\\cm idrule{4-7}
\x s tr u t & & &1 &2 & 3 & 4 \\\m id r u le
1 & 50 & 5 &3 &2 & 2 & 1 \\
2 & 30 & 8 &4 &3 & 3 & 2 \\
3 & 20 & 10 & 5 &5 & 4 & 2 \ \ \m idrule
4 & 10 & 18 & 3 &1 & — &1 \\
5 &5 & 8 &2 &1 & — & 6 \\
6 &1 & 80 & 6 &5 & 12 & 4 \\\m id r u le
\multicolumn{3}{@{}l}{%
N \’umero de c lie n te s d iarios} & 1000 & 2000 & 900 & 1200 \\\bottom rule
\end{tabular}

06-00-31
Tipo de Capacidad Número de Número de viajes diarios en
avión (pasajeros) aviones la ruta

1 2 3 4
1 50 5 3 2 2 1
2 30 8 4 3 3 2
3 20 10 5 5 4 2
4 10 18 3 1 - 1
5 5 8 2 1 - 6
6 1 80 6 5 12 4
Número de clientes diarios 1000 2000 900 1200

The following example shows how to add columns automatically with intermediate sums.
For space reasons, the whole preamble was moved into the non-visible part here.

\usepackage{longtable}
\resetintsum
\begin{longtable}{p{ 0. 7\linew idth}r}
l e f t & right
\endfirsthead
carry & \ \
\endhead
intermediate sum: & \MarkIntSumPos \ \
\endfoot
sum: &\MarkIntSumPos \ \
\en d lastfoot

195
E x a m p le s

An a r b it r a r y in t r o d u c t o r y t e x t a t th e s t a r t o f th e c o lu ra n \ld o ts .
& \ V a l{ l,0 0 > \ \
b & \ V a l{ 2 , l } \\
c & \ V a l{ 3 ,4 } \\
d & \ V a l{ 4 , 5} \ \
e & \ V a l{ 5 ,6 } \\
f & \ V a l{ 6 ,7 } \\
g & \ V a l{ 7 ,8} \ \
h & \ V a l{ 8 ,9 } \ \
i & \ V a l{ 9 ,4 2 } \ \
j & \ V a l{ 1 0 ,8 8 } \ \
k & \ V a l{ 1 5 ,7 6 }
\ e n d { lo n g ta b le }

[06-00-32

left right carry 40-€


An arbitrary in- 1- i 9.42
troductory text at j 10.88
the start of the k 15.76
column___ sum: 76.06 €
b 2.10
c 3.40
d 4.50
e 5.60
f 6.70
g 7.80
h 8.90
intermediate sum: 4 0 .- €

\u se p a ck a g e { ra g g e d 2 e , a r r a y , g ra p h ic x }

\re n e w c o m m a n d \ a rra y s tre tc h { l.3}


\b e g in { ta b u la r} { @ { } c c@ { } } \ s m a ll
\b e g in { ta b u la r} { @ { } c 1 1 > {\RaggedR igh t}m {3.0cm }@ {}}\hline
\em ph{pin} & \e m p h {co lo r} & \em ph{at e n co d e r} & \ e m p h { d e s c r ip t io n } \ \ \ h lin e
1 & ---- & — & $ \ la n g le empty \ r a n g le $ w
2 & y e llo w & 8 (g ra y ) & E n coder ch a n n e l B w
3 & w h ite & 7 ( v i o l e t ) & E n coder ch a n n e l $ \ o v e rlin e { B } $ w
4 & b lu e & 6 (b lu e ) & E n coder ch a n n e l A w
5 & g re e n & 5 (g re e n ) & En coder ch a n n e l $ \ o v e rlin e { A } $ w
6 & ---- & — & $ \ la n g le empty \ r a n g le $ w
7 & re d & 2 (re d ) & E n coder power s u p p ly (+5V) w
8 & b la c k & 3 (o ra n g e ) & GND \ \ \ h li n e

196
E x a m p le s

\ e n d { ta b u la r}
& % r i g h t colum n f o r th e image
\ r a is e b o x { - 0 . 5 \h e ig h t} { \in c lu d e g ra p h ic s [w id th = 3 c m ]{ im a g e s / d in 8 } }
\ e n d { ta b u la r}

[ 06-00-33 pin color at encoder description


1 (empty)
2 yellow 8 (gray) Encoder channel B 2
3 white 7 (violet) Encoder channel B
4 blue 6 (blue) Encoder channel A
5 green 5 (green) Encoder channel A
6 (empty)
Encoder power supply
7 red 2 (red) 8
(+5V)
8 black 3 (orange) GND

\ u s e p a c k a g e { a rra y ,b o o k ta b s , a r y d s h ln , eu rosym , g ra p h ic x }
\ u s e p a c k a g e [ t a b le ] { x c o lo r }

\ r e s iz e b o x { 0 . 9 \ t e x t w id t h } { ! }{\ren ew com m and\arraystretch {1 .2 5 }%


\ b e g in { ta b u la r} { @ { } l c r r | rr@ { } } \ to p r u le
\ t e x t it { T E S T 1} & & \ m u ltic o lu m n { 2 } { c } { l. J a h r} & \m u ltic o lu m n { 2 } { c } { a b 2. J a h r } \ \
\ t e x t it { T E S T 2} & & Monat & J a h r & Monat & J a h r \ \ \ m id r u le
\ t e x t i t {W erkzeugkosten j e Autom at} && \ t e x t it { 8 . 0 0 0 } & \ t e x t it { 9 6 . 0 0 0 }
& \ t e x t it { 8 . 0 0 0 } & \ t e x t it { 9 6 . 0 0 0 } \ \
A n z a h l B e s te llu n g e n f ü r W erkzeuge & & 8 & 96 &8 & 96 \ \
P ro z e s s k o s te n p ro B e s c h a ffu n g s p ro z e s s & 40 & & & & \ \
K o ste n f ü r Stam m datenpflege & & 10 & 120 & 10 & 120 \\
\ r o w c o lo r [ g r a y ] { 0 .9 2 } [ \ ta b c o ls e p ]
B e s t e llk o s t e n & & 330 & 3.960 & 330 & 3.960 \ \
% \ m id r u le
D u r c h s c h n it t lic h e r L a g e rw e rt (2 M onate)& & & 1 6 .0 0 0 & & 16 .000 \ \ \ c lin e { 3 - 6 }
Gebundenes K a p it a l p ro J a h r &6\% & 80 & 960 & 80 & 960 \ \
Lagerabw ertu n g vom L a g e rw e rt p ro J a h r &5\% & 67 & 800 & 67 & 800 \ \
\ r o w c o lo r [ g r a y ] { 0 .9 2 } [ \ ta b c o ls e p ]
L a g e rk o s te n & & 147 & 1 .7 6 0 & 147 & 1 .7 6 0 \ \
P e rs o n a lk o s te n W erkzeugausgabe \ e u ro / h & 30 & & & & \ \
E in s p a ru n g W erkzeugausgabe p ro Tag i n h & 2 & 1 .2 0 0 & 1 4.400 & 1 .2 0 0 & 1 4 .4 0 0 \ \
WerkzeugSchwund & 1\% & 80 & 960 & 80 & 960 \ \
\ t e x t i t { S t i l l s t a n d a u fg ru n d fehlendem W erkzeug} & \ t e x t it { 0 , 0 3 h / T a g } & \ t e x t it { 5 3 }
& \ t e x t it { 6 3 6 } & \ t e x t it { 5 3 } & \ t e x t it { 6 3 6 } \ \
A n z a h l M asch in en & 5 & 265 & 3.180 & 265 & 3 .1 8 0 \ \
W eniger V e rb ra u ch du rch K o n t r o lle & 5\% & 400 & 4 .8 0 0 & 400 & 4 .8 0 0 \ \
W eniger Schw arzbestän de im l . J a h r & 10\% & 800 & 9.6 0 0 & & \\
\ r o w c o lo r [ g r a y ] { 0 .9 2 } [ \ ta b c o ls e p ]
V e rb ra u c h - und P e rs o n a lk o s te n & & 2 .7 4 5 & 32.940 & 1 .9 4 5 & 23 .3 4 0 \ \

197
E x a m p le s

\ r o w c o lo r [ g r a y ] { 0 .8 8 } [ \ ta b c o ls e p ]
E in sp a ru n g e n & & 3 .2 2 2 & 38.660 & 2 .4 2 2 & 29.060 \ \
\ r o w c o lo r [ g r a y ] { 0 .9 9 } \ m u ltic o lu m n { 4 } { c I } { A b z ü g lic h z u s ä t z lic h e K o s te n :} \\
M ie te & &200 & 2 .4 0 0 & 200 & 2 .4 0 0 \ \
I n s t a l l a t i o n und Wartung& &142 & 1 .7 0 0 & 42 & 500 \\
S o n s tig e K o ste n & &83 & 1 .0 0 0 & 83 & 1 .0 0 0 \ \
\ r o w c o lo r [ g r a y ] { 0 .8 8 } [ \ t a b c o ls e p ] T a t s ä c h lic h e E in spa run ge n & & 2 . 797&33. 560&2. 097&25. 1 6 0 \\
& & \m u ltico lu m n { 2 } { cI} { S \s ta ck re l{ \w e d g e } { = } 3 5 \% $ }
& \m u ltico lu m n { 2 } { c@ { } } { $ \s ta ck re l{ \w e d g e } { = } 26\% $}\\
\c m id ru le { 3 -6 } \ m o re c m id ru le s \ c m id ru le { 3 -6 }
\ e n d { ta b u la r} }

TEST 1 1 . Jahr ab 2 . Jahr f06'00-34


TEST 2 Monat Jahr Monat Jahr

Werkzeugkosten je Automat 8.000 96.000 8.000 96.000


Anzahl Bestellungen für Werkzeuge 8 96 8 96
Prozesskosten pro Beschaffungsprozess 40
Kosten für Stammdatenpflege 10 120 10 120
Bestellkosten 330 3.960 330 3.960
Durchschnittlicher Lagerwert (2 Monate) 16.000 16.000
Gebundenes Kapital pro Jahr 6% 80 960 80 960
Lagerabwertung vom Lagerwert pro Jahr 5% 67 800 67 800
Lagerkosten 147 1.760 147 1.760
Personalkosten Werkzeugausgabe € /h 30
Einsparung Werkzeugausgabe pro Tag in h 2 1.200 14.400 1.200 14.400
Werkzeugschwund 1% 80 960 80 960
Stillstand aufgrund fehlendem Werkzeug 0,03h/Tag 53 636 53 636
Anzahl Maschinen 5 265 3.180 265 3.180
Weniger Verbrauch durch Kontrolle 5% 400 4.800 400 4.800
Weniger Schwarzbestände im 1 Jahr 10% 800 9.600
Verbrauch- und Personalkosten 2.745 32.940 1.945 23.340
Einsparungen 3.222 38.660 2.422 29.060
Abzüglich zusätzliche Kosten:
Miete 200 2.400 200 2.400
Installation und Wartung 142 1.700 42 500
Sonstige Kosten 83 1.000 83 1.000
Tatsächliche Einsparungen 2.797 33.560 2.097 25.160
= 35% = 26%

198
E x a m p le s

You can control the row spacing in a table relatively easily, by using either the ta b ls
package or altering the value of \a rra y s tre tc h , which defaults to 1 . Alternatively, you can
insert an invisible line (\ru le) with a depth and height. This example also shows how to use
nested tables.

Vertical spacing in a table. \ u s e p a c k a g e { a rra y , ragged2e}


06-00-35
Default baseline height \b e g in { c e n te r}
j An extremely long line of V e r t i c a l s p a c in g i n a t a b le . \ \ [ 5 p t ]

text in a m-column
D e fa u lt b a s e lin e h e ig h t \ \ [ 2 p t ]
^ An extremely long line of \b e g in { ta b u la r} { @ { } c
text in a m-column > {\R ag g e d R ig h t}m{4cm}@{} } \ h lin e
2 An extremely long line of 1 & An e x tre m e ly lo n g l i n e o f t e x t
text in a m-column i n a m -c o lu m n \\\ h lin e
2 & An e x tre m e ly lo n g l i n e o f t e x t
\renewcommand\arraystrech{l.5} i n a m -c o lu m n \\\ h lin e
3 & An e x tre m e ly lo n g l i n e o f t e x t
j An extremely long line of i n a m -c o lu m n \\\ h lin e
text in a m-column \e n d { ta b u la r}

2 An extremely long line of


\ b ig s k ip
text in a m-column \re n e w c o m m a n d \ a rra y s tre tc h { l.5}
^ An extremely long line of \ v e rb = \r enewcommand\arr a y s t r e c h - f l.5} = \\ [2 p t]
text in a m-column \b e g in { ta b u la r} { @ { } c
>{\RaggedRight}m{4cm}@{} } \ h lin e
1 & An e x tre m e ly lo n g l i n e o f t e x t
\ r u l e [-3ex] {0pt}{7ex} in first column i n a m -c o lu m n \\\ h lin e
j An extremely long line of 2 & An e x tre m e ly lo n g l i n e o f t e x t
i n a m -c o lu m n \\\ h lin e
text in a m-column
3 & An e x tre m e ly lo n g l i n e o f t e x t
2 An extremely long line of i n a m -c o lu m n \\\ h lin e
text in a m-column \e n d { ta b u la r}

^ An extremely long line of \ b ig s k ip


text in a m-column \v e rb = \ru le [ -3 e x ] { 0 p t} { 7 e x } = in
f i r s t c o lu m n \\[2 p t]
\b e g in { ta b u la r} { @ { }
> { \ ru le [ -3 e x ] { 0 p t} { 7 e x } } c
> {\RaggedRight}m {4cm }@ {}}\hline
1 & An e x tre m e ly lo n g l i n e o f t e x t
i n a m -c o lu m n \\\ h lin e
2 & An e x tre m e ly lo n g l i n e o f t e x t
i n a m -c o lu m n \\\ h lin e
3 & An e x tre m e ly lo n g l i n e o f t e x t
i n a m -c o lu m n \\\ h lin e
\e n d { ta b u la r}
\e n d { c e n te r}

199
6 E x a m p le s

T h e fo llo w in g tw o tables h ave been ro tate d th ro u g h s id e w a y s t a b l e a n d \ r o t a t e b o x . In


th e f ir s t case, th e o p t io n t w o s id e o f th e e x a m p le d o c u m e n t cla ss is ta k e n in to a c c o u n t a n d
ro ta te d a c c o rd in g ly , w h ile in the se co n d case th e table is s im p ly ro ta te d co u n te r-c lo c k w is e .

\ u s e p a c k a g e { a rra y ,b o o k ta b s , r o t a t i n g ,u n it s }
\ n e w c o lu m n ty p e { N } { > { \s c rip ts iz e } l}

\ b e g in { s id e w a y s ta b le }
\c a p tio n { T h e f o llo w in g t a b le has been r o t a t e d a u t o m a t ic a lly w ith \ t e x t t t { s id e w a y s t a b le } . }
\ b e g in { c e n te r}
\b e g in { ta b u la r} { @ { } N N * { 5 } { l} @ { } } \to p ru le
c a p a c it y & $ \u n it{ c m A3}$ & 1288 & 1488 & 1688 & 1985 & 2274 \ \ \ m id r u le
power & \u n it{k W } & 37 & 44 & 55 & 66 & 80 \ \ \ m id r u le
a c c e le r a t io n \ u n itfr a c [ 0 ] { k m } { h } to \ u n itfra c [1 0 0 ]{ k m } { h } & \ u n it { s } & 2 2 ,7
& 1 8 ,8 & 1 3 ,7 & 1 1 ,7 & 9 ,8 \ \ \ ir iid r u le
\ t e x t b f {maximum speed}
& \ t e x t b f { \ u n it fr a c { k m } { h } }
& \ t e x tb f{ 1 3 3 } & \ t e x tb f{ 1 4 0 } & \t e x tb f{ 1 5 5 }
& \ t e x tb f{ 1 6 5 } & \ t e x tb f{ 1 7 8 } \ \ \ m id r u le
f u e l co nsu m ptio n p e r \ u n it [ 1 0 0 ] {km} & \ u n i t { l } & 8 ,6 & 8 ,7 & 9 ,4 (s u p e r)
& 9 ,9 (s u p e r) & 1 0 ,1 (s u p e r) \ \ \ b o t t o m r u le
\ e n d { ta b u la r}
\e n d { c e n te r}
\ e n d { s id e w a y s ta b le }

06-00-36 j

200
E x a m p le s

In co n trast to the s id e w a y s t a b le e n viro n m e n t, the \ r o t a t e b o x co m m a n d can rotate the


table w ith o u t it a p p e a rin g o n a separate page. T h is m e a ns th a t te xt o f th e n o rm a l a lig n m e n t
can be p la ce d n e x t to the ro ta te d table.

\u s e p a c k a g e { a rra y , t a b u la r x , b o o k ta b s , r o t a t i n g , u n i t s , c a p tio n }
\ n e w c o lu m n ty p e { N } { > { \s c rip ts iz e } l}
\news avebox\TBox

\s a v e b o x \T B o x { \p a rb o x { \lin e w id th } { %
\ c a p tio n o f { ta b le } { T h e f o llo w in g t a b le was r o t a t e d w it h \ t e x t t t { r o t a t e b o x } . }
\b e g in { ta b u la r} { @ { } N N * { 5 } { l} @ { } } \to p ru le
c a p a c it y & $ \u n it{ c m A3}$ & 1288 & 1488 & 1688 & 1985 & 2274 \ \ \ m id r u le
power & \u n it{k W } & 37 & 44 & 55 & 66 & 80 \ \ \ m id r u le
a c c e le r a t io n \ u n itfr a c [ 0 ] { k m } { h } to \u n itfra c [ 1 0 0 ] { k m } { h }
& \ u n it { s } & 2 2 ,7 & 1 8 ,8 & 1 3 ,7 & 1 1 ,7 & 9 ,8 \ \ \ m id r u le
\textbf{m axim um speed} & \ t e x t b f { \ u n it fr a c { k m } { h } } & \ t e x tb f{ 1 3 3 }
& \ t e x tb f{ 1 4 0 } & \ te x tb f{ 1 5 5 } & \ t e x tb f{ 1 6 5 } & \ t e x tb f{ 1 7 8 } \ \ \ m id r u le
f u e l consu m ption p e r \ u n it [ 1 0 0 ] {km}
& \ u n i t { l } & 8 ,6 & 8 ,7 & 9 ,4 ( s u p e r)& 9 ,9 (su p e r)& 1 0 ,1 (s u p e r) \ \ \ b o t to m r u le
\e n d { ta b u la r} } }
\ b e g in { ta b u la r x } \ lin e w id th { @ { } 1 X @{}}
\ r a is e b o x { - l.3 \ h e ig h t} { \ r o ta te b o x { 9 0 } { \ u s e b o x \ T B o x } } & \ b lin d t e x t
\e n d { ta b u la rx }

06-00-37 ]
Hello, here is some text without a
meaning. Thistextshouldshow,howa
printedtextwill looklikeatthisplace.
Ifyoureadthistext,youwill getnoin­
Q formation. Really?Istherenoinforma­
3h tion?Isthereadifferencebetweenthis
textandsomenonsenselike»Huardest
1 § On g i gefburn«. Kjift - Never mind! A
blindtext likethisgivesyouinforma­
tionabout the selectedfont, howthe
1 lettersarewrittenandtheimpression
§ s 5 s O'. of thelook. Thistext shouldcontain
all lettersofthealphabetanditshould
S' bewritteninoftheoriginal language.
Thereisnoneedforaspecial contents,
1 E 3 3 !<> but thelengthofwordsshouldmatch
tothelanguage.
1 3 2£
1 £ 3 S 5
! 1 « î _
1 I
i
1 l
1 a 1
i
I t 1 1 1

201
E x a m p le s

\u s e p a c k a g e { p s t-n o d e , p s t - t r e e , g r a p h ic x , geom etry}


\def\G rap hT ab Line# l(# 2 ,#3,# 4,# 5){%
#1 & \rnode{A}{# 2} & \checkSpace(# 2,# 3){B}{# 3}
& \checkSpace(# 2,# 4){C}{# 4} & \checkSpace(# 2,# 5){D }{# 5}
\ n c lin e { A } { B } \ n c lin e { B } { C } \ n c lin e { C } { D } }
\n e w le n g th \V sp a c e
\d e f\c h e c k S p a c e (# 1 ,#2)#3#4{%
\V space= # lpt \a d v a n ce \V sp a ce by -# 2pt
\ra is e b o x { -3 \V s p a c e } { \rn o d e { # 3 } { # 4 } } }

\p s s e t{ n o d e s e p = 2 p t, arrows=->}
\ r e s iz e b o x { ! } { 0 . 5 \te x th e ig h t} { %
\b e g in {ta b u la r}{@ {}l* 4 {p {2 cm }}@ {}}
& 5 y e a r & 10 y e a r & 15 y e a r & 20 y e a r \ \
\G ra p h T a b L in e { P ro s ta te } ( 9 9 ,9 5 ,8 7 ,8 1 ) \ \
\G ra p h T a b L in e { T h y ro id } ( 9 6 ,9 6 ,9 4 ,9 5 ) \ \
\G ra p h T a b L in e { T e s tis } ( 9 5 ,9 4 ,9 1 ,8 8 ) \ \ [ - 1 5 p t ]
\G raph TabLin e{M elan om as} ( 8 9 ,8 7 ,8 4 ,8 2 ) \ \ [- 1 5 p t ]
\G ra p h T a b L in e { B re a s t} ( 8 6 ,7 8 ,7 1 ,6 5 ) \ \ [ - 4 5 p t ]
\G ra p h T a b L in e { H o d g k in ’ s d is e a s e } ( 8 5 ,8 0 ,7 4 ,6 7 ) \ \ [ - 1 0 p t ]
\G ra p h T a b L in e {C o rp u s u t e r i , u te ru s } ( 8 4 ,8 3 ,8 1 ,7 9 ) \ \ [ - 1 0 p t ]
\G ra p h T a b L in e { U rin a r b la d d e r} ( 8 2 ,7 6 ,7 0 ,6 7 ) \ \ [ - 2 7 p t ]
\G ra p h T a b L in e { C e rv ix u t e r i} ( 7 1 , 6 4 , 6 3 ,6 0 ) \ \ [ - 2 5 p t ]
\G ra p h T a b L in e {L a ry n x } ( 6 9 , 5 7 , 4 6 ,3 7 ) \ \ [ - 3 5 p t ]
\G raphTabLine{R ectum } ( 6 3 , 5 5 ,5 2 ,4 9 ) \ \ [ - 3 5 p t]
\G ra p h T a b L in e { K id n e y , r e n a l p e lv is } ( 6 2 , 5 4 ,5 0 ,4 7 ) \ \ [ - 2 5 p t]
\G ra p h T a b L in e {C o lo n } ( 6 2 , 5 5 , 5 4 ,5 2 ) \ \ [ - 2 0 p t ]
\G ra p h T a b L in e {N o n -H o d g k in ’ s} ( 5 8 ,4 6 ,3 8 ,3 4 ) \ \ [- 6 3 p t ]
\G ra p h T a b L in e { O ra l c a v it y , ph aryn x} ( 5 7 , 4 4 , 3 8 ,3 3 ) \ \ [ - 1 0 p t ]
\G ra p h T a b L in e {O vary} ( 5 5 , 4 9 , 5 0 ,5 0 ) \ \ [ - 1 0 p t ]
\G rap h T a b Lin e {Le u kae m ias} ( 4 3 ,3 2 ,2 9 ,2 6 ) \ \ [ - 1 0 p t ]
\G ra p h T a b L in e { B ra in , n e rvo u s s y s te m } ( 3 2 ,2 9 ,2 7 ,2 6 ) \ \ [ - 1 0 p t]
\G r a p h T a b L in e { M u ltip le myeloma} (3 0 ,1 3 , 7, 5 ) \ \ [ - 1 5 p t ]
\G raph TabLin e{Stom ach} ( 2 4 ,1 9 ,1 9 ,1 5 ) \ \ [ - 2 0 p t ]
\G rap h T a b Lin e {Lu n g and b ro n ch u s} (1 5 ,1 1 , 8, 6 ) \ \ [ - 2 0 p t ]
\G rap h T a bLin e {Esoph agu s} (1 4 , 8, 8, 5 ) \ \ [ 30pt]
\ G r a p h T a b L in e { L iv e r , b i l e d u c t} ( 8, 6, 6, 8 ) \ \
\G ra p h T a b L in e {P a n cre a s} ( 4, 3, 3, 3)
\e n d { ta b u la r} }

202
E x a m p le s

5year 10 year 15 year 20 year


i 06-00-38 I Prostate

Thyroid
Testis
Melanomas
Breast

Hodgkin’s disease

Corpus uteri, uterus


Urinar bladder

Cervix uteri
Larynx

Rectum
Kidney, renal pelvis

Colon
Non-Hodgkin’s
Oral cavity, pharynx

Ovary
Leukaemias

Brain, nervous system


Multiple myeloma

Stomach
Lung and bronchus
Esophagus

Liver, bile duct


Pancreas 4------------ * 3------------ ►3------------ ►3

203
E x a m p le s

\u s e p a c k a g e { n u m p rin t, s p re a d ta b }

\ b e g in { m in ip a g e } [ t] { 0 . 4 5 \ lin e w id th } \ v s p a c e { 0 p t }
\ [ \ f o r a l l x \ in \m ath bf{R }\qqu ad e Ax=\sum_{k=0}A\ i n f t y \ f r a c { x Ak } { k ! } \ ]
The a d ja c e n t t a b le shows th e co nve rge n ce f o r $x= 0.5$.
\ e n d { m in ip a g e } \ h f ill
\ b e g in { m in ip a g e } [ t] { 0 . 4 5 \ lin e w id th } \ v s p a c e { 0 p t}
\S T au to rou nd{1 5 }
\ b e g in { s p r e a d ta b } [ \ S T s a v e c e ll\ x v a lu e { a l} ] { { ta b u la r } { c N { 2 } { 1 5 } } }
\m u ltic o lu m n { 2 } { c } { c o n v e rg e n c e f o r $ x = { \n u m p rin t{ := { 0 .5 } } } $ } \\[1 .5 e x ]
@$n$ & e Aa l\ S T h id e c o l & {@
$ \ d is p la y s t y le e A{\n u m p rin t\x v a lu e } -\s u m _ { k = 0 } An
\ f r a c { \ n u m p r in t \ x v a lu e Ak } { k ! } $ } \ \ [ 3 e x ]\ h li n e
0 & a l A [ - l, 0 ] / f a c t ( [-1 ,0 ] ) & b 2 -[- 1 , 0 ] \\
[ 0 , - l ] + l & a l A [ - 1 , 0 ] / f a c t ( [ - 1 , 0 ] ) + [ 0 , - 1 ] & b 2 -[- 1 , 0 ] \\
[ 0 , - l ] + l & a l A [ - 1 , 0 ] / f a c t ( [ - 1 , 0 ] ) + [ 0 , - l] & b 2 -[- 1 , 0 ] \\
[ 0 , - l ] + l & a l A [ - 1 , 0 ] / f a c t ( [ - 1 , 0 ] ) + [ 0 , - l] & b 2 -[- 1 , 0 ] \\
[ 0 , - l ] + l & a l A [ - 1 , 0 ] / f a c t ( [ - 1 , 0 ] ) + [ 0 , - 1 ] & b 2 -[- 1 , 0 ] \\
[ 0 , - l ] + l & a l A [ - 1 , 0 ] / f a c t ( [ - 1 , 0 ] ) + [ 0 , - 1 ] & b 2 -[- 1 , 0 ] \\
[ 0 , - l ] + l & a l A [ - 1 , 0 ] / f a c t ( [ - 1 , 0 ] ) + [ 0 , - l] & b 2 - [ - l, 0 ] w
[ 0 , - l ] + l & a l A [ - 1 , 0 ] / f a c t ( [ - 1 , 0 ] ) + [ 0 , - l] & b 2 - [ - l, 0 ] w
[ 0 , - l ] + l & a l A [ - 1 , 0 ] / f a c t ( [ - 1 , 0 ] ) + [ 0 , - 1 ] & b 2 - [ - l, 0 ] w
[ 0 , - l ] + l & a l A [ - 1 , 0 ] / f a c t ( [ - 1 , 0 ] ) + [ 0 , - 1 ] & b 2 - [ - l, 0 ] \ \ \ h l i n e
\e n d { s p re a d ta b }
\e n d {m in ip a g e }

convergence for x = 0,5 |06-00-39


Vx e R C* = £ tt
k=0 K'

The adjacent table shows the convergence 0 0,648 721 270 700 128
for x = 0.5. 1 0,148 721 270 700 128
2 0,023 721 270 700 128
3 0,002 887 937 366 795
4 0,000 283 770 700 128
5 0,000 023 354 033 461
6 0,000 001 652 644 572
7 0,000 000 102 545 366
8 0,000 000 005 664 166
9 0,000 000 000 281 877

\ u s e p a c k a g e { ta b u la rx ,n u m p rin t, sp re a d ta b }

\ n p r o u n d d ig its 2
\ b e g in { s p r e a d ta b } { { ta b u la r x } { 0 . 8 \ lin e w id t h } { |
> { \ ru le [ -1 .2 e x ] { 0 p t} { 4 e x } } X > { { \ b fs e rie s } } N 4 2
> { \ b f s e r ie s } c N42 > { \ b f s e r ie s } c N 4 2 | } } \ h lin e
@Pos. & @ \ m u ltic o lu m n { l} { c } { p r ic e / u n it } & @ \m u ltico lu m n {l}{c}{n u m b e r} &

204
E x a m p le s

@ \ m u ltic o lu m n { l} { c } { p ric e } & @ \m u ltic o lu m n { l} { c } { re b a te } & @ \ t e x t b f { n e t } \ \ \ h lin e


@1 & 5 .9 9 & 20 & [ - 2 , 0 ] * [ - l , 0 ] & $-:={20}\%$ & [ - 2 , 0 ] * ( l - [ - l , 0 ] / 1 0 0 ) \ \
@2 & 12 &7 & [ - 2 , 0 ] * [ - l, 0 ] & $-:={10}\%$ & [ - 2 , 0 ] * ( l - [ - l , 0 ] / 1 0 0 ) \ \
@3 & 4 .5 0 & 40 & [ - 2 , 0 ] * [ - l , 0 ] & S-:={35}\% $ & [ - 2 , 0 ] * ( l - [ - l , 0 ] / 1 0 0 ) \ \
@4 & 650 & 2 & [ - 2 , 0 ] * [ - l , 0 ] & $ - :={15}\%$ & [ - 2 , 0 ] * ( l - [ - l , 0 ] / 1 0 0 ) \ \ \ h l i n e
@ \ m u ltic o lu m n { 6 } { c } { \ v s p a c e { - l.5 e x } } \ \ \ c lin e { 4 - 6 }
@ \ m u ltic o lu m n { l} { c } { \ r u le [ -1 .2 e x ] { 0 p t} { 4 e x } } &
@ \m u ltico lu m n {2 }{r|}{su m } & su m (d2 :[ 0 , - 2 ] )
& \ m u ltic o lu m n { l} { c } { $ := {ro u n d (( [ 1 , 0 ] / [ - 1 , 0 ] - 1 ) * 1 0 0 , 0 ) }\%$}
& { \ b f s e r ie s } :={sum (f2 : [ 0 , - 2 ] ) } \ \ \ c lin e { 4 - 6 }
@ \ m u ltic o lu m n { 3 } { rI}{} & @ \m u ltic o lu m n { l} { r} { \te x tb f{ V A T } } & @ 19\%
& { \ b f s e r ie s } := { [ 0 ,- 1 ] * 0 .1 9 } \ \ \ c lin e { 4 - 6 }
@ \m u ltic o lu m n { 3 } { r|}{} &
@ \ m u lt ic o lu m n { 2 } { r } { \ t e x t b f { f in a l sum}} & { \ b f s e r ie s } : = { [ 0 , - 2 ] + [ 0 , - l] } \ \ \ c lin e { 4 - 6 }
\e n d { s p re a d ta b }

Pos. price/unit number price rebate net


1 5,99 20 119,80 - 20% 95,84
2 12,00 7 84,00 - 10 % 75,60
3 4,50 40 180,00 -35% 117,00
4 650,00 2 1 300,00 -15% 1105,00

1683,80 -17% 1393,44


VAT 19% 264,75
final sum 1658,19

\u s e p a c k a g e { b o o k ta b s , p a r a l i s t , d co lum n , ragged2e}
\n e w e n v iro n m e n t{ V o rte ile }
{ \h b o x { } \ v s p a c e { - \ b a s e lin e s k ip } \ b e g in { c o m p a c tite m } [ $ \ o p lu s $ ] }
{ \h b o x { } \v s p a c e { -\ b a s e lin e s k ip } \ e n d { c o m p a c tite m } }
\n ew en viron m en t{ N a c h te ile }
{ \ h b o x { } \v s p a c e { -\ b a s e lin e s k ip } \ b e g in { c o m p a c tite m } [ $ \o m in u s $ ]}
{ \h b o x { } \v s p a c e { -\ b a s e lin e s k ip } \ e n d { c o m p a c tite m } }
\n e w co lu m n typ e {v}[ 1 ] {> {\R ag g e d R igh t\h sp a ce {O p t}}p {# l}}

\ s f f a m ily \ f o o t n o t e s iz e
\b e g in { ta b u la r} { @ { } v { 1 .4 cm } * { 2 } { v { 6 .9 c m } } @ { } } \to p ru le
M a t e r ia l & V o r t e il e & N a c h t e ile \ \ \ c m id r u le ( r ) { l- l} \ c m id r u le ( r l) { 2 - 2 } \ c m id r u le ( l) { 3 - 3 }
E d e ls t a h l
& \ b e g in { V o r t e ile }
\ ite m ro b u s t \ ite m p r e is g ü n s t ig \ ite m l e i c h t zu v e r a r b e it e n
\ ite m u n t e r s c h ie d lic h e D urchm esser und Längen im H andel e r h ä l t l i c h
\ e n d { V o r t e ile }
& \ b e g in { N a c h te ile }
\ ite m n u r in e r t b e i g e rin g e n Tem peraturen i n V erbin d u n g m it bestim m ten S u bsta n ze n
\ ite m O x id a tio n e n d e r O b e rflä c h e fü h re n zu unsym m etrischen Peaks

205
6 E x a m p le s

\ ite m Z e rs e tz u n g du rch V e ru n re in ig u n g e n d e r L e g ie ru n g s fo rm
\ e n d { N a c h te ile } \ t a b u la r n e w lin e \ c m id r u le ( r ) { l- l} \ c m id r u le ( r l) { 2 - 2 } \ c m id r u le ( l) { 3 - 3 }
G la s
& \ b e g in { V o rte ile } %
\ ite m f a s t v o ll s t ä n d ig in e r t
\ ite m d u r c h s ic h t ig , b e s s e re K o n t r o lle d e r Packung a u f G le ic h m ä ß ig k e it
\e n d { V o rte ile } %
& \b e g in { N a c h te ile } %
\ ite m aufw en dige R e in ig u n g d e r S ä u le
\ ite m k e in e A n a ly s e von a g g r e s s iv e r F lu o r id e m ö g lic h
\ ite m l e i c h t z e r b r e c h lic h
\ ite m K n a llg a s e x p lo s io n beim Z e rb re ch e n b e i e r h i t z t e r K a p ill a r e und
W a s s e r s to ff a ls T rä g e rg a s
\ e n d { N a c h te ile } \ t a b u la r n e w lin e \ c m id r u le ( r ) { l- l} \ c m id r u le ( r l) { 2 - 2 } \ c m id r u le ( l) { 3 - 3 }
N ic k e l
& \ b e g in { V o rte ile } %
\ ite m s t a b i l
\ ite m A n a ly s e von e m p fin d lic h e n S ub sta n ze n m ö g lic h , z \ , . B . S t e r o id e , A n a lg e t ic a
und B a r b it u r a t e
\e n d { V o rte ile } %
& \b e g in { N a c h te ile } %
\ ite m n ic h t so in e r t w ie G la s s ä u le n
\ e n d { N a c h te ile } \ t a b u la r n e w lin e \ c m id r u le ( r ) { l- l} \ c m id r u le ( r l) { 2 - 2 } \ c m id r u le ( l) { 3 - 3 }
K u p fe r
& \ b e g in { V o rte ile } %
\ ite m l e i c h t zu v e r a r b e it e n
\e n d { V o rte ile } %
& \ b e g in { N a c h te ile }
\ ite m O b e rflä c h e i s t a u to x y d a b e l
\ ite m K u p fe r o x id o x id ie r t o rg a n is c h e S t o f f e
\ ite m u n g e e ig n e t wenn S a u e r s t o f f im T rä g e rg a s vorhanden i s t
\ ite m a u fw e n d ig e s H e r s t e llu n g s v e r f a h r e n
\ e n d { N a c h te ile } \ t a b u la r n e w lin e \ c m id r u le ( r ) { l- l} \ c m id r u le ( r l) { 2 - 2 } \ c m id r u le ( l) { 3 - 3 }
T e flo n
& \ b e g in { V o r t e ile }
\ ite m v o ll s t ä n d ig in e r t
\ ite m A n a ly s e von a g g re s s iv e n S u b sta n ze n m ö g lic h
\ e n d { V o r t e ile }
& \ b e g in { N a c h te ile }
\ ite m M a t e r ia l kann m ik ro p o rö s s e in , Spu ren elem en te d e r A u ß e n lu ft r u fe n n e g a tiv e
E f f e k t e b e i d e r A n a ly s e h e rv o r
\ e n d { N a c h te ile } \ t a b u la r n e w lin e \ c m id r u le ( r ) { l- l} \ c m id r u le ( r l) { 2 - 2 } \ c m id r u le ( l) { 3 - 3 }
S iliz iu m
& \ b e g in { V o r t e ile }
\ ite m f a s t v o ll s t ä n d ig in e r t
\ ite m nahezu u n b e g re n zte R o h s to ffr e s e r v e n
\ ite m a u to x y d a b le B ild u n g von n a t iv e n S iliz iu m d io x id e n
\ e n d { V o r t e ile }
& \ b e g in { N a c h te ile }
\ ite m z e r b r e c h lic h e r a ls M e t a lle

206
Material Vorteile
Edelstahl © robust
© preisgünstig
© leicht zu verarbeiten
© unterschiedliche Durchmesser und Längen im Handel
erhältlich
Cías © fast vollständig inert
© durchsichtig, bessere Kontrolle der Packung auf Gleich­
mäßigkeit

Nickel © stabil
© Analyse von empfindlichen Substanzen möglich, z.B.
Steroide, Analgetica und Barbiturate
Kupfer © leicht zu verarbeiten

Teflon © vollständig inert


© Analyse von aggressiven Substanzen möglich
Silizium © fast vollständig inert
© nahezu unbegrenzte Rohstoffreserven
© autoxydable Bildung von nativen Siliziumdioxiden
h t e ile } \ t a b u la r n e w lin e \ a d d lin e s p a c e \ b o t to m r u le
Nachteile
© nur inert bei geringen Temperaturen in Verbindung mit
bestimmten Substanzen
© Oxidationen der Oberfläche führen zu unsymmetrischen
Peaks
© Zersetzung durch Verunreinigungen der Legierungsform
© aufwendige Reinigung der Säule
© keine Analyse von aggressiver Fluoride möglich
© leicht zerbrechlich
© Knallgasexplosion beim Zerbrechen bei erhitzter Kapilla­
re und Wasserstoff als Trägergas
© nicht so inert wie Glassäulen

© Oberfläche ist autoxydabel


© Kupferoxid oxidiert organische Stoffe
© ungeeignet wenn Sauerstoff im Trägergas vorhanden ist
© aufwendiges Herstellungsverfahren
© Material kann mikroporös sein, Spurenelemente der
Außenluft rufen negative Effekte bei der Analyse hervor
© zerbrechlicher als Metalle
E x a m p le s

The solution shown below lets us format the content of the table cell almost arbitrarily. It
is based on a special environment that can be defined with the help of the environ package
by Will Robertson. In contrast to the usual KH^Xenvironments, the text between \begin{. . . }
and \end{. . . } is not output immediately, but saved in a command. Afterwards, the content
of the command can be processed in many ways before actually outputting it. In the following
example, the mentioned environment is used to define a new column modificator C. In
addition to centring, the content is mirrored vertically.

u A W \ u s e p a c k a g e { a rra y , e n v ir o n , g ra p h ic x }
06-00-42
\N e w E n v iro n { co lle ctC } { %
KTEX R iX etex
\ m b o x { } \s c a le b o x { l} [- l]{ %
X A Z
\ra is e b o x { -\ h e ig h t} { \B O D Y } } }
\n e w c o lu m n ty p e { C } { > { \b e g in { c o lle c tC } } c
< { \ e n d { c o lle c tC } } }

\ b e g in { t a b u la r } { | 1 C r | } \ h li n e
U & V &W \\
\LaTeX & \LaTeX & \LaTeX \ \
X & Y &Z \ \ \ h lin e
\e n d { ta b u la r}

Creating tables with a loop command is not always easy - creating a table in EfipX can be
a somewhat complex process.

\ u s e p a c k a g e { lt a b le x , ragged2e}
\keepXColum ns
\n e w co lu m n typ e {C }{> {\C e n te rin g }X }
\n e w co lu m n typ e {P }[ 1 ] { > { \C e n te rin g } p { # l} }
%------------------- A f t e r a s u g g e s tio n by D a v id K a s tru p -------------------
\n e w co m m a n d \re p lica te [2 ]{\ifn u m # l> 0 #2%
\e x p a n d a fte r \ r e p lic a te \ e x p a n d a fte r { \ n u m b e r \ n u m e x p r # l- l} { # 2 } \ fi}
\newcommand*\NumberLines{79} \new counter{N }
\new com m and*\Space{\rule[ - 1 . 8mm]{Opt}{6mm}}

\ b e g in { ta b u la r x } { \ lin e w id th } { | r | c | P { 3 c m } | C | P { 3 c m } | } \ h li n e
\t e x tb f{ N o } & \ t e x t b f { f i r s t name} & \ t e x t b f { la s t name}
& \ t e x t b f { a d d r e s s } & \ t e x t b f { s ig n a t u r e } \S pa ce \ \ \ h li n e
\endhead
%
\re p lic a te { \ N u m b e rL in e s } { \ s te p c o u n te r{ N } \ th e N &&&& \S pace \ \ \ h lin e }
°/o
\e n d { ta b u la rx }

208
E x a m p le s

A survey A survey
| 06-00-43
No first name last name address signature No first name last name address signature
1 27
2 28
3 29
4 30
5 31
6 32
7 33
8 34
9 35
10 36
11 37
12 38
13 39
14 40
15 41
16 42
17 43
18 44
19 45
20 46
21 47
22 48
23 49
24 50
25 51
26 52

\u se p a cka g e {b o o k t a b s}
\usepackage{dcolu m n}
\new com m and\m c[l]{\m u lticolum n {l}{@ {}c@ {}}{# l}}
\n e w co lu m n typ e {x}{D {. } { . } { 3 . 2 } @ { \k e rn lp t\% \k e rn l0 p t} }
\n e w co lu m ntype {y}{D {. } { . } { 3 . l}@ {\% \k e rn lO p t}}

\b e g in { ta b u la r} { @ { } r @ {\kern2pt} y y y x y x y yy @ { } } \to p ru le
&\mc{CSY} & \m c{Eza ki} &\mc{Holz}&\mc{Maddison}&\mc{W ong} &\mc{Chow} &\mc{Wang}
&\m c{Scheibe}&\rac{IMF} \ \
&\mc{} &\mc{and Sun}&\mc{} &\mc{} &\mc{and Chan}&\mc{and Li}& \m c{and Yao}
&\mc{} & \m c {}\\
&\mc{2006}&\mc{1999} &\mc{2005}&\mc{2007} &\mc{2003} &\mc{2002} &\mc{2003}
&\mc{2003} & \m c { } \ \ \ m id ru le
1978 & 1 1 .7 &\mc{} & 11 .7 & 7 .7 1 &\mc{} & 7 .6 0 & 7 .6 & 7 .6 &\mc{} w
1979 & 7 .6 &\mc{} & 7 .6 & 3 .3 7 &\mc{} & 7 .8 1 & 7 .8 & 7 .6 &\mc{} w
1980 & 7 .8 &\rac{} & 7 .8 & 5 .98 &\mc{} & 5.2 6 & 5 .2 & 5 .2 & 7 .9 w
1981 & 5 .2 & 5 .2 & 5.2 & 7 .5 2 & 5 .3 & 9 .0 1 & 9 .1 & 9 .1 & 4 .7 w
1982 & 9 .1 & 9 .3 & 9 .1 & 8 .4 8 & 1 2 .1 & 1 0.89 & 1 0 .9 & 1 0 .9 & 9 .1 w
1983 & 1 0 .9 & 1 1 .2 & 1 0 .9 & 1 2 .4 5 & 9 .6 & 1 5.18 & 1 5 .2 & 1 5 .2 & 1 0 .9 \ \ \ b o t t o m r u le
% \mc{} i n empty c e l l s to p re v e n t o u tp u t o f th e % c h a r a c te r
\ e n d { ta b u la r}

209
E x a m p le s

CSY Ezaki Holz Maddison Wong Chow Wang Scheibe IMF | 06-00-44 |
and Sun and Chan and Li and Yao
2006 1999 2005 2007 2003 2002 2003 2003
1978 11 .7 % 11.7% 7.71% 7.60% 7.6% 7.6%
1979 7. 6% 7.6% 3.37% 7.81% 7.8% 7.6%
1980 7. 8% 7.8% 5.98% 5.26% 5.2% 5. 2% 7.9%
1981 5.2% 5. 2% 5.2% 7.52% 5. 3% 9.01% 9.1% 9.1% 4. 7%
1982 9. 1% 9. 3% 9.1% 8.48% 12.1% 10.89% 10.9% 10.9% 9.1%
1983 10.9 % 11.2% 10 .9 % 12.45% 9. 6% 15.18% 15.2% 15.2% 10.9%

\u s e p a c k a g e { ta b to }

\b e g in { te s tA re a } % see pream ble o f th e exam ple -> CTAN


\NumTabs{4}
duck \ t a b goose \ t a b t u r k e y \ t a b c o o t \p a r
\ta b \ta b \ t a b g ro u se
\e n d { te s tA re a }

\ b ig s k ip
\ b e g in { te s tA r e a }
\ T a b P o s it io n s { l. 5cm, 5cm, 8cm}
duck \ t a b goose \ t a b t u r k e y \ t a b c o o t \p a r
\ta b \ta b \ t a b g ro u se
\e n d { te s tA re a }

\ b ig s k ip
\ b e g in { te s tA r e a }
duck \ t a b to { l.5 c m } goose \ta b to {5 cm } tu r k e y \tab to {8 cm }
c o o t \ p a r \ta b to {8 cm } gro u se \tab to * {4 cm } p e lic a n
\ e n d { te s tA re a }

0 1 2 3 4 5 6 7 8 9 10 11 12 13

duck goose turkey coot


grouse
0 1 2 3 4 5 6 7 8 9 10 11 12 13
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
duck goose turkey coot
grouse
0 1 2 3 4 5 6 7 8 9 10 11 12 13
1111 I11 III11 I1111III11III11 III11 III11 III11 I1I11in 11 111IIIII11 nI 11 II11111111111111111111111IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
duck goose turkey coot
pelican grouse

210
E x a m p le s

T h e data file fo r the f o llo w in g e xa m p le is a ty p ic a l co m m a -se p a ra te d list, w h ic h co n ta in s


one data set p e r lin e a n d can be cre a te d fro m a ll database p ro g ra m s th ro u g h the a p p ro p ria te
e x p o rt o p tio n .

f ir s t n a m e ;la s tn a m e ;s t r e e t ; c i t y ;to p a y ;p a id
N i c o l e ;M ü ll e r ;S c h i l l e r p l a t z 61;18419 V o g e lo w ;1 0 0 ,0 ;1 0 0 ,0
Tom;Lehmann;N a c h t ig a llg a s s e 11;29098 A lt a u e ; 1 0 0 ,0 ;1 0 0 ,0
T im ;W agner;A m s e lp la tz 92;46917 Langenhausen;1 0 0 ,0 ;0 ,0
M o r it z ;M ü ll e r ;W a ld a lle e 71;55348 K ir c h s t e i n ; 1 0 0 ,0 ;0 ,0
S u s i;M a y e r;Sonnenweg 2 7 a ;83675 H e id e h a u se n ;1 0 0 ,0 ;1 0 0 ,0
I n e s ;M a y e r;W a s s e ra lle e 8 3 a ;26118 K i r c h f u r t ;1 0 0 ,0 ;1 0 0 ,0
U w e ;M e ie r;S o n n e n p la tz 7;07514 V o g e lb u rg ;1 0 0 ,0 ;0 ,0
M andy;B e r g e r ;Goetheweg 25;03783 W o lf e n t a l; 1 0 0 ,0 ;1 0 0 ,0
T im ;G rö n w a ld ;W ie s e n p la tz 9 a ;90778 Moosow;1 0 0 ,0 ;5 0 ,0
Je n n y ;K ö s t e r ;F in k e n a lle e 2 9 c ; 53522 W iesenow ;1 0 0 ,0 ;1 0 0 ,0
M a rk o ;M a y e r;Amselweg 1 1 c ;32108 G r ü n s t e in ;1 0 0 ,0 ;1 0 0 ,0
J e n n y ;B e r g e r ;W ie s e n a lle e 82;72044 M o o s a u e ;0 ,0 ;0 ,0

\u s e p a c k a g e { d a ta to o l}
\u se p a cka g e {e u ro sy m , b o o k tab s}
\ D T L s e ts e p a r a to r { ;}
\D T L se tn u m b e rch a rs{ } { ,}
\ D T L s e td e fa u ltc u rre n c y { \ te x te u ro ~ }
\ D T L lo a d d b { lis t} { d a ta / d a ta 2 d .c s v }
\D T L s o rt{ la s tn a m e , f ir s t n a m e } { lis t }
\ D T L s u m fo r k e y s { lis t} { to p a y } { \ d e b it}
\ D T L s u m f o r k e y s { lis t } { p a id } { \ c r e d it }

\ s m a ll\ a d d t o le n g t h \ t a b c o ls e p { - lp t }
\b e g in { ta b u la r} { @ { } r 1111 r r @ { } } \to p ru le
ID & f i r s t name & l a s t name & s t r e e t & c i t y & to pay & p a id \ \ \ m id r u le
\ D T L fo re a c h { lis t} { % d e fin e d l i s t e le m e n ts
\ f ir s t = f i r s t n a m e , \ la s t= la s tn a m e , \ a d d r e s s = s t r e e t ,
\ t o w n = c ity , \fe e = to p a y , \paid= paid}{%
\ \ \th e D T L ro w i & \ f i r s t & \ l a s t & \a d d re s s & \tow n & \ e u r o \ , %
\ D T L if c u rre n c y { \ fe e } % i f \ f e e i s a c u rre n c y
{ \ D T L c o n v e rtto d e c im a l{ \ fe e } { \ fe e } % th e n c o n v e rt to d e c im a l
% and save th e c o n v e rte d v a lu e i n
% \fe e
{ \ fe e } } % o u tp u t th e v a lu e o f \ f e e
{ \ fe e } % i f no c u rre n c y , th e n o n ly o u tp u t
& \ e u r o \ , \D T L ifc u rre n c y { \p a id } % i f \ p a id i s a c u rre n c y
{ \D T L c o n v e rt to d e c im a l{ \ p a id } { \ p a id } { \ p a id } } % th e n c o n v e rt
{ \ p a id } } \ \ \ m id r u le % e ls e o u tp u t \ p a id
& & & & & \ D T L d e c im a lt o c u r r e n c y { \ d e b it } { \ d e b it } \ e u r o \ ,\ d e b it & %
\ D T L d e c im a lt o c u r r e n c y { \ c r e d it } { \ c r e d it } \ e u r o \ , \ c r e d it \ \ \ b o t to m r u le
\ e n d { ta b u la r}

211
E x a m p le s

ID Vorname Nachname Straße Ort zu zahlen bezahlt

1 Jenny Berger Wiesenallee 82 72044 Moosaue € 0,0 € 0,0


2 Mandy Berger Goetheweg 25 03783 Wolfental € 100,0 € 100,0
3 Tim Grönwald Wiesenplatz 9a 90778 Moosow € 100,0 € 50,0
4 Jenny Köster Finkenallee 29c 53522 Wiesenow € 100,0 € 100,0
5 Tom Lehmann Nachtigallgasse 11 29098 Altaue € 100,0 € 100,0
6 Ines Mayer Wasserallee 83a 26118 Kirchfurt € 100,0 € 100,0
7 Marko Mayer Amselweg 11c 32108 Grünstein € 100,0 € 100,0
8 Susi Mayer Sonnenweg 27a 83675 Heidehausen € 100,0 € 100,0
9 Uwe Meier Sonnenplatz 7 07514 Vogelburg € 100,0 € 0,0
10 Moritz Müller Waldallee 71 55348 Kirchstein € 100,0 € 0,0
11 Nicole Müller Schillerplatz 61 18419 Vogelow € 100,0 € 100,0
12 Tim Wagner Amselplatz 92 46917 Langenhausen € 100,0 € 0,0

€ 1100,00 € 750,00

212
C h a p t e r

Q u e s t io n s a n d a n s w e r s

7.1 D ocum entation............................................................................................................... 213


7.2 Tables as floating o b je c ts ............................................................................................. 215

7.1 D o c u m e n ta tio n
Apart from a few exceptions, each package comes with its own documentation, which is part
of the TgX distribution just like the style or class file. You can consult this docum entation at
any tim e using the texdoc command. D epending on the operating system, the appropriate
program is started to show the file. Figure 7.2 on the next page shows the result of the
com m and “te x d o c t a b u l a r x ” in Linux. A lternatively, you can use the graphical texdoctk
environm ent (Figure 7.1), though the list of packages available in it is som ew hat dated. An
example of the output is shown in Figure 7.3 on the next page.

Figure 7 .1: The graphical environment


of the auxiliary program texdoctk.

Some authors don’t provide self-contained documentation, but give hints in the package
file itself, for example the t h r e e p a r t t a b l e package. If there is an appropriate link to the
Q u e s t io n s a n d a n s w e rs

Figure 7.2: Package documentation with texdoc.

Selection: Large tables (longtable)


Topics
Publication quality tables in LaTeX
Large tables (longtable)__________
Additional list environments/commands (mdwlist)
Alignment on decimal point (dcolumn)
View
Arrays with delimiters (delarray)
Coloured tables (colortbl) Print
Dashed lines, horizontal and vertical (arydshln)
Cancel
Draw an oblique line In a tabular' column
Extended enumeration style (enumerate)
Figure 7.3: Selection menu for tables Extended tabular and array environments 1 (array)
and lists. Extended tabular and array environments 2 (mdwtab)

package, texdoc will show this file as well. The location o f a package can be found through
the com m and kpsewhich < file > , w hich yields the result in Figure 7.4 on the facing page
for the W indows com m and line. Now the file can be loaded and the description read w ith a

2T4
7.2 T a b le s as f lo a tin g o b je c ts

norm al editor. If there is no output, the package is either not installed or you have spelt the
name of the package incorrectly.

Figure 7.4: Use of the program kpsewhich on the Windows command line.

Very often, the TgX sources of the docum entation can be of help, letting you see at once 3gk sources
how certain things were achieved. All source files for TpX Live can be found at $TEXMF/texmf-
d i s t / s o u r c e / l a t e x / and for MiKTgX in the directory . . .\MiKTeX Z .SX source.1

7.2 T ables as flo a tin g o b je cts


A table of type lo n g ta b le internally increm ents the counter ta b le , even if the table itself
does not have a \ c a p t i o n command. This can lead to wrong counter values if there is another
environm ent of type t a b l e a ft e r the lo n g ta b le . In the following example, the floating
environm ent is put in front of the l o n g ta b le by TpX, but still has the w rong number.

\u se p a c k a g e {lo n g ta b le }
\c a p tio n demo
\ b e g in { lo n g t a b le } { | c | } \ h lin e
A \ t e x t t t { l o n g t a b l e } w ithout
Table 2: A table caption with \ t e x t t t { \ t e x t b a c k s la s h c a p t io n } . \ \ \ h lin e
the wrong number. \e n d {lo n g ta b le }

A normal table. \ b e g in {t a b le }
\c e n te rin g
\ca p tio n {A ta b le cap tio n w ith
th e wrong number. }
A l o n g t a b l e without \c a p tio n . \ b e g in { t a b u la r } { | c | } \ h lin e
A normal t a b l e . \ \ \ h lin e
\e n d {ta b u la r}
\e n d {ta b le }

page 1

'Adapt this path accordingly for versions of MiKTjrX other than 2.8.

215
Q u e s tio n s a n d a n s w e r s

The problem can be fixed by decrementing the table counter tab le after a longtable
without caption.

\caption demo \ u s e p a c k a g e { lo n g ta b le }

\ b e g in { lo n g t a b le } { | c | } \ h lin e
A \ t e x t t t { lo n g t a b le } w ith o u t
Table 1 : A table caption with \ t e x t t t { \ t e x t b a c k s la s h c a p t io n } . \ \ \ h lin e
the correct number. \ e n d { lo n g ta b le }
\addtocounter{table}{-l}% % % % %
A normal table.
\ b e g in { t a b le }
\ c e n t e r in g
\ c a p tio n { A t a b le c a p tio n w ith th e c o r r e c t num ber.}
A longtable without \caption. \ b e g in { t a b u la r } { | c | } \ h lin e
A norm al t a b l e . \ \ \ h l i n e
\ e n d { ta b u la r}
\e n d { ta b le }

pagel

216
Bibliography

[1 ] Paul W. Abrahams, Karl Berry und Kathryn Hargreaves. TgK for the Impatient,
2003. ctan: /in fo /im p a tie n t/b o o k .p d f

[2 ] Hendri Adriaens. The xkeyval package, 2005. ctan: /macros/latex/contrib/xkeyval/

[3] Hendri Adriaens und Uwe Kern, »xkeyval - new developments and mechanism in key
handling«. TUGboat, 25(2): 194-198, 2004.
[4] Donald Arseneau. The th re e p a rtta b le package, 2003. Version 3.0.
ctan : / m a c r o s / la te x / c o n tr ib / ltx m is c /

[5] Donald Arseneau. The ta b ls package, 2006. Version 3.5.


ctan : / m a c r o s / la te x / c o n tr ib / ltx m is c /

[6 ] Donald Arseneau. The ta b to package, 2006. Version 1 .0 .


ctan : / m a c r o s / la te x / c o n tr ib / ltx m is c /

[7] Enrico Bertolazzi. The easytable package, 2 0 0 1 . Version 1 .0 .


ctan:/macros/latex/contrib/easy/

[8 ] Johannes Braams und Theo Jurriens. The super ta b u la r package, 2004.


Version 4.1e. c t a n : / m a c r o s / la t e x / c o n t r ib / s u p e r t a b u la r /

[9] D. Carlisle und S. Rahtz. The keyval package, 2 0 0 1 .


ctan: / m a c r o s / la t e x / r e q u ir e d / g r a p h ic s /

[10 ] David Carlisle. The d e la rra y package, 1994. Version 1 .0 1 .


ctan : / m a c r o s / la te x / c o n tr ib / to o ls / 1

[1 1 ] David Carlisle. The hhline package, 1994. Version 2.03.


ctan:/macros/latex/contrib/carlisle/
B IB L IO G R A P H Y

[12 ] David Carlisle. The ltx ta b le package, 1995. Version 0.2 .


ctan : / m a c r o s / la te x / c o n tr ib / c a r lis le /

[13] David Carlisle. The blkarray package, 1999. Version 0.05.


ctan: /macros/latex/contrib/carlisle/blkarray/

[14] David Carlisle. The tabularx package, 1999. Version 2.07.


ctan: / m a c r o s / l a t e x / c o n t r i b / c a r l i s l e /

[15] David Carlisle. The c o lo rtb l package, 2001. Version O.lj.


ctan : / m a c r o s / la te x / c o n tr ib / c a r lis le /

[16] David Carlisle. The dcolumn package, 2001. Version 1.06.


ctan : / m a c r o s / la te x / c o n tr ib / c a r lis le /

[17] David Carlisle. The longtable package, 2004. Version 4.11.


ctan : / m a c r o s / la t e x / r e q u ir e d / t o o ls / lo n g t a b le . p d f

[18] David Carlisle. The tabulary package, 2008. Version 0.9.


ctan : / m a c r o s / la te x / c o n tr ib / c a r lis le /

[19] Hans-Peter Dorr. The exceltex package, 2006. Version 0.51.


ctan : / m a c r o s / la te x / c o n tr ib / x ta b /

[20] Wybo Dekker. The ctable package, 2009. Version 1.15.


ctan:/macros/latex/contrib/ctable/

[2 1 ] Michael Downes. Short Math Guide for Щ[?Х. American Mathematical Society,
2002. h t t p : / / w w w .a m s . o r g / t e x / s h o r t - m a t h - g u i d e . h t m l

[22 ] Jean-Pierre Drucbert. The Tabbing package, 1997. Version 1 .0.


ctan: /macros/latex/contrib/Tabbing/

[23] Victor Eijkhout. ТрХ by Topic, 1992. h t t p :/ / w w w .e ijk h o u t .n e t / t b t /

[24] Simon Fear. The booktabs package, 2005. Version 1.6183.


ctan : / m a c r o s / la t e x / c o n t r ib / b o o k ta b s /

[25] Anil Goel. The lta b le x package, 1995. Version 1.0.


ctan : / m a c r o s / la te x / c o n tr ib / lta b le x /

[26] Michel Goossens, Frank Mittelbach, Sebastian Rahtz, Denis Roegel und Herbert Vofi.
The ETeX Graphics Companion: Illustrating Documents with TgX and PostScript, Second
Edition. Tools and Techniques for Computer Typesetting. Addison-Wesley, Reading,
MA, 2007.
[27] Eckhart Guthohrlein. The rc co l package, 2005. Version 1 .2 c.
ctan:/macros/latex/contrib/rccol/

[28] Alan Hoenig. TpX Unbound: ETjX & T^X Strategies, Fonts, Graphics, and More. Oxford
University Press, London, 1998.
[29] Uwe Kern. Color extensions with the xcolor package, 2007. Version 2 .1 1 .
ctan: / m a c r o s / l a t e x / c o n t r i b / x c o l o r /

218
B IB L IO G R A P H Y

[30] Donald E. Knuth. The TpXbook. Addison Wesley Professional, 2 1 . Auflage, 1986.
[31] Markus Kohm. »Satzspiegelkonstruktionen im Vergleich«. Die T on isch e Komödie,
14(4):28-48, 2002. h t t p ://www.da nt e.de/dante/DTK/PDF/komoedie_2002_4.pdf

[32] Helmut Kopka. IflpX—Eine Einführung. Addison-Wesley Verlag, Bonn, Germany, 3 .


Auflage, 2000. ISBN 3-89319-338-3.
[33] Helmut Kopka und Patrick W. Daly. Guide to Efl^X. Addison-Wesley, Reading, MA, 4.
Auflage, 2004.
[34] Leslie Lamport. ifl^X: A Document Preparation System: User’s Guide and Reference
Manual. Addison-Wesley, Reading, MA, 2 . Auflage, 1994. ISBN 0-201-52983-1.
[35] Olga Lapko. The makecell package, 2009. Version O.le.
ctan:/macros/latex/contrib/makecell/

[36] Jerry Leichter und Piet van Oostrum. The bigdelim package, 1994. Version 1 .
ctan:/macros/latex/contrib/multirow/

[37] Jerry Leichter und Piet van Oostrum. The b ig stru t package, 1994. Version 1 .
ctan: /macros/latex/contrib/multirow/

[38] Jerry Leichter und Piet van Oostrum. The multirow package, 2004. Version 1 .6 .
ctan:/macros/latex/contrib/multirow/

[39] Hubert Gäßlein und Rolf Niepraschk. The pict2e package, 2004.
ctan:/macros/latex/contrib/pict2e/

[40] Andres Löh. The polytable package, 2005. Version 0 .8.2 .


ctan:/macros/latex/contrib/polytable/

[41] Frank Mittelbach und David Carlisle. The array package, 2008. Version 2.4c.
ctan:/macros/latex/contrib/tools/

[42] Frank Mittelbach, Michel Goosens, David Carlisle und Johannes Brahms. The EüpX
Companion. Pearson Education, Reading, MA, 2 . Auflage, 2004. The general book to
etex .

[43] Lapo Filippo Mori. »Tables in ET]pX 2 £: Packages and Methods«. The PracT^C Journal,
(1):1—38, 2007.
[44] Hiroshi Nakashima. The arydshln package, 2004. Version 1.71.
ctan:/macros/latex/contrib/arydshln/

[45] Josselin Noirel. The cellspace package, 2009. Version 1 .6 .


ctan:/macros/latex/contrib/cellspace/

[46] Heiko Oberdiek. The t abularkv package, 2006. Version 1 .1 .


ctan:/macros/latex/contrib/oberdiek/

[47] Heiko Oberdiek. The tabularht package, 2007. Version 2.5.


ctan:/macros/latex/contrib/oberdiek/

219
B IB L IO G R A P H Y

[48] Scott Pakin. The Comprehensive ШрХ Symbol List. CTAN, 2009.
ctan: /info/symbols/comprehensive/symbol-a4 .pdf

[49] Hubert Parti. »German TeX«. TUGBoat, 9(l):70-72, 1988.


[50 ] Axel Reichert. Satz von Tabellen, 19 9 9 . ctan: /info/german/tabsatz/tabsatz. pdf

[51] Wayne Rochester. The warpcol package, 2007. Version 1.0c.


ctan:/ macros/latex/contrib/warpcol/

[52] Sigitas Tolusis. The stabular package, 1998. ctan: /macros/latex/contrib/sttools/

[53] Nicola Talbot. Databases and data manipulation, 2009. Version 2.03.
ctan:/ macros/latex/contrib/datatool/

[54] The ЩеХ team, clsguide - documentation pf íflpX class and package writing,
2003. ctan: /macros/latex/base/clsguide.pdf

[55] Herbert Voß. PSTricks - Grafik mit PostScript für TjX und fflpX.
DANTE/LOB-media.de, Berlin, 5. Auflage, 2008.
[56] Herbert Voß. Mathematiksatz mit Щ^Х. DANTE/LOB-media.de, Berlin, Heidelberg,
2009.
[57] Herbert Voß. ВДеХ Referenz. DANTE/LOB-media.de, Berlin, Heidelberg, 2 . Auflage,
2010 .
[58] Michael Wiedmann. References for ТрХ and Friends, 2005.
http ://www.miwie.org/tex-refs/

[59] Peter Wilson. The xtab package, 2008. Version 2.3c.


ctan:/macros/latex/contrib/xtab/

[60] Mark Wooding. The mdwtab package, 1998. Version 1.9.


ctan:/ macros/latex/contrib/mdwtab/

[61] Joseph Wright. The siu n itx package, 2009. Version 1.3c.
ctan:/ macros/latex/contrib/siunitx/

[62] Koichi Yasuoka. The slashbox package, 1993. ctan: /macros/latex/contrib/slashbox/

220
Index of commands and
concepts

To make it easier to use a command or concept, the entries are distinguished by their “type”
and this is often indicated by one of the following “type words” at the beginning of an entry:

boolean, counter, document class, env., file, file extension, font, font encoding,
key value, keyword, length, option, package, program, rigid length, or syntax.

The absence of an explicit “type word” means that the “type” is either a TgX or KT£X
“command” or simply a “concept”.
Use by, or in connection with, a particular package is indicated by adding the package
name (in parentheses) to an entry.
An italic page number indicates that the command is demonstrated in a source code
snippet or in an example on that page.
When there are several page numbers listed, bold face indicates a page containing impor­
tant information about an entry.
(S y m b o ls -B ) In d e x o f c o m m a n d s a n d c o n c e p ts

Symbols \addlinespace (booktabs), 47, 52


* notation, 5 \addparagraphcolumntypes (cellspace), 54
(blkarray), 44 \addtocounter,143
(hhline), 64 \addtolength, 53
\+, 13, 14, 15 \ADLdrawingmode (arydshln), 30
- notation \ADLnullwide (arydshln), 29
(blkarray), 44 \ADLsomewide (arydshln), 29
(hhline), 64 \aftergroup, 174
\-, 13, 14, 15 alignment, 171
. notation Alph counter, 71
(blkarray), 44 alph counter, 71
(demo), 174 amsmath package, 35, 39, 68
(mdwtab), 73 arabic counter, 71
/ notation (mdwtab), 73 array env., 3, 31, 36-38, 72, 83, 107, 118, 119
: notation (tabularht), 85
(arydshln), 28, 29 array package, 2-4, 7, 8, 17, 21-27, 53, 54, 65, 74, 151,
(blkarray), 44 159
(easytable), 63 \arraybackslash (array), 21, 22, 88, 143
(hhline), 64 arrayht env. (tabularht), 85
:= notation (spreadtab), 78 \arraylinesep rigid length (tabls), 83
; notation (arydshln), 28 \arrayrulecolor (colortbl), 115, 116, 120-122, 124, 168,
< notation (array), 22, 24, 174 169
\<, 13 \arrayrulewidth, 116
(polytable), 107 \arrayrulewidth rigid length, 4, 7, 8, 115
= notation (array), 29
(blkarray), 44 \arr ay stretch, 53, 196, 199
(hhline), 64 arydshln package, 27-29
\=, 13-16 .aux file extension, 169
(polytable), 107 (longtable), 137, 138
> notation (array), 22, 24 (supertabular), 151
\>, 13-16, 170 (xtab), 159
(polytable), 107
# notation B
(blkarray), 44 b notation, 53, 65, 66, 68, 69
(hhline), 64 (array), 23, 65
(mdwtab), 72 (bigstrut), 32, 34
& notation, 60 (blkarray), 44
(blkarray), 38 (easytable), 62
" notation (blkarray), 44 (hhline), 64
\<m>acro (spreadtab), 79 (mdwtab), 73
p column, 33
(tabularkv), 87
r column, 33
(threeparttable), 91
\\, 6, 21, 22, 56, 60, 133, 151, 158,168
\backslashbox (slashbox), 74, 75, 76, 83
(tabls), 83
backspace, 73
\\*,126 \BAenum (blkarray), 40
$ notation, 22, 23, 73
BAenumi counter (blkarray), 40, 41
~ notation
\BAextraheightafterhline (blkarray), 43
(blkarray), 44
\BAextrarowheight (blkarray), 43
(hhline), 64
\BAhhline (blkarray), 43, 44, 45
\ \ 13, 15, 16
\BAhline (blkarray), 43, 44, 45
\BAmulticolumn, 38-40
A (blkarray), 38
\a, 13, 14,109 \BAmultirow (blkarray), 40
\abovedisplayskip rigid length, 33 \BAnoalign (blkarray), 40, 41
\aboverulesep rigid length (booktabs), 47 \BAnoalign* (blkarray), 40
\abovetopsep rigid length (booktabs), 47 base line, 26, 68
add-decimal-zero Option (siunitx), 103 \baselineskip rigid length, 166

222
In d e x o f c o m m a n d s a n d c o n c e p ts (C )

\BAtablenotes (blkarray), 40 cell colour, 111


\BAtablenotesfalse (blkarray), 40 \cellalign (makecell), 66, 67, 68
\BAtablenotestrue (blkarray), 40, 42, 43 \cellcolor
\begingroup, 17, 89 (colortbl), 113, 114, 115
\belowbottomsep rigid length (booktabs), 47 (xcolor), 118
\belowrulesep rigid length (booktabs), 47 \cellrotangle (makecell), 66, 67
\bfseries, 22 \cellset (makecell), 66, 67
\bgroup, 89 cellspace package, 53, 54
\bigdelim (bigdelim), 36, 37 \cellspacebottomlimit rigid length (cellspace), 53
\bigskipamount rigid length, 129,130 \cellspacetoplimit rigid length (cellspace), 53
\bigstrut,30 center Option (ctable), 55, 58
(bigstrut), 32, 34, 35 center value
(multirow), 31, 32 (siunitx), 103
bigstrut package, 32, 34 (tabularkv), 86, 87
\bigstrutjot rigid length (bigstrut), 35 center-decimal-marker value (siunitx), 103, 105
bl notation (makecell), 66 \Centering (ragged2e), 25
blkarray package, 37-46, 64 \centering, 21, 25
block env. (blkarray), 38, 39, 40-44, 46 centring, 16
block* env. (blkarray), 39, 41 \Chline (demo), 122
blockarray env. (blkarray), 38-44, 45 \cline, 6, 7, 9, 31, 46, 47, 48, 49, 50, 73, 83, 116
bold font, 22 \cmidrule (booktabs), 47, 48, 49, 50
booktabs package, 2, 21, 46-50, 52, 54, 57, 63, 124 \cmidrulekern rigid length (booktabs), 47, 49
\bordermatrix, 39 \cmidrulesep rigid length (booktabs), 47
botcap Option (ctable), 55 \cmidrulewidth rigid length (booktabs), 47
\botstrut (makecell), 69 cmy notation (xcolor), 117
bottom value (tabularkv), 86 C M Y K , 123
\bottomcaption cmyk notation
(supertabular), 154 (color), 111
(xtab), 162 (xcolor), 117
\bottomrule (booktabs), 47, 48, 51, 52, 57 Xcolor
\bottopstrut (makecell), 69 (colortbl), 115
\Btab (demo), 11 (xcolor), 121
color package, 54, 111, 116
c colortbl package, 37,111-116,117, 118,120,122
C notation, 208 colour, 111
(tabulary), 90 cell, 111
c notation, 4, 53, 65, 91, 96 column, 111
(easytable), 62, 63 row, 111
(longtable), 125, 130 colour model, 111, 117
(mdwtab), 72, 73 column, 36
(tabularkv), 87 space, 87
(threeparttable), 91 \column (polytable), 107
calc package, 53, 85 column colour, 111
cap Option (ctable), 55 column definition, 4, 8, 23, 26
\caption, 93, 133 column distance, 5
(longtable), 131, 132, 133-136 column separator, 41
(Itablex), 140 column space, 5
(threeparttable), 91 column spacing, 101
caption Option (ctable), 55, 57 column type, 23, 31, 39, 87, 96, 101, 143
caption package, 154, 162 column width, 87
\caption* \columncolor
(longtable), 131 (colortbl), 111, 112-115
(Itablex), 140 (xcolor), 118, 119
captionskip Option (ctable), 55 comma, 98
\Ccline (demo), 122 convention, 3
\cdashline (arydshln), 28, 29 conversion, 175
\cdot, 99, 101 counting, 71

223
(D-G) In d e x o f c o m m a n d s a n d c o n c e p ts

csv format, 175 etex package, 62


csvtools package, 58 eurosym package, 1
\ctable (ctable), 54, 56-58 Excel, 175
ctable package, 54, 56 exceltex package, 175,176
exceltex program, 175, 176
D explicit-sign Option (siunitx), 103
exponent-base Option (siunitx), 102
D notation, 174, 182-184
exponent-product Option (siunitx), 102, 105
(dcolumn), 98, 99, 100, 174
\extracolsep, 5, 6, 87, 151, 152
\dashlinedash rigid length (arydshln), 29, 30
(array), 159, 160
\dashlinegap rigid length (arydshln), 29
\extrarowheight rigid length (array), 21
datatool package, 1, 2, 58, 61, 62,175
\extrarulesep rigid length (tabls), 83
dcolumn package, 96, 98, 100, 105, 174
\extratabsurround rigid length (array), 27
decimal co mm a, 98
decimal places, 98
decimal point, 98 F
decimal separator, 173 \fbox, 63, 87
\defaultaddspace rigid length (booktabs), 47 \fboxsep rigid length, 62
\defaultcolumn (polytable), 107 figure Option (ctable), 55
\definecolor (color), 112-115 filecontents env., 142
\definecolorseries (xcolor), 121 (Itxtable), 142
delimiter, 39 filecontents package, 142
\depth, 30 filecontents* env. (Itxtable), 142
document preamble, 38 \f ill, 85
documentation, 213 \fill rigid length, 5, 6, 129, 130
dot, 98 fine-tuning, 33
\dotfill, 170 \firsthdashline (arydshln), 28, 29
\doublerulesep rigid length, 50, 72, 73, 115 \firsthline (array), 27, 28
\doublerulesepcolor (colortbl), 115, 116 \FL (ctable), 54, 57
\DTLforeach (datatool), 58, 59-61 floating environment, 54, 125, 191
\DTLforeach* (datatool), 58 fltpoint package, 102
\DTLiffirstrow (datatool), 59, 60 footer, 137, 140, 148
\DTLifoddrow (datatool), 59, 60 footnote, 12, 40, 42, 136
\DTLisopenbetween (datatool), 59, 60, 61 \footnote, 12, 42, 43, 136
\DTLloaddb (datatool), 58 footnote counter, 12
DTLrowi counter (datatool), 59 (Itxtable), 143
DTLrowii counter (datatool), 59 footnote counter, 16
\DTLsort (datatool), 61 footnote counting, 136
\DTLsort* (datatool), 61 footnote rule, 156, 164
dvips program, 116 \footnotemark, 12, 16, 17, 143, 155
\footnotetext, 12, 16, 17, 42, 43, 55, 143, 155
E fp package, 76
\FPseed (fp), 81
e notation (easytable), 62, 63
framebg Option (ctable), 55
easy package, 62
framefg Option (ctable), 55
easytable package, 62, 63
framerule Option (ctable), 55
\egroup, 89
framesep Option (ctable), 55
\eline (makecell), 71, 72
\fromto (polytable), 107
\emptyrow (stabular), 145
function graph, 58
encoding, 167
\endfirsthead (longtable), 131, 132-135
\endfoot (longtable), 131, 132-135 G
\endgroup, 17, 89 \Gape (makecell), 68, 69
\endhead (longtable), 131, 132-135 \gape (makecell), 68, 69
\endlastfoot (longtable), 131, 132-135 graphicx package, 196
\enspace, 194, 195 Gray notation (xcolor), 117
environ package, 208 gray notation (xcolor), 117
eqnarray env., 35 group, 128
\Etab (demo), 11 group-separator Option (siunitx), 102, 105, 106

224
In d e x o f c o m m a n d s a n d c o n c e p ts (H -L )

H K
h notation (mdwtab), 73 keyval package, 86
\hdashline \kill, 13, 14, 16, 139
(arydshln), 28, 29 (longtable), 139
(celIspace), 53, 54 kpsewhich program, 214
(datatool), 59
(dcolumn), 99 L
(tabularht), 85, 86
L notation (tabulary), 90
header, 24, 137,140, 148
1 notation, 4, 5, 53, 55, 57, 65, 91, 96,107, 124, 184-191
\heavyrulewidth rigid length (booktabs), 47
(booktabs), 48, 49
\height, 30
(easytable), 62, 63
height Option (tabularkv), 86, 87
(longtable), 125,130
\hhline (hhline), 64, 65 (makecell), 66
hhline package, 43, 64, 116 (mdwtab), 72
\hiderowcolors (xcolor), 118, 120, 121 (slashbox), 75
\hline, 6, 7, 8, 9, 46, 47, 49, 50, 83, 118, 122, 126, 153, 161 label, 59
(stabular), 145 \label, 134
(tabls), 83 label Option (ctable), 55
\hlx (mdwtab), 72, 73 last notation (xcolor), 121
\hrulefill, 170, 194 \lasthdashline (arydshln), 28, 29
HSB notation (xcolor), 117 \lasthline (array), 27, 28
hsb notation (xcolor), 117 \ldelim (bigdelim), 36, 37
\hsize, 88, 89 \Left (blkarray), 40
\hsize rigid length, 88 \left, 36, 118
\hspace, 15, 24, 126 left Option (ctable), 55, 58
HTML notation (xcolor), 117 left value (siunitx), 103
hyperref package, 117 left-aligned, 25
hyphenation, 24, 25 \lightrulewidth rigid length (booktabs), 47
line, 21, 43
I coloured, 7
ifthen package, 53 counter, 40
\inccell, 175 depth, 21
\includegraphics, 196 feed, 32
\inctab, 175 height, 21
inline mode, 22 horizontal, 7, 43
\input,142, 169 spacing, 7, 53
vertical, 6, 26, 43
input env., 169
\linewidth rigid length, 87-89 ,109
input-decimal-markers Option (siunitx), 102, 105, 106
list of tables, 132, 133
input-digits Option (siunitx), 102, 105, 106
listings package, 14,107
input-exponent-markers Option (siunitx), 102
\LL (ctable), 54, 57
input-ignore Option (siunitx), 102
load-configuration Option (siunitx), 102
input-product Option (siunitx), 103
log file, 25
input-quotient Option (siunitx), 102
longtable
input-signs Option (siunitx), 103
table caption, 135
\insertTableNotes (threeparttablex), 93, 94
longtable env.
inter-unit-separator Option (siunitx), 103
(longtable), 52, 73, 125, 126-139, 142, 143, 151, 159,
\interrowfill (tabularht), 85
169, 215
\interrowspace (tabularht), 85, 86
(Itxtable), 143
\interrowstart (tabularht), 85, 86
longtable package, 52,125-139, 140,141
\interrowstop (tabularht), 85, 86
longtable* env., 20
\item, 91
\LongTableWidth rigid length (demo), 169
(threeparttable), 93
lot, 132, 133
lr notation (slashbox), 75
J \ltablex
J notation (tabulary), 90 (Itablex), 140, 141
\jot rigid length, 35, 68, 69 (Itxtable), 143

225
(M-P) In d e x o f c o m m a n d s a n d c o n c e p ts

Itablex package, 139-141 \newpage, 126, 129


\LTcapwidth rigid length (longtable), 135, 138 \nline (makecell), 71, 72
\LTchunksize rigid length (longtable), 137, 138 \NN (ctable), 54, 56
\LTleft rigid length (longtable), 130 \noalign, 30, 85, 118, 167, 168, 169, 191
\LTpost rigid length (longtable), 130, 131 \nodefaultcolumn (polytable), 107
\LTpre rigid length (longtable), 130, 131 \nofiles, 139
\LTright rigid length (longtable), 130 \nomakegapedcells (makecell), 69
\LTXtable (Itxtable), 142, 147, 195 \nopagebreak, 126
Itxtable package, 139,141-144, 151, 159 \normalbaselineskip rigid length, 15, 152, 160, 165, 172
(xtab), 166
M nosuper Option (ctable), 55
notespar Option (ctable), 55
m notation, 53
null, 61
(array), 23, 65, 89
number
\makecell (makecell), 65, 66-68, 70
column, 96
makecell package, 65, 68, 70, 71
\number, 120, 121
\makecell* (makecell), 65, 66
\NumTabs (tabto), 108, 109
\makegapedcells (makecell), 69
matrix, 36, 117
matrix env., 77 o
maxwidth Option (ctable), 55, 57 \omit, 167
\mbox, 39 OpenOffice, 175
Me notation (mdwtab), 72, 73 output driver, 85
m d w t a b package, 72, 74 output-decimal-marker Option (siunitx), 102,103,
\midrule (booktabs), 47, 48, 51, 52, 57 105, 106
mincapwidth Option (ctable), 55 oztex program, 116
minipage env., 16, 24,146,149, 156,157,164
\ML (ctable), 54, 57 P
Ml notation (mdwtab), 72
P notation (warpcol), 96, 97
\morecmidrules (booktabs), 47, 50
p notation, 4, 5, 21, 31, 53, 65, 87, 89, 90
mpsupertabular env. (supertabular), 149, 150, 156
p column, 31
mpsupertabular* env. (supertabular), 149, 150
page break, 12,125,128,171
mpxtabular env. (xtab), 157,158,164
\pagebreak, 73
mpxtabular* env. (xtab), 157,158
Pakete
Mr notation (mdwtab), 72
amsmath, 35, 39, 68
multicol package, 170
array, 2-4, 7, 8, 17, 21-27, 53, 54, 65, 74,151, 159
multicols env. (multicol), 171
arydshln, 27-29
\multicolumn, 8, 9, 17, 24, 26, 38, 41, 72, 76, 81, 96, 114,
bigstrut, 32, 34
118, 132, 133, 135, 139, 169
blkarray, 37-46, 64
multiply defined labels, 134
booktabs, 2, 21, 46-50, 52, 54, 57, 63, 124
\multirow, 35
calc, 53, 85
(bigstrut), 34, 35
caption, 154, 162
(multirow), 30, 31-34, 35, 36, 37, 40, 47, 70
cellspace, 53, 54
multirow package, 9, 32, 70
color, 54, 111,116
multirow cell, 31
colortbl, 37, 111-116, 117, 118, 120, 122
\multirowcell (makecell), 70, 71
csvtools, 58
\multirowhead (makecell), 70, 71
ctable, 54, 56
\multirowsetup (multirow), 33
datatool, 1, 2, 58, 61, 62, 175
dcolumn, 96, 98, 100, 105,174
N easy, 62
\ncline (pst-node), 13 easytable, 62, 63
\need (demo), 172 environ, 208
\newcolumntype etex, 62
(array), 23, 24, 25, 53, 105, 174 eurosym, 1
(mdwtab), 74 exceltex, 175,176
\newcounter, 194, 195 filecontents, 142
\NewLine (demo), 128 fltpoint, 102
\newline, 7,21, 22 fp, 76

226
Index of commands and concepts (Q-R)

graphicx, 196 pie chart, 58


hhline, 43, 64, 116 p laces value (siunitx), 102
hyperref, 117 pmboxed env. (polytable), 107
ifthen, 53 polytable package, 107
keyval, 86 \poptabs, 13, 14
listings, 14, 107 pos Option (ctable), 55
longtable, 52, 125-139, 140, 141 preamble, 142
Itablex, 139-141 \pspolygon (pstricks), 181
Itxtable, 139, 141-144, 151, 159 \p s r o ta t e le f t (pstricks), 180
makecell, 65, 68, 70, 71 \ p s t i l t (pst-3d), 180
mdwtab, 72, 74 ptboxed env. (polytable), 107, 108
multicol, 170 \pushtabs, 13, 14
multirow, 9, 32, 70
pict2e, 74 Q
polytable, 107 \qquad, 23, 24
ragged2e, 22, 25, 88 \quad, 41, 178
rccol, 102
rotating, 24, 54, 67, 200, 201 R
siunitx, 102
R notation
slashbox, 74, 83
(rccol), 101, 102
spreadtab, 76, 78, 80
(tabulary), 90
stabular, 145
r notation, 4, 5, 53, 65, 66, 91, 96, 107
sttools, 145
(booktabs), 48, 49
supertabular, 149-157
(easytable), 62, 63
Tabbing, 14, 109
(longtable), 125, 130
tabls, 82-84
(mdwtab), 72
tabto, 108
(slashbox), 75
tabto-ltx, 108
ragged, 25
tabularht, 84-86 ragged2e package, 22, 25, 88
tabularkv, 86 \raggedcolumn (demo), 179
tabularx, 2, 54, 57, 85, 86, 87-89, 90, 141 \RaggedLeft (ragged2e), 25
tabulary, 90 \ra g g e d le ft,2 1 , 25
threeparttable, 91, 93, 213 \RaggedRight (ragged2e), 22, 25, 88, 89
threeparttablex, 93 \rag g ed rig h t, 21, 22, 25, 88, 143
tipa, 167 \raiseb o x , 47, 68
units, 200, 201 rccol package, 102
varwidth, 24 \rd elim (bigdelim), 36, 37
warpcol, 96 red notation (colortbl), 112
widetable, 97, 98 \r e f , 59
xcolor, 37, 56, 111, 116-121, 122 referencing, 59
xkeyval, 54 \re fste p c o u n te r, 59, 194, 195
xspace, 54 \re la x , 52, 167
xtab, 157,162 \renewcommand, 67, 89, 91
paragraph mode, 107 repetition factor, 5
\parbox, 4, 41, 135, 182 \r e s e tc o lo r s e r ie s (xcolor), 121
\p a r f il ls k ip rigid length, 128 retain -zero -ex p o n en t Option (siunitx), 102
\p arindent, 130 RGB, 123
\parskip, 130 RGB notation (xcolor), 117
\PassOptionsToPackage, 122 rgb notation
pboxed env. (polytable), 107 (color), 111
\p c lin e (pst-node), 181 (xcolor), 117, 121
\pcolbegin (warpcol), 96, 97 \R ight (blkarray), 40, 41
\pcolend (warpcol), 96, 97 \r ig h t, 36, 118
pdftex program, 116 rig h t Option (ctable), 55, 58
Perl module, 175 rig h t value (siunitx), 103
\phantom, 191 right-aligned, 25
pict2e package, 74 \ r i g h t arrow, 5

227
(S-T) Index of commands and concepts

\r n lin e (makecell), 71 spreadsheet, 76


\rnode (pst-node), 13 spreadtab env., 204, 205
Roman counter, 71 (spreadtab), 76, 77-82
roman counter, 71 spreadtab package, 76, 78, 80
\ro tateb o x , 56 SQL database, 61
(rotating), 200, 201 s ta b u la r env. (stabular), 145, 146, 147
rotating package, 24, 54, 67, 200, 201 stabular package, 145
\ r o t c e l l (makecell), 68 stab u lar* env. (stabular), 145, 147, 148
\ro th ead (makecell), 66, 67, 68 s t a r Option (ctable), 55
\ro th e a d siz e rigid length (makecell), 67 starred version, 3, 5
round-mode Option (siunitx), 102 \STautoround (spreadtab), 76, 77
rou nd-precision Option (siunitx), 102 \step co u n ter, 143
row \SThidecol (spreadtab), 78
width, 87 \SThiderow (spreadtab), 78
row colour, 111 \STnum ericfieldmarker (spreadtab), 78
row height, 84 \ s t r u t , 69
\rowcolor \stru tb o x , 30
(colortbl), 113, 114, 115 \S T savecell (spreadtab), 79
(xcolor), 118, 120, 121 \S T te x tc e ll (spreadtab), 78
\row colors (xcolor), 118, 119, 120, 121 sttools package, 145
\rowcolors* (xcolor), 118 su p ertab u la r env. (supertabular), 149, 150, 151, 152.
\rownum (xcolor), 120, 121 153-156, 170
rownum counter (xcolor), 120 supertabular package, 149-157
\r ta b (demo), 170 su pertabular* env. (supertabular), 149, 150, 151, 152
\ru le , 7, 8, 11, 84, 179 syntax, 3

s T
S notation t notation, 27, 65, 66, 68, 69
(cellspace), 53 (array), 26
(siunitx), 102, 103, 105, 106 (arydshln), 29
s notation (bigstrut), 32, 34
(mdwtab), 73 (blkarray), 44
(siunitx), 103, 106 (easytable), 62
sans-serif, 174 (hhline), 64
separator, 22 (tabularkv), 87
\setbox, 30 (threeparttable), 91
\s e tc e llg a p e s (makecell), 69 TAB env. (easytable), 62, 63, 64
\se tc o u n te r, 136 \TAB (Tabbing), 109
\s e tle n g th , 53 tab, 13, 17, 107, 108, 170
\setto w id th , 67 Xtab (tabto), 108, 109
\showcols (array), 25, 26 Tabbing env. (Tabbing), 109
\showrowcolors (xcolor), 118, 120, 121 Tabbing package, 14,109
\sh rin k h eig h t tabbing env., 12, 13-17, 107, 108, 109, 170, 171, 173
(supertabular), 152 (longtable), 139
(xtab), 160, 166 \tab b in g sep rigid length, 15
sideways Option (ctable), 55, 56, 57 \ta b c o lse p rigid length, 4-6, 10, 11, 30, 49, 75, 101, 112,
sidew aystable env. (rotating), 200, 201 113, 114, 115
\s is e tu p (siunitx), 102 (tabto), 108
siunitx package, 102 table, 117
\slashbox (slashbox), 75 colour, 37
slashbox package, 74, 83 framed, 26
\sm all, 23 head, 23
\smash (amsmath), 68 height, 84
sort, 61 nested, 9, 30
\span, 167 width, 4, 5, 7, 87
\s p e c ia lru le (booktabs), 47, 50, 51, 52 ta b le counter, 215, 216
\sp read rigid length (tabularht), 85 ta b le env., 125, 215

228
Index of commands and concepts (T)

table caption, 171 tabularkv package, 86


longtable, 135 \tab u larn ew lin e, 6, 56,133
table width, 5 (array), 17, 21,22, 128, 151, 158
table-alignm ent Option (siunitx), 103 tab u la rx env.
tab le-au to -ro u n d Option (siunitx), 103, 105 (Itablex), 140
tab le-fo rm at Option (siunitx), 103-105, 106 (tabularx), 6, 55, 87, 88, 89, 139, 142, 147, 192, 194
table-num ber-alignm ent Option (siunitx), 103, 105 tabularx package, 2, 54, 57, 85, 86, 87-89, 90, 141
table-num ber-alignm ent=center Option (siunitx), \tabularxcolum n (tabularx), 89
106 tab u la ry env. (tabulary), 90, 91
ta b le -p a rse -o n ly Option (siunitx), 103, 105 tabulary package, 90
table-sign-exponen t Option (siunitx), 105 tabulator, 12
table-text-num bers Option (siunitx), 103 tabulator key, 12
ta b le -u n it-alig n m en t Option (siunitx), 103, 106 Tc notation (mdwtab), 72
\ta b le c a p tio n texdoc program, 176, 213, 214
(supertabu lar), 154 texdoctk program, 213
(xtab), 162, 166 \ t e x t (amsmath), 39
\ta b le f ir s th e a d \te x te p s ilo n (tipa), 167
(supertabular), 153 \th e , 4
(xtab), 161 \th ead (makecell), 66, 67, 68, 70
\tab leh ead \th e a d a lig n (makecell), 66, 67, 68
(supertabular), 153 \th e a d fo n t (makecell), 66, 67, 68
(xtab), 161 \th e a d se t (makecell), 66, 67
\ta b le la s tta il \theBAenumi (blkarray), 40
(supertabular), 153 \theDTLrowi (datatool), 59-61
(xtab), 161 ThreePartTable env. (threeparttablex), 93, 94
TableNotes env. (threeparttablex), 93, 94 th re e p a rtta b le env. (threeparttable), 91, 92, 93
ta b le n o te s env. threeparttable package, 91, 93, 213
(threeparttablex), 93 threeparttablex package, 93
(threeparttable), 91, 92, 93 tig h t-sp a c in g Option (siunitx), 103
\ta b le ta il tipa package, 167
(supertabular), 153 T1 notation (mdwtab), 72
(xtab), 161 t l notation (makecell), 66
\ta b lin e s e p rigid length (tabls), 83 \tm ark (ctable), 54, 55, 56, 57
tabls package, 82-84 \tn o te
\tabpause (mdwtab), 72, 73 (ctable), 54, 55, 56, 57
\T abPositions (tabto), 108, 109 (threeparttable), 91, 93
\tabrow (stabular), 145 \tn o te x (threeparttablex), 94
\ta b to (tabto), 108 \tn o tex * (threeparttablex), 94
tabto package, 108 \ t o rigid length (tabularht), 85
\ta b to * (tabto), 108 .to e file extension (supertabular), 154
tabto-ltx package, 108 \today, 81
ta b u la r env., 4, 5, 7-12, 16, 17, 21-30, 36-38, 46-50, 53, top value (tabularkv), 86
54, 59-61, 62, 72, 73, 74, 76, 83-86, 96, 97, 107, \to p c a p tio n
122-124, 125, 149, 157, 167-170, 182-193 (supertabular), 154
(tabularht), 85 (xtab), 162
(threeparttable), 91 \to p ru le (booktabs), 47, 48, 51, 52, 57
tab u lar* env., 4, 5, 6, 97, 147, 149, 157 \to p s tr u t (makecell), 69
(threeparttable), 91 \TPTminimum rigid length (threeparttable), 93
ta b u la rh t env. (tabularht), 85, 86 \TPTnoteLabel (threeparttable), 93
tabularht package, 84-86 \TPTnoteSettings (threeparttable), 93
ta b u larh t* env. \TPTrlap (threeparttable), 93
(tabularht), 85 \TPTtagStyle (threeparttable), 93
(tabularkv), 86 Tr notation (mdwtab), 72
ta b u la rh tx env. traffic colours, 123
(tabularht), 85 \ttfa m ily , 23
(tabularkv), 86 tu rn env. (rotating), 24
tabularkv env. (tabularkv), 87 \twocolumn, 17, 170, 171, 173

229
(U-X) Index of commands and concepts

(ctable), 55 w
\tymax rigid length (tabulary), 90 warpcol package, 96
\tym in rigid length (tabulary), 90 wave notation (xcolor), 117
typography, 3 w idetable env. (widetable), 97
widetable package, 97, 98
u \width, 30
u n it-v a lu e -se p a ra to r Option (siunitx), 103 width Option
units package, 200, 201 (ctable), 55
use-xspace Option (siunitx), 103 (tabularkv), 86, 87
\usepackage, 116

V X
v notation (mdwtab), 73 X notation
valign Option (tabularkv), 86, 87 (Itxtable), 143
varwidth package, 24 (tabularx), 54, 55, 57, 87-89
\verb, 89 x Option (tabularkv), 86
\verb*, 89 X column, 88
version-1 value (siunitx), 102 xcolor package, 37, 56, 111, 116-121, 122
vertical line, 26 xdvi program, 116
\ v f i l l , 85 xkeyval package, 54
\vgap (mdwtab), 72 xspace package, 54
\v lin e , 23, 115 xtab env. (xtab), 158
(mdwtab), 72 xtab package, 157, 162
\v ru le, 26, 30, 87 x tab u lar env. (xtab), 157, 158,159, 161-166
\vspace, 85 xtabular* env. (xtab), 157, 158, 159, 160

230
P e o p le

Arseneau, Donald, 24, 82, 91, Ihlenburg, Lutz, 2 Oberdiek, Heiko, 84, 86, 169,
108, 172 170,174, 177
Jagger, Catherine, 2 Oostrum, Piet van, 30
Beccari, Claudio, 97 Junge, Stefan, 177
Bertolazzi, Enrico, 62 Jurriens, Theo, 149 Pearson, George, 175
Bordiert, Uwe, 177
Braams, Johannes, 149 Raichle, Bernd, 167,177
Kaeder, Christoph, 2 Reichert, Axel, 1,177
Carlisle, David, 21, 38, 64, 87, Kern, Uwe, 116 Robertson, Will, 208
90, 98, 111, 116,141 Knaak, Kai-Martin, 177 Rochester, Wayne A., 96
Charpentier, Jean-Côme, 177 Kohm, Markus, 177
Kotthoff, Lars, 2 Schaa, Volker RW, 2
Dekker, Wybo, 54 Schröder, Martin, 25, 88
Doerr, Hans-Peter, 175 Löh, Andres, 107
Drucbert, Jean-Pierre F., 109 Lapko, Olga, 65 Talbot, Nicola, 1, 58
Leichter, Jerry, 30 Tellechea, Christian, 76,177
Fear, Simon, 46 Tolusis, Sigitas, 145
Madsen, Lars, 93
Geiger, Christiane, 177 Wilson, Peter, 157
Marder, Joachim, 175
Goel, Anil K., 139 Wooding, Mark, 72
Guthöhrlein, Eckhart, 100 Mittelbach, Frank, 21
Wright, Joseph, 102
Gäßlein, Hubert, 74
N akashim a, H iroshi, 27 Yasuoka, Koichi, 74
Hogholm, Morten, 177 N iepraschk, Rolf, 2, 74, 177
Höppner, Klaus, 2 N oirel, Josselin, 53 Ziegenhagen, Uwe, 2,177
ALSO PUBLISHED BY UIT

Typesetting Mathematics with KTpX


Herbert Voss

From a simple equation to a mathematical treatise, this practical guide offers an in-depth
review of the mathematics typesetting aspects of the industry-leading typesetting software,
EQpX. Among the topics discussed in this manual are mathematics in line with normal text,
the software’s special mathematics mode, color in math expressions, and fonts and math.
Handy features include a list of mathematical symbols for quick-reference, a survey of a
wide range of additional mathematics packages—with a particular emphasis on the American
Mathematical Society package—and ready-to-run examples to enable users to get going
quickly.
This book will:
> Save you time by quickly giving you the detailed command syntax you require.
> Improve your mathematical typesetting by providing a reference to all the available com­
mands.
> Showing the advantages of the packages from the American MAthematical Society
> Show you how to choose suitable math fonts, using the convenient samples of font output.

C o n te n ts
1. Introduction
2. Math in inline mode with standard
3. Math in display mode with standard I$IeX
4. Math elements from standard ET^X
5. Colour in math expressions
6. AMS packages
7. Symbols
8. TpX and math
9. Other packages
10. Examples
11. Fonts and math
12. Bibliography

ISBN: 9781906860172
290 pages
A L SO PUBLISH ED BY U IT

ETgX quick reference


Herbert Voss

This book lists all ETgX macros and environments in a comprehensive reference format. (The
packages array and graphicx are included even though they are not part of standard ET^X,
because they are so widely used.) The book also lists examples of fonts for both plain text and
math, making it a convenient graphical resource.
This book will:
• Save you time by quickly giving you the detailed command syntax you require.
• Improve your ETgX by providing a quick-reference to all the available command options.
• Show you how to choose suitable fonts, using the convenient samples of font output.

C o n te n ts
1. The Standard Programs
2. Document Structure
3. Commands for Fine-Tuning your Typography
4. Command List
5. Lengths and Counters
6. Fonts
7. Packages
8. Bibliography

P r a is e fo r t h e G e r m a n E d itio n

“A n e s s e n tia l reso u rce f o r BT^C u s e r s ”

ISBN: 9781906860219
160 pages
A L SO PU BLISH E D BY U IT

PSTricks
Graphics and PostScript for

Herbert Voss

A comprehensive guide to creating and including graphics in TeX and ETgX documents. It is
both a reference work and a tutorial guide.
PSTricks lets you produce very high-quality PostScript graphics, by programming rather
than interactive drawing. For designers, data publishers, scientists and engineers, generating
graphics from data or formulas instead of having to draw manually allows large data collections
or complex graphics to be created consistently and reliably with the minimum of effort.
There are many special-purpose extensions, for visualizing data, and for drawing circuit
diagrams, barcodes, graphs, trees, chemistry diagrams, etc.
Numerous examples with source code (freely downloadable) make it easy to create your own
images and get you up to speed quickly.

C o n te n ts
1. Introduction 2. Getting Started 3. The Coordinate System 4. Lines and Polygons 5.
Circles, Ellipses and Curves 6. Points 7. Filling 8. Arrows 9. Labels 10. Boxes 11. Custom styles
and objects 12. Coordinates 13. Overlays 14. Basics 15. Plotting of Functions and Data 16.
Nodes and Connections 17. Trees 18. Manipulating Text and Characters 19. Filling and Tiling
20. Coils, Springs and Zigzag Lines 21. Exporting PSTricks Environments 22. Color Gradients
and Shadows 23. Three-Dimensional Figures 24. Creating Circuit Diagrams 25. Geographic
Projections 26. Barcodes 27. Bar Charts 28. Gantt Charts 29. Mathematical Functions 30.
Euclidean Geometry 31. Additional Features 32. Chemistry Diagrams 33. UML Diagrams 34.
Additional PSTricks Packages 35. Specials 36. PSTricks in Presentations 37. Examples

P r a is e fo r t h e G e r m a n E d itio n

“A n ice C h ris tm a s p r e s e n t - f o r m e!”

“A d e ta ile d c u r r e n t d e sc r ip tio n o f P S T ricks a n d th e h u g e v a r ie ty o f P S T ricks p a c k a g e s th a t


a re a v a ila b le , a n d w r itte n b y an e x p e rie n c e d p a c k a g e d e v e lo p e r.”

“S e a rc h in g th r o u g h lo a d s o f d iffe r e n t p ie c e s o f d o c u m e n ta tio n is a th in g o f th e p a s t T his


sin g le c o m p e n d iu m is a q u ic k referen ce to e v e r y th in g I n eed. ”

ISBN: 9781906860134
900 pages
Example illustrations from PSTricks
A L SO PU B LISH E D BY U IT

Practical TCP/IP
Designing, using, and troubleshooting
TCP/IP networks on Linux and W indow s

Niall Mansfield
R e p r in te d f i r s t e d itio n

K e y b e n e f it s
1. Explore, hands-on, how your network really works. Build small test networks in a few
minutes, so you can try anything out without affecting your live network and servers.
2. Learn how to troubleshoot network problems, and how to use free packet sniffers to see
what’s happening.
3. Understand how the TCP/IP protocols map onto your day-to-day network operation - learn
both theory and practice.
W h a t r e a d e r s h a v e s a id a b o u t t h is b o o k

“B efore th is b o o k w a s re le a se d I w a s e a g e rly se a rc h in g f o r a book th a t co u ld b e u se d f o r m y


L in u x -b a se d L A N -cou rse. A f te r th e release o f th is boo k I sto p p e d m y se a rc h in g im m e d ia te ly ”
Torben Gregersen, Engineering College o f Aarhus.

"A c c u ra c y is su p e r b - w r itte n b y so m e o n e o b v io u s ly k n o w le d g a b le in th e su b je c t, a n d a b le
to c o m m u n ic a te th is k n o w le d g e e x tr e m e ly e ffe c tiv e ly ."

Tow w o n 't f i n d a b e tte r TCP/IP book!"

"An e x cellen t b o o k f o r ta k in g y o u r c o m p u te r n e tw o rk in g ca reer fr o m m ed io cre to top notch."

"Covers TCP/IP i a n d n e tw o r k in g in g e n e ra l , tr e m e n d o u s ly ."

"This b o o k h a s b een to u te d a s th e 2 1 st-c e n tu r y u p g ra d e to th e cla ssic TCP/IP Illu stra te d (b y


R ic h a rd W. S teven s). T hese a re b ig b o o ts to fill, b u t P ra c tic a l TCP/IP d oes an im p re ssiv e job.
In o v e r 800 p a g e s o f w e ll-o r g a n iz e d a n d w e ll-illu s tr a te d te x t, th e re is n o f a t , b u t r a th e r a
lea n a n d - y e s - p r a c tic a l tr e a tm e n t o f e v e r y m a jo r TCP/IP n e tw o r k in g c o n c e p t."

"It's a n id e a l b o o k f o r b e g in n e r s, p r o b a b ly th e o n ly o n e n e e d e d f o r th e f i r s t a n d se c o n d
s e m e ste r s o f a u n iv e r s ity n e tw o r k in g course. ... (B u t it is n o t a b o o k j u s t f o r b eg in n ers. ...)"

ISBN: 9781906860363
880 pages
A L SO PU BLISH ED BY U IT

The Exim SMTP Mail Server


Official Guide for Release 4

Philip Hazel
S e c o n d e d itio n

Email is one of the most widely used applications, and Exim is one of the most widely used mail
servers, handling mail for tens of millions of users daily.
Exim is free software. It’s easy to configure. It’s scalable, running on single-user desktop
systems as well as on ISP servers handling millions of users. (It’s the default server on many
Linux systems, and it’s available for countless versions of UNIX.)
Exim is fast, flexible, and reliable. It is designed not to lose messages even if your server
machine crashes. It can be used as a secure Internet-facing front-end to other, proprietary, mail
systems used internally in your organization.
Exim supports lookups from LDAP servers, SQL databases, and other data sources, letting
you automate maintenance and configuration. It can work in conjunction with other tools for
virus-checking and spam-blocking, to reject unwanted emails before they even enter your site.
This book will help you deploy Exim as your SMTP email server throughout your organiza­
tion, and to configure, tune, and secure your Exim systems.

P r a is e fo r t h e F ir st E d itio n

“The b o o k is s im p ly a m a z in g . I f i n d th e fo r m a t/s ty le /w h a te v e r 100 tim e s b e tte r th a n [o th e r


d o c u m e n ta tio n ]. ”

“I f th e r e ’s e v e n a w h if f o f a c h a n c e o f y o u h a v in g to c o m e in to c o n ta c t w ith E x im o r its
r u n tim e c o n fig u ra tio n , th e n I c a n d o n o th in g else b u t s tr o n g ly r e c o m m e n d th is book. T he
d e ta il’s th ere in sp a d e s, it rea d s v e ry well, a n d is a fin e c o m p le m e n t to th e referen ce m a n u a l.”

“The b o o k e x ceed s m y e x p e c ta tio n s. ”

“W ell p r e s e n te d a n d e a s y to f o l lo w ”

“A n e x c e lle n t b o o k th a t is v e r y w e ll w r itte n ”

“So w e ll w r itte n I lea rn n e w th in g s e v e ry tim e I o p en i t ”

ISBN: 9780954452971
xviii + 622 pages
A L SO PU BLISH E D BY U IT

The Joy o f X
The architecture o f the X w indow system

N iall M ansfield

This is a reprint of the 1993 classic, describing the architecture of the X window system - the
de facto standard windowing system for Linux, UNIX and many other operating systems. The
book has three sections:
1. X in a nutshell - a quick overview.
2. How X works, in detail, and how the user sees it.
3. Using the system, system administration, performance and programming.
The book is written in a clear, uncomplicated style, with over 200 illustrations. For maximum
accessibility, it has a flexibile, modular structure that makes it easy to skip to the sections that
interest you. The book has been widely recommended as a course text.

Niall Mansfield founded the European X window system User Group. He also wrote T he X
w in d o w sy s te m : a u ser's g u id e , and the widely-acclaimed P ra c tic a l TCP/IP.

P r a is e f o r T h is B o o k

“U ser in te rfa c e s com e a n d go, b u t X re m a in s th e s ta n d a r d w in d o w s y s te m a cross a ra n g e o f


o p e ra tin g sy ste m s. M a li's book, The J oy o fX , s till offers an e x cellen t look in to h o w X w o rk s
a n d h o w to m a k e i t w o rk b e tte r f o r you .
Keith Packard, X.org project leader

“I f y o u a re n e w to th e X W in d o w S y s te m e n v ir o n m e n t, w e s tr o n g ly s u g g e s t p ic k i n g u p a
b o o k su ch a s The J o y o f X " Eric Raymond, in the L i n u x X F r e e 8 6 H O W T O

“a g r e a t little b o o k c a lle d T h e J o y o f X b y N ia ll M a n s fie ld th a t ta u g h t m e m u c h o f w h a t I


k n o w ." Jeff Duntemann’s ContraPositive Diary

((M y p e rs o n a l to u ch sto n e w h en lo o k in g f o r a b ro a d in tro d u c tio n to a ll th in g s X is The J o y o f


X . . . b y N ia ll M a n s fie ld ” Peter Collinson

ISBN: 9781906860004
xii + 372 pages
A L SO PUBLISH ED BY U IT

Alternative DNS Servers


Choice and deployment, and optional SQL/LDAP back-ends

Jan-Piet Mens

This book examines many of the best DNS servers available. It covers each server’s benefits
and disadvantages, as well as how to configure and deploy it, and integrate it into your network
infrastructure. It describes the different scenarios where each server is particularly useful, so
you can choose the most suitable server for your site. A unique feature of the book is that it
explains how DNS data can be stored in LDAP directories and SQL databases, often required for
integrating DNS into large-organization infrastructures.
Other important topics covered include: performance, security issues, integration with DHCP,
DNSSEC, internationalization, and specialized DNS servers designed for some unusual purposes.

P r a is e fo r T h is B o o k

“T he f i r s t b o o k to d e sc rib e N S D a n d U n b o u n d in e x c e lle n t d e ta il. ”


NLnet Labs, authors o f NSD and Unbound

“F in a lly - a clear ; in -d e p th a n d a ccessible g u id e to u sin g B IN D -D L Z IA m u s t re a d f o r a n yo n e


c o n sid e rin g a lte r n a te D N S servers. ”
Rob Butler, BIND-DLZ project creator and author

‘T a k e s th e r e a d e r th ro u g h th e p r o c e s s o f c o n fig u rin g th e p r o g r a m f r o m b a sic s to a d v a n c e d


topics. ” Simon Kelley, author o f dnsmasq

“A n in fo rm a tiv e a c c u ra te g u id e f o r a n y o n e in te r e s te d in le a r n in g m o re a b o u t D N S .”
Sam Trenholme, MaraDNS author

“A v a lu a b le so u rce o f in fo rm a tio n f o r e v e r y P ow erD N S a d m in is tr a to r ! ”


Norbert Sendetzky, author o f PowerDNS LDAP & OpenDBX back-ends

“J a n -P ie t h as d o n e a g r e a t j o b d e sc r ib in g P ow erD N S. ”
Bert Hubert, principal author o f PowerDNS

ISBN: 9780954452995
xxxvi + 694 pages
A L SO PU BLISH E D BY U IT

OpenStreetMap
Using and enhancing the free map o f the w orld

Frederik Ramm and Jochen Topf, with Steve Chilton


S e c o n d e d itio n

OpenStreetMap is a map of the whole world that can be used and edited freely by everyone. In
a Wikipedia-like open community process, thousands of contributors world-wide survey the
planet and upload their results to the OpenStreetMap database. Unlike some other mapping
systems on the Web, the tools and the data are free and open. You can use them and modify
them as you require; you can even download all the map data and run your own private map
server if you need to.
This book introduces you to the OpenStreetMap community, its data model, and the software
used in the project. It shows you how to use the constantly-growing OSM data set and maps in
your own projects.
The book also explains in detail how you can contribute to the project, collecting and
processing data for OpenStreetMap. If you want to become an OpenStreetMap “mapper” then
this is the book for you.

About the authors: Frederik Ramm and Jochen Topf both joined the OpenStreetMap project
in 2006, when they were freelance developers. Since then they have made their hobby their
profession - by founding Geofabrik, a company that provides services relating to OpenStreetMap
and open geodata.

P r a is e fo r t h e F ir st (G e r m a n ) E d itio n

“A m u st-h a v e f o r O SM n ew com ers. The ba sics are p r e s e n te d w e ll a n d are e a sy to u n d e rsta n d ,


a n d y o u do n o t n e e d to be a n IT s p e c ia lis t to c o n trib u te y o u r f i r s t d a ta to O SM a fte r a sh o r t
tim e. ”

“T he b o o k is v e r y w e ll w ritte n . I t is o b v io u s th a t th e a u th o r s h a v e a lo t o f k n o w le d g e a n d
e x p e r ie n c e ... ”

“A v e r y g o o d O S M in tro d u c tio n . G e ttin g u p to s p e e d w ith O p e n S tre e tM a p is m u ch e a s ie r i f


y o u h a v e re a d th is b o o k .”

ISBN: 9781906860110
352 pages + 32 pages of color plates
I

untitled - M e rk a a rto r vG.15.2-svn


File Edit View Gps Layers Create Feature Node to a d Relation Tools W indow Help

<f* V P U b X - - I * ; »1“ 3 V U
Download Download more Select Move Rotate Node to ad Area

Layers

5 f~ Map • None

- ■» Dirty layer

* Uploaded layer

Relations Roads POTS

M! Only features fully within the viewport

-00000.00000.00000.00000h 0m s;ppm :392.968

Example illustrations from OpenStreetMap


M o r e a b o u t t h is b o o k

Register your book: receive updates, notifications about au­


thor appearances, and announcements about new editions.
w w w .u it. co. u k /r e g iste r
News: forthcoming titles, events, reviews, interviews, pod­
casts, etc. w w w .u it.c o .u k /n e w s
Join our mailing lists: get email newsletters on topics of in­
terest. w w w .u it.c o .u k /su b sc rib e
How to order: get details of stockists and online bookstores.
If you are a bookstore, find out about our distributors
or contact us to discuss your particular requirements.
www. u it. co. u k /o rd e r
Send us a book proposal: if you want to write - even if you
have just the kernel of an idea at present - we’d love to
hear from you. We pride ourselves on supporting our au­
thors and making the process of book-writing as satisfying
and as easy as possible, w w w .u it.c o .u k /fo r-a u th o rs

UIT Cambridge Ltd.


PO Box 145
Cambridge
CB4 1GQ
England

Email: inquiries@uit.co.uk
Phone: +44 1223 302 041
D u rr
C A M B R I D GH

T y p e s e t t in g ta b le s
w ith L y J ’f X

Herbert Voss studied electrical The LaTeX typesetting system is free, and runs on just about
engineering in Hanover and any operating system. It produces book-quality output, and
Berlin, and has a Doctorate of is widely used for typesetting articles, books, mathematical works
Engineering in Power Electronics. (at which it excels), directories, dictionaries, and other publications
He has been a high-school generated from databases.
teacher of mathematics, physics
and computer science, and a This book shows you how to:
lecturer at the Free University of • Create just about any kind of table in LaTeX, from
Berlin. For several years he has simple to extremely complex.
been heavily involved in • Use color In tables.
maintaining the PSTricks suite of • Produce multi-page tables.
tools for producing very high • Use available LaTeX packages to simplify your work,
quality PostScript graphics within with ready-to-run examples for each package.
LaTeX. • Present your data in the most effective way.

Other Herbert Voss books


published by UIT include: Contents
1. Introduction
• Typesetting Mathematics 2. Packages
with LaTeX 3. Color in tables
• LaTeX Quick Reference 4. Multi-page tables
• PSTricks - Graphics and
5. Tips and tricks
PostScript for TeXand LaTeX
6. Examples
• Presentations with LaTeX 7. Questions and answers

Intended audience
• Authors, especially in the fields of mathematics,
engineering, sciences, statistics and economics, where
LaTeX is widely used.
• College staff and students.
• Database publishers, where precise table layout is
ISBN 9 7 8 1 9 0 6 8 6 0 2 5 7 important for effective data presentation.
• Book and journal publishers.

Categories:
Computer: Graphic Design
Computer: Applications and Software
w w w .u it.c o .u k

Вам также может понравиться