How to have an arrow in textual environment?

It's possible to use arrows in non-math style using the textcomp package. It defines some arrows:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\begin{document}
\textleftarrow

\textrightarrow

\textdownarrow

\textuparrow

\end{document}

enter image description here

Edit

Here is some addition with unicode support within (pdf)latex: Some (but not yet all) unicode characters can be just copied or entered with some code into the .tex document and compiled, if \usepackage[utf8]{inputenc} is used. (The symbol → can be typed directly or copied from a character table application (Windows Symbol map) or KCharSelect on KDE on Linux etc., for example)

However, not any copied or entered character is yet recognized. With \newunicodechar from Enrico Gregorio's (egreg!!!) package newunicodechar it's possible to prepare the document to use the direct symbol. See the example for it's usage.

The unicode characters usually have a symbolic representation (the unicode): → has the code U+2192

The way, how unicode characters can be typed directly depends on the operating system and editors, but CTRLSHIFTU2192 is a good guess (at least it works for Firefox)

A former version used ucs and \unichar -- thanks to some notes by egreg, I dropped this and revised the example

\documentclass{article}
\usepackage{booktabs}
\usepackage{textcomp}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}

\newcommand{\showverb}[1]{%
  \texttt{\textbackslash#1} & \csname #1\endcsname  \tabularnewline
}

\newunicodechar{⇐}{\ensuremath{\Leftarrow}}
\newunicodechar{⇑}{\ensuremath{\Uparrow}}
\newunicodechar{⇒}{\ensuremath{\Rightarrow}}
\newunicodechar{⇓}{\ensuremath{\Downarrow}}
\newunicodechar{↦}{\ensuremath{\mapsto}}

\begin{document}
\begin{tabular}{ll}
Macro & Output \tabularnewline
\midrule[2pt]
  \showverb{textleftarrow}
  \showverb{textuparrow}
  \showverb{textdownarrow} 
  \showverb{textuparrow}
\midrule[2pt]
& \tabularnewline
Unicode character &  output \tabularnewline
\midrule[2pt]
2190 & ← \tabularnewline
2191 & ↑ \tabularnewline
2192 & → \tabularnewline
2193 & ↓ \tabularnewline
21D0 & ⇐ \tabularnewline
21D1 & ⇑ \tabularnewline
21D2 & ⇒ \tabularnewline
21D3 & ⇓ \tabularnewline
21A6 & ↦
\end{tabular}

\end{document}

enter image description here


You can create a command:

\newcommand{\textarrow}{$\rightarrow$}

You will use the math mode but without using math delimiters in fact.

Tags:

Fonts

Arrows