3

In a genealogical tree "Wife" has four children with "Husband1" and later a "Husband2" with no children. With

\documentclass{standalone}
\usepackage[all]{genealogytree}

\begin{document}
\begin{genealogypicture}[
  template=signpost,
  ]
  child{
    p{Husband1}
    g{Wife}
    c{Child1} c{Child2} c{Child3} c{Child4}
    union{
      p{Husband2}
    }
  }
\end{genealogypicture}
\end{document}

that is shown as enter image description here.

The edges are put on different heights to avoid clashing. I would prefer to have the edge to Husband2 to be above the other one instead to avoid having the edges cross. I can explicitly move the edge up, with

    union[subtree={edges={yshift=+5mm}}]{
      p{Husband2}

yielding enter image description here.

To get a good result I'd also need to lower the other edge. It seems like a clumsy workaround to undo the shifting work that is already done, so I wonder how I instead can tell genealogytree in what order I want the edges.

If I take Husband2 to be the "main" partner, and make a union node for Husband1 and the four children with

\documentclass{standalone}
\usepackage[all]{genealogytree}

\begin{document}
\begin{genealogypicture}[template=signpost]
  child{
    union{
      p{Husband1}
      c{Child1} c{Child2} c{Child3} c{Child4}
    }
    g{Wife}
    p{Husband2}
  }
\end{genealogypicture}
\end{document}

I get the edges in the height order I want, but other unnecessary crossings: enter image description here

(I'm using genealogytree 0.91 which is in texlive 2015.)

pst
  • 4,674

1 Answers1

5

Update: With genealogytree 1.30 (2017-12-08), the options edges shift, edges up, and edges down are available inside the package with a more generic implementation. They do not have to be defined by the user anymore.

If the seven nodes shall stay at their positions as they are (and I figure you want that), the vertical edge anchor position has to be changed manually. Basically, you already tried the possibilities. What I can add is some alleviation how to shift the edges.

You can add own styles to shortcut the local shift operation.

edges shift/.style={family edges={yshift=#1}},

would allow to write something like edges shift=5mm directly.

The template signpost sets the level distance to 1cm. To toggle the vertical height for a two-families-construct, you may use shortcuts

edges up/.style={edges shift=3.3333mm},
edges down/.style={edges shift=-3.3333mm},

to make things more simple.

The complete code is:

\documentclass{standalone}
\usepackage[all]{genealogytree}

% --- only needed before version 1.30 of genealogytree
%\gtrset{
%  edges shift/.style={family edges={yshift=#1}},
%  edges up/.style={edges shift=3.3333mm},
%  edges down/.style={edges shift=-3.3333mm},
%}

\begin{document}

\begin{genealogypicture}[
  template=signpost,
  ]
  child[edges down]{
    p{Husband1}
    g{Wife}
    c{Child1} c{Child2} c{Child3} c{Child4}
    union[edges up]{
      p{Husband2}
    }
  }
\end{genealogypicture}

\end{document}

This gives:

enter image description here

  • Yes, I intended to have the nodes at (approximately) those positions. Sometimes it's possible to fit all better by shifting the children to the left, for example with [pivot=child] for Child4. Then the edges won't cross, but genealogytree doesn't know about that and still does the shifting. Now with your answer I also know how to best undo that (by shifting 1.6667mm in the other direction) to get edges on the same level when they don't cross anyway. – pst Jul 12 '15 at 15:24
  • Apologies for abusing the comment system, but could you take a look at this question if you can spare the time? I have no idea whether it is a bug, a limitation or a feature ;). – cfr Oct 22 '15 at 23:24