This is edition 0.50, December 1998, of the Ultra-TeX Mode manual.  Copyright © 1996, 1997, 1998 John H. Palmieri

Ultra-TeX Mode
**************

Ultra-TeX Mode was written in Emacs lisp by Mark Haiman and Nick Reingold, with modifications by John Palmieri.

This is version 0.50, December 1998, of the Ultra-TeX Mode manual.  Bug reports and suggestions for new features should go to palmieri@member.ams.org.

This is a revised version of this manual; it is done (except for the indices).

Overview
********

Ultra-TeX mode is a major mode for editing TeX documents.  It features dynamic completion (see Completion) of TeX commands, and a number of other handy things.

Features
********

Completion
==========

One of the key features of Ultra-TeX mode is that it uses lightning completion to complete TeX commands.  When you enter Ultra-TeX mode (say, if you have followed the installation instructions (see Installation) so that you enter Ultra-TeX whenever you open a TeX file), Emacs constructs a list of TeX commands.  Then when you hit \, Emacs does lightning completion on the elements of this list.

I'll describe what lightning completion is, and I'll explain how Emacs constructs this list of commands.

Lightning completion
====================

Here is an example of lightning completion: suppose that the list of commands that Emacs knows about only contains the following:

     \xrightarrow{},   \xleftarrow{},   \Rightarrow

If I hit \, then \ is inserted into the buffer, and lightning completion starts.  If I then hit R, then after a delay (of length governed by the variable ultex-complete-idle-time) Rightarrow is inserted and completion ends (this all happens because there is only one valid completion starting \R).  If I hit x instead of R, then x gets inserted.  Then I can either hit r or l, resulting, after a delay, in either \xrightarrow{} or \xleftarrow{}.

(The aforementioned delay is new in version 0.50 of this package.  By default, it is equal to lc-complete-idle-time-default, a variable documented in the Lightning Completion Manual (see Lightning completion (Lightning Completion Manual)).  To get the old behavior of immediate completion, set the variable ultex-complete-idle-time to 0.)

Using the same example, if I start by hitting \, if I hit any printing character other than x or R, then after a delay, Emacs beeps because there is no valid completion starting with that character, and (depending on the value of the variable lc-clean-up) either that character is inserted or nothing is inserted.  I can always stop lightning completion prematurely by hitting C-c; this is one way to insert TeX commands that Ultra-TeX doesn't know about.

There is more to lightning completion. See Lightning completion (Lightning Completion Manual), for a full description.

Making a list
=============

As I said earlier, when Emacs enters Ultra-TeX mode, it constructs a list of TeX commands, and it uses this list for its completion table. The list is built from two pieces: first of all, the user should have a textree file, containing the TeX commands she typically uses.

Remarks:

 1. A sample textree file, textree.el, is included in the Ultra-TeX package.

 2. The path name of this file is stored in the variable ultex-tree-file.  See Installation, for how to set this, if you're not sure.

 3. If you're in Ultra-TeX mode, you can run the command ultex-new-cs to specify a new command sequence to be entered into the textree file.  See Defining new commands, for more information on this.  (Alternatively, the textree file is an Emacs lisp file, so you can edit it directly if you're comfortable with Emacs lisp.)

 4. If you're in Ultra-TeX mode, you can run the command ultex-delete-csname-from-tree-file to specify a command sequence to be deleted from the textree file.  See Defining new commands, for more information on this, too.

Now, Emacs scans the current buffer (the one which is using Ultra-TeX mode), looking for commands of the forms

     \documentclass{bozo}
     \documentstyle{bozo}
     \usepackage{bozo}

When it finds any such lines, it examines the list ultex-extra-tree-files to see if there is an associated file of commands for that class, style, or package, and if there is, if the main file textree.el should also be loaded.  It loads each one of these files, along with the main one if appropriate.

Remarks:

 1. See Installation, to see how to set the variable ultex-extra-tree-files.

 2. If the current buffer has more than one command file associated to it, if you run ultex-new-cs to add a new command, Emacs will ask which file to add it to.  Similarly, if you run ultex-delete-csname-from-tree-file to delete a command, if that command appears in more than one file, Emacs will ask you which one to delete it from.

 3. The variable ultex-also-load may contain the name of a command file to load in addition to any others which have been specified.  This is intended for use as a local variable; in other words, to use it, you should have lines like this at the end of your TeX document:

          %% Local variables:
          %% ultex-also-load: "~/emacs/other-ultex-commands.el"
          %% End:

After this has been done, Emacs scans the current buffer, looking for more commands.  It finds commands in the following ways:

  * If the buffer contains a TeX command of the form

          \newcommand{\bozo}[3]{blah blah blah}

     (or \renewcommand... or \providecommand...) then Emacs adds the string \bozo{}{}{} to its list of TeX commands (there are three sets of brackets because the 3 in the square brackets tells LaTeX that \bozo takes 3 arguments.  If you then use lightning completion to insert \bozo{}{}{} in the buffer, the point is placed inside the first set of brackets.  Hitting the RET key moves you to the next set of brackets (see Smart return key).

  * If the buffer contains a TeX command of the form

          \DeclareMathOperator{\clown}{Clown}

     then Emacs adds \clown to its list.

  * If the buffer contains a TeX command of the form

          \newenvironment{circus}

     (or \renewenvironment{circus}) then Emacs adds

          \begin{circus}

          \end{circus}

     to the list; when Ultra-TeX inserts this in your buffer, it puts the point on the blank line.

  * If the buffer contains a TeX command of the form

          \newtheorem{dumb-lemma}[thm]{Lemma}

     then Emacs adds

          \begin{dumb-lemma}\label{}

          \end{dumb-lemma}

     and it puts the point inside the argument for \label.  If you don't want a label, just hit the RET key (see Smart return key).

  * If the buffer contains a string of the form

          \label{ling-ling}

     then Emacs adds \ref{ling-ling}, \pageref{ling-ling}, and \eqref{ling-ling} to its list.

The above scanning is done by the function ultex-grab-defs.  The following is done by ultex-grab-bibs.

  * Emacs scans the bibliography for bibliographical keys: if the buffer contains \begin{thebibliography} and \end{thebibliography} commands, Emacs looks between them for commands of the form

          \bibitem{bib-key}  Bozo the Clown, \emph{How to write bad emacs
          lisp code}, ...

     When it finds such a command, it adds \cite{bib-key} and \nocite{bib-key} to the list.  If your buffer is associated to a file, file.tex, then Emacs does exactly the same scanning on the file file.bbl.  Lastly, if the buffer contains a command

          \bibliography{bib-data-base}

     then Emacs looks for a file bib-data-base.bib; if it finds it, it adds \cite and \nocite for all of the keys in it.

Emacs does all of this scanning recursively:

  * Whenever Emacs finds commands like

          \input{bozo}
          \include{bobo}

     at the start of a line, then Emacs scans the files bozo.tex and bobo.tex for their commands and labels.  If these commands are not at the start of the line (they have spaces or tabs in front of them, say), then the files are not scanned.

  * Whenever Emacs finds a line like this at the start of the file:

          %% -*- TeX-master: "main.tex"; -*-

     or lines like this at the end of the file:

          %% Local variables:
          %% TeX-master: "main.tex"
          %% End:

     then Emacs scans the file main.tex for its commands and labels (and any files included or input into them, too).

A few remarks:

 1. Emacs learns these command only temporarily---Emacs forgets them between editing sessions (which seems appropriate---I don't want commands I've defined specifically in one TeX document to be valid completions every time I edit any TeX document).

 2. The way things are currently set up, each buffer maintains its own list of TeX commands.  This behavior is controlled by the variable ultex-alist-local-flag.  If you want to change this---if you want Ultra-TeX to complete on commands defined in document A when you're editing document B---then customize the variable ultex-alist-local-flag (in the customization group "ultra-tex-commands".

 3. Hitting C-c C-r runs the command ultex-reset-current-alist, which resets the list to its default (the contents of the appropriate textree files) in the current buffer, or in all TeX buffers if ultex-alist-local-flag is off.

 4. The method of scanning for new commands is oriented towards LaTeX, rather than plain TeX.  Sorry about that.

 5. To avoid the recursive grabbing of commands from input or include files, just have a leading space or tab before the command: Emacs only does the recursive grabbing if the line begins with \input or \include.

Defining new commands
=====================

If you want to add a command to your textree file (hence permanently adding the command to the list of TeX commands on which Ultra-TeX completes), you should run the command ultex-new-cs.  In Ultra-TeX mode, this is bound to the key sequence C-c C-n.

When you do this, a new buffer, *TeX Completions Edit*, is opened in another window, and a backslash is inserted (just to get you started).  You type in your new command, including all the brackets and braces you want, put the cursor where you want the point to be when this string is inserted in your TeX document, and then hit M-C-c to exit.  You will be asked if you want to use this command in math mode exclusively; if you say yes, you will get an error message if you try to use it outside of a math environment (but the command will still be inserted).  If the current buffer is using more than one file of TeX commands, you will be asked in which file to store the command.

For example, if I wanted to add the command \sqrt[]{} to my textree file, I would hit C-c C-n to run ultex-new-cs, then type sqrt[]{} in the new buffer (remember, the backslash is already there).  Then I would put the cursor inside the brackets, and hit M-C-c.

This will add the line

     ("\\sqrt[]{}" -3 . ultex-math-mode)

to the appropriate textree file.  The first entry here is the command, the second entry is the number of characters the point is offset from the end of the string, and the last entry says that this command should only be used in a math environment.

If your textree file has some commands you don't want, you can run the command ultex-delete-csname-from-tree-file.  This prompts you for a command and then deletes it from the textree file.  If the command is in more than one of the textree files associated to this buffer, you are asked to specify the file, also.

You can also edit the command files by hand.  If you have want to get rid of the command \sqrt[]{}, open the textree file, and look for a line like

     ("\\sqrt[]{}" -3 . ultex-math-mode)

Once you have found it, delete it and save the file.  (In case you're not familiar with emacs lisp and you want to do this: just be careful to delete a region starting with a left parenthesis and ending with its matching right parenthesis.  Of course, if you're nervous about it, make a backup of your textree file, and then play around.)

If you want to disable a TeX command for this editing session (in this buffer only, if you have made ultex-current-alist local), call the function ultex-delete-csname, bound to the key sequence C-c C-d.  You are prompted for a TeX command you don't want, and the one you select is removed, temporarily, from the master list.

Dollar signs
============

When TeX sees text between two dollar signs (like $x=y$), it processes that text in math mode.  There are a number of other ways of typesetting mathematics, such as the equation environment and the eqnarray environment.  In Ultra-TeX mode, you can get at all of these things using the $ key.

Here is what $ does:

  * If you hit $ once, Emacs inserts a pair of dollar signs and places the point between them.

  * If you hit $ again, Emacs inserts

          \[

          \]

     and puts the point on the blank line.

  * If you hit $ again, Emacs inserts

          \begin{equation}\label{}

          \end{equation}

     and puts the point in the argument of \label.

  * Next comes

          \begin{equation*}

          \end{equation*}

     with the point on the blank line, then

          \begin{equation}\label{}\n\n\end{equation}

     then

          \begin{equation*}\n\n\end{equation*}

     then

          \begin{align}\label{}

          \end{align}

     then

          \begin{align*}

          \end{align*}

     then

          \begin{gather}\label{}

          \end{gather}

     then

          \begin{gather*}

          \end{gather*}

     then

          \begin{multline}\label{}

          \end{multline}

     then

          \begin{multline*}

          \end{multline*}

  * If you hit $ again, you go back to

          \[

          \]

     and (aside from the fact that you've skipped the first option---a pair of dollar signs) the whole thing starts over again.  If you would rather start over again with $$ instead, then set the variable ultex-dollar-back to 0.

This works even if the math environment is not empty.  For example, if you have

     \begin{equation}\label{wiles}
     x^{n} + y^{n} = z^{n}
     \end{equation}

and you hit $, then you get

     \begin{equation*}
     x^{n} + y^{n} = z^{n}
     \end{equation*}

Hitting $ again gives

     \begin{align}\label{wiles}
     x^{n} + y^{n} = z^{n}
     \end{align}

If you ever just want a single dollar sign, you can either type C-q $, or hit $ and then delete one of the two dollar signs that were just inserted (using C-d or DEL, for instance).

You can change the strings that get inserted by customizing the variable ultex-dollar-array (customization group "ultra-tex-environments").

Smart return key
================

The RET key in Ultra-TeX mode tries to move the point forward by the ``appropriate amount.''

  * If you are editing ordinary text, hitting RET moves the point past the next word.

  * If the point is to the left of a brace {, hitting RET moves the point to the right of the brace.

  * Suppose the point is inside a pair of braces.  If the braces contain several words, hitting RET moves forward a word.  If the braces only contain one word, or if the point is in the last word enclosed by the braces, hitting RET moves you to just outside the braces.

  * There is similar behavior with brackets [] instead of braces, with one exception: since brackets are used for optional arguments to TeX commands, if the point is inside an empty pair of brackets, hitting RET will delete the pair.  This way, you can use lightning completion to insert a command with lots of optional arguments, and you only have to hit RET to get rid of the ones you don't want.  (For example, you don't need separate entries in your textree file for \sqrt[]{} and for \sqrt{}.)

  * Similarly, if the text looks like \label{}, and the point is inside the braces, hitting RET will delete the string \label{}.

  * Since Ultra-TeX completes on bibliographical keys, it assumes you ordinarily don't want to add anything to the argument of \cite. So if the text looks like \cite[bozo]{clown}, if the point is anywhere inside the brackets, hitting RET moves the point past {clown}.  If the brackets had been empty, hitting RET would have deleted them, and then moved the point past {clown}.  If the braces had been empty, then hitting RET would have put the point inside them, ready to type in the argument to \cite.

To insert a newline, use M-RET.  LFD ends a paragraph when that makes sense, and checks the paragraph to see if parentheses, etc., are properly matched.

Fonts
=====

In a typical TeX document, one might use a number of different type faces---bold-face, italics, small caps, whatever.  Ultra-TeX provides an easy way to insert the command to change type faces.

Here is a typical example: hitting M-E inserts the string \emph{}, and puts the point inside the braces.  (Note: that key sequence is META-SFT-e, not META-e).  The META key, in combination with various other capital letters, produces similar effects:

  * M-A inserts \mathcal{}; it also beeps if you're not in a math environment.

  * M-B inserts \textbf{} or \mathbf{}, depending on the context.

  * M-C inserts \textsc{} or \mathsc{}.

  * M-E inserts \emph{}.

  * M-F inserts \textsf{} or \mathsf{}.

  * M-I inserts \textit{} or \mathit{}.

  * M-M inserts \mit{}.

  * M-R inserts \textrm{} or \mathrm{}.

  * M-S inserts \textsl{} or \mathsl{}.

  * M-T inserts \texttt{} or \mathtt{}.

  * M-U inserts \textup{}.

  * M-X inserts \text{}; it beeps if you're not in a math environment.

  * M-Z inserts \zz{} (intended to be a user-defined font).

These keys all call the function ultex-font, with an appropriate argument.  This wasn't written with customization in mind, but if you want to modify things, you can try adding lines like this to your .emacs file (see .ultex file):

     (define-key ultra-tex-mode-map "\C-[D"
       '(lambda nil (interactive) (ultex-font "bozo")))

and see what happens when you hit M-D, both in and out of a math environment.  If things don't work the way you want, you may have to modify the definition of the function ultex-font.

Greek keyboards
===============

The user's textree file (see Making a list) stores a lot of her favorite TeX commands, and hitting the $ key (see Dollar signs) produces some other useful commands.  There is a third way to insert TeX commands---via a Greek keyboard.

If you hit the left quote key ` followed by a, then \alpha is inserted into the buffer (and you get an error if you're not in a math environment).  Similarly, `b gives you \beta, etc.

Furthermore, while hitting `g gives \gamma, hitting `G gives \Gamma.  Once you hit the ` key, you can access the (ordinary) Greek keyboard, the Shift Greek keyboard, the Control Greek keyboard, the Meta, the Meta Shift, and the Meta Control Greek keyboards.  This gives you a lot of slots for storing TeX commands.

In order to see what symbols are stored in these slots, you can use the \ key: hitting `\ opens up a little window which displays a chart with the typewriter keys and their effect in the Greek keyboard---it might look something like this:

     times amalg oplus otime odot  wedge vee sqcup cap  cup  uplus pm  circ
       1     2     3     4     5     6    7    8    9    0     -    =   `
        theta infty varep rho  tau  upsil xi   iota  omega pi  subse supse
          q     w     e    r    t     y    u     i     o    p    [     ]
         alpha sigma delta varph gamma eta  exist kappa lambd int   in
           a     s     d     f     g     h    j     k     l     ;     '
           zeta  chi   psi   foral beta  nu   mu    sum   prod  not
             z     x     c     v     b    n    m     ,      .    /

(Unfortunately, it only has room to display the first five characters of the TeX command.)  In this example, hitting `, would produce \sum, hitting `6 would produce \wedge, hitting `e would produce \varepsilon.

Similarly, hitting `| gives you the Shift Greek keyboard, `C-\ gives the Control Greek keyboard, etc.

The bindings for the Greek keyboards are stored in a greek-keys file.

Remarks:

 1. A sample greek-keys file, greek.el, is included in the Ultra-TeX package.

 2. The path name of this file is stored in the variable ultex-greek-keys-file.  See Installation, for how to set this, if you're not sure.

 3. If you're in Ultra-TeX mode, you can run the command ultex-redefine-greek-key to change one of the Greek key bindings (just follow the directions).  (Alternatively, the greek-keys file is an Emacs lisp file, so you can edit it directly if you're comfortable with Emacs lisp.)  Note: you will get an error if you use any Greek key if you're not in a math environment, so you probably only want to bind math symbols to Greek keys.  (The appropriate string will be inserted in any case, though.)

Everything else
===============

There are a number of other features.  I'll probably forget one or two, but here are most of them:

  * Hitting C-c C-s inserts a template for a LaTeX document.  This template is stored in a file; its pathname is given by ultex-latex-skel-file.  A sample file is included in the package: skeleton.tex.  (Also, once the template is inserted, Emacs runs ultex-skel-hook.)

  * Hitting { makes a brace pair and puts the point inside.  If you want similar behavior for [ and (, then customize the variables ultex-match-brackets and ultex-match-parens. On the other hand, if you don't want this behavior for {, then customize ultex-match-braces.

  * Hitting the double-quote key " makes either two left single quotes `` or two right single quotes '', whichever Emacs thinks is appropriate.

  * Hitting ... inserts \dots.  (It used to insert \cdots or \ldots, depending on what it thought was appropriate, but I believe that the recent versions of LaTeX will position \dots according to the context.)

  * Hitting ^ produces ^{}, with the point inside the braces. Hitting _ produces _{}, with the point inside the braces.

  * Hitting TAB in an array environment moves the point forward a few spaces, and inserts &.  (Emacs determines when to do this by using the variable ultex-array-environs, which is a list consisting of environments that use & for ``tab stops''.  Change this variable to change the behavior of TAB.)

  * Hitting \\ will ordinarily insert \\ and a newline.  If you are in an appropriate environment (like itemize or enumerate), then \\ will not be inserted; instead, a newline and \item will be inserted.  (Emacs does this via the variable itemizing-environments, which a list consisting of environments that use \item.)

Installation
************

Basic installation
==================

Once you have the package in front of you, you should look at the file INSTALLATION.  That tells you how to byte-compile the Emacs lisp code and how to produce the documentation in various formats.  It also has basic instructions for how to modify your .emacs file.  Here are more details about .emacs:

  * Make sure the directory ultratex-0.50/lisp is in your load path. It might be good to make a symbolic link from ultratex-0.50 to ultratex and then put ultratex/lisp in your load-path, so that if this package ever gets upgraded to ultratex-0.51 and you choose to install it, you only have to change the symbolic link, not your .emacs file.  For example, I have the following line in my .emacs file.

          (setq load-path (cons "/home/palmieri/emacs/ultratex/lisp"
                                load-path))

  * Put the files textree.el, greek.el, and skeleton.tex someplace.  They start in the directory ultratex/user, but if you change them from their defaults, you might want to move them elsewhere so they don't get overwritten when you install a new version of the Ultra-TeX package.

  * Put the following line in your .emacs file:

          (require 'ultex-setup)

Now the next time you start Emacs, whenever you find a TeX file, you will automatically be put into Ultra-TeX mode.

.ultex file
===========

When Ultra-TeX starts up, it loads the file .ultex.  This was useful in versions of Ultra-TeX before 0.50, when one would set many options by hand and then wanted to avoid cluttering up the .emacs file with various Ultra-TeX settings.  This is not so useful in version 0.50 (or later) of the Ultra-TeX package, since all of the features can be customized, and the customizations get stored in .emacs automatically.

The name of the .ultex file is given by the variable ultex-init-file, so if you'd rather give this file a different name, like .ultra-tex-stuff.el, then customize this variable accordingly.

Customization variables
=======================

Many of the features of Ultra-TeX mode are customizable.  The best way to change this is with the customization feature of Emacs: run

     M-x customize-group GRP

where GRP is one of the Ultra-TeX customization groups, to each of which we devote a subsection.

ultra-tex
---------

To change these:

     M-x customize-group ultra-tex

All of the other Ultra-TeX mode groups can be accessed from this one, also.

ultex-complete-idle-time
     Default value: 0.5.  Effect: After this much idle time has elapsed, try to complete.  Measured in seconds. See Lightning completion.

ultra-tex-mode-hook
     Default value: nil.  Description: Hook for Ultra-TeX mode.  This is a list of commands, each of which is executed whenever Ultra-TeX mode starts.

ultra-tex-init
--------------

To change these:

     M-x customize-group ultra-tex-init

ultex-init-file
     Default value: ~/.ultex.  Description: The Ultra-TeX Emacs lisp startup file.  If you are setting Ultra-TeX options with customize, this file may be superfluous.  If a file with the .el or .elc suffix exists, it will be read instead. See .ultex file.

ultex-use-color
     Default value: nil.  Effect: Toggle use of color in Ultra-TeX mode. This is pretty, but it can add a noticeable delay when starting Ultra-TeX mode.

ultex-use-font-latex
     Default value: nil.  Effect: Toggle use of the font-latex package for colorization.  This variable is only relevant if ultex-use-color is on.  One version of the file font-latex.el is distributed with Ultra-TeX.  The most recent version is available from ftp://ftp.phys.ocean.dal.ca/users/rhogee/elisp/font-latex.el

ultex-use-auctex
     Default value: nil.  Effect: Toggle use of files from AUC-TeX distribution.  This has one main effect: several commands are added to Ultra-TeX to allow one to typeset the current TeX document, spawn an external viewer, jump to the next error, etc.

     This option requires the use of the file tex-buf.el from the AUC-TeX distribution.  This file is included with Ultra-TeX, but if you want the most up-to-date version, the AUC-TeX package is available from http://sunsite.auc.dk/auctex/. See ultra-tex-auctex, for options related to this one.

ultex-use-imenu
     Default value: nil.  Effect: Toggle use of imenu package in Ultra-TeX mode.  The imenu package lets you pop up a menu giving an outline of the buffer, so that you can move around to various section headings and theorem statements and so forth.  If this option is on, then S-mouse-3 (hold down the shift key, and hit (and release) the right mouse button) runs the command imenu, which pops up the aforementioned menu.

ultex-use-bib-cite
     Default value: nil.  Effect: Toggle use of bib-cite package in Ultra-TeX mode.  The bib-cite package does stuff with your labels and citations -- highlights them, lets you jump to them, etc. This option is not well-tested, and may yield unpredictable results. The latest version of bib-cite is available from ftp://ftp.phys.ocean.dal.ca/users/rhogee/elisp/bib-cite.el.

ultra-tex-files
---------------

To change these:

     M-x customize-group ultra-tex-files

ultex-tree-file
     Default value: The file user/textree.el in the Ultra-TeX distribution.  Description: This is the pathname for your textree file, the file containing a list of TeX commands on which to complete. See Making a list.

ultex-extra-tree-files
     Default value: nil.  Description: This is a list of triples.  The first element of each triple should be the name of a class, style, or package, the second the name of an associated file of TeX commands, the third a flag (t or nil).  When that class, style, or package is used in any given document, the associated file of TeX commands is loaded.  If the flags are nil for every class, style, and package used in the document, then the main TeX command file (ultex-tree-file) is not loaded.  See Making a list.

ultex-greek-keys-file
     Default value: The file user/greek.el in the Ultra-TeX distribution.  Description: This is the pathname for your greek keys file, the file containing mappings for the Greek keyboards in Ultra-TeX mode. See Greek keyboards.

ultex-latex-skel-file
     Default value: The file user/skeleton.tex in the Ultra-TeX distribution.  Description: This is the pathname for a file containing a template for a LaTeX document.  This file is inserted when the function get-latex-skel is run. See Everything else.

ultex-skel-hook
     Default value: nil.  Description: This hook is called when the function get-latex-skel is run. See Everything else.

ultra-tex-commands
------------------

To change these:

     M-x customize-group ultra-tex-commands

ultex-alist-local-flag
     Default value: t.  Effect: When non-nil, each Ultra-TeX buffer maintains its own list of TeX commands on which to complete. See Making a list.

ultex-rescan-after-new-label
     Default value: nil.  Effect: When non-nil, Ultra-TeX rescans the buffer for labels whenever you enter a new label.  This is useful if you change labels a lot and you don't want Ultra-TeX completing on old labels that you have removed.

ultex-append-space-to-defs
     Default value: t.  Effect: When non-nil, Ultra-TeX adds a space to any TeX control sequence names it grabs from a file or buffer.

ultra-tex-parens
----------------

To change these:

     M-x customize-group ultra-tex-parens

ultex-match-braces
     Default value: t.  Effect: If non-nil, hitting { inserts {}. See Everything else.

ultex-match-brackets
     Default value: nil.  Effect: If non-nil, hitting [ inserts []. See Everything else.

ultex-match-parens
     Default value: nil.  Effect: If non-nil, hitting ( inserts (). See Everything else.

ultex-blink-matching-bracket
     Default value: t.  Effect: If non-nil, hitting ] will briefly highlight the matching [.  More to the point, if this is nil, then the syntax type of brackets is changed from the default, in which case Ultra-TeX might do a better job of determining when the point is in math mode.  If you don't want to mess with the syntax table, but you do want to control the blinking of matching parentheses, look at the variable `blink-matching-paren' instead.

ultex-blink-matching-paren
     Default value: t.  Effect: If non-nil, hitting ) will briefly highlight the matching (.  More to the point, if this is nil, then the syntax type of parentheses is changed from the default, in which case Ultra-TeX might do a better job of determining when the point is in math mode.  If you don't want to mess with the syntax table, but you do want to control the blinking of matching parentheses, look at the variable `blink-matching-paren' instead.

ultra-tex-environments
----------------------

To change these:

     M-x customize-group ultra-tex-environments

ultex-array-environs
     Default value:

          (array tabular eqnarray eqnarray* align gather alignat
          aligned gathered alignedat split CD matrix smallmatrix
          pmatrix bmatrix vmatrix Vmatrix xalignat xxalignat cases)

     Description: List of symbols of array environments. See Everything else.

ultex-math-start
     Default value: some long regular expression.  Description: Regular expression to match the start of math mode.

ultex-math-end
     Default value: some long regular expression.  Description: Regular expression to match the end of math mode.

ultex-itemizing-environments
     Default value: (list trivlist itemize description enumerate). Description: List of symbols of LaTeX environments which use \item.  When the point is in one of these environments, hitting \\ inserts a new line and the text \item. See Everything else.

ultex-math-cs-regexp
     Default value: nil.  Description: Regular expression to match TeX commands whose arguments are set in math mode.

ultex-non-math-cs-regexp
     Default value: "\\\\[a-z]*box{\\|\\\\text[a-z]*{".  Description: Regular expression to match TeX commands whose arguments are not set in math mode.

ultex-def-regexp
     Default value: some long regular expression.  Description: Regular expression to match TeX commands whose arguments may or may not be in math mode (e.g., newcommand).

ultex-dollar-array-cursor
     Default value: "|".  Description: String to use to mark the cursor position in ultex-dollar-array. See Dollar signs.

ultex-dollar-array
     Default value:

           "$|$"
           "\[\n|\n\]"
           "\begin{equation}\label{|}\n\n\end{equation}"
           "\begin{equation*}\n|\n\end{equation*}"
           "\begin{align}\label{|}\n\n\end{align}"
           "\begin{align*}\n|\n\end{align*}"
           "\begin{gather}\label{|}\n\n\end{gather}"
           "\begin{gather*}\n|\n\end{gather*}"
           "\begin{multline}\label{|}\n\n\end{multline}"
           "\begin{multline*}\n|\n\end{multline*}"

     where I have written \n for newline. Description: List of strings inserted by hitting $.  The first time you hit $, the first string is inserted.  Hitting it again replaces the first string with the second, etc.  After inserting each string, the cursor is placed at the spot marked by the string ultex-dollar-array-cursor.  If you do not include the string ultex-dollar-array-cursor anywhere, Emacs will try to guess where to put the cursor.

     (Warning: customization sets the variable ultex-dollar-array-external, which has the above default value. If you want to set this directly, not via customize, then you should set ultex-dollar-array, which has a different syntax.  Read the documentation for that variable for help.) See Dollar signs.

ultex-dollar-back
     Default value: 1.  Description: Which element of ultex-dollar-array to start over with once the elements have been cycled through once.  The elements are numbered starting with 0. See Dollar signs.

ultra-tex-misc
--------------

To change these:

     M-x customize-group ultra-tex-misc

ultex-slash-dollar-is-not-math
     Default value: t.  Effect: If non-nil, then typing $ right after \ does not start math mode.

ultex-dont-use-completion
     Default value: nil.  Effect: If non-nil, Ultra-TeX will not use lightning completion on TeX commands.  Instead, things will work sort of like regular Emacs completion: the TAB key will try to complete on command sequences, etc.

ultra-tex-auctex
----------------

Except for ultex-ignore-auctex-tex.el, the rest of these come from AUC-TeX.  To change them:

     M-x customize-group ultra-tex-auctex

ultex-ignore-auctex-tex.el
     Default value: t.  Effect: If non-nil, then the AUC-TeX file tex.el will not be loaded by tex-buf.el.  In fact, if you want to load it, you have to do it with a load command (rather than require).  If the only piece of AUC-TeX you ever use is the part that comes with Ultra-TeX, then you have nothing to worry about.  If you use other parts of the AUC-TeX distribution, then you might want to set this variable to nil.  I can't guarantee that Ultra-TeX and AUC-TeX will interact well in that case, though.

TeX-display-help
     Default value: t.  Effect: If non-nil, then pop-up help when stepping thrugh errors with TeX-next-error.

TeX-debug-bad-boxes
     Default value: nil.  Effect: If non-nil, then also find overfull/underfull boxes warnings with TeX-next-error.

ultra-tex-auctex-files
----------------------

These options all come from AUC-TeX.  To change them:

     M-x customize-group ultra-tex-auctex-files

TeX-master
     Default value: t.  Description: The master file associated with the current buffer.  If the file being edited is actually included from another file, you can tell Ultra-TeX and AUC-TeX the name of the master file by setting this variable.  If there are multiple levels of nesting, specify the top level file.  If this variable is nil, Emacs will query you for the name.  If the variable is t, Emacs will assume the file is a master file itself.  If the variable is 'shared, Emacs will query for the name, but not change the file. See Making a list.

TeX-one-master
     Default value: "\\.tex$".  Description: Regular expression matching ordinary TeX files.

TeX-file-extensions
     Default value: '("tex" "sty" "cls" "ltx" "texi" "texinfo"). Description: List of file extensions used by manually generated TeX files.

TeX-macro-global
     Default value: '("/usr/local/lib/texmf/tex/").  Description: Directories containing the sites TeX macro files and style files.

TeX-macro-private
     Default value: obtained from environment variables TEXINPUTS and BIBINPUTS.  Description: Directories where you store your personal TeX macros.

TeX-check-path
     Default value: all elements from TeX-macro-private and TeX-macro-global, as well as the current directory.  Description: Directory path to search for dependencies.

BibTeX-file-extensions
     Default value: ("bib").  Description: List of valid file extensions for BibTeX files.

BibTeX-style-extensions
     Default value: ("bst").  Description: List of valid file extensions for BibTeX style files.

TeX-default-extension
     Default value: "tex".  Description: Default extension for TeX files.

ultra-tex-auctex-commands
-------------------------

These options all come from AUC-TeX.  To change them:

     M-x customize-group ultra-tex-auctex-commands

TeX-command-BibTeX
     Default value: "BibTeX".  Description: The name of the BibTeX entry in TeX-command-list.

TeX-command-Show
     Default value: "View".  Description: The default command to show (view or print) a TeX file.

TeX-command-Print
     Default value: "Print".  Description: The name of the Print entry in TeX-command-Print.

TeX-command-Queue
     Default value: "Queue".  Description: The name of the Queue entry in TeX-command-Queue.

TeX-print-command
     Default value: "dvips %s -P%p".  Description: Command used to print a file.  First %p is expanded to the printer name, then ordinary expansion is performed as specified in TeX-expand-list.

TeX-queue-command
     Default value: "lpq -P%p".  Description: Command used to show the status of a printer queue.  First %p is expanded to the printer name, then ordinary expansion is performed as specified in TeX-expand-list.

TeX-printer-list
     Default value:

           (("Local" "dvips -f %s | lpr" "lpq")
            ("lw")
            ("ps"))

     Description: List of available printers.  The first element of each entry is the printer name.  The second element is the command used to print to this printer.  It defaults to the value of TeX-print-command.  The third element is the command used to examine the print queue for this printer.  It defaults to the value of TeX-queue-command.  Any occurence of %p in the second or third element is expanded to the printer name given in the first element, then ordinary expansion is performed as specified in TeX-expand-list.

TeX-printer-default
     Default value: Derived from the environment variable PRINTER, or if that is not set, the car of TeX-printer-list, or if that is not set, "lw".  Description: Default printer to use with TeX-command.

TeX-view-style
     Default value:

           (("^a5$" "xdvi %d -paper a5")
            ("^landscape$" "xdvi %d -paper a4r -s 4")
            ("." "xdvi %d"))

     Description: List of style options and view options.  If the first element (a regular expresion) matches the name of one of the style files, any occurrence of the string %v in a command in TeX-command-list will be replaced with the second element.  The first match is used, if no match is found the %v is replaced with the empty string.

TeX-expand-list
     Default value: a long list of things of the form

            ("%s" file nil t)

     Description: List of expansion strings for TeX command names.  Each entry is a list with two or more elements.  The first element is the string to be expanded.  The second element is the name of a function returning the expanded string when called with the remaining elements as arguments.  The special value file will be expanded to the name of the file being processed, with an optional extension.

TeX-command-list
     Default value: a long list of things of the form

           ("LaTeX" "%l '\\nonstopmode\\input{%t}'" TeX-run-LaTeX nil t)

     Description: List of commands to execute on the current document.  Each element is a list of five elements, whose first element is the name of the command as it will be presented to the user.  The second element is the string handed to the shell after being expanded. The expansion is done using the information found in TeX-expand-list.  The third element is the function which actually start the process.  Several such hooks has been defined; see the function documentation for a description.  If the fourth element is non-nil, the user will get a chance to modify the expanded string.  The fifth element is obsolete and ignored.

ultra-tex-auctex-latex
----------------------

These options all come from AUC-TeX.  To change them:

     M-x customize-group ultra-tex-auctex-latex

LaTeX-version
     Default value: "2e".  Description: Default LaTeX version.  The only choices are "2" and "2e".

LaTeX-command-style
     Default value: if LaTeX-version is "2e", then (("." "latex"))). If LaTeX-version is "2", then a longer list.  Description: List of style options and LaTeX commands.