LyX is giving a lot of error messages for my Latex code which runs in other places.
\[
\begin{array}{rl}
p_{Y \mid H_1}(y \mid H_1) & = f_X(g^{-1}(y))\left| \dfrac{dg^{-1}(y)}{dy} \right| \\ \\
& = \begin{cases} y>0 & : & f_X(\ln(y))\left| \dfrac{d \ln(y)}{dy} \right| = \dfrac{f_X(\ln(y))}{y} \\
\text{otherwise} & : & 0
\end{cases}
\end{array}
\]
LyX says:
Extra alignment tabs changed to \cr.
& = \begin{cases} y>0 & : &
f_X(\ln(y))\left| \dfrac{d \ln(y)}{dy} \ri...
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.
However the exact code works perfectly in the SE Mathematics domain to give this output:
What does LyX not like in my code?
Best Answer
Here's a solution which (a) uses the
align*
environment instead of thearray
environment and (b) inverts the order of the arguments inside thecases
environment (as I believe that this may be closer to general usage of this environment). It also defines a macro called\abs
to simplify typesetting in the body of the example.If you want to state the condition part before the result part in the
cases
environment, you could write it as:leading to the following result: