Extension:Wiki2LaTeX

What can this extension do?
This extension converts Mediawikisyntax into LaTeX-code, and makes the result available as: The extension is written in php and uses its own parser, which is based on the original one of Mediawiki.
 * A textarea, where the code can be copied from
 * A .tex-file
 * A .pdf-file

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 comes with a eventsystem, so you can hook in a function, which changes the current parser-result.

Example: By default, references created by the " "-tag are transformed into the latex-command "\footnote{}". In case you use another command for footnotes (like endnotes, or you need some modifications to \footnote), you can hook in a function to the event "W2L_FINISH", which replaces "\footnotes{" by "\endnotes{". Have a look at w2lConfig.php where an example can be found.

Limitations
There are some limitations:
 * Currently, only logged in users can see the "LaTeX"-tab.
 * The extension sometimes assumes german localization. This will be fixed in later versions.
 * Tables and images aren't supported.
 * Definition lists get parsed into HTML.
 * Only external links are inserted into "url"-commands. Internal links are parsed to text.
 * pdf-export is very fragile and needs much cpu-power. So it can't be recommended, to empower users to personally export an article to pdf.
 * All parts are tested on Windows XP only. The parser itself should work on all OSes, but filesystem operations might be windows-only.
 * Double and single quotes are still problematic.

Please be aware, that this extension is still in its beta-phase. There might be security issues, performance issues and any thinkable issue could come up. So this extension is not (yet) intended to be used in a production environment or on a public wiki, though it works as expected for quite a time now on my personal server to create documents for university and letters.

Usage
After installation, there is a link next to the edit tab, which is labeled as "LaTeX". Click on it, choose some options and export the article.

Parser Extension Tags
This extension also adds some tags, which are useful for creating wikipages, which are intended for LaTeX-export specifically, like papers for university, letters...

These are the tags: No use for wiki, but prevents the paragraph indent of LaTeX.

Makes LaTeX creating a new page. Does nothing in wiki-mode.

name-of-label name-of-label name-of-label These three tags enable LaTeX referencing feature. In wiki mode they return pseudo-values, so you can see, that there are references.

 Returns a non breaking space. Might later be changed to HTML-entity.

text This tag can contain pure LaTeX-code, which is syntax-highlighted in wiki mode, and inserted as-is in latex-mode.

Installation
Please have look at the wiki on the project site, where you can find some documentation.

Download and extract W2L into your extension folder. Make sure, all the files land in the folder /extensions/w2l. Have a look at the file w2lConfig.php, where some settings might need changes.

Changes to LocalSettings.php
Just add the following lines to Localsettings:

require_once($IP."/extensions/w2l/w2lExporter.php"); require_once($IP."/extensions/w2l/w2lLatexUtil.php");

If you are using an extension, which makes use of the syntaxhighlighter GeSHi, this extension has to be loaded before W2L.