# acro package in pandoc with \tableofcontents throws error (LaTeX error: “kernel/command-already-defined”)

UPDATE (MWE):

preamble.texcontains:

\usepackage{acro}


test_acro.md contains:

\tableofcontents

\DeclareAcronym{api}{
short = API,
long = Application Programming Interface,
}

\printacronyms

\ac{api} is an abbreviation.


running

pandoc test_acro.md -o test_acro.pdf -H preamble.tex


throws

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
!
! Control sequence \g__acro_api_in_list_bool already defined.
!
! See the LaTeX3 documentation for further information.
!
! For immediate help type H <return>.
!...............................................

l.66 }


ignore from here

Sorry for not having a minimal working example, but I'm rather trying to get a hint what's going wrong than a readymade solution.

I'm using https://github.com/tompollard/phd_thesis_markdown as a template for pandoc.

My makefile has been altered by me to use some additional filters (pandoc-shortcaption and pandoc-crossref).

After having included

\usepackage{acro}}


in the style/template.tex

and for testing

\DeclareAcronym{api}{
short = API,
long = Application Programming Interface,
class = abbreviation
}

\printacronyms[include-classes=abbreviation, name=Abbreviations,

\ac{api} ist eine Abkuerzung.


in source/*abbreviations.md, I get:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
!
! Control sequence \g__acro_api_in_list_bool already defined.
!
! See the LaTeX3 documentation for further information.
!
! For immediate help type H <return>.
!...............................................

l.279 }

pandoc: Error producing PDF
pandoc.log (END)


Any idea what's going on here? I've read about people using the acro package with pandoc without problems.

• This phd_thesis_markdown is quite a huge project. Please make a minimal working example (MWE) which reproduces you problem – Henri Menke Jun 19 '17 at 3:36
• That's exactly my problem. If I could see where the error comes from I'd be already one step further. – Felix Victor Münch Jun 19 '17 at 4:14
• You track it down, we solve it. That's the deal here. Nobody is going to waste their time on this. – Henri Menke Jun 19 '17 at 4:32
• @HenriMenke Thanks for wasting your time on clarifying this. See above for the MWE I've found in the meantime. Any clue what's going on? – Felix Victor Münch Jun 19 '17 at 7:40

\tableofcontents

\DeclareAcronym{api}{
short = API,
long = Application Programming Interface,
}

\printacronyms

\ac{api} is an abbreviation.


Into a real MWE:

\documentclass{article}
\usepackage{acro}
\begin{document}
\tableofcontents

\DeclareAcronym{api}{
short = API,
long = Application Programming Interface,
}

\printacronyms

\ac{api} is an abbreviation.
\end{document}


produces the error and shows the problem: the declaration of the acronyms should be made in the preamble!

\documentclass{article}
\usepackage{acro}

\DeclareAcronym{api}{
short = API,
long = Application Programming Interface,
}

\begin{document}
\tableofcontents

\printacronyms

\ac{api} is an abbreviation.
\end{document}

• The question is about pandoc generated LaTeX, but the problem is similar I guess. – Henri Menke Jun 19 '17 at 7:59
• It's a working example, even if it's not minimal because still using pandoc and it's templates. That I couldn't see that it has nothing to do with pandoc was obviously part of my problem. So from my perspective it was an MWE. Thanks anyway, solved the problem! – Felix Victor Münch Jun 19 '17 at 8:01
• @HenriMenke In the end it must be the same document however the LaTeX code is generated, no? There surely must be a separation of preamble and document… – cgnieder Jun 19 '17 at 8:05
• @clemens Yes, it is the same problem. I've edited my filename for the preamble in my question to make this answer easier to understand and apply for other pandoc users. – Felix Victor Münch Jun 19 '17 at 8:06