0

I want an entry in my TOC (that was created with Headings 1, 2 & 3) that is not the same as the text it points to. So I want to have the word 'Epigram' in the TOC but I want some text like; 'For Joey and Suzy, thanks for all the help' to appear on the page as the 'target' for the 'Epigram' entry in the TOC.

Hope that is clear ! Thanks for any help, much appreciated.

Have tried googling this but difficult to describe in a 'searchy' way.

2 Answers 2

1

Initially, as long as you are not using automatic Heading numbering, or do not need those numbers in the ToC, there are a couple of ways you might be able to do this. One would be to create and maintain the ToC manually (In the References tab of the Ribbon, choose Manual Table from the Table of Contents dropdown. Then you have to manually either type all the texts you need or, for example, use the Cross-reference dialog box to make hyperlinked references to the paragraphs you want, and to make references to the page numbers you want as well.

Personally I suspect that is almost the simplest option if you do not have a lot of headings and the text isn't going to change much.

Otherwise, there are always two parts to the solution:

  • How to include text in the TOC that is not actually in the Heading (i.e. your "Epigram") but still
  • How to exclude the texts that you are trying to substitute (i.e. your "For Joey and Suzy, thanks for all the help")

...and you want "Epigram" in the ToC to have the same page number etc. as the Joey and Suzy paragraph, and (I think) to Hyperlink to the Joey and Suzy paragraph.

You can include text that is hidden in the document using { TC } fields.

You can exclude text either by omitting one of your Heading levels from the ToC, or by using different paragraph styles for the paragraphs whose text you want to substitute.

I'm not going to attempt to deal with the automatic numebring problem here. If you need that, post a comment and I'll try to cover that, but I suspect it will increase the complexity a lot.

There is potentially quite a lot involved - you need to be able to work with field codes, possibly to modify paragraph formatting and create/modify paragraph styles. I can't cover all that ground in this Answer so will focus on the "working with fields" part as it's the most likely to be unfamiliar.

In my view, it's easier to work directly with the field codes than to use the dialog boxes. On Windows Desktop Word, the main things you need to know are the keystrokes for working with fields:

F9 to execute the selected fields and update their results 
Ctrl-F9 to enter a pair of the special field code braces {  }
Shift-F9 to toggle between the selected field's *code* ( e.g. { TOC }) and its results
Alt-F9 like Shift-F9, but for all fields.

You may have a different set-up. In many cases, you can also right-click on a field and use menu options to update a field, toggle code/result or edit.

So let's take your example. Let's say you have a Heading 3 paragraph with the text

For Joey and Suzy, thanks for all the help

but in the ToC you want

Epigram

To include Epigram, create a TC field at the end of the Joey and Suzy paragraph, and we modify the TOC field.

To work with TC fields, you need to make sure that you can see Hidden Text - in the Home tab of the Ribbon, in the Paragraph group, click the Show/Hide icon (the Pilcrow that looks like a paragraph mark) until you can see Paragraph marks and other kinds of mark.

Create the TC field:

  • click immediately after the word "help"
  • click ctrl-F9 to enter a pair of field code braces { }
  • between the braces, type TC "Epigram" \l 3

so you end up with the following field

{ TC "Epigram" \l 3 }

You may notice that as soon as youu type the letter "C", word marks the field as hidden.

The \l 3 tells Word the level of the TC entry.

Now modify the TOC field to include Level 3 TC fields. Select the TOC and toggle its field code. You may see { HYPERLINK } fields, in which case, toggle again until you see the { TOC } field. The standard one looks like this:

{ TOC \o "1-3" \h \z \u }

What you need is to modify your existing code to include \l 3-3, e.g.

{ TOC \o "1-3" \l 3-3 \h \z \u }

Now toggle back and update the TOC. Always choose the Update entire table option when prompted.

You should see a new entry saying Epigram, with the same indentation as your other Heading 3 paragraphs and the correct page number. If your TOC entries are hyperlinked you should be able to click Epigram and Word will follow the hyperlink to the TC field (not quite the same as selecting the Joey and Suzy text but near enough. At this point if you are using automatic heading numbering you will also notice that the Epigram entry isn't numbered.

How do we remove the Joey and Suzy entry? Well, it depends. If you want to substitute all your Heading 3 titles, you could just change the TOC field from

{ TOC \o "1-3" \l 3-3 \h \z \u }

to

{ TOC \o "1-2" \l 3-3 \h \z \u }

If you just want to substitute this one, you could create a paragraph style that looks like Heading 3 but does not have an outline level in its paragraph formatting, apply that to the paragraph, and regenerate your TOC. Again, this may cause problems with automatic numbering.

If you want substitute text for a lot of your Headings, or even all of them, then it would probably be better to create TC fields for every heading and change the TOC field so it only looks for TC fields. You would probably still have 3 levels so perhaps

{ TOC \l 1-3 \h \z }

That means that you would need to duplicate the text of those Headings that do not have substitute text. Personally I suspect it is simpler just to do that by hand, but you can consider using field codes to avoid duplication, e.g. suppose you have a heading 2 level paragraph that says

A Stone for Sharpening

You can change it to this:

{ SET asfs "A Stone for Sharpening" }{ asfs }{ TC "{ asfs}" \l 2 }

Or you could change it to this

A Stone for Sharpening{ TC "" \l 2 }

then click between the "" and use the cross-reference dialog to make a reference to the text of the Heading. Word will create a bookmark that covers "A Stone for Sharpening" and insert a reference to it using a REF field, so you will end up with something like this:

A Stone for Sharpening{ TC "{ REF _Ref122971486 }" \l 2 }

However you do it, you may need to redo some things after making edits to your headings, e.g. you would need to keep the \l level in step with the Heading level manually, you may have to update your TC fields when you change the heading text, and sometimes you might have to redo the cross-reference as some edits might result in the _Ref122971486 bookmark being moved or deleted.

You can find out more about all the options in the TOC field here but here is a short summary:

The \o "1-3" tells Word to get its entries from paragraphs with styles that outline levels 1 to 3. That includes paragraphs with the Heading 1,2,3 styles, but could also include paragraphs with other styles.

The \u tells Word to include paragraphs that have been directly formatted with the same outline levels specied by the \o switch

The \h tells word to hyperlink each entry in the TOC to its target.

The '\z' removes leading space and page numbers when you use Web View.

The \l 1-3 includes material from TC fields which have the option \l 1, \l 2 or \l 3. For some reason the \o option has to have double quotation marks around its range of levels, but for the \l option you can omit them.

You can find out more about the TC field options here

1
  • A lot of information, very detailed instructions (which I applaude), thank you very much - I will give this a go over the weekend - I really appreciate you taking the time to answer.
    – Ramses505
    Commented Dec 29, 2022 at 13:37
1

Use a TC field and do not have the epigram, itself, in a style picked up by the Table of Contents.

i.e. { TC "Epigram" } or { TC "Epigram" \l 4 }.

Insert Tab > Quick Parts > Fields > TC. The following dialog will produce the second field shown above.

screenshot of Insert Field Dialog

To get this to show up in your TOC, you need to use a Custom TOC and add Table Entry fields to the options.

TOC Options dialog

That produced a field like this: { TOC \o "1-3" \f \h \z \u }.

For more things you can do, see Word MVP Suzanne Barnhill's TOC Tips and Tricks. The use of TC fields is covered in the section of that page on TOC Entries that do not appear in the document.

Here is my general page on Complex Documents including Generating a Table of Contents.

Here is my article on the Microsoft site on Dealing With Fields.

1
  • A lot of information, very well illustrated, thank you very much - I will give this a go over the weekend - I appreciate you taking the time to answer.
    – Ramses505
    Commented Dec 29, 2022 at 13:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .