[Tex/LaTex] leadsto with text

arrowstext-decorations

I know that:

\[
 A \xleftarrow{\text{this way}} B
  \xrightarrow[\text{or that way}]{ } C
\]

will produce:

Example
Is there a way to have an arrow with text, but with the style of a \leadsto???

Best Answer

I provide a solution with use of . This is easy but will not expand automatically. Just edit the [column sep=4.5em] to your needs.

As you had problems with Gonzalo's code, I adapted it slightly for you. Should work now. However, you will not be able to set the label below the arrow. If you are good in TikZ, you may define more commands like this or set optional parameters in order to modify the placement.

% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}
\usepackage{tikz-cd}
\usetikzlibrary{decorations.pathmorphing}

% code from Gonzalo
\newcommand\xrsquigarrow[1]{%
    \mathrel{%
        \begin{tikzpicture}[%
            baseline={(current bounding box.south)}
            ]
        \node[%
            ,inner sep=.44ex
            ,align=center
            ] (tmp) {$\scriptstyle #1$};
        \path[%
            ,draw,<-
            ,decorate,decoration={%
                ,zigzag
                ,amplitude=0.7pt
                ,segment length=1.2mm,pre length=3.5pt
                }
            ] 
        (tmp.south east) -- (tmp.south west);
        \end{tikzpicture}
        }
    }
\newcommand\xlsquigarrow[1]{%
    \mathrel{%
        \begin{tikzpicture}[%
            ,baseline={(current bounding box.south)}
            ]
        \node[%
            ,inner sep=.44ex
            ,align=center
            ] (tmp) {$\scriptstyle #1$};
        \path[%
            ,draw,<-
            ,decorate,decoration={%
                ,zigzag
                ,amplitude=0.7pt
                ,segment length=1.2mm,pre length=3.5pt
                }
            ] 
        (tmp.south west) -- (tmp.south east);
        \end{tikzpicture}
        }
    }

\begin{document}
    \[\begin{tikzcd}[column sep=4.5em]
    A\arrow[leftsquigarrow]{r}{\text{this way}} 
    & B\arrow[rightsquigarrow]{r}[swap]{\text{or that way}} 
    & C
    \end{tikzcd}\]

    \[
    A \xleftarrow{\text{this way}} B
    \xrightarrow[\text{or that way}]{} C
    \]
    \[
    A \xlsquigarrow{\text{this way}} B
    \xrsquigarrow{\text{or that way}} C
    \]
\end{document} 

enter image description here