I think I've seen a script for converting mediawiki syntax to Latex. Also, in case there are more than one solution for this, it might be nice to summarize them here.

10 Answers 10


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
  • I added this as the correct answer, as it seems to be the most up to date and portable solution, as of 2016. May 30, 2016 at 12:38
  • How about the mathematical formulas? For example, I would like to extract the Spearman's Correlation coefficient formula to a LaTeX file so that I do not have to type it in Latex manually. en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient
    – Ahmadov
    Aug 18, 2016 at 15:13
  • 1
    @Ahmedov, that works fine. :<math>r_s = \rho_{\operatorname{rg}_X,\operatorname{rg}_Y} = \frac {\operatorname{cov}(\operatorname{rg}_X,\operatorname{rg}_Y)} { \sigma_{\operatorname{rg}_X} \sigma_{\operatorname{rg}_Y} }</math> becomes \[r_s = \rho_{\operatorname{rg}_X,\operatorname{rg}_Y} = \frac {\operatorname{cov}(\operatorname{rg}_X,\operatorname{rg}_Y)} { \sigma_{\operatorname{rg}_X} \sigma_{\operatorname{rg}_Y} }\]. In other words, there's not a whole lot of conversion going on in the formulas. Oct 16, 2016 at 22:52
  • 1
    This might be a stupid question, which I couldn't figure out by googling: How do you access the medakiwi (.wiki) file of an article? And if accessed, that should be saved as input.text in that case?
    – psyguy
    Mar 16, 2022 at 13:29
  • @psyguy 1. On the Wikipedia page, click "Edit". 2. On the top-right corner of the editor, click the pencil. 3. Choose "Source editing". Oct 10, 2023 at 20:37

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:


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

Zim is WYSIWYG desktop note-taking application with a wiki markup that can directly export their .txt pages to HTML or LaTeX code. It is available for Windows, BSD and Linux (included in several distributions). It can export single pages or complete notebooks.

A simple page of Zim, their internal wiki code and the compiled LaTeX export as article is showed below:


Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-10-05T19:09:32+02:00

====== Testing Zim ======

===== Title 2 =====

==== Title 3 ====

=== Title 4 ===

== Title 5 ==

Some text  normal **bold** //italic// __underlined__
~~deleted~~ normal ''literal ''_{ sub} ^{super}

* item
* item
* item

[*] item checked
[ ] item not checked


  • 1
    Unfortunately it doesn't use MediaWiki mark up, but its own format Dec 29, 2013 at 14:43
  • 1
    @AlexeyGrigorev, Yes, but for simple pages can be useful. If you simply make a search & replace from ''' to ** and from '' to // (in that order, obviously) you can later import the MediaWiki code with bolds and italics working, and the titles, the [[links]] and the itemized list are imported without modification.
    – Fran
    Dec 30, 2013 at 11:13

This perl script seems to be the script I was thinking of.

  • 2
    It says: "Update: Don't use this. Use Pandoc instead!" Aug 28, 2015 at 14:22

Javalatex seems like a very interesting project, and should have support for this. (Haven't tried them yet, but will report experience when I have)


There is also WikiPublisher addon which is built specifically as an addon to pmwiki. I have been using it with quite some success.


There is a web solution based on pandoc mentioned in other answers.



I haven't had a chance to test these out, but these three look most promising:

  1. Pandoc (Web interface)

    In Ubuntu:

    sudo apt-get install pandoc
    pandoc --standalone -f mediawiki -o output.tex input.txt
  2. Dirk Hünniger. MediaWiki to LaTeX (Web interface)

    In Ubuntu:

    sudo apt-get install mediawiki2latex
    mediawiki2latex -u https://en.wikipedia.org/wiki/Adam_Ries -o AdamRies.pdf

    As a special-purpose tool, this might have better features than the others, but it requires a full TexLive installation (~2.5 Gb)

  3. C. Scott Ananian & Wikimedia Foundation. mw-ocg-latexer.

    This is designed for WikiBooks of bundled wiki pages, so it probably isn't as easy to use as the first two.

I found the following projects as well, but they are unmaintained, so I don't recommend trying them unless you know what you're doing. The dates indicate when development seems to have stopped.

  1. Szymon Tarnowski, cjiahao, & Hans-Georg Kluge. (2011/2013). Wiki2LaTeX. Server-side. Copied to github here.
  2. cyrilbuttay, jucablues, pajai, swalter. (2013). WikiPDF. (Overview of code)
  3. Derbeth, Sergei Turin, & tuetschek (2010). javaLatex.
  4. Daniel O'Connor. (2010). Text_Wiki.
  5. Chris Wellons. (2007). wiki2latex.perl. Author now recommends Pandoc.

I did a very thorough internet search, so I believe that this is comprehensive of all software on the internet to convert MediaWiki markup to LaTex.


I think many tools discussed above will fail when a MediaWiki document contains many citations. The problem is that MediaWiki typically does not handle BibTex files.

One solution is provided by HandWiki online encyclopedia on science and computing. It is also a Mediawiki wiki, similar to Wikipedia, but it has some parts that are designed for easy conversion of articles to LaTeX. For example, one can use the standard LaTeX tag "$$" for equations. Also, one can use the BibTeX files for referencing other articles. See HandWiki help page.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .