Solution 1: Allow variable node width and font size shrinking. Slightly enlarge the level size=1.5cm
to, for example level size=1.6cm
, to handle the specific situation (f
causes font shrinking).
Solution 2: Allow variable node height with the cost of fixed node width and fixed font size. (see below)
Explanation
It is the total height of node g[female]
that matters. Here the "node" is a genealogytree
concept and is different from the tikz
node.
Initially, genealogytree
sets option timeflow=down
. This fixes the height of every node to level size
, and let option node size from
sets the range of node width. If the natural height or width of node is larger than the fixed height or minimum width, respectively, genealogytree
tries to firstly enlarge the width. If maximum width (with fixed height) is still not big enough, then font size is shrunk, using fitting
library of tcolorbox
.
In your example,
level size=1.5cm
and node size from=2cm to 4cm
sets the node size;
- by setting
\gtrset{info separators={\par}{. }{}{}}
, the node content is split into four paragraphs, joined by three vertical skip \parskip
;
- by setting
before upper={\parskip=0.15\tcbfitdim plus 0pt minus 0pt}
, \parskip
is set, at the beginning of node content, to be variable with font size. Here \tcbfitdim
represents the used font size set by fitting
library of tcolorbox
. (By setting fit basedim=8pt
, \tcbfitdim
starts from 8pt
).
- Here comes the most tricky part: the
f
(with a depth) in comment = {born NameWithfxx}
makes the natural (total) height of node slightly bigger than 1.5cm, which causes node width enlarging. But even using maximum width will not solve the too-high problem, font size is then shrunk (with the maximum width applied). This makes the output of f
and r
differs in two ways: the node width and the font size. But these differences has a same cause.
- The change to
\parskip
is nothing more than adding vertical spaces and making the node higher.
Some examples to show how tricky it is:

\documentclass{article} %or standalone
\usepackage[all]{genealogytree}
\gtrset{info separators={\par}{. }{}{}} %no period after comment
\begin{document}
\newcommand\testGTree[3][]{
\par
\parbox{20em}{\texttt{%
\detokenize{\parindent= #2} ... \\
comment = \detokenize{#3}
}}
\begin{tikzpicture}[baseline=(current bounding box.center)]
\genealogytree[
processing=fit,
level distance=1cm,
level size=1.5cm,
node size from=2cm to 4cm,
box clear,
box={enhanced,fit basedim=8pt,
halign=center,valign=center,
before upper={\parskip=#2 plus 0pt minus 0pt},
drop fuzzy shadow
},
database content interpreter,
database format=full,
list separators hang,
edges=rounded,
date format=dd.mm.yyyy,
#1]
{
parent{
g[id=xxx]{
female,
name = {Name \surn{Long Surname}},
birth- = {1865-10-08},
death- = {1945-08-20},
comment = {#3\smash{, \the\tcbfitdim}},
}
}
}
\draw (0, 0) grid (4, .1); % to measure node width
\end{tikzpicture}
\par
}
\parindent=0pt
\paragraph{Group 1} zero \verb|\parindent| is ok
\testGTree{0pt}{f}
\testGTree{0pt}{r}
\paragraph{Group 2} \verb|\parindent=.8pt ...| is enough to trigger width enlarging and font size shrinking
\testGTree{.8pt}{f}
\testGTree{.8pt}{r}
\paragraph{Group 3} with \verb|\parindent=0.15\tcbfitdim ...|, depth \verb|0.2pt| is enough to trigger.
\newlength{\charDepth}
\newcommand{\showDepth}[1]{%
\settodepth\charDepth{#1}%
#1\smash{, \the\charDepth}
}
\testGTree{0.15\tcbfitdim}{\showDepth f}
\testGTree{0.15\tcbfitdim}{\showDepth r}
\testGTree{0.15\tcbfitdim}{r \rule[-.2pt]{1pt}{5pt}}
\paragraph{Group 4} a slightly larger \verb|level size=1.6cm| fixes the original problem.
\testGTree[level size=1.6cm]{0pt}{f}
\testGTree[level size=1.6cm]{0pt}{r}
\end{document}
Solution 2
Result: fix node width and let node height change by content. Restricted by the package implementation, you cannot have both width and height variable.
Main change: use tcolorbox
option natural height
. Search natural height
in doc of genealogytree
to see more examples.
Changes in detail:
- Add option
natural height
inside box={...}
.
- Change
processing=fit
to processing=tcolorbox
, to allow variable node height. Also add size=title
inside box={...}
to set tcolorbox margins.
- Adjust
node size
to some appropriate value. This would be used as the fixed node width.
- Replace useless
fitting
related options. Inside box={...}
,
- replace
fit basedim=8pt
by fontupper=\fontsize{8}{9.6}\selectfont
- replace
0.15\tcbfitdim
used in before upper={...}
by 1.2pt
(8pt * 0.15
).

\documentclass{article} %or standalone
\usepackage[all]{genealogytree}
\gtrset{info separators={\par}{. }{}{}} %no period after comment
\begin{document}
\begin{tikzpicture}[baseline=(current bounding box.center)]
\genealogytree[
processing=tcolorbox,
level distance=1cm,
level size=1.5cm,
node size=3cm,
box clear,
box={enhanced,
fontupper=\fontsize{8}{9.6}\selectfont,
halign=center, valign=center, size=title,
% 1.2pt = 8pt * 0.15
before upper={\parskip=1.2pt plus 0pt minus 0pt},
drop fuzzy shadow,
natural height
},
database content interpreter,
database format=full,
list separators hang,
edges=rounded,
date format=dd.mm.yyyy]
{
parent{
g[id=xxx]{
female,
name = {Name \surn{Long Surname}},
birth- = {1865-10-08},
death- = {1945-08-20},
comment = {born NameWithfxx},
}
}
}
\end{tikzpicture}
\end{document}
\parskip 0.15\tcbfitdim plus 0pt minus 0pt
does or moreover what the problem with that is (in the cases with the character f and q f.e.)