2

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?

3
  • 3
    $\overline{\langle x, y \rangle}$
    – Sigur
    Commented Dec 29, 2017 at 18:54
  • There is also Hendrik Vogt's widebar macro. Personally I prefer it over the standard overline. Commented Dec 29, 2017 at 19:10
  • 1
    Welcome to TeX SX! In a recent answer, I converted for convenience Hendrik Vogt's macro into a small (unofficial) macro package widebar.sty, which you can install into your TeXMF-local root.
    – Bernard
    Commented Dec 29, 2017 at 20:24

1 Answer 1

3

You 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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .