How can I customize LaTeX-item-list?
Asked Answered
K

2

7

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?

Kunin answered 3/12, 2013 at 21:16 Comment(0)
P
4

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.

Parthenogenesis answered 5/12, 2013 at 15:34 Comment(1)
Perfect! Thanks a lot. I'll vote up your answer once I've gained enough credit :-)Kunin
K
1

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.

Kilauea answered 3/12, 2013 at 21:22 Comment(1)
Thanks for the quick response, but doing so makes LaTeX freeze during compilation. I want to have \ex only inside the {exe}-environment because \item won't work there, but i still need \item in the other environmentsKunin

© 2022 - 2024 — McMap. All rights reserved.