[Tex/LaTex] Cross-referencing an equation

cross-referencingequations

So far I've always used non-labeled alignments with align*, but I think it's time for a small change. How do I refer to an alignment after creating it? I tried searching similar topics but I didn't find them here. I am using article document class.

Also, does equation behave and work similarly to align? And how would you refer to an equation number (same situation as with align)?

Best Answer

Your question is more a general question about labeling and referencing equations.

I think one great introduction is the mathmode of Herbert Voss. It's available at CTAN.

mathmode at CTAN

In the linked document you will find an extra sub section about Labels. It is introduced by:

Every numbered equation can have a label to which a reference is possible.

  • There is one restriction for the label names, they cannot include one of LaTeX’s 8 command characters.
  • The label names are replaced by the equation number.

Update

The following point was mentioned by Mico:

It may be useful to note that in addition to the eight "basic" special characters that can't be used inside labels, users should also refrain from using

  1. commas if the plan on using the cleveref package or
  2. any characters that have special meanings for various languages supported by the babel package (such as : in babel/French).

The environment equation doesn't allow any line breaks. So the syntax will be:

\begin{equation}
 a^2+b^2=c^2\label{eq:1}
\end{equation}

The environment align allows line breaks and so every line can get a label.

\begin{align}
  x^2+y^2&=2r^2 \label{eq:1} \\
  d^2+h^2&=4r^2 \label{eq:2}
\end{align}

To reference to a given label you can use the standard command \ref or any other reference command provided by some packages. I like to use \eqref to reference to equations.

Here a complete example:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
 a^2+b^2=c^2\label{eq:1}
\end{equation}
Text \eqref{eq:1}
\end{document}
Related Question