4

I'm using the genealogytree package and want to use multiple lines as family label (where you normally write data like marriage)

\documentclass{report}
\usepackage[all]{genealogytree}
\begin{document}
\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label={\gtrsymMarried~first line\\another line}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}
\end{document}

This is what I tried, but the package ignores the line break. What can I do about it?

3
  • fully compilable MWE. you know the drill.
    – naphaneal
    Apr 20, 2018 at 17:55
  • @naphaneal Sure, thx. for pointing out! Apr 20, 2018 at 19:24
  • 1
    @naphaneal ah, if it just was always that easy to get an MWE from OPs. It would be so refreshing.
    – thymaro
    Apr 23, 2018 at 19:06

3 Answers 3

2
+50

Options for labels can be given by label options. These a TikZ node options.

For multiline text, you need something like align=center.

The following shows an application with some more options to play:

\documentclass{report}
\usepackage[all]{genealogytree}
\begin{document}
\begin{tikzpicture}
\genealogytree[template=signpost,
    label options={align=center,font=\footnotesize,
      inner sep=1pt,fill=white,opacity=0.75,text opacity=1}
    ]{
    child[family label={\gtrsymMarried~first line\\another line}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}
\end{document}

enter image description here

3
  • Very good also with opacity. +1.
    – Sebastiano
    Apr 23, 2018 at 10:44
  • Why two times "label options"? Apr 25, 2018 at 8:42
  • @principal-ideal-domain No need for both - just a relict from the original code, sorry. I updated the code now. Apr 25, 2018 at 10:46
6

To allow linebreaks, you can insert a vertical box, for example a minipage or a \parbox. These require you to specify the width of the box but you probably want this to be automatically determined, so you can use the pbox package to get a parbox, which automatically shrinks to the required width. You still have to specify a maximum line width. I would just use \textwidth, but you can insert a more smaller dimension to get automatic linebreaking if a line is too long:

\documentclass{report}
\usepackage[all]{genealogytree}
\usepackage{pbox}
\begin{document}
\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label=\pbox{\textwidth}{\gtrsymMarried~first line\\another line}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}

% If you prefer a centered symbol:
\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label=\gtrsymMarried\scriptsize~\pbox{\textwidth}{first line\\another line}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}

\end{document}

enter image description here

1

With stacks or TABstacks, you can obtain a variety of appearances:

\documentclass{report}
\usepackage[all]{genealogytree}
\usepackage{tabstackengine}
\setstacktabbedgap{3pt}
\begin{document}
\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label={\Longstack{\gtrsymMarried~first line\\another line}}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}
\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label={\scriptsize\tabbedLongstack[l]{\gtrsymMarried&first line\\&next line}}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}
\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label={\gtrsymMarried\scriptsize\ \Centerstack[l]{first line\\next line}}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}\bigskip

\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label={\gtrsymMarried\setstackgap{L}{5.5pt}\tiny\ \Centerstack[l]{first line\\next line\\last line}}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}
\end{document}

enter image description here

1
  • EXCELLENT ALSO YOUR CODE. +1.
    – Sebastiano
    Apr 26, 2018 at 22:28

You must log in to answer this question.

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