# How to refer to an entry in Index / Glossaries?

I want to refer to some important keywords (defined by Index) and concepts (defined by glossary) in text.Suppose I've created [[Prototype]] as Index at some place and class and inheritance as glossary at other places.

My question is how can I reference them so that the text displayed here is something like:

pseudo latex code:

In Chapter 5, we addressed the \ref{index:Prototype} mechanism in
detail, and why it's confusing and inappropriate to describe it as
\ref{glossary:class} or \ref{glossary:inheritance} ...


desired output:

In Chapter 5, we addressed the [[Prototype]](§1.2.3 page 123)
mechanism in detail, and why it's confusing and inappropriate to
describe it as class (Glossary page 234) or inheritance (Glossary
page 235) ...


The entrycounter package option creates a counter that's automatically incremented using \refstepcounter when the top-level entries are listed in the glossary. By default this will also display the counter value in front of the entry, but this can be changed by redefining \glsentrycounterlabel to do nothing. The argument of \label is formed from glsentry-tag where tag is the entry's label.

\documentclass{report}

\usepackage[entrycounter]{glossaries}

\makeglossaries

\newglossaryentry{sample}{name={sample},description={an example}}

\renewcommand{\glsentrycounterlabel}{}

\begin{document}
\gls{sample} described on page \pageref{glsentry-sample}.

\printglossaries
\end{document}

• Nice answer! However, would you please tell me how to deal with Index? Many thanks! – spacegoing Jan 18 '17 at 10:44
• @spacegoing If you're just using glossaries.sty's index package option and \newterm, it's just the same. If you mean using a package like makeidx or imakeidx then that would require a different method, and you'll have to post it as a separate question. – Nicola Talbot Jan 18 '17 at 12:46