Generalcommand \r invalid

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
aundy
Posts: 2
Joined: Tue Jul 08, 2008 6:52 pm

command \r invalid

Post by aundy »

I occasionally get this strange warning
LaTeX Warning: Command \r invalid in math mode on input line xx
I investigated this and couldn't find anything on google or on these forms.
However, It seems that the error occurs whenever I use \AA (the angstrom symbol) inside an equation environment.

For example, I get the error when I try to compile this file

\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\AA
\end{equation}
\end{document}

The warning occurs on line 5 (the \AA)

This warning does not seem to affect anything, but it is bugging me, and I would appreciate any help.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

aundy
Posts: 2
Joined: Tue Jul 08, 2008 6:52 pm

Re: command \r invalid

Post by aundy »

Here is some additional information about my latex setup:
I am running latex off of ubuntu 8.04, and I installed it using apt.
Doing latex -v produces

pdfTeX using libpoppler 3.141592-1.40.3-2.2 (Web2C 7.5.6)
kpathsea version 3.5.6
Copyright 2007 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Kpathsea is copyright 2007 Karl Berry and Olaf Weber.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX using libpoppler copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX using libpoppler source.
Primary author of pdfTeX using libpoppler: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Kpathsea written by Karl Berry, Olaf Weber, and others.

Compiled with libpng 1.2.15beta5; using libpng 1.2.15beta5
Compiled with zlib 1.2.3.3; using zlib 1.2.3.3
Compiled with libpoppler version 3.00
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

command \r invalid

Post by localghost »

The explanation is simpler than you might think. The Angstrøm symbol is internally created by the \r{A} command as a text accent. Hence this command is not allowed in mathematical mode. You can do a workaround with the help of the (preferably to use) amsmath package.

Code: Select all

\documentclass[12pt]{article}
\usepackage{amsmath}

\begin{document}
  \begin{equation}
    \text{\AA}
  \end{equation}
\end{document}

Best regards and welcome to the board
Thorsten¹
Post Reply