Extension:Wiki2LaTeX/Documentation

Wiki2LaTeX is a wiki-to-LaTeX converter. There are two major aspects to conversion: the wiki-to-LaTeX conversion itself, and the use of templates, which specify the formatting of the LaTeX document.

A large number of wiki markups are converted by Wiki2LaTeX. For example if the wiki document contains bold, then this converts to \textbf{bold}, producing bold in the final LaTeX document. However, more complicated elements like tables, images and mathematics require more care in how the wiki markup is entered so that it will be converted to LaTeX in a way that produces nice-looking results. In addition, there are special tags specifically for LaTeX, for example, the creates a new page in the LaTeX document, which has no meaning in the wiki.

LaTeX templates are the way to specify the preamble of the LaTeX document. Wiki2LaTeX has a default "Magic" template, and additional custom templates may be created on the wiki.

Compatible Wiki Markup
Most basic wiki markup is correctly converted to LaTeX by Wiki2LaTeX, including the following:

Additional Capabilities

 * Tables can be included, but require special handling.  Tables.
 * Images may be included, but only filetypes that pdflatex accepts.
 * Typesetting mathematics may be done, although equation arrays are difficult
 * Wiki templates, those of the form
 * Prefix a section heading with a asterisk for unnumbered sections: == *Section Name ==

LaTeX Templates
Wiki2LaTeX allows the creation of custom LaTeX templates to control the formatting of the LaTeX document. Once custom templates have been created, they may be selected just before the LaTeX is compiled. The custom template specifies the content the the LaTeX preamble, that is, everything between \documentclass and \begin{document}.

A template is a page in the custom namespace LaTeX. Here is an example:

==LaTeX-Template==  \documentclass[12pt, a4paper]{scrartcl} \usepackage[utf8x]{inputenc} % This is very important! \usepackage[T1]{fontenc} \usepackage{tabularx} % Required for tables \title{((PAGENAME))} \begin{document} ((W2L_CONTENT)) \end{document}

If this page has the name LaTeX:W2L_My Template then "My Template" will appear in the drop-down menu in the latex/pdf conversion page.

Various variables can be included in the template, the most important one is WikiContent or W2L_CONTENT which is replaced with the LaTeX-formatted content. In addition, PAGENAME can be used for the page title, as well other variables such as CURRENTYEAR, see magic words for more information.

Custom Template Variables
Custom template variables are defined on the wiki page, and referred to by the LaTeX template. For example, if the wiki page contains the following: This is the left \LaTeX{} header This is the right and if the LaTeX template contains: \pagestyle{myheadings} \markboth{((left))}{((right))} then headers will appear. Note that the custom variable may contain LaTeX markup, but wiki markup is ignored.

The variable names will appear in the wiki as:
 * left: This is the left \LaTeX{} header
 * right: This is the right

Wiki to LaTeX Conversion Summary
Conversions are performed by w2lParser.php. Please refer to the source code for further details.

Refer to Mediawiki help for a good list of wiki markups.

LaTeX-Specific Tags
Wiki2LaTeX adds wiki tags which are intended for LaTeX-export specifically.

An example of using labels, in wiki is:

== Introduction intro == Section intro is the introduction, found on page intro.

Wiki Markup Which Does Not Convert
Wiki2LaTeX does not convert some wiki markup, or does not convert the same way that MediaWiki does.

Advanced Topics
Here are some advanced topics:
 * Preamble
 * Extensions to Mediawiki
 * Extending Wiki2LaTeX
 * Contributions
 * Hooks

Customizations
Various aspects of wiki2latex may be customized.

$w2lConfig['default_template'] = 'My Template';
 * Change the default template  Normally, the "Magic" template is the default.   Change the default selection to "My Tempate" by adding a line to w2lConfig.php