Take the 2-minute tour ×
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.

Since it has been recommended to me in Stack Overflow to post it here, I will do so:

I want to draw a genogram with LaTeX.

I tried to do this with TikZ, but since you need to model at least 3 different relations between people (Children, Siblings, Couples), a standard tree model doesn't seem to fit.

Is there an easy way (maybe a template) to draw a genogram? If not, what would be the approach to build an own sub-package or something?

The main problem with latter being the dynamic positioning of elements (depending on the amount of branching) and the previously mentioned three relations.

I edited/extended the question, so it will be more clear of what I'm asking exactly:

Given is the following tree in TikZ/\usetikzlibrary{trees}:

family tree

which is created with:

\documentclass[11pt]{article}
\usepackage{tikz}
\usepackage{tikz-qtree}
\newcommand{\per}[1]{\parbox{2.5cm}{#1}}
\usetikzlibrary{trees}
\begin{document}

\tikzstyle{female} = [rectangle, draw, fill=red!20, rounded corners, minimum height=3em]
\tikzstyle{male} = [rectangle, draw, fill=blue!20, minimum height=3em]
\tikzstyle{neutral} = [rectangle, draw, fill=green!20, minimum height=3em]

 \begin{tikzpicture}[level distance=4cm]
    \node[neutral] {\per{Child}}
    [edge from parent fork right,grow=right]
        child {     
            node[female] {\per{Mother}}     
            child {
                node[female] {\per{Mother's mother}}
            }
            child {
                node[male] {\per{Mother's father}}
            }           
        }
        child {
            node[male] {\per{Father}}
        };
\end{tikzpicture}
\end{document}

Now I have two problems:

  1. I want to add a Sibling to the Child and the Mother for example.
  2. I want to add a Father's mother and Father's father resp.,

How would I do that?

share|improve this question
1  
Welcome to TeX.SE. While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. While solving problems is fun, setting them up is not. Then those trying to help can simply cut and paste your MWE and get started on solving problem. –  Peter Grill Nov 13 '12 at 19:40
    
Thank you, I just changed it accordingly. –  Lumiukko Nov 14 '12 at 0:52
    
this appears to have been superseded by Genogram with LaTeX –  barbara beeton Nov 17 '12 at 19:14

2 Answers 2

up vote 9 down vote accepted

In this case I wouldn't use the trees library, but build the diagram using the positioning library; something along these lines:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\tikzset{
every node/.style={rectangle,draw,minimum height=3em,text width=2.5cm},
female/.style = {fill=red!20, rounded corners},
male/.style = {fill=blue!20},
neutral/.style = {fill=green!20}
}

\begin{tikzpicture}[node distance=8pt and 33pt]

% the nodes
\node[neutral] (chi1) {Child 1};
\node[neutral,below= of chi1] (chi2) {Child 2};
\node[male,above right=of chi1] (father) {Father};
\node[female,below right=of chi2] (mother) {Mother};
\node[female,below =of mother] (aunt) {Aunt};
\node[male,above right=of father] (ffather) {Father's\\ father};
\node[female,below right=of father] (fmother) {Father's\\ mother};
\node[male,above right=of mother] (mfather) {Mother's\\ father};
\node[female,below right=of aunt] (mmother) {Mother's\\ mother};

% some auxiliary coordinates for the edges
\coordinate[right=15pt of chi1] (auxc1);
\coordinate[right=15pt of chi2] (auxc2);
\coordinate[right=15pt of father] (auxf);
\coordinate[right=15pt of mother] (auxm);
\coordinate[right=15pt of aunt] (auxa);

% the edges
\draw (father.west) -| (auxc1) |- (mother.west);
\draw (chi1) -- (auxc1);
\draw (chi2) -- (auxc2);
\draw (ffather.west) -| (auxf) |- (fmother.west);
\draw (father) -- (auxf);
\draw (mfather.west) -| (auxm) |- (mmother.west);
\draw (mother) -- (auxm);
\draw (aunt) -- (auxa);

\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer

this appears to be similar to -- though most likely not the same as -- the medical pedigree trees described in papers delivered at tug meetings by leyla akhmadeeva and boris veytsman in 2008 and 2009, and subsequently published in tugboat:

the pedigree trees are not constructed with tikz, but with a package devised specifically for the purpose. nonetheless, you might get some ideas from that work.

share|improve this answer
    
Yes it is quite similar. In fact these are genograms. Unfortunately they are using a perl script to read a input file with the data of the later to be pedigree and generate the output used with the pst-pdgr in TeX. This alone wouldn't be a problem, however, I would like a TeX only solution, if possible, which will give me some freedom in design for nodes and coloring. The main problem seems to be, that a family tree is not a tree by definition, since every node can have more than one of each, successors and predecessors. –  Lumiukko Nov 13 '12 at 23:26

Your Answer

 
discard

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.