momom4urice
6/26/2017 - 12:53 PM

Nicer overline with index

Nicer overline with index

% This fixes bad index positioning with overline
% https://tex.stackexchange.com/questions/346842/symbol-with-overline-and-subscript-leads-to-wrong-kerning
\newcommand\mean[2][]{%
    \overline{#2}%
    \ifx\relax#1\relax\else
        \sbox0{$#2_{#1}$}%
        \sbox2{$\overline{#2}_{#1}$}%
        \kern\dimexpr\wd0-\wd2\relax_{#1}%
    \fi%
}

% usage example
$\mean[0]{T}$