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.

Supported Syntax features

 * ParserFunctions are supported (tested for 'if' and 'switch' only!)
 * ParserExtension-tags are supported.
 * Lists, even nested ones
 * italic and bold font-styles are supported
 * Internal and external links
 * Special characters are masked to LaTeX-commands
 * Some HTML-entities are parsed into their LaTeX-equivalents
 * The nowiki-tag is supported
 * Mediawikis Template-system can be used (with named and unnamed template parameters).

Please note, that even though it is supported, it can't be guaranteed, that everything works flawlessly. Not every possible case has been tested, so please report errors, in case something went wrong.

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 aren't supported.
 * Images aren't supported (see Extension talk:Wiki2LaTeX)
 * Definition lists are 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.

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.

Planned features

 * Nested Parserfunctions, Templates and such (done)
 * Better way of parsing headings (done)
 * calling of pdflatex without path information (done)
 * Custumizable number of repeated calls to pdflatex, so MikTex's 'texify.exe' can be used. (done)
 * Localization of the whole extension (v.0.6)
 * Better handling of internal links (v.0.6 or v.0.7)
 * Image support (v.0.7)
 * Table support (v.0.8)

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.

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.


 * 1) unpack all files of the archive into the folder '/extensions/w2l'.
 * 2) Have a look at the file w2lConfig.sample.php, where some settings might need changes.
 * 3) Rename w2lConfig.sample.php to w2lConfig.php
 * 4) Create the custom namespace LaTeX (optional, but required in order to export an article to pdf!).
 * 5) Make the changes to LocalSettings.php as described below.
 * 6) In order to use the pdf-export-feature, check out the LaTeX-Template-Docummentation over at the project page.

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

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.

If you are using Parser function extensions, then this extension needs to be loaded before W2L.

Update existing installations

 * 1) Read version.txt as config changes might be required.
 * 2) Backup all files
 * 3) Remove all files except w2lConfig.php
 * 4) Unpack all new files into that folder

Development
Development takes place on a subpage.