0

I have a code to reproduce 4 figures in a sort of 4x4 tile. But the subfigure (c)is not correclty aligned. multifig

Here the code:

\documentclass[12pt,twoside]{book}

\usepackage{_my_document_style}
\usepackage{_my_basic_document_style}


\begin{document}
\begin{figure}[H] 
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
    \includegraphics[scale=0.33]{Figures_2021/Q6/fig_Q6_SR_3D_view_1.png}
    \caption{Virata a sinistra sopra la città di Napoli.} 
    % \vspace{4ex}
    \hfill
  \end{subfigure}%% 
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
 \includegraphics[scale=0.33]{Figures_2021/Q6/fig_Q6_SR_3D_view_2.png}
    \caption{Salita ripida sui Monti Lattari.} 
    % \vspace{4ex}
        \hfill
  \end{subfigure} 
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
   \includegraphics[scale=0.33]{Figures_2021/Q6/fig_Q6_SR_3D_view_3.png}
    \caption{Virata a destra sopra l'isola di Capri.} 
       \hfill
  \end{subfigure}%%
  \begin{subfigure}[b]{0.5\textwidth}
    \centering
 \includegraphics[scale=0.33]{Figures_2021/Q6/fig_Q6_SR_3D_view_4.png}
    \caption{Virata con inversione di rotta sopra Bacoli e le isole di Procida ed Ischia.} 
       \hfill
  \end{subfigure} 
  \caption{Dettagli della navigazione a corto raggio su rotta regionale (Campania).}
  \label{fig:Q6:SR:3D views} 
\end{figure}

\end{document}

Some useful used packages:

\usepackage{subfig}
\usepackage{subcaption}
\usepackage{subfloat}
\usepackage[innercaption,wide]{sidecap}


2
  • If you want to align the bottoms of the images (\includegraphics), use [t] (first baseline). If you want to align the tops of the images, you will also need to use \raisebox{-\height}{\includegraphics{...}}. Commented Jul 19, 2021 at 4:05
  • i have no idea where the baseline for the caption is placed, but if [b] isn't "correct," don't use it. Commented Jul 19, 2021 at 14:35

1 Answer 1

0

It is because of the length of the caption which is occupying more space -- I have added some phantom text to even out the length of the captions

enter image description here

\documentclass[12pt,twoside]{book}
\usepackage{graphicx}
\usepackage[skip=0.5ex, belowskip=1ex]{subcaption}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\begin{document}
\begin{figure}[htb]
\setkeys{Gin}{width=\linewidth}
\centering
\begin{subfigure}[b]{.45\linewidth}
\includegraphics[width=\linewidth]{example-image-a}
    \caption{Virata a sinistra sopra la città di Napoli.} 
\end{subfigure}
\begin{subfigure}[b]{.45\linewidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{Salita ripida sui Monti Lattari.\phantom{Virata a sinistra sopra la città di Napoli.}} 
\end{subfigure}

\begin{subfigure}[b]{.45\linewidth}
\includegraphics[width=\linewidth]{example-image-b}
    \caption{Virata a destra sopra l'isola di Capri. \phantom{Virata con inversione di rotta sopra Bacoli }} 
\end{subfigure}
\begin{subfigure}[b]{.45\linewidth}
\includegraphics[width=\linewidth]{example-image-c}
    \caption{Virata con inversione di rotta sopra Bacoli e le isole di Procida ed Ischia.} 
\end{subfigure}
\caption{Dettagli della navigazione a corto raggio su rotta regionale (Campania).}
  \label{fig:Q6:SR:3D views} 
\end{figure}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .