Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

For some reason, I can not have large labels on the edge. I get an overflow. Any idea? If I replace $\{a_1, a_2\}$ with one character it works.

\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}

The error that I get is:

! 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.
share|improve this question
3  
In a very simple manner, just add braces around your label: {$\{a_1, a_2\}$} will work. –  Claudio Fiandrino May 20 '12 at 9:18
1  
Wow! So simple. It worked! Could you point me to docs in order to avoid similar questions in the future? The most relevant page that I have found is graphtheoryinlatex.blogspot.com/2009/08/… –  Dimitris Leventeas May 20 '12 at 10:33
    
@ClaudioFiandrino You should add your comment as an answer. –  Alan Munn May 20 '12 at 14:27
    
@AlanMunn: do you think so? In an answer, I would like to motivate in detail the reason behind which just adding braces the error disappear. I think of knowing the motivation (token expansion?), but I believe of not being really able to explain clearly. –  Claudio Fiandrino May 20 '12 at 14:33
1  
The reason is the comma. Without the braces, the comma is seen as a key-separator, so the label gets $\{a_1 as its argument, which causes all sorts of problems. –  Loop Space May 20 '12 at 20:52

1 Answer 1

up vote 7 down vote accepted

The error you got is due to the fact that the term $\{a_1, a_2\}$ should be placed inside braces.

Indeed:

\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}

will give you:

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.