I have been using tikz-graph to draw graphs representing two-part protocols. Now I'd like to add comments to some nodes of the graph (multiline text, to the side of the vertex). I'm not sure how to do that. I have been adding labels to vertices and putting them outside with LabelOut, but then I can't do multiline text. This is a toy/minimalistic example:





  \SetUpEdge[lw = 1.5pt,
             labelstyle = {sloped}]
  \tikzset{node distance = 6 cm}

  % Two top symbols, displayed as two invisible
  % vertices with visible labels:
  {\tikzset{VertexStyle/.style = {color=white,text=black}}
    \Vertex[position={right of=P}, L={\beta}]{X}}

  \tikzset{node distance = 1 cm}
   %%% HERE: in the next line the label can't be split in two lines...
   \Vertex[LabelOut,Lpos=180,position={below of=P}, L={the protocol starts here}]{X1}
  \tikzset{node distance = 2 cm}
  \tikzset{node distance = 6 cm}

  \Edge[label={220 ESMTP}](X1)(A1)
  \Edge[label={EHLO client-host}](A1)(X2)
  \Edge[label={250 DSN}](X2)(A2)
  \Edge[label={mail from: email-address}](A2)(X3)

What wold be the usual, easy way to do what I'm trying to do?

1 Answer 1


I'm the author of this package. The good news are the new versions of tkz-graph and tkz-berge will be on the ctan servers this week (i'm working on the docs actually), the bad news are that I modified some macros. I'm not sure to understand exactly what you want but an answer is that you can put TikZ's code inside you code.

Vertices are nodes so you can add multiple labels if you want with the option label= , if you want adding a text you can use the option text width

something like :

  \node[text width=2cm,left=1cm] (X1){the protocol starts here};

Another possibility :

{  \SetVertexNoLabel   
     L= {the protocol starts here},
     style={text width=2cm}](A){B}

But there are other ways to do this. You can use label. In your code you used "position" , it's not very fine because it's a problem to use "scale".

In 12 hours, I will upload the new version of tkz-graph. I the new version node distanceis obsolete, now I added an option unit and a macro \tkzGraphUnit=6 instead of `\tikzset{node distance=6cm}.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .