[Tex/LaTex] Make a new AucTEX command

auctexcompilingemacs

I'm writing a document using eps graphics so I need to compile with Latex to produce a dvi file. In that file graphics don't show (they're a combination of .tex and .eps files), but if I do dvipdf file.dvi then the produced file.pdf shows all graphics perfectly.

I was trying to create a new command in AucTex to execute dvipdf file.dvi directly from emacs instead of opening the terminal, but I don't understand the syntax, for example in the Latex run command:

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

So what would I need to write in a command to execute the line dvipdf file.dvi?

Thank you.

Best Answer

Use TeX-command-list for this job :)

(add-to-list
  'TeX-command-list
  '("DVI to PDF"
    "dvipdf %d"
    TeX-run-command
    nil                              ; ask for confirmation
    t                                ; active in all modes
    :help "Convert DVI->PDF"))

To add a command to view the PDF, use

(add-to-list
  'TeX-command-list
  '("View PDF"
    "open %s.pdf"
    TeX-run-command
    nil                              ; ask for confirmation
    t                                ; active in all modes
    :help "View PDF"))

You can find more information on the syntax of these format strings with C-h v TeX-command-list and C-h v TeX-expand-list.