0
votes

What I am looking for is the following table of contents structure:

Table of Contents

1 Vorwort

2 Hallo

3 Und so weiter

Document with these Chapters, but at the beginning of each chapter its specific table of contents:

1 Vorwort

----- here subtoc -----

1.1 subtoc

1.2 Test

---- here the beginning of section test ----

1.2 Test

The problem however is, that in these different chapters all subtocs are combined, such as in my example:

\documentclass{scrbook}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{blindtext}% generiert Beispieltext
\usepackage{tocstyle}[2008/10/20]% experimentelles KOMA-Script-Paket
\usetocstyle{standard}

\newcounter{normaltocdepth}
\newcommand*{\startstory}[1]{%
  \newpage\chapter{#1}\addtocontents{toc}{\protect\startstory}%
}
\newcommand*{\afterstory}{%
  \addtocontents{toc}{\protect\afterstory}
}

\newcommand*{\maintoc}{%
  \begingroup
    \setcounter{normaltocdepth}{\value{tocdepth}}%
    \renewcommand*{\startstory}{%
      \setcounter{tocdepth}{1}%
    }%
    \renewcommand*{\afterstory}{%
      \setcounter{tocdepth}{\value{normaltocdepth}}%
    }%
    \tableofcontents
  \endgroup
}

 \newcommand*{\storytoc}{%
   \begingroup
     \setcounter{normaltocdepth}{\value{tocdepth}}%
     \setcounter{tocdepth}{-2}%
     \renewcommand*{\startstory}{%
       \setcounter{tocdepth}{\value{normaltocdepth}}%
     }%
     \renewcommand*{\afterstory}{%
       \setcounter{tocdepth}{-2}%
     }%
     \showtoc{toc}
     \setcounter{tocdepth}{\value{normaltocdepth}}% HinzugefĆ¼gt!
   \endgroup
 }

\newcommand{\neuestory}[3]{

                            \startstory{#3}
                            \vspace{10mm}

                            \section*{Abstract}
                            \small
                            \noindent #1
                            \section*{Personen}
                            \noindent #2
                            \normalsize

                            \vspace{10mm}

                            \section*{Inhalt}
                            \storytoc

                            %\cleardoublepage
                            }


\begin{document}

\maintoc

\newpage
\chapter{Vorwort}

blabla

\neuestory{ABC}{eine Frau}{Hallo}

\section{Test}
abc

\afterstory

\neuestory{DEF}{eine Mann}{Und so weiter}

\section{weiterheiter}
def

\afterstory


\end{document}
1

1 Answers

0
votes

The answer is the minitoc package.

Works fine!