Document Formatting with Tex

Document Formatting with Tex

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).

Figure 20-1. The file example.tex

graphics/20fig01.gif

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:.

Figure 20-2. xdvi output

graphics/20fig02.gif

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.

Figure 20-3. The file example.man

graphics/20fig03.gif

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.

Figure 20-4. The file example.man via groff

graphics/20fig04.gif

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.

 



Linux Desk Reference
Linux Desk Reference (2nd Edition)
ISBN: 0130619892
EAN: 2147483647
Year: 2000
Pages: 174
Authors: Scott Hawkins

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net