2

I want to combine a glossary and a list of acronyms. I am using the newdualentry command from the wikibook (included in MWE below) and quite like the result, except for the hyperref links back to the pages where the terms occur. The actual glossary entry links only to the page of first use whereas the acronym is linked to all pages where the term occurs (and, interestingly, the glossary/LoA page where the acronym is listed).

While this makes intuitive sense from the technical point of view, it is still undesirable for the actual document. Can I have the same backlink list for acronym and glossary entry, or all backlinks only with the latter and none for the abbreviation (preferably without referencing the acronym entry itself)?

combined acronym and glossary result

\documentclass{article}

\usepackage{hyperref} % should be loaded after biblatex, before glossaries
\usepackage[nopostdot,toc]{glossaries}
\usepackage{xparse}
\DeclareDocumentCommand{\newdualentry}{ O{} O{} m m m m } {
    \newglossaryentry{gls-#3}{name={#5},text={#5\glsadd{#3}},
        description={#6},#1
    }
    \newacronym[see={[Glossary:]{gls-#3}},#2]{#3}{#4}{#5\glsadd{gls-#3}}
} % as per http://en.wikibooks.org/wiki/LaTeX/Glossary
\makeglossaries

\begin{document}
\printglossary[title={List of Terms and Acronyms}]
\clearpage

\newdualentry{ABC}{ABC}{Alphabet}{Standard set of letters.} 

Text \gls{ABC}. About the \gls{ABC}.
\clearpage
More \gls{ABC}.

\end{document}
1

With the default long (short) style, \newacronym sets the description to the long form, which in your example includes \glsadd. This means that when the description is displayed in the glossary, it automatically adds that page to the location list. The other thing is that with the \glsadd{gls-#3} in the long form, it's only used on first use, not on subsequent use. Both these things can be fixed by moving the \glsadd to the short form and explicitly adding the name.

\documentclass{article}

\usepackage{hyperref}
\usepackage[nopostdot,toc]{glossaries}
\usepackage{xparse}

\DeclareDocumentCommand{\newdualentry}{ O{} O{} m m m m } {
    \newglossaryentry{gls-#3}{name={#5},text={#5\glsadd{#3}},
        description={#6},#1
    }
    \newacronym[see={[Glossary:]{gls-#3}},name={#4},#2]{#3}{#4\glsadd{gls-#3}}{#5}
} % as per http://en.wikibooks.org/wiki/LaTeX/Glossary
\makeglossaries

\begin{document}
\printglossary[title={List of Terms and Acronyms}]
\clearpage

\newdualentry{ABC}{ABC}{Alphabet}{Standard set of letters.}

Text \gls{ABC}. About the \gls{ABC}.
\clearpage
More \gls{ABC}.

\end{document}

This now produces:

Image of glossary

Note that you get a different result if you move the definition to the preamble:

\documentclass{article}

\usepackage{hyperref}
\usepackage[nopostdot,toc]{glossaries}
\usepackage{xparse}

\DeclareDocumentCommand{\newdualentry}{ O{} O{} m m m m } {
    \newglossaryentry{gls-#3}{name={#5},text={#5\glsadd{#3}},
        description={#6},#1
    }
    \newacronym[see={[Glossary:]{gls-#3}},name={#4},#2]{#3}{#4\glsadd{gls-#3}}{#5}
} % as per http://en.wikibooks.org/wiki/LaTeX/Glossary
\makeglossaries

\newdualentry{ABC}{ABC}{Alphabet}{Standard set of letters.}

\begin{document}
\printglossary[title={List of Terms and Acronyms}]
\clearpage

Text \gls{ABC}. About the \gls{ABC}.
\clearpage
More \gls{ABC}.

\end{document}

Image of glossary

This brings page 1 back into the location list because of the see cross-reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.