Split the tex-mode stuff

master
Jacopo De Simoi 8 years ago
parent 3cc85fb23c
commit 5ab09ef043
  1. 71
      global.org

@ -528,29 +528,35 @@
(advice-add 'org-babel-tangle-single-block :around #'org-babel-tangle-single-block-handle-tangle-list)
#+END_SRC
** TODO split --- LaTeX
*** Require
Load auctex, reftex and set up related hooks
#+BEGIN_SRC emacs-lisp
(load "auctex.el" nil t t)
(require 'reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
#+END_SRC
*** Set default TeX options
#+BEGIN_SRC emacs-lisp
(setq-default TeX-master nil)
(setq TeX-auto-save t
TeX-parse-self t
TeX-insert-braces nil)
(setq-default TeX-master nil)
#+END_SRC
*** Appearance
No fontification for sub and superscripts
#+BEGIN_SRC emacs-lisp
(setq font-latex-fontify-script nil)
(setq LaTeX-equation-label "e_")
(setq LaTeX-section-label "s_")
(setq LaTeX-figure-label "f_")
(setq TeX-fold-ellipsis " …")
(require 'reftex)
(defun my-LaTeX-mode-dollars ()
(font-lock-add-keywords
nil
`((,(rx "$") (0 'success t)))
t))
(add-hook 'LaTeX-mode-hook 'my-LaTeX-mode-dollars)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
;; * Do not spell-check inside the following commands
;; see [https://tex.stackexchange.com/questions/117204/skip-spelling-in-emacs-for-the-content-of-a-user-macro]
#+END_SRC
*** Default labels
#+BEGIN_SRC emacs-lisp
(setq LaTeX-equation-label "e_"
LaTeX-section-label "s_"
LaTeX-figure-label "f_")
#+END_SRC
*** Spell checking help
Do not spell-check inside the following commands. See
[https://tex.stackexchange.com/questions/117204/skip-spelling-in-emacs-for-the-content-of-a-user-macro]
#+BEGIN_SRC emacs-lisp
(setq ispell-tex-skip-alists
(list
(append
@ -561,14 +567,15 @@
("\\\\address" ispell-tex-arg-end)
))
(cadr ispell-tex-skip-alists)))
(defun dabbrev-expand-helper ()
(interactive)
(call-interactively 'dabbrev-expand))
#+END_SRC
*** Specialty functions
This function adds a pair of delimiters or surrounds the active region
with the given delimiters.
**** TODO it breaks when there is no mark
#+BEGIN_SRC emacs-lisp
(defun add-delimiter (delim-begin delim-end r-begin r-end)
"Add the pair of delimiters given in delim at the ends of the region if it is activated"
"Add the pair of delimiters given in delim at the ends of the
region if it is activated"
(interactive "cBegin delimiter: \ncEnd delimiter: \nr")
(if (use-region-p)
(progn
@ -579,6 +586,22 @@
(save-excursion
(insert delim-end))
(insert delim-begin))))
#+END_SRC
*** TODO Leftovers
#+BEGIN_SRC emacs-lisp
(setq TeX-fold-ellipsis " …")
;; I lost track of what does this guy do?
(defun my-LaTeX-mode-dollars ()
(font-lock-add-keywords
nil
`((,(rx "$") (0 'success t)))
t))
(add-hook 'LaTeX-mode-hook 'my-LaTeX-mode-dollars)
(defun dabbrev-expand-helper ()
(interactive)
(call-interactively 'dabbrev-expand))
(add-hook 'LaTeX-mode-hook
(lambda ()

Loading…
Cancel
Save