2
\documentclass{article} 

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

\begin{document}
\begin{equation}
\Delta A_2 = x^2
\end{equation}

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?

0

2 Answers 2

4

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

For more info, see here: https://en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing.

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
\begin{equation}\label{eq:myeq}
\Delta A_2 = x^2
\end{equation}
\end{document}

enter image description here

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. 
\begin{equation}\label{eq:myneweq}
\Delta A_1 = x
\end{equation}
Equation \ref{eq:myeq} blah blah blah
\begin{equation}\label{eq:myeq}
\Delta A_2 = x^2
\end{equation}
\end{document}

enter image description here

4
  • 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. Dec 5, 2018 at 18:02
  • @Ben No, ben LaTeX will do it for you
    – CarLaTeX
    Dec 5, 2018 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, 2018 at 18:10
  • @Ben This is one of the wonderful things LaTeX does for you :)
    – CarLaTeX
    Dec 5, 2018 at 18:10
2

You can just add \label{yourlabel} after \begin{equation}:

\begin{equation}\label{equ1}
2
  • 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. Dec 5, 2018 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. Dec 5, 2018 at 19:08

Not the answer you're looking for? Browse other questions tagged .