首页 > 解决方案 > 如何强制使用 BibTeX 密钥作为 Pandoc 和 Biber 的引用密钥?

问题描述

我正在努力让教学技术一起准备出版。PDF 看起来不错,但我很难获得我满意的 HTML,我希望有人能提供帮助。我的 LaTeX 文件包含以下内容:

\usepackage[backend=biber,style=alphabetic,sorting=nyt,maxbibnames=99]{biblatex}
\addbibresource{book.bib}

我的 BibTeX 文件包含以下条目:

@inproceedings{Bacc2013,
  author = {Alberto Bacchelli and Christian Bird},
  title = {Expectations, Outcomes, and Challenges of Modern Code Review},
  booktitle = {2013 International Conference on Software Engineering ({ICSE'13})},
  year = {2013},
  month = {5},
  local = {bacchelli-2013-code-review.pdf},
  note = {A summary of work on code review.}
}

我编译所有内容:

$ pdflatex book.tex
$ biber book
$ pdflatex book.tex
$ pdflatex book.tex

PDF 正文中的引用使用 BibTeX 键作为引用键:

Debugging depends on being able to read code, which multiple studies have
shown is the single most effective way to find bugs [Basi1987; Keme2009;
Bacc2013]. The code quality rubric developed in [Steg2014; Steg2016a], which is
online at [Steg2016b], is a good checklist of things to look for, though it is best
presented in chunks rather than all at once.

参考书目也使用引文关键字,并包含该note字段。(我宁愿它在日期之后出现,但我尽量不要求月亮。)

[Bacc2013] Alberto Bacchelli and Christian Bird. "Expectations, Outcomes, and
    Challenges of Modern Code Review". In: 2013 International Conference on
    Software Engineering (ICSE’13). A summary of work on code review. May 2013.

我怎样才能用 Pandoc 复制它?我的命令行是:

$ pandoc -s --css=assets/bootstrap.css --css=assets/book.css --toc --toc-depth=2 \
  --template=template.html --bibliography=book.bib \
  -o index.html book.tex

template.htmlPandoc 的默认 HTML 模板的副本在哪里进行了轻微调整以使用 Bootstrap CSS。我希望生成的 HTML 在正文和参考书目中都使用 BibTeX 引用键。(我还希望引用指向参考书目条目的超链接,以及包含该note字段的参考书目条目,但一步一步......)我在寻找什么魔法?

标签: htmllatexpandocbibtexcsl

解决方案


为了在所有输出格式中产生相同的引用,pandoc 使用内置的pandoc-citeproc过滤器,而不是依赖于 LaTeX。这也意味着您不能使用 LaTeX 来影响引文输出:

pandoc 手册

引文和参考文献可以使用Zotero 样式库中列出的引文样式语言支持的任何样式进行格式化。这些文件是使用选项或 元数据字段指定的。默认情况下,将使用 芝加哥风格手册作者日期格式。CSL 项目提供了有关查找和编辑样式的更多信息。--cslcslpandoc-citeproc

另请参阅tex.stackexchange 上的此答案


推荐阅读