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

Override GREP paragraph style with superscript

New Here ,
Jan 24, 2020 Jan 24, 2020

I'm facing a GREP problem and need some help. I'm creating a Bible devotional and have a GREP paragraph style set up that superscripts the Bible verses. The problem is, each paragraph starts with the reference, which I don't want superscripted. I've been able to do the following using the formula 

\s\d+(?!\:|\,)

GREP_example_1.jpg

(The reason I'm using a : or , is it will be translated into multiple languages)

My problem arises when sometimes the reference has multiple verses, in which case the second reference is superscripted:

GREP_example_2.jpg

My question is, is there a way to ignore a GREP style? Ideally, I would have an en space after the reference and start my style after that. I've also tried using a nested character style, but the character style doesn't override the GREP style.

Thanks!

TOPICS
How to , Type
1.9K
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

Enthusiast , Jan 24, 2020 Jan 24, 2020

The following should work using your current GREP style.

1. Create a second GREP style for your run-in head: ^.+?\d\s(?=\u).

2. In the character style for the run-in head, set Basic Character Formats > Position: Normal.

3. Make sure that the new GREP comes after the GREP style for the verse number in the GREP Style pane.

Screenshot 2020-01-24 14.30.21.png

Translate
Enthusiast ,
Jan 24, 2020 Jan 24, 2020

Based on your example, where the verse number always follows a space and directly precedes an uppercase letter, would \s\d+(?=\u) not work in place of your current expression?

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 ,
Jan 24, 2020 Jan 24, 2020

Thanks David. That's not always the case—especially with different versions and languages.

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
Enthusiast ,
Jan 24, 2020 Jan 24, 2020

If hyphenation and spellchecking is important, you may want to consider a paragraph style for each language with the correct Language settings. You could customize your GREP code for each style where different patterns occur.

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
Enthusiast ,
Jan 24, 2020 Jan 24, 2020

The following should work using your current GREP style.

1. Create a second GREP style for your run-in head: ^.+?\d\s(?=\u).

2. In the character style for the run-in head, set Basic Character Formats > Position: Normal.

3. Make sure that the new GREP comes after the GREP style for the verse number in the GREP Style pane.

Screenshot 2020-01-24 14.30.21.png

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 ,
Jan 24, 2020 Jan 24, 2020
LATEST

Fantastic! That did exactly what I needed. Thanks so much.

And, I can simplify the entire superscript to \d+, which is an added bonus.

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 ,
Jan 24, 2020 Jan 24, 2020

Unfortunately, I won't be doing the layout on the other languages—we send out the files to local workers, some of whom have very little knowledge of InDesign. I guess another way of asking my question is, is there a way to apply a GREP style in a way similar to a nested style, where it only occurs after a specific character (like an en space). 

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