# subfloat - enclose a set of subfloats in a subfloat environment

I am struggling in finding the correct implementation for putting my two rows of figures inside a subfloat environment. What I have now is the following:

\documentclass[english]{article}
\usepackage[demo]{graphicx}
\usepackage{subfig}

\begin{document}

\begin{figure}[t]
\centering
\subfloat[ ]{
\includegraphics[width=.32\textwidth]{.png}
\label{fig1}
}
\subfloat[ ]{
\includegraphics[width=.32\textwidth]{.png}
\label{fig:2}
}
\subfloat[ ]{
\includegraphics[width=.32\textwidth]{.png}
\label{fig:3}
}

\subfloat[ ]{
\includegraphics[width=.32\textwidth]{.png}
\label{fig:4}
}
\subfloat[ ]{
\includegraphics[width=.32\textwidth]{.png}
\label{fig:5}
}
\subfloat[ ]{
\includegraphics[width=.32\textwidth]{.png}
\label{fig:6}
}

\caption{}
\label{fig:whatever}
\end{figure}

\end{document}


It returns the following output:

I would like to have one more level of subcaption on the row. I imagine refering each single picture in the following format: Figure 1.a.1. I tried putting them in a subfloat too, but latex returns an error on the stack. One constraint, I am forced to use the subfig package, I cannot move either to subfigure or subcaption.

EDIT: example:

• It is hard to make a figure. Basically I would like to have a,b,c grouped in a figure. There should be like a figure caption below each row – Guido Muscioni Apr 2 at 5:38
• @GuidoMuscioni Readers will be confused, especially when you refer to any of these subsubfigures. I think you really should place each of (a) and (b) to a new figure. – user156344 Apr 2 at 6:09
• The problem arises because these figures are going to have the same caption – Guido Muscioni Apr 2 at 6:46
• @MajidAbdolshah the solution is using subcaption, that I cannot use. Thank you – Guido Muscioni Apr 2 at 7:21

This is basically a duplicate of this answer only using \subfloat (more or less) from here.

\documentclass[english]{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}

\DeclareCaptionSubType{subfigure}
\captionsetup[subsubfigure]{labelformat=parens,labelsep=space}
\renewcommand{\thesubfigure}{\alph{subfigure}}
\renewcommand{\thesubsubfigure}{\arabic{subsubfigure}}
\AtBeginDocument{% trial and error
\let\oldsubsubfigure=\subsubfigure
\renewcommand{\subsubfigure}{\expandafter\def\csname @captype\endcsname{subfigure}%
\oldsubsubfigure}%
}

\newsavebox{\subsubfloatbox}% probably overkill
\newcommand{\subsubfloat}[2][\empty]% #1 = caption (optional), #2 = image
{\bgroup
\captionsetup[subsubfigure]{font=footnotesize}%
\savebox\subsubfloatbox{#2}%
\begin{subsubfigure}[t]{\wd\subsubfloatbox}
\usebox\subsubfloatbox
\ifx\empty#1\relax
\stepcounter{subsubfigure}%
\else
\caption{#1}%
\fi
\end{subsubfigure}%
\egroup}

\begin{document}

\begin{figure}[t]
\begin{subfigure}{\columnwidth}
\centering
\subsubfloat[]{%
\includegraphics[width=.32\textwidth]{example-image}%
\label{fig1}%
}\hfil
\subsubfloat[\label{fig:2}]{%
\includegraphics[width=.32\textwidth]{example-image}%
}\hfil
\subsubfloat[\label{fig:3}]{%
\includegraphics[width=.32\textwidth]{example-image}%
}
\caption{}
\end{subfigure}\par
\begin{subfigure}{\columnwidth}
\subsubfloat[\label{fig:4}]{%
\includegraphics[width=.32\textwidth]{example-image}%
}\hfil
\subsubfloat[\label{fig:5}]{%
\includegraphics[width=.32\textwidth]{example-image}%
}\hfil
\subsubfloat[\label{fig:6}]{%
\includegraphics[width=.32\textwidth]{example-image}%
}
\caption{}
\end{subfigure}
\caption{}
\label{fig:whatever}
\end{figure}

\end{document}