TransWikia.com

Increase and decrease horizontal overline and the vertical distance

TeX - LaTeX Asked on March 12, 2021

If I have this MWE,

documentclass[12pt]{article}
usepackage{amsmath,amssymb}

begin{document} 
[overline{left(frac{a}{b}right)}]
end{document}

it is possible increase (without to use a rule-macro) the lenght of overline and the vertical distance like the image below?

enter image description here

One Answer

Here, Xoverline pads the content vertically by Xgap and the overline gets extended by Xtend. Note: the vertical padding is applied to top and bottom of argument...this could be problematic if you wish to apply a subscript outside of the Xoverline. If so, let me know, and I will attempt to address.

In the MWE, 2pt are added as vertical gap, and the overline length is shrunk by 2pt.

documentclass[12pt]{article}
usepackage{amsmath,amssymb,stackengine,scalerel}
newlengthXgap
newlengthXtend
setlengthXgap{2pt}
setlengthXtend{-2pt}
newcommandXoverline[1]{%
  overline{ThisStyle{kernXtend
  ensurestackMath{addstackgap[Xgap]{SavedStyle#1}}
  kernXtend}}}
begin{document} 
[
overline{left(frac{a}{b}right)},
Xoverline{left(frac{a}{b}right)}
]
end{document}

enter image description here

Correct answer by Steven B. Segletes on March 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP