如何在族谱中创建一个循环?

如何在族谱中创建一个循环?

我使用 genealogytree 包创建了一个家谱。家谱从底部(从我这里)开始向上。但是,我的(外祖父)曾祖父和我的(外祖母)曾祖母有同一个(父亲)曾祖父,他是我的第五代祖父,这意味着存在一个循环。

当我尝试绘制家谱时,它看起来像这样:

家谱

顶部的人是同一个人,但出现了两次。有什么办法可以将两个条目合并为一个条目,以便该人只出现一次?

这是我用来生成家谱的代码:

\documentclass[]{standalone}
\usepackage[all]{genealogytree}
\begin{document}
\begin{genealogypicture}
[template=database portrait]
parent[]{
g[id=Said1990]{
    male,
    name = {\pref{Sa\"{i}d} \surn{Maanan}},
    birth= {1990}{},
}
c[id=Ahmed1992]{
    male,
    name = {\pref{Ahmed} \surn{Maanan}},
    birth= {1992}{},
}
parent{
    g[id=Fatima1962]{
        female,
        name = {\pref{Fatima} \surn{Dasser}},
        birth= {1962}{},
    }

    parent{
        g[id=Kelt1938]{
            female,
            name = {\pref{Keltoum} \surn{Akheshkhush}},
            birth= {1938}{},
        }
        parent{
            g[id=Zah]{
                female,
                name = {\pref{Zahra} \surn{A\"{i}t Lmoudden}},
                birth= {}{},
            }
            parent{
                g[id=Fad]{
                    female,
                    name = {\pref{Fadma} \surn{A\"{i}t Oulidi}},
                    birth= {}{},
                }
                parent{
                    g[id=Bihi]{
                        male,
                        name = {\pref{Bihi} \surn{A\"{i}t Oulidi}},
                        birth= {}{},
                    }
                }
            }
            parent{
                g[id=SiH]{
                    male,
                    name = {\pref{Si Hmed} \surn{A\"{i}t Lmoudden}},
                    birth= {}{},
                }
                parent{
                    g[id=Mhen]{
                        male,
                        name = {\pref{Mhend} \surn{A\"{i}t Lmoudden}},
                        birth={}{},
                    }
                    parent{
                        g[id=abdellah]{
                            male,
                            name = {\pref{Abdellah} \surn{A\"{i}t Lmoudden}},
                            birth= {}{},
                        }
                    }
                }
            }
        }
        parent{
            g[id=Brah]{
                male,
                name = {\pref{Brahim} \surn{Akheshkhush}},
                birth= {}{},
            }
            parent{
                g[id=Mhe]{
                    male,
                    name = {\pref{Mhend} \surn{A\"{i}t Lmoudden}},
                    birth= {}{},
                }
                parent{
                    g[id=ali]{
                        male,
                        name = {\pref{Ali} \surn{A\"{i}t Lmoudden}},
                        birth= {}{},
                    }
                    parent{
                        g[id=abdellah]{
                            male,
                            name = {\pref{Abdellah} \surn{A\"{i}t Lmoudden}},
                            birth= {}{},
                        }
                    }
                }
            }
            parent{
                g[id=ija]{
                    female,
                    name = {\pref{Ijja} \surn{N'A\"{i}t Tamr}},
                    birth= {}{},
                }
            }
        }
    }
    parent{
        g[id=Hmed1914]{
            male,
            name = {\pref{Ahmed} \surn{Dasser}},
            birth= {1914}{},
        }
    }
}
parent{
    g[id=Mohamed1947]{
        male,
        name = {\pref{Mohammed} \surn{Maanan}},
        birth={1947}{},
    }
 }
 }
 \end{genealogypicture}
 \end{document}

答案1

我已经删除了一个abdellah父级,移动了另一个,并在唯一级abdellahMhen子级之间手动绘制了一条额外的边(也许有更好的方法,但我不知道)。

\documentclass[]{standalone}
\usepackage[all]{genealogytree}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
    \begin{genealogypicture}[template=database portrait,
        after tree={\draw[thick](abdellah.south) -- ++(0,-8.5pt) -| (Mhen.north);}
        ]
        parent[]{
            g[id=Said1990]{
                male,
                name = {\pref{Sa\"{i}d} \surn{Maanan}},
                birth= {1990}{},
            }
            c[id=Ahmed1992]{
                male,
                name = {\pref{Ahmed} \surn{Maanan}},
                birth= {1992}{},
            }
            parent{
                g[id=Fatima1962]{
                    female,
                    name = {\pref{Fatima} \surn{Dasser}},
                    birth= {1962}{},
                }

                parent{
                    g[id=Kelt1938]{
                        female,
                        name = {\pref{Keltoum} \surn{Akheshkhush}},
                        birth= {1938}{},
                    }
                    parent{
                        g[id=Zah]{
                            female,
                            name = {\pref{Zahra} \surn{A\"{i}t Lmoudden}},
                            birth= {}{},
                        }
                        parent{
                            g[id=Fad]{
                                female,
                                name = {\pref{Fadma} \surn{A\"{i}t Oulidi}},
                                birth= {}{},
                            }
                            parent{
                                g[id=Bihi]{
                                    male,
                                    name = {\pref{Bihi} \surn{A\"{i}t Oulidi}},
                                    birth= {}{},
                                }
                            }
                        }
                        parent{
                            g[id=SiH]{
                                male,
                                name = {\pref{Si Hmed} \surn{A\"{i}t Lmoudden}},
                                birth= {}{},
                            }
                            parent{
                                g[id=Mhen,
                                family={extra edges={abdellah}{Mhen}{foreground={black},
                                        no background}}
                                ]{
                                    male,
                                    name = {\pref{Mhend} \surn{A\"{i}t Lmoudden}},
                                    birth={}{},
                                }
                            }
                        }
                    }
                    parent{
                        g[id=Brah]{
                            male,
                            name = {\pref{Brahim} \surn{Akheshkhush}},
                            birth= {}{},
                        }
                        parent{
                            g[id=Mhe]{
                                male,
                                name = {\pref{Mhend} \surn{A\"{i}t Lmoudden}},
                                birth= {}{},
                            }
                            parent{
                                g[id=ali]{
                                    male,
                                    name = {\pref{Ali} \surn{A\"{i}t Lmoudden}},
                                    birth= {}{},
                                }
                                parent{
                                    g[id=abdellah,
                                        tikz={xshift=-3.2em},
                                        ]{
                                        male,
                                        name = {\pref{Abdellah} \surn{A\"{i}t Lmoudden}},
                                        birth= {}{},
                                    }
                                }
                            }
                        }
                        parent{
                            g[id=ija]{
                                female,
                                name = {\pref{Ijja} \surn{N'A\"{i}t Tamr}},
                                birth= {}{},
                            }
                        }
                    }
                }
                parent{
                    g[id=Hmed1914]{
                        male,
                        name = {\pref{Ahmed} \surn{Dasser}},
                        birth= {1914}{},
                    }
                }
            }
            parent{
                g[id=Mohamed1947]{
                    male,
                    name = {\pref{Mohammed} \surn{Maanan}},
                    birth={1947}{},
                }
            }
        }
    \end{genealogypicture}
\end{document}

在此处输入图片描述

相关内容