Command \r invalid in math mode on input line XXX
This error appears when special characters are used incorrectly in math mode. In LaTeX, certain characters such as accented letters, or letters with umlauts can't be written in math mode. The best way to solve this is to write them inside the \text{...}
provided by the amsmath
package.
Common Causes
Including letters with accents, umlauts etc. in math mode:
e.g. ö is really {\"o}
Using special symbols in math mode:
e.g. angstrom \AA is really \r{A}