Enabling math markup

From Organic Design wiki
Revision as of 10:45, 14 January 2009 by Nad (talk | contribs) (Transparency (not working on current versions): You will then need to rebuild the ''texvc'' binary)
Procedure.svg Enabling math markup
Organic Design procedure
Info.svg Use this procedure to add math rendering support which is not included in the install a new server procedure by default as it requires many additional program libraries (about 200MB worth)


Example

The following maths code

<math>
e^x = \sum_{n = 0}^{\infty} {x^n \over n!} = 1 + x + {x^2 \over 2!} + {x^3 \over 3!} + {x^4 \over 4!} + \cdots
</math>

Should give the following output

[math]e^x = \sum_{n = 0}^{\infty} {x^n \over n!} = 1 + x + {x^2 \over 2!} + {x^3 \over 3!} + {x^4 \over 4!} + \cdots[/math]

Build the texvc binary

OCaml 3.06 or later from caml.inria.fr is required to compile texvc

apt-get install dvipng tetex-extra cjk-latex ocaml

Run make from within the MediaWiki's math directory to build the texvc binary on your system.

Make sure the directories tmp and math under 'images' exist and are writable.

LocalSettings.php customization

The following lines need to be added;

{{{1}}}

Transparency (not working on current versions)

I replaced the line defining the ImageMagick convert command in /wiki/math/render.ml which makes it output a transparent PNG and also increases the quality by rendering the vector larger and downsizing with the default Mitchell filter. After making changes to render.ml, you must rebuild the texvc executable by issuing a make clean and make.

let cmd_convert tmpprefix finalpath = "convert -quality 100 -density 480 " \
    ^ tmpprefix ^ ".ps -negate -unsharp 8 -resize 25% " ^ finalpath ^ " >/dev/null 2>/dev/null \
    && convert " ^ finalpath ^ " -fill black -colorize 100% " ^ finalpath ^ ".png \
    && composite -compose CopyOpacity " ^ finalpath ^ " " ^ finalpath ^ ".png " ^ finalpath

You will then need to rebuild the texvc binary again with make clean && make

See also