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

GREP style to insert tabs in a ToC??

Guest
Jul 29, 2020 Jul 29, 2020

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
2.3K
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

Deleted User
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.

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

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

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

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

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

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.

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

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. 

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
Guest
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.

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

So glad I found this, it was a lifesaver!

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

Here was a similar solution to a comparable problem:

Table of Contents tab before entry 

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