latex

How To Use a Vector Symbol in LaTeX

Vectors are handy in the fields of physics and mathematics. They represent the position, motion, velocity, and acceleration of objects and physical quantities. The vector is indicated by an arrow symbol on top of the character.

The vector symbol plays a significant role in physics and mathematical concepts. That’s why LaTeX contains a source code to add a vector symbol in any document. So, if you want to learn how to write the vector symbol in LaTeX, read this tutorial thoroughly.

How To Use a Vector Symbol in LaTeX

In LaTeX, you denote the vector symbol using \vec and \overrightarrow source code. So, let’s take a look at the following example to represent a variable, V, as a vector:

\documentclass{article}
\begin{document}
Here is the representation of the variable V as a vector:
$$ \vec{V}$$
\end{document}

Output:

Similarly, you also represent the relation between two vector quantities. For example, momentum is equal to the product of mass and velocity. So, we can use the following source code to represent it in LaTeX:

\documentclass{article}
\begin{document}
The equation of momentum is: $\vec{p}= m\vec{v}$
\end{document}

Output:

If you want to cover two different variables, use \overrightarrow source code as follows:

\documentclass{article}
\begin{document}
$$ \overrightarrow{PQ}$$
\end{document}

Output

You can use the physics usepackage to represent the vector symbol in different formats through the following source code:

\documentclass{article}
\usepackage{physics}
\begin{document}
 $$ \vb*{V} $$
 $$ \va{V} $$
 $$ \vb{V} $$
 $$ \va*{V} $$
\end{document}

Output:

In some books or research papers, the vectors are indicated by bold characters instead of arrows. For this, you need to use the \textbf source code as follows:

\documentclass{article}
\begin{document}
$$ \textbf{PQ}$$
\end{document}

Output:

The magnitude of a vector is represented as a mod, and you can pass it between \left| and \right| as arguments shown in the following code:

Output:

You can denote the zero vector/null vectors if the absolute value of the vector is zero as the arrow sign is above zero as shown in the following:

\documentclass{article}
\begin{document}
$$ \vec{F}_{v}= \vec{B} $$
\end{document}

Output:

You can denote the unit vector using a cap and divide it by the absolute value of the vector.

\documentclass{article}
\begin{document}
$$ \hat{V}=\frac{\vec{VB}}{\left| \vec{VB} \right |} $$
\end{document}

Output:

To specify a cap on a character, please use the \hat source code. For the fraction, use the \frac source code by passing two arguments to specify the numerator and denominator values.

Conclusion

This tutorial briefly overviews how to write and use a vector symbol in LaTeX. We have used efficient examples of the vector symbol source code so you can easily understand everything. We hope the information in this article helps you use vector symbols in any document processor. If you like this tutorial, visit Linux Hint for more.

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.