开发者

Convert mediawiki to LaTeX syntax

I need to convert mediawiki into LaTeX syntax. The formulas should stay the same, but I need to transf开发者_运维百科orm, for example = something = into \chapter{something}.

Although this can be obtained with a bit of sed, things get a little dirty with the itemize environment, so I was wondering if a better solution can be produced. Anything that can be useful for this task ?

This is the reverse of this question (graciously copied). Pandoc was the answer to that question, but probably not yet for this.


how about wiki2latex?

http://code.google.com/p/wiki2latex/

http://www.mediawiki.org/wiki/Extension:Wiki2LaTeX

Quoting from the mediawiki site:

This extension converts Mediawiki syntax into LaTeX-code, and makes the result available as:

* a text area, from which the code can be copied
* a .tex file
* a .pdf file

The extension is written in php and uses its own parser, which is based on the original one of Mediawiki.

Since the parser supports Parser Extension Tags, this extension enables Mediawiki to be used as a tool to create nicely printable documents. The parser also uses Mediawiki's Hook-system, so you can hook in functions, which change the default behavior of Wiki2LaTeX.


I spend two years writing a tool for that. You can get it here it's under GPL.

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

Edit: The project has been accepted into Debian. A binary version for Windows is also available.

Edit: There also is a web interface http://mediawiki2latex.wmflabs.org/


I use sed. For example, the following script converts your = something = into \chapter{something}:

s/^=[ ]*\(.*\)[ ]*=/\\chapter{\1}/g


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 -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.


When using HandWiki that runs on Mediawiki, you can do the conversion of wikitext articles using the built-in convertor. Open any article and the select "Export to LaTeX" using the Action menu (top-right)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜