1

This is a follow up from this question, where the previous problem was solved.

I am trying to employ AUCTeX to produce certain sequences, not exactly symbols, when I press key combinations: ` C-w or ` C-v. Below is what I added to .emacs

(setq LaTeX-math-list '((?\C-w (lambda () "\\Wec\{\}") "" nil)
                        (?\C-v (lambda () "\\Bec\{\}") "" nil)))

It doesn't show anything when I try to press the keys. I made sure I was in LaTeX-mode as well as Latex-Math mode was enabled. I could see Emacs recognises the keys but nothings happens.

1
  • What's the question?
    – Drew
    Commented Aug 28, 2022 at 21:38

1 Answer 1

2

I tested this that works like a charm:

(setq LaTeX-math-list '((?\C-w "Wec" "" nil)
                        (?\C-v "Bec" "" nil)))

You can set it with customize-variable LaTeX-math-list.

The doc string of LaTeX-math-list says:

VALUE can be a string with the name of the macro to be inserted, or a function to be called. The macro must be given without the leading backslash.

(Emphasis added).

3
  • Thanks. It's working. I pretty much tried everything but that simple name and then I read backlash is added .For the purpose of understanding better, can you tell why my version didn't work?
    – Celdor
    Commented Aug 28, 2022 at 23:11
  • Also, is it possible if I add braces {} to hold a cursor inside or that would be too complicated?
    – Celdor
    Commented Aug 28, 2022 at 23:13
  • You had a leading backslash in the value: you are supposed to give the name of the macro without a leading backslash.
    – NickD
    Commented Aug 29, 2022 at 1:58

Your Answer

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

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