2

I'm using the glossaries package for acronyms. I have a few acronyms that, depending on context, might be prepended by a 'the' in their long form, but the abbreviation is always used without 'the' (so simply using 'the' before the \ac{FOO} is not an option).

I could think of two ways how this could be achieved:

  • (Hypothetical) Option of \ac (or \gls) to "prepend if long form", something along the line of \ac[the]{FOO}; however this does not seem to exist.

  • Manually define 'the'-Version of the same acronym: \ac{theFOO}.

I've tried to implement the latter, but didn't quite get there, the problem being that the two versions of the acronym do not know about each other, such that the acronym is defined twice if both forms are used. This is illustrated by the following example.

\documentclass{article}

\usepackage[acronym,shortcuts]{glossaries}

\newacronym{FB}{FB}{Foo Bar}
\newacronym{theFB}{FB}{the Foo Bar}
%\newacronym{theFB}{\acs{FB}}{the \ac{FB}} % try to avoid duplication

\begin{document}

\noindent
\ac{FB}\\
\ac{FB}\\
\ac{theFB}\\
\glsresetall
\ac{theFB}\\
\ac{FB}\\
\ac{theFB}\\

\end{document}

What I want:

Foo Bar (FB)
FB
FB
the Foo Bar (FB)
FB
FB

What I get:

Foo Bar (FB)
FB
the Foo Bar (FB)
the Foo Bar (FB)
Foo Bar (FB)
FB

Is there a way to get my approach working, or another way to achieve what I want using glossaries?

0
2
+50

Just define

\newcommand{\theac}[1]{%
  \ifglsused{#1}{}{the\space}\ac{#1}%
}

and then use \theac{FB} in place of \ac{theFB}.

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.