I know it's possible to have \xrightarrow (text), but if I try to do \xRightarrow (text) I get an error each time. Does anybody know if it's a syntax error or if there is a other way to produce the \Rightarrow with text above?
Asked
Active
Viewed 1e+01k times
76
Paul Wintz
- 402
- 2
- 14
Niels Sønderbæk
- 1,863
3 Answers
74
Just taking the definition of \xrightarrow and replacing r by R :
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\xRightarrow}[2][]{\ext@arrow 0359\Rightarrowfill@{#1}{#2}}
\makeatother
\begin{document}
% To create a single arrow with text above, use lowercase "r".
$\xrightarrow{\mathit{hello}}$
% To create a double arrow with text above, use uppercase "R".
$\xRightarrow{\mathit{hello}}$
\end{document}
Paul Wintz
- 402
- 2
- 14
David Carlisle
- 757,742
52
\documentclass{article}
\usepackage{mathtools}
\begin{document}
$\xrightarrow{\text{hello}}$
$\xRightarrow{\text{hello}}$
\end{document}
Lorents
- 170
-
16Why the difference in arrow lengths? The head of the double arrow is under "o" of hello, while "hello" is entirely above the shaft of the single arrow. – Joshua Taylor Sep 01 '14 at 14:59
-
10
You can also use underset and overset:
$\underset{\text{hello}} \longrightarrow$
$\overset{\text{hello}} \longrightarrow$
$\underset{\tiny\text{hello}} \longrightarrow$
$\overset{\tiny\text{hello}} \longrightarrow$
Bill Moore
- 201
- 2
- 2
-
This solution does not create arrows that grow to accommodate what's over/under them. – Nathan Oct 25 '23 at 11:46


\mathit{hello}to get rid of the obnoxious math kerning. – barbara beeton Dec 01 '12 at 19:19\xrightarrowis a standard command from amsmath just shown for comparison, and the double arrow version with capital R which is defined here. – David Carlisle May 29 '20 at 20:41