6

I was wondering if the following specification in 'nice nodes' can make an empty node -- that is the sister to F3 node in the example below -- look symmetric (not hanging down). Everything else (the distances between parents and siblings) could stay as specified below. I went through several solutions but haven't found anything that keeps parents fairly close together with nice (=symmetric) empty nodes. Thanks in advance for help.

\documentclass{standalone}
\usepackage{forest}
\forestset{
  nice nodes/.style={
  for tree={
  inner sep=1pt, s sep=12pt,
  fit=band,
},
},
default preamble=nice nodes,
}
\useforestlibrary{linguistics}
\forestapplylibrarydefaults{linguistics}
\begin{document}

\begin{forest}
 [F$_4$P[F$_4$]    
 [F$_3$P, [F$_3$, fit=band]
 [{} [A]    [...]  ]]]]]]
\end{forest}

\end{document}

enter image description here

(NOTE: The broader context for this question -- that is, why I simply don't go for nice empty nodes is here: Forest for linguistics - proportional alignment like in qtree)

0

1 Answer 1

8

Empty nodes are always a compromise. You can combine the fit=band with any of the existing nice styles. I don't know which one you would prefer. Personally I think fairly nice empty nodes looks the best, for this tree but as the author of it, I may be biased. :) Once you decide, any one of them can be put into the default preamble of your trees (in addition to nice nodes).

\documentclass{standalone}
\usepackage{forest}
\forestset{
  nice nodes/.style={
  for tree={
  inner sep=1pt, s sep=12pt,
  fit=band,
},
},
% begin fairly nice empty nodes
fairly nice empty nodes/.style={
            delay={where content={}{shape=coordinate,for parent={
                  for children={anchor=north}}}{}}
},
% end fairly nice empty nodes
% begin pretty nice empty nodes
pretty nice empty nodes/.style={
    for tree={
      calign=fixed edge angles,
      parent anchor=children,
      delay={if content={}{
          inner sep=0pt,
          edge path={\noexpand\path [\forestoption{edge}] (!u.parent anchor) -- (.children)\forestoption{edge label};}
        }{}}
    },
  },
% end pretty nice empty nodes
default preamble={ 
nice nodes,
%nice empty nodes, % uncomment the one you want (and delete the ones you don't)
%fairly nice empty nodes,
%pretty nice empty nodes
}
}
\useforestlibrary{linguistics}
\forestapplylibrarydefaults{linguistics}
\begin{document}

\begin{forest}for tree=nice empty nodes
 [F$_4$P[F$_4$]    
 [F$_3$P, [F$_3$]
 [{} [A]    [nice]  ]]]]]]
\end{forest}

\begin{forest}for tree= fairly nice empty nodes
 [F$_4$P[F$_4$]    
 [F$_3$P, [F$_3$]
 [{} [A]    [{fairly nice}]  ]]]]]]
\end{forest}

\begin{forest}for tree= pretty nice empty nodes
 [F$_4$P[F$_4$]    
 [F$_3$P, [F$_3$]
 [{} [A]    [pretty nice]  ]]]]]]
\end{forest}



\end{document}

output of code

4
  • @oliver I've commented the code to show you where to cut.
    – Alan Munn
    Commented May 2, 2017 at 23:52
  • Don't you think which is nicest is somewhat context dependent? @oliver Glad to see you got an answer. You never managed to ping me, but somebody directed me to your attempts in chat.
    – cfr
    Commented May 3, 2017 at 0:23
  • @cfr Yes, I wasn't intending that to be a universal statement. :) Each of the styles solve a slightly different problem.
    – Alan Munn
    Commented May 3, 2017 at 0:28
  • @cfr Hi. Thanks for having a look at this issue.
    – oliver
    Commented May 3, 2017 at 0:33

You must log in to answer this question.

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