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.
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.
Inserts the value of TeX-open-quote
(normally `"') or
TeX-close-quote
(normally `"') depending on the context.
With prefix argument, always inserts `"' characters.
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.
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 {.
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.
If replace is not nil, replace current font. what
determines the font to use, as specified by TeX-font-list
.
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.
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
.
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
LaTeX-section-label
The precise behavior of LaTeX-section
is defined by the contents
of LaTeX-section-hook
.
The following variables are set before the hooks are run
LaTeX-section
.
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
LaTeX-section-title
LaTeX-section-toc
LaTeX-section-section
LaTeX-section-label
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
.
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.
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.
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
.
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.
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.
LaTeX-float
.
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.
In an itemize-like environment, nodes (i.e., `\item's) may be inserted using C-c LFD.
When inserting Tabular-like environments, that is, `tabular' `array' etc., you will be prompted for a template for that environment.
See section Adding Support for Environments, for how to customize the list of known environments.