Alper Alimoglu <[email protected]> writes: > I am trying to compile a latex file (opened buffer) with the following > command in order to suppress its compilation logs:
In general, this is a semi-good idea when you're using AUCTeX since it runs the process in a buffer and then parses the log for the upcoming course of action. > Please also link in emacs.stackexchange: > https://emacs.stackexchange.com/questions/72406/how-can-i-suppress-latex-problems-after-0-pages-message > > `pdflatex -shell-escape -interaction=batchmode current_buffer.tex` If I save the example provided in the question above and run pdflatex on it in the CLI, I get the following: -> pdflatex -shell-escape -interaction=batchmode current_buffer.tex This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex) \write18 enabled. entering extended mode So the compile-log provided there is off, somehow. > I keep seeing following message in the minibuffer when a tex file is compiled: > > ```LaTeX: problems after [0] pages``` > > I couldn't figure out why this error shows up even the tex file > compiled successfully. Would it be possible to suppress this message? In Emacs with AUCTeX, I did the following since I wanted it the easy way. This is my .tex file: --8<---------------cut here---------------start------------->8--- \documentclass[border=0.2cm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.symbols} \begin{document} \verb|M-x TeX-interactive-mode RET| before hitting \verb|C-c C-c| \begin{tikzpicture} \node at (0,0) [forbidden sign,line width=2ex,draw=red,fill=white] {Smoking}; \node [opacity=.5] at (2,0) [forbidden sign,line width=2ex,draw=red,fill=white] {Smoking}; \end{tikzpicture} \end{document} %%% Local Variables: %%% mode: latex %%% TeX-master: t %%% TeX-command-extra-options: "-shell-escape -interaction=batchmode" %%% End: --8<---------------cut here---------------end--------------->8--- Note that I enabled `TeX-interactive-mode. When I hit 'C-c C-c', I get: LaTeX: problems after some pages even if the file compiles successfully. This is a short-coming in the function `TeX-LaTeX-sentinel' which is not prepared for the short log file. Can you evaluate the following version and see if it helps? Search for "LaTeX finished at" and that's the only change: --8<---------------cut here---------------start------------->8--- (defun TeX-LaTeX-sentinel (process name) "Cleanup TeX output buffer after running LaTeX. Parse the output buffer to collect errors and warnings if the variable `TeX-parse-all-errors' is non-nil. Open the error overview if `TeX-error-overview-open-after-TeX-run' is non-nil and there are errors or warnings to show." (if TeX-parse-all-errors (TeX-parse-all-errors)) (if (and TeX-error-overview-open-after-TeX-run (TeX-error-overview-make-entries (TeX-master-directory) (TeX-active-buffer))) (TeX-error-overview)) (cond ((TeX-TeX-sentinel-check process name)) ((and (save-excursion (re-search-forward "^Package biblatex Warning: Please (re)run Biber on the file" nil t)) (with-current-buffer TeX-command-buffer (and (LaTeX-bibliography-list) (TeX-check-files (TeX-master-file "bbl") (TeX-style-list) (append TeX-file-extensions BibTeX-file-extensions TeX-Biber-file-extensions))))) (message "%s%s" "You should run Biber to get citations right, " (TeX-current-pages)) (setq TeX-command-next (with-current-buffer TeX-command-buffer TeX-command-Biber))) ((and (save-excursion (re-search-forward "^\\(?:LaTeX\\|Package natbib\\) Warning: Citation" nil t)) (with-current-buffer TeX-command-buffer (and (LaTeX-bibliography-list) (TeX-check-files (TeX-master-file "bbl") (TeX-style-list) (append TeX-file-extensions BibTeX-file-extensions TeX-Biber-file-extensions))))) (message "%s%s" "You should run BibTeX to get citations right, " (TeX-current-pages)) (setq TeX-command-next (with-current-buffer TeX-command-buffer TeX-command-BibTeX))) ((re-search-forward "Package biblatex Warning: Please rerun LaTeX" nil t) (message "%s%s" "You should run LaTeX again, " (TeX-current-pages)) (setq TeX-command-next TeX-command-default)) ((re-search-forward "^(biblatex)\\W+Page breaks have changed" nil t) (message "%s%s" "You should run LaTeX again - page breaks have changed, " (TeX-current-pages)) (setq TeX-command-next TeX-command-default)) ((re-search-forward "^\\(?:LaTeX Warning: Label(s)\\|\ Package natbib Warning: Citation(s)\\)" nil t) (message "%s%s" "You should run LaTeX again to get references right, " (TeX-current-pages)) (setq TeX-command-next TeX-command-default)) ((re-search-forward "^\\(?:(rerunfilecheck)\\|Package hyperref Warning:\\)\\W+\ Rerun to get outlines right" nil t) (message "%s%s" "You should run LaTeX again to get outlines right, " (TeX-current-pages)) (setq TeX-command-next TeX-command-default)) ((re-search-forward "^LaTeX Warning: Reference" nil t) (message "%s%s%s" name ": there were unresolved references, " (TeX-current-pages)) (let (dvi2pdf) (if (with-current-buffer TeX-command-buffer (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI)))) (setq TeX-command-next dvi2pdf) (setq TeX-command-next TeX-command-Show)))) ((re-search-forward "^\\(?:LaTeX Warning: Citation\\|\ Package natbib Warning:.*undefined citations\\)" nil t) (message "%s%s%s" name ": there were unresolved citations, " (TeX-current-pages)) (let (dvi2pdf) (if (with-current-buffer TeX-command-buffer (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI)))) (setq TeX-command-next dvi2pdf) (setq TeX-command-next TeX-command-Show)))) ((re-search-forward "^No file .*\\.\\(toc\\|lof\\|lot\\)\\.$" nil t) (message "%s" (concat "You should run LaTeX again to get " (upcase (match-string-no-properties 1)) " right")) (setq TeX-command-next TeX-command-default)) ((re-search-forward "Package longtable Warning: Table widths have \ changed\\. Rerun LaTeX\\." nil t) (message "%s" "You should run LaTeX again to get table formatting right") (setq TeX-command-next TeX-command-default)) ((re-search-forward "^hf-TikZ Warning: Mark '.*' changed\\. \ Rerun to get mark in right position\\." nil t) (message "%s" "You should run LaTeX again to get TikZ marks in right position") (setq TeX-command-next TeX-command-default)) ((re-search-forward "^\\* xsim warning: \"rerun\"" nil t) (message "%s" "You should run LaTeX again to synchronize exercise properties") (setq TeX-command-next TeX-command-default)) ((re-search-forward "^\\(\\*\\* \\)?J?I?p?\\(La\\|Sli\\)TeX\\(2e\\)? \ \\(Version\\|ver\\.\\|<[0-9/-]*\\(?:u[^>]*\\)?>\\)\ \\|^LaTeX finished at" nil t) (let* ((warnings (and TeX-debug-warnings (TeX-LaTeX-sentinel-has-warnings))) (bad-boxes (and TeX-debug-bad-boxes (TeX-LaTeX-sentinel-has-bad-boxes))) (add-info (when (or warnings bad-boxes) (concat " (with " (when warnings "warnings") (when (and warnings bad-boxes) " and ") (when bad-boxes "bad boxes") ")")))) (message "%s" (concat name ": successfully formatted " (TeX-current-pages) add-info))) (let (dvi2pdf) (if (with-current-buffer TeX-command-buffer (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI)))) (setq TeX-command-next dvi2pdf) (setq TeX-command-next TeX-command-Show)))) (t (message "%s%s%s" name ": problems after " (TeX-current-pages)) (setq TeX-command-next TeX-command-default))) ;; Check whether the idx file changed. (let (idx-file) (and (file-exists-p (setq idx-file (with-current-buffer TeX-command-buffer (expand-file-name (TeX-active-master "idx"))))) ;; imakeidx package automatically runs makeindex, thus, we need to be ;; sure .ind file isn't newer than .idx. (TeX-check-files (with-current-buffer TeX-command-buffer (expand-file-name (TeX-active-master "ind"))) (with-current-buffer TeX-command-buffer (list (file-name-nondirectory (TeX-active-master)))) '("idx")) (with-temp-buffer (insert-file-contents-literally idx-file) (not (equal ;; Compare old md5 hash of the idx file with the new one. (cdr (assoc idx-file LaTeX-idx-md5-alist)) (md5 (current-buffer))))) (push (cons idx-file t) LaTeX-idx-changed-alist))) (unless (TeX-error-report-has-errors-p) (run-hook-with-args 'TeX-after-compilation-finished-functions (with-current-buffer TeX-command-buffer (expand-file-name (TeX-active-master (TeX-output-extension))))))) --8<---------------cut here---------------end--------------->8--- Best, Arash
