TransWikia.com

How to use acronym package with beamer

TeX - LaTeX Asked by ViToni on February 6, 2021

For a beamer based presentation I’d like to reuse some figures/tables/diagrams I created in a paper.
These figures/tables/diagrams are stored in dedicated files so that I could work on them individually (reducing compilation time and having always an MWE).

So it’s rather easy to inlcude these into the presentation. In the paper I used the "acronym" package to manage acronyms which requires a dedicated section where used acronyms are shown (acronym definitions are also in an external files, because of sorting). I’d like to avoid that the acronym definitions have to appear but it seems that this breaks the figures/tables/diagrams which use the acronyms.

Adding the acronym section solves the issue with the acronyms but does not look nice.
"Hiding" the page with the acronyms does not really work either…
(In the MWE the acronym the is used in the frametitle as an example but they could be anywhere.)

Any ideas:

documentclass{beamer}
usepackage[printonlyused]{acronym}

title{Title}
author{Author}
institute{An institute}

mode<presentation>
usetheme{Boadilla}

begin{document}
% this would work but shows the acronyms
%begin{frame}
%    begin{acronym}[~~~~]
%        acro{TLA}{Three Letter Acronym}
%        acused{TLA}
%    end{acronym}
%end{frame}
% this hides the acronym page but doesn't work otherwise
begin{frame}<presentation:0>[noframenumbering]
    begin{acronym}[~~~~]
        acro{TLA}{Three Letter Acronym}
        acused{TLA}
    end{acronym}
end{frame}
begin{frame}
    frametitle{ac{TLA} used here}
end{frame}
end{document}

2 Answers

A combination of acrodef in the preamble instead of acro inside of an aycronym environment and acs instead of ac should result in the expected output.

documentclass{beamer}
usepackage{acronym}

title{Title}
author{Author}
institute{An institute}

mode<presentation>
usetheme{Boadilla}

acrodef{TLA}{Three Letter Acronym}
 
begin{document}

begin{frame}
    frametitle{acs{TLA} used here}
end{frame}

end{document}

Answered by leandriis on February 6, 2021

Based on @leandriis answer using acrodef I came up with this solution.

It seems that the acro macro is only available in the acronym environement so newcommand is used instead of renewcommand to map it to acrodef. Why not use acrodef directly? All the acro definitions are already inside an external file. Redefining the command avoids changing the shared file.

Since acused can be used anywhere, one can mock the acronym to have been used as in the paper. Using the acused command forces the short version for the specific acronym used later on.

documentclass{beamer}
usepackage{acronym}

title{Title}
author{Author}
institute{An institute}

mode<presentation>
usetheme{Boadilla}

newcommand{acro}[2]{acrodef{#1}{#2}}
acro{TLA}{Three Letter Acronym}
acused{TLA}

begin{document}
begin{frame}
    titlepage
end{frame}
begin{frame}
    frametitle{ac{TLA} used here}
end{frame}
end{document}

Answered by ViToni on February 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP