边缘上的标签

边缘上的标签

由于某种原因,我无法在边缘放置大标签。我得到溢出。有什么想法吗?如果我$\{a_1, a_2\}$用一个字符替换它就可以了。

\begin{figure}[b]
   \centering
    \begin{tikzpicture}
     \SetUpEdge[lw         = 1pt,
                color      = black,
                labelcolor = white]
      \SetVertexNoLabel
      \GraphInit[vstyle=Normal] 
      \SetGraphUnit{3}
      \tikzset{VertexStyle/.append  style={fill}}
      \Vertex{s}
      \NO(s){a}  \EA(a){b} \SO(b){c}
      \Edge[label=$\{a_1, a_2\}$](s)(a)
      \Edge[label=$b$](a)(b)
      \Edge[label=$c$](b)(c)
    \end{tikzpicture}
  \caption{Graph $g_1$ \label{fig:graph_1}}
\end{figure}

我收到的错误是:

! TeX capacity exceeded, sorry [input stack size=5000].
\curr@fontshape ->\f@encoding
/\f@family /\f@series /\f@shape
l.38 \Edge[label=$\{a_1, a_2\}$](s)(a)
If you really absolutely need more capacity,
you can ask a wizard to enlarge me.

答案1

您收到的错误是由于该术语$\{a_1, a_2\}$应放在括号内。

的确:

\documentclass{article}
\usepackage{tkz-graph}
\begin{document}
\begin{figure}[b]
   \centering
    \begin{tikzpicture}
     \SetUpEdge[lw         = 1pt,
                color      = black,
                labelcolor = white]
      \SetVertexNoLabel
      \GraphInit[vstyle=Normal] 
      \SetGraphUnit{3}
      \tikzset{VertexStyle/.append  style={fill}}
      \Vertex{s}
      \NO(s){a}  \EA(a){b} \SO(b){c}
      \Edge[label={$\{a_1, a_2\}$}](s)(a) % <= notice the modification
      \Edge[label=$b$](a)(b)
      \Edge[label=$c$](b)(c)
    \end{tikzpicture}
  \caption{Graph $g_1$ \label{fig:graph_1}}
\end{figure}
\end{document}

会给你:

在此处输入图片描述

相关内容