This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+lang/latex
Matt Kramer 5fcd84d845
[latex] Init jump handlers in LaTeX-mode-hook
AUCTeX is weird: It reports major-mode as latex-mode (since TeX-latex-mode is
applied as an :override advice on the basic built-in latex-mode), but its mode
hook is LaTeX-mode-hook, not latex-mode-hook (which is only run by the built-in
latex-mode). Since bind-map uses the value of major-mode, we must pass
latex-mode to spacemacs|define-jump-handlers. But then
spacemacs//init-jump-handlers-latex-mode gets added to latex-mode-hook, which
never gets run. So we must manualy add it to LaTeX-mode-hook.

[latex] Use dumb-jump as primary jump handler

Otherwise, the default is used, which prioritizes evil-goto-definition over
dumb-jump-go. Dumb Jump tends to Just Work, while evil-goto-definition doesn't
handle LaTeX very well, at least not without a TAGS table.

[latex] Update CHANGELOG.develop
2020-06-11 01:18:47 +02:00
..
img
config.el [latex] Init jump handlers in LaTeX-mode-hook 2020-06-11 01:18:47 +02:00
funcs.el
packages.el Fix ~SPC m ;~ binding 2020-01-20 15:41:20 +01:00
README.org [latex] Fix README to say auto-fill on by default. 2019-12-15 11:01:17 +01:00

LaTeX layer

/TakeV/spacemacs/media/commit/82b2942cb7a26a26459f82086186d77de716b1dc/layers/+lang/latex/img/latex.png

Description

This layer adds support for LaTeX files with AucTeX.

Features:

BibTeX

For more extensive support of BibTeX files than RefTeX provides, have a look at the BibTeX layer.

Install

Layer

To use this configuration layer, add it to your ~/.spacemacs. You will need to add latex to the existing dotspacemacs-configuration-layers list in this file.

Auto-completion

Add the layer auto-completion to the variable dotspacemacs-configuration-layers of your dotfile ~/.spacemacs.

Previewing

To perform full-document previews (that is, aside from the inline previewing under SPC m p), add the following to your .spacemacs under dotspacemacs/user-config:

  (add-hook 'doc-view-mode-hook 'auto-revert-mode)

Then when you open up a compiled PDF, the preview will update automatically when you recompile.

Build command

A build command can be specified via the layer variable latex-build-command.

If LatexMk is specified, the appropriate LatexMk configuration will be applied. (the default on systems with latexmk in the path) This variable can be set to any of the entities in TeX-command-list, including any custom entries you may have added there. To use the regular AucTeX command set latex-build-command to LaTeX as shown below.

  dotspacemacs-configuration-layers '(
    (latex :variables latex-build-command "LaTeX"))

Auto-fill

To disable auto-fill (which is on by default) set the variable latex-enable-auto-fill to nil.

The variable latex-nofill-env provide the list of environment names where auto-fill-mode will be inhibited.

  dotspacemacs-configuration-layers '(
    (latex :variables latex-enable-auto-fill nil))

Folding

Enable folding of text by setting latex-enable-folding to t. Default value is nil.

  dotspacemacs-configuration-layers '(
    (latex :variables latex-enable-folding t))

Magic latex buffer

To enable "magic" symbols in latex buffers, set the variable latex-enable-magic to t.

  dotspacemacs-configuration-layers '(
    (latex :variables latex-enable-magic t))

The precise effect of this feature can be modified by adjusting the following variables:

  • magic-latex-enable-block-highlight: show font properties like \large (default t).
  • magic-latex-enable-block-align: reflect block alignment such as \center (default nil).
  • magic-latex-enable-pretty-symbols: substitute symbols in place of code, e.g. greek letters (default t).
  • magic-latex-enable-suscript: show subscripts and superscripts (default t).
  • magic-latex-enable-inline-image: show images inline (default nil).

By default, the underlying latex code is echoed in the echo area.

Key bindings

Key binding Description
SPC m - recenter output buffer
SPC m , TeX command on master file
SPC m . mark LaTeX environment
SPC m * mark LaTeX section
SPC m % comment or uncomment a paragraph
SPC m ; comment or uncomment a region
SPC m a run all commands (compile and open viewer)
SPC m b build
SPC m c close LaTeX environment
SPC m e insert LaTeX environment
SPC m i i insert \item
SPC m k kill TeX job
SPC m l recenter output buffer
SPC m m insert LaTeX macro
SPC m n goto next error
SPC m N goto previous error
SPC m s insert LaTeX section
SPC m v view output
SPC m h d TeX documentation, can be very slow
SPC m f e fill LaTeX environment
SPC m f p fill LaTeX paragraph
SPC m f r fill LaTeX region
SPC m f s fill LaTeX section
SPC m p r preview region
SPC m p b preview buffer
SPC m p d preview document
SPC m p e preview environment
SPC m p s preview section
SPC m p p preview at point
SPC m p f cache preamble for preview
SPC m p c clear previews
SPC m v view
SPC m x b make font bold
SPC m x B make font medium weight
SPC m x c make font monospaced (for code)
SPC m x e make font emphasised
SPC m x i make font italic
SPC m x o make font oblique
SPC m x r remove font properties
SPC m x f a use calligraphic font
SPC m x f c use small-caps font
SPC m x f f use sans serif font
SPC m x f n use normal font
SPC m x f r use serif font
SPC m x f u use upright font

Folding

Available only when latex-enable-folding is non nil.

Key binding Description
SPC m z = fold TeX math
SPC m z b fold TeX buffer
SPC m z e fold TeX environment
SPC m z m fold TeX macro
SPC m z r fold TeX region

RefTeX

Key binding Description
SPC m r c reftex-citation
SPC m r g reftex-grep-document
SPC m r i reftex-index-selection-or-word
SPC m r I reftex-display-index
SPC m r TAB reftex-index
SPC m r l reftex-label
SPC m r p reftex-index-phrase-selection-or-word
SPC m r P reftex-index-visit-phrases-buffer
SPC m r r reftex-reference
SPC m r s reftex-search-document
SPC m r t reftex-toc
SPC m r T reftex-toc-recenter
SPC m r v reftex-view-crossref