一张图片胜过千言万语 ...
如您所见,重量标题被拉入了线条中。有人知道如何修复它吗?
这是我的代码:
\begin{figure}[h]
\centering
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,thick,main node/.style={circle,fill=white!20,draw,font=\sffamily\Large\bfseries}]
\node[initial,main node] (1) {1};
\node[main node] (2) [right of=1] {2};
\node[main node] (3) [right of=2] {3};
\path[every node/.style={font=\sffamily\small}]
(1) edge node [right] {0.5} (2)
(2) edge node [right] {0.8} (3);
\end{tikzpicture}
\caption{Beispiel Pfad} \label{fig:begriffe_4}
\end{figure}
谢谢你的帮助!
答案1
根据评论中的信息回答。
对于edge node
s,指定将right
标签强制放置在连接箭头中点的右侧,该中点位于线本身上。
将两个都更改right
为可解决问题。auto
edge node
代码
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{automata}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[
->,
>=stealth,
shorten >=1pt,
auto,
node distance=3cm,
thick,
main node/.style={circle,fill=white!20,draw,font=\sffamily\Large\bfseries,},
]
\node[initial,main node] (1) {1};
\node[main node] (2) [right of=1] {2};
\node[main node] (3) [right of=2] {3};
\path[every node/.style={font=\sffamily\small}]
(1) edge node [auto] {0.5} (2)
(2) edge node [auto] {0.8} (3);
\end{tikzpicture}
\caption{Beispiel Pfad} \label{fig:begriffe_4}
\end{figure}
\end{document}