How do I put text on multiple lines in a forest tree within a gb4e example?

I'm using gb4e and forest to present (linguistic) trees in a nice format. It's been working well except that I some of the text underneath the nodes presented on multiple lines. In the forest package readme I've found the following code.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[extra]{tipa}
\usepackage[linguistics]{forest}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{decorations,decorations.text}
decorate,
postaction={decorate,
decoration={text along path,
text align=center,
text={|\tiny|=},
transform={rotate=90}}}}}
\usepackage{gb4e}

\begin{document}

\begin{exe}
\ex
\begin{xlist}
\ex
\begin{forest} GP1 [
[parent
[child]
[child]
[a very\\tall\\child, align=center, base=bottom]
]
]
\end{forest}
\end{xlist}
\end{exe}

\end{document}


Which yields what I want, namely that the text is displayed on multiple lines.

However when I apply this method to my own tree, I encounter the problem that it does not put the text on multiple lines. Here is the code.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[extra]{tipa}
\usepackage[linguistics]{forest}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{decorations,decorations.text}
decorate,
postaction={decorate,
decoration={text along path,
text align=center,
text={|\tiny|=},
transform={rotate=90}}}}}
\usepackage{gb4e}

\begin{document}

\begin{exe}
\ex
\begin{xlist}
\ex
\begin{forest} GP1 [
[x[k]]
[x[\textipa{1}
[a very\\tall\\child, align=center, base=bottom]
]]
[x[z]]
[x[\textipa{1}[| |]]]
[x[n]]
]\end{forest}
\end{xlist}
\end{exe}

\end{document}


Which yields the following output.

Is there any way to fix this is issue and make the text appear on multiple lines?

EDIT: edited to include MWE

• Can you provide an MWE that compiles, and not just code fragments? Welcome to the site. – Steven B. Segletes May 8 '18 at 14:57
• @StevenB.Segletes Edited to include MWE's – L. Suurmeijer May 8 '18 at 15:12
• @StevenB.Segletes I've edited my answer in your honour. :) – Alan Munn May 8 '18 at 15:14

This has nothing to do with gb4e, but with the definition of the GP1 style in forest. There are at least three ways to fix this:

Use an explicit tabular

You can put the node inside an explicit tabular:

\documentclass{article}
\usepackage[extra]{tipa}
\usepackage[linguistics]{forest}
\usepackage{tikz}
\usepackage{gb4e}

\usetikzlibrary{decorations,decorations.text}
decorate,
postaction={decorate,
decoration={text along path,
text align=center,
text={|\tiny|=},
transform={rotate=90}}}}}
\begin{document}
\begin{exe}
\ex
\begin{xlist}
\ex
\begin{forest} GP1 [
[x[k]]
[x[\textipa{1}
[{\begin{tabular}{c}a very\\tall\\child\end{tabular}}]
]]
[x[z]]
[x[\textipa{1}[| |]]]
[x[n]]
]\end{forest}
\end{xlist}
\end{exe}
\end{document}


Use the stackengine package

Alternatively, you could use the stackengine package to do the same thing:

\usepackage{stackengine}
\begin{forest} GP1 [
[x[k]]
[x[\textipa{1}
[{\Shortunderstack[c]{{a very} tall child}}]
]]
[x[z]]
[x[\textipa{1}[| |]]]
[x[n]]
]\end{forest}


Redefine the forestGP1 style

If you're going to be doing this a lot, it might make more sense to redefine the GP1 style slightly, so that the nodes behave as you would expect:

\documentclass{article}
\usepackage[extra]{tipa}
\usepackage[linguistics]{forest}
\usepackage{tikz}
\usepackage{gb4e}
\usetikzlibrary{decorations,decorations.text}
decorate,
postaction={decorate,
decoration={text along path,
text align=center,
text={|\tiny|=},
transform={rotate=90}}}}}
\forestset{GP1/.style 2 args={
for n={1}{baseline},
s sep=0pt, l sep=0pt,
for descendants={
l sep=0pt, l={#1},
anchor=base,calign=first,child anchor=north,
inner xsep=1pt,inner ysep=2pt,outer sep=0pt,s sep=0pt
},
delay={
if content={}{phantom}{for children={no edge}},
for tree={
if content={O}{tier=OR}{},
if content={R}{tier=OR}{},
if content={N}{tier=N}{},
if content={x}{
tier=x,content={$\times$},outer xsep={#2},
for tree={calign=center},
for descendants={content format={\noexpand\standardnodestrut\forestoption{content}}},
before drawing tree={outer xsep=0pt,delay={typeset node}},
s sep=4pt
}{align=center}, % changed the style here
},
},
before drawing tree={where content={}{parent anchor=center,child anchor=center}{}},
}}
\begin{document}
\begin{exe}
\ex
\begin{xlist}
\ex
\begin{forest} GP1 [
[x[k]]
[x[\textipa{1}
[{a very\\ tall \\child}]
]]
[x[z]]
[x[\textipa{1}[| |]]]
[x[n]]
]\end{forest}
\end{xlist}
\end{exe}
\end{document}