1
 \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}

When I use the above code to generate some equations, it gives me the following errors:

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

I don't understand what is causing these errors. Can anyone help? thanks.

6
  • 2
    You are missing \usepackage{amsmath}, most likely -- the error messages seem to be related to \text, which is an amsmath macro...
    – user31729
    Feb 21 '18 at 22:18
  • Welcome to TeX.SX! You should look in the log file for the real error message, which is not due to enumerate.
    – egreg
    Feb 21 '18 at 22:19
  • 2
    (1) welcome, (2) as always on this site please post a full minimal example showing this behavior. (3) your use of the command \text is wrong here they are functions or similar, so use \mathrm or \operatorname , never \text
    – daleif
    Feb 21 '18 at 22:19
  • Thank you @ChristianHupfer . The problem is solved after using package amsmath. Sorry I am new to Tex.SX so I don't know how to post a full minimal example.
    – yuhengd
    Feb 21 '18 at 22:27
  • @yuhengd: Please follow daleif's advise about \mathrm or \operatorname as well
    – user31729
    Feb 21 '18 at 22:33
2

I would just add a simpler way to use enumerate, with enumitem, which uses what you type manually as default:

\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} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.