# Extension:TrustedMath

MediaWiki extensions manual
TrustedMath
Release status: beta
Implementation Tag
Description Embed LaTeX equations on wiki pages
Author(s) Bryan Tong Minh (Bryantalk)
MediaWiki 1.17 , 1.19, 1.28 and possibly lower versions as well
Tags
math
editmath
Hooks used
ParserFirstCallInit
Translate the TrustedMath extension if it is available at translatewiki.net
Check usage and version matrix.

TrustedMath is an extension that allows embedding LaTeX equations on wiki pages, similarly to the built-in math renderer, but without dependency on Ocaml and working almost out of the box on Windows.

## Usage

The reason that MediaWiki normally renders math via an intermediate Ocaml script, is because TeX is not inherently safe. The intermediate texvc script removes all unsafe markup. The TrustedMathe extension does not contain these validation mechanisms. Instead it allows certain users to write unvalidated LaTeX which can be embedded into a page by anyone.

Please note that normally math is validated for a reason. The author does not know the exact security implications, but it could be very well possible that users who are allowed to render math may crash your wiki, steal your passwords and delete your database, so do not allow access to users you don't trust.

### Safe mode

The safe mode is enabled by default. The extension creates the Math: namespace, which is restricted to users with the editmath user right. You need to grant that right to sysops or some other group that you trust. These users can then put equations in the Math namespace. Those equations can be embedded using the <math name="page in math namespace" /> syntax.

The unsafe mode allows math embedded in regular  syntax and is almost compatible with the built-in math renderer. To enable it set $wgTrustedMathUnsafeMode to true in LocalSettings.php. ## Installation • Install LaTeX. Windows users may want to install LaTeX using the MiKTeX package • Download TrustedMath and unpack it into your extensions folder • Add the following line to the bottom of your LocalSettings.php: require_once( "$IP/extensions/TrustedMath/TrustedMath.php" );
• Tell MediaWiki where the latex and dvipng renderers are located.
• For Linux those are usually /usr/bin/latex and /usr/bin/dvipng
• For Windows those are something like C:\Program Files\MiKTeX 2.8\miktex\bin\latex.exe and C:\Program Files\MiKTeX 2.8\miktex\bin\dvipng.exe
• Set them in LocalSettings: $wgTrustedMathLatexPath = 'C:\Program Files\MiKTeX 2.8\miktex\bin\latex.exe';$wgTrustedMathDviPngPath = 'C:\Program Files\MiKTeX 2.8\miktex\bin\dvipng.exe';

## Math support

Not all math syntax supported by the math renderer of Wikipedia is supported, such as \mathfrak. If you know how to fix this please leave a message at the talk page.