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
    Feb 7 '21 at 20:35
  • Thank you. I have modified the example to a complete one. I hope that helps.
    – Christoph
    Feb 8 '21 at 12:10
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
    Feb 8 '21 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.