;;; ifthen.el --- AUCTeX style for `ifthen.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 `ifthen.sty' ;;; Code: (TeX-add-style-hook "ifthen" (lambda () (TeX-auto-add-type "boolean" "LaTeX") (setq LaTeX-auto-regexp-list (append '(("\\\\\\(new\\|provide\\)boolean *{?\\([A-Za-z]+\\)}?" 2 LaTeX-auto-boolean)) LaTeX-auto-regexp-list)) (TeX-add-symbols '("ifthenelse" 3) "and" "not" "or" '("equal" 2) '("isundefined" TeX-arg-macro) '("lengthtest" t) '("boolean" t) '("newboolean" TeX-arg-define-boolean) '("setboolean" TeX-arg-boolean "Value (true or false, case insensitive)") '("whiledo" 2)) ;; Fontification (when (and (featurep 'font-latex) (eq TeX-install-font-lock 'font-latex-setup)) (font-latex-add-keywords '(("ifthenelse" "{{{") ("isundefined" "{") ("newboolean" "{") ("setboolean" "{{") ("whiledo" "{{") ("lengthtest" "{{")) 'function) ;; Tell font-lock about the update. (setq font-lock-set-defaults nil) (font-lock-set-defaults)))) ;; the following two functions were adapted from `TeX-arg-counter' and ;; `TeX-arg-define-counter' (defun TeX-arg-define-boolean (optional &optional prompt) "Prompt for a LaTeX boolean. If OPTIONAL is non-nil, insert the resulting value as an optional argument, otherwise as a mandatory one. Use PROMPT as the prompt string." (TeX-arg-boolean optional prompt t)) (defun TeX-arg-boolean (optional &optional prompt definition) "Prompt for a LaTeX boolean. If OPTIONAL is non-nil, insert the resulting value as an optional argument, otherwise as a mandatory one. Use PROMPT as the prompt string. If DEFINITION is non-nil, add the chosen boolean to the list of defined booleans." (let ((boolean (completing-read (TeX-argument-prompt optional prompt "Boolean") (LaTeX-boolean-list)))) (if (and definition (not (string-equal "" boolean))) (LaTeX-add-booleans boolean)) (TeX-argument-insert boolean optional))) (defvar LaTeX-ifthen-package-options nil "Package options for ifthen.") ;; ifthen.el ends here