With ConTeXt, one generally uses \underbar to underline. \underline also exists, but only for mathematics. I also played a bit with the ideas proposed on this wiki page. My tests can be seen on the following MWE.
\definetextbackground[myunderlinebackground]
[location=text,alternative=1,background=,frame=off]
\def\myunderline#1{
\starttextbackground[myunderlinebackground]
#1
\stoptextbackground
}
\starttext
Hello, this is \underbar{a test}. And now, this is \underbar{a $a_{e}$ test}.
And this is $\underline{\text{a } a_{e} \text{ test}}$. \\
And this is \myunderline{a $a_{e}$ test}.
\stoptext
However, none of these behaviors suit me. When there is a subscript, I would expect the bar to be broken and restart immediately after (like the underbar example, but restarting earlier and not underlying the subscript). I also notice that \underbar started inside a math environment behaves exactly like \underline.
Is it possible to tune this behavior ?