以下代码运行良好
\documentclass[a4paper,12pt]{book}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsthm}
\begin{document}
\begin{equation*}
\begin{split}
& x[0]\sim\mathcal{N}(\theta,1) \\
& x[1]\sim\left\{\begin{array}{rcl}
\mathcal{N}(\theta,1) & \mbox{if} & \theta\geq0 \\
\mathcal{N}(\theta,2) & \mbox{if} & \theta<0 \\
\end{array}\right.
\end{split}
\end{equation*}
\end{document}
..而下面给出的是“缺少分隔符”错误
\documentclass[a4paper,12pt]{book}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsthm}
\begin{document}
\begin{equation*}
\begin{split}
& var(\hat\theta_1) = \frac{1}{4}(var(x[0])+var(x[1])) \\
& var(\hat\theta_2) = \frac{4}{9}var(x[0])+\frac{1}{9}var(x[1]) \\
& var(\hat\theta_1) = \left\{\begin{array}{rcl}
\frac{18}{36}(\theta,1) & \mbox{if} & \theta\geq0 \\
\frac{27}{36}(\theta,1) & \mbox{if} & \theta<0 \\
\end{array}\right \\
& var(\hat\theta_2) = \left\{\begin{array}{rcl}
\frac{20}{36}(\theta,1) & \mbox{if} & \theta\geq0 \\
\frac{24}{36}(\theta,1) & \mbox{if} & \theta<0 \\
\end{array}\right.
\end{split}
\end{equation*}
\end{document}
信息如下
! Missing delimiter (. inserted):
<to be read again>
\let
I.94 \end{split}
?
那么,我遗漏了什么?
答案1
我建议您使用cases
环境提供的环境amsmath
,而不是array
嵌入在\left\{
/对中的环境。并且,假设“var”是“variance”的缩写,我认为您应该使用直立字母来表示它是一个运算符,而不是名为、和\right.
的变量的乘积。v
a
r
\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc} % surely not 'latin1' ??
\usepackage[english]{babel}
\usepackage{amsmath} % for 'split' and 'cases' environments
\DeclareMathOperator{\Var}{Var} % variance "operator"
\begin{document}
\begin{equation*}
\begin{split}
\Var(\hat\theta_1) &= \tfrac{1}{4}\bigl(\Var(x[0])+\Var(x[1])\bigr) \\
\Var(\hat\theta_2) &= \tfrac{4}{9}\Var(x[0])+\tfrac{1}{9}\Var(x[1]) \\
\Var(\hat\theta_1) &=
\begin{cases}
\frac{18}{36}(\theta,1) & \text{if $\theta\geq0$} \\[\jot]
\frac{27}{36}(\theta,1) & \text{if $\theta<0$}
\end{cases} \\
\Var(\hat\theta_2) &=
\begin{cases}
\frac{20}{36}(\theta,1) & \text{if $\theta\geq0$} \\[\jot]
\frac{24}{36}(\theta,1) & \text{if $\theta<0$}
\end{cases}
\end{split}
\end{equation*}
\end{document}