Next: Bibliography Up: Commands for Text Mode Previous: Tables

## Sectioning and Cross-references

is designed for working with large documents. It provides commands for generating section headings, and for generating and keeping track of section numbers automatically.

To begin a new section, use the \section{ } command, like this:

\section{Introductory Remarks}
There are also commands \subsection{ } and \subsubsection{ } to divide sections into smaller pieces. In the report and book document styles, there is a command \chapter{ } for introducing chapters, each of which can then have \section's, \subsection's, etc.

takes care of numbering chapters, sections and so on sequentially. In addition, it provides a mechanism for making cross-references which are automatically updated if the numbering changes, using the \label{ } and \ref{ } commands. \label{ } associates the section (or subsection, or subsubsection, etc.) number in effect when the label command is executed to the key'' contained between the curly braces. This number can be recalled at any other point in the paper by typing \ref{ } with the key contained in the curly braces. Even if the number of the section to which the reference is made is changed, the reference will stay correct. For example, this discussion of sectioning and cross-references began

\subsection{Sectioning and Cross-references}
\label{sectioning}

I can now type

as we saw in Section \ref{sectioning}, cross-references are
easy to do
to get, as we saw in Section 6.8, cross-references are easy to do''.

A few notes about using \label{ } and \ref{ }:

1. A key can contain upper and lower case letters, numbers and punctuation marks (but not spaces).
2. Upper and lower case letters are considered to be different (so that the sequence \ref{Sectioning} would not have worked above).
3. You can use \ref{ } to refer to a key before it is defined in your file. The first time sees your file, it will complain that it doesn't know what that key refers to, but after that it remembers what the key referred to the last time the document was processed, and uses that. So, by using \ twice on a file, you can always make sure that all references, including forward references, are up-to-date. (Fortunately, will tell you if this is necessary.)
4. If you use the \label{ } command within an enumerate environment or an environment created by \newtheorem, then the key is associated with the number of the item in the enumeration, or the number of the theorem (or lemma, or whatever). The same applies for numbered equations, which are described in Section 7.1.

Next: Bibliography Up: Commands for Text Mode Previous: Tables

Processed by LaTeX2html