>From cc87c5a07e4935123cf114c9125fe302fe85c7af Mon Sep 17 00:00:00 2001 From: Uwe Brauer
Date: Sat, 13 Aug 2016 12:29:08 +0000 Subject: [PATCH] Add style exam.el --- style/exam.el | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 style/exam.el diff --git a/style/exam.el b/style/exam.el new file mode 100644 index 0000000..f89f6bb --- /dev/null +++ b/style/exam.el @@ -0,0 +1,68 @@ +;;; exam.el --- AUCTeX style for the (LaTeX) exam package + +;; Copyright (C) 2003, 2004, 2005, 2008, 2015 Free Software Foundation + +;; Author: Uwe Brauer +;; Created: 20153-03-06 +;; Keywords: tex + +;; This file is part of AUCTeX. + +;; AUCTeX is free software; you can redistribute it and/or modify it +;; under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; AUCTeX is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with AUCTeX; see the file COPYING. If not, write to the Free +;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +;; 02110-1301, USA. + +;;; Commentary: + +;; This file adds support for the exam package. + +;;; Code: + +(defvar LaTeX-exam-package-options '("answers" "rldocuement") + "Package options for the exam package.") + +(TeX-add-style-hook "exam" + (lambda () + (LaTeX-add-environments "questions") + (LaTeX-add-environments "solution") + (LaTeX-add-environments "solutionorbox") + (LaTeX-add-environments "parts") + (LaTeX-add-environments "subparts") + (LaTeX-add-environments "subsubparts") + (TeX-add-symbols + '("droppoints" 0) + '("part" TeX-arg-examn-points 0) + '("subpart" TeX-arg-examn-points 0) + '("subsubpart" TeX-arg-examn-points 0) + '("question" TeX-arg-examn-points 0) + '("droptotalpoints" 0) + '("question" 1) + '("RL" 1) + '("titledquestion" "Title" ["Points"] reftex-label) + '("question" ["Points"] reftex-label))) + LaTeX-dialect) + + + + + +(defun TeX-arg-examn-points (optional &optional prompt) + "Prompt for overlay specification and optional argument." + (let ((options (read-input "Points: "))) + (if (not (zerop (length options))) + (progn (insert "[" options "]"))) + (indent-according-to-mode))) + + +;;; exam.el ends here -- 1.9.1