# HG changeset patch # User Uwe Brauer # Date 1478685071 0 # Wed Nov 09 09:51:11 2016 +0000 # Node ID 712a4e576df8416dd8b0df4edddf01f0df2122b4 # Parent e37527510e63bb0a4fcd64db2ab385a6f7fda5f2 Add style/exam.el and entry in Makefile.in * Makefile.in (STYLESRC): Add exam.el * style/exam.el: Add new style file. diff --git a/Makefile.in b/Makefile.in --- a/Makefile.in +++ b/Makefile.in @@ -157,7 +157,7 @@ style/splitidx.el style/tikz.el style/xcolor.el \ style/pdflscape.el style/commath.el style/empheq.el \ style/framed.el style/paracol.el style/menukeys.el \ - style/bidi.el + style/bidi.el style/exam.el STYLEELC = $(STYLESRC:.el=.elc) diff --git a/style/exam.el b/style/exam.el new file mode 100644 --- /dev/null +++ b/style/exam.el @@ -0,0 +1,71 @@ +;;; exam.el --- AUCTeX style for the (LaTeX) exam class + + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; Author: Uwe Brauer +;; Created: 2016-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 class. + +;;; Code: + + + +(defvar LaTeX-exam-class-options '("answers" "addpoints") + "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 + '("part" TeX-arg-examn-points 0) + '("subpart" TeX-arg-examn-points 0) + '("subsubpart" TeX-arg-examn-points 0) + '("question" ["Points"] reftex-label) + '("titledquestion" "Title" ["Points"] reftex-label) + '("question" TeX-arg-examn-points 0) + '("droptotalpoints" 0) + '("droppoints" 0) + )) + 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