6

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.

Werner
  • 603,163
Maurits
  • 173

2 Answers2

7

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:

enter image description here

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

Werner
  • 603,163
7

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}

enter image description here

egreg
  • 1,121,712
  • 1
    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