# How do you write unit vectors(â) in LaTeX?

Unit vector is an essential part of physics and mathematics. In this tutorial, we will discuss how to print this unit vector in a LaTeX document.

You need to know two commands to print unit vectors in LaTeX. First is hat{}, this command is used to write the cap(^) symbol on a letter and second is \vec{}, which is used to write the right arrow(→) symbol on a letter. For example.

\documentclass{article}
\begin{document}
$$\hat{v} = \frac{\vec{v}}{|\vec{v}|}$$
\end{document}

Output :

Also, Rectangular unit vectors are usually denoted by cap symbols over the letters i, j, and k. Some examples are given below.

\documentclass{article}
\begin{document}
$$\left( \hat{i},\hat{j},\hat{k} \right)$$
$$\vec{A}=x\hat{i}+y\hat{j}+z\hat{k}$$
$$\hat{A}=\frac{x\hat{i}+y\hat{j}+z\hat{j}}{\sqrt{x^{2}+y^{2}+z^{2}}}$$
\end{document}

Output :

In the above example, you can see that the result being printed in the output is not the best result. Here are the things we should do for the best results.

• Font is bold and not italic.
• No dot for the i or j unit vectors.
• A bold cap over the unit vector.

LaTeX provides us with a command called \textbf{}, with which you can bold any text. Also, to remove the dot of the letter i or j and for non-italic fonts, you have to write the letters i and j as \i, \j.

\documentclass{article}
\begin{document}
$$\hat{\textbf{\i}}$$
$$\hat{\textbf{\j}}$$
$$\hat{\textbf{k}}$$
\end{document}

Output :

In the example above you can see that i and j are printed as bold, non-italic, and without a dot but the cap(^) symbol is not shown as bold.

For this you need to use a package called bm, this package provides us with a command called \bm. By which you can easily bold the hat or cap symbol.

\documentclass{article}
\usepackage{bm}
\begin{document}
$$\bm\hat{\textbf{\i}}$$
$$\bm\hat{\textbf{\j}}$$
$$\bm\hat{\textbf{k}}$$
$$\bm\hat{\textbf{\i}} \ne \hat{\imath}_{\bm\hat{\textbf{\i}}} + \bm\hat{\textbf{\j}} + \bm\hat{\textbf{k}}$$
\end{document}

Output :

## Unit vector using physics package

An easy way to print unit vectors in a LaTeX document is to use the physics package. This package provides us with some commands that you can use to easily print unit vectors in LaTeX.

As you can see in the following excerpt, there are many differences in the output of the \vu command and the \vu* command. Using * with command would be better for output.

\documentclass{article}
\usepackage{physics}
\begin{document}
$$\verb|\vu{i}|\rightarrow \vu{i}$$
$$\verb|\vu*{i}|\rightarrow \vu*{i}$$
$$\verb|\va{a}|\rightarrow \va{a}$$
$$\verb|\va*{a}|\rightarrow \va*{a}$$
$$\vu*{a}=\frac{\va*{a}}{\abs{\va*{a}}}$$
\end{document}

Output :