The hat symbol is a common notation used in mathematics and science. It’s also called the circumflex symbol when used in languages. In LaTeX, this symbol can be used in both text and math modes.

This guide will help you understand how to use this symbol effectively in LaTeX.

## Hat symbol in math mode

In LaTeX, math mode uses the `\hat{arg}`

command to place a hat over a character. This is important for showing certain mathematical concepts, such as unit vectors or modified variables.

```
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[ \hat{\mathbf{r}} = \cos(\varphi)\hat{\mathbf{i}} + \sin(\varphi)\hat{\mathbf{j}},\; \hat{\boldsymbol{\varphi}} = \hat{\mathbf{k}}\times\hat{\mathbf{r}} \]
\end{document}
```

**Output :**

In the example above, you can see how this symbol is used in math mode. When using LaTeX, wrap your expressions with `\[...\]`

to display them correctly in math mode.

## Use vu command from physics package

You can easily solve the above problem using **physics** package. In physics, the hat symbol is used to denote the unit vector.

And you need to use `\vu`

command to define this unit vector.

```
\documentclass{article}
\usepackage{physics}
\begin{document}
\[ \vu{a} \]
\[ \vu*{a} \]
\end{document}
```

**Output :**

If you look at the output above, you will notice that the `*`

symbol is used with the `\vu`

command for the Greek and Italic styles.

## Wide hat symbol

When you need to apply the hat symbol to multiple characters, the `\widehat{arg}`

command is the right choice. This command is particularly useful for denoting broader mathematical constructs.

```
\documentclass{article}
\begin{document}
\[ \hat{abc} \]
\[ \widehat{abc} \]
\end{document}
```

**Output :**

The difference between `\hat{arg}`

and `\widehat{arg}`

is clear in the output. While `\hat{arg}`

applies to a single character, `\widehat{arg}`

can cover multiple characters, providing a more extensive notation.

## Hat symbol in text mode

In text mode, the circumflex symbol is used in various languages to denote specific pronunciations. LaTeX handles this with the `\^{arg}`

command.

```
\documentclass{article}
\begin{document}
Circumflex-\^{o},\^{a}
\end{document}
```

**Output :**

Circumflex-ô,â

## Conclusion

Whether you are working in math mode or text mode, understanding how to use the `\hat{}`

and `\widehat{}`

commands. For those in physics, the `\vu`

command from the `physics`

package offers additional functionality, making it easier to denote unit vectors.