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 7592 times

User avatar
Stefan Kottwitz
Site Admin
Posts: 9557
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: 9557
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.

  1. \documentclass{minimal}
  2. \usepackage{tikz}
  3. \usetikzlibrary{trees}
  4. \begin{document}
  5. \begin{tikzpicture}[
  6. man/.style={rectangle,draw,fill=blue!20},
  7. woman/.style={rectangle,draw,fill=red!20,rounded corners=.8ex},
  8. grandchild/.style={grow=down,xshift=1em,anchor=west,
  9. edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.west)}},
  10. first/.style={level distance=6ex},
  11. second/.style={level distance=12ex},
  12. third/.style={level distance=18ex},
  13. level 1/.style={sibling distance=5em}]
  14. % Parents
  15. \coordinate
  16. child[grow=left] {node[man,anchor=east]{Jim}}
  17. child[grow=right] {node[woman,anchor=west]{Jane}}
  18. child[grow=down,level distance=0ex]
  19. [edge from parent fork down]
  20. % Children and grandchildren
  21. child{node[man] {Alfred}
  22. child[grandchild,first] {node[man]{Joe}}
  23. child[grandchild,second] {node[woman]{Heather}}
  24. child[grandchild,third] {node[woman] {Barbara}}}
  25. child{node[woman] {Berta}
  26. child[grandchild,first] {node[man]{Howard}}}
  27. child {node[man] {Charles}}
  28. child {node[woman]{Doris}
  29. child[grandchild,first] {node[man]{Nick}}
  30. child[grandchild,second] {node[woman]{Liz}}};
  31. \end{tikzpicture}
  32. \end{document}


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


Stefan
LaTeX.org admin


Return to “General”

Who is online

Users browsing this forum: No registered users and 6 guests