首页 > 解决方案 > 如何删除 pandoc 引用周围的括号?

问题描述

这是我在乳胶中引用的方法

\documentclass[11pt]{article}

\usepackage[
    backend=biber, style=apa, 
    giveninits=true, uniquename=init,
    citestyle=authoryear]{biblatex}
\bibliography{references.bib} 

\begin{document}
... catastrophic population declines (\cite{McIntyre__2015}).
\end{document}

我正在使用 pandoc 将其转换为docx或者odt我可以从同事那里获得跟踪更改。

pandoc ./main.tex -f latex -t odt --bibliography=./references.bib --csl ../apa.csl -o output.odt

但是......在生成的文档中,pandoc 会自动\cite用一组额外的括号括起每个调用。

...灾难性的人口下降((McIntyre et al. 2015))。

我真的很喜欢手动做括号......有没有办法让 pandoc 停止添加这些额外的引用括号?

我的印象是,这可以通过 pandoc 中的 lua 过滤器来完成......我希望有人能给我一些关于如何解决这个问题的正确方向的指示。

标签: lualatexpandoc

解决方案


Lua 过滤器可用于更改引用模式,从而省略括号:

function Cite(cite)
  for _, c in ipairs(cite.citations) do
    c.mode = pandoc.AuthorInText
  end
  return cite
end

确保过滤器在 之前运行citeproc,即它必须首先出现在对 pandoc 的调用中:

pandoc --lua-filter=modify-citations.lua --citeproc ...

另一种方法是更改\cite​​为\citet.


推荐阅读