Hi,

I have a setup where I automatically compile a tex file upon saving, but
only if it is a standalone document (eg not something included by
another file):

(defun LaTeX-in-document-p ()
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (search-forward "documentclass" (point-max) t)))

(defun LaTeX-compile-on-save ()
  (when (LaTeX-in-document-p)
    (TeX-command "LaTeX" 'TeX-master-file)))

with

  (add-hook 'after-save-hook 'LaTeX-compile-on-save t t)

executed by LaTeX-mode-hook.

I am wondering if this setup could be improved with AUCTeX:

1. Is there a better way to test for LaTeX-in-document-p?

2. If A.tex includes B.tex, is there a way to compile A.tex when saving
B.tex?

Best,

Tamas

_______________________________________________
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex

Reply via email to