I would like to display the place of the first appearance of all acronyms, used in my text, but for some acronyms I prefer to use only the short form (even for the first usage). My question is similar to this previous one, BUT the solution for that does not allow for displaying among the Abbreviations those acronyms the long form of which was always suppressed.
I tried to solve this by adding \glsadd
manually to the first occurrence of \acrshort
, but this results in errors during compilation.
This is a MWE for my problem:
\documentclass{article}
\usepackage{hyperref}
\usepackage[abbreviations]{glossaries-extra}
\makeglossaries
\glssetcategoryattribute{acronym}{indexonlyfirst}{true}
\setabbreviationstyle[acronym]{long-short}
\newacronym{faq}{FAQ}{Frequently Asked Questions}
\newacronym{bbc}{BBC}{British Broadcasting Corporation}
\renewcommand*{\acrshort}[1][]{\glsxtrshort[noindex,#1]}
\begin{document}
Only short: \acrshort{faq}\\ %adding \glsadd{faq} here results in errors
Long form will be used as well: \acrshort{bbc}
\newpage
Again the short form: \acrshort{faq}\\
Normal usage: \gls{bbc}\\
\printabbreviations
\end{document}
Any help is much appreciated.
Best Answer
The simplest method is to use the
short
style for acronyms that shouldn't expand on first use and thelong-short
style for the ones that should. Since theabbreviation
category haslong-short
as the default style and theacronym
category hasshort
as the default style, you could just use\newacronym
for the terms that should show the full form on first use and\newabbreviation
for the others.For example:
First page:
Second page:
Since the
indexonlyfirst
attribute is only set for theacronym
category, the FAQ entry only has one location (page 1), since it was only indexed on first use. Theabbreviation
category doesn't have this attribute set, so the BBC entry has two locations (page 1 and 2) as it was indexed on each use of\gls
.