pandoc 中带有 \tableofcontents 的 acro 包抛出错误(LaTeX 错误:“kernel/command-already-defined”)

pandoc 中带有 \tableofcontents 的 acro 包抛出错误(LaTeX 错误:“kernel/command-already-defined”)

更新(MWE):

独立于模板跟踪错误。显然,当我尝试添加目录时,它就会发生:

preamble.tex包含:

\usepackage{acro}

test_acro.md包含:

\tableofcontents

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

\printacronyms

\ac{api} is an abbreviation.

跑步

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

抛出

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/command-already-defined"
! 
! 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 }

从这里忽略

抱歉,没有一个最小的工作示例,但我更想尝试找到问题所在,而不是寻找现成的解决方案。

我在用着https://github.com/tompollard/phd_thesis_markdown作为 pandoc 的模板。

我已经修改了我的 makefile 以使用一些附加过滤器(pandoc-shortcaption 和 pandoc-crossref)。

包括

\usepackage{acro}}

在 style/template.tex 中

并进行测试

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

\printacronyms[include-classes=abbreviation, name=Abbreviations, 
heading=chapter, sort=false]

\ac{api} ist eine Abkuerzung.

在 source/*abbreviations.md 中,我得到:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/command-already-defined"
! 
! 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)

知道这是怎么回事吗?我读到过有人使用 acro 包和 pandoc 时没有遇到问题。

答案1

完成你的代码片段

\tableofcontents

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

\printacronyms

\ac{api} is an abbreviation.

变成真实的梅威瑟:

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

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

\printacronyms

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

产生错误并显示问题:缩写词的声明应该在序言中进行!

\documentclass{article}
\usepackage{acro}

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

\begin{document}
\tableofcontents

\printacronyms

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

相关内容