lua - 如何删除 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 过滤器来完成......我希望有人能给我一些关于如何解决这个问题的正确方向的指示。
解决方案
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
.
推荐阅读
- python - Django:配置文件版本 set_password()
- javascript - 带有可点击子菜单的响应式菜单,可根据屏幕大小改变位置
- service-accounts - Google 服务帐户到用户帐户
- django - initdb:错误:无法创建目录“./PostgreSQL”:权限被拒绝
- python-2.7 - CentOS 7:重新安装 python2.7 和 yum
- html - ASP.NET Core 3 MVC:输入类型日期不从 asp-for 刷新
- excel - 删除带有名称标准的 Excel 表格
- java - 一个 API 的 Rest api 设计,可以使用三种不同类型的 json 请求
- node.js - 将可读对象标准输出进程重定向到节点中的文件
- python - 为什么我不能在一个块中添加 for 循环而不发生缩进错误?