# What's the difference between \underline and \underbar?

These two commands seem identical, and I haven't found enough materials on \underbar.

• What's the difference?
• and which doc/book has covered that?
• Welcome to TeX.SE.
– Mico
Oct 23, 2020 at 9:31

• \underbar:

• Its argument is processed in text mode by default. You need to enter math mode explicitly to process, say, \underbar{$\alpha$}.
• The horizontal line is set very close to the baseline, and will therefore intersect any parts of letters and symbols that have descenders, i.e., portions that fall below the baseline (e.g., g and $\gamma$).
• \underline:

• Its argument respects the surrounding (text or math) mode
• The horizontal line is shifted down, as needed, to avoid collisions with descender portions of any characters

\documentclass{article}
\begin{document}
$\underline{\alpha\beta\gamma}$ \underbar{$\alpha\beta\gamma$}

$\underline{effg}$ $\underbar{effg}$
\end{document}