What is the degree symbol?
I would use siunitx and so a semantic command:
\documentclass{report}
\usepackage{siunitx}
\begin{document}
The angle is \ang{30}.
\end{document}
But you can also load textcomp
\documentclass{report}
\usepackage{siunitx}
\usepackage{textcomp}
\begin{document}
The angle is
30\textdegree.
\end{document}
The following example code serves to show that siunitx
uses the ugly $^\circ$
construction as well (for compatibility reasons). Most fonts have a degree symbol for angles (U+00B0 DEGREE SIGN
) and some have a degree Celsius symbol for temperatures (U+2103 DEGREE CELSIUS
, output by \textcelsius
in my example) and these symbols usually would fit better to the line widths of the font.
My example also shows that the single degree symbol and the one included in the special degree Celsius glyph do not have to be the same, so I personally would redefine it accordingly when I'm using both in a piece of work, see the second line.
Compile with XeLaTeX or LuaLaTeX.
\documentclass{article}
\usepackage{fontspec}
\usepackage{siunitx}
\begin{document}
° % degree symbol
\si{\celsius} % ${}^{\circ}$
\textcelsius\ % special glyph of the font
\si{\degree} % angle unit
\sisetup{
math-celsius = °\text{C}, % for temperatures
text-celsius = °C,
math-degree = °, % for angles
text-degree = °
}
°
\si{\celsius} % now with the glyph
\textcelsius\ % special glyph of the font
\si{\degree} % angle unit
\end{document}
There is also a gensymb
package. I prefer it, since it provides just a symbol for both text/math modes, and you can do everything what you want with it.
Example:
\usepackage{gensymb}
% ...
$20 \degree$