Two Math Typography Niceties


Roughly eight years ago, some colleagues and I had the good fortune to spend an extraordinary afternoon with Donald Knuth, the primary author of TeX, at his home on the Stanford University campus. Among many things, Donald showed us how he uses TeX to typeset his computer-science papers and books exactly the way he wants them to look. In particular, he applies special tweaks to achieve perfection, such as “smashing the descender” on one radicand to make a sum of square roots line up in a pleasing way, and such as shimming characters to place them more beautifully in a formula.

The present post illustrates a couple typographical niceties that Knuth might add to his documents. At the outset I need to warn the reader that such “tweaking” is a fine art. Knuth mentioned that he could recognize some authors by the way they tweak their TeX documents. Furthermore many TeXies don’t understand the technique that well. Barbara Beeton of the American Mathematical Society (AMS) and a key person in having the AMS adopt TeX told me that the AMS has to delete most user tweaking before publication because it doesn’t meet AMS standards. With that caveat emptor, here are two examples.

A favorite equation of mine is the mode locking equation

 

I wrote several papers and two book sections showing how this equation describes mode locking phenomena in coupled clocks, coupled oscillators in general, and lasers in particular. Looking at it, you can see that there’s a little too much room between the 2π and the integrand. You can pull the integrand to the left under the π by “smashing” its width. Inside the upper limit, you type \hsmash \pi , and the π displays, but has no horizontal width as in

Doesn’t that look better? We thought about automating such refinements, but if we had, we wouldn’t have had enough time to ship Word 2007, so we left it to the user (as did Knuth).

The example Knuth showed us is adding the square root of x to the square root of y. If you just use the default layout in TeX (or Microsoft Office), you get

As you see, the square root of the y is a bigger than that of the x, since the y has a descender. But it would look better if we “smashed” the y’s descender (type \sqrt\dsmash y ) so that both square roots have the same size We also thought about automating such smashing, but the general case doesn’t appear to be described by a simple algorithm. Tweaking is an art! Hopefully you don’t need to tweak that often.

(As you see here, I still haven’t been able to make technical documents display in this blog the elegant way they display in Word. Some day, hopefully!)


Comments (10)

  1. JonnyBoats says:

    At the Microsoft research center in Cambridge, England they are doing some phenominal work with AI (Infer.Net is one example that comes to mind). This sounds like an ideal project for a summer intern to cut his teeth on, perhaps you should suggest it to them.

    Alternatively you could have a contest for students to submit the best math formatting add-in for word. I bet many students could come up with some great ideas!

  2. SoCal Sam says:

    I like this idea, it is too bad the Pex4fun engine doesn't support graphics, it would be perfect for that.

    I am definitely up to push this out to the students that I deal with.

  3. Juho says:

    In formula ∛(x/y), index 3 seems to be too high. Can I do something to lower it?

  4. Juho says:

    I found that I can lower the index at least with Word's standard font formatting command. Is there any other way?

  5. MurrayS says:

    When I type it in, I find the top of the 2 is little lower than the sqrt bar. Is this what you see? Unfortunately I can't include a png with a comment.

  6. Juho says:

    By default I get this:

    dl.dropbox.com/…/cuberoot.pdf

    I think this would be better:

    dl.dropbox.com/…/cuberoot2.pdf

    TeX does it even better:

    dl.dropbox.com/…/latexcuberoot.pdf

  7. MurrayS says:

    I agree that TeX's rendering is the nicest of the three. You can make Word's look a little better by smashing the descender on the y. Enlarged root symbols are tricky to create. For this particular expression, it would be better not to build up the fraction, e.g., type sqrt(3&x/y). That's true too if you superscript the x/y (type e^(x/y).

  8. Nali says:

    Word 2007 brought great support for math. However, Office 2010 "only" extended the math ability of Word to PowerPoint, Excel, and OneNote, but did not bring any significant improvement of model.

    While Office 2007 was a major version of Office, Office 2010 was a minor version. I hope that the Office 15 will be major version and bring some new and important features for math engine and document layout.

    I think, some behaviour of math engine should change in Office 15:

    1) Please, in Word 2007/2010 try to render following expression:

    sqrt x_i^2

    and you will see improper high of root.

    2) Another example is

    b=1/(sum_(i=1)^Nof x_i)

    In Word2007/Office2010, for n-ary operator placed in numerator or denominator of fraction, it is impossible to place the position of n-ary limits directly above and below n-ary operators – they are always placed to the side (as in inline mode).

    3) Some expression in inline mode should be more compact. Please, try to render e.g. fraction 1/2 in inline math mode, and you will see that the distances of numerator and denominator from fraction line are to large.

    4) Please, add both automatic and manual equation numbering, and referencing!!!:-) And also ability to change the style of reference :-)

    Automating of that two math typography niceties described in your post (and simillar features) would be cool!

    Thank you.

  9. Andreas Rejbrand says:

    I believe I have found a bug in Microsoft Word 2010:

    Steps to reproduce:

    1. Create a new Microsoft Word document.

    2. Insert the formula sqrtdsmash x_i^2.

    3. Save and close the document.

    4. Open the document again.

    5. Convert the formula from professional to linear format.

    PROBLEM: The smash has disappeared.

    6. Convert the formula back to professional format: no smashing (of course).

  10. MurrayS says:

    I tried this with Word 2013 and didn't repro the bug. The dsmash round tripped through the linear format as √(⬇(x_i )) (although the x and i are math italic). Still need to try it with Word 2010. Thanks.