[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1 Executing Commands

Formatting the document with TeX, LaTeX or ConTeXt, 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. A special case of running TeX on a region is TeX-command-buffer which differs from TeX-command-master if the current buffer is not its own master file.

Command: TeX-command-master
(C-c C-c) Query the user for a command, and run it on the master file associated with the current buffer. The name of the master file is controlled by the variable TeX-master. The available commands are controlled by the variable TeX-command-list.

See section 10. How to install AUCTeX, for a discussion about TeX-command-list and 5. Multifile Documents for a discussion about TeX-master.

Command: TeX-command-region
(C-c C-r) Query the user for a command, and run it on the "region file". Some commands (typically those invoking TeX or LaTeX) will write the current region into the region file, after extracting the header and tailer from the master file. If mark is inactive (which can happen with transient-mark-mode), use the old region. The name of the region file is controlled by the variable 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.

Command: TeX-pin-region
(C-c C-t C-r) If you don't have a mode like transient-mark-mode active, where marks get disabled automatically, the region would need to get properly set before each call to TeX-command-region. If you fix the current region with C-c C-t C-r, then it will get used for more commands even though mark and point may change. An explicitly activated mark, however, will always define a new region when calling TeX-command-region.

Command: TeX-command-buffer
(C-c C-b) Query the user for a command, and run it on the "region file". Some commands (typically those invoking TeX or LaTeX) will write the current buffer into the region file, after extracting the header and tailer from the master file. See above for details.

AUCTeX 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 4.3 Catching the errors and 4.5 Controlling the output will work on that process, otherwise they will work on the process associated with the current document.

User Option: TeX-region
The name of the file for temporarily storing the text when formatting the current region.

User Option: TeX-header-end
A regular expression matching the end of the header. By default, this is `\begin{document}' in LaTeX mode and `%**end of header' in TeX mode.

User Option: TeX-trailer-start
A regular expression matching the start of the trailer. By default, this is `\end{document}' in LaTeX mode and `\bye' in TeX mode.

AUCTeX 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.

User Option: TeX-command-default
The default command to run in this buffer. Must be an entry in 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:

AUCTeX 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, AUCTeX will query before saving each file. By default AUCTeX 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.

User Option: TeX-check-path
Directory path to search for dependencies.

If nil, just check the current file. Used when checking if any files have changed.

Command: TeX-PDF-mode
(C-c C-t C-p) This command toggles the PDF mode of AUCTeX, a buffer-local minor mode. You can customize TeX-PDF-mode to give it a different default. The default is used when AUCTeX does not have additional clue about what a document might want. This option usually results in calling either PDFTeX or ordinary TeX.

User Option: TeX-DVI-via-PDFTeX
If this is set, DVI will also be produced by calling PDFTeX, setting \pdfoutput=0. This makes it possible to use packages like `pdfcprot' even when producing DVI files.

Command: TeX-interactive-mode
(C-c C-t C-i) This command toggles the interactive mode of AUCTeX, a global minor mode. You can customize TeX-interactive-mode to give it a different default. In interactive mode, TeX will pause with an error prompt when errors are encountered and wait for the user to type something.

Command: TeX-source-specials-mode
(C-c C-t C-s) toggles Source Special support. Source Specials will move the DVI viewer to the location corresponding to point (forward search), and it will use `emacsclient' or `gnuclient' to have the previewer move Emacs to a location corresponding to a control-click in the previewer window. See section 4.2 Viewing the formatted output.

You can permanently activate TeX-source-specials-mode with

 
(TeX-source-specials-mode 1)
or by customizing the variable TeX-source-specials-mode. There is a bunch of customization options, use customize-group on the group `TeX-source-specials' to find out more.

It has to be stressed very strongly however, that Source Specials can cause differences in page breaks, in spacing, can seriously interfere with various packages and should thus never be used for the final version of a document. In particular, fine-tuning the page breaks should be done with Source Specials switched off.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Davide G. M. Salvetti on September, 8 2004 using texi2html