doomemacs/modules/lang/latex
Henrik Lissner 7e400abdc0
fix(docs): set mode in file-local vars
Due to emacs-straight/org-mode@e22b4eb, a replacement major mode (for
org-mode) can no longer be specified from .dir-locals.el, as it spirals
into infinite recursion. Therefore, a mode: line is needed in all Doom
docs.

Ref: emacs-straight/org-mode@e22b4eb7aa
2022-08-03 02:46:33 +02:00
..
+fontification.el lang/latex: general refactor 2018-07-30 03:43:43 +02:00
+ref.el Remove redundant abstraction 2020-04-07 13:16:13 -04:00
+viewers.el refactor: rename orig-fn arg in advice to fn 2021-08-04 01:53:12 -04:00
autoload.el Fix latex item indent ignore LaTeX item indent (#4516) 2021-02-11 17:34:10 -05:00
config.el fix(latex): run AUCTeX folding after font locking 2021-11-18 19:05:36 +01:00
packages.el bump: :lang 2021-09-15 01:22:33 +02:00
README.org fix(docs): set mode in file-local vars 2022-08-03 02:46:33 +02:00

:lang latex

Description   unfold

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

+cdlatex
Enable cdlatex for fast math insertion.
+fold
Use TeX-fold (from auctex) to fold LaTeX macros to unicode, and make folding hook-based and less manual.
+latexmk
Use LatexMk instead of LaTeX to compile documents.
+lsp
Enable LSP support in latex buffers. Requires :tools lsp and a langserver (supports digestif and TexLab).

TODO Hacks

🔨 This module's hacks haven't been documented yet. Document them?

TODO Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

This module requires ghostscript and a latex compiler. These are provided by the texlive bundle, available through many OS package managers.

🚧 Ghostscript <= 9.27 is reportedly 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

apt-get install texlive

Arch Linux

pacman -S texlive-core

TODO macOS

brew install --cask basictex
# If the above doesn't work, then
brew install --cask mactex  # WARNING: large 4gb download!

🔨 This has not been verified.

NixOS

environment.systemPackages = [ pkgs.texlive.combined.scheme-medium ];

TODO Usage

🔨 This module has no usage documentation yet. Write some?

Configuration

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):

;; in $DOOMDIR/config.el
(setq reftex-default-bibliography "/your/bib/file.bib")

Changing the PDFs viewer

This module provides integration for four supported pdf viewers. They are

  • 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:

;; in $DOOMDIR/config.el
(setq +latex-viewers '(zathura))

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:

;; in $DOOMDIR/config.el
(map! :map cdlatex-mode-map
      :i "TAB" #'cdlatex-tab)

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.

Troubleshooting

There are no known problems with this module. Report one?

Frequently asked questions

This module has no FAQs yet. Ask one?

TODO Appendix

🔨 This module has no appendix yet. Write one?