# Suppressing hyphenation of words that already contain a hyphen

According to the accepted answer of this question TeX never hyphenates words that already contain a hyphen. Nevertheless in a document here I find that the word “Modula-2” is hyphenated, as the following image shows (generated with this file using XeLaTeX, version 3.1415926-2.4-0.9998 (MiKTeX 2.9 64-bit)).

\documentclass[10pt]{article}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum Modula-2
nisi urna, congue sed congue id, iaculis et lacus.
\end{document}


Apparently I can’t use \hyphenation to prevent this; but the word appears several times so I don’t want to use \mbox either. Is there a better solution?

-
TeX never hyphenates words that are explicitly hyphenated, so if that instance is hyphenated presumably the markup used is hiding the hyphen. Please always provide a small complete document that demonstrates the problem, so people can reproduce it. –  David Carlisle Nov 12 '12 at 13:14
I just added a screenshot and its source file. –  JC Chu Nov 12 '12 at 13:49

By not hyphenating hyphenated words, what is meant is not adding more hyphens. What you want to prevent is line breaking at an existing hyphen for which you just need

   \exhyphenpenalty=10000


in the preamble to give an infinite penalty for breaking at an explicit hyphen

-

Davids answer shows you how to suppress breaking after an explicit hyphen globally (i.e., for every word with an explicit hyphen).

Often one wishes to suppress the breaking only in specific cases, and there are two approaches for this:

\mbox{Modula-2}


works without any package.

ngerman.sty or the ngerman option for the babel package contain a nifty shorthand for the unbreakable hyphen:

Modula"~2


where "~ is defined as

\leavevmode\hbox{-}

-