36

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
  • 7
    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
  • 1
    @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
57

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}

enter image description here

  • 7
    If you want space around the arrow, use this instead: A \textrightarrow{} B – Nathaniel M. Beaver Nov 4 '16 at 22:14
  • 5
    BTW: List of all available symbols in textcomp package is available here. Unfortunately there is no \textleftrightarrow (equivalent of \leftrightarrow that is available in math mode). – patryk.beza Jan 3 '17 at 10:55
1

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.

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.