1. Create an ASCII document containing the embedded control codes with <your favorite text editor>. By convention, these documents are stored with a .tex extension.
2. Compile the document into a device-independent intermediate file with tex (or latex).
3. View and print the resulting .dvi file with xdvi.
4. Depending on your printer type, use one of the dvi printer commands (dvips, dvilj) to print the dvi file.
If you're so inclined, you can type in the sample file that follows to get a feel for how TeX works. If not, pretend you did, as the file is used repeatedly in the next several examples (see Figure 20-1).
The preceding document first needs to be compiled into a deviced independent format by using the tex command:
tex example.tex
which generates a file example.dvi. The example.dvi file looks like Figure 20-2 when viewed through a dvi reader such as xdvi:.
groff
The groff (GNU roff) system is Linux's version of the nroff/troff document formatting system. Groff is a front end for nroff and troff. nroff and troff were developed at Bell Labs and, together, make up the standard document formatting system on UNIX. For example, the man pages are created with this system.
Like TeX, groff uses embedded control codes to specify the format of the end-result document. Unlike TeX, groff can produce plain ASCII files as output.
Where TeX commands can occur anywhere on the line, groff formatting commands are the first things you see on a given line, as shown in Figure 20-3.
This code makes more sense when viewed using the man page option to groff:
groff -Tascii -man example.man
The previous code generates output like that shown in Figure 20-4.
Groff source files are compiled with the groff command and may be displayed to either an ASCII display or an X display (gxditview). (See the examples with the commands for details.)
Ghostscript is Linux's version of the PostScript (tm) typesetting system. Postscript is a vector-based language, which means that images are broken up into mathematically representable arcs, lines, and whatnot. The resultant files are system independent and scalable.
The commands covered in this section include the following:
colcrt | This command displays underlines on tables on nongraphic displays. |
eqn | This command is the groff equation formatter. |
gs | This command is ghostscript typesetting language. |
grog | This command guesses groff options. |
gxditview | This command displays groff files on X terminal. |
tbl | This command is the groff table formatter. |
tex | This command compiles TeX source file. |
troff | This command is a document formatter. (See groff.) |
xdvi | This command displays .dvi file (see tex) on X Window. |