Debian Codegraph @

texmf-dist/source/latex/gtrlib-largetrees/gtrlib.largetrees.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2015-2018 by Richard Grewe <[email protected]>
4 % -------------------------------------------------------
5 %
6 % This file may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.2
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in:
10 %
11 % http://www.latex-project.org/lppl.txt
12 %
13 % and version 1.2 or later is part of all distributions of LaTeX
14 % version 1999/12/01 or later.
15 %
16 % \fi
17 %
18 % \iffalse
19 %<*driver>
20 \ProvidesFile{gtrlib.largetrees.dtx}
21 %</driver>
22 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
23 %<package>\ProvidesPackage{gtrlib.largetrees}
24 %<*package>
25 [2018/11/02 v1.2b Package providing extended options for the genealogytree package]
26 %</package>
27 %
28 %<*driver>
29 \documentclass{ltxdoc}
30 \usepackage[columns=2]{idxlayout}
31 \usepackage{enumitem}
32 \usepackage[style=alphabetic,backend=biber]{biblatex}
33 \usepackage{filecontents}
34 \begin{filecontents}{\jobname.bib}
35 @online{GenealogyTreeDoc,
36 author = {Thomas F. Sturm},
37 date = {2016-07-29},
38 title = {genealogytree -- Manual for version 1.01},
39 url = {http://mirrors.ctan.org/macros/latex/contrib/genealogytree/genealogytree.pdf},
40 urldate= {2016-12-23},
41 }
42 \end{filecontents}
43 \addbibresource{\jobname.bib}
44 \begin{filecontents}{example.gauss.graph}
45 parent {
46 g[id=GauxCarl1777]{
47 male,
48 name={Johann \pref{Carl Friedrich} \surn{Gau\ss{}}},
49 birth={1777-04-30}{Braunschweig (Niedersachsen)},
50 death={1855-02-23}{G\"ottingen (Niedersachsen)},
51 comment={Mathematiker, Astronom, Geod\"at und Physiker},
52 image={Carl_Friedrich_Gauss.jpg},
53 }
54 parent[id=GoosEgge1735]{
55 g[id=GauxGebh1743]{
56 male,
57 name={\pref{Gebhard} Dietrich \surn{Gau\ss{}}},
58 birth={1743-02-13}{Braunschweig (Niedersachsen)},
59 death={1808-04-14}{Braunschweig (Niedersachsen)},
60 %comment={G\"artner, Wasserkunstmeister, Rechnungsf\"uhrer},
61 }
62 parent[id=GoosLbtk1705]{
63 g[id=GoosJyrg1715]{
64 male,
65 name={\pref{J\"urgen} \surn{Gooss}},
66 birth={1715}{V\"olkenrode (Niedersachen)},
67 death={1774-07-05}{Braunschweig (Niedersachsen)},
68 comment={Lehmmaurer},
69 }
70 p[id=GoosHinr1655]{
71 male,
72 name={\pref{Hinrich} \surn{Gooss}},
73 birth={(caAD)1655}{},
74 death={1726-10-25}{V\"olkenrode (Niedersachen)},
75 }
76 p[id=LxtkKath1674]{
77 female,
78 name={\pref{Katharina} \surn{L\"utken}},
79 birth={1674-08-19}{V\"olkenrode (Niedersachen)},
80 marriage={1705-11-24}{V\"olkenrode (Niedersachen)},
81 death={1749-04-15}{V\"olkenrode (Niedersachen)},
82 }
83 }
84 p[id=EggeKath1710]{
85 female,
86 name={\pref{Katharina} Magdalena \surn{Eggenlings}},
87 birth={(caAD)1710}{Rethen},
88 marriage={(caAD)1735}{V\"olkenrode (Niedersachen)},
89 death={1774-04-03}{Braunschweig (Niedersachsen)},
90 }
91 }
92 parent[id=BentKron1740]{
93 g[id=BenzDoro1743]{
94 female,
95 name={\pref{Dorothea} \surn{Benze}},
96 birth={1743-06-18}{Velpke (Niedersachsen)},
97 marriage={1776-04-25}{Velpke (Niedersachsen)},
98 death={1839-04-18}{G\"ottingen (Niedersachsen)},
99 comment={Steinhauerstochter},
100 }
101 parent[id=BentBbbb1740]{
102 g[id=BentChri1717]{
103 male,
104 name={\pref{Christoph} \surn{Bentze}},
105 birth={1717}{Velpke (Niedersachsen)},
106 death={1748-09-01}{Velpke (Niedersachsen)},
107 %comment={Steinhauer},
108 }
109 p[id=BentAndr1687]{
110 male,
111 name={\pref{Andreas} \surn{Bentze}},
112 birth={1687-02}{},
113 death={(caAD)1750}{Velpke (Niedersachsen)},
114 }
115 }
116 p[id=KronKath1710]{
117 female,
118 name={\pref{Katharina} \surn{Krone}},
119 birth={(caAD)1710}{},
120 death={1743/}{Velpke (Niedersachsen)},
121 }
122 }
123 }
124 \end{filecontents}
125 \usepackage{showexpl}
126 \lstset{gobble=2,frame=trbl,rframe={},backgroundcolor=\color{black!5!white}}
127 \lstset{explpreset={numbers=none,columns=fixed,basicstyle=\footnotesize\ttfamily}}
128 \lstset{overhang=2cm,pos=r,varwidth=true}
129 \lstset{preset={\small\sffamily
130 \renewcommand\gtruselibrary[1]{}}}
131 \usepackage{pbox}
132 \newcommand\NiceDescribeStuff[2]{% #1=margin text, #2=body text
133 \medskip\par\noindent\leavevmode%
134 \marginpar{\hfill\pbox[t]{2\marginparwidth}{\ttfamily #1}%
135 \hspace*{-\marginparsep}}%
136 \ifstrempty{#2}{}{#2\smallskip\\}}
137 \newcommand\NiceDescribeEnv[2]{% #1=envname, #2=parameters
138 \NiceDescribeStuff{%
139 \textcolor{gray}{\cs{begin}}\string{#1\string}\\
140 \textcolor{gray}{\cs{end}}\string{#1\string}}{#2}}
141 \newcommand\NiceDescribeMacro[2]{% #1=macro, #2=parameters
142 \NiceDescribeStuff{\hbox to 0pt{\hss\string#1}}{#2}}
143 \newcommand\NiceDescribeConstant[1]{% #1=constant
144 \NiceDescribeStuff{\hbox to 0pt{\hss #1\quad}}{}\ignorespaces}
145 \usepackage[templates]{genealogytree}[2017/01/29 version 1.10]
146 \gtruselibrary{largetrees}
147 \usepackage{hypdoc}
148 \usepackage[capitalise,nameinlink]{cleveref}
149 \EnableCrossrefs
150 \CodelineIndex
151 \RecordChanges
152 \begin{document}
153 \DocInput{gtrlib.largetrees.dtx}
154 \PrintChanges
155 \PrintIndex
156 \end{document}
157 %</driver>
158 % \fi
159 %
160 % \CheckSum{0}
161 %
162 % \CharacterTable
163 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
164 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
165 % Digits \0\1\2\3\4\5\6\7\8\9
166 % Exclamation \! Double quote \" Hash (number) \#
167 % Dollar \$ Percent \% Ampersand \&
168 % Acute accent \' Left paren \( Right paren \)
169 % Asterisk \* Plus \+ Comma \,
170 % Minus \- Point \. Solidus \/
171 % Colon \: Semicolon \; Less than \<
172 % Equals \= Greater than \> Question mark \?
173 % Commercial at \@ Left bracket \[ Backslash \\
174 % Right bracket \] Circumflex \^ Underscore \_
175 % Grave accent \` Left brace \{ Vertical bar \|
176 % Right brace \} Tilde \~}
177 %
178 % \changes{v1.0}{2016/12/23}{Initial version}
179 % \changes{v1.1}{2017/01/24}{Split into package and library}
180 % \changes{v1.2}{2017/02/19}{Profession field went to genealogytree package}
181 % \changes{v1.2b}{2018/11/02}{Package author's name change}
182 %
183 % \GetFileInfo{gtrlib.largetrees.dtx}
184 %
185 % \DoNotIndex{\newcommand,\newenvironment,\def,\gdef,\edef}
186 %
187 %
188 % \title{The \textsf{gtrlib.largetrees} package\thanks{This document
189 % corresponds to \textsf{gtrlib.largetrees}~\fileversion, dated \filedate.
190 % The package is available online at
191 % \url{https://github.com/Ri-Ga/gtrlib.largetrees}.}}
192 % \author{Richard Grewe \\ \texttt{[email protected]}}
193 %
194 % \maketitle
195 %
196 % \section{Introduction}
197 %
198 % The main goal of the \textsf{gtrlib.largetrees} package is to offer
199 % additional database fields and formats for the \textsf{genealogytree}
200 % package, particularly for typesetting large trees.
201 % This package is the side product of typesetting an actual genealogy tree
202 % with almost 400 persons on 16 levels and on a DIN-A0 poster.
203 % The package provides the following extensions:
204 % \begin{description}
205 % \item[database fields:]\leavevmode
206 % \begin{itemize}[nosep]
207 % \item spouse, spousebirth, spousedeath
208 % \item children
209 % \end{itemize}
210 % \item[formats:]\leavevmode
211 % \begin{itemize}[nosep]
212 % \item Person+Marriage+Children+Profession
213 % \end{itemize}
214 % \item[node processors:]\leavevmode
215 % \begin{itemize}[nosep]
216 % \item sparse node processor
217 % \end{itemize}
218 % \end{description}
219 % In the following, each of the extensions is described and illustrated
220 % individually.
221 %
222 % To use the package, use
223 % \begin{LTXexample}
224 % \usepackage{genealogytree}
225 % \gtruselibrary{largetrees}
226 % \end{LTXexample}
227 % or
228 % \begin{LTXexample}
229 % \usepackage{gtrlib.largetrees}
230 % \end{LTXexample}
231 % Note that the following approach does \emph{not} work:
232 % \begin{itemize}[nosep]
233 % \item |\usepackage[largetrees]{genealogytree}|
234 % \end{itemize}
235 %
236 % \section{Database Fields}
237 %
238 % \subsection{Spouse}
239 %
240 % Sometimes, basic information about the spouse of a person is nice to
241 % have in a genealogy tree but a separate node in the tree would occupy
242 % too much space. For instance, if you have a person in the main line of
243 % ancestors, then you might also want to show a node for the sister of
244 % that person. However, a separate node for her spouse might be too much.
245 % In such a case, the database fields |spouse|, |spousebirth|, and
246 % |spousedeath| can come handy.
247 %
248 % The |spouse| field can be used for the specification of the name of
249 % the spouse. The |spousebirth| and |spousedeath| fields can be used
250 % for specifying the birth and death events of the spouse. For these
251 % events, the values are expected to be of the same format as other
252 % events, such as the |birth| and |death| fields. In particular this
253 % means that date and location can be specified.
254 % The following example shows the usage of the fields at the example of
255 % Gauss' first wife:
256 % \begin{LTXexample}
257 % \begin{genealogypicture}[processing=database,
258 % database format=person marriage children profession]
259 % sandclock{ child{
260 % g[id=GauxCarl1777]{male,
261 % name={Johann \pref{Carl Friedrich} \surn{Gau\ss{}}},
262 % birth={1777-04-30}{Braunschweig (Niedersachsen)},
263 % death={1855-02-23}{G\"ottingen (Niedersachsen)},
264 % marriage={1805-10-09}{Braunschweig (Niedersachsen)},
265 % spouse={\pref{Johanna} Elisabeth Rosina \surn{Osthoff}},
266 % spousebirth={1780-05-08}{Braunschweig (Niedersachsen)},
267 % spousedeath={1809-10-11}{G\"ottingen (Niedersachsen)},
268 % }}}
269 % \end{genealogypicture}
270 % \end{LTXexample}
271 %
272 % Note that currently only information about a single spouse can be
273 % specified through the fields provided by this package.
274 %
275 % \subsection{Children}
276 %
277 % When one wants to have information about children in a genealogy tree
278 % but cannot spend the space for separate nodes, then one can use the
279 % |children|, |children-|, and |children+| keys provided by this package.
280 % The following describes the individual keys and provides an illustration,
281 % again using data from Gauss' first marriage \cite[Section~2.3.5]{GenealogyTreeDoc}.
282 % \begin{itemize}
283 % \item Use |children+={some infos}| for providing arbitrarily formatted
284 % information about children.
285 % \begin{LTXexample}
286 % \begin{genealogypicture}[processing=database,
287 % database format=person marriage children profession]
288 % sandclock{ child{
289 % g[id=GauxCarl1777]{male,
290 % name={Johann \pref{Carl Friedrich} \surn{Gau\ss{}}},
291 % birth={1777-04-30}{Braunschweig (Niedersachsen)},
292 % death={1855-02-23}{G\"ottingen (Niedersachsen)},
293 % children+={Carl (\gtrsymBorn\,1806),
294 % Wilhelmina (\gtrsymBorn\,1808),
295 % Ludwig (\gtrsymBorn\,1809)},
296 % }}}
297 % \end{genealogypicture}
298 % \end{LTXexample}
299 % \item Use |children={D}{S}| to specify that the person has |D|
300 % daughters and |S| sons.
301 % \begin{LTXexample}
302 % \begin{genealogypicture}[processing=database,
303 % database format=person marriage children profession]
304 % sandclock{ child{
305 % g[id=GauxCarl1777]{male,
306 % name={Johann \pref{Carl Friedrich} \surn{Gau\ss{}}},
307 % birth={1777-04-30}{Braunschweig (Niedersachsen)},
308 % death={1855-02-23}{G\"ottingen (Niedersachsen)},
309 % children={1}{2},
310 % }}}
311 % \end{genealogypicture}
312 % \end{LTXexample}
313 % \item Use |children-=N| for providing only the overall number of
314 % children of the person.
315 % \begin{LTXexample}
316 % \gtrset{language=german}
317 % \begin{genealogypicture}[processing=database,
318 % database format=person marriage children profession]
319 % sandclock{ child{
320 % g[id=GauxCarl1777]{male,
321 % name={Johann \pref{Carl Friedrich} \surn{Gau\ss{}}},
322 % birth={1777-04-30}{Braunschweig (Niedersachsen)},
323 % death={1855-02-23}{G\"ottingen (Niedersachsen)},
324 % children-={3},
325 % }}}
326 % \end{genealogypicture}
327 % \end{LTXexample}
328 % Note that we show here also that the text ``children'' changes
329 % with the selected language.
330 % \end{itemize}
331 %
332 % \section{Database Formats}
333 % \label{sec:db-formats}
334 %
335 % This package extends \textsf{genealogytree}'s list of formats for
336 % displaying database entries \cite[Section~7.3.5]{GenealogyTreeDoc}.
337 %
338 % \subsection{Person+Marriage+Children+Profession}
339 % \label{sec:format-PMCP}
340 %
341 % This format is close to the format ``medium marriage below'', which
342 % is defined by the \textsf{genealogytree} package. The format can be
343 % selected by the |database format| key, as shown in the previous examples.
344 % The format displays
345 % \begin{enumerate}[nosep]
346 % \item name, birth, and death of the person
347 % \item a comment, if provided
348 % \item the marriage event and the spouse
349 % \item the children
350 % \item the profession
351 % \end{enumerate}
352 % The following long example shows a full example, based on combined
353 % data from the previous examples.
354 % \begin{LTXexample}
355 % \begin{genealogypicture}[processing=database,
356 % database format=person marriage children profession]
357 % sandclock{ child{
358 % g[id=GauxCarl1777]{male,
359 % name={Johann \pref{Carl Friedrich} \surn{Gau\ss{}}},
360 % birth={1777-04-30}{Braunschweig (Niedersachsen)},
361 % death={1855-02-23}{G\"ottingen (Niedersachsen)},
362 % marriage={1805-10-09}{Braunschweig (Niedersachsen)},
363 % spouse={\pref{Johanna} Elisabeth Rosina \surn{Osthoff}},
364 % spousebirth={1780-05-08}{Braunschweig (Niedersachsen)},
365 % spousedeath={1809-10-11}{G\"ottingen (Niedersachsen)},
366 % children={1}{2},
367 % profession={Mathematiker, Astronom, Geod\"at und Physiker},
368 % }}}
369 % \end{genealogypicture}
370 % \end{LTXexample}
371 %
372 % \section{Node Processors}
373 %
374 % \subsection{Sparse node processor}
375 %
376 % The sparse node processor serves the purpose of saving space by
377 % rotating nodes for which only few database fields are set.
378 % This follows the consideration that horizontally displayed nodes
379 % have the advantage of being easily readable, but require a rather wide
380 % display for a nice appearance. In a large genealogy tree with many nodes
381 % on a level, space can be saved by rotating those nodes for which only
382 % few database fields are set. The sparse node processor allows one
383 % to enable rotation dependent on how much information is available for
384 % a node, rather than merely on the level of the node or whether the
385 % node is a leaf or inner node.
386 % The sparse node processor inherits from the ``fit'' processor defined
387 % by the \textsf{genealogytree} package \cite[Section~6.2.1]{GenealogyTreeDoc}.
388 %
389 % The sparse node processor can be configured by several options.
390 % Some of these options can be set globally, some also for individual levels.
391 % The following options are defined:
392 % \begin{description}[style=nextline]
393 % \item[|sparse display|:] enables the node processor.
394 % \item[\texttt{sparse node size from=\meta{min} to \meta{max}}:]
395 % sets minimum and maximum width of sparse nodes.
396 % \item[\texttt{sparse max fields=\meta{N}}:]
397 % defines the maximum number \meta{N} of database fields
398 % of a person with which the node is still considered sparse and,
399 % therefore, displayed specially (rotated).
400 % \item[\texttt{sparse inner from level=\meta{N}}:]
401 % specifies that inner nodes shall be
402 % displayed specially only if they are above or on level \meta{N}.
403 % \item[\texttt{sparse leaf from level=\meta{N}}:]
404 % specifies that leaf nodes shall be
405 % displayed specially only if they are above or on level \meta{N}.
406 % \item[|sparse inner never|:] specifies that inner nodes shall never
407 % be displayed specially.
408 % \end{description}
409 %
410 % The following example shows the use and the effect of the options in an
411 % example, again based on the tree for Gauss. Concretely, the example
412 % demonstrates the following settings:
413 % \begin{itemize}[nosep]
414 % \item a node is considered sparse if at most 2 fields are defined:
415 % Hinrich Gooss (2 fields) is rotated,
416 % Katharina Lütken (3 fields) is not rotated;
417 % \item inner nodes get special display earliest from level 2:
418 % Christoph Bentze (2 fields and on level 2) is rotated,
419 % Gebhard Dietrich Gau\ss{} (sparse due to only 2 fields,
420 % but on level 1) is not rotated);
421 % \item leaf nodes get special display earliest from level 3:
422 % Katharina Krone (2 fields but on level 2) is not rotated,
423 % Andreas Bentze (2 fields and on level 3) is rotated;
424 % \item sparse nodes on levels 3 and 2 have different width settings.
425 % \end{itemize}
426 % \begin{LTXexample}[pos=t,justification=\centering]
427 % \usepackage[templates]{genealogytree}
428 % \begin{genealogypicture}[template=database pole,
429 % database format=person marriage children profession,
430 % level size=2.5cm, node size=3cm,
431 % level 3/.style={sparse node size from=0.4cm to 1.2cm},
432 % sparse node size from=1cm to 2cm,
433 % sparse max fields=2,
434 % sparse inner from level=2,
435 % sparse leaf from level=3,
436 % sparse display,
437 % options for node={GauxCarl1777}{pivot},
438 % ]
439 % input{example.gauss.graph}
440 % \end{genealogypicture}
441 % \end{LTXexample}
442 %
443 % Note that sparse node display currently is only possible for the
444 % database formats defined in \cref{sec:db-formats}. For enabling it
445 % in combination with other database formats, the
446 % |\gtrltDeclareFieldCount|\marg{db-format}\marg{macro} has to be used
447 % (see the use of this macro in the implementation of the database formats
448 % provided by this package).
449 %
450 % \printbibliography
451 % \clearpage
452 % \appendix
453 %
454 % \StopEventually{}
455 % \section{Implementation}
456 %
457 % \subsection{Wrapper Package}
458 %
459 %\iffalse
460 %<*package>
461 %\fi
462 % The package has the following dependencies:
463 % \begin{macrocode}
464 \RequirePackage{genealogytree}[2017/01/29 version 1.10]
465 \gtruselibrary{largetrees}
466 % \end{macrocode}
467 %
468 % The remaining code provides the \textsf{largetrees} library
469 % for the \textsf{genealogytree} package.
470 %\iffalse
471 %</package>
472 %<*gtrlib>
473 %\fi
474 %
475 % \subsection{Dependencies}
476 %
477 % The library has the following dependencies:
478 % \begin{macrocode}
479 \RequirePackage{etoolbox}
480 % \end{macrocode}
481 %
482 % \subsection{Database Fields}
483 %
484 % \subsubsection{Spouse}
485 % This adds three new fields for providing information about the spouse
486 % of a person, within the same node. The fields are for specifying
487 % the name of the spouse as well as the birth date and the day of death.
488 % \begin{macro}{\gtrDBspouse}
489 % The |\gtrDBspouse| macro holds what is provided for the
490 % |spouse| key of a database entry (this macro is defined
491 % by |\gtr@db@new@store|).
492 % \begin{macrocode}
493 \gtr@db@new@store{spouse}
494 \gtr@db@new@event@store{spousebirth}
495 \gtr@db@new@event@store{spousedeath}
496 % \end{macrocode}
497 % \end{macro}
498 % \begin{macro}{\gtrifspousedefined}
499 % The |\gtrifspousedefined|\marg{true}\marg{false} macro expands to
500 % \meta{true} if the spouse of a database entry is defined, and
501 % expands to \meta{false} otherwise. The distinction is made solely
502 % on the |spouse| field -- i.e., |spousebirth| and |spousedeath|
503 % are ignored.
504 % This macro can be used, for instance, by database formats
505 % (see \cref{sec:impl-database-formats}).
506 % \begin{macrocode}
507 \def\gtrifspousedefined#1#2{\ifdefvoid{\gtrDBspouse}{#2}{#1}}
508 % \end{macrocode}
509 % \end{macro}
510 % \begin{macro}{\gtrPrintSpouse}
511 % \begin{macro}{\gtrPrintSpouseDetails}
512 % The |\gtrPrintSpouseDetails| macro prints the name of the spouse
513 % as well as the birth and death of the spouse, if provided by the
514 % database entry. The |\gtrPrintSpouse| macro only prints the name.
515 % \begin{macrocode}
516 \newcommand\gtrPrintSpouse{\gtrDBspouse}
517 \newcommand\gtrPrintSpouseDetails{%
518 \gtrPrintSpouse
519 \begin{gtrprintlist}{\unskip\ (}{\unskip,\ }{\unskip)}{\unskip}%
520 \gtrifeventdefined{spousebirth}%
521 {\gtrlistseparator\gtrPrintEventPrefix{birth}\,%
522 \gtrPrintDate{spousebirth}}%
523 {}%
524 \gtrifeventdefined{spousedeath}%
525 {\gtrlistseparator\gtrPrintEventPrefix{death}\,%
526 \gtrPrintDate{spousedeath}}%
527 {}%
528 \end{gtrprintlist}}
529 % \end{macrocode}
530 % \end{macro}
531 % \end{macro}
532 %
533 % \subsubsection{Children}
534 % This adds a field for providing information about the
535 % children of a person, within the same node.
536 % \begin{macro}{\gtrDBchildren}
537 % \begin{macro}{\gtrDBdaughters}
538 % \begin{macro}{\gtrDBsons}
539 % If detailed information about children is provided through the
540 % |children+| key, then the |\gtrDBchildren| holds this detailed
541 % information. Otherwise, i.e., if information about children is
542 % provided through the |children-| or |children| key, then
543 % |\gtrDBchildren| holds the number of children of the person.
544 % The |\gtrDBdaughters| and |\gtrDBsons| macros store the number
545 % of daughters and, respectively, sons of the person.
546 % \begin{macrocode}
547 \gtrset{%
548 database/children/.code n args={2}{%
549 \numdef\gtrDBchildren{#1+#2}%
550 \def\gtrDBdaughters{#1}%
551 \def\gtrDBsons{#2}},%
552 database/children-/.store in=\gtrDBchildren,
553 database/children+/.store in=\gtrDBchildren,
554 }
555 % \end{macrocode}
556 % \end{macro}
557 % \end{macro}
558 % \end{macro}
559 % \begin{macro}{\gtrifchildrendefined}
560 % The |\gtrifchildrendefined|\marg{true}\marg{false} macro expands to
561 % \meta{true} if information about children of a database entry is
562 % defined, and expands to \meta{false} otherwise.
563 % This macro can be used, for instance, by database formats
564 % (see \cref{sec:impl-database-formats}).
565 % \begin{macrocode}
566 \def\gtrifchildrendefined#1#2{\ifdefvoid{\gtrDBchildren}{#2}{#1}}
567 % \end{macrocode}
568 % \end{macro}
569 % \begin{macro}{\gtrPrintChildren}
570 % The |\gtrPrintChildren| macro prints information about the children of
571 % a person.
572 % \begin{macrocode}
573 \def\gtrPrintChildren{%
574 \gtrTranslatedChildren:
575 % \end{macrocode}
576 % If |\gtrDBdaughters| is defined, then information about children
577 % must have been provided by the |children| key -- that is, numbers of
578 % daughters and sons have been provided. Otherwise information about
579 % children was provided though the |children+| (arbitrarily formatted
580 % information) or |children-| (number of children in total) keys,
581 % in which cases this information is printed as is.
582 % \begin{macrocode}
583 \ifdefvoid{\gtrDBdaughters}%
584 {\gtrDBchildren}%
585 {\gtrDBdaughters\kern0.5pt\gtrsymFemale~%
586 \gtrDBsons\kern0.5pt\gtrsymMale}}
587 % \end{macrocode}
588 % \end{macro}
589 %
590 %
591 % \subsection{Node Processors}
592 %
593 % \subsubsection{Sparse Node Processor}
594 %
595 % The following defines the keys that can be used for enabling and
596 % configuring sparse node display.
597 % \begin{macrocode}
598 \gtrset{%
599 % \end{macrocode}
600 % The |sparse display| key enables the node processor.
601 % \begin{macrocode}
602 sparse display/.style={node processor=\gtrltSparseNodeProcessor},
603 % \end{macrocode}
604 % The |sparse node size from| sets minimum and maximum width of
605 % sparse nodes.
606 % \begin{macrocode}
607 sparse node size from/.code args={#1 to #2}{%
608 \dimdef\gtr@@kv@@gtrlt@sparsenode@minsize{#1}%
609 \dimdef\gtr@@kv@@gtrlt@sparsenode@maxsize{#2}},
610 % \end{macrocode}
611 % The |sparse max fields| defines the maximum number of fields
612 % of a person with which the node is still considered sparse.
613 % \begin{macrocode}
614 sparse max fields/.code={%
615 \gdef\gtrlt@sparse@maxfields{#1}},%
616 % \end{macrocode}
617 % The following three options specify when sparse nodes are displayed specially.
618 % The |sparse inner from level| option specifies that inner nodes shall be
619 % displayed specially only if they are above or equal a particular level.
620 % \begin{macrocode}
621 sparse inner from level/.code={\def\gtrlt@sparseinner@level{#1}},
622 % \end{macrocode}
623 % The |sparse leaf from level| option specifies that leaf nodes shall be
624 % displayed specially only if they are above or equal a particular level.
625 % \begin{macrocode}
626 sparse leaf from level/.code={\def\gtrlt@sparseleaf@level{#1}},
627 % \end{macrocode}
628 % The |sparse inner never| option specifies that inner nodes shall never
629 % be displayed specially.
630 % \begin{macrocode}
631 sparse inner never/.code={\undef\gtrlt@sparseinner@level},
632 }
633 % \end{macrocode}
634 %
635 % The following registers the level-local macros used by the above
636 % options.
637 % \begin{macrocode}
638 \gtr@proc@register@level@local{\gtrlt@sparsenode@minsize}
639 \gtr@proc@register@level@local{\gtrlt@sparsenode@maxsize}
640 % \end{macrocode}
641 %
642 % \begin{macro}{\gtrltSparseNodeProcessor}
643 % The |\gtrltSparseNodeProcessor| is a node processor that inherits
644 % from the ``fit'' node processor, which it augments by means for
645 % displaying sparse nodes rotated.
646 % \begin{macrocode}
647 \newcommand\gtrltSparseNodeProcessor{%
648 \gtrltIfSparseEnabled{\gtrltIfSparse{%
649 \let\gtrNodeMinWidth=\gtrlt@sparsenode@minsize%
650 \let\gtrNodeMaxWidth=\gtrlt@sparsenode@maxsize%
651 \gtrkeysappto\gtrNodeBoxOptions{%
652 rotate=90,gtrNodeDimensionsLandscape,%
653 }%
654 }{}}{}%
655 \csuse{gtr@boxcontent@fit}}
656 % \end{macrocode}
657 % \end{macro}
658 %
659 % \begin{macro}{\gtrltIfSparseEnabled}
660 % Sparse display is enabled for leaf parent and leaf nodes
661 % and (if sparse display is desired for inner nodes) for
662 % inner nodes above the configured level. The
663 % |\gtrltIfSparseEnabled|\marg{true}\marg{false} macro checks
664 % the current node for whether these properties are satisfied
665 % and expands to \meta{true} if this is the case and \meta{false}
666 % otherwise.
667 % \begin{macrocode}
668 \newcommand\gtrltIfSparseEnabled{%
669 \gtrifleaf
670 {\ifdef\gtrlt@sparseleaf@level%
671 % \end{macrocode}
672 % For leaf nodes, if a mimimum level is specified (via
673 % |sparse leaf from level|), then
674 % sparse display is enabled if the node's level is greater or equal
675 % than the specified minimum:
676 % \begin{macrocode}
677 {\ifnumgreater{1+\gtrnodelevel}{\gtrlt@sparseleaf@level}}%
678 % \end{macrocode}
679 % If a mimimum level for leaf nodes is not specified, then sparse
680 % display is enabled no matter the node's level:
681 % \begin{macrocode}
682 {\@firstoftwo}}%
683 {\ifdef\gtrlt@sparseinner@level%
684 % \end{macrocode}
685 % For inner nodes, if a mimimum level is specified (via
686 % |sparse inner from level|), then
687 % sparse display is enabled if the node's level is greater or equal
688 % than the specified minimum:
689 % \begin{macrocode}
690 {\ifnumgreater{1+\gtrnodelevel}{\gtrlt@sparseinner@level}}%
691 % \end{macrocode}
692 % If a mimimum level for inner nodes is not specified, then sparse
693 % display is disabled no matter the node's level:
694 % \begin{macrocode}
695 {\@secondoftwo}}}
696 % \end{macrocode}
697 % \end{macro}
698 %
699 % \begin{macro}{\gtrltFieldCount}
700 % \begin{macro}{\gtrltIfSparse}
701 % The |\gtrltIfSparse|\marg{true}\marg{false} macro uses database format
702 % specific code to count the number of fields available for a node
703 % and expands to \meta{true} if this number is less than or equal the
704 % maximum number of fields for sparse display (specified by
705 % |sparse max fields|). Otherwise, the macro expands to \meta{false}.
706 % |\gtrltFieldCount| is a counter used internally by the macro.
707 % \begin{macrocode}
708 \newcount\gtrltFieldCount
709 \newcommand\gtrltIfSparse{%
710 \gtrltFieldCount=0\relax
711 \gtrltCountDatabaseFields
712 % \end{macrocode}
713 % Decrement the counter for using |\ifnumless| comparison below
714 % rather than ``less-or-equal'' (for which there is no conditional):
715 % \begin{macrocode}
716 \advance\gtrltFieldCount by-1\relax%
717 \ifnumless{\the\gtrltFieldCount}{\gtrlt@sparse@maxfields}}
718 % \end{macrocode}
719 % \end{macro}
720 % \end{macro}
721 %
722 % \begin{macro}{\gtrltDeclareFieldCount}
723 % The |\gtrltDeclareFieldCount|\marg{db-format}\marg{macro}
724 % registers, for the given database format \meta{db-format},
725 % macro code \marg{macro} for counting the number of
726 % displayed database fields. The \meta{macro} must ensure that,
727 % after expansion, the counter |\gtrltFieldCount| holds the
728 % number of fields.
729 % \begin{macrocode}
730 \newcommand\gtrltDeclareFieldCount[2]{%
731 \gtrset{database format/#1/.append code={%
732 \def\gtrltCountDatabaseFields{#2}}}}
733 % \end{macrocode}
734 % \end{macro}
735 %
736 % \begin{macro}{\gtrltFieldCountByConditionals}
737 % The |\gtrltFieldCountByConditionals|\marg{cond-list} macro counts
738 % the number of satisfied conditionals in the comma-separated list
739 % \meta{cond-list} of conditionals. This number is returned in the
740 % |\gtrltFieldCount| counter.
741 % \begin{macrocode}
742 \newcommand\gtrltFieldCountByConditionals[1]{%
743 % \end{macrocode}
744 % The |\do|\marg{conditional} macro increases |\gtrltFieldCount|
745 % if \meta{conditional} is true and otherwise does nothing. For this,
746 % the \meta{conditional} must be a macro with two argument, expanding
747 % to the first argument if the conditional is true, and to the second
748 % argument otherwise.
749 % \begin{macrocode}
750 \def\do##1{%
751 ##1{\advance\gtrltFieldCount by1\relax}{}}%
752 \gtrltFieldCount=0\relax
753 \docsvlist{#1}}
754 % \end{macrocode}
755 % \end{macro}
756 %
757 %
758 % \subsection{Database Formats}
759 % \label{sec:impl-database-formats}
760 %
761 % \subsubsection{Person+Marriage+Children+Profession}
762 % The following code defines the format
763 % ``\texttt{person marriage children profession}''.
764 % \begin{macrocode}
765 \gtrDeclareDatabaseFormat{person marriage children profession}{}{%
766 \gtrPrintName%
767 \begin{gtreventlist}%
768 \gtr@list@event@birth%
769 \gtr@list@event@death%
770 \end{gtreventlist}%
771 \gtrifcommentdefined{\gtrPrintComment}{}%
772 \gtr@ifmarriagedefined{\tcbline
773 \begin{gtreventlist}
774 \gtr@list@event@marriage
775 \gtrifspousedefined{
776 \gtrTranslatedWith\ \gtrPrintSpouseDetails}{}%
777 \gtrifchildrendefined{, \gtrPrintChildren}{}%
778 \end{gtreventlist}}{%
779 \gtrifchildrendefined{\tcbline\gtrPrintChildren}{}}%
780 \gtrifprofessiondefined{\tcbline\gtrPrintProfession}{}%
781 }
782 % \end{macrocode}
783 % Specify how the number of displayed database fields of a node
784 % are counted:
785 % \begin{macrocode}
786 \gtrltDeclareFieldCount{person marriage children profession}{%
787 \gtrltFieldCountByConditionals{%
788 \gtrifeventdefined{birth},
789 \gtrifeventdefined{death},
790 \gtrifeventdefined{marriage},
791 \gtrifcommentdefined,
792 \gtrifspousedefined,
793 \gtrifchildrendefined,
794 \gtrifprofessiondefined,
795 }}
796 % \end{macrocode}
797 %
798 %
799 % \subsection{Translations}
800 % For text to be displayed in nodes (for instance because there is no
801 % established symbol for the respective), we provide some additional
802 % small translation facility. This feature is complementary to the
803 % symbols facility provided by the \textsf{genealogytree} package.
804 % \begin{macro}{\gtrlt@texttranslation@add}
805 % The |\gtrlt@texttranslation@add|\marg{identifier} adds the
806 % \meta{identifier} to the list of understood translatables
807 % and provides a macro \cs{gtrTranslated\meta{identifier}} through
808 % which the translation for the chosen language can be accessed.
809 % \begin{macrocode}
810 \newcommand\gtrlt@texttranslation@add[1]{%
811 \begingroup\edef\x{\endgroup\noexpand\gtrset{%
812 textlang/#1/.store in=\expandonce{%
813 \csname gtrTranslated#1\endcsname}}}\x}
814 % \end{macrocode}
815 % \end{macro}
816 % The following are the identifiers for which there are translations.
817 % \begin{macrocode}
818 \gtrlt@texttranslation@add{Children}
819 \gtrlt@texttranslation@add{With}
820 % \end{macrocode}
821 % The following are the actual translations used by this library.
822 % We encapsulate the code in an |\AtBeginDocument| such that the
823 % |append code| portion is ensured to be run after
824 % \textsf{genealogytree} set its language code. This allows the
825 % user of the library to use |\gtrset{language=XXX}| in the
826 % preamble as well as in the document without any changes to the
827 % normal use in \textsf{genealogytree}.
828 % \begin{macrocode}
829 \AtBeginDocument{
830 \gtrset{language@/english/.append code={%
831 \gtrset{textlang/.cd,
832 Children=children,
833 With=with,
834 }
835 }}
836 \gtrset{language@/german/.append code={%
837 \gtrset{textlang/.cd,
838 Children=Kinder,
839 With=mit,
840 }
841 }}
842 \gtrset{language=\gtrlanguagename}}
843 % \end{macrocode}
844 %
845 %\iffalse
846 %</gtrlib>
847 %\fi
848 % \Finale
849 \endinput