# 1.a numbering of subfigures within a figure without a caption

I am using the subcaption package and write a caption for each of my subfigures. In order to get a reference to "Fig. 1a", I also have to write a "big caption" below all subfigures. But I don't want to write this "big caption" always. Anyway, I want my figure to have the label "Fig. 1a".

Example:

\documentclass[a4paper]{article}
\usepackage{mwe}
\usepackage{subcaption}
\begin{document}
\begin{figure}[tbp]
\begin{subfigure}[t]{0.48\linewidth}
\includegraphics[width=1\textwidth]{example-image-a}
\caption{An Elephant.}
\label{fig:elephant}
\end{subfigure}
\begin{subfigure}[t]{0.48\linewidth}
\includegraphics[width=1\textwidth]{example-image-b}
\caption{A Mouse.}
\label{fig:mouse}
\end{subfigure}
\caption{"Big caption". How can I avoid this one and get the label "Fig. 1a"?}
\end{figure}
\end{document}


(My question is not about the format of the number (e.g. "1a" or "1.a") but about "how do I get the "1" in my "1a"-reference)

• Can you please complete your code snippet to a running minimal working example (MWE)? Instead of image elephant and mouse you can use package MWE with the included example pictures. – Mensch Apr 29 '13 at 9:43
• ... or the demo option of the graphics package. – jub0bs Apr 29 '13 at 9:46
• You mean that you want the caption to say Figure 1.a but without any real caption at all... Is that right? What if you just write \caption{} is this what you want? – Thanos Apr 29 '13 at 10:00
• @Thanos: Writing \caption{} writes an extra line with "figure 1" which uses space I don't have ;-) – AnatraIlDuck Apr 29 '13 at 10:52
• @Vincent See Axel's comments on my answer below. I know you already got a satisfactory answer but, for the benefit of future visitors, could you clarify your question a bit? – jub0bs Apr 29 '13 at 14:28

Here is one way of producing the desired output; there may be better ways.

Wherever you want that numbering system for subfigures within a figure that lacks a \caption, use, at the beginning of the figure environment in question, the \nocaption command defined in my code below.

See section 6 of the subcaption manual for more details.

\documentclass[a4paper]{article}

\usepackage[demo]{graphicx}
\usepackage{subcaption}

\makeatletter
\newcommand\nocaption{%
\renewcommand\p@subfigure{}
\renewcommand\thesubfigure{\thefigure\alph{subfigure}}
}
\makeatother

\begin{document}

\begin{figure}[tbp]
\nocaption
\begin{subfigure}[t]{0.48\textwidth}
\includegraphics{elephant}
\caption{An Elephant.}
\label{fig:elephant}
\end{subfigure}
\begin{subfigure}[t]{0.48\textwidth}
\includegraphics{mouse}
\caption{A Mouse.}
\label{fig:mouse}
\end{subfigure}
%\caption{"Big caption". How can I avoid this one and get the label "Fig. 1a"?}
\end{figure}

Fig.~\ref{fig:elephant} shows an elephant; Fig.~\ref{fig:mouse}, a mouse.

\end{document}

• @egreg Yes, thanks. I don't know why I didn't do it that way in the first place. – jub0bs Apr 29 '13 at 10:29
• Why defining \nocaption when the (sub)caption package offers \phantomcaption for this purpose? And why using either \nocaption or \phantomcaption if this isn't necessary at all? I'm confused... – Axel Sommerfeldt Apr 29 '13 at 14:00
• @AxelSommerfeldt I think the OP wants the caption numbering system to be of the form 1.a. I'm not sure \phantomcaption is enough; don't you need to redefine \thesubfigure for that? – jub0bs Apr 29 '13 at 14:08
• @Jubobs Maybe, but what has this to do with the main caption? Why is the questioner asking about the main caption, if his real question should be "Hey, my refs are shown as 1a, but I want 1.a, how to do it?" – Axel Sommerfeldt Apr 29 '13 at 14:11