I do have to create some floating boxes containing various informations, some text, figures... I need to refer it sometimes using the document in the whole, sometimes I need to be more specific and refer only to a figure or a subfigure.
An exemple:
\documentclass{article}
\usepackage{lipsum}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{newfloat}
\usepackage{tcolorbox}
\newcounter{numdoc}
\renewcommand\thenumdoc{\arabic{numdoc}}
\DeclareFloatingEnvironment[name=Doc.,listname={Liste des documents}]{docuflottant}
%\newsubfloat{docuflottant}
\newenvironment{docu}[1]{
\refstepcounter{numdoc}
\begin{docuflottant}
\begin{tcolorbox}[title={\caption{#1}}]
}{
\end{tcolorbox}
\end{docuflottant}
}
\begin{document}
\begin{figure}
\centering
Figure 1
\caption{Figure 1}
\end{figure}
\begin{docu}{An interesting doc}
\lipsum[1]
\begin{minipage}{\columnwidth}
\begin{center}
\begin{subfigure}{5cm}
Figure 2a
\caption{\label{fig2a}Figure 2a}
\end{subfigure}
\begin{subfigure}{5cm}
Figure 2b
\caption{\label{fig2b}Figure 2b}
\end{subfigure}
\end{center}
\captionof{figure}{figure 2a et 2b}
\end{minipage}
\end{docu}
I would like a reference to 'Figure 2a' to be figure~2a, and it is figure~\ref{fig2a}\dots
\end{document}
I understand that 1a is for document 1, subfigure a, but I would like to have the subfigure condidered as a subfloat of a the figure, not the document.
How to do that? Thanks for reading, and for any usefull help!