blob: f1b7adc1e61a46d38866d3023add6a1ebf62bb66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
;;; prosper.el --- Prosper style file for AUCTeX -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
;; Authors: Phillip Lord<p.lord@russet.org.uk>
;; Nevin Kapur <nevin@jhu.edu>
;; Keywords: tex, wp, prosper
;; Version: 0.6
;; URL: http://www.mts.jhu.edu/~kapur/emacs/prosper.el
;; This is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;; Commentary:
;; This is a propser (http://prosper.sourceforge.net/) style file for
;; AUCTeX.
;;; Installation:
;;
;; For this file to work you need to have a working installation of
;; AucTeX. After that installtion is simple. Put this file into one of
;; the directories specified in `TeX-style-path', with the name
;; "style" rather than "auto" as it might get over written in the
;; latter.
;;
;; Then stick the current for into your .emacs
;; (eval-after-load "latex"
;; '(add-to-list 'LaTeX-style-list '("prosper")))
;;
;;
;; And that should be it. You check whether it's worked or not by
;; opening a prosper document, and trying `LaTeX-environment'. "slide"
;; should be available by tab completion and it should ask you about
;; overlays.
;;
;; The environment "prosper" should be inserted immediately after the
;; document environment. It will prompt you for options available
;; under prosper and create a skeleton document.
;;; Bugs:
;;
;; Currently the documentclass expansion doesn't work, unless you
;; enter a documentclass line to let auctex know which style files to
;; load. Then delete this and do it again. Not good. I know no way
;; around this.
;;; Code:
;; Constants:
;; This is partly working now, and it a little neater than it
;; was. The main problem is that the redefinition of "documentclass"
;; does not happen until its all too late, so that stuff never
;; happens correctly. This is easy enough to fix by fiddling with
;; auctex. I shall have to download the latest version, and see if
;; its already been fixed.
(require 'tex)
(require 'latex)
(defconst LaTeX-prosper-version "2008-05-25"
"prosper.el version.")
(defconst LaTeX-prosper-transition-styles '("Split"
"Blinds"
"Box"
"Wipe"
"Dissolve"
"Glitter"
"Replace")
"List of transition styles provided by prosper.")
(defconst LaTeX-prosper-slide-styles
'("alienglow" "autumn" "azure"
"contemporain" "darkblue" "default" "frames"
"lignesbleues" "nuancegris" "troispoints"
"alcatel" "gyom" "pascal" "rico"
))
(defun LaTeX-prosper-insert-title (_optional)
(newline)
(mapc (lambda(f)
(TeX-insert-macro f)
(newline))
'("title" "subtitle" "author" "email" "institution" "slideCaption"
"Logo" "DefaultTransition"))
(LaTeX-insert-environment "document")
(TeX-insert-macro "maketitle"))
;; Utility functions
(defun LaTeX-prosper-arg-pdftransition (_environment)
(let ((default
(if (boundp 'LaTeX-prosper-transition-history)
(car LaTeX-prosper-transition-history)
"Replace")))
(TeX-argument-insert
(completing-read
(TeX-argument-prompt nil
(format "Transition (Default %s) " default)
t)
(mapcar #'list LaTeX-prosper-transition-styles)
nil
t
nil
'LaTeX-prosper-transition-history
default)
nil)))
(defun LaTeX-prosper-slide-style-prompt()
(completing-read
"Slide Style?"
LaTeX-prosper-slide-styles
nil nil nil nil "default" ))
(defun LaTeX-prosper-insert-options(_environment)
(insert "[" )
(insert (LaTeX-prosper-slide-style-prompt) " ")
(mapc (lambda(f)
(if (y-or-n-p (car f))
(insert (car (cdr f)) " ")))
'(("Draft?" "draft")
("Color Slides?" "slideColor")
("Disable running total on each slide?" "nototal")
("Is the final version going to be PDF?" "pdf")
("Are you going to use Adobe Distiller" "distiller")))
(delete-char -1)
(insert "]"))
(defun LaTeX-prosper-insert-slide (_environment)
(if (y-or-n-p "Surround with overlay? ")
(progn (TeX-insert-macro "overlays")
(if (search-backward "{" 0 t)
(progn
(goto-char (+ 1 (point)))
(insert "%\n")))))
(let ((title (TeX-read-string "Title: ")))
(LaTeX-insert-environment "slide" (concat TeX-grop title TeX-grcl))))
;; AUCTeX configuration
(TeX-add-style-hook
"prosper"
(lambda ()
(LaTeX-add-environments
'("slide" LaTeX-prosper-insert-slide)
'("itemstep" LaTeX-env-item)
'("Itemize" LaTeX-env-item))
(TeX-add-symbols
'("documentclass"
LaTeX-prosper-insert-options
LaTeX-prosper-insert-title)
'("title" "Title of the presentation")
'("subtitle" "Subtitle of the presentation")
'("author" "Author name")
'("email" "Author email")
'("institution" "Author institution")
'("slideCaption" "Caption for slide")
'("Logo" "Logo")
'("displayVersion" TeX-arg-free)
'("DefaultTransition"
LaTeX-prosper-arg-pdftransition)
'("NoFrenchBabelItemize" TeX-arg-free)
'("part" LaTeX-prosper-arg-part)
'("overlays" "Number of overlays" t)
'("FontTitle" "Color slides" "Black & White Slides")
'("FontText" "Color slides" "Black & White Slides")
'("fontTitle" "Text")
'("fontText" "Text")
'("ColorFoot" "Color")
'("PDFtransition" LaTeX-prosper-arg-pdftransition)
'("myitem" "Level" "Definition")
'("fromSlide" "Number" t)
'("fromSlide*" "Number" t)
'("onlySlide" "Number" t)
'("onlySlide*" "Number" t)
'("OnlySlide" "Number")
'("UntilSlide" "Number")
'("untilSlide*" "Number")
'("PDForPS" TeX-arg-conditional)
'("onlyInPS" t)
'("onlyInPDF" t)
'("FromSlide" "Number")))
TeX-dialect)
;;; prosper.el ends here
|