I am using the tikz-uml package to model a class diagram.

The code snippet is placed in the examples sub-directory of the downloaded tikz-uml package.

Here is the code:

\documentclass[a4paper,11pt, svgnames]{article}



\textwidth 18.5cm
\textheight 25.5cm

\hyphenpenalty 10000000



            \umlemptyclass[y=-3, type=abstract]{M}

            \umlemptyclass[y=-3, x = 6]{P}
            \umlemptyclass[y=-6, x = 6]{H}
            \umlunicompo[pos1=1.9, pos2=0.2]{P}{M}


and it results with the following diagram:

Composition and implementation

The association lines between P and M are overlapping. I would like to redirect the composition line (black diamond) between P and M, so that the line is parallel to the implementation line (empty arrow), only placed above it. I tried reading the documentation, but whatever I do fails. Any help?

  • 1
    I think you are looking for To modify the anchor points of a relation manual section. It suggest to use \umlunicompo[anchor1=30, anchor2=150]{P}{M}\umlunicompo[anchor1=30, anchor2=150]{P}{M}.
    – Ignasi
    Jul 29, 2013 at 12:19
  • @Ignasi: you are right, I don't know how I missed this. There is an error in your proposed command though, the anchors need to be switched [anchor1=150, anchor2=30], if you write this as an answer (just this line even), I can accept it. Thank you!
    – tmaric
    Jul 29, 2013 at 12:23

1 Answer 1


By default, anchors for associations links are placed between entities' centers. But you can change them with anchor options. You can fix anchor1=...andanchor2=...or both with same optionanchors= ... and ...`

What you need is:

\umlunicompo[anchors=150 and 30]{P}{M}


\umlunicompo[anchor1=150, anchor2=30]{P}{M}

You'll find more information in section To modify the anchor points of a relation in Tikz-UML documentation

  • 2
    Named anchors (as in TikZ) work as well, so maybe \umlunicompo[anchors=mid west and mid east]{P}{M} might be a valid choice. Jul 29, 2013 at 16:52

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.