Questions tagged [pandoc]

Pandoc is an open-source, command-line, universal document converter for converting between various markup formats.

If you need to convert files from one markup format into another, pandoc is your swiss-army knife. Pandoc can convert documents in any of thirty supported input formats, e.g., Markdown, reStructuredText, textile, HTML, DocBook, or LaTeX, to more than fifty output formats:

Pandoc understands a number of useful Markdown syntax extensions, including document metadata (title, author, date); footnotes; tables; definition lists; superscript and subscript; strikeout; enhanced ordered lists (start number and numbering style are significant); running example lists; delimited code blocks with syntax highlighting; smart quotes, dashes, and ellipses; Markdown inside HTML blocks; and inline LaTeX. If strict Markdown compatibility is desired, all of these extensions can be turned off.

LaTeX math (and even macros) can be used in Markdown documents. Eight different methods of rendering math in HTML are provided, including MathJax and translation to MathML. LaTeX math is rendered in docx using native Word equation objects.

Pandoc includes a powerful system for automatic citations and bibliographies, using Andrea Rossato’s citeproc-hs. This means that you can write a citation like

[see @doe99, pp. 33-35; also @smith04, ch. 1]

and pandoc will convert it into a properly formatted citation using any of hundreds of CSL styles (including footnote styles, numerical sytles, and author-date styles), and add a properly formatted bibliography at the end of the document. Many forms of bibliography database can be used, including bibtex, RIS, EndNote, ISI, MEDLINE, MODS, and JSON citeproc. Citations work in every output format.

Pandoc includes a Haskell library and a standalone command-line program. The library includes separate modules for each input and output format, so adding a new input or output format just requires adding a new module.

Pandoc is free software, released under GPL2-or-later. © 2006-2020 John MacFarlane.

2486 questions
15
votes
1 answer

How do I insert a block quote within a paragraph using Pandoc?

I am using pandoc to convert from markdown to LaTeX. My problem is that Pandoc seems to interpret paragraph text following a block quote as the start of a new paragraph. While this is often what I want, there are many times that I want to continue…
user2764840
  • 261
  • 1
  • 2
  • 6
15
votes
2 answers

Is there an option to control output page orientation (using knitr->pander->pandoc->docx)

I am playing with Tal's intro to producing word tables with as little overhead as possible in real world situations. (Please see for reproducible examples there - Thanks, Tal!) In real application, tables are to wide to print them on a…
aae
  • 439
  • 7
  • 18
15
votes
1 answer

Autocomplete Pandoc-style citations from a Bibtex file in Emacs

Pandoc-style citations Pandoc uses a Markdown format that supports automatic citations using keys from BibTeX files. Some examples for the format are: Blah blah [@doe99] Blah blah [@doe99, p.33] Blah blah [see @doe99, pp. 33-35; also @smith04, ch.…
lecodesportif
  • 10,737
  • 9
  • 38
  • 58
15
votes
1 answer

How to convert reStructuredText files with images to markdown?

I have rst files containing lines like .. figure:: examples/foo.png :scale: 80% Fig. 1 : Illustration of the awesomeness of stackoverflow now I want this file to be converted into markdown. I tried using pandoc, pandoc -s -w rst --toc…
nye17
  • 12,857
  • 11
  • 58
  • 68
14
votes
2 answers

Remove \hypertarget from pandoc LaTex output

I am using pypandoc to convert a markdown file to LaTex. My markdown file has a header, for example: # Header Text # When pypandoc renders the file as a .tex file, this appears as: \hypertarget{header-text}{% \section{Header…
rsgny
  • 565
  • 1
  • 6
  • 17
14
votes
1 answer

How to get a second bibliography?

In rmarkdown PDF and HTML I want two bibliographies—one for papers/books, and one for software I have used in my research. I found this related issue but it doesn't answer my question since it's concerning the combination of two *.bib files into one…
jay.sf
  • 60,139
  • 8
  • 53
  • 110
14
votes
2 answers

CRAN notes that files cannot be checked without ‘pandoc’ being installed

In doing final checks on a CRAN package submission, this NOTE comes up: * checking top-level files ... NOTE Files ‘README.md’ or ‘NEWS.md’ cannot be checked without ‘pandoc’ being installed. However, pandoc is definitely installed as I use it…
dshkol
  • 1,208
  • 7
  • 23
14
votes
1 answer

Is it possible to set default options for pandoc?

Is it at all possible to set default options for pandoc? For example, I always want to use xelatex to generate PDFs, and as far as I can tell, my options for doing so are to pass --latex-engine=xelatex to every invocation of pandoc, or to write a…
Michael M.
  • 613
  • 6
  • 14
14
votes
2 answers

knit DT::datatable without pandoc

I am trying to use DT::datatable to output a nicely formatted, interactive table in R. ...only problem is that I want a heroku job to knit the document for me, and I've learned that RStudio and rmarkdown::render() use pandoc under the hood -- but…
Andrew
  • 9,090
  • 8
  • 46
  • 59
14
votes
2 answers

Changing the Pandoc monospace font size or style in DOCX output

When using markdown code blocks the resulting monospace font size is too large in DOCX documents. I can adjust the font size of paragraphs by specifying a custom template.docx file, but for some reason the generated code blocks do not use a…
Karl Ivar Dahl
  • 1,023
  • 2
  • 11
  • 23
14
votes
2 answers

Compile multiple files into one with title blocks

I'd like to know how to compile multiple pandoc files into one output document, where each input file has a title block. E.g. suppose I have two files: ch1.md: % Chapter 1 % John Doe % 1 Jan 2014 Here is chapter 1. ch2.md: % Chapter 2 % Jane…
mathematical.coffee
  • 55,977
  • 11
  • 154
  • 194
14
votes
1 answer

Adding a title page, page headers and footers using Pandoc

How do you specify that Pandoc should use a specific header and footer when generating a PDF from Markdown? Currently I use the following to create my doc from the command line: pandoc -s -V geometry:margin=1in --number-sections -o doc.pdf…
Jack
  • 16,506
  • 19
  • 100
  • 167
14
votes
1 answer

centre title in PDF converted from markdown using Pandoc

I'm converting a markdown document to a PDF document using Pandoc from within R. I'm trying to centre the title. So far, I've tried:
# This is my title
and -># This is my title<- but neither have worked. Is there a way to centre…
luciano
  • 13,158
  • 36
  • 90
  • 130
14
votes
4 answers

Using table caption on R markdown file using knitr to use in pandoc to convert to pdf

I am wondering if it is possible to use the table captions like figure captions using knitr in .Rmd file ? I saw options for figure caption but I couldn't see the option for the table caption. I also want to remove the message such as "% latex…
Jd Baba
  • 5,948
  • 18
  • 62
  • 96
14
votes
1 answer

Pandoc: Converting markdown to HTML, syntax highlighter

I'm converting markdown to HTML, and I want to include syntax-highlighted code. I'm working from some markdown that contains syntax like: ~~~ {.c} long factorial (int n) { long result = 1; while (n > 1) result *= n--; return…
Rose Perrone
  • 61,572
  • 58
  • 208
  • 243