使用 `genealogytree` 绘制家谱

使用 `genealogytree` 绘制家谱

我正在尝试使用以下版本创建以下图像genealogytree包裹:

除了“兄弟”框和其中一个“表兄弟”框重叠之外,我已经完成了大部分操作:

这是我的 MWE,它产生了上面的图像:

\documentclass[a4paper,landscape]{article}
\usepackage[top=4.5cm, bottom=4.5cm, left=1cm, right=1cm]{geometry}
\usepackage[all]{genealogytree}
\begin{document}
\resizebox{\textwidth}{!}{
\begin{tikzpicture}
\genealogytree[template=signpost, id suffix=@p]
{
 child{
  g[male]{paternal grandfather}
  p[female]{paternal grandmother}
  child{
   g[male]{paternal uncle}
   c[male]{cousin}
   child{
    g[female]{cousin}
    }
   }
  child{
   g[female]{paternal aunt}
   c[male]{cousin}
   child{
    g[female]{cousin}
    }
   }
   child[phantom*]{
    g[male,id=father]{father}
    p[female]{mother}
    c[male]{brother}
    c{\textsc{ego}}
    c[female]{sister}
   }
 }
}
\genealogytree[template=signpost, id suffix=@m, set position=father@m at father@p]
{
 child{
  g[male]{maternal grandfather}
  p[female]{maternal grandmother}
  child{
   p[male,id=father]{father}
   g[female]{mother}
   child{
    g[male]{brother}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
   child{
    g{\textsc{ego}}
    c[male]{son}
    child{
     g[female]{daughter}
    }
   }
   child{
    g[female]{sister}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
  }
  child{
   g[male]{maternal uncle}
   c[male]{cousin}
   c[female]{cousin}
  }
  child{
   g[female]{maternal aunt}
   c[male]{cousin}
   c[female]{cousin}
  }
 }
}
\end{tikzpicture}
}
\end{document}

欢迎帮助寻找解决方案!

答案1

确实,您可以手动移动父系树……但您所面临的问题可以通过另一种方式解决。

问题是,在父系树中,你有终止于仅有的brotherego和节点sister。但在母系树中,有sondaughterniece/nephew节点终止。这些较低级别的节点迫使 、 和 之间有更多的分离空间brother——ego这个sister空间不是在父系树中是必需的,因为那些低级节点不存在。

您需要做的就是镜像全部的子节点结构从fathermother向下,如下所示:

编辑:

复制粘贴时,结构需要进行很小的调整。第一幅图显示了不进行调整时发生的情况。您需要翻转父系树中的和节点中的g和。pfathermother

\documentclass[a4paper,landscape]{article}
\usepackage[top=4.5cm, bottom=4.5cm, left=1cm, right=1cm]{geometry}
\usepackage[all]{genealogytree}
\begin{document}
\resizebox{\textwidth}{!}{
\begin{tikzpicture}
\genealogytree[template=signpost, id suffix=@p]
{
 child{
  g[male]{paternal grandfather}
  p[female]{paternal grandmother}
  child{
   g[male]{paternal uncle}
   c[male]{cousin}
   child{
    g[female]{cousin}
    }
   }
  child{
   g[female]{paternal aunt}
   c[male]{cousin}
   child{
    g[female]{cousin}
    }
   }
%OLD WAY
   %child[phantom*]{
    %g[male,id=father]{father}
    %p[female]{mother}
    %c[male]{brother}
    %c{\textsc{ego}}
    %c[female]{sister}
   %}
%MIRRORED FROM MATERNAL TREE (SEE FIRST IMAGE)
   %child[phantom*]{
   %p[male,id=father]{father}
   %g[female]{mother}
   %child{
    %g[male]{brother}
    %c[male]{nephew}
    %child{
     %g[female]{niece}
    %}
   %}
   %child{
    %g{\textsc{ego}}
    %c[male]{son}
    %child{
     %g[female]{daughter}
    %}
   %}
   %child{
    %g[female]{sister}
    %c[male]{nephew}
    %child{
     %g[female]{niece}
    %}
   %}
  %}
 %}
%MIRRORED FROM MATERNAL TREE WITH THE TWEAK (SEE SECOND IMAGE)
   child[phantom*]{
   g[male,id=father]{father}
   p[female]{mother}
   child{
    g[male]{brother}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
   child{
    g{\textsc{ego}}
    c[male]{son}
    child{
     g[female]{daughter}
    }
   }
   child{
    g[female]{sister}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
  }
 }
}
\genealogytree[template=signpost, id suffix=@m, set position=father@m at father@p]
{
 child{
  g[male]{maternal grandfather}
  p[female]{maternal grandmother}
  child{
   p[male,id=father]{father}
   g[female]{mother}
   child{
    g[male]{brother}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
   child{
    g{\textsc{ego}}
    c[male]{son}
    child{
     g[female]{daughter}
    }
   }
   child{
    g[female]{sister}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
  }
  child{
   g[male]{maternal uncle}
   c[male]{cousin}
   c[female]{cousin}
  }
  child{
   g[female]{maternal aunt}
   c[male]{cousin}
   c[female]{cousin}
  }
 }
}

\end{tikzpicture}
}
\end{document}

(未经调整 - 纯粹的复制粘贴):

Proper merge of paternal and maternal trees in genealogytree without tweak

(复制粘贴加上切换gp开启fathermother节点):

Proper merge of paternal and maternal trees in genealogytree with tweak

我认为这种方式更好,因为它可以自动间隔。手动换挡方法应该保留用于第 44 页的手册genealogytree提到(我认为这不适用于此处):

请注意,在更复杂的情况下,可能需要更多的手动干预,以避免其他节点不必要的重叠。

答案2

您可以用tikz={xshift=...}它来转移父系亲属。

\documentclass[a4paper,landscape]{article}
\usepackage[top=4.5cm, bottom=4.5cm, left=1cm, right=1cm]{geometry}
\usepackage[all]{genealogytree}
\begin{document}
\resizebox{\textwidth}{!}{
\begin{tikzpicture}
\genealogytree[template=signpost, id suffix=@p]
{
 child{
  g[male]{paternal grandfather}
  p[female]{paternal grandmother}
  child{
   g[male,tikz={xshift=-2.3cm}]{paternal uncle}
   c[male,tikz={xshift=-2.3cm}]{cousin}
   child{
    g[female,tikz={xshift=-2.3cm}]{cousin}
    }
   }
  child{
   g[female,tikz={xshift=-2.3cm}]{paternal aunt}
   c[male,tikz={xshift=-2.3cm}]{cousin}
   child{
    g[female,tikz={xshift=-2.3cm}]{cousin}
    }
   }
   child[phantom*]{
    g[male,id=father]{father}
    p[female]{mother}
    c[male]{brother}
    c{\textsc{ego}}
    c[female]{sister}
   }
 }
}
\genealogytree[template=signpost, id suffix=@m, set position=father@m at father@p]
{
 child{
  g[male]{maternal grandfather}
  p[female]{maternal grandmother}
  child{
   p[male,id=father]{father}
   g[female]{mother}
   child{
    g[male]{brother}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
   child{
    g{\textsc{ego}}
    c[male]{son}
    child{
     g[female]{daughter}
    }
   }
   child{
    g[female]{sister}
    c[male]{nephew}
    child{
     g[female]{niece}
    }
   }
  }
  child{
   g[male]{maternal uncle}
   c[male]{cousin}
   c[female]{cousin}
  }
  child{
   g[female]{maternal aunt}
   c[male]{cousin}
   c[female]{cousin}
  }
 }
}
\end{tikzpicture}
}
\end{document}

enter image description here

相关内容