![genealogytree:如何在通用密钥中保存数据库密钥](https://linux22.com/image/418775/genealogytree%EF%BC%9A%E5%A6%82%E4%BD%95%E5%9C%A8%E9%80%9A%E7%94%A8%E5%AF%86%E9%92%A5%E4%B8%AD%E4%BF%9D%E5%AD%98%E6%95%B0%E6%8D%AE%E5%BA%93%E5%AF%86%E9%92%A5.png)
通常在家谱树节点我必须说
p[]{name=Jane, birth={2-2-1888}{somewhere}}
我怎样才能创建一个键,像persdata=JaneID
扩展为的一样name=Jane, birth={2-2-1888}{somewhere}
,这样我只需要说:
p[]{persdata=JaneID}
不工作或不正确的 MWE:
\documentclass[landscape,paper=a5]{scrartcl}
\usepackage[all]{genealogytree}
\begin{document}
% Works not:
\pgfkeys{
persdata/.initial={name=Jane, birth={1-1-1777}{somewhere}},
persdata/.get=\persdata,
persdata/.store in=\persdata,
}
\gtrset{database/save/persdata/.get=\persdata}
\begin{tikzpicture}[]
\genealogytree[template=signpost,
processing=database,
]{
parent{
g{name=first child}
c{name=second child}
c{name=third child}
p[]{persdata=JaneID} % <---------------- Problem here....
p[]{name=works, birth={1-1-1777}{somewhere}}
}
}
\end{tikzpicture}
\end{document}
答案1
此答案提供了一个新的/gtr/database
键persdata
,它接受预定义的选择,例如JaneID
。persdata=JaneID
使用时,将检索以该样式存储的相应键值列表。
\documentclass[landscape,paper=a5]{scrartcl}
\usepackage[all]{genealogytree}
\begin{document}
\gtrset{
database/.cd,
persdata/.is choice,
persdata/JaneID/.style={name=Jane, birth={1-1-1777}{somewhere}}
}
\begin{tikzpicture}[]
\genealogytree[
template=signpost,
processing=database,
]
{
parent{
g{name=first child}
c{name=second child}
c{name=third child}
p[]{persdata=JaneID}
p[]{name=works, birth={1-1-1777}{somewhere}}
}
}
\end{tikzpicture}
\end{document}