Macro for degree symbol
Maybe it’s a good alternative to use siunitx
\documentclass{minimal}
\usepackage{siunitx}
\begin{document}
Works in text \ang{45} an in math $\ang{2.4}$.
Even with minutes and seconds: \ang{40;12;08}.
\end{document}
It also gives you the oportunity to set all numbers in the same style an change it globally if it’s requested, e. g. changing from period to comma: 1.234 --> 1,234
Edit: To type radians just use the \radian
unit. One may likes to define an own macro.
\documentclass{scrartcl}
\usepackage{siunitx}
\newcommand{\rad}[1]{\SI{#1}{\radian}}
\begin{document}
\SI{\pi}{\radian}
\rad{\pi/2}
\end{document}
Anything wrong with textcomp
's \textdegree
?
I prefer this solution
\renewcommand{\deg}{\ensuremath{^{\circ}}\xspace}
because it also works in math mode.
(At least for me, \textdegree
does not work in math mode, i.e.
$> 30\textdegree$
does not work, but
$> 30\deg$
does.