annotate lisp/auctex/style/epsf.el @ 24:4103f0995bd7 r19-15b95

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