Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

enter image description here

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}
share|improve this question
1  
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

1 Answer 1

up vote 7 down vote accepted

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.

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.