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?
3 Answers
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}
-
1
-
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.– RmanoOct 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` tox\mbox{${}\mid{}$}x
. Oct 15, 2015 at 10:49
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}
You can stack these using a regular array
:
\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}