Sentence Numbering with Microsoft Word for Texts in Law

There is nothing so useless as doing efficiently that which should not be done at all.
Peter Drucker

Some texts require you to number each sentence. Apparently that is the case for some law texts. I see the advantage in being able to refer to each individual sentence, but it would be … insane to do this manually.

The following image shows the idea — taken from an unpublished draft, so I’ve blacked out the actual content. But each sentence has a number in superscript, which starts again after each paragraph:

There is software that can do this quite quickly. However, apparently it is rather expensive. And at least if you are using … sigh Microsoft Word, there are ways to semi-automate it.

NOTE: This is a hack. It works, with limitations, see below, but it’s not elegant. But if you’re using Word, elegance is not necessarily a criteria.

Word can do field functions, which include functions to simply count up. You see it in numbered list, but you can also put a field — which is replaced by the correct sequential number — anywhere in the text. Word can also search and replace, and while it apparently cannot replace text with field functions, it can replace text with the content of the clipboard. Taken together, it simply means replacing each full stop (.) with a full stop and the field function for an increasing number copied to the clipboard. You have to do the same for other punctuation marks, e.g., with question marks or exclamation marks, if your text uses them. If the counting should restart after each paragraph, you just have to replace the paragraph mark with the paragraph mark and the field function to restart counting.

NOTE: Microsoft Word updates the fields only when printing/exporting to PDF or when you select everything (Edit => Select All) and press F9 (or FN + F9 depending on the keyboard). The document might look weird for time with error messages until everything is in place and the functions are refreshed. Work with a copy of the document to try it out.

Thus, the steps are:

1. Add a field, does not matter where. Use the menu via Insert => Field, then select Seq as field name. You either get a grey box with { SEQ MERGEFORMAT } or, if the field functions themselves are not visible, you might get «ERRROR! No sequence specified.»

2. If you get the Error Message, make the field functions visible. Usually ATL (or OPTION) + F9 (if you have a limited keyboard with function keys instead of the F-Keys, you might additionally press the fn key whenever you use an F-key, so it would be FN + ALT/OPTION + F9).

3. Edit the Text in the field function to { SEQ NumList }. Stay inside the field function (in the gray box). Format the field function box in the way you like, e.g., make it superscript.

4. Select the function (without the paragraph mark at the end! see the image above) and copy it. Either with Edit => Copy or CTRL/Command + c. If the paragraph mark is not visible (the blue mirrored-p looking character in the image above), make the visible by clicking the icon (should be on the home ribbon.).

As the clipboard is used for replacement, the paragraph mark must not be selected, otherwise you add a new paragraph after each sentence.

5. Then select search and replace (Edit => Find => Replace) and search for the punctuation mark (e.g., «.») and replace it with «.^c» (without the quotation marks, see image below).

It will replace each full stop with a full stop and the content of the clipboard, which is the field function.

Note that it will do so for all full stops, so if you have a law with some numeric values, e.g., «must not exceed 17.3», it will add the function also to this punctuation mark. That can totally screw up the meaning, e.g., if it’s the third sentence, you could get «must not exceed 17.33». In this case, you can delete this particular instance afterwards by hand, or, perhaps more useful, you can search for «. » (add a space behind the dot) and replace it with «.^c ». You then likely have to search for «.^p» and replace it with «.^c^p» also. As the last sentence in a paragraph likely has no space character behind the full stop, the «. » search will not find it, so you have to search for it separately by also looking at full stops before paragraph marks (^p).

6. If the numbering should restart with each paragraph, you have to tell Word to restart the numbering. One hack I found was to simply add an invisible numbering field with the information to restart counting at 0. You have to add it before each paragraph mark. So use the field function which you had edited in step 3, replace the text inside with: { SEQ NumList \r 0 \h}. It tells word to reset the counter and start with 0. The \h hides the field, so it will not be shown in print. Then copy it to clipboard, and search for «^p» and replace it with «^c^p».

7. The document should now look something like this:

You might want to delete the function field which you used for edits/copying to the clipboard, as now each sentence should have a { SEQ NumList } and each paragraph mark an { SEQ NumList \r 0 \h}.

Switch to hide field functions via ALT + F9 (or FN + ALT/OPTION + F9). Select everything (Edit => Select All) and press F9 (or FN + F9). It should now show numbers after each sentence and restart the numbering with each new paragraph:

As written, it is a hack. It works, but it has it’s limits. You have to do some Find and Replace, be very careful if you have used punctuation marks for other purposes than to end a sentence (e.g., numeric values), and it’s frickly. Additionally, you have to be careful if you change the text afterwards. As the field functions are already part of the text, you cannot simply repeat the steps. You could delete all field functions, but it’s probably better to copy a { SEQ NumList } field into the clipboard and search for «. » (full stop followed by space) and replace it with «.^c ». Additionally search for «.^p» and replace it with «.^c^p» (to cover the last sentence in a paragraph). As the field function is immediately after the dot, the additional blank space will prevent it from being added again to all the sentences that you have already numbered.

But yeah, it works and it’s free. It’s probably also possible to write a VBA Macro or something that does the steps with one click (and ignores punctuation marks surrounded by numbers), but I’m not a fan of macros (nor do I write law texts, this was just a small ball of wool to play around with).

Anyways, happy writing.