1

I call the style definition mystyle in line 20. As you can see, I pass a \filldraw command as an argument to the style definition mystyle. That way I want to achieve a gray circle to be displayed in the middle of the transition line. Unfortunately it does not work.

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning, calc, shadings, shadows, shapes.arrows, arrows.meta, matrix, mindmap}
\usepackage{tikz-uml}
\begin{document}
\begin{tikzpicture}[
    mystyle/.style n args = {1}{
        color=black,
        rounded corners, 
        arrows={-Straight Barb[angle=60:9pt 3]},
        path picture={
            #1
        }
    }]
    \begin{umlstate}[name=Statemaschine]{Lightcontrol}
        \umlstateinitial[name=start, x=0,y=3]{start}
        \umlbasicstate [fill=red!20, width=5cm] {manual}
        \umlbasicstate [below left=4of manual,fill=red!20, width=5cm,] {waiting}
        \umlbasicstate [below right=4of manual,fill=red!20, width=5cm] {auto}
        \umlbasicstate [below=8of manual,fill=red!20, width=5cm] {time}
        \umltrans[mystyle={\filldraw [gray] (0,0) circle [radius=9pt]}]{waiting}{auto}
    \end{umlstate}
\end{tikzpicture}
\end{document}
4
  • There's a ; missing in your path specification. Aug 14 at 11:06
  • do you mean like this: \umltrans[mystyle={\filldraw [gray] (0,0) circle [radius=9pt];}]{waiting}{auto}
    – Z.J
    Aug 14 at 11:35
  • Yes, however, your document already doesn't compile for me even without mystyle. I need at least /tikz/below left and so on. Hoewever \umltrans still throws an error without mystyle. Aug 14 at 12:04
  • i have the tikz-uml.sty library in the same directory. Unfortunately it does not work even with semicolon. The following error message appears: Package pgfkeys: I do not know the key '/tikz/0) circle [radius', to which you passed '9pt];', and I am going to ignore it. Perhaps you mispelled it.
    – Z.J
    Aug 14 at 12:32

1 Answer 1

1

Using insert path between the two states.

b

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning, calc, shadings, shadows, shapes.arrows, arrows.meta, matrix, mindmap}

\usepackage{tikz-uml}

\begin{document}
    \begin{tikzpicture}[
        mystyle/.style  2 args = {%
            color=black,
            rounded corners, 
            arrows={-Straight Barb[angle=60:9pt 3]},
            insert path={node[circle, fill=gray!60,minimum size=12pt] at  ($(#1)!.5!(#2)$){}},
        }]
        \begin{umlstate}[name=Statemaschine]{Lightcontrol}
            \umlstateinitial[name=start, x=0,y=3]{start}
            \umlbasicstate [fill=red!20, width=5cm] {manual}
            \umlbasicstate [below left=4 of manual,fill=red!20, width=5cm,] {waiting}
            \umlbasicstate [below right=4 of manual,fill=red!20, width=5cm] {auto}
            \umlbasicstate [below=8 of manual,fill=red!20, width=5cm] {time}
            \umltrans[mystyle={waiting}{auto}]{waiting}{auto} % changed <<<<<<<<<<<<<<<<<<<
        \end{umlstate}
    \end{tikzpicture}

    \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.