Better LaTeX configuration

This commit is contained in:
Eduardo Cueto-Mendoza 2024-04-17 21:28:05 +01:00
parent 128eb00299
commit a364ef15f4
2 changed files with 94 additions and 66 deletions

View File

@ -213,12 +213,15 @@ This section configures basic UI settings that remove unneeded elements to make
;; Disable line numbers for some modes ;; Disable line numbers for some modes
(dolist (mode '(org-mode-hook (dolist (mode '(org-mode-hook
pdf-view-mode-hook
term-mode-hook term-mode-hook
shell-mode-hook shell-mode-hook
treemacs-mode-hook treemacs-mode-hook
eshell-mode-hook)) eshell-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0)))) (add-hook mode (lambda () (display-line-numbers-mode 0))))
(setq-default display-line-numbers-type 'relative)
(global-set-key (kbd "C-x l") 'load-file) (global-set-key (kbd "C-x l") 'load-file)
#+end_src #+end_src
@ -1003,6 +1006,24 @@ This will install the [[https://github.com/theia-ide/typescript-language-server]
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Better configuration but rquires pdf-tools ;; Better configuration but rquires pdf-tools
(use-package auctex
:ensure t
;:defer t
:hook (LaTeX-mode .
(lambda ()
(push (list 'output-pdf "PDF Tools")
TeX-view-program-selection)))
)
(use-package company-auctex
:ensure t
:init (company-auctex-init))
(use-package auctex-latexmk
:ensure t
:config
(auctex-latexmk-setup)
(setq auctex-latexmk-inherit-TeX-PDF-mode t))
(use-package pdf-tools (use-package pdf-tools
:ensure t :ensure t
@ -1017,11 +1038,6 @@ This will install the [[https://github.com/theia-ide/typescript-language-server]
(add-hook 'pdf-view-mode-hook 'pdf-tools-enable-minor-modes) (add-hook 'pdf-view-mode-hook 'pdf-tools-enable-minor-modes)
) )
(use-package auctex-latexmk
:ensure t
:config
(auctex-latexmk-setup)
(setq auctex-latexmk-inherit-TeX-PDF-mode t))
(use-package reftex (use-package reftex
:ensure t :ensure t
@ -1029,36 +1045,34 @@ This will install the [[https://github.com/theia-ide/typescript-language-server]
:config :config
(setq reftex-cite-prompt-optional-args t)) ;; Prompt for empty optional arguments in cite (setq reftex-cite-prompt-optional-args t)) ;; Prompt for empty optional arguments in cite
;(use-package auto-dictionary (use-package auto-dictionary
; :ensure t
; :init(add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1))))
(use-package company-auctex
:ensure t :ensure t
:init (company-auctex-init)) :init(add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1))))
(use-package tex
:ensure auctex
:mode ("\\.tex\\'" . latex-mode) ;(use-package tex
:config (progn ; :ensure auctex
(setq TeX-source-correlate-mode t) ; :mode ("\\.tex\\'" . latex-mode)
(setq TeX-source-correlate-method 'synctex) ; :config (progn
(setq TeX-auto-save t) ; (setq TeX-source-correlate-mode t)
(setq TeX-parse-self t) ; (setq TeX-source-correlate-method 'synctex)
(setq-default TeX-master "0_front_matter.tex") ; (setq TeX-auto-save t)
(setq reftex-plug-into-AUCTeX t) ; (setq TeX-parse-self t)
(pdf-tools-install) ; (setq-default TeX-master "0_front_matter.tex")
(setq TeX-view-program-selection '((output-pdf "PDF Tools")) ; (setq reftex-plug-into-AUCTeX t)
TeX-source-correlate-start-server t) ; (pdf-tools-install)
;; Update PDF buffers after successful LaTeX runs ; (setq TeX-view-program-selection '((output-pdf "PDF Tools"))
(add-hook 'TeX-after-compilation-finished-functions ; TeX-source-correlate-start-server t)
#'TeX-revert-document-buffer) ; ;; Update PDF buffers after successful LaTeX runs
(add-hook 'LaTeX-mode-hook ; (add-hook 'TeX-after-compilation-finished-functions
(lambda () ; 'TeX-revert-document-buffer)
(reftex-mode t) ; (add-hook 'LaTeX-mode-hook
;;(flyspell-mode t) ; (lambda ()
)) ; (reftex-mode t)
)) ; ;;(flyspell-mode t)
; ))
; ))

80
init.el
View File

@ -149,12 +149,15 @@
;; Disable line numbers for some modes ;; Disable line numbers for some modes
(dolist (mode '(org-mode-hook (dolist (mode '(org-mode-hook
pdf-view-mode-hook
term-mode-hook term-mode-hook
shell-mode-hook shell-mode-hook
treemacs-mode-hook treemacs-mode-hook
eshell-mode-hook)) eshell-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0)))) (add-hook mode (lambda () (display-line-numbers-mode 0))))
(setq-default display-line-numbers-type 'relative)
(global-set-key (kbd "C-x l") 'load-file) (global-set-key (kbd "C-x l") 'load-file)
(cond ((eq system-type 'darwin) (cond ((eq system-type 'darwin)
@ -648,6 +651,24 @@
:hook (julia-mode . julia-snail-mode)) :hook (julia-mode . julia-snail-mode))
;; Better configuration but rquires pdf-tools ;; Better configuration but rquires pdf-tools
(use-package auctex
:ensure t
;:defer t
:hook (LaTeX-mode .
(lambda ()
(push (list 'output-pdf "PDF Tools")
TeX-view-program-selection)))
)
(use-package company-auctex
:ensure t
:init (company-auctex-init))
(use-package auctex-latexmk
:ensure t
:config
(auctex-latexmk-setup)
(setq auctex-latexmk-inherit-TeX-PDF-mode t))
(use-package pdf-tools (use-package pdf-tools
:ensure t :ensure t
@ -662,11 +683,6 @@
(add-hook 'pdf-view-mode-hook 'pdf-tools-enable-minor-modes) (add-hook 'pdf-view-mode-hook 'pdf-tools-enable-minor-modes)
) )
(use-package auctex-latexmk
:ensure t
:config
(auctex-latexmk-setup)
(setq auctex-latexmk-inherit-TeX-PDF-mode t))
(use-package reftex (use-package reftex
:ensure t :ensure t
@ -674,36 +690,34 @@
:config :config
(setq reftex-cite-prompt-optional-args t)) ;; Prompt for empty optional arguments in cite (setq reftex-cite-prompt-optional-args t)) ;; Prompt for empty optional arguments in cite
;(use-package auto-dictionary (use-package auto-dictionary
; :ensure t
; :init(add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1))))
(use-package company-auctex
:ensure t :ensure t
:init (company-auctex-init)) :init(add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1))))
(use-package tex
:ensure auctex
:mode ("\\.tex\\'" . latex-mode) ;(use-package tex
:config (progn ; :ensure auctex
(setq TeX-source-correlate-mode t) ; :mode ("\\.tex\\'" . latex-mode)
(setq TeX-source-correlate-method 'synctex) ; :config (progn
(setq TeX-auto-save t) ; (setq TeX-source-correlate-mode t)
(setq TeX-parse-self t) ; (setq TeX-source-correlate-method 'synctex)
(setq-default TeX-master "0_front_matter.tex") ; (setq TeX-auto-save t)
(setq reftex-plug-into-AUCTeX t) ; (setq TeX-parse-self t)
(pdf-tools-install) ; (setq-default TeX-master "0_front_matter.tex")
(setq TeX-view-program-selection '((output-pdf "PDF Tools")) ; (setq reftex-plug-into-AUCTeX t)
TeX-source-correlate-start-server t) ; (pdf-tools-install)
;; Update PDF buffers after successful LaTeX runs ; (setq TeX-view-program-selection '((output-pdf "PDF Tools"))
(add-hook 'TeX-after-compilation-finished-functions ; TeX-source-correlate-start-server t)
#'TeX-revert-document-buffer) ; ;; Update PDF buffers after successful LaTeX runs
(add-hook 'LaTeX-mode-hook ; (add-hook 'TeX-after-compilation-finished-functions
(lambda () ; 'TeX-revert-document-buffer)
(reftex-mode t) ; (add-hook 'LaTeX-mode-hook
;;(flyspell-mode t) ; (lambda ()
)) ; (reftex-mode t)
)) ; ;;(flyspell-mode t)
; ))
; ))
(use-package rustic (use-package rustic
:ensure t :ensure t