Mercurial > hg > xemacs-beta
comparison lisp/auctex/style/psfig.el @ 100:4be1180a9e89 r20-1b2
Import from CVS: tag r20-1b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:15:11 +0200 |
parents | 4103f0995bd7 |
children |
comparison
equal
deleted
inserted
replaced
99:2d83cbd90d8d | 100:4be1180a9e89 |
---|---|
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-input "Figure width: ")) | |
29 (figheight (read-input "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-input "Float to: " LaTeX-float)) | |
45 (caption (read-input "Caption: ")) | |
46 (label (read-input "Label: " LaTeX-figure-label)) | |
47 ; gf: ask if this should be centered | |
48 (psfile (read-file-name "PS-file: " "" "" nil)) | |
49 (figwidth (read-input "Figure width: ")) | |
50 (figheight (read-input "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 |