24
|
1 ;;; epsf.el - Support for the epsf style option.
|
|
2
|
|
3 ;; Contributed by Marc Gemis <makke@wins.uia.ac.be>
|
|
4
|
|
5 ;;; Code:
|
|
6
|
|
7 (TeX-add-style-hook "epsf"
|
|
8 (function
|
|
9 (lambda ()
|
|
10 (TeX-add-symbols
|
|
11 '("epsfsize" TeX-arg-epsfsize)
|
|
12 '("epsffile" TeX-arg-file)
|
|
13 '("epsfbox" TeX-arg-file)
|
|
14 "epsflly" "epsfury" "testit" "epsfgetlitbb"
|
|
15 "epsfnormal" "epsfgetbb" "other" "epsfsetgraph"
|
|
16 "PsFragSpecialArgs" "epsfaux" "testit" "epsfgrab"
|
|
17 "epsfllx" "epsflly" "epsfury" "epsfverbosetrue"
|
|
18 )
|
|
19 (LaTeX-add-environments
|
|
20 '("epsffig" LaTeX-env-epsffigure)
|
|
21 )
|
|
22
|
|
23 )))
|
|
24
|
|
25
|
|
26 (defun LaTeX-env-epsffigure (environment)
|
|
27 "Create a `figure'-environment with \\label and \\caption and \\epsfbox
|
|
28 commands. Eventually a `psfrags'-environment is inserted round the \\epsfbox."
|
|
29
|
|
30 (let ((float (read-input "Float to: " LaTeX-float))
|
|
31 (caption (read-input "Caption: "))
|
|
32 (label (read-input "Label: " LaTeX-figure-label))
|
|
33 ; gf: ask if there is an psfrag environment needed
|
|
34 (psfrag (y-or-n-p "PS fragments: "))
|
|
35 (psfile (read-file-name "EPS-file: " "" "" nil))
|
|
36 )
|
|
37
|
|
38 (setq LaTeX-float (if (zerop (length float))
|
|
39 LaTeX-float
|
|
40 float))
|
|
41
|
|
42 (LaTeX-insert-environment "figure"
|
|
43 (concat LaTeX-optop LaTeX-float LaTeX-optcl))
|
|
44 (LaTeX-insert-environment "center")
|
|
45 (if psfrag
|
|
46 (progn
|
|
47 (LaTeX-insert-environment "psfrags")
|
|
48 (newline-and-indent)
|
|
49 ))
|
|
50 (if (or (zerop (length label))
|
|
51 (and (string= "figure" environment)
|
|
52 (equal LaTeX-figure-label label))
|
|
53 )
|
|
54 ()
|
|
55 (newline-and-indent)
|
|
56 (insert TeX-esc "label" TeX-grop label TeX-grcl)
|
|
57 (end-of-line 0)
|
|
58 (LaTeX-indent-line))
|
|
59
|
|
60
|
|
61 (newline-and-indent)
|
|
62 (insert TeX-esc "leavevmode")
|
|
63 (newline-and-indent)
|
|
64 (insert TeX-esc "epsfbox" TeX-grop psfile TeX-grcl)
|
|
65 (if (zerop (length caption))
|
|
66 ()
|
|
67 (newline-and-indent)
|
|
68 (insert TeX-esc "caption" TeX-grop caption TeX-grcl))
|
|
69 (newline)
|
|
70 (forward-line 4)
|
|
71 (newline)
|
|
72
|
|
73 ))
|
|
74
|
|
75 (defun TeX-arg-epsfsize (optional &optional prompt definition)
|
|
76 "Create a line that print epsf figures at a certain percentage"
|
|
77 (interactive)
|
|
78 (let ((scale (read-input "Scale (%): "))
|
|
79 )
|
|
80 (setq scalestr (if (zerop (length scale))
|
|
81 "75"
|
|
82 (format "%s" scale)
|
|
83 ))
|
|
84 (save-excursion
|
|
85 ; append #1#{scale#1}
|
|
86 (insert "#1#2" TeX-grop "0." scale "#1" TeX-grcl)
|
|
87 ; insert \def before \epsfsize
|
|
88 (beginning-of-line 1)
|
|
89 (newline)
|
|
90 (insert TeX-esc "def")
|
|
91 (forward-line -1)
|
|
92 (insert "% From now on print figures at " scale "% of original size")
|
|
93 )
|
|
94 (end-of-line)))
|
|
95
|
|
96 ;;; epsf.el ends here
|