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

How to left align a whole table in markdown (pandoc)?

How do you left align an entire table in Markdown/Pandoc? I know about different ways of specifying tables and how alignment of columns are done, but I cannot find a way to shift the table from center aligned to left aligned (have even tryed…
fileunderwater
  • 1,125
  • 2
  • 12
  • 31
17
votes
1 answer

How to convert HTML to Markdown while retaining non-markdown HTML tags?

I'd like to be able to take an existing HTML snippet and convert it to markdown. I've tried pandoc for this purpose: pandoc test.html -o test.md where test.html looked like this: Hello and some more text

some heading

Jeromy Anglim
  • 33,939
  • 30
  • 115
  • 173
16
votes
3 answers

R Markdown add White Space to HTML Output

I've found several suggestions for adding whitespace to R Markdown documents including
, \newpage and some other things. These don't work for my HTML output, maybe there's a better way. I'd like to do two things in the example below: (1) Add…
stackinator
  • 5,429
  • 8
  • 43
  • 84
16
votes
3 answers

NOTE or WARNING from package check when README.md includes images

I have a package with a README.Rmd that I pass to rmarkdown::render() producing README.md and a directory README_files, which contains images in README.md. This looks like the tree below. README_files is not a standard package directory, so if it…
effel
  • 1,421
  • 1
  • 9
  • 17
16
votes
5 answers

pandoc-citeproc error 83 with Rmarkdown file

I have the following document, that I am trying to compile with Rstudio: --- title: shorttitle: author: bibliography: - library.bib output: papaja::apa6_pdf --- ```{r message = FALSE, warning = FALSE} library("papaja") apa_prepare_doc() #…
Ladislas Nalborczyk
  • 725
  • 2
  • 5
  • 20
16
votes
1 answer

Images pushed off slides in beamer output from R markdown

I'm using R markdown v2 to create a beamer presentation. Most of my slides contain an image generated by ggplot, sometimes with explanatory text above that slide. I've found that I really have to individually tweak the size of each element (i.e.…
16
votes
2 answers

Pandoc: Long tablerows in Markdown->PDF documents do not get linewrap

I am using Pandoc to generate markdown->DOCX documents with a lot of tables but would like better control over the layout. I am now trying to output markdown->PDF as well, but have run into problems with table output. In DOCX, long rows with text…
Karl Ivar Dahl
  • 1,023
  • 2
  • 11
  • 23
16
votes
3 answers

Whole site compilation of markdown/pandoc?

With Sphinx-doc, you can create a bunch of ReStructureText files, with an index.rst file which includes a table of contents macro that auto generates a table of contents from the other included files, and a conf.py that acts as a compilation config.…
naught101
  • 18,687
  • 19
  • 90
  • 138
15
votes
1 answer

pdflatex not found. pdflatex is needed for pdf output

I have installed my shiny server on Ubuntu. In addition I installed Texlive- full 2017 on the server as well. The problem is that downloading report from the shiny app on the server does not work (on my local computer is working !!!) the error is…
Ali Hadjihoseini
  • 941
  • 1
  • 11
  • 31
15
votes
1 answer

How do I provide only the year in a citation in R markdown?

My rmarkdown script looks as follows: --- title: "Untitled" author: "me" date: '`r format(Sys.time(), "%d %B, %Y")`' output: pdf_document: default bibliography: bibliography.bib --- In his book Helsel explains how to approach censored…
andschar
  • 3,504
  • 2
  • 27
  • 35
15
votes
1 answer

Text Justification in Rmarkdown word document

When I create the word document in Rmarkdown, text is always left-aligned: Is it possible (and how) to justify the text in Rmarkdown?
Jot eN
  • 6,120
  • 4
  • 40
  • 59
15
votes
2 answers

Where is pandoc installed on Windows?

I have a Windows 8 machine and I just ran the pandoc-1.13-windows.msi installer. The installer did not let me choose an install path, but it finished without error. I cannot run pandoc from the command line so I'm guessing I have to update the path.…
Mark
  • 5,286
  • 5
  • 42
  • 73
15
votes
2 answers

How can I change PDF output font from within the YAML header when using Pandoc on Markdown?

Is there a (built-in) way to set a different font (or fonts) to use in the Pandoc YAML header? Ideally, I would do something like this in the YAML header of my Markdown file: --- font: MySansSerifFontName ... I'm using TexLive on Linux (Ubuntu),…
Kalin
  • 1,691
  • 2
  • 16
  • 22
15
votes
3 answers

How do I include meta tags in Pandoc-generated HTML?

I am using Pandoc to write the contents of a site. How do I include meta tags (specifically, description and keywords tags) on a document, without changing the command line arguments passed to Pandoc? I mean, can I include meta tags somehow in the…
Jay
  • 9,585
  • 6
  • 49
  • 72
15
votes
4 answers

Why does Pandoc not retrieve the image file?

On RStudio version 0.98.501 I had a long .Rmd file which was easily converted to html once I clicked KnitHtml button. The Knitting process, as I understand, created several folders including images (some manually added by myself), figures, cache and…
umair durrani
  • 5,597
  • 8
  • 45
  • 85