我正在尝试实现这样的目标(每个图像都有单独的子标题):
我想知道如何在两个图像列的左侧(或右侧)添加任意数量的图像 A。我不明白乳胶如何放置图像:
\newsavebox{\measurebox}
\usepackage{graphicx}
\usepackage{subfig}
\begin{figure}[h!]
\centering
\sbox{\measurebox}{%
\begin{minipage}[b]{.33\textwidth}
\subfloat
[]
{\label{fig:figA}\includegraphics[width=\textwidth,height=5cm]{images/bosquet_1.png}}
\end{minipage}}
\usebox{\measurebox}\qquad
\begin{minipage}[b][\ht\measurebox][s]{.33\textwidth}
\centering
\subfloat
[]
{\label{fig:figB}\includegraphics[width=\textwidth,height=2cm]{example-image-a}}
\vfill
\subfloat
[]
{\label{fig:figC}\includegraphics[width=\textwidth,height=2cm]{example-image-a}}
\end{minipage}
\caption{my caption. (a) is .... (b) is .... (c) is ....}
\label{fig:Test}
\end{figure}
答案1
您在第一个小页面中输入的任何内容minipage
最终都会出现在“左栏”中,用空行将您想要显示在彼此顶部的两幅图像分开。如果您在第一个小页面中放置了多幅图像,则保存框会考虑所有这些图像。您在第二个小页面中放置的所有图像都将出现在“右栏”中。如果您希望它们均匀分布,请用空行将它们分开\vfill
。
另外两个每列图像数量不同的示例如下所示:
\documentclass{article}
\newsavebox{\measurebox}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[h!]
\centering
\sbox{\measurebox}{%
\begin{minipage}[b]{.33\textwidth}
\subfloat
[]
{\label{fig:figA}\includegraphics[width=\textwidth,height=5cm]{example-image-a}}
\subfloat
[]
{\label{fig:figB}\includegraphics[width=\textwidth,height=6cm]{example-image-a}}
\end{minipage}}
\usebox{\measurebox}\qquad
\begin{minipage}[b][\ht\measurebox][s]{.33\textwidth}
\centering
\subfloat
[]
{\label{fig:figC}\includegraphics[width=\textwidth,height=2cm]{example-image}}
\vfill
\subfloat
[]
{\label{fig:figD}\includegraphics[width=\textwidth,height=2cm]{example-image}}
\vfill
\subfloat
[]
{\label{fig:figE}\includegraphics[width=\textwidth,height=2cm]{example-image}}
\vfill
\subfloat
[]
{\label{fig:figF}\includegraphics[width=\textwidth,height=2cm]{example-image}}
\end{minipage}
\caption{my caption. (\subref{fig:figA}) is .... (\subref{fig:figB}) is .... (\subref{fig:figC}) is .... }
\label{fig:Test}
\end{figure}
\begin{figure}[h!]
\centering
\sbox{\measurebox}{%
\begin{minipage}[b]{.33\textwidth}
\subfloat
[]
{\label{fig:figA}\includegraphics[width=\textwidth,height=3cm]{example-image-a}}
\subfloat
[]
{\label{fig:figB}\includegraphics[width=\textwidth,height=3cm]{example-image-a}}
\subfloat
[]
{\label{fig:figC}\includegraphics[width=\textwidth,height=3cm]{example-image-a}}
\end{minipage}}
\usebox{\measurebox}\qquad
\begin{minipage}[b][\ht\measurebox][s]{.33\textwidth}
\centering
\subfloat
[]
{\label{fig:figD}\includegraphics[width=\textwidth,height=4cm]{example-image}}
\vfill
\subfloat
[]
{\label{fig:figE}\includegraphics[width=\textwidth,height=4cm]{example-image}}
\end{minipage}
\caption{my caption. (\subref{fig:figA}) is .... (\subref{fig:figB}) is .... (\subref{fig:figC}) is .... }
\label{fig:Test}
\end{figure}
\end{document}
附注:
对于您的实际图像,请确保您仅使用width=..
或height=...
(或至少添加keepaspectratio
),否则图像会扭曲,正如您从我的两个示例中看到的那样。
确保第一个小页面的内容比第二个小页面的内容高。否则您将看到重叠。
为了在图形的主标题中添加有关每个子图的更多信息,您可以\subref
像我在示例代码中所做的那样使用。我还建议对标签使用更具描述性的键。这样识别图像就会容易得多,特别是如果您以后决定删除/添加图像。(如果您这样做,fig:figB
不一定与标题为 (b) 的子图相对应)
关于评论中的请求的更新:
\documentclass{article}
\newsavebox{\measurebox}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[h!]
\centering
\sbox{\measurebox}{%
\begin{minipage}[b]{.3\textwidth}
\subfloat
[]
{\label{fig:figA}\includegraphics[width=\textwidth,height=5cm]{example-image-a}}
\end{minipage}}
\usebox{\measurebox}\hfill
\begin{minipage}[b]{.3\textwidth}
\subfloat
[]
{\label{fig:figA2}\includegraphics[width=\textwidth,height=5cm]{example-image-a}}
\end{minipage}\hfill
\begin{minipage}[b][\ht\measurebox][s]{.3\textwidth}
\centering
\subfloat
[]
{\label{fig:figB}\includegraphics[width=\textwidth,height=2cm]{example-image-a}}
\vfill
\subfloat
[]
{\label{fig:figC}\includegraphics[width=\textwidth,height=2cm]{example-image-a}}
\end{minipage}
\caption{my caption. (a) is .... (b) is .... (c) is ....}
\label{fig:Test}
\end{figure}
\end{document}