diff --git a/init.el b/init.el index 244d68d..6508c06 100644 --- a/init.el +++ b/init.el @@ -819,7 +819,16 @@ COMMAND and COMINT are like `compile'." ;; (La)TeX (use-package tex-mode - :hook (latex-mode . eglot-ensure) + :hook ((latex-mode . eglot-ensure) + (tex-mode . my/-setup-tex-mode-compile-command)) + :init + (defun my/-setup-tex-mode-compile-command () + "Setup `compile-command' for `tex-mode'." + (let ((quoted-name (shell-quote-argument buffer-file-name))) + (setq-local compile-command + (concat "latexmk -pdf " + "-auxdir=" quoted-name "-build" + " " quoted-name)))) :config (add-to-list 'auto-mode-alist '("/\\.latexmkrc\\'" . perl-mode)))