This is a basic emacs configuration to work with LaTeX projects. The configuration has been tested on Ubuntu 20.04 LTS.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
5.3 KiB

3 years ago
  1. ;;; My basic configuration Gerardo Marx 20/Sep/2021
  2. ;; Ubuntu version
  3. ;;--------
  4. ;; Melpa repository:
  5. (require 'package)
  6. (add-to-list 'package-archives
  7. '("melpa" . "https://melpa.org/packages/")t)
  8. (package-initialize)
  9. ;;+++++++++++++
  10. ;;function to check installed packages:
  11. (defun is-installed (pack)
  12. "Check if a package is istalled"
  13. (unless (package-installed-p pack)
  14. (package-refresh-contents)
  15. (package-install pack)))
  16. ;;++++++++++++++++
  17. ;; Packages used
  18. ;;...............
  19. ;;++++++++++++++
  20. ;; Helm
  21. (is-installed 'helm)
  22. (require 'helm-config)
  23. (global-set-key (kbd "M-x") 'helm-M-x)
  24. (global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks)
  25. (global-set-key (kbd "C-x C-f") #'helm-find-files)
  26. (helm-mode 1)
  27. ;;++++++++++++
  28. ;; which-key
  29. (is-installed 'which-key)
  30. (require 'which-key)
  31. (which-key-mode)
  32. ;;+++++++++++++
  33. ;; frame size
  34. (setq initial-frame-alist '((top . 0)(left . 0)
  35. (width . 80)(height . 50)))
  36. (set-frame-parameter (selected-frame) 'alpha '(95 . 15)) ;;transparency
  37. (add-to-list 'default-frame-alist '(alpha . (95 . 15))) ;;transparency
  38. ;;+++++++++++
  39. ;; Doom-themes, all-the-icons, mode-line and font
  40. (unless (package-installed-p 'doom-themes)
  41. (package-install 'doom-themes))
  42. (unless (package-installed-p 'all-the-icons)
  43. (package-install 'all-the-icons))
  44. (require 'doom-themes)
  45. ;; Global settings (defaults)
  46. (setq doom-themes-enable-bold t ; if nil, bold is universally disabled
  47. doom-themes-enable-italic t) ; if nil, italics is universally disabled
  48. ;; Load the theme (doom-one, doom-molokai, etc); keep in mind that each
  49. ;; theme may have their own settings.
  50. (load-theme 'doom-one t)
  51. ;; Enable flashing mode-line on errors
  52. (doom-themes-visual-bell-config)
  53. ;; Enable custom neotree theme
  54. (doom-themes-neotree-config) ; all-the-icons fonts must be installed!
  55. ;; Installling doom-modeline:
  56. (unless (package-installed-p 'doom-modeline)
  57. (package-install 'doom-modeline))
  58. (require 'doom-modeline)
  59. (doom-modeline-mode 1)
  60. ;;Intalling all-the-icons font:
  61. (unless (package-installed-p 'all-the-icons)
  62. (package-install 'all-the-icons))
  63. ;; Set default font:
  64. (add-to-list 'default-frame-alist
  65. '(font . "Source Code Pro-14"))
  66. ;;+++++++
  67. ;;auctex:
  68. (is-installed 'auctex)
  69. (is-installed 'pdf-tools);; PDFtools
  70. (pdf-tools-install)
  71. (setenv "PATH" (concat "/Library/TeX/texbin:"
  72. (getenv "PATH")))
  73. (add-to-list 'exec-path "/Library/TeX/texbin")
  74. (setq TeX-auto-save t)
  75. (setq TeX-save-query nil)
  76. (setq LaTeX-includegraphics-read-file 'LaTeX-includegraphics-read-file-relative)
  77. (setq TeX-parse-self t)
  78. (setq-default TeX-master nil)
  79. (add-hook 'LaTeX-mode-hook 'visual-line-mode)
  80. (add-hook 'LaTeX-mode-hook 'flyspell-mode)
  81. (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
  82. (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
  83. (setq reftex-plug-into-AUCTeX t)
  84. (setq TeX-view-program-selection '((output-pdf "PDF Tools"))
  85. TeX-source-correlate-start-server t)
  86. ;; Update PDF buffers after successful LaTeX runs
  87. (add-hook 'TeX-after-compilation-finished-functions
  88. #'TeX-revert-document-buffer)
  89. (add-to-list 'auto-mode-alist '("\\.pdf\\'" . pdf-view-mode))
  90. (add-hook 'pdf-view-mode-hook
  91. (lambda () (pdf-tools-enable-minor-modes)))
  92. (setq TeX-source-correlate-method 'synctex)
  93. ;;--end----
  94. ;;========
  95. ;;Flyspell
  96. (setq ispell-program-name "/usr/bin/aspell")
  97. (dolist (hook '(text-mode-hook))
  98. (add-hook hook (lambda () (flyspell-mode 1))))
  99. ;; ==========
  100. ;; ORG files:
  101. (is-installed 'org-ref)
  102. (require 'org-ref)
  103. (setq org-latex-pdf-process (list "latexmk -shell-escape -bibtex -f -pdf %f"))
  104. (setq org-latex-prefer-user-labels t)
  105. ;; ==========
  106. ;; TRMAP
  107. (eval-after-load 'tramp '(setenv "SHELL" "/bin/bash"))
  108. ;;=========
  109. ;;Shell
  110. (setq-default explicit-shell-file-name "/bin/bash")
  111. ;; =========
  112. ;; markdown
  113. (is-installed 'markdown-mode)
  114. (autoload 'markdown-mode "markdown-mode"
  115. "Major mode for editing Markdown files" t)
  116. (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
  117. (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
  118. (autoload 'gfm-mode "markdown-mode"
  119. "Major mode for editing GitHub Flavored Markdown files" t)
  120. (add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))
  121. ;; ========
  122. ;;Neotree
  123. (is-installed 'neotree)
  124. (require 'neotree)
  125. (global-set-key [f8] 'neotree-toggle)
  126. ;;====================
  127. ;; emacs startup config
  128. (setq inhibit-startup-message nil) ;;inhibit startup
  129. (global-visual-line-mode t)
  130. (tool-bar-mode -1)
  131. (menu-bar-mode -1)
  132. (global-hl-line-mode +1) ;; highlith current line
  133. (delete-selection-mode +1) ;; deletes selected text and replace it
  134. (scroll-bar-mode -1)
  135. (setq ns-right-alternate-modifier nil) ;; right option macos key enable
  136. (fset 'yes-or-no-p 'y-or-n-p) ;; Ask y/n instead of yes/no
  137. (add-hook 'prog-mode-hook 'display-line-numbers-mode) ;; display line number when programming
  138. (show-paren-mode +1) ;; show matching parentheses
  139. ;;---------
  140. ;;Keybindings:
  141. ;;(global-set-key (kbd "M-x") 'helm-M-x)
  142. ;;................
  143. (custom-set-faces
  144. ;; custom-set-faces was added by Custom.
  145. ;; If you edit it by hand, you could mess it up, so be careful.
  146. ;; Your init file should contain only one such instance.
  147. ;; If there is more than one, they won't work right.
  148. )
  149. (custom-set-variables
  150. ;; custom-set-variables was added by Custom.
  151. ;; If you edit it by hand, you could mess it up, so be careful.
  152. ;; Your init file should contain only one such instance.
  153. ;; If there is more than one, they won't work right.
  154. )