How to get a \bar more thicker (0.8pt for example) than usual and fit all character?
Asked
Active
Viewed 5,514 times
9
Martin Scharrer
- 262,582
Stufazi Hoqckt
- 1,129
2 Answers
13
\documentclass{article}
\usepackage{accents}
\newcommand\thickbar[1]{\accentset{\rule{.4em}{.8pt}}{#1}}
\begin{document}
$\bar A$ VS $\thickbar A$
\end{document}

You can change the width and height of the rule as you wish.
Leo Liu
- 77,365
-
But when I added a
\Largecommand, the thickness ofthickbarturned thiner than in normalsize... – Stufazi Hoqckt Apr 26 '11 at 02:28 -
-
Am I wrong or the accents package is not available in Miktex? Is there a substitute for Miktex? – Juan Bermejo Vega Apr 18 '12 at 12:59
-
-
Thanks, it's solved. The problem was that
accentsis inside a bundle calledbezos, which is the one that features in the Package Manager: original link. And +1 for the help, it is nice to have this symbol if you use overline for complex numbers. – Juan Bermejo Vega Apr 18 '12 at 15:26
10
\makeatletter
\newcommand{\thickbar}{\mathpalette\@thickbar}
\newcommand{\@thickbar}[2]{{#1\mkern1.5mu\vbox{
\sbox\z@{$#1\mkern-1.5mu#2\mkern-1.5mu$}%
\sbox\tw@{$#1\overline{#2}$}%
\dimen@=\dimexpr\ht\tw@-\ht\z@-.8\p@\relax
\hrule\@height.8\p@ % adjust for the desired rule thickness
\vskip\dimen@
\box\z@}\mkern1.5mu}
}
\makeatother
With \mathpalette we make a macro that will do the right thing in all sizes. The first \sbox command sets the argument in the desired size (display, text, script or scriptscript); the second one sets the argument overlined; then we measure the difference, thus computing the clearance between the symbol and the bar above it. Then we draw a rule with the desired thickness, leave the computed clearance and print the symbol.
It's not exactly as wide as \bar, but it should be close enough.
egreg
- 1,121,712
-
Compare the
\thickbarand the\bar, you'll find their aren't similar in length. – Stufazi Hoqckt Apr 25 '11 at 12:53 -
-
tikzsolution): a bolder \overline [duplicate] – Peter Grill Mar 09 '14 at 22:53