I have to draw multiple inheritance type hierarchies. The worst case is something like the following:

enter image description here

I used tables and tree-dvipsto draw these figures, but I am now looking for something that is xelatex compatible.

I started typesetting simple hierarchies with forrest, but for cases like the one above this seems to be overkill. I already found Is there a library for drawing object inheritance trees in TikZ? but the problem is more complicated since inheritance may involve two or more parent nodes.

So: Is there a package for this or a predefined style for forest?


If you don't ask for an automatic way, a TiKZ matrix and some foreach loops are enough:

\matrix (A) [matrix of nodes, row sep=1cm, nodes={minimum width=2cm}]
arg1+ & arg4+ & arg2+& arg3+ & arg3- & arg4- & arg1- & arg2- \\
arg12-123-124 & arg-124-2-24 & arg1-12 & arg12-23 & arg0-2 \\
arg124 & arg123 & arg12 & arg24 & arg1 & arg2 & arg23 & arg0 \\
\path (A-1-4)--(A-1-5) node[above=1cm, midway] (link) {link};

\foreach \i in {1,...,8}
\draw (link.south) -- (A-1-\i.north);

\foreach \i/\j in {1/1,1/3,3/1,3/2,3/4,5/2,5/3,5/5,6/5}
\draw (A-1-\i.south)--(A-2-\j.north);

\foreach \i/\j in {2/1,2/3,4/2,4/6,5/4,7/4,7/7,8/5,8/8}
\draw (A-1-\i.south)--(A-3-\j.north);

\foreach \i/\j in {1/1,1/2,1/3,2/1,2/3,2/4,2/6,3/3,3/5,4/3,4/7,5/6,5/8}
\draw (A-2-\i.south)--(A-3-\j.north);


enter image description here

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.