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

Writing in LaTeX gives beautiful documents, especially if you are in a science-oriented area like mathematics or physics, and most of the time you may be working with equations, integrals, and vectors.

And if you have vectors you will have unitarian vectors. That’s when the hat symbols come into play.

The hat symbols also receive the name of caret or circumflex symbols. And today you will get the knowledge to create a hat product symbol.

**The Vectors**

We begin with mathematics and physics: vectors are used to define an object that has magnitude and direction, and has many kinds of properties. Most of the time it is used in physics, engineering, or math branches.

**The Unit Vector**

Now, back to the definition, it mentioned direction, here is when the unit vector comes in. It denotes the direction of the vectors you are using.

And to define a unit vector, and recognize it from other nonunit vectors, you use the hat above the vectors.

**The LaTeX hat symbol**

It is straightforward to insert the hat symbol in your document; you begin with the command that only requires one value (the character) between {}, denoted by the command \**hat**{}. The command is built-in, you don’t need external packages.

```
\begin{document}
$$\vec{A} = |a|\hat{a}$$
\end{document}
```

**In the Math mode:**

The hat symbol must be inside the **math mode** to call the command, you can open **math mode** with, $$, or **\[ \]**, and close it with the same symbol at the end.

**In the Text mode:**

It is also possible to use it in a text. To call it, you use \**^**{}. You can also use the **math mode** inline the **text**, but you have to use the $ symbol to open and close it, and the command \**hat**{}. Given the code below

```
\begin{document}
\[
\vec{B} = x\hat{i} + y\hat{j} + z\hat{k}
\]
Expression using the hat symbol with math mode in $\hat{i}, \hat{j}, \hat{k}$ in text, looks like a Wikipedia article. \\
Here we are using the hat symbol with text only \^{i}, \^{j}, \^{k}.
\end{document}
```

Notice the difference between the fonts in the letters, math is italic, the text is not.

**Hat symbol in LaTeX variations**

It is useful to know the existence of some variations of this symbol that you may use or not customize something. The command is different, it is \**widehat**{}. The command produces

```
…
$$\hat{abc}$$
$$\widehat{abc}$$$$\widehat{keyboard}$$
…
```

**Caret/Circumflex/Hat in languages**

Some languages may have symbols known as caret or circumflex. The hat symbol in **text mode** is the recommended command to use. For example

Standard output for languages

**LaTeX Hat symbol with packages**

There are other variants for the hat symbol in your document, especially in physics, with a package, but sometimes it is better to use already built-in commands.

The package is called physics, and the command is denoted by \**vu**{} and \**vu***{}.

```
Physics package
$$ \vu{i}, \vu*{abc}$$
$$ \vu{land}$$
```

Whatever method you choose to write the hat/caret/circumflex symbol in your document or article and the context, now you have the knowledge on how to write it and the output that you’ll get.

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

And, as always, keep writing in LaTeX

**Further Reading**

**LaTex Tutorial** **on Symbols**

- How To Create A Cross Product Symbol In LaTeX
- How to create a prime symbol in LaTeX?
- How to create an absolute value symbol in LaTeX?
- How to create an approximate symbol in LaTeX?
- How to create an intersection symbol in LaTeX?
- How to create the empty set symbol in LaTeX?
- How to write a degree symbol in LaTeX?
- How to write a dot product in LaTeX?
- How to Write a Greater Than Symbol in LaTeX?
- How to write a norm symbol in LaTeX?
- How to write A Plus-Minus Symbol in LaTeX
- How to write a proportional to symbol in LaTeX?
- How to write a real number symbol in LaTeX?
- How to write a tilde symbol in LaTeX?
- How to write a union symbol in LaTeX?
- How to write a vector in LaTeX?
- How to write an infinity symbol in LaTeX?
- How to write bold text in LaTeX?
- How To Write Dots Symbols In LaTeX?
- How to write the arrow symbols in LaTeX
- How to write the Degree celsius symbol in LaTeX?
- How to write the equal or not equal symbol in LaTeX?
- How to write the Euro symbol in LaTeX?
- How to write the floor symbol in LaTeX?
- How to write the gradient operator symbol in LaTeX
- How To Write The Greater Than Or Equal To Symbol In LaTeX?
- How to write the integer number symbol in LaTeX?
- How to write the less than symbol in LaTeX?
- How to write the Natural numbers symbol in LaTeX?
- How to write the parallel symbol in LaTeX?
- How to write the percent symbol in LaTeX?
- How to write the square root symbol in LaTeX?
- How To Write The Symbol For A Subset In LaTeX?
- How to write the symbol for therefore in LaTeX?
- How to write with the mathbb in LaTeX?

Very nice written!