如何在tikz latex中的顶点中添加下标?
我面临的问题是,我可以为每个顶点定义标签,但当我移动到顶点的南部或东部时,这只会创建一个新的顶点如何在tikz latex中的顶点中添加下标?,latex,tikz,Latex,Tikz,我面临的问题是,我可以为每个顶点定义标签,但当我移动到顶点的南部或东部时,这只会创建一个新的顶点 \begin{figure} \tikzstyle{VertexStyle} = [shape = ellipse,minimum width= 6ex,draw] \tikzstyle{EdgeStyle} = [->,>=stealth'] \begin{tikzpicture}[scale=0.5, auto=left,every node/.style={circ
\begin{figure}
\tikzstyle{VertexStyle} = [shape = ellipse,minimum width= 6ex,draw]
\tikzstyle{EdgeStyle} = [->,>=stealth']
\begin{tikzpicture}[scale=0.5, auto=left,every node/.style={circle}]
\SetGraphUnit{4}
\Vertex[L=$x_{1}$]{x};
\Vertex[L=$h_{1}$]{h};
\EA(x){h}
\Edges(x)(h)
\end{tikzpicture}
\end{figure}
下面是我得到的结果:
对于您的代码,逐行执行以下操作:
\Vertex[L=$x_{1}$]{x};
这将创建一个名为x
和L
abel$x_1$
的顶点(在原点)
\Vertex[L=$h_{1}$]{h};
\EA(x){h}
这也会创建一个名为h
的顶点(在原点),该顶点带有L
abel$h\u 1$
\Vertex[L=$h_{1}$]{h};
\EA(x){h}
在这里,您向x
的EA
st添加一个顶点h
。标签名是h
,标签名也是
\Edges(x)(h)
现在您尝试在x
和h
之间添加一条边
\SetVertexMath
\Edges(h,h_2)
也许这是您可能感兴趣的事情:
\Vertex[x = 1cm, L = $x_1$]{x};
将一个名为x
的顶点与L
abel$x_1$
(1cm
位于原点以东,仅因如此)
用L
abel$h\u 1$
放置一个顶点h
(4cm
位于原点以东,这样它就不会位于/靠近x
)
在节点x
和h
之间绘制一条边
\SetVertexMath
\Edges(h,h_2)
节点名称和标签将包括数学内容
\EA(h){h_2}
为h
的EA
st创建一个新顶点h2
\SetVertexMath
\Edges(h,h_2)
在h
和h_2
之间绘制另一条边
下面是一个完整的最小示例: