Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
Do you want to do this with every .tex file you edit or only for certain projects? – Paul Gessler Mar 4 '14 at 16:48
@PaulGessler Actually, now I think that I will use this chain for every (main) .tex file, even in the future. – Andrew Zabavnikov Mar 4 '14 at 17:03
Do you really want to do that, or merely use the PDFLaTeX option ? that's generally a better way to make a PDF while retaining all the features you want. – Suresh Mar 4 '14 at 17:37
@Suresh Why it is? And what is the way to properly handle .eps graphics with the pdflatex? Here, 'proper' means that I can use them in scalable manner (after conversion to some other format for example). – Andrew Zabavnikov Mar 4 '14 at 17:47
ah. I didn't think anyone used .eps any more :). If you have .eps files it's probably best to go that route. – Suresh Mar 4 '14 at 17:48

3 Answers 3

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 .emacs file

(eval-after-load "tex"
      '("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.

share|improve this answer
Note that it may be necesary to include this inside a (eval-after-load "tex-mode" ...) – cool_me5000 Mar 31 '14 at 22:28
@cool_me5000 Thank you for the suggestion ;-). – giordano Mar 31 '14 at 22:31

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.

share|improve this answer
there is also a menu interface to check that option: Command->TeXing Options->PDF via dvips + ps2pdf (but no shortcut of three or four C-something is provided) – jfbu yesterday
Uh, I forgot to mention this new feature, thank you! And I'd add that with the new C-c C-a key binding you can compile the whole document at once. – giordano yesterday

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

%`%l%(mode)%' %t

In the LaTex list, I replaced by

%(latex) --synctex=1 %s

In the dvips + ps2pdf list, I put

dvips %s.dvi && ps2pdf %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 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")
    (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" "%(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.pdf " TeX-run-TeX nil t)
    ((output-dvi "Skim")
     (output-pdf "Skim")
     (output-html "open"))))
 '(TeX-source-correlate-method (quote ((dvi . synctex) (pdf . synctex))))
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.