Re: beamer: completion for \usetheme and \usecolortheme
Reiner Steib <[email protected]>
| Newsgroups | gmane.emacs.auc-tex |
|---|---|
| Organization | Dept. of Theoretical Physics, University of Ulm |
| Message-ID | <[email protected]> |
On Wed, Mar 02 2005, Masayuki Ataka wrote:
> This is a quick hack, but we can get the list of beamer's theme name.
[...]
Thanks. Below[1] is my version `LaTeX-beamer-search-themes' based on
your suggestion.
> We can get beamercolotheme*, beamerfonttheme*, beameroutertheme*,
> and so forth. (Maybe, we should remove themes which start small
> letter from list of themes, because they are still available only
> for backward compatibility.)
ACK. See the results[2] of calling `LaTeX-beamer-search-themes' with
various arguments.
> If "beamer.cls" is in `/ush/share/texmf/tex/latex/beamer/base/',
> then beamer theme files would be in "../themes/theme"
> (relative path from `beamer.cls').
I think the user can also put his on beamer*theme.sty files in his
texmf tree (or in TEXINPUTS).
When I added completion for \includegraphics{}, some people complained
that such a completion function is too slow for them. Therefore I'd
like to make the completion customizable:
(defcustom LaTeX-beamer-themes 'LaTeX-beamer-search-themes
"Presentation themes for the LaTeX beamer package.
It can be a list of themes or a function. If it is the symbol
`once' search only once per Emacs session."
:group 'LaTeX-macro
:type '(choice (const :tag "TeX search" LaTeX-beamer-search-themes)
(const :tag "Search once per session" 'once)
(function :tag "Other function")
(list (set :inline t
(const "Antibes")
(const "Bergen")
;; [...]
(const "Szeged")
(const "Warsaw"))
(repeat :inline t
:tag "Other"
(string)))))
But when I choose "List" from the value menu in customize, I get:
"invalid ((nil nil))". What am I doing wrong?
Bye, Reiner.
[1]
(defun LaTeX-beamer-search-themes (&optional regexp extensions length)
"Search for beamer themes matching REGEXP with EXTENSIONS.
The function removes the first LENGTH characters and the
extension of the file and returns a list of strings. LENGTH may
also be a string. Then the length of the string is used."
(let* ((match (or regexp "^beamertheme[A-Z]"))
(exts (or extensions '("tex" "sty")))
(chars (cond ((integerp length)
length)
((stringp length)
(string-width length))
;; Try some DWIM magic...
((and (not length)
(string-match "beamer[A-Za-z0-9]*theme" match))
(- (match-end 0) (match-beginning 0)))
(t (error "Invalid length")))))
;; (message "match=`%s' chars=`%s'" match chars)
(TeX-delete-duplicate-strings
(delete nil
(mapcar
(lambda (file)
(let ((case-fold-search nil))
(and (numberp (string-match match file))
(substring file chars))))
(TeX-search-files nil exts t t))))))
[2]
ELISP> (LaTeX-beamer-search-themes "^beamertheme[A-Z]")
("Antibes" "Bergen" "Berkeley" "Berlin" "Boadilla" "Copenhagen"
"Darmstadt" "Dresden" "Frankfurt" "Goettingen" "Hannover" "Ilmenau"
"JuanLesPins" "Luebeck" "Madrid" "Malmoe" "Marburg" "Montpellier"
"PaloAlto" "Pittsburgh" "Rochester" "Singapore" "Szeged" "Warsaw")
ELISP> (LaTeX-beamer-search-themes)
[ the same ]
ELISP> (LaTeX-beamer-search-themes "^beamerinnertheme")
("circles" "default" "inmargin" "rectangles" "rounded")
ELISP> (LaTeX-beamer-search-themes "^beameroutertheme")
("default" "infolines" "miniframes" "shadow" "sidebar" "smoothbars"
"smoothtree" "split" "tree")
ELISP> (LaTeX-beamer-search-themes "^beamercolortheme")
("albatross" "beetle" "crane" "default" "dolphin" "dove" "fly" "lily"
"orchid" "rose" "seagull" "seahorse" "sidebartab" "structure" "whale")
ELISP> (LaTeX-beamer-search-themes "^beamerfonttheme")
("default" "professionalfonts" "serif" "structurebold"
"structureitalicserif" "structuresmallcapsserif")
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/