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?

Name
  • 7,689
  • 4
  • 38
  • 84
  • 1
    @nanny: no, not at all. – mbork Nov 26 '14 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 '14 at 14:48
  • @mbork. Why not? Isn't that what he wants to do? Insert text? – nanny Nov 26 '14 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 '14 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 '14 at 20:03

1 Answers1

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.

ChrisR
  • 404
  • 2
  • 7
  • 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 '14 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 '14 at 15:19
  • 1
    Maybe: I'm on version 11.87. – Dan Nov 26 '14 at 15:20