我正在尝试创建马尔可夫链。在第一张屏幕截图中你可以看到我现在得到的结果。箭头与第一行中的第二个椭圆相交,这太可怕了。
我想通过改变所有这些箭头的起始位置来解决这个问题。我想要一些像图片上显示的东西。但在自动机中,所有箭头都从状态中心移动,我担心这是不可能的。
我的努力毫无用处。对我没什么帮助。如果重复的话,抱歉。
我的希望:
梅威瑟:
%document information
\documentclass[a5paper,openany,9pt]{extbook} %главы начинаются с любой страницы
\usepackage{tikz}
\begin{document}
\usetikzlibrary{shapes,shapes.geometric,arrows,fit,calc,positioning,automata,}
\begin{center}
\begin{tikzpicture}
\tikzset{elliptic state/.style={draw,ellipse}}
\node[elliptic state] (20) {\footnotesize i-1,0};
\node[elliptic state, right=of 20] (21) {\footnotesize i-1,1};
\node[elliptic state,below=of 20] (30) {\footnotesize i,0};
\node[elliptic state,right=of 30] (31) {\footnotesize i,1};
\node[elliptic state,right=of 31] (32) {\footnotesize i,2};
\node[elliptic state,right=of 32,draw=none] (33) {\vphantom{{\vphantom{\footnotesize i-1,0}}}\ldots};
\node[elliptic state,right=of 33] (34) {\footnotesize i,$W_i-2$};
\node[elliptic state,right=of 34] (35) {\footnotesize i,$W_i-1$};
\draw[
>=latex,
% every node/.style={above,midway},% either
auto=right, % or
every loop,
]
(21) edge node {1} (20)
(20) edge[bend right=-5] node[pos=0.8, sloped, above] {$p/W_i$} (35)
(20) edge node[pos=0.75, sloped, above] {$p/W_i$} (34)
(20) edge node[pos=0.75, sloped, above] {$p/W_i$} (32)
(20) edge node[pos=0.75, sloped, above] {$p/W_i$} (31)
(20) edge node[pos=0.5, sloped, above] {$p/W_i$} (30);
\end{tikzpicture}
\end{center}
\end{document}
答案1
您可以使用节点的特定锚点20
,例如
\draw[
>=latex,
% every node/.style={above,midway},% either
auto=right, % or
every loop,
]
(21) edge node {1} (20)
(20.south) edge[bend right=-5] node[pos=0.8, sloped, above] {$p/W_i$} (35)
(20.south) edge node[pos=0.75, sloped, above] {$p/W_i$} (34)
(20.south) edge node[pos=0.75, sloped, above] {$p/W_i$} (32)
(20.south) edge node[pos=0.75, sloped, above] {$p/W_i$} (31)
(20.south) edge node[pos=0.5, sloped, above] {$p/W_i$} (30);
这样,所有edge
s 都将从south
锚点(即节点的底部)开始。您还可以使用角度代替命名锚点,例如20.290
。