Math & Science ⇒ Controlling Size of '\overline' or '\bar' Command
Controlling Size of '\overline' or '\bar' Command
I am trying to put a bar over a letter. Say, for example, in case of writing a complex conjugate of $z$ as $\bar{z}$.
However, I find it appears smaller in length (less than the width of the letter) and the bar is not clearly visible. Now if I use \overline instead, then it seems to exceed the width of the letter.
Is there something intermediate or in general, can I modify the length of the \bar or \overline ?
Thanks.
However, I find it appears smaller in length (less than the width of the letter) and the bar is not clearly visible. Now if I use \overline instead, then it seems to exceed the width of the letter.
Is there something intermediate or in general, can I modify the length of the \bar or \overline ?
Thanks.
Last edited by hbaromega on Fri Nov 18, 2011 8:51 pm, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

Re: Controlling Size of '\overline' or '\bar' Command
I guess, this post has been overlooked. Please let me know whether any solution exists.
Thanks.
Thanks.
Re: Controlling Size of '\overline' or '\bar' Command
I wonder why I am not receiving any comment or reply! Is not it appearing in the topics?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Controlling Size of '\overline' or '\bar' Command
Solutions can only be provided if they are present. And people who work out these solutions do that in their spare time. Furthermore you are not the only one here who is asking for a solution to a problem. Perhaps you can take that into account for your next question.hbaromega wrote:I wonder why I am not receiving any comment or reply! […]
A relative simple solution would be to define a new command that just draws a line with fixed sizes above an expression.
Code: Select all
\documentclass{article}
\newcommand*\oline[1]{%
\vbox{%
\hrule height 0.5pt% % Line above with certain width
\kern0.25ex% % Distance between line and content
\hbox{%
\kern-0.1em% % Distance between content and left side of box, negative values for lines shorter than content
\ifmmode#1\else\ensuremath{#1}\fi% % The content, typeset in dependence of mode
\kern-0.1em% % Distance between content and left side of box, negative values for lines shorter than content
}% end of hbox
}% end of vbox
}
\begin{document}
$\oline{\alpha}$ \oline{\beta}
\end{document}
A more complex solution is given at another place [1]. It is also more flexible due to possible customization.
[1] {TeX} SX — The \bar and \overline commands
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Controlling Size of '\overline' or '\bar' Command
Thanks Thorsten. I had been thinking that somehow my post did not appear.
Could you tell me where I should make change to vary the length of the bar?
Thanks a lot.
Could you tell me where I should make change to vary the length of the bar?
Thanks a lot.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Controlling Size of '\overline' or '\bar' Command
Can't comprehend that. Either look in the sub-forum where you posted or just view the active topics (see main menu on the right side of each page here).hbaromega wrote:[…] I had been thinking that somehow my post did not appear. […]
Actually I thought that my comments in the code should help. The relevant part is the horizontal box.hbaromega wrote:[…] Could you tell me where I should make change to vary the length of the bar? […]
Code: Select all
\hbox{%
\kern-0.1em% % Set screw for the left side
\ifmmode#1\else\ensuremath{#1}\fi% % The box content
\kern-0.1em% % Set screw for the right side
}% end of hbox
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Controlling Size of '\overline' or '\bar' Command
Thanks a lot. I got it. It's working.