next up previous
Next: Further LATEX Up: textalk3 Previous: Using LATEX

Subsections

TEX ing, Previewing and Printing


Running TEX

Figure: The TEX process revisited
\begin{figure}
\centering%
\providecommand{\myrbox}[1]{\makebox(0,0){\framebox[...
...200,200){\makebox(0,0){\framebox [32mm]{Preview}}}
\end{picture}\par\end{figure}

Figure 10 shows the basic TEX process with some additional details. You can create your document in any text editor you want. Section 4.2 describes the AUC-TEX mode of Emacs. If you never make mistakes then TEX will exit and tell you the name of the output file. Section 4.3 discusses errors you may make and how to correct them.


AUC-TEX

AUC-TEX is a comprehensive customizable integrated environment for writing input files for LATEX using GNU Emacs.

AUC-TEX lets you run TEX /LATEX and other LATEX -related tools, such as a output filters or post processor from inside Emacs. Especially `running LATEX ' is interesting, as AUC-TEX lets you browse through the errors TEX reported, while it moves the cursor directly to the reported error, and displays some documentation for that particular error. This will even work when the document is spread over several files.

AUC-TEX automatically indents your `LATEX -source', not only as you write it--you can also let it indent and format an entire document. It has a special outline feature, which can greatly help you `getting an overview' of a document.

Apart from these special features, AUC-TEX provides an large range of handy Emacs macros, which in several different ways can help you write your LATEX documents fast and painless.

All features of AUC-TEX are documented using the GNU Emacs online documentation system. That is, documentation for any command is just a key click away!

To use AUC-TEX , do M-x load-library tex-site before reading a .tex file. To avoid having to do this every time you want to edit a LATEX file, put the line

(require 'tex-site)
in your .emacs file. Then Emacs automatically puts you in AUC-TEX mode each time you read a .tex file.

AUC-TEX features

Some of the features of AUC-TEX are:

As an example of the math mode, to insert

$\alpha\leq\beta$
into your document (which produces $ \alpha\leq\beta$) one can simply type the following characters:
$ ` a ` < ` b $
In math minor mode pressing the backquote character ( ` ) changes the meaning of the next character.


Errors

If TEX succeeds in processing the file, it will say so, returning the shell prompt to you. However, often TEX will find errors in your file. TEX reports errors by displaying the following information:

If you are running TEX in batch mode (non-stop mode) then TEX will do its best to process your file, and fix your errors. You can then go back over the error messages and fix the problems.

If you are running TEX in interactive mode, then when it comes to an error TEX will display the above information and give you a ? prompt. Type

h
to get more information on the error
?
to list your options
r
to put TEX into non-stop mode
Return
To ignore the error and continue.

Unless you know what you are doing, the best thing to do is to type r (and Return) to process your file to the end. The most common classes of error are described in the next section.


Common classes of error

Missing Files

Format files
produce either
Sorry, I can't find the format `myformat.fmt';
will try `tex.fmt'.
which means that TEX will try to process with the default format. If the file myformat.fmt really exists then TEX can't find it. More serious is the error:
I can't find the format file `tex.fmt'!
Emergency stop.
This is the default format and if TEX can't find it, then there is a problem with your installation.
Package files
in LATEX are loaded in the preamble with the command \usepackage{mypackage}. If TEX can't find the package it will complain with
!LaTeX Error:File `mypackage.sty' not found.
In interactive mode you can then enter the full name and/or location of the file, but in non-stop mode TEX just stops.
Input files
are your extra files that you want to include. The behaviour is similar to that for package files.

Misspelling a Control Sequence Name

Spelling mistakes in commands range from the innocuous to the catastrophic. For example \nwepage instead of \newpage just produces


! Undefined control sequence.
l.6 \nwepage
and may be fixed later. However a misspelt environment name, such as \begin{itemiz} instead of \begin{itemize} can completely confuse TEX and you may have to give up and fix it before continuing.

Failure to close an environment

There are several ways you may fail to close an environment:

Math outside of math mode

TEX has a lot of operators for use in math formulæ. These normally occur in math mode, usually delimited by dollar signs (the formula $ x^2+y^2=1$ is typeset as $x^2 + y^2 = 1$) but also by \[... \] and other environments. If you try to use these operators outside of math mode, then the following error will occur:

! Missing $ inserted
Either you failed to close a previous math environment, or you failed to open a new one. The most common problems occur with Greek letters e.g. \alpha ($ \alpha$) and with the ^ and _ operators for superscripts and subscripts. For example H$_2$O produces H$ _2$O, while H_2O generates an error message.

Missing Fonts

If you request a font that does not exist, for example crm10 (a misspelling of cmr10), then TEX cannot find it and will generate an error similar to:

Font \myfont=crm10 not loadable: Metric (TFM)
file not found
Unless you try to use fonts at a low level, or try to include strange fonts, you are unlikely to meet these errors.


Warnings

As well as errors TEX generates warnings. The most common are over- or under-full boxes, and font substitution warnings.

Underfull hboxes

The warning

Underfull \hbox (badness 10000) in paragraph at lines 783-784
is generated when a line-break is forced before the end of the line, leaving a line that is too short. This is up to you to deal with as a matter of æsthetics.

Overfull hboxes

Overfull boxes, however, are usually a problem:

Overfull \hbox (19.96118pt too wide) in paragraph at lines 307-309
[]\OT1/lcmss/m/n/16.59 A line de-signed to
pro-duce the warn-ing:
[] \OT1/cmtt/m/n/17.28
Overfull \hbox\OT1/lcmss/m/n/16.59 .
\end{environment}
This means that for some reason TEX was unable to format the paragraph ``nicely'' and has had to leave a line that is too long. The above message comes from the following line of text:

A line designed to produce the warning: Overfull \hbox.

As you can see TEX gives you the text of the line and the line number. A simple rewording is often enough to allow TEX to sort out the problem.

Underfull vboxes

The warning Underfull \vbox usually comes when TEX cannot fill a page to within the desired tolerance. As with underfull hboxes this is a matter of style.

Overfull vboxes

The warning


Overfull \vbox (31.44003pt too high) has 
occurred while \output is active
[1]
comes when TEX is forced to put material on a page beyond the normal bounds specified in the page size variables. You can either rearrange the page, change the dimensions or ignore it.

Font Warnings

If TEX cannot find the font with the specifications you have asked for, then it will try to substitute another font. For example

LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size $ <$13.99994$ >$ not available
(Font) size $ <$14.4$ >$ substituted on input line 195.
means that a font of size 14.4 was substituted for the requested one of size 13.99994. Probably this was what was intended anyway, so you can safely ignore it.

On the other hand the warning

LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size $ <$150$ >$ not available size
(Font) $ <$24.88$ >$ substituted on input line 195.
would mean that a font of size 24.88pt was substituted for one of size 150pt. A rather drastic difference. At the end of processing TEX will tell you if it performed any substitutions, and what the difference in size was. The previous case generates this warning:
LaTeX Font Warning: Size substitutions with
(Font) differences up to 125.12pt have occurred.


Summary of Errors and Warnings

Errors

Missing Files
If you are missing TEX system files--formats, class or style files, then either TEX was not installed correctly, you gave it the wrong name, or you are asking for a non-standard file.
Misspelling a Control Sequence Name
These are either simple and ignored, or catastrophic and TEX stops immediately.
Failure to close an environment
You are missing a brace (}), a \end{environment} or a math delimiter ($, \]) etc.
Math outside of math mode
You tried to use math symbols or commands in text mode.
Missing Fonts
You have requested a font TEX can't find.

Warnings

Underfull $ \backslash$hbox
The text is too short for the line.
Underfull $ \backslash$vbox
The text is too short for the page.
Overfull $ \backslash$hbox
The text is too long for the line.
Overfull $ \backslash$vbox
The text is too long for the page.
Font Warnings
TEX couldn't find the font in the right size, shape or series.


Printing and Previewing

When you have successfully run TEX on your document it will write a DeVice Independent (DVI) file. This file is portable: you can use it anywhere that has a driver which understands DVI files. At this stage you can either preview the file on the screen or print it.

To preview the DVI file under unix, with no more processing, you can run xdvi, a DVI previewer for X, with:

xdvi filename.dvi

If you want to use a postscript previewer instead, then you can write the DVI file to a postscript file with

dvips filename.dvi -o
which will write the file filename.ps. You may then use ghostview or gv etc. to view the postscript file.

How you print the file is completely system dependent. If you have a postscript printer called myprinter, and dvips is configured for that printer, then you may be able to print directly from the DVI file:

dvips -Pmyprinter filename.dvi
Alternatively you can do this in two steps:
dvips filename.dvi -o
lpr -Pmyprinter filename.ps

PDF files

If for some reason you absolutely insist on having a PDF (Portable Document Format) file, then this is also possible. There are at least two ways to do this. One is to run pdftex or pdflatex instead of TEX or LATEX respectively. This produces a PDF file instead of a DVI file. The disadvantage is that not all LATEX commands are implemented--although for basic use, even complicated math papers, you are unlikely to encounter such commands. Another way is to write the postscript file, and then use ps2pdf to translate the file. This is not usually a good idea because it will only write the standard postscript fonts correctly, and the default TEX fonts will be bitmapped instead--usually producing ugly or unreadable output.

As well as acroread you can use gv or xpdf to view PDF files. I recommend both of them over acroread for viewing most PDF files.

Summary


next up previous
Next: Further LATEX Up: textalk3 Previous: Using LATEX
Robert Judd
2000-12-10