Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}}
\]
share|improve this question
    
Here is that message again: eqnarray vs align –  Werner Mar 27 at 4:19
    
possible duplicate of The \bar and \overline commands –  Peter Grill Mar 27 at 4:20
1  
@PeterGrill: The \bar and \overline commands is about the width of the line, not the height/thickness. –  Heiko Oberdiek Mar 27 at 4:22
    
@Werner: i dont know if i wrote it correctly, but i need change height of overline (vertical thickness) –  Krab Mar 27 at 4:22
add comment

2 Answers 2

up vote 9 down vote accepted

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]{%
    \setumath{overbarrule}{#1}%
    $\overline{abc}$ % additional space
  }
  \test{.1pt}
  \test{.4pt}
  \test{1.6pt}
  \test{6.4pt}
\end{document}

Result LuaLaTeX

share|improve this answer
add comment

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}

enter image description here

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

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.