I have 4 images of various sizes (attached herewith). I want to place them in a 2 x 2 grid. Their widths should be the same, roughly 0.5/textwidth. I have done the following:
'''
\documentclass[12pt,onehalfspacing,headsepline,oneside,openright,a4paper]{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[t]{0.5\textwidth}
\centering
\raisebox{-\height}{\includegraphics[width=.8\linewidth]{images/image1.jpg}}
\caption{Step 1: Creating a new Project}
\vspace{1.7cm}
\label{fig:newproj}
\end{subfigure}%
\begin{subfigure}[t]{0.5\textwidth}
\centering
\raisebox{-\height}{\includegraphics[width=.8\linewidth]{images/image2.jpg}}
\caption{Step 3: Creating a new Model}
\label{fig:newmod}
\end{subfigure}
\newline
\begin{subfigure}{0.5\textwidth}
\centering
\includegraphics[width=0.8\linewidth]{images/image3.jpg}
%\vspace{0.7cm}
\caption{Step 5: Choosing model subsystem structure}
\label{fig:smsc_structure}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
\includegraphics[width=0.8\linewidth]{images/image4.jpg}
%\vspace{0.7cm}
\caption{Step 7: Editing new Model}
\label{fig:smsc_structure}
\end{subfigure}
\caption{How to make a model in OPAL-RT}
\label{fig:scratch}
\end{figure}
\end{document}
'''
But what I want is :
To explain in words, I want the top margin and bottom margins of the figures to be flush with each other horizontally. I should be able to do the fine-tuning by using space to add space between sub-figures and captions.
Any insights about what I am doing wrong would be greatly appreciated.
Note: I am new to this forum and I am trying my best to adhere to the guidelines. Kindly give me a chance to rectify any mistakes made before downvoting.
UPDATE: With the suggestion from @David Carlisle. I have added '%' a comment after the \end{subfigure}. And Adding [t], makes the second row flush to the bottom. This is how the result looks like:
However, as pointed out, the numbering is now jumbled up (I need c and b to be interchanged). How do I fix that? Updated code is as follows:
'''
\documentclass[12pt,onehalfspacing,headsepline,oneside,openright,a4paper]{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[t]{0.5\textwidth}
\centering
\raisebox{-\height}{\includegraphics[width=.8\linewidth]{images/image1.jpg}}
\caption{Step 1: Creating a new Project}
%\vspace{1.7cm}
\label{fig:newproj}
\end{subfigure}%
\begin{subfigure}[t]{0.5\textwidth}
\centering
\raisebox{-\height}{\includegraphics[width=.8\linewidth]{images/image3.jpg}}
%\includegraphics[width=.8\linewidth]{images/image2.jpg}
\caption{Step 5: Creating a new Model}
\label{fig:newmod}
\end{subfigure}
\newline
\begin{subfigure}[t]{0.5\textwidth}
\centering
\includegraphics[width=0.8\linewidth]{images/image2.jpg}
%\vspace{0.7cm}
\caption{Step 3: Choosing model subsystem structure}
\label{fig:smsc_structure}
\end{subfigure}%
\begin{subfigure}[t]{0.5\textwidth}
\centering
\includegraphics[width=0.8\linewidth]{images/image4.jpg}
%\vspace{0.7cm}
\caption{Step 7: Editing new Model}
\label{fig:smsc_structure}
\end{subfigure}
\caption{How to make a model in OPAL-RT}
\label{fig:scratch}
\end{figure}
\end{document}
'''








%hiding the word space, so if you want to put the second two in the same row add a%or if you want all 4 to be stacked vertically remove the%after the first. – David Carlisle Jan 26 '22 at 15:01