[Tex/LaTex] Error: Missing \begin{document}


I wanted to make a command that outputs a number in math mode. This is how my file looks like:




Lorem ipsum...

But when I compile this with XeTeX, I always get this error:

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.

l.13 \newcommand{dice}[1]{\ensuremath{#1}}

I have not that much experience with TeX, I think the solution is quite easy.

Best Answer

You're just missing a backslash in the command definition, it should be