3

I am using the development version of the msc package to draw a protocol message sequence diagram. I have the following diagram.

enter image description here

I want the lost messages to arrive in the next level (not the same level - straight line) and I need to increase its length. This is how I want it to be:

enter image description here

Here is the original script.

\documentclass[12pt, a4paper, oneside]{article}

\usepackage{msc} %for the diagrams
\usepackage{graphicx} 

\begin{document}

%------------------------------------------------------------------------------------
%   BEGIN DIAGRAM
%------------------------------------------------------------------------------------
\begin{figure}[ht!] 
\[
\resizebox{\columnwidth}{!}{%
   \centering
\setmsckeyword{} 
\drawframe{no} 
\hspace{-1cm}
\begin{msc}[small values, /msc/left environment distance=2cm, /msc/level height=0.6cm, /msc/label distance=0.5ex, /msc/first level height=0.75cm]{} 

\setlength{\instwidth}{2.5\mscunit} 
\setlength{\instdist}{2\mscunit} 

\declinst{A}{}{A}%
\declinst{X}{}{X}%
\declinst{B}{}{B}%

\mess {message 1} {A}{X}
\nextlevel
\lost[side=left]{}{}{X}

\nextlevel
\mess {message 2} {A}{X}
\nextlevel
\lost[side=left]{}{}{X}


\end{msc}
} %end scalebox
 \]
 \caption{Illustration}
\end{figure}
%------------------------------------------------------------------------------------
%   END DIAGRAM
%------------------------------------------------------------------------------------

\end{document}
  • that won't compile cleanly with my version of msc package. I get: ! Package msc Error: illegal title placement specifier: small values, ... – Thruston Jan 30 '17 at 10:01
2

Note to other users: this code is written for the development version of msc, available from http://satoss.uni.lu/software/mscpackage/. It will not work with the version of msc that is on CTAN.


The length of that arrow is defined by the relative coordinate ++(\msc@dist,0) in a macro called \msc@lost@final. You can use \patchcmd from etoolbox to patch that macro, replacing the coordinate with for example ++(2.5*\msc@dist,-10pt).

To make the line start on the same level, move \nextlevel to after \lost[..., as in the code example below.

As in one of your other questions, I removed the math environment (\[ .. \]) because it doesn't really make sense to use it, and I removed the \resizebox because I don't see that you need it.

output of code

\documentclass[12pt, a4paper, oneside]{article}
\usepackage{msc} %for the diagrams
\usepackage{etoolbox}
\makeatletter
\patchcmd{\msc@lost@final}{++(\msc@dist,0)}{++(2.5*\msc@dist,-10pt)}{}{}
\makeatother
\begin{document}

%------------------------------------------------------------------------------------
%   BEGIN DIAGRAM
%------------------------------------------------------------------------------------
\begin{figure}[ht!] 
\centering
\setmsckeyword{} 
\drawframe{no} 
\begin{msc}[small values, /msc/left environment distance=2cm, /msc/level height=0.6cm, /msc/label distance=0.5ex, /msc/first level height=0.75cm]{} 

\setlength{\instwidth}{2.5\mscunit} 
\setlength{\instdist}{2\mscunit} 

\declinst{A}{}{A}%
\declinst{X}{}{X}%
\declinst{B}{}{B}%

\mess {message 1} {A}{X}
\lost[side=left]{}{}{X}
\nextlevel
\nextlevel
\mess {message 2} {A}{X}
\lost[side=left]{}{}{X}

\nextlevel

\end{msc}
\caption{Illustration}
\end{figure}
%------------------------------------------------------------------------------------
%   END DIAGRAM
%------------------------------------------------------------------------------------

\end{document}

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.