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)
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: "))
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))
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: "))
53 (setq LaTeX-float (if (zerop (length float))
57 (LaTeX-insert-environment "figure"
58 (concat LaTeX-optop LaTeX-float LaTeX-optcl))
60 (insert TeX-esc "centerline" TeX-grop TeX-esc "psfig" TeX-grop
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))
70 (insert TeX-esc "caption" TeX-grop caption TeX-grcl))
71 (if (or (zerop (length label))
72 (equal LaTeX-figure-label label))
75 (insert TeX-esc "label" TeX-grop label TeX-grcl))
79 ;;; psfig.el ends here