Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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...

share|improve this question
2  
RTFM, Section "2.1.2 The \newsubfloat Command" –  Axel Sommerfeldt Feb 21 '12 at 20:29
    
Ok, I added \newsubfloat{chart} and now it sortof works. However cleveref doesn't seem to inherit the "chart" label from chart. Any idea how I can fix that? –  Matthias Feb 22 '12 at 13:16
2  
RTFM (cleveref), Section 7.1.2 "Customising Individual Cross-Reference Types" ;-) –  Axel Sommerfeldt Feb 24 '12 at 17:34
add comment

closed as too localized by Paulo Cereda, lockstep, egreg, Thorsten, Marco Daniel Mar 4 '12 at 15:36

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.