How to convert mediawiki syntax to latex?

I'm surprised no one has mentioned Pandoc yet. Quoting its website:

Pandoc can convert documents in markdown, reStructuredText, textile, HTML, DocBook, LaTeX, MediaWiki markup, TWiki markup, OPML, Emacs Org-Mode, Txt2Tags, Microsoft Word docx, LibreOffice ODT, EPUB, or Haddock markup to

  • HTML formats: XHTML, HTML5, and HTML slide shows using Slidy, reveal.js, Slideous, S5, or DZSlides.
  • Word processor formats: Microsoft Word docx, OpenOffice/LibreOffice ODT, OpenDocument XML
  • Ebooks: EPUB version 2 or 3, FictionBook2
  • Documentation formats: DocBook, GNU TexInfo, Groff man pages, Haddock markup
  • Page layout formats: InDesign ICML
  • Outline formats: OPML
  • TeX formats: LaTeX, ConTeXt, LaTeX Beamer slides
  • PDF via LaTeX
  • Lightweight markup formats: Markdown (including CommonMark), reStructuredText, AsciiDoc, MediaWiki markup, DokuWiki markup, Emacs Org-Mode, Textile

It's a command-line tool. Usage:

pandoc input.txt -f mediawiki -t latex --standalone -o output.tex

If you're working from within a MediaWiki, there is the wiki2latex extension.


The software doing that is licensed freely under GPL and can be obtained from:

http://de.wikibooks.org/wiki/Benutzer:Dirk_Huenniger/wb2pdf

You may download the binary for Windows from there too.

On Ubuntu 16.04 or higher it is

sudo apt-get install mediawiki2latex

and then call the program by, for instance,

mediawiki2latex -u https://en.wikipedia.org/wiki/Adam_Ries -o AdamRies.pdf