In my document, I have several figures spread throughout and some of them consist of subfigures without captions. If I want to print a List of Figures (LOF), then these "captionless" subfigures appear in the form:
1. Figure 1: <Caption>
* a.
* b.
* c.
Now, that's pointless. However, I still want to include the subfigures in the LoF, since many of them do have proper captions.
To remove the "captionless" subfigure entries from the LoF, I tried this solution suggested by @Hertbert and it seems to work partially. That is, the required entries are indeed removed from the LoF, however this solution appears to add some additional vertical spacing between the two figure entries, as illustrated in the image given below:
My question is how to get rid of this extra vertical space between the two LoF entries without affecting other entries containing subfigures?
Here's my Minimal Working Example (MWE):
\documentclass[a4paper,oneside]{report}
\usepackage[demo]{graphicx} %% To get demo figures
\usepackage{showframe} %% Shows the actual page layout
\usepackage[list=true]{subcaption} %% alternative for subfigure
%% To get subfloats listed in list of figures, you
%% must load the subcaption package with [list=true]
%% option!
%%\usepackage{subfigure} %% deprecated package!
\usepackage[subfigure]{tocloft} %% A trick for tocloft+subcaption combo.
%% This option is required if, and only if,
%% the tocloft and subfigure packages are being used
%% together. The two packages can be specifed in any
%% order. - From the tocloft package documentation
%% (dated 2013/05/02)
\newcounter{lofdepth} %% Declare new LoF depth counter
\newcounter{lotdepth} %% Declare new LoT depth counter
\setcounter{lofdepth}{2} %% Set new LoF depth counter to include subfigures
%%\setcounter{lofdepth}{1} %% If subfigures are't needed in LoF
%% Adding horizontal space between LoF numbers and entry text
\renewcommand{\cftfignumwidth}{1in} %% Exaggerated width!
\renewcommand{\cftsubfignumwidth}{1in} %% Exaggerated width!
%% Indentation for LoF entry numbers
\renewcommand{\cftfigindent}{0em}
\renewcommand{\cftsubfigindent}{2.25em}
%% Vertical skips for LoF entries
\renewcommand{\cftbeforefigskip}{12pt}
\renewcommand{\cftbeforesubfigskip}{8pt}
%% Customisation of subfig numbers in the LoF entries
\renewcommand{\cftsubfigpresnum}{[\hspace*{0.5mm}}
\renewcommand{\cftsubfigaftersnum}{{}.\hspace*{0.5mm}]}
%% Figure LoF entries in bold
\renewcommand{\cftfigfont}{\bfseries}
\renewcommand{\cftfigpagefont}{\bfseries}
\renewcommand{\cftfigleader}{\bfseries\cftdotfill{\cftfigdotsep}}
%% To switch-off page numbers of subfigure LoF entries
\cftpagenumbersoff{subfigure}
\begin{document}
\tableofcontents
\cleardoublepage
\listoffigures
\cleardoublepage
\listoftables
\cleardoublepage
\chapter{CHAPTER 1}
\begin{figure}[!ht]
\vspace*{-20pt}
\centering
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption{First SUB-FLOAT}
%\label{fig:demo1}
\end{subfigure}
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption{Second SUB-FLOAT}
%\label{fig:demo2}
\end{subfigure}
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption{Third SUB-FLOAT}
%\label{fig:demo3}
\end{subfigure}
\caption{Demo Figure 1}
\end{figure}
\cleardoublepage
\section{Section 1}
\begin{table}[h]
\begin{center}
\vspace*{1.5in}
\scalebox{1.25}{
\begin{tabular}{|c|c|}
\hline
Mineral & Color \\
\hline
\hline
Ruby & red \\
\hline
\hline
Sapphire & blue \\
\hline
\end{tabular}
}
\end{center}
\caption{Demo Table 1}
\vspace*{50pt}
\end{table}
\subsection{Subsection 1}
\begin{figure}[!ht]
\vspace*{-20pt}
\centering
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption[]{} %% captionless subfigure
%\label{fig:demo1}
\end{subfigure}
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption[]{} %% captionless subfigure
%\label{fig:demo2}
\end{subfigure}
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption[]{} %% captionless subfigure
%\label{fig:demo3}
\end{subfigure}
\caption{Demo Figure 2}
\end{figure}
\cleardoublepage
\chapter{CHAPTER 2}
\begin{figure}[!ht]
\vspace*{-20pt}
\centering
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption{First SUB-FLOAT}
%\label{fig:demo1}
\end{subfigure}
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption{Second SUB-FLOAT}
%\label{fig:demo2}
\end{subfigure}
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption{Third SUB-FLOAT}
%\label{fig:demo3}
\end{subfigure}
\caption{Demo Figure 3}
\end{figure}
\cleardoublepage
\section{Section 2}
\begin{table}[h]
\begin{center}
\vspace*{1.5in}
\scalebox{1.25}{
\begin{tabular}{|c|c|}
\hline
Fruit & Color \\
\hline
\hline
Apple & red \\
\hline
\hline
Banana & Yellow \\
\hline
\end{tabular}
}
\end{center}
\caption{Demo Table 2}
\vspace*{50pt}
\end{table}
\subsection{Subsection 2}
\cleardoublepage
\end{document}
Removing the tocloft
added vertical skips from the preamble (see below) does not change observed behaviour of this code!
%% Vertical skips for LoF entries
\renewcommand{\cftbeforefigskip}{12pt}
\renewcommand{\cftbeforesubfigskip}{8pt}
Note: This may appear like a duplicate question, however solutions to similar problems aren't really useful in this case. A solution suggested here by @barbara-beeton is based on
ams
document classes and is also erroneous, to which a resolution wasn't found after the question was closed; whereas a solution given here by @steven-b-segletes is based on removing allappendix
-related figures and tables and is therefore not applicable in this case.
Any help would be greatly appreciated. Thanks!
Update: This is just F.Y.I. Just found another way to exclude a certain figure/subfigure/table for whatever reason, without affecting other entries. Include \captionsetup[<float-type>]{list=no} %% <float-type> = figure/subfigure/table
just before the figure you wish to exclude and restore it back again after that figure with \captionsetup[<float-type>]{list=yes}
and viola! it's gone from the list! (Source: Excluding items from list-of-figures / list-of-tables)
Best Answer
The standard behavior of
report
andbook
is to separate, in the list of figures and tables, items pertaining to different chapters by a vertical space and this is the space you see.If you want a tight list of figures without this separation, it's easy to patch
\chapter
:Full code