Vector Arrow in LaTeX (\vec{x})
- LaTeX command
\vec{x}- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
Where it is used
Places a small right-pointing arrow over a single letter to mark it as a vector.
School physics and many engineering texts write vectors as \vec{F}, \vec{v} or \vec{r}, while pure mathematics more often uses bold \mathbf{v} or plain letters. The arrow has a fixed size meant for one character; over two points such as AB it looks cramped, so use \overrightarrow{AB} instead. The arrow sits slightly right of center over italic letters to follow their slant. Combining it with a hat for unit vectors (\hat{\vec{x}}) works but stacks tall, so many writers use \hat{\mathbf{x}}.
Also listed under: Linear Algebra
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Vector Arrow: $\vec{x}$
\[ \vec{F} = m\vec{a} = \frac{d\vec{p}}{dt} \]
\end{document}Related symbols
- Wide Vector
\overrightarrow{AB} - Underline
\underline{xyz} - Left Vector
\overleftarrow{AB} - Overline
\overline{xyz} - Line Arrow (over AB)
\overleftrightarrow{AB} - Bar
\bar{x}
Frequently asked questions
- How do I write Vector Arrow in LaTeX?
- Type \vec{x} in math mode, for example $\vec{F} = m\vec{a} = \frac{d\vec{p}}{dt}$. It works in plain LaTeX without loading any package.
- Which package do I need for \vec{x}?
- None. \vec{x} is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use \vec{x} in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\vec{x}$ in running text.
Best AI LaTeX Editor, Overleaf Alternative
Octree helps researchers from 15+ universities write research papers faster using AI
- Generate beautiful TikZ diagrams using AI
- Upload image and convert it to LaTeX seamlessly
- Get instant assistance with writing and formatting research papers