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
69
votes
2 answers

Simple manual RMarkdown tables that look good in HTML, PDF and DOCX

How can I manually and simply format a table in RMarkdown that will look good when converted to HTML (using the knitr and markdown packages), PDF (using pandoc and miktex) and docx (using pandoc)? I want to be able to write small tables in…
Ben
  • 41,615
  • 18
  • 132
  • 227
60
votes
3 answers

Setting document title in Rmarkdown from parameters

I've got an Rmarkdown template that works well, and I've parameterized it so I can generate variants of the same report from different data sources. However, I'd like to change the title of the report in each case. How do I do that? Here's the YAML…
Harlan
  • 18,883
  • 8
  • 47
  • 56
59
votes
4 answers

What can I control with YAML header options in pandoc?

Only by chance did I see an example document using the toc: true line in their YAML header options in a Markdown file to be processed by Pandoc. And the Pandoc docs didn't mention this option to control table of contents using the YAML header.…
Kalin
  • 1,691
  • 2
  • 16
  • 22
55
votes
8 answers

Figure position in markdown when converting to PDF with knitr and pandoc

I'm trying to control the position of a plot when converting to PDF using knitr and pandoc. My .Rmd file looks this: # My report Some text some text some text some text some text some text some text some text some text ```{r myplot, echo=FALSE,…
luciano
  • 13,158
  • 36
  • 90
  • 130
52
votes
3 answers

From Markdown to PDF: how to change the font-size with Pandoc?

I'm converting some Markdown files into PDF using Pandoc like this: pandoc input.md -V geometry:margin=1in -o output.pdf By default, the font-size is quite small in the pdf. I'd like to make all the fonts bigger (title, sub title, text, etc.). How…
pimpampoum
  • 5,816
  • 6
  • 24
  • 27
50
votes
1 answer

Disable page numbering converting markdown to pdf with pandoc

I am converting a markdown file to pdf using pandoc. How can I suppress page numbers in the pdf file?
sieste
  • 8,296
  • 3
  • 33
  • 48
49
votes
4 answers

Pandoc: What are the available syntax highlighters?

Bullet point 18 of http://pandoc.org/demos.html#examples shows how to change the syntax highlighter used by giving an argument to --highlight-style. For example: pandoc code.text -s --highlight-style pygments -o example18a.html pandoc code.text -s…
user1002119
  • 3,692
  • 4
  • 27
  • 30
49
votes
11 answers

How to add a page break in word document generated by RStudio & markdown

I writing a Word document with R markdown in R Studio. I can get many things, but at the moment I am not figuring out how can I get a page break. I have found solutions but only for rendered latex / pdf document that it is not my case.
Giorgio Spedicato
  • 2,413
  • 3
  • 31
  • 45
47
votes
3 answers

Poor resolution in knitr using Rmd

I have a .Rmd file and I am trying to create a .docx file via the function pandoc. I want to have a figure with final resolution of 504x504 pixels (i.e., 7x7inch with 72dpi). Unfortunately, the default 72 dpi is too poor in quality, and I would…
dbarneche
  • 645
  • 1
  • 5
  • 8
43
votes
14 answers

pandoc document conversion failed with error 43 : pdflatex: The memory dump file could not be found

RStudio : 0.98.994 OS: Microsoft Windows 7 Ultimate Edition, 64-bit Service Pack 1 MiKTeX: 2.9.4503 Hi, I get the following error when I try to knit a PDF document. pandoc.exe: Error producing PDF from TeX source. This is pdfTeX, Version…
38
votes
3 answers

Pandoc Markdown to PDF image position

When converting a Markdown document to PDF with pandoc, my images are not placed in the same position I put them in the source code. I believe this is due to the conversion through LaTeX, but I'm not sure how to remedy this in the Markdown…
squirl
  • 1,636
  • 1
  • 16
  • 30
38
votes
6 answers

Slides with Columns in Pandoc

I would like to have code and an image side-by-side in a Beamer slide. In LaTeX I would do this with columns. I would like to use markdown within the column structure. \begin{columns} \column{.5\textwidth} ~~~~~~~~Python >>> some python…
MRocklin
  • 55,641
  • 23
  • 163
  • 235
37
votes
2 answers

pandoc doesn't text-wrap code blocks when converting to pdf

I'm using pandoc with xelatex engine to convert markdown to pdf. I'm running pandoc like this: pandoc -s 'backbone-fundamentals'.md -o 'backbone-fundamentals'.pdf \ --title-prefix 'Developing Backbone.js Applications' \ --normalize \ …
skud
  • 536
  • 1
  • 4
  • 9
36
votes
6 answers

Knitr & Rmarkdown docx tables

When using knitr and rmarkdown together to create a word document you can use an existing document to style the output. For example in my yaml header: output: word_document: reference_docx: style.docx fig_caption: TRUE within this style…
zacdav
  • 4,603
  • 2
  • 16
  • 37
36
votes
3 answers

Chrome rendering MathJax equations with a trailing vertical line

I am working through Andrew Ng's machine learning course on Coursera using the Octave kernel for Jupyter and of course MathJax provides the equation rendering. This thin bar appears on the right side of every equation, and only in Chrome. Any…
Niels
  • 1,513
  • 1
  • 14
  • 21