2
\begin{frame} {Family work up }
\begin{tikzpicture}[level 1/.style={sibling distance=5cm},level 2/.style={sibling distance=2.5cm}]
    \node {Patient}[edge from parent fork down]
        child { node {Daughter 32 years}}
        child { node {Son 28 years}}
        child { node {\color{red} {Daughter 23 years}}}         
    ;
\end{tikzpicture}
\end{frame}

Hi Above code produces a small family tree. I would like to highlight a child (Daughter 23 years) suggesting she also has got a disease. This can be done by encircling it with a box or highlighting it with a color. Kindly help.

  • 1
    Your answer below would be better as an edit to your question. Also, please post a full working example: example code that does not compile isn't very helpful because anyone who is inclined to help has to first figure out what packages etc you are using...people are much more likely to help if you give them a working example to start with. – Andrew Feb 1 '16 at 11:59
  • Do you want it highlighted on the same frame or on two different overlays? – Rmano Feb 1 '16 at 12:00
  • Thanks. it would be better if on two different overlays with animation if possible. – Vaibhav Feb 1 '16 at 12:09
2

You like to have something like this?

enter image description here

The code:

\documentclass[compress,final]{beamer}
\usepackage{tikz}
\usetikzlibrary{trees}

\begin{document}
\begin{frame}{Family work up }
\begin{tikzpicture}[
level 1/.style={sibling distance=3cm},level 2/.style={sibling distance=2.5cm}]
    \node {Patient}[edge from parent fork down]
        child { node {Daughter 32 years}}
        child { node {Son 28 years}}
        child { node[draw=red] {Daughter 23 years}}
    ;
\end{tikzpicture}

or

\begin{tikzpicture}[
level 1/.style={sibling distance=3cm},level 2/.style={sibling distance=2.5cm}]
    \node {Patient}[edge from parent fork down]
        child { node {Daughter 32 years}}
        child { node {Son 28 years}}
        child { node[fill=gray!30] {Daughter 23 years}}
    ;
\end{tikzpicture}
\end{frame}
\end{document}

Nodes in tree you can design as other nodes in tikzpicture, just add to them desired parameters, similarly as I do above. And by the way: sibling distance 5cm is to big that with it the tree can be fitted onto slide so I reduce it to 3cm.

1

Also, using the macro from Using beamer overlays with forest generated trees, to have two overlays:

\documentclass[compress,final]{beamer}
\usepackage{tikz}
\tikzset{
    invisible/.style={opacity=0},
    visible on/.style={alt={#1{}{invisible}}},
    alt/.code args={<#1>#2#3}{%
        \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
    },
}

\usetikzlibrary{trees}

\begin{document}
\begin{frame}{Family work up }
\begin{tikzpicture}[
level 1/.style={sibling distance=3cm},level 2/.style={sibling distance=2.5cm}]
    \node {Patient}[edge from parent fork down]
        child { node {Daughter 32 years}}
        child { node {Son 28 years}}
        child { node[alt={<2->{fill=yellow}{}}] {Daughter 23 years}}
    ;
\end{tikzpicture}
\end{frame}
\end{document}

With the result:

result

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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