子图的行和列之间没有空格

子图的行和列之间没有空格

我创建了一个 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您必须使用。可以使用选项:、颜色等,也可以用 指示命令的特殊选项。您还可以决定行和列之间的距离。\tcbincludegraphicsrastertcolorboxestcolorboxtitle\includegrahicsgraphics={...}

这个特殊案例的代码可能是:

\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}

在此处输入图片描述

相关内容