
サイズの異なる 2 つの画像を並べて配置し、最初の画像の下にキャプションを配置して空白を埋めようとしています。
minipage オプションの各組み合わせでは、tb
目的の出力が得られません。
要件は次のとおりです:
- 2 つの画像は上部に揃えられています。
- キャプションは両方の画像に固有であり、最初の画像のすぐ下に書かれています。
次の出力では、画像が上部に揃っていません。これはミニページを正しく調整する方法ですか?
MWE は次のとおりです:
\documentclass[11pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[top=2.5cm,bottom=2cm,left=2.6cm,right=2.6cm]{geometry}
\begin{document}
\begin{figure}
\centering
\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics[width=238px, height=274px]{example-image-a}
\caption{Schémas dex expériences des aimants $A$ et $B$}
\end{minipage}\qquad
\begin{minipage}{0.4\linewidth}
\centering
\includegraphics[width=117px, height=383px]{example-image-b}
\end{minipage}
\end{figure}
\newpage
\begin{figure}
\centering
\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics[width=0.9\linewidth]{AimantAB1.png}
\caption{Schémas dex expériences des aimants $A$ et $B$}
\end{minipage}\qquad
\begin{minipage}{0.4\linewidth}
\centering
\includegraphics[width=0.6\linewidth]{AimantAB2.png}
\end{minipage}
\end{figure}
\end{document}
対応する出力は次のようになります。
答え1
あなたの質問を正しく理解したかどうかわかりませんが...こんな感じでしょうか?
\documentclass[11pt,a4paper]{report}
\usepackage[export]{adjustbox} % it load graphicx too
% used to move images' baselines at their top
\usepackage[vmargin=2.5cm, hmargin=2.6cm]{geometry}
\begin{document}
\begin{figure}
\centering
\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics[width=238px, height=274px,valign=t]{example-image-a}
\caption{Schémas dex expériences des aimants $A$ et $B$}
\end{minipage}\hfil
\begin{minipage}[t]{0.4\linewidth}
\centering
\includegraphics[width=117px, height=383px,valign=t]{example-image-b}
\end{minipage}
\end{figure}
\end{document}
答え2
以下を試してください:
\documentclass[11pt,a4paper]{report}
\usepackage{graphicx}
\usepackage[top=2.5cm,bottom=2cm,left=2.6cm,right=2.6cm]{geometry}
\usepackage{adjustbox}
\begin{document}
\begin{figure}
\centering
\adjustbox{valign=t}{
\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics[width=238px, height=274px]{example-image-a}
\caption{Schémas dex expériences des aimants $A$ et $B$}
\end{minipage}}\qquad
\adjustbox{valign=t}{
\begin{minipage}{0.4\linewidth}
\centering
\includegraphics[width=117px, height=383px]{example-image-b}
\end{minipage}}
\end{figure}
\end{document}
出力: