2

I use lost message in msc diagram. I need to control the length and color of the lost message line as shown below. I looked at the manual, it suggests using \selfmesswidth in the msc definition. I tried it but it made no effect at all. Here is a sample script:

\documentclass{article}
    \usepackage{graphicx} 
    \usepackage{msc} 
    \usepackage{xcolor}

\begin{document}
\begin{figure*}[b!] 
\vspace{-1cm}
\[
\resizebox{\textwidth}{!}{
\centering
\setmsckeyword{} 
\drawframe{no} 
\hspace{-1cm}

\begin{msc}[small values, /msc/level height=0.6cm, /msc/label distance=0.5ex , /msc/first level height=0.6cm, /msc/last level height=0.6cm, /msc/top head dist=0, /msc/bottom foot dist=0]{}
\setlength{\instwidth}{2.5\mscunit} 
\setlength{\instdist}{5\mscunit} 

\declinst{A}{}{A}
\declinst{B}{}{B}

\mess {Message1} {A}{B}
\nextlevel
\lost[side=left]{}{}{B}

\nextlevel
\mess {Messag2} {A}{B}
\nextlevel

\end{msc}
} 
 \]
 \caption[caption]{Figure} 
\end{figure*}
\end{document}

I need to change the length and color of the lost message as shown below. I could not find a way to do that in the manual. enter image description here

EDIT: The document class updated. You also need the msc.sty from here

  • Your example is not working for me. First it has a strange non-standard document class (which I have not), second: replacing it with a standard article class, it gives me some errors. Please make it working for all of us in order for us to be able to help you – Moriambar Apr 16 '17 at 21:36
  • Have you tried to compile your code, and have you looked at the log file? According to the documentation you cannot use [small values, /msc/level height=0.6cm, /msc/label distance=0.5ex , /msc/first level height=0.6cm, /msc/last level height=0.6cm, /msc/top head dist=0, /msc/bottom foot dist=0] as an option. It throws an error. – gernot says Reinstate Monica Apr 16 '17 at 23:09
1

Add the following command to the preamble:

\makeatletter
\newcommand\lostredlong[1][l]%
  {\psset{linecolor=red}% color lines in red. Unfortunately this affects all lines.
   \selfmesswidth=\instwidth% set the length of the arrow
   \def\lostfound@position{#1}%
   \def\lostfound@type{lost}%
   \def\msc@circlefillstyle{red}% fill the circle in red
   \lostfound@B%
  }
\makeatother

Setting linecolor and \selfmesswidth affects also all of the following commands. To avoid this, enclose the \lostredlong invocation in braces.

{\lostredlong{}{}{B}}

It is basically possible to add these braces to the definition of the command \lostredlong, but this requires to copy much more code from msc.sty should probably be avoided.

enter image description here

\documentclass{article}
    \usepackage{graphicx} 
    \usepackage{msc} 
    \usepackage{xcolor}
\makeatletter
\newcommand\lostredlong[1][l]%
  {\psset{linecolor=red}%
   \selfmesswidth=\instwidth
   \def\lostfound@position{#1}%
   \def\lostfound@type{lost}%
   \def\msc@circlefillstyle{red}%
   \lostfound@B%
  }
\makeatother
\begin{document}
\begin{msc}{}
\setlength{\instwidth}{2.5\mscunit} 
\setlength{\instdist}{5\mscunit} 

\declinst{A}{}{A}
\declinst{B}{}{B}

\mess {Message1} {A}{B}
\nextlevel
{\lostredlong{}{}{B}}

\nextlevel
\mess {Messag2} {A}{B}
\nextlevel

\end{msc}

\end{document}
  • I tried to compile your code. I got: Error: Undefined control sequence that points to the line that contains: {\lostredlong{}{}{B}}. – user6875880 Apr 17 '17 at 10:56
  • @user6875880 Which error message exactly? Which undefined control sequence? My guess is that you LaTeX distribution is outdated. – gernot says Reinstate Monica Apr 17 '17 at 23:20

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.