When I place a subfigure caption using \captionof
, the format differs from the one appearing when placed via \caption
inside a subfigure environment.
I suppose this is a bug in the \captionof
command? Trying to force it via \captionsetup
doesn't work either.
\documentclass{article}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\begin{subfigure}{\textwidth}
\caption{A}
\end{subfigure}
\end{figure}
\captionsetup[sub]{labelformat=parens}
\captionof{subfigure}{B}
\end{document}
Best Answer
\captionof{subfigure}
was never meant to work correctly. (IMHO it should give an error message instead.)\captionof
is only valid for main environments which offer captions, likefigure
.If one need sub-captions for non-floating environments, I recommend using
\captionsetup{type=...}
instead:BTW: I recommand using
\captionsetup{type=...}
plus\caption
instead of\captionof
anyway, even when used for main captions.