[Tex/LaTex] Writing å, ä, ö in mathmode

accentsmath-mode

I use a Swedish usepackage and when I write, for instance, å in formulas I get an error message please use \mathaccent ….

Here's what I try to write:

\begin{align} 
    \begin{split}
    {R} = \{alla\:tal\:på\:tallinjen\}
        \end{split}                 
\end{align}

At \end{align} I get the error message:

Please use \mathaccents for accents in math mode. \add@accent … spacefactor \spacefactor}\accent #1 #2\egroup \spacefactor …
1.54 \end{align}
I'm changing \accent to \mathaccent here: wish me luck.
(Accents are not the same in formulas as in text.)

I have tried with \aa but that doesn't work. Where is my failure?

Best Answer

"Accents" in math mode can have a precise mathematical meaning. For instance $\dot{a}$ isn't related to the use of the letter ȧ in words, but usually means a derivative with respect to time. Similarly, $\ddot{a}$ is the second derivative and has nothing to do with ä.

Thus TeX disallows text accent commands in math mode: one should know what he/she is writing.

Your case is different: you want text inside a math formula; then use \text, which is provided by amsmath (you already load it).

\begin{align} 
    \begin{split}
    R = \{ \text{alla tal på tallinjen} \}
        \end{split}                 
\end{align}

By the way, that formula is unnecessarily complicated:

\begin{equation}
R = \{ \text{alla tal på tallinjen} \}
\end{equation}

not only is simpler, but provides for better vertical spacing.