4

I cannot find a shortcut for the command \neq (not equal) in AUCTeX by the answers provided to my previous question A comprehensive list of shortcuts provided by AUCTeX

I would be great if it would be possible to associate the shortcut `= to \neq when working with emacs+auctex just in LaTeX-mode. Is is possible?

5
  • 1
    @nanny: no, not at all.
    – mbork
    Nov 26, 2014 at 14:48
  • Yes, it's possible. The resources available on the internet for a question like this are countless. Break down your question into logical and general pieces ("insert text programmatically" "define key in major mode") and try a search engine.
    – nanny
    Nov 26, 2014 at 14:48
  • @mbork. Why not? Isn't that what he wants to do? Insert text?
    – nanny
    Nov 26, 2014 at 14:50
  • 1
    @nanny It is a bit more specific, because he wants to insert some shortcut to a keymap which already provides a lot of them. There are easier (and more scalable) ways of achieving this than creating a new function and bind it to the wanted key.
    – T. Verron
    Nov 26, 2014 at 15:01
  • @nanny: also, the point of the other question (which is mine, btw) is that the point should stay to the left of inserted text. It's rather improbable that the OP wants such behavior in this case (it would be very unnatural and impractical).
    – mbork
    Nov 26, 2014 at 20:03

1 Answer 1

6

The variable LaTeX-math-list allows you to add additional math shortcuts and menu entries. You can either customize it, or use (add-to-list 'LaTeX-math-list '(?= "neq" "Relational" 8800)) for your case. Each element of the list contains a key binding, the macro to insert, a submenu of the Math-menu to add an entry to, and a unicode code point for the corresponding symbol. Note that when not setting this through custom, you may have to call (LaTeX-math-initialize) afterwards.

3
  • 1
    I'd suggest add-to-list rather than setf in case there are already entries in LaTeX-math-list. I'm also, by the way, not finding LaTeX-math-initialize.
    – Dan
    Nov 26, 2014 at 15:15
  • @Dan: Thanks, I updated the answer. Regarding LaTeX-math-initialize, I'm using AUCTeX 11.88. Maybe this is a new thing?
    – ChrisR
    Nov 26, 2014 at 15:19
  • 1
    Maybe: I'm on version 11.87.
    – Dan
    Nov 26, 2014 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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