I have 2 figure side by side in LaTeX using the recommended package subcaption
.
\begin{figure}
\centering
\begin{subfigure}[b]{0.48\textwidth}
\includegraphics[width=\textwidth]{events/pad_p2}
\label{fig:pad_p2}
\end{subfigure}
~
\begin{subfigure}[b]{0.48\textwidth}
\includegraphics[width=\textwidth]{events/pad_p8}
\label{fig:pad_p8}
\end{subfigure}
\caption{Pads.}
\end{figure}
Then I try to reference them in the text using:
Look at figure~\ref{fig:pad_p8}
But I get an error when compiling the document that the reference doesn't exist.
If instead I put a caption in each subfigure then the error goes away, but that's not what I really want to do.
How do I solve the problem without adding the caption
for each subfigure?
Use packages
Write code like this in proper position
*
for multicolumn article (if no need then usefigure
.Use just
~\ref{subfig:lab1} is subref.
will show likeUse just 6(a) is subref.
or like that according.