Previous Next Contents

4. 4. USING TETEX.

Theoretically, at least, you should have everything installed correctly and ready to run. teTeX is a very large system, and you want to start by learning slowly, instead of being overwhelmed by the necessary complexities of the system.

So, instead of watching TeX typeset

``Hello, World!''

as Professor Knuth suggests in the TeXbook, we'll produce a couple of teTeX's own documents through the system in order to test it.

You should be logged in as root the first time you run teTeX. If you aren't, metafont may not be able to create the necessary directories for its fonts. Metafont will complain that it can't make the directories, and you won't see any output because you will have a bunch of zero-length font characters. This is no problem. Simply log out, re-login as root, and repeat the offending operation.

Of course, it doesn't mention this in teTeX's manual. But the nice thing about teTeX is that, if you blow it, no real harm is done. It's not like a compiler, where, say, you will trash the root partition if a pointer goes astray. What, you haven't read the teTeX manual yet? Of course you haven't! It's still in the distribution in source code form, waiting to be output!

So, without further delay, you will want to read the teTeX manual. It's located in the directory

/usr/lib/teTeX/texmf/doc/tetex.
Without further adieu, type
latex TETEXDOC.tex

LaTeX will print several warnings. One of them tells you to re-run the document through LaTeX to resolve its cross-references. This is a standard procedure for building a document's Table of Contents. So, repeat the command.

The other warnings can be safely ignored. They simply are warning you that some of the ftp paths mentioned in the documentation are too wide for their alloted spaces. (If you're really inquisitive, look at one of the TeX references for a discussion of \hbox and \vbox.)

LaTeX will have generated several files from TETEXDOC.tex. The one we're interested in is TETEXDOC.dvi. This is the device-independent output that you're going to send to the printer. There are several printer drivers included with teTeX, which allow you to change the dvi file into a fax, into plain text, or print it on a HP Laserjet. There are other dvi drivers available at CTAN sites. However, the best option, in my humble opinion, is convert the file to PostScript using dvips, which is included with the package. It isn't difficult. The command


dvips TETEXDOC.dvi -o TETEXDOC.ps 

will do the job very nicely.

This is where the real work begins. (And you thought you were finished!) Dvips has invoked metafont, which is now happily generating all of the fonts that the teTeX User's Manual needs in order to print correctly. There are about half-a-dozen fonts in all, which can take anywhere from 5 minutes to several days (on a 10 MHZ 386 or something equally primitive) to generate.

If you're lucky (and rich) and have a PostScript printer, you can simply dump TETEXDOC.ps to the printer with a command like


lpr TETEXDOC.ps.

I haven't tested this, because I have a non-PostScript HP Deskjet 400 color inkjet printer connected to Chanel3's parallel port. This is where ghostscript comes into the picture. What ghostscript does is translate (actually, render) PostScript code into a form that any bitmapped output device can understand. Even though the Deskjet doesn't understand PostScript, ghostscript allows me to scale, rotate, blend, or otherwise alter text, or include graphics or colors, just like the expensive printers. A discussion of color printing is a little beyond the scope of this document, though, along with most other effects. We're going to stick to the basics for the moment.

The first thing you want to do (after dvips has completed writing TETEXDOC.ps) is invoke ghostscript to see its command line arguments, like this:


gs -help

You'll see a list of supported output devices and sundry other commands. Pick the output device that most nearly matches your printer. On Chanel3, because I generally produce black-and-white text, I use the cdjmono driver, which drives a color DeskJet in monochrome (black and white) mode.

The command line I would use is:


gs -dNOPAUSE -sDEVICE=cdjmono -sOutputFile=/tmp/gs.out TETEXDOC.ps -c quit

This will produce my HP-compatible output in the /tmp directory. It's a good idea to use a directory like /tmp, because gs can be particular about access permissions. Now you can print the file:
lpr /tmp/gs.out

Obviously, this can all go into a shell script. On my system, I have two simple scripts written, pv and pr, which simply outputs the PostScript file either to the display or the printer. Screen previewing is possible without X, but it's far from ideal. So, it's definitely worth the effort to install XFree86, or TinyX (which is what I did) in order to preview your output on the screen.

I'll probably write a HOWTO about dviware sometime in the future. Until then, the best thing to do is simply play with ghostscript to explore its various previewing options; failing that, you are strongly encouraged to use dvitty -- this will give you ascii-readable text you can page through with less or Xless. It's only an approximation of what the printed output will look like, of course, but well worth the incovenience, given the amount of paper saved.

So, until you are able to view documents easily on-screen, please recycle your paper. If possible, purchase recycled photocopy paper to print on. You don't want your workplace to look like a branch office of Georgia-Pacific.

Remember: Save a tree... kill an editor.

Robert Kiesling

Robert_A._Kiesling@macline.com ... No writing gig too small ...


Previous Next Contents