;;; latex.el --- major mode for editing LaTeX and SliTeX documents ;; Copyright (C) 1988--1998 Free Software Foundation, Inc. ;; Author: Nelson H. F. Beebe ;; Maintainer: Nelson H. F. Beebe ;; Created: 12 March 1988 ;; Version: 0.32 ;; Keywords: LaTeX, SliTeX ;; This file is part of GNU Emacs. ;;; Commentary: ;/u/sy/beebe/emacs/latex.el, Thu Jan 20 12:52:04 1994 ;Edit by Nelson H. F. Beebe ;;; ==================================================================== ;;; @Emacs-Lisp-file{ ;;; author = "Nelson H. F. Beebe", ;;; version = "0.41", ;;; date = "21 Nov 2000", ;;; time = "12:06:04 MST", ;;; filename = "latex.el", ;;; address = "Center for Scientific Computing ;;; University of Utah ;;; Department of Mathematics, 322 INSCC ;;; 155 S 1400 E RM 233 ;;; Salt Lake City, UT 84112-0090 ;;; USA", ;;; telephone = "+1 801 581 5254", ;;; FAX = "+1 801 585 1640, +1 801 581 4148", ;;; URL = "http://www.math.utah.edu/~beebe", ;;; checksum = "60713 5508 23948 205438", ;;; email = "beebe@math.utah.edu, beebe@acm.org, ;;; beebe@ieee.org (Internet)", ;;; URL = "http://www.math.utah.edu/~beebe/", ;;; codetable = "ISO/ASCII", ;;; keywords = "bibliography, index, LaTeX, SLiTeX", ;;; supported = "yes", ;;; docstring = "This file contains support for editing ;;; LaTeX documents in GNU Emacs. It is ;;; thoroughly documented in two separate ;;; files, ltxmode.ltx (a TUGboat article), and ;;; ltxinfo.ltx (a LaTeXinfo file). ;;; ;;; The checksum field above contains the ;;; standard UNIX wc (word count) utility ;;; output of lines, words, and characters; ;;; eventually, a better checksum scheme should ;;; be developed.", ;;; } ;;; ==================================================================== ;;; Change log: ;;;===================================================================== ;;; [0.41] ;;; [21-Nov-2000] Rename split-string to LaTeX-split-string to avoid ;;; conflict with function split-string defined in ;;; .../emacs/20.x/lisp/subr.el, and move it to its ;;; proper alphabetical place in this file. ;;; ;;; [0.40] ;;; [24-Apr-1999] Change initial value of LaTeX-2e from nil to t, making ;;; LaTeX-2e the default. It is now 5 years since 2e ;;; appeared, so all new documents should certainly be ;;; using it in preference to 2.09. ;;; ;;; Change this change log to use three initial ;;; semicolons, instead of just one, to conform to Emacs ;;; Lisp comment conventions. ;;; ;;; Revise LaTeX-comment and LaTeX-uncomment to invert the ;;; sense of its argument compared to old versions. I ;;; found that I use them far more often to comment out a ;;; region, and only rarely, a paragraph, so it makes ;;; sense for them to act on a region by default, and a ;;; paragraph only if given an argument. I only regret ;;; that I did not make this change several years ago, ;;; sigh... ;;; ;;; In LaTeX-begin-end-block, reduce indentation of list ;;; environments after an \item, because it looks better. ;;; This was another change I'd been intending to do for ;;; several years. ;;; ;;; Update author address, telephone, FAX, and URL in file ;;; header to reflect my move to new building (14 months ;;; ago). ;;; ;;; [0.39] ;;; [21-Apr-1998] Update LaTeX-gripe, make-LaTeX-document, and ;;; make-SLiTeX-document to use mail-host-address when ;;; available. ;;; ;;; [0.38] ;;; [17-Dec-1997] Fix minor error in documentation of LaTeX-brace-words. ;;; ;;; [0.37] ;;; [10-Nov-1997] Change eql to eq, since the alias eql is no longer ;;; available in emacs-20 and later. ;;; ;;; [0.36] ;;; [05-Sep-1996] Insert patch in renumber-figures, renumber-slides, and ;;; renumber-tables to deal with changed behavior of ;;; zap-to-char between emacs 18 and 19. ;;; ;;; Add exclamation mark to regexps in LaTeX-begin-figure ;;; and LaTeX-begin-table since it is a new LaTeX 2e ;;; feature. ;;; ;;; Add Prof. and Profs. to list of ;;; LaTeX-standard-tied-abbreviations. ;;; ;;; [0.35] ;;; [29-Aug-1996] Remove superfluous %s format item in an (error "...") ;;; call in check-LaTeX-labels. ;;; ;;; [0.34] ;;; [21-Aug-1995] Change some doubled quotes inside strings to backslash ;;; quotes (obsolete use: change required for emacs 19.29 ;;; or later) ;;; ;;; [0.33] ;;; [01-May-1995] Update for LaTeX-2e support, and remove "beta test" ;;; from version string, pending public release of code. ;;; New variables: ;;; LaTeX-2e ;;; LaTeX-2e-extra-classes ;;; LaTeX-2e-extra-fonts ;;; LaTeX-2e-extra-italic-fonts ;;; LaTeX-2e-extra-macros ;;; LaTeX-2e-extra-options ;;; LaTeX-2e-extra-packages ;;; LaTeX-2e-standard-classes ;;; LaTeX-2e-standard-fonts ;;; LaTeX-2e-standard-italic-fonts ;;; LaTeX-2e-standard-macros ;;; LaTeX-2e-standard-options ;;; LaTeX-2e-standard-packages ;;; ;;; New functions: ;;; LaTeX-2.09-mode () ;;; LaTeX-2e-mode () ;;; LaTeX-2e-package () ;;; convert-LaTeX-2.09-to-LaTeX-2e () ;;; internal-LaTeX-2e-convert-document-options () ;;; internal-LaTeX-2e-convert-documentstyle () ;;; internal-LaTeX-2e-convert-font (old new) ;;; internal-LaTeX-set-mode-name () ;;; ;;; [beta test 0.32] ;;; [20-Jan-1994] Move LaTeX-x-window-setup to end of file to avoid ;;; references to undefined symbols. ;;; ;;; [beta test 0.31] ;;; [14-Sep-1993] Add new variables occur-highlight-time, ;;; occur-match-beginning, and occur-match-end. Replace ;;; occur mode's occur-mode-goto-occurrence with private ;;; version, and add new functions ;;; occur-mode-extended-goto-occurrence and ;;; occur-mode-mouse-goto to support quick mouse-click ;;; gotos. These functions are duplicated from the ;;; author's clsc.el library, but included here so that ;;; the two can be independent of one another. Replace ;;; show-LaTeX-labels with new version that uses ;;; occur-mode and extended mouse goto. ;;; ;;; [beta test 0.30] ;;; [07-Sep-1993] Merge in separate experimental development code, with ;;; new variables LaTeX-begin-table, ;;; LaTeX-display-math-comment-separator, ;;; LaTeX-displaymath-indentation-column, ;;; LaTeX-math-comment-separator, ;;; LaTeX-math-indentation-column, ;;; LaTeX-prettyprint-paragraph-separate, ;;; LaTeX-begin-figure, and LaTeX-path-delimiter, and ;;; new functions LaTeX-brace-words, LaTeX-path, ;;; LaTeX-prettyprint-displaymath, LaTeX-prettyprint-math, ;;; internal-LaTeX-indent-math, renumber-figures, and ;;; renumber-tables. Extend LaTeX-dollar, LaTeX-ref, and ;;; LaTeX-ref-with-completion to handle an optional ;;; argument. ;;; Thanks to Rick Zaccone [27-Jun-1992] for the extension ;;; to LaTeX-dollar. ;;; Add LaTeX-x-window-setup and call it from LaTeX-mode ;;; so popup menus are automatically provided when they ;;; can be supported. ;;; ;;; [beta test 0.29] ;;; [05-Sep-1993] Augment LaTeX-standard-dotted-abbreviations table. ;;; Add support for mouse-directed indexing under Emacs ;;; 19. ;;; Temporarily turn off transient-mark-mode during ;;; delimiter balance checking so that marks can be set a ;;; unmatched delimiters. ;;; Add customization variables LaTeX-update-bibtags and ;;; LaTeX-update-labels; nil values suppress updating the ;;; lists of bibtags and labels when LaTeX-mode is ;;; invoked. ;;; Fix a bug in update-LaTeX-bibtags that resulted in ;;; the .bib files not being found when emacs' default ;;; directory differs from that of the .aux file. ;;; In LaTeX-mode, move point to beginning before calling ;;; hooks, instead of after \documentstyle. ;;; Update show-LaTeX-bibtags and show-LaTeX-labels to ;;; remove extraneous output produced by emacs version 19 ;;; completion support. ;;; Add (save-excursion ...) wrapper around (set-buffer ;;; ...) calls in internal-LaTeX-collect-bibtags, ;;; update-LaTeX-bibtags, and update-LaTeX-labels so that ;;; subsequent (goto-char ...) positioning in original ;;; buffer is correct. ;;; ;;; [beta test 0.28] ;;; [12-Jun-1993] Update code to match guidelines in Style Tips section ;;; of Emacs Lisp Manual version 2.0. All uses of princ ;;; have been changed to message, some uses of message ;;; have been changed to error, all uses of ding have been ;;; removed, and recursive edits have been replaced by ;;; error termination. Key binding has been generalized ;;; through the addition of LaTeX-command-key-prefix so ;;; that the old C-c prefix can be easily changed by those ;;; who wish to do so. Functions have been reformatted ;;; according to guidelines. ;;; ;;; [beta test 0.27] ;;; [05-Nov-1992] Add w.r.t. to LaTeX-standard-dotted-abbreviations. ;;; ;;; [29-Oct-1992] Change paragraph-start to recognize a bare formfeed, ;;; instead of a formfeed just at beginning of line; TeX ;;; treats formfeed anywhere as a paragraph break. ;;; ;;; [05-Aug-1992] Change update-LaTeX-bibtags to return quietly if ;;; no bibliography files are found. ;;; ;;; [beta test 0.26] ;;; [25-Jul-1992] Add variables LaTeX-BIBINPUTS and LaTeX-bibtags, and ;;; functions expand-file-name-in-path, ;;; LaTeX-bibtag-with-completion, ;;; internal-LaTeX-collect-bibtags, show-LaTeX-bibtags, ;;; split-string, and update-LaTeX-bibtags. ;;; ;;; Change insert-file calls to insert-file-contents to ;;; avoid "Mark set" messages. ;;; ;;; [beta test 0.25] (changes made since [09-Aug-1991]) ;;; ;;; [26-May-1992] Add (let ...) to bind free variables discovered by ;;; new byte-compile-file in make-LaTeX-document ;;; (LaTeX-option) and LaTeX-end (environment-name). ;;; ;;; [25-Apr-1992] Move ltugboat from option list to style list. ;;; ;;; [16-Dec-1991] Don't load x-mouse if running under Epoch instead of ;;; Emacs ;;; ;;; [11-Dec-1991] Replace ;;; internal-LaTeX-check-matching-character-balance with ;;; new version. ;;; Increase LaTeX-brace-interval to 4000 from 500. ;;; Increase LaTeX-dollar-interval to 2000 from 500. ;;; Add new variable LaTeX-default-options whose string ;;; value is always put in the \documentstyle[...]{...} ;;; option list. ;;; Change default LaTeX-verb-delimiter from | to = to ;;; avoid conflict with use of | by MakeIndex. ;;; Add LaTeX-standard-comment-delimited-environments and ;;; LaTeX-extra-comment-delimited-environments and modify ;;; LaTeX-begin-end-block to use them. ;;; ;;; [09-Dec-1991] Remove one level of braces from indexing macro ;;; definition. ;;; ;;; [25-Nov-1991] Change amstex abbrev to expand to \AmSTeX, and ;;; add lamstex abbrev ;;; ;;; Load x-mouse only if window-system is known, to avoid the load ;;; aborting when window-system-version is referenced in x-mouse.el. ;;; That way, the code will work in Emacs implementations that have ;;; not been built with window support, or are not running under X. ;;; ;;; Make LaTeX-subscript and LaTeX-superscript recognize a preceding ;;; backslash, and just do a simple insertion. ;;; ;;; Finally implement support for ignoring paragraph breaks ;;; in internal-LaTeX-check-matching-character-balance and ;;; functions that call it. ;;; ;;; Reduce "-insert-" to "-" in function names for consistency. ;;; ;;; Modify code references to LaTeX-xxx-start-with-newline to ;;; avoid newline insertion if already at beginning of line. ;;; ;;; Modify make-LaTeX-document and make-SLiTeX-document to permit ;;; non-interactive invocation. ;;; ;;; Change "non-NIL" to "non-nil" in doc strings. ;;; ;;; Correct handling of overlay environment (it was missing the empty ;;; braces), and fix format error in renumber-slides. ;;; ;;; Add function LaTeX-counter and supporting variables ;;; LaTeX-extra-counters and LaTeX-standard-counters. ;;; ;;; Add variables LaTeX-footnote-start-with-newline and ;;; LaTeX-footnote-end-with-newline, and update LaTeX-footnote to use ;;; them. ;;; ;;; Remove leading asterisk from doc strings of all defun and defconst ;;; values, so that they do not appear to be user-settable. ;;; ;;; Add optional list elements 2--4 to LaTeX-standard-environments and ;;; use them to simplify the code in LaTeX-begin-end-block, and permit ;;; greater user customization. ;;; ;;; Remove labelledequation environment (it was an obsolete remnant of ;;; TOPS-20 latex.emacs code). ;;; ;;; Add default filename completion to update-LaTeX-labels (idea ;;; borrowed from tags.el). ;;; ;;; Add LaTeX-extra-tied-abbreviations and ;;; LaTeX-standard-tied-abbreviations with support code in LaTeX-dot. ;;; ;;; In LaTeX-dot and LaTeX-comma, call expand-abbrev only if abbrev-mode ;;; is selected. ;;; ;;; Add missing terminal s to one instance of ;;; LaTeX-standard-unindented-environments. ;;; ;;; Correct internal-x-LaTeX-index-mark when LaTeX-index-macro is nil. ;;; ;;; Fine tune spacing in LaTeX-index. ;;; ;;; Make internal-LaTeX-wrap a no-op if the word-count argument is not ;;; > 0. ;;; ;;; Add internal-LaTeX-default function to clean up handling of ;;; optional arguments and their default values. This drastically ;;; reduces the number of complex references to current-prefix-arg ;;; and prefix-numeric-value. ;;; ;;; Remove deletion of horizontal space around \verb|| from C-c v for ;;; consistency with LaTeX-macro generation of same. ;;; ;;; Add suffix arg to internal-LaTeX-keyword for better space control, ;;; and tune space insertion in internal-LaTeX-delimiter-pair. ;;; ;;; Add LaTeX-set-indentation on C-c ,. ;;; ;;; Make LaTeX-item-count consistently be the number of \item or ;;; \bibitem lines generated. ;;; ;;; Make thebibliography environment always insert \bibitem[]{} ;;; instead of \bibitem{}. ;;; ;;; Make LaTeX-macro supply a newline after a macro with arguments only ;;; if it is being inserted in the middle of a line. Generation of ;;; superfluous blank lines is undesirable. ;;; ;;; Modify LaTeX-bibitem, LaTeX-cite, and LaTeX-item to generate [] when ;;; they are given an argument. ;;; ;;; Modify LaTeX-verb to make it consistent with output from ;;; (LaTeX-macro "verb"), obeying LaTeX-newline-after-opening-delimiter ;;; and LaTeX-newline-after-closing-delimiter. ;;; ;;; Modify LaTeX-begin-end-block to improve thebibliography formatting ;;; and make it consistent with other list environments. ;;; ;;; Set default comment-xxx variables in LaTeX-mode. ;;; ;;; Add LaTeX-subscript and LaTeX-superscript. ;;; ;;; Add LaTeX-label-definition and LaTeX-label-reference for user ;;; customization. ;;; ;;; Add file-name-sans-extension, internal-LaTeX-sort-alist, ;;; LaTeX-aux-file-label-tags, and update-LaTeX-labels to solve the ;;; problem of finding \label{} tags in multi-file documents. ;;; ;;; Augment documentation of many functions with their key/mouse ;;; bindings. ;;; ;;; Add variable LaTeX-space-after-begin-end, modify insertions of ;;; \begin or \end to use it, and change all regexps to allow ;;; optional space between begin/end keyword and opening brace. ;;; ;;; Rename all internal functions from "LaTeX-..." to ;;; "internal-LaTeX-..." to make it easier to verify that all ;;; user-visible functions are documented in reference manual. Remove ;;; (interactive) from all internal functions so as not to interfere ;;; with name completion. ;;; ;;; Move most top-level setq values to defvar initializations. ;;; ;;; Add missing asterisk to some defvar doc strings so the variables ;;; become user-settable (some are not, so the asterisk is omitted). ;;; ;;; Revise tex-mode.el to remove all definitions of LaTeX objects. It ;;; will still autoload LaTeX-mode if a \documentstyle command is found. ;;; ;;; TeX-insert-quote is copied and renamed LaTeX-quote. ;;; ;;; Change two x-LaTeX-index-* variables to LaTeX-index-*, with new code ;;; in LaTeX-index. ;;; ;;; Add LaTeX-label-start-with-newline and LaTeX-label-end-with-newline, ;;; with new code in LaTeX-label. ;;; ;;; Remove loading of tex-mode here, and create private keymap instead ;;; of using TeX-mode-map. With the new tex-mode.el* in place in the ;;; Emacs Lisp directory, and these autoload commands in loaddefs.el or ;;; site-init.el or personal .emacs files: ;;; ;;;>> (autoload 'latex-mode "latex" ;;;>> "\ ;;;>> Major mode for editing files of input for LaTeX. ;;;>> More information on this command is available after this mode is ;;;>> selected." ;;;>> t) ;;;>> ;;;>> (autoload 'LaTeX-mode "latex" ;;;>> "\ ;;;>> Major mode for editing files of input for LaTeX. ;;;>> More information on this command is available after this mode is ;;;>> selected." ;;;>> t) ;;; ;;; tex-mode and LaTeX-mode are now fully, and finally, independent. We ;;; preserve TeX-dollar here, since it does not exist in tex-mode.el. ;;; ;;; Move xxxslides from LaTeX-standard-options to LaTeX-standard-styles. ;;; ;;; Delete "Inside \begin{xxx}" message from LaTeX-item ;;; ;;; Change "'(lambda..." to "(function (lambda..." to allow more ;;; efficient byte compiling. ;;; ;;; Add LaTeX-standard-dotted-abbreviations and ;;; LaTeX-extra-dotted-abbreviations, and rewrite LaTeX-dot to use them. ;;; ;;; Add support function LaTeX-preceding-buffer-substring. ;;; ;;; Rename some xxx-LaTeX-yyy internal functions to LaTeX-xxx-yyy. ;;; ;;; Correct some alphabetization errors in the ordering of definitions ;;; of constants, variables and functions. ;;; ;;; Add SLiTeX note and overlay environment support in ;;; LaTeX-standard-environments, LaTeX-begin-end-block, and ;;; renumber-slides. ;;; ;;; Change LaTeX-unindented-environments to ;;; LaTeX-standard-unindented-environments and add ;;; LaTeX-extra-unindented-environments. ;;; ;;; Move x-latex.el back into this file, now that autoload problem has ;;; been solved. The load of x-menu has been deleted, and the load of ;;; x-mouse is a conditional that only on success causes mouse button ;;; bindings. ;;;===================================================================== ;;; [09-Aug-1991] ;;; Add LaTeX-maybe-remove-italic-correction, and add missing italic ;;; correction to LaTeX-font-sl. ;;; ;;; Change {cmd} to {\cmd} in macro comments to remind user to ;;; include backslash. ;;; ;;; Completely rewrite LaTeX-dollar to use LaTeX-begin-end-block and ;;; LaTeX-insert-delimiter-pair, and to support LaTeX-displaymath-option ;;; and LaTeX-math-option (LaTeX-use-math-dollar has been removed). ;;; ;;; Rewrite LaTeX-keyword to use LaTeX-insert-delimiter-pair ;;; ;;; For symmetry and consistency, change LaTeX-arg-on-empty-line to ;;; LaTeX-newline-after-opening-delimiter. ;;;===================================================================== ;;; [07-Aug-1991] ;;; Add (goto-char (point-min)) in LaTeX-gripe (thanks to Olaf ;;; Heimburger ) ;;;===================================================================== ;;; [beta test 0.24] [01-Aug-1991] ;;; Write TUGboat article describing all of LaTeX-mode. That effort ;;; suggested the additions and changes for this version. ;;; Add support for \verb*|...| in LaTeX-verb (an argument requests the ;;; starred form). ;;; Add LaTeX-angle-interval, LaTeX-angles, and ;;; LaTeX-check-angle-balance. ;;; Correct two comment errors in LaTeX-mode's documentation. ;;; Change two mailing addresses from science.utah.edu to math.utah.edu. ;;; Add LaTeX-protect. ;;; Add support for \@ in LaTeX-dot. ;;; Add x-LaTeX-* functions and variables for mouse-supported indexing ;;; in X windows; these are in x-latex.el, because they cannot be used ;;; unless Emacs has been compiled with xmenu.o. ;;; Add LaTeX-make-label-list, LaTeX-pageref-with-completion, and ;;; LaTeX-ref-with-completion, and put the latter two on C-c p and C-c ;;; r; because these might be slow (they must scan the whole buffer to ;;; create the label list), the old (and fast) LaTeX-pageref and ;;; LaTeX-ref functions are retained. ;;; Add LaTeX-uncomment, and change LaTeX-comment to use ;;; LaTeX-comment-prefix instead of hard-coded "% ". ;;; Add LaTeX-use-math-dollar variable and modify LaTeX-dollar; this ;;; gives access to the \( ... \) form instead of $ ... $. ;;; Correct error on show-LaTeX-labels comment. ;;; Add LaTeX-extra-environments, LaTeX-extra-fonts, ;;; LaTeX-extra-italic-fonts, LaTeX-extra-list-environments, ;;; LaTeX-extra-macros, LaTeX-extra-options, and LaTeX-extra-styles ;;; for easier user customization. ;;; Change last 3 args of all but one completing-read calls to nil nil ;;; nil, so that users can always override the offered completion list. ;;;===================================================================== ;;;/u/sy/beebe/emacs/latex.el, Wed May 8 18:35:06 1991 ;;;Edit by Nelson H.F. Beebe ;;;/u/sy/beebe/emacs/latex.el, Wed May 2 11:11:16 1990 ;;;Edit by Nelson H.F. Beebe ;;; [beta test 0.23] [08-May-1991] ;;; Fix incorrect help comments for framebox, makebox, minipage, parbox, ;;; and savebox. ;;;===================================================================== ;;;/u/sy/beebe/emacs/latex.el, Tue Dec 18 14:35:01 1990 ;;;Edit by Nelson H.F. Beebe ;;; [beta test 0.22] [18-Dec-1990] ;;; Add new functions for changing the font of one or more words. ;;; LaTeX-font-bf (on C-c C-c b) ;;; LaTeX-font-em (on C-c C-c e) ;;; LaTeX-font-it (on C-c C-c i) ;;; LaTeX-font-rm (on C-c C-c r) ;;; LaTeX-font-sc (on C-c C-c u) ;;; LaTeX-font-sf (on C-c C-c f) ;;; LaTeX-font-sl (on C-c C-c s) ;;; LaTeX-font-tt (on C-c C-c t) ;;;===================================================================== ;;;/u/sy/beebe/emacs/latex.el, Mon Jun 25 14:06:20 1990 ;;;Edit by Nelson H.F. Beebe ;;; [beta test 0.21] [25-Jun-1990] ;;; Add ltugboat style option. ;;;===================================================================== ;;; [beta test 0.20] [08-Jun-1990] ;;; Fix make-LaTeX-document to work if LaTeX-index-macro is not defined; ;;; thanks to Martin Jourdan . ;;;===================================================================== ;;; [beta test 0.19] [01-Jun-1990] ;;; Add expand-abbrev calls in LaTeX-comma and LaTeX-dot; thanks to ;;; Lucien Van Elsen for reporting this. ;;;===================================================================== ;;; [beta test 0.18] [02-May-1990] ;;; Fix LaTeX-begin-end-block to know about extra arguments for array ;;; and tabular* environments. ;;;===================================================================== ;;; [beta test 0.17] [30-Dec-1989] ;;; Rewrite LaTeX-comment to behave better. It will still hang in ;;; save-restriction if used on the last paragraph in the document; ;;; Ctl-G gets you out. ;;; Add LaTeX-equation on C-c = and LaTeX-displaymath on C-c C-c = ;;; Thanks for Fritz Zaucker for the ;;; bug report and ideas. ;;;===================================================================== ;;; [beta test 0.16] [31-Oct-1989] ;;; Add LaTeX-newline-after-closing-delimiter support; thanks to Stephen ;;; Adams for the idea. ;;;===================================================================== ;;; [beta test 0.15] [05-Sep-1989] ;;; Fixed bug in check-LaTeX-labels (bad regexp could match too much); ;;; thanks to Toby Ferguson ;;;===================================================================== ;;; [beta test 0.14] [27-Apr-1989] ;;; Added \special to LaTeX-standard-macros ;;;===================================================================== ;;; [beta test 0.13] [19-Apr-1989] ;;; Incorporated several suggestions and fixes from Ashwin Ram, with new ;;; versions of LaTeX-end, LaTeX-item, LaTeX-insert-item, moved ;;; keymap setting to load time instead of in LaTeX-mode, and changed ;;; calculate-latex-indent to calculate-LaTeX-indent for consistency. ;;; Removed ll abbreviation for Leslie Lamport (bad in text like I'll), ;;; and turned off abbrev mode by default (if you want it, turn it on in ;;; a mode hook). ;;; Alphabetized some out-of-order defuns. ;;;===================================================================== ;;; [beta test 0.12] [17-Apr-1989] ;;; Added abbrev-mode support ;;; Removed beta test note from mode line ;;; Added Ashwin Ram's change to LaTeX-insert-item ;;; Replaced LaTeX-indent-line by new code from George Hartzell (the old ;;; one is preserved as LaTeX-old-indent-line in case problems arise) ;;;===================================================================== ;;; [beta test 0.11] [27-Oct-88] ;;; Added tt to LaTeX-standard-fonts ;;;===================================================================== ;;; [beta test 0.10] [15-Sep-88] ;;; Change renumber-slides to use a variable SLiTeX-begin-slide for the ;;; matching regexp, and add binding to C-c 0 ;;; Fix call to completing-read in make-LaTeX-document so user can ;;; override standard styles. ;;; Replaced LaTeX-end by version that works correctly for things like ;;; \begin{tabular}{c}. ;;;===================================================================== ;;; [beta test 0.09] [30-Aug-88] ;;; Add LaTeX-comma (on ","). ;;; Add italic correction removal in LaTeX-dot. ;;; Add LaTeX-dollar (on "$"). ;;; Add TeX-dollar (no binding in LaTeX-mode, but may be useful in ;;; TeX-mode). ;;;===================================================================== ;;; [beta test 0.08] [05-May-88] ;;; Fix inserted comment in make-{La/SliTeX}-document ;;; Move setting of paragraph-separate and paragraph-start from preamble ;;; to LaTeX-mode ;;; Add LaTeX-news and bind to C-c C-n ;;;===================================================================== ;;; [beta test 0.07] ;;; Fixed LaTeX-begin-end-block to add [] in figure and table ;;; environments ;;; Add LaTeX-dot and bind to ".". ;;; Change paragraph-separate and paragraph-start to be more appropriate ;;; for LaTeX ;;; Fix LaTeX-end to work if \begin{foo} is at end-of-buffer, without ;;; preceding newline. ;;; Change {\(.*\)} patterns to {\([^{}]*\)} so as to match only one ;;; brace level. Otherwise \begin{thebibliography}{} will not match ;;; \end{thebibliography}, because the first pattern matches ;;; "thebibliography}{" instead of "thebibliography". ;;; Change LaTeX-add-word-to-index to index word at, or just before, ;;; point. ;;; Add LaTeX-comment (on C-c %) and LaTeX-tab (on C-c TAB) ;;; courtesy of Ashwin Ram ;;; Increase LaTeX-{brace,bracket,dollar,parenthesis}-interval to 500 ;;; from 200 ;;;===================================================================== ;;;/usr/csc-sun/u/sy/beebe/emacs/latex.el, Wed Mar 30 13:18:07 1988 ;;;Edit by Nelson H.F. Beebe (beebe at plot79.utah.edu) ;;; [beta test 0.06] ;;; Use LaTeX-arg-on-empty-line inside LaTeX-keyword too. ;;; Add LaTeX-indent-line and bind to indent-line-function in LaTeX-mode ;;; so C-j (linefeed) preserves indentation of previous line. ;;; LaTeX-insert-item no longer sets fill prefix, since C-j can be used ;;; instead to maintain the indentation. ;;; Change binding of LaTeX-item to C-c i and move LaTeX-index to C-c x ;;; Remove old binding of LaTeX-item to C-c t ;;; Put key bindings in TeX-mode-map instead of make-sparse-keymap ;;; so we preserve most TeX-mode bindings. Unbind TeX-close-LaTeX-block ;;; (C-C C-f) because it conflicts in functionality. ;;; Make LaTeX-end position on line following inserted \\end{...}, and ;;; print an error message as well as dinging if no unmatched ;;; \\begin{...} was found. ;;; If make-LaTeX-document-hook exists, run it to provide a ;;; user-customizable template for make-LaTeX-document instead of ;;; supplying a default template. If make-SLiTeX-document-hook exists, ;;; run it to provide a user-customizable template for ;;; make-SLiTeX-document instead of supplying a default template. ;;; Extend LaTeX-add-word-to-index to use verbose standard LaTeX ;;; indexing if LaTeX-index-macro is nil. ;;; Change M-X to M-x in documentation to conform to GNU Emacs practice. ;;;===================================================================== ;;;/usr/csc-sun/u/sy/beebe/emacs/latex.el, Fri Mar 18 10:33:18 1988 ;;;Edit by Nelson H.F. Beebe (beebe at plot79.utah.edu) ;;; [beta test 0.05] ;;; Modify LaTeX-macro to not follow macro with newline, except when ;;; there are arguments and LaTeX-arg-on-empty-line is non-nil. ;;; Add LaTeX-arg-on-empty-line variable. ;;; Add \\ to documentation strings so binding gets ;;; displayed in any mode. ;;; Add binding of make-SLiTeX-document (on C-C s). ;;; Add further comments to LaTeX-item, LaTeX-macro, and LaTeX-mode. ;;; Add LaTeX-verb-delimiter variable for use in LaTeX-verb. ;;; Add LaTeX-end (on C-C n) to supply matching \\end{...}. ;;;===================================================================== ;;;/usr/csc-sun/u/sy/beebe/emacs/latex.el, Thu Mar 17 21:09:12 1988 ;;;Edit by Nelson H.F. Beebe (beebe at plot79.utah.edu) ;;; [beta test 0.04] ;;; Call TeX-common-initialization in LaTeX-mode to setup comment and ;;; character ;;; syntax handling. ;;; Fix major-mode so describe-mode (C-H M) works. ;;; Add text-mode-hook and TeX-mode-hook to list of hooks run. ;;; Make LaTeX-macro print documentation string in minibuffer when no ;;; arg. ;;; Make LaTeX-item (and LaTeX-macro for item) display enclosing ;;; environment name. ;;;/usr/csc-sun/u/sy/beebe/emacs/latex.el, Mon Mar 14 10:26:49 1988 ;;;===================================================================== ;;;Edit by Nelson H.F. Beebe (beebe at plot79.utah.edu) ;;; [beta test 0.03] -- not distributed ;;; [beta test 0.02] -- not distributed ;;; [beta test 0.01] ;;; corrected a few macros after proofreading sorted list against LaTeX ;;; manual index ;;;===================================================================== ;;;/usr/csc-sun/u/sy/beebe/emacs/latex.el, Sat Mar 12 19:05:22 1988 ;;;Edit by Nelson H.F. Beebe (beebe at plot79.utah.edu) ;;; begin [beta test 0.00] ;;; fixed LaTeX-set-indentation to fail gracefully if \begin{}/\end{} ;;; not found ;;; added make-SLiTeX-document, renumber-slides, and slides environment ;;; support ;;; added LaTeX-gripe on C-C g for bug reports ;;; completed entry of all LaTeX macros in LaTeX-standard-macros ;;;===================================================================== ;;;/usr/csc-sun/u/sy/beebe/emacs/latex.el, Fri Mar 4 12:06:12 1988 ;;;Edit by Nelson H.F. Beebe (beebe at plot79.utah.edu) ;;; [alpha test 0.4] ;;; Resolved problem of unpleasant interaction between this library and ;;; tex-mode.el, which has a few identically named functions. ;;;/usr/csc-sun/u/sy/beebe/emacs/latex.el, Fri Feb 5 22:44:59 1988 ;;;Edit by Nelson H.F. Beebe (beebe at plot79.utah.edu) ;;;/usr/csc-sun/u/sy/beebe/emacs/latex.el, Thu Feb 4 08:58:04 1988 ;;;Edit by Nelson H.F. Beebe (beebe at plot79.utah.edu) ;;;/usr/csc-sun/u/sy/beebe/emacs/latex.el, Wed Feb 3 15:31:36 1988 ;;;Edit by Nelson H.F. Beebe (beebe at plot79.utah.edu) ;;;/usr/csc-sun/u/sy/beebe/emacs/latex.el, Tue Feb 2 17:33:31 1988 ;;;Edit by Nelson H.F. Beebe (beebe at plot79.utah.edu) ;;; Experimental LaTeX mode based on my TOPS-20 LATEX.EMACS library in ;;; TECO. ;;; ;;; Most functions have been named identically to their TOPS-20 ;;; equivalents, except that in names, hyphens have replaced spaces, ^R ;;; and ... have been eliminated, and "LaTeX" has been inserted in a ;;; couple that were lacking it. Documentation has mostly been copied ;;; verbatim. ;;; ;;; New features include user-modifiable variables for standard ;;; environments, options, macros, styles, et al, and the LaTeX-macro ;;; and show-LaTeX-labels commands. The template generated by ;;; make-LaTeX-document is somewhat improved as well. ;;; ;;; Key bindings in the TOPS-20 version were usually on ;;; C-M- which can be typed (on TOPS-20) as ;;; C-Z-, and is distinct from ;;; C-Z- (and -C-, which means the ;;; upper-case variant). ;;; ;;; Unfortunately, C-Z is the BSD Unix suspend-process signal which is ;;; best left reserved for that purpose, so bindings to C-c- ;;; analogous to the TOPS-20 C-z- bindings are provided ;;; instead. This has the advantage that no existing standard ;;; bindings are usurped, and all the LaTeX-relevant bindings are on ;;; C-c-. ;;; ;;; Please keep the functions sorted ALPHABETICALLY (M-x sort-pages ;;; does the trick), with the SINGLE exception of tex-mode() ;;; immediately following. ;;; ;;; In order to avoid duplication of library source code, we load the ;;; tex-mode library, then rebind a stripped down version of the ;;; function tex-mode which will not attempt to run that library's ;;; latex-mode. Otherwise, we risk ending up in an infinite loop of ;;; confusion between the two libraries. All other functions in the ;;; tex-mode library are left intact, so that we have usurped nothing ;;; from a user who wishes to edit plain TeX files. ;;; (load "tex-mode" nil t nil) ;load it silently ;;; (defun tex-mode () ;;; "Major mode for editing files of input for plain TeX." ;;; (interactive) ;;; (plain-tex-mode)) ;;; Code: ;;; Although the defxxx macros permit the assignment of an initial ;;; value, they do this only if the name has not been previously ;;; defined. During interactive development while these values are ;;; changing, this is inconvenient, so all are assigned values by setq ;;; which can be executed directly to get updated values. (provide 'latex-mode) ;required by ltxmenu.el (defvar LaTeX-2e t) ;set to nil when in LaTeX-2.09 mode (defconst LaTeX-2e-extra-classes nil "*List of extra classes to augment those in LaTeX-2e-standard-classes for use by make-LaTeX-document.") (defconst LaTeX-2e-extra-fonts nil "*List of extra font change control sequences to augment those in LaTeX-2e-standard-fonts.") (defconst LaTeX-2e-extra-italic-fonts nil "*List of extra italic font change control sequences to augment those in LaTeX-2e-standard-italic-fonts.") (defconst LaTeX-2e-extra-macros nil "*List of extra macros to augment those in LaTeX-2e-standard-macros.") (defconst LaTeX-2e-extra-options nil "*List of extra options to augment those in LaTeX-2e-standard-options.") (defconst LaTeX-2e-extra-packages nil "*List of extra packages to augment those in LaTeX-2e-standard-packages.") (defvar LaTeX-angle-interval 500 "*Limit on number of characters between matching angle brackets for LaTeX-check-angle-balance (on \\\\[LaTeX-check-angle-balance]).") (defvar LaTeX-aux-file-label-tags nil "*List of \\label{} tags collected from an .aux file by update-LaTeX-labels. It is used by those functions that offer completion on label tags to augment the list of tags collected from the current buffer.") (defvar LaTeX-begin-end-indentation 2 "*Indentation given for each successive \\begin{}...\\end{} nesting level. Environments defined by LaTeX-standard-unindented-environments and LaTeX-extra-unindented-environments always have their indentation suppressed.") (defvar LaTeX-begin-figure "^[ \t]*\\\\begin *{figure}\\(\\[[a-z!]*\\]\\)?\\|^[ \t]*\\\\begin *{Figure}{[a-z!]*}" "*Regexp that matches the start of a figure. Used by renumber-figures to find a place to put the comment with the figure number. Text from the end of the match to end-of-line will be replaced by a comment with the figure number.") (defvar LaTeX-begin-table "^[ \t]*\\\\begin *{table}\\(\\[[a-z!]*\\]\\)?\\|^[ \t]*\\\\begin *{Table}{[a-z!]*}" "*Regexp that matches the start of a table. Used by renumber-tables to find a place to put the comment with the table number. Text from the end of the match to end-of-line will be replaced by a comment with the table number.") (defvar LaTeX-BIBINPUTS (concat ".:" (getenv "HOME") "/tex/bib:/usr/local/lib/tex/bibtex") "*Default BIBINPUTS search path for use in the event that the BIBINPUTS environment variable is not set. It is used by update-LaTeX-bibtags to locate .bib files referenced in \\bibdata{...} or \\bibliography{...} commands.") (defvar LaTeX-brace-interval 4000 "*Limit on number of characters between matching braces for LaTeX-check-brace-balance (on \\\\[LaTeX-check-brace-balance]).") (defvar LaTeX-bracket-interval 500 "*Limit on number of characters between matching brackets for LaTeX-check-bracket-balance (on \\\\[LaTeX-check-bracket-balance]).") (defvar LaTeX-bibtags nil "*List of BibTeX citation tags collected from the bibliography files listed in the \\bibliography{...} or \\bibdata{...} commands. Each list entry contains a citation tag, and the name of the file from which it was extracted. The list is used by LaTeX-bibtag-with-completion to offer completion on citation tags, and can be conveniently displayed by show-LaTeX-bibtags.") (defvar LaTeX-comma-after-dotted-abbreviation nil ;modern style: use \ "*When LaTeX-dot is invoked after dotted abbreviations, like ``e.g'' or ``i.e'', if this variable is nil, insert a \\ control sequence for a non-sentence ending period. If the variable is set non-nil, insert a comma instead. The choice between the two is a matter of style; traditional use inserts a comma, while modern tendency is to omit it.") (defvar LaTeX-command-key-prefix "\C-c" "*Prefix keystroke(s) to be applied to LaTeX mode key bindings. Emacs standards require that C-c be reserved for user-specific bindings, but LaTeX-mode has historically used C-c prefix key. You can set this variable to \"\\C-c\" for old-style binding, or to say, \"\\C-z\" or \"\\C-c\\C-c\" for standard-conforming binding.") (defvar LaTeX-comment-prefix "%%: " "*Comment prefix string for LaTeX-comment and LaTeX-uncomment. This is used in regular-expression matching by LaTeX-uncomment, so it should NOT contain any regular-expression pattern characters like . or *.") (defvar LaTeX-current-indentation 0 "*Indentation of current \\begin{} level (varies dynamically)") (defvar LaTeX-default-options nil "*This string value is always put in the \documentstyle[...]{...} option list by make-LaTeX-document and make-SLiTeX-document. Use it to customize environments where some styles are always used, e.g. \"a4,french\".") (defconst LaTeX-display-math-comment-separator "%%======================================================================\n" "*This variable defines a comment string that will be used by prettyprint-displaymath to set off display math from surrounding text. If nil or an empty string, no comment line is inserted.") (defconst LaTeX-displaymath-indentation-column 4 "*Number of columns to indent display math during prettyprinting.") (defvar LaTeX-displaymath-option 2 "*Select style of output by LaTeX-dollar. A value of 1 gives \\[ ... \\], 2 gives \\begin{displaymath} ... \\end{displaymath}, and anything else gives $$ ... $$.") (defvar LaTeX-dollar-interval 2000 "*Limit on number of characters between matching dollars for LaTeX-check-dollar-balance (on \\\\[LaTeX-check-dollar-balance]).") (defvar LaTeX-extra-comment-delimited-environments nil "*List of extra environments to set off by empty comment lines.") (defvar LaTeX-extra-counters nil "*List of extra counters to augment those in LaTeX-standard-counters (q.v.).") (defvar LaTeX-extra-dotted-abbreviations nil "*List of extra abbreviations to augment those in LaTeX-standard-dotted-abbreviations for which LaTeX-dot must provide special spacing, according to the value of LaTeX-comma-after-dotted-abbreviation.") (defvar LaTeX-extra-environments nil "*List of extra environments to augment those in LaTeX-standard-environments for use by LaTeX-begin-end-block.") (defvar LaTeX-extra-fonts nil "*List of extra fonts to augment those in LaTeX-standard-fonts for use by LaTeX-macro.") (defvar LaTeX-extra-italic-fonts nil "*List of extra fonts to augment those in LaTeX-standard-italic-fonts for use by LaTeX-macro.") (defvar LaTeX-extra-list-environments nil "*List of extra list environments to augment those in LaTeX-standard-list-environments for use by LaTeX-begin-end-block.") (defvar LaTeX-extra-macros nil "*List of extra macros to augment those in LaTeX-standard-macros for use by LaTeX-macro.") (defvar LaTeX-extra-options nil "*List of extra options to augment those in LaTeX-standard-options for use by make-LaTeX-document and make-SLiTeX-document.") (defvar LaTeX-extra-styles nil "*List of extra styles to augment those in LaTeX-standard-styles for use by make-LaTeX-document.") (defvar LaTeX-extra-tied-abbreviations nil "*List of extra abbreviations to augment those in LaTeX-standard-tied-abbreviations (q.v.).") (defvar LaTeX-extra-unindented-environments nil "*List of extra environments to augment those in LaTeX-standard-unindented-environments (q.v.).") (defvar LaTeX-footnote-end-with-newline nil "*Inserted footnote entries end with a newline if this is non-nil.") (defvar LaTeX-footnote-start-with-newline nil "*Non-nil means put footnotes on a new line.") (defvar LaTeX-index-end-with-newline nil "*Non-nil means that inserted index entries end with a newline.") (defvar LaTeX-index-macro "\\X" "*Private indexing macro that causes its argument to appear both in the document text, as well as in an index entry. If nil, then LaTeX-index (on \\\\[LaTeX-index]) will insert ..text..% \\index{..text..} instead of \\this-macro{..text..} ") (defvar LaTeX-index-start-with-newline nil "*Non-nil means that Inserted index entries start a newline at same indentation level.") (defvar LaTeX-item-count 4 "*Number of \\item or \\bibitem entries to generate in initial templates.") (defvar LaTeX-item-indentation 2 "*Indentation given to \\item's with respect to their enclosing \\begin{}...\\end{} group.") (defvar LaTeX-item-info-indent 6 "*The amount by which the text beneath an item gets indented." ) (defvar LaTeX-label-end-with-newline nil "*Non-nil means that inserted label entries end with a newline.") (defvar LaTeX-label-definition "\\\\label{\\([^{}]*\\)}" "*Regular expression which matches a label definition. It normally matches \\label{}, but may be extended if needed to include private macros that also contain label definitions.") (defvar LaTeX-label-reference "\\\\[page]*ref{\\([^{}]*\\)}" "*Regular expression which matches a label reference. It normally matches \\pageref{} and \\ref{}, but may be extended if needed to include private macros that also contain label references.") (defvar LaTeX-label-start-with-newline nil "*Non-nil means that inserted label entries start a newline at same indentation level.") (defvar LaTeX-labels-occur-pos-list () "List of label positions created by show-LaTeX-labels.") (defvar LaTeX-labels-occur-buffer nil "Name of buffer in which show-LaTeX-labels was last run.") (defconst LaTeX-math-comment-separator "%%----------------------------------------------------------------------\n" "*This variable defines a comment string that will be used by prettyprint-displaymath to set off display math from surrounding text. If nil or an empty string, no comment line is inserted.") (defconst LaTeX-math-indentation-column 4 "*Number of columns to indent math during prettyprinting.") (defvar LaTeX-math-option 0 "*Select style of output by LaTeX-dollar. A value of 1 gives \\( ... \\), 2 gives \\begin{math} ... \\end{math}, and anything else gives $ ... $.") (defvar LaTeX-mode-abbrev-table nil "Abbrev table in use in LaTeX-mode buffers.") (if LaTeX-mode-abbrev-table () (define-abbrev-table 'LaTeX-mode-abbrev-table ()) (let ((abbrevs-changed nil)) (define-abbrev LaTeX-mode-abbrev-table "amstex" "\\AmSTeX{}" nil) (define-abbrev LaTeX-mode-abbrev-table "bibtex" "\\BibTeX{}" nil) ;; (define-abbrev LaTeX-mode-abbrev-table "dd" "DVI driver" nil) ;; (define-abbrev LaTeX-mode-abbrev-table "dek" "Donald~E. Knuth" nil) (define-abbrev LaTeX-mode-abbrev-table "lamstex" "\\LamSTeX{}" nil) (define-abbrev LaTeX-mode-abbrev-table "latex" "\\LaTeX{}" nil) (define-abbrev LaTeX-mode-abbrev-table "lug" "\\LaTeX{} User's Guide and Reference Manual" nil) (define-abbrev LaTeX-mode-abbrev-table "mf" "\\MF{}" nil) ;; (define-abbrev LaTeX-mode-abbrev-table "ms" ;; "Michael~D. Spivak" nil) (define-abbrev LaTeX-mode-abbrev-table "slitex" "\\SLiTeX{}" nil) (define-abbrev LaTeX-mode-abbrev-table "tb" "\\TeX{}book" nil) (define-abbrev LaTeX-mode-abbrev-table "tex" "\\TeX{}" nil)) nil) (defvar LaTeX-mode-map nil "Keymap used in LaTeX mode.") (defvar occur-highlight-time 2 "*Number of seconds to highlight matches from *LaTeX Labels* selections when occur-mode-extended-goto-occurrence (on \\[occur-mode-extended-goto-occurrence]) is invoked. If you make it zero, highlighting is suppressed. If you make it large, highlighting will remain until you input something.") (defvar occur-match-beginning nil "*Byte position of beginning of occur match.") (defvar occur-match-end nil "*Byte position of end of occur match.") ; NB: this function must appear before references to it! (defun LaTeX-define-key (map suffix function) "Define a key binding in MAP, prefixing SUFFIX with LaTeX-command-key-prefix, and attach it to FUNCTION." (define-key map (concat LaTeX-command-key-prefix suffix) function)) (if LaTeX-mode-map () ;then do nothing if user-defined (let ((map (make-sparse-keymap))) ;else set standard map (define-key map "\"" 'LaTeX-quote) (LaTeX-define-key map "\C-b" 'LaTeX-bibitem) (LaTeX-define-key map "\C-i" 'LaTeX-tab) (LaTeX-define-key map "\C-n" 'LaTeX-news) (LaTeX-define-key map "\C-p" 'LaTeX-protect) (LaTeX-define-key map "<" 'LaTeX-angles) (LaTeX-define-key map ">" 'LaTeX-check-angle-balance) (LaTeX-define-key map "$" 'LaTeX-check-dollar-balance) (LaTeX-define-key map "%" 'LaTeX-comment) (LaTeX-define-key map "(" 'LaTeX-parentheses) (LaTeX-define-key map ")" 'LaTeX-check-parenthesis-balance) (LaTeX-define-key map "," 'LaTeX-set-indentation) (LaTeX-define-key map "." 'LaTeX-add-word-to-index) (LaTeX-define-key map "[" 'LaTeX-brackets) (LaTeX-define-key map "]" 'LaTeX-check-bracket-balance) (LaTeX-define-key map "0" 'renumber-slides) (LaTeX-define-key map "a" 'LaTeX-to-begin) (LaTeX-define-key map "b" 'LaTeX-begin-end-block) (LaTeX-define-key map "C" 'LaTeX-bibtag-with-completion) (LaTeX-define-key map "c" 'LaTeX-cite) (LaTeX-define-key map "d" 'make-LaTeX-document) (LaTeX-define-key map "e" 'LaTeX-to-end) (LaTeX-define-key map "f" 'LaTeX-footnote) (LaTeX-define-key map "g" 'LaTeX-gripe) (LaTeX-define-key map "i" 'LaTeX-item) (LaTeX-define-key map "k" 'LaTeX-counter) (LaTeX-define-key map "l" 'LaTeX-label) (LaTeX-define-key map "m" 'LaTeX-macro) (LaTeX-define-key map "n" 'LaTeX-end) (LaTeX-define-key map "p" 'LaTeX-pageref-with-completion) (LaTeX-define-key map "r" 'LaTeX-ref-with-completion) (LaTeX-define-key map "s" 'make-SLiTeX-document) (LaTeX-define-key map "u" 'LaTeX-uncomment) (LaTeX-define-key map "v" 'LaTeX-verb) (LaTeX-define-key map "x" 'LaTeX-index) (LaTeX-define-key map "{" 'LaTeX-braces) (LaTeX-define-key map "}" 'LaTeX-check-brace-balance) (LaTeX-define-key map "=" 'LaTeX-equation) (LaTeX-define-key map "\C-c=" 'LaTeX-displaymath) ;; The following bindings are similar to C-c C-f in mail-mode. ;; The second Ctl-C can be thought of as a mnemonic for `check' (LaTeX-define-key map "\C-c$" 'LaTeX-check-dollar-balance) (LaTeX-define-key map "\C-c)" 'LaTeX-check-parenthesis-balance) (LaTeX-define-key map "\C-c]" 'LaTeX-check-bracket-balance) (LaTeX-define-key map "\C-c}" 'LaTeX-check-brace-balance) ;; font wraps (need 3-char sequence, since we are running out ;; of two-character mnemonics) (LaTeX-define-key map "\C-cb" 'LaTeX-font-bf) (LaTeX-define-key map "\C-ce" 'LaTeX-font-em) (LaTeX-define-key map "\C-ci" 'LaTeX-font-it) (LaTeX-define-key map "\C-cr" 'LaTeX-font-rm) (LaTeX-define-key map "\C-cu" 'LaTeX-font-sc) (LaTeX-define-key map "\C-cf" 'LaTeX-font-sf) (LaTeX-define-key map "\C-cs" 'LaTeX-font-sl) (LaTeX-define-key map "\C-ct" 'LaTeX-font-tt) ;; miscellaneous bindings (LaTeX-define-key map "\C-c{" 'LaTeX-brace-words) (LaTeX-define-key map "\C-cp" 'LaTeX-path) (define-key map "\C-j" 'newline-and-indent) (define-key map "\M-(" 'backward-up-list) (define-key map "\M-)" 'forward-list) (define-key map "$" 'LaTeX-dollar) (define-key map "," 'LaTeX-comma) (define-key map "." 'LaTeX-dot) (define-key map "^" 'LaTeX-superscript) (define-key map "_" 'LaTeX-subscript) (setq LaTeX-mode-map map))) (defconst LaTeX-mode-version "0.41 [21-Nov-2000]" "Version number of current release of LaTeX-mode") (defvar LaTeX-newline-after-closing-delimiter nil "*Non-nil means that a newline is inserted after the closing brace following an inserted keyword (e.g. \cite{...}) or inserted delimiter pair.") (defvar LaTeX-newline-after-opening-delimiter t "*Non-nil means that macro arguments that appear in braces, brackets, or parenthesis are entered with the closing character on a new line, allowing typein to avoid having to push that character across the display. If nil, no empty line is created.") (defvar LaTeX-parenthesis-interval 500 "*Limit on number of characters between matching parentheses for\\ LaTeX-check-parenthesis-balance (on \\[LaTeX-check-parenthesis-balance]).") (defvar LaTeX-path-delimiter ?\= "*Delimiter character for LaTeX \\path macro.") (defconst LaTeX-prettyprint-paragraph-separate "^[ \t]*$\\| \\|^[ \t]*\\\\item\\|^[ \t]*\\\\bibitem\\|^[ \t]*%.*$" "*Regular expression for beginning of a line that separates paragraphs for the purposes of prettyprinting math mode.") (defvar LaTeX-space-after-begin-end nil "*Non-nil means that space is inserted before the braced environment name following a \\begin or \\end.") (defconst LaTeX-standard-comment-delimited-environments nil "*List of environments to always set off by empty comment lines.") (defconst LaTeX-standard-counters nil "List of standard counter names.") (setq LaTeX-standard-counters '( ("chapter") ("enumi") ("enumii") ("enumiii") ("enumiv") ("equation") ("figure") ("footnote") ("mpfootnote") ("page") ("paragraph") ("part") ("section") ("subparagraph") ("subsection") ("subsubsection") ("table") )) (defconst LaTeX-standard-dotted-abbreviations nil "List of abbreviations for which LaTeX-dot must provide special spacing, according to the value of LaTeX-comma-after-dotted-abbreviation.") (setq LaTeX-standard-dotted-abbreviations '( ("e.g.") ("ff.") ("i.e.") ("ibid.") ("loc cit.") ;both loc and loc. are in use ("loc. cit.") ("op. cit.") ("q.v.") ("viz.") ("w.r.t.") )) (defconst LaTeX-standard-environments nil "Standard environments known to LaTeX. Users may also define private ones in LaTeX-extra-environments. Each entry is itself a list, usually of only one string. A second optional list element is an additional string to be supplied after the \\begin{}. A third optional list element is a helpful comment string that is supplied on request. A fourth optional list element is a function to run after the \\begin{} \\end{} pair has been inserted, and point is between them; that function should position point to the place in the string defined by the second list element where something should be typed by the user.") (setq LaTeX-standard-environments '( ("abstract") ("alltt") ("array" "{}" (concat " % <- insert column justification letters (c,l,r)\n" " % Row entries: column-1 & column-2 & ... & column-n \\\\\n" " % Omit \\\\ on last row") (function (lambda () (search-backward "{}") (forward-char 1)))) ("bf") ("center") ("description") ("displaymath") ("document") ("em") ("enumerate") ("eqnarray") ("eqnarray*") ("equation") ("figure" "[]" " % <- insert location letters: h, b, t, p" (function (lambda () (search-backward "[]") (forward-char 1)))) ("figure*" "[]" " % <- insert location letters: h, b, t, p" (function (lambda () (search-backward "[]") (forward-char 1)))) ("flushleft") ("flushright") ("footnotesize") ("fussy") ("guess") ("huge") ("hunch") ("it") ("itemize") ("large") ("list") ("math") ("minipage" "[]{}" " % <- insert [position (b,t)]{width}" (function (lambda () (search-backward "[]{}") (forward-char 1)))) ("normalsize") ("note") ("overlay" "{}" " % <- insert {red,green,blue,etc.} color list" (function (lambda () (search-backward "{}") (forward-char 1)))) ("picture" "()()" " % <- insert (width,height)(lower-left-x,lower-left-y)" (function (lambda () (search-backward "()()") (forward-char 1)))) ("quotation") ("quote") ("scriptsize") ("setlength") ("sf") ("simple") ("sl") ("slide" "{}" " % <- insert {red,green,blue,etc.} color list" (function (lambda () (search-backward "{}") (forward-char 1)))) ("sloppy") ("sloppypar") ("small") ("tabbing") ("table" "[]" " % <- insert location letters: h, b, t, p" (function (lambda () (search-backward "[]") (forward-char 1)))) ("tabular" "{}" (concat " % <- insert column justification letters (c,l,r)\n" " % Row entries: column-1 & column-2 & ... & column-n \\\\\n" " % Omit \\\\ on last row") (function (lambda () (search-backward "{}") (forward-char 1)))) ("tabular*" "{}" (concat " % <- insert column justification letters (c,l,r)\n" " % Row entries: column-1 & column-2 & ... & column-n \\\\\n" " % Omit \\\\ on last row") (function (lambda () (search-backward "{}") (forward-char 1)))) ("thebibliography" "{}" " % <- insert widest label" (function (lambda () (search-forward "{thebibliography}") ;find \\end {thebibliography} (newline) ;and supply a newline (forward-line -2) (delete-blank-lines) (search-backward "{thebibliography}{}") (delete-blank-lines) (forward-char 18)))) ("theindex") ("theorem") ("tiny") ("titlepage") ("trivlist") ("tt") ("verbatim") ("verse") ("xguess") ("xiipt") ("xipt"))) (defconst LaTeX-standard-fonts nil "Standard LaTeX fonts which should be placed in a braced group.") (setq LaTeX-standard-fonts '( ;; size changes (from smallest to largest) ("tiny") ("scriptsize") ("footnotesize") ("small") ("normalsize") ("large") ("Large") ("LARGE") ("huge") ("Huge") ;; font style changes (alphabetically) ("bf") ("em") ("it") ("rm") ("sc") ("sf") ("sl") ("tt"))) (defconst LaTeX-2e-standard-fonts nil "Standard LaTeX 2e fonts which should be placed in a braced group.") (setq LaTeX-2e-standard-fonts '( ;; size changes (from smallest to largest) ("tiny") ("scriptsize") ("footnotesize") ("small") ("normalsize") ("large") ("Large") ("LARGE") ("huge") ("Huge") ;; font style changes (alphabetically) ;; These are excluded here, because they behave differently from ;; their 2.09 equivalents when inserted by LaTeX-macro. They ;; are included in LaTeX-2e-standard-macros. ;; ("emph") ;; ("textbf") ;; ("textit") ;; ("textmd") ;; ("textrm") ;; ("textsc") ;; ("textsf") ;; ("textsl") ;; ("textup") ;; ("texttt") )) (defconst LaTeX-standard-italic-fonts nil "Standard LaTeX italic fonts which usually take an italic correction.") (setq LaTeX-standard-italic-fonts '( ("em") ("it") ("sl"))) (defconst LaTeX-2e-standard-italic-fonts nil "Standard LaTeX 2e italic fonts. These do NOT require an italic correction, because the macros supply it automatically.") (setq LaTeX-2e-standard-italic-fonts '( ("emph") ("textit") ("textsl"))) (defconst LaTeX-standard-list-environments nil "Standard environments which expect \\item entries.") (setq LaTeX-standard-list-environments '( ("description") ("enumerate") ("itemize") ("list") ("trivlist"))) (defconst LaTeX-standard-macros nil "Standard LaTeX macros. These are stored in an associative list with elements of the form (\"name\" \"args\" \"short comment\"). If there are no arguments, then args is nil. For example, (\"framebox\" \"[][]{}\" \"[width][position (c,l,r)]{...}\") describes the macro \\framebox[width][position]{...}. The comment will be displayed by LaTeX-macro (on \[LaTeX-macro]) if name completion is requested.") ;;; Note that these are not globally sorted alphabetically, but instead ;;; are kept in order by their groupings in the LaTeX Reference Card, ;;; with blank lines separating the groups. The Reference Card does ;;; not cover the complete set of LaTeX commands, so we need to extend ;;; this some more yet. (setq LaTeX-standard-macros '( ;; miscellany ("date" "{}" "explicit date") ("footnotemark" "[]{}" "[number-or-symbol]{text} to footnote mark only") ("footnoterule" nil "command to draw line between text and footnotes") ("footnotesep" nil "height of vertical space between footnotes") ("footnotetext" "[]{}" "[number-or-symbol]{text} for footnote text only") ("special" "{}" "DVI-driver dependent text") ("today" nil "today's date like July 22, 1985") ;; type style ("bf" nil "bold text") ("boldmath" nil "use bold math symbols") ("cal" nil "upper-case calligraphic letters (math mode only)") ("em" nil "emphasized text") ("it" nil "italic text") ("mit" nil "math italics (math mode only)") ("rm" nil "roman text") ("sc" nil "small-caps text") ("sf" nil "sans-serif text") ("sl" nil "slanted text") ("tt" nil "typewriter text") ("unboldmath" nil "use normal math symbols") ;; math type styles ("displaystyle" nil "for normal symbols in displayed formula") ("scriptstyle" nil "for subscripts and superscripts") ("scriptscriptstyle" nil "for higher-level subscripts and superscripts") ("textstyle" nil "for normal symbols in in-text formula") ;; type size ("tiny" nil "tiny typesize") ("scriptsize" nil "subscript typesize") ("footnotesize" nil "footnote typesize") ("small" nil "small typesize") ("normalsize" nil "normal typesize") ("large" nil "large typesize") ("Large" nil "larger typesize") ("LARGE" nil "very large typesize") ("huge" nil "huge typesize") ("Huge" nil "Hugest typesize") ;; special symbols ("P" nil "pilcrow (paragraph mark)") ("S" nil "section mark") ("copyright" nil "copyright mark") ("dag" nil "single dagger") ("ddag" nil "double dagger") ("pounds" nil "sterling currency mark") ;; document sectioning ("tableofcontents" nil "generate table of contents in document") ("listoffigures" nil "generate list of figures in document") ("listoftables" nil "generate list of tables in document") ("part" "{}" "part in document") ("chapter" "{}" "chapter in document") ("section" "{}" "section in document") ("subsection" "{}" "subsection in document") ("subsubsection" "{}" "subsubsection in document") ("paragraph" "{}" "paragraph in document") ("subparagraph" "{}" "subparagraph in document") ("appendix" nil "appendix in document") ("part*" "{}" "unnumbered part in document") ("chapter*" "{}" "unnumbered chapter in document") ("section*" "{}" "unnumbered section in document") ("subsection*" "{}" "unnumbered subsection in document") ("subsubsection*" "{}" "unnumbered subsubsection in document") ("paragraph*" "{}" "unnumbered paragraph in document") ("subparagraph*" "{}" "unnumbered subparagraph in document") ;; math symbols ("frac" "{}{}" "{numerator}{denominator}") ("left" nil "left delimiter (follow by one of \".([{|\")") ("overbrace" "{}" "expression to overbrace") ("overline" "{}" "expression to overline") ("right" nil "right delimiter (follow by one of \".)]}|\")") ("sqrt" "[]{}" "[n-th root]{what of}") ("underbrace" "{}" "expression to underbrace") ("underline" "{}" "expression to underline") ;; document and page styles ("pagenumbering" "{}" "one of: arabic, roman, alph, Roman, Alph") ("pagestyle" "{}" "one of: plain, empty, headings, myheadings") ;; title page and abstract ("author" "{}" "author name(s)") ("and" nil "another author") ("maketitle" nil "generate title from \\title, \\author, \\date") ("title" "{}" "document title") ;; splitting the input ("include" "{}" "read {file} unless excluded by \\readonly") ("includeonly" "{}" "exclude any file not in {files}") ("input" "{}" "read {file}") ;; line breaking ("\\\\" "[]" "start new line leave [v] extra vertical space") ("\\\\*" "[]" "start new line leave [v] extra vertical space WITHOUT page break") ("linebreak" "[]" "force or encourage a line break ([n] in [0]..[4])") ("nolinebreak" "[]" "forbid or discourage a line break ([n] in [0]..[4])") ("sloppy" nil "allow loose lines (opposite of \\fussy)") ;; page breaking ("clearpage" nil "print all figures and tables and start a new page") ("cleardoublepage" nil "print all figures and tables and start a new right-hand (odd-numbered) page") ("newpage" nil "start a new page") ("nopagebreak" "[]" "forbid or discourage a page break ([n] in [0]..[4])") ("pagebreak" "[]" "force or encourage a page break ([n] in [0]..[4])") ("samepage" nil "forbid page breaking except between paragraphs") ;; boxes ("fbox" "{}" "frame {text} in box") ("framebox" "[][]{}" "make framed box of [width][position (l,r)]{...}") ("makebox" "[][]{}" "make box of [width][position (l,r)]{...}") ("mbox" "{}" "unbreakable text") ("newsavebox" "{}" "define {\\cmd} to be a bin for saving boxes") ("parbox" "[]{}{}" "paragraph box [position (b,t)]{width}{text}") ("savebox" "{}[][]{}" "{\\cmd}[width][position (l,r)]{text} save text in savebox {\\cmd}") ("sbox" "{}{}" "{\\cmd}{text} save text in savebox {\\cmd}") ("usebox" "{}" "print box saved in bin {\\cmd}") ;; length ("addtolength" "{}{}" "{\\cmd}{len} add len to length cmd") ("newlength" "{}" "define {\\cmd} to be a length") ("setlength" "{}{}" "{\\cmd}{len} set length cmd to len") ("settowidth" "{}{}" "{\\cmd}{text} set cmd to width of text") ;; space ("hspace" "{}" "make {length} horizontal space") ("hspace*" "{}" "make {length} horizontal space, even at beginning of line") ("vspace" "{}" "make {length} vertical space") ("vspace*" "{}" "make {length} vertical space, even at beginning of page") ;; pictures (NB: makebox, framebox, savebox have conflicting forms ;; here, and are omitted for now) ("circle" "{}" "circle of diameter {dia}") ("circle*" "{}" "filled disk of diameter {dia}") ("dashbox" "{}()[]{}" "{d}(x,y)[position (b,t,l,r)]{object} put frame of dashed line of length {d} around {object}") ("frame" "{}" "draw frame around {object}") ("line" "(){}" "line of slope (h,v) and horizontal extent {len} (length len if h = 0), h,v in 0..6") ("multiput" "()(){}{}" "(x,y)(dx,dy){n}{object} put object at (x,y), (x+dx, y+dy), ... n times") ("oval" "()[]" "[part (l,r,t,b)] of oval of size (width,height)") ("put" "(){}" "put at (x,y) some {object}") ("shortstack" "[]{}" "at [position (c,l,r)] stack {object} in box") ("thicklines" nil "thick picture lines") ("thinlines" nil "thin picture lines") ("vector" "(){}" "vector of slope (h,v) and horizontal extent {len} (length len if h = 0), h,v in 0..4") ;; figures and tables ("caption" "{}" "{caption} of figure or table") ;; tabbing environment ("=" nil "set tab stop") (">" nil "go to next tab stop") ("kill" nil "throw away sample line in tabbing environment") ;; array and tabular environments ("cline" "{}" "horizontal line across columns {i-j}") ("hline" nil "horizontal line between rows") ("multicolumn" "{}{}{}" "{n}{col}{text} span next n columns with col format") ("vline" nil "vertical line between columns") ;; definitions ("newcommand" "{}[]{}" "{\\cmd}[n]{def} define new command with n arguments") ("newcounter" "{}[]" "{new-counter}[within-counter]") ("newenvironment" "{}[]{}{}" "{env}[n]{beg}{end} define new environment with n arguments") ("newfont" "{}{}" "{command}{fontname} for new font") ("newtheorem" "{}{}" "{name}{caption} define new theorem environment") ;; numbering ("addtocounter" "{}{}" "{ctr}{n} add n to counter ctr") ("setcounter" "{}{}" "{ctr}{n} set counter ctr to n") ;; remainder not on reference card ;; bibliographies ("bibitem" "[]{}" "[label]{cite_key}") ("bibliography" "{}" "{bibliography-datebase-filename}") ("bibliographystyle" "{}" "{style-name}") ;; index and glossary ("glossary" "{}" "{glossary entry}") ("glossaryentry" "{}{}" "{string}{page} glossary entry") ("indexentry" "{}{}" "{string}{page} index entry") ("indexspace" nil "extra vertical space in index") ("makeglossary" nil "generate glossary (.glo) file (in preamble only)") ("makeindex" nil "generate index (.idx) file (in preamble only)") ;; terminal I/O ("typein" "[]{}" "[cmd]{message} -- (re)define cmd from terminal input") ("typeout" "{}" "{message}") ;; assorted others from Appendix C ("addvspace" "{}" "{len} extra vertical space") ("bigskip" nil "big skip") ("fussy" nil "restore fussy line breaking (opposite of \\sloppy)") ("hyphenation" "{}" "{hy-phen-ations sep-a-rated by spaces}") ("medskip" nil "medium skip") ("newline" nil "forced line break") ("raisebox" "{}[][]{}" "{raise_len}[height][depth]{text}") ("rule" "[]{}{}" "[raise_len]{width}{height}") ("smallskip" nil "small skip") ("stretch" "{}" "{dec_num} -- rubber length dec_num times the stretchability of \\fill") ("verb" "||" "|verbatim (typewriter) text| (use any identical delimiters in place of | |)") ("verb*" "||" "|verbatim (typewriter) text| with visible spaces (use any identical delimiters in place of | |)") ;; macros already bound to keys because of frequency of use, ;; but if user tries to generate them with LaTeX-macro, that ;; should be permitted too ("cite" "[]{}" "[remark text]{cite_key,key,...,key}") ("footnote" "{}" "{footnote text}") ("index" "{}" "{index text}") ("item" "[]" "[alternate item tag]") ("label" "{}" "{cross-reference key}") ("nocite" "{}" "{citation key,key,...,key}") ("pageref" "{}" "{cross-reference key}") ("ref" "{}" "{cross-reference key}") ;; foreign symbols ("AA{}" nil nil) ("AE{}" nil nil) ("L{}" nil nil) ("OE{}" nil nil) ("O{}" nil nil) ("aa{}" nil nil) ("ae{}" nil nil) ("l{}" nil nil) ("oe{}" nil nil) ("o{}" nil nil) ("ss{}" nil nil) ;; accents ("'" "{}" "acute over-accent") ("." "{}" "dot over-accent") ;;("=" "{}" "bar over-accent") ;;used in tabbing environment ("H" "{}" "hungarian umlaut over-accent") ("\"" "{}" "umlaut over-accent") ("^" "{}" "circumflex (hat) over-accent") ("`" "{}" "grave over-accent") ("b" "{}" "bar under-accent") ("c" "{}" "cedilla under-accent") ("d" "{}" "dot under-accent") ("t" "{}" "tie over-accent") ("u" "{}" "breve (cup) over-accent") ("v" "{}" "v (check) over-accent") ("~" "{}" "tilde over-accent") ;; math mode accents ("acute" "{}" "acute over-accent") ("bar" "{}" "bar over-accent") ("breve" "{}" "breve (cup) over-accent") ("check" "{}" "check over-accent") ("ddot" "{}" "double-dot over-accent") ("dot" "{}" "dot over-accent") ("grave" "{}" "grave over-accent") ("hat" "{}" "circumflex (hat) over-accent") ("tilde" "{}" "tilde over-accent") ("vec" "{}" "vector over-accent") ;; style parameters ("abovedisplayshortskip" nil "amount of extra space left above a short displayed formula (except in `fleqn' style option)") ("abovedisplayskip" nil "amount of extra space left above a long displayed formula (except in `fleqn' style option)") ("arraycolsep" nil "half width of default intercolumn space in `array' environment") ("arrayrulewidth" nil "width of rule from |, \\cline, \\hline, or \\vline") ("arraystretch" nil "multiplier of normal interrow spacing") ("belowdisplayshortskip" nil "amount of extra space left below a short displayed formula (except in `fleqn' style option)") ("belowdisplayskip" nil "amount of extra space left below a long displayed formula (except in `fleqn' style option)") ("bottomfraction" nil "maximum page fraction for bottom floats") ("dblfloatpagefraction" nil "minimum page fraction for floats in two-column style") ("dblfloatsep" nil "vertical space between top or bottom floats in two-column style") ("dbltextfloatsep" nil "vertical space between top or bottom floats and page text in two-column style") ("dbltopfraction" nil "maximum page fraction for top floats in two-column style") ("doublerulesep" nil "width of space between || or \\hline \\hline") ("evensidemargin" nil "one inch less than distance of left edge of paper to left margin of text on left-hand pages") ("extracolsep" "{}" "{width} extra space (for @-expression in `array' or `tabular' environment)") ("fboxrule" nil "width of lines in \\fbox and \\framebox") ("fboxsep" nil "amount of space between box edge and contents in \\fbox and \\framebox") ("floatpagefraction" nil "minimum page fraction for floats") ("floatsep" nil "vertical space between top or bottom floats") ("footheight" nil "height of a box containing the page foot") ("footskip" nil "distance from bottom of last line of body text to bottom of foot") ("headheight" nil "height of a box containing the head") ("headsep" nil "vertical space between head and body of page") ("intextsep" nil "vertical space above and below here-float") ("jot" nil "amount of extra vertical space between rows in `eqnarray' environment") ("marginpar" "[]{}" "[left-text]{right-text} of margin paragraph") ("marginparpush" nil "minimum vertical space between marginal notes") ("marginparsep" nil "horizontal space between outer margin and marginal note") ("marginparwidth" nil "width of marginal note parbox") ("mathindent" nil "indentation from left margin of displayed formulas in `fleqn' style") ("normalmarginpar" nil "place marginal notes in default margin") ("oddsidemargin" nil "one inch less than distance of left edge of paper to left margin of text on right-hand pages") ("reversemarginpar" nil "place marginal notes in opposite of default margin") ("tabcolsep" nil "half width of default intercolumn space in `tabular' environment") ("textfloatsep" nil "vertical space between top or bottom floats and page text") ("textfraction" nil "minimum page fraction for text") ("textheight" nil "normal height of page body") ("textwidth" nil "normal width of page body") ("topfraction" nil "maximum page fraction for top floats") ("topmargin" nil "one inch less than distance from top edge of paper to top of page head") ("topsep" nil "extra vertical space between list and surrounding text") ("topskip" nil "minimum distance from top of body to bottom of first line of text") ;; math mode ("bmod" nil "binary `mod' symbol") ("cdots" nil "dots ... at center of line") ("ddots" nil "diagonal dots") ("ldots" nil "dots ... at bottom of line") ("lefteqn" "{}" "print {formula} in zero-width display style in `eqnarray'") ("pmod" "{}" "produce `(mod {arg})'") ("vdots" nil "vertical dots") ;; Greek letters ("alpha" nil nil) ("beta" nil nil) ("gamma" nil nil) ("delta" nil nil) ("epsilon" nil nil) ("varepsilon" nil nil) ("zeta" nil nil) ("eta" nil nil) ("theta" nil nil) ("vartheta" nil nil) ("iota" nil nil) ("kappa" nil nil) ("lambda" nil nil) ("mu" nil nil) ("nu" nil nil) ("xi" nil nil) ("pi" nil nil) ("varpi" nil nil) ("rho" nil nil) ("varrho" nil nil) ("sigma" nil nil) ("varsigma" nil nil) ("tau" nil nil) ("upsilon" nil nil) ("phi" nil nil) ("varphi" nil nil) ("chi" nil nil) ("psi" nil nil) ("omega" nil nil) ("Gamma" nil nil) ("Delta" nil nil) ("Theta" nil nil) ("Lambda" nil nil) ("Xi" nil nil) ("Pi" nil nil) ("Sigma" nil nil) ("Upsilon" nil nil) ("Phi" nil nil) ("Psi" nil nil) ("Omega" nil nil) ;; delimiters ("langle" nil "left angle bracket") ("lceil" nil "left ceiling bracket") ("lfloor" nil "left floor bracket") ("rangle" nil "right angle bracket") ("rceil" nil "right ceiling bracket") ("rfloor" nil "right floor bracket") ;; binary operation symbols ("pm" nil "plus-minus") ("mp" nil "minus-plus") ("times" nil "multiply") ("div" nil "divide") ("ast" nil "asterisk") ("star" nil "star") ("circ" nil "hollow circle") ("bullet" nil "solid circle") ("cdot" nil "centered dot") ("cap" nil "intersection") ("cup" nil "union") ("uplus" nil "union plus") ("sqcap" nil "square cap") ("sqcup" nil "square cup") ("vee" nil "logical or") ("wedge" nil "logical and") ("setminus" nil "backslash") ("wr" nil "vertical squiggle") ("diamond" nil "hollow diamond") ("bigtriangleup" nil "up-pointing big triangle") ("bigtriangledown" nil "down-pointing big triangle") ("triangleleft" nil "left-pointing triangle") ("triangleright" nil "right-pointing triangle") ("lhd" nil "left arrowhead") ("rhd" nil "right arrowhead") ("unlhd" nil "underlined left arrowhead") ("unrhd" nil "underlined right arrowhead") ("oplus" nil "circled plus") ("ominus" nil "circled minus") ("otimes" nil "circled multiply") ("oslash" nil "circled divide") ("odot" nil "circled dot") ("bigcirc" nil "big hollow circle") ("dagger" nil "dagger") ("ddagger" nil "double dagger") ("amalg" nil "inverted Pi") ;; relation symbols ("not" nil "cross following math operator") ("leq" nil "less than or equal") ("prec" nil nil) ("preceq" nil nil) ("ll" nil "much less than") ("subset" nil "subset") ("subseteq" nil nil) ("sqsubset" nil "square subset") ("sqsubseteq" nil "square subseteq") ("in" nil "element of") ("vdash" nil nil) ("geq" nil "greater than or equal") ("succ" nil nil) ("succeq" nil nil) ("gg" nil "much greater than") ("supset" nil "superset") ("supseteq" nil nil) ("sqsupset" nil "square supset") ("sqsupseteq" nil "square supseteq") ("ni" nil "backwards \\in") ("dashv" nil nil) ("equiv" nil "equivalent") ("sim" nil nil) ("simeq" nil nil) ("asymp" nil nil) ("approx" nil "approximately equal") ("cong" nil nil) ("neq" nil "not equal to") ("doteq" nil "dotted equal") ("propto" nil "proportional to") ("models" nil nil) ("perp" nil "perpendicular to") ("mid" nil "vertical bar") ("parallel" nil "double vertical bar") ("bowtie" nil nil) ("Join" nil "small bowtie") ("smile" nil nil) ("frown" nil nil) ;; arrow symbols ("leftarrow" nil nil) ("Leftarrow" nil nil) ("rightarrow" nil nil) ("Rightarrow" nil nil) ("leftrightarrow" nil nil) ("Leftrightarrow" nil nil) ("mapsto" nil nil) ("hookleftarrow" nil nil) ("leftharpoonup" nil nil) ("leftharpoondown" nil nil) ("rightleftharpoons" nil nil) ("longleftarrow" nil nil) ("Longleftarrow" nil nil) ("longrightarrow" nil nil) ("Longrightarrow" nil nil) ("longleftrightarrow" nil nil) ("Longleftrightarrow" nil nil) ("longmapsto" nil nil) ("hookrightarrow" nil nil) ("rightharpoonup" nil nil) ("rightharpoondown" nil nil) ("leadsto" nil nil) ("uparrow" nil nil) ("Uparrow" nil nil) ("downarrow" nil nil) ("Downarrow" nil nil) ("updownarrow" nil nil) ("Updownarrow" nil nil) ("nearrow" nil nil) ("searrow" nil nil) ("swarrow" nil nil) ("nwarrow" nil nil) ;; miscellaneous symbols ("aleph" nil "first Hebrew letter") ("hbar" nil "Planck's constant/(2pi)") ("imath" nil "undotted italic i") ("jmath" nil "undotted italic j") ("ell" nil "script l") ("wp" nil nil) ("Re" nil "real part of") ("Im" nil "imaginary part of") ("mho" nil "reciprocal ohm") ("prime" nil nil) ("emptyset" nil "slashed 0") ("nabla" nil "inverted delta") ("surd" nil "root of") ("top" nil nil) ("bot" nil nil) ("|" nil "double vertical bars") ("angle" nil "angle between") ("forall" nil "inverted A") ("exists" nil "backwards E") ("neg" nil "negation") ("flat" nil "musical flat") ("natural" nil "musical natural") ("sharp" nil "musical sharp") ("backslash" nil nil) ("partial" nil "partial derivative") ("infty" nil "infinity") ("Box" nil "big hollow box") ("Diamond" nil "big hollow diamond") ("triangle" nil "hollow triangle") ("clubsuit" nil "playing card club suit") ("diamondsuit" nil "playing card diamond suit") ("heartsuit" nil "playing card heart suit") ("spadesuit" nil "playing card spade suit") ;; variable-sized symbols ("sum" nil "summation of") ("prod" nil "product of") ("coprod" nil nil) ("int" nil "integral of") ("oint" nil "contour integral of") ("bigcap" nil "big intersection of") ("bigcup" nil "big union of") ("bigsqcup" nil "big square union of") ("bigvee" nil "big logical or") ("bigwedge" nil "big logical and") ("bigodot" nil "big circled dot") ("bigotimes" nil "big circled multiply") ("bigoplus" nil "big circled plus") ("biguplus" nil "big union plus") ;; log-like functions ("arccos" nil nil) ("arcsin" nil nil) ("arctan" nil nil) ("arg" nil nil) ("cos" nil nil) ("cosh" nil nil) ("cot" nil nil) ("coth" nil nil) ("csc" nil nil) ("deg" nil nil) ("det" nil nil) ("dim" nil nil) ("exp" nil nil) ("gcd" nil nil) ("hom" nil nil) ("inf" nil nil) ("ker" nil nil) ("lg" nil nil) ("lim" nil nil) ("liminf" nil nil) ("limsup" nil nil) ("ln" nil nil) ("log" nil nil) ("max" nil nil) ("min" nil nil) ("Pr" nil nil) ("sec" nil nil) ("sin" nil nil) ("sinh" nil nil) ("sup" nil nil) ("tan" nil nil) ("tanh" nil nil) ;; letters ("address" "{}" "{line1\\\\line2\\\\...linen} of letter return address (in preamble)") ("cc" "{}" "{name1\\\\name2\\\\...namen} carbon copies of letter") ("closing" "{}" "{Best regards,} letter closing") ("makelabels" nil "make list of mailing labels") ("opening" "{}" "{Dear John,} letter opening") ("ps" nil "precedes text after letter \\closing (you type P.S.)") ("signature" "{}" "{name\\\\title} letter signature (in preamble)") ("encl" "{}" "{encl1\\\\encl2...\\\\encln} list of enclosures") ;; logos ("AMSTEX{}" nil "AMSTeX") ("BibTeX{}" nil "BibTeX") ("LaTeX{}" nil "LaTeX") ("METAFONT{}" nil "Metafont") ("MF{}" nil "Metafont") ("SLiTeX{}" nil "SLiTeX") ("TeX{}" nil "TeX") ;; remaining macros appearing in the index (alphabetically) ("Alph" "{}" "{counter} uppercase letters for counter") ("Roman" "{}" "{counter} uppercase roman numerals for counter") ("a'" "{}" "acute over-accent in tabbing environment") ("a=" "{}" "bar over-accent in tabbing environment") ("a`" "{}" "grave over-accent in tabbing environment") ("addcontentsline" "{}{}{}" "{file_ext}{sec_unit}{entry} -- add an entry to specified list or table") ("addtocontents" "{file_ext}{text}" "add text to .toc, .lof, or .lot file") ("alph" "{}" "{counter} lowercase letters for counter") ("arabic" "{}" "{counter} arabic numerals for counter") ("baselineskip" nil "minimum space between successive line bottoms") ("baselinestretch" nil "multiplier of \\baselineskip") ("batchmode" nil "non-stop LaTeX processing") ("begin" "{}" "{environment}") ("bibindent" nil "width of extra indentation in openbib block") ("bigskipamount" nil "vertical space for \\bigskip") ("blackandwhite" "{}" "{file} for black and white slides") ("centering" nil "centering text") ("colors" "{}" "{red,blue,green,etc.} slides") ("colorslides" "{}" "{file} for color slides") ("columnsep" nil "width of intercolumn space in twocolumn style") ("columnseprule" nil "width of intercolumn rule in twocolumn style") ("documentstyle" "[]{}" "[option,option,...]{style}") ("dotfill" nil "dotted fill") ("end" "{}" "{environment}") ("fill" nil "arbitrarily stretchable rubber length") ("flushbottom" nil "preamble declaration for flush page bottoms") ("fnsymbol" "{}" "{counter} one of 9 footnote symbols") ("frenchspacing" nil "suppress extra space after punctuation") ("hbox" "{}" "horizontal box") ("hfill" nil "horizontal stretchable space") ("hrulefill" nil "horizontal rule fill") ("indent" nil "horizontal space of size as paragraph indentation") ("invisible" nil "color declaration for invisible SliTeX text") ("itemindent" nil "extra indentation before item label") ("itemsep" nil "vertical space between list items") ("i{}" nil "undotted i") ("j{}" nil "undotted j") ("labelitemi" nil "macro to produce label item") ("labelitemii" nil "macro to produce label item") ("labelitemiii" nil "macro to produce label item") ("labelitemiv" nil "macro to produce label item") ("labelsep" nil "space between label box and item text") ("labelwidth" nil "width of label box") ("leftmargin" nil "horizontal distance from enclosing environment left margin and left margin of list") ("leftmargini" nil "horizontal distance from enclosing environment left margin and left margin of list") ("leftmarginii" nil "horizontal distance from enclosing environment left margin and left margin of list") ("leftmarginiii" nil "horizontal distance from enclosing environment left margin and left margin of list") ("leftmarginiv" nil "horizontal distance from enclosing environment left margin and left margin of list") ("linethickness" "{}" "{len} for picture environment lines") ("linewidth" nil "width of lines in current environment") ("listparindent" nil "extra indentation for first line of each paragraph except first one of item") ("load" "{}{}" "{size}{style} -- load size and style of font") ("makelabel" "{}" "{label} -- generate label for \\item command") ("markboth" "{}{}" "{left-head}{right-head} for page styles `headings' and `myheadings'") ("markright" "{}" "{right-head} for page styles `headings' and `myheadings'") ("medskipamount" nil "vertical space for \\medskip") ("nofiles" nil "suppress writing of .aux files") ("noindent" nil "suppress following paragraph indentation") ("nonfrenchspacing" nil "restore extra space after punctuation") ("nonumber" nil "suppress equation number in current row") ("numberline" "{}{}" "{sec_num}{heading} (for \\addcontentsline)") ("onecolumn" nil "start new page and revert to single column") ("onlynotes" "{}" "{1,3-5,7,23} -- produce subset of slide notes") ("onlyslides" "{}" "{1,3-5,7,23} -- produce subset of slides") ("par" nil "new paragraph") ("parindent" nil "paragraph indentation") ("parsep" nil "interparagraph separation in lists") ("parskip" nil "extra vertical space before paragraph") ("partopsep" nil "extra vertical space between list and surrounding text") ("poptabs" nil "restore pushed tab settings") ("protect" nil "protect following macro from immediate expansion") ("pushtabs" nil "push current tab settings (restore by \\poptabs)") ("raggedbottom" nil "preamble declaration for ragged page bottoms") ("raggedleft" nil "declaration for ragged left margins") ("raggedright" nil "declaration for ragged right margins") ("refstepcounter" "{}" "{counter} increment counter by 1 and declare \ref value") ("renewcommand" "{}[]{}" "{\\cmd}[n]{def} redefine old command with n arguments") ("renewenvironment" "{}[]{}{}" "{env}[n]{beg}{end} redefine old environment with n arguments") ("rightmargin" nil "horizontal distance from enclosing environment right margin and right margin of list") ("roman" "{}" "{counter} lowercase roman numerals for counter") ("smallskipamount" nil "vertical space for \\smallskip") ("space" nil "single space in argument of \\typeout{}") ("stackrel" "{}{}" "{top}{bottom} -- typeset top over bottom") ("stepcounter" "{}" "{counter} increment counter by 1") ("subitem" nil "subitem in document index") ("subsubitem" nil "subsubitem in document index") ("symbol" "{}" "typeset symbol {num} in current font") ("tabbingsep" nil "intercolumn tab stop separation") ("thanks" "{}" "{footnote} for titlepage -- put inside \\title{}, \\author{}, or \\date{}") ("the" nil "\\thectr is value of counter ctr") ("thepage" nil "current page number in current style") ("thispagestyle" "{}" "{style} of current page") ("twocolumn" "[]" "start new page in two column mode, setting two-column [optional-text] across top") ("unitlength" nil "size of unit length in picture mode") ("usecounter" "{}" "enable and zero {ctr} for numbering list items") ("value" "{}" "value of counter {ctr}") ("vbox" "{}" "vertical box") ("vfill" nil "vertical stretchable space") ("widehat" "{}" "{text} to be capped by wide hat") ("widetilde" "{}" "{text} to be capped by wide tilde") ;; miscellaneous additions ("printindex" nil "read and print index at this point") )) (defconst LaTeX-2e-standard-macros nil "Standard macros that are new with LaTeX 2e. They supplement the list in LaTeX-standard-macros.") (setq LaTeX-2e-standard-macros '( ;; These are given in the same order as they appear on the LaTeX ;; 2e reference card. Several additional ones are also provided. ;; type style ("emph" "{}" "emphasized text") ("textrm" "{}" "roman text") ("textit" "{}" "italic text") ("textbf" "{}" "bold text") ("textsl" "{}" "slanted text") ("textsc" "{}" "small-caps text") ("texttt" "{}" "typewriter text") ("textsf" "{}" "sans-serif text") ("textmd" "{}" "medium text") ; missing from reference card ("textup" "{}" "upright text") ; missing from reference card ("itshape" "{}" "italic shape") ; missing from reference card ("scshape" "{}" "small caps shape") ; missing from reference card ("slshape" "{}" "slanted shape") ; missing from reference card ("upshape" "{}" "upright shape") ; missing from reference card ("bfseries" "{}" "bold series") ; missing from reference card ("mdseries" "{}" "medium series") ; missing from reference card ("rmfamily" "{}" "roman family") ; missing from reference card ("sffamily" "{}" "sans serif family") ; missing from reference card ("ttfamily" "{}" "typewriter family") ; missing from reference card ("mathrm" "{}" "roman text") ("mathit" "{}" "italic text") ("mathbf" "{}" "bold text") ("mathtt" "{}" "typewriter text") ("mathsf" "{}" "sans-serif text") ("mathcal" "{}" "calligraphic text") ;; document class, packages, styles ("documentclass" "[]{}" "[option,option,...]{class}") ("usepackage" "[]{}" "[option,option,...]{subclass}") ;; page breaking ("enlargethispage" "{}" "squeeze extra {ht} of text onto this page") ("enlargethispage*" "{}" "squeeze extra {ht} of text onto this page") ;; graphics and color package ("scalebox" "{}{}" "{factor}{contents}: scale box by {factor}") ("resizebox" "{}{}{}" "{wd}{ht}{contents}: scale box to {wd} x {ht}") ("rotatebox" "{}{}" "{angle}{contents}: rotate box by {angle} degrees") ("includegraphics" "{}" "insert graphics from {file}") ("definecolor" "{}{}{}" "{color}{model}{value}: define color") ("textcolor" "{}{}" "{color}{text}: typeset colored text") ("colorbox""{}{}" "{color}{text}: typeset colored box") ("pagecolor" "{}" "set background {color} of page") )) (defconst LaTeX-standard-options nil "Standard \\documentstyle options. Users may also define private ones.") ;;; Note that is is not possible to just insert the names of all .sty ;;; files here, because a few are not for LaTeX (e.g. AMSTeX .sty ;;; files), and of the remainder, some are standalone styles (for ;;; LaTeX-standard-styles), and some (these) are modifying options. ;;; Some options, like 11pt, do not have a style file at all (which was ;;; probably a bad design choice, for otherwise, this list could be set ;;; dynamically from the file system). ;;; ;;; This list is chosen from the set of styles available at the author's ;;; site in Utah [last update 21 August 1991]. Some styles may not be ;;; available elsewhere, but that is fairly harmless. All of these ;;; styles may be freely distributed. Credits have been given; ;;; eventually, these comments may be added to the option list for ;;; additional documentation. (setq LaTeX-standard-options '( ("11pt") ;LaTeX 2.09 ("12pt") ;LaTeX 2.09 ("a4") ;John Pavel: A4 paper ("a4wide") ;Jean-Francois Lamy: wider text lines on A4 paper ("acm") ;LaTeX 2.09 ("acronym") ;Douglas Miller: acronyms ("agugrl") ;American Geophysical Union Geophysical Research Letters ("agujgr") ;American Geophysical Union Journal of Geophysical Research ("alltt") ;LaTeX 2.09 ("amsbsy") ;AMS-LaTeX ("amscd") ;AMS-LaTeX ("amsfonts") ;AMS-LaTeX ("amssymb") ;AMS-LaTeX ("amssymbols") ;Charles Karney: AMS symbol font support ("amstext") ;AMS-LaTeX ("apalike") ;BibTeX APA style citations ("archmemo") ;Utah ("array") ;F. Mittelbach array+tabular TUGboat 9(3)298 (1988), 10(1)103 (1989) ("bezier") ;LaTeX 2.09 ("biihead") ;Ted Shapin: underlined page headings ("boxedmini") ;Jerry Leichter: boxed minipage environment ("changebar") ;anonymous: changebar environment ("chapterbib") ;C. Niel Kempson: multiple bibliographies ("cite") ;Donald Arseneau: line breaks in long citations ("clsc") ;Utah ("clscmemo") ;Utah ("concrete") ;Concrete Roman fonts ("cropmark") ;Dominik Wujastyk: page crop marks (corner rules) ("ctagsplt") ;AMS-LaTeX ("cyrillic") ;Charles Karney: cyrillic fonts ("dblspace") ;same as doublespace ("doublespace") ;same as dblspace ("draft") ;Joe Baker: mark label, cite, ref, index, glossary ("drafthead") ;Stephen Page: DRAFT + timestamp in page header ("drop") ;David G. Cantor: dropped caps ("dvidoc") ;John Pavel: dvidoc fonts ("eqsecnum") ;aps (American Physical Society) ("espo") ;anonymous: Esperanto object names ("fleqn") ;LaTeX 2.09 ("format") ;Charles Karney: floating-point number formatting ("fullpage") ;Richard Furuta: extended text height ("geophysics") ;Stephen Gildea: Geophysics journal ("german") ;H. Partl: German object names et al ("gnuindex") ;Utah: GNU TeXindex indexing support ("ifthen") ;LaTeX 2.09 ("intlim") ;AMS-LaTeX ("ist21") ;anonymous: British Standards Institute IST21 docs ("leqno") ;LaTeX 2.09 ("listing") ;Utah: program listings ("longtab") ;David Carlisle: long tables ("makeidx") ;LaTeX 2.09 ("math") ;Utah ("merge") ;Johannes L. Braams: form letter merge ("mfr") ;Mark A. Roth: memo-for-record (usafmemo option) ("mitthesis") ;MIT thesis ("moretext") ;Jean-Francois Lamy: wider text lines ("natsci") ;Stephen Gildea: citations in NATSCI bib style. ("nl") ;Nederlands (Dutch) object names ("nonamelm") ;AMS-LaTeX ("nopageno") ;Richard Furuta: suppress page numbers ("nosumlim") ;AMS-LaTeX ("openbib") ;LaTeX 2.09 ("pandora") ;N. Billawala's Pandora fonts ("preprint") ;aps ("proc") ;LaTeX 2.09 ("psmavg") ;Kinch AP-TeX AvantGarde ("psmbkm") ;Kinch AP-TeX Bookman ("psmncs") ;Kinch AP-TeX NewCenturySchoolBook ("psmpal") ;Kinch AP-TeX Palatino ("psmtim") ;Kinch AP-TeX TimesRoman ("remark") ;anonymous: remark environment ("resume") ;Stephen Gildea: resume ("revtex") ;aps ("righttag") ;AMS-LaTeX ("sc21") ;British Standards Institute ISO/TC97/SC21 docs ("sc21-wg1") ;British Standards Institute ISO/TC97/SC21/WG1 ("sfwmac") ;anonymous: UNIX-style docs ("showidx") ;LaTeX 2.09 ("showlabels") ;Gil Neiger: show labels in line ("slem") ;Richard Furuta: \em -> \sl instead of \it ("spacecites") ;Richard Furuta: spaces in citation lists ("supertab") ;Theo Jurriens: supertabular environment ("suthesis") ;Joseph Pallas: Stanford University thesis ("tablisting") ;Utah: file listing ("tapeseal") ;Utah: tape seal label support ("texindex") ;FSF: TeXindex support ("texnames") ;Richard Furuta: TeXware names ("tgrind") ;anonymous: LaTeX prettyprinting ("theorem") ;AMS-LaTeX ("thp") ;AMS-LaTeX ("threepart") ;Lance Berc: threepart head and foot macros ("titlepage") ;LaTeX 2.09 ("trademark") ;anonymous: macros of trademarks ("troffman") ;Utah: troff man style ("troffms") ;Utah: troff ms style ("twocolumn") ;LaTeX 2.09 ("twoside") ;LaTeX 2.09 ("underline") ;anonymous: horizontal rule below page header ("uofutah") ;Utah: University of Utah letterhead ("vdm") ;M. Wolczko: VDM (== ???) ("verbatim") ;AMS-LaTeX )) ;;; The LaTeX 2e option set is much smaller than in LaTeX 2.09, because ;;; most of the latter have been transformed into packages. (defconst LaTeX-2e-standard-options nil "Standard \\documentclass options. Users may also define private ones.") (setq LaTeX-2e-standard-options '( ("11pt") ("12pt") ("a4paper") ("fleqn") ("leqno") ("titlepage") ("twocolumn") ("twoside") )) (defconst LaTeX-2e-standard-packages nil "Standard packages. Users may also define private ones.") ;;; This list of LaTeX 2e packages corresponds to the names ;;; /usr/local/lib/tex/latex2e/unpacked/*.sty in the LaTeX 2e ;;; 18-Dec-1994 release, plus files from the February 1995 AmSTeX ;;; release. However, it excludes all *.sty files for which a ;;; corresponding *.cls file exists, because use of those *.sty files ;;; generates a warning that a class file should be used instead. (setq LaTeX-2e-standard-packages '( ("afterpage") ("alltt") ("amsbsy") ("amscd") ("amsfonts") ("amsgen") ("amsintsm") ("amssymb") ("amstex") ("amstext") ("amsthm") ("amsxtra") ("array") ("avant") ("babel") ("bahasa") ("basker") ("bembo") ("bezier") ("bookman") ("catalan") ("chancery") ("charter") ("cmmib57") ("color") ("croatian") ("czech") ("danish") ("dcolumn") ("delarray") ("doc") ("dutch") ("english") ("enumerate") ("epsfig") ("esperant") ("eucal") ("eufrak") ("euscript") ("exscale") ("finnish") ("flafter") ("fontdoc") ("fontenc") ("fontinst") ("fontsmpl") ("francais") ("ftnright") ("galician") ("garamond") ("germanb") ("graphics") ("graphicx") ("graphpap") ("helvet") ("hhline") ("ifthen") ("indentfirst") ("inputenc") ("italian") ("keyval") ("latexsym") ("layout") ("longtable") ("lscape") ("lucbmath") ("lucbr") ("lucid") ("lucidbrb") ("lucidbry") ("lucmath") ("luctimes") ("magyar") ("makeidx") ("mathptm") ("mathtime") ("mtimes") ("multicol") ("newcent") ("newlfont") ("nimbus") ("norsk") ("oldgerm") ("oldlfont") ("ot1var") ("palatino") ("pandora") ("pict2e") ("pifont") ("polish") ("portuges") ("pstcol") ("rawfonts") ("romanian") ("romref") ("shortvrb") ("showidx") ("showkeys") ("slovak") ("slovene") ("somedefs") ("spanish") ("swedish") ("syntonly") ("t1enc") ("tabularx") ("thb") ("thc") ("thcb") ("theorem") ("thm") ("thmb") ("thp") ("times") ("tracefnt") ("trig") ("turkish") ("utopia") ("varioref") ("verbatim") ("xr") ("xspace") )) (defconst LaTeX-standard-styles nil "Standard document styles. Users may also define private ones.") (setq LaTeX-standard-styles '( ("aaai") ("amsart") ;AMS-LaTeX ("amsbook") ;AMS-LaTeX ("amstex") ;AMS-LaTeX ("aps") ;APS ("article") ;LaTeX 2.09 ("book") ;LaTeX 2.09 ("deproc") ;DECUS Proceedings ("letter") ;LaTeX 2.09 ("ltugboat") ;TeX User Group TUGboat journal ("ltugproc") ;TeX User Group Proceedings ("refman") ;H. Partl's Adobe-like reference manual ("report") ;LaTeX 2.09 ("siam") ;LaTeX 2.09 ("slides") ;LaTeX 2.09 ("tugboat") ;TeX User Group journal ("ucthesis") ;University of California thesis ("uoftoronto") ;University of Toronto thesis ("usafmemo") ;this is called `memo' at some sites ("uuthesis") ;University of Utah ("xxxslides") ;extended slides )) (defconst LaTeX-2e-standard-classes nil "Standard document classes. Users may also define private ones.") ;;; This list of LaTeX 2e packages corresponds to the names ;;; /usr/local/lib/tex/latex2e/unpacked/*.cls in the LaTeX 2e ;;; 18-Dec-1994 release, plus files from the February 1995 AmSTeX ;;; release. (setq LaTeX-2e-standard-classes '( ("amsart") ("amsbook") ("amsdtx") ("amsldoc") ("article") ;LaTeX 2.09 ("book") ;LaTeX 2.09 ("letter") ;LaTeX 2.09 ("ltnews") ("ltxdoc") ("ltxguide") ("proc") ("report") ;LaTeX 2.09 ("slides") ;LaTeX 2.09 )) (defconst LaTeX-standard-tied-abbreviations nil "List of abbreviations for which LaTeX-dot must suppy a tie following the dot. See the LaTeX User's Guide and Reference Manual, p. 18, and the TeXbook, pp. 73--74.") (setq LaTeX-standard-tied-abbreviations '( ("cf.") ("Dr.") ("Fig.") ("Fr.") ("Mr.") ("Mrs.") ("Ms.") ("Prof.") ("Profs.") ("resp.") ("Rev.") ("vs.") )) (defconst LaTeX-standard-unindented-environments nil "List of environments whose \\begin{} and \\end{} must not be indented") (setq LaTeX-standard-unindented-environments '( ("document") ("verbatim") )) (defvar LaTeX-update-labels t "Update list of LaTeX \\label{...} names when LaTeX-mode is selected.") (defvar LaTeX-update-bibtags t "Update list of LaTeX \\cite{...} bibliography tags when LaTeX-mode is selected.") (defvar LaTeX-verb-delimiter ?\= "*Delimiter character for LaTeX \\verb macro.") (defvar SLiTeX-begin-slide "\\\\begin *{slide}{[^{}]*}\\|\\\\begin *{overlay}{[^{}]*}\\|\\\\begin *{note}" "*Regexp that matches the start of a note, overlay, or slide. Used by renumber-slides to find a place to put the comment with the slide number.") ;;; We use this so the file can be harmlessly blank-trimmed (defmacro SPACE () "just an ordinary space" ?\ ) (defmacro NEWLINE () "just an ordinary newline" 10) ;;; set-auto-mode always downcases mode function name, so alias it (fset 'latex-mode 'LaTeX-mode) (defun expand-file-name-in-path (path filename) "Search a colon-separated directory PATH for an existing FILENAME, and return its full name. If the file cannot be found, return nil." (let ((filepath (LaTeX-split-string path ":"))) (while (and filepath (not (file-exists-p (concat (car filepath) "/" filename)))) (setq filepath (cdr filepath))) (if (null filepath) nil (concat (car filepath) "/" filename)))) (defun file-name-sans-extension (filename) "Return the base name (minus .extension) of FILENAME. If there is no extension, FILENAME is returned." (let (n) (setq n (1- (length filename))) (>= n 0) (while (and (>= n 0) (not (= (aref filename n) ?.))) (setq n (1- n))) (substring filename 0 (if (>= n 0) n (length filename))))) (defun LaTeX-add-word-to-index (&optional arg) "Index word(s) or group or, or just before, point, as \\X{..text..} X is replaced by whatever LaTeX-index-macro is set to, if it is not nil, or as ..text..% \\index{..text..} if LaTeX-index-macro is nil. An argument selects that many words, and is ignored for groups (just the group following point will be indexed). Bound to \\\\[LaTeX-add-word-to-index]." (interactive) (setq arg (internal-LaTeX-default arg 1)) (skip-chars-forward " \t\n") (if LaTeX-index-macro ;; then user wants short form: ;; \macro{..text..} (if (looking-at "{") ;then index a single group (progn (insert LaTeX-index-macro "{") (forward-sexp 1) (insert "}")) (progn ;else index ARG words (backward-word 1) ;make sure we are at start of word (insert LaTeX-index-macro "{") (forward-word arg) (insert "}"))) ;; else user wants verbose standard LaTeX form: ;; ..text..% ;; \\index{..text..} (let ((start nil) (end nil)) (if (looking-at "{") ;then index a single group (progn (setq start (point)) (forward-sexp 1) (setq end (point))) (progn ;else index ARG words (forward-word 1) ;make sure we are at start of word (backward-word 1) (setq start (point)) (forward-word arg) (setq end (point)))) (insert "%\n\\index{" (buffer-substring start end) "}") (if (not (looking-at "\n")) (progn (insert "\n") (delete-horizontal-space)))))) (defun LaTeX-angles (&optional arg) "Insert pair of angle brackets. With an argument, backslashed angle brackets (literal angle brackets) are generated. Bound to \\\\[LaTeX-angles]." (interactive) (if (and (null arg) (null current-prefix-arg)) (internal-LaTeX-delimiter-pair "<" ">" nil) (internal-LaTeX-delimiter-pair "\\<" "\\>" nil))) (defun LaTeX-begin-end-block (environment-name &optional arg) "Insert \\begin{...} ... \\end{...} block, prompting for the ENVIRONMENT-NAME. The indentation is set according to the current \\begin{} ... \\end{} nesting level. With an argument, helpful comments may be inserted. Bound to \\\\[LaTeX-begin-end-block]." (interactive (list (completing-read "Environment name: " (append LaTeX-standard-environments LaTeX-extra-environments) nil nil nil))) (setq arg (internal-LaTeX-default arg nil)) (internal-LaTeX-set-indentation) (let ((commentary) (environments (assoc environment-name (append LaTeX-standard-environments LaTeX-extra-environments))) (extra-args) (moveto)) (setq extra-args (eval (nth 1 environments))) (setq commentary (eval (nth 2 environments))) (setq moveto (nth 3 environments)) (if (> (current-column) 0) (progn (end-of-line) (newline))) (if (not (looking-at "\n")) (progn (newline) (forward-line -1))) (if (assoc environment-name (append LaTeX-standard-comment-delimited-environments LaTeX-extra-comment-delimited-environments)) (insert-string "%\n")) (if (not (assoc environment-name (append LaTeX-standard-unindented-environments LaTeX-extra-unindented-environments))) (insert-char (SPACE) ;; [24-Apr-1999] Change to use just LaTeX-current-indentation ;; (+ LaTeX-current-indentation LaTeX-begin-end-indentation) LaTeX-current-indentation)) (insert "\\begin" (if LaTeX-space-after-begin-end (if (not (equal environment-name "verbatim")) " " "") "") "{" environment-name "}") (if extra-args (insert extra-args (if (and arg commentary) commentary ""))) (newline) (if (assoc environment-name (append LaTeX-standard-list-environments LaTeX-extra-list-environments)) (progn (if arg (progn (insert-char (SPACE) (+ LaTeX-current-indentation (if arg -2 0) LaTeX-begin-end-indentation LaTeX-item-indentation)) (insert "% \\item or item[label]"))))) (save-excursion (cond ((assoc environment-name (append LaTeX-standard-list-environments LaTeX-extra-list-environments)) (internal-LaTeX-repeat LaTeX-item-count '(LaTeX-item))) ((equal environment-name "thebibliography") (internal-LaTeX-repeat LaTeX-item-count ;generate \bibitem[]{} '(LaTeX-bibitem t)) ;instead of \bibitem{} (forward-line 1))) ;; NB: MUST use insert "\n" here and not newline, otherwise point ;; advances one during the save excursion. This seems to be an ;; GNU EMACS (version 18.49 or earlier) bug! ;; rms@prep.ai.mit.edu reports that it is no longer present at ;; 18.50, but doesn't recall fixing it. (insert "\n") (if (not (assoc environment-name (append LaTeX-standard-unindented-environments LaTeX-extra-unindented-environments))) (insert-char (SPACE) ;; [24-Apr-1999] Change to use just LaTeX-current-indentation ;; (+ LaTeX-current-indentation LaTeX-begin-end-indentation) LaTeX-current-indentation)) (insert "\\end" (if LaTeX-space-after-begin-end (if (not (equal environment-name "verbatim")) " " "") "") "{" environment-name "}") (if (assoc environment-name (append LaTeX-standard-comment-delimited-environments LaTeX-extra-comment-delimited-environments)) (insert-string "\n%"))) ;end save-excursion (if (not (null moveto)) ;position point (funcall (eval moveto))) (if (assoc environment-name (append LaTeX-standard-list-environments LaTeX-extra-list-environments)) (progn ;; Somehow I'm getting an extra blank line before the first ;; \\item, and I cannot see why, sigh... This is a hack to ;; remove it. (forward-line -1) (delete-blank-lines) (end-of-line))))) (defun LaTeX-bibitem (&optional arg) "Insert \\bibitem indented according to enclosing \\begin{} or \\bibitem level. Without an argument, generate the \\bibitem{} form. With an argument, generate \\bibitem[]{} instead. Fill prefix is updated to match the bibitem text indentation. Bound to \\\\[LaTeX-bibitem]." (interactive) (let (col) (save-excursion (re-search-backward "\\\\bibitem\\|\\\\begin *{") (goto-char (match-beginning 0)) (setq col (current-column)) (if (looking-at "\\\\begin") (if (looking-at "\\\\begin *{thebibliography}") ;if thebibliography, (setq col (+ col LaTeX-item-indentation)) ;then reset indentation (ding) ;else leave indentation alone and warn (message ;user of possible error "WARNING: You may not be inside thebibliography environment")))) (if (and (null arg) (null current-prefix-arg)) (progn (internal-LaTeX-item col "\\bibitem{} ") (search-backward "}")) (progn (internal-LaTeX-item col "\\bibitem[]{} ") (search-backward "]"))))) (defun LaTeX-bibtag-with-completion (bibtag) "Insert a BibTeX BIBTAG with completion (on \\\\[LaTeX-bibtag-with-completion]). The citation tag completion list is created from the bibliography data base files by update-LaTeX-bibtags." (interactive (list (completing-read "BibTeX citation tag: " LaTeX-bibtags nil nil nil))) (insert bibtag)) (defun LaTeX-brace-words (&optional word-count) "Insert { ... } around next ARG words (on \\\\[LaTeX-brace-words])." (interactive) (setq word-count (internal-LaTeX-default word-count 1)) (internal-LaTeX-wrap "{" "}" word-count)) (defun LaTeX-braces (&optional arg) "Insert pair of braces. With an argument, backslashed braces (literal braces) are generated. Bound to \\\\[LaTeX-braces]." (interactive) (if (and (null arg) (null current-prefix-arg)) (internal-LaTeX-delimiter-pair "{" "}" nil) (internal-LaTeX-delimiter-pair "\\{" "\\}" nil))) (defun LaTeX-brackets (&optional arg) "Insert pair of brackets. With an argument, backslashed brackets (displaymath mode) are generated. Bound to \\\\[LaTeX-brackets]." (interactive) (if (and (null arg) (null current-prefix-arg)) (internal-LaTeX-delimiter-pair "[" "]" nil) (internal-LaTeX-delimiter-pair "\\[" "\\]" nil))) (defun LaTeX-check-angle-balance (&optional allow-paragraph-breaks) "Starting at current point, check for unbalanced angle brackets, and angle bracket pairs separated by long strings. Backslashed angle brackets are ignored. With an argument, paragraph breaks are permitted between the matching angle brackets. Bound to \\\\[LaTeX-check-angle-balance]." (interactive) (internal-LaTeX-check-matching-character-balance ?\< ?\> "angle bracket" LaTeX-angle-interval allow-paragraph-breaks)) (defun LaTeX-check-brace-balance (&optional allow-paragraph-breaks) "Starting at current point, check for unbalanced braces, and brace pairs separated by long strings. Backslashed braces are ignored. With an argument, paragraph breaks are permitted between the matching braces. Bound to \\\\[LaTeX-check-brace-balance]." (interactive) (internal-LaTeX-check-matching-character-balance ?\{ ?\} "brace" LaTeX-brace-interval allow-paragraph-breaks)) (defun LaTeX-check-bracket-balance (&optional allow-paragraph-breaks) "Starting at current point, check for unbalanced brackets, and bracket pairs separated by long strings. Backslashed brackets are ignored. With an argument, paragraph breaks are permitted between the matching brackets. Bound to \\\\[LaTeX-check-bracket-balance]." (interactive) (internal-LaTeX-check-matching-character-balance ?\[ ?\] "bracket" LaTeX-bracket-interval allow-paragraph-breaks)) (defun LaTeX-check-dollar-balance () "Starting at current point, check for dollar pairs which are separated by long strings. Backslashed dollars are ignored. With an argument, paragraph breaks are permitted between the matching dollar signs. Bound to \\\\[LaTeX-check-dollar-balance]." (interactive) (let ((open-char-point nil) (start-point (point))) (while (re-search-forward "[^\\\\]\\$" nil t) (if open-char-point ;then we have closing dollar (progn (if (> (- (point) open-char-point) LaTeX-dollar-interval) (progn (push-mark open-char-point t) (error "More than %d chars in $...$ interval. Mark at opening $." LaTeX-dollar-interval)) (setq open-char-point nil))) (setq open-char-point (point)))) ;else we have opening dollar (if open-char-point ;then we are missing a closing one (progn (ding) (push-mark start-point t) (message "No closing dollar found for this one. Mark set at start of search")) (progn (message "[done] -- dollar balance check") (goto-char start-point))))) (defun LaTeX-check-parenthesis-balance (&optional allow-paragraph-breaks) "Starting at current point, check for unbalanced parentheses, and parenthesis pairs separated by long strings. Backslashed parentheses are ignored. With an argument, paragraph breaks are permitted between the matching parentheses. Bound to \\\\[LaTeX-check-parenthesis-balance]." (interactive) (internal-LaTeX-check-matching-character-balance ?\( ?\) "paren" LaTeX-parenthesis-interval allow-paragraph-breaks)) (defun LaTeX-cite (&optional arg) "Insert \\cite{ ... } at point. With an argument, generate \\cite[ ... ]{ ... } instead. Bound to \\\\[LaTeX-cite]." (interactive) (if (and (null arg) (null current-prefix-arg)) (internal-LaTeX-keyword "cite" " " " ") (internal-LaTeX-keyword "cite[]" " " " ") (backward-char 2))) (defun LaTeX-comma () "Insert a comma, and if the preceding characters are an italic correction at group end `\\/},', remove the italic correction. Bound to \\\\[LaTeX-comma]." (interactive) (if abbrev-mode (expand-abbrev)) (insert-string ",") (backward-char 1) (internal-LaTeX-maybe-remove-italic-correction) (forward-char 1)) (defun LaTeX-comment (&optional paragraph) "Comment out the current region or, with a prefix argument, paragraph. Point is left at the end of the region, or at the beginning of the next paragraph. M-x undo (on \\[undo]) will undo it. Bound to \\\\[LaTeX-comment]." (interactive "P") (let ((region (not paragraph))) (save-restriction (if region (progn (if (> (mark) (point)) ;ensure that (mark) <= (point) (exchange-point-and-mark)) (narrow-to-region (mark) (point))) (narrow-to-region (progn ;find first character of paragraph (backward-paragraph) (if (looking-at "\n") (forward-char)) (point)) (progn ;find last character of paragraph (forward-paragraph) (if (looking-at "\n") (backward-char)) (point)))) (goto-char (point-min)) (while (re-search-forward "^" (1- (point-max)) t) ;comment out lines (replace-match LaTeX-comment-prefix t t)) (goto-char (point-max))) ;end save-restriction (if (not region) ;position to start of next paragraph (progn (forward-paragraph) (backward-paragraph) (forward-char) (beginning-of-line))))) (defun LaTeX-counter (counter-name) "Insert COUNTER-NAME at point, using the standard values in LaTeX-standard-counters augmented by the values in the user-customizable LaTeX-extra-counter variable to offer name completion." (interactive (list (completing-read "Counter name: " (append LaTeX-standard-counters LaTeX-extra-counters) nil nil nil))) (insert counter-name)) (defun LaTeX-displaymath () "Insert \\begin{displaymath} ... \\end{displaymath}. This is required often enough that a key binding separate from that for LaTeX-begin-end-block is desirable. Bound to \\\\[LaTeX-displaymath]." (interactive) (LaTeX-begin-end-block "displaymath")) (defun LaTeX-dollar (&optional arg) "If the preceding character is a backslash, just put in a single dollar sign. Otherwise, insert a math mode environment. If point is in the middle of a line, or an argument is given, use a dollar pair or equivalent, according to the value of the variable LaTeX-math-option. If at beginning of line, insert a double dollar pair or equivalent, according to the value of the variable LaTeX-displaymath-option. Bound to \\\\[LaTeX-dollar]." (interactive) (setq arg (or arg current-prefix-arg)) (cond ((equal (preceding-char) ?\\) ;have backslash dollar (insert-string "$")) ((or arg (> (current-column) 0)) ;argument, or math mode in middle of line (cond ((equal LaTeX-math-option 2) ;then use \begin{math} ... \end{math} (newline) (LaTeX-begin-end-block "math")) ((equal LaTeX-math-option 1) ;then use \\( ... \\) (internal-LaTeX-delimiter-pair "\\(" "\\)" nil)) (t ;else use $ ... $ (internal-LaTeX-delimiter-pair "$" "$" nil)))) (t ;math mode at start of line (cond ((equal LaTeX-displaymath-option 2) (LaTeX-begin-end-block "displaymath")) ((equal LaTeX-displaymath-option 1) (internal-LaTeX-delimiter-pair "\\[\n" "\\]" t) (LaTeX-tab)) (t (internal-LaTeX-delimiter-pair "$$\n" "$$" t) (LaTeX-tab)))))) (defun LaTeX-dot () "Insert a dot (period, full stop), and then handle some special cases: [1] If the previous two characters are also dots, change all three of them to \\ldots{}. [2] If the previous characters are dotted abbreviations, like `e.g.' or `i.e.', which are defined as list elements of the variables LaTeX-standard-dotted-abbreviations and LaTeX-extra-dotted-abbreviations, supply a trailing string: if LaTeX-comma-after-dotted-abbreviation is nil, insert `\\ ' to mark a non-sentence-ending dot; otherwise insert a comma. Dotted abbreviations are recognized only if the character preceding them is not a letter. [3] If the previous characters are abbreviations defined as list elements of the variable LaTeX-standard-tied-abbreviations that should be tied to the following word with a single unbreakable space, insert a tilde to mark the tie. [4] If the preceding characters are an italic correction at group end `\\/}.', remove the italic correction. [5] If the dot is preceded by two or more upper-case letters, insert a sentence-ending `\\@' inserted before it. Bound to \\\\[LaTeX-dot]." (interactive) (if abbrev-mode (expand-abbrev)) (insert-char ?\. 1) (backward-char 1) (internal-LaTeX-maybe-remove-italic-correction) (forward-char 1) (let (old-case-fold-search case-fold-search) (setq case-fold-search nil) ;need exact case matching here (cond ;; . -> \@. ((string-match "[A-Z][A-Z]\\." (internal-LaTeX-preceding-buffer-substring 3)) (progn (backward-char 1) (insert "\\@") (forward-char 1))) ;; "..." -> "\ldots{}" ((string-equal "..." (internal-LaTeX-preceding-buffer-substring 3)) (progn (delete-char -3) (insert "\\ldots{}"))) ;; "i.e." -> "i.e.\ " or "i.e.," (for many such abbrevs) (t (catch 'EXIT (mapcar;; scan the list of dotted abbrevs (function (lambda (x) (let ((s (nth 0 x))) ; reduce ("i.e.") to "i.e." (if (and (not ; abbrev must not follow a letter (string-match "[A-Za-z]" (buffer-substring (max 1 (- (point) (length s) 1)) (max 1 (- (point) (length s)))))) (string-equal s ; does the abbrev match the buffer? (internal-LaTeX-preceding-buffer-substring (length s)))) (progn ; yes, so do the insertion, then (insert ; bail out, forgetting the ; rest of the abbrev list (if (assoc s (append LaTeX-standard-tied-abbreviations LaTeX-extra-tied-abbreviations)) "~" (if LaTeX-comma-after-dotted-abbreviation "," "\\ "))) (throw 'EXIT nil)))))) ;end if-let-lambda- function (append LaTeX-standard-dotted-abbreviations LaTeX-extra-dotted-abbreviations LaTeX-standard-tied-abbreviations LaTeX-extra-tied-abbreviations))))) ;end cond (setq case-fold-search old-case-fold-search))) ;restore old value (defun LaTeX-end () "\\Generate a \\end{...} to match a preceding \\begin{...}. This is handy if you didn't use LaTeX-begin-end-block (on \\[LaTeX-begin-end-block]) to generate a matched pair, but manually typed the \\begin{...} instead. Bound to \\[LaTeX-end]." (interactive) (let ((text (save-excursion (if (LaTeX-to-begin 1) (progn (beginning-of-line) (looking-at "\\( *\\)\\\\begin *{\\([^}\n]*\\)}") (let ((environment-name (buffer-substring (match-beginning 2) (match-end 2)))) (concat (buffer-substring (match-beginning 1) (match-end 1)) "\\end" (if LaTeX-space-after-begin-end (if (equal environment-name "verbatim") "" " ") "") "{" environment-name "}\n"))))))) (if text (progn (if (< 0 (current-column)) (insert "\n")) (insert text) (if (not (equal (preceding-char) (NEWLINE))) (newline))) (error "No preceding unmatched \\begin{...} found")))) (defun LaTeX-equation () "Insert \\begin{equation} ... \\end{equation}. This is required often enough that a key binding separate from that for LaTeX-begin-end-block is desirable. Bound to \\\\[LaTeX-equation]." (interactive) (LaTeX-begin-end-block "equation")) (defun LaTeX-font-bf (&optional word-count) "Insert {\\bf ... } around next ARG words (on \\\\[LaTeX-font-bf])." (interactive) (setq word-count (internal-LaTeX-default word-count 1)) (if LaTeX-2e (internal-LaTeX-wrap "\\textbf{" "}" word-count) (internal-LaTeX-wrap "{\\bf " "}" word-count))) (defun LaTeX-font-em (&optional word-count) "Insert {\\em ... \\/} around next ARG words (on \\\\[LaTeX-font-em])." (interactive) (setq word-count (internal-LaTeX-default word-count 1)) (if LaTeX-2e (internal-LaTeX-wrap "\\emph{" "}" word-count) (internal-LaTeX-wrap "{\\em " "\\/}" word-count) (internal-LaTeX-maybe-remove-italic-correction))) (defun LaTeX-font-it (&optional word-count) "Insert {\\it ... \\/} around next ARG words (on \\\\[LaTeX-font-it])." (interactive) (setq word-count (internal-LaTeX-default word-count 1)) (if LaTeX-2e (internal-LaTeX-wrap "\\textit{" "}" word-count) (internal-LaTeX-wrap "{\\it " "\\/}" word-count) (internal-LaTeX-maybe-remove-italic-correction))) (defun LaTeX-font-rm (&optional word-count) "Insert {\\rm ... } around next ARG words (on \\\\[LaTeX-font-rm])." (interactive) (setq word-count (internal-LaTeX-default word-count 1)) (if LaTeX-2e (internal-LaTeX-wrap "\\textrm{" "}" word-count) (internal-LaTeX-wrap "{\\rm " "}" word-count))) (defun LaTeX-font-sc (&optional word-count) "Insert {\\sc ... } around next ARG words (on \\\\[LaTeX-font-sc])." (interactive) (setq word-count (internal-LaTeX-default word-count 1)) (if LaTeX-2e (internal-LaTeX-wrap "\\textsc{" "}" word-count) (internal-LaTeX-wrap "{\\sc " "}" word-count))) (defun LaTeX-font-sf (&optional word-count) "Insert {\\sf ... } around next ARG words (on \\\\[LaTeX-font-sf])." (interactive) (setq word-count (internal-LaTeX-default word-count 1)) (if LaTeX-2e (internal-LaTeX-wrap "\\textsf{" "}" word-count) (internal-LaTeX-wrap "{\\sf " "}" word-count))) (defun LaTeX-font-sl (&optional word-count) "Insert {\\sl ... } around next ARG words (on \\\\[LaTeX-font-sl])." (interactive) (setq word-count (internal-LaTeX-default word-count 1)) (if LaTeX-2e (internal-LaTeX-wrap "\\textsl{" "}" word-count) (internal-LaTeX-wrap "{\\sl " "\\/}" word-count) (internal-LaTeX-maybe-remove-italic-correction))) (defun LaTeX-font-tt (&optional word-count) "Insert {\\tt ... } around next ARG words (on \\\\[LaTeX-font-tt])." (interactive) (setq word-count (internal-LaTeX-default word-count 1)) (if LaTeX-2e (internal-LaTeX-wrap "\\texttt{" "}" word-count) (internal-LaTeX-wrap "{\\tt " "}" word-count))) (defun LaTeX-footnote () "Insert \\footnote{ ... } at point (on \\\\[LaTeX-footnote]). If LaTeX-footnote-start-with-newline is non-nil, start the footnote on a newline. If LaTeX-footnote-end-with-newline is non-nil, end the footnote on a newline." (interactive) (internal-LaTeX-keyword "footnote" (if (and (> (current-column) 0) LaTeX-footnote-start-with-newline) "%\n" nil) " ") (save-excursion (search-forward "}") (if (and (not (looking-at "\n")) LaTeX-footnote-end-with-newline) (newline)))) (defun LaTeX-gripe () "Send mail to maintainer of LaTeX-mode with comments, gripes, and bug reports. Bound to \\\\[LaTeX-gripe]." (interactive) (mail-other-window) (goto-char (point-min)) ;[07-Aug-1991] suggested by ;Olaf Heimburger (beginning-of-line) (if (not (looking-at "^To: $")) (progn (goto-char (point-min)) (error "Trash in *mail* buffer--please clear it and try again")) (progn (end-of-line) (insert "beebe@math.utah.edu" ", " (or (and (boundp 'user-mail-address) user-mail-address) (concat (user-login-name) "@" (or (and (boundp 'mail-host-address) mail-host-address) (system-name))))) (end-of-line 2) (insert "LaTeX-mode gripe report {" LaTeX-mode-version "}") (goto-char (point-max))))) (defun LaTeX-index (&optional phrase) "Insert \\index{ ... } at point (on \\\\[LaTeX-index]). If a prefix argument is given, the string is prompted for, and inserted both as text and as an index entry, e.g. gnats and gnus\\index{gnats and gnus}. All horizontal space preceding \\index is removed to prevent an intervening page break causing an off-by-one page number error. If LaTeX-index-start-with-newline is non-nil, insert a percent to start a comment, then put \\index at the start of a following new line. If LaTeX-index-end-with-newline is non-nil, follow the entry with a new line." (interactive) (if (null current-prefix-arg) (internal-LaTeX-keyword "index" (if (and (> (current-column) 0) LaTeX-index-start-with-newline) "%\n" nil) " ") (progn (setq phrase (read-string "Phrase to index and insert: ")) (if (not (or (equal (buffer-substring (1- (point)) (point)) " ") (equal (buffer-substring (1- (point)) (point)) "\n"))) (insert " ")) (insert phrase) (internal-LaTeX-keyword "index" (if (and (> (current-column) 0) LaTeX-index-start-with-newline) "%\n" nil) " ") (insert phrase) (if (looking-at "\n") (delete-char 1)) ;kill any newline after phrase (search-forward "}") (if LaTeX-index-end-with-newline (newline) (insert " "))))) (defun LaTeX-item (&optional arg) "Insert \\item indented according to enclosing \\begin{} or \\item level (on \\\\[LaTeX-item). With an argument, insert \\item[] instead. The fill prefix is updated to match the item text indentation." (interactive) (let (col env) (save-excursion (if (LaTeX-to-begin 1) (progn (setq col (+ (current-column) LaTeX-item-indentation)) (setq env (buffer-substring (point) (progn (end-of-line) (point))))))) (if col (if (and (null arg) (null current-prefix-arg)) (internal-LaTeX-item col "\\item ") (internal-LaTeX-item col "\\item[] ") (backward-char 2)) (error "Not inside a \\begin{...}")))) (defun LaTeX-label () "Insert \\label{ ... } at point (on \\\\[LaTeX-label]). If LaTeX-label-start-with-newline is non-nil, insert a percent to start a comment, then put \\label at the start of a following new line." (interactive) (internal-LaTeX-keyword "label" (if (and (> (current-column) 0) LaTeX-label-start-with-newline) "%\n" nil) " ") (search-forward "}") (if LaTeX-label-end-with-newline (newline) (insert " ")) (search-backward "{") (forward-char 1)) (defun LaTeX-macro (&optional macro-name insert-comment) "Insert a LaTeX macro together with argument braces and brackets (on \\\\[LaTeX-macro]). With an argument, a short comment about the arguments is also inserted. Without an argument, the comment is displayed in the echo area instead." (interactive (list (completing-read "Macro name: " (append LaTeX-standard-macros (if LaTeX-2e LaTeX-2e-standard-macros) LaTeX-extra-macros) nil t nil))) (let ((the-font) (the-macro)) (setq the-font (assoc macro-name (append (if LaTeX-2e LaTeX-2e-standard-fonts LaTeX-standard-fonts) LaTeX-extra-fonts))) (setq the-macro (assoc macro-name (append LaTeX-standard-macros (if LaTeX-2e LaTeX-2e-standard-macros) LaTeX-extra-macros))) (if the-font (insert "{")) (insert "\\" (nth 0 the-macro)) (if (nth 1 the-macro) (progn ;then we have arguments to insert (save-excursion (insert (nth 1 the-macro)) (if (or (not (null current-prefix-arg)) (not (null insert-comment))) (insert " % " (nth 2 the-macro) "\n") (message (nth 2 the-macro)) (if LaTeX-newline-after-closing-delimiter (newline)))) ;end save-excursion (forward-char 1) ;always start insertion after first brace, (if LaTeX-newline-after-opening-delimiter (progn (newline) ;bracket, or paren, but leave space to enter text (backward-char 1)))) (progn ;else no arguments (if (or (not (null current-prefix-arg)) (not (null insert-comment))) (insert " % " (nth 2 the-macro)) (message (nth 2 the-macro))) (if the-font (progn (if LaTeX-newline-after-opening-delimiter (newline)) (if (assoc macro-name (append (if LaTeX-2e LaTeX-2e-standard-italic-fonts LaTeX-standard-italic-fonts) LaTeX-extra-italic-fonts)) (if (not LaTeX-2e) (insert "\\/"))) (insert "}") (if LaTeX-newline-after-opening-delimiter (search-backward "\n") (progn (re-search-backward "[a-zA-Z]") (forward-char 1))) (insert " "))))) (if (string-equal macro-name "item") (save-excursion (if (LaTeX-to-begin 1) (message (format " Inside %s" (buffer-substring (point) (progn (end-of-line) (point)))))))))) (defun LaTeX-2.09-mode () "Call LaTeX-mode and then set for old-style LaTeX 2.09 editing." (interactive) (LaTeX-mode) (setq LaTeX-2e nil) (internal-LaTeX-set-mode-name)) (defun LaTeX-2e-mode () "Call LaTeX-mode and then set for new-style LaTeX 2e editing." (interactive) (LaTeX-mode) (setq LaTeX-2e t) (internal-LaTeX-set-mode-name)) (defun LaTeX-mode () "Major editing mode for LaTeX and SLiTeX. \\ To create a new LaTeX document, use make-LaTeX-document (on \\[make-LaTeX-document]), or make-SLiTeX-document (on \\[make-SLiTeX-document]). With an argument, they will provide some additional helpful comments. The functions will prompt for document style and options. Type ? to see the standard ones; you can enter them with name completion. You can also enter your own, since it is possible to have private styles and options unknown to make-LaTeX-document or make-SLiTeX-document. If a document header already exists, this function will automatically set for editing in either LaTeX 2.09 or 2e style. If you wish, you can set the mode explicitly with M-x LaTeX-2e-mode or M-x LaTeX-2.09-mode. You may find it useful to bind these functions to file extensions in the auto-mode-alist in your $HOME/.emacs file. The most frequent LaTeX construct is the \\begin{}...\\end{} grouping; you can generate it by LaTeX-begin-end-block (on \\[LaTeX-begin-end-block]). With an argument, a helpful comment may be printed. Type ? to see the standard environments, or enter your own. If you type a \\begin{...} manually, you can later generate a matching \\end{...} with the function LaTeX-end (on \\[LaTeX-end]). Other common constructs are the insertion of labels, citations, cross-references, index entries, verbatim strings, and additional items in a list. The functions \\[LaTeX-add-word-to-index] LaTeX-add-word-to-index \\[LaTeX-bibitem] LaTeX-bibitem \\[LaTeX-cite] LaTeX-cite \\[LaTeX-counter] LaTeX-counter \\[LaTeX-footnote] LaTeX-footnote \\[LaTeX-index] LaTeX-index \\[LaTeX-item] LaTeX-item \\[LaTeX-label] LaTeX-label \\[LaTeX-macro] LaTeX-macro \\[LaTeX-pageref-with-completion] LaTeX-pageref-with-completion \\[LaTeX-protect] LaTeX-protect \\[LaTeX-ref-with-completion] LaTeX-ref-with-completion \\[LaTeX-verb] LaTeX-verb \\[make-LaTeX-document] make-LaTeX-document \\[make-SLiTeX-document] make-SLiTeX-document provide for these. LaTeX-tab (on \\[LaTeX-tab]) will indent a line to the current \\begin{}...\\end{} nesting level. Most major LaTeX macros can be entered by LaTeX-macro (on \\[LaTeX-macro]). This will supply the correct set of following braces, brackets, and parentheses, and with an argument, will insert a short comment about the expected command arguments. For SLiTeX, the function renumber-slides can be used to put a numbered comment on each slide environment for handy reference in the \\onlynotes{...} and \\onlyslides{...} commands. You can move over \\begin{} ... \\end{} groups with LaTeX-to-begin (on \\[LaTeX-to-begin]) and LaTeX-to-end (on \\[LaTeX-to-end]). Insertion of paired angle brackets, braces, square brackets, and parentheses is provided by \\[LaTeX-angl