2

How to obtain PDF that reflects the order of argument put into brackets as shown in the code?

My father 
My father's father 
My father's mother
My mother   
My mother's father 
My mother's mother

If you see the PDF diagram, it is the inverse. I took this code from Typesetting genealogical trees

\documentclass[tikz,12pt]{standalone}
\usetikzlibrary{calc,positioning,backgrounds,arrows.meta}
\usepackage{forest}
\pagestyle{empty}

\begin{document}

\begin{forest}
  for tree={
    child anchor=west,
    parent anchor=east,
    grow=east,
    draw,
    anchor=west,
    edge path={
      \noexpand\path[\forestoption{edge}]
        (.child anchor) -| +(-5pt,0) -- +(-5pt,0) |-
        (!u.parent anchor)\forestoption{edge label};
    },
  }
[Me
    [My Father
      [My Father's Father
      ]
      [My Father's Mother
      ]
    ]
    [My Mother
      [My Mother's Father
      ]
      [My Mother's Mother
      ]
    ]
  ]
\end{forest}

\end{document}

\end{document}
Cragfelt
  • 4,005

2 Answers2

4

Even though this will work fine for this simple tree, note that you are probably better off using the newer genealogytree package for drawing genealogical trees.

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

\pagestyle{empty}

\begin{document}
\begin{genealogypicture}[
  timeflow=left,
  level size=5cm,
  node size=1cm,
  box={halign=center, valign=center},
  ]
  parent{
    g{Me}
    parent{
      g{My Father}
      p{My Father's Father}
      p{My Father's Mother}
    }
    parent{
      g{My Mother}
      p{My Mother's Father}
      p{My Mother's Mother}
    }
  }
\end{genealogypicture}
\end{document}

enter image description here

pst
  • 4,674
  • (+1) For Sportmanship, for going the extra mile and for educating us all. – Cragfelt Dec 31 '17 at 08:27
  • I'm not sure about the 'probably better off'. I've tried using genealogytree and it is rather obscure, to say the least, if you are not familiar with the technical terminology used to describe genealogies. And there are also a lot of things which you can't do but which seem obvious things to want to do. At least, I couldn't figure out how to do them. If you are a professional or expert amateur genealogist, it is almost certainly the best option, as you say. But I suspect I'm not the only one who will find it practically impossible to navigate the documentation. (And I really, really tried.) – cfr Jan 06 '18 at 21:11
  • Thanks for all your responses. They were very useful to me. – Houda Araj Jan 22 '18 at 15:49
3

In order to revert the order of the children in the tree as shown in the arguments, you will need to add the character ' right after the word grow in the tree options, like this: grow'=east.

It will show the expected order from top to bottom. So with the same code

[Me
    [My Father
      [My Father's Father
      ]
      [My Father's Mother
      ]
    ]
    [My Mother
      [My Mother's Father
      ]
      [My Mother's Mother
      ]
    ]
  ]

we obtain the following outputs:

With grow=east

enter image description here

With grow'=east

enter image description here

Cragfelt
  • 4,005
  • It would be better to include a complete MWE in your post. Questions aren't the only posts which benefit from such things. – cfr Jan 06 '18 at 21:12