24

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?

Matthias
  • 4,051

4 Answers4

21

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}
Boris
  • 38,129
10

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.

Aditya
  • 62,301
  • 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
  • 5
    @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
7

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.

Werner
  • 603,163
7

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}.

Marco
  • 26,055