[Tex/LaTex] Overline thickness

math-moderules

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

Best Answer

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}

Result TeX

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}

Result LuaLaTeX