30

Is there a command like \bar{...} but such that the bar is placed below the symbol?

Of course there is \underline{...} but then the line is adapted to the width of the symbol and I don't want that (compare with the difference between \overline{...} and \bar{...}).

I need this for math mode.

  • Do you need it in text mode or in math mode? Have a look at the accents package. – egreg Jul 25 '13 at 13:02
  • Maybe this from amsmath: \underset{\bar{}}{A} – Sigur Jul 25 '13 at 13:03
  • @egreg That's good. Could you turn the comment into an answer please. – lpdbw Jul 25 '13 at 13:12
23

The accents package has the feature you're looking for:

\usepackage{accents}
\newcommand{\ubar}[1]{\underaccent{\bar}{#1}}

Why the \newcommand? Because you might change your mind or find a new way to underline a symbol, so you can just modify the definition instead of hunting through the document for occurrences of \underaccent{\bar}.

  • Interesting. With this we don't need to write \bar{} like mine suggestion. Also, the space between the symbol and the bar is different. – Sigur Jul 25 '13 at 13:23
  • 2
    @Sigur The accents package ensures that the correct vertical dimension is assigned to the underaccent; with \underset{\bar{}}{x} you get a full vertical sized bar; and, moreover, it will be in script style. – egreg Jul 25 '13 at 13:30
20

My solution is \newcommand{\ubar}[1]{\text{\b{$#1$}}} since I get a conflict of accents and amsmath packages concerning \vec command.

  • Can someone please explain why this has been downvoted? I am unsure if I should use the accents package in case there is indeed an assue with the amsmath package, as @SergeyPolyakovskiy suggests, however it is unclear. I have tried searching it in other questions and it seems that such a \vec issue does exist, but some clarification would be helpful. Thanks! – Flint72 Oct 5 '14 at 21:25
  • 1
    This. This answer saved my hide. The solution that is accepted here -- and referenced seemingly everywhere when it comes to the problem of making a suitable underbar expression relies on a really outdated package that, as far as I can figure, was last updated in 2006. It is not compatible with amsmath and a host of other packages. This solution works tremendously well. – Tom Feb 15 '16 at 3:51
7

You can play with the three parameters (1.2pt underset gap, .8ex rule length, .075ex rule width

\documentclass{article}
\usepackage{stackengine}
\begin{document}
\newcommand\barbelow[1]{\stackunder[1.2pt]{$#1$}{\rule{.8ex}{.075ex}}}
\( \overline{A} \bar{A} \barbelow{A} \)
\end{document}

enter image description here

0

Use the \textrm{.1.} for text mode IN the math mode. In the brackets you can then use the text mode command \underline{.2.} to underline your text input in the {.2.} brackets.

in math mode...

\textrm{\underline{this text input will be underlined}} 

... worked for me

-1

Have you tried using \underbar{symbol} in a math environment?

  • 1
    This only works in text mode. – egreg Feb 20 '18 at 0:24

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.