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)

6
  • 2
    I do not see any difference?! Commented Mar 18, 2021 at 15:05
  • 1
    In the second line, the (n) is vertically aligned with the arrow
    – seaver
    Commented Mar 18, 2021 at 15:09
  • Maybe search for "\raisebox". Commented Mar 18, 2021 at 15:12
  • I actually already did this, but this does not yield a generic solution... (as far as I could find)
    – seaver
    Commented Mar 18, 2021 at 15:13
  • Please provide code so we have something to work with.
    – daleif
    Commented Mar 18, 2021 at 15:19

2 Answers 2

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

1
  • This is exactly what I meant, thank you!
    – seaver
    Commented Mar 18, 2021 at 19:15
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}
1
  • 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
    Commented Mar 18, 2021 at 19:14

You must log in to answer this question.

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