\rightarrow has math symbol class 3, that is, it is a math relation.

How can I define a macro, let's call it \rightinf, to get the same right arrow character, but as an ordinary math symbol (like \infty, say) rather than as a math relation?

Reason for the question: I want to use \rightinf to designate intervals in an ordered set that are not bounded above, as in (0, \rightinf), instead of (0, \infty).


How about


or, more concisely,


(\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


  • But since \to is an alias for \rightarrow and \rightarrow is a math relation (class 3), doesn't the concise definition \newcommand{\rightinf}{{\to}} keep \rightinf as a math relation? Or does the extra grouping around \to in that definition convert it into an ordinary math symbol (class 0)? – murray Aug 4 '18 at 17:07
  • @murray: Indeed, encasing \to (or any other math-mode object, really) in curly braces changes its math status to math-ord. – Mico Aug 4 '18 at 17:53
  • 1
    @Mico Could you add an image to understand your answer? Thanks. – Sebastiano Aug 4 '18 at 20:05
  • @Sebastiano - Done! :-) – Mico Aug 4 '18 at 20:20
  • Since \to is of class 3 (math rel), why does the spacing stay the same for the \mathord version (invoked in the form \mathord{\rightarrow}) as for the original math rel form? – murray Aug 4 '18 at 22:24

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






$a\rightarrow b$

$a\rightinf b$


enter image description here

On the other hand,


is simpler.

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.