Word: Fixing a Table of ContentsSeptember 11, 2009
Sometimes Word just won’t behave…
Recently I had a client’s Table of Contents (TOC) that got broken somehow (this is in Word 2003). If you look at the screen shot below you can see that there are two places where it is broken — section ‘9.3 Performance Standards…. 141’ is split over two lines, as is section ‘10.0 Implementation’ on page 146. There were a lot more than this, but these will do as the examples.
What I tried
I’ve had this before and have usually been able to fix it by doing Ctrl+click on the page number to go the heading that isn’t behaving, pressing Enter a few times at the beginning of the text for that section, creating a new heading with the same text on one of the new lines, applying the appropriate heading style, then deleting the old heading and any excess lines, then updating the TOC. Well, that worked for some of the Heading 3 level headings, but I just couldn’t fix the Heading 1 and 2 levels this way. They were broken.
So I tried several other strategies, none of which worked (e.g. reapply the style to the heading, reinsert the TOC from scratch, use the Organizer to copy across the original heading styles from the template, reassign the template to the doc, etc.).
What did work was a suggestion from my colleague, Susan Mc. She asked if I’d tried adding new lines ABOVE and BELOW the heading, re-creating the heading above the existing one, then removing all the excess lines and the heading that was misbehaving. I’d been adding the new lines below the heading, so I tried her suggestion — and it worked!
My TOC was back in order and I was happy, and my client was happy too!
However, this solution, while it worked, threw up another problem…
What can go wrong
If any of the headings you replace are cross-referenced within the document, they will become ‘0’ or ‘1.x’ or perhaps Error! Reference source not found’ cross-references — as shown below:
How to find these broken cross-references
Typically you’ll have a word in front of them that you can use to narrow down the search. Let’s use the example above — the incorrect reference is ‘Section 0’. So you need to do a Find (Ctrl+F) and look for ‘section 0’ (without the quotes).
How to fix these broken cross-references
For broken cross-references with a number like ‘0’ (as in the example above) or ‘1.x’, then Ctrl+click on the number and you’ll get taken to where Word thinks the heading is. Somehow Word remembers where the now-deleted heading was, so Ctrl+click takes you to where the new one is. But Word doesn’t know this new heading should be the cross-reference, so you need to reassign it. That’s easy — it’s a bit time-consuming, but it’s easy as you know where it *should* refer to.
However, if you have ‘Error! Reference source not found’ instead of the cross-reference, then you’ll have to figure out what it’s meant to refer to by the context of the text surrounding it, and then reassign it. Not so easy, especially if you’re the editor and not the author.
Other clues I had that things might not be right with the headings in this document were the Document Map (View > Document Map) and the Cross-reference dialog box. Here’s part of the Document Map — those blank numbered items are a BIG clue!
And in the Cross-reference dialog (Insert > Reference > Cross-reference), I had all these extra 1.x’s for the ‘blank’ Headings:
What caused it in the first place?
I still don’t know what caused this document to get corrupt headings. I had only worked on it a few weeks earlier and it was fine then. However, it went to several authors after that and they added and deleted a lot of information, including copying and pasting an entire section from another document, WITHOUT pasting it as unformatted text. I suspect that’s where the problem occurred — somehow the styles got screwed up (technical term!), and even though they looked fine in the main body of the document, they obviously weren’t right when it came to the document’s structure.
(Update September 2010: I had a similar problem with a Word 2007 document and suspected that Track Changes might be the cause. So I copied the original document and accepted all Track Changes on the copy. When I updated the TOC, everything was back where it should be. It’s likely that Track Changes is the culprit, though I’m sure it’s not helped by people just copy/pasting from other docs.)
I think what I did is a quick fix only, and at some point this entire 200 page document will need to be copied over (using unformatted text!) to a clean template. I hope not — it adds about 4 to 8 hours to my editing process. The copy/paste as unformatted text and reassignment of heading styles is the easy part — reconstructing the many tables and cross-references is the painful part, as is setting up all the section breaks and headers and footers for the various page layouts (these documents have lots of Landscape and A3 pages).
It could all be avoided with the authors taking a little more time and care when they paste in text from another document — even one using the same template. Paste unformatted avoids so many of these conflicting style issues…
[Links last checked August 2009; thanks to Susan Mc who suggested adding new lines in front of the headings]