Take the 2-minute tour ×
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.

If I want --shell-escape, do I just need to add it to my .latexmkrc file as

$pdf_mode = 1;
$pdflatex = 'pdflatex --shell-escape -interaction=nonstopmode %O %S
          -file-line-error -synctex=1';

or should it be added in my .emacs file (where would it go here if this is the case?)

(defun run-latexmk ()
  (interactive)
  (let ((TeX-save-query nil)
        (TeX-process-asynchronous nil)
        (master-file (TeX-master-file)))
    (TeX-save-document "")
    (TeX-run-TeX "latexmk"
                 (TeX-command-expand "latexmk -pdflatex='pdflatex -file-line-error  
                                   -synctex=1' -pdf %O %S" 'TeX-master-file)
                 master-file))
    (if (plist-get TeX-error-report-switches (intern master-file))
        (TeX-next-error t)
      (progn
        (demolish-tex-help)
        (minibuffer-message "latexmk: done."))))

or does it need to be in both the .emacs and .latexmkrc?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

If you run latexmk with this function, the parameter -pdflatex='pdflatex -file-line-error -synctex=1' will override the settings you put in your .latexmkrc.

You can either keep it in your .latexmkrc this way, and then run simply latexmk -pdf <yourfile>, or not worry about the .latexmkrc and put all compilation parameters in the .emacs.

The first option:

(defun run-latexmk ()
  (interactive)
  (let ((TeX-save-query nil)
        (TeX-process-asynchronous nil)
        (master-file (TeX-master-file)))
    (TeX-save-document "")
    (TeX-run-TeX "latexmk"
                 (TeX-command-expand "latexmk -pdf %O %S" 'TeX-master-file)
                 master-file))
    (if (plist-get TeX-error-report-switches (intern master-file))
        (TeX-next-error t)
      (progn
        (demolish-tex-help)
        (minibuffer-message "latexmk: done."))))

and the second:

(defun run-latexmk ()
  (interactive)
  (let ((TeX-save-query nil)
        (TeX-process-asynchronous nil)
        (master-file (TeX-master-file)))
    (TeX-save-document "")
    (TeX-run-TeX "latexmk"
                 (TeX-command-expand "latexmk -pdflatex='pdflatex -file-line-error  
                                   --shell-escape -synctex=1' -pdf %O %S" 'TeX-master-file)
                 master-file))
    (if (plist-get TeX-error-report-switches (intern master-file))
        (TeX-next-error t)
      (progn
        (demolish-tex-help)
        (minibuffer-message "latexmk: done."))))

In both cases, the only part you need to change is the call to latexmk.

share|improve this answer
    
So I can just delete my .latexmkrc file? Can I add interaction=nonstopmode to option two? –  dustin Jul 20 '13 at 16:15
    
You can either delete it or keep it, it won't matter. You can use it to specify more settings, or to maintain coherent settings if you don't always use it with emacs. For the second question, yes, the -pdflatex parameter is exactly equivalent to setting the pdflatex variable in the .latexmkrc. –  T. Verron Jul 20 '13 at 16:24
    
What should the order be? This: "latexmk -pdflatex='pdflatex -file-line-error --shell-escape -interaction=nonstopmode -synctex=1' -pdf %O %S" or should file line, nonstop, and/or shell escape be in a different order? –  dustin Jul 20 '13 at 17:16
    
It shouldn't matter. –  T. Verron Jul 20 '13 at 18:30

Your Answer

 
discard

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.