Partilhar via


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

  • Anonymous
    April 30, 2011
    The comment has been removed

  • Anonymous
    May 04, 2011
    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.

  • Anonymous
    May 13, 2011
    The comment has been removed

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

  • Anonymous
    May 14, 2011
    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.

  • Anonymous
    May 14, 2011
    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

  • Anonymous
    May 15, 2011
    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).

  • Anonymous
    May 24, 2011
    The comment has been removed

  • Anonymous
    December 31, 2014
    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).
  • Anonymous
    January 01, 2015
    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.