Three Styles for LaTeX Vector Notation
filed in LaTeX, Math on Jun.26, 2012
LaTeX is a very flexible program for typesetting math, but sometimes figuring out how to get the effect you want can be tricky. Most of the stock math commands are written for typesetting math or computer science papers for academic journals, so you might need to dig deeper into LaTeX commands to get the vector notation styles that are common in physics textbooks and articles.
This post shows how to typeset a LaTeX vector with an arrow, a hat, or bold.
LaTeX Vector With an Arrow
The arrow vector notation is the standard in LaTeX, just use the \vec command in math mode.
This:
Generates this:
![]()
LaTeX Vectors With Hats
Using the \hat command in LaTeX generates a caret commonly used for unit vectors.
This:
Generates this:
![]()
Note that I used \jmath in the last statement. This gets rid of the dot over the j which screws up the placement of the caret. A similar command, \imath is also available for i.
Bold LaTeX Vector
This command will make \vec typeset LaTeX vectors using bold instead of an arrow:
Put that in the header of the LaTeX file, then $\vec{v} = 5\hat{k}$ generates:
![]()
If you like bold unit vectors, these commands will also modify the \hat command:
\renewcommand{\hat}[1]{\oldhat{\mathbf{#1}}}
Now $\vec{v} = 5\hat{k}$ generates:
![]()
My other post about bold LaTeX vectors has some great tips in the comments about using this with Greek letters.
Bold is my favorite style for vectors in LaTeX articles, but the decorated styles can look good in a well-printed book. Leave your favorite styles and tips in the comments!



Feb 13th, 2013 on 6:40 am
Thanks for the nice and structured info. Here’s a small addition:
If you want bold hats, add \boldsymbol to the above line of code so it looks like this:
renewcommand{\hat}[1]{\boldsymbol{\oldhat{\mathbf{#1}}}}
If you want an i or j unit vector without dot you can use \hat{\imath} and \hat{\jmath}, however the i and j will be italized, not bold. Instead use
\newcommand{\ihat}{\hat{\textbf{\i}}}
\newcommand{\jhat}{\hat{\textbf{\j}}}
in the preamble and from then on use \ihat when you want an i unit vector and \ihat when you want a j unit vector.
Feb 28th, 2013 on 3:22 am
good