Apologies for creating a duplicate question: I exactly want to achieve what @eDeviser asks in Acronym, swap description and acronym but due to my low reputation, I cannot collaborate there: How to swap the short and long form (putting the long form in parentheses) of an acronym when used for the first time? After that just the short form should be displayed.
I struggle incorporating the suggested solution by @clemens (https://tex.stackexchange.com/a/288328/118158). I use Rmarkdown and pandoc to generate a pdf but get the following error:
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.165 ...ring{\protect\@acf{#1}}{#1 (\AC@acl{#1})}
pandoc: Error producing PDF from TeX source
relevant parts of Master.Rmd with YAML snippet:
---
header-includes:
- \usepackage[nohyperlinks, printonlyused]{acronym}
---
```{r child = 'Abstract.Rmd'}
```
```{r child = 'Abbreviations.Rmd'}
```
Abbreviations.Rmd
\begin{acronym}
\acro{API}[API]{application programming interface}
\end{acronym}
Abstract.Rmd based on @clemens solution
\makeatletter
% singular:
\renewcommand*{\acfa}[1]{%
\texorpdfstring{\protect\@acf{#1}}{#1 (\AC@acl{#1})}%
}
\renewcommand*{\@acf}[1]{%
\acffont{%
\AC@placelabel{#1}%
\acfsfont{\acsfont{\AC@acs{#1}}}%
\nolinebreak[3] %
(\AC@acl{#1})%
}%
}
\makeatother
\ac{API}\newline