I am trying to use subfloats in a custom caption/float environment. But I get compilation errors.
MWE:
\documentclass[a4paper]{report}
\usepackage[margin=10pt,font=small,labelfont=bf,justification=centering,belowskip=0pt]{caption}
\usepackage[nameinlink,noabbrev]{cleveref}
%%Charts
\DeclareCaptionType[fileext=loc,placement=b,within=chapter]{chart}[Chart][List of Charts] %list of charts is generated by \listofcharts
\crefname{chart}{chart}{charts}
\begin{document}
\begin{chart}[!h]
\centering%
\subfloat[Test 1]{\includegraphics[width=0.4\textwidth]{Test1.pdf}\label{chrt:Tests:1}}%
\quad%
\subfloat[Test2]{\includegraphics[width=0.4\textwidth]{Test2.pdf}\label{chrt:Tests:2}}%
\caption{Tests}%
\label{chrt:Tests}%
\end{chart}
\end{document}
If I change \begin{chart} to \begin{table} and \end{chart} to \end{table} this suddenly works...