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?

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

4 Answers 4

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

2
  • 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
    Commented Nov 23, 2011 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
    Commented Nov 23, 2011 at 17:39
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}.

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.

You must log in to answer this question.

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