3

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.

  • I would say that this is a duplicate to Adequate hyphenation of words already containing a hyphen – Johannes_B Jun 30 '15 at 15:02
  • @Johannes_B -- not quite the same. that question/answer doesn't deal with anything that isn't a letter. (i've added an answer that shows what we do for tugboat.) – barbara beeton Jun 30 '15 at 15:07
  • @barbarabeeton The 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:15
  • @Johannes_B -- actually, under most circumstances, i would say that this shouldn't be broken. but there are times, ... what usually happens when this technique is applied is that the number itself isn't broken off, but hyphenation becomes "permissible" somewhere in the following word. if it's a long word, and the break after the 9- leaves extreme spaces in the broken line, hyphenating the word is more attractive. i don't dispute that hyphenat works, just that it seems like overkill. – barbara beeton Jun 30 '15 at 15:20
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).

2

This works: 9-\-di\-men\-sional

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.