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.

I'm a medical student and I need to write a report on a patient for next week. I'm fairly new to LaTeX, so I was wondering if there is a way of creating a genogram like the one below. It needs to have both the usual family tree and the type/quality of the relationships between each person.

Is there a package that could make this easier? I have zero experience with TikZ and graphics, and I feel I won't have time to do this.

I found an earlier question regarding genograms, but they were much simpler, and it was already 1 year old.

enter image description here

share|improve this question
    
I guess it can be done using TikZ (not that I can do it) but why not just include the picture you have provided? –  Svend Tveskæg Oct 28 '13 at 20:19
1  
For next week? Hum... too complicated to do this with tikz in so short time. –  Sigur Oct 28 '13 at 20:28
    
the image is from a friend's report, using word. to do it with an external program is also a possibility, I am looking for an "in-house" solution for styling sake. I guess the most important thing is the actual genogram, the "relationships" lines can be drawn in a different graphic. –  Santiago Oct 28 '13 at 20:38
    
There's an example of a family tree at texample.net –  Tom Bombadil Oct 28 '13 at 20:47
5  
I'd probably do it in Inkscape and export it to TikZ –  Uwe Ziegenhagen Oct 28 '13 at 20:47

1 Answer 1

I tried to do this in tikz, the code is quite long but well...

I managed to do everything except those irregular sine paths. I'm afraid I'm not at that level yet. If I find I solution I'll let you know but I'm not sure.

Please note that there might be better solutions than this one, and if you need to do this multiple times, it would be better for you to look for ways to automatize a lot of the options in some way.

graph

\documentclass[border=1cm]{standalone}
\usepackage[T1]{fontenc}
\usepackage{tikz}

\usetikzlibrary{positioning, calc, decorations, decorations.pathmorphing, shapes.arrows, snakes}

\definecolor{outerblue}{RGB}{50,100,170}
\definecolor{innerblue}{RGB}{70,110,170}
\definecolor{lightblue}{RGB}{155,210,220}

\tikzset{sqr/.style={draw=outerblue, thick,rectangle,fill=white,minimum size=1cm},
        cir/.style={draw=outerblue, thick,circle,fill=white,minimum size=1cm},
        every label/.style={font=\tiny, text width=2cm},
        liltext/.style={font=\tiny, inner sep=.5mm},
        bigarrow/.style={single arrow,
                        single arrow head extend=.2mm,
                        draw=outerblue,
                        fill=innerblue,
                        line width=1pt,
                        shorten >= 4.5pt,
                        minimum size=4mm, 
                        text width=4mm,
                        inner sep=.1mm},
        doublea/.style={thick, fill=none, double, double distance=1.5pt},
}

\newcommand{\dil}[1]{\draw[very thick] ($(#1.south west)+(-2mm, -2mm)$) -- ($(#1.north east)+(2mm, 2mm)$);}

\begin{document}
\begin{tikzpicture} 
    % SHAPES

    \node (sqr1) [sqr, label={[align=right,anchor=south east]left:Daniel\\\color{red}?\\"foi-se abaixo depois da morte da minhã mãe"}]  {}; \dil{sqr1}
    \node (sqr2) [sqr, right=8mm of sqr1, label={[anchor=south west]right:João\\\color{red}?\\Pneumonia}] {}; \dil{sqr2}
    \node (cir1) [cir, right=1.5cm of sqr2, label={[anchor=south west]right:Maria José\\\color{red}62\\"coração"}] {}; \dil{cir1}
    \node (sqr3) [sqr, right=2cm of cir1, label={[anchor=south west]right:Jorge\\\color{red}?\\AVG}] {}; \dil{sqr3}
    \node (cir2) [cir, right=1cm of sqr3, label={[anchor=south west]right:Teresa\\\color{red}?\\"causa natural"}] {}; \dil{cir2}

    \node (cir3) [cir, below=1.5cm of sqr1, xshift=5mm, label={[align=right, anchor=south east]left:Fernanda\\65\\AVC (2011)}] {};
    \node (sqr4) [sqr, right=2.3cm of cir3, label={[align=right, anchor=south east]left:António\\75\\HTA, DM, asma, HBP}] {};
    \node (sqr5) [sqr, right=1cm of sqr4, yshift=8mm, label={[yshift=4mm,align=right, anchor=south east]left:?}] {};  \dil{sqr5}
    \node (cir4) [cir, below=1.5cm of sqr3, xshift=1cm, label={[anchor=south west]right:Gilda\\71\\Dislipidémia AVC (2005)}] {};

    \node (sqr6) [sqr, below=1.5cm of cir3, label={[align=right,anchor=south east]left:Armando\\?}] {};
    \node (cir5) [cir, below=1.5cm of sqr4, xshift=-5mm, label={[anchor=south west]right:Cristina\\45}] {};
    \node (sqr7) [sqr, right=2.5cm of cir5, label={[yshift=4mm,align=right,anchor=south east]left:?}] {};
    \node (cir6) [cir, below=1.5cm of cir4, xshift=5mm, label={[anchor=south west]right:Angela\\43}] {};

    \node (sqr8) [sqr, below=1.5cm of sqr6, xshift=-2mm, label={[align=right,anchor=south east]left:Igor\\16}] {};
    \node (sqr9) [sqr, below=1.5cm of cir5, xshift=2mm, label={[anchor=south west]right:Leandro\\12}] {};
    \node (sqr10)[sqr, below=1.5cm of sqr7, xshift=1cm, label={[anchor=south west]right:Bruno Rafaeli\\20}] {};

    % LINES

    \draw[doublea, draw=lightblue] (sqr1.south) -- (sqr4.north); 
    \draw[doublea, draw=lightblue] (sqr2.south) -- (sqr4.north); 
    \draw[doublea, draw=lightblue] (cir1.south) -- (sqr4.north); 
    \draw[doublea, draw=lightblue] (sqr4.east) -- (cir4.west);
    \draw[doublea, draw=lightblue] (sqr4.south) -- (cir5.north);
    \draw[thick, draw=lightblue] (cir4.south) -- (cir6.north);

    \draw (sqr1) |- ([xshift=0em,yshift=-5mm]sqr1.south) -| (cir1.south);
    \draw (sqr2) |- ([xshift=0em,yshift=-3mm]sqr2.south) -| (cir1.south);
    %\draw (sqr3.south) |- to node[near start,above](center1){H} -| (cir2.south); 
    \draw (sqr3) |- ([xshift=0em,yshift=-4mm]sqr3.south) -| (cir2.south);
    \draw (cir4) -- ($(sqr3.south)!0.5!(cir2.south)+(0mm,-4mm)$);  
    \draw (cir3) |- ([xshift=0em,yshift=4mm]cir3.north) -| (sqr4.north);
    \draw[decoration={snake}, decorate] ($(cir3.north)!0.5!(sqr4.north)+(0mm,4mm)$) -- ($(sqr2.south)!0.5!(cir1.south)+(0mm,-3mm)$);
    \draw (sqr5) |- ([xshift=0em,yshift=-1cm]sqr5.south) -| (cir4.south);

    \draw (sqr4) |- ([xshift=0em,yshift=-6mm]sqr4.south) -| (cir4.south);   
    \draw ($(sqr4.south)!0.5!(cir4.south)+(0mm,-6mm)$) node[liltext, above]{1966} -- ($(cir5.north)!0.5!(cir6.north)+(0mm,6mm)$); 
    \draw (cir5) |- ([xshift=0em,yshift=6mm]cir5.north) -| (cir6.north);

    \draw (sqr6) |- ([xshift=0em,yshift=-3mm]sqr6.south) -| (cir5.south);
    \draw ($(sqr6.south)!0.5!(cir5.south)+(0mm,-3mm)$) node[liltext, above]{1995} -- ($(sqr8.north)!0.5!(sqr9.north)+(0mm,3mm)$); 
    \draw (sqr8) |- ([xshift=0em,yshift=3mm]sqr8.north) -| (sqr9.north);

    \draw (sqr7) |- ([xshift=0em,yshift=-3mm]sqr7.south) -| (cir6.south);
    \draw (sqr10) -- ($(sqr7.south)!0.5!(cir6.south)+(0mm,-3mm)$) node[liltext, above, anchor=south east]{1999};
    \draw[doublea] ($(sqr7.south)!0.5!(cir6.south)+(-2mm,-5mm)$) -- ($(sqr7.south)!0.5!(cir6.south)+(2mm,-1mm)$);

    \node[bigarrow, anchor=east, rotate=225] at ($(sqr4.north east)+(.5mm,.5mm)$) {};

    \draw [red!60!black, dashed, thick] plot [smooth cycle] coordinates {
    ([yshift=2mm]sqr4.north east) 
    ([yshift=-3mm]sqr5.south west) 
    ([yshift=-3mm]sqr5.south east) 
    ([yshift=2mm]cir4.north west) 
    ([yshift=1.7mm]cir4.north east) 
    ([xshift=1.2mm]cir4.east) 
    ([yshift=-3mm]cir4.south) 
    ([xshift=-1.8mm,yshift=-2.3mm]sqr4.south)
    %([xshift=-1mm]sqr4.west)
    ([yshift=1mm]sqr4.north west)
    };

\end{tikzpicture}
\end{document}
share|improve this answer

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.