# Spacing, Lengths, and Tables

The topics to be covered in this section of the LaTeX tutorial include fullpage, double spacing, blank space, and tables.

# Using the Full Page

LaTeX doesn't use much of the page when it formats text, only about 4.8 x 7.3 inches. Therefore, to really make use of the page to conserve paper and get more ideas per page, you want to use fullpage as one of your optional arguments to the \documentstyle commands. It appears next to the 12pt specification you have been using throughout this tutorial.

\documentstyle[12pt,fullpage]{article}

That will set the margins to about 6.5 x 8.9 inches.

# Double Spacing

There are several ways to change to double spacing for your document. Probably the most reliable and best looking is the doublespace style option. It goes up there with the 12pt and the fullpage options.

\documentstyle[12pt,fullpage,doublespace]{article}

Note that this does not doublespace footnotes or figures and tables. If the spacing is too wide, you can put the following command in your preamble:

\setstretch{1.7}

That will decrease the stretch between lines. The setstretch in double spacing is normally set to "2." If you change it to "1," you will be back into single spacing again.

You can create a single spaced environment by using:

\begin{singlespace}
\end{singlespace}

Note that the singlespace environment is not valid unless the doublespace style option has been used.

# Tables

There are three similar constructs for doing tables in LaTeX. They are:

Table
A floating "thing" in a paper.
Usually "see Table 3" or something in the text.
Tabular
A bunch of rows and columns.
Width of columns determined automatically.
Must fit on one page.
Tabbing
Power similar to tabular.
Can be many pages long.
Formatting changes more flexible.

We will cover the basic functions of tabular in this section of the tutorial.

You input a table in a \begin{tabular} environment. The alignment of the columns is specified in the environment command. The rows are separated by a line break \\, and the columns are separated by an &.

   \begin{tabular}{rrr}
This & Here & And the \\
is & is second & third is \\
first & column & here \\
\end{tabular}


In this example there are three columns which are all aligned on the right {rrr}. Columns can be aligned according to the following options:

r - right justify the column
l - left justify the column
c - center the column

If you look at the output of the previous examples, you will notice that the columns are not separated by much space. You can add horizontal space between columns by using the \hspace{width} command in the table setup. For example to add 1 inch between the columns of a table, use the following construct:

\begin{tabular}{r{\hspace{1in}}rr}
. . .
\end{tabular}

For the rest of the work to be done with tables, we will use the goal document tables.tex. T

## Table Positioning

Tabular items can appear in-line in the text or it can be centered on the page if more appropriate.

You can put tabular text \begin{tabular} inline like this \end{tabular}, or you can center it. 

To center it you would use the \begin{center} environment followed by the \begin{tabular} environment, as in:

\begin{center}
\begin{tabular}
. .
\end{tabular}
\end{center}

## Columns as Paragraphs

Some columns in a table look more like paragraphs than single lines. You could put in explicit line breaks to break lines within the column width, but that makes it very hard to update if you add or delete text. The tabular environment provides a way for you to set a width to automatically break the lines.

Rather than using c or l or r to define the columns of the table, use p{width} which will create a column width wide where you can input a paragraph of text.

\begin{tabular}{p{1in}p{2in}}

The previous example creates two columns, of which the left is one inch wide, and the right is two inches wide.

The LaTeX command \hline puts a line after any row of a table. It can be used only at the start of a line or just after a row separator (\\).

\begin{tabular}{rrr}
\hline
This & Here & And the \\
\hline
is & is second & third is \\
\hline
first & column & here \\
\hline \hline
\end{tabular}

## Lines Between Columns

To put vertical bars between columns, you simply add a vertical bar between the column alignment letters, as in

\begin{tabular}{|r|r|r|}
\hline
This & Here & And the \\
\hline
is & is second & third is \\
\hline
first & column & here \\
\hline \hline
\end{tabular}

## Lines Between Some Rows

You can put a horizontal line between some rows and not others by using the \cline{m-n} command. In the format of the command, m starts the line in column m, and n ends the line in column n. Obviously, n must be greater than or equal to m, and both m and n are required by the command. Therefore,

\begin{tabular}{|r|r|r|}
\hline
This & Here & And the \\
\cline{1-2}
is & is second & third is \\
\cline{1-1} \cline{3-3}
first & column & here \\
\hline \hline
\end{tabular}

## Changing Columns for One Row Only

If a row is slightly unusual, you can use the \multicolumn command in your table. The format for the command is:

\multicolumn{n}{code}{text}

What it does is replace the next n columns with one column. The new column is aligned as the code which is one of r, l, or c. You can use vertical bars within multicolumn alignments as well. The text to be placed in the column goes in text. Consider the following:

\begin{tabular}{|r|r|r|}
\hline
This & Here & And the \\
\cline{1-2}
\multicolumn{3}{|c|}{$x+y=3$} \\
\cline{1-1} \cline{3-3}
first & column & here \\
\hline \hline
\end{tabular}

Go to Introducing LaTeX