A simple pandoc cheat sheet

pandoc is a tool suite for converting between text formats. I find it useful as a writer (rather than a techie) to convert something written in plain text into an RTF file that I can read readily, with some formatting, in a word processor, up to and including the dreaded Word. What I outline here is a tiny fraction of what it can do.

It is as simple as:

$ pandoc -s file.txt -o file.rtf

(Replace ‘rtf’ with html etc to get something else.)

It can convert a file of nothing but typing, but if you use a little simple formatting, pretty much a version of markdown syntax, you can get a nice RTF with some useful extra features (italics, for example). For example, the heading above (‘A simple pandoc…’) was underlined with equals signs on the very next line; when processed, that gives a heading. (Though for proper H1 H2 etc, see below.)

Paragraphing is determined by empty lines, so this text gives one paragraph in the RTF, and…

This text also gives one paragraph in the RTF.

If I want to force a return, I end a line with a backslash.

This will not work inside back ticks (see below), which is the verbatim environment, so for example if I want a bunch of stuff verbatim, including without interparagraph spacing, I end each line with a backslash outside the backtics:

`line 1`\
`line 2`\
`line 3`

will give

line 1
line 2
line 3

Formatting fonts

The word is the character used to delimit the modified text. The code, verbatim, is also given.

underscore _underscore_

dollar (math, which does not translate into RTF) $dollar$

caret (superscript) ^caret^

tilde (subscript) ~tilde~

2 tildes ~~tilde~~

2 underscores __2 underscores__

2 asterisks **2 asterisks**

3 asterisks ***3 asterisks***

back tick `back tick`

Note that the nesting of the instructions matters

***back tick outside 3 asterisks***

3 asterisks outside back tick

2 asterisks outside back tick

1 asterisk outside back tick

Other stuff

(Note, line above was underlined with hyphens on the immediate next line.)

nonbreaking space – precede a space with a backslash, so this bunch of words should not break I hope it is wide enough to show.

block quote > greater than introduces a block quote

block quote, again >> same, bigger indent

H1 (1 hash, #)

H2 (2 hashes, ##)

H3 (3 hashes, ###)

  1. Numbered list

  2. Numbered list still

  3. Numbered list again

– 2 hyphens for en rule

— 3 hyphens for em rule


Some formats (eg HTML) like metadata to be specified. Simplest is to put

% title
% author(s)
% date

at the top of the file (replace ‘title’, ‘author’ and ‘date’ with your own text).