# How can I force hyphenation in chapter titles?

I have a (German and English) document, which uses the scrbook class fromt he KOMA package, with long German words in the chapter titles. I would like Latex to hyphenate those words when necessary, but I do not know how to do this.

A minimal example looks like this:

\documentclass{scrbook}
\usepackage[ngerman,english]{babel}
\selectlanguage{ngerman}
\hyphenation{men-schen-rechts-ana-logen}
\selectlanguage{english}
\hyphenation{}
\begin{document}
\selectlanguage{ngerman}
\chapter{Noch viel viel mehr zu menschenrechtsanalogen Dingen}
\chapter{Noch viel viel mehr zu men\-schen\-rechts\-ana\-logen Dingen}
\end{document}


I run it with xelatex hyph.tex and I get a chapter line like this:

and I would like to have the word "menschenrechtsanalogen" to get hyphenated.

-

Redefine \raggedsection (see p. 91--92 of the English version of the KOMA-Script manual). One option is to typeset sectioning titles justified:

\documentclass{scrbook}
\renewcommand*{\raggedsection}{}% default is \raggedright
\usepackage[ngerman]{babel}
\hyphenation{men-schen-rechts-ana-logen}
\usepackage{lipsum}
\begin{document}
\chapter{Noch viel viel mehr zu menschenrechtsanalogen Dingen}

\lipsum[1]
\end{document}


Another option is to use the \RaggedRight command of the ragged2e package (this combines alignment to the left and possibility of hyphenation):

\documentclass{scrbook}
\usepackage{ragged2e}
\renewcommand*{\raggedsection}{\RaggedRight}% default is \raggedright
\usepackage[ngerman]{babel}
\hyphenation{men-schen-rechts-ana-logen}
\usepackage{lipsum}
\begin{document}
\chapter{Noch viel viel mehr zu menschenrechtsanalogen Dingen}

\lipsum[1]
\end{document}


Note that both approaches can be combined with specifying hyphenation points manually (with \-) in the argument of \section. The motivation to do so is that there may be hyphenation points which are acceptable in the running text, but somewhat out of place in sectioning titles.

-
ugh. the section heading lines are unattractively spacy. better just to lower the penalty on hyphenation, rather than wiping out the other desirable features of \raggedsection. (i'm not in a position to look up the details at the moment.) –  barbara beeton Oct 7 '12 at 11:32
@barbarabeeton The ragged2e option should be more attractive. –  lockstep Oct 7 '12 at 11:33