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
21
votes
1 answer

Markdown preview in emacs fails: (pandoc?) error 127

I am trying to create a markdown document in Emacs *. It does highlight the syntax etc. and goes into Markdown mode (I am not quite sure if I installed that package or if it is standard issue).. Problem: When I try to create a preview (either via…
patrick
  • 4,455
  • 6
  • 44
  • 61
21
votes
1 answer

Adding a footnote / thanks to Rmarkdown title slide

I have to include a note in my title slide declaring the source of my funding. I was able to do this in LyX / LaTeX through: \author{Michael Chirico\thanks{These people gave me money}, Other Authors} I have not been able to reproduce this in…
MichaelChirico
  • 33,841
  • 14
  • 113
  • 198
21
votes
1 answer

How do I add citations and a bibliography to "Rpres" rmarkdown presentations?

This page: http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html describes adding citations and a generated bibliography to regular rmarkdown documents. When authoring presentations using rmarkdown, this method works for…
Brian G. Peterson
  • 3,531
  • 2
  • 20
  • 21
21
votes
1 answer

How do I produce R package vignettes in multiple formats?

I use knitr and rmarkdown to write vignettes for R packages. Thanks to the magic of pandoc it is easy to turn these documents into a variety of formats. I would like to take advantage of this by offering vignettes as both HTML and PDF. There is…
Peter Humburg
  • 550
  • 5
  • 15
21
votes
1 answer

IPython (Jupyter) MathJaX preamble

Question How can I setup a MathJax "preamble" for use in IPython (or Jupyter) notebooks for repeated use in a way that is convenient for others to read my documents (on http://nbviewer.org) and that works for LaTeX/PDF generation? Background I…
mforbes
  • 7,062
  • 3
  • 16
  • 21
21
votes
5 answers

How to set the font size for code blocks in pandoc markdown?

this small example: An example code snippet: ~~~{.cpp} class A { public: static void f1 () {}; virtual void f2 () = override; }; ~~~ can be used to generate a PDF output with: pandoc -o block-code.pdf…
tmaric
  • 5,347
  • 4
  • 42
  • 75
21
votes
5 answers

Automatically create bibliography from bibtex in pandoc/markdown without inline citations

How can I automatically create a citations list from a bibtex file, preferably in markdown (more specifically, pandoc) format? I'm in the process of building my personal, academic website. As most personal, academic websites do, I am including a…
cledoux
  • 4,717
  • 1
  • 22
  • 30
20
votes
5 answers

Building docs fails due to missing pandoc

The problem I am having trouble getting my docs to build successfully when clicking "Build" on the readthedocs.io web interface, but it builds just fine on my local machine. To test that it is an environment issue, I created a virtual…
keirasan
  • 365
  • 2
  • 6
20
votes
1 answer

Why pandoc keeps span and div tags when converting html to markdown?

I'm a pandoc newbie, so I must be missing something obvious. I'm trying to convert MS Word generated HTML file to markdown. Here is a test html:
igorludi
  • 1,519
  • 2
  • 18
  • 31
20
votes
1 answer

Reduce space between code chunks and code output in rmarkdown beamer presentation

I'm building a presentation using rmarkdown and LaTeX/Beamer. I would like to reduce the spacing between the displayed R-commands and R-output. I believe this is related to the paragraph spacing options in LaTeX/Beamer. Is this something I should do…
RyanStochastic
  • 3,963
  • 5
  • 17
  • 24
20
votes
2 answers

Chunk reference using knitr, r markdown and pandoc (pander)

I am having trouble trying to reference chunks within a r markdown document which I am trying to convert to .pdf using pandoc.convert. If I include \label{mylabel} within the text - I can reference this by \ref{mylabel}. However, I thought I might…
Jimichanga1
  • 333
  • 2
  • 5
20
votes
3 answers

Set double spacing and line numbers when converting from Markdown to PDF with pandoc

I am using markdown & pandoc for scientific writing, I know I can change margins of the final pdf using Set margin size when converting from Markdown to PDF with pandoc but very often the journals require double lines and line numbers in submitted…
Leosar
  • 2,010
  • 4
  • 21
  • 32
19
votes
1 answer

Authors and affiliations in the YAML of RMarkdown

I know this question was already asked in the past in this forum (1, 2, 3). Before you mark this as duplicated, I tried all the answers with no success. Most of the questions were asked long ago, and some updates related with pandoc might affect…
antecessor
  • 2,688
  • 6
  • 29
  • 61
19
votes
3 answers

How to move the bibliography in markdown/pandoc

I'm currently writing my bachelor thesis and my instructor wants me to put my appendix after the bibliography but markdown/pandoc puts the references at the end by default. I read the instructions at http://yihui.name/knitr/demo/pandoc/ and tried to…
mockstr
  • 193
  • 1
  • 6
19
votes
6 answers

Regression tables in Markdown format (for flexible use in R Markdown v2)

The new version of R Markdown is based on pandoc, so you can easyly change the output format. My Problem is to get markdown formated tables from e.g. regression models, because LATEX and HTML tables do not survive the pandoc conversion. I know…
sammerk
  • 1,143
  • 1
  • 9
  • 23