Search:

# MathJax

Summary: Add markup to embed math using TeX syntax.
Version: 20110307
Prerequisites:
Status: Stable
Maintainer: AMyles
Categories: Markup Math

## Questions answered by this recipe

• How can I embed math in a wiki page using MathJax which is the successor of jsMath?

## Description

Embed math in wiki pages using scalable fonts.

## Notes

Disable the jsMath plugin (if you are already using it) before using the MathJax plugin below.

2. Unless backward compatibility with old browsers is a must, consider removing the MathJax/fonts/HTML-CSS/TeX/png directory since it has too many files and may slow down the server.
3. Download MathJax.phpΔ into the cookbook/ directory.
4. Add the following line to a local customization file:
include_once("$FarmD/cookbook/MathJax.php");  ## Additional MathJax settings The MathJax settings file MathJax/config/MathJax.js has many more settings to play around with, including setting the HTML tags (e.g. script, pre, etc) within which MathJax will not translate the text to mathematics. Take a look there. ## Release notes • 20101218: Took Domingo Redal's suggestion into account, simplifying installation and MathJax upgrades. • 20110307: Support for equation \label and \eqref added by Richard Shaw. ## See also Cookbook / ASCIIMath Display MathML rendered ascii formula into PmWiki 2.x pages (Stable) Formula Lightweight rendering of mathematical formulas in wiki pages (Beta) JsMath Add markup to display and embed mathematical formulas in wiki pages using TeX. (Stable) LaTeXMathML Translating LaTeX math notation dynamically to Presentation MathML (Stable) LinuxTex Enable TeX markup Mathtex Add markup to display and embed several lines of mathematical formulas in wiki pages (testing) MimeTeX Add markup to display and embed mathematical formulas in wiki pages (Stable) SimpleJsMath TrueLatex Enables interpretation and rendering of real LaTeX markups in PmWiki. Support for XeLaTex included in v1.8. (Working perfectly. Very simple to use, customizable and comes with lots of options.) ## Contributors ## Comments You can include the parameters necessary to change the settings using MathJax without changing the file MathJax/config/MathJax.js. You only need to change the call to that file: $HTMLHeaderFmt['MathJax'] = '<script type="text/javascript" src="$MathJaxUrl/MathJax.js"></script>';  to $HTMLHeaderFmt['MathJax'] = '<script type="text/javascript" src="$MathJaxUrl/MathJax.js">MathJax.Hub.Config({ extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"], jax: ["input/TeX", "output/HTML-CSS"], tex2jax: { inlineMath: [ [\'{\$\',\'\$}\'] ], displayMath: [ [\'{\$\$\',\'\$\$}\'] ] } });</script>';  in your cookbook. Domingo Redal November 29, 2010, at 08:21 AM Thank you, Domingo! I have updated the script and documentation taking your suggestions into account. AMyles 2010-12-18 David C. October 1st, 2011, at 15:56 You can simplify the installation and updates refering directly in the MathJax.php file to https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML rather than to a local installation of MathJax. It works fine for me. So replace  SDV($MathJaxUrl, "$PubDirUrl/MathJax");  with  SDV($MathJaxUrl, "https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML");

SDV() means "Set default value (if none is set)" and its purpose is to allow you to set your own values without editing the script. You shouldn't ever need to modify files from the PmWiki core distribution or recipes, because they allow you to set your own variables. In config.php, before including the cookbook/RECIPE.php file, add something like:
$VARIABLE = "my value"; # now SDV($VARIABLE, "value") in RECIPE.php will do nothing
This principle will allow you to upgrade your PmWiki and/or Recipe installations without losing your local customizations. --Petko October 01, 2011, at 09:53 AM

This space is for User-contributed commentary and notes. Please include your name and a date (eg 2007-05-19) along with your comment. Optional alternative: create a new page with a name like "ThisRecipe-Talk" (e.g. PmCalendar-Talk).

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.