# Insert a line break into a TOC item without breaking the line in the chapter title [duplicate]

I have a chapter title that is too long to fit onto one line in the table of contents, but LaTeX does keep it in one line, producing an overfull line in the TOC. How can I insert a line break into this title so that to break it only in the TOC, not when it appears as a chapter heading?

I tried \protect\linebreak[1], but it did the opposite: it broke the line in the chapter heading but not in the TOC.

Here is a simplified version of my source (not quite a minimal example though):

\documentclass[a4paper,12pt]{scrbook}

\usepackage[utf8]{inputenc}  % UTF-8 input encoding
\usepackage[T1]{fontenc}     % for hyphenation to work with
%   accented letters, etc.
\usepackage{lmodern}         % modern latin font

\usepackage[french]{babel}   % language support

\usepackage[hmargin=3.5cm,vmargin=3.5cm]{geometry}

\usepackage{tocstyle}

\usetocstyle{KOMAlike} % defined in tocstyle package

\renewcommand{\thechapter}{\Roman{chapter}}

\begin{document}

\frontmatter

\tableofcontents

\mainmatter

\chapter{Un chapitre}

\chapter{Deux chapitre}

\chapter{Systèmes d'équations différentielles
linéaires à coefficients \protect\linebreak[1]constants}

\section{Généralités}

\section{Résolution d'un système d'ordre $1$
par diagonalisation ou par triangularisation}

\end{document}


## marked as duplicate by barbara beeton, Przemysław Scherwentke, Zarko, Andrew, user13907 Sep 8 '16 at 21:56

• i don't use the koma classes, so i don't know if this will work. an alternative form of a title or heading is often provided as an option: \chapter[optional form](form in chapter}. the \linebreak could then be put only in the optional form. this, of course, will also mess up running heads, but they can be fixed with \markboth{left page}{right page}. – barbara beeton Sep 8 '16 at 15:13
• That works, thanks! I forgot about alternative chapter titles. – Alexey Sep 8 '16 at 15:21
• potential duplicate: Avoid hyphenation in chapter title – barbara beeton Sep 8 '16 at 15:24
• Possible duplicate: How can I force a line break in the Table of Contents? – Werner Sep 8 '16 at 15:38
• @Werner, yes, indeed. I'll probably delete my question. – Alexey Sep 8 '16 at 15:43

an alternative form of a title or heading is often provided as an option:

\chapter[optional form](form in chapter}


the \linebreak could then be put only in the optional form.

this, of course, will also mess up running heads, but they can be fixed with

\markboth{left page}{right page}


this question addresses the opposite requirement -- break in the chapter title, but none in the toc: Avoid hyphenation in chapter title

• I will wait to see if there will be any more answers. Ideally i would like to not to have to type the same title twice, but only to configure line breaking. – Alexey Sep 8 '16 at 15:31
• the ams document classes offer an alternative mechanism. it's described in the ams author faq, at ams.org/faq?faq_id=238 -- look for the entry that is surrounded by a red box. i don't know whether it would work with a koma class, but may be worth a try. if if does work, let me know, and i will add the relevant details to this answer. – barbara beeton Sep 8 '16 at 15:40
• \for and \except do not work for me with scrbook. – Alexey Sep 8 '16 at 17:44