Mediawiki extensions: math: Difference between revisions
From wikinotes
(→Usage) |
|||
(One intermediate revision by the same user not shown) | |||
Line 55: | Line 55: | ||
<syntaxhighlight lang="latex"> | <syntaxhighlight lang="latex"> | ||
\texttt{ | \texttt{my-variable} # arbitrary text | ||
\dfrac{1}{2} | \dfrac{1}{2} # 1/2 | ||
\times{1}{2} | \times{1}{2} # 1*2 | ||
1^{2} | 1^{2} # 1**2 | ||
\bigg( | \bigg( 1+2 \bigg) # brackets (each 'g' makes larger) | ||
\begin{align} # within align blocks, newlines align on '&' char | |||
& 2 * 1 = 2 \\ | |||
& 2 * 2 = 4 \\ # a \\ indicates a line-break | |||
& 2 * 3 = 6 \\ | |||
\end{align} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Cheat Sheet --> | </blockquote><!-- Cheat Sheet --> |
Latest revision as of 01:02, 11 April 2022
Renders MathML in <math>
blocks, falling back onto SVG.
I believe this extension is used by wikipedia itself as of 2021.
Documentation
official docs https://www.mediawiki.org/wiki/Extension:Math supported LaTeX syntax https://www.mediawiki.org/wiki/Extension:Math/Help:Formula#Formatting_using_Template:TeX
Install
1. First, download the extension for your mediawiki version, extract to
${www}/mediawiki/extensions
.2. enable extension
# ${www}/mediawiki/LocalSettings.php wfLoadExtension( 'Math' );
3. (backup then) run database updatercd ${www}/mediawiki/maintenance mysqldump --all-databases > out.sql php update.php4. Confirm plugin detected on Special:Version
5. Confirm plugin renders math alright on Special:MathStatus
Usage
Simply write tex between math tags.
Here are some examples:
<math>\exp_a b = a^b, \exp b = e^b, 10^m</math>
Cheat Sheet
Some of the more common items.
\texttt{my-variable} # arbitrary text \dfrac{1}{2} # 1/2 \times{1}{2} # 1*2 1^{2} # 1**2 \bigg( 1+2 \bigg) # brackets (each 'g' makes larger) \begin{align} # within align blocks, newlines align on '&' char & 2 * 1 = 2 \\ & 2 * 2 = 4 \\ # a \\ indicates a line-break & 2 * 3 = 6 \\ \end{align}
Configuration
Rendering Modes
All math is expressed in tex, but can be rendered in a variety of ways:
- MathML
- LaTex
- LaTeXML