I have written the following code in LaTeX which produces what is in the image below. My question is, how can I make it so that the two figures are in the same row, one next to the other? I have tried using minipage and subfigure but could not work it out. Thanks!
\begin{figure}
\begin{center}
\minipage{0.1\textwidth}
\includegraphics[trim={0 2 2 2},clip,width=\linewidth]{image1.jpg}
\endminipage
\hspace{1 cm}
\minipage{0.1\textwidth}
\includegraphics[trim={0 2 2 2},clip,width=\linewidth]{image2.jpg}
\endminipage
\caption{1st common caption}
\label{1st label}
\end{center}
\end{figure}
\begin{figure}
\begin{center}
\minipage{0.1\textwidth}
\includegraphics[trim={0 2 2 2},clip,width=\linewidth]{image3.jpg}
\endminipage
\hspace{1 cm}
\minipage{0.1\textwidth}
\includegraphics[trim={0 2 2 2},clip,width=\linewidth]{image4.jpg}
\endminipage
\caption{2nd common caption}
\label{2nd label}
\end{center}
\end{figure}



floatrowpackage. An example of using that package to obtain a desired output can be found here: https://tex.stackexchange.com/questions/674888/subfigure-with-vertically-centered-subcaptions-on-the-side/674897#674897. There are other examples available too, I guess. – alchemist Jun 05 '23 at 14:08