drawing arrow under a text latex code example

Example 1: latex arrow with text above

\documentclass{article}
\usepackage{mathtools}
\begin{document}

$\xrightarrow[\text{world}]{\text{hello}}$
$\xRightarrow[\text{world}]{\text{hello}}$

\bigskip    
$\xrightarrow[g(x)]{f(x)}$
$\xRightarrow[g(x)]{f(x)}$  
\end{document}

Example 2: text over left right arrow latex

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\xLeftrightarrow}[2][]{\ext@arrow 0099\Leftrightarrowfill@{#1}{#2}}
\makeatother
\begin{document}
$A \xLeftrightarrow{\mathit{hello}} B$
\end{document}

Tags:

Misc Example