I would like to write


in order to display the mean of Y. This yields:

Overlined Y

However when I do this there is a gap between the Y and the n. Using



bared Y

This avoids the gap however in that case the bar above the Y is not long enough for my liking.

I have seen that there exists a question \overline and \widehat with subscript but that question asks about subscript added to the bar symbol, not subscript added to the symbol(s) which are under the bar.

I'm also aware of this question: Overline over a symbol with an index but that question is about what you should or shouldn't do; not a method to solve this problem.

Thanks in Advance!

EDIT: I realize that this question is very similar to this one: Symbol with overline and subscript leads to wrong kerning, however the answer given below is better than the ones to that question.

  • 1
    The simplest fix would be \overline{Y}_{\!n}, but it requires a little typing. Commented May 17, 2017 at 11:45
  • @Arzigoglu yeah they're quite similar, though I prefer the answer given below to this question, I'm not sure what the proper thing is to do in this case. Commented May 17, 2017 at 12:11
  • 1
    @hallomotocar you should see my answer more like a quick fix. If you want exact results (meaning same spacing as without the \overline), you should either use the answer provided in the question Arzigoglu linked to or use AboAmmar's answer.
    – Skillmon
    Commented May 17, 2017 at 12:28

2 Answers 2


Exact method with a newcommand:



$Y_n$ ... with no bar \\    
$\mybar{Y}_n$ ... with my bar


enter image description here


You could insert a negative space \! to reduce the spacing:



enter image description here

Not the answer you're looking for? Browse other questions tagged .