I want to place two images of different size next to each other. Both shall have individual subcaption
s. Everything works fine. My only question is: how can I center the smaller image vertically with respect to the higher image?
\documentclass[a4paper,10pt]{scrreprt}
\usepackage[T1]{fontenc}
% \usepackage[utf8]{inputenc}
\usepackage[latin1]{inputenc}
\usepackage{geometry}
\geometry{a4paper,left=25mm,right=25mm, top=25mm, bottom=25mm}
\usepackage{subcaption}
\usepackage{tikz}
\begin{document}
\begin{figure}[htbp]
\centering
\hfill
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[height=.22\textheight]{example-image-a}
\caption{Subcaption left}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.48\textwidth}
\centering
\includegraphics[height=.18\textheight]{example-image-b}
\caption{Subcaption right}
\end{subfigure}
\hfill
\caption{Caption}
\end{figure}
\end{document}
Best Answer
You can following the same type of precedures discussed in Subcaption vertical alignment and Vertically align different size images in a
figure*
environment. That is, capture the size of the larger image, and use its height to adjust the vertical position of the smaller image.The vertical adjustment is 50% of the height of the larger image minus 50% of the height of the smaller image. Technically this gives 50% of the vertical whitespace around the smaller image... vertically centering it with respect to the larger one.