# How to reference equations (new to Latex) [duplicate]

\documentclass{article}

\newcommand{\dd}[1]{\mathrm{d}#1}

\begin{document}
$$\Delta A_2 = x^2$$


This code puts a (1) next to this equation, and numbers later equations accordingly. If I want to reference this equation, say with:

And as you can see in Eq. #,


how would I link it so that if the equation number later changes, I don't have to update the text?

## marked as duplicate by CarLaTeX, Troy, Circumscribe, Phelype Oleinik, MenschDec 5 '18 at 19:23

You can simply use \label{...} within the equation environment and \ref{...} to refer to it.

And remember to compile twice, the first time you'll get ?? instead of the ref.no., but don't worry, it's normal, the second time you'll get the correct number.

\documentclass{article}

\begin{document}
Equation \ref{eq:myeq} blah blah blah
$$\label{eq:myeq} \Delta A_2 = x^2$$
\end{document}


If you add another equation, LaTeX will manage the numbering:

\documentclass{article}

\begin{document}
If I add another equation \ref{eq:myneweq},  \LaTeX{} will manage the numbering.
$$\label{eq:myneweq} \Delta A_1 = x$$
Equation \ref{eq:myeq} blah blah blah
$$\label{eq:myeq} \Delta A_2 = x^2$$
\end{document}


• This does not provide automatic numbering though. I don't want to manually label every equation. What if I decide to add an equation at the beginning? Then all the numbering is messed up. – Jackson Hart Dec 5 '18 at 18:02
• @Ben No, ben LaTeX will do it for you – CarLaTeX Dec 5 '18 at 18:04
• @Ben See my second example, you only have to put the alphabetical labels, LaTeX will do the correct numbering (compiling twice). – CarLaTeX Dec 5 '18 at 18:10
• @Ben This is one of the wonderful things LaTeX does for you :) – CarLaTeX Dec 5 '18 at 18:10

You can just add \label{yourlabel} after :

\label{equ1}

• This does not provide automatic numbering though. I don't want to manually label every equation. What if I decide to add an equation at the beginning? Then all the numbering is messed up. – Jackson Hart Dec 5 '18 at 18:02
• @aquila: Your answer is somewhat incomplete: while you illustrate how a label should be inserted, you do not show how it can be referenced. – Circumscribe Dec 5 '18 at 19:08