Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

duplicate entries in table of contents

New Here ,
Aug 09, 2023 Aug 09, 2023

Hello Everyone,

I'm trying to find a way to remove duplicate entries i my TOC using GREP,

if Enybody could help me plese finding a proper code for that?

My TOC looks like that:

JacekJakubowski_0-1691576321199.png

thank's for help!

TOPICS
How to
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Aug 09, 2023 Aug 09, 2023

Basing on your sample:

 

Simplistically:

 

(^.+)(~y\d+)\r\K(\1(?2)$\r?)+

 

Capture d’écran 2023-08-09 à 13.57.38.png

 

(^/)  The Jedi

Translate
LEGEND ,
Aug 09, 2023 Aug 09, 2023

Is it a mockup or a real thing? 

 

TOC is supposed to show all entries. 

 

Or your goal is Index - where each brand is mentioned / referenced?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2023 Aug 09, 2023

It's a test file on which I'm trying to find a solution.

So I think, I need a GREP code to delete the second and after "first brand" words with the page number, and the same with the "second brand" entries which TOC collects from the headers on every page.

Is there any solution to do it?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 09, 2023 Aug 09, 2023

Then just create new ParaStyle and use it once, at the beginning of the "chapter" - and use it just for TOC. 

You can even put it on the pasteboard - but the TextFrame needs to touch the edge of the page. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2023 Aug 09, 2023

I've got the Paragraph Style for TOC, the problem is I dont't want to delete or use the title once, it suppose to be on every page, thats why im trying to find the solution to remove the double entries after the first in the index, the entry should be mentioned only once, the first page on which it's apears.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 09, 2023 Aug 09, 2023

As @John Mensinger said - you need two different ParaStyles - one for TOC entries - that you'll use ONCE per chapter, at the beginning, and then the second for your "normal" headers. 

 

Kind of two level Heading - 1st level is at the beginning of the chapter - then 2nd level on every page.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2023 Aug 09, 2023

You're thinking in the wrong direction, and editing your TOC after the fact, using GREP or any other approach, defeats the purpose of automating the TOC in the first place.

 

The TOC function is picking up your main header paragraph style. If you apply that style to a second instance of the same header, and the TOC finds them both, it's just working as designed. The solution is to apply your styles differently to prevent the duplication. Make a copy of your main header paragraph style and give it a different name, like "duplicate header" then apply it to the header instance(s) you don't want included in the TOC.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2023 Aug 09, 2023

in order to do it quite quickly, im duplicating the pages (about 300 in fact), so the header is the same, on which i'd duplicated (my example - 8 times 'first brand' - means 8 pages with it, and 6 times 'second brand' - 6 pages). I dont't want to change the paragharh style selectively, because it will take much more time, working on a such multi-page document, to add it to the duplicated text fields. So I was thinking of deleting it using script.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2023 Aug 09, 2023
quote

I dont't want to change the paragharh style selectively, because it will take much more time, working on a such multi-page document, to add it to the duplicated text fields.

 

Okay, so don't apply it to the duplicated headers, apply it to just the first instance, then change your TOC setup to target the first-instance style.

 

Again, the TOC function is automatic, and can be updated in a single click when needed. Creating a need to edit it by any means after the fact negates the feature. Doing it correctly up-front would only take a little more time; less than you're wasting looking for the wrong solution.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 09, 2023 Aug 09, 2023

Do you have a database for your catalog? Because you could at least use DataMerge. 

 

But even if you do it "manually" - AFTER you create your catalog - you just need to go to the first page of each chapter - and add one extra TextFrame - with the contents of your TOC. 

 

Or, as you've said - you are duplicating pages - then, when starting new chapter - duplicate first two pages from the previous chapter, then duplicate only 2nd page for next pages - 1st page of the chapter will always remain the same. 

You could even use dedicated Master Page / Spread for this to speed up your work. 

 

With 300 pages you won't be creating it from scratch every day so it's not much of extra work... 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 09, 2023 Aug 09, 2023

Basing on your sample:

 

Simplistically:

 

(^.+)(~y\d+)\r\K(\1(?2)$\r?)+

 

Capture d’écran 2023-08-09 à 13.57.38.png

 

(^/)  The Jedi

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2023 Aug 09, 2023

Thanks Robert! that's what I was looking for! works fine! DZIEKI!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2023 Aug 09, 2023
LATEST

Thanks FRIdNGE! that's what I was looking for! works fine!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines