summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/genealogytree/genealogytree.sty
blob: d4ec56177294828ed5b8f242e62dc90d14cbeb95 (plain)
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
55
56
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
96
97
98
99
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
%% The LaTeX package genealogytree - version 2.00 (2020/06/19)
%% genealogytree.sty: genealogy trees (graphs)
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2013-2020 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{genealogytree}[2020/06/19 version 2.00 genealogy trees]
\def\gtr@version{2.00}

\RequirePackage{expl3}[2020/02/25]
\RequirePackage{xparse}
\RequirePackage{tcolorbox}[2020/04/28]

\tcbuselibrary{skins,fitting,external}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{fit}

\def\gtr@warning#1{\PackageWarning{genealogytree}{#1}}
\def\gtr@error#1#2{\PackageError{genealogytree}{#1}{#2}}

\pgfkeys{/handlers/.gstore in/.code=\pgfkeysalso{\pgfkeyscurrentpath/.code=\gdef#1{##1}}}
\pgfkeys{/handlers/.xstore in/.code=\pgfkeysalso{\pgfkeyscurrentpath/.code=\xdef#1{##1}}}
\pgfkeys{/gtr/.is family}
\def\gtrset{\pgfqkeys{/gtr}}

\def\gtr@load@language@nil#1-#2\@nil{\gtruselibrary{lang.#1}}
\def\gtr@load@language#1{\gtr@load@language@nil#1-\@nil}%
\def\gtrloadlanguage#1{\forcsvlist{\gtr@load@language}{#1}}

\gtrset{
  code/.code={#1},
  keysfrom/.code={\pgfkeysalsofrom{#1}},
  language/.code={%
    \edef\gtrlanguagename{#1}%
    \gtr@load@language{#1}%
    \gtrset{language@=#1}%
  },
  language@/.is choice,
  language@/.unknown/.code={%
    \gtr@error{The language '\pgfkeyscurrentname' is unknown or not loaded}{%
      Set this language in the preamble or use '\string\gtrloadlanguage{\pgfkeyscurrentname}' in the preamble.}%
  },
}

\AtBeginDocument{%
  \gtrset{language/.code={%
      \edef\gtrlanguagename{#1}%
      \gtrset{language@=#1}%
  }}%
  \ifdefined\gtrlanguagename\else\gtrset{language=english}\fi}

\def\gtr@optionlist{}

\def\gtr@set@library@version#1{%
  \def\gtr@library@version{#1}%
  \typeout{Library (genealogytree): '\@currname' version '\gtr@library@version'}
  \gtr@check@library@version%
}

\def\gtr@check@library@version{%
  \ifx\gtr@library@version\gtr@version\else%
  \PackageError{genealogytree}{genealogytree version '\gtr@version' loads library '\@currname' with version '\gtr@library@version'}
  \fi%
}

\def\gtruselibrary#1{\gtrset{library/.cd,#1}}
\@onlypreamble\gtruselibrary

\providecommand{\gtrpkgprefix}{}

\def\gtr@load@library@#1#2#3{%
  \pgfkeysifdefined{/gtr/libload/#2}{}{%
    \pgfkeyssetvalue{/gtr/libload/#2}{}%
    \@pushfilename%
    \xdef\@currname{#3}%
    \makeatletter%
    #1%
    \@popfilename%
  }%
}

\def\gtr@load@library{\gtr@load@library@{%
  \def\gtr@library@version{-}%
  \input\gtrpkgprefix\@currname\relax%
  \gtr@check@library@version%
}}

\def\gtr@load@external@library{\gtr@load@library@{%
  \typeout{External library (genealogytree): '\@currname'}
  \input\@currname\relax%
}}

\gtrset{library/.unknown/.code={%
  \IfFileExists{gtrlib.\pgfkeyscurrentname.code.tex}%
    {\begingroup\edef\x{\endgroup\noexpand\gtr@load@external@library%
      {\pgfkeyscurrentname}{gtrlib.\pgfkeyscurrentname.code.tex}}\x}%
    {\gtr@error{The library '\pgfkeyscurrentname' is unknown}{Perhaps you misspelled it.}}%
}}

\def\gtr@add@library#1#2{%
  \gtrset{library/#1/.code={\gtr@load@library{#1}{#2}}}%
  \DeclareOption{#1}{\appto\gtr@optionlist{,#1}}%
}
\def\gtr@add@library@style#1#2{%
  \gtrset{library/#1/.style={#2}}%
  \DeclareOption{#1}{\appto\gtr@optionlist{,#1}}%
}

\gtr@add@library{core.parser}{gtrcore.parser.code.tex}
\gtr@add@library{core.processing}{gtrcore.processing.code.tex}
\gtr@add@library{core.contour}{gtrcore.contour.code.tex}
\gtr@add@library{core.node}{gtrcore.node.code.tex}
\gtr@add@library{core.drawing}{gtrcore.drawing.code.tex}
\gtr@add@library{core.options}{gtrcore.options.code.tex}
\gtr@add@library{core.symbols}{gtrcore.symbols.code.tex}

\gtr@add@library{lang.danish}{gtrlang.danish.code.tex}
\gtr@add@library{lang.dutch}{gtrlang.dutch.code.tex}
\gtr@add@library{lang.english}{gtrlang.english.code.tex}
\gtr@add@library{lang.french}{gtrlang.french.code.tex}
\gtr@add@library{lang.german}{gtrlang.german.code.tex}
\gtr@add@library{lang.italian}{gtrlang.italian.code.tex}
\gtr@add@library{lang.spanish}{gtrlang.spanish.code.tex}
\gtr@add@library{lang.swedish}{gtrlang.swedish.code.tex}

\gtr@add@library{debug}{gtrlib.debug.code.tex}
\gtr@add@library{templates}{gtrlib.templates.code.tex}
\gtr@add@library{fanchart}{gtrlib.fanchart.code.tex}

\gtr@add@library@style{all}{debug,templates,fanchart}

\ProcessOptions*

\gtruselibrary{
  core.parser,
  core.processing,
  core.contour,
  core.node,
  core.drawing,
  core.options,
  core.symbols,
  lang.english,
}

\begingroup\edef\x{\endgroup\noexpand\gtruselibrary{\gtr@optionlist}}\x