0

I have recently started to use the package glossaries.

When I make the Glossary list, the page numbers show up at the end of the description. So far so good.

I have found information about how to not show the page numbers.

I have found one solution in How to add the word "page" or "pages" in the Glossary how to add the words "page" or "pages". But it had some issues:

  1. The previously existing cross-references disappeared. It used to look like

    How it previously looked.

    So my question is, can you include the words "page" or "pages" without losing the clickable cross-references?

  2. Another problem with the found solution is that it tends to repeat the term "page"

    Screenshot example

    instead of just using it once.

The second issue seems to be solved

The term "page" only appears once per entry

in the proposed solution of Problem with inserting "page" in Glossary, but I was not sure how to implement the proposed solution. At least I got error codes when trying to add the

% Columns in acronym table
\newglossarystyle{mylong}{%
  \setglossarystyle{long}%
  \renewenvironment{theglossary}%
     {\begin{longtable}[l]{@{}p{\dimexpr 2cm-\tabcolsep}p{0.8\hsize}}}%
     {\end{longtable}}%
      \renewcommand{\glossentry}[2]{%
      \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
      \glossentrydesc{##1}\glspostdescription\space 
      \pagesfalse
      \usepagestag{##1}\space
      ##2%
      \ifpages
        \savepagestag{##1}{pages}%
      \else
        \savepagestag{##1}{page}%
      \fi
      \tabularnewline
     }%
 }

code block from Problem with inserting "page" in Glossary to my .tex document.

Can anyone help me out with this?

/Lars

3
  • Please do never post screenshots of code, but real code.
    – TeXnician
    Apr 20, 2017 at 11:00
  • It is NOT. Please read our guidelines. It looks good.
    – TeXnician
    Apr 20, 2017 at 11:03
  • It did not look good, but probably someone fixed it. Apr 20, 2017 at 14:31

1 Answer 1

3

The simplest method is to use the extension package glossaries-extra which provides \GlsXtrEnablePreLocationTag.

\documentclass{article}

\usepackage[colorlinks]{hyperref}
\usepackage[postdot]{glossaries-extra}

\makeglossaries

\GlsXtrEnablePreLocationTag{Page: }{Pages: }

\newglossaryentry{sample1}{name={sample1},description={first example}}
\newglossaryentry{sample2}{name={sample2},description={second example}}

\begin{document}
\gls{sample1}, \gls{sample2}.

\newpage

\gls{sample2}.

\newpage

\printglossaries

\end{document}

image of glossary

The build process is latex, makeglossaries, latex, latex (replace latex with pdflatex, xelatex or lualatex as appropriate).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .