以前的 问题关于网格中的图像有标题,并且水平和垂直距离不相等。
我想制作这个网格,没有文本和背景。它取自这里。
问题
有人知道如何制作这种 24x24 图像网格吗?
更新
如果我执行以下操作,则无法在水平和垂直方向上获得相同的距离......
\documentclass{article}
\usepackage{graphicx}
\captionsetup[subfigure]{justification=raggedright}
\begin{document}
\begin{figure}
\centering
{\includegraphics[width=.18\textwidth,height=2cm]{example-image-a}}\hfill
{\includegraphics[width=.18\textwidth,height=2cm]{example-image-a}}\hfill
{\includegraphics[width=.18\textwidth,height=2cm]{example-image-a}}\hfill
{\includegraphics[width=.18\textwidth,height=2cm]{example-image-a}}\hfill
{\includegraphics[width=.18\textwidth,height=2cm]{example-image-a}}\\
{\includegraphics[width=.18\textwidth,height=2cm]{example-image-b}}\hfill
{\includegraphics[width=.18\textwidth,height=2cm]{example-image-b}}\hfill
{\includegraphics[width=.18\textwidth,height=2cm]{example-image-b}}\hfill
{\includegraphics[width=.18\textwidth,height=2cm]{example-image-b}}\hfill
{\includegraphics[width=.18\textwidth,height=2cm]{example-image-b}}\\
\end{figure}
\end{document}
答案1
如果您的图像的命名方案是,image-<col>-<row>.png
您可以通过嵌套循环使用 tikz 创建图像网格foreach
。
\documentclass{article}
\usepackage[hmargin=1cm]{geometry}
\usepackage{tikz}
\begin{document}
\pagestyle{empty}
\begin{figure}
\begin{tikzpicture}[x=\linewidth/24, y=\linewidth/24]
\foreach \i in {1,...,24} {
\foreach \j in {1,...,24} {
\node[
rounded corners = 2pt,
minimum width = \linewidth/24-3pt,
minimum height = \linewidth/24-3pt,
inner sep = 0pt,
fill = black,
font = \scriptsize,
text = white
] at (\i,-\j) {\i x\j%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \includegraphics[width=\linewidth/24-5pt]{image-\i-\j.png}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
};
}
}
\end{tikzpicture}
\caption{Grid of images}
\end{figure}
\end{document}