This commit is contained in:
ry
2022-01-11 18:05:13 -08:00
parent 2046befee2
commit 8e7b654716
846 changed files with 71287 additions and 4 deletions

View File

@@ -0,0 +1,88 @@
;;; lang/latex/+fontification.el -*- lexical-binding: t; -*-
;; Fontification taken from https://tex.stackexchange.com/a/86119/81279.
(setq font-latex-match-reference-keywords
'(;; BibLaTeX.
("printbibliography" "[{")
("addbibresource" "[{")
;; Standard commands.
("cite" "[{")
("citep" "[{")
("citet" "[{")
("Cite" "[{")
("parencite" "[{")
("Parencite" "[{")
("footcite" "[{")
("footcitetext" "[{")
;; Style-specific commands.
("textcite" "[{")
("Textcite" "[{")
("smartcite" "[{")
("Smartcite" "[{")
("cite*" "[{")
("parencite*" "[{")
("supercite" "[{")
;; Qualified citation lists.
("cites" "[{")
("Cites" "[{")
("parencites" "[{")
("Parencites" "[{")
("footcites" "[{")
("footcitetexts" "[{")
("smartcites" "[{")
("Smartcites" "[{")
("textcites" "[{")
("Textcites" "[{")
("supercites" "[{")
;; Style-independent commands.
("autocite" "[{")
("Autocite" "[{")
("autocite*" "[{")
("Autocite*" "[{")
("autocites" "[{")
("Autocites" "[{")
;; Text commands.
("citeauthor" "[{")
("Citeauthor" "[{")
("citetitle" "[{")
("citetitle*" "[{")
("citeyear" "[{")
("citedate" "[{")
("citeurl" "[{")
;; Special commands.
("fullcite" "[{")
;; Cleveref.
("cref" "{")
("Cref" "{")
("cpageref" "{")
("Cpageref" "{")
("cpagerefrange" "{")
("Cpagerefrange" "{")
("crefrange" "{")
("Crefrange" "{")
("labelcref" "{")))
(setq font-latex-match-textual-keywords
'(;; BibLaTeX brackets.
("parentext" "{")
("brackettext" "{")
("hybridblockquote" "[{")
;; Auxiliary commands.
("textelp" "{")
("textelp*" "{")
("textins" "{")
("textins*" "{")
;; Subcaption.
("subcaption" "[{")))
(setq font-latex-match-variable-keywords
'(;; Amsmath.
("numberwithin" "{")
;; Enumitem.
("setlist" "[{")
("setlist*" "[{")
("newlist" "{")
("renewlist" "{")
("setlistdepth" "{")
("restartlist" "{")
("crefname" "{")))

View File

@@ -0,0 +1,39 @@
;;; lang/latex/+ref.el -*- lexical-binding: t; -*-
(use-package! reftex
:hook (LaTeX-mode . reftex-mode)
:config
;; Set up completion for citations and references.
(set-company-backend! 'reftex-mode 'company-reftex-labels 'company-reftex-citations)
;; Get RefTeX working with BibLaTeX, see
;; http://tex.stackexchange.com/questions/31966/setting-up-reftex-with-biblatex-citation-commands/31992#31992.
(setq reftex-cite-format
'((?a . "\\autocite[]{%l}")
(?b . "\\blockcquote[]{%l}{}")
(?c . "\\cite[]{%l}")
(?f . "\\footcite[]{%l}")
(?n . "\\nocite{%l}")
(?p . "\\parencite[]{%l}")
(?s . "\\smartcite[]{%l}")
(?t . "\\textcite[]{%l}"))
reftex-plug-into-AUCTeX t
reftex-toc-split-windows-fraction 0.3)
(when (featurep! :editor evil)
(add-hook 'reftex-mode-hook #'evil-normalize-keymaps))
(map! :map reftex-mode-map
:localleader
";" 'reftex-toc)
(add-hook! 'reftex-toc-mode-hook
(reftex-toc-rescan)
(map! :map 'local
:e "j" #'next-line
:e "k" #'previous-line
:e "q" #'kill-buffer-and-window
:e "ESC" #'kill-buffer-and-window)))
;; Set up mode for bib files.
(after! bibtex
(setq bibtex-dialect 'biblatex
bibtex-align-at-equal-sign t
bibtex-text-indentation 20)
(define-key bibtex-mode-map (kbd "C-c \\") #'bibtex-fill-entry))

View File

@@ -0,0 +1,67 @@
;;; lang/latex/+viewers.el -*- lexical-binding: t; -*-
;; Fall back PDF previewing to `latex-preview-pane-mode'.
(add-to-list 'TeX-view-program-selection '(output-pdf "preview-pane") 'append)
(add-to-list 'TeX-view-program-list '("preview-pane" latex-preview-pane-mode))
(dolist (viewer (reverse +latex-viewers))
(pcase viewer
(`skim
(when-let
(app-path
(and IS-MAC
(file-exists-p! (or "/Applications/Skim.app"
"~/Applications/Skim.app"))))
(add-to-list 'TeX-view-program-selection '(output-pdf "Skim"))
(add-to-list 'TeX-view-program-list
(list "Skim" (format "%s/Contents/SharedSupport/displayline -b %%n %%o %%b"
app-path)))))
(`sumatrapdf
(when (and IS-WINDOWS
(executable-find "SumatraPDF"))
(add-to-list 'TeX-view-program-selection '(output-pdf "SumatraPDF"))))
(`okular
(when (executable-find "okular")
;; Configure Okular as viewer. Including a bug fix
;; (https://bugs.kde.org/show_bug.cgi?id=373855).
(add-to-list 'TeX-view-program-list '("Okular" ("okular --noraise --unique file:%o" (mode-io-correlate "#src:%n%a"))))
(add-to-list 'TeX-view-program-selection '(output-pdf "Okular"))))
(`zathura
(when (executable-find "zathura")
(add-to-list 'TeX-view-program-selection '(output-pdf "Zathura"))))
(`evince
(when (executable-find "evince")
(add-to-list 'TeX-view-program-selection '(output-pdf "Evince"))))
(`pdf-tools
(when (featurep! :tools pdf)
(add-to-list 'TeX-view-program-selection '(output-pdf "PDF Tools"))
(when IS-MAC
;; PDF Tools isn't in `TeX-view-program-list-builtin' on macs.
(add-to-list 'TeX-view-program-list '("PDF Tools" TeX-pdf-tools-sync-view)))
;; Update PDF buffers after successful LaTeX runs.
(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)))))
(after! latex-preview-pane
(setq latex-preview-pane-multifile-mode 'auctex)
;; TODO: PR this to maintained fork by arifer48. The original project appears abandoned.
(defadvice! +latex--dont-reopen-preview-pane-a (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 fn args)))
(define-key! doc-view-mode-map
"ESC" #'delete-window
"q" #'delete-window
"k" (cmd! (quit-window) (delete-window))))

View File

@@ -0,0 +1,131 @@
#+TITLE: lang/latex
#+DATE: January 16, 2017
#+SINCE: v1.3
#+STARTUP: inlineimages
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#ubuntu][Ubuntu]]
- [[#arch-linux][Arch Linux]]
- [[#macos][macOS]]
- [[#nixos][NixOS]]
- [[#features][Features]]
- [[#customization][Customization]]
- [[#specifying-the-location-of-a-bibtex-file--corresponding-pdfs][Specifying the location of a bibtex file & corresponding PDFs]]
- [[#changing-the-pdfs-viewer][Changing the PDFs viewer]]
- [[#using-cdlatexs-snippets-despite-having-yasnippet][Using cdlatex's snippets despite having yasnippet]]
* Description
Provide a helping hand when working with LaTeX documents.
+ Sane defaults
+ Fontification of many popular commands
+ Pretty indentation of wrapped lines using the ~adaptive-wrap~ package
+ Spell checking with ~flycheck~
+ Change PDF viewer to Okular or ~latex-preview-pane~
+ Bibtex editor
+ Autocompletion using ~company-mode~
+ Compile your .tex code only once using LatexMk
** Module Flags
+ =+latexmk= Use LatexMk instead of LaTeX to compile documents.
+ =+cdlatex= Enable [[https://github.com/cdominik/cdlatex][cdlatex]] for fast math insertion.
+ =+lsp= Start LSP automatically in `tex-mode-hook`. This requires the =:tools
lsp= module. Supported servers are `digestif` and `TexLab`.
+ =+fold= Use TeX-fold (from auctex) to fold LaTeX macros to unicode, and make
folding hook-based and less manual.
** Plugins
+ [[http://www.gnu.org/software/auctex/][auctex]]
+ [[http://elpa.gnu.org/packages/adaptive-wrap.html][adaptive-wrap]]
+ [[https://github.com/iyefrat/evil-tex][evil-tex]] (when =:editor evil +everywhere=)
+ [[https://github.com/jsinglet/latex-preview-pane][latex-preview-pane]]
+ [[https://github.com/tom-tan/auctex-latexmk][auctex-latexmk]]*
+ [[https://github.com/alexeyr/company-auctex][company-auctex]]*
+ [[https://github.com/TheBB/company-reftex][company-reftex]]*
+ [[https://github.com/vspinu/company-math][company-math]]*
+ [[https://github.com/cdominik/cdlatex][cdlatex]] (=+cdlatex=)
* Prerequisites
You will need ghostscript and a latex compiler. All this is provided by
the =texlive= bundle, available through many OS package managers.
Ghostscript <= 9.27 is [[https://www.gnu.org/software/auctex/manual/preview-latex/No-images-are-displayed-with-gs-9_002e27-and-earlier.html][reported buggy]] and doesn't work with auctex's math
previews. (You can check you ghostscript version with ~gs --version~.) Most
package managers already have newer versions, but if not you might have to build
gs from source.
** Ubuntu
#+BEGIN_SRC sh
apt-get install texlive
#+END_SRC
** Arch Linux
#+BEGIN_SRC sh
pacman -S texlive-core
#+END_SRC
** TODO macOS
#+BEGIN_SRC sh
brew install --cask basictex
# If the above doesn't work, then
brew install --cask mactex # WARNING: large 4gb download!
#+END_SRC
#+begin_quote
This has not been verified.
#+end_quote
** NixOS
#+BEGIN_SRC nix
environment.systemPackages = [ pkgs.texlive.combined.scheme-medium ];
#+END_SRC
* TODO Features
* Customization
** Specifying the location of a bibtex file & corresponding PDFs
Reftex has a variable that allow you to
specify where it should find your bibliography file(s):
#+BEGIN_SRC emacs-lisp
(setq reftex-default-bibliography "/your/bib/file.bib")
#+END_SRC
** Changing the PDFs viewer
This module provides integration for four supported pdf viewers. They are
+ [[https://skim-app.sourceforge.io/][Skim.app]] (MacOS only)
+ Evince
+ Sumatra PDF
+ Zathura
+ Okular
+ pdf-tools (requires =:tools pdf= module)
They are searched for in this order. See ~+latex-viewers~ to change the order,
or remove tools from the search altogether. If you want to exclusively use one
tool, for instance:
#+BEGIN_SRC emacs-lisp
(setq +latex-viewers '(zathura))
#+END_SRC
If none of these tools are found, ~latex-preview-pane~ (uses ~DocView~ in Emacs)
is used as a fallback. You can use this exclusively by setting ~+latex-viewers~
to ~nil~.
** Using cdlatex's snippets despite having yasnippet
cdlatex has a snippet insertion capability which is disabled in favor of
yasnippet when using ~:editor snippets~. If you still wanna use it, simply rebind
the ~TAB~ key for cdlatex, which takes care of snippet-related stuff:
#+BEGIN_SRC emacs-lisp
(map! :map cdlatex-mode-map
:i "TAB" #'cdlatex-tab)
#+END_SRC
This would favor yasnippet's expansion and cursor movement over cdlatex's
expansion and movement, but that shouldn't matter if you're not using yasnippet
in latex buffers.

View File

@@ -0,0 +1,67 @@
;;; lang/latex/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(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.
See `LaTeX-indent-level-item-continuation' for the indentation strategy this
function uses."
(save-match-data
(let* ((re-beg "\\\\begin{")
(re-end "\\\\end{")
(re-env "\\(?:itemize\\|\\enumerate\\|description\\)")
(indent (save-excursion
(when (looking-at (concat re-beg re-env "}"))
(end-of-line))
(LaTeX-find-matching-begin)
(+ LaTeX-item-indent (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-item-indent
LaTeX-indent-level
(if (looking-at (concat re-beg re-env "}"))
contin
0))))
indent))
((looking-at (concat re-end re-env "}"))
(save-excursion
(beginning-of-line)
(ignore-errors
(LaTeX-find-matching-begin)
(current-column))))
((looking-at "\\\\item")
(+ LaTeX-indent-level indent))
((+ contin LaTeX-indent-level indent))))))
;;;###autoload
(defun +latex-fold-last-macro-a (&rest _)
"Advice to auto-fold LaTeX macros after functions that
typically insert macros."
;; A simpler approach would be to just fold the whole line, but if point was
;; inside a macro that would kick it out. So instead we fold the last macro
;; before point, hoping its the one newly inserted.
(TeX-fold-region (save-excursion
(search-backward "\\" (line-beginning-position) t)
(point))
(1+ (point))))
;;;###autoload
(defun +latex-symbols-company-backend (command &optional arg &rest _ignored)
"A wrapper backend for `company-mode' that either uses
`company-math-symbols-unicode' or `company-math-symbols-latex'. If
`+latex-enable-unicode-math' is non-nil use the former, otherwise the latter."
(if +latex-enable-unicode-math
(company-math-symbols-unicode command arg)
(company-math-symbols-latex command arg)))

View File

@@ -0,0 +1,278 @@
;;; lang/latex/config.el -*- lexical-binding: t; -*-
(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',
enabling unicode symbols in math regions. This requires the unicode-math LaTeX
package to be installed.")
(defvar +latex-viewers '(skim evince sumatrapdf zathura okular pdf-tools)
"A list of enabled LaTeX viewers to use, in this order. If they don't exist,
they will be ignored. Recognized viewers are skim, evince, sumatrapdf, zathura,
okular and pdf-tools.
If no viewer is found, `latex-preview-pane-mode' is used.")
;;
(defvar +latex--company-backends nil)
;;
;; Packages
(add-to-list 'auto-mode-alist '("\\.tex\\'" . LaTeX-mode))
(setq TeX-parse-self t ; parse on load
TeX-auto-save t ; parse on save
;; Use hidden directories for AUCTeX files.
TeX-auto-local ".auctex-auto"
TeX-style-local ".auctex-style"
TeX-source-correlate-mode t
TeX-source-correlate-method 'synctex
;; Don't start the Emacs server when correlating sources.
TeX-source-correlate-start-server nil
;; Automatically insert braces after sub/superscript in `LaTeX-math-mode'.
TeX-electric-sub-and-superscript t
;; Just save, don't ask before each compilation.
TeX-save-query nil)
(after! tex
;; Fontify common LaTeX commands.
(load! "+fontification")
;; Select viewer.
(load! "+viewers")
;; Do not prompt for a master file.
(setq-default TeX-master t)
;; Set-up chktex.
(setcar (cdr (assoc "Check" TeX-command-list)) "chktex -v6 -H %s")
(setq-hook! 'TeX-mode-hook
;; Tell Emacs how to parse TeX files.
ispell-parser 'tex
;; Don't auto-fill in math blocks.
fill-nobreak-predicate (cons #'texmathp fill-nobreak-predicate))
;; Enable word wrapping.
(add-hook 'TeX-mode-hook #'visual-line-mode)
;; Enable `rainbow-mode' after applying styles to the buffer.
(add-hook 'TeX-update-style-hook #'rainbow-delimiters-mode)
;; Display output of LaTeX commands in a popup.
(set-popup-rules! '((" output\\*$" :size 15)
("^\\*TeX \\(?:Help\\|errors\\)"
:size 0.3 :select t :ttl nil)))
(after! smartparens-latex
;; We have to use lower case modes here, because `smartparens-mode' uses
;; the same during configuration.
(let ((modes '(tex-mode plain-tex-mode latex-mode LaTeX-mode)))
;; All these excess pairs dramatically slow down typing in LaTeX buffers,
;; so we remove them. Let snippets do their job.
(dolist (open '("\\left(" "\\left[" "\\left\\{" "\\left|"
"\\bigl(" "\\biggl(" "\\Bigl(" "\\Biggl(" "\\bigl["
"\\biggl[" "\\Bigl[" "\\Biggl[" "\\bigl\\{" "\\biggl\\{"
"\\Bigl\\{" "\\Biggl\\{"
"\\lfloor" "\\lceil" "\\langle"
"\\lVert" "\\lvert" "`"))
(sp-local-pair modes open nil :actions :rem))
;; And tweak these so that users can decide whether they want use LaTeX
;; quotes or not, via `+latex-enable-plain-double-quotes'.
(sp-local-pair modes "``" nil :unless '(:add sp-in-math-p))))
;; Hook LSP, if enabled.
(when (featurep! +lsp)
(add-hook! '(tex-mode-local-vars-hook
latex-mode-local-vars-hook)
#'lsp!))
(map! :localleader
:map latex-mode-map
:desc "View" "v" #'TeX-view
:desc "Compile" "c" #'TeX-command-run-all
:desc "Run a command" "m" #'TeX-command-master)
(map! :after latex
:localleader
:map LaTeX-mode-map
:desc "View" "v" #'TeX-view
:desc "Compile" "c" #'TeX-command-run-all
:desc "Run a command" "m" #'TeX-command-master))
(use-package! tex-fold
:when (featurep! +fold)
:hook (TeX-mode . +latex-TeX-fold-buffer-h)
:hook (TeX-mode . TeX-fold-mode)
:config
(defun +latex-TeX-fold-buffer-h ()
(run-with-idle-timer 0 nil 'TeX-fold-buffer))
;; Fold after all AUCTeX macro insertions.
(advice-add #'TeX-insert-macro :after #'+latex-fold-last-macro-a)
;; Fold after CDLaTeX macro insertions.
(advice-add #'cdlatex-math-symbol :after #'+latex-fold-last-macro-a)
(advice-add #'cdlatex-math-modify :after #'+latex-fold-last-macro-a)
;; Fold after snippets.
(when (featurep! :editor snippets)
(add-hook! 'TeX-fold-mode-hook
(defun +latex-fold-snippet-contents-h ()
(add-hook! 'yas-after-exit-snippet-hook :local
(when (and yas-snippet-beg yas-snippet-end)
(TeX-fold-region yas-snippet-beg yas-snippet-end))))))
(add-hook! 'mixed-pitch-mode-hook
(defun +latex-fold-set-variable-pitch-h ()
"Fix folded things invariably getting fixed pitch when using mixed-pitch.
Math faces should stay fixed by the mixed-pitch blacklist, this is mostly for
\\section etc."
(when mixed-pitch-mode
;; Adding to this list makes mixed-pitch clean the face remaps after us
(add-to-list 'mixed-pitch-fixed-cookie
(face-remap-add-relative
'TeX-fold-folded-face
:family (face-attribute 'variable-pitch :family)
:height (face-attribute 'variable-pitch :height))))))
(map! :map TeX-fold-mode-map
:localleader
:desc "Fold paragraph" "f" #'TeX-fold-paragraph
:desc "Unfold paragraph" "F" #'TeX-fold-clearout-paragraph
:desc "Unfold buffer" "C-f" #'TeX-fold-clearout-buffer))
(after! latex
;; Add the TOC entry to the sectioning hooks.
(setq LaTeX-section-hook
'(LaTeX-section-heading
LaTeX-section-title
LaTeX-section-toc
LaTeX-section-section
LaTeX-section-label)
LaTeX-fill-break-at-separators nil
LaTeX-item-indent 0)
(when +latex--company-backends
(set-company-backend! 'latex-mode +latex--company-backends))
;; 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-indent-item-fn)))
;; Fix #1849: allow fill-paragraph in itemize/enumerate.
(defadvice! +latex--re-indent-itemize-and-enumerate-a (fn &rest args)
:around #'LaTeX-fill-region-as-para-do
(let ((LaTeX-indent-environment-list
(append LaTeX-indent-environment-list
'(("itemize" +latex-indent-item-fn)
("enumerate" +latex-indent-item-fn)))))
(apply fn args)))
(defadvice! +latex--dont-indent-itemize-and-enumerate-a (fn &rest args)
:around #'LaTeX-fill-region-as-paragraph
(let ((LaTeX-indent-environment-list LaTeX-indent-environment-list))
(delq! "itemize" LaTeX-indent-environment-list 'assoc)
(delq! "enumerate" LaTeX-indent-environment-list 'assoc)
(apply fn args))))
(use-package! preview
:hook (LaTeX-mode . LaTeX-preview-setup)
:config
(setq-default preview-scale 1.4
preview-scale-function
(lambda () (* (/ 10.0 (preview-document-pt)) preview-scale)))
;; Don't cache preamble, it creates issues with SyncTeX. Let users enable
;; caching if they have compilation times that long.
(setq preview-auto-cache-preamble nil)
(map! :map LaTeX-mode-map
:localleader
:desc "Preview" "p" #'preview-at-point
:desc "Unpreview" "P" #'preview-clearout-at-point))
(use-package! cdlatex
:when (featurep! +cdlatex)
:hook (LaTeX-mode . cdlatex-mode)
:hook (org-mode . org-cdlatex-mode)
:config
;; Use \( ... \) instead of $ ... $.
(setq cdlatex-use-dollar-to-ensure-math nil)
;; Disabling keys that have overlapping functionality with other parts of Doom.
(map! :map cdlatex-mode-map
;; Smartparens takes care of inserting closing delimiters, and if you
;; don't use smartparens you probably don't want these either.
"$" nil
"(" nil
"{" nil
"[" nil
"|" nil
"<" nil
;; TAB is used for CDLaTeX's snippets and navigation. But we have
;; Yasnippet for that.
(:when (featurep! :editor snippets)
"TAB" nil)
;; AUCTeX takes care of auto-inserting {} on _^ if you want, with
;; `TeX-electric-sub-and-superscript'.
"^" nil
"_" nil
;; AUCTeX already provides this with `LaTeX-insert-item'.
[(control return)] nil))
;; Nicely indent lines that have wrapped when visual line mode is activated.
(use-package! adaptive-wrap
:hook (LaTeX-mode . adaptive-wrap-prefix-mode)
:init (setq-default adaptive-wrap-extra-indent 0))
(use-package! auctex-latexmk
:when (featurep! +latexmk)
:after latex
:init
;; Pass the -pdf flag when TeX-PDF-mode is active.
(setq auctex-latexmk-inherit-TeX-PDF-mode t)
;; Set LatexMk as the default.
(setq-hook! LaTeX-mode TeX-command-default "LatexMk")
:config
;; Add LatexMk as a TeX target.
(auctex-latexmk-setup))
(use-package! evil-tex
:when (featurep! :editor evil +everywhere)
:hook (LaTeX-mode . evil-tex-mode))
(use-package! company-auctex
:when (featurep! :completion company)
:defer t
:init
(add-to-list '+latex--company-backends #'company-auctex-environments nil #'eq)
(add-to-list '+latex--company-backends #'company-auctex-macros nil #'eq))
(use-package! company-math
:when (featurep! :completion company)
:defer t
:init
(add-to-list '+latex--company-backends #'+latex-symbols-company-backend nil #'eq))
;; BibTeX + RefTeX.
(load! "+ref")

View File

@@ -0,0 +1,23 @@
;; -*- no-byte-compile: t; -*-
;;; lang/latex/packages.el
(package! auctex :pin "3b0a080ae596c26c17b15ba9c71fc5542eae238b")
(package! adaptive-wrap :pin "0d5b4a07de76d87dd64333a566a8a0a845f2b9f0")
(package! latex-preview-pane :pin "5297668a89996b50b2b62f99cba01cc544dbed2e")
(when (featurep! :editor evil +everywhere)
(package! evil-tex :pin "aa0ddf8e768a24cda6d50d07f04c8e7813a2dccd"))
;; Optional module features.
(when (featurep! +latexmk)
(package! auctex-latexmk :pin "4d353522650d7685acbf1d38f7dbc504f734bd84"))
(when (featurep! +cdlatex)
(package! cdlatex :pin "f215b70c5cb02bbc43f5a7d5c8e5e3460ff82428"))
;; Features according to other user selected options.
(when (featurep! :completion company)
(package! company-auctex :pin "9400a2ec7459dde8cbf1a5d50dfee4e300ed7e18")
(package! company-reftex :pin "42eb98c6504e65989635d95ab81b65b9d5798e76")
(package! company-math :pin "45778f5731c97a21a83e3b965cbde42018709afd"))