我想添加一个标签,该标签位于另一个标签之后。例如,我有:
\documentclass[10pt]{beamer}
\usepackage{tkz-graph}
\GraphInit[vstyle = Shade]
\tikzset{
LabelStyle/.style = { rectangle, rounded corners, draw,
minimum width = 2em, fill = yellow!50,
text = red, font = \bfseries },
VertexStyle/.append style = { inner sep=5pt,
font = \Large\bfseries},
EdgeStyle/.append style = {->, bend left} }
\title{test}
\begin{document}
\begin{frame}{graph}
\begin{tikzpicture}
\SetGraphUnit{4}
\Vertex{A}
\EA(A){B}
\Edge[label = first](A)(B)
\Edge[label = ok](B)(A)
\end{tikzpicture}
\end{frame}
\end{document}
我希望在同一边缘上的“第一个”标签之后有另一个“第二个”标签。
答案1
采用纯 Ti钾Z,但“导入” 的样式tkz-graph
。您仍然可以tkz-graph
在文档的其余部分使用。最重要的是,在这张特定的图片中(我不使用tkz-graph
),我建议不要使用全局选项(EdgeStyle
、LabelStyle
等)以避免冲突。我改用labelonpath
或myvertex
。
\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\tikzset{
labelonpath/.style = { rectangle, rounded corners, draw,
minimum width = 2em, fill = yellow!50,
text = red, font = \bfseries },
myvertex/.style = {circle,inner sep=5pt,font = \Large\bfseries,draw,ball color=orange},
}
\begin{document}
\begin{tikzpicture}
\sffamily
\node[myvertex] (a) {A};
\node[myvertex,right=5cm of a] (b) {B};
\draw[double=orange,double distance=1pt,line width=0.8pt,color=black,->,bend left] (a) to node[pos=.3,sloped,labelonpath] {First} node[pos=.7,sloped,labelonpath] {Second} (b);
\draw[double=orange,double distance=1pt,line width=0.8pt,color=black,->,bend left] (b) to node[midway,sloped,labelonpath] {Okay} (a);
\end{tikzpicture}
\end{document}