This avoids inserting braces when you type "a_", so you end up typing "a_i" instead of "a_{i}". The official LaTeX manual says that braces are correct, but it doesn't matter for many cases, e.g., when the sub/superscript is just a single token like "i". It's simply a matter of taste in these cases. - Frank Mittelbach, a LaTeX maintainer, says that he types "a_i": https://tex.stackexchange.com/questions/82329/how-bad-for-tex-is-omitting-braces-even-if-the-result-is-the-same#comment176261_82331 - David Carlisle, another LaTeX maintainer, says that a_i "arguably improves the look of the source code": https://tex.stackexchange.com/a/82337 - Joseph Wright, yet another LaTeX maintainer, says that he "would always use braces here, so favour a_{i}": https://tex.stackexchange.com/a/1929 And I think if it is a matter of taste, then the sane default is to avoid any magic that gets in the way of users. Anyone who prefers braces can still enable this argument, but people who do not like them won't get upset every time they type "_" or "^".
: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 doom-package:adaptive-wrap package
- Spell checking with doom-package:flycheck
- Change PDF viewer to Okular or AUCTeX-selected viewer
- Bibtex editor
- Autocompletion using doom-package:company-mode
- Compile your
.tex
code only once using LatexMk
Maintainers
Module flags
- +cdlatex
- Enable doom-package:cdlatex for fast math insertion.
- +fold
- Use TeX-fold (from doom-package:auctex) to fold LaTeX macros to unicode, and make folding hook-based and less manual.
- +lsp
- Enable LSP support in latex buffers. Requires doom-module::tools lsp and a langserver (supports digestif and TexLab).
Packages
- doom-package:adaptive-wrap
- doom-package:auctex
- doom-package:cdlatex if doom-module:+cdlatex
- doom-package:evil-tex if doom-module::editor evil +everywhere
- doom-package:auctex-cont-latexmk
-
if doom-module::completion company
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-basic texlive-latexrecommended texlive-plaingeneric
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 ];
Formatter
Formatting is handled using the doom-module::editor format module via latexindent.
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 doom-module::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))
Using cdlatex's snippets despite having yasnippet
doom-package:cdlatex has a snippet insertion capability which is disabled in favor of doom-package:yasnippet when using doom-module::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?
Appendix
Commands
+latex/live-preview
: Pop up the viewer of choice and display the document compiled live with each save.