On a publication that I work on I run into a problem where hyphenated words are hyphenated again at the end of a line. (Here's an example: self-sufficent would end up self-suffi-cent) Is there a way to change the hyphenation settings so that this will not happen?
3 Answers
You need discretionary hyphens. If you want to make sure that word is always hyphenated at that point, then you can create a custom dictionary list.
Just to clarify, discretionary hyphens are normally used to insert a "discretionary" hyphen—i.e. one that is only rendered when InDesign's paragraph composer decides to hyphenate the word. However, the discretionary hyphen also forces InDesign to only hyphenate the word at that point.
So if you type "self-sufficient" and then insert a discretionary hyphen after the "-" then that forces InDesign to hyphenate only between the "self-" and "sufficient" and nowhere else, effectively preventing the double-hyphenation of a hyphenated word.
This is slightly tricky. If you're dealing with specific words and need to prevent this kind of double-hyphenation, then a custom dictionary approach as Lèse refers to will do the trick. This won't work for the more general case where you want to prevent any hyphenated word from being again hyphenated by InDesign.
Normally, I do this kind of tweak during the final typographic "fine tuning" pass through a document, after the author has signed (in blood, on the grave of his grandmother) a solemn vow that all editorial changes are complete. During this pass, I'm handling widows, orphans, any kind of awkward line breaks, rivers, and so on. For unseemly hyphenation, the straightforward handling is to highlight what you don't want to break and select "No Break" from the Character Panel flyout. For extra credit, and always preferably, set up a "No Break" character style ahead of time, and apply that to the offending word.
If you've an urge toward typographic tyranny, you can set up GREP styles in your Body Copy paragraph style to ensure that no hyphenated word ever breaks, other than at its hard hyphen. This is tricky, because you can't just grep for hyphenated words and assign "No Break", because then they won't break at the hyphen either. There is another way to prevent a word from hyphenating, though. Read on... :)
Your first GREP style assigns the "No Break" character style to the second part of all hyphenated words. The expression -[\l\u]+
looks for one or more uppercase or lowercase letters following a hyphen.
Your second GREP style is the one that separates the propeller-heads from regular, sensible people with better things to do than think up weird tricks in InDesign. It assigns a "No Language" character style to the first part of all hyphenated words, using [\l\u]+-
. This works because InDesign bases all of its hyphenation upon entries in its dictionaries. "No Language" has no dictionary, so it also has no hyphenation.
Here's the before:
and the after (the two character styles are indicated by cyan and magenta text):
-
"more general case where you want to prevent any hyphenated word from being again hyphenated by InDesign": couldn't you just search for all hyphens and replace with hyphen-discretionary hyphen?– e100Commented Feb 10, 2012 at 10:16
-
1
-
1
-
@e100 Discretionary hyphens, like [insert favorite superhero], appear only in time of need, at a line break, but otherwise masquerade as mild-mannered side bearings. That's a problem if you need to say "mild-mannered" in the middle of a line. :) Commented Feb 10, 2012 at 19:06
-
Genius! I don't understand why this doesn't have 1,000 upvotes. One question though: I could only get this to work by applying the 'No language' to both the first and second segments. Even if I set the 'No language' style to inherit 'no break' and explicitly turn 'no break' off, the hyphen always came out as 'Mixed' character style (being subject to both rules) and it refused to break at the hyphen. 'No language' on both works great, however. Any idea what I might be doing wrong? Commented Mar 7, 2013 at 1:40
I was able to make a hyphenated word break only at the hyphen, without using a discretionary hyphen, using 2 GREP styles in the Body Copy paragraph style. I simply expanded on the GREP code that Alan Gilbertson originally posted.
Both GREP styles use the No Language character style.
The first GREP style is (?<=-)[\l\u]+
which will apply the No Language character style to the word after the hyphen, without including the hyphen.
The second GREP style is [\l\u]+(?=-)
which will apply the No Language character style to the word before the hyphen without including the hyphen.