28.03.2013 Views

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

98 Chapter 4. Displayed Text<br />

If a p-type column contains \raggedright or \centering, the \\ forces a<br />

! new line within the column entry <strong>and</strong> not the end of the whole row. If this occurs<br />

in the last column, then \\ cannot be used <strong>to</strong> terminate the row; instead one<br />

must use \tabularnewline <strong>to</strong> end such a row.<br />

Since a table is a vertical box of the same sort as parbox <strong>and</strong> minipage,<br />

it may be positioned horizontally with other boxes or text (see examples<br />

in Section 4.7.3). In particular, the table must be enclosed within<br />

\begin{center} table \end{center}<br />

in order <strong>to</strong> center it on the page.<br />

4.8.2 Table style parameters<br />

There are a number of style parameters used in generating tables which L AT E X sets<br />

! <strong>to</strong> st<strong>and</strong>ard values. These may be altered by the user, either globally within the<br />

preamble or locally inside an environment. They should not be changed within<br />

the tabular environment itself.<br />

\tabcolsep is half the width of the spacing that is inserted between columns<br />

in the tabular <strong>and</strong> tabular* environments;<br />

\arraycolsep is the corresponding half intercolumn spacing for the array<br />

environment;<br />

\arrayrulewidth is the thickness of the vertical <strong>and</strong> horizontal lines within a<br />

table;<br />

\doublerulesep is the separation between the lines of a double rule.<br />

Changes in these parameters can be made with the \setlength comm<strong>and</strong> as<br />

usual. For example, <strong>to</strong> make the line thickness <strong>to</strong> be 0.5 mm, give \setlength<br />

{\arrayrulewidth}{0.5mm}. Furthermore, the parameter<br />

\arraystretch can be used <strong>to</strong> change the distance between the rows of a table.<br />

This is a multiplying fac<strong>to</strong>r, with a st<strong>and</strong>ard value of 1. A value of 1.5<br />

means that the inter-row spacing is increased by 50%. A new value is set<br />

by redefining the parameter with the comm<strong>and</strong><br />

4.8.3 Table examples<br />

\renewcomm<strong>and</strong>{\arraystretch}{fac<strong>to</strong>r}<br />

Creating tables is much easier in practice than it would seem from the<br />

above list of formatting possibilities. This is best illustrated with a few<br />

examples.<br />

The simplest table consists of a row of columns in which the text<br />

entries are either centered or justified <strong>to</strong> one side. The column widths,<br />

the spacing between the columns, <strong>and</strong> thus the entire width of the table<br />

are au<strong>to</strong>matically calculated.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!