问题
To compile a pdf with a bibtex bibliography, I thought it was sufficient to write the YAML as
---
title: super awesome paper
author: albert enstein
bibliography: /path/to/bib/file.bib
---
and punch this command into the terminal:
pandoc test.md -o test.pdf
But it does not work. Instead I have to manually add the bib file to the terminal command:
pandoc test.md --bibliography=/path/to/bib/file.bib -o test.pdf
What am I doing wrong?
回答1:
There is nothing wrong with your syntax. So I suspect there are spaces somewhere in the path to the file.
A common error is that the variable does not accept spaces, so I would suggest to try bibliography: "/path/to/bib/file.bib"
instead.
回答2:
I believe you need to use the flag --filter pandoc-citeproc
if you don't want to use the flag --bibliography=/path/to/bib/file.bib
. This is because using the --bibliography=
flag is equivalent to writing --metadata bibliography=FILE --filter pandoc-citeproc
(https://pandoc.org/MANUAL.html#citation-rendering).
来源:https://stackoverflow.com/questions/41653335/pandoc-does-not-print-references-when-bib-file-is-in-yaml