The \bar and \overline commands
I usually define a command \overbar
, which reduced the width of \overline
by 1.5mu
on each side.
\documentclass{article}
\usepackage{amsfonts}
\newcommand{\overbar}[1]{\mkern 1.5mu\overline{\mkern-1.5mu#1\mkern-1.5mu}\mkern 1.5mu}
\begin{document}
$\bar{\mathbb{R}}$ $\overbar{\mathbb{R}}$ $\overline{\mathbb{R}}$
\end{document}
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.
\documentclass{article}
\usepackage{amsmath,amssymb}
\makeatletter
\newsavebox\myboxA
\newsavebox\myboxB
\newlength\mylenA
\newcommand*\xoverline[2][0.75]{%
\sbox{\myboxA}{$\m@th#2$}%
\setbox\myboxB\null% Phantom box
\ht\myboxB=\ht\myboxA%
\dp\myboxB=\dp\myboxA%
\wd\myboxB=#1\wd\myboxA% Scale phantom
\sbox\myboxB{$\m@th\overline{\copy\myboxB}$}% Overlined phantom
\setlength\mylenA{\the\wd\myboxA}% calc width diff
\addtolength\mylenA{-\the\wd\myboxB}%
\ifdim\wd\myboxB<\wd\myboxA%
\rlap{\hskip 0.5\mylenA\usebox\myboxB}{\usebox\myboxA}%
\else
\hskip -0.5\mylenA\rlap{\usebox\myboxA}{\hskip 0.5\mylenA\usebox\myboxB}%
\fi}
\makeatother
\begin{document}
$|\xoverline{W}|~~
|\xoverline{i}|~~
|\xoverline[3.0]{i}|$
\bigskip
$\bar{\mathbb{R}}~~\overline{\mathbb{R}}~~\xoverline{\mathbb{R}}$
\end{document}
I need a bit shorter overlines for variables in boolean algebra to make clear that variables are separately inverted. I defined the following command:
\newcommand{\olsi}[1]{\,\overline{\!{#1}}} % overline short italic
It is special designed for variables that are typeset in italic, so it is not only above but rather above right. So upright characters need a different definition:
\newcommand{\ols}[1]{\mskip.5\thinmuskip\overline{\mskip-.5\thinmuskip {#1} \mskip-.5\thinmuskip}\mskip.5\thinmuskip} % overline short
Similar definitions for underlines:
\newcommand{\ulsi}[1]{\!\overline{\,{#1}}} % underline short italic
\newcommand{\uls}[1]{\mskip.5\thinmuskip\underline{\mskip-.5\thinmuskip {#1} \mskip-.5\thinmuskip}\mskip.5\thinmuskip} % underline short
Example:
$ \olsi{x+y} = \olsi{x}\olsi{y} $
is rendered as
I hope that helps.