I need to place a wide bar over the following expression
<x , y>
Using command \bar{<x , y>}
just puts a small bar sign over the expression. I need the bar sign to cover the entire expression. How can I do that?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityYou can use Hendrik Vogt's macro widebar
or use the \widebar
command from mathabx
(here renamed \varwidebar
for testing purposes).
In the following code, where I defined what I believe to a be an inner product, with \DeclarePaired Delimiter
from mathtools
(needless to load amsmath
), you'll see there's not much difference between the three solutions. There's a significant difference when one has to take into account the italic angle of the maths font:
\documentclass[12pt, a4paper]{article}
\usepackage{mathtools}%
\usepackage{xparse, etoolbox}
\DeclarePairedDelimiterX{\innerp}[1]{\langle}{\rangle}{\innpargs{#1}}
\NewDocumentCommand{\innpargs}{>{\SplitArgument{1}{,}}m}
{\innpargsaux#1}
\NewDocumentCommand{\innpargsaux}{mm}
{\ifblank{#1}%
{\ifblank{#2}{~{,}~}{{\, · \,}{,}{\mkern2mu#2}}}%
{{#1\,}{,}\ifblank{#2}{\, · \,}{\mkern2mu#2}}%
}%
\usepackage{widebar}
\DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
\DeclareFontShape{U}{mathx}{m}{n}{
<5> <6> <7> <8> <9> <10>
<10.95> <12> <14.4> <17.28> <20.74> <24.88>
mathx10
}{}
\DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
\DeclareFontSubstitution{U}{mathx}{m}{n}
\DeclareMathAccent{\varwidebar}{0}{mathx}{"73}
\begin{document}
\[ \begin{array}{c@{\qquad}c@{\qquad}c}
\texttt{\textbackslash overline} & \texttt{\textbackslash widebar} & \texttt{\textbackslash varwidebar}\\[2ex]
\overline{\innerp{x, y}} & \widebar{\innerp{x, y}} & \varwidebar{\innerp{x, y}} \\[1.5ex]
\overline{A\cdot\mkern-2mu B} & \widebar{A\cdot\mkern-2mu B} & \varwidebar{A\cdot\mkern-2.5mu B}
\end{array} \]%
\end{document}
$\overline{\langle x, y \rangle}$
widebar
macro. Personally I prefer it over the standardoverline
.widebar.sty
, which you can install into your TeXMF-local root.