I'd like to generate a table-of-contents style list of a hand-selected group of figures---that is, a subset of the list captured by \listoffigures.

Although obviously I can open the .lof file itself, I'd like to preserve the dynamic references in my list (in a style with the same kind of results as \ref{}). The .lof file hard-codes the page numbers for the figures.

(The actual use case for this question: I'm assembling a list of the color figures for the print shop, so I'm hand-editing the list to select only the color figures. But I need to make sure the page references stay accurate or they'll print the wrong pages in color.)

  • Good question, but perhaps the answer is to create a new environment that, apart from acting as a wrapper for figure, also adds itself to its own 'list of' (see the TeX Blog or the tocloft package). – Sean Allred Sep 23 '13 at 4:37

Here is one option provided via a \colorcaption for each of the coloured figures:

enter image description here

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
% See https://tex.stackexchange.com/q/113147/5764
      {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}}{}{}\caption}%
  \renewcommand{\listfigurename}{List of Coloured Figures}%
\section{A section}
\begin{figure}\caption{A figure}\end{figure}
\begin{figure}\colorcaption{A colour figure}\end{figure}
\begin{figure}\caption{Another figure}\end{figure}

The idea is to create a \colorcaption macro (for coloured figures) that acts the same as \caption, but also inserts a contents line into a new ToC file (with extension .lcf - for list of coloured figures). A companion \listofcolorfigures acts just like \listoffigures, except it calls \@starttoc{lcf} to generate the list of coloured figures.

Patching an argument inside a macro requires some assistance, as provided by Patching arguments inside a macro.

  • Can somebody explain how to make this work with labels? I want to use \ref to reference the \listofcolorfigures. – meijuh Mar 22 '14 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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