37

I don't like the way the vector with an arrow $\vec{x}$ looks. I would prefer to indicate it with a line underline but when I google it nothing comes up to show me how to do it. Does anyone know?

\documentclass[a4paper,11pt]{article}


\begin{document}

 \vec{x} 

\end{document}
  • 1
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. – Mensch Oct 7 '12 at 19:53
  • I did but someone edited it out. – Magpie Oct 7 '12 at 20:30
  • 1
    the macro itself is not an MWE. It is customary here to include the simplest document starting from \documentclass{...} ... \end{document} such that users can copy/paste your code and work on it directly. – percusse Oct 7 '12 at 21:05
47

Here is a comparison of a few techniques to represent a vector (not sure about the \overline, \underline ones as I don't think that that is standard usage):

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath} 


\begin{document}
$\vec{x}$  $\overline{x}$  $\underline{x}$  $\mathbf{x}$

$\vec{\mathbf{x}}$  $\overline{\mathbf{x}}$  $\underline{\mathbf{x}}$ 
\end{document}
  • 1
    I really dislike using \mathbf since the font changes to upright. I want my vectors italic according to ISO 80000-2. Previously I have used the Boldmath bm package, now I use isomath for this. – Martin Ueding Jul 25 '15 at 20:08
  • @MartinUeding: I am not familiar with isomath. Perhaps you should post an answer. – Peter Grill Jul 26 '15 at 1:42
  • Can you underline a single blank space in an align (math mode)? – Jeff Apr 8 '16 at 0:06
  • @Jeff: Should be able to. Try using \underline{\phantom{\space}}. Otherwise, I'd suggest posting a new question. – Peter Grill Apr 9 '16 at 1:17
31

You can renew the command \vec.

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

In this case, if you use \vec your vector will be underlined. If you change mind and you want to use a dot or whatever, you can change the definition and all your \vec on the document will automatically change in the next compilation.

\documentclass{standalone}
\usepackage{amsmath}

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

\begin{document}
\[
   \vec{x} = \cdots % "x" will be underlined
\]
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.