Variable: latex-mode-hook
latex-mode-hook is a variable defined in tex-mode.el.gz.
Value
nil
Documentation
Hook run after entering LaTeX mode.
No problems result if this variable is not bound.
add-hook automatically binds it. (This is true for all hook variables.)
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/tex-mode.el.gz
;;;###autoload
(define-derived-mode latex-mode tex-mode "LaTeX"
"Major mode for editing files of input for LaTeX.
Makes $ and } display the characters they match.
Makes \" insert \\=`\\=` when it seems to be the beginning of a quotation,
and \\='\\=' when it appears to be the end; it inserts \" only after a \\.
Use \\[tex-region] to run LaTeX on the current region, plus the preamble
copied from the top of the file (containing \\documentstyle, etc.),
running LaTeX under a special subshell. \\[tex-buffer] does the whole buffer.
\\[tex-file] saves the buffer and then processes the file.
\\[tex-print] prints the .dvi file made by any of these.
\\[tex-view] previews the .dvi file made by any of these.
\\[tex-bibtex-file] runs bibtex on the file of the current buffer.
Use \\[tex-validate-buffer] to check buffer for paragraphs containing
mismatched $'s or braces.
Special commands:
\\{latex-mode-map}
Mode variables:
latex-run-command
Command string used by \\[tex-region] or \\[tex-buffer].
tex-directory
Directory in which to create temporary files for LaTeX jobs
run by \\[tex-region] or \\[tex-buffer].
tex-dvi-print-command
Command string used by \\[tex-print] to print a .dvi file.
tex-alt-dvi-print-command
Alternative command string used by \\[tex-print] (when given a prefix
argument) to print a .dvi file.
tex-dvi-view-command
Command string used by \\[tex-view] to preview a .dvi file.
tex-show-queue-command
Command string used by \\[tex-show-print-queue] to show the print
queue that \\[tex-print] put your job on.
Entering Latex mode runs the hook `text-mode-hook', then
`tex-mode-hook', and finally `latex-mode-hook'. When the special
subshell is initiated, `tex-shell-hook' is run."
(setq-local tex-command latex-run-command)
(setq-local tex-start-of-header "\\\\document\\(style\\|class\\)")
(setq-local tex-end-of-header "\\\\begin\\s-*{document}")
(setq-local tex-trailer "\\end{document}\n")
;; A line containing just $$ is treated as a paragraph separator.
;; A line starting with $$ starts a paragraph,
;; but does not separate paragraphs if it has more stuff on it.
;; For \pagebreak allow latex optional arg like \pagebreak[2]
(setq paragraph-start
(concat "[ \t]*\\(\\$\\$\\|"
"\\\\[][]\\|"
"\\\\" (regexp-opt (append
(mapcar #'car latex-section-alist)
'("begin" "label" "end"
"item" "bibitem" "newline" "noindent"
"newpage" "footnote" "marginpar"
"parbox" "caption"))
t)
"\\>\\|\\\\[a-z]*" (regexp-opt '("space" "skip" "page") t)
"\\>\\)"))
(setq paragraph-separate
(concat "\\([ \t]*%\\)\\|[\f]\\|[ \t]*\\($\\|"
"\\\\[][]\\|"
"\\\\" (regexp-opt (append
(mapcar #'car latex-section-alist)
'("begin" "label" "end" ))
t)
"\\>\\|\\\\\\(" (regexp-opt '("item" "bibitem" "newline"
"noindent" "newpage" "footnote"
"marginpar" "parbox" "caption"))
"\\|\\$\\$\\|[a-z]*\\(space\\|skip\\|page[a-z]*\\)"
"\\>\\)[][0-9 \t]*\\($\\|%\\)\\)"))
(setq-local imenu-create-index-function #'latex-imenu-create-index)
(setq-local tex-face-alist tex-latex-face-alist)
(add-hook 'fill-nobreak-predicate #'latex-fill-nobreak-predicate nil t)
(setq-local indent-line-function #'latex-indent)
(setq-local fill-indent-according-to-mode t)
(add-hook 'completion-at-point-functions
#'latex-complete-data nil 'local)
(add-hook 'flymake-diagnostic-functions #'tex-chktex nil t)
(setq-local outline-regexp latex-outline-regexp)
(setq-local outline-level #'latex-outline-level)
(setq-local forward-sexp-function #'latex-forward-sexp)
(setq-local skeleton-end-hook nil)
(setq-local comment-region-function #'latex--comment-region)
(setq-local comment-style 'plain))