Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using the subcaption package and I would like to change the display in the List of Figures of the subfigures.

Right now, it displays as :

2.1 Caption 1  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
   a      Subcaption 1 . . . . . . . . . . . . . . . . . . . . . . . . . 6
   b      Subcaption 2 . . . . . . . . . . . . . . . . . . . . . . . . . 6

I'd like it to have a display as :

2.1  Caption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
   2.1.a  Subcaption 1 . . . . . . . . . . . . . . . . . . . . . . . . . 6
   2.1.b  Subcaption 2 . . . . . . . . . . . . . . . . . . . . . . . . . 6

Is it possible to customize the display ?

Here's the a piece of code I'm using :

\documentclass{book}

\usepackage{graphicx}
\usepackage{caption}
\usepackage[list=true]{subcaption}

\begin{document}
\begin{figure}[H]
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.9\textwidth]{subfigure1.jpg}
\caption{subcaption 1}
\label{fig:sub1}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.3\textwidth]{subfigure2.jpg}
\caption{subcaption 2}
\label{fig:sub2}
\end{subfigure}
\caption{Caption}
\label{fig:fig} 
\end{figure}

\end{document}
share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

You could use the option listformat=..., e.g.:

\documentclass{book}

\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage[list=true,listformat=simple]{subcaption}

\begin{document}
\listoffigures

\chapter{One}
\section{One}

\begin{figure}[!ht]
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.9\textwidth]{subfigure1.jpg}
\caption{subcaption 1}
\label{fig:sub1}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.3\textwidth]{subfigure2.jpg}
\caption{subcaption 2}
\label{fig:sub2}
\end{subfigure}
\caption{Caption}
\label{fig:fig} 
\end{figure}

\end{document}

enter image description here

If you want to have an additional dot between figure and sub-figure number, one option is creating an own list format, e.g.:

...
\usepackage{caption}
\DeclareCaptionListFormat{myfmt}{#1.#2}
\usepackage[list=true,listformat=myfmt]{subcaption}
...

enter image description here

Please note that this solution will still give you references like 1.1a as result of \ref{fig:sub1}.

To change both, the appearance of List of Figures, and the references, one better re-define \p@subcaption. For example:

...
\usepackage{caption}
\usepackage[list=true,listformat=simple]{subcaption}
\makeatletter
\g@addto@macro\p@subfigure{.}
\makeatother
...

As opposite to the last solution this one will change both to 1.1.a, i.e. having a period between figure and sub-figure part of the numbering in List of Figures and references.

(For details about listformat= and \DeclareCaptionListFormat please take a look at the caption package documentation. For details about \p@subfigure please take a look at the subcaption package documentation, section "References".)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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