2

I have a problem with the alignment of my subfigurs in a minipage-environment. My minimal example looks like this:

    \documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}
  \begin{minipage}[b]{0.5\textwidth}
    \centering
    \subcaptionbox{Caption zu Bild1}{\includegraphics[height=4cm]{bild1}}
    \subcaptionbox{Caption zu Bild2}{\includegraphics[height=4cm]{bild2}}
  \end{minipage}%
  \begin{minipage}[b]{0.5\textwidth}
    \centering
    \subcaptionbox{Caption zu Bild3}{\includegraphics[height=8cm]{bild3}}
  \end{minipage}
  \caption{Caption gesamt}
  \label{fig:test}
\end{figure}
\end{document}

So this gives me three pictures, two in the first minipage and the third in the second. But the sequence is not what i want. Right now its pic a and b in first minipage and pic c in second. But i want pic a and c in first minipage and pic b in second. Any possibility to do that?

Thanks a lot

2
  • Is there something that's stopping you from interchanging the directives that place "Bild2" and "Bild3"?
    – Mico
    Jul 10, 2023 at 10:54
  • Yes, the one picture I want to have in the second minipage has two times the height of the other two, so the it would be akward looking if I just interchange them
    – Jogalf
    Jul 10, 2023 at 11:05

1 Answer 1

1

But I want pic a and c in first minipage and pic b in second.

This may be achieved by interchanging the directives (and their associated sizing options) that place the images "Bild2" and "Bild3" and by incrementing/decrementing the subfigure counter suitably.

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
%%\usepackage[utf8]{inputenc} % that's the default nowadays
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}
  \begin{minipage}[b]{0.475\textwidth}
    \centering
    \subcaptionbox{Caption zu Bild1}{\includegraphics[width=\linewidth]{bild1}}
    
    \medskip
    \stepcounter{subfigure} % increment the 'subfigure' counter by 1
    \subcaptionbox{Caption zu Bild3}{\includegraphics[width=\linewidth]{bildc}}
  \end{minipage}%
  \hspace{\fill}%
  \addtocounter{subfigure}{-2} % decrement the 'subfigure' counter by 2
  \begin{minipage}[b]{0.475\textwidth}
    \centering
    %% Choose the height of the image (e.g., 0.407\textheight) suitably:
    \subcaptionbox{Caption zu Bild2}{%
      \includegraphics[width=\linewidth,height=0.407\textheight]{bild2}}
  \end{minipage}
  \caption{Caption gesamt}
  \label{fig:test}
\end{figure}
\end{document} 
2
  • Ah didnt think about changing the counter, thanks a lot Mico, works as I have imagined
    – Jogalf
    Jul 10, 2023 at 16:26
  • 1
    @Jogalf, you may consider to upvote answer ( according to site policy) a way to express your thankfulness) and even accept it if it solve your problem.
    – Zarko
    Dec 7, 2023 at 16:28

You must log in to answer this question.

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