使用枚舉未定義控制序列

使用枚舉未定義控制序列
 \begin{enumerate}
     \item[1.] Choose $N\sim \text{Poisson}(\xi)$.

 \item[2.] Choose $\theta \sim \text{Dir}(\alpha)$.
 \item[3.] For each of the $N$ words $w_n$:
   \begin{enumerate}
   \item[(a)] Choose a topic $z_n \sim \text{Multinomial}(\theta)$.
   \item[(b)] Choose a word $w_n$ from $p(w_n | z_n, \beta)$, a multinomial probability conditioned on the topic $z_n$. 
   \end{enumerate}
 \end{enumerate}

當我使用上面的程式碼產生一些方程式時,它給出了以下錯誤:

Undefined control sequence. \item[1.] Choose $N\sim \text
Undefined control sequence. \item[2.] Choose $\theta \sim \text
Undefined control sequence. \item[(a)] Choose a topic $z_n \sim \text

我不明白是什麼導致了這些錯誤。有人可以幫忙嗎?謝謝。

答案1

我只是添加一種更簡單的方法來使用 enumerate, with enumitem,它使用您手動輸入的內容作為預設值:

\documentclass{article}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\usepackage{enumitem}
\usepackage{amsmath}

\begin{document}

\begin{enumerate}[ wide = 0pt, leftmargin = *]
     \item Choose $N\sim \text{Poisson}(\xi)$.

 \item Choose $\theta \sim \mathrm{Dir}(\alpha)$.
 \item For each of the $N$ words $w_n$:
   \begin{enumerate}[wide = 0pt]
   \item Choose a topic $z_n \sim \mathrm{Multinomial}(\theta)$.
   \item Choose a word $w_n$ from $p(w_n \,|\, z_n, \beta)$, a multinomial probability conditioned on the topic $z_n$.
   \end{enumerate}
 \end{enumerate}

\end{document} 

在此輸入影像描述

相關內容