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
(dolist (mode '(org-mode-hook
pdf-view-mode-hook
term-mode-hook
shell-mode-hook
treemacs-mode-hook
eshell-mode-hook))
(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)
#+end_src
@ -1003,6 +1006,24 @@ This will install the [[https://github.com/theia-ide/typescript-language-server]
#+begin_src emacs-lisp
;; 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
: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)
)
(use-package auctex-latexmk
:ensure t
:config
(auctex-latexmk-setup)
(setq auctex-latexmk-inherit-TeX-PDF-mode t))
(use-package reftex
:ensure t
@ -1029,36 +1045,34 @@ This will install the [[https://github.com/theia-ide/typescript-language-server]
:config
(setq reftex-cite-prompt-optional-args t)) ;; Prompt for empty optional arguments in cite
;(use-package auto-dictionary
; :ensure t
; :init(add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1))))
(use-package company-auctex
(use-package auto-dictionary
: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)
:config (progn
(setq TeX-source-correlate-mode t)
(setq TeX-source-correlate-method 'synctex)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master "0_front_matter.tex")
(setq reftex-plug-into-AUCTeX t)
(pdf-tools-install)
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
TeX-source-correlate-start-server t)
;; Update PDF buffers after successful LaTeX runs
(add-hook 'TeX-after-compilation-finished-functions
#'TeX-revert-document-buffer)
(add-hook 'LaTeX-mode-hook
(lambda ()
(reftex-mode t)
;;(flyspell-mode t)
))
))
;(use-package tex
; :ensure auctex
; :mode ("\\.tex\\'" . latex-mode)
; :config (progn
; (setq TeX-source-correlate-mode t)
; (setq TeX-source-correlate-method 'synctex)
; (setq TeX-auto-save t)
; (setq TeX-parse-self t)
; (setq-default TeX-master "0_front_matter.tex")
; (setq reftex-plug-into-AUCTeX t)
; (pdf-tools-install)
; (setq TeX-view-program-selection '((output-pdf "PDF Tools"))
; TeX-source-correlate-start-server t)
; ;; Update PDF buffers after successful LaTeX runs
; (add-hook 'TeX-after-compilation-finished-functions
; 'TeX-revert-document-buffer)
; (add-hook 'LaTeX-mode-hook
; (lambda ()
; (reftex-mode t)
; ;;(flyspell-mode t)
; ))
; ))

80
init.el
View File

@ -149,12 +149,15 @@
;; Disable line numbers for some modes
(dolist (mode '(org-mode-hook
pdf-view-mode-hook
term-mode-hook
shell-mode-hook
treemacs-mode-hook
eshell-mode-hook))
(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)
(cond ((eq system-type 'darwin)
@ -648,6 +651,24 @@
:hook (julia-mode . julia-snail-mode))
;; 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
:ensure t
@ -662,11 +683,6 @@
(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
:ensure t
@ -674,36 +690,34 @@
:config
(setq reftex-cite-prompt-optional-args t)) ;; Prompt for empty optional arguments in cite
;(use-package auto-dictionary
; :ensure t
; :init(add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1))))
(use-package company-auctex
(use-package auto-dictionary
: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)
:config (progn
(setq TeX-source-correlate-mode t)
(setq TeX-source-correlate-method 'synctex)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master "0_front_matter.tex")
(setq reftex-plug-into-AUCTeX t)
(pdf-tools-install)
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
TeX-source-correlate-start-server t)
;; Update PDF buffers after successful LaTeX runs
(add-hook 'TeX-after-compilation-finished-functions
#'TeX-revert-document-buffer)
(add-hook 'LaTeX-mode-hook
(lambda ()
(reftex-mode t)
;;(flyspell-mode t)
))
))
;(use-package tex
; :ensure auctex
; :mode ("\\.tex\\'" . latex-mode)
; :config (progn
; (setq TeX-source-correlate-mode t)
; (setq TeX-source-correlate-method 'synctex)
; (setq TeX-auto-save t)
; (setq TeX-parse-self t)
; (setq-default TeX-master "0_front_matter.tex")
; (setq reftex-plug-into-AUCTeX t)
; (pdf-tools-install)
; (setq TeX-view-program-selection '((output-pdf "PDF Tools"))
; TeX-source-correlate-start-server t)
; ;; Update PDF buffers after successful LaTeX runs
; (add-hook 'TeX-after-compilation-finished-functions
; 'TeX-revert-document-buffer)
; (add-hook 'LaTeX-mode-hook
; (lambda ()
; (reftex-mode t)
; ;;(flyspell-mode t)
; ))
; ))
(use-package rustic
:ensure t