GREP String to copy and paste

To fix Runts, copy and paste this string into the ‘To Text:’ field, in the GREP Style section of your paragraph style. Choose your ‘No Break’ Character Style from the ‘Apply Style’ dropdown, and click OK.


What are Widows, Orphans, and Runts, in typography?

The typographic terms ‘Widows’, ‘Orphans’, and ‘Runts’ may sound archaic and mysterious, but they are actually just a shorthand way of referring to common text flow problems that occur in typesetting.

Image of two columns of text, showing a single line breaking to the second column

Widows in typography

The term ‘Widow’ refers to the last line in a paragraph breaking over to the start of a new column or page. Instead of the paragraph ending neatly altogether, there is an awkward line that the reader must go searching for in a different place in order to finish. This interrupts the flow of the text for the reader, and also creates an untidy appearance.

Image of two columns of text, showing a single indented line at the bottom of the first column

Orphans in typography

The term ‘Orphan’ refers to the first line of a new paragraph occurring at the end of a column or page. While it is arguably not as disruptive to the reader to break the flow of text when a paragraph has only begun, rather than right before it ends, it is still an undesired interruption, and orphans also contribute to an untidy appearance.

Image of a single column of text, showing a single word breaking to a new line at the end of a paragraph

Runts in typography

The term ‘Runt’ refers to the last word (or part thereof) breaking to a new line at the end of a paragraph. Runts are often incorrectly referred to as Widows or Orphans. While runts aren’t overly disruptive to the reading experience in a block of type (unless they also occur simultaneously as a widow), they can nevertheless cause the overall appearance of type on the page to look untidy by contributing to white-space problems such as rivers within the text, and can create awkward gaps between the end of a paragraph, and an indented new line, due to insufficient horizontal overlap.

How to fix Widows, Orphans, and Runts when using Adobe InDesign

Widows and Orphans are relatively straightforward to correct using InDesign. The program has inbuilt capabilities to prevent lines from becoming separated at the beginning and end of paragraphs, although you will most likely still need to make manual adjustments on a case-by-case basis. InDesign can, however, do an excellent job of resolving Runts automatically using the program’s GREP Styles function, although this requires just a little bit more initial configuration.

Fixing Widows and Orphans

  1. Double-click the Paragraph Style you need to modify, in the Paragraph Styles panel.
  2. Go to the ‘Keep Options’ section of the Paragraph Styles dialog box.
  3. Check the box next to ‘Keep Lines Together’.
Screenshot of InDesign dialog box

The default setting for this option will force InDesign to keep the first and last two lines together (this can be changed as needed), so it is now technically not possible for widows or orphans to occur. The caveat here is that obviously this will now cause two lines to break across columns and pages, instead of just the single line, which may be less desirable itself and create different problems.

Fixing Runts (using GREP Styles)

  1. Create a new Character Style, and go to the ‘Basic Character Formats’ section of the Character Style Options dialog box.
  2. Check the box for ‘No Break’.
    Screenshot of InDesign dialog box
  3. Click the ‘OK’ button to close the Character Style Options dialog box.
  4. Double-click your Paragraph Style to open it, and go to the ‘GREP Style’ section of the Paragraph Style Options dialog box.
  5. Click the ‘New GREP Style’ button.
  6. Select the new Character Style you just created from the ‘Apply Style’ drop-down list.
  7. Enter this GREP string \<(\s?(\S+)){2}$ (you can copy/paste it) into the ‘To Text’ field.
    Screenshot of InDesign dialog box
  8. Click the ‘OK’ button to save and close the dialog box.

How does this GREP Style work?

GREP is incredibly powerful and useful, but also can appear very overwhelming. It uses what are known as ‘regular expressions’ to look for very specific patterns in text. Regular expressions are typically a confusing arrangement of different characters (such as the one above). Rather than try to cover the exact GREP commands being used (there are plenty of excellent resources online already that cover the specifics), let’s just look at the basic mechanics of how this particular pattern works to fix the problem of Runts.

Firstly, it’s helpful to understand that GREP can search for patterns both forwards, as well as backwards, with the text. So the first thing this pattern does is look for the end of every paragraph, and then it works backwards from there. From the end of the paragraph it searches for any two groups of preceding characters separated by a single space.

Diagram of last two words in sentence with pointers showing word space word end

And that’s it. It’s actually very simple. Every instance of this ‘found pattern’ within the text is then targeted by InDesign using the GREP Style function, to apply a ‘No Break’ rule to the last two words which occur at the end of a paragraph.

Cancelling the GREP Style

If you understand how this GREP Style is applied, then you can also understand how to deal with problems that can occur when using it. If you have narrow columns and some particularly long words at the end of a paragraph, for instance, you may find that having a ‘no break’ rule will cause all of your following paragraphs to inexplicably become overset. In a situation like this, it’s incredibly simple to fix the problem without needing to make any complex style changes — just add a space to the end of the paragraph, and the GREP Style will be cancelled. Remember, it’s looking for the last two words directly before the end of paragraph marker, not the last two words followed by a space.