tikz.dev / forest Manual

Forest

Reference

3.2 Invocation

  • \begin {forest}[(⟨config⟩)]⟨tree⟩\end {forest}(environment)

  • \ Forest[*][(⟨config⟩)]{⟨tree⟩}(macro)

  • The environment and the starless version of the macro introduce a group; the starred macro does not, so the created nodes can be used afterwards, like in the example below. (Note that this will leave a lot of temporary macros lying around. This shouldn’t be a problem, however, since all of them reside in the \forest “namespace”.)

    (53)

    Compiled output

    We create a
    ~\Forest*~{
    [DP,name=DP,baseline
    [D]
    [NP]
    ]
    }
    and merge it into a
    ~\Forest*~{
    [VP,baseline
    [V]
    [,replace by=DP
    ]
    ]
    }

    ⟨config⟩ is a keylist that configures the behaviour of the environment/macro. The configuration is the first operation that the environment/macro does; it precedes even the reading of the tree specification. Currently, ⟨config⟩ accepts only one key:

    • stages=⟨keylist⟩(forest option)

    • By default, after reading the tree specification, Forest executes style stages. If key stages is used in ⟨config⟩, ⟨keylist⟩ is executed instead.

  • \ forestset{⟨keylist⟩}(macro)

  • Execute ⟨keylist⟩ (of node keys) with the default path set to /forest.

    • This macro is usually used to define Forest styles.

    • Usually, no current node is set when this macro is called. Thus, executing most node keys in this place will fail. However, if you have some nodes lying around, you can use propagator for name=⟨node name⟩ to set the node with the given name as current.