Overlayed underlines

I want the overlayed underline like the one shown , but, since the ulem package only offer {}as enclosing characters, the code \uline{ab\uwave{cd}ef} doesn't work. Does anyone have a simple solution to this? Thanks!!

EDITED to try to automate. There are four commands \tuwave, \buwave, \tuline, and \buline. The t signifies "top" and the b signifies "bottom", depending on whether the squiggle or line are on top or bottom level. The wave commands take one argument signifying the characters to be underset with a wave. The line commands take two arguments, the first are the letters to output, and the second is a text string used to determine the length of the underline.

\documentclass{article}
\usepackage{ulem}
\usepackage{stackengine}
\let\tuwave\uwave
\newcommand\buwave[1]{\raisebox{-3pt}{\uwave{\raisebox{3pt}{#1}}}}
\newcommand\tuline[2]{\stackunder[.6ex]{#1}{\rule{\widthof{#2}}{.2ex}}}
\newcommand\buline[2]{\stackunder[1.2ex]{#1}{\rule{\widthof{#2}}{.2ex}}}
\parskip 1em
\def\useanchorwidth{T}
\def\stackalignment{l}
\def\stacktype{L}
\begin{document}
\buline{ab\tuwave{cd}ef}{abcd}\par
\tuline{ab}{abcd}\buwave{cdef}
\end{document}


The following example defines \uwavelow to get a lowered wave line to avoid clashes with the underline. Also it seems, that \uwavelow (or \uwave) can be put into \uline. But the other way round is more trickier. The example uses a box to hide the \uline inside \uwavelow (or \uwave).

\documentclass{article}
\usepackage{ulem}

\newcommand*{\uwavelow}{%
\bgroup
\markoverwith{%
\lower7pt\hbox{\sixly\char58}%
}%
\ULon
}

\begin{document}

\uline{ab\uwavelow{cd}}\uwavelow{ef}

{\uline{ab}\sbox0{\uline{cd}ef}\uwavelow{\usebox{0}}}

\end{document}


• where to find the defination of \sixly?
– lyl
Apr 16, 2019 at 13:29
• @lyl It is defined by package ulem: \font\sixly=lasy6 Apr 19, 2019 at 21:26