This is a test of KaTex, the latex rendering engine used for Khan academy. They advertise themselves as much faster than mathjax, but it looks like the reason for that is because they generate images that look crappy unless the browser resolution is matched to the images just right.

Here’s a rerendering of an old post, with the latex rendered with WP-KaTeX instead of MathJax-LaTeX.

# The post

### Problem:

Calculate the field due to a spherical shell. The field is

where is the position to the area element on the shell. For the test position, let .

### Solution:

We need to parameterize the area integral. A complex-number like geometric algebra representation works nicely.

Here has been used to represent to horizontal rotation plane.

The difference in position between the test vector and area-element is

with an absolute squared length of

As a side note, this is a kind of fun way to prove the old “cosine-law” identity. With that done, the field integral can now be expressed explicitly

Observe that all the azimuthal contributions get killed. We expect that due to the symmetry of the problem. We are left with an integral that submits to Mathematica, but doesn’t look fun to attempt manually. Specifically

if , and zero otherwise, so

for , and zero otherwise.

In the problem, it is pointed out to be careful of the sign when evaluating , however, I don’t see where that is even useful?

# KaTex commentary

- Conditional patterns, such as:
\left\{ \begin{array}{l l} \frac{\sigma (R/z)^2 \mathbf{e}_3}{\epsilon_0} & \quad \mbox{if \( z > R \) } \\ 0 & \quad \mbox{if \( z < R \) } \end{array} \right.

- The latex has to be all in one line, or else KaTex renders the newlines explicitly. Example:

Having to condense all my latex onto a single line is one of the reasons I switched from the default wordpress latex engine to mathjax. It was annoying enough that I started paying for my wordpress hosting, and stopped posting on my old free peeterjoot.wordpress.com blog. Using KaTex and having to go back to single line latex would suck! - The rendering looks like crap, unless you match your resolution to exactly those used to create the images. The mathjax rendering may be slower, but looks much better!
- The Mathjax-Latex wordpress plugin has some support for equation labeling and references. I don’t see a way to do those with the WP-KaTex plugin.
- I can have a large set of macros installed in my default.js matching a subset of what I have in my .sty files. I don’t see a way to do that with the WP-KaTex plugin, but perhaps there is just no documented mechanism. KaTex itself does have a macro mechanism.
- Left justified display mode is hard to read. The mathjax rendered centered display mode looks much better.

## EDIT.

I’m not sure I was getting the katex plugin when I used the [ latex ] … [ /latex ] tags. I see some comments that indicate that there is built in handling of these tags in the Jetpack plugin. If I change frontend.php in the katex plugin to use [ katex ] … [ /katex ] tags instead, then I see much different results.

Peeter Joot's Blog » Electric field of a spherical shell. Ka-Tex rendered [Take II].1 year ago