我使用 genealogytree 包的数据库模板创建家谱。祖先经常在出生地结婚并去世。我希望将某人的出生地自动替换为“ibid”。
上面的截图(James HowItIs)中您可以看到正常输出;下面的(John HowIWantIt)是我想要的简洁版本 — 自动完成,无需手动更改数据库数据。
\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
早期尝试。它应该能提供所需的输出,但目前尚未提供用户友好的界面。
\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}