How to write a degree symbol in LaTeX

# How to write a degree symbol in LaTeX

This post may contain affiliate links that allow us to earn a commission at no expense to you. Learn more

This article aims to show you a simple way to create a degree symbol in LaTeX.

Most of the time you see this symbol together with the letters C or F, and on some occasions with numbers, referring to temperatures and angles respectively, used in math areas and physics and chemistry. Today you are going to learn how to write it in your LaTeX document

## Degree Symbol

This symbol has a wide variety of use, mainly to represent degrees of arc and degrees of temperature. You will always see it together with some number or letter depending on the context. For example

\documentclass{article}
\begin{document}
\begin{center}
The road is heading 45$^{\circ}$ N\\
The temperature in the room is $20^{\circ}$ C\\
The angle in the figure is $\theta=90^{\circ}$
\end{center}
\end{document}


## LaTeX degree symbol

In LaTeX generating the degree symbol is quite easy, but with a catch, you are using a circle as a superscript, thus you need the math mode. The default command for the circle is \circ. If we take the circle as a superscript the command would be ^{\circ} inside the math mode. For example

$212^{\circ}$ F = $100^\circ$ C


This is done without any packages, but in LaTeX someone already created a package to make things easier (or  more difficult). And it does not need values ar argument

## Degree command with packages

To write the degree symbols with LaTeX packages there are many options, the ones you will learn are generated by, gensymb, siunitx, and textcomp. Each package has its own degree commands.

Starting with gensymb the command is \degree, and it does not need the math mode enabled. For example

\usepackage{gensymb}
\begin{document}
\begin{center}
Rockets are launched with an 90\degree angle.\\
Water freezes at $0\degree$ C or 32\degree  F.
\end{center}
\end{document}


Following with the siunitx package, the command is \ang{} it is the only command in this post that requires a value as argument.

\usepackage{siunitx}
\begin{document}
A triangle has three \ang{60} angles.\\
$\angle{QC} = \ang{45}$
\end{document}


Lastly there is the textcomp package, the command is \textdegree. For example

\usepackage{textcomp}
\begin{document}
Water boils at 212\textdegree F or 100\textdegree C.\\
You can move from 43\textdegree W to 25\textdegree S.
\end{document}


Now you have 4 different ways, with various packages, to generate the LaTeX degree symbol for whatever purpose you may need it, whether a right angle, a temperature or direction. But be aware of some compatibility issues if you are working with multiple packages.

I hope this post was helpful. If you have any questions leave them in the comments.

And, as always, keep writing in LaTeX 