7.4 \ref & \Ref

Synopsis:

\ref{key}
\ref*{key}
\Ref{key}
\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.

If hyperref is in use, the starred forms avoid creating a link for the command, as normally happens. If hyperref is not being used, the starred forms are the same as the unstarred forms.

In this example the \ref{popular} produces ‘2’. Since it is a forward reference, coming before the \label{popular}, this document would have to be compiled twice for the reference to resolve.

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 \labelformat command allows you to define text to be inserted by \ref along with the number (see \labelformat). If the reference begins a sentence, you then want that text to be capitalized; that is what \Ref does. For example:

\labelformat{equation}{equation~(#1)}}
...
\begin{equation}
E=mc^2 \label{einstein}
\end{equation}
\Ref{einstein} is due to Einstein ...

This will output something like ‘Equation 1.1 is due to Einstein …’. If the reference does not begin with a simple ASCII or UTF-8 letter, the capitalization will fail and/or you will get an error message. In this case, put the part to be capitalized within braces.

If no \labelformat has been defined for the given counter, then \Ref is the same as \ref, and outputs just the counter’s value.


Unofficial LaTeX2e reference manual