I may earn commissions if you shop through the affiliate links on this page. These links help support this website and keeps the content free. Thank you for your support!

\LaTeX

I used LaTeX extensively in both my undergraduate and graduate school careers, but I’m very new to using LaTeX in WordPress. I feel like I’m starting over with the basics since I’m no longer writing entire articles and compiling to create an .eps or .pdf, but rather writing individual lines of code within my WordPress editor. It’s somewhat limiting, and I’m daunted at the prospect of using it rather than just embedding pdfs.

But, I’m starting to add science pages to my site, and I’m going to start uploading notes from both my undergraduate and graduate studies, including research. So this is going to be a working document as I figure out how to use WordPress to publish science/math-related topics in WordPress (without just uploading pdfs). As I learn more about what I can do with this, I’ll add the information below.

Simple equations with LaTeX built-in WordPress/Jetpack

WordPress (with Jetpack) has three LaTeX packages built in:

  • amsmath
  • amsfonts
  • amssymb

You will need to have Jetpack enabled with LaTeX turned on in the settings. In the menu panel go to:

Jetpack > Settings > Writing

and look under composing for “Use the LaTeX markup language to write mathematical equations and formulas”

It’s easy enough to insert equations within your WordPress posts or pages. You just need to write with the following format:

$latex \mbox{Your Code Here}$

So you could write the time-dependent Schrödinger equation:

$latex i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right=H\left|Psi(t)\right>$

Which produces:

i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>

If you are using Gutenburg you don’t need to be in an HTML block. You can use the code to produce inline equations like Hooke’s law, F=-kx=m\frac{\partial^2 x}{\partial t}, right in the paragraph block.

This may be all I need for simple posts, but this simply isn’t going to work for more in-depth articles with more math. There is no way to reference equations within the document, and the default size is frustratingly small and hard to read (fixable, keep reading), and there is no way to automatically number equations. But, I’ll probably use it if I just need a couple of lines of equations. It’s time to start looking at some plugin options.

Another thing I’ve discovered is that using the “preformatted” block in Gutenburg to display the code was finicky at best. I tried to copy and paste the text into it, but then it still parsed the latex code. It needs to copy as plain text. When I looked at Jetpack’s instructions, there was a space after the dollar sign. I’m not sure why. It broke everything when I had any space there.

The actual equation produced is simply an image, so there is no way someone can copy/paste it. That might be a feature I want. Oh, and that’s a really small image, too. It’s also too low of a resolution to increase the size.

Sizing

It is possible to adjust the size of the image by passing in an integer between -4 to 4. The default size is zero (12pt). The parameter is entered as

&s=x

where x is the integer. Now our Schrödinger equation becomes a little bigger.

$latex i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>&s=2$
i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>

Two seems like a good and friendly size for display on desktop browsers and mobile. For now, you can find more documentation and how to change colors at WordPress.com.

Summary – Why I stopped using Jetpack Latex

It was completely unreliable. It wouldn’t render most of the time and seemed to be very inconsistent across browsers. I’ve since installed the QuickLaTeX plugin. So far, I am very happy with it. I’ll follow up with info on that soon. If you don’t have conflicting plugins, and only need to use a few lines of math ever, the built-in LaTeX package is probably ok. If math is any significant part of your WordPress site, then use a plugin like QuickLaTeX.

Add a comment

*Please complete all fields correctly

Related Posts

SpaceX Falcon 9 Launch on January 6, 2020
Follow Me
Tweet