The most powerful features of AUC TeX may be those allowing you to
run (La)TeX and other external commands like BibTeX and
makeindex
from within Emacs, viewing and printing the results,
and moreover allowing you to debug your documents.
Formatting the document with TeX or LaTeX, viewing with a
previewer, printing the document, running BibTeX, making an index, or
checking the document with lacheck
or chktex
all require
running an external command.
There are two ways to run an external command, you can either run it on
all of the current documents with TeX-command-master
, or on the
current region with TeX-command-region
.
TeX-master
. The available commands are
controlled by the variable TeX-command-list
.
See section Installation of AUC TeX for a discussion about TeX-command-list
and
section Multifile Documents for a discussion about TeX-master
.
TeX-region
. The name of the master file is controlled by the
variable TeX-master
. The header is all text up to the line
matching the regular expression TeX-header-end
. The trailer is
all text from the line matching the regular expression
TeX-trailer-start
. The available commands are controlled by the
variable TeX-command-list
.
AUC TeX will allow one process for each document, plus one process for the region file to be active at the same time. Thus, if you are editing n different documents, you can have n plus one processes running at the same time. If the last process you started was on the region, the commands described in section Catching the errors and section Controlling the output will work on that process, otherwise they will work on the process associated with the current document.
AUC TeX will try to guess what command you want to invoke, but by
default it will assume that you want to run TeX in TeX mode and
LaTeX in LaTeX mode. You can overwrite this by setting the
variable TeX-command-default
.
TeX-command-list
.
If you want to overwrite the values of TeX-header-end
,
TeX-trailer-start
, or TeX-command-default
, you can do that
for all files by setting them in either TeX-mode-hook
,
plain-TeX-mode-hook
, or LaTeX-mode-hook
. To overwrite
them for a single file, define them as file variables (see section `File Variables' in The Emacs Editor). You do this by putting special
formatted text near the end of the file.
% Local Variables: % TeX-header-end: "% End-Of-Header" % TeX-trailer-start: "% Start-Of-Trailer" % TeX-command-default: "SliTeX" % End:
AUC TeX will try to save any buffers related to the document, and
check if the document needs to be reformatted. If the variable
TeX-save-query
is non-nil, AUC TeX will query before saving
each file. By default AUC TeX will check emacs buffers associated
with files in the current directory, in one of the
TeX-macro-private
directories, and in the TeX-macro-global
directories. You can change this by setting the variable
TeX-check-path
.
If nil, just check the current file. Used when checking if any files have changed.
Once you've formatted your document you may `debug' it, i.e. browse through the errors (La)TeX reported.
Normally AUC TeX will only report real errors, but you may as well ask it to report `bad boxes' as well.
As default, AUC TeX will display that special `*help*' buffer containing the error reported by TeX along with the documentation. There is however an `expert' option, which allows you to display the real TeX output.
TeX-next-error
(C-c `).
Running TeX or LaTeX will only find regular errors in the
document, not examples of bad style. Furthermore, description of the
errors may often be confusing. The utility lacheck
can be used
to find style errors, such as forgetting to escape the space after an
abbreviation or using `...' instead of `\ldots' and many other
problems like that. You start lacheck
with C-c C-c C h e c
k RET. The result will be a list of errors in the
`*compilation*' buffer. You can go through the errors with
C-x ` (next-error
, see section `Compilation' in The Emacs Editor), which will move point to the location of the next
error.
Another newer program which can be used to find errors is chktex
.
It is much more configurable than lacheck
, but doesn't find all
the problems lacheck
does, at least in its default configuration.
You must install the programs before using them, and for chktex
you must also modify TeX-command-list
. You can get
lacheck
from `<URL:ftp://sunsite.auc.dk/pub/text/lacheck/>'
or alternatively chktex
from
`<URL:ftp://ftp.dante.de/pub/tex/support/chktex/>'. Search for
`chktex' in `tex.el' to see how to switch between them.They
are
A number of commands are available for controlling the output of an application running under AUC TeX