33

In wordpress, I appended the Mathjax CDN to my header file. The inline equations do not render while the display-mode equations seem fine. An example:

enter image description here

I have experience with Mathjax on another CMS (Drupal) and never had such a problem, or even on Math.SE . The reason I do not post it on the wordpress forum is because I did not install any plugin, so this has nothing to do with wordpress I guess.

Does anyone know why this is happening? For completeness, I appended the following script before the </head>

<script type="text/javascript"
   src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
yayu
  • 5,237
  • 4
    I suspect this is 'off topic': it's really about WordPress rather than TeX. – Joseph Wright Sep 06 '11 at 05:59
  • @Joseph you may migrate it if you wish. I thought this was not related to wordpress, but mathjax, which belonged to "Tex Latex and friends". I may be wrong. – yayu Sep 06 '11 at 06:07
  • I will wait to see what others feel about this – Joseph Wright Sep 06 '11 at 06:07
  • 1
    I'm not sure where to recommend for this on SE; most likely the MathJaX mailing list. MathJaX questions are on the border of what I would consider "on-topic". This is about installing and/or configuring which I think is over that border. I wouldn't expect someone who knows about TeX to even know where to start with this sort of thing, so although there might be someone here who could help, it's unlikely that this is the best place to ask to get the best chance of getting help. – Andrew Stacey Sep 06 '11 at 06:37
  • @Andrew: I wondered about the WordPress SE site – Joseph Wright Sep 06 '11 at 07:31
  • @Joseph: I don't really know anything about that site. They have 5 qns about MathJaX, and none are about installing it. They do have a fair few about javascript in general, but this does feel like it is about configuring MathJaX rather than javascript in general, or installing something. It would be worth a try, but I would say that the best place for the querrent to get help is the MathJaX mailing list. – Andrew Stacey Sep 06 '11 at 07:39
  • 1
    Given your answer to Yannick's answer, I suspect that you should read the page on configuration options: http://www.mathjax.org/docs/1.1/options/tex2jax.html – Andrew Stacey Sep 06 '11 at 08:20
  • Have a careful look at the configuration, for inline it might be only the math delimitiers \(...\) are set, so try using these instead of $...$. – Andrew Swann Nov 25 '18 at 16:04

2 Answers2

53

You can enable the $ … $-style inline mode by inserting the following code into the <head> section of your HTML before MathJax is being loaded. This way, you can invent new delimiters, too.

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>

Remember that after enabling this, you have to escape 'normal' dollar signs with \$.

A more detailed description can be found in the MathJax documentation. It also describes why the single dollar delimiters are disabled by default:

Note that the single dollar signs are not enabled by default because they are used too frequently in normal text, so if you want to use them for math delimiters, you must specify them explicitly.

In MathJax v3, the configuration API changed. You now create a global MathJax object:

<script type="text/x-mathjax-config">
  MathJax = {
    tex: {
      inlineMath: [['$', '$'], ["\\(", "\\)"]],
      processEscapes: true,
    }
  }
</script>
Rob
  • 103
Patrick Oscity
  • 964
  • 6
  • 11
  • 1
    Also, since the original posts some new issues come up. You may need to replace http:// with https:// everywhere you link to mathjax. – Algeboy Apr 29 '18 at 04:05
  • v3 syntax was necessary for me, otherwise, it won't work with the latest. – Visrut Oct 21 '23 at 16:30
10

Does it work if you use \( and \) ? At least for me, mathjax is pretty picky when it comes to formulas with just dollars around them.

Yannick Versley
  • 209
  • 1
  • 2