3

I'm using TikZ-UML to draw a class diagram with multiple packages, and classes with the same name but located in different packages. The thing is, I want to put relations on those classes, but I can't reference one in particular because they have the same name.

I already tried using the name option of the \umlclass macro to change the node name, but I can't seem to be able to reference the node name from the \umlrelation arguments. Here is a minimal (non-)working example:

\documentclass{article}
\usepackage{tikz-uml}

\begin{document}
    \begin{tikzpicture}
        \umlsimpleclass[name=a]{A}
        \umlsimpleclass[x=2, name=b]{A}
        \umlassoc{a}{b}
    \end{tikzpicture}
\end{document}
4

You can use alias instead.

\documentclass{article}
\usepackage{tikz-uml}

\begin{document}
    \begin{tikzpicture}
        \umlsimpleclass[alias=a]{A}
        \umlsimpleclass[x=2, alias=b]{B}
        \umlassoc{a}{b}
    \end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |
  • Thanks for the quick response, had been stuck on this for 2 hours :-) – Champitoad Jun 12 '16 at 21:16

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.