2

I have multiple similar glossaries with different indexes. I would like for all of them to hyperlink to one glossary entry. Is it possible?

Code:

\documentclass{article}

\usepackage[unicode, colorlinks=true]{hyperref}
\usepackage[automake, acronym, nopostdot, nonumberlist, style=super, shortcuts]{glossaries}
    \setlength{\glsdescwidth}{0.9\textwidth}
    \makeglossaries 
    \newglossaryentry{F1}{name = \ensuremath{F_1}, description = Force in cross-section 1}
    \newglossaryentry{F2}{name = \ensuremath{F_2}, description = Force in cross-section 2}
    \newglossaryentry{F3}{name = \ensuremath{F_3}, description = Force in cross-section 3}
    \glsaddall

\begin{document}
\printglossary
\section{Text}
There are three cross-sections.

The force in cross-section 1: $\gls{F1} = 10 kN$.

The force in cross-section 2: $\gls{F2} = 15 kN$.

The force in cross-section 3: $\gls{F3} = 20 kN$.
\end{document}

Currently it looks like this:

Current

I want it to look like this:

Desired

And I want the glossaries F_1, F_2 and F_3 to point to F_i in Glossary.

1 Answers1

0

As Nicola Talbot mentioned in his comment, answer can be found here.

Using the suggested approach my new code would look like this

\documentclass{article}

\usepackage[unicode, colorlinks=true]{hyperref}
\usepackage[automake, acronym, nopostdot, nonumberlist, style=super, shortcuts]{glossaries}
\setlength{\glsdescwidth}{0.9\textwidth}
\makeglossaries

\glsnoexpandfields

\newcommand*{\providedIndex}{i} % default index

\newglossaryentry{Fi}{
name = \ensuremath{F_{i}},
text = \ensuremath{F_{\providedIndex}},
description = Force in cross-section i
}

% modify the entry's format
\defglsentryfmt{%                   
    \let\orgprovidedIndex\providedIndex
    \ifdefempty\glsinsert
    {}%
    {%
    \let\providedIndex\glsinsert
    \let\glsinsert\relax
    }%
    \glsgenentryfmt
    \let\providedIndex\orgprovidedIndex
}

\begin{document}
\printglossary
\section{Text}
There are three cross-sections.

The force in cross-section 1: $\gls{Fi}[1] = 10 kN$.

The force in cross-section 2: $\gls{Fi}[2] = 15 kN$.

The force in cross-section 3: $\gls{Fi}[3] = 20 kN$.
\end{document}

The code produces exactly the desired output as described in my question.