Advanced authoring in Microsoft Word – Part 19: Automatic numbering of definitions and theorems
In mathematics and mathematical physics texts it is common practice to number definitions and theorems. A typical example is given below.
In some texts, definitions and theorems share a single sequence of numbers, and sometimes each type of object has its own sequence.
Now, in Microsoft Word, is there some way to number objects like this automatically, and to create dynamic cross-references to them? Yes, there is, and we already know how to do it using the SEQ
field and bookmarks.
If you want to use a single sequence to number all kinds of objects (both definitions and theorems), you could use a single sequence named ‘Box’, for example. If you want two separate sequences for definitions and theorems, you could use two sequences named ‘Definition’ and ‘Theorem’, respectively. In the sequel, we will use only a single sequence.
To number a particular object, simply press Ctrl+F9 where you want the number, and enter SEQ Box or SEQ Box \s 1 (or whatever suits you). The latter version will restart the numbering at each chapter heading (‘Heading 1’). Then press F9 to update the field.
If you want a convenient and robust way of referring to the box (definition or theorem), you should assign it a descriptive bookmark name, as we did for equations in the previous post: select the number of the box, and click Insert/Bookmark in the ribbon. Then you can create cross-references to the box, using that friendly bookmark name.
In the example above, I think I would use ‘NewtonSecondDiscreteSystem’ as the bookmark name. To make a reference to this bookmark, you can use the GUI as described in the previous post, or you could press Ctrl+F9, type REF NewtonSecondDiscreteSystem \h and press F9.
You can also include the page number of the bookmark, using the PageRef
field:
This might look like
To simplify the creation of numbered boxes further, you could create a ‘building block’ with the SEQ
field, or even with the entire box skeleton (which includes the field).