In Emacs the command C-c C-e prompts for an environment to insert. After pressing TAB I'd like to type just two letters eq and get equation or equation*, which I use most of the times. Unfortunately, there are another two "undesirable" environments eqnarray and eqnarray*, which I never use (in fact, they are even not recommended).

Of course, I can type three letters equ and get what I want, but this is really much slower: e, q, and TAB are so easy to type by one hand. My guess was to look into latex.el file for possible solutions: in that file I commented all lines with eqnarray, eqnarray*. In result, C-c C-e does not show eqnarray* but still shows eqnarray.

I have no idea what to do further. Maybe there are better solutions instead of editing latex.el?

I know that using YASnippets one can bind eq to equation and so on. In fact, I need to modify that list in order to be able to change one environment to another by C-u C-C C-e.


Here is the solution proposed by ArashEsbati.

  • You should try out an autocompletion library like helm. – giordano Mar 23 '17 at 23:25
  • @gernot I wrote that it is not so convenient, you can press e, q TAB almost simultaneously by one hand. And, I do not know why, but unconsciously, for any environment I always type only first two letters, then press TAB and type another letter if I need. And I can't get rid of this habit. – cheyp Mar 24 '17 at 0:24
  • Maybe this answer here helps. – Arash Esbati Mar 24 '17 at 7:43
  • @ArashEsbati That's exactly the solution that I wanted. But, unfortunately, Emacs gives me some error with that piece of code. – cheyp Mar 24 '17 at 15:04
  • In Emacs, do M-x toggle-debug-on-error RET, trigger the error and update your question with the error(s) you get. Otherwise it is not possible to see what is happening. – Arash Esbati Mar 24 '17 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.