30 March, 2013

Inputting Equations in Pages

It's a pain to enter equations in Pages on a Mac. You can get them to look somewhat right by just entering the text, but there are things you can't do, like insert a vector arrow above a given character. For some simple equations, using Grapher will get the job done, but only for equations that you'd want to graph, so your options are pretty limited.

So what is to do be done? I didn't want to install LibreOffice just to use its equation editor, and the equation editor in Microsoft Office didn't sound much better. Enter the Daum Equation Editor, available on the Mac App Store. You can enter just about any mathematical symbol you can think of, and it looks great in the app. The only problem comes in its export options: It can only export to PNG. This means that when you drop that image into a Pages document, it looks pretty fuzzy, and doesn't scale well.
Not acceptable.

It turns out that Daum is just a GUI for the TeX document formatting system, and as Daum shows the raw TeX syntax for the equation entered (see screenshot below), I figured I could paste that into a true TeX editor, and get much higher quality output. And I was right. That editor is LaTeXiT.

So here is what you need to do:
  1. Get the Daum Equation Editor on the Mac App Store for free.
  2. Download MacTex (2.1 GB, unfortunately) and install it.
  3. Once TeX is installed, open LaTeXiT in /Applications/TeX/.
  4. Open Daum Equation Editor.
Now, enter the equation using Daum's interface. 
Copy the code you see in the bottom of the window (if it's hidden, click the blue "TeX" button), and paste it into LaTeXiT.

Once you click "LaTeX it!" you should see your equation magically appear in fully-scalable SVG quality. Drag and drop your rendered equation into your document, and scale to your heart's content.

If you have problems with a symbol not being found, check the preamble within LaTeXiT to make sure the package that contains the symbol you want to use is being included. I was trying to insert a surface integral sign into my equation, but it was throwing an "undefined control sequence" error because it couldn't find the symbol. After I inserted a statement to include the "mathabx" package, it worked just fine.

And this isn't limited to Pages! You should be able to drag and drop the PDF SVG generated by LaTeXiT into any word processor on a Mac, including Microsoft Word. Happy equation-ing!


Martin said...

Cool! I'll remember this.

Copyright © 2015 James Irwin.
Clear by BloggerThemes Design by Diovo.com, with serious alterations by the author.