1 ;;; psfig.el - Support for the psfig style option.
3 ;; Contributed by Marc Gemis <makke@wins.uia.ac.be>
4 ;; Please direct comments to him.
8 (TeX-add-style-hook "psfig"
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"
17 '("psfig" TeX-arg-psfig)
20 (LaTeX-add-environments
21 '("psfigure" LaTeX-env-psfigure)
26 (defun TeX-arg-psfig (optional)
27 "Ask for file, width and length. Insert psfig macro"
28 (let ((psfile (read-file-name "PS-file: " "" "" nil))
29 (figwidth (read-string "Figure width: "))
30 (figheight (read-string "Figure height: "))
33 (insert TeX-grop "figure=" psfile)
34 (if (not (zerop (length figwidth)))
35 (insert ",width=" figwidth))
36 (if (not (zerop (length figheight)))
37 (insert ",height=" figheight))
43 (defun LaTeX-env-psfigure (environment)
44 "Create with \\label and \\caption and \\psfig commands."
45 (let ((float (read-string "Float to: " LaTeX-float))
46 (caption (read-string "Caption: "))
47 (label (read-string "Label: " LaTeX-figure-label))
48 ; gf: ask if this should be centered
49 (psfile (read-file-name "PS-file: " "" "" nil))
50 (figwidth (read-string "Figure width: "))
51 (figheight (read-string "Figure height: "))
54 (setq LaTeX-float (if (zerop (length float))
58 (LaTeX-insert-environment "figure"
59 (concat LaTeX-optop LaTeX-float LaTeX-optcl))
61 (insert TeX-esc "centerline" TeX-grop TeX-esc "psfig" TeX-grop
63 (if (not (zerop (length figwidth)))
64 (insert ",width=" figwidth))
65 (if (not (zerop (length figheight)))
66 (insert ",height=" figheight))
67 (insert TeX-grcl TeX-grcl)
68 (if (zerop (length caption))
71 (insert TeX-esc "caption" TeX-grop caption TeX-grcl))
72 (if (or (zerop (length label))
73 (equal LaTeX-figure-label label))
76 (insert TeX-esc "label" TeX-grop label TeX-grcl))
80 ;;; psfig.el ends here