How can I customize LaTeX-item-list?

514 views Asked by At

I use auctex to write linguistic texts with many examples using the exe-environment which looks like this:

\begin{exe}  
 \ex (some text, glossed examples, etc.)
\end{exe}

Now, i'd like to have LaTeX-insert-item, bound to M-RET, to automatically insert \ex instead of \item in this environment, as it does with the description-environment and others. Documentation tells me i can customize LaTeX-item-list in order to achieve this, but

  1. when i try customize-variable RET LaTeX-item-list i get a "no match" error
  2. the documentation of LaTeX-item-list states it is "A list of environments where items have a special syntax.

The cdr is the name of the function, used to insert this kind of items."
Now i read those lists have a syntax of the form (car . cdr), so my guess is that i should put in my .emacs-file something along the lines of

setq LaTeX-item-list (quote ("exe" . "function-to-insert-\ex-label")))

but my actual knowledge of elisp is rather thin so i'm really not sure if that's the right way. Could someone please help me out here?

2

There are 2 answers

1
Tobias On BEST ANSWER

You can put the following into your .emacs file:

(add-hook 'LaTeX-mode-hook '(lambda ()
     (add-to-list 'LaTeX-item-list
          '("exe" lambda () (let (TeX-insert-braces) (TeX-insert-macro "ex"))))))

Very well prepared question.

1
arodrisa On

I don't really know why you want to use \ex instead of \item. Anyway try using \renewcommand. In your case you will need this: \renewcommand{item}{ex} Hope this will work for you.