           (append '(("itemize" +latex/LaTeX-indent-item)
                     ("enumerate" +latex/LaTeX-indent-item)
                     ("description" +latex/LaTeX-indent-item))
-                  LaTeX-indent-environment-list))))
-
-(after! latex
-  ;; Use Okular if the user says so.
-  (when (featurep! +okular)
-    ;; Configure Okular as viewer. Including a bug fix
-    ;; (https://bugs.kde.org/show_bug.cgi?id=373855)
-    (add-to-list 'TeX-view-program-list
-                 '("Okular" ("okular --unique file:%o" (mode-io-correlate "#src:%n%a"))))
-    (add-to-list 'TeX-view-program-selection
-                 '(output-pdf "Okular")))
-
-  ;; Or Skim
-  (when (featurep! +skim)
-    (add-to-list 'TeX-view-program-list
-                 '("Skim" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b"))
-    (add-to-list 'TeX-view-program-selection
-                 '(output-pdf "Skim")))
-
-  ;; Or PDF-tools, but only if the module is also loaded
-  (when (and (featurep! :tools pdf) (featurep! +pdf-tools))
-    (add-to-list 'TeX-view-program-list
-                 '("PDF Tools" ("TeX-pdf-tools-sync-view")))
-    (add-to-list 'TeX-view-program-selection
-                 '(output-pdf "PDF Tools"))
-    ;; Enable auto reverting the PDF document with PDF Tools
-    (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)))
-
+                  LaTeX-indent-environment-list))
+
+    ;;
+    ;; Use Okular if the user says so.
+    (when (featurep! +okular)
+      ;; Configure Okular as viewer. Including a bug fix
+      ;; (https://bugs.kde.org/show_bug.cgi?id=373855)
+      (map-put TeX-view-program-list
+               "Okular" '(("okular --unique file:%o" (mode-io-correlate "#src:%n%a"))))
+      (map-put TeX-view-program-list 'output-pdf '("Okular")))
+
+    ;; Or Skim
+    (when (featurep! +skim)
+      (map-put TeX-view-program-list
+               "Skim" '("/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b"))
+      (map-put TeX-view-program-selection 'output-pdf '("Skim")))
+
+    ;; Or PDF-tools, but only if the module is also loaded
+    (when (and (featurep! :tools pdf)
+               (featurep! +pdf-tools))
+      (map-put TeX-view-program-list "PDF Tools" '("TeX-pdf-tools-sync-view"))
+      (map-put TeX-view-program-selection 'output-pdf '("PDF Tools"))
+      ;; Enable auto reverting the PDF document with PDF Tools
+      (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer))))
 
 
 (def-package! preview

            LaTeX-section-label)
          LaTeX-fill-break-at-separators nil
          LaTeX-item-indent 0) ; item indentation.
    :config
    (map! :map LaTeX-mode-map "C-j" nil)
    ;; Do not prompt for Master files, this allows auto-insert to add templates
    ;; to .tex files
    (add-hook! '(LaTeX-mode TeX-mode)
      (remove-hook 'find-file-hook (car find-file-hook) 'local))
    ;; Adding useful things for latex
    (add-hook! LaTeX-mode
      (LaTeX-math-mode)
      (TeX-source-correlate-mode)
      (TeX-global-PDF-mode t)
      (TeX-PDF-mode t)
      (visual-line-mode +1))
    ;; Enable rainbow mode after applying styles to the buffer
    (add-hook 'TeX-update-style-hook #'rainbow-delimiters-mode)
    (when (featurep! :feature spellcheck)

  ;; master, so we just have to wait.
  :init
  (setq-default preview-scale 1.4
                preview-scale-function
                (lambda () (* (/ 10.0 (preview-document-pt)) preview-scale)))
  (add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup))


(def-package! latex-preview-pane
  :when (featurep! +preview-pane)
  :commands latex-preview-pane-enable
  :init
  (setq latex-preview-pane-multifile-mode 'auctex)
  (add-hook! (latex-mode LaTeX-mode) #'latex-preview-pane-enable)
  (map-put TeX-view-program-list "preview-pane" '(latex-preview-pane-mode))
  (map-put TeX-view-program-selection 'output-pdf '("preview-pane"))
  :config
  (map! :map doc-view-mode-map
        "ESC" #'delete-window
        "q"   #'delete-window
        "k" (λ! (quit-window) (delete-window))))


(def-package! reftex
  :commands turn-on-reftex
  :init
  (setq reftex-plug-into-AUCTeX t
        reftex-toc-split-windows-fraction 0.3)
  (add-hook! (latex-mode LaTeX-mode) #'turn-on-reftex)
  :config
  ;; Get ReTeX working with biblatex
