Different commands used to display the degree symbol in LaTeX. This includes LaTeX degree symbol for angles and LaTeX degree symbol for temperature (degree Celsius °C).
Degree symbol is mainly used to denote the angle or temperature. The four main packages that can be used to involve degree in our document are amsmath, gensymb, textcomp, and siunitx package. Next, we discuss each method in detail.
1. \circ by amsmath
Inserting a degree symbol for angles (or temperature) in LaTeX can be achieved by the command \circ provided by amsmath package. Here is an illustrative example:
% Angle LaTeX symbol (degrees) \documentclass{article} \usepackage{amsmath} \begin{document} In terms of angles, tower of Pisa leans at $3.99^\circ$. \end{document}
Compiling this code yields the following output:
\circ command
adds a small circle and to denote angles (or temperature symbol), we should put it as subscript. Here is another example:
% Celsius and Fahrenheit LaTeX symbols \documentclass{article} \usepackage{amsmath} \begin{document} Today, the temperature outside is 38 $^{\circ}$C which corresponds to 100.4 $^{\circ}$F. \end{document}
This code yields the following output:
2. \ang by siunitx for LaTeX degree symbol
Writing degree symbol in LaTeX for angles can be done using the command \ang{} provided by siunitx package. Here is how one can use it:
% Angle LaTeX symbol using siunitx \documentclass{article} \usepackage{siunitx} \begin{document} In terms of angles, tower of Pisa leans at \ang{30}. \end{document}
which yields the following output:
3. \degree command by gensymb
gensymb package provides \degree
command that can be used to denote angles or temperature in LaTeX. Check the following code:
% write LaTeX degree symbol using gensymb \documentclass{article} \usepackage{gensymb} \begin{document} In physics, A launch angle of 45\degree{} maximizes the traveled distance by a projectile. \end{document}
Compiling this code yields:
The following code highlights the use of \degree command to denote temperature in LaTeX:
% write LaTeX degree symbol using gensymb \documentclass{article} \usepackage{gensymb} \begin{document} The boiling point of water is 100 \degree C or 212 \degree F at 1 atmosphere of pressure. \end{document}
Output:
4. \textdegree by textcomp
The fourth alternative command to denote LaTeX degree symbol is the \textdegree
command, which is provided by the textcomp
package. Check the following example for writing LaTeX degree symbol for location:
% LaTeX degree symbol using textcomp \documentclass{article} \usepackage{textcomp} \begin{document} The location is 52\textdegree N from here. \end{document}
which yields the following result:
We reached the end of this post about writing degree symbol in LaTeX for angles as well as for temperature and location using different methods.