Skip to main content
Participant
December 9, 2021
Answered

Adding a Prefix to a Paragraph style, that will only appear in Table of Contents

  • December 9, 2021
  • 3 replies
  • 1293 views

Hi guys,

I have created a paragraph style for a title in my document, and have created a Table of Contents that works with it. What I would like is for a prefix to appear before any text using the paragraph style, but only to appear in the Table of Contents, e.g.

 

In the TOCs, the text currently shows the word 'Yellow'.

I would like it to show 'Sector Yellow' in the TOCs, but I do not want the word 'Sector' to appear anywhere else in the document.

 

I can't see an option to do this in the TOCs panel, and am not sure how or where to apply code to make this work.

Many thanks in advance and apologies if my explanation is not clear.

This topic has been closed for replies.
Correct answer jctremblay

Or even easier... in your paragraph style for the TOC, use a numbered list BUT only with the word Sector with no level number code.

3 replies

Diane Burns
Inspiring
December 9, 2021

One thing that comes to mind is to use Find/Change after you flow the TOC. If it's literally always the word "Yellow" that can be changed to "Sector Yellow." If it's more complicated, a GREP query might need to be created. I've had many a TOC where I've had to run Find/Change on it and since queries can be saved and re-used, it's relatively painless.

jctremblay
Community Expert
jctremblayCommunity ExpertCorrect answer
Community Expert
December 9, 2021

Or even easier... in your paragraph style for the TOC, use a numbered list BUT only with the word Sector with no level number code.

Participant
December 9, 2021

This worked a treat Jean-Claude. Thank you so much, and to all who replied!

jctremblay
Community Expert
Community Expert
December 9, 2021

In your document, make sure the word Sector is in at the begining of your paragraph, but with a GREP style that make it invisible (0.1pt, 1% Horz. Scale and None color).
Use this for GREP Style code

^Sector\h

In your TOC use a style without teh GREP style...