# Drawing Simple Abstract Syntax Trees with Forest, without them looking odd

I'm having a problem with creating some abstract syntax trees with the Forest package. As is clear below, there is a large gap between the siblings even though there is no need for such a gap, but I can't find anything in the documentation about this issue.

Below you can see how I've created the current tree. I'm thinking I need to align the nodes to the left somehow, if I want to get a tree looking like my drawing in the bottom of this post.

\begin{forest}
for tree={
before typesetting nodes={content=\texttt{#1}}
}
[<regexp>, s sep=0pt
[(seq]
[<regexp>, edge={draw=none}
[(atom 1)]
]
[<regexp>), edge={draw=none}
[(seq]
[<regexp>, edge={draw=none}
[(atom 2)]
]
[<regexp>), edge={draw=none}
[(seq]
[<regexp>, edge={draw=none}
[(atom 3)]
]
[<regexp>), edge={draw=none}]
]
]
]
\end{forest}


This is what I'm looking for, but not able to create:

• I think what you need is calign=first Apr 27 '17 at 17:54

I think you need the for tree option calign=first. I.e.

\documentclass{book}
\usepackage[linguistics]{forest}
\begin{document}
\begin{forest}
for tree={
before typesetting nodes={content=\texttt{#1},
calign=first}
}
[<regexp>, s sep=0pt
[(seq]
[<regexp>, edge={draw=none}
[(atom 1)]
]
[<regexp>), edge={draw=none}
[(seq]
[<regexp>, edge={draw=none}
[(atom 2)]
]
[<regexp>), edge={draw=none}
[(seq]
[<regexp>, edge={draw=none}
[(atom 3)]
]
[<regexp>), edge={draw=none}]
]
]
]
\end{forest}
\end{document}


Outputs: