views:

119

answers:

2

I need to convert mediawiki into LaTeX syntax. The formulas should stay the same, but I need to transform, 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.

A: 

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

s/^=[ ]*\(.*\)[ ]*=/\\chapter{\1}/g
Alexey Malistov
+2  A: 

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.

xiechao