[Tex/LaTex] Error: Command \” invalid in math mode on input line x

charactersmath-mode

I'm receiving the following error

Command \" invalid in math mode on input line 60. 

where my input lines 58-61 are

\begin{equation}
\label{1}
\Delta x=x_{efter}-x_{före}
\end{equation}

The problem doesn't to be the \Delta. The problem seem to come from x_{efter}-x_{före}. I have tried to use $....$ but it doesn't work. I'm new to LaTeX but I think I have imported the correct packages.

Best Answer

The ligature ö consists of \"{o}, which can happen in text but not math mode. Here's how it should be used:

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}% http://ctan.org/pkg/inputenc
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{equation}
  \Delta x = x_\text{efter} - x_\text{före} \label{eq:difference}
\end{equation}
\end{document}

amsmath provides \text{<stuff>} which prints <stuff> in text mode. inputenc allows you to specify ligature as-is in your code.

As a side-note, it's best to label things with descriptive names.

Related Question