I am trying to reference a Figure and Table (with ~\ref{}) in my document. I placed both elements in a figure environment (figure first, table second, both inside of a minipage) to have them displayed next to each other. For a better look I am using a combined caption. I found a solution to the label issue on this feed. I can now call my figure and the table. However, the table reference seems to be tied to the figure number. The problem is that I have figures and tables in my document that are in their normal environments and the counters at the place where this combined figure/table appears are not the same for the figure and the table.
Does anyone have suggestions on how to fix this to show the correct table and figure numbers? In my preamble I also defined this:
\DeclareCaptionLabelFormat{figandtab}{#1~#2 \& \tablename~\thetable}
to allow me to use a combined figure and table caption. It is working as it should and states the correct figure and table number. It is just the label and referencing of it that isn't working with the correct counter.
Here is what I have used for the figure/table.
\begin{figure}[h]
\centering
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[width=1.0\columnwidth]{picture.jpg}%}
\end{minipage}
\begin{minipage}{0.49\textwidth}
\centering
\captionsetup{type=table}
\resizebox{0.9\linewidth}{!}{%
\begin{tabular}{lll}
*my table contents*
\end{tabular}%
}
\end{minipage}
\captionsetup{labelformat=figandtab}
\caption{combined caption}
\label{fig:figure_label}
{\makeatletter\edef\@currentHref{table.caption.\the\c@table}\label{tab:table_label}}
\end{figure}
I would be grateful for your help!

\captionaltogether. All you really need is\refstepcounter{figure}and\refstepcounter{table}followed by\labels (one each presumably). I take it you don't plan on using a\listoffiguresetc. – John Kormylo May 11 '22 at 15:08\addcontentsline, but it is easier to show than explain. – John Kormylo May 12 '22 at 12:19