# Is it posible to have different tags in the text linking to one label?

When I write parameterized or otherwise indexed equations I often would like to be able to refer to eqn:f_i (i.e. producing a clickable link in the document) using:

• the given tag $f_i$ for general discussion
• a custom tag like $f_1$ when referring to 'specializations

The first requirement is easily fulfilled by \ref{eqn:f_i}, how about the second one?

%MWE
\documentclass{minimal}
\usepackage{amsmath}
\usepackage{hyperref}
\begin{document}
Today we're going to talk about parameterized functions.
Consider the different alternatives \ref{eqn:a_i}:
$$\label{eqn:a_i} a_0(x) = 42, \qquad a_1(x) = sin(x), ...$$
These are used by the well known function \ref{eqn:f_i}:
$$\label{eqn:f_i} f(x) = a_i \tag{f_i}$$
Surprisingly $f_0$ % I can write this but it doesn't link to the \label{eqn:f_i}
is constant while $f_1$ % same here...
strangely resembles a trigonometric function I've heard about in school.
\end{document}

• I don't fully understand your question (i.e., the 2nd requirement). Could you expand your example to include a full minimum working example showing what you hope to achieve? – Steven B. Segletes Aug 1 '17 at 17:09
• @StevenB.Segletes: There you go. – mrclng Aug 1 '17 at 17:33

Using Werner's approach from How can one refer to a part of an equation?. After adding his pixie dust (slightly modified) to the preamble, then I make these added calls in the cited equation: \instancelabel{f_0}{eqn:f_0}\instancelabel{f_1}{eqn:f_1}.

\documentclass{article}
\usepackage{hyperref,amsmath,refcount,lipsum}

\AtBeginDocument{\let\textlabel\label}% http://tex.stackexchange.com/q/9939/5764
\makeatletter
\newcommand{\instancelabel}[2]{\def\@currentlabel{$#1$}\textlabel{#2}}
\makeatother
\begin{document}
Today we're going to talk about parameterized functions.
Consider the different alternatives \ref{eqn:a_i}:
$$\label{eqn:a_i} a_0(x) = 42, \qquad a_1(x) = sin(x), ...$$
These are used by the well known function \ref{eqn:f_i}:
$$\label{eqn:f_i}\instancelabel{f_0}{eqn:f_0}\instancelabel{f_1}{eqn:f_1} f(x) = a_i \tag{f_i}$$
\lipsum[1-2]

Surprisingly \ref{eqn:f_0} % I can write this but it doesn't link to the \label{eqn:f_i}
is constant while \ref{eqn:f_1} % same here...
strangely resembles a trigonometric function I've heard about in school.
\end{document}


• @mrclng I removed the part of Werner's definition referring to \phantomsection. However, this question, tex.stackexchange.com/questions/44088/…, indicates I might have been too hasty. If you experience problems in the behavior of the macro, let me know and I will revise accordingly. – Steven B. Segletes Aug 1 '17 at 18:06
• However, the second answer at that same question indicates we are OK with the current arrangement. Namely, "The \phantomsection command is needed to create a link to a place in the document that is not a figure, equation, table, section, subsection, chapter, etc." Since we are an equation, all should be good. – Steven B. Segletes Aug 1 '17 at 18:08