Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

As the question says,

$\overrightarrow{a} \otimes \overrightarrow{b}$

looks rather unpleasant because the arrow over the a is so much lower than the arrow over the b. I'm not sure that just raising the arrow over the a would lead to a visually pleasing result... but I thought I'd ask if anyone had any suggestions.

Edit: enter image description here

share|improve this question

1 Answer 1

up vote 18 down vote accepted

You can force the two arrows to be on the same level by adding a \vphantom instruction in the argument of the first \overrightarrow instruction. "vphantom" is short for "vertical phantom"; a vertical phantom has no width (and is therefore invisible) and has the same height and depth as its argument. For your purposes, the argument of the \vphantom command may simply be the character used in the second \overrightarrow command.

\documentclass{article}
\begin{document}
$\overrightarrow{a\vphantom{b}} \otimes \overrightarrow{b}$
\end{document}

enter image description here

Addendum: If you find yourself using a lot of \overrightarrow instructions and don't wish to have to keep track of whether the heights of some of the arrows have to be adjusted, you could create a command such as \rarrow (short for "right arrow"):

\newcommand{\rarrow}[1]{\overrightarrow{#1\vphantom{b}}}

Here, b is chosen as the argument of the \vphantom command because it has a full-height ascender. The preceding MWE could then be rewritten as

\documentclass{article}
\newcommand{\rarrow}[1]{\overrightarrow{#1\vphantom{b}}}
\begin{document}
$\rarrow{a} \otimes \rarrow{b}$
\end{document}

Further addendum, prompted by a great comment by @sigur: To address the possibility that both elements of the tensor product consist of characters that either do not contain ascenders or only half-height ascenders (such as "t" and "j"), you could define a command named, say, \tensorpr, as follows:

\documentclass{article}
\usepackage{amsmath} % for less-cramped positioning of arrows
\newcommand{\tensorpr}[2]{\overrightarrow{#1\vphantom{#2}} 
                  \otimes \overrightarrow{#2\vphantom{#1}}}
\begin{document}
$\tensorpr{a}{b}$
\end{document}

Note the symmetric use of the \vphantom instructions. By the way, I'd recommend using the amsmath package because it causes the arrows to be typeset ever so slightly higher above their arguments, leading to a less "cramped" look.

share|improve this answer
1  
Nice. What about this command: \newcommand{\oarrow}[2]{\overrightarrow{#1\vphantom{#1#2}}\otimes\overrightarro‌​w{#2}} to write the tensor product with the \vphantom using both arguments so that in case of no letters with ascenders, everything works. ` –  Sigur Sep 24 '12 at 23:27
1  
@Sigur -- thanks for this great comment! I've incorporated your idea in a new addendum that sets up a command I call \tensorpr and uses two \vphantom instructions. –  Mico Sep 25 '12 at 11:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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