Copy link to clipboard
Copied
Hi all
Really hoping someone knows this.
I have 3 long from books to format.
The author use in-chapter breaks styled as a star / asterix glyph (*).
The paragraph following that glyph needs to be an untabbed paragraph (for which I have a style setup).
I have limited experience of GREP / am still learning.
So: how do I find the star * glyph (which is a paragraph by itself) and then target the following paragraph only to apply the untabbed style to?
There over 600 instances of this, so any help appreciated!
M
If Para with the asterisk should be removed:
Find: (\*\r)(.)
Change to: $2
If should be left:
Find: (?<=\*\r).
Change to: [leave blank]
In both cases in Change Format: field define your desired Para Style.
Copy link to clipboard
Copied
Hi,
If I understand well: you have an "*" and the para end and you want to style the para below?
Right?
What do you do with this "*" after styling?
[Could you make a screenshot of a page with invisible chars?]
(^/)
Copy link to clipboard
Copied
If Para with the asterisk should be removed:
Find: (\*\r)(.)
Change to: $2
If should be left:
Find: (?<=\*\r).
Change to: [leave blank]
In both cases in Change Format: field define your desired Para Style.
Copy link to clipboard
Copied
winterm- Won't the second option also get rid of the first character? Change to should be: $0 to keep it.
Copy link to clipboard
Copied
Thx Winterm
Your second option - with a little tweak - worked a treat!
M
Copy link to clipboard
Copied
The Patina wrote:
Thx Winterm
Your second option - with a little tweak - worked a treat!
M
What was the little tweak?
Regards,
Uwe
Copy link to clipboard
Copied
Hi Laubender
Sorry, for being slightly misleading: the 'little tweak' was just the insertion of the correct character in the search ( a star '✴' , not an asterix '*').
Just out of curiosity, can yourself or any other forumites suggest a good resource for GREP learning and knowledge? It looks like I have a lot of book interior formats ahead of me in the next year and getting my head completely around this would be wonderful!
VBW
M
Copy link to clipboard
Copied
A great place to start is Peter Kahrel's "GREP in InDesign" from O'Reilly. There is also a FB group "Treasures of GREP." We are another friendly group over there!
Copy link to clipboard
Copied
thanks for the information
Copy link to clipboard
Copied
Hi Erica
Many thanks for the info and links.
Very much appreciated!
M
Copy link to clipboard
Copied
Sure thing! I have Peter Kahrel's book on my iPad and reference the glossary in it constantly! Also, the FB group has members from all over the world...I find I can get an answer no matter what time of day (or night it is).
Copy link to clipboard
Copied
@The Patina
You're welcome
@Uwe
Uwe, thank You for GREP tutorial. You're frighteningly perfect, as always
Copy link to clipboard
Copied
winterm wrote:
…Find:
(?<=\*\r).Change to: [leave blank]
Change Format: field define your desired Para Style.
That really should do it.
The expression explained:
(?<=\*\r)
winterm is using a positive lookbehind: (?<=)
After the = in that expression you should insert what characters should be positioned before the thing you want to change.
In your case it is a * followed by a paragraph sign.
Since a * is a special character in GREP you have to tell GREP that you are literally looking for a * and not using the special character.
That is called "escaping" a character and is done like that: \*
The escape sequence for an end of paragraph character is: \r
So the expression:
Find something that is preceded by a star and an end of paragraph character is:
(?<=\*\r)
The something you'd like to find is the text after the star and the end of paragraph character.
Since you want to change the paragraph style of the text behind, it is sufficient to only find a single character in the paragraph.
And that is a simple dot . in GREP.
So the complete expression is:
(?<=\*\r).
And that will find the first character after every star followed by a paragraph sign.
Now for the change.
Leave it blank, because you do not want to change the found character but its formatting.
A screenshot from my old InDesign CS4 is showing a before and after scenario:
"Absatzformat" is "Paragraph style" in German…
So I think, you can give winterm's anwer the "Correct Answer" here.
Here some help pages:
Find/Change
Metacharacters for searching:
Regards,
Uwe
Copy link to clipboard
Copied
Hi all
I should've attached a screenshot!
Here's the 'offending' example with 'show invisibles' switched on:
As described earlier: asterix is on one para. The next / following para is the one I need to target and apply an untabbed style to.
If there's a way of targeting both together that would be acceptable, as I could do a secondary search and reformat just the asterix.
But if there's a way of targeting just that second paragraph, that would be awesome.
Many thanks for the continuing help!
M
Copy link to clipboard
Copied
Hi
Did you try Winterm 2nd suggestion? I believe it does what you want...
Copy link to clipboard
Copied
Hi Vinny38
Yes! You're right. Winterm's second suggestion does work brilliantly!
I had to tweak the search term as the asterix is a slightly different glyph but - boom! - yes!
Thanks to everyone for their input and help 🙂
M
Copy link to clipboard
Copied
I do follow your screen snap.
Where do I send it?