More on Equation Numbering

The book Creating Research and Scientific Documents using Microsoft Word gives a method for numbering equations that works with all versions of Word from Word 2007 on and has automatic renumbering of the equations and the references to the equations. Those are very attractive features. The approach inserts a center tab before the equation and a right tab before the equation number. This works perfectly for simple equations, but there are some problems for more complicated equations. The problems could in principle could be solved with modifications to Word, but not in a backward compatible way. This post explains the problems and possible solutions.

The problems occur because the presence of tabs on the line outside the math zone makes Word think the math zone is an inline math zone and therefore uses inline math typography instead of display math typography. For inline typography, summation limits appear as subscripts and superscripts instead of being displayed above and below. Also fraction numerators and denominators are squeezed down to script level 1. A fix in Word would be to treat a math zone ensconced between such tabs as a display math zone. Such a fix wouldn’t require file format changes. For example, with inline math typography the display-math equation

looks like

 

The relatively compressed format is desirable inline so that a paragraph isn’t spaced too far apart. But it doesn’t look as nice as the display math version.

A second problem is that if an equation is too long to fit in the allotted space, it wraps using inline protocol and typically leaves the equation number centered instead of flushed right. Nice wrapping can be obtained using an equation array as discussed below.  A minor inconvenience with the center and flush-right tabs is that if you change the margins, you need to change the center and right tabs as well in order to keep the equation centered and the equation number flushed to the right. This problem would be fixed if Word added center-width and right-margin tabs that derive their positions from the current display width instead of from fixed values on the ruler. Adding two new kinds of tabs would change the tab-type enumeration in files.

If you use the three-cell table approach of Dong Yu, these problems don’t occur and the approach works with Word 2007 on. You can have numbered equations with nice wrapping like

   

 

 

(1.1)           

The first and third cells have the identical, small widths. The second cell is wide and contains the equation. The third cell contains the equation number. Or you could put the equation numbers in the first cell if your publisher wants equation numbers to be on the left (pretty rare). The three-cell table approach can be used instead of the center and right tabs, while using the approach of the book for formatting and referencing the equation numbers. Chapter 5 of the book discusses using tables to align figures in nice ways and tables are used extensively in HTML web pages to achieve special alignments. In fact, a three-cell HTML table is used here in this post to flush the equation number to the right.

In principle, the Office math handlers offer better approaches to equation numbering than using center and right tabs. An earlier post describes such approaches. The main glitch with the more elegant equation numbering approach using the Page/Table Services math handler is that Word needs some changes to utilize the facility.

Meanwhile an intermediate approach was quietly incorporated into OneNote 2013 and hopefully will show up in other apps pretty soon. This approach uses a special feature of the equation array, which flushes an equation number to the right margin. You enter a numbered equation by typing the equation followed by ‘#’ followed by the equation number and then an Enter key as described in Section 3.21 of the math linear format paper. The # is a code that triggers insertion of an equation array with a # argument separator. The text that follows the separator is flushed to the right of the page. This allows the equation to remain in display mode and to track margin changes automatically. Furthermore, by using a nested equation array with line breaks and appropriate aligning and spacing &’s, you can get arbitrary inter-equation alignments as explained in the equation-array post. The numbering and cross referencing can be accomplished using the techniques explained in Chapter 6 of the book. Once you have one equation number in place, all you need to do is to copy that number to generate appropriately numbered equations elsewhere in the document and bookmark them for cross referencing purposes. Word’s automatic sequence numbering renumbers the equations as need be (you can fire the update by pressing the F9 key). The equation-number option of the equation array doesn’t require any file format changes, but on unaware apps, it displays the equation number adjacent to the equation instead of flushed right.

The good thing is that there are ways to number equations in Word pretty easily, although they aren’t as discoverable as other kinds of numbering in Word. For the moment at least, I like using the three-cell table approach with the formatting and referencing methods described in the book. That combination gives you easy equation number updates along with display-math formatting and nice equation line breaks.