Convert LaTeX to MediaWiki
Max file size 100mb.
LaTeX vs MediaWiki Format Comparison
| Aspect | LaTeX (Source Format) | MediaWiki (Target Format) |
|---|---|---|
| Format Overview |
LaTeX
Professional Typesetting System
LaTeX is a document preparation system created by Leslie Lamport in 1984 on top of Donald Knuth's TeX engine. It is the worldwide standard for academic and scientific publishing, offering exceptional control over mathematical typesetting, document layout, and professional output. LaTeX excels at producing complex documents with equations, tables, and structured references. Academic Standard Math Typesetting |
MediaWiki
Wiki Markup Language
MediaWiki markup is the formatting language used by Wikipedia, Wiktionary, Fandom, and thousands of other wiki-based websites powered by the MediaWiki software. Developed alongside Wikipedia starting in 2002, it provides a readable syntax for creating collaborative web content with links, tables, templates, and categories. It is the most widely deployed wiki markup in the world. Wiki Standard Collaborative |
| Technical Specifications |
Structure: Plain text with macro commands
Standard: LaTeX2e (1994, continuously updated) Format: Compiled markup with package system Compilation: pdflatex, xelatex, lualatex Extensions: .tex, .latex, .ltx |
Structure: Plain text with wiki formatting codes
Standard: MediaWiki markup (no formal spec) Format: Server-rendered markup language Rendering: MediaWiki parser (PHP-based) Extensions: .wiki, .mediawiki, .mw |
| Syntax Examples |
LaTeX uses backslash commands and environments: \documentclass{article}
\begin{document}
\section{Photosynthesis}
\textbf{Photosynthesis} converts
light energy into chemical energy.
\begin{itemize}
\item Light reactions
\item Calvin cycle
\end{itemize}
The equation is:
$6CO_2 + 6H_2O \rightarrow C_6H_{12}O_6$
\end{document}
|
MediaWiki uses equal signs and apostrophes: == Photosynthesis ==
'''Photosynthesis''' converts
light energy into chemical energy.
* Light reactions
* Calvin cycle
The equation is:
<math>6CO_2 + 6H_2O \rightarrow
C_6H_{12}O_6</math>
[[Category:Biology]]
{{Main|Photosynthesis}}
|
| Content Support |
|
|
| Advantages |
|
|
| Disadvantages |
|
|
| Common Uses |
|
|
| Best For |
|
|
| Version History |
TeX Created: 1978 (Donald Knuth)
LaTeX Created: 1984 (Leslie Lamport) Current Version: LaTeX2e (continuously updated) Evolution: TeX → LaTeX → LaTeX2e → LaTeX3 |
Introduced: 2002 (with MediaWiki software)
Used By: Wikipedia since January 2001 Status: Actively maintained Evolution: UseModWiki → Phase II → MediaWiki → VisualEditor |
| Software Support |
Distributions: TeX Live, MiKTeX, MacTeX
Editors: Overleaf, TeXstudio, TeXmaker, VS Code Compilers: pdflatex, xelatex, lualatex Other: Pandoc, KaTeX, MathJax |
Platforms: Wikipedia, Fandom, Miraheze
Editors: VisualEditor, WikiEditor, VS Code Converters: Pandoc, mw2latex, wiki2latex Other: MediaWiki API, Parsoid parser |
Why Convert LaTeX to MediaWiki?
Converting LaTeX to MediaWiki markup bridges the gap between academic publishing and the world's largest collaborative knowledge platform. Wikipedia and thousands of other wiki sites use MediaWiki markup to organize and present information. When researchers convert their LaTeX papers, lecture notes, or textbook chapters to MediaWiki format, they make their specialized knowledge accessible to the global community of wiki editors and readers.
One of the most compelling reasons for this conversion is that MediaWiki actually supports LaTeX math notation through its <math> tags. This means that mathematical equations from your LaTeX source can be preserved in a recognizable form on Wikipedia and other MediaWiki installations. The conversion translates your document structure (sections, lists, tables, formatting) into wiki markup while keeping mathematical content in a compatible LaTeX subset, giving you the best of both worlds.
The converter processes LaTeX source through Pandoc, mapping document structures to their MediaWiki equivalents. LaTeX sections become wiki headings with equal-sign syntax, \textbf and \textit become triple and double apostrophe markers, itemize and enumerate become wiki list syntax, and tabular environments are transformed into MediaWiki's pipe-based table format. The result is clean wiki markup ready for direct use on any MediaWiki-powered site.
This conversion is especially valuable for academic outreach. Researchers who have written detailed technical content in LaTeX can contribute that knowledge to Wikipedia, institutional wikis, or project documentation wikis. The conversion eliminates the manual work of rewriting content in wiki syntax, allowing academics to focus on reviewing and adapting the content for a wiki audience rather than reformatting it from scratch.
Key Benefits of Converting LaTeX to MediaWiki:
- Wikipedia Contribution: Convert research papers into wiki articles ready for Wikipedia and other Wikimedia projects
- Math Preservation: Mathematical equations transfer to MediaWiki's <math> tags, maintaining LaTeX math syntax
- Collaborative Editing: Enable wiki communities to collaboratively improve and maintain your content
- Knowledge Sharing: Make specialized academic content accessible to a global audience
- Institutional Wikis: Populate organizational knowledge bases with converted academic materials
- Structured Content: Preserve headings, lists, tables, and formatting in wiki-compatible markup
- No Manual Rewriting: Automate the tedious process of translating LaTeX syntax to wiki markup
Practical Examples
Example 1: Scientific Article to Wikipedia Draft
Input LaTeX file (article.latex):
\documentclass{article}
\begin{document}
\section{Black Holes}
A \textbf{black hole} is a region of
spacetime where gravity is so strong
that nothing can escape.
\subsection{Types}
\begin{itemize}
\item Stellar black holes
\item Supermassive black holes
\item Intermediate black holes
\end{itemize}
\subsection{Schwarzschild Radius}
The radius is given by:
$r_s = \frac{2GM}{c^2}$
\end{document}
Output MediaWiki file (article.mediawiki):
== Black Holes ==
A '''black hole''' is a region of
spacetime where gravity is so strong
that nothing can escape.
=== Types ===
* Stellar black holes
* Supermassive black holes
* Intermediate black holes
=== Schwarzschild Radius ===
The radius is given by:
<math>r_s = \frac{2GM}{c^2}</math>
[[Category:Astrophysics]]
{{See also|Event horizon}}
Example 2: Course Material to Institutional Wiki
Input LaTeX file (course.latex):
\documentclass{article}
\begin{document}
\section{Introduction to Algorithms}
\subsection{Sorting Algorithms}
\begin{enumerate}
\item Bubble Sort: $O(n^2)$
\item Merge Sort: $O(n \log n)$
\item Quick Sort: $O(n \log n)$ avg
\end{enumerate}
\subsection{Comparison}
\begin{tabular}{|l|c|c|}
\hline
Algorithm & Best & Worst \\
\hline
Bubble & $O(n)$ & $O(n^2)$ \\
Merge & $O(n \log n)$ & $O(n \log n)$ \\
Quick & $O(n \log n)$ & $O(n^2)$ \\
\hline
\end{tabular}
\end{document}
Output MediaWiki file (course.mediawiki):
== Introduction to Algorithms ==
=== Sorting Algorithms ===
# Bubble Sort: <math>O(n^2)</math>
# Merge Sort: <math>O(n \log n)</math>
# Quick Sort: <math>O(n \log n)</math> avg
=== Comparison ===
{| class="wikitable"
|-
! Algorithm !! Best !! Worst
|-
| Bubble || <math>O(n)</math> || <math>O(n^2)</math>
|-
| Merge || <math>O(n \log n)</math> || <math>O(n \log n)</math>
|-
| Quick || <math>O(n \log n)</math> || <math>O(n^2)</math>
|}
Example 3: Research Summary to Knowledge Base
Input LaTeX file (summary.latex):
\documentclass{article}
\begin{document}
\section{CRISPR Gene Editing}
\subsection{Overview}
\textbf{CRISPR-Cas9} is a molecular
tool for editing DNA sequences with
unprecedented \textit{precision}.
\subsection{Applications}
\begin{itemize}
\item Disease treatment
\item Agricultural improvement
\item Basic research
\item Drug development
\end{itemize}
\subsection{Mechanism}
The guide RNA directs Cas9 to the
target DNA, where it creates a
double-strand break for editing.
\end{document}
Output MediaWiki file (summary.mediawiki):
== CRISPR Gene Editing == === Overview === '''CRISPR-Cas9''' is a molecular tool for editing DNA sequences with unprecedented ''precision''. === Applications === * Disease treatment * Agricultural improvement * Basic research * Drug development === Mechanism === The guide RNA directs Cas9 to the target DNA, where it creates a double-strand break for editing.
Frequently Asked Questions (FAQ)
Q: What is MediaWiki markup?
A: MediaWiki markup is the formatting language used by Wikipedia and thousands of other wiki sites powered by the MediaWiki software. It uses readable syntax like == for headings, ''' for bold, '' for italic, * for bullet lists, and # for numbered lists. It also supports complex tables, templates, categories, and internal/external linking.
Q: Are LaTeX math equations preserved in MediaWiki output?
A: Yes, this is one of the key advantages of the LaTeX-to-MediaWiki conversion. MediaWiki supports LaTeX math notation through <math> tags. Your inline and display equations are wrapped in <math>...</math> tags, preserving the LaTeX math syntax that MediaWiki's Texvc or MathJax engine can render. This means formulas like fractions, summations, and integrals display correctly on Wikipedia.
Q: Can I directly paste the output into Wikipedia?
A: The converted markup can be used as a starting point for Wikipedia articles. However, Wikipedia has specific guidelines for formatting, sourcing, and neutral point of view. You will need to adapt the content to meet Wikipedia's Manual of Style, add reliable sources with citation templates, and ensure the content meets notability guidelines. The conversion handles the structural formatting, but editorial adaptation is still required.
Q: How are LaTeX tables converted to MediaWiki tables?
A: LaTeX tabular environments are converted to MediaWiki's pipe-based table syntax with the "wikitable" CSS class. Column headers use !! separators and data rows use || separators. Basic column alignment is preserved. However, complex LaTeX table features like multirow, multicolumn, or custom coloring may be simplified since MediaWiki tables have different styling capabilities.
Q: What happens to LaTeX bibliography and citations?
A: LaTeX \cite commands are converted to text references in the MediaWiki output. For Wikipedia, you would typically replace these with <ref> tags and citation templates. The converter preserves citation keys so you can identify which references need to be formatted as MediaWiki citations. Full BibTeX-to-MediaWiki citation conversion requires additional manual formatting.
Q: Can I use this for Fandom or other MediaWiki-based wikis?
A: Yes! The output markup is compatible with any site running MediaWiki software, including Fandom (formerly Wikia), Miraheze, ShoutWiki, and self-hosted MediaWiki installations. The core wiki markup syntax is the same across all MediaWiki instances. Some advanced templates may be specific to Wikipedia, but the basic formatting, tables, lists, and math tags work universally.
Q: What about LaTeX figures and images?
A: LaTeX \includegraphics commands are converted to MediaWiki file syntax ([[File:name.ext|caption]]). However, the actual image files need to be uploaded separately to the wiki. TikZ diagrams cannot be directly represented in MediaWiki and will be converted to descriptive text. For important diagrams, consider exporting them as SVG or PNG files and uploading them to the wiki independently.
Q: Does the converter handle LaTeX cross-references?
A: LaTeX \label and \ref commands are resolved where possible during conversion. Cross-references to sections become wiki internal links or plain text references. Equation and figure references are converted to their textual content. MediaWiki has its own linking system (using double brackets), and the converter maps LaTeX references to the closest wiki equivalent where feasible.