Automatic LaTeX compilation under Emacs
If you write LaTeX files under Emacs, you may find useful this small
file I have written.
It provides in the TeX menu the option "Automatic TeX Toggle".
Once activated, this option TeXes file every time the buffer is saved.
This is inspired from the
The emacs-lisp file auto-tex.el may be loaded in configuration file .emacs by inserting the following line:
;; Auto-tex (firstname.lastname@example.org)
;; Automatic compilation of TeX files on saving
;; (inspired from html-mode.el auto-browsing feature)
(defun tex-file-and-delete-window ()
"Tex file and shrink the tex window to 9 lines."
(switch-to-buffer-other-window (get-buffer "*tex-shell*"))
(shrink-window (- (window-height) 9))
; (delete-window (get-buffer-window (get-buffer "*tex-shell*")))
(defun tex-autoview-mode (&optional arg)
"Toggle automatic texing upon saving buffer.
With positive prefix ARG always turns texing on, with negative ARG always off.
Can be used as a value for `tex-mode-hook'."
(if (setq arg (if arg
(< (prefix-numeric-value arg) 0)
(and (boundp 'after-save-hook)
(memq 'tex-file-and-delete-window after-save-hook))))
(setq after-save-hook (delq 'tex-file-and-delete-window after-save-hook))
(add-hook 'after-save-hook 'tex-file-and-delete-window t 0)
(message "Autotexing turned %s."
(if arg "off" "on")))
;; Now adding the menu entry
'(lambda () (define-key tex-mode-map [menu-bar tex tex-autoview-mode]
'("Automatic Tex Toggle" . tex-autoview-mode))))
;; End of auto-tex.el
Last modified: Aug 17th, 2012 12:41