As you may already have gathered, this is not an entirely straightforward thing to do, especially given the desiderata in your comment on Sašo's answer.
For that reason, my solution is far from guaranteed. It passes minimal testing, but it relies on an experimental package, xcoffins
. Also, it involves using code written by me, which is doubtless a considerably greater peril to any traveller who ventures down this path.
Caveat emptor ...
I define a new command \excoffintrees
for use in the exe
environment. It should be used instead of \ex
as it will issue \ex
itself. The command is defined to support the following forms:
for 1 tree:
\excoffintrees{<forest tree>}[<optional text>]
\excoffintrees*{<forest tree>}[<optional text>]
for 2 trees:
\excoffintrees{<forest tree>}[<optional text between>]{<forest tree>}[<optional text>]
\excoffintrees*{<forest tree>}[<optional text between>]{<forest tree>}[<optional text>]
Although I say <forest tree>
, actually, you could put anything similar here. I designed it for trees, but the code isn't specific to them.
The starred form aligns any text between trees at the top. The unstarred form aligns it at the bottom.
Note that the contents cannot be broken over a page, so excessively long text should not be appended as the final argument.
Moreover, it only really makes sense to use something short and sweet between two trees and it will certainly not look right if too much is included here!
The idea, however, is that we can write something like
\begin{exe}
Start the environment as usual.
\excoffintrees
will issue \ex
, so we don't need to include it explicitly (and it would give an error if we did - probably it would complain about a missing \item
or something obscure like that).
{%
This is our first tree.
\begin{forest}
[This
To align the trees, we use
\forestset{default preamble=!r.baseline}
You could alternatively add , baseline
within the tree specification, if preferred. Or change the default locally for a group of trees.
Now the rest of the tree:
[is
[another]
[tree]
]
[just]
]
\end{forest}
}
Pretty boring. All this really does is align with the number in a very roundabout way. It would be better to just use \ex
here.
\excoffintrees
{%
\begin{forest}
[This
[is
[another]
[tree]
]
[just]
]
\end{forest}
}%
This is a bit more interesting as we have some optional text. Not a lot, but a little. Since there's only one tree, this gets aligned to the baseline of the lowest node in the tree.
[%
and little more.
]
\excoffintrees
{%
\begin{forest}
[This
[is
[another]
[tree]
]
[just]
]
\end{forest}
}%
This time we have a lot more stuff after the tree and see that it flows naturally onto subsequent lines.
[%
and much more \dots.
\kant[2]
]
\excoffintrees
{%
\begin{forest}
[This
[is
[another]
[tree]
]
[just]
]
\end{forest}
}%
This one has just a little bit of text after the first tree ...
[%
and there
]%
... and then another tree, so the preceding text will align to the bottom level of the deepest tree ...
{%
\begin{forest}
[is
[another tree]
]
]
\end{forest}
}%
... and the final, longer text aligned to the bottom of the lowest node of both trees for the first partial line, and then flowing below the trees into subsequent lines.
[%
to complete the sequence.
\kant[1]
]
\end{exe}
This produces the following result:

or with the starred form:

Complete code:
\documentclass[a4paper]{article}
\usepackage[linguistics]{forest}
\usepackage[T1]{fontenc}
\usepackage{gb4e,xcoffins,calc,microtype,kantlipsum}
\forestset{default preamble=!r.baseline}
\NewCoffin\excoffina
\NewCoffin\excoffinb
\NewCoffin\excoffinc
\NewCoffin\excoffind
\newlength\mylength
\newlength\mytemplength
\newlength\mywidth
\makeatletter
\NewDocumentCommand\excoffintrees { s m +O {\makebox[0pt]{\phantom{Xyp}}} g +O {\makebox[0pt]{\phantom{Xyp}}} }
{%
\setlength\mywidth{\textwidth-\leftmargin}%
\IfValueTF{#4}{%
\def\ex@coffintree@tree{#4}%
\long\def\ex@coffintrees@longtext{#5}%
\long\def\ex@coffintrees@tween{#3}%
}{%
\let\ex@coffintree@tree\relax
\long\def\ex@coffintrees@longtext{#3}%
\long\def\ex@coffintrees@tween{\makebox[0pt]{\phantom{Xyp}}}%
}%
\ex\makebox[0pt]{\relax}%
\SetHorizontalCoffin\excoffina
{%
#2%
}%
\SetHorizontalCoffin\excoffinb
{%
\ex@coffintrees@tween
}%
\SetHorizontalCoffin\excoffinc
{%
\ex@coffintree@tree
}%
\JoinCoffins\excoffina[H,r]\excoffinc[H,l](\CoffinWidth{\excoffinb},0pt)%
\setlength\mylength{\CoffinDepth{\excoffina}-\CoffinHeight{\excoffinb}}%
\IfBooleanTF{#1}{%
\setlength\mytemplength{\mylength}%
}{%
\setlength\mytemplength{0pt}%
}%
\SetVerticalCoffin\excoffind{\mywidth}
{%
\hspace*{\CoffinWidth{\excoffina}}\ex@coffintrees@longtext
}%
\JoinCoffins\excoffind[T,l]\excoffina[H,l](0pt,\mylength)%
\JoinCoffins\excoffind[\excoffind-T,\excoffina-r]\excoffinb[H,l](0pt,\mytemplength)%
\TypesetCoffin\excoffind[\excoffina-H,l]
\par
}
\makeatother
\begin{document}
\begin{exe}
\excoffintrees
{%
\begin{forest}
[This
[is
[another]
[tree]
]
[just]
]
\end{forest}
}
\excoffintrees
{%
\begin{forest}
[This
[is
[another]
[tree]
]
[just]
]
\end{forest}
}%
[%
and little more.
]
\excoffintrees
{%
\begin{forest}
[This
[is
[another]
[tree]
]
[just]
]
\end{forest}
}%
[%
and much more \dots.
\kant[2]
]
\excoffintrees
{%
\begin{forest}
[This
[is
[another]
[tree]
]
[just]
]
\end{forest}
}%
[%
and there
]%
{%
\begin{forest}
[is
[another tree]
]
]
\end{forest}
}%
[%
to complete the sequence.
\kant[1]
]
\end{exe}
\begin{exe}
\excoffintrees*
{%
\begin{forest}
[This
[is
[another]
[tree]
]
[just]
]
\end{forest}
}
\excoffintrees*
{%
\begin{forest}
[This
[is
[another]
[tree]
]
[just]
]
\end{forest}
}%
[%
and little more.
]
\excoffintrees*
{%
\begin{forest}
[This
[is
[another]
[tree]
]
[just]
]
\end{forest}
}%
[%
and much more \dots.
\kant[2]
]
\excoffintrees*
{%
\begin{forest}
[This
[is
[another]
[tree]
]
[just]
]
\end{forest}
}%
[%
and there
]%
{%
\begin{forest}
[is
[another tree]
]
]
\end{forest}
}%
[%
to complete the sequence.
\kant[1]
]
\end{exe}
\end{document}