Skip to content

Commit

Permalink
tweak(auctex): better defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Jun 10, 2023
1 parent 0950451 commit a4152ef
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions modules/me-latex.el
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
(TeX-auto-local ".auctex-auto") ; use hidden directories for AUCTeX files.
(TeX-style-local ".auctex-style")
(TeX-source-correlate-method 'synctex)
(TeX-electric-math '("$" . "$")) ; auto close inline equations
(TeX-source-correlate-start-server nil) ; don't start the Emacs server when correlating sources.
(TeX-electric-sub-and-superscript t) ; automatically insert braces after sub/superscript in `LaTeX-math-mode'.
(TeX-save-query nil) ; just save, don't ask before each compilation.
(TeX-engine 'xetex) ; use XeLaTeX by default
(TeX-PDF-mode t) ; export to PDF by default
:init
(+map-local! :keymaps '(tex-mode-map TeX-mode-map latex-mode-map LaTeX-mode-map)
"c" #'TeX-command-run-all
Expand All @@ -32,14 +32,33 @@
"v" #'TeX-view)
:config
(when (functionp 'pdf-tools-install)
(add-to-list 'TeX-view-program-selection '(output-pdf "PDF Tools"))))
(add-to-list 'TeX-view-program-selection '(output-pdf "PDF Tools")))

;; To have the buffer refresh after compilation
(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)

;; Compile to PDF by default
(TeX-PDF-mode 1))

(use-package latex
:straight auctex
:config
:hook (latex-mode . latex-math-mode)
:custom
;; Add the TOC entry to the sectioning hooks.
(setq LaTeX-fill-break-at-separators nil
LaTeX-item-indent 0))
(LaTeX-fill-break-at-separators nil)
(LaTeX-item-indent 0)
(LaTeX-electric-left-right-brace t)
:config
;; Set a correct indentation in a few additional environments
(add-to-list 'LaTeX-indent-environment-list '("lstlisting" current-indentation))
(add-to-list 'LaTeX-indent-environment-list '("tikzcd" LaTeX-indent-tabular))
(add-to-list 'LaTeX-indent-environment-list '("tikzpicture" current-indentation))

;; Add a few macros and environment as verbatim
(add-to-list 'LaTeX-verbatim-environments "lstlisting")
(add-to-list 'LaTeX-verbatim-environments "Verbatim")
(add-to-list 'LaTeX-verbatim-macros-with-braces "lstinline")
(add-to-list 'LaTeX-verbatim-macros-with-delims "lstinline"))

;; Adapted from Doom Emacs
(use-package auctex-latexmk
Expand Down

0 comments on commit a4152ef

Please sign in to comment.