You can do these things with etoc:
Note: for an elaboration (incorporating the remark below) of the technique see my answer to Expanded toc-like environment
Remark: The code below defines a command \sectionsummary
which ultimately writes things to the .toc
file. It thus has the same difficulties with fragile commands that the \section
command has. To get the material given as argument to \sectionsummary
find its way unexpanded to the .toc
file, one can use the following which uses the e-TeX
primitive \unexpanded
.
\newcommand*{\sectionsummary}[1]%
{\etoctoccontentsline{sectionsummary}{\unexpanded{\unexpanded{#1}}}}
With this variant, material given as argument to \sectionsummary
will only get expanded when the Summary
gets typeset.
\documentclass{scrartcl}
\usepackage{etoc}
\etocsetlevel {sectionsummary}{6}
\newcommand*{\sectionsummary}[1]{\etoctoccontentsline{sectionsummary}{#1}}
\begin{document}
\tableofcontents
\etocsettocstyle {\bigskip\noindent\bfseries\sffamily\Large
Summary\par\normalfont\normalsize}{}
% section headings exactly as in the standard TOC
\makeatletter
\let\original@l@section\l@section
\etocsetstyle {section}{}{}% cf etoc manual, "Another compatibility mode"
{\original@l@section{\numberline{\etocnumber}\etocname}{\etocpage}}{}
\makeatother
% now setting a style to print the summaries:
\etocsetlevel {sectionsummary}{2}
\etocsetstyle {sectionsummary}{\parindent1.5em\normalfont}
{\etocname}{\par}{\medskip}
% subsections a priori at level 2, need to be moved out of the way
\etocsetlevel {subsection}{6}
\etocsettocdepth {sectionsummary}
\tableofcontents
% can be located anywhere in the document.
% (but if before the main TOC, or before some other TOC, put everything in a
% group, to limit the scope of our style changes)
\section{A}
\sectionsummary{This section is about stuff.}% one paragraph only please.
\sectionsummary{Oh, and I forgot to say that also.}% another paragraph.
Hello
\subsection{A.A}
Hello
\subsection{A.B}
Hello
\section{B}
\sectionsummary{This section is about whatever.}
\subsection{B.A} \subsection{B.B}
\end{document}