Skip to main content
New Participant
January 12, 2024
Answered

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

  • January 12, 2024
  • 2 replies
  • 1826 views

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. 

 

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!

This topic has been closed for replies.
Correct answer Andrew24943677v30i

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.


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. 

2 replies

rob day
Community Expert
January 12, 2024

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:

 

Inspiring
January 12, 2024

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.

elissafAuthor
New Participant
January 12, 2024

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. 

Willi Adelberger
Community Expert
January 12, 2024

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.