I am a newbie here. I want to redefine keymaps of math symbol in auctex I wanted 'I to be \int and '8 to be \infty, so I changed LaTeX-math-default in auctex-11.89.4/latex.el as follows

(?I "infty" "Misc Symbol" 8734) ;; #X221E => (?8 "infty" "Misc Symbol" 8734) ;; #X221E

(nil "int" "Var Symbol" 8747) ;; #X222B => (?I "int" "Var Symbol" 8747) ;; #X222B

But it doesn't work, and now when I hit '8 it show "` 8 is undefined" in mini buffer. Why is that? And how can I redefine them?


When else fails, read the documentation:

The variable LaTeX-math-list allows you to add your own mappings.

User Option: LaTeX-math-list

A list containing user-defined keys and commands to be used in LaTeX Math mode. Each entry should be a list of two to four elements.

First, the key to be used after LaTeX-math-abbrev-prefix for macro insertion. If it is nil, the symbol has no associated keystroke (it is available in the menu, though).

Second, a string representing the name of the macro (without a leading backslash.)

Third, a string representing the name of a submenu the command should be added to. Use a list of strings in case of nested menus.

Fourth, the position of a Unicode character to be displayed in the menu alongside the macro name. This is an integer value.

You can customize this option with M-x customize-variable RET LaTeX-math-list RET and see the following screenshot:

enter image description here

When you're done hit the "Apply and Save" button.

Alternatively, put this code in your init file:

(setq LaTeX-math-list
      '((?8 "infty" "Misc Symbol" 8734)
        (?I "int" "Var Symbol" 8747)))

AUCTeX is highly customizable, you should never manually edit the source code.

  • Hi. It works well. But I want to change it little bit more. I made a function to jump to "<++>" and delete it, and I bind a key for this. Now I want "`I" to be \int_{}^{<++>}<++> with cursor at the blank bracket. Could you give me a tip? – Junbeom Lee Sep 4 '16 at 15:53
  • 1
    Just replace "int" with "int_{}^{<++>}<++>" ;-) – giordano Sep 4 '16 at 16:11
  • Hi. Thanks. Actually, I came up with that first, but the difficult part to me was the place of cursor. So, I changed it as "int_{[+]}^{<+>}<+>" and make my jump function move to "[+]" first. But still I don't like this. I need to hit one more key!. – Junbeom Lee Sep 11 '16 at 6:14
  • What I am thinking is manipulating the third key, "Misc Symbol" or "Var symbol" part. Cause it seems like it determine what is followed after the main insertion part. What do you think about this? And how can I touch the third part? – Junbeom Lee Sep 11 '16 at 6:16
  • No, the third element is just the name of the menu under which the symbol will be listed. – giordano Sep 14 '16 at 20:42

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.