Extensible negated arrow

arrowsmath-mode

Similar to this question, I want to write some text above $\nrightarrow$. This is what I could do:

\documentclass{article}
\usepackage{mathtools}
\usepackage{amssymb}

\begin{document}
    
    
    $\nrightarrow$
    
    $\nrightarrow^{\text{Hello}}$
\end{document}

As you can see, the text is not properly aligned.

So, I seek help in putting the text right on top.

Additionally, it would be appreciated to faciliate extending the arrow to fit the text.

Best Answer

Maybe something like

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\makeatletter
\newcommand{\xnrightarrow}[2][]{%
  \mathrel{%
    \vphantom{\xrightarrow[#1]{#2}}%
    \ooalign{\hidewidth\neg@arrow\hidewidth\cr$\m@th\xrightarrow[#1]{#2}$\cr}%
  }%
}
\newcommand{\neg@arrow}{%
  $\m@th\vcenter{\hbox{%
    \rotatebox[origin=c]{-45}{\scalebox{1.5}[1]{$\m@th\scriptscriptstyle|$}}%
  }}$
}
\makeatother

\begin{document}

\begin{gather*}
A\xnrightarrow{\text{hello}}B \\
A\xnrightarrow{\text{hello again}}B
\end{gather*}

\end{document}

where a negation symbol is superimposed to the standard \xrightarrow. The negation symbol is a fattened bar which is rotated.

enter image description here