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 wonder if there is a way to avoid hyphenation of words in the title of a chapter.

I have tried \mbox but that makes the word run over the margin. I've also tried inserting a \\ in front of the word, but while this has the intended result on the chapter title page it has the unwanted side effect that the breakline also appears in the ToC.

Any ideas?

share|improve this question
    
\chapter{\mbox{maybe} \mbox{this} \mbox{would} \mbox{work}?} –  gerrit Nov 21 '11 at 22:19
    
No it won't, I already tried that (see question): it causes margin run-overs. –  Matthias Nov 21 '11 at 22:50
add comment

4 Answers

up vote 10 down vote accepted

If you want to have linebreaks in the chapter title, but not in TOC, use the optional argument for \chapter:

\chapter[The long long long title]{The long long\\ long title}
share|improve this answer
add comment

In ConTeXt, you can use

\setuphead[chapter][align=nothyphenated]

or, slightly better

\setuphead[chapter][align={flushleft, nothyphenated, verytolerant}]

which sets the title to be flushed left, not hyphenated, and the white space between words to be more stretchable.

share|improve this answer
    
Cool, but I can't risk switching to a new typesetting system at this (final) stage of the writing-up of my thesis :-). So I'm sticking with XeTeX. –  Matthias Nov 23 '11 at 16:37
2  
@Matthias: I understand. I gave a ConTeXt solution in case a ConTeXt user has the same question and is searching for a solution. –  Aditya Nov 23 '11 at 17:39
add comment

The hyphenat package provides the command \nohyphens. You can control the hyphenation locally.

If you want to switch off hyphenation globally, use \usepackage[none]{hyphenat}.

share|improve this answer
add comment

Chapter headings are set, by default, using \raggedright. However, this does not avoid hyphenation necessarily. Yet one can patch the respective chapter heading macros to avoid hyphenation via \hyphenpenalty=10000:

enter image description here

\documentclass{report}%
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox

% http://mentalfloss.com/article/50611/12-exceptionally-long-or-extremely-special-words
\hyphenation{sub-der-ma-to-gly-phic}
\setlength{\textwidth}{.5\textwidth}% Just for this example
\begin{document}
\chapter{This subdermatoglyphic title is long}

\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\@makechapterhead}{#1}{\hyphenpenalty=10000 #1}{}{}% Patch \chapter
\patchcmd{\@makeschapterhead}{#1}{\hyphenpenalty=10000 #1}{}{}% Patch \chapter*
\makeatother

\chapter{This subdermatoglyphic title is long}

\end{document}

Note that avoiding hyphenation could cause "Overfull \hbox" warnings, which is exactly the case above. Perhaps it's an extreme case, but still.

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