I'm using a custom command \addacronym
which creates two glossary entries for each acronym:
- the main entry and
- a cross-reference from the abbreviation to the main entry.
I also had to redefine the \glsseeitemformat
command to change the text of the cross-reference links to the long versions of the acronyms by calling \acrlong
.
The problem is that this command adds a new entry location to the main glossary term. How can I avoid that?
Here is a MWE:
\documentclass{article}
\usepackage[hidelinks]{hyperref}
\usepackage{glossaries}
\makeglossaries
% A new command creates two glossary entries for each acronym (the main entry
% and a cross-reference from abbreviation to the main entry).
% Syntax: \addacronym[options]{label}{abbreviation}{long}{description}
\newcommand{\addacronym}[5][]{
% Create the main glossary entry with \newacronym
% \newacronym[key-val list]{label}{abbrv}{long}
\newacronym[
name={#4 (#3)},
description={#5},
#1 % pass additional options to \newglossaryentry
]
{#2}{#3}{#4}
% Create a cross-reference from the abbreviation to the main glossary entry by
% creating an auxiliary glossary entry (note: we set the label of this entry
% to '<original label>_auxiliary' to avoid clashes)
\newglossaryentry{#2_auxiliary}{
name={#3},
sort={#3},
description={\makefirstuc{#4}},
see=[See:]{#2}
}
}
% Change the text of the cross-reference links to long versions of the acronyms
\renewcommand*{\glsseeitemformat}[1]{\emph{\acrlong{#1}}.}
\addacronym
{sample} % label
{ABR} % abbreviation
{long version of the acronym}
{Description of the acronym}
\begin{document}
The first occurrence of the acronym would look like:
\gls{sample}.
Further occurrences would look like: \gls{sample}.
\newpage
\printglossaries
\end{document}
It produces two pages. First page:
Second page:
The entry location I want to remove is crossed-out in red.
\glsentrylong
instead of\acrlong
. The former just displays the text associated with the long version without indexing it or creating a hyperlink. If you want a hyperlink you can use\glshyperlink[\glsentrylong{sample}]{sample}