math-equations-and-latex-in-wordpress

You can use different methods to add mathematical equations to your WordPress blogs and pages. The most popular is LaTex. LaTex has been around for many years and it is not likely to go away any time soon.

Straight away, two points:-

  1. You need some sort of Plugin to enable LaTex
  2. You don’t see your equations in your Dashboard, you have to view your site through a browser to see the results of your handywork.

One of the most up-to-date plugins for LaTex is Slimpack

 

WordPress uploads directory
You have to use a plugin to use LaTex on WordPress

The LaTex option in the settings of Slimpack is not enabled by default. So when you have uploaded and activated Slimpack go to Settings and select “Beautiful Math” and then press the save button.

WordPress uploads directory
In SlimPack settings you need to select “Beautiful Math” to get to use LaTex Math on WordPress

There are two ways to tell WordPress that you are writing a LaTex formula:-

WordPress uploads directory

Both ways produce exactly the same result

i \hbar \frac{\partial}{\partial t}\Psi \left( \textbf{r},t \right) = \left [ \frac{-\hbar^{2}}{2\mu}\, \nabla^{2} + V \left( \textbf{r},t \right) \right]\Psi \left( \textbf{r},t \right)

 i \hbar \frac{\partial}{\partial t}\Psi \left( \textbf{r},t \right) = \left [ \frac{-\hbar^{2}}{2\mu}\, \nabla^{2} + V \left( \textbf{r},t \right) \right]\Psi \left( \textbf{r},t \right)

 

This is Shrödingers time-dependent Equation for a single non-relativistic particle, for example.

As an aside here, I present the formula code as an image because otherwise it would just show as another equation on my website! There is probably a technical way of showing formula code as formula code that I don’t know about. But the final result is that it would look just the same.

For help with learning the codeing for LaTex equation formula you can search the web. There are many different websites on the subject. It’s best to be specific though. For example search for “matrices in latex” or “integrals in latex”, depending on what you want to do of course. I give a few examples at the end of this article.

It’s really just the begining and end of a LaTex formula code that is different in WordPress than in a LaTex document, such as you might use on Bakoma, for example. Plus, as I indicate below, how to change the size and colour of the resultant equation. The actual equation formula is the same in WordPress web pages and in LaTex documents.

There is a support page for LaTex on WordPress.com. which gives some additional information for displaying LaTex equations in WordPress. For example &s=x, for x between -4 and 4 changes the size of the equation. Also &bg and &fg changes the font colour of the back-ground and fore-ground, respectively, according to the hexadecimal colour codes used.

WordPress uploads directory

i \hbar \frac{\partial}{\partial t}\Psi \left( \textbf{r},t \right) = \left [ \frac{-\hbar^{2}}{2\mu}\, \nabla^{2} + V \left( \textbf{r},t \right) \right]\Psi \left( \textbf{r},t \right)

and

i \hbar \frac{\partial}{\partial t}\Psi \left( \textbf{r},t \right) = \left [ \frac{-\hbar^{2}}{2\mu}\, \nabla^{2} + V \left( \textbf{r},t \right) \right]\Psi \left( \textbf{r},t \right)

Examples

(1) An array of numbers

gives

\left| \begin{array}{ccccc} x_{11} & x_{12} & x_{13} \\ x_{21} & x_{22} & x_{23} \\ x_{31} & x_{32} & x_{33} \end{array} \right|

(2) A matrix of numbers. What’s the difference between a matrix and an array in LaTex? Note if you just use matrix, rather than bmatrix, below, you get no left and right borders. If you use pmatrix you get parenthesis borders, if you use vmatrix you get vertical straight line borders, which indicate the determinant of the matrix, and if you use Vmatrix you get double vertical line borders

gives

\begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}

(3) An integral with limits

gives

\int_{a}^{b} x^2 dx

(4) An integral with dots

gives

\idotsint_V \mu(u_1,\dots,u_k) \,du_1 \dots du_k

(5) The Greek alphabet

$ latex \alpha, A, \beta, B, \gamma, \Gamma, \delta, \Delta, \epsilon, \varepsilon\, E, \zeta, Z, \eta, H, \theta, \vartheta, \Theta, &s=2 $

$ latex \iota, I, \kappa, K, \lambda, \Lambda, \mu, M, \nu, N, \xi, \Xi, o, O, \pi, \Pi, &s=2 $

$ latex \rho, \varrho, P, \sigma, \Sigma, \tau, T. \upsilon, \Upsilon, \phi, \varphi, \Phi, \chi, X, \psi, \omega, \Omega &s=2 $

gives

\alpha, A, \beta, B, \gamma, \Gamma, \delta, \Delta, \epsilon, \varepsilon\, E, \zeta, Z, \eta, H, \theta, \vartheta, \Theta,

\iota, I, \kappa, K, \lambda, \Lambda, \mu, M, \nu, N, \xi, \Xi, o, O, \pi, \Pi,

\rho, \varrho, P, \sigma, \Sigma, \tau, T. \upsilon, \Upsilon, \phi, \varphi, \Phi, \chi, X, \psi, \omega, \Omega

See also sharelatex.com for symbols like nabla, partial, square-root, infinity etc.

Incidentally, to get these pictures of equations, I copy the equation from WordPress into Microsoft Word. Then alter the font size to 16 point. Also, in Word, I go to File > Options > Proofing, and turn off both “Check spelling as you type” and “Mark grammar errors as you type”. This stops you from getting red underlines and blue underlines, respectively. I then do a screen print, paste into Paint Shop Pro and then crop and save the images as jpeg. Sounds long-winded but you get used to it!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.