I am looking to create a `\newcommand`

to type in the quadratic formula by using the alias `\qf`

as follows:

```
\newcommand*{\qf}{x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}}
```

However, when I compile, it spits out errors such as `Missing $ inserted`

? What have I done wrong?

## Best Answer

Suppose that you write in a LaTeX file

`since you have x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}, then`

. You get an error message if you try to compile it, right? That's because you should have written`since you have $x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$, then`

instead. So, either defineor else keep your definition and use it as

`since you have $\qf$, then`

.