I have a question regarding placing captions with subfigures. I know there are several posts already which are pretty close to what I would like to achieve, but not exactly. I hope the question has not been asked as I couldn't find the case I'm looking for.
What I have is a table next to a figure, and I would like to add a common caption, similar to what was proposed in this post. So I can use
\DeclareCaptionLabelFormat{andtable}{#1~#2 \& \tablename~\thetable}
to make common caption with proper counts for table and figure. However, the referencing breaks with this. \cref{fig_and_tab} only gives the number of the figure, not the table. It makes sense as the label is placed in the outer environment and the reference has no way to check whether the figure or the table was meant.
So instead I would like to place two labels in the \subfigure or \subtable environment, but the captions both in the outer floating environment. Ideally, below each other.
After learning about \captionof in this post I tried to place two captions in the outer environment with it, which is basically my MWE
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[capitalize]{cleveref}
\begin{document}
\begin{figure}[!tb]
\centering
\begin{subfigure}{0.45\textwidth}
\centering
\rule{4cm}{3cm}
\end{subfigure}
~
\begin{subtable}{0.45\textwidth}
\begin{tabular}{@{}lllll@{}}
J & 0.0 & 0.25 & 0.5 & 1.0 \
300 & 0.0 & 25.07 & 50.14 & 100.28 \
kWh: & 0.0 & 125.00 & 250.00 & 500.00
\end{tabular}
\end{subtable}
\caption{Caption}
\label{fig:subfig}
\captionof{table}{TABLE}
\label{tab:subtable}
\end{figure}
With this MWE both parts of the floating environment can be referenced, i.e. the table with \cref{tab:subtable} and the figure with \cref{fig:subfig}.
\end{document}
However, the captions are vertically separated and I would like to join them. Probably I new line for the second caption is useful, but with the current version it looks pretty ugly:

I know I could place the captions in the subfloats. But in my actual document the lengths of the captions are pretty different. It looks strange if one lengthy caption and one rather short caption are placed side-by-side.
Thanks for your help!
floatrow, you can have each caption under the corresponding float, each caption starting at the same vertical position. I think it's clearer for the reader. – Bernard Sep 15 '21 at 08:18