![如何在 LaTex 中的图形之间画一些线](https://linux22.com/image/299692/%E5%A6%82%E4%BD%95%E5%9C%A8%20LaTex%20%E4%B8%AD%E7%9A%84%E5%9B%BE%E5%BD%A2%E4%B9%8B%E9%97%B4%E7%94%BB%E4%B8%80%E4%BA%9B%E7%BA%BF.png)
我想画下图。我该怎么做?在图形之间画一些线条,你能给我这些线条上色吗?
图中部分颜色线条,如下图:
答案1
可能是这样的:
\documentclass{article}
\usepackage{colortbl}
\usepackage{arydshln,graphicx,xcolor,array}
\begin{document}
\arrayrulecolor{magenta}%
\setlength{\arrayrulewidth}{1pt}%
\begin{tabular}{c;{2pt/2pt}c|}
\includegraphics[width=3cm]{example-image-a} & \includegraphics[width=3cm]{example-image-b}
\end{tabular}
\arrayrulecolor{blue}%
\setlength{\arrayrulewidth}{1pt}%
\begin{tabular}{c;{2pt/2pt}c}
\includegraphics[width=3cm]{example-image-a} & \includegraphics[width=3cm]{example-image-b}
\end{tabular}
\end{document}
如果您不介意使用tikz
,您可以使用matrix
的库tikz
并以任何您喜欢的方式绘制线条。这种方法用途广泛。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (a)[row sep=0mm, column sep=0mm, inner sep=1mm, matrix of nodes] at (0,0) {
\includegraphics[width=3cm]{example-image-a} &
\includegraphics[width=3cm]{example-image-b} &
\includegraphics[width=3cm]{example-image-c}\\
\includegraphics[width=3cm]{example-image-a} &
\includegraphics[width=3cm]{example-image-b} &
\includegraphics[width=3cm]{example-image-c}\\\\
};
%
\draw[thick,red] (a-1-1.north east) -- (a-2-1.south east);
\draw[thick,densely dashed,blue] (a-1-2.north east) -- (a-2-2.south east);
\end{tikzpicture}
\end{document}