2443 |
are stored, @pxref{Automatic Local}. If @AUCTeX{} finds the pre-parsed |
are stored, @pxref{Automatic Local}. If @AUCTeX{} finds the pre-parsed |
2444 |
information when loading a file, it will not need to reparse the buffer. |
information when loading a file, it will not need to reparse the buffer. |
2445 |
The information in the @file{auto} directory is also useful for |
The information in the @file{auto} directory is also useful for |
2446 |
multifile documents @pxref{Multifile}, since it allows each file to |
multifile documents, @pxref{Multifile}, since it allows each file to |
2447 |
access the parsed information from all the other files in the document. |
access the parsed information from all the other files in the document. |
2448 |
This is done by first reading the information from the master file, and |
This is done by first reading the information from the master file, and |
2449 |
then recursively the information from each file stored in the master |
then recursively the information from each file stored in the master |
2502 |
@code{TeX-auto-parse-length} in your @file{.emacs} file. |
@code{TeX-auto-parse-length} in your @file{.emacs} file. |
2503 |
|
|
2504 |
@lisp |
@lisp |
2505 |
;; Only parse \documentstyle information. |
;; Only parse LaTeX class and package information. |
2506 |
(setq-default TeX-auto-regexp-list 'LaTeX-auto-minimal-regexp-list) |
(setq-default TeX-auto-regexp-list 'LaTeX-auto-minimal-regexp-list) |
2507 |
;; The documentstyle command is usually near the beginning. |
;; The class and package information is usually near the beginning. |
2508 |
(setq-default TeX-auto-parse-length 2000) |
(setq-default TeX-auto-parse-length 2000) |
2509 |
@end lisp |
@end lisp |
2510 |
|
|
2539 |
@end defvr |
@end defvr |
2540 |
|
|
2541 |
@defvr Constant LaTeX-auto-minimal-regexp-list |
@defvr Constant LaTeX-auto-minimal-regexp-list |
2542 |
Only parse documentstyle. |
Only parse @LaTeX{} class and packages. |
2543 |
@end defvr |
@end defvr |
2544 |
|
|
2545 |
@defvr Constant LaTeX-auto-label-regexp-list |
@defvr Constant LaTeX-auto-label-regexp-list |
3073 |
@lisp |
@lisp |
3074 |
;;; book.el - Special code for book style. |
;;; book.el - Special code for book style. |
3075 |
|
|
3076 |
(TeX-add-style-hook "book" |
(TeX-add-style-hook |
3077 |
(function (lambda () (setq LaTeX-largest-level |
"book" |
3078 |
(LaTeX-section-level ("chapter")))))) |
(lambda () (setq LaTeX-largest-level |
3079 |
|
(LaTeX-section-level ("chapter"))))) |
3080 |
@end lisp |
@end lisp |
3081 |
|
|
3082 |
This file specifies that the largest kind of section in a @LaTeX{} document |
This file specifies that the largest kind of section in a @LaTeX{} document |
3108 |
Here are a few examples from @file{latex.el}. |
Here are a few examples from @file{latex.el}. |
3109 |
|
|
3110 |
@lisp |
@lisp |
3111 |
(TeX-add-style-hook "latex" |
(TeX-add-style-hook |
3112 |
(function |
"latex" |
3113 |
(lambda () |
(lambda () |
3114 |
(TeX-add-symbols |
(TeX-add-symbols |
3115 |
'("arabic" TeX-arg-counter) |
'("arabic" TeX-arg-counter) |
3116 |
'("label" TeX-arg-define-label) |
'("label" TeX-arg-define-label) |
3117 |
'("ref" TeX-arg-label) |
'("ref" TeX-arg-label) |
3118 |
'("newcommand" TeX-arg-define-macro [ "Number of arguments" ] t) |
'("newcommand" TeX-arg-define-macro [ "Number of arguments" ] t) |
3119 |
'("newtheorem" TeX-arg-define-environment |
'("newtheorem" TeX-arg-define-environment |
3120 |
[ TeX-arg-environment "Numbered like" ] |
[ TeX-arg-environment "Numbered like" ] |
3121 |
t [ TeX-arg-counter "Within counter" ]))))) |
t [ TeX-arg-counter "Within counter" ])))) |
3122 |
@end lisp |
@end lisp |
3123 |
|
|
3124 |
@defun TeX-add-symbols @var{symbol} @dots{} |
@defun TeX-add-symbols @var{symbol} @dots{} |
3295 |
@file{latex.el}. |
@file{latex.el}. |
3296 |
|
|
3297 |
@lisp |
@lisp |
3298 |
(TeX-add-style-hook "latex" |
(TeX-add-style-hook |
3299 |
(function |
"latex" |
3300 |
(lambda () |
(lambda () |
3301 |
(LaTeX-add-environments |
(LaTeX-add-environments |
3302 |
'("document" LaTeX-env-document) |
'("document" LaTeX-env-document) |
3303 |
'("enumerate" LaTeX-env-item) |
'("enumerate" LaTeX-env-item) |
3304 |
'("itemize" LaTeX-env-item) |
'("itemize" LaTeX-env-item) |
3305 |
'("list" LaTeX-env-list))))) |
'("list" LaTeX-env-list)))) |
3306 |
@end lisp |
@end lisp |
3307 |
|
|
3308 |
@findex LaTeX-env-item |
@findex LaTeX-env-item |
3329 |
@lisp |
@lisp |
3330 |
;; loop.el |
;; loop.el |
3331 |
|
|
3332 |
(TeX-add-style-hook "loop" |
(TeX-add-style-hook |
3333 |
(function |
"loop" |
3334 |
(lambda () |
(lambda () |
3335 |
(LaTeX-add-environments |
(LaTeX-add-environments |
3336 |
'("loop" "From" "To" "Step"))))) |
'("loop" "From" "To" "Step")))) |
3337 |
@end lisp |
@end lisp |
3338 |
|
|
3339 |
If an environment is defined multiple times, @AUCTeX{} will chose the |
If an environment is defined multiple times, @AUCTeX{} will chose the |
3343 |
the appropriate style directory. |
the appropriate style directory. |
3344 |
|
|
3345 |
@lisp |
@lisp |
3346 |
(TeX-add-style-hook "latex" |
(TeX-add-style-hook |
3347 |
(function |
"latex" |
3348 |
(lambda () |
(lambda () |
3349 |
(LaTeX-add-environments |
(LaTeX-add-environments |
3350 |
'("enumerate" LaTeX-env-enumerate foo))))) |
'("enumerate" LaTeX-env-enumerate foo)))) |
3351 |
|
|
3352 |
(defun LaTeX-env-enumerate (environment &optional ignore) ...) |
(defun LaTeX-env-enumerate (environment &optional ignore) ...) |
3353 |
@end lisp |
@end lisp |
3415 |
defined. We can specify this information in a style hook file. |
defined. We can specify this information in a style hook file. |
3416 |
|
|
3417 |
@lisp |
@lisp |
3418 |
;;; macro.el - Special code for my own macro file. |
;;; macro.el --- Special code for my own macro file. |
3419 |
|
|
3420 |
;;; Code: |
;;; Code: |
3421 |
|
|
3428 |
"Temporary for parsing \\newmacro definitions.") |
"Temporary for parsing \\newmacro definitions.") |
3429 |
|
|
3430 |
(defun TeX-macro-cleanup () |
(defun TeX-macro-cleanup () |
3431 |
;; Move symbols from `TeX-auto-multi' to `TeX-auto-symbol'. |
"Move symbols from `TeX-auto-multi' to `TeX-auto-symbol'." |
3432 |
(mapcar (function (lambda (list) |
(mapcar (lambda (list) |
3433 |
(mapcar (function (lambda (symbol) |
(mapcar (lambda (symbol) |
3434 |
(setq TeX-auto-symbol |
(setq TeX-auto-symbol |
3435 |
(cons symbol TeX-auto-symbol)))) |
(cons symbol TeX-auto-symbol))) |
3436 |
list))) |
list)) |
3437 |
TeX-auto-multi)) |
TeX-auto-multi)) |
3438 |
|
|
3439 |
(defun TeX-macro-prepare () |
(defun TeX-macro-prepare () |
3440 |
;; Clear `Tex-auto-multi' before use. |
"Clear `Tex-auto-multi' before use." |
3441 |
(setq TeX-auto-multi nil)) |
(setq TeX-auto-multi nil)) |
3442 |
|
|
3443 |
(add-hook 'TeX-auto-prepare-hook 'TeX-macro-prepare) |
(add-hook 'TeX-auto-prepare-hook 'TeX-macro-prepare) |
3444 |
(add-hook 'TeX-auto-cleanup-hook 'TeX-macro-cleanup) |
(add-hook 'TeX-auto-cleanup-hook 'TeX-macro-cleanup) |
3445 |
|
|
3446 |
(TeX-add-style-hook "macro" |
(TeX-add-style-hook |
3447 |
(function |
"macro" |
3448 |
(lambda () |
(lambda () |
3449 |
(TeX-auto-add-regexp TeX-newmacro-regexp) |
(TeX-auto-add-regexp TeX-newmacro-regexp) |
3450 |
(TeX-add-symbols '("newmacro" |
(TeX-add-symbols '("newmacro" |
3451 |
TeX-arg-macro |
TeX-arg-macro |
3452 |
(TeX-arg-macro "Capitalized macro: \\") |
(TeX-arg-macro "Capitalized macro: \\") |
3453 |
t |
t |
3454 |
"BibTeX entry: " |
"BibTeX entry: " |
3455 |
nil))))) |
nil)))) |
3456 |
|
|
3457 |
;;; macro.el ends here |
;;; macro.el ends here |
3458 |
@end lisp |
@end lisp |