What is the best way to make LaTeX hyphenate the word 9-dimensional. Currently I have a case where it produces an overfull line without hyphenation. Adding \hyphenation{9-di-men-sional} doesn't work because it contains a digit. Using 9- dimensional looks ugly because of the white space.
Asked
Active
Viewed 552 times
3
Emit Taste
- 4,404
2 Answers
9
replace the hyphen with a macro:
\makeatletter
\newcommand{\hyph}{-\penalty\z@\hskip\z@skip }
\makeatother
9\hyph dimensional
this "separates" the 9- from the following word, allowing the normal
hyphenation procedure to be activated.
edit:
if using amsmath, there's another approach: forcibly suppress the break
after the explicit hyphen, but enable ordinary hyphenation to be applied to
the following word:
$n$\nobreakdash-\hspace{0pt)dimensional
this can be abbreviated in a macro as described in the amsmath documentation (texdoc amsmath).
barbara beeton
- 88,848
hyphenat-solution works just fine. Isn't the reason for not breaking the same? Or is the behaviour really different with a number? – Johannes_B Jun 30 '15 at 15:159-leaves extreme spaces in the broken line, hyphenating the word is more attractive. i don't dispute thathyphenatworks, just that it seems like overkill. – barbara beeton Jun 30 '15 at 15:20