4

I would like to draw the family tree by using genealogytree package. I have no idea how to change the shape of nodes from simple box to something more complicated, for example coat of arms. Always, the box is rectangle. So my question is how to change it to something else. Thank you for your help and tips.

I tried to do it through tcbset, but every attempt failed. So, I'm afraid it will be not the correct way.

\documentclass{article}

\usepackage[czech]{babel}
\usepackage[cp1250]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}    
\usepackage[all]{genealogytree}    
\usepackage{incgraph} 
\usepackage{tikz,pgf}

\begin{document}
\begin{inctext}
\begin{tikzpicture}    
    \genealogytree[template=signpost]{
    parent{           
           c[female]{Silvie Polaková} 
           g[male]{Alex Homola}  
           parent{
                  g[male]{Radomir Palacek}         
                 } 
           parent{   
                  c[female]{Marie Homolova}
                  g[female]{Zdenka Homolova}                  
                  parent{
                         g[female]{Marie Drastichova}
                        }
                  parent{
                         c[female]{Marie Homolova}

                         g[male]{Augustin Homola}
                         c[male]{Josef Homola}

                         parent{
                                g[female]{Amalie Tomanková}
                               }                              
                        } 
                  }
           }         
     }            
\end{tikzpicture}
\end{inctext}
\end{document}
3
  • Please post some compilable example code to support your question. Commented Feb 9, 2017 at 21:02
  • 2
    Possible duplicate of Draw a coat of arms in LaTeX
    – TeXnician
    Commented Feb 9, 2017 at 21:18
  • 2
    @TeXnician I don't think it's exactly a duplicate, here the OP uses genealogytree.
    – CarLaTeX
    Commented Feb 9, 2017 at 21:41

2 Answers 2

1

The box option is used to give options to the underlying box processor. This can be tcolorbox or directly tikz.

For example,

box={bean arc,sharp corners=north,bottom=5mm},

reshapes the box to some coat of arms looking.

male and female are styles which can be redefined to apply male/female specific settings. If tcolorbox is used for processing, these styles can be set using tcbset as you already figured.

See the following complete example:

\documentclass{article}

\usepackage[czech]{babel}
\usepackage[cp1250]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[all]{genealogytree}
\usepackage{incgraph}
\usepackage{tikz,pgf}


\begin{document}
\begin{inctext}[border=3mm]
\begin{tikzpicture}
    \genealogytree[template=signpost,
      level size=2cm,
      box={bean arc,sharp corners=north,bottom=5mm},
      tcbset={
        male/.style={
          colframe=blue!50!black,
          interior style={top color=blue!20,bottom color=blue!50!yellow!5},
          drop fuzzy shadow=blue!25!black!30},
        female/.style={
          colframe=red!50!black,
          colback=red!50!yellow!5,
          interior style={top color=red!20,bottom color=red!50!yellow!5},
          drop fuzzy shadow=red!25!black!30}
      },
      ]{
    parent{
           c[female]{Silvie Polaková}
           g[male]{Alex Homola}
           parent{
                  g[male]{Radomir Palacek}
                 }
           parent{
                  c[female]{Marie Homolova}
                  g[female]{Zdenka Homolova}
                  parent{
                         g[female]{Marie Drastichova}
                        }
                  parent{
                         c[female]{Marie Homolova}

                         g[male]{Augustin Homola}
                         c[male]{Josef Homola}

                         parent{
                                g[female]{Amalie Tomanková}
                               }
                        }
                  }
           }
     }
\end{tikzpicture}
\end{inctext}
\end{document}

enter image description here

2
  • So, if I use directly tikz it will be in the form box={ tikz={ <tikz code> }} into tcbset ? Thank you.
    – Radomir81
    Commented Feb 18, 2017 at 17:20
  • If processing=tikznode is set (as in the answer by Ignasi), options can be given directly as box={ <tikz code> }. Here, <tikz code> is anything you can set as an option for a TikZ node. Commented Feb 19, 2017 at 11:39
4

By default genealogytree uses a \tcboxfit (from tcolorbox) for drawing tree leaves, but you can change it with processing option and select some other tool. One of them is tikznode. In this case, you can use whatever node option available to configure tree's elements.

Following code uses the heraldic shield shape defined in Draw a coat of arms in LaTeX. It seems it will need some adjustment but I hope it serves as starting point.

\documentclass{article}

\usepackage[czech]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{lmodern}    
\usepackage[all]{genealogytree}    
\usepackage{incgraph} 

\makeatletter    

\pgfkeys{/tikz/.cd,
  corner radius/.initial=1.5075cm,
  height shield/.initial=2.25cm,
  minimum width=3cm,
  minimum height=1.5cm,
}

\pgfdeclareshape{heraldic shield}{% taken and modified from page 631 of the manual
  \inheritsavedanchors[from=rectangle] %  this is nearly a rectangle
  \inheritanchorborder[from=rectangle]
  \inheritanchor[from=rectangle]{center}
  \inheritanchor[from=rectangle]{north}
  \inheritanchor[from=rectangle]{north west}
  \inheritanchor[from=rectangle]{north east}
  \inheritanchor[from=rectangle]{south}
  \inheritanchor[from=rectangle]{south west}
  \inheritanchor[from=rectangle]{south east}
  \inheritanchor[from=rectangle]{west}
  \inheritanchor[from=rectangle]{east}

   \savedmacro\cornerradius{%
    \edef\cornerradius{\pgfkeysvalueof{/tikz/corner radius}}%
  }

   \savedmacro\heightshield{%
    \edef\heightshield{\pgfkeysvalueof{/tikz/height shield}}%
  }

  \savedmacro\posarc{%
    \edef\posarc{1.75cm*\heightshield}%
  }

  \backgroundpath{%  this is new
    %  store lower right in xa/ya and upper right in xb/yb
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    %  construct main path
    \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}
    \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}}
    \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
     \pgfpatharc{360}{270}{\cornerradius}%
     \pgfpatharc{270}{180}{\cornerradius}%
     \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathclose
 }

  \savedanchor{\bottom}{
    \pgf@y=-\heightshield%
    \pgf@x=0cm %
    }

    \savedanchor{\arcleft}{
    \pgf@y=-\posarc%
    \pgf@x=0.9cm %
    }
    \savedanchor{\arcright}{
    \pgf@y=-\posarc%
    \pgf@x=-0.9cm %
    }
 \anchor{bottom}{\bottom}
 \anchor{arc left}{\arcleft}
 \anchor{arc right}{\arcright}
}
\makeatother

\tikzset{arms/.style={draw=#1, line width=1mm, heraldic shield, text width=20mm, align=center}}

\begin{document}
\begin{inctext}
\begin{tikzpicture}    
    \genealogytree[
    processing=tikznode,
    male/.style={box={arms=blue}},
    female/.style={box={arms=red}},
    box={arms=black}]{
    parent{           
           c[female]{Silvie Polaková} 
           g[male]{Alex Homola}  
           parent{
                  g[male]{Radomir Palacek}         
                 } 
           parent{   
                  c[female]{Marie Homolova}
                  g[female]{Zdenka Homolova}                  
                  parent{
                         g[female]{Marie Drastichova}
                        }
                  parent{
                         c[female]{Marie Homolova}

                         g[male]{Augustin Homola}
                         c[male]{Josef Homola}

                         parent{
                                g[female]{Amalie Tomanková}
                               }                              
                        } 
                  }
           }         
     }            
\end{tikzpicture}
\end{inctext}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .