我有 3 个图,我想将它们作为一个图插入到我的文档中。我想按以下顺序排列它们
我使用以下代码
\documentclass[a4paper,fleqn,10pt,oneside]{book}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\pagestyle{plain}
\begin{figure}
\centering
\subfloat[aaa]{
\includegraphics[width=6cm]{Fig.jpg}
\subfloat[bbb]{
\includegraphics[width=6cm]{Fig.jpg}
\hfill
\includegraphics[width=6cm]{Fig.jpg}
}
}
\end{figure}
\end{document}
有人有什么建议吗?
答案1
像这样:
使用tabular
表格很简单:
\documentclass[a4paper,fleqn,10pt,oneside]{book}
\usepackage[demo, % in real document remove option "demo"
export]{adjustbox} % it also call "graphicx",
% enable to move baseline to vertical center of image
\usepackage{subfig}
\usepackage{multirow}
\begin{document}
\pagestyle{plain}
\begin{figure}
\centering
\setkeys{Gin}{width=\linewidth}
\begin{tabular}{ *{2}{p{6cm}} }
\multirow{2}{=}{
\subfloat[aaa]{\includegraphics[valign=c]{Fig.jpg}}
}
& \subfloat[bbb]{\includegraphics[valign=c]{Fig.jpg}}
\subfloat[ccc]{\includegraphics[valign=c]{Fig.jpg}}
\end{tabular}
\caption{My figure}
\label{fig:?}
\end{figure}
\end{document}
答案2
可以将两幅图像放入一张中\subfloat
,但您需要一个\parbox
、minipage
或者(更好)varwidth
。
请注意,的默认基线\subfloat
是图像的基线(底部),因此您需要\raisebox
将其居中。
\documentclass[a4paper,fleqn,10pt,oneside]{book}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\pagestyle{plain}
\begin{figure}
\centering
\raisebox{\dimexpr 0.5\depth-0.5\height}{%
\subfloat[aaa]{\includegraphics[width=5cm]{example-image-a}}%
}\hfill
\subfloat[bbb]{\parbox{6cm}{%
\includegraphics[width=6cm]{example-image-b}
\par
\includegraphics[width=6cm]{example-image-c}%
}%
}\llap{\rule{\textwidth}{1pt}}% show baseline, debug only
\end{figure}
\end{document}