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 ...
- The compiler complains because
subcaption
is not in the correct environment. - 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?