[Tex/LaTex] The \bar and \overline commands


I want to represent, say, the closure of a set or the extended reals, e.g., $\bar{\mathbb{R}}$ but unfortunately this creates a bar that is much too small (horizontally) and can barely be seen. On the other hand, $\overline{\mathbb{R}}$ creates a line that is too long. I need something that's just right, in between the bar and the overline. What would be my best choice?

Best Answer

Here is a command \xoverline[width percent]{symb} that will do it. Note that it will not scale inside sub or superscripts. If you need that, everthing has to go through a \mathchoice resulting in a lot more complex code.


    \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}%





enter image description here

Related Question