## LaTeX Problem’s Not Our Fault

Thanks to those who’ve sent me e-mail saying that the LaTeX is broken on the site. It’s not our fault. Really. It’s a problem with WordPress’s server.

Are lots of people having problems seeing LaTeX on our site?

### What’s Going On

WordPress uses a web service to decode the LaTeX expressions to PNGs. When I write something like

$latex f(x)$


in a blog post, it gets rendered as $f(x)$.

What’s really going on is that WordPress is preprocessing my doc and replacing the LaTeX escapes with links to a web service that returns PNG images. For instance, the example above translates to the following link:

http://l.wordpress.com/latex.php?latex=f%28x%29&bg=ffffff&fg=000000&s=0


If you click on the link, you should see just the formula.

(Note: Given that they run the preprocessor, WordPress might change the path and the link might go stale. Or their server might be down. If that happens, right click on the image in your browser and select “View Image Info” or whatever the variant for doing that on your browser is.)

### What Happens When it Fails

When WordPress’s web server goes down, it fills in something like “latex path not specified”. Not sure whether that’s postprocessing or just the result from the server not being configured properly.

Brendan O’Connor was kind enough to send me a screen shot:

### 8 Responses to “LaTeX Problem’s Not Our Fault”

1. lingpipe Says:

Some suggestions I received via e-mail were for ASCIIMathML, which doesn’t produce particularly beautiful output, and jsLaTeX, which looks like the same kind of plug-in as is being used by WordPress.

I used to use the Sitmo equation editor, but the direct syntax of the WordPress plug-in’s awfully convenient.

2. lingpipe Says:

WordPress got back to me and said they’ve diagnosed and fixed the problem.

You may need to reload to get things out of your browser’s cache.

3. Sam Fenster Says:

jsMath might be a good option for authors whose pages aren’t preprocessed like WordPress does for you: http://www.math.union.edu/~dpvc/jsMath/ . I haven’t used it myself, but it looks good.

• lingpipe Says:

As I said above, I used to use Sitmo, which plugs in images. But it’s much easier to get the feedback along with the page than try to glom something on from the outside.

The way jsMath interacts with the browser for fonts is neat, but I doubt many of my readers are going to go for an install, even of a browser plugin. It also won’t work for me, because WordPress controls the server, and the instructions start with telling you to install something on your server! Maybe I could use a different server than the one feeding my web pages?

• Sam Fenster Says:

No reader install needed! If a frequent reader chooses to do it, it makes equation rendering faster.

After commenting, I installed it, and it was trivial: Upload one .js file to the web server, and a big folder full of font images. Then putting equations in any .html file is trivial. Sample (view source):
http://samfenster.org/jsmathtest.html

• lingpipe Says:

I checked out the source of your example link and see what’s going on. There’s a Javascript you’re referencing by URL in a script element that’s doing the work. I could host the script on one of our servers and then link it from the WordPress pages.

But I’m afraid WordPress wont’ let me include arbitrary script elements, either.

I realized you didn’t need to install the fonts locally. But it doesn’t look much like their examples otherwise. Even their examples don’t look as good as the images from WordPress or Sitmo.

The resizing’s nice, though. You might be able to hack that with the LaTeX image server and more Javascript, but that’s well beyond my web dev level.

4. Sam Fenster Says:

I just had to follow up, months later, to point out this option:
http://www.mathjax.org/
It still requires a one-line in your template’s head, but the rendering is perfect (not bitmaps), with no client-side adaptations.

• lingpipe Says:

I’ve seen other refs to MathJax. The output looks nice, unlike the things that try to convert to HTML.

The problem for us is that we’re hosted on WordPress rather than running our own server install of WordPress. I don’t have permission to install general-purpose software, so I can’t follow the line in the MathJax instructions for WordPress where they say “path-to-MathJax should be replaced by the web-address of the main MathJax directory on your server”.

On the other hand, now that I’ve started blogging on Andrew’s blog, I could probably install it there, because we are running Movable Type locally.