[Tex/LaTex] Table of contents (minitoc, parttoc) and line breaks

horizontal alignmentline-breakingminitoctable of contents

I have to make a table of contents for each part of a book document.
I use minitoc package, and \parttoc command.

I have line breaks (\\) in the chapters and sections titles in both [] and {} options, otherwise they look ugly.

In minitoc package, it is said that linebreaks in titles may cause the problem. The problem for my file is that LaTeX spreads the text in the title lines before \\ until the end of the line.
(No problems in \tableofcontents though, but I need a table of contents for each part separately).

How can I fix it?

In the package description, they suggest to use \protect\linebreak, but where should I place it? I tried several variants, none has worked.

Here is the example:

\documentclass{book}

\usepackage{minitoc}

\begin{document}

\doparttoc

\tableofcontents

\part{First Part}

\parttoc

\chapter[Chapter1 Chapter1 Chapter1 Chapter1\\Chapter1 Chapter1]{Chapter1 Chapter1 Chapter1 Chapter1\\Chapter1 Chapter1}

\section{Section1}

\chapter[Chapter2 Chapter2 Chapter2 Chapter2\\Chapter2 Chapter2]{Chapter2 Chapter2 Chapter2 Chapter2\\Chapter2 Chapter2}

\section{Section2}

\chapter[Chapter3 Chapter3 Chapter3 Chapter3\\Chapter3 Chapter3]{Chapter3 Chapter3 Chapter3 Chapter3\\Chapter3 Chapter3}

\section{Section3}

\subsection{Subsections3}

\part{Second Part}

\end{document}

Please see page 1 and 5 of the generated document for ToC and MiniToC. I need the same alignment for MiniToC as for ToC (in the names of chapters).

Best Answer

Replace \\ with \protect\newline (and a space) in the optional arguments of your \chapter commands.

\documentclass{book}

\usepackage{minitoc}

\begin{document}

\doparttoc

\tableofcontents

\part{First Part}

\parttoc

\chapter[Chapter1 Chapter1 Chapter1 Chapter1\protect\newline Chapter1 Chapter1]{Chapter1 Chapter1 Chapter1 Chapter1\\Chapter1 Chapter1}

\section{Section1}

\chapter[Chapter2 Chapter2 Chapter2 Chapter2\protect\newline Chapter2 Chapter2]{Chapter2 Chapter2 Chapter2 Chapter2\\Chapter2 Chapter2}

\section{Section2}

\chapter[Chapter3 Chapter3 Chapter3 Chapter3\protect\newline Chapter3 Chapter3]{Chapter3 Chapter3 Chapter3 Chapter3\\Chapter3 Chapter3}

\section{Section3}

\subsection{Subsections3}

\part{Second Part}

\end{document}