label ref system

StartLaTeX Topics

references with LaTeX

A brief introduction to the use of references within LaTeX. The information refers to the standard commands. By including additional reference packages it may be possible that the commands have been changed in their properties and or have been replaced by new commands.

The command label marks a reference in the LaTeX code in the following form: \label{marking}

The ref command can be used to refer to the marker set by label: \ref{marking} after that the number of the place where the label command was set (i.e. \label{marking}) in the document, the number appears at the place where the ref command was set.

The pageref command differs from the ref command only in as far as it outputs the page number instead of the number. Or if you use it in the beamer class the foil number. \pageref{marking}

Set the label after the object to be referenced. For example, if you want to refer to a figure or a table, \label{marking} comes after caption.

text ...
\begin{table}
\caption{nice table}
\label{table}
...
\end{table}
More text... As described in table \ref{table} ...

The often shown variant where the markers are set in the form \label{sec:one} or \label{tab:one}, serves primarily only for the own overview. Only if the fancyref package is also included, a new functionality is available. By the additionally used names, here in the examples sec and tab, the object behind which the marking was set can be specified. But this only works for the output if the corresponding package (here fancyref) is included.

If references were set, you should compile at least twice. After the first run this message will appear, and after the second run it won't.

LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
If the message
LaTeX Warning: There were undefined references.

in the log appears, and if you find "??" at the place were you expected the reference, than you refered to a non-existing label. In order not to lose the overview of the used links the package showkeys can be integrated.

useful usepackages

Contact   Privacy Policy   disclosures

accept decline

This website uses cookies and pixel tags to ensure you get the best experience on our website. By using this website, you consent to the use of cookies.learn more about cookies see also our privacy policy