Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to use the glossaries package for acronyms in Beamer presentations. However, when using Beamer's overlay mechanisms, I run into trouble.

An acronym (used for the first time) on a slide with overlays will have its long form printed on the first overlay but then be shown in its short form on the following overlays of that slide. This looks wrong, as it changes text between overlays that was supposed to appear static for the entire slide (across overlays). So, I guess what I would like is for glossaries to print the long form of an acronym on its first occurrence, but for all consecutive overlays displaying that first occurrence.

I include a minimal example of what I mean:

\documentclass{beamer}

\usepackage[acronym]{glossaries}
\newacronym{AMA}{AMA}{a meaningless acronym}

\begin{document}

\begin{frame}
  \begin{itemize}
  \item<1-> The first occurrence of the acronym \gls{AMA}.
  \item<1-> The second occurence of the acronym \gls{AMA}.
  \item<2-> Something else.
  \end{itemize}
\end{frame}

\end{document}

As you can see, the problem is that the first occurrence of the acronym gets printed in short on the second overlay. I guess it may be difficult to keep track of since the acronym (here) effectively has to be printed in "long-short-long-short" form across the two overlays.

Can this be done? And hopefully, how?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

If you know it's definitely the first occurrence, you can explicitly use \glsfirst instead of \gls. Something like this:

\documentclass{beamer}

\usepackage[acronym]{glossaries}
\newacronym{AMA}{AMA}{a meaningless acronym}

\begin{document}

\begin{frame}
  \begin{itemize}
  \item<1-> The first occurrence of the acronym \glsfirst{AMA}.
  \item<1-> The second occurrence of the acronym \glstext{AMA}.
  \item<2-> Something else.
  \end{itemize}
\end{frame}
\glsunset{AMA}

\end{document}

Edit: Here's another approach:

\documentclass{beamer}

\usepackage[acronym]{glossaries}
\newacronym{AMA}{AMA}{a meaningless acronym}

\begin{document}

\ifglsused{AMA}
 {\newcommand{\doAMA}{\gls{AMA}}}
 {\newcommand{\doAMA}{\glsfirst{AMA}\glsunset{AMA}}}

\begin{frame}
  \begin{itemize}
  \item<1-> The first occurrence of the acronym \doAMA.
  \item<1-> The second occurrence of the acronym \gls{AMA}.
  \item<2-> Something else.
\end{itemize}
\end{frame}

\end{document}
share|improve this answer
    
A workable solution, indeed. But it takes most of the fun (my reason for using it) out of glossaries - keeping track of first occurrence. This way, I will have to keep track of occurrences myself and glossaries does nothing but hold the acronym definitions themselves :-( –  Thomas Arildsen Nov 12 '12 at 12:46
    
I don't know the inner workings of glossaries, but I guess you do ;-) Couldn't glossaries be tweaked to expand \gls into the appropriate (long/short) form of the acronym before Beamer takes the code and repeats it across multiple overlays? –  Thomas Arildsen Nov 12 '12 at 12:58
    
@ThomasArildsen Unfortunately I'm not so familiar with the inner workings of beamer. I had an idea about providing a localised unset in \gls but the item text gets scoped, so that doesn't help. I've added an alternative approach to my answer. –  Nicola Talbot Nov 12 '12 at 13:08
    
Well, the second approach seems to do the trick. Thanks! –  Thomas Arildsen Nov 12 '12 at 20:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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