When I write ToString[a->b], regardless of whether the input uses the right-arrow symbol or - and > separately, it comes out as "a -> b" with - and >. If I just write "->" but with the right-arrow symbol, that's what I get in the output, so it's possible to get the arrow to show up in a string, but is there a good way to do this without having to break up the expression before using ToString?

  • 1
    $\begingroup$ does ToString[a -> b, StandardForm] give what you want? $\endgroup$
    – kglr
    Dec 14, 2020 at 0:30
  • $\begingroup$ @kglr Yes, thank you! $\endgroup$
    – H.v.M.
    Dec 14, 2020 at 0:34

1 Answer 1


You can use StandardForm in the second argument of ToString:

ToString[a -> b, StandardForm]

enter image description here


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.