\documentclass{article}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{amssymb}
\pagestyle{fancy}
\rhead{Homework for Stats Chapter 4\textbackslash Lab}
\cfoot{Page \thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}
\section{4.4 Excercises}
\begin{enumerate}
\item For each experiment, list the sample space and the probabilities
for each outcome. Compute the expected number of heads in each case.
\begin{enumerate}
\item Two independent tosses of a fair coin\\
\{(HH),(HT),(TH),(TT)\}\\
$\mathbb{P}(HH)=\frac{1}{4} \mathbb{P}(HT)
=\frac{1}{4}\mathbb{P}(TH)=\frac{1}{4}\mathbb{P}(TT)
=\frac{1}{4}$\\
\begin{align}
\mathbb{E}\left ( H\right )=\sum _{i=0}H_i\cdot p_i & =2\cdot\frac{1}{4}+1\cdot\frac{1}{4}+1\cdot\frac{1}{4}+0\cdot\frac{1}{4}\\
& =\frac{1}{2}+\frac{1}{4}+\frac{1}{4}\\
& =1\\
\end{align}
\end{enumerate}
\end{enumerate}
\end{document}
看不出我哪裡搞砸了。我已經關閉了所有的東西。取得「段落在 \align 完成之前結束。
答案1
您的對齊環境中有一個空白行。我對您的程式碼做了一些修改:將內聯\frac
(在我看來太小)替換為包\mfrac
中的(=中等大小的分數,約80%的顯示樣式分數)nccmath
,刪除了另一個空白行,並且我認為您的每一行對齊不需要編號,我冒昧地將其替換為aligned
嵌套在equation
.
\documentclass{article}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{amssymb}
\usepackage{nccmath}
\pagestyle{fancy}
\fancyhf{}
\rhead{Homework for Stats Chapter 4\textbackslash Lab}
\cfoot{Page \thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}
\section{4.4 Exercises}
\begin{enumerate}
\item For each experiment, list the sample space and the probabilities
for each outcome. Compute the expected number of heads in each case.
\begin{enumerate}
\item Two independent tosses of a fair coin\\
\{(HH),(HT),(TH),(TT)\}\\
$\mathbb{P}(HH)=\mfrac{1}{4} \mathbb{P}(HT)
=\mfrac{1}{4}\mathbb{P}(TH)=\mfrac{1}{4}\mathbb{P}(TT)
=\mfrac{1}{4}$
\begin{equation}
\begin{aligned}
\mathbb{E}\left ( H\right )=∑ _{i=0}^4H_i · p_i & =2 · \frac{1}{4}+1 · \frac{1}{4}+1 · \frac{1}{4}+0 · \frac{1}{4}\\
& =\frac{1}{2}+\frac{1}{4}+\frac{1}{4}\\
& =1
\end{aligned}
\end{equation}
\end{enumerate}
\end{enumerate}
\end{document}
答案2
我認為您不應該在環境中的最後一行末尾有換行符。嘗試刪除最後一個\\
.