1

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???

  • Welcome to TeX.SX! Do you want the arrow to be as long as the text? If not, you can just use \underset{\mathclap{\text{this way}}}{\leadsto}. Otherwise, does Gonzalo's answer here answer your question? – Adam Liter Mar 17 '15 at 20:41
  • May be a nice solution is some arrow in TikZ with the snake decoration. – Manuel Mar 17 '15 at 20:43
  • I needed to be as long as text, and Gonzalo's solution seems to break the style, maybe I should change all of them to tikz. – gusridd Mar 17 '15 at 21:26
3

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

  • Is there a way to write text both above and below the squiggly arrow? Something like $B \xrsquigarrow[\text{above}]{\text{below}} C$ doesn't work. – leastaction Sep 13 '16 at 2:41
  • @leastaction For tikz-cd just do \arrow[leftsquigarrow]{r}{\text{this way}}[swap]{\text{or that way}} For the other approach, please ask another question. – LaRiFaRi Sep 13 '16 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.