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.

Possible Duplicate:
Genogram or family tree with PGF/TikZ

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 being the dynamic positioning of elements (depending on the amount of branching) and the previously mentioned three relations.

Edit:

I edited the problem, 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:

\newcommand{\per}[1]{\parbox{2.5cm}{#1}}

\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}

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
    
I see, I didn't know about that. Since it hasn't been moved yet, I just edited it here again. Also I am aware that this won't be a tree by the graph theory definition anymore, but I hope the tikz package is able to handle it anyway. –  Lumiukko Nov 11 '12 at 21:02
    
Additional information, as desired: the link to the duplicate is right at the top, to make it easier to find for people who come here via google, for example. Furthermore, it's in the right navigation bar. –  Stefan Kottwitz Dec 13 '12 at 19:09
    
@Lumiukko As Stefan says, closing as a duplicate automatically edits in a link into the top of the question. It also lists the people who voted to close at the bottom, but the idea is that by the time you read down the page to that you've already seen the link. –  Joseph Wright Dec 14 '12 at 8:27
add comment

migrated from stackoverflow.com Nov 17 '12 at 17:24

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Gonzalo Medina, Paulo Cereda, Torbjørn T., Kurt, Stefan Kottwitz Nov 18 '12 at 0:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers

You could try the package "pst-tree" from "pstricks":

http://tug.org/PSTricks/main.cgi?file=pst-tree/pst-tree

It has its own syntax, but from the examples you can learn it quite fast.

share|improve this answer
add comment

In this case, I wouldn't use a tree; here's one option:

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{trees,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
    
Minor comment: you're listing the trees library, but not actually using it. It works without that. –  Faheem Mitha Jan 26 at 18:08
add comment

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