Philipp's Computing Blog

Success is about speed and efficiency

Use pandoc To Convert LaTeX to Markdown

Pandoc is a tool to convert documents from one format to another and it supports quite some formats! You can test it and convert small docs online: http://johnmacfarlane.net/pandoc/try

Supported input formats include

  • markdown,
  • html,
  • latex, and rst.

Note that the rst reader only parses a subset of reStructuredText syntax. (The latex and html input readers are limited in what they can do.)

Supported output formats include

  • markdown,
  • latex,
  • context (ConTeXt),
  • html, rtf (rich text format),
  • rst (reStructuredText),
  • docbook (DocBook XML),
  • opendocument (OpenDocument XML),
  • odt (OpenOffice text document),
  • texinfo, (GNU Texinfo),
  • mediawiki (MediaWiki markup),
  • epub (EPUB ebook),
  • man (groff man),
  • slidy (slidy HTML and javascript slide show), or
  • s5 (S5 HTML and javascript slide show).

To install pandoc on Ubuntu, run:

sudo aptitude install pandoc

To convert the LaTeX file report.tex from LaTeX to Markdown do:

pandoc -o report.txt report.tex

You can also specify the input and output format explicitly using:

pandoc -f latex -t markdown -o report.txt report.tex

A more cutting-edge version can be installed using

sudo apt-get install cabal-install
cabal update
cabal install pandoc

Resources