Modifying my answer from here we can just pull this data out of LaTeX-math-default
, which is a list of 4-tuples
(CHARACTER MACRO MENU UNICODE)
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 ()
(interactive)
(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)
(show-latex-symbol-at-point)
)
))
(global-set-key [C-down-mouse-3] 'mouse-popup-menubar)
. That way, you don't have messages ad nauseam.