Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to set up a part of my Mathematica package so that typing <-Space is replaced with the left arrow character ( or \[LeftArrow]) just like it does with ->Space. Does anyone know how to do this? I looked briefly at event handling but didn't see anything immediately useful. I already know, of course, that Esc<-Esc will insert , and that doing so is not that much additional effort, but I'm more interested in the concept involved here. Any ideas?

share|improve this question
    
Also see my answer here for how to set input aliases and input auto-replacements –  rm -rf May 4 '12 at 17:10
add comment

1 Answer 1

up vote 8 down vote accepted

Normally you could use:

SetOptions[$FrontEndSession,
  InputAutoReplacements -> {"<-" -> "\[LeftArrow]"}
]

But this fails because Mathematica already parses <- differently. Specifically the documentation states:

In expression input, automatic replacements can be performed only on strings of characters that correspond to complete input tokens.

You can see that this setting works for other strings, e.g.:

SetOptions[$FrontEndSession,
  InputAutoReplacements -> {"stuff" -> "\[LeftArrow]"}
]

Then typing (with a space):

x stuff 

Will render:

x \[LeftArrow] 
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.