Equation Numbering in Office 2016


Word 2016 and PowerPoint 2016 join OneNote 2010 (and later) in offering a way to display equation numbers flushed to the right margin. To enter an equation number using the linear format (see Section 3.21), type the equation followed by a # (U+0023) followed by the desired equation number text and hit Enter. For example, E=mc^2#(30) ⏎ renders as

 

(30)

Internally this layout is created with an equation array in which the # character acts as a marker telling the LineServices math handler to flush what follows the # to the right margin. Because equation arrays allow you to align parts of multiple equations vertically, you can use a nested equation array with line breaks and appropriate &’s to get arbitrary inter-equation alignments as explained in the equation-array post.

Flushing the equation number to the right margin is key, but in addition, one needs a way to number the equations automatically and refer to them in the text. Chapter 6 of the book Creating Research and Scientific Documents using Microsoft Word gives a method for doing just that. The approach inserts a center tab before the equation and a right tab before the equation number. While this works well for simple equations, it currently forces the equation to use inline typography, for which integral signs and the like are small rather than large as in display-mode typography (TeX $…$ vs $$…$$). This behavior is illustrated in the earlier post. So for Word 2016, the book approach can be updated to use the equation array # option instead of the flush-right tab.

The book explains how to number equations in Word automatically using the Equation Caption, which is based on Word’s handy SEQ Equation field. The other Office applications don’t have this feature unfortunately. The way it works is as follows. On the REFERENCES ribbon tab

1)      Click on “Insert Caption”

2)      Choose the Equation label

3)      Check the “Exclude label from caption” box

4)      Hit the OK button

5)      Insert a ( in front of your equation number and a ) after the number

6)      Change the formatting as desired preferably using an equation style with the formatting you like

The book notes that some publishers don’t want parenthesized equation-number references, so it’s a good idea to have the parentheses outside of the field. You can copy/paste this parenthesized equation number to insert equation numbers for other equations in your paper. Word automatically numbers all such entries sequentially.

To refer to an equation number, you first need to bookmark it. Select its Equation Caption with or without the enclosing parentheses and in the INSERT ribbon tab click on Bookmark. Give the equation number a name starting with “eq” so that you can tell equation numbers apart from other kinds of bookmarks and click on Add.

Wherever you want to reference an equation number, insert a Cross reference to the equation number’s bookmark. Specifically, on the INSERT ribbon tab

1)      Click on the Cross-reference button

2)      In the Reference type box, choose Bookmark

3)      Select the bookmark you want to refer to

4)      Ensure the “Insert reference to:” box contains “Bookmark text”

5)      Click Insert

If the bookmark doesn’t include the parentheses and you want them in the cross reference, you can enclose the cross reference in parentheses. If you don’t need flexible publishing style requirements, it’s simpler to include the parentheses in the bookmark itself. To update the cross references, type ctrl+a to Select All and F9 to update all the fields.

If you want to include chapter numbers in the equation numbers, in the Insert Caption dialog, click on Numbering… and check the “Include chapter number” box. The dialog gives options for how the chapters are defined using heading styles.

The equation handlers used in Microsoft Office have an elegant layout mechanism for equation numbers using the math paragraph, which also supports automatic equation wrapping and flexible equation alignments. The equation numbers can be placed on the left side or the right side and positioned vertically in various ways. In this connection, it might be worth modifying Word to treat a math zone that fills the [soft] paragraph aside from an optional leading center tab and a trailing right tab followed by text (the equation caption) as a display math zone. This would allow equation wrapping, something that has to be done a bit by hand with the equation-array approach. This “tabbed” math zone could be a way to represent the basic math-paragraph equation-number functionality in files. Another nice feature would be if inserting a cross reference, you could use Equation instead of Bookmark and see the current equation numbers without any surrounding text so that you wouldn’t have to create bookmarks. Inserting a caption always wants to include extra text unless the equation number is alone on a line. The bookmark lets you select the precise text you want in the cross reference.

The equation-array approach can also have arbitrary equation wrapping and alignments, but line wrapping isn’t automatic and you may need to insert appropriate markers to get what you want. So it’d be nice to follow through with the math paragraph approach someday. The present approach does work well for most purposes and is pretty easy to use. Enjoy!


Comments (25)

  1. Royi says:

    Nice,

    When will the Equation Editor be available in Office On Line?

  2. Andreas Rejbrand says:

    Finally! Almost a decade too late, though. Will try this out some day.

  3. davidacoder says:

    Finally, after almost 10 years, I might be able to use the equation editor. Thank you, I know you always lobbied for this, thanks for being persistent and not giving up on this feature.

    How will these equations look on older versions of Word?

    1. Lazar says:

      In older versions of Word, such as Word 2010 you can use a table-based method. To print chapter number use Insert—>Quick Parts —>Field and scroll down to StyleRef. Then place a period and Insert—>Quick Parts —>Field, scroll down to Seq. This will print sequential numbers. Exact procedure is here http://smps-power.blogspot.com/2016/09/insert-chapter-based-equation-numbers.html .

  4. Sebastian says:

    Hello Mr. Sargent,

    I tried Word 2016 and realized that the non-breaking space didn't work anymore like it does in Word 2010. I used it for example to keep the space between "3 km" constant, even if the paragraph format was set to justify. In Word 2016 the space between 3 and km is stretched in the german version of Word 2016. So I think the layout-engine ignores the non-breaking space that I inserted with Shift+Control+Space. A bug?

    I also tried the new formula numbering possibility. Here I think it is difficult to modify the fieldcode of the SEQ-Field in the mathzone because the Field-options (like show/hide fieldcode) didn't show up in the context menu, if I right-click on a field inserted in a mathzone. But nice to see, that numbering will be available in Word 2016.

    Are there chances that Word 2010 will get an update to display the numbering like Word 2016? At the moment it will show #(1) for example, when opening a Word 2016 document :-(.

    Best wishes from Germany

    Sebastian

  5. MurrayS3 says:

    You might try using one of the Unicode spaces like U+2004 (three-per-em space). Word doesn’t expand that at least.

    Good suggestion to back port the flush-right equation array feature to Word 2010/2013. The fix is simple, so hopefully I can convince people.

  6. Sebastian says:

    Thanks for the idea with Unicode spaces. The problem with this approch is that Word could break the line between value (3) and unit (km).

    If Word would support  the different kinds of fixed spaces you mentioned and a method to disable linebreaks at these points I would be very happy. The actual Word 2013/2016 behavior makes me unhappy. I'm happier with the behavior of Word until version 2010.

  7. Andreas Rejbrand says:

    @Sebastian: Surely you use the keyboard to work with fields, like Shift+F9: english.rejbrand.se/…/msword.asp

  8. Tom says:

    Dear Murray,

    The below is a feature request that would be incredibly useful when working with math heavy Word documents:

    At present, it is possible to search for a single math character, and replace it with an arbitrary math expression, via the "insert clipboard contents" function in the search and replace dialogue. In a similar way that you can insert the clipboard contents into the replace field (only entering ^c in that field), it would be great if you could insert the currently highlighted text into the find field (perhaps just entering ^h).

    I cannot imagine that the actual process of searching for exact math expressions is that difficult, the problem rather was mostly(?) a UI one, and this proposal would solve that at least.

    Thanks in advance,

    Tom

  9. MurrayS3 says:

    Actually it's pretty easy to search for an arbitrary mathematical expression as described in blogs.msdn.com/…/math-find-replace-and-rich-text-searches.aspx. You're right, we ought to do it!

  10. bbbear2002 says:

    Does this method support Office Mac 2016?

    1. Ken says:

      This way of equation numbering in Word 2016 is now supported in Mac too! Thank you!

  11. chrbau2711 says:

    I'm afraid it doesn't support Office 2016 for Mac. At least not on my Mac 🙁

    1. mathieu says:

      It “kinda works” in Office for Mac 2016 (at least as of today), but you have to do a little extra gymnastics… I’ll assume you have already written your equation with its number flushed to the right, as described in the E=mc^2#(30) above. Then:
      1- put your cursor anywhere on the page
      2- hit Insert Caption, choose the Equation label, don’t bother adding text, format the numbering to your liking
      3- click Insert
      Now you have a useless equation caption in the middle of a page. Great.
      4- copy the entire equation number (i.e. not the label, but including the chapter number if it is part of your numbering scheme)
      5- paste it between inside the equation field of the equation you had written, i.e. in the original example overwrite the “30” in “E=mc^2#(30)”

      Done. You can keep copy-pasting that same field in all your equations with right-flushed numbers. Unfortunately this method now considers the whole equation as the label of your caption, and it doesn’t look like there’s a way to cross-reference just the number of a caption, so you’re stuck with the bookmarking extra step described by MurrayS3.

    2. Ken says:

      OK, but it’s not supported in Word 2016 for Mac. We need to wait another 10 years…

  12. Shants says:

    Great tips, thanks.
    How can we have a single equation number vertically centered over a multi-line set of equations (particularly if there is an even number of equations in the set)?
    E.g.
    x = ….
    y = …. (1)
    z = ….

    1. MurrayS3 says:

      Use an equation array for the three equations and put it in an equation array with the equation number

  13. Ben says:

    Where exactly is the syntax reference for this thing? I’ve looked all over and I can’t find a trace of any sort of official documentation regarding the equation editor at all. This is the first hit on anything technical and official, so I’m asking here.

  14. Shannon Owings says:

    When I’m inserting a caption for an equation. Should I click inside or outside of the equation box? When it inserts the caption, i.e. 1, to the right, when I attempt to put parenthesis after the 1 it forces the ) to the next line. I can’t seem to find a way to put the closed parenthesis on the other side of the 1 and it be on the same line.

    Thanks for your help.

  15. Shannon says:

    Also, is there a feature that recognizes when you delete an equation/or and an equation and then automatically renumbers your equations accordingly?

  16. dat says:

    Works perfectly when I’m not using reference with header (E.g. 5.12).

  17. B3Co0L says:

    “type the equation followed by a # (U+0023) followed by the desired equation number text and hit Enter. For example, E=mc^2#(30) ⏎”

    I can’t make the equation numbering to work on my word 2016. The number doesn’t flush to the right. Any idea why?

  18. a1a
    Very good!!
    Next equaytion:
    a2a ???

  19. Meteorhead says:

    I realize this blog post is fairly “old”, but it does not work for me. Everything works up until bookmarking the equation caption. In the bookmarking dialog I tried virtually every combination that exists, but when I try to insert a cross-reference, it does not see any bookmarks. I am using a Hungarian localized Microsoft Word, I only see “Könyvjelző” instead of Bookmark, I don’t know if this causes an issue somewhere under the hood (or something else goes wrong).

Skip to main content