# Setting two math symbols directly above each other and vertically aligned

I am typesetting the Neyman Pearson decision rule and would like to set the greater than > and smaller than < symbols directly above each other. I tried \overset but that doesn't align the resulting two symbols vertically to the middle.

-
Have a look at “How to look up a symbol?”. –  Caramdir Jun 28 '12 at 22:12
Thanks, good link. I have the not so short introduction to latex, but managed to miss the specific symbol.. –  Maurits Jun 28 '12 at 22:18

Of course, there's always \gtrless from

\usepackage{amssymb}% http://ctan.org/pkg/amssymb


If you're not up for using packages, you could rather "overset" the symbols yourself:

\documentclass{article}
\newcommand{\npsym}{%
\mathrel{\ooalign{\raisebox{.6ex}{$>$}\cr\raisebox{-.6ex}{$<$}}}
}
\begin{document}
Here is some text. Here is some text. Here is some text. Here is some text.
See, for example, $x\npsym y$. Here is some text. Here is some text. Here is some text.
Here is some text. Here is some text. Here is some text. Here is some text.
\end{document}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​


See \subseteq + \circ as a single symbol (“open subset”) for a short course in \ooalign.

-
Brilliant, thanks. I also found that my specific case has math symbol, \gtrless. –  Maurits Jun 28 '12 at 22:11
I don't think that \ooalign is the best way to cope with this problem. –  egreg Jun 28 '12 at 22:17

Where \grtless not available, one could define it with a tabular; for efficiency, it's better to use primitive commands:

\documentclass{article}

% This won't do anything if amssymb is loaded first
\providecommand{\gtrless}{
\mathrel{% it's a relation
\smash{% we don't want that it influences the interline spacing
\vcenter{% the symbol will be vertically centered
\offinterlineskip % no interline skip here
\ialign{% build a table
\hfil##\hfil\cr % just one centered column
$>$\cr % first row
\noalign{\kern-.3ex}% shorten the vertical distance
$<$\cr % second row
}% end of the \ialign
}% end of \vcenter
}% end of \smash
\vphantom{>}% pretend it's as high as a >
}% end of \mathrel
}

\begin{document}
Here is some text. Here is some text. Here is some text. Here is some text.
See, for example, $x\gtrless y$. Here is some text. Here is some text. Here is some text.
Here is some text. Here is some text. Here is some text. Here is some text.
\end{document}


-
Out of curiosity: Why is this better that Werner's solution? Both need to use some manual spacing adjustment. –  Caramdir Jun 29 '12 at 20:29
@Caramdir This one is more efficient in terms of computations; it would be a breeze if we avoided \smash and \phantom, which is clearly possible, for it uses only primitives, except \ialign that's \halign together with two assignments. –  egreg Jun 29 '12 at 20:33