 (load "auctex" nil t)
 (load "auctex-autoloads" nil t)
 (push '("\\.[tT]e[xX]\\'" . TeX-latex-mode) auto-mode-alist)
+
+(add-hook! (latex-mode LaTeX-mode) #'turn-on-auto-fill)
+(add-hook! 'LaTeX-mode-hook #'(LaTeX-math-mode TeX-source-correlate-mode))
 
 (add-transient-hook! 'LaTeX-mode-hook
   (setq TeX-auto-save t

          LaTeX-section-section
          LaTeX-section-label))

  (add-hook! (latex-mode LaTeX-mode) #'turn-on-auto-fill)
  (add-hook! 'LaTeX-mode-hook #'(LaTeX-math-mode TeX-source-correlate-mode))

  (set! :popup " output\\*$" :regexp t :size 15 :noselect t :autoclose t :autokill t)

  (map! :map LaTeX-mode-map "C-j" nil)

  (def-package! company-auctex
    :when (featurep! :completion company)
    :init
    ;; We can't use the (set! :company-backend ...) because Auctex reports its
    ;; major-mode as `latex-mode', but uses LaTeX-mode-hook for its mode, which
    ;; is :company-backend doesn't anticipate (and shouldn't have to!)
    (add-hook! LaTeX-mode
      (make-variable-buffer-local 'company-backends)
      (company-auctex-init))))


(def-package! reftex ; built-in
  :commands (turn-on-reftex reftex-mode)



;;
;; AucTex/LaTeX bootstrap
;;

;; Because tex-mode is built-in and AucTex has conflicting components, we need
