How to create a hat symbol in LaTeX?

How to create a hat 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 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}
Basic output 

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}
Output with both modes, look at the spacing in B

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}$$
…
Widehat output covers more letters

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}$$
Physics package output

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

  1. How To Create A Cross Product Symbol In LaTeX
  2. How to create a prime symbol in LaTeX?
  3. How to create an absolute value symbol in LaTeX?
  4. How to create an approximate symbol in LaTeX?
  5. How to create an intersection symbol in LaTeX?
  6. How to create the empty set symbol in LaTeX?
  7. How to write a degree symbol in LaTeX?
  8. How to write a dot product in LaTeX?
  9. How to Write a Greater Than Symbol in LaTeX?
  10. How to write a norm symbol in LaTeX?
  11. How to write A Plus-Minus Symbol in LaTeX
  12. How to write a proportional to symbol in LaTeX?
  13. How to write a real number symbol in LaTeX?
  14. How to write a tilde symbol in LaTeX?
  15. How to write a union symbol in LaTeX?
  16. How to write a vector in LaTeX?
  17. How to write an infinity symbol in LaTeX?
  18. How to write bold text in LaTeX?
  19. How To Write Dots Symbols In LaTeX?
  20. How to write the arrow symbols in LaTeX
  21. How to write the Degree celsius symbol in LaTeX?
  22. How to write the equal or not equal symbol in LaTeX?
  23. How to write the Euro symbol in LaTeX?
  24. How to write the floor symbol in LaTeX?
  25. How to write the gradient operator symbol in LaTeX
  26. How To Write The Greater Than Or Equal To Symbol In LaTeX?
  27. How to write the integer number symbol in LaTeX?
  28. How to write the less than symbol in LaTeX?
  29. How to write the Natural numbers symbol in LaTeX?
  30. How to write the parallel symbol in LaTeX?
  31. How to write the percent symbol in LaTeX?
  32. How to write the square root symbol in LaTeX?
  33. How To Write The Symbol For A Subset In LaTeX?
  34. How to write the symbol for therefore in LaTeX?
  35. How to write with the mathbb in LaTeX?

Photo of author
Author
SJ Tsai
Chief Editor. Writer wrangler. Research guru. Three years at scijournal. Hails from a family with five PhDs. When not shaping content, creates art. Peek at the collection on Etsy. For thoughts and updates, hit up Twitter.

1 thought on “How to create a hat symbol in LaTeX?”

Leave a Comment