[Tex/LaTex] Drawing family tree with `genealogytree`

genealogygenealogytreetikz-pgftikz-trees

I'm trying to create a version of the image below using the genealogytree package:

I've got most of the way there except for the fact that the "brother" and one of the "cousin" boxes overlap:

Here's my MWE that produced the image above:

\documentclass[a4paper,landscape]{article}
\usepackage[top=4.5cm, bottom=4.5cm, left=1cm, right=1cm]{geometry}
\usepackage[all]{genealogytree}
\begin{document}
\resizebox{\textwidth}{!}{
\begin{tikzpicture}
\genealogytree[template=signpost, id suffix=@p]
{
 child{
  g[male]{paternal grandfather}
  p[female]{paternal grandmother}
  child{
   g[male]{paternal uncle}
   c[male]{cousin}
   child{
    g[female]{cousin}
    }
   }
  child{
   g[female]{paternal aunt}
   c[male]{cousin}
   child{
    g[female]{cousin}
    }
   }
   child[phantom*]{
    g[male,id=father]{father}
    p[female]{mother}
    c[male]{brother}
    c{\textsc{ego}}
    c[female]{sister}
   }
 }
}
\genealogytree[template=signpost, id suffix=@m, set position=father@m at father@p]
{
 child{
  g[male]{maternal grandfather}
  p[female]{maternal grandmother}
  child{
   p[male,id=father]{father}
   g[female]{mother}
   child{
    g[male]{brother}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
   child{
    g{\textsc{ego}}
    c[male]{son}
    child{
     g[female]{daughter}
    }
   }
   child{
    g[female]{sister}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
  }
  child{
   g[male]{maternal uncle}
   c[male]{cousin}
   c[female]{cousin}
  }
  child{
   g[female]{maternal aunt}
   c[male]{cousin}
   c[female]{cousin}
  }
 }
}
\end{tikzpicture}
}
\end{document}

Help finding a solution would be welcome!

Best Answer

It is true that you can manually shift the paternal tree...but the problem you are facing is solved in another way.

The issue is that in the paternal tree, you have termination at only the brother, ego, and sister nodes. But in the maternal tree, you have son, daughter, and niece/nephew nodes terminating. These lower-level nodes force more separation space between brother, ego, and sister -- this space is not required in the paternal tree, because those lower-level nodes don't exist.

All you need to do is mirror the entire child nodes structure from father and mother downward, like such:

EDIT:

The structure requires a very small tweak when you copy and paste. The first image shows what happens when you do not make the tweak. You'll need to flip the g and p in the father and mother nodes within the paternal tree.

\documentclass[a4paper,landscape]{article}
\usepackage[top=4.5cm, bottom=4.5cm, left=1cm, right=1cm]{geometry}
\usepackage[all]{genealogytree}
\begin{document}
\resizebox{\textwidth}{!}{
\begin{tikzpicture}
\genealogytree[template=signpost, id suffix=@p]
{
 child{
  g[male]{paternal grandfather}
  p[female]{paternal grandmother}
  child{
   g[male]{paternal uncle}
   c[male]{cousin}
   child{
    g[female]{cousin}
    }
   }
  child{
   g[female]{paternal aunt}
   c[male]{cousin}
   child{
    g[female]{cousin}
    }
   }
%OLD WAY
   %child[phantom*]{
    %g[male,id=father]{father}
    %p[female]{mother}
    %c[male]{brother}
    %c{\textsc{ego}}
    %c[female]{sister}
   %}
%MIRRORED FROM MATERNAL TREE (SEE FIRST IMAGE)
   %child[phantom*]{
   %p[male,id=father]{father}
   %g[female]{mother}
   %child{
    %g[male]{brother}
    %c[male]{nephew}
    %child{
     %g[female]{niece}
    %}
   %}
   %child{
    %g{\textsc{ego}}
    %c[male]{son}
    %child{
     %g[female]{daughter}
    %}
   %}
   %child{
    %g[female]{sister}
    %c[male]{nephew}
    %child{
     %g[female]{niece}
    %}
   %}
  %}
 %}
%MIRRORED FROM MATERNAL TREE WITH THE TWEAK (SEE SECOND IMAGE)
   child[phantom*]{
   g[male,id=father]{father}
   p[female]{mother}
   child{
    g[male]{brother}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
   child{
    g{\textsc{ego}}
    c[male]{son}
    child{
     g[female]{daughter}
    }
   }
   child{
    g[female]{sister}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
  }
 }
}
\genealogytree[template=signpost, id suffix=@m, set position=father@m at father@p]
{
 child{
  g[male]{maternal grandfather}
  p[female]{maternal grandmother}
  child{
   p[male,id=father]{father}
   g[female]{mother}
   child{
    g[male]{brother}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
   child{
    g{\textsc{ego}}
    c[male]{son}
    child{
     g[female]{daughter}
    }
   }
   child{
    g[female]{sister}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
  }
  child{
   g[male]{maternal uncle}
   c[male]{cousin}
   c[female]{cousin}
  }
  child{
   g[female]{maternal aunt}
   c[male]{cousin}
   c[female]{cousin}
  }
 }
}

\end{tikzpicture}
}
\end{document}

(without the tweak - a pure copy-and-paste):

Proper merge of paternal and maternal trees in genealogytree without tweak

(copy-and-paste plus switching g and p on father and mother nodes):

Proper merge of paternal and maternal trees in genealogytree with tweak

I think this way is preferable because of the automatic spacing. The manual shift method should be reserved for what the genealogytree manual on page 44 refers to (which I think does not apply here):

Note that in a more complicated situation more manual intervention may be necessary to avoid unwanted overlapping of other nodes.

Related Question