帮助绘制家谱树

帮助绘制家谱树

我一直在尝试为我的家人绘制家谱树。我使用我孙子(我儿子的儿子)的父母家庭绘制了初始家谱树。然后我将自己和妻子添加为我两个儿子的父母。然后我添加了我的父母。此时代码如下所示

\documentclass{article}
\usepackage[all]{genealogytree}
\begin{document}
%\section{First Test}
\begin{tikzpicture}
   \genealogytree [template=signpost] {
      parent{
         g[ male]{GRANDSON}   
         p[female]{MY DAUGHTER IN LAW}
         parent{
                    g[male]{SON 1}
                    c[ male]{SON 2}
                   parent{
                          g[male]{ME}
                          c[male]{MY BROTHER}
                          p[ male]{MY FATHER}
                          p[female]{MY MOTHER}
                           }
                 p[female]{MY WIFE}
                  }
              } 
           }
\end{tikzpicture}
\end{document}

编译成功。树看起来像 在此处输入图片描述

现在我想添加我兄弟的家人。我使用带有单个 g 节点的子家庭来表示我兄弟。

代码如下:

\documentclass{article}
\usepackage[all]{genealogytree}
\begin{document}
%\section{First Test}
\begin{tikzpicture}
   \genealogytree [template=signpost] {
      parent{
         g[ male]{GRANDSON}   
         p[female]{MY DAUGHTER IN LAW}
         parent{
                    g[male]{SON 1}
                    c[ male]{SON 2}
                   parent{
                          g[male]{ME}
                          child{
                          g[male]{MY BROTHER}
                                  }
                          p[ male]{MY FATHER}
                          p[female]{MY MOTHER}
                           }
                 p[female]{MY WIFE}
                  }
              } 
           }
\end{tikzpicture}
\end{document}

现在无法编译。错误消息指出最后一个花括号 [}]。有人能帮忙吗?提前致谢。

答案1

后代图方法可以满足您的需求,有关更多信息,请访问文档文档

\documentclass{standalone}
\usepackage[all]{genealogytree}

\begin{document}

\begin{tikzpicture}
\genealogytree[template=signpost]
    {
        % Familiy formed by my father and mother
        child[id=famA]{
            g[id=na1, male]{My father}
            p[id=na2, female]{My mother}

            % Familiy formed by me and my wife
            child[id=famB]{
                g[id=na3, male]{Me}
                p[id=nb1, female]{My wife}

                % Familiy formed by son 1 and his wife
                child[id=famD]{
                    g[id=nb2, male]{Son 1}   
                    p[id=nd1, female]{My daughter in law}
                    c[id=nd2, male]{Grandson}
                }
                c[id=nb3, male]{Son 2}
            }
            
            % Familiy formed my brother
            child[id=famC]{
                g[id=na4, male]{My Brother}
                p[id=nc1, female]{My BW}
                c[id=nc2, male]{B Son 1}
                c[id=nc3, male]{B Son 2}
            }
        }
    }
\end{tikzpicture}

\end{document}

例子

相关内容