5

I'd like to write an expression with several vectors:

$\vec{t} + \vec{a}$

I'd like the arrow to appear at the same level, but the t arrow appears higher than the a arrow. I tried with \overrightarrow but it's the same problem.

1
  • There was briefly a comment to thus effect, but it was deleted: if you know how tall you want the arrows to be, something like \vec{\vphantom t\smash{#1}} should work.
    – LSpice
    Jun 17, 2015 at 16:12

2 Answers 2

8

You can also do the following to avoid having to change any of the existing mathematical code.

\documentclass[border=5mm]{standalone}
\let\nvec\vec
\def\vec#1{\nvec{\vphantom t\smash{#1}}}
\begin{document}
$\vec{t} + \vec{a}$
\end{document}

enter image description here

You will have to modify the \def command for the 'tallest' variable used.

3
  • I wonder if it is possible to do some .aux-file monkeying that will record every argument to which an \alignedvec is applied, calculate the tallest among them, and then use that on the next pass as the height of a strut (to replace the guessing / fiddling required for the \vphantom).
    – LSpice
    Jun 17, 2015 at 19:43
  • @LSpice I suspect it would be possible, but probably overkill. If all the vectors are lower case then depending upon the font one of the letters b, d, f, h, k, l, or t would be the tallest if not the same height. (So t is a great general choice. If you are using uppercase as vector then I would be a good choice for the tallest. Jun 17, 2015 at 19:55
  • I personally ended up using l which is bit higher than t (I used only lowercase vector)
    – gwenzek
    Jun 18, 2015 at 8:24
4

Make a new macro for making vectors, say

\newcommand\myvec[1]{\vec{\vphantom{t}#1}}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .