Left-align captions with respect to subfigure

How do I left-align the captions on the subfigures below, so that the caption starts aligned with the left-hand edge of the corresponding subfigure?

\documentclass{article}

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

\begin{document}

\begin{figure}[H]
\begin{center}
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[scale=0.8]{fig/workflow-S}
\caption{workflow $S$}
\end{subfigure}
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[scale=0.8]{fig/workflow-S-run}
\caption{run of $S$}
\end{subfigure}

\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[scale=0.8]{fig/workflow-S'}
\caption{workflow $S'$}
\end{subfigure}
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[scale=0.8]{fig/workflow-S'-run}
\caption{run of $S'$}
\end{subfigure}
\end{center}
\end{figure}

\end{document}


There seem to be many related questions, but none that specifically addresses this.

\captionsetup[subfigure]{justification=justified,singlelinecheck=false}


That will affect all the subfigure captions. For details (and other options), please keep reading on.

As is pointed out in the caption package documentation,

As addition to the caption format you could also specify a caption justiﬁcation; it is speciﬁed with the option justification=<justiﬁcation name>.

You can choose one of the following:

justified: Typesets the caption as a normal paragraph.

......

singlelinecheck= The standard LaTeX document classes (article, report, and book) automatically center a caption if it ﬁts in one single line. The caption package adapts this behavior and therefore usually ignores the justiﬁcation & indention you have set with justification= & indention= in such case. But you can switch this special treatment of such short captions off with the option singlelinecheck=false.

Now since you want only the subfigure captions to be left justified, you need to use the \captionsetup[FLOAT_TYPE]{OPTIONS} command.

FLOAT_TYPE can be table, figure, subtable and subfigure and specifies what type of caption that particular \captionsetup command applies to. So you can set different options for each of the figure, table, subfigure and subtable floats individually.

In your case the FLOAT_TYPE will be subfigure. If you put that \captionsetup command in the preamble, all your subfigure captions will be left justified. If you put that at some midpoint, all subsequent ones will get that effect. Should you need that for only one figure, put that inside that particular figure environment.

Here is the output.

• It should be possible to do this only for subfigure captions. – egreg Jan 6 '14 at 16:23
• @egreg Oops. Get your point. – Masroor Jan 6 '14 at 16:30
• Just being fussy. ;-) A good answer has become an excellent one. – egreg Jan 6 '14 at 16:48
• @egreg Thanks are not norm here, but can not help thanking you. (And will follow the norm and upvote the comment.) :-) – Masroor Jan 6 '14 at 16:50
• Does the trick. (I had scanned the subcaption documentation but didn't think to look at the caption package.) Thanks! – Roly Jan 6 '14 at 20:43