我正在尝试生成 BEC 通道的简单图表,但指向同一点的箭头边缘看起来很奇怪。有人能解释一下绘制该图表的正确方法吗?
\documentclass{standalone}
\usepackage{tikz}
\usepackage{xifthen}
\usetikzlibrary{shapes,arrows,fit,calc,positioning,automata}
\usetikzlibrary{plotmarks}
\usetikzlibrary{calc}
\begin{document}
\tikzset{addition/.style={draw,circle,append after command={
[shorten >=\pgflinewidth, shorten <=\pgflinewidth,]
(\tikzlastnode.north) edge (\tikzlastnode.south)
(\tikzlastnode.east) edge (\tikzlastnode.west)
}
}
}
\tikzset{line/.style={draw, -latex',shorten <=1bp,shorten >=1bp}}
\tikzstyle{block}=[draw, rectangle, minimum size=2em]
\begin{tikzpicture}[auto]
\node[anchor=south west] at (-0.4,-0.2) {$1$};
\node[anchor=south west] at (-0.4,2-0.2) {$0$};
\node[anchor=south west] at (3+0.1,-0.2) {$1$};
\node[anchor=south west] at (3+0.1,2-0.2) {$0$};
\node[anchor=south west] at (3,1-0.25) {$?$};
\draw[->] (0,0) --node [below,midway,font=\small] {$1-\epsilon$} (3,0) ;
\draw[->] (0,2) --node [above,midway,font=\small] {$1-\epsilon$} (3,2) ;
\draw[->] (0,0) --node [above,midway,font=\small] {$\epsilon$} (3,1) ;
\draw[->] (0,2) --node [below,midway,font=\small] {$\epsilon$} (3,1) ;
\end{tikzpicture}
\end{document}
答案1
Tikz 3.0 引入的库arrows.meta
允许您使用三角形箭头。这里,带有20:5pt 3
确定角度和长度的参数。
\begin{tikzpicture}[auto,>={Triangle[angle=20:5pt 3]}]
\documentclass{standalone}
\usepackage{tikz}
\usepackage{xifthen}
\usetikzlibrary{shapes,arrows.meta,fit,calc,positioning,automata}
\usetikzlibrary{plotmarks}
\usetikzlibrary{calc}
\begin{document}
\tikzset{addition/.style={draw,circle,append after command={
[shorten >=\pgflinewidth, shorten <=\pgflinewidth,]
(\tikzlastnode.north) edge (\tikzlastnode.south)
(\tikzlastnode.east) edge (\tikzlastnode.west)
}
}
}
%\tikzset{line/.style={draw, -latex',shorten <=1bp,shorten >=1bp}}
\tikzstyle{block}=[draw, rectangle, minimum size=2em]
\begin{tikzpicture}[auto,>={Triangle[angle=20:5pt 3]}]
\node[anchor=south west] at (-0.4,-0.2) {$1$};
\node[anchor=south west] at (-0.4,2-0.2) {$0$};
\node[anchor=south west] at (3+0.1,-0.2) {$1$};
\node[anchor=south west] at (3+0.1,2-0.2) {$0$};
\node[anchor=south west] at (3,1-0.25) {$?$};
\draw[->] (0,0) --node [below,midway,font=\small] {$1-\epsilon$} (3,0) ;
\draw[->] (0,2) --node [above,midway,font=\small] {$1-\epsilon$} (3,2) ;
\draw[->] (0,0) --node [above,midway,font=\small] {$\epsilon$} (3,1) ;
\draw[->] (0,2) --node [below,midway,font=\small] {$\epsilon$} (3,1) ;
\end{tikzpicture}
\end{document}