Skip to main content
April 22, 2017
Question

GREP: how can I add "Style B" to all the first paragraphs after "Style A"?

  • April 22, 2017
  • 1 reply
  • 559 views

Working in a book, I fail to apply "then next style" to the paragraphs after titles. So now the have the same style as the rest of the normal text, that is, a style named "normal text". Now I need to apply the "text after title" style to all the first paragraphs after the style "title".

In short(er), I need GREP to look behind any next paragraph after "title" style and apply "text after title" style to it.

I've done it before, but I have lost my super powers.

Can you help me?

Thanks!

Seb

This topic has been closed for replies.

1 reply

winterm
Legend
April 22, 2017

In this thread you can find interesting script, fixing paragraph style combinations.

April 22, 2017

Thanks winterm, but I'm sure we don't need scripting for this. The secon part of the post you mention looks like it could ansewr my question, but since I don't fully understand the grep code they are using, I can't adapt it to my needs.

I'll take a deeper look at it anyway.

Thanks again!

winterm
Legend
April 22, 2017

You're welcome.

That script is ready to use, intuitive, and requires no special knowledge. Easy.

If you want more semi-manual control, GREP is the way to go.

Obi-wan gave excellent samples there in that thread, regex he used are pretty simple to understand. He covered your question fully, I believe.

There's a lot of GREP code sheets floating around on the net. Do yourself a favor, download one or two of them.

Also consider a tiny bit outdated but still excellent Jongware's script WhatTheGREP (google for it). It's a tool to explain given GREP expression.