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

GREP style to insert tabs in a ToC??

Participant ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

Is is possible to insert tabs using a GREP style? 

I have a ToC text style that has a nested style (italics) through two tabs, then the normal style. 

I want it to look like this when I update the ToC:

Screen Shot 2020-07-29 at 2.36.26 PM.png

The head style it is using to make the ToC has a space and a soft return betwen it and rest of the headline. That's fine, as the soft return gets removed and the third tab with leader dots gets inserted when the TOC generates. What I am wondering is there a GREP STyle I can write to have it insert the first and second tabs automatically? 

TOPICS
How to , Type

Views

1.4K

Translate

Translate

Report

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

Participant , Jul 29, 2020 Jul 29, 2020

I DID IT!! Yay me.

Find: ^\w+(\s)  Beginning of ¶, a word, a space

Change: \t$0\t  A tab, found word, a tab

 

Hooray.

Votes

Translate

Translate
Community Expert ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

GREP Styles can't add text, they can only style it. You would have to run a Find/Change to insert the tabs.

Votes

Translate

Translate

Report

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 ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

Why not let the ToC generator do it? It is something you switch on in the dialog box

Mike Witherell

Votes

Translate

Translate

Report

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 ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

I don't think that's possible. You're asking the TOC command to either insert a tab within the chapter name (e.g. between "One" and "Discovering Your Inner Child") or to number the chapters as a string.

Votes

Translate

Translate

Report

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
Participant ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

Okay, I couldn't do it as a GREP style but I could run a find change afterward. Does anyone know what the strings would be?

I know that beginning of paragraph is ^ So for the first tab it could be:

Find: ^

Change: \t$0 (tab found text)

but I don't know how I'd do the second tab. 

Votes

Translate

Translate

Report

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
Participant ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

I DID IT!! Yay me.

Find: ^\w+(\s)  Beginning of ¶, a word, a space

Change: \t$0\t  A tab, found word, a tab

 

Hooray.

Votes

Translate

Translate

Report

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 ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

LATEST

So glad I found this, it was a lifesaver!

Votes

Translate

Translate

Report

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 ,
Jul 30, 2020 Jul 30, 2020

Copy link to clipboard

Copied

Here was a similar solution to a comparable problem:

Table of Contents tab before entry 

Votes

Translate

Translate

Report

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