这可以创建一个漂亮的矩阵,但不是选择宽度,而是可以通过在一幅图像中设置宽度百分比来自动使其缩放到整条线的宽度,还是必须width=0.25\textwidth
在每一行中使用?
\begin{figure}[h]
\begin{center}$
\begin{array}{cccc}
\includegraphics[width=1in]{image1} &
\includegraphics[width=1in]{image2} \\
\includegraphics[width=1in]{image3} &
\includegraphics[width=1in]{image4}
\end{array}$
\end{center}
\caption{my caption}
\end{figure}
答案1
是的,可以用 来完成\resizebox
。
我还使用了一个技巧,使图形之间的空间在水平和垂直方向上相同。
\documentclass{article}
\usepackage{graphicx,booktabs}
\usepackage{lipsum}
\begin{document}
\lipsum[3]
\begin{figure}[htp] % not just h
\centering % not center
\resizebox{\textwidth}{!}{%
\renewcommand{\arraystretch}{0}%
\begin{tabular}{@{}c@{\hspace{3pt}}c@{}}
\includegraphics[width=1in]{example-image.pdf} &
\includegraphics[width=1in]{example-image-a.pdf} \\
\addlinespace[3pt]
\includegraphics[width=1in]{example-image-b.pdf} &
\includegraphics[width=1in]{example-image-c.pdf}
\end{tabular}% <-- don't forget
}
\caption{my caption}
\end{figure}
\lipsum[4]
\end{document}
对于 3 x 3 的排列来说,情况类似。
\documentclass{article}
\usepackage{graphicx,booktabs}
\usepackage{lipsum}
\begin{document}
\lipsum[3]
\begin{figure}[htp] % not just h
\centering % not center
\resizebox{\textwidth}{!}{%
\renewcommand{\arraystretch}{0}%
\begin{tabular}{@{}c@{\hspace{3pt}}c@{\hspace{3pt}}c@{}}
\includegraphics[width=1in]{example-image.pdf} &
\includegraphics[width=1in]{example-image.pdf} &
\includegraphics[width=1in]{example-image-a.pdf} \\
\addlinespace[3pt]
\includegraphics[width=1in]{example-image-b.pdf} &
\includegraphics[width=1in]{example-image-b.pdf} &
\includegraphics[width=1in]{example-image-c.pdf} \\
\addlinespace[3pt]
\includegraphics[width=1in]{example-image-b.pdf} &
\includegraphics[width=1in]{example-image-b.pdf} &
\includegraphics[width=1in]{example-image-c.pdf}
\end{tabular}% <-- don't forget
}
\caption{my caption}
\end{figure}
\lipsum[4]
\end{document}