I frequently use $^{\circ}$C
for writing the degree celsius unit.
Now I would like to make this into a command like \deg
, \degree
, \celsius
, or any suitable command that is not already taken of course.
However, trying \newcommand{\deg}{$^{\circ}$C}
does not work. In general, how would you create a command for an expression containing $
?
I am aware that there is also the \textdegree
command from the textcomp package. Nevertheless, I would like the C added as well. Just anything that makes this into one convenient command.
Any ideas?
Best Answer
You are likely looking for
\ensuremath
:You could use
\textdegree
for text mode and\circ
for math mode, e.g.As the author of
siunitx
, I'd of course favour using that package. I get the feeling you want free-standing units: