# [Tex/LaTex] Triangle arrows with text above

arrowscolortext;

I would like to use black and white triangle arrows with text above like these:

I guess that I have to combine /longrightarrow /xrightarrow{W} and /rightarrowtriangle but I don't know how to do that.

Messing around with the code found in mathtools, which defines several types of extensible arrows on, I got the following:

\documentclass{article}
\usepackage{mathtools}
\usepackage{stmaryrd}

\makeatletter
\providecommand*\xrightarrowtriangle[2][]{%
\ext@arrow 0055{\arrowfill@\relbar\relbar\rightarrowtriangle}{#1}{#2}}
\makeatother

\begin{document}
$x \rightarrowtriangle y, \qquad x \xrightarrowtriangle{i} y$

Some unknown text les transitions synchrones par xyzqwert

$x \rightarrow y, \qquad x \xrightarrow{W} y$
\end{document}


EDIT: To get filled arrows with the same shape as the empty ones, I used the \rhd (▷) and \RHD (▶) commands from wasysym:

\documentclass{article}
\usepackage{amsmath}
\usepackage{wasysym}
\usepackage{booktabs}

\providecommand\rightarrowRHD{\relbar\joinrel\mathrel\RHD}
\providecommand\rightarrowrhd{\relbar\joinrel\mathrel\rhd}
\providecommand\longrightarrowRHD{\relbar\joinrel\relbar\joinrel\mathrel\RHD}
\providecommand\longrightarrowrhd{\relbar\joinrel\relbar\joinrel\mathrel\rhd}

\makeatletter
\providecommand*\xrightarrowRHD[2][]{\ext@arrow 0055{\arrowfill@\relbar\relbar\longrightarrowRHD}{#1}{#2}}
\providecommand*\xrightarrowrhd[2][]{\ext@arrow 0055{\arrowfill@\relbar\relbar\longrightarrowrhd}{#1}{#2}}
\makeatother

\begin{document}
\begin{tabular}{lcccc}
\toprule
type               &   displaystyle                            &   textstyle                            &   scriptstyle                            \\
\midrule
filled short       & $\displaystyle a \rightarrowRHD b$ & $\textstyle a \rightarrowRHD b$ & $\scriptstyle a \rightarrowRHD b$ \\
empty  short       & $\displaystyle a \rightarrowrhd b$ & $\textstyle a \rightarrowrhd b$ & $\scriptstyle a \rightarrowrhd b$ \\
filled long        & $\displaystyle a \longrightarrowRHD b$ & $\textstyle a \longrightarrowRHD b$ & $\scriptstyle a \longrightarrowRHD b$ \\
empty  long        & $\displaystyle a \longrightarrowrhd b$ & $\textstyle a \longrightarrowrhd b$ & $\scriptstyle a \longrightarrowrhd b$ \\
filled superscript & $\displaystyle a \xrightarrowRHD{c} b$ & $\textstyle a \xrightarrowRHD{c} b$ & $\scriptstyle a \xrightarrowRHD{c} b$ \\
empty  superscript & $\displaystyle a \xrightarrowrhd{c} b$ & $\textstyle a \xrightarrowrhd{c} b$ & $\scriptstyle a \xrightarrowrhd{c} b$ \\
filled sup+super   & $\displaystyle a \xrightarrowRHD[d]{c} b$ & $\textstyle a \xrightarrowRHD[d]{c} b$ & $\scriptstyle a \xrightarrowRHD[d]{c} b$ \\
empty  sub+super   & $\displaystyle a \xrightarrowrhd[d]{c} b$ & $\textstyle a \xrightarrowrhd[d]{c} b$ & $\scriptstyle a \xrightarrowrhd[d]{c} b$ \\
\bottomrule
\end{tabular}
\end{document}


They have the same behavior as \longrightarrow and friends in that they don't scale as much (at all?) as the regular arrows.