Predictive mode's LaTeX support parses the LaTeX file as you type (without any noticeable slow-down!), in order to identify different contexts. The main use for this information is to switch to the appropriate dictionary in different regions of a LaTeX document.
The following customization options affect this parsing:
\documentclass{<
docclass>}
with dictionaries.
\begin{<
environment>}
and
\end{<
environment>}
are automatically synchronised.
By default, predictive mode will use the usual main dictionary in LaTeX mode, determined by predictive-main-dict (see Basic Dictionary Usage). However, by customizing predictive-latex-docclass-alist, the main dictionary can be selected automatically based on the document class.
In addition to the main dictionary, a number of LaTeX dictionaries
are also used, grouped into four main categories: text-mode LaTeX
commands, maths-mode LaTeX commands, preamble LaTeX commands, and
LaTeX environments. The dictionaries in the different categories are
used to look for completions in different contexts in the LaTeX
document. The main LaTeX dictionaries in these categories are,
respectively, dict-latex
, dict-latex-math
,
dict-latex-preamble
and dict-latex-env
. In addition, there
are dictionaries for LaTeX document classes
(dict-latex-docclass
), bibliography styles
(dict-latex-bibstyle
). Finally, a dictionary of cross-reference
labels and dictionaries of locally defined LaTeX commands and
environments, unique to each LaTeX file, are generated automatically
(see Automatically Created Files for LaTeX).
Predictive mode will automatically complete words from the correct dictionary in different regions of your LaTeX document1. In the main body of the document it will complete from the main dictionary, as usual, and also from the dictionaries of text-mode LaTeX commands. Inside ‘equation’ or other display-mode environments, between ‘$’'s, or between ‘\[’ and ‘\]’, it will use the dictionaries of maths commands. Inside ‘\begin{...}’ it will use the dictionaries of LaTeX environments. Inside ‘\ref{...}’ it will use the dictionary of cross-reference labels, which is created and updated automatically for each LaTeX document. Inside ‘\documentclass{...}’ and ‘\bibliographystyle{...}’, it will use the document class and bibliography style dictionaries, respectively.
When predictive-latex-electric-environments is enabled, the
environment name appearing inside a LaTeX
\end{<
environment>}
command is automatically synchronised
with its matching \begin{<
environment>}
command. The
synchronisation doesn't just occur when the \end
command is first
typed; it is kept synchronised at all times, even when the \begin
command that it originally matched is deleted, causing it to match a
different \begin
somewhere else in the document. Also, when the
environment name within either a \begin
or an \end
command is modified, the environment name within its matching partner is
also modified accordingly. WARNING: this feature is known to have bugs,
and should probably not be used at the moment (see Known Bugs).
Predictive LaTeX mode honours the TeX-master variable. If it is turned on in a buffer whose TeX-master variable is set to the name of another LaTeX file, the TeX-master file will be visited, predictive mode will be enabled in its buffer, and all buffers with the same TeX-master will share various predictive mode settings.
The behaviour of different character syntax classes, and the behaviour of certain individual characters, is set up appropriately for LaTeX (see Character Syntax and Key Bindings). Also, a special LaTeX completion browser menu, more appropriate for browsing LaTeX commands, is used instead of the default one.
[1] The automatic dictionary switching is implemented using the auto-overlays Elisp package.