[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX] Re: Adding new environments to
From: |
Tyler Smith |
Subject: |
[AUCTeX] Re: Adding new environments to |
Date: |
Wed, 22 Dec 2010 16:18:23 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Ralf Angeli <address@hidden> writes:
> * Tyler Smith (2010-12-17) writes:
>
>> I'm using Auctex to prepare tests using the exam class. This introduces
>> several new 'list'-like environments: questions, choices, and parts. I
>> want Auctex to treat these like enumerate, list or description
>> environments, including adding the appropriate 'item' macro. However,
>> from my reading of the code, there is no user-friendly way to access the
>> appropriate variables.
>
> Instead of reading the code, try reading the manual. (c;
>
*facepalm*
Thanks. I knew there must be an easier way.
I still have some questions. I can now use LaTeX-add-environments to get
choices, questions and parts included in AucTex when I insert new
environments.
I don't understand how the style files work though. I used the example
from the manual as a template, and put my own tws.el file in the default
style file directory "/home/tyler/.emacs.d/auctex/style" (which is listed in
TeX-style-path):
(TeX-add-style-hook
"latex"
(lambda ()
(LaTeX-add-environments
'("choices" LaTeX-env-item)
'("questions" LaTeX-env-item)
'("parts" LaTeX-env-item))))
(defun LaTeX-insert-choice ()
"Insert the \choice macro within the choices environment."
(let ((TeX-insert-braces ()))
(TeX-insert-macro "choice")
(insert " ")))
(defun LaTeX-insert-part ()
"Insert the \part macro within the parts environment."
(let ((TeX-insert-braces ()))
(TeX-insert-macro "part")
(insert " ")))
(defun LaTeX-insert-question ()
"Insert the \question macro within the questions environment."
(let ((TeX-insert-braces ()))
(TeX-insert-macro "question")
(insert " ")))
However, this doesn't appear to get run when I open a .tex file. Once
I'm visiting a .tex file I can evaluate the commands in the minibuffer
to get the behaviour I want, but the code is definitely not getting
evaluated automatically. What am I missing?
Thanks!
Tyler