43.12 Typesetting OverviewIn the early '80s, one thing that made UNIX popular was that it came with its own typesetting system. It was the first operating system that could really let users produce high-quality documents using laser printers. Although there are probably more fancy editors available for Macintosh systems, high-quality printing is still a part of the UNIX experience. In this article, we'll discuss briefly the different typesetters that are available for UNIX. We won't describe any of the systems in detail, but we'll give enough information so that you'll know what options are available. 43.12.1 troffThis is the grand-daddy of UNIX typesetters. It's the oldest program that we'll discuss. It's a batch-oriented, markup-based language. This means that you insert typesetting commands directly into your document. You write documents with a regular text editor, like vi or emacs , process them with the troff command (or, more likely, by invoking some kind of "format" shell script), and see the output on a laser printer. In fact, troff files are really more like "programs" than traditional "text files." troff comes with three preprocessors that handle equations ( eqn ), tables ( tbl ), and simple line drawings ( pic ). The equation and table processors are reasonably good; the drawing program has some interesting features, but really isn't worth the trouble. If you need a lot of illustrations (or high-quality illustrations), use a tool like FrameMaker or Interleaf, or some dedicated illustration program, and insert the results into your troff document. troff is surprisingly flexible, although taking advantage of its flexibility is difficult. For example, this book was written with troff ; we've added index, cross reference, and table-of-contents packages (see article 43.13 ). Although it's obsolete, quirky, and difficult, we find that troff is still better for large typesetting jobs, particularly books. At one time, troff was supplied with all UNIX systems. That's no longer true; these days, you often have to buy it as an extra-cost product, particularly if you're using System V. Unfortunately, if troff comes with your system, it's probably the old and moldy version that was designed to work with a particular obsolete phototypesetter. By hacking it to death, it has been made to work with modern printers of all sorts. But you're better off spending the money and getting device independent troff ; you'll get much better results. Of course, now that vendors are making money from troff , some third party vendors such as SoftQuad and Elan are selling enhanced versions. Given the language's basic warts, this is probably a good thing. The Free Software Foundation also has a version of troff called groff ( 43.16 ) . 43.12.2 TeXTeX is a typesetting language that was designed in the '70s by Donald Knuth, primarily so he could write his Art of Computer Programming books. I am not a fan of TeX, and readers of this section should be forewarned. Really, in my opinion, TeX is not much worse than troff . But it's also not much better, despite many claims to the contrary. TeX is a complete programming language. Like troff , you add typesetting commands to your text as you write it, and then process the document with some kind of formatting command. TeX's syntax is much more like a programming language than a "simple markup language." However, if troff 's syntax is graceless, TeX's is decidedly ugly. If you write a lot of software, you might like it. If you don't write software, you might get used to it with time. I don't find LaTeX (a macro package that makes TeX look like Scribe, which we'll discuss later) to be a significant improvement, though it's admittedly simpler. If you want to write your own macro package, the difference between TeX and troff is a toss-up; whichever you choose, the task requires a lot of black magic. TeX's biggest strength is typesetting equations, for which it really doesn't have an equal. ( troff 's eqn preprocessor will do the job, but isn't anywhere near as flexible.) It doesn't have a drawing processor, though I have seen versions of troff 's pic preprocessor that work with TeX. However, if you need illustrations, you'll need to develop them with some other tools and insert the results into your TeX document. I think TeX's biggest drawback is its error messages. troff has virtually no error messages. But TeX's error messages are incomprehensible or misleading, and I think that's worse. TeX messages typically complain about something going wrong inside a macro package. So you get an error message about a line of code that you've never seen. Yes, your input did cause the error - but, unless you know in detail how TeX works, you may never figure out why. Another drawback: TeX gives you incredible flexibility. Unfortunately, you get altogether too much flexibility, and this gives people who are long on intellect but short on good taste the ability to create horrendously ugly output. There's no need for anyone to play with the algorithm for putting spaces between letters or words. In short: it's possible to create beautiful documents with TeX, but it's very easy to create ugly ones. TeX's biggest advantage is that it's distributed for free by the American Mathematical Society. So if you need a low-cost typesetting solution, it's definitely worth considering. [There are also commercial versions available. These may be preferable on the strength of their technical support. -EK ] O'Reilly & Associates has a Nutshell Handbook, Making TeX Work , that shows how to combine TeX with other packages to do what you need. 43.12.3 ScribeA few words on Scribe, only because I really thought it was a good tool. Scribe was another "batch" typesetting system, like TeX and troff . However, the authors of Scribe had a great knack for hiding complexity from the mortal user. Someone with no technical training could make good-looking documents very quickly. Scribe was horribly overpriced, and never (to my knowledge) priced realistically for workstations. (I'm sure I'll hear if this is untrue!) This limited its acceptance in the workstation market. 43.12.4 WYSIWYG Document ProcessorsIn the last decade, we've been bombarded with WYSIWYG documentation tools. WYSIWYG stands for "What You See Is What You Get," and means that your workstation or X terminal ( 1.31 ) displays a realistic approximation of the printed document on the screen. When you make changes, you get immediate feedback on what happened; you don't have to wait for the document to come out of the printer. Such tools are very good for drawings and illustrations. They aren't quite as good at handling equations, but some of them have special equation processors built-in. The drawback of the WYSIWYG is (of course) that you can't use a WYSIWYG processor effectively on an ASCII terminal. We've tried several of the major WYSIWYG packages for UNIX, and we use a couple of them at O'Reilly & Associates. In terms of features, they tend to leap-frog one another. In my opinion, a lot of these features (like self-modifying, or "live," documents) exist mostly for marketing value. They're surprisingly weak at handling large (book-length) documents; yes, they can do it, but the battle-scarred batch tools (Scribe, TeX, and troff ) do as good a job, or better. The WYSIWYG packages are arguably easier to learn than the batch-oriented typesetters. However, it's easy to overstate the advantages of a graphical interface. While they're certainly easier to learn than troff or TeX, I'm not sure how either would stack up against a well-designed batch document processor, like Scribe. WYSIWYG processors are all added-cost products; they can be quite expensive. I'm not aware of any public domain or "free" tools, though such may exist. - |
|