Pandoc: Direct conversion md → pdf using --natbib fails

Created on 28 Nov 2017  Â·  5Comments  Â·  Source: jgm/pandoc

pandoc 2.0.3
Compiled with pandoc-types 1.17.3, texmath 0.10, skylighting 0.4.3.2

wtf.md

@BALSE2017

biblio.bib

@article{BALSE2017,
    Author = {{Vie}, Jill-J{\^e}nn and {Yger}, Florian and {Lahfa}, Ryan and {Clement}, Basile and {Cocchi}, K{\'e}vin and {Chalumeau}, Thomas and {Kashima}, Hisashi},
    Journal = {ArXiv e-prints},
    Title = {{Using Posters to Recommend Anime and Mangas in a Cold-Start Scenario}},
    Url = {https://arxiv.org/abs/1709.01584},
    Year = 2017,
}

The command:

pandoc --bibliography biblio.bib --natbib wtf.md -o wtf.pdf

fails (= the references are missing), while the command:

pandoc --bibliography biblio.bib wtf.md -o wtf.pdf

works.

(--biblatex also fails)

Maybe one extra compilation step is missing?

Most helpful comment

We might revisit the earlier decision not to support bibtex in PDF generation.

All 5 comments

We don't run bibtex in the process that creates a pdf via a latex intermediary. There are too many different ways one might do this (biber vs bibtex, e.g.). The pdf output option is for people who don't know how to use LaTeX. Those who do should just generate a latex file and run bibtex and pdflatex (or whatever) themselves, perhaps automating this with a Makefile.

See #1193, #681

We might revisit the earlier decision not to support bibtex in PDF generation.

See the manual:

--natbib: Use natbib for citations in LaTeX output. This option is not for use
with the pandoc-citeproc filter or with PDF output. It is intended for
use in producing a LaTeX file that can be processed with bibtex.

We might revisit the earlier decision not to support bibtex in PDF generation.

I for one would use this! I confess I don't know how to use LaTeX. I tried to use markdown and BibLaTeX to produce an assignment for class. I'm grateful for the bibliography variable and --biblatex option, which added the \addbibresource command and converted my markdown citations to BibLaTeX citations :+1: however the following command merrily produced a PDF without any references, leaving me scratching my head. I discovered that this behavior is expected and documented (#1194).

$ pandoc --output wellness-assignment.pdf --pdf-engine xelatex --biblatex wellness-assignment.md

^ Didn't work :disappointed:

On the other hand, pandoc-citeproc worked with ease (did include references):

$ pandoc --output wellness-assignment.pdf --filter pandoc-citeproc --pdf-engine xelatex --csl apa.csl wellness-assignment.md

When I eventually got BibLaTeX to work, it wasn't that much more involved, however I had to go wading through the XeTeX and BibLaTeX manuals to find the commands (I don't know LaTeX). These manuals are way more sophisticated than my little assignment! I don't know if there's a primer I overlooked ...

$ pandoc --output wellness-assignment.tex --standalone --biblatex wellness-assignment.md
$ xelatex wellness-assignment
$ biber wellness-assignment
$ xelatex wellness-assignment

^ Worked!

So these are the commands I wish I'd known. It seems like it would be trivial for the --biblatex option to simply call Biber. Then again it may seem trivial only because I don't know LaTeX and its complexities :thinking:

Was this page helpful?
0 / 5 - 0 ratings