LaTeX numbering

One advantage of LaTeX over the other TeX-flavors is that it provides an automatic numbering of the sections, theorems, equations etc., together with an easy way to refer to these numbers.

The value of a counter can be changed with a command of the type


\setcounter{equation}{0}

One can achive the reseting of the equation counter at the beginning of each section and the inclusion of the section number in the equation numbering with the command

\numberwithin{equation}{section}

To add a label to any of the items which received a number, use

\label{label-name}

One can refer anywhere else in the text to it with one of the following:

\ref{label-name}
\eqref{label-name}
\pageref{label-name}

The meaning is the following:

One can adjust the way items are numbered by re-defining some of the commands (the first example is essentially equivalent to \numberwithin{equation}{section}):


\renewcommand{\theequation}{\thesection.\arabic{equation}}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{(\alph{subsection})}

The \newtheorem command defines a new "theorem-like" environment. Its syntax is described below. Two arguments are required (as in the first form), the others are optional.

\newtheorem{env-name}{label-text}
\newtheorem{env-name}[other_env]{label-text}
\newtheorem{env-name}[other_env]{label-text}[within]

where: Here is an example of macros that define the way theorems etc. are numbered and presented:

\newtheorem{thm}{Theorem}[section]
\newtheorem{lemma}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{defn}[thm]{Definition}
\newtheorem{examp}[thm]{Example}
\newtheorem{conj}[thm]{Conjecture}
\newtheorem{rmk}[thm]{Remark}}

For more on variations of the fonts used, see this part in the Fancy Stuff Section.