Skip to main content
Participant
August 1, 2017
Answered

Nested or GREP style for forcing a line break

  • August 1, 2017
  • 2 replies
  • 2249 views

Hi all,

I've been away from using nested or GREP styles for a long time and a solution is eluding me. I'm working on a very long mobile document with lists of references that link to the related content.

The lists are separated by a semicolon initially as below:

w14 12/15 7-10; w14 8/15 29-30; w14 7/15 8 pars. 4-6; w14 2/15 26-27; w13 7/15 5 par. 8; 13-14 pars. 16-17, endnotes; 20-25; w11 7/15 24, 28; w10 7/15 20-23; w09 4/15 12-13; w08 2/15 23-24; w95 5/15 21-22, 24-26; w94 2/15 19-20 pars. 14-18; kr 11-12 pars. 16-20; 90-91; ia 142 box

I need to format them with a forced line break after each semicolon as below:

w14 12/15 7-10;

w14 8/15 29-30;

w14 7/15 8 pars. 4-6;

w14 2/15 26-27;

w13 7/15 5 par. 8; 13-14 pars. 16-17, endnotes;

20-25; w11 7/15 24, 28;

w10 7/15 20-23; w09 4/15 12-13;

w08 2/15 23-24; w95 5/15 21-22, 24-26;

w94 2/15 19-20 pars. 14-18;

kr 11-12 pars. 16-20; 90-91;

ia 142 box

Any input on how to create this style is greatly appreciated.

Correct answer winterm

You can’t add nor remove any character (including forced line break) using style, be it para, char, grep or nested style, only format.

In your case, plain Find/Change might work. In Text tab:

Find: ;

Change to: ;^n

2 replies

Participant
August 1, 2017

Ok. That explains why I couldn't figure it out.

Thanks for the help.

Steeve Beach
Participating Frequently
November 2, 2021

I can't figure it out. What is the character style? What really brought me here is a search to find a way to keep short Russian prepositions with the next word. The proofreader commented for each to move to the next line:

 

 

currently if I apply a nobreak character style to "в[space]" of course it includes any в also at the end of a word, and will force both words to the next line. As in this example, "миллионов"

 

 

if I try to avoid that with the Find is: [space]в[space] there is a different problem: the nobreak understakeeps the previous word together

 

The search goes on, but if you had a suggestion...? 

 

 

 

Participating Frequently
June 20, 2025

Yes, I'm also looking for something like this and also exactly why I ended up on this feed.

winterm
wintermCorrect answer
Legend
August 1, 2017

You can’t add nor remove any character (including forced line break) using style, be it para, char, grep or nested style, only format.

In your case, plain Find/Change might work. In Text tab:

Find: ;

Change to: ;^n

Obi-wan Kenobi
Legend
August 1, 2017

Just for comment! … and with Grep Styles!

(^/) 

Jongware
Community Expert
Community Expert
August 1, 2017

Yeah, applying No-Break works ... right until one of the lines is too long. The find&change doesn't have that problem.