merge: rewrite-docs

I've omitted docs/*.org from this merge, as there is still work left to
do there, but I am pushing the module docs early so folks can benefit
from the new docs sooner.
This commit is contained in:
Henrik Lissner 2022-08-03 03:23:34 +02:00
commit 1f8bf7accb
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
179 changed files with 13125 additions and 8630 deletions

View file

@ -1,98 +1,112 @@
#+TITLE: lang/latex
#+DATE: January 16, 2017
#+SINCE: v1.3
#+STARTUP: inlineimages
# -*- mode: doom-docs-org -*-
#+title: :lang latex
#+subtitle: Writing papers in Emacs has never been so fun
#+created: January 16, 2017
#+since: 1.3
* 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
* 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
- 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 [[doom-package:][latex-preview-pane]]
- Bibtex editor
- Autocompletion using [[doom-package:][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.
** Maintainers
- [[doom-user:][@tecosaur]]
- [[doom-user:][@ymarco]]
** 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=)
[[doom-contrib-maintainer:][Become a maintainer?]]
* Prerequisites
You will need ghostscript and a latex compiler. All this is provided by
the =texlive= bundle, available through many OS package managers.
** 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.
- +latexmk ::
Use LatexMk instead of LaTeX to compile documents.
- +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:][auctex-latexmk]] if [[doom-module:][+latexmk]]
- [[doom-package:][cdlatex]] if [[doom-module:][+cdlatex]]
- [[doom-package:][evil-tex]] if [[doom-module:][:editor evil +everywhere]]
- [[doom-package:][latex-preview-pane]]
- if [[doom-module:][:completion company]]
- [[doom-package:][company-auctex]]
- [[doom-package:][company-math]]
- [[doom-package:][company-reftex]]
** TODO Hacks
#+begin_quote
🔨 This module's hacks haven't been documented yet. [[doom-contrib-module:][Document them?]]
#+end_quote
** TODO Changelog
# This section will be machine generated. Don't edit it by hand.
/This module does not have a changelog yet./
* Installation
[[id:01cffea4-3329-45e2-a892-95a384ab2338][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.
#+begin_quote
🚧 Ghostscript <= 9.27 is [[/auctex/manual/preview-latex/No-images-are-displayed-with-gs-9_002e27-and-earlier.html][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.
#+end_quote
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
#+begin_src sh
apt-get install texlive
#+END_SRC
#+end_src
** Arch Linux
#+BEGIN_SRC sh
#+begin_src sh
pacman -S texlive-core
#+END_SRC
#+end_src
** TODO macOS
#+BEGIN_SRC sh
#+begin_src sh
brew install --cask basictex
# If the above doesn't work, then
brew install --cask mactex # WARNING: large 4gb download!
#+END_SRC
#+end_src
#+begin_quote
This has not been verified.
🔨 This has not been verified.
#+end_quote
** NixOS
#+BEGIN_SRC nix
#+begin_src nix
environment.systemPackages = [ pkgs.texlive.combined.scheme-medium ];
#+END_SRC
#+end_src
* TODO Features
* TODO Usage
#+begin_quote
🔨 This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]
#+end_quote
* Customization
* 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):
#+BEGIN_SRC emacs-lisp
Reftex has a variable that allow you to specify where it should find your
bibliography file(s):
#+begin_src emacs-lisp
;; in $DOOMDIR/config.el
(setq reftex-default-bibliography "/your/bib/file.bib")
#+END_SRC
#+end_src
** Changing the PDFs viewer
This module provides integration for four supported pdf viewers. They are
@ -102,30 +116,41 @@ This module provides integration for four supported pdf viewers. They are
+ Sumatra PDF
+ Zathura
+ Okular
+ pdf-tools (requires =:tools pdf= module)
+ 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:
#+BEGIN_SRC emacs-lisp
#+begin_src emacs-lisp
;; in $DOOMDIR/config.el
(setq +latex-viewers '(zathura))
#+END_SRC
#+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
[[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 [[kbd:][TAB]] key for cdlatex, which takes care of snippet-related stuff:
#+begin_src emacs-lisp
;; in $DOOMDIR/config.el
(map! :map cdlatex-mode-map
:i "TAB" #'cdlatex-tab)
#+END_SRC
: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.
* Troubleshooting
/There are no known problems with this module./ [[doom-report:][Report one?]]
* Frequently asked questions
/This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]]
* TODO Appendix
#+begin_quote
🔨 This module has no appendix yet. [[doom-contrib-module:][Write one?]]
#+end_quote