5

I try to compile this code suggested at this previous answer

protocol message diagram - rectangle

\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}
\begin{pgfonlayer}{umlsd@background}
\fill[red!30, rounded corners]
($(RRC Connection Request from)+(-1ex,1.5em)$) rectangle ($(RRC Connection Setup Complete to)+(1ex, -1.5ex)$);
\end{pgfonlayer}
\end{sequencediagram}
\end{document}

I receive this error:

! Package pgf Error: Sorry, the requested layer 'umlsd@background' is not part
of the layer list. Please verify that you provided \pgfsetlayers and that 'umls
d@background' is part of this list.

the package pgf-umlsd that I use is the last version 0.7

Thank you

user21431
  • 685

1 Answers1

3

The @ character needs to be defined as letter. You may define a new scope key: on umlsd background.

\documentclass{article}
\usepackage[margin=12mm]{geometry}
\usepackage{hyperref}
\usepackage[underline=true]{pgf-umlsd}
\makeatletter
\tikzset{
  on umlsd background/.style={
    execute at begin scope={
      \pgfonlayer{umlsd@background}
      \let\tikz@options=\pgfutil@empty%
      \tikzset{#1}%
      \tikz@options
    },
    execute at end scope={\endpgfonlayer},
  }
}
\makeatother
\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}
\begin{scope}[on umlsd background]
  \fill[red!30, rounded corners]($(RRC Connection Request from)+(-1ex,1.5em)$) rectangle ($(RRC Connection Setup Complete to)+(1ex, -1.5ex)$);
\end{scope}
\end{sequencediagram}
\end{document}
Paul Gaborit
  • 70,770
  • 10
  • 176
  • 283