# Missing $inserted. Extra }, or forgotten$. Missing } inserted

I know this gets asked pretty often but I can not find my error. And since the code renders just fine I am really at odds here.

$$\frac{\Delta {f}}{f} = -\frac{\pi\textrm{r^3}}{W} \frac{\epsilon_r-1}{\epsilon_r+2}\epsilon_0{|{E_0}^2|} \label{eq. 5}$$

• Welcome to TeX.SE. – Sebastiano Sep 1 '19 at 11:20
• Is there any particular reason for wanting “r” in upright type? I see none. – egreg Sep 1 '19 at 13:16
• My supervisor. End of story. – julesc Sep 1 '19 at 22:27

The \textrm{...} command converts the contents of command to text mode, consequently r^3 cannot work. Instead it you should use \marthrm{r^3} as suggested @Sebastiano in his answer (+1) or better and more correct \mathrm{r}^3 as suggested @GuM in his comment. However, I wonder why you like to write variable in roman shape. They are usually written in italic shape. So to my opinion is better write your equation as follows:

\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert} % new, it better align vertical bars

\begin{document}
$$\frac{\Delta{f}}{f} = - \frac{\pi r^3}{W} \frac{\epsilon_r - 1}{\epsilon_r + 2}\epsilon_0 \abs*{E_0^2} \label{eq. 5}$$
\end{document}


which gives:

If you persist to use upshape r, than you need to be consistent:

\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}

\begin{document}
$$\frac{\Delta{f}}{f} = - \frac{\pi \mathrm{r}^3}{W} \frac{\epsilon_{\mathrm{r}} - 1}{\epsilon_{\mathrm{r}} + 2}\epsilon_0 \abs*{E_0^2} \label{eq. 5}$$
\end{document}


which gives:

Often it is very important to put a complete code starting from \documentclass{...} to \end{document}. There are two mistakes: \label{eq.5} into the formula e when you use a formula the correct syntax is: \mathrm instead of \textrm. After my humble suggestion: use \epsilon_{0} instead of \epsilon_0, it is very important for the future.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\begin{document}\label{eq.5}
$$\frac{\Delta {f}}{f} = -\frac{\pi\mathrm{r^3}}{W} \frac{\epsilon_r-1}{\epsilon_r+2}\epsilon_0{|{E_0}^2|}$$
\end{document}

• I find \mathrm{r}^3 more elegant… – GuM Sep 1 '19 at 11:25
• @GuM But my English language is horrible :-(...ahhahaha. – Sebastiano Sep 1 '19 at 11:28
• Thanks. You are correct. I can only accept one answer. Sorry :(. – julesc Sep 1 '19 at 11:46
• @julesc Don't worry I'm very happy to help you a bit. The Zarko's answer is the best. – Sebastiano Sep 1 '19 at 11:48