nice empty nodes broken by forest 2.0?

As @cfr points out,

The problem is that node walks have changed dramatically and invalid steps now trigger errors by default. Because the root is empty, it gets nice empty nodes treatment and for parent fails because, well, there is no parent.

So yes, this is a bug in the definition of nice empty nodes, so thanks for finding it and poiting it out. I didn't catch it as the only example of nice empty nodes in the documentation doesn't apply the style to the root node, so the docs compiled just fine ...

The solution is actually very simple (and will be included in the upcoming minor release) as forest now has step siblings.

\documentclass{article}
\usepackage{forest}
\forestset{
nice empty nodes/.style={
    for tree={calign=fixed edge angles},
    delay={where content={}{shape=coordinate,for siblings={anchor=north}}{}}
},
}
\begin{document}
\begin{forest}
    [{},nice empty nodes
    [b][
    [c]
    [
    [b] [a]
    ]
    ]
    ]
\end{forest}
\end{document}

Note that the for parent={for children={...}} idiom is not exactly the same as for siblings={...}, as the current node is not walked in the for siblings case. In our case, this makes no difference, as the current node gets a coordinate shape. To get exactly the (old) for parent={for children={...}} behaviour, say for preceding siblings={...},for current and following siblings={...}. And I promise to include key for current and siblings in the next minor release ... I have just not realized until now there's a case where having it makes sense.


Surely a bug? It doesn't work even loading the linguistics library and using the official nice empty nodes in a tree preamble.

This is very inelegant, but it should work for now. The problem is that node walks have changed dramatically and invalid steps now trigger errors by default. Because the root is empty, it gets nice empty nodes treatment and for parent fails because, well, there is no parent. Rather than disable that globally, this hopefully disables it just for this node walk. However, I'm sure there is a more efficient approach.

\documentclass[tikz]{standalone}
\usepackage{forest}
\forestset{%
  nice empty nodes/.style={%
    for tree={calign=fixed edge angles},
    delay={%
      where content={}{%
        shape=coordinate,
        for nodewalk={%
          Nodewalk={%
            on invalid=fake,
          }{%
            parent,
          }{%
            for children={anchor=north},
          }
        }{},
      }{},
    },
  },
}

\begin{document}
\begin{forest}
  nice empty nodes
  [
    [b]
    [
      [c]
      [
        [b]
        [a]
      ]
    ]
  ]
\end{forest}
\end{document}

nicer empty nodes?