   :init
   (setq latex-preview-pane-multifile-mode 'auctex)
   (add-hook! (latex-mode LaTeX-mode) #'latex-preview-pane-enable)
-  (add-to-list 'TeX-view-program-list
-                 '("preview-pane"
-                   latex-preview-pane-mode))
-  (add-to-list 'TeX-view-program-selection
-                 '(output-pdf "preview-pane"))
+  (add-to-list 'TeX-view-program-list '("preview-pane" latex-preview-pane-mode))
+  (add-to-list 'TeX-view-program-selection '(output-pdf "preview-pane"))
   :config
   (map! :map doc-view-mode-map
         "ESC" #'delete-window

  (set! :popup " output\\*$" '((size . 15)))

  ;; TeX Font Styling
  (def-package! tex-style
    :defer t)

  ;; TeX Folding
  (def-package! tex-fold
    :defer t
    :init
    (add-hook! 'TeX-mode-hook 'TeX-fold-mode))

  (def-package! latex
    :defer t
    :init
    (setq
     ;; Add the toc entry to the sectioning hooks.
     LaTeX-section-hook
       '(LaTeX-section-heading
         LaTeX-section-title
         LaTeX-section-toc
         LaTeX-section-section
         LaTeX-section-label)
     LaTeX-fill-break-at-separators nil
     ;; Item indentation.
     LaTeX-item-indent 0)
    :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) '(lambda () (remove-hook 'find-file-hooks (car find-file-hooks) '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))
    (when (featurep! :feature spellcheck)
      (add-hook! LaTeX-mode (flyspell-mode t)))
    ;; Default language setting.
    (setq ispell-dictionary "english")
    ;; Use chktex to search for errors in a latex file.

  ;; Pass the -pdf flag when TeX-PDF-mode is active
  (setq auctex-latexmk-inherit-TeX-PDF-mode t)
  ;; Set LatexMk as the default
  (add-hook! LaTeX-mode (setq TeX-command-default "LatexMk"))
  :config
  ;; Add latexmk as a TeX target
  (auctex-latexmk-setup))
