2

I have a number of diagrams (right now 8) that depict different stages of an algorithm, each in its own figure environment together with a caption and a label I am referencing in text (the description is quite lengthy, currently it has 6 pages). However, the pictures are quite similar and it is silly to put them in the list of figures under short-captions like "Algorithm 4.2, step 42".

I am looking for a solution that won't put a number of similar entries in the list of figures, but will still allow to reference at least the first diagram, and will make the all of them feel like a part of a series.

For example we could number the diagrams like subfigures, i.e., "Fig 4.2a", but keep them in different figure environments, and then put only the first one as "4.2" in the list of figures.

Even better, perhaps we could put in the list of figures a range, like "Fig 4.2-4.9" or "Fig 4.2a-4.2h".

I don't really know how to make it appear nicely, so I'm open to different solutions as well. Thank you for your help!

(I'm not providing a minimal example because it would be quite lengthy and it wouldn't contain anything special. Yet, if you want me to provide one, I will edit it in.)

  • Adding a range such as "Fig 4.2-4.9" in the LoF might be ambigüous unless all eight figures appear on the same page (the one that will appear in the LoF). – Gonzalo Medina Aug 26 '15 at 17:11
  • @GonzaloMedina I am aware of that, that's one of the reasons I am not sure how to do it. Perhaps the page should be also a range then? – dtldarek Aug 26 '15 at 17:14
  • I think this could make things even worst; in my answer below I propose a possible option as well as an explanation of why I consider the range solution to be suboptimal. – Gonzalo Medina Aug 26 '15 at 17:21
  • Will there be text in between the eight steps, or can they be treated as eight subfigures of just one main figure? – Gonzalo Medina Aug 26 '15 at 17:28
  • @GonzaloMedina There is a lot of text between the figures, besides, the figures are too large to even fit on one page. – dtldarek Aug 26 '15 at 18:16
5

I don't think that adding a range such as "Fig 4.2-4.9" in the LoF is a good idea since it might be ambiguous unless all eight figures appear on the same page (the one that will appear in the LoF). Trying to circumvent this using a page range in the LoF might be even worse, since it might be possible that no float appears in one of the pages of the range.

Here's one proposal to do it using \ContinuedFloat from the caption package. Only the "main" float in the a series of steps will produce an entry in the LoF; the use of an empty optional argument for \caption in the continued floats for that series assures that no entries will be produced in the LoF. One could additionally declare a special label for the continued floats (in my example code each one of them has a label of the form "Figure # (Cont.)" but you could change this to suit your needs) to clearly specify that it is the continuation of a series.

\documentclass[openany]{book}% openany just for the example
\usepackage[a6paper]{geometry}% just for the example
\usepackage{caption}

\DeclareCaptionLabelFormat{continued}{#1~#2 (Cont.)}
\captionsetup[ContinuedFloat]{labelformat=continued}

\begin{document}

\listoffigures

\chapter{A test chapter}
\clearpage% just for the example
\begin{figure}
\caption{First Algorithm---Step 1}
\end{figure}

\begin{figure}
\ContinuedFloat
\caption[]{First Algorithm---Step 2}
\end{figure}

\begin{figure}
\ContinuedFloat
\caption[]{First Algorithm---Step 3}
\end{figure}

\begin{figure}
\caption{Second Algorithm---Step 1}
\end{figure}

\begin{figure}
\ContinuedFloat
\caption[]{Second Algorithm---Step 2}
\end{figure}

\begin{figure}
\ContinuedFloat
\caption[]{Second Algorithm---Step 3}
\end{figure}

\begin{figure}
\ContinuedFloat
\caption[]{Second Algorithm---Step 4}
\end{figure}

\end{document}

Here's the resulting LOF:

enter image description here

And the page containing the steps of the algorithms:

enter image description here

  • 1
    I needed to reference in text particular diagrams (not just all of them), so I have combined your solution with subcaption and captionlistentry and it works great (at least for now). Thanks! – dtldarek Aug 27 '15 at 0:16

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.