In LaTeX, the command \bar{x}
gives a short bar over a letter, which is okay for single characters like just x
. But when you write something like \bar{AB}
, the bar only covers the A
, not the whole AB
. That’s where the problem comes in.
To solve this, we use \widebar{AB}
. This command puts a longer bar over the entire expression AB
, which looks much neater.
How to use \widebar?
The \widebar
is not available in LaTeX’s default packages, so we need to do a little extra work to use it.
For this, we can use packages like \usepackage{mathabx}
, or sometimes \usepackage{extarrows}
, or even with \usepackage{amsmath, amsfonts, amssymb}
.
However, the easiest and most reliable way is to add the \mathabx
package.
\documentclass{article} \usepackage{mathabx} \begin{document} This is a normal bar: $\bar{AB}$ This is a long bar: $\widebar{AB}$ \end{document}
Conclusion
When you use the mathabx
package, it may slightly change the appearance of some math symbols or fonts.
If that causes problems in your document, there are other ways to make a wide bar (like using \overline
or special tricks).