I'm trying to use German umlauts in math mode but get the known error: LaTeX Warning: Command \" invalid in math mode on input line ##.
So I could think of two possible solutions:
- Use
\text
instead of\mathrm
. But this wouldn't be the right solution because this text will be changed according to the surrounding text and the text I try to write ("Empfänger", German word for "receiver") should appear as a superscript to a field variable. - Replace the letter
ä
with"a
. But this leads to LaTeX not recognizing the ligature offä
.
Since I'm using the lmodern
package, the letter ä is still shown, so the resulting PDF is what I would expect.
Are there some elegant and correct solutions to this merely cosmetic problem?
My code for this would be:
\documentclass{scrartcl}
% Kodierung
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
% Sprache (neue deutsche Rechtschreibung)
\usepackage[ngerman]{babel}
% Mathematik
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
% reference
Empfänger
% creates warning but is correct
\begin{align}
\mathrm{Empfänger}
\end{align}
% creates no warning but has no ligature
\begin{align}
\mathrm{Empf"anger}
\end{align}
\end{document}
Best Answer
As you load the
ams
packages, you can use\textnormal
:As the example shows, this is immune to the surounding text changes.