Indian TEX Users Group: On-Line Tutorial On L TEX
Indian TEX Users Group: On-Line Tutorial On L TEX
URL: http://www.river-valley.com/tug
Longtable
Another example
7
Exercise
Title Page
JJ II
On-line Tutorial on LAT EX J I
The Tutorial Team
Indian TEX Users Group, SJP Buildings, Cotton Hills
Page 1 of 10
Trivandrum 695014, INDIA
2000
Prof. (Dr.) K. S. S. Nambooripad, Director, Center for Mathematical Sciences, Trivandrum, (Editor); Dr. E. Krishnan,
Reader in Mathematics, University College, Trivandrum; Mohit Agarwal, Department of Aerospace Engineering, Go Back
Indian Institute of Science, Bangalore; T. Rishi, Focal Image (India) Pvt. Ltd., Trivandrum; L. A. Ajith, Focal Image
(India) Pvt. Ltd., Trivandrum; A. M. Shan, Focal Image (India) Pvt. Ltd., Trivandrum; C. V. Radhakrishnan, River
Valley Technologies, Software Technology Park, Trivandrum constitute the Tutorial team
This document is generated from LATEX sources compiled with pdfLATEX v. 14e in an Full Screen
INTEL Pentium III 700 MHz system running Linux kernel version 2.2.14-12. The
packages used are hyperref.sty and pdfscreen.sty
2000,
c Indian TEX Users Group. This document may be distributed under the terms of the Close
LATEX Project Public License, as described in lppl.txt in the base LATEX distribution, either
version 1.0 or, at your option, any later version
Quit
7 Tables Continued
Longtable
Another example
Exercise
7.1. Longtable
Title Page
The tabular and tabularx environments explained in the previous chapter provide a con-
venient way of making tables. These environments, however, fail if a table exceeds one page.
One easy trick that might do the job would be to break the tables manually but the longtable JJ II
package enables automatic page breaks by the TEX compiler.
J I
7.1.1. Constructing longtables
Page 2 of 10
The longtable environment shares most of the features with the tabular environment. We
begin with the following example that uses most of the features of the longtable environment.
Go Back
Table 7.1: A long table
1 You can also have a footnote in the table head by using \footnotemark and \footnotetext. Quit
Table 7.1: (continued)
Some lines can be really long: This column This is also a “p”* This is not.
Go Back
is a “p” column so that this row of the table column.
can take up several lines. But TEX will never
break a page within such a row.
Full Screen
\\* has the same effect as \\ but it * 16
disallows a page break after the row. * 17
command in * 18 Close
setlongtables is an obsolete
This goes at the bottom. * 0.00
Quit
Table 7.1: (continued)
Title Page
7.1.2. Optional arguments
LTchunksize This corresponds to the number of rows that TEX has to keep in memory at
one time. By default this value is set to 20, but it can be set by the user; for
Quit
instance, by \setcounter{LTchunksize}{10} or \LTchunksize=10 to
a value of 10. Changing the default does not affect page breaking. However,
TEX will run faster with a large LTchunksize, and, on the other hand, will
require more memory. The minimum value of LTchunksize can be set equal
to 1; however, it must be at least as large as the number of rows in each of the
head or foot sections (if the table head and foot need to be set).
Longtable
\LTleft The defaults in the longtable package are such that the tables are set flush
Another example
left, but are indented by the usual paragraph indentation. \LTleft con-
trols the amount of glue to the left of the table. By default this is set to Exercise
\caption[hloti]{hcaptioni}
Caption ‘Table ?: hcaptioni’, and a ‘hloti’ entry in the list of tables.
Go Back
\caption[]{hcaptioni}
Caption ‘Table ?: hcaptioni’, but no entry in the list of tables.
\caption*{hcaptioni} Full Screen
Caption ‘hcaptioni’, but no entry in the list of tables.
\footnote Used for having footnotes, but it cannot be used in the table head and foot.
Close
\footnotemark Footnotemark, can be used only in the table head and foot.
\footnotetext Footnote text: for use in the table body after a \footnotemark has been set
(should appear on the page on which the footnote is desired). Quit
\setlongtables setlongtables is an obsolete command in v4.09 of longtable and does
nothing.
\multicolumn The \multicolumn command works in the same way as in the tabular
environment. Please refer to Chapter 6 for details about this.
Longtable
Another example
7.2. Another example
Exercise
J I
Page 8 of 10
Go Back
Full Screen
Close
Quit
7.2.1. Verbatim highlights from Table (7.2):
\begin{longtable}{|p{0.9in}|p{2in}|c|}
xxxxx & xxxxx & xxxxxxxxxxxxx \kill
\caption{A simple example\label{simple}}\\ \hline\hline
\multicolumn{3}{|c|}{\bf Another long table example}\\ \hline\hline Longtable
Quit
7.3. Exercise
Try making Table (7.1); it seems to be quite strange, but it contains most of the features one
would need in order to get thoroughly acquainted with the longtable environment. It should
be quite easy if one actually reads the table itself. Look at the spaces carefully.
Longtable
Another example
Exercise
Title Page
JJ II
J I
Page 10 of 10
Go Back
Full Screen
Close
Quit