0

I try to build a genealogytree with a loop/circle inside; i.e. there is a node with gggreat-grandparents occuring twice.

To simplify the problem I have tried to create a tree which shows the problem:

Here is a complete version g-father1 and g-father2 should be brothers with the same parents A and B.

\documentclass{article}
\usepackage[all]{genealogytree}
\begin{document}
\section{First Test}
\begin{tikzpicture}
\genealogytree{
  parent{
    g{child}
    parent{
      g{father}
      p{g-mother1}
      parent{
        g{g-father1}
        p{A}
        p{B}
      }
    }
    parent{
      g{mother}
      p{g-mother2}
      parent{
        g{g-father2}
        p{A}
        p{B}
      }
    }
  }
}
\end{tikzpicture}
\end{document}
2
  • 1
    Welcome to TeX.SX! Please add the code of a small complete document (starting with \documentclass and ending with \end{document}) that illustrates your problem. Just edit your question using the Edit button at the bottom left.
    – gernot
    Commented Feb 7, 2021 at 20:35
  • Thank you. I have modified the example to a complete one. I hope that helps.
    – Christoph
    Commented Feb 8, 2021 at 12:10

1 Answer 1

2
  • Connect the common ancestor only to one of the families.
  • Assign names to the ancestors and the other child using the id option.
  • Add the missing lines with a \draw command.

enter image description here

\documentclass{article}
\usepackage[all]{genealogytree}
\begin{document}
\begin{tikzpicture}
\genealogytree{
  parent{
    g{child}
    parent{
      g{father}
      p{g-mother1}
      parent{
        g{g-father1}
        p[id=A,tikz={yshift=4mm}]{A}
        p[id=B,tikz={yshift=4mm}]{B}
      }
    }
    parent{
      g{mother}
      p{g-mother2}
      p[id=g-father2]{g-father2}
    }
  }
}
\draw[green!40!black,line width=1pt] ([xshift=3mm]A.south) -- ++(0,-3mm) -| (g-father2);
\draw[green!40!black,line width=1pt] ([xshift=3mm]B.south) -- ++(0,-3mm) -| (g-father2);
\end{tikzpicture}
\end{document}
1
  • Thank you for your fast and helpful solution!
    – Christoph
    Commented Feb 8, 2021 at 19:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .