我刚刚开始使用 Latex,我想知道是否可以制作如下所示的图形。
看来我必须先从表格之类的东西开始,然后再以某种方式添加箭头。任何能制作类似东西的指示都将不胜感激。
答案1
一种可能性是使用TikZ
;放置一些节点然后绘制箭头:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[
mydot/.style={
circle,
fill,
inner sep=2pt
},
>=latex,
shorten >= 3pt,
shorten <= 3pt
]
\node[mydot,label={left:1}] (a1) {};
\node[mydot,below=of a1,label={left:2}] (a2) {};
\node[mydot,below=of a2,label={left:3}] (a3) {};
\node[mydot,below=of a3,label={left:4}] (a4) {};
\node[mydot,right=2cm of a1,label={right:1}] (b1) {};
\node[mydot,below=of b1,label={right:2}] (b2) {};
\node[mydot,below=of b2,label={right:3}] (b3) {};
\node[mydot,below=of b3,label={right:4}] (b4) {};
\path[->] (a1) edge (b1)
edge (b2)
edge (b3)
edge (b4);
\path[->] (a2) edge (b3)
edge (b4);
\path[->] (a3) edge (b1)
edge (b3);
\path[->] (a4) edge (b2)
edge (b4);
\end{tikzpicture}
\end{document}
使用环境的更“传统”的方法picture
:
\documentclass{article}
\begin{document}
\setlength{\unitlength}{.5in}
\begin{picture}(0,0)(3,4)
\linethickness{1pt}
\multiput(0,0)(0,1){4}{$\bullet$}
\multiput(2,0)(0,1){4}{$\bullet$}
\put(-0.2,0){4}
\put(-0.2,1){3}
\put(-0.2,2){2}
\put(-0.2,3){1}
\put(2.2,0){4}
\put(2.2,1){3}
\put(2.2,2){2}
\put(2.2,3){1}
\put(0.2,0.1){\vector(2,1){1.8}}
\put(0.2,0.1){\vector(1,1){1.8}}
\put(0.2,0.1){\vector(1,0){1.8}}
\put(0.2,1.1){\vector(1,0){1.8}}
\put(0.2,2.1){\vector(2,1){1.8}}
\put(0.2,2.1){\vector(1,0){1.8}}
\put(0.2,2.1){\vector(1,-1){1.8}}
\put(0.2,3){\vector(1,-1){1.8}}
\put(0.2,3.1){\vector(1,0){1.8}}
\end{picture}
\end{document}
答案2
像往常一样,使用 PSTricks 只是为了好玩。
\documentclass[preview,border=12pt]{standalone}
\usepackage{pst-node,multido}
\begin{document}
\nointerlineskip
\begin{psmatrix}[rowsep=1,colsep=2,mnode=dot]
[name=l1] & [name=r1]\\
[name=l2] & [name=r2]\\
[name=l3] & [name=r3]\\
[name=l4] & [name=r4]
\end{psmatrix}
\multido{\i=1+1}{4}{\uput[180](l\i){\i}\uput[0](r\i){\i}}
\psset{nodesep=3pt,arrows=->}
\ncline{l1}{r1}
\ncline{l1}{r2}
\ncline{l2}{r4}
% just add your own connecting lines here
\end{document}