Erweiterte toc-ähnliche Umgebung

Erweiterte toc-ähnliche Umgebung

Ich setze ein Buch. Am Anfang jedes Kapitels steht ein spezieller Inhaltsverzeichnis-ähnlicher Text.

Was ich tun möchte, ist: nach jedem Abschnitt eine Umgebung (sagen wir abstrakt) verwenden und das Ergebnis am Anfang jedes Kapitels erhalten.

\documentclass{book}

\usepackage[inline]{enumitem}

\begin{document}
\chapter{First Chapter}
    \begin{abstract}
        \begin{itemize*}
            \item First this abstract talks about....
            \item Second we have ...
        \end{itemize*}
    \end{abstract}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{First Section}
    \begin{abstract}
        \begin{itemize*}
            \item this section talks about ....
            \item it also tals about
        \end{\itemize*}
    \end{abstract}

bla bla bla
\end{document}

Ergebnis:

First Chapter
-- First this abstract talks about.... -- Second we have ...
1. First Section: -- this section talks about .... -- it also talks about

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

*First Section*
bla bla bla

Ist das möglich?

Beachten Sie, dass dies nicht nur Minitoc ist, da jeder Abschnitt eine Zusammenfassung im Inhaltsverzeichnis enthält.

Bearbeiten: Die Beschreibung ist tatsächlich eine itemize*vom enumitemPaket bereitgestellte Umgebung.

Antwort1

So geht's mitetoc. Ich habe zusätzlich zu den Inhaltsverzeichnissen der Abschnittszusammenfassungen ein „Minitoc“ mit Kapitelzusammenfassungen hinzugefügt, eines pro Kapitel.

Das Update fügt als Reaktion auf Kommentare ein zweites Codebeispiel hinzu: wie die Methode mit unnummerierten Kapiteln () verwendet wird und wie anstelle von für die Zusammenstellung von Abschnittskapiteln \chapter*verwendet wird, die am Anfang jedes (jetzt unnummerierten) Kapitels erfolgt.enumerate*enumerate

Seite 1

Zusammenfassung 1

Seite 3

Zusammenfassungen 2

Seite 5

Zusammenfassungen 3

\documentclass{book}

\usepackage[inline]{enumitem}
\usepackage{etoc}
\usepackage{hyperref}% checking compatibility (also for pdf bookmarks)

\etocsetlevel{chapterabstract}{6}% invisible in TOCs unless level changed
\etocsetlevel{sectionabstract}{6}% invisible in TOCs unless level changed

\usepackage{environ}

%%%%

\NewEnviron {sectionabstract}{%
   \expandafter\SaveSectionAbstract\expandafter {\BODY}%
}%

\newcommand\SaveSectionAbstract [1]{%
   \etoctoccontentsline{sectionabstract}{\unexpanded{\unexpanded{#1}}}}

\NewEnviron {chapterabstract}{%
   \expandafter\SaveChapterAbstract\expandafter {\BODY}%
}%

\newcommand\SaveChapterAbstract [1]{%
   \etoctoccontentsline{chapterabstract}{\unexpanded{\unexpanded{#1}}}}

%%%%

\newcommand\PrintSectionAbstracts {%
    \begingroup
% level must be set *before* use of \etocsetstyle
       \etocsetlevel {sectionabstract}{2}
       \etocsetnexttocdepth {sectionabstract}
       \etocsetlevel {subsection}{3}   
       \etocsetstyle {section}
          {\begin{enumerate}}
          {}
          {\item \etocname:~}
          {\end{enumerate}}
       \etocsetstyle {sectionabstract}
          {}
          {}
          {\etocthename\par}
          {}
       \etocsettocstyle{\subsection*{Section abstracts}}{}
       \localtableofcontents
    \endgroup
}   

\newcommand\PrintChapterAbstracts {%
    \begingroup
       \etocsetlevel {chapterabstract}{1}
       \etocsetnexttocdepth {chapterabstract}
       \etocsetlevel {section}{2}   
       \etocsetstyle {chapter}
          {\begin{enumerate}}
          {}
          {\item \etocname:~}
          {\end{enumerate}}
       \etocsetstyle {chapterabstract}
          {}
          {}
          {\etocthename\par}
          {}
       \etocsettocstyle{\subsection*{Chapter abstracts}}{}
       %\localtableofcontents 
       % better not local, as the main TOC itself, a priori printed before,
       % could have been configured to create a chapter entry in the toc file
       \tableofcontents
    \endgroup
}   

\begin{document}

\tableofcontents % standard table of contents

\PrintChapterAbstracts % chapter abstracts

\chapter{First Chapter}
   \begin{chapterabstract}
        \begin{itemize*}
            \item First this chapter talks about....
            \item Second we have ...
        \end{itemize*}
   \end{chapterabstract}

\PrintSectionAbstracts % section abstracts

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{First Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this first section talks about Lorem ipsum dolor sit amet,
              consetetur sadipscing elitr \dots
            \item it also talks about \dots
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Second Section}

    \begin{sectionabstract}
        \begin{itemize*}
        \item this second section talks about ipsum dolor sit amet, consetetur
          sadipscing elitr,
        \item it also talks about sed diam voluptua. At vero eos et accusam et
          justo duo dolores et ea rebum.
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Third  Section}

    \begin{sectionabstract}
        \begin{itemize*}
        \item this third section talks about ipsum dolor sit amet, consetetur
          sadipscing elitr,
        \item it also talks about sed diam voluptua.
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\chapter{Second Chapter}
   \begin{chapterabstract}
        \begin{itemize*}
        \item First this second chapter talks about ipsum dolor sit amet,
          consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
          labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos
          et accusam et justo duo dolores et ea rebum.
        \item Second we have clita kasd gubergren, no sea takimata sanctus est
          Lorem ipsum dolor sit amet.
        \end{itemize*}
   \end{chapterabstract}

\PrintSectionAbstracts % section abstracts

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{First Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this first section of the second chapter talks about \dots
            \item it also talks about \dots
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Second Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this section talks about \dots
            \item it also talks about \dots
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Third  Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this third section talks about ipsum dolor sit amet, consetetur sadipscing elitr,
            \item it also talks about sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum.
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\end{document}

Anmerkung: Dies ist eine weitere Ausarbeitung meinerAntwortZuErstellen Sie ein zweites „Inhaltsverzeichnis“ mit einer kurzen Zusammenfassung für jeden AbschnittNeu ist die Verwendung von PaketenUmgebungum eine Umgebung anstelle einer Befehlssyntax zuzulassen. Abgesehen davon ist dies im Wesentlichen dieselbe Technik.


Aktualisieren:

Seite des Hauptinhaltsverzeichnisses (beachten Sie, dass es die reservierten Leerzeichen der Klasse standardmäßig für die Abschnittsnummern verwendet, die hier zu groß sind, da die Kapitel nicht nummeriert sind; Sie können entweder etocvollständiger verwenden, Beispiele finden Sie im Handbuch, oder zum Beispiel verwenden, tocloftum dieses Hauptinhaltsverzeichnis anzupassen, das inKompatibilitätsmodus).

Die Kapitelzusammenfassungen werden mithilfe einer descriptionUmgebung gedruckt.

Abschnitt Abstracts II 1

Seite des ersten Kapitels

Abschnitt Abstracts II 2

Seite des zweiten Kapitels

Abschnitt Abstracts II 3

\documentclass{book}

\usepackage[inline]{enumitem}
\usepackage{etoc}
\usepackage{hyperref}% checking compatibility (also for pdf bookmarks)

\etocsetlevel{chapterabstract}{6}% invisible in TOCs unless level changed
\etocsetlevel{sectionabstract}{6}% invisible in TOCs unless level changed

\usepackage{environ}

%%%%

\NewEnviron {sectionabstract}{%
   \expandafter\SaveSectionAbstract\expandafter {\BODY}%
}%

\newcommand\SaveSectionAbstract [1]{%
   \etoctoccontentsline{sectionabstract}{\unexpanded{\unexpanded{#1}}}}

\NewEnviron {chapterabstract}{%
   \expandafter\SaveChapterAbstract\expandafter {\BODY}%
}%

\newcommand\SaveChapterAbstract [1]{%
   \etoctoccontentsline{chapterabstract}{\unexpanded{\unexpanded{#1}}}}

%%%%

\newcommand\PrintSectionAbstracts {%
    \begingroup
% level must be set *before* use of \etocsetstyle
       \etocsetlevel {sectionabstract}{2}
       \etocsetnexttocdepth {sectionabstract}
       \etocsetlevel {subsection}{3}  
% enumitem redefinition of \item causes the closing of groups
% hence either some \expandafter, or like here \global saving
% of number and name 
       \etocsetstyle {section}
          {\begin{enumerate*}}
          {\global\let\EtocNumber\etocthenumber
           \global\let\EtocName\etocthelinkedname}
          {\item [{\bfseries\EtocNumber.}~]\EtocName: }
          {\end{enumerate*}}
       \etocsetstyle {sectionabstract}
          {}
          {}
          {\etocthename\par}
          {}
       \etocsettocstyle{\subsection*{Section abstracts}}{\medskip}
       \localtableofcontents
    \endgroup
}   

\newcommand\PrintChapterAbstracts {%
    \begingroup
       \etocsetlevel {chapterabstract}{1}
       \etocsetnexttocdepth {chapterabstract}
       \etocsetlevel {section}{2}   
       \etocsetstyle {chapter}
          {\begin{description}}
          {}
          {\item[\etocname] }
          {\end{description}}
       \etocsetstyle {chapterabstract}
          {}
          {}
          {\etocthename\par}
          {}
       \etocsettocstyle{\subsection*{Chapter abstracts}}{}
       \tableofcontents
    \endgroup
}   

\begin{document}

\renewcommand{\thesection}{\arabic{section}}

\tableofcontents % standard table of contents

\PrintChapterAbstracts % chapter abstracts

\chapter*{First Chapter}
\addcontentsline{toc}{chapter}{First Chapter}

   \begin{chapterabstract}
        \begin{itemize*}
            \item First this chapter talks about....
            \item Second we have ...
        \end{itemize*}
   \end{chapterabstract}

\PrintSectionAbstracts % section abstracts

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{First Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this first section talks about Lorem ipsum dolor sit amet,
              consetetur sadipscing elitr \dots
            \item it also talks about \dots
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\subsection{this subsection should not create problems}

\section{Second Section}

    \begin{sectionabstract}
        \begin{itemize*}
        \item this second section talks about ipsum dolor sit amet, consetetur
          sadipscing elitr,
        \item it also talks about sed diam voluptua. At vero eos et accusam et
          justo duo dolores et ea rebum.
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Third  Section}

    \begin{sectionabstract}
        \begin{itemize*}
        \item this third section talks about ipsum dolor sit amet, consetetur
          sadipscing elitr,
        \item it also talks about sed diam voluptua.
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\chapter*{Second Chapter}
\addcontentsline{toc}{chapter}{Second Chapter}

   \begin{chapterabstract}
        \begin{itemize*}
        \item First this second chapter talks about ipsum dolor sit amet,
          consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
          labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos
          et accusam et justo duo dolores et ea rebum.
        \item Second we have clita kasd gubergren, no sea takimata sanctus est
          Lorem ipsum dolor sit amet.
        \end{itemize*}
   \end{chapterabstract}

\PrintSectionAbstracts % section abstracts

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

\section{First Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this first section of the second chapter talks about \dots
            \item it also talks about \dots
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Second Section}

    \begin{sectionabstract}
        \begin{itemize*}
            \item this section talks about \dots
            \item it also talks about \dots
        \end{itemize*}
    \end{sectionabstract}

bla bla bla

\section{Third  Section}

    \begin{sectionabstract}
    \begin{itemize*}
    \item this third section talks about ipsum dolor sit amet, consetetur
      sadipscing elitr,
    \item it also talks about sed diam voluptua.
    \end{itemize*}
    \end{sectionabstract}

bla bla bla

\end{document}

Antwort2

Hier ist eine Möglichkeit mit demtitletocPaket zur Generierung der partiellen Inhaltsverzeichnisse und einer Variante vonMartin Sharrers AntwortZuInhaltsverzeichnis mit zusätzlicher Beschreibung der Einträgeum die zusätzliche Abschnittsbeschreibung in das partielle Inhaltsverzeichnis aufzunehmen:

\documentclass{book}
\usepackage{titletoc}
\usepackage{environ}
\usepackage[inline]{enumitem}
\usepackage{lipsum}

\makeatletter
\def\@nodottedtocline#1#2#3#4#5{%
  \ifnum #1>\c@tocdepth \else
    \vskip \z@ \@plus.2\p@
    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
     \parindent #2\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima #3\relax
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {#4}\nobreak
     \leaders\hbox{$\m@th
        \mkern \@dotsep mu\hbox{\,}\mkern \@dotsep
        mu$}\hfill
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor }%
     \par}%
  \fi}
\newcommand*\l@sectioninfo{\@nodottedtocline{1}{1.5em}{2.3em}}
\NewEnviron{sectioninfo}{%
    \addcontentsline{ptc}{sectioninfo}{%
    \noexpand\numberline{}\BODY}%
}
\makeatother

\def\PrintContents{%
\startcontents%
\printcontents{}{1}{{\bfseries\Large\contentsname}%
  \par\nobreak\vskip-6pt\noindent\hrulefill}%
  \vskip-6pt\noindent\hrulefill\vskip3\baselineskip%
}

\begin{document}
\tableofcontents

\chapter{First chapter}
\PrintContents

\lipsum[4]

\section{First section of chapter one}
\begin{sectioninfo}
\protect\begin{itemize*}
\protect\item The first important thing about this section.
\protect\item The second important thing about this section.
\protect\item The third important thing about this section.
\protect\end{itemize*}%
\end{sectioninfo}
\lipsum[4]
\section{Second section of chapter one}
\begin{sectioninfo}
\protect\begin{itemize*}
\protect\item The first important thing about this section.
\protect\item The second important thing about this section.
\protect\item The third important thing about this section.
\protect\item The fourth important thing about this section.
\protect\end{itemize*}%
\end{sectioninfo}
\lipsum[4]

\chapter{Second chapter}
\PrintContents

\lipsum[4]

\section{First section of chapter two}
\begin{sectioninfo}
\protect\begin{itemize*}
\protect\item The first important thing about this section.
\protect\item The second important thing about this section.
\protect\end{itemize*}%
\end{sectioninfo}
\lipsum[4]
\section{Second section of chapter two}
\begin{sectioninfo}
\protect\begin{itemize*}
\protect\item The first important thing about this section.
\protect\item The second important thing about this section.
\protect\item The third important thing about this section.
\protect\end{itemize*}%
\end{sectioninfo}
\lipsum[4]

\end{document}

Ein Bild des allgemeinen Inhaltsverzeichnisses:

Bildbeschreibung hier eingeben

Und einige Bilder der teilweisen Inhaltsverzeichnisse:

Bildbeschreibung hier eingeben

Und

Bildbeschreibung hier eingeben

Anmerkung

Die Beschreibungen werden mit einer sectioninfoUmgebung versehen; innerhalb dieser Umgebung müssen fragile Kommentare geschützt werden; da itemize*(von enumitem) in den Beschreibungen verwendet wird, benötigen \begin{itemize*}, \end{itemize*}und \itemein vorangestelltes \protect.

verwandte Informationen