[Tex/LaTex] How to produce symbol with arrow under

amsmathsymbols

My goal is to create a symbol with an arrow and a variable length argument under it.

The top line in the picture shows how I want the symbol to look, generated using \underset{\quad \ \rightarrow k+1}{r}, however the spacing I have to introduce to the underset creates an unwanted space between this and A. Additionally, this spacing must be tuned to match the length of the variable length argument.

The second option uses \underrightarrow{r}_{k+1}, which removes the unwanted space, but uses an uglier arrow and places the subscript too high.

Can anyone think of a more elegant solution for me?

enter image description here

Best Answer

\documentclass[a4paper, 11pt]{article}
\usepackage{amsmath}


\begin{document}

   text

\fbox{$A\underset{\overset{\rightarrow}{}}{r}_{\overset{k+1}{}}$}

\fbox{$A\underset{\rightarrow}{r}_{k+1}$}


text
\end{document}

enter image description here