]> code.delx.au - gnu-emacs-elpa/blob - auctex-11.86/style/emp.el
Initial repository contents
[gnu-emacs-elpa] / auctex-11.86 / style / emp.el
1 ;;; emp.el --- AUCTeX support for emp.sty
2
3 ;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.
4
5 ;; Author: Yvon Henel aka TeXnicien de surface <Yvon.Henel@wanadoo.fr>
6 ;; Maintainer: auctex-devel@gnu.org
7 ;; Keywords: tex
8
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)
12 ;; any later version.
13
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.
18
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.
23
24 ;; version 1.0 2004-03-04
25
26 ;;; Code:
27
28
29 (TeX-add-style-hook "emp"
30 (function
31 (lambda ()
32 (TeX-add-symbols "empuse" "empTeX" "empaddtoTeX"
33 "emprelude" "empaddtoprelude" "unitlength"
34 )
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)
40 '("empcmds")
41 ))))
42
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?
53 )
54 (if (not (zerop (length emp-fig-name)))
55 (progn
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))
59 (forward-line -1)
60 (end-of-line)
61 (insert "(" emp-fig-width "," emp-fig-height ")")
62 (forward-line 1)
63 (indent-according-to-mode)
64 ))
65
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)))
70 (progn
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))
74 (progn
75 (setq mpost-emp-file-name "\\jobname")
76 (LaTeX-insert-environment "empfile")))
77 (if LaTeX-write18-enabled-p
78 (progn
79 (forward-line 1)
80 (end-of-line)
81 (newline-and-indent)
82 (insert "\\immediate\\write18{mpost -tex=latex " mpost-emp-file-name TeX-grcl)
83 (forward-line -2)))))
84 ;;; emp.el ends here