1

I use the \gls{} command to cross-reference in my glossary, which spans multiple pages. However, instead of printing the page number of the page where I had referenced the entry, the first page of the table of contents is printed. I think that it may have something to do with the changing of page numbers from roman to arabic.

Is there any way around this?

MWE:

\documentclass [a4paper, 12pt] {report}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage[backref=page, hyperfootnotes=false, hidelinks, colorlinks, citecolor=OliveGreen, linkcolor=Blue, linktocpage, bookmarks=true]{hyperref}
\usepackage[toc, nopostdot, nogroupskip]{glossaries}

\newglossarystyle{mylong}{
\setglossarystyle{long}
\renewenvironment{theglossary}
 {\begin{longtable}[l]{@{}p{\dimexpr 8cm-\tabcolsep}p{0.5\hsize}}}
 {\end{longtable}}
 }

\makeglossaries
\newglossaryentry{q}{name=q,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{w}{name=w,description=blahblahblahblahblahblahblahblahblahblahblah. Cross-reference \gls{z}}
\newglossaryentry{e}{name=e,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{r}{name=r,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{t}{name=t,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{y}{name=y,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{u}{name=u,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{i}{name=i,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{o}{name=o,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{p}{name=p,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{l}{name=l,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{k}{name=k,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{j}{name=j,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{h}{name=h,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{g}{name=g,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{f}{name=f,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{d}{name=d,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{s}{name=s,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{a}{name=a,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{z}{name=z,description=blahblahblahblahblahblahblahblahblahblahblah. Cross-reference \gls{a}}
\newglossaryentry{x}{name=x,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{c}{name=c,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{v}{name=v,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{b}{name=b,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{n}{name=n,description=blahblahblahblahblahblahblahblahblahblahblah}
\newglossaryentry{m} {name=m,description=blahblahblahblahblahblahblahblahblahblahblah}


\begin{document}
\pagenumbering{roman}
\tableofcontents
\phantomsection
\printglossary[style=mylong]
\label{glossary}

\chapter{Introduction}
\pagenumbering{arabic}

\gls{q}
\gls{w}
\gls{e}
\gls{r}
\gls{t}
\gls{y}
\gls{u}
\gls{i}
\gls{o}
\gls{p}
\gls{l}
\gls{k}
\gls{j}
\gls{h}
\gls{g}
\gls{f}
\gls{d}
\gls{s}
\gls{a}
\gls{z}
\gls{x}
\gls{c}
\gls{v}
\gls{b}
\gls{n}
\gls{m}

\end{document}

closed as unclear what you're asking by user31729, user13907, Andrew Swann, Svend Tveskæg, Zarko Jan 15 '16 at 22:17

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • When I run this for entries such as a I get two page numbers: iii and 1. The reason for this is that there is a \gls{a} command on page 1 AND a \gls{a} appearing as a cross-reference in the glossary on page iii. I think that this is correct. – Andrew Aug 20 '15 at 12:57
  • It seems that deleting the aux files and running makeindex again worked for me for the MWE. It however did not work for my actual tex file. I will attempt to make a better MWE. Thanks for your help, Andrew. – Sanjay Sekaran Aug 21 '15 at 1:10

Browse other questions tagged or ask your own question.