6

I am using genealogytree package, can I add the highlighted boxes in the graph below :

enter image description here

Here is my code:

    \documentclass{article}
\usepackage[templates]{genealogytree}
\begin{document}
\begin{genealogypicture}[template=formal graph,timeflow=left,
add parent=a5 to AB_fam,
add parent=b6 to BC_fam,
]
child{
g[male]{X} p[female]{Y}
child{ g[male]{a_1}
child{ g[female]{a_2}
child{ g[female]{a_3}
child{ g[male]{a_4}
child{ g[female,id=a5]{a_5}
}}}}}
child{ g[male]{b_1}
child{ g[male]{b_2}
child{ g[male]{b_3}
child{ g[male]{b_4}
child[id=AB_fam]{ g[male]{b_5}
child{ g[female,id=b6,tikz={xshift=-6.5mm,yshift=5.5mm}]{b_6}
}}}}
child{ g[male]{c_1}
child{ g[female]{c_2}
child{ g[male]{c_3}
child{ g[female]{c_4}
child[id=BC_fam,pivot shift=-8.25mm]{ g[male]{c_5}
child{ g[male]{Z}
}}}}}}
}}
}
\end{genealogypicture}
\end{document}

1 Answer 1

6

You can use the after tree key to add additional TikZ-elements.

enter image description here

\documentclass{article}
\usepackage[templates]{genealogytree}
\usetikzlibrary{positioning}
\begin{document}
\begin{genealogypicture}[
  template=formal graph,timeflow=left,
  add parent=a5 to AB_fam,
  add parent=b6 to BC_fam,
  after tree={
   \node [draw,red] (a) at (current bounding box.south east) {Type 1};
   \node [draw,blue,left=2mm of a] (b) {Type 2};
  }
]
child{
g[male]{X} p[female]{Y}
child{ g[male]{a_1}
child{ g[female]{a_2}
child{ g[female]{a_3}
child{ g[male]{a_4}
child{ g[female,id=a5]{a_5}
}}}}}
child{ g[male]{b_1}
child{ g[male]{b_2}
child{ g[male]{b_3}
child{ g[male]{b_4}
child[id=AB_fam]{ g[male]{b_5}
child{ g[female,id=b6,tikz={xshift=-6.5mm,yshift=5.5mm}]{b_6}
}}}}
child{ g[male]{c_1}
child{ g[female]{c_2}
child{ g[male]{c_3}
child{ g[female]{c_4}
child[id=BC_fam,pivot shift=-8.25mm]{ g[male]{c_5}
child{ g[male]{Z}
}}}}}}
}}
}
\end{genealogypicture}
\end{document}

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.