3

I recently discovered pandoc and I am trying to get it to process my \cite commands in a .tex file using my CSL file, outputting a formatted PDF. As far as I understand this is something that pandoc can do?

I'm trying to come up with a MWE but no luck so far. This is what I have. I have a folder with the following .tex file

\title{This is the Title}
\author{John Doe}
\begin{document}
\maketitle
\section{Introduction}
Here is some text with a reference to a bibliography citation.\cite{DeLucia:2012tt]
\section{References}
\printbibliography
\end{document}

I have this references.bib file with just a single BibTex entry.

@article{DeLucia:2012tt,
Author = {De Lucia, Luca},
Journal = {Review of European Administrative Law},
Number = {2},
Pages = {17--45},
Title = {{Administrative Pluralism, Horizontal Cooperation and Transnational Administrative Acts}},
Volume = {5},
Year = {2012}}

And I'm using this shell script in OSX Terminal, where I get the following error with regard to my .bib and .csl file: "command not found". Same when I input the full path to these files, i.e. /Users/MyName/Desktop/Folder/name.bib

 pandoc \
-M author="Timothy Roes" \
-M date="June 2, 2016" \
-f latex \
--smart \
--bibliography=references.bib
--csl=citationstyle.csl
-o output.pdf input.tex

And then I have a .CSL file that I used before with Papers.app where it worked splendidly.

  • 1
    If you want to use CSL files you can't use biblatex or BibTeX (or other LaTeX bibliography packages), Pandoc will create the bibliography for you. I have therefore removed the biblatex and BibTeX tags. The document you show looks very TeX-y already, normally Pandoc documents look a bit different. – moewe Jun 26 '16 at 9:31
  • 1
    You need a \documentclass statement in your MWE, for instance \documentclass{article}. – A Feldman Jun 26 '16 at 11:05
2

Seems like some typos and syntax errors were responsible for the issues.

In the tex file:

  • missing \documentclass
  • missing biblatex setup
  • \cite closed with ] instead of }

after fixing that the MWE compiled fine

In the script:

  • syntax for metadata is -M KEY:VALUE not -M KEY=VALUE
  • all line breaks have to be escaped with a \

So, here are the files

\documentclass{article}
\usepackage{biblatex}
\addbibresource{references.bib}
\title{This is the Title}
\author{John Doe}
\begin{document}
\maketitle
\section{Introduction}
Here is some text with a reference to a bibliography citation.\cite{DeLucia:2012tt}
\section{References}
\printbibliography
\end{document}

and the script

pandoc input.tex -s -S\
    -M author:"Timothy Roes" \
    -M date:"June 2, 2016" \
    --bibliography=references.bib --csl=citationstyle.csl \
    -o output.pdf

putting it together (using chicago-note-bibliography.csl) results in the following

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.