Like in this question, I'm trying to fill a genealogytree with datas from an external source, thanks to the datatool package. But I can't figure how to tell genealogytree how to correctly recognize these datas. I probably misunderstands the setting and the use of pgfkeys.

The main problem is that \gtrDBsex does not execute the right gender /.style in the box options. If I replace it with a \def containing a specific gender, the /.style is executed.

Notice that \gtrPrintName and \gtrPrintSex correctly display their datas.

Where am I wrong? Any help would be kind.


% \def\boy{male}% this one will execute male/.style
    \def\nom{#1} % use of control sequences like in the datatool pkg
    \gtrset{database/sex=\sexe}% \gtrif(fe)male doesn't work, but /.style neither.
    % \gtrset{database/sex=male}% even forcing male, /.style doesn't work, considered neuter.
    \gtrPrintName{} \gtrPrintSex{}\\ gender(\gtrDBsex) = \gtrifmale{male}{\gtriffemale{female}{neuter}}%
    processing=fit, node size=2.5cm, level size=2cm,
        male/.style={colback=blue!20!white,sharp corners},
    box={\gtrDBsex}% not recognized?
    %box={\boy}% this one executes male/.style

mwe compiled

An alternate problem is that the tests \gtrifmale and \gtriffemale don't recognize the gender. The xstring package does.

  • 1
    I have never used genealogytree, but from looking at its manual, it seems to me the way you are trying to use it doesn't conform to the doc, esp. what you use \gtrset for and how you try to declare the sex to gtr. To go from CSV format to genealogytree, it seems to me a possible approach would be to first generate an intermediate file like example.database.graph in the genealogytree manual, then input it as shown e.g. on p. 154 of the manual. To go from CSV to this graph format, many possibilities: for instance, Python if you know it; otherwise, datatool can probably do too. – frougon May 4 at 23:00
  • But why the names and the sex symbols are correctly identified and displayed? I've removed the datatool code for the MWE, but the result is the same. I'm diving into the pgfkeys documentation, perhaps the datas are stored in a scope that I don't see? – Loïc May 5 at 9:29
  • I assume your \gtrset{database/name={\nom}} and \gtrset{database/sex=\sexe} commands are manually doing part of the setup that inputing a proper .graph file would have done. But only part of it; maybe it is already too late to apply the male or female style to the graph nodes at this point. But these are just impressions/assumptions: I have only browsed through the genealogytree manual and tried your example. – frougon May 5 at 9:37
  • If you have a gedcom file, perhaps you can use my tool: github.com/mikkelee/genealogytree-mkgraph – meide Jun 4 at 7:54
  • I'm not familiar with gedcom, but thanks, I'll study it. From now i'm still with my problem, and not able to give a correct format for a database in the p/c/g braces... I'll oriente my next tests to the "content interpreter" described in the package. – Loïc Jun 4 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.