Go to the first, previous, next, last section, table of contents.

Inserting Frequently Used Commands

The most commonly used commands/macros of AUC TeX are those which simply insert templates for often used TeX and/or LaTeX constructs, like font changes, handling of environments, etc. These features are very simple, and easy to learn, and help you avoiding stupid mistakes like mismatched braces, or `\begin{}'-`\end{}' pairs.

Insertion of Quotes, Dollars, and Braces

In TeX literal double quotes `"like this"' are seldom used, instead two single quotes are used `"like this"'. To help you insert these efficiently, AUC TeX allows you to continue to press " to insert two single quotes. To get a literal double quote, press " twice.

Command: TeX-insert-quote count
(") Insert the appropriate quote marks for TeX.

Inserts the value of TeX-open-quote (normally `"') or TeX-close-quote (normally `"') depending on the context. With prefix argument, always inserts `"' characters.

User Option: TeX-open-quote
String inserted by typing " to open a quotation.

User Option: TeX-close-quote
String inserted by typing " to open a quotation.

If you include the style file `german' TeX-open-quote and TeX-close-quote will both be set to `"'.

In AUC TeX, dollar signs should match like they do in TeX. This has been partially implemented, we assume dollar signs always match within a paragraph. The first `$' you insert in a paragraph will do nothing special. The second `$' will match the first. This will be indicated by moving the cursor temporarily over the first dollar sign. If you enter a dollar sign that matches a double dollar sign `$$' AUC TeX will automatically insert two dollar signs. If you enter a second dollar sign that matches a single dollar sign, the single dollar sign will automatically be converted to a double dollar sign.

Command: TeX-insert-dollar arg
($) Insert dollar sign.

Show matching dollar sign if this dollar sign end the TeX math mode. Ensure double dollar signs match up correctly by inserting extra dollar signs when needed.

With optional arg, insert that many dollar signs.

To avoid unbalanced braces, it is useful to insert them pairwise. You can do this by typing C-c {.

Command: TeX-insert-braces
(C-c {) Make a pair of braces and position the cursor to type inside of them.

Inserting Font Specifiers

Perhaps the most used keyboard commands of AUC TeX are the short-cuts available for easy insertion of font changing macros. They all put the font change inside a TeX group, a practice that help preventing subtle errors. The most significant advantage of using these command instead of typing it in yourself, is that the braces will always match correctly.

If you give an argument (that is, type C-u) to the font command, the innermost font will be replaced, i.e. the font in the TeX group around point will be changed. The following table shows the available commands, with -!- indicating the position where the text will be inserted.

C-c C-f C-r
Insert roman {\textrm -!-} text.
C-c C-f C-b
Insert bold face `{\textbf -!-}' text.
C-c C-f C-i
Insert italics `{\textit -!-\/}' text.
C-c C-f C-e
Insert emphasized `{\emph -!-\/}' text.
C-c C-f C-s
Insert slanted `{\textsl -!-\/}' text.
C-c C-f C-t
Insert typewriter `{\texttt -!-}' text.
C-c C-f C-c
Insert SMALL CAPS `{\textsc -!-}' text.
C-c C-f C-d
Delete the innermost font specification containing point.

Command: TeX-font arg
(C-c C-f) Insert template for font change command.

If replace is not nil, replace current font. what determines the font to use, as specified by TeX-font-list.

User Option: TeX-font-list
List of fonts used by TeX-font.

Each entry is a list with three elements. The first element is the key to activate the font. The second element is the string to insert before point, and the third element is the string to insert after point. An optional fourth element means always replace if not nil.

Inserting chapters, sections, etc.

Insertion of sectioning macros, that is `\chapter', `\section', `\subsection', etc. and accompanying `\label''s may be eased by using C-c C-s. This command is highly customizable, the following describes the default behavior.

When invoking you will be asked for a section macro to insert. An appropriate default is automatically selected by AUC TeX, that is either: at the top of the document; the top level sectioning for that document style, and any other place: The same as the last occurring sectioning command.

Next, you will be asked for the actual name of that section, and last you will be asked for a label to be associated with that section. The label will be prefixed by the value specified in LaTeX-section-hook.

Command: LaTeX-section arg
(C-c C-s) Insert a sectioning command.

Determine the type of section to be inserted, by the argument arg.

The following variables can be set to customize the function.

LaTeX-section-hook
Hooks to be run when inserting a section.
LaTeX-section-label
Prefix to all section references.

The precise behavior of LaTeX-section is defined by the contents of LaTeX-section-hook.

User Option: LaTeX-section-hook
List of hooks to run when a new section is inserted.

The following variables are set before the hooks are run

level
Numeric section level, default set by prefix arg to LaTeX-section.
name
Name of the sectioning command, derived from level.
title
The title of the section, default to an empty string.
toc
Entry for the table of contents list, default nil.
done-mark
Position of point afterwards, default nil meaning after the inserted text.

A number of hooks are already defined. Most likely, you will be able to get the desired functionality by choosing from these hooks.

LaTeX-section-heading
Query the user about the name of the sectioning command. Modifies level and name.
LaTeX-section-title
Query the user about the title of the section. Modifies title.
LaTeX-section-toc
Query the user for the toc entry. Modifies toc.
LaTeX-section-section
Insert LaTeX section command according to name, title, and toc. If toc is nil, no toc entry is inserted. If toc or title are empty strings, done-mark will be placed at the point they should be inserted.
LaTeX-section-label
Insert a label after the section command. Controlled by the variable LaTeX-section-label.

To get a full featured LaTeX-section command, insert

(setq LaTeX-section-hook
      '(LaTeX-section-heading
        LaTeX-section-title
        LaTeX-section-toc
        LaTeX-section-section
        LaTeX-section-label))

in your `.emacs' file.

The behavior of LaTeX-section-label is determined by the variable LaTeX-section-label.

User Option: LaTeX-section-label
Default prefix when asking for a label.

If it is a string, it is used unchanged for all kinds of sections. If it is nil, no label is inserted. If it is a list, the list is searched for a member whose car is equal to the name of the sectioning command being inserted. The cdr is then used as the prefix. If the name is not found, or if the cdr is nil, no label is inserted.

By default, chapters have a prefix of `cha:' while sections and subsections have a prefix of `sec:'. Labels are not automatically inserted for other types of sections.

Inserting Environment Templates

A large apparatus is available that supports insertions of environments, that is `\begin{}' -- `\end{}' pairs.

AUC TeX is aware of most of the actual environments available in a specific document. This is achieved by examining your `\documentstyle' command, and consulting a precompiled list of environments available in a large number of styles.

You insert an environment with C-c C-e, and select an environment type. Depending on the environment, AUC TeX may ask more questions about the optional parts of the selected environment type. With C-u C-c C-e you will change the current environment.

Command: LaTeX-environment arg
(C-c C-e) AUC TeX will prompt you for an environment to insert. At this prompt, you may press TAB or SPC to complete a partially written name, and/or to get a list of available environments. After selection of a specific environment AUC TeX may prompt you for further specifications.

If the optional argument arg is not-nil (i.e. you have given a prefix argument), the current environment is modified and no new environment is inserted.

As a default selection, AUC TeX will suggest the environment last inserted or, as the first choice the value of the variable LaTeX-default-environment.

User Option: LaTeX-default-environment
Default environment to insert when invoking `LaTeX-environment' first time.

If the document is empty, or the cursor is placed at the top of the document, AUC TeX will default to insert a `document' environment.

Most of these are described further in the following sections, and you may easily specify more, as described in `Customizing environments'.

You can close the current environment with C-c ], but we suggest that you use C-c C-e to insert complete environments instead.

Command: LaTeX-close-environment
(C-c ]) Insert an `\end' that matches the current environment.

Floats

Figures and tables (i.e., floats) may also be inserted using AUC TeX. After choosing either `figure' or `table' in the environment list described above, you will be prompted for a number of additional things.

float-to
This field is the option of float environments that controls how they are placed in the final document. In LaTeX this is a sequence of the letters `htbp' as described in the LaTeX manual. The value will default to the value of LaTeX-float.
caption
This is the caption of the float.
label
The label of this float. The label will have a default prefix, which is controlled by the variables LaTeX-figure-label and LaTeX-table-label.

Moreover, in the case of a `figure' environment, you will be asked if you want to insert a `center' environment inside the figure.

User Option: LaTeX-float
Default placement for floats.

User Option: LaTeX-figure-label
Prefix to use for figure labels.

User Option: LaTeX-table-label
Prefix to use for table labels.

Itemize-like

In an itemize-like environment, nodes (i.e., `\item's) may be inserted using C-c LFD.

Command: LaTeX-insert-item
(C-c LFD) Close the current item, move to the next line and insert an appropriate `\item' for the current environment. That is, `itemize' and `enumerate' will have `\item ' inserted, while `description' will have `\item[]' inserted.

Tabular-like

When inserting Tabular-like environments, that is, `tabular' `array' etc., you will be prompted for a template for that environment.

Customizing environments

See section Adding Support for Environments, for how to customize the list of known environments.


Go to the first, previous, next, last section, table of contents.