How to get the \bar over a relation?

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).


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


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