Typing Equations on WordPress

Many teachers have asked me how I manage to put up those beautiful equations onto my posts. In this article, I will explain how I use LaTex to create those equations in my posts.

LaTex

LaTex is a system that scientists used to write their scientific journals. LaTex is huge. According to the LaTex organisation ,

LaTeX is a document preparation system for high-quality typesetting. It is most often used for medium-to-large technical or scientific documents but it can be used for almost any form of publishing.

You could create a whole document using LaTex. However, for most teachers, we usually use our favorite word processors to create our document, inserting equations only when necessary. Some word processors have built-in features that allow you to type equations. Others require you to install third party software, such as MathType.

For web sites, you would need to check whether your content management system allows third party plugins to enable LaTex entry. Most popular CMS would have such plugins made available by third party, including WordPress. However, WordPress takes a step further by including this function in its default setup.

Enabling LaTex in WordPress

If you are logging into the official WordPress website, then LaTex is already enabled by default. If you are using a hosted WordPress site, you would need to create an account with WordPress.com site and link your hosted WordPress with the WordPress.com account using Jetpack. After you linked up the account, activate Beautiful Math function under the Jetpack setting.

LaTex Basics

To type an equation, you would enclose the expression within the [latex] and [/latex] short code.

a=b+c is typed as [latex]a=b+c[/latex].

Space is ignored, so there is no difference whether you typed one for two spaces or even no space for formatting purpose. You may try typing [latex] a  =b +       c[/latex] and you would get the same result as above.

Symbols

To insert symbols, you would use the forward slash i.e. \times would produce \times.

Symbols

\times : \times
\div : \div
\approx : \approx

Greek symbols

The codes for Greek symbols are the name of the symbols.

\alpha : [latex]\alpha[/latex]
\beta : [latex]\beta[/latex]
\gamma : [latex]\gamma[/latex]

For symbols that are Greek capitals, capitalise the first letter. For example,

\omega - \Omega : [latex]\omega – \Omega [/latex]

Mathematical structures

\frac{x}{y} : [latex]\frac{x}{y}[/latex]
x^y : [latex]x^y[/latex]
x_y : [latex]x_y[/latex]
\begin{aligned}\frac{dy}{dx}  \end{aligned} : [latex]\frac{dy}{dx}[/latex]
\begin{aligned} \int_a^b x^2 dx \end{aligned}  : [latex]\int_a^b x^2 dx[/latex]

Text, including units

\text{This is a statement.}

To get a full list, use this cheat sheet.

Combinations

The power of LaTex comes when you combine the above codes. For example,

\begin{aligned} \text{circumference of circle }=\frac{\pi d^2}{4} \end{aligned} : [latex] \text{circumference of circle }=\frac{\pi d^2}{4} [/latex]
\begin{aligned} F_\text{charge} = \frac{1}{4 \pi \epsilon_0}\frac{Q_1 Q_2}{r^2} \end{aligned} : [latex] F_\text{charge} = \frac{1}{4 \pi \epsilon_0}\frac{Q_1 Q_2}{r^2} [/latex]

Multiple Equations

Very often, you would want to show derivations of include multiple lines of equations. The ideal way would be to align the equal signs so that the list of equations looks neat. To do that, we need to add the aligned formatter.

\begin{aligned} \text{kinetic energy}&=\frac{1}{2}mv^2\\&=\frac{1}{2}(0.50)(2^2)\\&= 1 \text{ J}\end{aligned} :
[latex]\begin{aligned} \text{kinetic energy}&=\frac{1}{2}mv^2\\&=\frac{1}{2}(0.50)(2^2)\\&= 1 \text{ J}\end{aligned} [/latex]

Use & to fix the alignment character. In the above example, &= will align all the equal signs.

Review

Challenge 1

Enable LaTex entry for your WordPress site.

Challenge 2

Using LaTex, create the following equations on your site.

\begin{aligned} E&=mc^2 \\ \text{specific heat capacity}&=mc\Delta \theta\\\frac{1}{R_\text{total}}&=\frac{1}{R_1}+\frac{1}{R_2}+...\end{aligned}

 

print