6

I need a Grep style in my paragraph styles in InDesign that makes sure that the letter i cannot stand alone at the end of a line, but will always move to the beginning of the next line. I have a client that makes me do it manually.

3
  • 2
    Why only "i"? But anyway. Just instruct to Find: (\d+)( )(i) replace: $1~S$3 But I would suggest to use script or regular ctr+f as it will change in every instance not only the ones with GREPed style. Commented Feb 3, 2017 at 8:47
  • 2
    @SZCZERZOKŁY I do it with a/A as well, and sometimes two-letter words. Itty-bitty words at the end of a line can sometimes look untidy, and I completely understand the impulse to bump them down to the beginning of the next line. Commented Feb 3, 2017 at 10:40
  • 2
    @LaurenIpsum I Use a script called "UseMyTypo". It can add nonbreaking space after given letters or words as well as remove extra ones etc. Commented Feb 3, 2017 at 11:44

3 Answers 3

6
  • Create a character style and set it to "No break".
  • Edit your existing paragraph style, go to the GREP Style tab, choose the character style you created above and type (?<=\s)i\W+ in the "To Text" field. (credits go to @Tobias Kienzler who suggested this)

no break

grep style

14
  • 2
    Although you dont need a separate style for different letters you can use the (i|a|a,) syntax to enumerate many options. But good thing about the images, clarified this quote much (even though i had voted and tested this before you got them posted for me to see).
    – joojaa
    Commented Feb 3, 2017 at 11:12
  • 1
    Correct, the GREP can be improved to deal with multiple issues at the same time.
    – lmlmlm
    Commented Feb 3, 2017 at 11:14
  • 2
    If I understand this right, it could probably also be expanded to handle any single-letter word with something like \s[A-Za-z]\s
    – IMSoP
    Commented Feb 3, 2017 at 11:19
  • 4
    You can also use (?<=\s)i\W+ (or (?<=\s)\w\W+). The lookbehind (?<= makes sure the preceding whitespace remains breakable, otherwise your GREP-style might pull the previous syllable down, too. And \W+ means at least one non-word character, which takes care of punctuation as well. Commented Feb 3, 2017 at 11:50
  • 2
    Hopefully the OP is following these comments and can choose whichever string works best with their document. I am definitely adding this to my own collection of Grep strings. Quite useful comments thanks! :)
    – lmlmlm
    Commented Feb 3, 2017 at 13:15
0

First make a no break character style like in Lucian's asnwer, then try this Grep style in your paragraph style. It worked for me. (?<=[!\?\.]\s)[^\s]{1,3}\s

3
  • What is a 'broken character style'?
    – Vincent
    Commented Aug 23, 2018 at 11:50
  • Sorry, "no break" Commented Aug 23, 2018 at 14:20
  • I took the liberty to clarify that a little. Be aware that because of up/downvotes, answers aren't always displayed in the same order. If you want to know more about the Stack Exchange model and specifically about this site, have a look at the tour and the help center. Oh, and welcome! :D
    – Vincent
    Commented Aug 23, 2018 at 14:32
0

This solution works great: (?<=\s)\w{1,3}\W+ only that it won't work for when more than one 1-3 letter words are next to each other, in that case it will skip every other word. I propose to add a second grep style to account for this (?<=\s)\w{1,3}\W+\w{1,3}\W+ and can keep going to find 3,4,5.. 1-3 letter words together. There is probably a smarter DRY solution to that, but I'm not smart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.