10

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?
1
  • 1
    Welcome to TeX.SE.
    – Mico
    Oct 23, 2020 at 9:31

1 Answer 1

9
  • \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

enter image description here

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.