November 13, 2005

Math into Type

Posted in Tools, Typesetting at 2:00 pm by India


India, Ink., has moved. The live version of this post is now located at Sorry for the inconvenience!

Maybe I should put some tape on the bridge of my glasses for this post, just as a precaution.

At my day job, I’m trying to come up for an interior design for this kind of freaky novel about puzzles. Or, rather, it’s a novel that is a puzzle. Or something like that. Each chapter contains problems to solve, and some of the problems are shaded in red (it’s four-color throughout—yow!), and if you solve all of those and send in your results, you get a prize. Legal details TK.

But that’s not the puzzle that concerns me.

No, the biggest problem I have to solve, aside from how to make this book look tasteful, is how to represent the inevitable mathy bits in InDesign. Because although we have a single license for an adequate if klugey math Xtension for Quark XPress 4 (in a five-typesetter shop, this frequently leads to exchanges like this: “I need the math.” “Okay, I’ll quit Quark in a sec.”), it’s my long-held policy to use InDesign whenever I can get away with it. In this case, I had already started setting up the book in InDesign when I noticed how much math it contained. Simple stacked fractions, sure, I can deal with those by hand, but square roots are a pain. And complex fractions, like

square root of ((x times (y squared)) over (x plus y))?

Forget it. Seek professional help.

I had researched this math-in-InDesign issue a couple of times before, as it’s one of the main technical obstacles to my company’s switching over from Quark (though not the main obstacle overall, that being cost). We do a lot of test-prep books (SAT, GED, GRE, occupational exams, etc.), and we need to be able to set a high volume of fractions, long division, square roots, and all that other stuff you learned about for tests and then promptly forgot. When I’d looked for plug-ins in the past, what I found was discouraging. If we squirm at a $169 upgrade from IDCS to IDCS2 (which is totally worth it), there’s no way we’re going to pay 495 euros, much less $695, for a single plug-in. I might be able to wheedle my way into a $119 version, but I’d have to be able to prove that it does everything our existing math XTension for Quark does, and possibly more.

But if the equation editor is free (excepting the minor expenditure of tape for your glasses)? Well, now we’re talking. Enter the magical world of TeX.

Note: Tape on my glasses or no, I don’t have much idea of what I’m talking about here. I’m just telling you what I did to get pretty equations into InDesign. I’m learning more about it just in the process of writing this up, so you may find upon investigating the matter yourself that there’s some even tidier way to do this. If so, please let me know, without flaming me. I’m a designer; I’m not even supposed to be able to read.

You will need:

  • Mac OS 10.something. I’m running Panther at work, but I’m about to try this all on Tiger at home; will let you know if there are any hitches.
  • i-Installer, a free program by Gerben Wierda that you will use probably one time only, to install TeX and Ghostscript.* Note the persuasive sales pitch: “You won’t believe it, but this whole installation lack of a train wreck actually attracts fan mail.” I found using this program, while not aesthetically pleasing, to be, in fact, utterly train-wreck free.
  • Equation Service, the free friendly TeX front-end that you will use to actually set your equations.
  • Adobe InDesign. Or any other layout application, to be honest, but why you would use anything other than InDesign to typeset a book if you had a choice is beyond me.

Not required but recommended:

  • TeX/Illustrator Fonts, available from the Editors/Fonts page at Mac-TeX. These are helpful if you want to fiddle with the equations by hand in Illustrator or some other vector art editor.
  • Adobe Illustrator or some other vector art editor, as above.
  • LaTex Help Book, which makes TeX help available from the Mac’s Help Viewer application. This doesn’t seem to be working for me in Tiger, but it’s fine in Panther.
  • Assorted other objects listed in the Applications Table at Mac-TeX.

What to do:

  • Launch i-installer and select i-Package -> Known Packages i-Directory from the menu bar (a popup on launch will tell you to do exactly this). A window will open listing the packages (programs) you can install. Highlight “TeX” and “Ghostscript 8” (or whatever appears to be the most recent version of Ghostscript*) and click Open i-Package. A new window will pop up containing the readme for each package. Read the readmes. When you’ve satisfied yourself that these won’t blow up your computer, click the “Install & Configure” button at the top of each window. You’ll need to type your administrator password for each. The TeX installer will ask you which version to install; I chose the basic installation, 2005 version. You will also be asked whether you want to have the ability to run it from the command line (not in so few words); I said no. When the installation is done, you will be notified in an unequivocal manner. Quit i-installer.
  • Install Equation Service by dragging it into your Applications folder. Test that it’s working by launching the application and typing the following in the top box: \frac{1}{2} and clicking “Typeset.” If all the parts are in place, after a few seconds you should see a stacked fraction in the bottom box:


    Save your fraction, which is in PDF format, and place it in an InDesign document.

Woo! That’s pretty much it. Except that in going through all this stuff for the second time, I realized why Equation Service is called Equation Service. Because, duh, it’s available globally, as a service, under the program menu in Cocoa applications.


Right, I never use services, either. But try this: With Equation Service running (or not–it will launch when you use the service; it just takes longer), type or paste \sqrt[3]{\frac{n}{n-1} S} into an InDesign document. Select this text, then choose InDesign -> Services -> Equation Service -> Typeset Equation from the menu. I actually gasped when I saw the result:

cube root of something or other

So do you see why this is good? There are some hitches, of course. For one, when you use the service function, the image is embedded in your document and doesn’t show up on the links palette. On the other hand, maybe you don’t want a zillion tiny fractions gunking up your links palette. For another, so far I haven’t found any way to change the typeface on these things except to open them in Illustrator and use Type -> Find Font. And for a third, you may have to learn some hairy-seeming syntax.

But it’s free.

As far as the hairy-seeming syntax goes, look in Equation Service help under Examples -> More Examples. Probably everything you need to know is on the Latex Math Symbols cheat sheet mentioned there.

So that’s it. If I figure out a way to get Equation Service to set my fractions in Adobe Garamond Pro, I’ll let you know.


* You know, I’m pretty sure you don’t even need Ghostscript. I may have downloaded that for some other reason. Try doing all this without it, first.


  1. […] So yesterday evening I submitted sample pages for that puzzle book, and today I received an e-mail from the publisher saying the “design is drop-dead gorgeous . . . I think it’s lovely.” The author hasn’t seen it, though, and I had some queries about structural issues, so there may yet be changes. But I’ll post some samples eventually. […]

  2. […] Since that puzzle book I mentioned earlier (math, design) has now been printed and should be appearing in stores, I figure it’s time to post some pages of it here, for your viewing pleasure. […]

  3. Mac Steve said,

    Is there a specific reason you didn’t consider MS Word’s Equation Editor, since you work with MS Word anyway. We create a new Word document for each formular, convert that to PDF and place it into InDesign like any other graphic. When you output PDF from Word it will be RGB but you can change that with PitStop or your Printer will handle this for you. At least in Word for Windows this works quite ok.

  4. India Amos said,

    No, no specific reason except, I guess, that I didn’t think of it. I’m aware of the existence of Word’s equation editor but have never used it; is it good? It’s not installed on my current computer, either, so I can’t check it out.

    Curious: can you cut and paste equations from Word directly into Illustrator, as you can do with embedded drawings?

  5. Brian said,

    I ran into the same trouble while writing papers for an optics class, and didn’t feel like mucking with TeX or any of that business.

    Try opening the Grapher utility that comes with Mac OS X (it might be a 10.4 thing). Create a new graph, and enter your equations (the equation pallete is helpful). You can then “copy as” (from the Edit menu) a PDF.

    The only problem I run into is that rules’ widths are hairlines, and they need to be fattened up in Illustrator before use.

  6. India Amos said,

    Well, well—isn’t that an interesting little gadget. But I rarely have trouble graphing mathematical expressions (or rather, I’m rarely required to do so with any accuracy).

    No, the time-consuming chore is setting the expressions themselves: fitting a stacked fraction with exponents under a square root symbol is a painful chore to do by hand. And representing cross-multiplication, with some numerators and denominators crossed out? Gaah. Doing it once is interesting; doing it over and over for a hundred pages is exhausting.

    Grapher displays such things admirably onscreen, but I don’t see a way to export the expressions—only the graphs of their results. Or am I missing it?

  7. Brian said,

    I’m sorry, I wasn’t very clear.

    Grapher makes it pretty easy to set fractions and square roots and other complicated math-type things. Things that can’t be typed in can be selected from the equation palette I mentioned. Then, you select the *equation*, and copy that as a PDF.

    Then paste it into Illustrator, re-copy, and paste into Indesign.

  8. India Amos said,

    Hmm. Still missing something. I’m able to copy the equation out of the formula box and paste it into Illustrator (just select and copy; no need to do Copy As -> PDF), but the type is converted to outlines. Is there a way to get it out as live, editable text?

    Meanwhile, it looks like the whole thing is just another TeX front-end, anyway. So one could use the friendly graphical interface to build an expression, do Copy As -> LaTeX, use Equation Service to set it, and then change the typeface in Illustrator . . . That would be kind of nuts, though, even for me.

  9. Mac Steve said,

    I think the Equation editor in MS Word is quite easy to learn, very visual and so far delivered what was needed. It has rules when to set text italic and when not according to mathematical conventions.

    With regards to copy/paste to Illustrator, I can currently only speak for WinXP, Word2002 and Illustrator10: Yes, you can directly copy over a formular from Word to Illustrator. Text even remains editable text but e.g. the square root sign gets converted into lines that look a little less desirable.

    So going the PDF route results in better typography

Comments are closed.

%d bloggers like this: