%% The LaTeX package genealogytree - version 2.4.1 (2026/06/16)
%% genealogytree.sty: genealogy trees (graphs)
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2013-2026 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}[2025-11-01]
\ProvidesPackage{genealogytree}[2026/06/16 version 2.4.1 genealogy trees]
\def\gtr@version{2.4.1}

\RequirePackage{tcolorbox}[2025/11/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}%

\ExplSyntaxOn
\box_new:N \l__getree_tmpa_box
\clist_new:N \l__getree_tmpa_clist
\dim_new:N \l__getree_tmpa_dim
\dim_new:N \l__getree_tmpb_dim
\fp_new:N \l__getree_tmpa_fp
\fp_new:N \l__getree_tmpb_fp
\int_new:N \l__getree_tmpa_int
\tl_new:N \l__getree_tmpa_tl
\tl_new:N \l__getree_tmpb_tl

\NewDocumentCommand \gtrloadlanguage { m }
  {
    \clist_set:Nn \l__getree_tmpa_clist { #1 }
    \clist_map_function:NN \l__getree_tmpa_clist \gtr@load@language
  }
\ExplSyntaxOff

\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.catalan}{gtrlang.catalan.code.tex}
\gtr@add@library{lang.chinese}{gtrlang.chinese.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.portuguese}{gtrlang.portuguese.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
