GeneralDrawing a Family Tree

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

Drawing a Family Tree

Post by anta40 »

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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

Drawing a Family Tree

Post by Stefan Kottwitz »

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: 10308
Joined: Mon Mar 10, 2008 9:44 pm

Drawing a Family Tree

Post by Stefan Kottwitz »

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.

Code: Select all

Code, edit and compile here:
\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}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
family-tree.png
family-tree.png (15.85 KiB) Viewed 16514 times
Stefan
LaTeX.org admin
middlec000
Posts: 1
Joined: Wed Sep 22, 2021 7:59 am

Drawing a Family Tree

Post by middlec000 »

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