I use Geophar http://sourceforge.net/projects/geophar/ With this Program, I can easy to make a tree. With the code

||Tirage 1|Tirage 2|Tirage 3

I got the tree. enter image description here

How can I make simple code in tree package or forest package like above code?

  • What do you mean? Obviously, to use those packages, you have to use those packages' syntax. You can't expect them to work with syntax from a completely different software programme.
    – cfr
    Commented Nov 6, 2015 at 3:27
  • @cfr Can I make a code in order to write, easy to understand and easy to practice? I see that, Geophar is easy to use. Commented Nov 6, 2015 at 3:30
  • I think the bracket notation is pretty easy. I think the Geophar code you posted less easy. It is just a question of what you are used to. You can always use Geophar and \includegraphics{} but writing something to parse your tree in order to turn it into forest code or whatever, which then uses special tricks to parse the tree.... Well, of course you can. You can write whatever tree-drawing package you like. For me, I think life too short when other people have already done the job;).
    – cfr
    Commented Nov 6, 2015 at 3:49
  • Don't reinvent the wheel.... Not unless you are really, really, really sure that your new triangular design will be easier to use, more aesthetically pleasing and more efficient than the currently available circular forms favoured by existing manufacturers.
    – cfr
    Commented Nov 6, 2015 at 3:51
  • Or you could use TikZ's graph-drawing syntax. That's not specifically for trees, of course. Or specify it as a matrix of nodes, say, and then draw the edges in later?
    – cfr
    Commented Nov 6, 2015 at 3:59

1 Answer 1


forest uses bracket notation for specifying trees which is, I believe, pretty standard (or a variation on standard syntax). I find this fairly intuitive - much more so than qtree's version, for example.

For an introduction to forest's syntax and some basic uses of the package see the second part of my answer which tries to provide a kind of basic getting-started.

In the following example, note that the specification of the tree is extremely concise. Indentation makes it easier to 'read' the tree structure from the code.

  /tikz/every node/.append style={font=\sffamily},
  my edge/.style={%
    if n=1{
      edge label={node [midway, above, font=\scriptsize, sloped, anchor=south] {#1}},
      edge label={node [midway, below, font=\scriptsize, sloped, anchor=north] {#1}},
    before drawing tree={
      tikz/.wrap pgfmath arg={\node at ([yshift=10pt].center |- h.north) {Tirage ##1};}{level()},
    for ancestors'={if level=0{}{toss}},
    before packing={
      !1.tikz={\node at ([yshift=10pt].center |- h.north) {Outcomes};}
  for tree={
    parent anchor=east,
    child anchor=west,
    tier/.wrap pgfmath arg={tier #1}{level()},
    l sep+=20pt,
    math content,
    [A, my edge=0.7
      [B, name=h, my edge=0.8]
      [C, my edge=0.2]
    [\overline{A}, my edge=0.3
      [E, my edge=0.1
        [H, tosses]
      [\overline{E}, my edge=0.9


You must log in to answer this question.

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