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

How do I add custom formatting to docx files generated in Pandoc?

How can I add custom formatting to docx files generated by Pandoc from, say, Markdown? For example, can I highlight text or center it? Can I restyle links, etc? I know that I can change styles for default elements, like headings, by using a…
citelao
  • 4,898
  • 2
  • 22
  • 36
13
votes
1 answer

Error running filter pandoc-citeproc: Could not find executable pandoc-citeproc

I am attempting to use R Markdown with papaja. I downloaded everything according to this website. I open an APA template, and click "knit". I get this error: Error running filter pandoc-citeproc: Could not find executable pandoc-citeproc I know that…
Katie
  • 323
  • 3
  • 10
13
votes
4 answers

Inline CSS with Pandoc

I apologize if a simple way to this programmatically (not by copying/pasting in a browser field and clicking a button to convert) is documented somewhere. In my searches and reading I cannot find it. I would like to programmatically turn a Markdown…
hcdocs
  • 1,078
  • 2
  • 18
  • 30
13
votes
1 answer

Stopping Pandoc from escaping single quotes when converting from HTML to Markdown

If I convert a single quote ' from HTML to Markdown, it is automatically escaped: % echo "'" | pandoc -f html -t markdown \' I'd like it to output without the slash, as it makes text with contractions rather much harder to read. I thought this…
kdannyob
  • 172
  • 1
  • 7
13
votes
2 answers

kableExtra: Dynamic add_header_above labeling

I would like to create a pdf with rmarkdown. The PDF should contain a table. The table should have a dynamic column label. The tabhead should display the calendar week. However, the calendar week (e.g., KW29) is not displayed but the variable name…
Rene
  • 281
  • 2
  • 8
13
votes
1 answer

How to suppress automatic figure numbering in Rmarkdown / pandoc

I have the following Rmarkdown (.Rmd) document where I call existing .png images and create a .pdf with captions. By default, pandoc? is automatically adding "Figure #." before the caption for each picture. I can see how this would be the normal…
Marc in the box
  • 11,769
  • 4
  • 47
  • 97
13
votes
3 answers

Pandoc - HTML to Markdown - remove all attributes

This would seem like a simple thing to do, but I've been unable to find an answer. I'm converting from HTML to Markdown using Pandoc and I would like to strip all attributes from the HTML such as "class" and "id". Is there an option in Pandoc to do…
trajan
  • 1,093
  • 2
  • 12
  • 15
13
votes
1 answer

pandoc add class to table in markdown

For a heading, for a code-block, for a span element we can with pandoc add {.class} to add a class. # Heading 1 {.my_class_for_heading1} Here is some `code`{.my_class_for_code} and for a [span]{.my_class_for_span} it is working as well and for img…
karelv
  • 756
  • 9
  • 20
13
votes
1 answer

LaTeX multicolumn block in Pandoc markdown

I want to convert a markdown file to html and pdf using pandoc. For the pdf file, which is intended for printing, I'd like to render a block of (narrow) text in two column format. This is what I came up with (and doesn't work): --- papersize:…
m000
  • 5,932
  • 3
  • 31
  • 28
13
votes
1 answer

tightlist error using Pandoc with Markdown

I am using pandoc v. 1.18 on Mac OS 10.12 to transform this markdown file to a pdf, using a simple command line: # A list that does not work - one - two - three And I get this error: ! Undefined control sequence. l.53 \tightlist pandoc: Error…
sbac
  • 1,897
  • 1
  • 18
  • 31
13
votes
1 answer

Pandoc, Markdown to Doc, how to use variables?

AFAIK, variables can be defined in a YAML external file or inside the Markdown file in a header. Then they can be used in the document. I have found examples with two different sytaxes: $variable$ will convert variable to math mode, which is great…
Trylks
  • 1,458
  • 2
  • 18
  • 31
13
votes
1 answer

rmarkdown: how to use multiple bibliographies for a document

[My environment: Win 7 Pro / R 3.2.1 / knitr_1.12.3 / R Studio Version 0.99.892] I am trying to write an article in .Rmd format using R Studio, Knit -> PDF, and I've been following…
user101089
  • 3,756
  • 1
  • 26
  • 53
13
votes
2 answers

pandoc convert html with style sheet to docx

I've been banging my head on this one for a few hours, and I'm sure the solution is quite simple, or non-existent. I'm trying to convert an html file to docx!