箭头标记

箭头标记

我将如何标记下面的箭头:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{petri}
\tikzset{state/.style={circle,draw=gray,inner sep=0pt,minimum size=7mm,label=center:$#1$,name=#1},
redarrow/.style={->, red, fill=none,>=stealth},bluearrow/.style={->, blue, fill=none,>=stealth},  
redline/.style={-,red,fill=none},blueline/.style={-,blue,fill=none}}

\begin{document}

\begin{tikzpicture}
\node[state=a^{-1}]{};
\node[state=1,right=of a{-1}]{};
\node[state=b,above=of 1]{};
\node[state=a,right=of 1]{};
\node[state=ab^{-1},above=of a]{};
\node[state=aa,right=of a]{};
\node[state=ac,below=of a]{};
\node[state=acc,right=of ac]{};
\node[state=aca,below =of ac]{};
\draw[redarrow](a^{-1})--(1);
\draw[redarrow](1)--(b);
\draw[redarrow](1)--(a);
\draw[redarrow](ab^{-1})--(a);
\draw[redarrow](a)--(aa);
\draw[redarrow](a)--(ac);
\draw[redarrow](ac)--(acc);
\draw[redarrow](ac)--(aca);
\end{tikzpicture}

\end{document}  

答案1

参见下文,第一个连接标记为 1a

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{petri}
\tikzset{state/.style={circle,draw=gray,inner sep=0pt,minimum size=7mm,label=center:$#1$,name=#1},
redarrow/.style={->, red, fill=none,>=stealth},bluearrow/.style={->, blue, fill=none,>=stealth},  
redline/.style={-,red,fill=none},blueline/.style={-,blue,fill=none}}

\begin{document}

\begin{tikzpicture}
\node[state=a^{-1}]{};
\node[state=1,right=of a^{-1}]{};
\node[state=b,above=of 1]{};
\node[state=a,right=of 1]{};
\node[state=ab^{-1},above=of a]{};
\node[state=aa,right=of a]{};
\node[state=ac,below=of a]{};
\node[state=acc,right=of ac]{};
\node[state=aca,below =of ac]{};
\draw[redarrow](a^{-1})--(1) node[midway,above] {1a};
\draw[redarrow](1)--(b);
\draw[redarrow](1)--(a);
\draw[redarrow](ab^{-1})--(a);
\draw[redarrow](a)--(aa);
\draw[redarrow](a)--(ac);
\draw[redarrow](ac)--(acc);
\draw[redarrow](ac)--(aca);
\node[midway,above] {1a};
\end{tikzpicture}

\end{document}  

回答你的第二条评论的简单例子

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{petri}
\tikzset{state/.style={circle,draw=gray,inner sep=0pt,minimum size=7mm,label=center:$#1$,name=#1},
redarrow/.style={->, red, fill=none,>=stealth},bluearrow/.style={->, blue, fill=none,>=stealth},  
redline/.style={-,red,fill=none},blueline/.style={-,blue,fill=none}}

\begin{document}

\begin{tikzpicture}
\node[state] (nodea) {.};
\node[state] (nodeb) [right=of nodea]{.};
\draw[redarrow](nodea)--(nodeb) node[midway,above] {1a};
\end{tikzpicture}

\end{document}  

相关内容