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
259
votes
3 answers

Set margin size when converting from Markdown to PDF with pandoc

I have created an RMarkdown file in RStudio and managed to knit it with knitr into an HTML and .md file. Next, I used pandoc to convert the .md file into a PDF file (I get an error if I try and convert from the .html file). However, the PDF that…
mchangun
  • 9,814
  • 18
  • 71
  • 101
253
votes
15 answers

How can I create a text box for a note in markdown?

I am writing a document in markdown. I am using the wonderful pandoc to create docx and tex files from the markdown source. I would like to have a textbox for tips and notes to readers the way programming books often do. I cannot figure out how to…
TJB
  • 3,493
  • 4
  • 23
  • 20
185
votes
8 answers

How to set size for local image using knitr for markdown?

I have a local image that I would like to include in an .Rmd file which I will then knit and convert to HTML slides with Pandoc. Per this post, this will insert the local image : ![Image Title](path/to/your/image) Is there a way to modify this code…
Adam Smith
  • 2,584
  • 2
  • 20
  • 34
180
votes
9 answers

How to convert a Markdown file to PDF

I have a Markdown file that I wish to convert to PDF so that I can upload it on Speakerdeck. I am using Pandoc to convert from markdown to PDF. My problem is I can't specify what content should go on what page of the PDF, because Markdown doesn't…
Akshar Raaj
  • 14,231
  • 7
  • 51
  • 45
142
votes
5 answers

Pandoc markdown page break

Recently I started using Pandoc markdown which seems a good alternative to LaTeX, as my document does not have many mathematical formulas, and I do not have ANY experience with LaTeX, which combined with less than 2 week submission deadline makes it…
LucasSeveryn
  • 5,984
  • 8
  • 38
  • 65
132
votes
3 answers

How to combine two RMarkdown (.Rmd) files into a single output?

I have two files in the same folder: chapter1.Rmd and chapter2.Rmd, with the following content: chapter1.Rmd --- title: "Chapter 1" output: pdf_document --- ## This is chapter 1. {#Chapter1} Next up: [chapter 2](#Chapter2) chapter2.Rmd --- title:…
RobinLovelace
  • 4,799
  • 6
  • 29
  • 40
132
votes
8 answers

How to convert R Markdown to PDF?

I've previously asked about the commands for converting R Markdown to HTML. What is a good way to convert R Markdown files to PDF documents? A good solution would preserve as much as possible of the content (e.g., images, equations, html tables,…
Jeromy Anglim
  • 33,939
  • 30
  • 115
  • 173
128
votes
7 answers

How do I make a reference to a figure in markdown using pandoc?

I'm currently writing a document in markdown and I'd like to make a reference to an image from my text. this is my text, I want a reference to my image1 [here]. blablabla ![image1](img/image1.png) I want to do that reference because after…
Romain Piel
  • 11,017
  • 15
  • 71
  • 106
121
votes
1 answer

Relationship between R Markdown, Knitr, Pandoc, and Bookdown

What is the relationship between the functionality of R Markdown, Knitr, Pandoc, and Bookdown? Specifically what is the 'division of labour' between these packages in converting markup documents with embedded R code (e.g. .Rnw or .Rmd) into final…
RobinL
  • 11,009
  • 8
  • 48
  • 68
95
votes
7 answers

Pandoc and foreign characters

I've been trying to use Pandoc to convert some Markdown into a PDF file. This is a sample that Pandoc will not convert for me: # Header! ## Sub Header themselves derived respectively from the Greek ἀναρχία i.e. 'anarchy' That's just something I…
Mike Thomsen
  • 36,828
  • 10
  • 60
  • 83
79
votes
12 answers

pandoc version 1.12.3 or higher is required and was not found (R shiny)

I have a problem generating a pdf report from my app shiny which is hosted on a server. the app works fine but when I press the button to download the report, I get this error : pandoc version 1.12.3 or higher is required and was not found. The…
Daniele Avancini
  • 899
  • 1
  • 10
  • 14
77
votes
4 answers

Markdown to docx, including complex template

I have automated my build to convert Markdown files to DOCX files using Pandoc. I have even used a reference document for the final document's styling. The command I use is: pandoc -f markdown -t docx --data-dir=docs/rendering/ mydoc.md -o…
Synesso
  • 37,610
  • 35
  • 136
  • 207
76
votes
8 answers

rmarkdown: pandoc: pdflatex not found

When I use the render{rmarkdown} to produce pdf file from .Rmd file on my Mac, an error message says pandoc: pdflatex not found. pdflatex is needed for pdf output. Error: pandoc document conversion failed However when I check with pdflatex -v I…
askming
  • 925
  • 1
  • 6
  • 8
73
votes
2 answers

Plot size and resolution with R markdown, knitr, pandoc, beamer

Doesn't fit on the slide by default, doesn't even print by any other means. Here's the .Rmd: Edit: it seems you have to use plot() in every chunk. Second plot now prints. # Plot should show at high resolution ```{r echo=FALSE, comment = ""} # load…
nacnudus
  • 6,328
  • 5
  • 33
  • 47
69
votes
3 answers

Pandoc convert docx to markdown with embedded images

When converting .docx file to markdown, the embedded image is not extracted from the docx archive, yet the output contains ![](media/image1.png){width="6.291666666666667in" height="3.1083333333333334in"} Is there a parameter that needs to be set in…
JC-
  • 1,200
  • 2
  • 9
  • 12
1
2 3
99 100