# Acronym package: Swap short and long form

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.
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:

---
---
{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


I was able to solve the issue by making the changes directly in the original acronym.sty file that in my case is located at /usr/local/texlive/2016/texmf-dist/tex/latex/acronym.
I do not understand why the \renewcommand way did not work, though.