[Tex/LaTex] Two labels in one caption possible

captionscleverefcross-referencing

In a lot of journals it is common to have single digit figure numbers and denote parts in the figures as (a), (b), and so on. I wanted to use a similar style. After reading the documentation to the caption package and the cleveref package I did not find anything similar.
I do not want to break up the picture in two parts and use subfigure with two captions but keep it all in one.

Is there an easy way to realize this? My example looks as follows without the correct references:

\documentclass{scrbook}

\usepackage{caption}
\usepackage{cleveref}

\begin{document}

\begin{figure}
  \centering
  a \rule{10pt}{10pt} \hspace{1cm} b \rule{15pt}{15pt} 
  \caption{Common text here. \label{part_a}\textbf{(a)} Description of a. \label{part_b}\textbf{(b)} Description of b. } 
\end{figure} 

This should read fig. 0.1a and fig. 0.1b but it is only \cref{part_a} and \cref{part_b}.

\end{document}

This gives this output:
output image

Best Answer

A small addition to Mico's answer with \phantomcaption option:

\documentclass{article}
\usepackage{mwe}            %For dummy images
\usepackage{subcaption}
\usepackage{cleveref}
\crefdefaultlabelformat{\thesection.#2#1#3} 

\begin{document}
\begin{figure}
\centering
\begin{subfigure}{0.4\textwidth}
  \centering
  \includegraphics[width=0.3\textwidth]{example-image-a}
  \phantomcaption 
  \label{part_a}
\end{subfigure}
\hspace{1cm} 
\begin{subfigure}{0.4\textwidth}
  \centering
  \includegraphics[width=0.3\textwidth]{example-image-b}
  \phantomcaption
  \label{part_b}
\end{subfigure}
\caption{Common caption here \textbf{(a)} On left \textbf{(b)} On right} \label{fig-overall}
\end{figure} 

This should read fig.\ 0.1a and fig.\ 0.1b, and indeed it now reads \cref{part_a} and \cref{part_b}.
\end{document}

enter image description here

Related Question