# Latex default citation and bibliography style with Pandoc

I write a paper in Markdown and convert it to PDF via Pandoc and Latex with the following commands to get Latex's (well, BibLatex's) default citation and bibliography style:

``````pandoc -s --bibliography=foo.bib --biblatex -o foo.tex foo.md
pdflatex foo.tex
bibtex foo.aux
pdflatex foo.tex
pdflatex foo.tex
``````

Of course I could just let Pandoc produce a PDF file directly like this:

``````pandoc --bibliography=foo.bib --csl=foo.csl -o foo.pdf foo.md
``````

However, despite an extensive search on zotero.org/styles I did not find a CSL style that

1. closely matches Latex's default citation style "plain" (with inline citations like "blah blah [1]") and
2. produces bibliography entries that are suited for a German document (with pages abbreviated as "S." instead of "pp.", publishers as "Hrsg." instead of "Eds.", etc.) without errors like missing dots after abbreviations and the like.

So here's my question:

Is there an easier way to use native Latex citation and bibliography stuff via Pandoc than the commands above? I don't care about typing more or less commands (Makefile ftw), I just wonder if it's necessary to create an intermediate Latex file at all.

Alternatively, can anybody point me to a decent CSL file for German (Computer Science) texts?

• What do you normally use in your preamble for latex citations formatted the way you want them? – dfc Oct 24 '14 at 2:59
• @dfc I use the documentclass scrartcl (a specific german class like the standard article class) and the packages babel/ngerman, biblatex, and some more that I don't think have any influence on the bibliography. – marhop Oct 24 '14 at 21:47

After some more experiments and reading documentation I am pretty sure there is no way to avoid creating an intermediate Latex file if one wants to use native Latex citation and bibliography power.

The reason is with Pandoc we can apparently use one of two possible techniques to produce bibliographic references: Either CSL files (with the `--csl` setting) or Latex citations (with the `--biblatex` or `--natbib` settings). CSL files can be used with every output format, Latex citations can only be used if the output format is, well, Latex.

But why? Because when creating Latex output with the `--biblatex` or `--natbib` settings, Pandoc converts Markdown references like `[@foo, p. 20]` into Latex commands like `\autocites[p. 20]{foo}`. When converting the Latex file to PDF, these commands will be processed by pdflatex and thus produce the beautiful output I am looking for. Obviously, creating such Latex commands in any other output format would be rather vain.

When invoked with the `--csl` option, on the other hand, Pandoc directly converts Markdown references like the above into text like "(Knuth 1970, p. 20)", depending on the CSL style. This is actually pretty cool because that way the citations will be "hardcoded" and thus look like they are specified in the CSL file in every output format. The drawback is of course that if I do not find a CSL file that suits my needs, I have to go the Markdown -> Latex -> PDF way.

What still makes me wonder is why the `--biblatex` and `--natbib` settings cannot be used when creating PDF output. If I am not mistaken, Pandoc produces PDF via Latex anyway, so why not use the full power of Latex? But anyway, I think I can totally live with the way described in my question ;-)

• "The drawback is of course that if I do not find a CSL file that suits my needs, [...]" -- WAAAAT?!? If you look at www.zotero.org/styles you'll see more than 8.000 (!) styles, and you can even preview them (sources are even public, on GitHub: github.com/citation-style-language/styles). If you still don't like one of these, you really are due to write your own CSL. And if it's a publisher or university, which has unreasonable demands regarding the style -- tell them to give you their CSL style... – Kurt Pfeifle May 15 '16 at 20:24
• @KurtPfeifle You are certainly right, and next time I will probably try the CSL way again. But when I just want my citations to look exactly like the Latex way, there is no point for me in searching through 8000 CSL styles for one that emulates the Latex look (which I did to some extent, but as I mentioned, lots of them did not get the details right) when I can just use the original Latex engine ;-) And concerning writing my own CSL style: That may be interesting, but when I am in the middle of writing my thesis, my time is better spent with anything but authoring CSL styles ;-) – marhop May 17 '16 at 8:05
• "...want my citations to look exactly like the Latex way," -- Can you show me an example screenshot of that way? IMHO, there is no single "THE" LaTeX way. LaTeX can do it in multiple ways, too. And what Pandoc does: it uses LaTeX in the background anyway... – Kurt Pfeifle May 17 '16 at 22:20
• @KurtPfeifle Do you happen to know about a CSL, which exactly matches the `natbib` format, which one could use to circumvent that in between bibtex step? – Zelphir Kaltstahl Nov 3 '16 at 9:33
• @Zelphir: Sorry, I don't happen to know such a CSL. My advice to you is: go to this Zotero site, using a modern browser. There you can then see previews of the renderings for all the available styles by just "mousing over" their names. – Kurt Pfeifle Nov 3 '16 at 10:07

I'm German too. Did you try "Deutsche Gesellschaft für Psychologie"? It seems to do what you want. Otherwise, you could edit it here:

http://editor.citationstyles.org/styleInfo/?styleId=http%3A%2F%2Fwww.zotero.org%2Fstyles%2Fdeutsche-gesellschaft-fur-psychologie