하위 캡션: 세로 크기가 다른 두 이미지의 세로 정렬

하위 캡션: 세로 크기가 다른 두 이미지의 세로 정렬

크기가 다른 두 개의 이미지를 나란히 배치하고 싶습니다. 둘 다 개별 s를 가져야 합니다 subcaption. 모든 것이 잘 작동합니다. 내 유일한 질문은: 어떻게 더 높은 이미지에 대해 작은 이미지를 수직으로 중앙에 배치할 수 있습니까?

\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}

답변1

에서 설명한 것과 동일한 유형의 절차를 따를 수 있습니다.하위 캡션 수직 정렬그리고figure*환경 에서 다양한 크기의 이미지를 수직으로 정렬. 즉, 더 큰 이미지의 크기를 캡처하고 해당 높이를 사용하여 더 작은 이미지의 수직 위치를 조정합니다.

여기에 이미지 설명을 입력하세요

\documentclass{article}
\usepackage{geometry,graphicx}
\geometry{a4paper,margin=1in}
\usepackage{subcaption}
\newsavebox{\largestimage}

\begin{document}

\begin{figure}[htbp]
  \centering
  % Store largest image in a box
  \savebox{\largestimage}{\includegraphics[height=.22\textheight]{example-image-a}}%
  \begin{subfigure}[b]{0.48\textwidth}
    \centering
    \usebox{\largestimage}
    \caption{Subcaption left}
  \end{subfigure}
  \quad
  \begin{subfigure}[b]{0.48\textwidth}
    \centering
    % Adjust vertical height of smaller image
    \raisebox{\dimexpr.5\ht\largestimage-.5\height}{%
      \includegraphics[height=.18\textheight]{example-image-b}}
    \caption{Subcaption right}
  \end{subfigure}
  \caption{Caption}
\end{figure}

\end{document}

수직 조정은 더 큰 이미지 높이의 50%입니다.마이너스작은 이미지 높이의 50%입니다. 기술적으로 이는 작은 이미지 주위에 수직 공백의 50%를 제공합니다. 큰 이미지를 기준으로 수직으로 중앙에 배치됩니다.

관련 정보