WP MathJax-LaTeX Plugin


There is a WordPress Plugin called MathJax-LaTeX that I am using here to format mathematical formulas.

In WordPress, once you install the plugin you can display formulas on your posts and pages. You need to follow the syntax. Whenever you need to show a formula you first go to the text editor and type “latex” surrounded by square brackets instead of the quotes I just used. Type the formula. Close it with backslash-latex surrounded by square brackets. These square brackets contain WordPress shortcodes.

Here is one example: $x$ to the exponent 2 is written as x^2 and appears as \[x^2\] using latex.

Here are just a few examples in the table below. For the first one, all you have to do is put this: 3x^2 between the latex shortcodes to get this: 3x^2.

 HTML Code placed between [latex] and then [/latex]  Display
 X_1  X_1
 =  =
 \neq  \neq
 X_1^2  X_1^2
 \bar{X}  \bar{X}
 \bar{X}_1  \bar{X}_1
 3x^2  3x^2
 a^{xyz} a^{xyz}
 \left( \frac{a}{b} \right) \left( \dfrac{a}{b} \right)
 a^{\frac{1}{2}} a^{\frac{1}{2}}
 a^{\dfrac{1}{2}} a^{\dfrac{1}{2}}
 7\frac{1}{2}  7\frac{1}{2}
 7\dfrac{1}{2}  7\dfrac{1}{2}
\dfrac{a^m}{a^n} = a^{m-n} \dfrac{a^m}{a^n} = a^{m-n}
 \frac{2}{x+2}  \frac{2}{x+2}
 \frac{1+\frac{1}{x}}{3x + 2}  \frac{1+\frac{1}{x}}{3x + 2}
 \dfrac{1+\dfrac{1}{x}}{3x + 2}  \dfrac{1+\dfrac{1}{x}}{3x + 2}
 \sqrt{3}   \sqrt{3}
 \sqrt[3]{3}  \sqrt[3]{3}
 \sqrt[3]{x+y}  \sqrt[3]{x+y}
 \sqrt{x+\frac{1}{2}}  \sqrt{x+\frac{1}{2}}
 \sum_{i=1}^{\infty}\frac{1}{i}  \sum_{i=1}^{\infty}\frac{1}{i}
 e = \sum_{n=1}^{\infty}\frac{1}{n!} = 1 + \frac{1}{1} + \frac{1}{(1)(2)} + …  e = \sum_{n=1}^{\infty}\frac{1}{n!} = 1 + \frac{1}{1} + \frac{1}{(1)(2)} + ...
 \prod_{n=1}^5\frac{n}{n-1}  \prod_{n=1}^5\frac{n}{n-1}
 \lim\limits_{x\to\infty}\frac{1}{x}  \lim\limits_{x\to\infty}\frac{1}{x}
 \dbinom{9}{3} \dbinom{9}{3}
 \frac{d}{dx}\left(x^2\right) = 2x \frac{d}{dx}\left(x^2\right) = 2x
 \int 2x\,dx = x^2+C \int 2x\,dx = x^2+C
 \int^5_1 2x\,dx = 24 \int^5_1 2x\,dx = 24
t = \dfrac{(\bar{X}_1 – \bar{X}_2)} {\sqrt{\left(\dfrac{s_1^2}{n_1} + \dfrac{s_2^2}{n_2}\right)}} t = \dfrac{(\bar{X}_1 - \bar{X}_2)} {\sqrt{\left(\dfrac{s_1^2}{n_1} + \dfrac{s_2^2}{n_2}\right)}}

Here is a site listing some latex syntax.

It takes a little extra work to actually show the two latex markup delimiters without latex actually executing. The latex delimiters that you would use in your HTML code on your WordPress site would be [latex] and then [/latex]. To actually display the first delimiter with the left and right bracket in the previous sentence, I need to code it this way: [latex]. Have a look at my post called HTML Character References (Entities). I tried using the UTF-8 codes, but when you switch back to the Visual editor in WordPress, the editor converts my codes back to actual characters and Latex takes over execution again. When latex executes it never shows the two delimiters. UTF-8 codes are shown at the w3schools website.