# Insert Text between “List of XXX” Heading and Actual Listing

I would like to insert a small paragraph of text between the "List of Figures" heading and the actual list of figures, and also between "List of Listings" and the actual list of listings. I am using the listing environment provided by minted.

What's the best and easiest way to do this?

Edit: A picture in case I wasn't clear enough:

Edit2:

\documentclass{article}
\usepackage{minted}

\begin{document}
\listoffigures
\listoflistings

\begin{figure}
\caption{A figure}
\label{fig:figure}
\end{figure}

\begin{listing}
\caption{A listing}
\label{fig:listing}
\end{listing}

\end{document}
-
It would be easier if you provided a "skeleton document" (MWE) to show what to work from. –  Stephan Lehmke Nov 24 '12 at 10:57
It's very important that you specify the class you're using. –  egreg Nov 24 '12 at 11:10

You can patch the \@starttoc command so that it inserts something that you've specified in advance:

\documentclass{article}
\usepackage{minted}

\usepackage{etoolbox}
\makeatletter
\pretocmd\@starttoc{\csname #1@prolog\endcsname}{}{}
\newcommand{\listprolog}[2]{\global\@namedef{#1@prolog}{#2\par\bigskip}}
\makeatother

\begin{document}

\listprolog{lof}{This is what I want to appear as a prolog to the list of figures.

It even has two paragraphs.}

\listprolog{lol}{This is what I want to appear as a prolog to the list of listings}

\listoffigures
\listoflistings

\begin{figure}[h]
\caption{A figure}
\label{fig:figure}
\end{figure}

\begin{listing}
\caption{A listing}
\label{fig:listing}
\end{listing}

\end{document}

The first argument to \listprolog is the list file extension

• lot for the list of tables
• lof for the list of figures
• lol for the list of listings

The second argument is the prolog text.

-