Degree symbol in LaTeX (circ, textdegree, ang)
In math mode the degree sign is a raised circle: $90^\circ$. In text it is \textdegree. For numbers with units, siunitx has \ang{90} for angles and \qty{20}{\degreeCelsius} for temperatures.
Preamble
The snippets on this page need these lines before \begin{document}:
\usepackage{siunitx}Degrees in a formula
^\circ raises the small circle \circ to the position of an exponent.
A right angle has $90^\circ$, and $\sin 30^\circ = \frac{1}{2}$.Degrees in text
\textdegree prints the degree sign and \textcelsius the sign for degrees Celsius. Both are part of LaTeX since 2020; older installations need the textcomp package. The {} after \textcelsius keeps the space that follows, and \, puts a thin space between number and unit.
Turn the dial by 45\textdegree. Water boils at 100\,\textcelsius{} at sea level.Angles and temperatures with siunitx
\ang{90} prints an angle; with semicolons it takes degrees, minutes and seconds. \qty{20}{\degreeCelsius} prints a temperature with the correct space, and \unit{\degreeCelsius} the unit alone. The commands work in text and in math mode.
An angle of \ang{90}, a position of \ang{12;30;15}
and a temperature of \qty{20}{\degreeCelsius}.Type the character directly
In normal text you can type the degree character from the keyboard; LaTeX reads it as \textdegree. This does not work inside a formula.
Turn the dial by 45° and heat the oven to 180\,°C.Pitfalls
- A typed degree character inside
$...$prints nothing. The log shows the warning "Command \textdegree invalid in math mode", see Command \item invalid in math mode. Write^\circthere. - Do not use a raised letter o or a zero, as in
$90^o$: the shape and height differ from the degree sign. - The
gensymbpackage offers\degreeand\celsius, which work in text and in math mode.
Compiled with pdfLaTeX from TeX Live 2023.
Related pages
- Package
siunitx - Package
textcomp - How-to Units and numbers in LaTeX with siunitx
- How-to Exponents and subscripts in LaTeX
- Error Command \item invalid in math mode