]> code.delx.au - gnu-emacs-elpa/blob - packages/auctex/style/psfig.el
Update AUCTeX ELPA package to the new 11.87 release.
[gnu-emacs-elpa] / packages / auctex / style / psfig.el
1 ;;; psfig.el - Support for the psfig style option.
2
3 ;; Contributed by Marc Gemis <makke@wins.uia.ac.be>
4 ;; Please direct comments to him.
5
6 ;;; Code:
7
8 (TeX-add-style-hook "psfig"
9 (function
10 (lambda ()
11 ;; probable some of the following symbols may be removed
12 (TeX-add-symbols "protect" "figurepath" "fbox"
13 "other" "letter" "other" "then" "Sine" "Cosine"
14 "psdraft" "psfull" "psscalefirst" "psrotatefirst"
15 "psnodraftbox" "psdraftbox" "pssilent" "psnoisy"
16 "minmaxtest"
17 '("psfig" TeX-arg-psfig)
18 '("psfigurepath" t)
19 )
20 (LaTeX-add-environments
21 '("psfigure" LaTeX-env-psfigure)
22 )
23 )))
24
25 (defun TeX-arg-psfig (optional)
26 "Ask for file, width and length. Insert psfig macro"
27 (let ((psfile (read-file-name "PS-file: " "" "" nil))
28 (figwidth (read-string "Figure width: "))
29 (figheight (read-string "Figure height: "))
30 )
31
32 (insert TeX-grop "figure=" psfile)
33 (if (not (zerop (length figwidth)))
34 (insert ",width=" figwidth))
35 (if (not (zerop (length figheight)))
36 (insert ",height=" figheight))
37 (insert TeX-grcl)
38 )
39 )
40
41
42 (defun LaTeX-env-psfigure (environment)
43 "Create with \\label and \\caption and \\psfig commands."
44 (let ((float (read-string "Float to: " LaTeX-float))
45 (caption (read-string "Caption: "))
46 (label (read-string "Label: " LaTeX-figure-label))
47 ; gf: ask if this should be centered
48 (psfile (read-file-name "PS-file: " "" "" nil))
49 (figwidth (read-string "Figure width: "))
50 (figheight (read-string "Figure height: "))
51 )
52
53 (setq LaTeX-float (if (zerop (length float))
54 LaTeX-float
55 float))
56
57 (LaTeX-insert-environment "figure"
58 (concat LaTeX-optop LaTeX-float LaTeX-optcl))
59
60 (insert TeX-esc "centerline" TeX-grop TeX-esc "psfig" TeX-grop
61 "figure=" psfile)
62 (if (not (zerop (length figwidth)))
63 (insert ",width=" figwidth))
64 (if (not (zerop (length figheight)))
65 (insert ",height=" figheight))
66 (insert TeX-grcl TeX-grcl)
67 (if (zerop (length caption))
68 ()
69 (newline-and-indent)
70 (insert TeX-esc "caption" TeX-grop caption TeX-grcl))
71 (if (or (zerop (length label))
72 (equal LaTeX-figure-label label))
73 ()
74 (newline-and-indent)
75 (insert TeX-esc "label" TeX-grop label TeX-grcl))
76
77 (forward-line 2)))
78
79 ;;; psfig.el ends here