\newinst[3]{nodeb}{Node B}
\mess{ue}{RRC Connection Request}{rnc}
\mess{rnc}{Radio Link Setup Request}{nodeb}
\mess{nodeb}{Radio Link Setup Response}{rnc}
\mess{rnc}{Establish Request}{nodeb}
\mess{nodeb}{Establish Confirm}{rnc}
\mess{rnc}{RRC Connection Setup}{ue}
\mess{nodeb}{Synchronization Indication}{rnc}
\filldraw[fill=black!30] ($(RRC Connection Setup to)+(0,-.3)$) rectangle ($(Synchronization Indication from) +(0,.3)$)
 node[midway] {L1 Synchronization};
\mess{ue}{RRC Connection Setup Complete}{rnc}


enter image description here

Is it possible assign a different color to pairs of arrows and put a legend with the colors for each protocol layer?


As pgf-umlsd uses a tikzpicture environment for sequence diagrams, you can simply set the TikZ key draw=<color> for the scope of the message in question:

  \mess[<delay>]{<sender>}{<message content>}{<receiver>}

Or if you want to define a convenient macro, you can put this snippet in your preamble:


which gives you a new macro for messages with coloured arrows in the form \colmess{<color>}[<delay>]{<sender>}{<message content>}{<receiver>}.


Package pgf-umlsd does not allow to specify the color (nor any other option) of the "messages" (the arrows). However, you can enclose a message or a group of messages in a tikz scope and change the color inside the scope, for example:

  \mess{rnc}{Radio Link Setup Request}{nodeb}
  \mess{nodeb}{Radio Link Setup Response}{rnc}

If you plan to use this construct several times, perhaps a better idea is to define your own \colormess to draw coloured messages, using the same trick:


And then use it like this:

\colormess{red}{rnc}{Radio Link Setup Request}{nodeb}

Even a better option would be to create a \mymess based on the code of the original \mess, but accepting also any tikz style to be passed to the draw command:

  (#3)+(0,-\theseqlevel*\unitfactor-0.7*\unitfactor) node (mess from) {};
  (#5)+(0,-\theseqlevel*\unitfactor-0.7*\unitfactor) node (mess to) {};
  \draw[->,>=angle 60,#2] (mess from) -- (mess to) node[midway, above]

  \node (#4 from) at (mess from) {};
  \node (#4 to) at (mess to) {};

Which can be used like:

\mymess{red, dashed, -latex}{rnc}{Radio Link Setup Request}{nodeb}
  • Hi JLDiaz, the text above the arrow is possible to take the same color? for example \colormess{red}{rnc}{Radio Link Setup Request}{nodeb} the arrow red and the text "Radio Link Setup Request" red too – user21431 Mar 22 '13 at 8:16
  • 1
    @user21431 That is the default behaviour, isn't? I tried with last command \mymess and worked as you ask. – JLDiaz Mar 22 '13 at 9:13
  • I'm sorry, it's true jLDiaz, the behavior of the command mymess do what I indicated. I was checking the command scope, that was just for the arrows. Than you very much for the help! – user21431 Mar 22 '13 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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