# How do I stack multiple underbrackets?

How do I reproduce the lines like the image below in LaTeX?

In this image, common characters are connected by a line.

I've tried using \overbrace and \underbrace, but I couldn't reproduce it successfully on my own (I've never used Tikz).

Something like this?

\documentclass{article}
\usepackage{tikz}
%So we can use south later
\usetikzlibrary{positioning}
\newcommand{\Nice}[2]{\tikz[remember picture, inner sep=0pt, baseline, anchor=base]\node(#1){#2};}
\begin{document}
Et \Nice{l1}{l}es \Nice{f1}{f}ruits \Nice{p1}{p}as\Nice{s1}{s}eront \Nice{l2}{l}a \Nice{p2}{p}romes\Nice{s2}{s}e des \Nice{f2}{f}\Nice{l3}{l}eurs
\begin{tikzpicture}[remember picture, overlay]
%Adjust the distance changing 1ex if you want a different spacing
\draw (l1.south) -- ++ (south:1ex) -| (l2.south);
\draw (l1.south) -- ++ (south:1ex) -| (l3.south);
\draw (f1.south) -- ++ (south:2ex) -| (f2.south);
\draw (p1.south) -- ++ (south:3ex) -| (p2.south);
\draw (s1.south) -- ++ (south:4ex) -| (s2.south);
\end{tikzpicture}
\end{document}


• This is what I was looking for! Thanks so much ! – necotanouqui Jul 15 '20 at 0:57