29

I have a relation called Likelihood Ratio Test which has a special format. As you see in the picture, there are two non-equality signs and also somethings above and below them. How can I write these symbols? enter image description here

3 Answers 3

17

You can use a \Vectorstack, where the baselineskip of the stack may be set to the desired value. As Bernard points out, a \Vectorstack is actually a \Centerstack that is automatically processed in math mode.

\documentclass{article}
\usepackage{stackengine}
\begin{document}
\[
  \setstackgap{L}{.7\baselineskip}
  \Lambda(y) = \frac{p(y{\mid}H_1)}{p(y{\mid}H_0)}
  \Vectorstack{H_1 > < H_0}
  \lambda.
\]
\end{document}

enter image description here

4
  • 1
    Why not \Vectorstack? I thought \Centerstack was rather for text.
    – Bernard
    Oct 14, 2015 at 17:52
  • 7
    @Bernard Teaching me about my own package. I should either be impressed or depressed. Using a \Vectorstack in lieu of the \Centerstack indeed allows one to eliminate the \stackMath directive. Oct 14, 2015 at 17:59
  • 2
    +1 especially for the {} around \mid, I'll put that in my list of tricks.
    – Rmano
    Oct 15, 2015 at 10:42
  • 1
    @Rmano Thanks. Don't forget the corresponding trick, that of forcing the introduction of the space, with {}\mid{}. Compare, for example, x\mbox{$\mid$}x` to x\mbox{${}\mid{}$}x. Oct 15, 2015 at 10:49
24

I propose using \gtrless of amssymb, to begin with.

The “official” way would be

\underset{H_0}{\overset{H_1}{\gtrless}}

but the effect is the same with more efficient code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}

\newcommand{\LRT}[2]{%
  \mathrel{\mathop\gtrless\limits^{#1}_{#2}}%
}

\begin{document}

\begin{equation*}
\Lambda(y)=\frac{p(y\mid H_1)}{p(y\mid H_0)} \LRT{H_1}{H_0} \lambda
\end{equation*}

\end{document}

enter image description here

10

You can stack these using a regular array:

enter image description here

\documentclass{article}

\begin{document}

\[
  \Lambda(y) = \frac{p(y \mid H_1)}{p(y \mid H_0)}
  \begin{array}{c}
    H_1 \\ > \\ < \\ H_0
  \end{array}
  \lambda.
\]

\end{document}

You must log in to answer this question.

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