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

Help with a GREP Style for Quote Attributions

Community Expert ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

I can't quite get the GREP right for quote attributions for this project and I would love some of your help! 

 

The quotes themselves are set in italics, which is no problem in the paragraph style, but the attribute on the next line starts wtih an em dash, followed by the name in Roman Small Caps. I set up a Character Style "Quote Attribution" with case set to Small Caps. My GREP Style applies that Character Style from the em dash through to the end of the attribution but I must not have the right sequence because ~_\r is not working and I have to separately apply the Character Style to the attribution line.

 

Also: I'm importing these quotes (several dozen) from a Word document and some longer quotes have line breaks already set based on what looks/sounds good and these are made by paragraph returns. I want to keep the line brakes as they are set in Word but replace the return character with a forced line break (or should I use Space Between Paragraphs Using Same Style for this instead?).

 

Finally, some of the quotes mix styles in the attribution, for example, a quote like this (note Word doesn't have Small Caps so all the names are in All Caps, another conversion puzzle) where the reference is the title of a TV show which has to be in italics like this:

 

Whatchu talkin’ ’bout?
—ARNOLD JACKSON, Diff’rent Strokes

 

Or like this, when the name is in Small Caps but the following text should be in Roman:

 

Alea iacta est (The die has been cast).

—JULIUS CAESAR, on leading his army across the Rubicon river.

 

Many thanks in advance for any guidance!

sample-885.jpg

TOPICS
How to , Scripting

Views

330

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 Expert , Jun 23, 2021 Jun 23, 2021

(Off the top of my head)

 

Find what: ^~_.+?(?=,)

Change to: [leave empty]

Find format: [your paragraph style]

Change format: [your character style]

 

The find expression says from an em-dash (~_) at the start of the paragraph (^) one or more characters (.+) up to (?) the first comma without selecting the comma ((?=,))

 

P.

Votes

Translate

Translate
Community Expert ,
Jun 23, 2021 Jun 23, 2021

Copy link to clipboard

Copied

The scope of a Grep style is the paragraph. So you can't use a Grep style to target something in the next (or preceding) paragraph. You'll have to use Grep find/replacements in the document.

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 ,
Jun 23, 2021 Jun 23, 2021

Copy link to clipboard

Copied

So, to apply a Character Style to a Paragraph Style where text starts with an emdash and continues up to the first comma, with GREP find/replace, what formula do I use? Thank you!

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 ,
Jun 23, 2021 Jun 23, 2021

Copy link to clipboard

Copied

(Off the top of my head)

 

Find what: ^~_.+?(?=,)

Change to: [leave empty]

Find format: [your paragraph style]

Change format: [your character style]

 

The find expression says from an em-dash (~_) at the start of the paragraph (^) one or more characters (.+) up to (?) the first comma without selecting the comma ((?=,))

 

P.

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 ,
Jun 23, 2021 Jun 23, 2021

Copy link to clipboard

Copied

LATEST

@Peter Kahrel Works great. Very impressive off the top of your head, Peter! Thanks for writing the expression out for me, too. I have Erica Gamet's terrific GREP Cheat Sheet but it's still hard to figure out on my own sometimes. My sincere appreciation! ~ J

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