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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

56 Chapter 3. Document Layout <strong>and</strong> Organization<br />

n is the current chapter number. At this point in the present book, we are<br />

in Chapter 3, Section 3.3, Subsection 3.3.3.<br />

For each sectioning comm<strong>and</strong> there is an internal counter that is<br />

incremented by one every time that comm<strong>and</strong> is called, <strong>and</strong> reset <strong>to</strong> zero<br />

on every call <strong>to</strong> the next higher sectioning comm<strong>and</strong>. These counters are<br />

not altered by the *-forms, a fact that can lead <strong>to</strong> difficulties if st<strong>and</strong>ard<br />

<strong>and</strong> *-forms of the comm<strong>and</strong>s are mixed such that the *-forms are higher<br />

in the hierarchy than the st<strong>and</strong>ard forms. There are no problems, however,<br />

if the *-forms are always lower than the st<strong>and</strong>ard forms. The sequence<br />

\section ... \subsection ... \subsubsection* ...<br />

numbers the headings for \section <strong>and</strong> \subsection while leaving the<br />

headings for \subsubsection without any numbering.<br />

The sectioning comm<strong>and</strong> \part is a special case <strong>and</strong> does not affect<br />

the numbering of the other comm<strong>and</strong>s.<br />

The au<strong>to</strong>matic numbering of sections means that the numbers might<br />

not necessarily be known at the time of writing. The author may be writing<br />

them out of their final order, or might later introduce new sections or even<br />

remove some. If he or she wants <strong>to</strong> refer <strong>to</strong> a section number in the text,<br />

some mechanism other than typing the number explicitly will be needed.<br />

The L AT E X cross-reference system, described in detail in Section 9.2.1,<br />

accomplishes this task with the two basic comm<strong>and</strong>s<br />

\label{name} \ref{name}<br />

the first of which assigns a keyword name <strong>to</strong> the section number, while the<br />

second may be used as reference in the text for printing that number. The<br />

keyword name may be any combination of letters, numbers, or symbols.<br />

For example, in this book the comm<strong>and</strong> \label{sec:xref} has been<br />

typed in at the start of Section 9.2.1, so that this sentence contains the<br />

input text at the start of Section \ref{sec:xref}.<br />

A second referencing comm<strong>and</strong> is \pageref for printing the page<br />

number where the corresponding \label is defined.<br />

The referencing comm<strong>and</strong>s may be used in many other situations for<br />

labeling items that are numbered au<strong>to</strong>matically, such as figures, tables,<br />

equations.<br />

Every sectioning comm<strong>and</strong> is assigned a level number such that \section<br />

! is always level 1, \subsection level 2, . . . \subparagraph level 5. In document<br />

class article, \part is level 0 while in book <strong>and</strong> report classes, \part is level<br />

−1 <strong>and</strong> \chapter becomes level 0. Section numbering is carried out down <strong>to</strong><br />

the level given by the number secnumdepth. This limit is set <strong>to</strong> 2 for book<br />

<strong>and</strong> report, <strong>and</strong> <strong>to</strong> 3 for article. This means that for book <strong>and</strong> report, the<br />

section numbering extends only <strong>to</strong> the level of \subsection <strong>and</strong> for article <strong>to</strong><br />

\subsubsection.<br />

In order <strong>to</strong> extend (or reduce) the level of the section numbering, it is necessary<br />

<strong>to</strong> change the value of secnumdepth. This is done with the comm<strong>and</strong><br />

\setcounter{secnumdepth}{num}

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

Saved successfully!

Ooh no, something went wrong!