# Content summaries - sections

I'm currently writing up my thesis and I have a section "content summary" in my introduction section. This gives an indication to what each section contains and is about. At the minute, each chapter / section is in text files, "introduction.tex", "background.tex" etc..

My question is whether or not, in each of the chapter ".tex" files - Can I add a tag like "\contentsummary" for each chapter which then get's inserted to the "content summary" section within the introduction file?

Sorry if this does not make sense.

-

## 1 Answer

You can use the collect package:

\documentclass{article}
\usepackage{collect}

\makeatletter
\newenvironment{contsummary}[1]
{\@nameuse{collect*}{contsum}{\par}{\par}{\subsection*{#1}}{}}
{\@nameuse{endcollect*}}
\makeatother

\definecollection{contsum}

\begin{document}

\section{Contents summary}
\includecollection{contsum}

\section{Test section one}
\begin{contsummary}{Test section one}
This is the description of the first section. Here we add some more text for the example
\end{contsummary}

\section{Test section two}
\begin{contsummary}{Test section two}
This is the description of the second section. Here we add some more text for the example
\end{contsummary}

\section{Test section three}
\begin{contsummary}{Test section three}
This is the description of the third section. Here we add some more text for the example
\end{contsummary}

\end{document}


I declared a collection contsum. For each \section, use the contsummary environment (which will add its contents to the collection) to enclose the corresponding summary. In the section containing the summaries all you have to do is to invoke \includecollection{contsum}. The mandatory argument for the contsummary environment is used to produce a heading in the contents summary section.

-
Yes this works :) Is it possible to have for example \textbf{Background Section} \\ This section provides the background..` so basically it would auto generate the header titles for the content? –  user1326876 Mar 22 at 17:00
@user1326876 Sure. I modified the environment definition so now it has one mandatory argument in which you provide the title; this is automatically formatted as a proper heading in the contents summary. –  Gonzalo Medina Mar 22 at 17:11