TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The \xoverline command (see the-bar-and-overline-commands) works beautifully except that it assumes normalsize. So it blows up the size of subscripts as in

$A_{\xoverline{K}}$ vs $A_{\overline{K}}$
share|improve this question
My question is, how do you fix this? The size of the subscript should not be changed by adding an overline to the subscript – Ben G Aug 23 '14 at 0:39
up vote 4 down vote accepted

You can try Hendrik Vogt's solution (thanks, Hendrik!), which I have adopted in the form of a small .sty file, widebar.sty:


%%% Defines a \widebar command, similar to\widehat.
%%% May have problems with indices
%%% Comes from Hendrik Vogt's answerhere : http://tex.stackexchange.com/questions/16337/can-i-get-a-widebar-without-using-the-mathabx-package/60253#60253

  \ifdim\ht0=\ht2 #3\else #2\fi
%The bar will be moved to the right by a half of \macc@kerna, which is computed by amsmath:
%If there's a superscript following the bar, then no negative kern may follow the bar;
%an additional {} makes sure that the superscript is high enough in this case:
%Use a separate algorithm for single symbols:
%Enable nesting of accents:
%If there's more than a single symbol, use the first character instead (see below):
    \if#32 \let\macc@nucleus\first@char \fi
%Determine the italic correction:
%Now \dimen@ is the italic correction of the symbol.
    \divide\dimen@ 3
%Now \@tempdima is the width of the symbol.
    \divide\@tempdima 10
%Now \dimen@ = (italic correction / 3) - (Breite / 10)
    \ifdim\dimen@>\z@ \dimen@0pt\fi
%The bar will be shortened in the case \dimen@<0 !
%Place the combined final kern (-\dimen@) if it is >0 or if a superscript follows:
      \ifdim\dimen@<\z@ \let\final@kern1\fi
      \if\final@kern1 \kern-\dimen@\fi
  \let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar
  \mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}%
%The following initialises \macc@kerna and calls \mathaccent:
%If the argument consists of more than one symbol, and if the first token is
%a letter, use that letter for the computations:
    \ifcat\noexpand\first@char A\else

Here is a minimal test code:




\[ \widebar{\mathbf A}_{\widebar{K}_{\widebar L}} \]%


enter image description here

share|improve this answer




    \setbox\myboxB\null% Phantom box
    \wd\myboxB=#1\wd\myboxA% Scale phantom
    \sbox\myboxB{$\m@th\overline{\copy\myboxB}$}%  Overlined phantom
    \setlength\mylenA{\the\wd\myboxA}%   calc width diff
       \rlap{\hskip 0.5\mylenA\usebox\myboxB}{\usebox\myboxA}%
        \hskip -0.5\mylenA\rlap{\usebox\myboxA}{\hskip 0.5\mylenA\usebox\myboxB}%



 $A_{\xoverline{K}}$ vs $A_{\overline{K}}$ 

 $A_{\text{\xoverline{K}}}$ vs $A_{\overline{K}}$ 

share|improve this answer
This (putting the xoverlined-subscript inside "\text") works well too. Thanks! – Ben G Aug 23 '14 at 1:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.