Previous: , Up: TeX Mode   [Contents][Index]


20.1.2.2 TeX Printing Commands

You can invoke TeX as an inferior of Emacs on either the entire contents of the buffer or just a region at a time. Running TeX in this way on just one chapter is a good way to see what your changes look like without taking the time to format the entire file.

C-c C-r

Invoke TeX on the current region, plus the buffer’s header (tex-region).

C-c C-b

Invoke TeX on the entire current buffer (tex-buffer).

C-c C-l

Recenter the window showing output from the inferior TeX so that the last line can be seen (tex-recenter-output-buffer).

C-c C-k

Kill the inferior TeX (tex-kill-job).

C-c C-p

Print the output from the last C-c C-r or C-c C-b command (tex-print).

C-c C-q

Show the printer queue (tex-show-print-queue).

You can pass the current buffer through an inferior TeX using C-c C-b (tex-buffer). The formatted output appears in a file in /tmp; to print it, type C-c C-p (tex-print). Afterward use C-c C-q (tex-show-print-queue) to view the progress of your output towards being printed.

The console output from TeX, including any error messages, appears in a buffer called ‘*TeX-shell*’. If TeX gets an error, you can switch to this buffer and feed it input (this works as in Shell mode; see Interactive Shell). Without switching to this buffer, you can scroll it so that its last line is visible by typing C-c C-l.

Type C-c C-k (tex-kill-job) to kill the TeX process if you see that its output is no longer useful. Using C-c C-b or C-c C-r also kills any TeX process still running.

You can pass an arbitrary region through an inferior TeX by typing C-c C-r (tex-region). This is tricky, however, because most files of TeX input contain commands at the beginning to set parameters and define macros. Without them, no later part of the file will format correctly. To solve this problem, C-c C-r allows you to designate a part of the file as containing essential commands; it is included before the specified region as part of the input to TeX. The designated part of the file is called the header.

To indicate the bounds of the header in Plain TeX mode, insert two special strings in the file: ‘%**start of header’ before the header, and ‘%**end of header’ after it. Each string must appear entirely on one line, but there may be other text on the line before or after. The lines containing the two strings are included in the header. If ‘%**start of header’ does not appear within the first 100 lines of the buffer, C-c C-r assumes there is no header.

In LaTeX mode, the header begins with ‘\documentstyle’ and ends with
\begin{document}’. These are commands that LaTeX requires you to use, so you don’t need to do anything special to identify the header.

When you enter either kind of TeX mode, Emacs calls with no arguments the value of the variable text-mode-hook, if that value exists and is not nil. Emacs then calls the variable TeX-mode-hook and either plain-TeX-mode-hook or LaTeX-mode-hook under the same conditions.


Previous: , Up: TeX Mode   [Contents][Index]