[Tex/LaTex] Missing $ error and undefined control sequence, while all seems correct

math-mode

I've written this code

\subsection*{Definitie 1}
\textit{Als $z$, $f(z)$ \in \mathbb{R}^{m}, dan is de M-de Frechet afgeleide van $f$, voorgesteld
door $f$^{(M)}$(z)$ een operator op \mathbb{R}^{m} \times \mathbb{R}^{m} \times \ldots \times \mathbb{R}^{m} (M maal)
, die lineair is in elk van de operandi met als waarde}

But I can't compile the document, as I get a "$ missing" and "Undefined control sequence" error. I've already checked this code a dozen times, but can't seem to find anything wrong. Any ideas?

Best Answer

You had several math mode expressions written in text mode; I've fixed them in the code below. I would suggest you to use the amsthm package to define a theorem-like structure with the desired formatting for your definitions; in this way, the formatting and numbering are dona automatically:

\documentclass{article}
\usepackage{amssymb}
\usepackage{amsthm}

\newtheoremstyle{mydefi}
  {\topskip}{\topskip}
  {\itshape}{}
  {\bfseries}{}
  {\newline}{}
\theoremstyle{mydefi}
\newtheorem{defi}{Definitie}

\begin{document}

\begin{defi}
Als $z$, $f(z) \in \mathbb{R}^{m}$, dan is de $M$-de Fr\'echet afgeleide van $f$, voorgesteld door $f^{(M)}(z)$ een operator op $\mathbb{R}^{m} \times \mathbb{R}^{m} \times \cdots \times \mathbb{R}^{m}$ ($M$ maal), die lineair is in elk van de operandi met als waarde
\end{defi}

\end{document}

enter image description here

I used Fr\'echet; but loading inputenc with the appropriate encoding, you can simply write Fréchet.

By the way, for definitions it's also common to use use the roman (upright) font instead of italics; in this case, you can change the definition of the mydefi style to:

\newtheoremstyle{mydefi}
  {\topskip}{\topskip}
  {}{}
  {\bfseries}{}
  {\newline}{}

I would also like to suggest you (quoting cmhughes's valuable comment) to have a look at some introductory material (the Not so short guide to LaTeX (available in seveal languages) and the amsmath package documentation, for example); in your first few documents, always build up your code slowly, compiling frequently- this will help you find where the errors are.