latex

How To Write and Use a Vector Arrow in LaTeX

In physics, we use arrows on vectors where the length of the arrow shows the magnitude, and its direction shows the vector direction. It means arrows above the vector quantities have an essential role in the expressions.

Therefore, document processors like LaTeX provide simple source codes to write the vector quantities quickly. However, many beginners don’t know how to add vectors in the LaTeX document. So, we will discuss in this tutorial the simple ways to write and use a vector arrow in LaTeX.

How To Write and Use a Vector Arrow in LaTeX

First, let’s start with the simple source code, i.e., \vec to add vector arrow in the following LaTeX document:

\documentclass{article}
\begin{document}
$\vec{A}$
\end{document}

 

Output


You can add a dot above the vector quantity showing the derivative taken concerning the specific time:

\documentclass{article}
\begin{document}
$\vec{\dot{A}}$
\end{document}

 

Output


If you want to add two dots in the vector quantity, use \ddot rather than \dot. Similarly, you can write a vector quantity with the subscript or superscript:

\documentclass{article}
\begin{document}
$\vec{m^{2}}$ \\
$\vec{m_{2}}$
\end{document}

 

Output


In case you want to use multiple quantities in a single, but it will not work with the \vec source code:

\documentclass{article}
\begin{document}
$\vec{ABC}$
\end{document}

 

Output


Hence, you can use \overrightarrow code to cover the complete quantities in a single arrow:

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

 

Output


As you can see in the previous image, the vector arrow is not looking good. So use the esvect \usepackage and \vv code:

\documentclass{article}
\usepackage{esvect}
\begin{document}
$\vv{ABC}$
\end{document}

 
Output


You can use the physics \usepackage with different source codes, such as \vec, and \va.

\documentclass{article}
\usepackage{setspace}
\usepackage{physics}
\begin{document}
\doublespacing
Here are the vector symbols: \\
$\vec{m_{2}}$ \\
$\overrightarrow{ABC}$ \\
$\va{m_{2}}$
\end{document}

 

Output


You can also use the mathabx \usepackage with \vec or \overrightarrow source code:

\documentclass{article}
\usepackage{setspace}
\usepackage{mathabx}
\begin{document}
\doublespacing
Here are the vector symbols: \\
$\vec{m_{2}}$ \\
$\overrightarrow{ABC}$ \\
\end{document}

 

Output

Conclusion

This was the brief information on the method to write and use a vector arrow in LaTeX. We have used different packages and source codes to create a vector arrow symbol in a LaTeX document easily. Moreover, we recommend you write the codes correctly, or else you may get an error while compiling.

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.