Minor edits.

This commit is contained in:
Derek Taylor
2020-11-05 13:27:52 -06:00
parent 8fbacc6392
commit 35112d3f8c
170 changed files with 1304 additions and 756 deletions

View File

@@ -50,6 +50,17 @@
(after! latex-preview-pane
(setq latex-preview-pane-multifile-mode 'auctex)
;; TODO PR this to maintained fork. Original project appears abandoned
(defadvice! +latex--dont-reopen-preview-pane-a (orig-fn &rest args)
"Once the preview pane has been closed it should not be reopened."
:around #'latex-preview-pane-update
(letf! (defun init-latex-preview-pane (&rest _)
;; HACK Avoid the function because it tries to delete the current
;; window, but it's already gone, so it ends up deleting the
;; wrong window.
(setq-local latex-preview-pane-mode nil))
(apply orig-fn args)))
(define-key! doc-view-mode-map
"ESC" #'delete-window
"q" #'delete-window

View File

@@ -64,7 +64,7 @@ apt-get install texlive
** Arch Linux
#+BEGIN_SRC sh
pacman -S texlive
pacman -S texlive-core
#+END_SRC
** TODO macOS

View File

@@ -1,43 +1,44 @@
;;; lang/latex/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +latex/LaTeX-indent-item ()
"Provide proper indentation for LaTeX \"itemize\",\"enumerate\", and
\"description\" environments.
(defun +latex-indent-item-fn ()
"Indent LaTeX \"itemize\",\"enumerate\", and \"description\" environments.
\"\\item\" is indented `LaTeX-indent-level' spaces relative to the the beginning
of the environment.
Continuation lines are indented either twice `LaTeX-indent-level', or
`LaTeX-indent-level-item-continuation' if the latter is bound."
See `LaTeX-indent-level-item-continuation' for the indentation strategy this
function uses."
(save-match-data
(let* ((offset LaTeX-indent-level)
(contin (or (and (boundp '+latex-indent-level-item-continuation)
+latex-indent-level-item-continuation)
(* 4 offset)))
(re-beg "\\\\begin{")
(let* ((re-beg "\\\\begin{")
(re-end "\\\\end{")
(re-env "\\(itemize\\|\\enumerate\\|description\\)")
(re-env "\\(?:itemize\\|\\enumerate\\|description\\)")
(indent (save-excursion
(when (looking-at (concat re-beg re-env "}"))
(end-of-line))
(LaTeX-find-matching-begin)
(current-column))))
(current-column)))
(contin (pcase +latex-indent-item-continuation-offset
(`auto LaTeX-indent-level)
(`align 6)
(`nil (- LaTeX-indent-level))
(x x))))
(cond ((looking-at (concat re-beg re-env "}"))
(or (save-excursion
(beginning-of-line)
(ignore-errors
(LaTeX-find-matching-begin)
(+ (current-column)
LaTeX-indent-level
(if (looking-at (concat re-beg re-env "}"))
contin
offset))))
0))))
indent))
((looking-at (concat re-end re-env "}"))
indent)
((looking-at "\\\\item")
(+ offset indent))
((+ contin indent))))))
(+ LaTeX-indent-level indent))
((+ contin LaTeX-indent-level indent))))))
;;;###autoload
(defun +latex-fold-last-macro-a (&rest _)

View File

@@ -1,7 +1,27 @@
;;; lang/latex/config.el -*- lexical-binding: t; -*-
(defvar +latex-indent-level-item-continuation 4
"Custom indentation level for items in enumeration-type environments")
(defconst +latex-indent-item-continuation-offset 'align
"Level to indent continuation of enumeration-type environments.
i.e. This affects \\item, \\enumerate, and \\description.
Set this to `align' for:
\\item lines aligned
like this.
Set to `auto' for continuation lines to be offset by `LaTeX-indent-line':
\\item lines aligned
like this, assuming LaTeX-indent-line == 2
Any other fixed integer will be added to `LaTeX-item-indent' and the current
indentation level.
Set this to `nil' to disable all this behavior.
You'll need to adjust `LaTeX-item-indent' to control indentation of \\item
itself.")
(defvar +latex-enable-unicode-math nil
"If non-nil, use `company-math-symbols-unicode' backend in LaTeX-mode,
@@ -75,7 +95,10 @@ If no viewers are found, `latex-preview-pane' is used.")
(when (featurep! +lsp)
(add-hook! '(tex-mode-local-vars-hook
latex-mode-local-vars-hook)
#'lsp!)))
#'lsp!))
(map! :map LaTeX-mode-map
:localleader
:desc "View" "v" #'TeX-view))
(use-package! tex-fold
@@ -130,16 +153,17 @@ Math faces should stay fixed by the mixed-pitch blacklist, this is mostly for
;; Provide proper indentation for LaTeX "itemize","enumerate", and
;; "description" environments. See
;; http://emacs.stackexchange.com/questions/3083/how-to-indent-items-in-latex-auctex-itemize-environments
;; Set `+latex-indent-item-continuation-offset' to 0 to disable this
(dolist (env '("itemize" "enumerate" "description"))
(add-to-list 'LaTeX-indent-environment-list `(,env +latex/LaTeX-indent-item)))
(add-to-list 'LaTeX-indent-environment-list `(,env +latex-indent-item-fn)))
;; Fix #1849: allow fill-paragraph in itemize/enumerate
(defadvice! +latex--re-indent-itemize-and-enumerate-a (orig-fn &rest args)
:around #'LaTeX-fill-region-as-para-do
(let ((LaTeX-indent-environment-list
(append LaTeX-indent-environment-list
'(("itemize" +latex/LaTeX-indent-item)
("enumerate" +latex/LaTeX-indent-item)))))
'(("itemize" +latex-indent-item-fn)
("enumerate" +latex-indent-item-fn)))))
(apply orig-fn args)))
(defadvice! +latex--dont-indent-itemize-and-enumerate-a (orig-fn &rest args)
:around #'LaTeX-fill-region-as-paragraph

View File

@@ -5,7 +5,7 @@
(package! adaptive-wrap :pin "319db649fb083db3ad07b4c71ee6c9429497043b")
(package! latex-preview-pane :pin "5297668a89996b50b2b62f99cba01cc544dbed2e")
(when (featurep! :editor evil +everywhere)
(package! evil-tex :pin "06234c9ea4a7ffac91f7b4f3fd683014bb8137af"))
(package! evil-tex :pin "a3b6875d4027c675cf490622026a15a12fe1a911"))
;; Optional module features: