Following solution is used as base to compile current buffer that is a LaTeX file:

(defun my-run-latex ()
  "Save all buffers and run LaTeX on the current master."
  (let* ((inhibit-message t)
         (TeX-command-force "LaTeX")
         (TeX-clean-confirm t)
         (TeX-save-query nil)
         (master (TeX-master-file))
         (process (and (stringp master) (TeX-process master))))
    (TeX-save-document master)
    (when (and (processp process)
               (eq (process-status process) 'run))
      (delete-process process))

(setq LaTeX-command-style '(("" "%(PDF)%(latex) -shell-escape -interaction=batchmode %S%(PDFout)")))  ;; https://tex.stackexchange.com/a/161303/127048
(add-hook 'LaTeX-mode-hook (λ ()
                             (TeX-fold-mode 1)))

Here even I have -interaction=batchmode flag, AucTeX adds -interaction=nonstopmode, which force to generated output during latex compilation. I want to suppress the generated compile logs to speed up the build process.

file name *:

Running `LaTeX' on `eblocbroker' with ``pdflatex -shell-escape -interaction=batchmode  -interaction=nonstopmode work.tex''
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex)
 \write18 enabled.
entering extended mode
// generated compile log ...

How can I prevent pdflatex logs to be created or is there any way to suppress the logs or have lowest verbose outputs?

  • Redirect stderr and stdout to /dev/null
    – nega
    Jun 8, 2022 at 16:30
  • How can I re-direct it within the emacs? Could I write something like : (setq LaTeX-command-style '(("" "%(PDF)%(latex) -shell-escape -interaction=batchmode %S%(PDFout) >/dev/null 2>&1"))) ?
    – alper
    Jun 8, 2022 at 21:35
  • That's the first thing I'd try
    – nega
    Jun 8, 2022 at 23:49
  • see also tex.stackexchange.com/questions/157242/…
    – nega
    Jun 8, 2022 at 23:50
  • Seems like adding >/dev/null 2>&1 worked! it still generates a file called * but having only TeX Output finished at Thu Jun 9 21:57:15. Also I keep seeing LaTeX: problems after [0] pages in the mini-buffer after the compiling
    – alper
    Jun 9, 2022 at 20:06

1 Answer 1


If you search nonstopmode in the auctex code, you will find The -interaction=nonstopmode is expanded from the %(mode) in the TeX-command-list.

Here are three options you can inhibit -interaction=nonstopmode:

  1. change how %(mode) expand in TeX-expand-list:
(add-to-list 'TeX-expand-list
               (lambda nil
                 (if TeX-interactive-mode ""
                   " -interaction=batchmode"))))
;; use extra-options to leave `LaTeX-command-style' not changed
(setq TeX-command-extra-options " -shell-escape") 
  1. change TeX-command-list directly:
(setf (nth 1 (assoc "LaTeX" TeX-command-list)) "%`%l%' %T")
  1. enable TeX-interactive-mode, i.e.:
(add-hook 'LaTeX-mode-hook 'TeX-interactive-mode)
  • This opens a file that has Running LaTeX on som.tex with pdflatex -shell-escape -interaction=batchmode some.tex' text in it. The file opened as a buffer in a half page windows ; is it possible to prevent it ? like I want window not to pop-up
    – alper
    Jun 10, 2022 at 14:28
  • It seems to be caused by TeX-interactive-mode, if you really want to remove -interaction=nonstopmode you can just modify TeX-command-list (see my updated answer). Jun 11, 2022 at 6:59
  • Or change how %(mode) expand, i.e. TeX-expand-list-builtin. Jun 11, 2022 at 6:59
  • Should I apply all the three options or if I apply the first one would it be enough?
    – alper
    Jun 11, 2022 at 11:37
  • Choose the one you like, I prefer the first one. And the last one have side effect you don't want. Jun 11, 2022 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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