简体   繁体   中英

Latex: Multiple Table of Contents

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}

The answer is the minitoc package.

Works fine!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM