# Overline thickness

Is there a way in latex to change the vertical thickness (height) of the line generated by the \overline command?

$\overline{\overline{A \vee B}} = \overline{\overline{A} \wedge \overline{B}}$

-
Here is that message again: eqnarray vs align –  Werner Mar 27 '14 at 4:19
possible duplicate of The \bar and \overline commands –  Peter Grill Mar 27 '14 at 4:20
@PeterGrill: The \bar and \overline commands is about the width of the line, not the height/thickness. –  Heiko Oberdiek Mar 27 '14 at 4:22
@Werner: i dont know if i wrote it correctly, but i need change height of overline (vertical thickness) –  Krab Mar 27 '14 at 4:22

## TeX

The default rule thickness θ is 0.4pt in TeX. An \overline formula is set as \vbox:

• At the top is a kern of θ
• The bar follows with thickness θ
• The gap to the formula has height 3θ
• The formula follows.

θ is taken from fontdimen 8 of math font family 3. Example:

\documentclass{article}

\begin{document}
$\overline{abc}$
\fontdimen8\textfont3=5pt
$\overline{abc}$
\end{document}


As can be seen, also the gap between the line and the formula changes with the thickness of the line (even with factor 3).

## LuaTeX/LuaLaTeX

LuaTeX makes the parameters configurable:

• \Umathoverbarkern: the white space above the line
• \Umathoverbarrule: line thickness
• \Umathoverbarvgap: the gap between the line and the formula

These values can be set for all eight math styles. LuaTeX also makes the cramped styles available as:

• \crampeddisplaystyle
• \crampedtextstyle
• \crampedscriptstyle
• \crampedscriptscriptstyle

In cramped styles, used for formulas below bars (\overline, \sqrt, denominator in fractions), the exponents are set lower than usual.

LuaLaTeX adds a prefix luatex to LuaTeX's new primitives (to avoid name clashes). The following example sets \Umathoverbarrule in all eight styles:

\documentclass{article}

\newcommand*{\setumath}[2]{%
\csname luatexUmath#1\endcsname\displaystyle=#2\relax
\csname luatexUmath#1\endcsname\luatexcrampeddisplaystyle=#2\relax
\csname luatexUmath#1\endcsname\textstyle=#2\relax
\csname luatexUmath#1\endcsname\luatexcrampedtextstyle=#2\relax
\csname luatexUmath#1\endcsname\scriptstyle=#2\relax
\csname luatexUmath#1\endcsname\luatexcrampedscriptstyle=#2\relax
\csname luatexUmath#1\endcsname\scriptscriptstyle=#2\relax
\csname luatexUmath#1\endcsname\luatexcrampedscriptscriptstyle=#2\relax
}

\begin{document}
\newcommand*{\test}[1]{%
\csname check@mathfonts\endcsname
\setumath{overbarrule}{#1}%
$\overline{abc}$ % additional space
}
\test{.1pt}
\test{.4pt}
\test{1.6pt}
\test{6.4pt}
\end{document}


-
The \setumath works only for the second math (move the \test{6.4pt} to the begin to see, also your image shows that the first two lines have the same height). One has to call \check@mathfonts first. –  Ulrike Fischer May 19 at 10:22
@UlrikeFischer Thanks, answer updated by adding \check@mathfonts. –  Heiko Oberdiek May 19 at 14:28

Rather than trying to contend with the existing definition, one could design their own, using stacks. Here the 1.2\LMpt is the vertical offset above the item of the overline, and .4\LMpt is the rule thickness. As part of a \ThisStyle argument, an \LMpt is 1pt it \displaystyle and \textstyle, but proportionately reduced in \scriptstyle and \scriptscriptstyle, as shown in the MWE.

One may or may not wish to stack a \mathop around the definition.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\usepackage{scalerel}
\def\myoverline#1{\ThisStyle{%
\setbox0=\hbox{$\SavedStyle#1$}%
\stackengine{1.2\LMpt}{$\SavedStyle#1$}{\rule{\wd0}{.4\LMpt}}{O}{c}{F}{F}{S}%
}}
\begin{document}
$\myoverline{\myoverline{A \vee B}} = \myoverline{\myoverline{A} \wedge \myoverline{B}}$$\scriptscriptstyle \myoverline{\myoverline{A \vee B}} = \myoverline{\myoverline{A} \wedge \myoverline{B}}$
\end{document}


For example, here, we change the offset to 1.4\LMpt, and the thickness to .6\LMpt:

-

The following answer is not a solution, but an easy trick suitable for some purposes (and not for all purposes). The \overbracket{} command in package mathtools has two arguments (rule thickness and bracket height):

\overbracket[〈rule thickness〉] [〈bracket height〉]{〈arg〉}


Suppose you set a rule thickness smaller than x pt. If you set the bracket height at -x pt then you get a line (values between 0 and minus the rule thickness also yield a line, but small anomalies could be visible at its extremes).

The solution is not strictly "correct", since the resulting line is slightly shorter than that of \overline{} and the distance between lines shall not be the same that in \overline{\overline{}}. But for some purposes the outcome can be similar enough.

In the following minimal working example two commands are defined: in \myov{} the thickness is set in the preamble; in \myovline{} there is an argument for it. I set the bracket height at -1pt because all the thicknesses in the MWE are below 1pt:

\documentclass{article}
\usepackage{mathtools}
\newcommand*{\myov}[1]{\overbracket[0.65pt][-1pt]{#1}}
\newcommand*{\myovline}[2]{\overbracket[#2][-1pt]{#1}}
\begin{document}
$$\overline{A \vee B} = \overline{\overline{A} \wedge \overline{A}}$$ % Default thickness = 0.4 pt
$$\myovline{A \vee B}{0.4pt} = \myovline{\myovline{A}{0.4pt} \wedge \myovline{A}{0.4pt}}{0.4pt}$$
$$\myovline{A \vee B}{0.6pt} = \myovline{\myovline{A}{0.8pt} \wedge \myovline{A}{0.8pt}}{0.8pt}$$
$$\myov{A \vee B} = \myov{\myov{A} \wedge \myov{A}}$$
\end{document}


-