LaTeX forum ⇒ GeneralDrawing a Family Tree

LaTeX specific issues not fitting into one of the other forums of this category.
User avatar
anta40
Posts: 38
Joined: Thu Sep 11, 2008 2:36 pm

Drawing a Family Tree

Postby anta40 » Fri Dec 30, 2011 11:56 am

Is there any LaTeX package that can be used to draw family tree (hopefully it's relatively easy)?
Something like this:

The rectangle means men, and rounded rectangle means women.
Oh the left, there are numbers which are meant to indicate the number of the generation.
Attachments
family.png
family.png (15.93 KiB) Viewed 10093 times

User avatar
Stefan Kottwitz
Site Admin
Posts: 9783
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Dec 30, 2011 5:44 pm

Hi,

you could use TikZ for that. Have a look at the TikZ tree examples. In the TikZ example gallery you can find many more examples.

Stefan
LaTeX.org admin

User avatar
Stefan Kottwitz
Site Admin
Posts: 9783
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Dec 30, 2011 10:33 pm

I created an example. I used styles for rectangles and rounded rectangles and for color, of course you can change it to gray. Adjust styles and distances how you like it, you may use this as a start.

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}[
  man/.style={rectangle,draw,fill=blue!20},
  woman/.style={rectangle,draw,fill=red!20,rounded corners=.8ex},
  grandchild/.style={grow=down,xshift=1em,anchor=west,
    edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.west)}},
  first/.style={level distance=6ex},
  second/.style={level distance=12ex},
  third/.style={level distance=18ex},
  level 1/.style={sibling distance=5em}]
    % Parents
    \coordinate
      child[grow=left] {node[man,anchor=east]{Jim}}
      child[grow=right] {node[woman,anchor=west]{Jane}}
      child[grow=down,level distance=0ex]
    [edge from parent fork down]
    % Children and grandchildren
    child{node[man] {Alfred}
      child[grandchild,first] {node[man]{Joe}}
      child[grandchild,second] {node[woman]{Heather}}
      child[grandchild,third] {node[woman] {Barbara}}}
    child{node[woman] {Berta}
      child[grandchild,first] {node[man]{Howard}}}
    child {node[man] {Charles}}
    child {node[woman]{Doris}
      child[grandchild,first] {node[man]{Nick}}
      child[grandchild,second] {node[woman]{Liz}}};
\end{tikzpicture}
\end{document}


family-tree.png
family-tree.png (15.85 KiB) Viewed 10083 times


Stefan
LaTeX.org admin

middlec000
Posts: 1
Joined: Wed Sep 22, 2021 7:59 am

Postby middlec000 » Wed Sep 22, 2021 8:04 am

I'm working on a family tree project and found this helpful package built for the task:
https://www.ctan.org/tex-archive/macros/latex/contrib/genealogytree


Return to “General”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 9 guests