我知道:
\[
A \xleftarrow{\text{this way}} B
\xrightarrow[\text{or that way}]{ } C
\]
将产生:
有没有办法让箭头带有文字,但又具有 \leadsto 的样式?
答案1
我提供了一个解决方案tikz-cd。这很简单,但不会自动扩展。只需[column sep=4.5em]
根据您的需要编辑即可。
由于您在使用 Gonzalo 的代码时遇到了问题,我为您做了一些修改。现在应该可以正常工作了。但是,您将无法在箭头下方设置标签。如果您擅长 Ti钾Z,您可以定义更多这样的命令或设置可选参数以修改位置。
% 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}