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 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
As an example of the math mode, to insert
$\alpha\leq\beta$
$ ` a ` < ` b $
` ) changes
the meaning of the next character.
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 interactive mode, then when it comes to an error TEX will display the above information and give you a ? prompt. Type
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.
Sorry, I can't find the format `myformat.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:
will try `tex.fmt'.
I can't find the format file `tex.fmt'!This is the default format and if TEX can't find it, then there is a problem with your installation.
Emergency stop.
\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.
Spelling mistakes in commands range from the innocuous to the catastrophic.
For example \nwepage instead of \newpage just produces
! Undefined control sequence. l.6 \nwepageand 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.
There are several ways you may fail to close an environment:
\end{environment}! Missing $ insertedwhen TEX encounters a macro that makes no sense in 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
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 $ insertedEither 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 (H$_2$O produces HH_2O generates an error message.
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:
FontUnless you try to use fonts at a low level, or try to include strange fonts, you are unlikely to meet these errors.\myfont=crm10 not loadable: Metric (TFM)
file not found
As well as errors TEX generates warnings. The most common are over- or under-full boxes, and font substitution warnings.
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 boxes, however, are usually a problem:
OverfullThis 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:\hbox (19.96118pt too wide) in paragraph at lines 307-309
[]\OT1/lcmss/m/n/16.59A 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}
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.
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.
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.
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 sizemeans 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.13.99994
not available
(Font) size14.4
substituted on input line 195.
On the other hand the warning
LaTeX Font Warning: Font shape `OT1/cmr/m/n' in sizewould 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:150
not available size
(Font)24.88
substituted on input line 195.
LaTeX Font Warning: Size substitutions with
(Font) differences up to 125.12pt have occurred.
\end{environment} or a math delimiter ($, \]) etc.
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 -owhich 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.dviAlternatively you can do this in two steps:
dvips filename.dvi -o
lpr -Pmyprinter filename.ps
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.