Marking up mathematics

I have enabled the Mathjax plugin in WordPress so that you can add mathematical notation to your posts using Latex markup.

You must wrap the latex markup appropriately to inform WordPress to process it using the plugin.

For in-line maths use escaped round brackets (i.e., precede the bracket with a backslash):

 \(A = \pi r^2\) 

→ \(A = \pi r^2\)

An alternative is to use shortcodes

 [latex] E=mc^2 [/latex] 

→\(E=mc^2\)

For display maths use escaped square brackets:

 \[ C=2\times\pi\times r \] 

→ \[ C=2\times\pi\times r \]

Note: The visual editor can corrupt the text used to enter markup so check the raw text if you have a WYGINWYW moment (What You Get Is Not What You Wanted).

How do you come up with the Latex code?

Consider this formula:

 \[ G(f)=\int_{-\infty }^{\infty}g(t)e^{-j2\pi ft}dt \] 

→\[ G(f)=\int_{-\infty }^{\infty}g(t)e^{-j2\pi ft}dt \]

I showed the markup explicitly above by including it in a text block before the equation:

\[ [\mbox{text}]\ldots [/\mbox{text}] \]

but if you right click the displayed formula, you can view the actual Latex markup and copy it to the clipboard. Suppose you wanted to include this formula in a post, but using \( j \omega \) as the frequency variable. Paste it into this online equation editor and edit it appropriately. Once the equation looks right, copy the revised latex code into the WordPress post editor (between escaped brackets) and preview it to see if all is well.

Leave a Reply