# Refer to an equation with multiple labels

I have the following equation:

$$\tag{E_{n}}\label{E} f_n(x)=a$$


When I write \eqref{E} I am referred to the equation and it is written E_n

My question is: how to be referred to the same equation and write for example E_{n-1} rather then E_n?

• As a writer but more importantly as reader of scientific papers I beg you: please, please don't do that ;-) – campa Jul 26 '20 at 19:46
• Welcome to TeX.SE! Instead of writing See Equation \eqref{E} you can also just write see Equation (E$_{n-1}$), so don't use \eqref at all if you don't want to use the tag. But I guess that would be very confusing for the reader? – Marijn Jul 26 '20 at 19:47
• The question/intent is ill formed, as the reference is just that, a reference to the equation, which you have given a specific (non-numeric) name to. If you wish to change the formula, then this produces a dangling reference, which does not refer to anything. – oliversm Jul 26 '20 at 19:49
• I want that when the reader click on E_{n-1}, he will be directed to the equation. Indeed, the equation is written as a function of n, and when we write E_{n-1} it will be clear for the reader how he can deduce it. – Ghizlane Jul 26 '20 at 19:53

You can do like this:

\documentclass{article}
\usepackage{amsmath}
\usepackage{hyperref}

\DeclareRobustCommand{\tagindex}{\ensuremath{_{\defaulttagindex}}}
\newcommand{\defaulttagindex}{n}
\DeclareRobustCommand{\indexedref}[2][n]{%
\begingroup\def\defaulttagindex{#1}\ref{#2}\endgroup
}
\DeclareRobustCommand{\indexedeqref}[2][n]{%
\begingroup\def\defaulttagindex{#1}\eqref{#2}\endgroup
}

\begin{document}

$$\tag{E\tagindex}\label{E} f_n(x)=a$$

We refer to~\indexedeqref{E}, but also to~\indexedeqref[n-1]{E}.

\end{document}


For this use case you can use the command \hyperref[label]{text} from the hyperref package. It creates a (clickable) link to the label with the text being shown in the document (and not the default label text).

MWE:

\documentclass{article}
$$\tag{E_{n}}\label{E} f_n(x)=a$$
See Equation \eqref{E}, also known as Equation (\hyperref[E]{E$_{n-1}$}).