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

Reduce cell width and font size of table using pandoc.table()

I'm using knitr and pander to make a table in a markdown file. I'm converting the markdown file to a PDF using Pandoc from within R. This code: library(knitr) ```{r myTable, echo=FALSE, message=FALSE, results='asis',…
luciano
  • 13,158
  • 36
  • 90
  • 130
19
votes
4 answers

How to use Pandoc image alignment to align two images in the same row?

From the pandoc documentation I know how to insert an image http://johnmacfarlane.net/pandoc/README.html#images Now I want to align two images in the same row, how can I do that? My desired output format is pdf.
LittleSweet
  • 534
  • 2
  • 6
  • 9
18
votes
4 answers

Specifying papersize for md to pdf conversion

I've read you can specify papersize by pandoc -V papersize:"a4paper" .... This doesn't seem to work anymore. I've managed to specify B5 using pandoc -V papersize:b5 -o out.pdf in.md But this fails for e.g. b6. The following -V arguments also all…
geotheory
  • 22,624
  • 29
  • 119
  • 196
18
votes
4 answers

How to make a figure caption in Rmarkdown?

I am thinking about writing my thesis with rmarkdown and latex. I'm getting the hang of how it all works, however, when I try to add a figure (not an R plot) to the text and render it to pdf, the caption and in-text reference dissappear. This is…
rosannavh
  • 195
  • 1
  • 1
  • 9
18
votes
3 answers

Preserve line breaks in title using pandoc

Consider the following title block in pandoc-flavored Markdown: % Higgelty Pigglety Pop! or There Must Be More to Life % Maurice Sendak Here, line breaks are part of the title. It is possible to reformat the title in order to insert it into…
A. Donda
  • 8,381
  • 2
  • 20
  • 49
18
votes
1 answer

*Some* figure captions from RMarkdown not showing

Essentially, I have a Rmd document configured like this: --- title: "Example" author: "me" date: "December 2014" output: pdf_document: fig_caption: yes keep_tex: yes -- Then, in the document, I use ggplot2 to show some charts, for…
fnl
  • 4,861
  • 4
  • 27
  • 32
18
votes
2 answers

Posiible to use pandoc with HTML containing base64 inline images?

I want to convert an HTML file containing base64 encoded images to DOCX. When I do this using pandoc the base64 images are not converted. Is it possible to include the base64 images using pandoc?
Mark Heckmann
  • 10,943
  • 4
  • 56
  • 88
18
votes
2 answers

How to convert HTML with mathjax into Latex using Pandoc?

I have some HTML documents with MathJax equations, and I want to convert them to Latex, and then to pdf. I'd like to use Pandoc. However, Pandoc replaces $ with \$ and it replaces \ in formulas with \textbackslash{}. Is it possible to get Pandoc to…
Jeromy Anglim
  • 33,939
  • 30
  • 115
  • 173
17
votes
1 answer

How can I modifiy the positions of the text and logo on RMarkdown title slide

Because of the picture I have at the bottom of my title slide, I want to: move all title, subtitle and author up from their center positions. remove the Rlogo in the title slide only (don't really know how to do it). I could only remove slide…
Tung
  • 26,371
  • 7
  • 91
  • 115
17
votes
1 answer

How can we pass pandoc_args to yaml header in rmarkdown?

I'm using rmarkdown to produce a word (.docx) report. I would like to change the header of the toc. This seems possible as pandoc_args can be passed as options in the yaml header in the case of a doc file (1). But I'm not doing it right. Could…
Cedric
  • 2,412
  • 17
  • 31
17
votes
1 answer

Not able to use titlesec with markdown and pandoc?

When I used titlesec in my markdown document as below: --- header-includes: - \usepackage{titlesec} --- when processing it by pandoc, I got the following error: pandoc try.md -o try.pdf ! Argument of \paragraph has an extra }.
Yu Shen
  • 2,770
  • 3
  • 33
  • 48
17
votes
1 answer

Where in the world is my pandoc directory?

I am trying to add a custom latex template for pandoc I know that pandoc templates go in ~/.pandoc/templates and I confirmed the pandoc directory location by typing pandoc --v - it says pandoc is in ~/.pandoc but when I do cd ~/.pandoc: -bash: cd:…
invictus
  • 1,821
  • 3
  • 25
  • 30
17
votes
1 answer

Vim syntax and Latex math inside markdown

I write documentation in markdown using ViM and I also put math using the latex $$ symbol (I compile using pandoc). The thing is that ViM syntax wouldn't ignore the underscores _ inside the dollar symbols and it is pretty annoying. For instance if I…
sharp
  • 171
  • 1
  • 4
17
votes
3 answers

RMarkdown: How to change headline in table of contents in R Markdown?

When I'm using the toc: yes command, the document contains "Content" as the headline of the table of contents. Due to the fact that I want to write this document in german, I also want to change the headline of the table of contents to the…
Metamatics
  • 173
  • 1
  • 5
17
votes
1 answer

How to do cell vertical alignment in markdown/pandoc table?

Is there a way to to specify the vertical alignment of table cell contents in markdown/pandoc? Details: The default behavior is center alignment, I want cell contents to be aligned to the top of the cell. For an example of the default behavior: | …
Mustafa
  • 1,814
  • 3
  • 17
  • 25