Arrow in text mode

Is there a way to write the equivalent of \rightarrow in text mode?

I tried → but it threw an error, and the math arrow complained about bad environment.

It doesn't need to be exactly the same arrow, I just want to write something like "A → B" as in A points to B.

• You can use A$\,\to\,$B – Gonzalo Medina Feb 20 '15 at 18:24
• Why not $\rightarrow$? – egreg Feb 20 '15 at 18:24
• I hoped there's a cleaner way than making a math context just for the one arrow, but yeah that'll do the trick as well. – MightyPork Feb 20 '15 at 18:24
• @MightyPork there's a text-mode option. See my answer below. – Gonzalo Medina Feb 20 '15 at 18:29
• @c.p. Not here, they are names of nodes, not math related. If they were points, yeah. – MightyPork Feb 20 '15 at 18:34

You can use something like A$\,\to\,$B or A\textrightarrow B (in text mode) from the textcomp package:

\documentclass{article}
\usepackage{textcomp}

\begin{document}

A$\,\to\,$B

A\textrightarrow B

\end{document}


With fontspec, you can simply paste the Unicode glyphs for arrows after selecting any font that contains them, or use commands such as \char"2194 or \symbol.