How change class of a math symbol?

How about

\newcommand{\rightinf}{\mathord{\rightarrow}}

or, more concisely,

\newcommand{\rightinf}{{\to}}

(\to is an alias for \rightarrow.)

Creating a macro called \rightinf in this manner may be unnecessary, though, at least for the use case you laid out: $(0,\to)$ and $(0,{\to})$ produce the exact same output.

Here's a full MWE. It illutrates my point about $(0,\to)$ and $(0,{\to})$ producing the exact same output.

enter image description here

\documentclass{article}
\newcommand{\rightinf}{{\to}}
\begin{document}
$(0,\to)$

$(0,\rightinf)$
\end{document}

Since \rightarrow is a \mathchardef token, you can define

\mathchardef\rightinf=\numexpr\rightarrow-"3000\relax

Example:

\documentclass{article}

\mathchardef\rightinf=\numexpr\rightarrow-"3000\relax

\begin{document}

$a\rightarrow b$

$a\rightinf b$

\end{document}

enter image description here

On the other hand,

\newcommand{\rightinf}{\mathord\rightarrow}`

is simpler.

Tags:

Symbols