In issue of 52 of InDesign Magazine, Sandee Cohen provides a brilliant and simple solution to a problem that many designers face – how to control widows and orphans on paragraphs (this is separate to page-defined widows/orphans). Download the issue to read about this handy tip.
Her advice is great, but can go one step further. Her solution can be adapted to not just fixing paragraph widows/orphans, but also any situation where a type should not break, such as:
- Dates (e.g. 31 July)
- Names (Mr John Citizen)
- Times (4.00 pm)
The example here is an article about the Adelaide Phenomenon known as “Mad March”. The dates at the end of the article are breaking, and so is an individual’s name. These have been highlighted in Magenta to illustrate what needs to be fixed.
Part of Sandee’s fix, without revealing her magic trick, is to create a unique character style that only has the “no-break” attribute turned on and everything else left off.
The paragraphs in this text have a paragraph style applied that will undergo some GREP style magic. To do this, the paragraph style has to be edited, particularly the GREP styles portion of the dialog box.
Firstly, the dates have to be fixed. Click the “New GREP Style” button and select the “no-break” style that was made earlier, and then in the “To Text” field, type the following:
\d+\s(January|February|March|April|May|June|July|August|September|October|November|December)
This will look for any number followed by one space and followed by any month written in full. Anything that matches this will now have the “no-style” applied. Don’t click OK just yet, but click once in the grey box just underneath the field that was just typed to refresh the page.
Fixed. Now let’s fix the name Mr Paul McDermott. Still in the same window, click the “New GREP Style” button again, again using the “no-break” style, but this time in the “To Text” field, type the following:
(Mr|Mrs|Miss|Ms|Dr|Sir)\s[\l\u]+\s[\l\u]+
This will look for any name that has a title, initial or name, and surname. Yes, this is a basic GREP code and a better one could be written to encompass all sorts of names, but for this demonstration it will do. Click OK.
Voila! All fixed. The advantage with using these GREP style fixes as opposed to using non-breaking spaces or forced line breaks is that if the copy changes for whatever reason, many of the forced breaks don’t have to be removed. Non-breaking spaces are a hassle so if they don’t need to be made, why bother?
This article has focused on two instances where a no-break character style (with some GREP style magic) can keep names and dates together, but there are other uses for this such as times, dollar values… the list is up to you. As usual to see how this was done, feel free to download the sample here.
[…] there was concern that turning GREP styles off would limit the control of “runt lines”. GREP styles had also been used for formatting of particular words, but because no type was […]
Amazing thank you, i have been after this for ages, but i also worked out if you want the year in, have the GERP style like so: \d+\s(January|February|March|April|May|June|July|August|September|October|November|December)+\s(2012|2013|2014|2015)
Obviously you need to update the year as of when. Hopes this helps someone.
I think I can improve on that GREP for dates. after the \s after the month, change the year bit to be (\d{2,4}) given that the date will either be written as YYYY or YY (e.g. 2014, 1972, 13, 14). There will be a follow-up to this story soon to focus more on removing “runt lines” once further information is to hand.
Thank you