4

I create pedigrees with the database template of the genealogytree package. It often happens that ancestors married and died in their birthplace. I would like identical places to be automatically replaced by “ibid.” for a person.

Above in the screenshot (James HowItIs) you see the normal output; below (John HowIWantIt) the concise version I would like to have—just automatically, without changing the database data manually.

\documentclass{standalone}

\usepackage{genealogytree}
\gtruselibrary{templates}

\begin{document}

\begin{genealogypicture}[
    processing=database,template=database pole,database format=short,node size=4cm,level size=1cm,
    place text={}{},
    list separators={\unskip\break}{\unskip, }{\unskip}{\unskip},
    event code={\tcbfontsize{0.65}\strut\gtrPrintEventPrefix{#1}\,\gtrPrintDate{#1}\gtrifplacedefined{#1}{~\gtrPrintPlace{#1}}{}\strut}
  ]
  parent{
    g{name={James \surn{HowItIs}},birth={1800}{Johnstown},marriage={1830}{Johnstown},death={1890}{Johnstown}}
  }
\end{genealogypicture}
\end{document}

1 Answer 1

4

An early-stage attempt. It should give desired output but currently provides no user-friendly interface (yet).

\documentclass[margin=5pt]{standalone}

\usepackage{genealogytree}
\gtruselibrary{templates}

\makeatletter
\ExplSyntaxOn
\tl_new:N \l__gtr_last_printed_event_tl

\cs_gset_protected:Npn \gtrPrintPlace #1
  {
    \gtrkv@place@pre
    % if the place of current event is the same as that of the previous event
    \bool_lazy_and:nnTF
      { ! \tl_if_empty_p:N \l__gtr_last_printed_event_tl }
      {
        \tl_if_eq_p:cc
          {gtrDB \l__gtr_last_printed_event_tl place}
          {gtrDB#1place}
      }
      {
        \gtr@ibid@style\gtr@ibid@text
      }
      {
        \use:c {gtrDB#1place}
      }
    \tl_set:Nn \l__gtr_last_printed_event_tl {#1}
    \gtrkv@place@app
  }
\ExplSyntaxOff

\newcommand\gtr@ibid@style[1]{\textit{#1}}
\newcommand\gtr@ibid@text{ibid.}
\makeatother

\begin{document}

\begin{genealogypicture}[
    processing=database,template=database pole,database format=short,node size=4cm,level size=1cm,
    place text={}{},
    list separators={\unskip\break}{\unskip, }{\unskip}{\unskip},
    event code={%
      \tcbfontsize{0.65}\strut\gtrPrintEventPrefix{#1}\,\gtrPrintDate{#1}\gtrifplacedefined{#1}{~\gtrPrintPlace{#1}}{}\strut
    },
    % just for test
    timeflow=right, node size=1cm,level size=3cm,
  ]
  parent{
    g{
      name={James \surn{HowItIs}},
      birth={1800}{Johnstown},
      marriage={1830}{Johnstown},
      death={1890}{Johnstown}
    }
    c{
      name={James \surn{NotYet}},
      birth={1800}{Johnstown},
      marriage={1830}{Maryville},
      death={1890}{Johnstown}
    }
    c{
      name={James \surn{NotYet}},
      birth={1800}{Johnstown},
      marriage={1830}{Maryville},
      death={1890}{Maryville}
    }
  }
\end{genealogypicture}
\end{document}

enter image description here

7
  • Thanks for your approach! In the case where the place of birth, marriage and death are identical, it works flawlessly. Unfortunately, the following cases are wrong: p{name={James \surn{NotYet}},birth={1800}{Johnstown},marriage={1830}{Maryville},death={1890}{Johnstown}} returns "Johnstown/Maryville/ibid."; but it should be "Johnstown/Maryville/Johnstown". p{name={James \surn{NotYet}},birth={1800}{Johnstown},marriage={1830}{Maryville},death={1890}{Maryville}} returns "Johnstown/Maryville/Maryville"; but this should again be "Johnstown/Maryville/ibid.".
    – MacDevil
    Jul 13, 2023 at 15:21
  • So to speak, you would always have to check if the "previous" location is the same as the current one. (There are also cases where e.g. no marriage date is known; then the place of death would have to be compared with the place of birth). Would it be possible for you to formulate the appropriate queries and update your code? If so, I'll take your answer as a solution, of course! (My ExplSyntax knowledge is too rudimentary for that, I'm afraid).
    – MacDevil
    Jul 13, 2023 at 15:21
  • Currently the place of birth is always compared to. Let me try what you truly wanted... Jul 13, 2023 at 16:48
  • Answer updated. Please check if it works as expected. Jul 13, 2023 at 17:22
  • Perfect! Thank you for your efforts!
    – MacDevil
    Jul 14, 2023 at 14:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .