我创建了一个 3x3 的数字矩阵,如下所示:
\begin{figure}
\begin{tabular}{ccc}
\includegraphics[scale=0.2]{my_figure} &
\includegraphics[scale=0.2]{my_figure} &
\includegraphics[scale=0.2]{my_figure} \\
\includegraphics[scale=0.2]{my_figure} &
\includegraphics[scale=0.2]{my_figure} &
\includegraphics[scale=0.2]{my_figure} \\
\includegraphics[scale=0.2]{my_figure} &
\includegraphics[scale=0.2]{my_figure} &
\includegraphics[scale=0.2]{my_figure} \\
\end{tabular}
\caption{Many figures}
\end{figure}
我怎样才能减少它们之间的空间或者不留空间?
答案1
正如 LaRiFaRi 所建议的,\newcommand*{\arraystretch}{0}
抑制行之间和@{}
列之间的空间。
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\renewcommand*{\arraystretch}{0}
\begin{tabular}{*{3}{@{}c}@{}}
\includegraphics[scale=0.2]{example-image} &
\includegraphics[scale=0.2]{example-image} &
\includegraphics[scale=0.2]{example-image} \\
\includegraphics[scale=0.2]{example-image} &
\includegraphics[scale=0.2]{example-image} &
\includegraphics[scale=0.2]{example-image} \\
\includegraphics[scale=0.2]{example-image} &
\includegraphics[scale=0.2]{example-image} &
\includegraphics[scale=0.2]{example-image}
\end{tabular}
\caption{Many figures}
\end{figure}
\end{document}
第二种选择:与raster
来自的图书馆tcolorbox
raster
库允许您以规则的方式排列多个框。默认情况下,每行占据整个行宽并tcolorbox
计算内部 tcolorboxes 的大小。
因为环境需要,所以\includegraphics
您必须使用。可以使用选项:、颜色等,也可以用 指示命令的特殊选项。您还可以决定行和列之间的距离。\tcbincludegraphics
raster
tcolorboxes
tcolorbox
title
\includegrahics
graphics={...}
这个特殊案例的代码可能是:
\documentclass{article}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{figure}
\centering
\begin{tcbraster}[raster columns=3, raster equal height,
raster column skip=0pt, raster row skip=0pt, raster every box/.style={blank}]
\tcbincludegraphics{example-image}
\tcbincludegraphics{example-image}
\tcbincludegraphics{example-image}
\tcbincludegraphics{example-image}
\tcbincludegraphics{example-image}
\tcbincludegraphics{example-image}
\tcbincludegraphics{example-image}
\tcbincludegraphics{example-image}
\tcbincludegraphics{example-image}
\end{tcbraster}
\caption{Many figures}
\end{figure}
\end{document}