: Learning GNU Emacs, 3rd Edition

8.5.4 Processing and Printing Text

8.5.4 Processing and Printing Text

In addition to marking up files for LATEX , you can process files, see your errors (if any), and invoke a viewer, all without leaving Emacs. To process a file, just type C-c C-f (for tex-file).[54] Emacs saves the file before processing it. Messages that would appear on screen are channeled to a buffer called *tex-shell*, which Emacs displays on your screen. If the buffer isn't on the screen, typing C-c C-l (for tex-recenter-output-buffer) automatically displays it.

To demonstrate, let's try processing dickens.tex, a very basic file indeed.

Type: C-c C-f

Processing a LATEX file displays a special *tex-shell* buffer.

This command generates a .dvi file, which is an intermediate, device-independent file. You can view the resulting file by typing C-c C-v. On Linux, the default viewer is xdvi. Pressing C-c C-v displays the output in an xdvi window.

Type: C-c C-v

Output displayed by xdvi.

To print the .dvi file, give the command C-c C-p (for tex-print); this formats the .dvi file and sends it to your default printer. C-c C-q(tex-show-print-queue) displays the print queue so you know when to go to the printer to look for your processed output.

Two important variables tell Emacs how to print a TEX , file. You need to know about them if C-c C-p or C-c C-q doesn't work correctly; if these commands don't work, the configuration of TEX , on your system may be nonstandard, or the print and print queue commands are slightly different. The variable tex-dvi-print-command determines the command that is used to print a .dvi file; its default is lpr -d. For print queues, the command used to show the print queue is controlled by the tex-show-queue-command variable. By default, tex-show-queue-command is set to lpq.

Table 8-9 summarizes TeX and LaTeX mode commands.

Table8-9.TeX and LaTeX mode commands

Keystrokes Command name Action
(none) tex-mode Enter TeX or LaTeX mode according to file's contents.
(none) plain-tex-mode Enter TeX mode.
(none) latex-mode Enter LaTeX mode.
C-j tex-terminate-paragraph Insert two hard returns (standard end of paragraph) and check syntax of paragraph.
C-c { tex-insert-braces Insert two braces and put cursor between them.
C-c } up-list If you are between braces, position the cursor following the closing brace.
(none)TeX ? Validate Buffer tex-validate-buffer Check buffer for syntax errors.
(none)TeX ? Validate Region tex-validate-region Check the region for syntax errors.
C-c C-f TeX ? TeX File tex-file Saves the current file, then processes it.
C-c C-b TeX ? TeX Buffer tex-buffer Process buffer.[55]
C-c C-l TeX ? TeX Recenter tex-recenter-output-buffer Put the message shell on the screen, showing (at least) the last error message.
C-c C-k TeX ? TeX Kill tex-kill-job Kill processing.
C-c C-p TeX ? TeX Print tex-print Print output.
C-c C-q TeX ? Show Print Queue tex-show-print-queue Show print queue.
C-c C-e latex-close-block Provide closing element of a command pair.
(none) tex-close-latex-block Provide closing element of a command pair.
C-c Tab` TeX ? BibTeX File tex-bibtex-file Process the current file using BibTeX, a system for creating bibliographies automatically.
C-c C-v TeX ? TeX View tex-view View .dvi output.
(none)TeX ? TeX Print (alt printer) tex-alt-print Print .dvi file using an alternative printer defined by the variable tex-alt-dvi-print-command.
C-c C-o latex-insert-block Insert a block (prompts for block name and options).
C-c C-u tex-goto-last-unclosed-latex-block Look backward in the file to find the nearest unclosed block and move the cursor there.
M-Enter latex-insert-item Insert item.
(none) latex-split-block Insert an end to the current block and the beginning of a new one.
" tex-insert-quote Insert TeX-style quotation marks.

: 0.789. /Cache: 3 / 1