Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pandoc not converting latex style citations correctly

I want to use latex-style citations \cite{key} in my markdown so that I can create tex and pdf documents nicely using pandoc. However, when I cite something, it shows the keyword in brackets instead of the citation style, such as author name or citation number. In other words, I want it to show up in the PDF as "This is my citation [1]" but instead it is appearing as "This is my citation [mykey]". Also, my references list isn't showing up after I add my # References header. What is going on here?

Below is my sample command for producing this along with the sample files and my current incorrect output file (test.pdf).

pandoc test.md --biblatex --biblio test.bib --csl chicago-author-date.csl -o test.pdf

test.md

% My test pandoc-ument

I want to reference this: \cite{Gepasi1993}

# References

test.bib

@ARTICLE{Gepasi1993,
    Author         = {P. Mendes},
    Journal        = {Comput. Applic. Biosci.},
    Pages          = {563--571},
    Title          = {GEPASI: A software package for modelling the dynamics, steady states and control of biochemical and other systems.},
    Volume         = {9},
    Year           = {1993}
}

test.pdf

I want to reference this: [Gepasi1993]
like image 869
user1027169 Avatar asked Jan 12 '13 00:01

user1027169


People also ask

Does Pandoc need LaTeX?

By default, pandoc will use LaTeX to create the PDF, which requires that a LaTeX engine be installed (see --pdf-engine below). Alternatively, pandoc can use ConTeXt, roff ms, or HTML as an intermediate format. To do this, specify an output file with a .

What citation format does LaTeX use?

LaTex allows you to manage citations within your document through the use of a separate bibtex file ( filename. bib ).

Can Pandoc convert from PDF?

You can't. You can try opening the PDF in Word or Google Docs and saving in a format from which pandoc can convert directly.


1 Answers

The --biblatex option is not for writing biblatex directly in markdown. What it does is convert native pandoc markdown citations, like

[@Gepasil1993, p. 5] 

to biblatex citations in LaTeX output.

If you use pandoc markdown citations instead of the LaTeX ones, you'll find that the citations work. Use this command:

pandoc test.md --biblio test.bib --csl chicago-author-date.csl -o test.pdf 

with this input:

I want to reference this: [@Gepasi1993] 

Pandoc's citation format is documented in the Pandoc User's Guide.

If you really want to use raw biblatex citations in your markdown input, you can, but then you need to take care of the bibliography stuff yourself. You'd do it this way:

pandoc test.md --parse-raw -t latex -s > test.tex 
pdflatex test 
biber test 
pdflatex test 
pdfltatex test 
like image 121
John MacFarlane Avatar answered Sep 20 '22 17:09

John MacFarlane