# Subcaptions without subfigures

I'm laying out a document that includes images that are made up of a series of sub images and each image includes labels directly in the image itself. Here's an example ...

Again, the above is not 6 separate PNG files, but 1 PNG.

I need to caption the image ... I'd prefer to use something like subcaption to keep the formatting consistent for all the images in the document.

Currently I'm captioning the figure like this :

\usepackage{graphicx}
\usepackage[font=footnotesize,
labelfont=bf,
labelsep=endash,
justification=RaggedRight]{caption}

\begin{document}

\begin{figure}[ht]
\includegraphics[width=\linewidth]{fig.png}
\caption[My Figure]{\textbf{Myfigure (a)} This describes something shown in a. \textbf{(b)} This describes something shown in b. \textbf{(c)} This describes something shown in c. \textbf{(d)} This describes something shown in d. \textbf{(e)} This describes something shown in e. \textbf{(f)} This describes something shown in f.}
\label{fig:myfig}
\end{figure}

\end{document}


In order to keep the code compact and to keep the formatting consistent, I'd prefer to use something like the subcaption package. Syntax might look like this ...

\usepackage{graphicx}
\usepackage[font=footnotesize,
labelfont=bf,
labelsep=endash,
justification=RaggedRight]{caption}
\usepackage[labelformat=parens,
labelsep=space]{subcaption}

\begin{document}

\begin{figure}[ht]
\includegraphics[width=\linewidth]{fig.png}
\caption[My Figure]{My Figure} \subcaption{This describes something shown in a.} \subcaption{This describes something shown in b.} \subcaption{This describes something shown in c.} \subcaption{This describes something shown in d.} \subcaption{This describes something shown in e.} \subcaption{This describes something shown in f.}
\label{fig:myfig}
\end{figure}


This, however, has 2 issues ...

1. The compiler complains because subcaption is not in the correct environment.
2. There is a line break between the main caption title and each subcaption.

Is there any way to achieve a caption like the one in the first example but without having to brute force it the way the first example does?

• Both \subcaption and \caption use the same \@makecaption, which takes up the entire width of the page (or minipage). – John Kormylo Jun 27 '19 at 14:02

Figure 5 from the subcaption documentation gives an example which can be adjusted to your situation:

\documentclass{article}

\usepackage{graphicx}
\usepackage[font=footnotesize,
labelfont=bf,
labelsep=endash,
justification=RaggedRight]{caption}
\usepackage[labelformat=parens,
labelsep=space]{subcaption}

\begin{document}

\begin{figure}[ht]
\includegraphics[width=\linewidth]{example-image}
{
\phantomsubcaption\label{figa}
\phantomsubcaption\label{figb}
\phantomsubcaption\label{figc}
\phantomsubcaption\label{figd}
\phantomsubcaption\label{fige}
\phantomsubcaption\label{figf}
}
\caption[My Figure]{My Figure (\subref{figa}) This describes something shown in a. (\subref{figb}) This describes something shown in b. (\subref{figc}) This describes something shown in c.(\subref{figd}) This describes something shown in d.(\subref{fige}) This describes something shown in e.(\subref{figf}) This describes something shown in f.}
\label{fig:myfig}
\end{figure}

\end{document}

• This works but one question ... I was expecting the labelfont=bf option to be inherited from caption but it doesn't seem to make (a), (b), etc. bold. I tried adding it to the sub-caption options but it also doesn't seem to work. Any thoughts? – agf1997 Jun 27 '19 at 0:28
• Actually, this interestingly doesn't seem to respect any of the options of subcaption and the parentheses are hard coded. – agf1997 Jun 27 '19 at 0:33
• @agf1997 It respects all options of subcaption for referencing the sublabels. – Pizzagne Jun 27 '19 at 7:52

This uses \mycaption to effect the formatting used in the first example. Of course, all it really saves you is formatting the counter.

You can put a \label inside each \mycaption, if so inclined. They should not interfere with the main caption \label.

\documentclass{article}
\usepackage{graphicx}
\usepackage[font=footnotesize,
labelfont=bf,
labelsep=endash,
justification=RaggedRight]{caption}

\newcounter{subfigure}[figure]% or install subcaption package
\renewcommand{\thesubfigure}{\alph{subfigure}}% format for \ref
\newcommand{\mycaption}[1]% #1 = text
{\bgroup
\refstepcounter{subfigure}% global counter, local label
\textbf{(\alph{subfigure})}~#1
\egroup}

\begin{document}

\begin{figure}[ht]
\includegraphics[width=\linewidth]{example-image}
\captionsetup{singlelinecheck=off}% otherwise starts at (g)
\caption[My Figure]{\textbf{Myfigure}
\mycaption{This describes something shown in a.}
\mycaption{This describes something shown in b.}
\mycaption{This describes something shown in c.}
\mycaption{This describes something shown in d.}
\mycaption{This describes something shown in e.}
\mycaption{This describes something shown in f.}}
\label{fig:myfig}
\end{figure}

\end{document}