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: Below is an example of macros that define the way theorems etc. are numbered and presented.
With these definitions numbering includes the section number, starts from 1 in each section, and theorems, lemmas, etc. are numbered in the same sequence. [IMHO, this is highly desirable, otherwise the reader might have a hard time to find Proposition 2.1 as it could be after Definition 2.5.]
E.g., Section 2 will have Theorem 2.1, Theorem 2.2, Remark 2.3, Definition 2.4, Remark 2.5, Lemma 2.6 and so on.
    
      \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}
    
  
NOTE that one can also use some of these environments without a number as well:
    
      \newtheorem*{thm*}{Theorem}
    
  
which is invoked with
    
      \begin{thm*}
      TEXT (formatted as in a Theorem)
      \end{thm*}
    
  
For more on variations of the fonts used, see this part in the Fancy Stuff Section.