sketch-frame-with-math-symbols-for-your-design-vector-1150074

Which do you prefer more: 1/2 or \frac{1}{2} ?

They both accomplish the job, but the \frac{1}{2} is admittedly more attractive. To write mathematically in WordPress, the site employs the typesetting system LaTeX.

In my recent mathematics posts, in particular this one on Euler’s formula, I’ve resorted to LaTeX to properly format equations.

Writing LaTeX in WordPress is much the same as writing LaTeX in an outside document, with the exception that in order to WordPress to recognize the code, you must nest the word latex and your code between dollar signs, as follows:

$ latex enter code here $

(Note: A space is added between the first $ and latex. That is formatted so that the code displays. When writing in LaTeX, there is no space between $ and latex.)

A Short Guide to LaTeX Code

For arithmetic operations

$ latex 4 + 2 $ 4 + 2
$ latex 4 -2 $ 4 - 2
$ latex 4 \cdot 2 $,   $ latex 4 \times 2 $ 4 \cdot 2 ,   4 \times 2
$ latex 4 \div 2 $ 4 \div 2

For fractions, exponents, subscripts, and logarithms

$ latex \frac{2}{3} $ \frac{2}{3}
$ latex 2^3 $ 2^3
$ latex y_1 $ y_1
$ latex \log_{10} 3 $ \log_{10} 3

For relationships

$ latex 2 < 3 $ 2 < 3
$ latex 3 \leq 4 $ 3 \leq 4
$ latex 4 > 3 $ 4 > 3
$ latex 4 \geq 3.5 $ 4 \geq 3.5
$ latex 2 = 2 $ 2 =2
$ latex 4 \neq 3 $ 4 \neq 3

For trigonometry

$ latex \sin{45} $ or $ latex \sin(45) $ \sin{45} or \sin(45)
Follow this same format for the other trigonometric functions, relating \sin with \cos, \tan, \csc\, \sec, \cot, \arcsin, \arccos, or \arctan.

For Riemann sums, limits, and integrals

$ latex \sum_{n=1}^{\infty} {2 \cdot 3^x} $
$ latex \sum\limits_{n=1}^{\infty} {2 \cdot 3^x} $
\sum_{n=1}^{\infty} {2 \cdot 3^x}
\sum\limits_{n=1}^{\infty} {2 \cdot 3^x}
$ latex \lim_{x\to\infty} f(x) $ \lim_{x\to\infty} f(x)
$ latex \int_{a}^{b} x^3 $
$ latex \int\limits_{a}^{b} x ^3 $
\int_{a}^{b} x^3
\int\limits_{a}^{b} x ^3

For special symbols, and the Greek symbols in particular, just write the name of the symbol with a backslash to the left. For example:

$ latex \theta $ \theta

To keep terms together, as in an exponent with more than one character, enclose the numbers/letters in brackets, {}. Brackets tell the LaTeX coder that a group of characters is together.

$ latex 2^{2x} $ 2^{2x}

Below is an example of LaTeX code adapted from my Euler’s formula post, to give you a feel of how a full equation looks.

$ latex f(x) = \sum\limits_{n=0}^\infty \frac{{f^n}{(a)}}{n!}\cdot (x-a)^n $ f(x) = \sum\limits_{n=0}^\infty \frac{{f^n}{(a)}}{n!}\cdot (x-a)^n

I hope that this short look into LaTeX has been helpful. Happy coding!