Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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??

share|improve this question
4  
\frac is a math command so $\frac{2}{\|w\|}$ –  David Carlisle Mar 28 at 15:33
    
Welcome to TeX.SX! –  Adam Liter Mar 28 at 15:52

1 Answer 1

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:
\begin{equation} \frac{2}{\|w\|} \end{equation}

\end{document}

Result:

formulas

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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