TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I looking for a simple way to typeset a genealogical tree in LaTeX.

In particular, I'm interested in typesetting a so-called "Ahnentafel", that is a tree that shows me, my parents, my grandparents, my great-grandparents etc. In other words, it is a hierarchical tree in which the number of branches doubles at each level.

Is there a package that can help me? Sadly, http://www.ctan.org/topic/genealogy is empty.

I've noted a few posts recommending TikZ for drawing trees. I've never used TikZ, and I'm reluctant to dive into it just for this purpose. But if I must, I must.


Here's an example of what I want to create:

This is a 3-generation Ahnentafel.

This is a 3-generation Ahnentafel

share|improve this question
could you provide a sample image in your question? – cmhughes May 11 '14 at 16:03
See e.g. tex.stackexchange.com/questions/23241/… – Alan Munn May 11 '14 at 16:13
@cmhughes, I've done so. – oz1cz May 11 '14 at 17:16
Not completely TeX related, but you can use gramps-project.org . Which generated Graphviz, dot, and PDF tree. You can include the PDF graphics directly or use dot2tex or dot2texi to include it you documents. – alfC Nov 14 '15 at 21:15
up vote 17 down vote accepted

Here's another option using forest to illustrate some other of its features:


% comment out the following four lines if the Helvet Neue font are not available:
\newfontfamily\namefont[]{Helvetica Neue Condensed Bold}
\setmainfont[Mapping=tex-text, Color=textcolor]{Helvetica Neue Light}


  {\namefont #1} \\
  b: & #2 \\
  & #3 \\
  d: & #4 \\
  & #5


  for tree={
    edge path={
        ([xshift=-(6pt-1pt*level)].child anchor) to[out=180,in=0]
        ([xshift=(6pt-1pt*level)]!u.parent anchor)\forestoption{edge label};
    if n=1
      {fill=color1,shape=tape,tape bend bottom=none}
      {if n'=1
        {fill=color2,shape=tape,tape bend top=none}
for tree={
  line width=3pt,
  inner sep=8pt,
  minimum size=1cm,
  text width=4.5cm,
  child anchor=west,
  parent anchor=east,
  l sep=2cm,
  s sep=10pt,
  edge={line width=(18pt-3pt*level),line cap=rect,color=brown},
[\Person{Abraham /LINCOLN/}{12 Feb 1809}{Hardin (Larue), KY}{15 Apr 1865}{Washington, DC},fill=color2
  [\Person{Nancy /HANKS/}{5 Feb 1784}{Campbell Co., Virginia}{5 Oct 1818}{Centryville, Spencer, Ind}
   [\Person{Nancy /SHIPLEY/}{ABT 1745}{Pembroke, Wash, ME}{}{Amelia, Amelia, VA}
     [\Person{Sarah Or Rachel}{ABT 1723}{}{}{}
     [\Person{Robert /SHIPLEY/}{ABT 1719}{}{}{}
   [\Person{Joseph /HANKS/}{ABT 1740}{Pembroke, Wash, ME}{}{Amelia, Amelia, VA}
     [\Person{Sarah /EVANS/}{ABT 1714}{Pembroke, Wash, ME}{}{}
     [\Person{John /HANKS/}{22 Oct 1709}{Pembroke, Wash, ME}{6 Sep 1742}{Pembroke, Wash, ME}
  [\Person{Thomas /LINCOLN/}{20 Jan 1780}{Rockingham, VA}{17 Jan 1851}{Beechland, Co., KY.}
    [\Person{Bethsheba /HERRING/}{1746}{Rockingham, Co., VA.}{}{}
    [\Person{Abraham /LINCOLN/}{17 May 1744}{Berks, Co., Penn.}{1786}{Jefferson County, KY}
      [\Person{Rebecca /FLOWERS/}{30 Mar 1720}{Berks, Co., Penn.}{1806}{Berks, Co., Penn}
      [\Person{John /LINCOLN/}{3 May 1711}{Freehold, Monmouth, N.J.}{1778}{PA}


The result:

enter image description here

In this solution, the edges are curved so as to suggest a tree and the thickness of the branches automatically diminishes as the level increases; also, male and female persons are distinguished by selecting different attributes for their nodes (shape, filling); all this is done at the tree specification.

The Helvet Neue font used in my example can be downloaded from rebba pocket.

share|improve this answer
Very, very beautiful, Gonzalo! I'm impressed. – oz1cz May 12 '14 at 5:53
(+1) But it hardly looks much like the target image specified in the question's desiderata! – cfr Jun 9 '14 at 2:00

You could use forest which I've recently been learning to use for tree diagrams. This code owes pretty much everything to Gonzalo Medina's answer to my question about using forest in this way:



  for tree={
    child anchor=west,
    parent anchor=east,
    edge path={
        (.child anchor) -| +(-5pt,0) -- +(-5pt,0) |-
        (!u.parent anchor)\forestoption{edge label};
    [My Father
      [My Father's Father
      [My Father's Mother
    [My Mother
      [My Mother's Father
      [My Mother's Mother


Family Forest

share|improve this answer

The newly released genealogytree package would help you! This post previously mentioned version 0.10 alpha I had to install the current version manually, because the current Latex distribution is frozen until the new upgrade.

A current example of what can be done with the package: http://mirrors.ctan.org/macros/latex/contrib/genealogytree/genealogytree-example-2.pdf example2

I can not add the MWE from this picture, because I am not able to parse it myself.

You can find the package here: http://www.ctan.org/pkg/genealogytree

From The genealogytree package Manual for version 0.90 (2015/05/22):

Pedigree and genealogy tree diagrams are proven tools to visualize genetic and relational connections between individuals. The naming for mathematical tree structures with parent nodes and child nodes is traded from historical family diagrams. However, even the smallest family entity consisting of two parents and several children is no mathematical tree but a more general graph. The genealogytree package provides a set of tools to typeset such genealogy trees or, more precisely, to typeset a set of special graphs for the description of family-like structures. The package uses an auto-layout algorithm which can be customized to e.g. prioritize certain paths.

share|improve this answer
Very interesting. It's still only an alpha version, but I'll follow its evolution. – oz1cz Jan 23 '15 at 9:38
Much better than using forest, in my opinion! – Alessandro Cuttin May 26 '15 at 9:36
For family trees specifically, this does, indeed, look very nice. But i think @AlessandroCuttin is a little unfair since forest really is not designed to draw graphs - as opposed to trees - at all, so it will always be a bit of a hack to draw tree-like structures without a single root. – cfr Jun 28 '15 at 16:11

I have an "indirect" solution to your problem. There are two free programs that leap into mind that could solve your problem: A) Gramps www.gramps-project.org - a fully blown genealogy program (open source) that can draw various types of an "Ahnentafel" and can also export written reports to Latex. There are program versions for Linux, Mac and Win32. If you are on Linux I would recommend version 3.4.7 B) yEd - a Java-based Editor (closed source but free) that can read and visualize/print also Gedcom files. So if you just have a Gedcom file, try yEd. It has also a Weblaunch facility to try it out.

share|improve this answer

enter image description here

Another indirect solution. Some years ago I used a program called LifeLines http://lifelines.sourceforge.net which reads a GEDCOM (try googling) file and can produce a variety of reports and trees in LaTeX format (and others as well).

EDIT Above I have added a scan of a couple of pages of LaTeX output.

share|improve this answer
Is there any screenshot or sample of the latex output? I'd be interested in playing with this. Thanks for your efforts, it seems like no one else has undertaken this kind of integration with tex. – Sridhar-Sarnobat Oct 31 '15 at 18:18
If you send me (herries.press@earthlink.net) your email address I can send you some example files. – Peter Wilson Nov 1 '15 at 21:14
GRUMP: I first programmed using machine code. Now I don't know how to upload LaTeX source files to the site,how todownload them so that i can try them out, or to upload the results. Further, the 5 minute limit on creating a comment is too short, – Peter Wilson Nov 1 '15 at 21:24
Added an image. – Peter Wilson Nov 2 '15 at 15:15

I played with this a bit:

\usepackage[ngerman]{babel} % Deutsche Sprachanpassungen
\usepackage[utf8]{inputenc}  % Direkte Angabe von Umlauten im Dokument.

female/.style={font=\fontsize{9}{10}\color{black!100}\ttfamily, fill=red!20, rounded corners=10pt, rectangle,draw,minimum height=4.8em,text width=4.5cm},
male/.style={font=\fontsize{9}{10}\color{black!100}\ttfamily, fill=blue!20, rectangle,draw,minimum height=4.8em,text width=4.5cm, },
neutral/.style={draw=black!0,text width=3.2cm, minimum height=1em}, 
siblingm/.style={font=\fontsize{9}{10}\color{black!100}\ttfamily, fill=blue!20,  rectangle,draw, text width=3.5cm, minimum height=1em},
siblingf/.style={font=\fontsize{9}{10}\color{black!100}\ttfamily, fill=red!20, rounded corners=10pt, rectangle,draw, text width=3.5cm, minimum height=1em}}
\begin{tikzpicture}[node distance=5pt and 20pt] %distance ist  zwischenraum untereinander
\node(zerou) [neutral,right=35em] {Ur-Grosseltern}; %Kopfzeile Bezeichnung rechts
\node(zerog) [neutral,left=of zerou] {Grosseltern}; %Kopfzeile zweites von rechts
\node(zeroe) [neutral,left=of zerog] {Eltern}; %Kopfzeile drittes von rechts
\node(zerok) [neutral,left=of zeroe] {Kinder}; %Kopfzeile links

% hier kommen die UrGrosseltern, dazwischen jeweils das Kind
\node[male,below=of zerou] (8) {8 HS\\ \textit{geboren}  \\ verh \\ Leop};
\node[male,below left=of 8] (4) {4\\1\\2\\3};
\node[female,below right=of 4] (9) {9\\1\\2\\3};

\node[neutral,below =of 9] (invisible1) {\textcolor{white}{1}}; %unsichtbar, abstand halten und punkt fuer spaeter benutzen

\node [male,below= of invisible1] (10) {10\\1\\2\\3};
\node[female,below left=of 10] (5) {5\\1\\2\\3};
\node[female,below right=of 5] (11) {11\\1\\2\\3};

\node[neutral,below =of 11] (invisible2) {\textcolor{white}{1}}; %unsichtbar, abstand halten und punkt fuer spaeter benutzen

\node [male,below= of invisible2] (12) {12\\1\\2\\3};
\node[male,below left=of 12] (6) {6\\1\\2\\3};
\node[female,below right=of 6] (13) {13\\1\\2\\3};

\node[neutral,below =of 13] (invisible3){\textcolor{white}{1}}; %unsichtbar, abstand halten und punkt fuer spaeter benutzen

\node [male,below= of invisible3] (14) {14\\1\\2\\3};
\node[female,below left=of 14] (7) {7\\1\\2\\3};
\node[female,below right=of 7] (15) {15\\1\\2\\3};

%hier kommen die Eltern
\node [male,left=4cm of invisible1] (2) {2\\1\\2\\3};  % richtet sich an aus
\node [female,left=4cm of invisible3] (3) {3\\1\\2\\3}; % richtet sich an aus

%hier kommen die Kinder. Achtung, Reihenfolge beachten
\node [siblingf,  left=9.5cm of invisible2] (1) {2 Kind\\1}; %liegt im Zentrum
\node [siblingm, above= of 1] (c) {1 Kind\\1}; % eins darueber
\node [siblingm, below= of 1] (a) {3 Kind\\1}; % eins darunter
\node [siblingm, below= of a] (b) {4 Kind\\1};
\node [siblingf, below= of b] (d) {5 Kind\\1};

\coordinate[right=12pt of 3] (aux3);
\coordinate[right=12pt of 4] (aux4); 
\coordinate[right=12pt of 5] (aux5);
\coordinate[right=12pt of 6] (aux6);
\coordinate[right=12pt of 7] (aux7);

\coordinate[right=12pt of 1] (aux1); 
\coordinate[right=12pt of a] (auxa);
\coordinate[right=12pt of b] (auxb);
\coordinate[right=12pt of c] (auxc);

\coordinate[right=12pt of d] (auxd);

% die Eheverbindungen
\draw (8.west) -| (aux4) |- (9.west);   %Eheverbindung
\draw (4) -- (aux4);                    %rechtsstrich am Kasten und ihre Bezeichnung
\draw (10.west) -| (aux5) |- (11.west); %Eheverbindung
\draw (5) -- (aux5);                    %rechtsstrich am Kasten und ihre Bezeichnung
\draw (12.west) -| (aux6) |- (13.west); %Eheverbindung
\draw (6) -- (aux6);                    %rechtsstrich am Kasten und ihre Bezeichnung
\draw (14.west) -| (aux7) |- (15.west); %Eheverbindung
\draw (7) -- (aux7);                    %rechtsstrich am Kasten und ihre Bezeichnung

\draw (4.west) -| (2) |- (5.west);      %Eheverbindung
\draw (6.west) -| (3) |- (7.west);      %Eheverbindung

\draw (2.west) -| (aux1) |- (3.west);   %Eheverbindung

\draw (1) -- (aux1); %Kind 2 zentriert, ausgangspunkt, rechtsstrich am Kasten und ihre Bezeichnung
\draw (a) -- (auxa);    %Kind 3 rechtsstrich am Kasten und ihre Bezeichnung
\draw (b) -- (auxb);    %Kind 4 rechtsstrich am Kasten und ihre Bezeichnung
\draw (c) -- (auxc);    %Kind 1  rechtsstrich am Kasten und ihre Bezeichnung
\draw (d) -- (auxd);    %Kind 5 rechtsstrich am Kasten und ihre Bezeichnung

The result is this: enter image description here

share|improve this answer

After years avoiding tikz because I thought it was complicated (having used latex for 20 years), I moved to it, because my 2nd month intern, who never used latex before, got into it so fast. So it might be worth some of your time. Pointers:

share|improve this answer
Talking about recursion ... – MaxNoe Nov 16 '15 at 8:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.