auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX] Adding new environments to


From: Tyler Smith
Subject: [AUCTeX] Adding new environments to
Date: Thu, 16 Dec 2010 21:38:26 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hi,

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.

I've added some code to my .emacs (below). It seems to do what I need. My
questions for you are:

1. Does this look like a sensible solution?

2. Is there some way to incorporate this into Auctex proper, either by
adding customization options or hard-wiring the new environments into
LaTeX-environment-list. I couldn't actually find where this variable is
initialized in the auctex directory.

(defun my-LaTeX-hook ()
  (TeX-PDF-mode)
  (auto-fill-mode)
  (face-remap-set-base 'default '(:family "Verdana" :height 140))
  (setq TeX-command-default "PdfLatex")
  (push '("choices" . LaTeX-insert-choice) LaTeX-item-list)
  (push '("parts" . LaTeX-insert-part) LaTeX-item-list)
  (push '("questions" . LaTeX-insert-question) LaTeX-item-list)
  (push '(("choices" LaTeX-env-item)) LaTeX-environment-list)
  (push '(("questions" LaTeX-env-item)) LaTeX-environment-list)
  (push '(("parts" LaTeX-env-item)) LaTeX-environment-list))

(add-hook 'LaTeX-mode-hook 'my-LaTeX-hook)

(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 " ")))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]