[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX] Re: creating a new evironment command
From: |
Stephen Eglen |
Subject: |
[AUCTeX] Re: creating a new evironment command |
Date: |
Wed, 07 Jun 2006 11:40:19 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
"Ryan Krauss" <address@hidden> writes:
> I am using AUCTeX with beamer (a great Latex package for
> presentations), and I need to create a new custom command sort of like
> inserting a figure environment. Each frame in a presentation has the
> form
>
> \frame{
> \frametitle{Title}
>
> contents
>
> }
>
> How can I set up a command like the one used to insert a figure that
> prompts me for the frametitle and then puts the cursor in the contents
> area?
Dear Ryan,
Here's what I use (nb it doesn't prompt you for the title, but leaves
you in the right spot for it).
Stephen
(defun beamer-template-frame ()
"Create a simple template and move point to after \\frametitle."
(interactive)
(LaTeX-environment-menu "frame")
(insert "\\frametitle{}")
(backward-char 1))
(eval-after-load "tex"
'(TeX-add-style-hook "beamer" 'my-beamer-mode))
(defun my-beamer-mode ()
"My adds on for when in beamer."
;; when in a Beamer file I want to use pdflatex.
;; Thanks to Ralf Angeli for this.
(TeX-PDF-mode 1) ;turn on PDF mode.
;; Tell reftex to treat \lecture and \frametitle as section commands so that
;; C-c = gives you a list of frametitles and you can easily navigate around
;; the list of frames.
;; If you change reftex-section-level, reftex needs to be reset so that
;; reftex-section-regexp is correctly remade.
(require 'reftex)
(set (make-local-variable 'reftex-section-levels)
'(("lecture" . 1) ("frametitle" . 2)))
(reftex-reset-mode)
;; add some extra functions.
(define-key LaTeX-mode-map "\C-cf" 'beamer-template-frame)
(define-key LaTeX-mode-map "\C-\M-x" 'tex-frame)
)
(defun tex-frame ()
"Run pdflatex on current frame.
Frame must be declared as an environment."
(interactive)
(let (beg)
(save-excursion
(search-backward "\\begin{frame}")
(setq beg (point))
(forward-char 1)
(LaTeX-find-matching-end)
(TeX-pin-region beg (point))
(letf (( (symbol-function 'TeX-command-query) (lambda (x) "LaTeX")))
(TeX-command-region))
)
))
- [AUCTeX] creating a new evironment command, Ryan Krauss, 2006/06/06
- Re: [AUCTeX] creating a new evironment command, David Kastrup, 2006/06/06
- [AUCTeX] Re: creating a new evironment command,
Stephen Eglen <=
- Re: [AUCTeX] Re: creating a new evironment command, Ryan Krauss, 2006/06/07
- Re: [AUCTeX] Re: creating a new evironment command, Ralf Angeli, 2006/06/07
- Message not available
- Re: [AUCTeX] Re: creating a new evironment command, Ralf Angeli, 2006/06/08
- Re: [AUCTeX] Re: creating a new evironment command, Stephen Eglen, 2006/06/08
- Re: [AUCTeX] Re: creating a new evironment command, Ralf Angeli, 2006/06/08
- Re: [AUCTeX] Re: creating a new evironment command, Stephen Eglen, 2006/06/09
- Re: [AUCTeX] Re: creating a new evironment command, Ralf Angeli, 2006/06/10