# Modify the style of UML-tikz elements with standard tikZ commands

I use the UML-tikZ package to create UML state machines. From time to time I want to make changes to the appearance of the given elements. For example, I want to enlarge the arrowhead of the element \umltrans (line 13). Stupidly, a completely different arrow enlarges, which has nothing to do with this transition at all. Can you tell me if and how to change the style of UML elements using the commands from the tikZ library?

\documentclass[tikz]{standalone}
\usepackage{tikz-uml}
\begin{document}
\begin{tikzpicture}
\begin{umlstate}[name=Statemaschine,fill=yellow!20]{Lightcontrol}
\umlstateinitial[name=start, x=0,y=3]{start}
\umlbasicstate [name=manuel, fill=red!20, width=5cm] {manuel}
\umlbasicstate [name=waiting,below left=4of manuel,fill=red!20, width=5cm,] {witing}
\umlbasicstate [name=auto,below right=4of manuel,fill=red!20, width=5cm] {auto}
\umlbasicstate [name=time,below=8of manuel,fill=red!20, width=5cm] {time}
\umltrans[geometry =-|]{start}{waiting}
\umltrans[->,/tikz/arrows={-Straight Barb[angle=60:9pt 3]}]{waiting}{auto}
\end{umlstate}
\end{tikzpicture}
\end{document}


For state transitions macros this is the default style:

\tikzstyle{tikzuml transition style}=[color=\tikzumlDefaultDrawColor, rounded corners, -angle 45]


You can define your own styles in the preamble to change a particular transition.

\documentclass[tikz]{standalone}

\usepackage{tikz-uml}

\tikzstyle{tikzuml transition style2}=[color=blue, rounded corners, arrows={-Straight Barb[angle=60:9pt 3]}]% added <<<<

\tikzstyle{tikzuml transition style3}=[color=red, rounded corners, arrows={-Latex[angle=40:5.5mm]}]% added <<<<

\begin{document}
\begin{tikzpicture}
\begin{umlstate}[name=Statemaschine,fill=yellow!20]{Lightcontrol}

\umlstateinitial[name=start,x=0,y=3,]{start}
\umlbasicstate[name=manuel,fill=red!20,width=5cm]{manuel}
\umlbasicstate[name=waiting,below left=1 of manuel,fill=red!20,width=5cm,]{waiting}
\umlbasicstate[name=auto,below right=1 of manuel,fill=red!20,width=5cm]{auto}
\umlbasicstate[name=time,below=8 of manuel,fill=red!20,width=5cm]{time}
\umlHVtrans[tikzuml transition style2]{start}{waiting} % changed <<<<<<<<<<<<
\umltrans[tikzuml transition style3]{waiting}{auto}% changed <<<<<<<<<<<<

\end{umlstate}
\end{tikzpicture}
\end{document}


Analogously, the default style for the state

\tikzstyle{tikzuml state style}=[rectangle split, rectangle split parts=2, rounded corners, inner xsep=1.5ex]%


can be redefined.

• Thank you for your valuable approach. It has solved my problem. I now have a state machine diagram with clearly visible arrows. However, instead of the \tikzstyle syntax, I wrote the style definitions in the square brackets that follow \begin{tikzpicture}[...].
– Z.J
Aug 16 at 5:46
• @Z.J Thank you for your feedback! Aug 16 at 12:55