T-F-S / genealogytree

pedigree and genealogy tree diagrams
LaTeX Project Public License v1.3c
47 stars 7 forks source link

`\gtrifdateorplacedefined` macro #35

Closed mikkelee closed 4 years ago

mikkelee commented 4 years ago

Evaluates to true if either date or place is defined. This allows \gtrPrintEvent@prefixdateplace to print events that contain only a place, but no date. Can for example be used if a person has no known birth date, but the address is of interest, in conjunction with a baptismal date+place; likewise for death place + burial date:

{
    female,
    name = {Anne Sophie \surn{Tofte}},
    birth = {}{Nørrevold},
    baptism = {1790-06-28}{Trinitatis kirke},
    death = {1871-05-31}{Rigensgade 8},
    burial = {1871-06-04}{Skt. Paul kirke},
}

Renders as (symbols approximated):

Anne Sophie Tofte
* i Nørrevold
~ 28. juni 1790 i Trinitatis kirke
† 31. maj 1871 i Rigensgade 8
[] 4. juni 1871 i Skt. Paul kirke
T-F-S commented 4 years ago

I thought this over and was tempted to accept the pull request, but I cannot, because it changes documented features and may cause problems in succession.

On page 169 of the documentation we have

docu

This could be changed, but my own implementations and possibly many private extensions rely on the fact that an event always contains a date. Luckily, a date can be interpreted very flexible.

Consider the following example:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[all]{genealogytree}
\usepackage{lmodern}

\begin{document}

\begin{genealogypicture}[
  processing=database,database format=full,
  node size=3cm,level size=3.2cm,
  list separators hang,place text={\newline}{},
  box={fit basedim=9pt,boxsep=2pt,segmentation style=solid,
  halign=flush left,before upper=\parskip1pt,\gtrDBsex }
]
parent {
  g{
    female,
    name = {Anne Sophie \surn{Tofte}},
    birth = {()}{Nørrevold},
    baptism = {1790-06-28}{Trinitatis kirke},
    death = {1871-05-31}{Rigensgade 8},
    burial = {1871-06-04}{Skt. Paul kirke},
  }
}
\end{genealogypicture}
%
%
\begin{genealogypicture}[
  processing=database,database format=full,
  node size=3cm,level size=3.2cm,
  list separators hang,place text={\newline}{},
  box={fit basedim=9pt,boxsep=2pt,segmentation style=solid,
  halign=flush left,before upper=\parskip1pt,\gtrDBsex }
]
parent {
  g{
    female,
    name = {Anne Sophie \surn{Tofte}},
    birth = {?}{Nørrevold},
    baptism = {1790-06-28}{Trinitatis kirke},
    death = {1871-05-31}{Rigensgade 8},
    burial = {1871-06-04}{Skt. Paul kirke},
  }
}
\end{genealogypicture}
%
%
\begin{genealogypicture}[
  processing=database,database format=full,
  node size=3cm,level size=3.2cm,
  list separators hang,place text={\newline}{},
  box={fit basedim=9pt,boxsep=2pt,segmentation style=solid,
  halign=flush left,before upper=\parskip1pt,\gtrDBsex }
]
parent {
  g{
    female,
    name = {Anne Sophie \surn{Tofte}},
    birth = {(ca)1790}{Nørrevold},
    baptism = {1790-06-28}{Trinitatis kirke},
    death = {1871-05-31}{Rigensgade 8},
    burial = {1871-06-04}{Skt. Paul kirke},
  }
}
\end{genealogypicture}

\end{document}

screen

mikkelee commented 4 years ago

Thanks for the detailed answer. Yeah, I wouldn't want this to conflict with existing code.

I wasn't aware that () inteprets as an empty date, I can probably use this method. However, it seems I still get separators making a hard ~ space (even if I make them soft spaces with event text={}{ }{ }{})

Screenshot 2020-06-30 at 08 37 33

Or is it perhaps the date code that ends up rendering () as a space?

Alternately, I could write a pull request with database entries for birthplace, deathplace etc (generated via \gtr@db@new@event@store)

T-F-S commented 4 years ago

The () was a quick method to simulate your code approximately. It defines an unknown but valid calender and accepts the empty date content. Nevertheless, it inserts the space before the date followed by the space between date and place.

I still would not like to have events without a date. That should not hinder you to do otherwise for your graphs. If you want to get rid of the ? or ca. entries, I see at least two possibilites:

Use your pull request as a private patch / extension for your documents.

Or, maybe better, insert something invisible space-eating for the date. This needs to be seen in combination with event text. The most simple case would be

event text={}{ }{ }{}

and for the event

birth = {\unskip}{Nørrevold},

\unskip removes the superfluous space.

Now, you can set up a private data key like

\gtrset{database/birthplace/.style={birth={\unskip}{#1}}}

with events like

birthplace = {Nørrevold},

With event text as above, this should give the desired output.

mikkelee commented 4 years ago

Aha!

Then the simplest solution is \let\nodate=\unskip in my personal .sty file, and then using birth = {\nodate}{Nørrevold}, gives the desired results :)

Thanks for the help!

mikkelee commented 4 years ago

I'll close this as solved for me, but perhaps a short line or two in the documentation p. 169 on how to create date-less events would be appreciated by future users :)

T-F-S commented 4 years ago

OK :-)