How to Disable Hyphenation for a Word
To disable hyphenation for a specific word, there are several possible approaches:
- If the word is a compound (like "T-shirt") and you want to keep it on the same line, you
have two options:
- Manual Approach
- Wrap the word in an inline element with the
@outputclass
attribute set. In the CSS, change its style towhite-space:nowrap;
. For example:.. <ph outputclass="no-hyphenation">T-shirt</ph>...
*[outputclass ~= "no-hyphenation"] { white-space: nowrap; }
- Automatic Approach
- A better alternative to this is to write an XSLT extension that matches the text
nodes and performs automatic markup (to see an example, go to How to Wrap Words in
Markup in the XSLT Extensions for PDF
Transformations section). Then match the
compound-word
class the same as in the previous example:*[outputclass ~= "compound-word"] { white-space: nowrap; }
- Another Alternative
- In all the compound words from your documentation, replace the hyphen ("-") with a
non-breaking hyphen character
U+2011
(or XML notationߛ
).Then change the autocorrect settings to automatically replace the compound word with its equivalent. For example: "T-shirt" would be replaced with "T[\u2011]shirt".
- If the word is not a compound, you have two options:
- Use one of the approaches listed above.
- Alter the hyphenation dictionaries as explained in: How to Alter a Hyphenation Dictionary.