Find file History

README.org

LaTeX layer

img/latex.png

Table of Contents

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 enable auto-fill set the variable latex-enable-auto-fill to t.

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

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

Keybindings

Key BindingDescription
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 arun all commands (compile and open viewer)
SPC m bbuild
SPC m cclose LaTeX environment
SPC m einsert LaTeX environment
SPC m i iinsert \item
SPC m kkill TeX job
SPC m lrecenter output buffer
SPC m minsert LaTeX macro
SPC m sinsert LaTeX section
SPC m vview output
SPC m h dTeX documentation, can be very slow
SPC m f efill LaTeX environment
SPC m f pfill LaTeX paragraph
SPC m f rfill LaTeX region
SPC m f sfill LaTeX section
SPC m p rpreview region
SPC m p bpreview buffer
SPC m p dpreview document
SPC m p epreview environment
SPC m p spreview section
SPC m p ppreview at point
SPC m p fcache preamble for preview
SPC m p cclear previews
SPC m vview
SPC m x bmake font bold
SPC m x Bmake font medium weight
SPC m x cmake font monospaced (for code)
SPC m x emake font emphasised
SPC m x imake font italic
SPC m x omake font oblique
SPC m x rremove font properties
SPC m x f ause calligraphic font
SPC m x f cuse small-caps font
SPC m x f fuse sans serif font
SPC m x f nuse normal font
SPC m x f ruse serif font
SPC m x f uuse upright font

Folding

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

Key BindingDescription
SPC m z =fold TeX math
SPC m z bfold TeX buffer
SPC m z efold TeX environment
SPC m z mfold TeX macro
SPC m z rfold TeX region

RefTeX

Key BindingDescription
SPC m r creftex-citation
SPC m r greftex-grep-document
SPC m r ireftex-index-selection-or-word
SPC m r Ireftex-display-index
SPC m r TABreftex-index
SPC m r lreftex-label
SPC m r preftex-index-phrase-selection-or-word
SPC m r Preftex-index-visit-phrases-buffer
SPC m r rreftex-reference
SPC m r sreftex-search-document
SPC m r treftex-toc
SPC m r Treftex-toc-recenter
SPC m r vreftex-view-crossref