If I do M-x forward-char, Emacs gives a very useful message

You can run the command "forward-char" with C-f.

Considering the fact that Emacs can find all LaTeX keybindings in the file latex.el under LaTeX-math-default provided by AUCTeX, is it possible that in LaTeX mode (AUCTeX) Emacs recalls me the Keybindings? For example after typing \sigma Emacs shows a message that

You can insert "\sigma" by `s .

This would be very useful as it permits to gradually learn the keybindings in LaTeX mode.

  • 2
    Not an answer to your question, but the menubar should show the keyboard shortcuts if they are defined. And, the same thing is available with a popup-menu (which shows the shortcuts) -- e.g., (global-set-key [C-down-mouse-3] 'mouse-popup-menubar). That way, you don't have messages ad nauseam.
    – lawlist
    Feb 1, 2015 at 8:01
  • @lawlist I was going to comment that the math mode symbols aren't in the menu, but they actually have a whole menu of their own! Even the ones that don't have a defined short cut are shown, with the code needed to produce them. Very handy!
    – Tyler
    Feb 6, 2015 at 15:11

1 Answer 1


Modifying my answer from here we can just pull this data out of LaTeX-math-default, which is a list of 4-tuples


where CHARACTER is the character used to bind it (I know it looks like an integer, but it's a character, use (string CHARACTER) to see), MACRO is the Latex macro without the slash, MENU is the name for the menus and UNICODE is a unicode character used for display in the menu. We want to check the first and second elements:

(defun show-latex-symbol-at-point ()
  (let* ((sym (symbol-at-point))
         (latex-symbol (TeX-member sym LaTeX-math-default
                                   (lambda (a b)
                                     (string= a (nth 1 b)))))
         (shortcut (nth 0 latex-symbol))
    (if (and latex-symbol shortcut)
        (message "You can insert \\%s with `%s"
                 (nth 1 latex-symbol)
                 (key-description (string shortcut))))))

There are probably better ways to continually show the output, but one way to use post-command-hook to run the above function after every command. We'll use an if to make sure this only runs in latex-mode

(add-hook 'post-command-hook
          (lambda ()
            (if (bound-and-true-p LaTeX-math-mode)
  • Many thanks for this answer. Your code works. After typing $\sigma$, a message appears telling You can insert \sigma with s. Let me report a possible bug, if I type $\oplus$m there is an error telling Error in post-command-hook ((lambda nil (if (eq major-mode (quote latex-mode)) (show-latex-symbol-at-point)))): (wrong-type-argument characterp nil). I think this is caused by the fact that auctex has not set a shortcut for oplus (oplus can be found under LaTeX-math-default). And from this error on, the code seems to not working, e.g. by typing $\sigma$ nothing happens.
    – Name
    Feb 6, 2015 at 7:51
  • @Name I fixed it to not try to print when CHARACTER is nil
    – erikstokes
    Feb 6, 2015 at 19:59
  • Perfect. Few minor suggestions: (1) I think the message You can insert \sigma with `s is better than You can insert sigma with s. (2) Currently after typing \rightarrow the message You can insert rightarrow with ^F appears. I think the message You can insert \rightarrow with `C-f is perhaps better.
    – Name
    Feb 6, 2015 at 20:21
  • And, fixed again.
    – erikstokes
    Feb 6, 2015 at 21:11

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.