[ESS] ess-swv "features"

Vitalie S. spinuvit.list at gmail.com
Tue Mar 1 14:53:11 CET 2011


<Ross.Darnell at csiro.au> writes:

> I recently downloaded the emacs and friends bundle from Vincent Goulet's site.
> I noticed that the default pdflatex option is to use texi2pdf.  I can change
> that by reordering the list in the ess-swv.el . But how can I do this is my
> own .emacs or site file to avoid upgrade issues?
>  I tried using the options menu but it seems to be ignored.
> ;; Part of code in ess-swv I changed.
> (custom-set-variables
>   ;; custom-set-variables was added by Custom.
>   ;; If you edit it by hand, you could mess it up, so be careful.
>   ;; Your init file should contain only one such instance.
>   ;; If there is more than one, they won't work right.
>  '(ess-swv-pdflatex-commands (quote ("pdflatex" "texi2pdf" "make"))))

Just put into your .emacs:

(setq ess-swv-pdflatex-commands '("pdflatex" "make"))


>
> Secondly, how can I stop pdflatex commands from executing the pdf viewer
> application?  I use docview and I certainly don't want acroread (which is my
> default windows pdf viewer.. I guess I can change to Sumatra or evince but
> they have problems rendering some fonts)

This is and in-build functionality so you will have to modify the ess-swv-PDF and
put it into your .emacs. Something along these lines (I've just removed the shell
call to the default reader):

(defun ess-swv-PDF (&optional pdflatex-cmd)
  "From LaTeX file, create a PDF (via 'texi2pdf' or 'pdflatex', ...), by
default using the first entry of `ess-swv-pdflatex-commands' and display it."
  (interactive
   (list
    (let ((def (elt ess-swv-pdflatex-commands 0)))
      (completing-read (format "pdf latex command (%s): " def)
		       ess-swv-pdflatex-commands ; <- collection to choose from
		       nil 'confirm ; or 'confirm-after-completion
		       nil nil def))))
  (let* ((buf (buffer-name))
	 (namestem (file-name-sans-extension (buffer-file-name)))
	 (latex-filename (concat namestem ".tex"))
	 (tex-buf (get-buffer-create " *ESS-tex-output*"))
	 (pdfviewer (ess-get-pdf-viewer))
	 (pdf-status))
    ;;(shell-command (concat "pdflatex " latex-filename))
    (message "Running '%s' on '%s' ..." pdflatex-cmd latex-filename)
    (switch-to-buffer tex-buf)
    (setq pdf-status
	  (call-process pdflatex-cmd nil tex-buf 1
			(if (string= "texi2" (substring pdflatex-cmd 0 5))
			    ;; workaround (bug?): texi2pdf or texi2dvi *fail* to work with full path:
			    (file-name-nondirectory latex-filename)
			  latex-filename)))
    (if (not (= 0 pdf-status))
	(message "** OOPS: error in '%s' (%d)!" pdflatex-cmd pdf-status)
      ;; else: pdflatex probably ok
      )
    (switch-to-buffer buf)
    (display-buffer tex-buf)))
    
>
> Regards
> Ross Darnell
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> ESS-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list