使用pandoc导出pdf文件中的所有yaml书目

Off*_*ray 5 pdf markdown yaml bibliography pandoc

我正在使用Leo,yaml和pandoc来创建一个pdf.为此,我的工作流程是这样的:

  1. 我收集了所有相关项目作为zotero集合
  2. 我将它们全部导出为CSL JSON,并使用biblio2yaml将其转换为yaml
  3. 我创建了一个带有markdown节点的Leo大纲和一个yaml节点,其中包含我要编写的所有信息和所有收集的参考书目项,并制作了一个小脚本来遍历大纲并导出我想要的东西.
  4. 最后在我运行的输出文件中:

    pandoc --filter pandoc-citeproc output.markdown -o output.pdf
    
    Run Code Online (Sandbox Code Playgroud)

并且工作得很好.问题是我想告诉pandoc包含所有参考书目项目,无论它们是[@reference]在降价文本中引用还是仅在嵌入式yaml块中收集用于参考书目.这可能吗?如果没有,有一些方法来编写pandoc来做类似的事情吗?

PS:我在pandoc的markdown中使用了[ - @ reference]技巧,试图在导出中放入参考书目的非显式引用但是我在导出的pdf中得到一年的括号,正如人们所期望的那样,所以这不是要走的路.

Joh*_*ane 5

最后,我想为pandoc添加一个语法,用于标记引用以包含在参考书目中而不将它们放在文本中.

但是现在,你最好的选择是在文本中添加所有这些参考,并修改你的CSL文件,这样就不会打印出真正的引文(只是参考书目).我无法指导如何做到这一点,但我听说其他人这样做,所以我知道这是可能的.


FrV*_*ofm 2

pandoc的README 1给出了解决方案。您需要定义一个虚拟元nocite数据字段并将引文放在那里:

# References

The bibliography will be inserted after this header.  Note that
the `unnumbered` class will be added to this header, so that the
section will not be numbered.

If you want to include items in the bibliography without actually
citing them in the body text, you can define a dummy `nocite` metadata
field and put the citations there:

---
nocite: |
  @item1, @item2
...

@item3

In this example, the document will contain a citation for `item3`
only, but the bibliography will contain entries for `item1`, `item2`, and
`item3`.
Run Code Online (Sandbox Code Playgroud)