| Note: Tables and Figures are called "floats" by professional printers because they float in text. Floating in the text means that they are not part of the normal text, but rather float in the area where they are placed and can move up or down in the text based on spacing needs. Tables and figures always have captions and are always numbered, for easy referencing throughout the text. |
To create a table, use the Emacs Tables mode or type the code, or use the table environment by typing these commands:
\begin{table}
\caption{text here for the caption you want}
\label{text here for the label you want}
\begin{tabular}{alignment}
\end{table}
The \label command must be after the \caption command. The \caption command also allows for a shorter description to be included in the "List of Figures" if the caption on the table is too long. This is done by typing:
\caption{Short description}{Long description which will only be useful and reasonable in the full figure}
Tables can be used to typeset tabular data or to include a table captured as an image from elsewhere. To typeset the tabular data, you must be in the tabular environment. LaTeX does not cope well with printing auto-adjusting table cell sizes, like those used in many web pages. Extra space is automatically added between columns, and can be adjusted by changing the \tabcolsep dimension.
It is conventional, but not required, to center the tabular setting within the table, by using either the center environment (\begin{center} and \end{center} or the \centering command. The \hline command draws a horizontal rule across all columns and the \cline command draws a rule across a range of columns. When \hline or \cline are used, they follow the \\ of the row they apply to.
Alignment is specified as right, left, or center aligned through the commands r, l, and c. A table with three columns, the first one centered, the second left-aligned, and the third right-aligned would be specified with {clr}. Here is an example of a table with the columns aligned as {clr}:
|
\begin{table} \caption{The International Cookie Council and You.} \label{samtable_align} \begin{center} \begin{tabular}{clr} \&Item&Amount\\ \hline a)&Cookies (2 batches chocolate chip)&10\\ &Walnuts for nut cookies&2\\ &Baking sheets (3 for all the cookies)&10\\ &Sprinkles and icing for the cookies&5\\ b)&Oven for cookies, electricity for the oven, etc&500\\\cline{3-3}&Total &527 \end{tabular} \par\medskip\footnotesize The International Cookie Council Contributed greatly to (a)and (b) for this important research. \end{center} \end{table} |
Figures can contain text, diagrams, pictures, or any other kind of illustration. To create a figure, use the figure environment by typing these commands (remember to see below for including graphics and for more on the \includegraphics command):
\begin{figure} \caption{your caption} \label{label_with_no_spaces} \begin{center} \fbox{\includegraphics[width=.5\columnwidth]{diagram}} \end{center} \end{figure}
To include graphics, the include graphicx package must be listed in the preamble. The graphicx package is included in the preamble (the preamble is where the document class is defined) with the command:
\usepackage{graphicx}
This enables the \includegraphics command, which is used to inser an image in the document. This command must appear with the name of the file after it, but the name of the image file must not have a file extension. Thus, the command to include graphics appears as:
\includegraphics{ImageName}
Standard LaTeX graphics files must be in EPS (Encapsulated PostScript) format. Difficulty printing graphics normally indicates a problem with the way the graphics program saved the image.
Pdflatex allows graphics files to be in JPG, PNG, or PDF format, but not EPS. This means that if you want to use both standard LaTeX and pdflatex, you will need to jeep to versions of your images: one in EPS and one in either JPG, PDF, or PNG format. Because LaTeX and pdflatex look for their own matching filetypes, no file extensions are listed with the filename on the includegraphics command.