[OS X TeX] AucTeX, simpdftex, dvipdfmx in ECE plugin

Enrico Franconi franconi at inf.unibz.it
Tue Apr 17 11:53:45 EDT 2007


Hi,
I have released a new version of the ECE plugin for emacs, which now  
handles simpdftex (for a one shot latex compilation in pdf via ps)  
and dvipdfmx (for a conversion from dvi to pdf dealing with different  
types of included graphics) in a seamless way:

<http://web.inf.unibz.it/~franconi/enhanced-carbon-emacs>.

For the curious people, for comments, and for reproducibility, this  
is the core of the hack (which can be reproduced by using a  
customisation of TeX-expand-list, plus few definitions):

(setq TeX-a4-paper t)
(setq TeX-view-format "pdf")  ;;; "pdf", "ps", "dvi"
(setq pdf-previewer-program "open")
(setq ps-previewer-program "open")
(setq dvi-previewer-program "open -a texniscope")
(setq simpdflatex-mode nil)

(setq simpdflatex-command "simpdftex_dpmx latex --dpx --maxpfb")
(defun TeX-dvips-command ()
   (if TeX-a4-paper
       "dvips -ta4 -Ppdf -G0 %d -o %f "
     "dvips -Ppdf -G0 %d -o %f "))
(defun TeX-dvipdf-command ()
   (if TeX-a4-paper
       "dvipdfmx -p a4 %d"
     "dvipdfmx %d"))

(add-hook
'LaTeX-mode-hook
(function
   (lambda ()

     (setq TeX-expand-list
	  '(("%p" TeX-printer-query)
	    ("%q" (lambda ()
		    (TeX-printer-query t)))
	    ;; changed EF:
	    ("%V" (lambda ()
		    (cond (simpdflatex-mode
			   (TeX-output-style-check
			    (TeX-output-simpdflatex-view-style)))
			  ((equal TeX-view-format "dvi")
			   (TeX-output-style-check (TeX-output-dvi-view-style)))
			  ((equal TeX-view-format "ps")
			   (TeX-output-style-check (TeX-output-ps-view-style)))
			  ((equal TeX-view-format "pdf")
			   (TeX-output-style-check (TeX-output-pdf-view-style)))
			  )))
	    ("%v" (lambda ()
		    (TeX-style-check TeX-view-style)))
	    ("%r" (lambda ()
		    (TeX-style-check TeX-print-style)))
	    ("%l" (lambda ()
		    (TeX-style-check LaTeX-command-style)))
	    ;; changed EF:
	    ("%(PDF)" (lambda ()
			(if (and (not TeX-Omega-mode)
				 (not simpdflatex-mode)
				 (or TeX-PDF-mode
				     TeX-DVI-via-PDFTeX))
			    "pdf"
			  "")))
	    ;; changed EF:
	    ("%(PDFout)" (lambda ()
			   (if (and (not TeX-Omega-mode)
				    (not TeX-PDF-mode)
				    (not simpdflatex-mode)
				    TeX-DVI-via-PDFTeX)
			       " \"\\pdfoutput=0 \""
			     "")))
	    ;; changed EF:
	    ("%(mode)" (lambda ()
			 (if (or TeX-interactive-mode
				 simpdflatex-mode)
			     ""
			   " -interaction=nonstopmode")))
	    ("%(o?)" (lambda () (if TeX-Omega-mode "o" "")))
	    ("%(tex)" (lambda () (if TeX-Omega-mode
				     TeX-Omega-command
				   TeX-command)))
	    ;; changed EF:
	    ("%(latex)" (lambda () (if TeX-Omega-mode
				       LaTeX-Omega-command
				     (if simpdflatex-mode
					 simpdflatex-command
				       LaTeX-command))))
	    ("%(execopts)" ConTeXt-expand-options)
	    ;; changed EF:
	    ("%S"  (lambda () (if simpdflatex-mode
				  ""
				(TeX-source-specials-expand-options))))
	    ("%dS" TeX-source-specials-view-expand-options)
	    ("%cS" TeX-source-specials-view-expand-client)
	    ("%(outpage)" (lambda () (if TeX-sync-output-page-function
					 (funcall TeX-sync-output-page-function)
				       "")))
	    ("%s" file nil t)
	    ("%t" file t t)
	    ("%`" (lambda nil
		    (setq TeX-command-pos t TeX-command-text "")))
	    (" \"\\" (lambda nil
		       (if (eq TeX-command-pos t)
			   (setq TeX-command-pos pos
				 pos (+ 3 pos))
			 (setq pos (1+ pos)))))
	    ("\"" (lambda nil (if (numberp TeX-command-pos)
				  (setq TeX-command-text
					(concat
					 TeX-command-text
					 (substring command
						    TeX-command-pos
						    (1+ pos)))
					command
					(concat
					 (substring command
						    0
						    TeX-command-pos)
					 (substring command
						    (1+ pos)))
					pos TeX-command-pos
					TeX-command-pos t)
				(setq pos (1+ pos)))))
	    ;; changed EF:
	    ("%'" (lambda nil
		    (prog1
			(if (and (stringp TeX-command-text)
				 (not simpdflatex-mode))
			    (progn
			      (setq pos (+ (length TeX-command-text) 9)
				    TeX-command-pos
				    (and (string-match " "
						       (funcall file t t))
					 "\""))
			      (concat TeX-command-text " \"\\input\""))
			  (setq TeX-command-pos nil)
			  "")
		      (setq TeX-command-text nil))))
	    ("%n" TeX-current-line)
	    ("%d" file "dvi" t)
	    ("%f" file "ps" t)
	    ("%o" (lambda nil (funcall file (TeX-output-extension) t)))
	    ("%b" TeX-current-file-name-master-relative)
	    ("%m" preview-create-subdirectory)))

     (defun TeX-output-dvi-view-style ()
       `(("^dvi$" "." ,(concat "%(o?)" dvi-previewer-program " %d"))
	("^pdf$" "." ,(concat "%(o?)" pdf-previewer-program " %s.pdf"))
	))

     (defun TeX-output-ps-view-style ()
       `(("^dvi$" "." ,(concat (TeX-dvips-command) " ; "
			      ps-previewer-program " %f"))
	("^pdf$" "." ,(concat "%(o?)" pdf-previewer-program " %s.pdf"))
	))

     (defun TeX-output-pdf-view-style ()
       `(("^dvi$" "." ,(concat (TeX-dvipdf-command) " ; "
			      pdf-previewer-program " %s.pdf"))
	("^pdf$" "." ,(concat "%(o?)" pdf-previewer-program " %s.pdf"))
	))

     (defun TeX-output-simpdflatex-view-style ()
       `(("." "." ,(concat "%(o?)" pdf-previewer-program " %s.pdf"))
	))

     )))


------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the MacOSX-TeX mailing list