Re: help with LaTeX-add-environment for pspicture

Ralf Angeli <[email protected]>
Newsgroups gmane.emacs.auc-tex
Message-ID <[email protected]>
* Patrick Drechsler (2005-01-29) writes:

> I'm trying to customize an environment so that pressing `C-c C-e'
> offers me the correct behavior for the pspicture
> environment. The problem I'm having is that the syntax for this
> environment is a bit different from LaTeX default
> environments. `pspicture' has a mandatory and an optional
> argument which are both set in parenthesis. The two arguments
> define the picture size (x0,y0)(x1,y1). When the optional
> argument (x0,y0) is dropped x0 and y0 are set to (0,0) by
> PSTricks.
[...]
> Besides the fact that I do not really understand how the above
> works (I'm just experimenting with stuff I found in beamer.el) I
> haven't been able to squeeze the mandatory argument in.

Does the following function do what you want?

(lambda (env &rest ignore)
  (LaTeX-insert-environment
   env
   (let ((lower-left (read-input "(Optional) Lower left corner (x0,y0): "))
	 (upper-right (read-input "Upper right corner (x1,y1): ")))
     (concat (unless (zerop (length lower-left)) (format "(%s)" lower-left))
	     (format "(%s)" upper-right)))))

-- 
Ralf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.