如何删除 pandoc 引用周围的括号?
How to remove parentheses around pandoc citations?
这是我在 latex 中进行引用的方式
\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
调用括起来。
...catastrophic population declines ((McIntyre et al. 2015)).
我真的很喜欢手动添加括号...有没有办法让 pandoc 停止添加这些额外的引文括号?
我的印象是这可以通过 pandoc 中的 lua 过滤器来完成...我希望有人能给我一些关于如何解决这个问题的正确方向的指示。
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
。
tarleb
的回答没有解决问题,但它确实把我带到了 right documentation。
我现在明白 pandoc 依赖于 CSL 来对引文进行实际格式化,而 lua 过滤器可以修改使用的 kind 引文(作者在正文中, vs 括号中的作者)。
<citation et-al-min="3" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true" collapse="year" givenname-disambiguation-rule="primary-name-with-initials">
<layout prefix="" suffix="" delimiter="; ">
</layout>
</citation>
在我的 CSL 文档中,我刚刚从 <citation> <layout>
节点的 prefix
和 suffix
属性中删除了括号。
现在只有我手动放置的括号出现在编译的文档中。
...catastrophic population declines (McIntyre et al., 2015).
这是我在 latex 中进行引用的方式
\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
调用括起来。
...catastrophic population declines ((McIntyre et al. 2015)).
我真的很喜欢手动添加括号...有没有办法让 pandoc 停止添加这些额外的引文括号?
我的印象是这可以通过 pandoc 中的 lua 过滤器来完成...我希望有人能给我一些关于如何解决这个问题的正确方向的指示。
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
。
tarleb
的回答没有解决问题,但它确实把我带到了 right documentation。
我现在明白 pandoc 依赖于 CSL 来对引文进行实际格式化,而 lua 过滤器可以修改使用的 kind 引文(作者在正文中, vs 括号中的作者)。
<citation et-al-min="3" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true" collapse="year" givenname-disambiguation-rule="primary-name-with-initials">
<layout prefix="" suffix="" delimiter="; ">
</layout>
</citation>
在我的 CSL 文档中,我刚刚从 <citation> <layout>
节点的 prefix
和 suffix
属性中删除了括号。
现在只有我手动放置的括号出现在编译的文档中。
...catastrophic population declines (McIntyre et al., 2015).