## Using mathrsfs script fonts in MediaWiki

In howto on Jan 28, 2011 by theoryl Tagged: , , , , , , , ,

This is in Ubuntu Lucid Lynx 10.04:

The RSFS fonts give you very nice script fonts:

The top row shows the fonts from the command \mathscr while the bottom from \mathcal, which $\LaTeX$ users should be more familiar with.

In order to use the RSFS fonts in $\LaTeX$, you would add the preamble \usepackage{mathrsfs} in the .tex file. But what if you want to use the RSFS fonts in MediaWiki (the software that powers the Wikipedia), which by default does not include the preamble?

It turns out that you have to compile texvc (the $\LaTeX$ interpreter incorporated into MediaWiki) with some slight modifications to texutil.ml (located in the source directory mediawiki/math). Basically, you want to add the preamble into that file. Below is what I did:

• First, make sure you have installed mathrsfs.sty in the $\LaTeX$ environment. If not, you can download it from http://ctan.org. In Ubuntu 10.04, it should be located at /usr/share/texmf-texlive/tex/latex/jknapltx/mathrsfs.sty.
• Get the MediaWiki source from repo: sudo apt-get source mediawiki. Install all the dependencies as well.
• Get its compiler: sudo apt-get install ocaml-nox gcc.
• Now cd to the math directory: cd /var/lib/mediawiki/mediawiki-1.15.1/math
• Edit the file texutil.ml. Find the line beginning with: (if !modules_ams then "\\usepackage{amsmath}\n
• Now, add: "\\usepackage(mathrsfs)\n" among the preambles.
• Add another line close to the end of the file:  | "\\mathscr" -> (tex_use_ams (); FUN_AR1 "\\mathscr ").
• Compile: sudo make
• After it is compiled successfully, copy the executable: sudo cp texvc /usr/bin

Make sure TeX is enabled in MediaWiki config file LocalSettings.php. If not, append the line to the file: \$wgUseTeX = true ;.

That’s it. You should be able to use the command \mathscr in your MediaWiki!