;;; enumerate.el --- AUCTeX style for `enumerate.sty' ;; Copyright (C) 2013 Free Software Foundation, Inc. ;; Author: Mads Jensen ;; Maintainer: address@hidden ;; 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 `enumerate.sty' ;;; Code: (TeX-add-style-hook "enumerate" (lambda () ;; enumerate just offers the oppertunity to modify how the ;; enumeration in the enumerate environment takes place (add-hook 'LaTeX-after-insert-env-hooks 'LaTeX-enumerate-after-insert-env-hook))) (defun LaTeX-enumerate-after-insert-env-hook (env start end) "Hook to insert the formatting string for the enumerate environment" (when (string-equal env "enumerate") (let ((fmt (read-string (TeX-argument-prompt t "Formatting string for the environment (tokens: A, a, I, i or 1)" nil)))) (when (not (zerop (string-width fmt))) (save-excursion ;; so the \\item is put in the right place (goto-char (+ 1 start (length (concat "\begin{" env "}")))) ;; for some reason, TeX-argument-insert barfs about char-or-string-p ;; so this is the best alternative ... (if (not (zerop (length fmt))) (insert (format "%s" (concat LaTeX-optop fmt LaTeX-optcl))))))))) (defvar LaTeX-enumerate-package-options nil "Package options for enumerate.") ;; enumerate.el ends here