*This article aims to show you a simple way to create a **vector in LaTeX**.*

Regardless of where you look in science books, you will find at least a vector somewhere in one of its many representations, and thatâ€™s because it is used for many things in science subjects. And if you are using LaTeX you will want to know how to insert vectors in your document.

**Vectors**

According to its definition a vector is a geometric object that has magnitude and direction, and has properties according to vector algebra. Usually represented graphically as an arrow connecting two points A, B and denoted by

```
$$\overrightarrow{AB} \qquad \vec{r}$$
```

**Vec command**

The standard command to call the arrow above the letter is \**vec**{} it takes one value as an argument, but it has a disadvantage, it does not cover the entire argument. Instead you can use \**overrightarrow**{} likewise it takes one value as argument, for example

```
$$\vec{r} \qquad %standard
\vec{AB} \qquad %the arrow does not cover all the letters
\overrightarrow{AB}$$ %the arrow covers all the letters
```

**Vectors in Math mode**

You probably already noticed it, to call the vector commands you have to use math mode, more examples

```
\documentclass{article}
\usepackage{amssymb}
\begin{document}
$$\vec{r}=x\hat{i}+y\hat{i}+z\hat{k}$$
$$\vec{\mathbf{F}}=m\vec{\mathbf{a}}$$
\begin{center}
If $\vec{\mathbf{a}}_{net}$ is 0, then
$\vec{\mathbf{F}}_{net} = \vec{0}$
\end{center}
\end{document}
```

**Vector with physics package**

Now the physics package allows you to write the same vector arrow above the letters but with more options, for example without having to use a command for the boldness. The command for the vector is \**va**{} and \**va***{} and for the bold font \**vb**{} and \**vb***{}. For example

```
\usepackage{physics}
...
$$\vec{\mathbf{F}}=\vec{0}$$ % two commands
$$\vb{F}\,,\,\vb*{F}$$ %one command
$$\vec{r}=x\hat{i}+y\hat{i}+z\hat{k}$$ %no package
$$\va{r}\,,\,\va*{r}$$ %with package
\end{document}
```

Two things to notice, first the commands with the * generated a cursive font, and second the \**vb**{} and \**vb***{} command does not generate an arrow above the argument, this form is another way to represent vectors in textbooks and documents, especially in physics.

Now you have the knowledge on how to write vectors in LaTeX in multiple ways, I prefer the physics package to write it due to its smoothness and simplicity, but that is up to you to decide.

I hope this post was helpful in you path using LaTeX, and as always keep writing in LaTeX.

**Further Reading**

**LaTex Tutorial** **on Symbols**

- How To Create A Cross Product Symbol In LaTeX
- How to create a hat symbol in LaTeX?
- How to create a prime symbol in LaTeX?
- How to create an absolute value symbol in LaTeX?
- How to create an approximate symbol in LaTeX?
- How to create an intersection symbol in LaTeX?
- How to create the empty set symbol in LaTeX?
- How to write a degree symbol in LaTeX?
- How to write a dot product in LaTeX?
- How to Write a Greater Than Symbol in LaTeX?
- How to write a norm symbol in LaTeX?
- How to write A Plus-Minus Symbol in LaTeX
- How to write a proportional to symbol in LaTeX?
- How to write a real number symbol in LaTeX?
- How to write a tilde symbol in LaTeX?
- How to write a union symbol in LaTeX?
- How to write an infinity symbol in LaTeX?
- How to write bold text in LaTeX?
- How To Write Dots Symbols In LaTeX?
- How to write the arrow symbols in LaTeX
- How to write the Degree celsius symbol in LaTeX?
- How to write the equal or not equal symbol in LaTeX?
- How to write the Euro symbol in LaTeX?
- How to write the floor symbol in LaTeX?
- How to write the gradient operator symbol in LaTeX
- How To Write The Greater Than Or Equal To Symbol In LaTeX?
- How to write the integer number symbol in LaTeX?
- How to write the less than symbol in LaTeX?
- How to write the Natural numbers symbol in LaTeX?
- How to write the parallel symbol in LaTeX?
- How to write the percent symbol in LaTeX?
- How to write the square root symbol in LaTeX?
- How To Write The Symbol For A Subset In LaTeX?
- How to write the symbol for therefore in LaTeX?
- How to write with the mathbb in LaTeX?