# Equation Error - Undefined Control Sequence

    \documentclass[12pt,a4paper,oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage{textgreek}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{mathtools}
\begin{document}

\begin{equation*}
\begin{aligned}
\theta_1^*(t) ~ P(\theta_1| Y_1^{obs}, Y_2^{(t-1)},…,Y_p^{(t-1)})\\
Y_1^{*(t)} ~ P(Y_1| Y_1^{obs}, Y_2^{(t-1)},…,Y_p^{(t-1)}, theta_1^{*(t)}) %<----stops here
\end{aligned}
\end{equation*}
\end{document}


Hello, I'm trying to input equations into my thesis and I've been trying for quite sometime now, but it always stops at the line indicated in the code. I dont know what I'm doing wrong. Please could someone help me.

• (1) welcome, (2) it is always a good idea to cite the error you get. (3) where is \Y defined? (4) You'd probably want \dots instead of … (utf8 char) since the latter is apparently defined as something \textellipsis (by inputenc) and as the name suggests this is a text symbol that cannot be used in math mode. – daleif Aug 16 '17 at 15:19
• and (5) it should be \theta not theta ... – Zarko Aug 16 '17 at 15:21
• (5) what should this mean: Y_p^(t-1)? currently it makes ( into a superscript, perhaps you meant Y_p^{(t-1)}? (6) you are missing a \ at the end in theta – daleif Aug 16 '17 at 15:21
• (7) you probably also mean Y_1^{\textyp{obs}} not Y_1^obs – daleif Aug 16 '17 at 15:21
• Hello, I dont know where I typed the edit reference. I cant see it in my edit in the question. But yes, thanks for pointing it out. The \Y was a typ0 – Ar1229 Aug 16 '17 at 15:23

1. ~ does not produce a visible symbol; you probably want \sim
2. … should be \dots
3. Y_p^(t-1) should be Y_p^{t-1};
4. theta should be \theta
5. | should be \mid or the spacing would be wrong
6. ^obs should be ^{\mathrm{obs}} so the superscript is in textual mode and a single object
7. \Y should probably be Y
8. you are missing an alignment point

Here is the fixed code:

\documentclass[12pt,a4paper,oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsthm}

\begin{document}

\begin{equation*}
\begin{aligned}
\theta_1^*(t) &\sim P(\theta_1\mid Y_1^{\mathrm{obs}}, Y_2^{t-1},\dots,Y_p^{t-1})\\
Y_1^*(t) &\sim P(Y_1\mid Y_1^{\mathrm{obs}}, Y_2^{t-1},\dots,Y_p^{t-1},\theta_1^*(t))
\end{aligned}
\end{equation*}
\end{document}


If you wanted a space instead of a ~ symbol:

\documentclass[12pt,a4paper,oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsthm}

\DeclareMathOperator{\Prob}{\mathnormal{P}}

\begin{document}

\begin{equation*}
\begin{aligned}
&\theta_1^*(t) \Prob(\theta_1\mid Y_1^{\mathrm{obs}}, Y_2^{t-1},\dots,Y_p^{t-1})\\
&Y_1^*(t) \Prob(Y_1\mid Y_1^{\mathrm{obs}}, Y_2^{t-1},\dots,Y_p^{t-1},\theta_1^*(t))
\end{aligned}
\end{equation*}
\end{document}


• all this was said in comments ... but you not consider given advises – Zarko Aug 16 '17 at 15:30
• @Zarko Yes, while I was writing my answer. Made CW anyway. – egreg Aug 16 '17 at 15:32
• @egreg, no, your answer is sufficient. – Zarko Aug 16 '17 at 15:34
• @Zarko I did, I was incorporating the \theta as the comments were made. – Ar1229 Aug 16 '17 at 15:36
• @Ar1229, than you should obtain the same solution as egreg provide ! – Zarko Aug 16 '17 at 15:42