1 ;;; emp.el --- AUCTeX support for emp.sty
3 ;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 ;; Author: Yvon Henel aka TeXnicien de surface <Yvon.Henel@wanadoo.fr>
6 ;; Maintainer: auctex-devel@gnu.org
9 ;; This file is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 3, or (at your option)
14 ;; This file is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to
21 ;; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
24 ;; version 1.0 2004-03-04
29 (TeX-add-style-hook "emp"
32 (TeX-add-symbols "empuse" "empTeX" "empaddtoTeX"
33 "emprelude" "empaddtoprelude" "unitlength"
35 (LaTeX-add-environments
36 '("empfile" LaTeX-env-empfile)
37 '("emp" LaTeX-env-emp-gen)
38 '("empdef" LaTeX-env-emp-gen)
39 '("empgraph" LaTeX-env-emp-gen)
43 (defun LaTeX-env-emp-gen (environment-name)
44 "Ask for file, width and length. Insert environment-name environment
45 Used for emp, empdef, and empgraph environments."
46 (let ((emp-fig-name (read-string "figure name: " ""))
47 (emp-fig-width (read-string "figure width: " "1" ))
48 (emp-fig-height (read-string "figure height: " "1" ))
49 ;;; emp.sty demands a width and a height for each of the
50 ;;; emp, empdef, and empgraph environments
51 ;;; we give them 1 by default
52 ;;; not necessarily the best thing to do?
54 (if (not (zerop (length emp-fig-name)))
56 (setq LaTeX-emp-fig-name (concat LaTeX-optop emp-fig-name LaTeX-optcl))
57 (LaTeX-insert-environment environment-name LaTeX-emp-fig-name))
58 (LaTeX-insert-environment environment-name))
61 (insert "(" emp-fig-width "," emp-fig-height ")")
63 (indent-according-to-mode)
66 (defun LaTeX-env-empfile (optional)
67 "Ask for file. Insert empfile environment"
68 (let ((empfile (read-string "empfile: " "")))
69 (if (not (zerop (length empfile)))
71 (setq LaTeX-emp-file-name (concat LaTeX-optop empfile LaTeX-optcl))
72 (setq mpost-emp-file-name (concat empfile ".mp"))
73 (LaTeX-insert-environment "empfile" LaTeX-emp-file-name))
75 (setq mpost-emp-file-name "\\jobname")
76 (LaTeX-insert-environment "empfile")))
77 (if LaTeX-write18-enabled-p
82 (insert "\\immediate\\write18{mpost -tex=latex " mpost-emp-file-name TeX-grcl)