3

I have a simple question... I want a modified version of \overrightarrow such that:

what I want:

So, the (n) is vertically aligned with the arrow. And this of course for every letter and symbol. The first line I make with

\documentclass{standalone}
\usepackage{amsmath}
\begin{document}
\pagestyle{empty}
$\displaystyle \overrightarrow{a}^{(n)} \text{ and } \overrightarrow{A}^{(n)}$
\end{document}

The second line is made with paint (manually aligning the (n)'s)

seaver
  • 491

2 Answers2

7

You can just brace \overright{a}. However, I suggest a slimmer form of the arrows, because the default ones are really too big.

\documentclass{article}
\usepackage{amsmath}
\usepackage[old]{old-arrows}

\newcommand{\vect}[1]{{\varoverrightarrow{#1}}}

\begin{document}

$\vect{a}^{(n)}$ and $\vect{A}^{(n)}$

\end{document}

enter image description here

If you want the standard arrows, just remove the call to old-arrows and remove var from the definion of \vect to get

enter image description here

egreg
  • 1,121,712
2

enter image description here

The idea comes from the answer of Steven B. Segletes here: How can I move the superscript higher?, which suggest to use \strut and, in a comment, \rule{0pt}{<dimen>}. As I think this second solution is more interesting, I thought it appropriate to summarize it here:

\documentclass[margin=2mm]{standalone}
\usepackage{amsmath}
\newcommand{\moveup}[1]{\rule{0pt}{#1pt}}
\begin{document}
 $\displaystyle \overrightarrow{a}\moveup{7.5}^{(n)} 
\text{ and } 
\overrightarrow{A}\moveup{10}^{(n)}$
\end{document}
Ivan
  • 4,368
  • Thanks for the suggestion, as I use this on different types of symbols, the solution is not as generic as I would like, but the trick is a very nice one for my toolbox. Thank you! – seaver Mar 18 '21 at 19:14