# Refer to a glossary entry

I want to refer to a glossary entry from my text or form another entry in the same or from another glossary. What's the label I have to put in my hyperref options like \ref{<label>} or \pageref{<label>} to refer at the glossary entry or at the glossary title ? Thanks. It seems easy but I don't find the solution in manuals.

% !TEX TS-program = arara
\documentclass{scrbook}
\usepackage{hyperref}
\usepackage{glossaries}
\newglossaryentry{test}{name=test,type=main,description={this is a test}}
\newglossaryentry{entry}{name=other,type=main,description={another entry (have a link to the test \gls{entry} % \pageref{gls:test}
?)}}
\makeglossary
\begin{document}
A \gls{test}. I want to refer to this glossary \gls{entry}, see the test definition % \pageref{gls:test}, in ref{sec:glossary}.
\printglossary[type=main]%label{sec:glossary}
\end{document}
% arara: xelatex
% arara: makeglossaries
% arara: xelatex


It's a MWE, but I use cleveref, etoolbox and xindy

You can use the package option numberedsection=autolabel, described in Sectioning, Headings and TOC Options, and then you can reference it using the glossary label (e.g. \ref{main} for the main glossary) but that will turn the glossary into a numbered chapter (which is necessary in order to cross-reference it using \ref). If you want a prefix you can redefine \glsautoprefix. For example

\renewcommand*{\glsautoprefix}{sec:}


You can now reference the main glossary using \ref{sec:main}.

The package option entrycounter will automatically number each entry in the glossary. If this is set you can then reference the entry by its number using \glsrefentry{label}. If you only want to reference the page number without the entries having a visible number, you can prevent the entry number from appearing in the glossary by redefining \glsentrycounterlabel:

\renewcommand*{\glsentrycounterlabel}{}


This will increment the entry counter (so it can still be labelled and referenced) but just won't display it. If you want to refer to the page number (rather than the entry number) you can't use \glsrefentry but instead you need to use \pageref{glsentry-label}.

% arara: xelatex
% arara: makeglossaries
% arara: xelatex
\documentclass{scrbook}

\usepackage{hyperref}
\usepackage[entrycounter,numberedsection=autolabel]{glossaries}

\renewcommand*{\glsentrycounterlabel}{}

\makeglossaries

\newglossaryentry{test}{name=test,type=main,description={this is a
test}}
\newglossaryentry{entry}{name=other,type=main,description={another
entry (have a link to the test \gls{test} on page~\pageref{glsentry-test})}}

\begin{document}
A \gls{test}. I want to refer to this glossary \gls{entry}, see the
test definition on page~\pageref{glsentry-entry}, in \ref{main}.

\printglossary[type=main]
\end{document}

• Great ! Thanks. I imagine that I may change the \ref{main} by other glossary name ! Very good – Zouib Jul 6 '15 at 15:28
• finally, I use nameref option, better than auto label for me : \usepackage{nameref} & \usepackage[entrycounter,numberedsection=nameref]{glossaries} for an unnumbered sectioning, & using \nameref{go:main} in my work ;-) – Zouib Jul 7 '15 at 12:51