JsMath

From miki
Revision as of 11:15, 6 January 2010 by Mip (talk | contribs)
Jump to navigation Jump to search

This page is dedicated to jsMath, a javascript that allows to render LaTeX formula in HTML pages with very high output quality and that works across multiple browsers on Windows, Linux and Mac.

Install

Reference instructions:

Server Side

  • Install jsmath main package.
  • Install extra fonts package for fonts msam10 and msbm10 (these fonts are required for extension AMSsymbols, which is frequently used).
The packages are found here. To install them, create a directory fonts in jsmath directory, and unzip them there, i.e. you should end up with 2 directories named ./jsmath/fonts/msam10 and ./jsmath/fonts/msbm10.

Client Side

  • Install the standard fonts.
On Windows, the fonts are in package called TeX-fonts-25.zip (from this page).
On Linux, due to FireFox issue since v3.5, use the package TeX-fonts-linux.tgz (from this page).
  • Install the extra fonts msam10.ttf and msbm10.ttf (from here), and install them on your system.

Install on MediaWiki

On MediaWiki, there exists an extension that ease the use of jsMath. We describe here how the extension is installed on this wiki.

Reference information:

Server Side

  • Install jsMath in /miki/jsmath.
  • Install the following jsMath extra fonts package (in /miki/jsmath/fonts) :
  • Edit the file /miki/jsmath/easy/load.js:
  //...
  root: "/miki/jsmath",
  //...
  scale: 130,
  //...
  processSlashParens: 0,       // process \(...\) in text?
  processSlashBrackets: 0,     // process \[...\] in text?
  processDoubleDollars: 0,     // process $$...$$ in text?
  processSingleDollars: 0,     // process $...$ in text?
  processLaTeXenvironments: 0, // process \begin{xxx}...\end{xxx} outside math mode?
  fixEscapedDollars: 0,        // convert \$ to $ outside of math mode?
  doubleDollarsAreInLine: 0,   // make $$...$$ be in-line math?
  allowDisableTag: 1,          // allow ID="tex2math_off" to disable tex2math?
  //...
  loadFiles: ["extensions/AMSmath.js", "extensions/AMSsymbols.js",  
              "extensions/boldsymbol.js", "extensions/moreArrows.js"],
  //...
  loadFonts: ["cmmib10", "cmbsy10"],
  //...
  noImageFonts: 1
  • Install Mediawiki extension JsMath in /miki/extensions/JsMath (2 files are needed: JsMath.i18n.php and JsMath.php).

Client Side

Troubleshoot

  • I get the error message "unknown control sequence \msbm" when using \mathbb{...} (blackboard bold).
Most probably this is because jsmath cannot find the font definition file at ./jsmath/fonts/msbm10/def.js on the server side (see [1]). \mathbb uses the fonts msbm, and to work properly, the author package msbm10.zip (see here) must be unzipped in directory ./jsmath/fonts/. Also for best rendering the msbm10 truetype font should be installed on the client side.

Examples

Some text before <math>\textstyle{a_i^e}</math> and after
Some text before <math>\displaystyle{a_i^e}</math> and after
Some text before a_i^e and after

Some text before

a_i^e

and after

<math>\textstyle{ \frac{ \sum_{i=1}^n(x_i-\overline x) (y_i-\overline y) }{\left[ \sum_{i=1}^n(x_i-\overline x)^2 \sum_{i=1}^n(y_i-\overline y)^2 \right]^{1/2} } }</math>

<math>\displaystyle{ \frac{ \sum_{i=1}^n(x_i-\overline x) (y_i-\overline y) }{\left[ \sum_{i=1}^n(x_i-\overline x)^2 \sum_{i=1}^n(y_i-\overline y)^2 \right]^{1/2} } }</math>