0

I have a document with many instances where hyphenation would be appropriate. But not a single word is being hyphenated. I have tried:

  • Using \hyphenation to explicitly define the hyphenation.
  • Adding \- (or "-) at positions in the word where it should be hyphenated (source).
  • Switching the document language to English and adding English words to see if that's the problem.

There is no hyphen in the word, the word is not the first word in a paragraph, and I have not imported the hyphenat package.

This is a minimal working example (MWE):

\documentclass[a4paper]{article}
\usepackage[ngerman]{babel}
\raggedright

\begin{document}
Dieser Satz enthält ein sehr langes Wort, das dafür sorgt,
dass es eine Silbentrennung geben müsste.
\end{document}
1
  • 2
    if you say ragged right you disable justification so there is no need to hyphenate any word, you are specifying that it is preferable to carry the whole word to the next line. Commented Mar 14 at 15:04

1 Answer 1

1

The issue lies with the command \raggedright. Any of the commands \centering, \raggedleft, or \raggedright, as well as the environments center, flushleft, or flushright prevent hyphenation (source: ragged2e manual, page 2).

The solution is to use the package ragged2e and replace \raggedright with \RaggedRight (or \centering with \Centering, \begin{flushleft} with \begin{FlushLeft}, etc.)

5
  • 3
    That is exactly what those commands are defined for, so what does for some reason refer to?
    – daleif
    Commented Mar 14 at 15:19
  • 1
    Thank you for the clarification, I have removed that part. To me, the difference between justified text and raggedright is not that there is no hyphenation, but that spaces are not stretched to achieve a perfectly justified text. I see your point as well, though. Commented Mar 14 at 16:07
  • 3
    @vauhochzett actually \raggedright does nothing about hyphenation but tex always applies a slight penalty for breaking a word, but raggedright specifies the right margin space can stretch to arbitrary length with 0 penalty so it will always be chosen in preference. RaggedRight only allows a finite stretch so in that case in some cases hyphenation will be chosen. Commented Mar 14 at 18:52
  • 2
    Plain TeX's \raggedright macro keeps words hyphenation.
    – wipet
    Commented Mar 14 at 19:50
  • Interesting! I did not know that. Thank you for the explanation Commented Mar 15 at 19:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .