How to write unit vector (â) in LaTeX?

In this tutorial, I will show you how to get different types of unit vectors in LaTeX.

In order to write a unit vector in LaTeX you have to use these commands.

with these commands, you can easily write a unit vector in LaTeX.

\documentclass{article}
\begin{document}
  \[ \hat{u}  = \frac{\vec{u}}{\left|\vec{u}\right|} \]
  \[ \hat{a}  = \frac{\vec{a}}{|\vec{a}|} \]
\end{document}

Output:

unit vector.

Rectangular unit vectors in LaTeX

To get a rectangular unit vector you have to put the hat (^) symbol over i, j, and k. So you have to use the \hat{} command.

\documentclass{article}
\begin{document}
  \[
    \verb|\hat{i}| : \hat{i}
  \]
  \[
    \verb|\hat{j}| : \hat{j}
  \]
  \[
    \verb|\hat{k}| : \hat{k}
  \]
  \[ |\hat{i}| = |\hat{j}| = |\hat{k}| = 1 \]
  \[ \vec{a} = x\hat{i} + y\hat{j} + z\hat{k} \]
\end{document}

Output:

Rectangular unit vectors

Bold and Non-italic font of the unit vector in LaTeX

In rectangular unit vectors, sometimes we need those i, j, and k in bold, non-italic, and without dots on i and j. Also, the hat symbol is in bold font.

Follow these steps:

  1. To get bold i, j, and k we are gonna use the \textbf{} command which is used to make bold any text. It will also return a non-italic font.
  2. To get dotless i and j we are gonna use \i and \j. It means you need to switch to text mode.
  3.  To get a bold hat symbol we are gonna use the \bm{} command provided by the bm package.

 

\documentclass{article}
\usepackage{bm}
\begin{document}
  \[
    \verb|\bm{\hat{\textbf{\i}}}| : \bm{\hat{\textbf{\i}}}
  \]
  \[
    \verb|\bm{\hat{\textbf{\j}}}| : \bm{\hat{\textbf{\j}}}
  \]
  \[
    \verb|\bm{\hat{\textbf{k}}}| : \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:

Rectangular unit vectors in bold font.

Write unit vector with physics packages

The physics packages also provide these commands to write a unit vector in LaTeX.

  • \vu{} : To get a hat symbol over a letter in a non-italic font.
  • \vu*{} : To get a hat symbol over a letter (italic font).
  • \va{} : To get a right arrow symbol over a letter in a non-italic font.
  • \va*{} : To get a right arrow symbol over a letter.
  • \abs{} : To get the absolute value symbol.
\documentclass{article}
\usepackage{physics}
\begin{document}
\noindent Unit vector with \verb|\vu{}| and \verb|\va{}|:
  \[ \vu{u}=\frac{\va{u}}{\abs{\va{u}}} \]
Unit vector with \verb|\vu*{}| and \verb|\va*{}|:
  \[ \vu*{u}=\frac{\va*{u}}{\abs{\va*{u}}} \]
Rectangular unit vectors with \texttt{physics} package:
  \[ \va{a} = x\vu{i} + y\vu{j} + z\vu{k} \]
  \[ \va*{a} = x\vu*{i} + y\vu*{j} + z\vu*{k} \]
\end{document}

Output:

unit vector with physics package.

Leave a Reply

Your email address will not be published. Required fields are marked *