32

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>
8
  • 4
    I suspect this is 'off topic': it's really about WordPress rather than TeX.
    – Joseph Wright
    Sep 6, 2011 at 5: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 6, 2011 at 6:07
  • I will wait to see what others feel about this
    – Joseph Wright
    Sep 6, 2011 at 6: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. Sep 6, 2011 at 6:37
  • 1
    Given your answer to Yannick's answer, I suspect that you should read the page on configuration options: mathjax.org/docs/1.1/options/tex2jax.html Sep 6, 2011 at 8:20

2 Answers 2

50

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>
1
  • 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, 2018 at 4:05
9

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.

2
  • 3
    Yes it does. My problem is that I have a habit of using $ ... $ in my latex files, which I am trying to put up on my website.
    – yayu
    Sep 6, 2011 at 7:59
  • 1
    if it's not working out for you try with \( and \)
    – vCillusion
    Jun 2, 2018 at 10:08

Not the answer you're looking for? Browse other questions tagged .