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

Marking, Formatting and Indenting

AUC TeX contains very advanced handling of indentation and reformatting of the LaTeX source. If you have already tried AUC TeX with auto-fill-mode enabled, you may have noted that the source is automatically indented and formatted as you write it. More over, AUC TeX is able to format sections of text on demand.

It is important to realize, that AUC TeX comes with `formatting' in two fashions. Either letting TeX format the file, or letting AUC TeX make the ASCII document look better.

Indentation is done by LaTeX environments and by TeX groups, that is the body of an environment is indented by the value of LaTeX-indent-level (default 2). Also, items of an `itemize-like' environment are indented by the value of LaTeX-item-indent, default -2. This indentation makes it easier to see the structure of the document, and to catch errors such as a missing close brace. Thus, the indentation is done for precisely the same reasons that you would indent ordinary computer programs.

The following is a short sample of an itemize environment indented by AUC TeX. If more environment are nested, they are indented `accumulated' just like most programming languages usually are seen indented in nested constructs.

\begin{itemize}
\item Insertion of templates for logical-structural compositions such as
  environments and sections.
\item Hot-keys for easy access to certain often used constructs, e.g.,
  font changes, accented letters, and mathematical symbols.
\item Running application programs (such as \TeX), and then parsing
  the output so that errors in the document may be located 
  easily.
\item Support for multi-file documents.
\item Online help for \AllTeX\ error messages.
\item Outlining\Dash i.e., manipulating the document as a composition
  of nested/sequential logical constructs.
\item Instant formatting and indentation of the \ascii-document in
  order to make it easier to read.
\item `Completion' (and thereby spell-checking) of partially written
  control sequences.
\end{itemize}

You can format and indent single lines, paragraphs, environments, or sections.

tab
LaTeX-indent-line will indent the current line.
lfd
reindent-then-newline-and-indent indents the current line, and then inserts a new line (much like ret) and move the cursor to an appropriate position by the left margin.
M-q
Alias for C-c C-q C-p
C-c C-q C-p
LaTeX-format-paragraph will reformat or `fill' the current paragraph.
C-c C-q C-e
LaTeX-format-environment will reformat or `fill' the current environment. This may e.g. be the `document' environment, in which case the entire document will be formatted.
C-c C-q C-s
LaTeX-format-section will reformat or `fill' the current logical sectional unit.
M-g
Alias for C-c C-q C-r
C-c C-q C-r
LaTeX-format-region will format or `fill' the current region.

Warning: The formatting cannot handle tabular-like environments. Those will be completely messed-up if you try to format them.

User Option: LaTeX-indent-level
Number of spaces to add to the indentation for each `\begin' not matched by a `\end'.

User Option: LaTeX-item-indent
Number of spaces to add to the indentation for `\item''s in list environments.

User Option: TeX-brace-indent-level
Number of spaces to add to the indentation for each `{' not matched by a `}'.


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