我如何在论文中完成这个效果,4行图形和8个8位图形,特别是整个图形中间有一条红线。请问你能帮我完成吗?
答案1
这是一种可能的解决方案,其中matrix of node
使用 tikzlibrary 矩阵并用名为 table 的名称进行定义。
includegraphics 选项中的 [width=xx 和 height=xx] 适用于图像的大小。
row sep=xx 和 col sep=xx 用于行和列分隔。
代码
\documentclass{article}
\usepackage{tikz,lscape,amsmath}
\usepackage[margin=1cm]{geometry}
\usetikzlibrary{matrix}
\begin{document}
\def\arraystretch{0.5}
\tikzset{
table/.style={
matrix of nodes,
row sep=-\pgflinewidth, % <-- This adjusts the row separation
column sep=\pgflinewidth,% <-- This adjusts the column separation
nodes={rectangle,draw=none, text width=2cm, align=center,inner sep=2pt,outer sep=0pt},
% nodes in empty cells
}
}
\begin{tikzpicture}
\matrix (mat) [table]
{
\includegraphics[width=2cm]{example-image-A} & \includegraphics[width=2cm]{example-image-A} & \includegraphics[width=2cm]{example-image-A} & \includegraphics[width=2cm]{example-image-A} & \includegraphics[width=2cm]{example-image-B}
& \includegraphics[width=2cm]{example-image-B} & \includegraphics[width=2cm]{example-image-B} & \includegraphics[width=2cm]{example-image-B}\\
\includegraphics[width=2cm]{example-image-A} & \includegraphics[width=2cm]{example-image-A} &\includegraphics[width=2cm]{example-image-A}&\includegraphics[width=2cm]{example-image-A} &\includegraphics[width=2cm]{example-image-B} & \includegraphics[width=2cm]{example-image-B} & \includegraphics[width=2cm]{example-image-B}& \includegraphics[width=2cm]{example-image-B}\\
\includegraphics[width=2cm]{example-image-A} & \includegraphics[width=2cm]{example-image-A} &\includegraphics[width=2cm]{example-image-A}&\includegraphics[width=2cm]{example-image-A} &\includegraphics[width=2cm]{example-image-B} & \includegraphics[width=2cm]{example-image-B} & \includegraphics[width=2cm]{example-image-B}& \includegraphics[width=2cm]{example-image-B}\\
\includegraphics[width=2cm,height=2.3cm]{example-image-A} & \includegraphics[width=2cm,height=2.3cm]{example-image-A} &\includegraphics[width=2cm,height=2.3cm]{example-image-A}&\includegraphics[width=2cm,height=2.3cm]{example-image-A} &\includegraphics[width=2cm,height=2.3cm]{example-image-B}& \includegraphics[width=2cm,height=2.3cm]{example-image-B} & \includegraphics[width=2cm,height=2.3cm]{example-image-B} & \includegraphics[width=2cm,height=2.3cm]{example-image-B}\\
};
\draw[red,dashed,very thick](mat-1-4.north east)--(mat-4-4.south east); %<-- This is for the red line in the middle
\end{tikzpicture}
\end{document}