13

When adding a \bar to a relation the spacing around the relation is removed:

\documentclass{article}

\begin{document}

$x > y$ $x \bar{>} y$

\end{document}

So, how does one do this correctly?

14

The name "relation" is the key: you must tell TeX that you want a math relation with \mathrel:

\documentclass{article}

\begin{document}
$x > y$, $x \bar{>} y$, $x \mathrel{\bar{>}} y$
\end{document}

enter image description here

By default > is already a Rel atom, but \bar{>} is turned into an Ord atom, just like x and y, and you find no spacing between them (try x{>}y).

  • 2
    To be extremely fussy, \bar{>} yields an Acc[ent] atom, which, however, is eventually “turned into an Ord atom”, as the answer correctly states, once the accent has been dealt with. – GuM Jul 27 '17 at 9:58
11

Here are three other possibilities: with the \widebar symbol from mathabx, a simple \overline, and with \stackrel which, by definition, does not remove the relation spacing:

\documentclass{article}

\usepackage{amsmath}

\DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
\DeclareFontShape{U}{mathx}{m}{n}{
<-6> mathx5 <6-7> mathx6 <7-8> mathx7
<8-9> mathx8 <9-10> mathx9
<10-12> mathx10 <12-> mathx12
}{}
\DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
\DeclareFontSubstitution{U}{mathx}{m}{n}
\DeclareMathAccent{\widebar}{0}{mathx}{"73}

\begin{document}

$x \mathrel{\widebar{>}} y$

$x \mathrel{\mkern1.8mu\overline{\mkern-1.8mu>\mkern-1.5mu}\mkern1.5mu} y$

$x \stackrel{\raisebox{-0.7ex}[0pt][0pt]{$\relbar$}}{>} y$

\end{document} 

enter image description here

9

Do you really want a bar over > or do you need simply something like this?

\documentclass{article}
\usepackage{amsmath, amssymb}
\begin{document}
\[
x \eqslantgtr y
\]
\end{document}

enter image description here

7

Not a general answer for the problem of getting a bar over a relation symbol, but a specific solution for < and >. Using \mathrel around the construction is necessary anyway.

The idea here is to rotate \leq and \geq by 180 degrees. However, \mathrel{\bar{<}} and \mathrel{\bar{>}} might be better, depending on the intended meaning of the symbol.

\documentclass{article}
\usepackage{graphicx}

\makeatletter
\DeclareRobustCommand{\barlt}{\bar@glt{\geq}}
\DeclareRobustCommand{\bargt}{\bar@glt{\leq}}

\newcommand{\bar@glt}[1]{%
  \mathrel{\mathpalette\bar@glt@aux{#1}}%
}
\newcommand{\bar@glt@aux}[2]{%
  \rotatebox[origin=c]{180}{$\m@th#1#2$}%
}
\makeatother

\begin{document}

$a\barlt b\bargt c$ $a\leq b \geq c$

$a\leq b\geq c$

$a_{\barlt\bargt}$

\end{document}

enter image description here

5

Generally, < > = are called as relational operators, LaTeX some spaces are fixed for relational operators, if you give this symbol into braces, then those spaces are removed, so give the tag within \mathrel command, e.g, $x > y$ $x \mathrel{\bar{>}} y$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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