next up previous contents
Next: e-mail Up: No Title Previous: Plotting

TeX and LaTeX typesetting

The only `wordprocessing' program on the workstation is TeX (LaTeX is simply TeX with an extra macro package, it is available also). TeX is not really a wordprocessor, it is a typesetting program. It is specifically geared towards scientific and mathematical typesetting of the highest quality. Note that TeX is not a WYSIWYG (What You See Is What You Get) program.

Incidentally, the word TeX is usually pronounced ``teck'' (although for the truely correct pronounciation, see Donald Knuth's ``TeXbook'') and LaTeX something like ``lay-teck'' or ``lah-teck''.

To use TeX you first create a file containing your text and associated TeX commands. This file is normal ASCII text, can be created using any text editor, and can be e-mailed around the world and transferred between computer systems without fear of being corrupted by communications software (unlike the output from most PC-based wordprocessors which use full 8-bit binary input files). Once you have the input file, you run TeX, or LaTeX, on it and correct any errors that appear. The error messages from TeX can be very hard to understand. The best approach is usually to note the line number of the error and then visit that line with your text editor and look for something obviously wrong. With practice you can find errors very quickly.

TeX produces a file with an extension .dvi, which stands for ``device independent output''. If you have an X-terminal you can use xdvi to preview the results before printing. To print the file you must first feed it into dvips to convert it into PostScript, which the laser printer can understand. You also view the output of dvips on an Xterminal using GhostScript (gs), which can be preferable to using xdvi, particularly if your document incorporates PostScript graphs.

Here is a complete example of the steps required

emacs                                   ! enter emacs for editing
C-x C-f myfile.tex<CR>                  ! ^x^f to open a file
{ enter your text at this point }        
C-x s                                   ! save the file
C-z                                     ! exit emacs 
                                        !  (keeping it in the background)
latex myfile                            ! run LaTeX on your file
xdvi myfile&                            ! preview output (X-terminal only)
dvips myfile                            ! convert to PostScript
lpr myfile.ps                           ! print the PostScript file
                                        !      NOTE THE .PS EXTENSION!
%emacs                                  ! go back and try again!
dvips has a number of useful switches available, for example,
dvips -n2 -p35 myfile
will print two pages beginning at page number 35. Please use these options wisely to avoid the excessive use of the printer. dvips is a locally added command and is documented in man dvips. Note that dvips will automatically make fonts using MetaFont if they are not present on the workstation (provided that the appropriate font metric file is found in /usr/local/tex/fonts/tfm). However, you should not use this as a way of generating documents at arbitrary font scalings (e.g., 0.97% of normal size) since the generation of new fonts is very cpu intensive.

When you first start using TeX you may find it difficult. However, if you need to use mathematics in your papers, TeX is almost the only way of making it look right. This document was typeset using LaTeX, and here is an example of some mathematics:

displaymath1289

which was typeset using the following line in the input file:

$$\pi=\int_{-\infty}^{+\infty}\sin x\,dx$$
This may look complex, but it has a certain logic to it. (Note that TeX won't check the correctness of your equations). As another example,

displaymath1291

was typeset with

$$\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+x}}}}}}$$
Notice how TeX took care of choosing the right sizes and positions for the square-root symbols. If you careful compare the output from these examples with that from PC-based word-processors you will notice the superior typesetting quality that is available with TeX.

mathematica can produce output in TeX form.

PostScript graphs, diagrams, and images can easily be incorporated into TeX documents. See man dvips for details.

Rather than using the normal TeX fonts, it is possible to use the Adobe PostScript fonts that are built into the laser printers. This has several advantages: (1) the Adobe fonts are generally nicer looking, particularly at small font sizes, (2) you can select arbitary point sizes without the need to run metafont, (3) the .dvi files are much smaller since the font bitmaps do not have to be sent. The disadvantage is that some of the more esoteric TeX symbols don't work correctly in PostScript. To try using PostScript fonts in a LaTeX\ document, put the argument times in the option list for the documentstyle command, e.g.,

\documentstyle[twoside,12pt,times]{article}
To use an individual font in a TeX or LaTeX document, do something along these lines

\font\myfont=ptmr at 72pt

which will define the token myfont to mean the PostScript Times Roman font at 72pt (25.4 mm high). To obtain a list of the available fonts, have a browse around /usr/local/lib/tex/fonts.

There is a public domain program called getref available which will search through a TeX document (or, in fact, any ASCII text file) and try and identify any references to the literature that you have made. This is useful for checking that the list of references in a paper matches those that you have actually referred to in the text. To use it, try

getref < inputfile > outputfile

or

getref < inputfile | less


next up previous contents
Next: e-mail Up: No Title Previous: Plotting

Michael C. B. Ashley
Fri Jun 28 13:34:23 EST 1996