Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

enter image description here

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

share|improve this question
add comment

1 Answer 1

up vote 7 down vote accepted

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}

enter image description here

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}

enter image description here

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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