4

I want to code the below lines of the image in latex. enter image description here

\begin{itemize}
   \item [m] - Number of training examples
   \item [x] - "Input"  variables / features
   \item [y] - "Output" variable / "target" Variable
   \item [(x,y)]  - One training example
   \item x^(i),y^(i) - i^{th} training example
\end{itemize}

I have given a try, but i am facing an error. I couldn't identify what's the issue behind. Please help me.

 The error i am facing is 

  ! Missing $ inserted.
  <inserted text> 
            $
     l.40         \item [x^(i),y^(i)] - i^{th} training example
  ? 
   ! Extra }, or forgotten $.
Tobi
  • 56,353
James K J
  • 155

1 Answers1

10

You need to use math mode for math symbols, i.e. enclose em with $ or in \(…\) (see Are \( and \) preferable to dollar signs for math mode?). Furthermore I’d use a description list in this case as this would match the input better …

\documentclass{article}

\begin{document}
\begin{description}
\item [$m$] Number of training examples
\item [$x$] ``Input''  variables / features
\item [$y$] ``Output'' variable / ``target'' Variable
\item [$(x,y)$]  One training example
\item [$x^(i),y^(i)$] $i$-th training example
\end{description}
\end{document}

Furthermore I’d write $i$-th instead of the superscript to prevent confusion with “i to the power of th”. You also missed the brackets at the last item.

And you may take a look at the csquotes package to get the right quotes.

Tobi
  • 56,353
  • Maybe you should cross out the recommendation for $(see https://tex.stackexchange.com/a/513/124577) – TeXnician Apr 15 '17 at 06:18
  • Yep, thanks for the comment. Had it in mind but forgot to add it ;-) – Tobi Apr 15 '17 at 06:18
  • 1
    Note that using square bracket characters inside the item symbol will trigger errors, so replace literal brackets by \lbrack and \rbrack – PlasmaBinturong Mar 26 '21 at 13:22
  • As for alle optional argument you can also enclose the whole argument in braces like \item [{$[1,2]$}]. – Tobi Apr 10 '21 at 06:55