GREP — Moving "one-letter" words to next line

Learn / Forums / General InDesign Topics / GREP — Moving "one-letter" words to next line

Viewing 3 reply threads
  • Author
    Posts
    • #61678

      Using GREP in InDesign, any suggestions on how to force a “one-letter word”
      at the end of a line, in a column of text (paragraph), and move the word to the beginning of the next line?

      Here is an example of what I am speaking about:

      Before:
      The little piggy and I
      went to the market.¶

      After:
      The little piggy and
      I went to the market.¶

      Thank you.

    • #61682

      Manually:

      Search for this GREP string

      b[ul] ww

      and specify “No Break” in the Replace With Formatting (you don't need to put anything in the Replace With Text field).

      Maybe better:

      1. Create a new character style called “No Break”, and only switch on the No Break attribute.

      2. Add this GREP style to the paragraph style you are using for the little piggy text:

      b[ul] ww

      3. Set the character style to apply to your “No Break” style.

      .. and from hence on all single letter words will always be kept with the next one, totally fully 100% automatic!

      The GREP works like this: b is the word delimiter — before the next code there should not be another letter. [ul] is a set, consisting of all Uppercase and all Lowercase letters. Any single one of these will be matched. Then there is a space, which will match a regular space only. Next, there should follow a word consisting of at least two more characters — w stands for 'any word character at all', and repeating it tells ID to use two in a row.

    • #61694

      Hello Jongware

      Excellent solution!

      I wish it was my birthday, so I could claim this “prize” for myself!
      But alas, your wonderful solution is now for all “word-fanatics” and layout architects everywhere!

      Thank you.

    • #61706

      Someone's got to say it: be careful about doing this globally, as there could be occasions when you want a single letter word to remain on the first line.

      Arguably in your example, “piggy and I” belong together as the subject of the verb, and the text would read better that way.

      For another example, “King Henry V” might be better not to be split over two lines (could be achieved with a non-breaking space).

      Other languages might yield some exceptions. Russian and Polish certainly have single-letter prepositions, which obviously work better at the start of a line than at the end. In Italian, a, e, i, o, è are all single letter words (to, and, the, or, is). Tried to find a resource with general multi-lingual guidance, but no such luck.

      And just to confuse things further, Hart's Rules for Compositors and Readers (Oxford University Press, 1967) has plenty of instances of single letter words at the ends of lines, and has no “rules” to cover this eventuality.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
>