Intro | First attempt | Text | References | Figures | Maths | Source Code | Theorems

Including figures and table


In order to include figures, I recommend the following sequence of commands.

    \caption{A diagram showing how to include graphics.}

Additionally, in the preamble, you need:


This does require a bit of explanation. First, a block enclosed by a \begin/\end pair is called an environment. The example uses two environments, figure and center.

figure environment
This creates a float, i.e. a block which is placed outside the flow of text, moved to give a good aesthetical result. Big chunks which cannot be split between pages should normally be placed in floats to allow the text to fill the pages.
center environment
This centres the enclosed material within the margins.
This includes an external graphics file, figfile. You should usually omit the extension. pdflatex supports PNG and PDF, and sometimes JPEG. The optional argument says that the width should be 80% of the width of the text (i.e. between the margins. The height will be set to maintain the aspect ratio.
This specifies an explaining text to appear in the figure.
This defines a key which can be used to refer to the figure later. E.g. See Figure~\ref{fig:1} on page~\pageref{fig:1}.


The following code creates a table:

        Field 1 & Field 2 & Field 3 \\
        Data 1 & 0.5 & $\alpha$ \\
        Data 2 & 2.1 & $\beta$ \\
    \caption{Table demo.}

The table environment creates a float like figure does, but it keeps it in separate list with its own number sequence.

The actual table itself is made by the tabular environment.

This is the column specification. The pipes (|) represent vertical lines, and the letters represent fields, respectively right justified, centred and left justified.
makes a horizontal line.
separates fields.
starts a new row

Lists of Figures/Tables

Whereever you want the lists, issue the commands