summaryrefslogtreecommitdiffstats
path: root/lisp/ravi-init-tex.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ravi-init-tex.el')
-rw-r--r--lisp/ravi-init-tex.el29
1 files changed, 17 insertions, 12 deletions
diff --git a/lisp/ravi-init-tex.el b/lisp/ravi-init-tex.el
index 95df08f..7af212a 100644
--- a/lisp/ravi-init-tex.el
+++ b/lisp/ravi-init-tex.el
@@ -48,8 +48,23 @@
(sp-local-pair 'latex-mode "\\begin" "\\end")
(sp-local-tag 'latex-mode "\\ba" "\\begin{align*}" "\\end{align*}")
- (use-package preview :ensure nil)
- (use-package font-latex :ensure nil)
+ (use-package preview
+ :ensure nil
+ :if window-system
+ :config
+ (defun my-LaTeX-preview-math ()
+ (interactive)
+ (let ((b (save-excursion (while (texmathp) (backward-char 1)) (1- (point))))
+ (e (save-excursion (while (texmathp) (forward-char 1)) (point))))
+ (preview-region b e)))
+ (bind-key "C-<m-key>" 'my-LaTeX-preview-math preview-map))
+
+ (use-package font-latex
+ :ensure nil
+ :if window-system
+ :config
+ ;; fix italian quote highlight
+ (push '("\"<" "\">") font-latex-quote-list))
(fset 'tex-font-lock-subscript 'ignore)
(sp-with-modes '(tex-mode plain-tex-mode latex-mode)
@@ -114,9 +129,6 @@
(add-hook 'TeX-after-TeX-LaTeX-command-finished-hook
#'th/pdf-view-revert-buffer-maybe)
- ;; fix italian quote highlight
- (push '("\"<" "\">") font-latex-quote-list)
-
(defun my-latex-remove-command ()
"Unwrap the expression that point is in or before, also
removing the command name. By command we understand a symbol
@@ -156,13 +168,6 @@ starting with \\ and followed by a block of text enclosed in {}."
:hook (LaTex-mode . latex-extra-mode)
:diminish latex-extra-mode)
- (defun my-LaTeX-preview-math ()
- (interactive)
- (let ((b (save-excursion (while (texmathp) (backward-char 1)) (1- (point))))
- (e (save-excursion (while (texmathp) (forward-char 1)) (point))))
- (preview-region b e)))
- (bind-key "C-<m-key>" 'my-LaTeX-preview-math preview-map)
-
(defun my-LaTeX-mode-init ()
(setq TeX-auto-save t)
(setq TeX-parse-self t)