# Undefined control sequence with nested fraction [closed]

I got a block like this

\hspace*{\fill}
\text {$O(R\mid \vec{x} ,\vec{q}$ = $\cfrac{P(R=1\mid \vec{x},\vec{q})}{P(R=0\mid \vec{x},\vec{q})}$ = $\cfrag{\cfrag{P(R=1\mid \vec{q})P(\vec{x} \mid R=1, \vec{q})}{P(\vec{x} \mid \vec{q})} }{3}$}
\hspace*{\fill}


Latex shows that the line in the middle has an Undefined control sequence and the nested fractions dont show up properly.

What did i do here wrong ?

Thanks !

## closed as off-topic by Johannes_B, egreg, TeXnician, Bobyandbob, WernerDec 17 '17 at 10:56

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• For a starter, do you know \centering and the center environment? – Johannes_B Dec 17 '17 at 10:13
• Also, do you know math environments? – Johannes_B Dec 17 '17 at 10:13
• a fraction is not a fragtion ;-) – Johannes_B Dec 17 '17 at 10:14
• @Johannes_B thank you I realized that too, it works now :) – Tuấn Phạm Dec 17 '17 at 10:15
• I'm voting to close this question as off-topic because the issue is a simple typo. – Johannes_B Dec 17 '17 at 10:18

You should use a proper math environment.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\hspace*{\fill}
\text {$O(R\mid \vec{x} ,\vec{q}$ = $\cfrac{P(R=1\mid \vec{x},\vec{q})}{P(R=0\mid \vec{x},\vec{q})}$ = $\cfrac{\cfrac{P(R=1\mid \vec{q})P(\vec{x} \mid R=1, \vec{q})}{P(\vec{x} \mid \vec{q})} }{3}$}
\hspace*{\fill}

\begin{equation*}
O(R\mid \vec{x} ,\vec{q}  =
\cfrac{P(R=1\mid \vec{x},\vec{q})}{P(R=0\mid \vec{x},\vec{q})} =
\cfrac{\cfrac{P(R=1\mid \vec{q})P(\vec{x} \mid R=1, \vec{q})}{P(\vec{x} \mid \vec{q})}   }{3}
\end{equation*}
\end{document}


I just realized it was a typo \cfrag instead of \cfrac , dummy