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

-
Even though you didn't format your "minimal working example" as a code sample, the example itself was outstanding. I wish every "first question asked at tex.sx" would include an example like this one! –  lockstep Oct 11 '11 at 19:39

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}

-
That works! Thank you very much for your help!!!! –  Natalia Oct 12 '11 at 10:26