  Generalizing the notion of the boundary sequence introduced by Chen and Wen,
the $n$th term of the $\ell$-boundary sequence of an infinite word is the
finite set of pairs $(u,v)$ of prefixes and suffixes of length $\ell$ appearing
in factors $uyv$ of length $n+\ell$ ($n\ge \ell\ge 1$). Otherwise stated, for
increasing values of $n$, one looks for all pairs of factors of length $\ell$
separated by $n-\ell$ symbols.
  For the large class of addable abstract numeration systems $S$, we show that
if an infinite word is $S$-automatic, then the same holds for its
$\ell$-boundary sequence. In particular, they are both morphic (or generated by
an HD0L system). To precise the limits of this result, we discuss examples of
non-addable numeration systems and $S$-automatic words for which the boundary
sequence is nevertheless $S$-automatic and conversely, $S$-automatic words with
a boundary sequence that is not $S$-automatic. In the second part of the paper,
we study the $\ell$-boundary sequence of a Sturmian word. We show that it is
obtained through a sliding block code from the characteristic Sturmian word of
the same slope. We also show that it is the image under a morphism of some
other characteristic Sturmian word.
