0

I'm working with a tufte-book document in LaTeX and encountering a problem where I want to exclude the caption of a particular figure from being listed in the List of Figures (LoF). However, despite using the \caption[]{} command, the caption still appears in the LoF. Here's a minimal example of what I tried:

\documentclass{tufte-book}

\usepackage{caption}

\begin{document}

\begin{figure}
  \caption[]{My caption 1} % Do not expect this caption to appear in the LoF
\end{figure}

\begin{figure}
  \ContinuedFloat
  \caption{My caption 2} % Expect this caption to appear in the LoF
\end{figure}

\listoffigures

\end{document}

Is there a specific way to properly handle this exclusion within the tufte-book document class, or a workaround that does not involve manually editing the LoF?

1
  • With standard classes, such as article, you can use the \caption* command from the caption package (typeset the caption without entry in the list of tables and without label). But I don't know if this works with tuft-book. See maybe: tex.stackexchange.com/questions/550798/…
    – jlab
    Commented Mar 3 at 15:06

2 Answers 2

0

You can temporary prevent writing caption content to the list of figures by redefining \caption@addcontentsline. This must be done between \makeatletter and \makeatother to handle the '@' symbol in macro name, and in a group (\begingroup...\endgroup) to restore after that the normal command definition. Note that the figure number must be incremented by hand (with \refstepcounter{figure} outside the group).

\documentclass{tufte-book}

\usepackage{caption}

\begin{document}

\begingroup
  \makeatletter
  \renewcommand{\caption@addcontentsline}[2]{}
  \makeatother
  \begin{figure}
    \caption{My caption 1} % Do not expect this caption to appear in the LoF
  \end{figure}
\endgroup
\refstepcounter{figure}

\begin{figure}
  \ContinuedFloat
  \caption{My caption 2} % Expect this caption to appear in the LoF
\end{figure}

\listoffigures

\end{document}

To use this many times, define a new environment, for example figurenolof :

\documentclass{tufte-book}

\usepackage{caption}

\makeatletter
\newenvironment{figurenolof}{%
\begingroup
  \renewcommand{\caption@addcontentsline}[2]{}
  \begin{figure}
  }{%
  \end{figure}
\endgroup
\refstepcounter{figure}
}
\makeatother

\begin{document}

\begin{figurenolof}
  \caption{My caption 1} % Do not expect this caption to appear in the LoF
\end{figurenolof}

\begin{figure}
  \ContinuedFloat
  \caption{My caption 2} % Expect this caption to appear in the LoF
\end{figure}

\listoffigures

\end{document}
```## Heading ##
1
  • Since I only want to exclude figures in case of ContinuedFloat, I removed the modification of \refstepcounter{figure}. Works like a charm, thanks!
    – Soraly
    Commented Mar 4 at 12:46
0

Tuft class has its own \caption and probably resets it in every figure environment (\AtBeginDocument doesn't help), Note also that the default \caption@caption centers the caption.

\documentclass{tufte-book}

\usepackage{caption}

\makeatletter
\let\Caption=\caption@caption% caption package \caption
\makeatother

\begin{document}

\listoffigures

\begin{figure}
  \Caption[]{My caption 1}
\end{figure}

\begin{figure}
  \ContinuedFloat
  \Caption{My caption 2}
\end{figure}

\end{document}
2
  • This also removes the figure number (which I want to keep) and is not compatible with ContinuedFloat.
    – Soraly
    Commented Mar 4 at 8:22
  • So you really want two figure 1s? Not a problem. Commented Mar 4 at 14:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .