How I Do MathJax I. Installation

I use equations. To enable equations in a WordPress blog, there are several options. The most comprehensive—and aesthetically pleasing—is to use MathJax. This post tells you how to install MathJax for your WordPress site. A second post has a few pointers. Here are a few usage examples.

1. Edit default.js

I do not use the MathJax CDN since occasionally their site has problems. When that happens, your math stops working and your pages containing math become ugly. So I download MathJax to my WordPress install. Rather than futz with <script> tags in my site’s header, I edit the default configuration file to my liking. Thus:

  • Download the latest version of MathJax: go to https://github.com/mathjax/MathJax/, click on Releases, and download the latest version.
  • Unpack the archive file to your hard drive.
  • Edit default.js in the config directory. My preferences:
    • You’ll probably want to add to your extensions, something like:
      extensions: ["tex2jax.js", "TeX/AMSsymbols.js", "TeX/AMSmath.js"]
    • Scroll down and set messageStyle to your liking (I changed mine to messageStyle: "simple").
    • Scroll down to menuSettings and change these to your liking (I set zoom: "Hover").
    • In the tex2jax section that immediately follows:
      • Under inlineMath uncomment the line with inline delimiters ['$','$']. This enables normal LaTeX inline delimiters. You’ll have to escape actual dollar signs with \\\$.
      • processEscapes: true
      • preview: "[math]"
    • Scroll down to the TeX section.
      • Under equationNumbers, set autoNumber: "AMS".
      • Fiddle with whatever else there catches your fancy.
    • Fiddle with whatever else catches your fancy.
  • Finally, upload your entire MathJax directory to your WordPress site, something like http://yourdomain/mathjax/.

2. Get the WordPress plugin.

Next, get the MathJax-LaTeX plugin and set the settings. The easiest way is to go to your blog administration Dashboard→Plugins→Add New, and type mathjax in the search box. My plugin settings (Dashboard→Settings→MathJax-LaTeX) are

  • Force Load = unchecked
  • Default [latex] syntax attribute = inline (this seems to have no effect with my configuration)
  • Use wp-latex syntax? = unchecked
  • Use MathJax CDN Service? = unchecked
  • Custom MathJax location? = http://yourdomain/mathjax/MathJax.js
  • MathJax Configuration = default

Do not forget to click the Save Changes button!

Leave a Reply