LaTeX – bold vectors and arrow vectors

Lately I’m writing a lot of papers in \LaTeX and every once and a while something comes up that drives me crazy trying to figure out.

Here’s how to easily switch between a bold vector \boldsymbol{x} and an arrow vector \vec{x}.

[***update: the comment by fbianco below is a better way to do this and is how I do it now.]

I got this idea from D.H here and I thought it was worth expanding a bit more.

First, make sure you include,

\usepackage{amsmath} % used for boldsymbol.

at the top of your .tex file. Then add these two lines somewhere underneath.

\newcommand{\vect}[1]{\boldsymbol{#1}} % Uncomment for BOLD vectors.
%\newcommand{\vect}[1]{\vec{#1}} % Uncomment for ARROW vectors.

Now when you are writing your vectors, instead of using \vec{}, you use \vect{}. This allows you to easily toggle between the two different modes.

\usepackage{amsmath} % used for boldsymbol.
\newcommand{\vect}[1]{\boldsymbol{#1}} % Uncomment for BOLD vectors.
%\newcommand{\vect}[1]{\vec{#1}} % Uncomment for ARROW vectors.
 
% Some other text here...
 
My lovely bold vector $\vect{x}$.

This will display the boldface vectors \boldsymbol{x}.

Whereas, this,

\usepackage{amsmath} % used for boldsymbol.
%\newcommand{\vect}[1]{\boldsymbol{#1}} % Uncomment for BOLD vectors.
\newcommand{\vect}[1]{\vec{#1}} % Uncomment for ARROW vectors.
 
% Some other text here...
 
My lovely arrow vector $\vect{x}$.

Will produce an arrow vector \vec{x}.

Now if anyone ever asks you to change how your vectors look in a paper, you can smile at them :D.

1 thought on “LaTeX – bold vectors and arrow vectors”

  1. The easiest is to use renewcommand this will change existing arrow vector by bold vector :

    \renewcommand{\vec}[1]{\boldsymbol{#1}}

    By the way, thanks for the boldsymbol tricks.

Leave a Reply