8

In my document some of long words are not automatically broken at the end of the line. Is there a way to fix that?

  • 1
    could you be more precise as to what exactly the problem looks like? Maybe post a minimal working example so we can see what you're doing? – Nils L Jun 8 '13 at 9:09
  • 2
    Let me guess: Are some of these very long words hyphenated? TeX won't insert further hyphens into words that are already hyphenated. Please edit your posting to provide some examples of problem words. – Mico Jun 8 '13 at 10:57
9

Make sure you have the correct language specified with eg \usepackage[german]{babel} then if there are still some words TeX does not know how to hyphenate you can add hyphenation rules in the preamble such as

\hyphenation{ve-ry-lon-g-w-ord  ev-en-long-er-com-pound-word-with-no-spaces}

and then if either of verylongword or evenlongercompoundwordwithnospaces appears in the document it may be hyphenated at the indicated places.

  • The hyphenation exceptions should be declared after \begin{document} or, in the preamble, between \begin{hyphenrules}{<language>} and \end{hyphenrules}. With babel 3.9 there are better facilities. – egreg Jun 8 '13 at 16:59
  • Non of the above suggestions worked for me =( – abdu Jun 8 '13 at 17:11
  • Ok I discovered that I also have to add \selectlanguage{ngerman} after \begin{document} and it works. But when using a german vowel like ä or ü in the hyphenation, it doesn't work. – abdu Jun 8 '13 at 17:41
  • 1
    If German umlauts prevent hyphenation then check and ensure that you use the correct font encoding and optionally also an input encoding that allows you to input German umlauts as a single character. E.g. \usepackage[TS1,T1]{fontenc} and \usepackage[utf8]{inputenc}. Without an explicit font encoding the traditional OT1 encoding is used. With this encoding German umlauts are printed as compound characters and those prevent hyphenation. – nagmat84 Sep 20 '17 at 7:41

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.