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

How to apply a nested character style using GREP within a paragraph style?

Community Beginner ,
Jan 12, 2024 Jan 12, 2024

Copy link to clipboard

Copied

Hi There! I'm wondering if anyone can help  - I'm trying to use a grep code to format the running foot text for a book I'm working on. The running foot text would have a movie title and year in parentheses, ideally looking like "Psycho (1960)".

 

As of now, I have a paragraph style for the RF text set to italics, and I'm hoping to create a rule so the text within the parentheses could have a character style, keeping them roman. 

 

Screen Shot 2024-01-12 at 2.36.16 PM.png

I've tried a couple different grep codes I found on similar boards, as well as selecting my own rules using drop-down menu options, coming out to:

Apply Style: RF rom (year)

To Text: "\(\d+\)".

 

But nothing seems to make a difference.

I'm wondering if anyone can help, thank you!

TOPICS
How to , Scripting , Type

Views

543

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

Community Beginner , Jan 12, 2024 Jan 12, 2024

Like Willi implies, you will need two Running Headers (Character Style).

If you apply Nested Styles to the movie heading on each page that the variables will draw from (Roman and Italic), you can then then put the two Running Headers in the footer, one set to Style: Roman and one set to Style: Italic. 

Votes

Translate

Translate
Community Beginner ,
Jan 12, 2024 Jan 12, 2024

Copy link to clipboard

Copied

Personally, I would do it without GREP. Assume you have the "RF rom (year) Paragraph Style applied to the text in question.

  1. Create a "Roman" Character Style
  2. Edit "RF rom (year)" Paragraph Style
  • New Nested Style
    • [None] through 1 (
  • New Nested Style
    • Roman up to 1 )

Adjust above 'through or up to' depending on whether you want the parentheses to be Roman or not.

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 Beginner ,
Jan 12, 2024 Jan 12, 2024

Copy link to clipboard

Copied

Thanks for your response! I should clarify, that the paragraph style I'm using is "RF Movie Title + Year" which is all itals, and I'm applying a character style called "RF rom (year)" to romanize the year within & including the parentheses.

 

Maybe it's also helpful to note, that these running feet are set as variable text so they change with each chapter/movie topic within my doc's masterpages. 

 

Here is a screenshot of my applying the nested styles, but still the running feet text isn't displaying that way for some reason. 

 

Screen Shot 2024-01-12 at 3.47.23 PM.png

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 ,
Jan 12, 2024 Jan 12, 2024

Copy link to clipboard

Copied

You get the title with title and Year as a single entity. It comes either from a text variable or something similar. InDesign does not see the paranthesis as they are a part of the text element. Neither nested nor GREP style would help here. If you want to apply a different style to the Year block and the title block, you have to separate them into 2 independent entities.

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 Beginner ,
Jan 12, 2024 Jan 12, 2024

Copy link to clipboard

Copied

Like Willi implies, you will need two Running Headers (Character Style).

If you apply Nested Styles to the movie heading on each page that the variables will draw from (Roman and Italic), you can then then put the two Running Headers in the footer, one set to Style: Roman and one set to Style: Italic. 

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 Beginner ,
Jan 16, 2024 Jan 16, 2024

Copy link to clipboard

Copied

Thank you both, Willi and Andrew - with your help I was able to get my desired result!!

 

For those with a similar issue, the solution was to add two nested character styles to the A Head paragraph style your running feet is pulling from.

  • I added a nested italic character style up to "(" and a nested roman character style through ")".
  • Then I defined two separate Running Feet (Character Style) on my master page, one for ital movie titles and one for roman movie years, and applied my own running feet character styles to them as well, to get my desired result.Screen Shot 2024-01-16 at 11.52.33 AM.pngScreen Shot 2024-01-16 at 11.54.10 AM.png

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 ,
Jul 21, 2024 Jul 21, 2024

Copy link to clipboard

Copied

I came here to figure out why my nested style won't allow me to place a parantheses.Screenshot 2024-07-21 at 12.26.29 PM.png

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 21, 2024 Jul 21, 2024

Copy link to clipboard

Copied

That's a numeric field only. You can only specify characters and other text markers using GREP, not a nested style.


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

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 ,
Jul 21, 2024 Jul 21, 2024

Copy link to clipboard

Copied

I need a grep to apply a character style to the content before the parentheses below?

Lorem ipsum dolor sit (amet navicus). 

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 21, 2024 Jul 21, 2024

Copy link to clipboard

Copied

You can only specify characters and other text markers using GREP, not a nested style

 

That goes for the field before where Laura has 'Characters' in her screenshot. But click 'Characters' and you can select any of the predefined characters in the dropdown or type a character:

PeterKahrel_0-1721595788314.png

 

> I need a grep to apply a character style to the content before the parentheses below?

 

No, you can use a nested style, enter the opening parenthesis as shown in the screenshot, above.

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 21, 2024 Jul 21, 2024

Copy link to clipboard

Copied

LATEST

Ah, oops. 🙂

 

The selections for the end element are a little... terse.

 

 


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

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 ,
Jan 12, 2024 Jan 12, 2024

Copy link to clipboard

Copied

Hi @elissaf , Do you want the parenthesis to also be roman? I think @Andrew24943677v30i ’s example leaves them as italic, so there’s also something like this:

 

Screen Shot 7.pngScreen Shot 8.png

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