[英]Pandoc Lua : how to add a markdown block around a header without losing the markdown syntax #
[英]How to remove parentheses around pandoc citations?
这是我在乳胶中引用的方法
\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 过滤器来完成……我希望有人能给我一些关于如何解决这个问题的正确方向的指示。
tarleb
的回答并没有解决问题,但它确实让我找到了正确的文档。
我现在明白 pandoc 依赖于 CSL 来对引文进行实际格式化,而 lua 过滤器可以修改使用的引文类型(文本中的作者,括号中的作者)。
<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
属性中删除了括号。 现在只有我手动放置的括号出现在编译的文档中。
...灾难性的人口下降(McIntyre 等人,2015 年)。
Lua 过滤器可用于更改引用模式,以便省略括号:
function Cite(cite)
for _, c in ipairs(cite.citations) do
c.mode = pandoc.AuthorInText
end
return cite
end
确保过滤器在citeproc
之前citeproc
,即它必须首先出现在对 pandoc 的调用中:
pandoc --lua-filter=modify-citations.lua --citeproc ...
另一种方法是将\\cite
更改为\\citet
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.