Created
February 25, 2014 21:03
-
-
Save stefano-meschiari/9217695 to your computer and use it in GitHub Desktop.
AUCTeX configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; AucTeX | |
(setq TeX-auto-save t) | |
(setq TeX-parse-self t) | |
(setq-default TeX-master nil) | |
(add-hook 'LaTeX-mode-hook 'visual-line-mode) | |
(add-hook 'LaTeX-mode-hook 'flyspell-mode) | |
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) | |
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) | |
(setq reftex-plug-into-AUCTeX t) | |
(setq TeX-PDF-mode t) | |
;; Use Skim as viewer, enable source <-> PDF sync | |
;; make latexmk available via C-c C-c | |
;; Note: SyncTeX is setup via ~/.latexmkrc (see below) | |
(add-hook 'LaTeX-mode-hook (lambda () | |
(push | |
'("latexmk" "latexmk -pdf %s" TeX-run-TeX nil t | |
:help "Run latexmk on file") | |
TeX-command-list))) | |
(add-hook 'TeX-mode-hook '(lambda () (setq TeX-command-default "latexmk"))) | |
;; use Skim as default pdf viewer | |
;; Skim's displayline is used for forward search (from .tex to .pdf) | |
;; option -b highlights the current line; option -g opens Skim in the background | |
(setq TeX-view-program-selection '((output-pdf "PDF Viewer"))) | |
(setq TeX-view-program-list | |
'(("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hooks are a mechanism used all around Emacs in order to modify its behavior in a more granular way.
A hook is a Elisp variable holding a list of functions, to be called on some well-defined occasion. In this case,
LaTeX-mode-hook
holds functions that are loaded when the LaTeX mode is loaded.Sometimes such commands need to be issued every time a file is entered. Emacs does not set it globally as expected.