# Unevenly aligned nodes in forest

This should be a cakewalk but for some reason I can't find the key to it.

Following Alan Munn's suggestion, I have recently switched from qtree to forest for tree diagrams. Using the code:

\documentclass[11pt,a4paper,oneside,notitlepage]{book}
%...
\usepackage[linguistics]{forest}
%...
\begin{document}
%...
\begin{forest}
[A [B [C ] [D ] [E,edge=dotted ] ] [F [G ] ] ]
\end{forest}
%...
\end{document}


the following tree obtains:

How can I set a specific (shorter) length for the dotted line? I would like for node E to be positioned above the level of C, D, and G.

As the dotted line suggests, E is only remotely connected with what the tree represents, and I don't want it to be on the same level of the other bottom nodes.

You can specify the l parameter for a single node. It can lead to some funny results if you make the value too small, but for this purpose it seems to work.

\documentclass[11pt,a4paper,oneside,notitlepage]{book}
%...
\usepackage[linguistics]{forest}
%...
\begin{document}
%...
\begin{forest}
[A [B [C ] [D ] [E,edge=dotted,l=.75cm ] ] [F [G ] ] ]
\end{forest}
%...
\end{document}


• This works, thanks. I also applied the same tier to C, D, and G to make E the only unaligned node. – poxx Jul 25 '17 at 9:42
• (+1) l'=.75cm would be faster. – cfr Jul 26 '17 at 9:14
• @cfr l' is an undocumented feature... (appears nowhere in the docs that I can see.) – Alan Munn Jul 26 '17 at 16:40
• Page 36. It is a standard feature for all dimension options/registers. (Also integers etc.) – cfr Jul 26 '17 at 22:02
• Well, and you're right. l' is not specifically documented. It just isn't an undocumented feature, either. I have an advantage here: many of the avoid-pgfmath features were given a user interface when Sašo tried to figure out how prooftrees could be made faster and realised I was already using most of the (few) tricks available at the time, so provided some more. So we've been through prooftrees code trying to eliminate every use of pgfmath we could ... :-). Or, rather, I've followed Sašo through it .... – cfr Jul 26 '17 at 22:36

Forest also allows you to manually adjust the position of nodes before the tree is drawn (see chapter workflow, p.24 in forest manual). Note that x-=3 is augmented assignment.

\documentclass[11pt,a4paper,oneside,notitlepage]{book}
%...
\usepackage[linguistics]{forest}
%...
\begin{document}
%...
\begin{forest}
[A [B [C ] [D ] [E,edge=dotted, before drawing tree={x-=3mm, y+=3mm} ]
] [F [G ] ] ]
\end{forest}
%...
\end{document}


You can also change the inner ysep to adjust the distance between the dotted line and the node content.

\documentclass[11pt,a4paper,oneside,notitlepage]{book}
%...
\usepackage[linguistics]{forest}
%...
\begin{document}
%...
\begin{forest}
[A [B [C ] [D ] [E,edge=dotted, inner ysep=1pt, before drawing tree={x-=2mm, y+=2mm} ]
] [F [G ] ] ]
\end{forest}
%...
\end{document}