# Cross-referencing equations to equation numbers

I’ve just completed my first LaTex document. Love the program and the typography, but one thing that I find annoying is having to use unique labels to reference equations. Is there any way to reference an equation by linking it directly to the equation number that LaTex has assigned to it? I have been using MathType in MS Word which does exactly this. I'm using TexStudio.

• Welcome to TeX.SX! Could you please add a minimal working example (MWE) that shows how you are currently referring to an equation? Do you use the usual \label/ \ref mechanism? If so, the whole purpose of \label is to assign a unique name to an equation that is completely unrelated to the number this equation will later get. This is especially useful if you later on add/remove an equation or change their order. – leandriis Aug 19 '19 at 21:35
• The equations and references to them will automatically be numbered correctly and labels that are not related to the equation number will cause no confusion. If you don't want to remember equation labels, you might want to have a look into the showkeys package. With it, the label of an equation is shown in the margin next to the equation in the final pdf file. This can make looking p the label for a specific equation a lot easier. – leandriis Aug 19 '19 at 21:35

My welcome to the TeX.SE. Does this MWE respond to your request? \label{eq:Pythagoras} works to give a name for the equation. \eqref{eq:Pythagoras} is the reference of the equation.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}

\begin{document}
This is my first equation
$$\label{eq:Pythagoras} a^2=b^2+c^2$$
with the reference~\eqref{eq:Pythagoras}.
\end{document}

• May I ask you not to use a lable like eq:1, mutch better and better to remember is something like eq:quadrat or simular. And mixing equations in your example could result in an order of eq:2, then eq:5, then eq:1. That should simply be omitted, it does only result in bad errors ... – Mensch Aug 19 '19 at 21:42
• I added an ~ before \eqref to make sure the number is not set at the beginning of the next page ... – Mensch Aug 19 '19 at 22:26