Previous: , Up: Cross references   [Contents][Index]


7.3 \ref

Synopsis:

\ref{key}

Produces the number of the sectional unit, equation, footnote, figure, …, of the corresponding \label command (see \label). It does not produce any text, such as the word ‘Section’ or ‘Figure’, just the bare number itself.

If there is no \label{key} then you get something like ‘LaTeX Warning: Reference `th:GrensThm' on page 1 undefined on input line 11.

In this example the \ref{popular} produces ‘2’. Note that it is a forward reference since it comes before \label{popular} so this document would have to be compiled twice.

The most widely-used format is item number~\ref{popular}.
\begin{enumerate}
\item Plain \TeX
\item \label{popular} \LaTeX
\item Con\TeX t
\end{enumerate}

The cleveref package includes text such as ‘Theorem’ in the reference. See the documentation on CTAN.


Unofficial LaTeX2e reference manual