Use KaTeX with WordPress – Not JetPack

This short article will give a few reasons that you should use KaTeX with WordPress instead of JetPack Beautiful Math, assuming that you need some sort of math tex solution.

Why would you want to use tex? To write and display complex math functions in a pleasant way. I use tex here on the site in some of the exams I offer.

I can think of 4 reasons to use KaTeX instead of JetPack, but the first 2 are my big reasons:

  1. Compatability
    1. I currently use Watu Quizzes on the site. Beautiful Math conflicts with it and KaTeX doesn’t.
    2. Of course I could switch from Watu, and I probably will eventually, but this signals a more general problem.
  2. Ease of Use
    1. I may be different as I write HTML fluently, but I prefer the syntax for KaTeX.
  3. Closeness to real TeX
    1. See below images to visually compare for yourself.
    2. The difference between KaTeX and TeX seems to be the need to use an extra “\”
    3. Beautiful Math uses a “$latex” syntax that doesn’t resemble the real deal as much to me.
  4. Modularity
    1. KaTeX is implemented as open source JS + CSS. That is easy to extend and bring in to all sorts of applications.
    2. Beautiful Math is implemented as a component of JetPack, which means it is PHP-based and hard to extend or transfer.
  5. Performance?
    1. I guess? I didn’t do speed tests myself but KaTeX brags about how it is the fastest tex web rendering engine.
    2. I’m not officially counting this in my 4 official reasons, but worth mentioning.

Some Images

katex-code

Writing with KaTeX in the WP text view page editor. Perhaps more verbose, but I prefer this syntax.

 

jetpack-code

Writing with Beautiful Math. It feels ugly to me.

 

rendering

The most important part: The output! This is in the context of a Watu Quiz question. The Watu-incompatible Beautiful Math is on top and KaTeX is on bottom.

  Now, on to finish converting my Watu Quiz questions to KaTeX…

  •  
  •  
  •  
  •  
Tagged with: , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*