Apple and LaTeX

This morning, Federico Viticci tweeted out this image, captured from one of Apple’s WWDC videos.

Apple equations

My first thought was that this supported my impression that programmers, as a class, aren’t especially good at math. Not that the equations are incorrect, far from it. But if the hatted variables are constant offsets from their unhatted versions, do you really need to waste a slide telling your audience that the difference of the hatteds is equal to the difference of the unhatteds? I guess you do if your audience is made of programmers.1

But then I saw Eddie Smith’s reply to Federico:

@viticci They probably added LaTeX support to iWork just so they could make that slide
Eddie Smith (@eddie_smith) Jun 26 2017 9:38 AM

I looked at the equations more carefully and decided they couldn’t have been formatted by LaTeX—they’re just too poorly formatted. My guess is the presenter built these by hand without knowing how math is supposed to look.2

To me, three things tell the tale:

  1. Those aren’t minus signs, they’re hyphens. Minus signs are as wide as plus signs, and what you see on the slide certainly aren’t. LaTeX knows this and puts proper minus signs in place when you type a hyphen in math mode.
  2. The spacing is ugly and uneven. Look at the extra space just before the final e in each equation. LaTeX has consistent rules for spacing out the elements of an equation and ignores any extra space characters you might insert.
  3. The parentheses are italicized. This is just wrong. Nobody does this, especially not LaTeX.

After I tweeted an abbreviated summary of these points, Eddie pointed out that the equations should be aligned on the equals signs. That’s true, although it’s something LaTeX doesn’t force on you—you have to explicitly use the eqnarray or align environments.

Then Benjamin Morgan pointed out that the hats and subscripts looked wrong, too. He’s right, they do. The hats are way too peaky and the subscripts shouldn’t be sans serif when the base variables are seriffed.

To see what Apple’s doing with LaTeX in its iWork apps, I opened Pages and used the Insert‣Equation… command to enter LaTeX for generating the first equation.

Pages equation entry

This is how it looked after insertion into the document (zoomed to 400%).

Pages equation display

That’s more like it! Too bad this wasn’t used to make the slides.

By the way, whenever I need to insert an equation into a drawing, I use LaTeXiT by Pierre Chatelier. It’s a free program that leverages the LaTeX system I already have installed on my computer, so I don’t have to worry about which packages are or aren’t available—whatever I use in my normal LaTeX writing will be there. I’m not sure when I started using LaTeXiT, but it has to be over a decade ago. It’s always been rock solid.

LaTeXiT equation


  1. Is this unnecessarily mean?. Maybe, but I’ve gotten this impression from reading a lot of programming books that apologize for the supposed complexity of things like trig functions. By the way, this is unrelated to my cranky and unpopular opinion that programmers aren’t engineers. If anything, this supports the idea that programmers are engineers, as engineers are widely known for their limited math skills

  2. By the way, I did skim through the video and there’s some real math in there. I’m not suggesting the presenter, Brad Ford, can’t do math, just that he can’t typeset it.