Search code examples
latexgithub-pagesmathjax

MathJax not rendering some equations properly on Github pages


I've configured Mathjax on my Github pages site and it can render some equations properly but not others.

It can render properly the following equations:

\\[ \frac{1}{n^{2}} \\]

\\[ J(\theta) = \frac{1}{2m}[\sum_{i=1}^m(h_\theta (x^{(i)}) - y^{(i)})^2 + \lambda\sum_{j=1}^n\theta^2_j] \\]

But it can't render equations like below:

\\[ F'(\theta_*)=\lim\limits_{\theta\to\theta_*}\frac{F(\theta)-F(\theta_*)}{\theta-\theta_*} \\]

Can someone please see where the problem might be?


Solution

  • You should try to post or link to some HTML output but usually this is due to markdown converting the underscores into <em> tags which in turn makes MathJax skip an equation (cf. the MathJax docs).

    Kramdown (used on GitHub-pages) has special support for $$ to delimit both inline and block equations, which will prevent this kind of interaction, cf. the kramdown docs)