You can complete your diagram without leaving pgf-umlsd:

To do so, you only need to know some things about pgf-umlsd:
Macro \postlevel
increases a "unit of time" the timing of the next message, so it serves to leave a gap between "RRC Connection Setup" and "Synchronizacion indication", to insert your rectangle.
pgf-umlsd defines a pair of named nodes for each message, which you can use later to draw things relative to those nodes. They are called (<message label> from)
and (<message label> to)
, where <message label>
is the text written above the message.
You can use those named nodes to specify the corners of the shaded rectangle. I used calc
library to do so.
So, in your case, to draw the rectangle at the desired point, you have to find which messages are near the corners of the rectangle. We find that the top left corner is near the ending of message "RRC Connection Setup", and the bottom right corner is near the starting of message "Synchronization Indication", so the corners of the rectangle are:
(RRC Connection Setup to) rectangle (Synchronization Indication from)
But those would produce a rectangle too close to the messages, so we have displace a bit the y coordinate to separate it from each message. I used the following expression to separate it 0.3 units of each:
($(RRC Connection Setup to)+(0,-.3)$) rectangle ($(Synchronization Indication from) +(0,.3)$)
If you want the rectangle spanning other columns, you have to find which message endings are nearby to the desired rectangle corners. For example, for having the rectangle from "Node B" to "RNC", yo may use:
($(RR Connection Setup from)+(0,-.3)$) rectangle ($(Synchronization Indication from) +(0,.5)$)
and so on
\documentclass{article}
\usepackage[margin=12mm]{geometry}
\usepackage{hyperref}
\usepackage[underline=true]{pgf-umlsd}
\usetikzlibrary{calc}
\begin{document}
\begin{sequencediagram}
\newinst{ue}{UE}
\newinst[3]{nodeb}{Node B}
\newinst[3]{rnc}{RNC}
\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}
\postlevel
\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}
\end{sequencediagram}
\end{document}
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:
\begin{scope}[draw=<color>]
\mess[<delay>]{<sender>}{<message content>}{<receiver>}
\end{scope}
Or if you want to define a convenient macro, you can put this snippet in your preamble:
\usepackage{xargs}
\newcommandx\colmess[5][2=0]{%
\begin{scope}[draw=#1]%
\mess[#2]{#3}{#4}{#5}%
\end{scope}%
}
which gives you a new macro for messages with coloured arrows in the form \colmess{<color>}[<delay>]{<sender>}{<message content>}{<receiver>}
.
Best Answer
I think it's easy to draw some diagram like that if you start placing comments and after that use them as references to draw message interchanges.
Next code shows a minimal example. I've used
matrix
to create allcomments
andserver
andclient
labels. Of course, you don't need to use amatrix
and can place them using relative positions.The tricky part is how to align message arrows with corresponding comment first line. May be there exist better solutions but I've used
\subnode
command fromtikzmark
library. It creates an internal reference inside every comment node.Finally it's easy to draw message interchanges with the help of intersection coordinates (
|-
or-|
).This is a complete code for a minimal example:
Compile previous code twice to get
Update
If you want to align comments around colons, you can use a
tabular
inside comments. In this case you have to useampersand replacement
option inside\matrix
because it's necessary to have different&
symbols insidetabular
andmatrix
.The result is now
But, if you want to align all comments, it's better to put all of them inside a
tabular
. You can avoid using\matrix
and placeserver
andclient
labels after it. In order to separate different comments you can use\\[vertical distance]
insidetabular
.Solution looks like:
And the result is: