|
|
|
|
@ -1030,66 +1030,78 @@ |
|
|
|
|
("prop" ?p "prp:" "~\\ref{%s}" prp (regexp "propositions?")) |
|
|
|
|
("cor" ?c "cor:" "~\\ref{%s}" cor (regexp "corollary")) |
|
|
|
|
("def" ?d "def:" "~\\ref{%s}" cor (regexp "defintions?"))))) |
|
|
|
|
;;; advice the auctex function to replace the |
|
|
|
|
;;; lighter with somthing softer |
|
|
|
|
(with-eval-after-load "auctex" |
|
|
|
|
(defun cleanup-TeX-mode (&optional mode) |
|
|
|
|
"Advice for the base auctex MODE naming" |
|
|
|
|
(setq mode-name (replace-regexp-in-string "LaTeX" "χ" mode-name t)) |
|
|
|
|
(setq mode-name (replace-regexp-in-string "/" "·" mode-name))) |
|
|
|
|
(advice-add 'TeX-set-mode-name :after 'cleanup-TeX-mode)) |
|
|
|
|
|
|
|
|
|
#+END_SRC |
|
|
|
|
*** Setup ~latex-mode~ |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(eval-after-load 'latex |
|
|
|
|
'(progn |
|
|
|
|
(font-lock-add-keywords 'latex-mode |
|
|
|
|
`((,(rx "$") 0 'font-latex-sedate-face t)) t) |
|
|
|
|
(defface font-latex-special-comment-face '((t (:foreground "#2aa198"))) "Cyan") |
|
|
|
|
(font-lock-add-keywords 'latex-mode '(("^% \\([^*].*\\)" 1 'font-latex-special-comment-face t))) |
|
|
|
|
|
|
|
|
|
(define-key-alist LaTeX-mode-map |
|
|
|
|
'(("M-S-SPC" . TeX-insert-braces) |
|
|
|
|
("C-c C-v" . wilder/TeX-insert-reference) |
|
|
|
|
("C-M-<return>" . wilder/TeX-insert-align-dwim) |
|
|
|
|
;; unbind return - NOTE it is important to unbind |
|
|
|
|
;; <return> and not RET. If we unbind RET then C-m won't work |
|
|
|
|
;; either. |
|
|
|
|
("<return>" . (lambda() (interactive) (insert "\\"))) |
|
|
|
|
("S-<return>" . (lambda() (interactive) (insert "|"))) |
|
|
|
|
("C-c C-." . LaTeX-mark-environment) |
|
|
|
|
("C-c C-k" . (lambda (r-begin r-end) |
|
|
|
|
(interactive "r") |
|
|
|
|
(add-delimiter "_{" "}" r-begin r-end))) |
|
|
|
|
("C-c C-i" . (lambda (r-begin r-end) |
|
|
|
|
(interactive "r") |
|
|
|
|
(add-delimiter "^{" "}" r-begin r-end))) |
|
|
|
|
("M-|" . (lambda (r-begin r-end) |
|
|
|
|
(interactive "r") |
|
|
|
|
(add-delimiter "|" "|" r-begin r-end))) |
|
|
|
|
("M-," . (lambda (r-begin r-end) |
|
|
|
|
(interactive "r") |
|
|
|
|
(add-delimiter ", " ", " r-begin r-end))) |
|
|
|
|
("M-\"" . (lambda (r-begin r-end) |
|
|
|
|
(interactive "r") |
|
|
|
|
(add-delimiter "“" "”" r-begin r-end))) |
|
|
|
|
|
|
|
|
|
;; This is the rationale: C-M-SPC starts inline math C-M-RET starts display math |
|
|
|
|
|
|
|
|
|
("C-M-SPC" . (lambda (r-begin r-end) (interactive "r") (add-delimiter "$" "$" r-begin r-end))) |
|
|
|
|
("C-c C-d" . wilder/TeX-insert-todonote) |
|
|
|
|
("C-M-d" . kill-sexp) |
|
|
|
|
("C-M-i" . down-list) ;; -i stands for /in/ |
|
|
|
|
("C-M-o" . up-list) ;; -o stands for /out/ |
|
|
|
|
("<f4>" . ( lambda() (interactive) (message "Use C-c C-c"))) |
|
|
|
|
("C-c C-c" . ( lambda() (interactive) (compile "/home/jacopods/scripts/latex-mk")) ) |
|
|
|
|
("~" . wilder/TeX-replace-tilde) |
|
|
|
|
("C-o" . wilder/open-line-and-indent) |
|
|
|
|
;; Force moves around to be more “semantic” |
|
|
|
|
("C-v" . goto-next-comment-line) |
|
|
|
|
("M-v" . goto-previous-comment-line) |
|
|
|
|
("C-S-v" . backward-paragraph))) |
|
|
|
|
|
|
|
|
|
(mapcar (lambda (ch) |
|
|
|
|
(define-key LaTeX-mode-map (kbd ch) 'insert-char-with-padding)) |
|
|
|
|
'("=" "≠" ">" "<" "≥" "≤" "⇒" "∩" "∪" "∨" "∧" "×" "⊂" "⊃")) |
|
|
|
|
|
|
|
|
|
;; Move around commands in the Right Way™ |
|
|
|
|
(modify-syntax-entry ?\\ "w" LaTeX-mode-syntax-table) |
|
|
|
|
(setq subword-forward-regexp "\\W*\\(\\([\\\\[:upper:]]*\\W?\\)[[:lower:][:digit:]]*\\)") |
|
|
|
|
(setq subword-backward-regexp "\\(\\(\\W\\|[[:lower:][:digit:]]\\)\\([\\\\[:upper:]]+\\W*\\)\\|\\W\\w+\\)"))) |
|
|
|
|
(eval-after-load 'latex |
|
|
|
|
'(progn |
|
|
|
|
(font-lock-add-keywords 'latex-mode |
|
|
|
|
`((,(rx "$") 0 'font-latex-sedate-face t)) t) |
|
|
|
|
(defface font-latex-special-comment-face '((t (:foreground "#2aa198"))) "Cyan") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(font-lock-add-keywords 'latex-mode '(("^% \\([^*].*\\)" 1 'font-latex-special-comment-face t))) |
|
|
|
|
|
|
|
|
|
(define-key-alist LaTeX-mode-map |
|
|
|
|
'(("M-S-SPC" . TeX-insert-braces) |
|
|
|
|
("C-c C-v" . wilder/TeX-insert-reference) |
|
|
|
|
("C-M-<return>" . wilder/TeX-insert-align-dwim) |
|
|
|
|
;; unbind return - NOTE it is important to unbind |
|
|
|
|
;; <return> and not RET. If we unbind RET then C-m won't work |
|
|
|
|
;; either. |
|
|
|
|
("<return>" . (lambda() (interactive) (insert "\\"))) |
|
|
|
|
("S-<return>" . (lambda() (interactive) (insert "|"))) |
|
|
|
|
("C-c C-." . LaTeX-mark-environment) |
|
|
|
|
("C-c C-k" . (lambda (r-begin r-end) |
|
|
|
|
(interactive "r") |
|
|
|
|
(add-delimiter "_{" "}" r-begin r-end))) |
|
|
|
|
("C-c C-i" . (lambda (r-begin r-end) |
|
|
|
|
(interactive "r") |
|
|
|
|
(add-delimiter "^{" "}" r-begin r-end))) |
|
|
|
|
("M-|" . (lambda (r-begin r-end) |
|
|
|
|
(interactive "r") |
|
|
|
|
(add-delimiter "|" "|" r-begin r-end))) |
|
|
|
|
("M-," . (lambda (r-begin r-end) |
|
|
|
|
(interactive "r") |
|
|
|
|
(add-delimiter ", " ", " r-begin r-end))) |
|
|
|
|
("M-\"" . (lambda (r-begin r-end) |
|
|
|
|
(interactive "r") |
|
|
|
|
(add-delimiter "“" "”" r-begin r-end))) |
|
|
|
|
|
|
|
|
|
;; This is the rationale: C-M-SPC starts inline math C-M-RET starts display math |
|
|
|
|
|
|
|
|
|
("C-M-SPC" . (lambda (r-begin r-end) (interactive "r") (add-delimiter "$" "$" r-begin r-end))) |
|
|
|
|
("C-c C-d" . wilder/TeX-insert-todonote) |
|
|
|
|
("C-M-d" . kill-sexp) |
|
|
|
|
("C-M-i" . down-list) ;; -i stands for /in/ |
|
|
|
|
("C-M-o" . up-list) ;; -o stands for /out/ |
|
|
|
|
("<f4>" . ( lambda() (interactive) (message "Use C-c C-c"))) |
|
|
|
|
("C-c C-c" . ( lambda() (interactive) (compile "/home/jacopods/scripts/latex-mk")) ) |
|
|
|
|
("~" . wilder/TeX-replace-tilde) |
|
|
|
|
("C-o" . wilder/open-line-and-indent) |
|
|
|
|
;; Force moves around to be more “semantic” |
|
|
|
|
("C-v" . goto-next-comment-line) |
|
|
|
|
("M-v" . goto-previous-comment-line) |
|
|
|
|
("C-x n c" . narrow-between-comments) |
|
|
|
|
("C-S-v" . backward-paragraph))) |
|
|
|
|
|
|
|
|
|
(mapcar (lambda (ch) |
|
|
|
|
(define-key LaTeX-mode-map (kbd ch) 'insert-char-with-padding)) |
|
|
|
|
'("=" "≠" ">" "<" "≥" "≤" "⇒" "∩" "∪" "∨" "∧" "×" "⊂" "⊃")) |
|
|
|
|
|
|
|
|
|
;; Move around commands in the Right Way™ |
|
|
|
|
(modify-syntax-entry ?\\ "w" LaTeX-mode-syntax-table) |
|
|
|
|
(setq subword-forward-regexp "\\W*\\(\\([\\\\[:upper:]]*\\W?\\)[[:lower:][:digit:]]*\\)") |
|
|
|
|
(setq subword-backward-regexp "\\(\\(\\W\\|[[:lower:][:digit:]]\\)\\([\\\\[:upper:]]+\\W*\\)\\|\\W\\w+\\)"))) |
|
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
|
|
*** Require |
|
|
|
|
|