What is the proper way of solving this problem with respect to AUCTeX's design - I mean, how to do that in a way that it will still recognize the errors, display log on demand, make "View" command default on successful compilation, etc. Or, what is a way to define my own command with the same functionality and make it default?
With the current AUCTeX management of compilers I think the cleanest solution would be to add a new command for
dvips and another one for
ps2pdf and every time issue C-c C-c three times, but this isn't definitely comfortable.
Here there is the following solution (slightly improved): add this code to your
(eval-after-load "tex" '(progn (add-to-list 'TeX-command-list '("LaTeX + dvips + ps2pdf" "latex%(mode) %t && dvips %d -o %f && ps2pdf14 %f" TeX-run-TeX nil t))))
This isn't the best solution, but at least is able to catch error reports.
Since AucTeX 11.89, this is a built-in feature; simply set the variable
TeX-PDF-via-dvips-ps2pdf to non-nil. The relevant documentation is found here:
User Option: TeX-PDF-via-dvips-ps2pdf
With TeX-PDF-mode set to non-nil, if TeX-PDF-via-dvips-ps2pdf is non-nil too, the document is compiled with tex (or latex) instead of pdftex (or pdflatex). When the document is ready, C-c C-c will suggest to run dvips and then ps2pdf in order to convert the DVI file to PDF. When the PDF file is finally ready, the next suggested command will be to open the viewer.
This option can also be set as a file local variable, in order to use the sequence tex–dvips–ps2pdf on a per-document basis.
So you could just put
(setq TeX-PDF-via-dvips-ps2pdf t) in your
.emacs to make every file be compiled this way.
I am a just plain latex user, but I got results, which was my best. I don't know LISP at all, and I was using just aquamacs and its GUI-like AUCtex customize menus. Anyway, for now I use psfrag, inverse search for pdf in Skim viewer both from pdflatex and from dvips + ps2pdf.
This was all my best. First, I separated (latex) and (dvips + ps2pdf). The reason is that if I don't, C-c C-v try to show dvi, which was not a good idea in my mac.
In the AUCtex customize menu -> TeX-command-list, the LaTex is bound to the PdfLatex as a default. So I added two more command-lists, the PdfLatex and the dvips + ps2pdf, and I just copied the original command in the LaTex list to PdfLatex list, which was
In the LaTex list, I replaced by
%(latex) --synctex=1 %s
In the dvips + ps2pdf list, I put
dvips %s.dvi && ps2pdf %s.ps %s.pdf
Then, the LaTex icon in the aquamacs operates as only latex compilation. After C-c C-c to run dvips + ps2dvi, I can see the pdf file using C-c C-v.
Also, I was able to use inverse search generated by dvips + ps2pdf in Skim viewer after I changed the value to synctex for DVI in the Tex Source Correlate Method menu.
Overall changes resulted in the following LISP, which I don't understand, but I put them here.
(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. '(LaTeX-clean-intermediate-suffixes nil) '(LaTeX-clean-output-suffixes nil) '(LaTeX-command "latex") '(LaTeX-mode-hook (quote (preview-mode-setup smart-dnd-latex (lambda nil (TeX-fold-mode t)) turn-on-bib-cite turn-on-reftex flyspell-mode abbrev-mode))) '(TeX-clean-confirm nil) '(TeX-command-list (quote (("TeX" "%(PDF)%(tex) %(extraopts) %`%S%(PDFout)%(mode)%' %t" TeX-run-TeX nil (plain-tex-mode texinfo-mode ams-tex-mode) :help "Run plain TeX") ("LaTeX" "%(latex) --synctex=1 %s" TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX") ("PdfLaTex" "%`%l%(mode)%' %t" TeX-run-command nil t) ("dvips + ps2pdf" "dvips %s.dvi && ps2pdf %s.ps %s.pdf " TeX-run-TeX nil t) '(TeX-view-program-selection (quote ((output-dvi "Skim") (output-pdf "Skim") (output-html "open")))) '(TeX-source-correlate-method (quote ((dvi . synctex) (pdf . synctex))))