# Alternative definition of overline, comments?

Hi,

after learning that overline uses a fixed distance of 3
default_rule_thickness over the symbol, I decided to write an
alternative command with a fixed height. In MdSymbol, I use a rather
large rule_thickness which results in a to large height of the line. Not
knowing much of TeX, I tried to combine solutions for other problems:

http://tex.stackexchange.com/a/24134/11605
http://tex.stackexchange.com/a/43906/11605

The following works well for me. Anything I missed? Or is there an
easier solution? As far as I can see, the problem is to define a box in
math mode. Herbert's solution in the first link works for text only.

Thanks!

\documentclass{article}

\usepackage{amsmath,calc}

\newsavebox\overliningbox
\makeatletter

\def\fb@eat#1#2#3#4#5{\futurelet\fb@let@token\fb@eat@}
\def\fb@eat@#1\fb@eat{%
\ifx\fb@let@token\bgroup
\else\ifx\fb@let@token\mathop
\mathop
\else\ifx\fb@let@token\mathbin
\mathbin
\else\ifx\fb@let@token\mathrel
\mathrel
\else\ifx\fb@let@token\mathopen
\mathopen
\else\ifx\fb@let@token\mathop
\mathop
\else\ifx\fb@let@token\mathpunct
\mathpunct
\else\ifcat.\ifcat a\noexpand\fb@let@token.\else\noexpand\fb@let@token\fi
\afterassignment\fb@mathchar\count@\mathcode#1\relax\fb@eat
\else\ifx\fb@let@token\mathchar
\afterassignment\fb@mathchar\expandafter\count@\@gobble#1\relax\fb@eat
\else
\xdef\meaning@{\meaning\fb@let@token}%
\expandafter\fb@mchar@test\meaning@""\@nil
\fi\fi\fi\fi\fi\fi\fi\fi\fi
}

\def\overlining#1{%
\begingroup
\let\protect\empty
\expandafter\fb@eat\romannumeral\Q#1\relax\fb@eat
\ifcase\count@
\or
\mathop\or
\mathbin\or
\mathrel\or
\mathopen\or
\mathclose\or
\mathpunct\or
\fi
{\text{\savebox\overliningbox{$\m@th#1$}\fboxsep\z@\makebox[0pt]%[l]{$\m@th#1$}\rule[\ht\overliningbox+1.2pt]{\wd\overliningbox}%{\fontdimen8\textfont3}}}%
\endgroup}

\edef\fb@mchar@{\meaning\mathchar}

\def\fb@mchar@test#1"#2"#3\@nil{%
\xdef\meaning@{#1}%
\ifx\meaning@\fb@mchar@
\count@"#2\relax
\fb@mathchar\fb@eat
\fi
}

\def\fb@mathchar#1\fb@eat{%
\divide\count@"1000 }

\makeatother

\begin{document}
$\overlining{abcd} \overlining{\sin{abcd}}$

\overlining{\frac{abcd}{abcd}} \overlining{\int dx}

\end{document}
.