At the moment I have an output with \bar{...} command as
and I want something that extends over the entire term preferably without redefining the original command.
At the moment I have an output with \bar{...} command as
and I want something that extends over the entire term preferably without redefining the original command.
I wrote a macro \voverline which has a variable rule width and separation from the content. These parameters are called \voverlinesep and \voverlinewidth. They can be adjusted via \setlength.
\documentclass{article}
\newlength\voverlinesep
\newlength\voverlinewidth
\setlength\voverlinesep{1pt}
\setlength\voverlinewidth{.1pt}
\makeatletter
\newcommand\voverline[1]{%
\mathpalette\@voverline{#1}%
}
\newcommand\@voverline[2]{%
\sbox0{$\m@th#1#2$}%
\rule[\dimexpr\ht0+\voverlinesep]{\wd0}{\voverlinewidth}%
\llap{\box0}
}
\begin{document}
$\overline{\mathbf{M}_{\mathbf{2}}(\mathbf{q}_{\mathbf{b}})}$
versus
$\voverline{\mathbf{M}_{\mathbf{2}}(\mathbf{q}_{\mathbf{b}})}$
\end{document}
\setlength\voverlinesep{1.2pt} would fit better, because the separation to the formula is 3 times the line thickness (default 0.4pt) for \overline.
– Henri Menke
Nov 19 '15 at 19:01
\overlineinstead of\bar. The\baraccent is meant to be used for single letters only. – Henri Menke Nov 19 '15 at 15:42\overline, because it is a primitive command. You can write a macro which does similar things with a variable line thickness, though. – Henri Menke Nov 19 '15 at 16:28