How to write a vector in LaTeX?

How to write a vector in LaTeX?

This post may contain affiliate links that allow us to earn a commission at no expense to you. Learn more

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.


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}$$
vector in LaTeX
Standard form of a vector

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
vector in LaTeX
Standard form of vectors according to LaTeX

Vectors in Math mode

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


    If $\vec{\mathbf{a}}_{net}$ is 0, then
    $\vec{\mathbf{F}}_{net} = \vec{0}$

vector in LaTeX
A combination of bold font with vectors

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

$$\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

vector in LaTeX
Vectors with and without physics package

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

  1. How To Create A Cross Product Symbol In LaTeX
  2. How to create a hat symbol in LaTeX?
  3. How to create a prime symbol in LaTeX?
  4. How to create an absolute value symbol in LaTeX?
  5. How to create an approximate symbol in LaTeX?
  6. How to create an intersection symbol in LaTeX?
  7. How to create the empty set symbol in LaTeX?
  8. How to write a degree symbol in LaTeX?
  9. How to write a dot product in LaTeX?
  10. How to Write a Greater Than Symbol in LaTeX?
  11. How to write a norm symbol in LaTeX?
  12. How to write A Plus-Minus Symbol in LaTeX
  13. How to write a proportional to symbol in LaTeX?
  14. How to write a real number symbol in LaTeX?
  15. How to write a tilde symbol in LaTeX?
  16. How to write a union symbol in LaTeX?
  17. How to write an infinity symbol in LaTeX?
  18. How to write bold text in LaTeX?
  19. How To Write Dots Symbols In LaTeX?
  20. How to write the arrow symbols in LaTeX
  21. How to write the Degree celsius symbol in LaTeX?
  22. How to write the equal or not equal symbol in LaTeX?
  23. How to write the Euro symbol in LaTeX?
  24. How to write the floor symbol in LaTeX?
  25. How to write the gradient operator symbol in LaTeX
  26. How To Write The Greater Than Or Equal To Symbol In LaTeX?
  27. How to write the integer number symbol in LaTeX?
  28. How to write the less than symbol in LaTeX?
  29. How to write the Natural numbers symbol in LaTeX?
  30. How to write the parallel symbol in LaTeX?
  31. How to write the percent symbol in LaTeX?
  32. How to write the square root symbol in LaTeX?
  33. How To Write The Symbol For A Subset In LaTeX?
  34. How to write the symbol for therefore in LaTeX?
  35. How to write with the mathbb in LaTeX?

Photo of author
SJ Tsai
Chief Editor. Writer wrangler. Research guru. Three years at scijournal. Hails from a family with five PhDs. When not shaping content, creates art. Peek at the collection on Etsy. For thoughts and updates, hit up Twitter.

Leave a Comment