Skip to main content
sebdea
Inspiring
September 23, 2026
Answered

Delete Nested style text from TOC

  • September 23, 2026
  • 3 replies
  • 34 views

Hello good people,

I have a project in InDesign. The agency that created the documents worked quite professional. However, I am not impressed the way that created the styles for Headings level 2 to 6. They’ve created a heading style using Nested Styles. The heading continues with the text paragraph. Once I separate the heading from the main text using EM SPACE, the InDesign recognize the text before Em SPACE as being the header. See below. 1.4 Definition of requirements is the heading while the rest of the text is body text.

 

Here is how they defined the style.

 

 

Well, my problem is when I generate the TOC. InDesign brings in the entire paragraph.

So, I have to manually clean the TOC deleting the text between EM SPACE and dots. The dots have a character style named DOTS SPACING. The TOC should look like that.

I tried to do that using FIND/CHANGE tool.

FIND: tilda m (Em SPACE) + \w (any word character)
However, how I set to stop to DOTS SPACING character style?

Is there a way to do this automatically?

Thank you in advance.

Sebastian

 

 

 

 

 

 

Correct answer Eugene Tyson

The problem is that the TOC works from paragraph styles, not nested styles or character styles.

So although “1.4 Definition of Requirements” looks like a separate heading because of the nested style, InDesign still sees the entire line, heading + EM space + body text as one paragraph. The TOC will therefore bring in the entire paragraph.

There isn’t a TOC setting that tells InDesign to stop when the nested style ends or when it reaches the EM space.

You could clean the generated TOC afterwards with GREP. For example, if the body text always begins after an EM space and the page number is separated by a tab, something along the lines of:

~m.+?(?=\t)

could be replaced with nothing. That would remove everything from the EM space up to the TOC tab while leaving the heading and page number intact.

However, you would need to run that again whenever the TOC is regenerated. The cleaner solution would be to have the heading as its own paragraph with its own heading paragraph style, and the following text as a separate body paragraph.

3 replies

Dave Creamer of IDEAS
Community Expert
Community Expert
September 23, 2026

If you want to keep headings the way they are, you can put a non-printing text block either at the top of the page or inline so it flows with the text. Create completely new styles for the inline text frames and put only the heading in those frames. Collect those frames for the TOC. 

Other programs, such as QuarkXPress, can use either paragraph or character styles for the TOC. You may want to start a feature request at https://indesign.uservoice.com/ .

David Creamer: Community Expert (ACI and ACE 1995-2023)
sebdea
sebdeaAuthor
Inspiring
September 23, 2026

Thank you Eugene. It worked.

I am not sure why they decided to set the styles that way considering that each manual has hundreds of pages with images and drawings. They do not save much space setting headings that way. Imagine how difficult was to manually clean the TOC each time they changed something inside a manual and the headings moved.

Thank you very much.

Best regards,

Sebastian

Eugene TysonCommunity ExpertCorrect answer
Community Expert
September 23, 2026

The problem is that the TOC works from paragraph styles, not nested styles or character styles.

So although “1.4 Definition of Requirements” looks like a separate heading because of the nested style, InDesign still sees the entire line, heading + EM space + body text as one paragraph. The TOC will therefore bring in the entire paragraph.

There isn’t a TOC setting that tells InDesign to stop when the nested style ends or when it reaches the EM space.

You could clean the generated TOC afterwards with GREP. For example, if the body text always begins after an EM space and the page number is separated by a tab, something along the lines of:

~m.+?(?=\t)

could be replaced with nothing. That would remove everything from the EM space up to the TOC tab while leaving the heading and page number intact.

However, you would need to run that again whenever the TOC is regenerated. The cleaner solution would be to have the heading as its own paragraph with its own heading paragraph style, and the following text as a separate body paragraph.