Troubleshooting \bar vs. \overbar in LaTeX

In summary, Dan was on a thread where he noticed that MarkFL's \bar operator didn't look as good as using the \overbar operator. When Dan first tested it, it worked but when he posted it, the tex box showed \overbarAB instead of \overbar{AB}. Dan assumed that \overbar was part of the current LaTeX version. Jameson asked for a link to the thread to see the issue, but Dan quickly realized that he had used "overline" instead of \overbar in his test. He had seen MarkFL's \bar command and mistakenly used \overbar to answer the post. Dan apologized for the confusion and thanked Jameson for the quick response.
  • #1
topsquark
Science Advisor
Insights Author
Gold Member
MHB
2,019
825
I was just on a thread and I noted that MarkFL's \bar operator didn't look quite as nice as using the \overbar operator. It worked for me when I first tested it in the thread, but when I posted it the tex box gave me \overbarAB ie. [tex]\overbar{AB}[/tex]

Since it worked for me the first time I can only assume that \overbar is part of the current LaTeX version. Does anyone know why it's doing this?

Thanks!

-Dan
 
Physics news on Phys.org
  • #2
Link to thread so we can see it working properly and not properly?
 
  • #3
Ah Jameson. You're too efficient. I just spotted the solution to my problem. I tested the LaTeX using "overline." I saw MarkFL's \bar command and I got \overbar stuck in my head and used that to answer the post.

Sorry for the confusion and thanks for the quick response.

-Dan
 

FAQ: Troubleshooting \bar vs. \overbar in LaTeX

What is the difference between \bar and \overbar in LaTeX?

The \bar command in LaTeX creates a horizontal line over a single character, while the \overbar command creates a horizontal line over multiple characters or a whole equation.

Why is my \overbar not showing up in my LaTeX document?

The \overbar command only works with specific fonts in LaTeX, such as the Computer Modern font. If you are using a different font, the command may not work. You can try using the \overline command instead, which should work with most fonts.

How do I adjust the length of the \overbar in my LaTeX document?

The length of the \overbar can be adjusted by using the \overline command and placing the desired length in parentheses after it. For example, \overline{abc} will create a longer bar than \overline{a}.

Can I use \bar and \overbar in math mode in LaTeX?

Yes, both \bar and \overbar can be used in math mode in LaTeX to create horizontal lines over variables or equations. Just make sure to enclose them in dollar signs to indicate math mode.

Why is my \overbar appearing above my equation instead of over it in LaTeX?

This may be due to the placement of the \overbar command. Make sure to place it directly after the equation or the specific characters you want it to cover. If it is still not working, try using the \overline command instead.

Similar threads

Replies
12
Views
2K
Replies
8
Views
2K
Replies
8
Views
2K
Replies
11
Views
3K
Replies
7
Views
11K
Replies
11
Views
1K
Replies
7
Views
3K
Replies
3
Views
4K
Replies
11
Views
5K
Back
Top