101

I want to have a vector with a superscript:

\vec{o}^t

But this gives very bad results: the t is overlapping with the vector arrow. How do I fix this (and why does this give bad results in the first place) ?

Ben
  • 1,013

5 Answers5

75

I don't really know why the result is bad; I suspect it has to do with the width of the letter. I wouldn't use such a notation, but that's a personal opinion.

With

\vec{o}^{\,t}

the superscript is moved a bit to the right. One might perhaps let TeX do some computations in order that the shift to the right of the superscript is automatic.

egreg
  • 1,121,712
42

Try this:

\documentclass{article}
\usepackage{esvect}
\begin{document}
$\vv{o}^t \ \vv{o^t}$
$\vec{o}^{\,t}$
\end{document}

(I have included egreg's code to make the comparison easier.)

The first two are done using the esvect package, the third is egreg's code. The visual comparison.

17

How about something like

\documentclass{article}

\makeatletter
\newcommand{\vo}{\vec{o}\@ifnextchar{^}{\,}{}}
\makeatother

\begin{document}

$\vec{o}^t o$ $\vo^t o$ 

$\vec{o} o$ $\vo o$

$\vec{o}^t_t o$ $\vo^t_t o$

\end{document}

enter image description here

This looks all right for $\vo^t$. (The ^ must be immediately after \vo.) I don't know how to make just the superscript shift in $\vo^t_t$.

Here is a discussion of how \@ifnextchar works.

MSC
  • 2,722
4
$\overrightarrow{A}$  this one for simple vector
$\overrightarrow{A}^{value}$  This one for superscript
$\overrightarrow{A}_{value}$  This one for subscript.

Hope this will help you. It's working in mine.

1

You just have to put y into the whole bracket like:

\vec{o^t}

This should give a result like: o^t

Jin Lee
  • 11
  • 1