2

I have a small problem. I want to draw 2 sequence diagrams, but I have some formatting problems.

1 2

My solution:

    \documentclass[]{scrreprt}
\usepackage[ngerman, english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{tikz-uml}
\usetikzlibrary{matrix, shapes, positioning}

\begin{document}

\begin{tikzpicture}
\begin{umlseqdiag}
\umlactor{DruckauftragA}
\umlactor[x=6]{DruckauftragB}
\umlobject[x=12]{Drucker}

\begin{umlcall}{DruckauftragA}{Drucker}
\begin{umlcall}{Drucker}{DruckauftragA}
\end{umlcall}
\begin{umlcall}[return=1]{DruckauftragA}{Drucker}
\end{umlcall}
\end{umlcall}

\begin{umlcall}{DruckauftragB}{Drucker}
\begin{umlcall}{Drucker}{DruckauftragB}
\end{umlcall}
\begin{umlcall}[return=1]{DruckauftragB}{Drucker}
\end{umlcall}
\end{umlcall}

\end{umlseqdiag}
\end{tikzpicture}

    \begin{tikzpicture}
\begin{umlseqdiag}
\umlactor{DruckauftragA}
\umlactor[x=6]{DruckauftragB}
\umlobject[x=12]{Drucker}

\begin{umlcall}{DruckauftragA}{Drucker}
\begin{umlcall}{Drucker}{DruckauftragA}
\end{umlcall}
\begin{umlcall}{DruckauftragB}{Drucker}
\begin{umlcall}{Drucker}{DruckauftragB}
\end{umlcall}
\begin{umlcall}[return=1]{DruckauftragB}{Drucker}
\end{umlcall}
\end{umlcall}
\begin{umlcall}[return=1]{DruckauftragA}{Drucker}
\end{umlcall}
\end{umlcall}


\end{umlseqdiag}
\end{tikzpicture}

\end{document}              

Result: 1

Link to tikz-uml.sty http://perso.ensta-paristech.fr/~kielbasi/tikzuml/index.php?lang=en

Also posted in 1 http://www.golatex.de/viewtopic.php?t=14492&sid=97b25a8b7fb48b70e8f623e6af5218b3

  • Please be a bit more concrete. What is your problem? What have you tried? What don't you understand? Please give a link to the tikz-uml package and make your code compilable if possible. I am getting 4 times "Extra \or, \end{umlcall}". – LaRiFaRi Jan 13 '15 at 8:20
  • Fixed your Problem. The code needs the babel package – Stephan Jan 13 '15 at 8:53
  • @Stephan Thank you, but you still do not describe your problem. I am seeing two diagrams... and? – LaRiFaRi Jan 13 '15 at 9:45
  • Compare the Result picture withe the initial pictures. The "timeline" of my two threads ("DruckauftragA" and "DruckauftragB") is incorrect. In the first picture thread "DruckauftragA" must be completed before the second threads starts. In the second picture thread "DruckauftragA" started and before the thread is ended thread "DruckauftragB" started. But in my case both threads stared at the same "time". I don´t find a solution for the korrekt starttime for thread "DruckauftragB". – Stephan Jan 13 '15 at 10:36
1

First of all, I have no experience with this package. But without any additional information the first call of "DruckauftragB" starts at the beginning of its timeline.

You can use the option dt to shift the call. See the subsection "To place a call" in the manual:

The dt option allows to place a function call on a lifeline, relatively to the last call drawn on this lifeline. It has no default value. Its unit is ex. The default behavior is to shift the call you define to avoid overwriting between to consecutive calls :

Suggestion:

\documentclass[]{scrreprt} 
\usepackage[ngerman, english]{babel} 
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage{tikz} 
\usepackage{tikz-uml} 
\usetikzlibrary{matrix, shapes, positioning} 

\begin{document} 
\begin{tikzpicture} 
  \begin{umlseqdiag} 
    \umlactor{DruckauftragA} 
    \umlactor[x=6]{DruckauftragB} 
    \umlobject[x=12]{Drucker} 

    \begin{umlcall}{DruckauftragA}{Drucker} 
     \begin{umlcall}{Drucker}{DruckauftragA} 
     \end{umlcall} 
     \begin{umlcall}[return=1]{DruckauftragA}{Drucker} 
     \end{umlcall} 
    \end{umlcall} 
  %
    \begin{umlcall}[dt=25]{DruckauftragB}{Drucker} 
      \begin{umlcall}{Drucker}{DruckauftragB} 
      \end{umlcall} 
      \begin{umlcall}[return=1]{DruckauftragB}{Drucker} 
      \end{umlcall} 
    \end{umlcall} 
  \end{umlseqdiag} 
\end{tikzpicture} 


\begin{tikzpicture} 
  \begin{umlseqdiag} 
    \umlactor{DruckauftragA} 
    \umlactor[x=6]{DruckauftragB} 
    \umlobject[x=12]{Drucker} 
  %
    \begin{umlcall}{DruckauftragA}{Drucker} 
      \begin{umlcall}{Drucker}{DruckauftragA} 
      \end{umlcall} 
      \begin{umlcall}[dt=11]{DruckauftragB}{Drucker} 
        \begin{umlcall}{Drucker}{DruckauftragB} 
        \end{umlcall} 
        \begin{umlcall}[return=1]{DruckauftragB}{Drucker} 
        \end{umlcall} 
      \end{umlcall} 
      \begin{umlcall}[dt=19,return=1]{DruckauftragA}{Drucker} 
      \end{umlcall} 
    \end{umlcall} 
  \end{umlseqdiag}
 \end{tikzpicture}
 \end{document}

enter image description here

  • I tred \umlactor[x=6, y=5]{DruckauftragB} :-) You are right i got no experience with that packed. I tried it the first time. But i like it ;-) Thank you for your help – Stephan Jan 14 '15 at 18:10

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.