New update. A general method to combine the TOCs of two distinct chapters sharing some common section/subsection titles.
Uses package etoc. Each sectioning unit is labeled, then, at any location in the document (either before \end{document}
or before a \chapter
, but not before a \section
) a dummy chapter is created where the user inserts a \dummysection
line with the title of each section from each of the two chapters followed by its two labels (or possibly only one, the other being then an empty pair of braces). The \dummychapter
is followed by a \localtableofcontents \label{toc:combined}
commands, and then the command \CombinedTOC
with arguments {toc:combined}{label of the first chapter}{label of the second chapter}
will print the desired table of contents.
The creation of the \dummysection
lines could also be automatized to some extent.
Output:

Code:
\documentclass{book}% used to have chapters
%\usepackage[linktoc=all,breaklinks]{hyperref} % if latex+dvips
\usepackage[linktoc=all]{hyperref} % for testing compatibility
\usepackage{etoc}
% PREPARATION FOR PRODUCING A COMBINED TOC OF TWO CHAPTERS
\etocsetlevel{dummychapter}{6} % invisible in TOCs until level is modified
\etocsetlevel{dummysection}{6} % invisible in TOCs until level is modified
\etocsetlevel{dummysubsection}{6} % invisible in TOCs until level is modified
\etocsetlevel{dummysubsubsection}{6} % invisible in TOCs until level is modified
\newcommand*{\dummychapter}
% THIS WILL ESCAPE THE AUTOMATIC ADDITION TO THE FILE BOOKMARKS BY HYPERREF
{\etoctoccontentsline{dummychapter}{A dummy chapter}}
% after \dummychapter a
% \localtableofcontents will know that its
% top level is "section" (once the level
% of dummychapter as been set to 0=chapter)
\newcommand*{\dummysection}[3]
{\etoctoccontentsline{dummysection}{#1\ExtraRefs{#2}{#3}}}
\newcommand*{\dummysubsection}[3]
{\etoctoccontentsline{dummysubsection}{#1\ExtraRefs{#2}{#3}}}
\newcommand*{\dummysubsubsection}[3]
{\etoctoccontentsline{dummysubsubsection}{#1\ExtraRefs{#2}{#3}}}
% This will be added to the .toc file, but not seen by the
% main \tableofcontents because the dummy* things will be ignored.
\DeclareRobustCommand\ExtraRefs[2]
{\hfill\rlap
{\makebox[2cm]{\makebox[1.5cm]
{\if\relax#1\relax\else\ref{#1}\leaders\hbox to .1cm{\hss.\hss}
\hfill\pageref{#1}\fi}}%
\makebox[2cm]{\makebox[1.5cm]
{\if\relax#2\relax\else\ref{#2}\leaders\hbox to .1cm{\hss.\hss}
\hfill\pageref{#2}\fi}}}}
% #1: label given to the dummy \localtableofcontents after \dummychapter
% #2: label of first concerned chapter, here the General
% #3: label of second concerned chaper, here the Experimental
\newcommand*{\CombinedTOC}[3]{%
\begingroup
\parindent 0pt
\parfillskip 0pt
\leftskip 0cm
\rightskip 4cm
\etocsetstyle {section}
{}
{\leavevmode\leftskip 0pt\relax }
{\bfseries\etocname\par\smallskip}
{}
\etocsetstyle {subsection}
{}
{\leavevmode\leftskip 15pt\relax }
{\mdseries\etocname\par}
{\addvspace{\medskipamount}}
\etocsetstyle {subsubsection}
{}
{\leavevmode\leftskip 30pt\relax }
{\mdseries\etocname\par}
{}
\etocsetlevel{dummychapter}{0}
\etocsetlevel{dummysection}{1}
\etocsetlevel{dummysubsection}{2}
\etocsetlevel{dummysubsubsection}{3}
\etocruledstyle [1]
{\bfseries Combined Contents of chapters \ref{#2} and \ref{#3}}
\renewcommand{\etocaftertitlehook}{\hfill{}\rlap{\makebox[2cm]{\textbf{Gen.}}%
\makebox[2cm]{\textbf{Exp.}}}\par}
\setcounter{tocdepth}{3}
\tableofcontents \ref {#1}
\setcounter{tocdepth}{1}
\endgroup
}
\begin{document}
\setcounter {secnumdepth}{3}
\setcounter {tocdepth}{1}
\tableofcontents
\CombinedTOC {toc:combined}{chap:G}{chap:E}
\chapter{Introduction}
\cleardoublepage
\chapter{Objective}
\cleardoublepage
\chapter{General Part}\label{chap:G}
\section{A section not in the Experimental part}\label{g:0}
\section{State of the Art}\label{g:1}
\subsection{A}\label{g:1.1}
\clearpage
\subsection{B}\label{g:1.2}
\clearpage
\section{Evaluation of Peracrylate 1}\label{g:2}
\subsection{E}\label{g:2.1}
\clearpage
\subsection{F}\label{g:2.2}
\clearpage
\subsection{G}\label{g:2.3}
\clearpage
\subsection{H}\label{g:2.4}
\clearpage
\subsection{Various Methods: a very long subsection name to see what
happens then with the formatting inside the etoc table of
contents}\label{g:2.5}
% no subsubsections in the General part.
\chapter{Experimental Part}\label{chap:E}
\section{Evaluation of Peracrylate 1}\label{e:1}
\subsection{E}\label{e:1.1}
\clearpage
\subsection{F}\label{e:1.2}
\clearpage
\subsection{G}\label{e:1.3}
\clearpage
\subsection{H}\label{e:1.4}
\clearpage
\subsection{Various Methods: a very long subsection name to see what
happens then with the formatting inside the etoc table of
contents}\label{e:1.5}
% these subsubsections are only here
\subsubsection{Method A}\label{e:1.5.1}
\subsubsection{Method B}\label{e:1.5.2}
\section{An experimental section not in the general part}
\label{e:2}
% COMBINATION OF THE SECTIONS (COMMON TITLES, AND UP TO TWO LABELS)
\dummychapter % This is a dummy chapter which is here to combine all
% sections, subsections and subsections of two other
% chapters
% we set the tocdepth to -3 to avoid a Contents header (here, the
% default style of the document class are a priori used, as we did not
% modify the global toc style; so we have to get rid of the printing of
% the Contents headline)
\setcounter{tocdepth}{-3}
\localtableofcontents \label{toc:combined}
% These dummy sectioning units find their way to the .toc file, but they
% are assigned level 6, thus a priori do not appear either in the main
% TOC nor in any other TOC, unless their levels is re-assigned.
% (re-assignement of levels is a functionality of the etoc package)
\dummysection{A section not in the Experimental part}{g:0}{}
\dummysection{State of the Art}{g:1}{}
\dummysubsection{A}{g:1.1}{}
\dummysubsection{B}{g:1.2}{}
\dummysection{Evaluation of Peracrylate 1}{g:2}{e:1}
\dummysubsection{E}{g:2.1}{e:1.1}
\dummysubsection{F}{g:2.2}{e:1.2}
\dummysubsection{G}{g:2.3}{e:1.3}
\dummysubsection{H}{g:2.4}{e:1.4}
\dummysubsection{Various Methods: a very long subsection name to see what
happens then with the formatting inside the etoc table of
contents}{g:2.5}{e:1.5}
\dummysubsubsection{Method A}{}{e:1.5.1}
\dummysubsubsection{Method B}{}{e:1.5.2}
\dummysection{An experimental section not in the general part}{}{e:2}
\end{document}
Earlier answer:
The difficulty also depends on how much additional mark-up one is ready to add to the source.
The method (simplified in this update: earlier version had a two argument command \Refs
rather than the one argument \ExtraRef
now used) relies on:
the use of \label
's for each concerned sectioning unit,
\ExtraRef {elabel}
which has to be inserted by the user in the section and subsection names from the General
chapter to refer to the corresponding data in the Experimental
chapter. The command \ExtraRef
is initially defined to do nothing.
the use of package etoc to then do the job from the data available in the .toc
file.
Before describing a bit more how etoc
is used, let me point out
that with the same technique something a bit different but more
convenient I think can easily be achieved: the table of contents would be as
usual, except for an extra column on the right. In this column, called
See also:
some of the sectioning units, but not all, would have
extra page or section (subsection, etc...) numbers, for related
material elsewhere in the document.
This extra data would come from the labels the user puts into a suitable version
of \ExtraRef
.
Aspects of the use of etoc
here:
A local table of contents of the chapter General
is declared, it is not printed in that chapter, but right after the main table of contents [and for this \ExtraRef
is re-defined to use \pageref
for the "experimental" label].
The main table of contents is done as in the class default, with \tableofcontents
instructed to only print chapters and sections.
It is then followed by the local table of contents managed by etoc
which will have the dobbled page references.
Some things are only in the Experimental
chapter; so a third table of contents toc:ExtraExperimental
is also declared in the corresponding subsection, and it is inserted right after the already done toc:General
. I opted for a special style for these subsubsections whose numbering is not in continuation of the others, as they in fact only belong to the Experimental chapter, not the General one.
Here is the output:

\documentclass{book}% used to have chapters
% test of hyperref compatibility:
%\usepackage[linktoc=all,breaklinks]{hyperref} % if latex+dvips
\usepackage[linktoc=all]{hyperref}
\usepackage{etoc}
% This is written to the .toc file, but does not do anything until it is
% redefined
\DeclareRobustCommand\ExtraRef[1]{}
\begin{document}
% I used this to suppress the page numbering of the first page; this is because
% in the book class the \chapter command is invoked by the default \tableofcontents,
% and this resets the page style.
% \renewcommand{\etocaftertitlehook}{\thispagestyle{empty}}
\setcounter {secnumdepth}{3}
\setcounter {tocdepth}{1}
\tableofcontents
\begingroup
\parindent 0pt
\parfillskip 0pt
\leftskip 1.5cm
\rightskip 2cm
% redefining \ExtraRef
\DeclareRobustCommand\ExtraRef[1]
{\hfill\rlap
{\makebox[1cm]{\etocpage}%
\makebox[1cm]{\if\relax#1\relax\else\pageref{#1}\fi}}}
\etocsetstyle {section}
{\hfill{}\rlap{\makebox[1cm]{\textbf{Gen.}}%
\makebox[1cm]{\textbf{Exp.}}}\par}
{\leavevmode}
{\bfseries\llap{\makebox[1.5cm][l]{\etocnumber}}\etocname
\par
\smallskip}
{}
\etocsetstyle {subsection}
{}
{\leavevmode}
{\mdseries\llap{\makebox[1.5cm][l]{\etocnumber}}\etocname
\par}
{\addvspace{\medskipamount}}
\etocsetstyle {subsubsection}
{}
{\leavevmode}
{\mdseries \hspace{.5cm}\etocname\ (\etocnumber)
\hfill{}\rlap{\hspace{1cm}\makebox[1cm]{\etocpage}}\par}
{}
\setcounter {tocdepth}{3}
\etocsettocstyle {\vspace{1cm}\hrule\bigskip}{}
\tableofcontents \ref {toc:General}
\etocsettocstyle {\addvspace{-\medskipamount}}{}
\tableofcontents \ref {toc:ExtraExperimental}
\endgroup
\chapter{Introduction}
\cleardoublepage
\chapter{Objective}
\cleardoublepage
\chapter{General Part}
% This will not print anything but just prepares the local table of
% contents for this part, which is actually displayed earlier.
\setcounter{tocdepth}{-3}
\localtableofcontents \label {toc:General}
\setcounter{tocdepth}{3}
\section{State of the Art\ExtraRef{}}\label{g:1}
\subsection{A\ExtraRef{}}\label{g:1.1}
\clearpage
\subsection{B\ExtraRef{}}\label{g:1.2}
\clearpage
\section{Evaluation of Peracrylate 1\ExtraRef{e:1}}\label{g:2}
\subsection{E\ExtraRef{e:1.1}}\label{g:2.1}
\clearpage
\subsection{F\ExtraRef{e:1.2}}\label{g:2.2}
\clearpage
\subsection{G\ExtraRef{e:1.3}}\label{g:2.3}
\clearpage
\subsection{H\ExtraRef{e:1.4}}\label{g:2.4}
\clearpage
\subsection{Various Methods: a very long subsection name to see what happens
then with the
formatting inside the etoc table of contents\ExtraRef{e:1.5}}\label{g:2.5}
\chapter{Experimental Part}
\section{Evaluation of Peracrylate 1}\label{e:1}
\subsection{E}\label{e:1.1}
\clearpage
\subsection{F}\label{e:1.2}
\clearpage
\subsection{G}\label{e:1.3}
\clearpage
\subsection{H}\label{e:1.4}
\clearpage
\subsection{Various Methods: a very long subsection name to see what happens
then with the
formatting inside the etoc table of contents}\label{e:1.5}
\setcounter{tocdepth}{-3}
\localtableofcontents \label {toc:ExtraExperimental}
\setcounter{tocdepth}{3}
\subsubsection{Method A}%\label{e:1.5.1} (label not used)
\subsubsection{Method B}%\label{e:1.5.2} (label not used)
\end{document}