
Estou ciente de \xrightarrow
outras opções usando amsmath
, mas em vez de ter o texto sobre a seta, estou procurando algo assim:
expression --text--> another expression
Isso pode ser conseguido usando amsmath (ou alguma outra biblioteca)?
Se não, como posso definir isso sozinho?
Responder1
Eu usaria um tipo menor centralizado verticalmente em relação ao eixo matemático:
\documentclass{article}
\usepackage{amsmath}
\newcommand{\crightarrow}[1]{%
\relbar\joinrel\joinrel\relbar\mathrel{\vcentertext{#1}}\rightarrow
}
\newcommand{\vcentertext}[1]{%
\vcenter{\hbox{\scriptsize\smallstrut#1}}%
}
\newcommand{\smallstrut}{\vrule height 1.5ex depth 0.5ex width 0pt }
\begin{document}
$a_n \crightarrow{goes to} a$
$a_n \crightarrow{oes} a$
$a_n \crightarrow{bbb} a$
$a_n \crightarrow{ppp} a$
\end{document}
Responder2
Responder3
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\newlength\tmplength
\newcommand*\textarrow[2][3em]
{\mathrel{\vcenter{\hbox{\settowidth\tmplength{\scriptsize#2}%
\tikz[font=\scriptsize]
\draw[->](0,0)--node[fill=white,midway]{#2}
++({#1+\the\tmplength},0);}}}}
e você pode usar
$a \textarrow{foo} b$
$a \textarrow[5em]{bar} b$
$a \textarrow[10em]{baz} b$