我想在家谱中显示两姐妹与同一个男人的婚姻状况。我使用了 genealogytree 包。
以下代码生成两次丈夫节点,每次都与其中一个姐妹有孩子。我的目的是将丈夫节点放置在姐妹之间的中间,两条边从这个丈夫节点对称地延伸到孩子。
\documentclass{article}
\usepackage[all]{genealogytree}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\genealogytree[]{
child{
g[male]{A}
p[female]{B}
child{
g[female]{Sister 1}
p[male]{Husband of both sisters}
c[male]{Son A}
}
child{
g[female]{Sister 2}
p[male]{Husband of both sisters}
c[male]{Son B}
}
}
}
\end{tikzpicture}
\end{document}
答案1
在以他开始的树中,如果有两个妻子和孩子,则更容易获得“两个姐妹的丈夫”,因此你可以将以他开始的树与更早开始的树结合起来。
\documentclass{article}
\usepackage[all]{genealogytree}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% Tree for the common husband with descendents
\genealogytree[
nullify edge level shift,
]{
child{
p[id=sister1,female]{Sister 1}
c[male]{Son A}
g[male]{Husband of both sisters}
union{
p[female]{Sister 2}
c[male]{Son B}
}
}
}
\genealogytree[
set position=sister1c at sister1,
]{
child{
g[male]{A}
p[female]{B}
child{
g[id=sister1c,female]{Sister 1}
}
child{
p[phantom,male]{}
% This version of sister2 is not in the exact same position
% as the one above, so make it a phantom*
g[phantom*,female]{Sister 2}
}
}
}
\end{tikzpicture}
\end{document}