1

Previously I have asked about Avoid showing the number of chapter.section in the list of figures. The code works beautifully, but not for the subfigures when using subcaption package.

\documentclass[a4paper,12pt]{article}
\usepackage[demo]{graphicx}
\usepackage{lipsum}
\usepackage[list=true]{subcaption}

%Avoid showing the number of chapter.section in the list of figure
\usepackage{tocbasic}   % needs version 3.20 or newer   
\DeclareTOCStyleEntry[
entrynumberformat=\gobble,
numwidth=0pt,
indent=0pt
]{tocline}{figure}
\newcommand\gobble[1]{}

\begin{document}
\listoffigures
\section{TEST}
\lipsum[1]
\begin{figure}
 \centering
 \captionsetup[subfigure]{labelformat=empty}
 \begin{subfigure}[b]{1.0\linewidth}
    \includegraphics[width=1.0\linewidth]{example-image-a}
    \caption{This is figure A.}
\end{subfigure}

\vspace{15pt}
\lipsum[1]  
\vspace{15pt}   

\begin{subfigure}[b]{1.0\linewidth}
    \caption{This is Figure B.}
    \includegraphics[width=1.0\linewidth]{example-image-b}
\end{subfigure}
\end{figure}'

1 Answer 1

1

You can use a similar code for the subfigure entries:

\documentclass[a4paper,12pt]{article}
\usepackage[demo]{graphicx}
\usepackage{lipsum}
\usepackage[list=true]{subcaption}

%Avoid showing the number of chapter.section in the list of figure
\usepackage{tocbasic}   % needs version 3.20 or newer
\DeclareTOCStyleEntry[
  entrynumberformat=\gobble,
  numwidth=0pt,
  indent=0pt
]{tocline}{figure}
\DeclareTOCStyleEntry[
  level=2,
  entrynumberformat=\gobble,
  numwidth=0pt,
  indent=1.5em% <- if subfigures should be indented
]{tocline}{subfigure}
\newcommand\gobble[1]{}

\begin{document}
\listoffigures
\section{TEST}
\lipsum[1]
\begin{figure}
 \centering
 \captionsetup[subfigure]{labelformat=empty}
 \begin{subfigure}[b]{1.0\linewidth}
    \includegraphics[width=1.0\linewidth]{example-image-a}
    \caption{This is figure A.}
\end{subfigure}

\vspace{15pt}
\lipsum[1]  
\vspace{15pt}   

\begin{subfigure}[b]{1.0\linewidth}
    \caption{This is Figure B.}
    \includegraphics[width=1.0\linewidth]{example-image-b}
\end{subfigure}
\caption{Figure with two subfigures.}
\end{figure}
\end{document}

enter image description here

You must log in to answer this question.

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