latex

How to Write and Use the Hat Symbol in LaTeX

Hat symbols are used in statistics to show the estimated value. It is also used to represent unitarian vectors. The hat symbol is also used as a circumflex and a caret in some languages. Hat symbols have a vital role in writing vector-related expressions.

That’s why many document processors like LaTeX support source code to use a hat symbol. However, many users don’t know the correct code and may get errors. So, in this tutorial, we will include different ways to write and use the hat symbol in LaTeX.

How to Write and Use the Hat Symbol in LaTeX?

It’s very easy to add the hat symbol to your LateX document because it only requires the following source code:

\begin{document}

$$\hat{i}$$

$
$\vec{V} = |a|\hat{a}$$

\end{document
}

Output

There are other variants of the hat symbol in LateX, and you need different packages to represent them. So let’s use physics \usepackage and \vu{} code:

\documentclass{article}

\usepackage{physics}

\begin{document}

$\vu{k}$

\end{document
}

Output

You can use \vu*{} rather than the above one to get the italic character with the hat symbol:

\documentclass{article}

\usepackage{physics}

\begin{document}

$\vu*{k}$

\end{document
}

Output

Similarly, you can create long expressions using the $$ in the source code:

\documentclass{article}

\begin{document}

$$\vec{a}=1\hat{i}+2\hat{j}+3\hat{j}+4\hat{k}$$

\end{document
}

Output

You can also use the hat symbol in the text mode using the \^{} code, and here is the basic example:

\documentclass{article}

\begin{document}

\^{x}, \^{y}, and \^{z} are unit vectors.

\end{document
}

Output

In some languages, hat symbols are used as circumflexes or carets. For example, let’s translate the word ‘Inquest’ into French as it includes a hat symbol:

\documentclass{article}

\begin{document}

Enqu\^{e}te

\end{document
}

Output

If you want to use this hat symbol over one letter or word, please use the following source code:

\begin{document}

$$\widehat{LinuxHint}$$

\end{document
}

Output

Conclusion

Many mathematical questions and equations in physics require hat symbols to denote a unit vector. As a result, we have explained different ways to write and use the hat symbol in LaTeX. You can also use the hat symbols with different packages, which we have already mentioned in the above information.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.