1 2
3 4
5 6 7
8 9 10
11 12 13 14 15
16 17
18 19 20
21 22 23
24 25
26 27 28
29 30 31 32 33 34 35 36
37 38 39 40 41
42 43 44 45 46
47 48 49 50 51
52 53
54
genealogytree
57
58 59 60 61 62
63 64 65 66
67 68 69
70 71 72
73 74 75 76
77 78 79
80 81 82 83 84 85 86
87 88 89
90 91 92 93
94 95 100 101 102 103 104 105 106 107 108
109 110
111 112 113 114 115
116 117 118
119 120 121
122 123 124 125 126 127 128 129
130 131 132
133 134 135 136 145 146 147 148 149
150 151 152 153
154 155 156 157
158 159 160 161 162 163 164
165 166 167 168
169 170 171 172
173 174 175 176 177
178 179
180 181
182 183
184 185 186
187 188 189 190 191
192 193 194 195 196
197 198
199 200 201 202
203 204
205 206
207 208 209
210 211 212
213 214
215 216
217 218 219
220 221
222 223 224
225 226 227 Manual for version
2.2.0 (2022/03/17)
230 231 232 233 234
235 236 237 238
Thomas F. Sturm
240 241 242 243
244 245 246 247 248
249 250 251 252 253
254 255 256
257 258 259
260 261 262 263 264 265
266 267 268 269 270 271 272
Cover code
% \usepackage{incgraph}
% \usetikzlibrary{backgrounds}
\begin{inctext}%
\gtrSymbolsSetCreateSelected{blue}{Male}\gtrSymbolsSetCreateSelected{red}{Female}%
\gtrSymbolsSetCreateSelected{black}{Neuter}%
\begin{tikzpicture}
\genealogytree[template=symbol nodes,level size=8mm,level distance=6.5mm, box={title={\gtrnodenumber},height=5mm,attach boxed title to bottom center,
fonttitle=\fontsize{3mm}{3mm}\sffamily,
boxed title style={size=tight,height=3mm,valign=center,left=0.2mm,right=0.2mm}},
tcbset={mytext/.style={notitle,interior style={top color=gtr_Yellow_Frame!50!gtr_Yellow_Back, bottom color=gtr_Yellow_Frame!50!gtr_Yellow_Back,middle color=gtr_Yellow_Back}}},
add parent=a to fam_a,add parent=b to fam_b,add parent=c to fam_c]
{ child{ gm pf
child{ pm gf cm child{ gm pf cf child{ gm pf cf cm cm child{ gm pf
child{ gm pf cf child{ gm pf cf child{ gm pf child{ gm pf cf cm cm } cf cm c[id=a]m } cm } cm } cm cm } } cm } cf cf cf
child{ gm pf cf cm cm child{ gm pf cf cm cm child{ gm pf child{ gm pf cf child{ g[box={width=6.5cm,notitle},phantom*]m
child{g[box={width=6.5cm,height=23mm,enlarge top initially by=-15mm,mytext}, no content interpreter]{\Huge\bfseries genealogytree}
child[id=fam_a] {gf cm cf cm
child{ gm pf cf cm child{ gm pf cf child{ gm pf cf cm child[id=fam_b]{ gm cf cf child{ gm pf cf
child{ gm pf cm cf cf cm cm
child{ gm pf cm child{ gm pf cm cf child{ gm pf child{ gm pf cm cf cm cf } cm cf cm cf } cm cf } cf cm cf }
child{ gm pf cm cf cm cf }
child[id=fam_c,pivot shift=2cm]{ g[distance=1cm]m cm child { gm pf cm child{ gm pf cm cm cf cf cf cm cm cf } cm
child{ gm pf cf cm child{ gm pf cm cm cf cf cf cm cm cf } cm cf } cf } } }
cm cm } cm cm } } cm cm } cm } cm cf cm } cm cf cf cm cm cm cf }
} cm } cf cm cm } } }
} cm cm
child{ gm pf cm cf cm cm cf }
child{ gm pf child{ pm gf child{ gm pf cm cf cm } } cf cm cf cm } union{ pf cm cm cf
child{ gm pf child{ gm pf cf cm child{ gm pf child{ gm pf child{ gm pf cf child{ gm pf cf child{ gm pf child{ gm pf
child{ gm pf cf child{ gm pf child{ gm pf c[id=b]f cm cm } cf cm cm child{ g[box={width=4cm,notitle},phantom*]m
child{g[box={width=4cm,height=23mm,enlarge top initially by=-15mm, mytext,capture=minipage,halign=center},no content interpreter]
{\large\bfseries Manual for\\ version\\ \version\\(\datum)}
cm cf cm cm child{ gm cf cm cf cm
child{ g[box={width=4cm,mytext},no content interpreter]{Thomas F.~Sturm} } c[id=c]f cm } cf cm }
} } cm cm } cf cm cm } cf cm cm } cm cm }
cm child{ gm pf cf cm cm } cm cm cm } cf cm cm } cf cm cm } cm } cf cm cm
} } } }
\begin{scope}[on background layer]
\node (bg) [fill tile image*={width=4cm}{crinklepaper.png},minimum width=21cm, minimum height=29.7cm,inner sep=0pt,outer sep=0pt] at (current bounding box) {};
\path[top color=white,bottom color=red,fill opacity=0.25]
(bg.south west) rectangle (bg.north east);
\end{scope}
\end{tikzpicture}
\end{inctext}
The genealogytree package
Manual for version 2.2.0 (2022/03/17)
Thomas F. Sturm1
https://www.ctan.org/pkg/genealogytree https://github.com/T-F-S/genealogytree
Abstract
Pedigree and genealogy tree diagrams are proven tools to visualize genetic and rela- tional connections between individuals. The naming for mathematical tree structures with parent nodes and child nodes is traded from historical family diagrams. How- ever, even the smallest family entity consisting of two parents and several children is no mathematical tree but a more general graph.
Thegenealogytree package provides a set of tools to typeset such genealogy trees or, more precisely, to typeset a set of special graphs for the description of family-like structures. The package uses an auto-layout algorithm which can be customized to e.g. prioritize certain paths.
Contents
1 Introduction 9
1.1 Genealogy Trees . . . 9
1.2 Package Design Principles and Philosophy . . . 10
1.3 Comparison with Other Packages . . . 11
1.4 Installation . . . 12
1.5 Loading the Package . . . 12
1.6 Libraries . . . 13
1.7 How to Get Started . . . 13
2 Tutorials 15 2.1 Tutorial: First Steps (Ancestor Tree) . . . 15
2.1.1 Document Setup . . . 15
2.1.2 Creation of a Basic Ancestor Diagram . . . 16
2.1.3 Applying options . . . 18
2.1.4 Growing the Tree . . . 19
2.1.5 Prioritize and Colorize a Path . . . 22
2.1.6 Changing the Timeflow . . . 24
2.2 Tutorial: Diagram Manipulation by ID values (Descendant Tree) . . . 25
2.2.1 Creation of a Basic Descendant Diagram . . . 25
2.2.2 Growing the Tree . . . 26
2.2.3 Separating Diagram Data and Diagram Drawing . . . 29
2.2.4 Emphasizing a Relationship Path . . . 30
2.2.5 Coloring Subtrees . . . 32
2.3 Tutorial: A Database Family Diagram (Sand Clock) . . . 34
2.3.1 Creation of a Basic Sand Clock Diagram . . . 34
2.3.2 Node Content in Database Format . . . 35
1Prof. Dr. Dr. Thomas F. Sturm, Institut für Mathematik und Informatik, Universität der Bundeswehr München, D-85577 Neubiberg, Germany; email: [email protected]
2.3.3 Formatting the Node Content . . . 36
2.3.4 Adding Images . . . 38
2.3.5 Full Example with Frame . . . 39
2.4 Tutorial: Descendants of the Grandparents (Connecting Trees) . . . 43
2.4.1 Descendants of the Two Grandparents . . . 43
2.4.2 Connected Diagram . . . 44
2.5 Tutorial: Multi-Ancestors . . . 46
2.5.1 Triple Ancestor Example . . . 46
2.5.2 Adding Edges Manually . . . 47
2.5.3 Manual Position Adjustments . . . 48
2.6 Tutorial: Externalization . . . 49
2.6.1 Externalization Process . . . 49
2.6.2 Document Setup . . . 49
2.6.3 Marking Diagrams for Externalization . . . 50
2.7 Tutorial: Conversion to Pixel Images . . . 52
2.7.1 Command Line Conversion with MuPDF . . . 52
2.7.2 Command Line Conversion with Ghostscript . . . 52
2.7.3 Command Line Conversion with ImageMagick . . . 53
2.7.4 Conversion with the ’standalone’ Package . . . 53
2.7.5 Conversion during Externalization . . . 54
3 Genealogy Tree Macros 55 3.1 Creating a Genealogy Tree . . . 55
3.2 Using Tree Options . . . 58
3.3 Accessing Information inside Nodes . . . 59
3.4 Auxiliary Tools . . . 61
4 Graph Grammar 63 4.1 Graph Structure . . . 63
4.2 Subgraph ’parent’ . . . 65
4.3 Subgraph ’child’ . . . 67
4.4 Subgraph ’union’ . . . 69
4.5 Subgraph ’sandclock’ . . . 71
4.6 Node ’c’ . . . 73
4.7 Node ’p’ . . . 73
4.8 Node ’g’ . . . 73
4.9 Data ’input’ . . . 74
4.10 Control Sequence ’insert’ . . . 75
5 Option Setting 77 5.1 Option Priorities . . . 77
5.1.1 Option Priorities for Nodes . . . 78
5.1.2 Option Priorities for Families . . . 79
5.2 Graph Growth Setting (Time Flow) . . . 80
5.3 Graph Geometry . . . 83
5.4 Identifiers . . . 92
5.5 Node Options . . . 95
5.6 Family Options . . . 104
5.7 Subtree Options . . . 107
5.8 Level Options . . . 109
5.9 Tree Positioning Options . . . 111
5.10 TikZ and Tcolorbox Options . . . 114
5.11 Ignoring Input . . . 117
5.12 Inserting Input . . . 121
5.13 Phantom Nodes and Subtrees . . . 125
5.14 Childless Families . . . 128
5.15 Autofill Parent Graphs (Ancestors) . . . 132
5.16 Special and Auxiliary Options . . . 136
6 Node Data (Content) Processing 137 6.1 Setting a Node Data Processing and Processor . . . 138
6.2 Predefined Non-Interpreting Processings . . . 139
6.2.1 fit . . . 139
6.2.2 tcolorbox . . . 143
6.2.3 tcbox . . . 146
6.2.4 tcbox* . . . 149
6.2.5 tikznode . . . 152
6.3 Creating a Customized Non-Interpreting Processor . . . 154
6.4 Content Interpreters . . . 155
7 Database Processing 161 7.1 Database Concept . . . 162
7.2 Example Settings . . . 163
7.3 Data Keys . . . 165
7.4 Input Format for Dates . . . 172
7.5 Formatting the Node Data . . . 174
7.6 Formatting Names . . . 184
7.7 Formatting Dates . . . 186
7.8 Formatting Places . . . 190
7.9 Formatting Events . . . 191
7.10 Formatting Lists of Events . . . 193
7.11 Formatting Comments . . . 195
7.12 Formatting Professions . . . 196
7.13 Formatting Lists of Information . . . 197
7.14 Formatting Sex . . . 198
7.15 Formatting Images . . . 199
7.16 Formatting Ages . . . 201
8 Edges 203 8.1 Edge Settings . . . 204
8.2 Edge Types . . . 208
8.3 Edge Parameters . . . 213
8.4 Edge Labels . . . 217
8.5 Edge Labels Database . . . 219
8.6 Adding and Removing Nodes from Edge Drawing . . . 221
8.7 Extra Edges . . . 226
8.8 Edge Shifting . . . 231
9 Genealogy Symbols 237 9.1 Symbol Color Settings . . . 237
9.1.1 Global Color Settings . . . 237
9.1.2 Local Color Settings . . . 238
9.2 List of Symbols . . . 239
9.3 Legend to Symbols . . . 243
9.3.1 Printing a Legend . . . 243
9.3.2 Description Texts and Language Settings . . . 244
10 Language and Text Settings 247 10.1 Preamble Settings . . . 247
10.2 Document Settings . . . 248
11 Debugging: Library LIB debug 249 11.1 Parser Debugging . . . 249
11.2 Processor Debugging . . . 252
11.3 Graphical Debugging . . . 261
11.4 Show Information . . . 265
12 Templates: Library LIB templates 269 12.1 Using Templates . . . 269
12.2 Template ’formal graph’ . . . 269
12.3 Template ’signpost’ . . . 270
12.4 Template ’symbol nodes’ . . . 270
12.5 Template ’tiny boxes’ . . . 271
12.6 Template ’tiny circles’ . . . 271
12.7 Template ’directory’ . . . 272
12.8 Template ’database pole’ . . . 273
12.9 Template ’database pole reduced’ . . . 275
12.10 Template ’database poleportrait’ . . . 276
12.11 Template ’database poleportrait reduced’ . . . 278
12.12 Template ’database portrait’ . . . 279
12.13 Template ’database portrait reduced’ . . . 281
12.14 Template ’database traditional’ . . . 282
12.15 Template ’database traditional reduced’ . . . 283
12.16 Template ’database sideways’ . . . 284
12.17 Template ’database sideways reduced’ . . . 286
12.18 Template ’database sidewaysportrait’ . . . 287
12.19 Template ’database sidewaysportrait reduced’ . . . 288
12.20 Template ’database relationship’ . . . 289
12.21 Template ’ahnentafel 3’ . . . 290
12.22 Template ’ahnentafel 4’ . . . 292
12.23 Template ’ahnentafel 5’ . . . 294
12.24 Template ’a4paper 3’ . . . 296
12.25 Template ’a4paper 4’ . . . 297
12.26 Template ’a3paper 5’ . . . 298
12.27 Template ’letterpaper 3’ . . . 299
12.28 Template ’letterpaper 4’ . . . 299
12.29 Template ’display 16:9 3’ . . . 300
12.30 Template ’display 16:9 4’ . . . 301
12.31 Template ’display 16:9 5’ . . . 302
12.32 Template ’display 16:10 3’ . . . 303
12.33 Template ’display 16:10 4’ . . . 303
12.34 Template ’display 16:10 5’ . . . 303
12.35 Border Size Options . . . 304
12.36 Predefined Colors of the Library . . . 306
12.37 Auxiliary Control Sequences . . . 307
13 Fancharts: Library LIB fanchart 309
13.1 Fan Chart Diagrams . . . 309
13.2 Geometry Options . . . 312
13.3 Segment Text Options . . . 318
13.4 Color and Style Options . . . 320
13.5 Templates . . . 333
13.5.1 Template ’spartan’ . . . 333
13.5.2 Template ’malefemale sober’ . . . 334
13.5.3 Template ’malefemale relation’ . . . 334
13.5.4 Template ’colorwheel sober’ . . . 335
13.5.5 Template ’colorwheel serious’ . . . 335
13.5.6 Template ’colorwheel malefemale’ . . . 336
13.5.7 Template ’colorwheel rich’ . . . 336
13.5.8 Template ’colorwheel opulent’ . . . 337
13.5.9 Template ’wave sober’ . . . 337
13.5.10 Template ’wave serious’ . . . 338
13.5.11 Template ’wave malefemale’ . . . 338
13.5.12 Template ’wave rich’ . . . 339
13.5.13 Template ’wave opulent’ . . . 339
13.5.14 Template ’radial sober’ . . . 340
13.5.15 Template ’radial serious’ . . . 340
13.5.16 Template ’radial malefemale’ . . . 341
13.5.17 Template ’radial rich’ . . . 341
13.5.18 Template ’radial opulent’ . . . 342
13.6 Advanced Customization . . . 343
14 Auto-Layout Algorithm 347 14.1 Preliminaries . . . 347
14.1.1 Aesthetic Properties . . . 347
14.1.2 Genealogy Trees . . . 348
14.1.3 Graph Grammar . . . 348
14.2 Requirements . . . 349
14.2.1 Parent and Child Alignment . . . 349
14.2.2 Patchwork Families . . . 350
14.2.3 Graph Growing Direction . . . 351
14.3 Algorithmic Steps . . . 352
14.3.1 Recursive Family and Node Placement . . . 352
14.3.2 Contours . . . 352
14.3.3 Combining Subtrees . . . 353
14.4 Known Problems . . . 354
15 Example Graph Files 357 15.1 example.option.graph . . . 357
15.2 example.database.graph . . . 358
15.3 example.formal.graph . . . 359
15.4 example.neumann.graph . . . 360
16 Stack Macros 365 16.1 Creating a Stack . . . 365
16.2 Push to a Stack . . . 365
16.3 Pop from a Stack . . . 366
16.4 Peek into a Stack . . . 366
16.5 Creating Stack Shortcuts . . . 367
Bibliography 369
Index 371
1
Introduction
1.1 Genealogy Trees
The naming for mathematical tree structures with parent nodes and child nodes is traded from historical family diagrams. But, creating a family diagram for medical and sociological studies or family research can become surprisingly difficult with existing tools for tree visualization.
The simple reason is, that a mathematical tree has only one parent node for its direct children nodes.
parent
child child child
With reverse logic, this can be used to visualize ancestor diagrams starting from an individual to its predecessors:
proband father
grandfather grandmother
mother
grandfather grandmother
However, even the smallest family entity consisting of two parents and several children is no mathematical tree but a more general graph:
child child child uncle father
grandfather grandmother
aunt mother
grandfather grandmother
uncle
Thegenealogytreepackage aims to support such graphs which will be denotedgenealogy trees in the following. The graphs to be processed cannot become arbitrarily complex. A set of special graphs for the description of family-like structures is supported by the package algorithms. From at theoretical point of view, these graphs can be seen as a sort of annotated mathematical trees.
1.2 Package Design Principles and Philosophy
The emphasis of a genealogy tree is not the node or individual, but the family. A family is a set of arbitrarily many parents and children. From an algorithmic point of view, there could be more than two parents in a family.
child child child father mother
A single family
A node is either a parent or a child to a specific family. A node can also be child to one family and parent to another (or many) families. Such a node is called a g-node (genealogy node) in the following.
child child child uncle father (g-node)
grandfather grandmother
aunt mother
Two families
The main restriction of the graph grammar is that there is exactly one g-node which connects its enclosing family to another one. In the example above, the father node is the g-node in the grandparents family. It is linked to the family with mother and children.
A strong driving force for elaborating and creating this package was to balance two contradictory goals for diagram generation: automatism and customization. In the ideal case, a diagram would be constructed automatically by data provided from an external data source and would also be freely customizable in any thinkable way starting changing colors, lines, shapes, node positioning, etc. In the real world, a trade-off between these goals has to be found.
Automatism:
• For a set of genealogy trees described by a grammar, see Chapter 4 on page63, an auto- layout algorithms computes the node positioning.
• The graph grammar is family-centric and supports ancestors and descendants diagrams.
For the later, multiple marriages can be used to a certain degree.
• The graph data can be written manually, but the package design is adjusted to process automatically generated data. There are many genealogy programs which manage family related data. The general idea is that such programs export selected diagram data in a text file using the provided grammar. Processing GEDCOM1 files directly by the package is not possible.
• While manipulations like coloring a single node can be done directly at node definition, the package design makes a lot of efforts to allow manipulations aside from the actual place of data definition, see Section 5.1.1 on page 78 and Section 5.1.2 on page 79. The idea is that automatically generated data has not to be edited, but can be manipulated from outside. Also, an automatically or manually generated data set can be used for several distinct diagrams; e.g. the graph data in Section15.1on page357is used numerous times inside this document for different diagrams.
1GEDCOM (GEnealogical Data COMmunication) is a widely used data exchange format.
• The auto-layout algorithm is implemented in pure TEX/LATEX (without Lua). This imposes all programming restrictions of this macro language on the implementation, but makes the package independent of external tools and fosters LATEX customization.
Customization:
• The auto-layout algorithm can be customized to e.g. prioritize certain paths or exclude selected subtrees. Also, several node dimensions and distances can be changed globally or locally.
• The appearance of a node can be customized with all capabilities of TikZ [5] and tcolorbox [4]. Also, the node text can be processed.
• For the node content, a database concept can be used, see Chapter 7 on page 161. This gives a high degree of customizing the data visualization inside the node.
• The geometry of edges between nodes is not considered by the auto-layout algorithm, but edges can also be customized in many ways, see Chapter 8on page 203.
• Several genealogy tree diagrams can be interconnected manually to form a more complex total diagram.
On the technical side, the package is based on The TikZ and PGF Packages [5] and uses The tcolorbox package [4] for the nodes. Since all processing is done in TEX/LATEX without Lua and external tools, one should expect a lot of processing time for complex diagrams. Therefore, using an externalization of the diagrams is recommended.
1.3 Comparison with Other Packages
This is not really a comparison, but more a hinting to other possibilities for graph drawing. I am not aware of another package with focus on genealogy trees as defined here, but surely there are excellent other graph drawing packages. The first to name is TikZ itself. There, one will find a bunch of graph drawing tools with different algorithms, partly implemented in Lua. The second one is the forestpackage which is also very powerful and does not need Lua.
1.4 Installation
Typically, genealogytree will be installed as part of a major LATEX distribution and there is nothing special to do for a user.
If you intend to make a local installationmanually, you have to install not onlytcolorbox.sty, but also all *.code.texfiles in the local texmftree.
texmf/
doc/ latex/ genealogytree/
genealogytree.pdf
genealogytree-example-*.pdf genealogytree-languages.pdf genealogytree.doc.sources.zip README
tex/ latex/ genealogytree/
genealogytree.sty gtrcore.*.code.tex gtrlang.*.code.tex gtrlib.*.code.tex
1.5 Loading the Package
The base package genealogytree loads the package tcolorbox [4] with its skins, fitting, and external libraries. This also loads several other packages are loaded, especially tikz [5]
with itsarrows.metaand fitlibraries.
genealogytreeitself is loaded in the usual manner in the preamble:
\usepackage{genealogytree}
The package takes option keys in the key-value syntax. Alternatively, you may use these keys later in the preamble with\gtruselibrary→P. 13(see there). For example, the key to use debug code is:
\usepackage[debug]{genealogytree}
1.6 Libraries
The base package genealogytree is extendable by program libraries. This is done by using option keys while loading the package or inside the preamble by applying the following macro with the same set of keys.
U2017-01-20 \gtruselibrary{⟨key list⟩}
Loads the libraries given by the⟨key list⟩.
\gtruselibrary{all}
The following keys are used inside \gtruselibrary respectively \usepackagewithout the key tree path /gtr/library/.
/gtr/library/debug ( LIB debug)
Loads additional code for debugging a genealogy tree. This is also useful for displaying additional informations during editing a graph; see Chapter 11on page 249.
/gtr/library/templates ( LIB templates)
Loads additional code for templates. These are styles to set various options by one key; see Chapter 12 on page269.
/gtr/library/fanchart ( LIB fanchart)
Loads additional code to draw ancestor fancharts. Therefor, the auto-layout algorithm is replaced by a specialized other algorithm; see Chapter13 on page 309.
/gtr/library/all (style, no value)
Loads all libraries listed above.
For the curious readers: There are additional core libraries which are loaded automatically and which are not mentioned here. Also, languages are special libraries which are loaded by
\gtrloadlanguage→P. 248.
Third party libraries (denoted external libraries) can also be loaded using \gtruselibrary, if they follow the file naming scheme gtrlib.⟨key⟩.code.tex
% Loading ’gtrlib.foobar.code.tex’
\gtruselibrary{foobar}
Note that such external libraries are not version-checked as internal libraries are.
1.7 How to Get Started
You don’t have to read this long document to start creating your first genealogy tree. A good starting point is to browse through the tutorials in Chapter 2 on page15 and simply try some of them on your computer. The package provides a lot of options and allows many adjustments to node setting, but you do not need to know them in advance to create the first examples.
You should also take a look at Chapter 12 on page 269, where template examples are shown which could be useful instantly.
For using advanced features, it is not harmful to know at least the basics of TikZ [5] and tcolorbox [4], sincegenealogytree is based on both.
2
Tutorials
2.1 Tutorial: First Steps (Ancestor Tree)
2.1.1 Document Setup
Most examples in this documentation will display some code snippets which one can use in a document with proper set-up. This very basic tutorial will create a tiny full document. If this does not work on your system, there is probably some installation problem. Typically, this can be solved by just updating the TEX distribution.
The very first document just tests, if the package is installed:
\documentclass{article}
\usepackage[all]{genealogytree}
\begin{document}
\section{First Test}
Package loaded but not used yet.
\end{document}
1 First Test Package loaded but not used yet.
1
2.1.2 Creation of a Basic Ancestor Diagram
Now, we start with the very first genealogy tree. Such trees are family-centric. So, let us begin with a family consisting of mother and father and three children. Chapter 4 on page 63 tells us, that there are different kinds of families; the two main ones are parent and child. For a single family, the choice is quite irrelevant. Here, we think about extending the example to grandparents. Therefore, we take the parentconstruct.
Before the details are discussed, let us try a full example:
\documentclass{article}
\usepackage[all]{genealogytree}
\begin{document}
\section{First Test}
\begin{tikzpicture}
\genealogytree{
parent{
g{first child}
c{second child}
c{third child}
p{father}
p{mother}
} }
\end{tikzpicture}
\end{document}
1 First Test
first child second child third child
father mother
1
The environment tikzpicture is the main picture environment from the TikZ [5] package.
\genealogytree→P. 55 can only be used inside such an environment.
When testing this example, be very sure about setting all braces properly. The internal parser will react very sensitive on input errors. Of course, this is nothing new for a TEX user, but larger trees will have a lot of hierarchical braces and error messages will likely not be very talkative about where the error is.
The genealogytree package uses {} pairs for structuring and [] pairs for options like typical LATEX does.
In the following, we will not see full documents but code snippets and their output. Note that the full example used the alloption to load all libraries of genealogytree, see Section 1.6on page 13. You should also add all libraries for testing the examples. Later, you may choose to reduce the libraries.
Let us look at our example again with focus on the relevant part:
\begin{tikzpicture}
\genealogytree{
parent{
g{first child}
c{second child}
c{third child}
p{father}
p{mother}
} }
\end{tikzpicture}
first child second child third child
father mother
Our parentfamily has two parents denoted by p and three children, two of them denoted by c as expected. But one child, not necessarily the first one, is denoted byg. This is theg-node which connects a family uplink to another family. Here, we have a single family which is the root family where nouplink exists. Nevertheless, ag-node has to be present.
2.1.3 Applying options
Certainly, the size and distance of the nodes can be changed. A quick way to adapt the graph is to use preset values from a given /gtr/template→P. 269. We put this to the option list of
\genealogytree→P. 55.
\begin{tikzpicture}
\genealogytree[template=signpost]{
parent{
g{first child}
c{second child}
c{third child}
p{father}
p{mother}
} }
\end{tikzpicture}
first child second child third child
father mother
Options can also be set for families and nodes. We enhance our genealogy tree by giving /gtr/male→P. 101 and /gtr/female→P. 101 settings to the nodes:
\begin{tikzpicture}
\genealogytree[template=signpost]{
parent{
g[female]{first child}
c[male]{second child}
c[female]{third child}
p[male]{father}
p[female]{mother}
} }
\end{tikzpicture}
first child second child third child
father mother
2.1.4 Growing the Tree
As next step, the father node shall get a grandfather and a grandmother. For this, the father node has to become ag-node which links the grandparents family to the root family:
\begin{tikzpicture}
\genealogytree[template=signpost]{
parent{
g[female]{first child}
c[male]{second child}
c[female]{third child}
parent{
g[male]{father}
}p[female]{mother}
} }
\end{tikzpicture}
first child second child third child
father mother
Visually, nothing happened. But, the father node is nowg-node of a new family. As in our root family, we can add parents pand even other childrenc. Of course, these other children are the siblings of the father node:
\begin{tikzpicture}
\genealogytree[template=signpost]{
parent{
g[female]{first child}
c[male]{second child}
c[female]{third child}
parent{
c[female]{aunt}
g[male]{father}
c[male]{uncle}
p[male]{grandfather}
p[female]{grandmother}
}p[female]{mother}
} }
\end{tikzpicture}
first child second child third child
aunt father uncle
grandfather grandmother
mother
One could replace all parents p by parent families with a single g-node. This would increase the expense, but can be a good thing when editing and compiling a tree step by step.
We now prepare our tree for expansion and replace mother, grandfather, and grandmother with
appropriate parentfamilies.
\begin{tikzpicture}
\genealogytree[template=signpost]{
parent{
g[female]{first child}
c[male]{second child}
c[female]{third child}
parent{
c[female]{aunt}
g[male]{father}
c[male]{uncle}
parent
{ % former ’p’ node g[male]{grandfather}
}parent{
% former ’p’ node g[female]{grandmother}
} } parent
{ % former ’p’ node g[female]{mother}
} }
\end{tikzpicture}}
first child second child third child
aunt father uncle
grandfather grandmother
mother
Again, we populate the three added families with parentspand children c.
\begin{tikzpicture}
\genealogytree[template=signpost]{
parent{
g[female]{first child}
c[male]{second child}
c[female]{third child}
parent{
c[female]{aunt}
g[male]{father}
c[male]{uncle}
parent
{ g[male]{grandfather}
p[male]{great-grandfather}
p[female]{great-grandmother}
}parent{
g[female]{grandmother}
p[male]{great-grandfather 2}
p[female]{great-grandmother 2}
c[male]{granduncle}
} } parent
{ c[male]{uncle 2}
g[female]{mother}
p[male]{grandfather 2}
p[female]{grandmother 2}
} }
\end{tikzpicture}}
first child second child third child
aunt father uncle
grandfather great-
grandfather great- grandmother
grandmother great- grandfather
2
great- grandmother
2
granduncle
uncle 2 mother grand-
father 2 grand- mother 2
2.1.5 Prioritize and Colorize a Path
After the tree has been grown to its final size, we want to influence the node positions. Let us assume that the lineage fromfirst child togreat-grandmother 2 has to be especially emphasized.
To prioritize a node, the/gtr/pivot→P. 97 option can be used. This will place a node centered in relation to its ancestors and/or descendants. If this option is used for several connected nodes, a straight lineage is generated. All other nodes are placed automatically to respect this lineage.
%... g[pivot,female]{first child}
%...
To emphasize this lineage further, the respective nodes should be colorized differently. With standard settings, every node is drawn as atcolorbox. Box options are given by/gtr/box→P. 98. The options inside /gtr/box→P. 98 are tcolorbox options [4]. To add a yellowish background color and glow, we use:
%... g[pivot,box={colback=yellow!20,no shadow,fuzzy halo},female]{first child}
%...
All option settings are pgfkeys options. So, it is easy to create a new option style highlight which can be used for each node in the lineage. This can be done by\gtrset→P. 58 or inside the option list of \genealogytree→P. 55.
\gtrset{highlight/.style={pivot,box={colback=yellow!20,no shadow,fuzzy halo}}}
Now, highlight can be used to apply/gtr/pivot→P. 97 and /gtr/box→P. 98 settings with one key word:
%... g[highlight,female]{first child}
%...
\begin{tikzpicture}
\genealogytree[template=signpost,
highlight/.style={pivot,box={colback=yellow!20,no shadow,fuzzy halo}}, ]{parent{
g[highlight,female]{first child}
c[male]{second child}
c[female]{third child}
parent{
c[female]{aunt}
g[highlight,male]{father}
c[male]{uncle}
parent
{ g[male]{grandfather}
p[male]{great-grandfather}
p[female]{great-grandmother}
}parent{
g[highlight,female]{grandmother}
p[male]{great-grandfather 2}
p[highlight,female]{great-grandmother 2}
c[male]{granduncle}
} } parent
{ c[male]{uncle 2}
g[female]{mother}
p[male]{grandfather 2}
p[female]{grandmother 2}
} }
\end{tikzpicture}}
first child second child third child
aunt father uncle
grandfather great-
grandfather great- grandmother
grandmother great-
grandfather 2
great- grandmother
2
granduncle
uncle 2 mother grand-
father 2 grand- mother 2
2.1.6 Changing the Timeflow
A genealogy treemay be grown in four directions depending on the given /gtr/timeflow→P. 80. Now, we will let the time flow to the left. Additionally, we replace the /gtr/template→P. 269 setting by individual settings for /gtr/processing→P. 138,/gtr/level size→P. 84,/gtr/node size from→P. 86, and /gtr/box→P. 98.
\begin{tikzpicture}
\genealogytree[
timeflow=left, processing=tcolorbox,
level size=3.3cm,node size from=5mm to 4cm,
box={size=small,halign=center,valign=center,fontupper=\small\sffamily}, highlight/.style={pivot,box={colback=yellow!20,no shadow,fuzzy halo}}, ]{parent{
g[highlight,female]{first child}
c[male]{second child}
c[female]{third child}
parent{
c[female]{aunt}
g[highlight,male]{father}
c[male]{uncle}
parent
{ g[male]{grandfather}
p[male]{great-grandfather}
p[female]{great-grandmother}
}parent{
g[highlight,female]{grandmother}
p[male]{great-grandfather 2}
p[highlight,female]{great-grandmother 2}
c[male]{granduncle}
} } parent
{ c[male]{uncle 2}
g[female]{mother}
p[male]{grandfather 2}
p[female]{grandmother 2}
} }
\end{tikzpicture}}
first child second child
third child
aunt father
uncle
grandfather great-grandfather great-grandmother
grandmother
great- grandfather 2
great- grandmother 2 granduncle
uncle 2 mother
grandfather 2 grandmother 2
2.2 Tutorial: Diagram Manipulation by ID values (Descendant Tree)
This tutorial shows how set up and save a descendant diagram which is going to be manipulated without changing the base data.
2.2.1 Creation of a Basic Descendant Diagram
For a genealogy tree displaying a descendant lineage, we take the child construct. As a first step, we start with a single family. As always, this root family has to have ag-node which serves no important role for a root family, but stands for a parent here. The resulting genealogy tree will contain just small nodes without names to display some interconnection. For this, a preset value from a given /gtr/template→P. 269 is used for quick setup.
\begin{tikzpicture}
\genealogytree[template=formal graph]{
child{
g[male]{a_1}
p[female]{a_2}
c[female]{a_3}
c[male]{a_4}
c[female]{a_5}
} }
\end{tikzpicture}
a1 a2
a3 a4 a5
The nodes of the diagram already have some options settings. To select and manipulate some or many nodes later without editing the data, the nodes and families can be given unique /gtr/id→P. 92 values.
\begin{tikzpicture}
\genealogytree[template=formal graph]{
child[id=fam_A]{
g[id=na1,male]{a_1}
p[id=na2,female]{a_2}
c[id=na3,female]{a_3}
c[id=na4,male]{a_4}
c[id=na5,female]{a_5}
} }
\end{tikzpicture}
a1 a2
a3 a4 a5
2.2.2 Growing the Tree
The nodes a3 and a4 shall become parent of their own families. To proceed in small steps, we make them g-nodes of single-member childfamilies which does not change the diagram. Both new families get their own /gtr/id→P. 92 values for later reference.
\begin{tikzpicture}
\genealogytree[template=formal graph]{
child[id=fam_A]{
g[id=na1,male]{a_1}
p[id=na2,female]{a_2}
child[id=fam_B]{
g[id=na3,female]{a_3}
}child[id=fam_C]{
g[id=na4,male]{a_4}
}c[id=na5,female]{a_5}
} }
\end{tikzpicture}
a1 a2
a3 a4 a5
Now, the new families are populated by a second parent and children.
\begin{tikzpicture}
\genealogytree[template=formal graph]{
child[id=fam_A]{
g[id=na1,male]{a_1}
p[id=na2,female]{a_2}
child[id=fam_B]{
p[id=nb1,male]{b_1}
g[id=na3,female]{a_3}
c[id=nb2,male]{b_2}
c[id=nb3,female]{b_3}
}child[id=fam_C]{
g[id=na4,male]{a_4}
p[id=nc1,female]{c_1}
c[id=nc2,male]{c_2}
}c[id=na5,female]{a_5}
} }
\end{tikzpicture}
a1 a2
b1 a3
b2 b3
a4 c1
c2
a5
As a specialty, a union construct can be used inside achild family. This represents a second husband or wife including children for the g-node of the current child family. A union does not get its own g-node but shares the g-node of the childfamily.
In our example, node a4 gets a union which has to be placed inside the family with id value fam_C:
\begin{tikzpicture}
\genealogytree[template=formal graph]{
child[id=fam_A]{
g[id=na1,male]{a_1}
p[id=na2,female]{a_2}
child[id=fam_B]{
p[id=nb1,male]{b_1}
g[id=na3,female]{a_3}
c[id=nb2,male]{b_2}
c[id=nb3,female]{b_3}
}child[id=fam_C]{
g[id=na4,male]{a_4}
p[id=nc1,female]{c_1}
c[id=nc2,male]{c_2}
union[id=fam_D]{
p[id=nd1,female]{d_1}
c[id=nd2,female]{d_2}
c[id=nd3,male]{d_3}
c[id=nd4,male]{d_4}
} }
c[id=na5,female]{a_5}
} }
\end{tikzpicture}
a1 a2
b1 a3
b2 b3
a4 c1
c2
d1
d2 d3 d4 a5
As the reader may note, for union constructs, the edges between the nodes are likely to overlap. Therefore, to attenuate the effect, the vertical positions of the edges for fam_C and fam_D are shifted automatically. Also, note the small visual separation at the cross- point of both family edges. This is generated by using /gtr/edge/foreground→P. 213 and /gtr/edge/background→P. 214 (here, as preset values).
In some context, fam_Cand fam_Dwill be seen as a single aggregated family and will be called patchwork family.
The tree is now grown further following the previous construction pattern.
\begin{tikzpicture}
\genealogytree[template=formal graph]{
child[id=fam_A]{
g[id=na1,male]{a_1}
p[id=na2,female]{a_2}
child[id=fam_B]{
p[id=nb1,male]{b_1}
g[id=na3,female]{a_3}
c[id=nb2,male]{b_2}
child[id=fam_E]{
p[id=ne1,male]{e_1}
g[id=nb3,female]{b_3}
c[id=ne2,male]{e_2}
c[id=ne3,female]{e_3}
} }
child[id=fam_C]{
g[id=na4,male]{a_4}
p[id=nc1,female]{c_1}
child[id=fam_F]{
g[id=nc2,male]{c_2}
p[id=nf1,female]{f_1}
c[id=nf2,male]{f_2}
c[id=nf3,female]{f_3}
c[id=nf4,male]{f_4}
}union[id=fam_D]{
p[id=nd1,female]{d_1}
child[id=fam_G]{
p[id=ng1,male]{g_1}
g[id=nd2,female]{d_2}
c[id=ng2,male]{g_2}
c[id=ng3,female]{g_3}
union[id=fam_H]{
p[id=nh1,male]{h_1}
c[id=nh2,male]{h_2}
} }
c[id=nd3,male]{d_3}
child[id=fam_I]{
g[id=nd4,male]{d_4}
p[id=ni1,female]{i_1}
c[id=ni2,female]{i_2}
c[id=ni3,female]{i_3}
c[id=ni4,female]{i_4}
} }
}c[id=na5,female]{a_5}
} }
\end{tikzpicture}
a1 a2
b1 a3
b2 e1 b3
e2 e3
a4 c1
c2 f1
f2 f3 f4
d1
g1 d2
g2 g3 h1
h2
d3 d4 i1
i2 i3 i4 a5
2.2.3 Separating Diagram Data and Diagram Drawing
For the second part of this tutorial, the final diagram data is now saved into a file example.formal.graph, see Section 15.3 on page 359. That is everything inside
\genealogytree→P. 55without the options of\genealogytree→P. 55. Using theinputconstruct, graph drawing is done simply by the following:
\begin{tikzpicture}
\genealogytree[template=formal graph]
{input{example.formal.graph}}
\end{tikzpicture}
a1 a2
b1 a3
b2 e1 b3
e2 e3
a4 c1
c2 f1
f2 f3 f4
d1
g1 d2
g2 g3 h1
h2
d3 d4 i1
i2 i3 i4 a5
In our example, the given /gtr/id→P. 92 values are easy to remember since we choose them nearly identical to the node content. For a not-so-formal example, this will be different. To avoid digging into the data source for finding some/gtr/id→P. 92value, the/gtr/show id→P. 265 setting from the LIB debug library is useful:
\begin{tikzpicture}
\genealogytree[template=formal graph,show id]
{input{example.formal.graph}}
\end{tikzpicture}
a1 na1 na2a2
b1 nb1 na3a3
b2
nb2 ne1e1 nb3b3
e2 ne2 ne3e3
a4 na4 nc1c1
c2 nc2 nf1f1
f2
nf2 nf3f3 nf4f4
d1 nd1 g1
ng1 nd2d2
g2 ng2 ng3g3
h1 nh1
h2 nh2
d3
nd3 nd4d4 ni1i1
i2
ni2 ni3i3 ni4i4
a5 na5 fam_A
fam_B fam_E
fam_C fam_F
fam_D
fam_G fam_H fam_I
2.2.4 Emphasizing a Relationship Path
For the given example data, we will emphasize the relationship between node e3 and nodei2 in our graph. The diagram above exposes the id values along the relationship path as ne3, nb3, na3, na1 and na2, na4, nd4, ni2. For emphasizing, we dim the colors of all other nodes and brighten the colors for the nodes along this path.
All these manipulations are done inside the option list of\genealogytree→P. 55without changing the diagram data directly.
1. /gtr/box→P. 98 sets options to wash out all nodes.
2. /gtr/edges→P. 204 sets options to wash out all edges.
3. /gtr/options for node→P. 95 sets box options to all nodes along the selected path to display them emphasized.
4. /gtr/extra edges for families→P. 227 sets extra edge options to all emphasized the connection line along the selected path.
\begin{tikzpicture}
\genealogytree[template=formal graph,
box={colback=white,colupper=black!50,opacityframe=0.25}, edges={foreground=black!25,background=black!5},
options for node={ne3,nb3,na3,na1,na2,na4,nd4,ni2}%
{box={colback=blue!50!red!20,colupper=black,opacityframe=1,fuzzy halo}}, extra edges for families={
x={fam_E}{nb3}{ne3},x={fam_B}{na3}{nb3}, x={fam_A}{na1,na2}{na3,na4},
x={fam_D}{na4}{nd4},x={fam_I}{nd4}{ni2}
}{foreground=blue!50!red,no background}, ] {input{example.formal.graph}}
\end{tikzpicture}
a1 a2
b1 a3
b2 e1 b3
e2 e3
a4 c1
c2 f1
f2 f3 f4
d1
g1 d2
g2 g3 h1
h2
d3 d4 i1
i2 i3 i4 a5
Also, the parameters for the auto-layout algorithm can be changed using the known id values.
Our selected relationship path is emphasized further by straightening the lineages. This is done by inserting/gtr/pivot→P. 97 values through/gtr/options for node→P. 95.
\begin{tikzpicture}
\genealogytree[template=formal graph,
box={colback=white,colupper=black!50,opacityframe=0.25}, edges={foreground=black!25,background=black!5},
options for node={ne3,nb3,na3,na1,na2,na4,nd4,ni2}%
{box={colback=blue!50!red!20,colupper=black,opacityframe=1,fuzzy halo}}, extra edges for families={
x={fam_E}{nb3}{ne3},x={fam_B}{na3}{nb3}, x={fam_A}{na1,na2}{na3,na4},
x={fam_D}{na4}{nd4},x={fam_I}{nd4}{ni2}
}{foreground=blue!50!red,no background}, options for node={ne3,nb3,nd4,ni2}{pivot}, options for node={na3,na4}{pivot=parent}, ] {input{example.formal.graph}}
\node[below] at (ne3.south) {Start of path};
\node[below] at (ni2.south) {End of path};
\path (na1) -- node[above=5mm]{Common ancestors} (na2);
\end{tikzpicture}
a1 a2
b1 a3
b2 e1 b3
e2 e3
a4 c1
c2 f1
f2 f3 f4
d1
g1 d2
g2 g3 h1
h2
d3 d4 i1
i2 i3 i4 a5
Start of path End of path
Common ancestors
All given /gtr/id→P. 92 values are also TikZ nodes. Therefore, a genealogy tree can easily be annotated and extended by TikZ instructions.
2.2.5 Coloring Subtrees
For the given example data, the descendants of the root family should now by colored with three different colors. All in-law nodes should be visually separated from descendants of a1 and a2. As a first step, the subtree denoted by fam_B is colored in red by /gtr/options for subtree→P. 107. Analogously, fam_C is colored in blue. Node a5 is a leaf node without own family and, therefore, is colored using /gtr/options for node→P. 95. Also, the preset /gtr/male→P. 101 and /gtr/female→P. 101 styles are made ineffective for this drawing.
This gives a colored genealogy tree, but not only the direct descendents are colored, but all members of descendant families:
\begin{tikzpicture}
\genealogytree[template=formal graph,
male/.style={},female/.style={box={circular arc}}, options for subtree={fam_B}{box={colback=red!20!white}}, options for subtree={fam_C,fam_D}{box={colback=blue!20!white}}, options for node={na5}{box={colback=green!20!white}},
] {input{example.formal.graph}}
\end{tikzpicture}
a1 a2
b1 a3
b2 e1 b3
e2 e3
a4 c1
c2 f1
f2 f3 f4
d1
g1 d2
g2 g3 h1
h2
d3 d4 i1
i2 i3 i4 a5
As can be inspected using /gtr/show type→P. 267 from the LIB debug library, the nodes to be excluded are all p-nodes:
\begin{tikzpicture}
\genealogytree[template=formal graph,show type, male/.style={},female/.style={box={circular arc}}, options for subtree={fam_B}{box={colback=red!20!white}}, options for subtree={fam_C,fam_D}{box={colback=blue!20!white}}, options for node={na5}{box={colback=green!20!white}},
] {input{example.formal.graph}}
\end{tikzpicture}
a
g
1 ap
2b
p
1 ag
3b
c
2 ep
1 bg
3e
c
2 ec
3a
g
4 cp
1c
g
2 fp
1f
c
2 fc
3 fc
4d
p
1g
p
1 dg
2g
c
2 gc
3h
p
1h
c
2d
c
3 dg
4 ip
1i2
c
ic
3 ic
4a