# Latex question “Missing $inserted I want to write this simple equation in latex  2/|w|  In which |w| is the norm of w,, I tried with  \frac{2}{\|w\|}  And get error "Missing$ inserted"

then I use this

  \frac{2}{$\|w\|$}


And still get same error..

Does someone know how to solve this problem??

-
\frac is a math command so $\frac{2}{\|w\|}$ – David Carlisle Mar 28 '14 at 15:33
Welcome to TeX.SX! – Adam Liter Mar 28 '14 at 15:52

You'll need to include the whole thing in a math environment, as \frac is a math command.

\documentclass[]{article}

\usepackage[width=2in]{geometry}
\begin{document}

Inline: $\frac{2}{\|w\|}$ \$2em] Display: \[$$\frac{2}{\|w\|}$$$

Numbered Display:
$$\frac{2}{\|w\|}$$

\end{document}


Result:

-