⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch43_12.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 43] 43.12 Typesetting Overview </TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly &amp; Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly &amp; Associates, Inc."><METANAME="DC.date"CONTENT="1998-10-23T15:51:53Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="ch43_01.htm"TITLE="43. Printing"><LINKREL="prev"HREF="ch43_11.htm"TITLE="43.11 Big Letters: banner "><LINKREL="next"HREF="ch43_13.htm"TITLE="43.13 The Text Formatters nroff, troff, ditroff, ... "></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch43_11.htm"TITLE="43.11 Big Letters: banner "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 43.11 Big Letters: banner "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 43<BR>Printing</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch43_13.htm"TITLE="43.13 The Text Formatters nroff, troff, ditroff, ... "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 43.13 The Text Formatters nroff, troff, ditroff, ... "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-7740">43.12 Typesetting Overview </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-48162"></A><ACLASS="indexterm"NAME="AUTOID-48165"></A><ACLASS="indexterm"NAME="AUTOID-48168"></A>In the early '80s, one thing that made UNIX popular was that it camewith its own typesetting system. It was the first operating systemthat could really let users produce high-quality documents using laser printers. Although there are probably more fancy editorsavailable for Macintosh systems, high-quality printing is still a partof the UNIX experience.</P><PCLASS="para">In this article, we'll discuss briefly the different typesetters thatare available for UNIX. We won't describe any of the systems indetail, but we'll give enough information so that you'll know whatoptions are available.</P><DIVCLASS="sect2"><H3CLASS="sect2"><ACLASS="title"NAME="UPT-ART-7740-SECT-1.1">43.12.1 troff </A></H3><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-48175"></A>This is the grand-daddy of UNIX typesetters. It's the oldest programthat we'll discuss. It's a batch-oriented, markup-based language.This means that you insert typesetting commands directly into yourdocument. You write documents with a regular text editor, like<EMCLASS="emphasis">vi</EM> or <EMCLASS="emphasis">emacs</EM>, process them with the <EMCLASS="emphasis">troff</EM> command(or, more likely, by invoking some kind of &quot;format&quot; shell script), andsee the output on a laser printer. In fact, <EMCLASS="emphasis">troff</EM> files arereally more like &quot;programs&quot; than traditional &quot;text files.&quot;</P><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-48182"></A><ACLASS="indexterm"NAME="AUTOID-48184"></A><ACLASS="indexterm"NAME="AUTOID-48186"></A><EMCLASS="emphasis">troff</EM> comes with three preprocessors that handle equations (<EMCLASS="emphasis">eqn</EM>),tables (<EMCLASS="emphasis">tbl</EM>), and simple line drawings (<EMCLASS="emphasis">pic</EM>). Theequation and table processorsare reasonably good; the drawing program has some interestingfeatures, but really isn't worth the trouble. If you needa lot of illustrations (or high-quality illustrations), use a toollike FrameMaker or Interleaf, or some dedicated illustrationprogram, and insert the results into your <EMCLASS="emphasis">troff</EM> document.</P><PCLASS="para"><EMCLASS="emphasis">troff</EM> is surprisingly flexible, although taking advantage of itsflexibility is difficult. For example, this book was written with<EMCLASS="emphasis">troff</EM>; we've added index, cross reference, and table-of-contentspackages (see article<ACLASS="xref"HREF="ch43_13.htm"TITLE="The Text Formatters nroff, troff, ditroff, ... ">43.13</A>).Although it's obsolete, quirky, and difficult, wefind that <EMCLASS="emphasis">troff</EM> is still better for large typesetting jobs,particularly books.</P><PCLASS="para">At one time, <EMCLASS="emphasis">troff</EM> was supplied with all UNIX systems. That's nolonger true; these days, you often have to buy it as an extra-costproduct, particularly if you're using System V. Unfortunately, if<EMCLASS="emphasis">troff</EM> comes with your system, it's probably the old and moldyversion that was designed to work with a particular obsoletephototypesetter. By hacking it to death, it has been made to workwith modern printers of all sorts. But you're better off spending themoney and getting <EMCLASS="emphasis">device independent troff</EM>; you'll get muchbetter results.</P><PCLASS="para">Of course, now thatvendors are making money from <EMCLASS="emphasis">troff</EM>, some third party vendorssuch 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 <EMCLASS="emphasis">troff</EM> called<SPANCLASS="link"><EMCLASS="emphasis">groff</EM> (<ACLASS="linkend"HREF="ch43_16.htm"TITLE="groff ">43.16</A>)</SPAN>.</P></DIV><DIVCLASS="sect2"><H3CLASS="sect2"><ACLASS="title"NAME="UPT-ART-7740-SECT-1.2">43.12.2 TeX</A></H3><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-48210"></A><ACLASS="indexterm"NAME="AUTOID-48213"></A><ACLASS="indexterm"NAME="AUTOID-48215"></A><ACLASS="indexterm"NAME="AUTOID-48218"></A>TeX is a typesetting language that was designed in the '70s byDonald Knuth, primarily so he could write his <EMCLASS="emphasis">Art of ComputerProgramming</EM> books.I am not a fan of TeX, and readers of this section should beforewarned. Really, in my opinion, TeX is not much worse than <EMCLASS="emphasis">troff</EM>. But it's alsonot much better, despite many claims to the contrary.</P><PCLASS="para">TeX is a complete programming language. Like <EMCLASS="emphasis">troff</EM>, you addtypesetting commands to your text as you write it, and then processthe document with some kind of formatting command.TeX's syntax is much more like a programming language than a &quot;simplemarkup language.&quot; However, if <EMCLASS="emphasis">troff</EM>'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 betweenTeX and <EMCLASS="emphasis">troff</EM> is a toss-up; whichever you choose, the task requires a lot of black magic.</P><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-48228"></A>TeX's biggest strength is typesetting equations, for which it reallydoesn't have an equal. (<EMCLASS="emphasis">troff</EM>'s <EMCLASS="emphasis">eqn</EM> preprocessor will dothe job, but isn't anywhere near as flexible.) It doesn't have adrawing processor, though I have seen versions of <EMCLASS="emphasis">troff</EM>'s<EMCLASS="emphasis">pic</EM> preprocessor that work with TeX. However, if you needillustrations, you'll need to develop them with some other tools andinsert the results into your TeX document.</P><PCLASS="para">I think TeX's biggest drawback is its error messages.<EMCLASS="emphasis">troff</EM> has virtually no error messages. But TeX's error messagesare 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 codethat you've never seen. Yes, your input <EMCLASS="emphasis">did</EM> cause theerror&nbsp;- but, unless you know in detail how TeX works, you may neverfigure out why. Another drawback: TeX gives you incredibleflexibility. Unfortunately, you get altogether too much flexibility,and this gives people who are long on intellect but short on goodtaste the ability to create horrendously ugly output. There's noneed for <EMCLASS="emphasis">anyone</EM> to play with the algorithm for putting spacesbetween letters or words. In short: it's possible to createbeautiful documents with TeX, but it's very easy to create ugly ones.</P><PCLASS="para">TeX's biggest advantage is that it's distributed for free by theAmerican Mathematical Society. So if you need a low-cost typesettingsolution, it's definitely worth considering. [There are alsocommercial versions available.These may be preferable on thestrength of their technical support. <EMCLASS="emphasis">-EK</EM>&nbsp;]O'Reilly &amp; Associates has a Nutshell Handbook, <EMCLASS="emphasis">Making TeX Work</EM>,that shows how to combine TeX with other packages to do what you need.</P></DIV><DIVCLASS="sect2"><H3CLASS="sect2"><ACLASS="title"NAME="UPT-ART-7740-SECT-1.3">43.12.3 Scribe </A></H3><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-48244"></A><ACLASS="indexterm"NAME="AUTOID-48246"></A><ACLASS="indexterm"NAME="AUTOID-48249"></A>A few words on Scribe, only because I really thought it was a goodtool. Scribe was another &quot;batch&quot; typesetting system, like TeX and<EMCLASS="emphasis">troff</EM>. However, the authors of Scribe had a great knack forhiding complexity from the mortal user. Someone with no technicaltraining could make good-looking documents very quickly.</P><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-48254"></A><ACLASS="indexterm"NAME="AUTOID-48257"></A>Scribe was horribly overpriced, and never (to my knowledge) pricedrealistically for workstations. (I'm sure I'll hear if this is untrue!)This limited its acceptance in the workstation market.</P></DIV><DIVCLASS="sect2"><H3CLASS="sect2"><ACLASS="title"NAME="UPT-ART-7740-SECT-1.4">43.12.4 WYSIWYG Document Processors </A></H3><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-48263"></A>In the last decade, we've been bombarded with WYSIWYG documentationtools. WYSIWYG stands for &quot;What You See Is What You Get,&quot; and meansthat your workstation or<SPANCLASS="link">X terminal (<ACLASS="linkend"HREF="ch01_31.htm"TITLE="The X Window System ">1.31</A>)</SPAN>displays a realistic approximationof the printed document on the screen. When you make changes, you getimmediate feedback on what happened; you don't have to wait for thedocument to come out of the printer. Such tools are very good fordrawings and illustrations. They aren't quite as good at handlingequations, but some of them have special equation processors built-in.The drawback of the WYSIWYGis (of course) that you can't use a WYSIWYG processor effectively onan ASCII terminal.</P><PCLASS="para">We've tried several of the major WYSIWYG packages for UNIX,and we use a couple of them at O'Reilly &amp; Associates.In terms of features, they tend to leap-frog one another. In myopinion, a lot of these features (like self-modifying, or &quot;live,&quot;documents) exist mostly for marketing value. They're surprisinglyweak at handling large (book-length) documents; yes, they can do it,but the battle-scarred batch tools (Scribe, TeX, and <EMCLASS="emphasis">troff</EM>) doas good a job, or better.</P><PCLASS="para">The WYSIWYG packages are arguably easier to learn than thebatch-oriented typesetters. However, it's easy to overstate theadvantages of a graphical interface. While they're certainly easierto learn than <EMCLASS="emphasis">troff</EM> or TeX, I'm not sure how either would stack upagainst a well-designed batch document processor, like Scribe.</P><PCLASS="para">WYSIWYG processors are all added-cost products; they can be quiteexpensive. I'm not aware of any public domain or &quot;free&quot; tools, thoughsuch may exist.</P></DIV><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">ML</SPAN></P></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch43_11.htm"TITLE="43.11 Big Letters: banner "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 43.11 Big Letters: banner "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch43_13.htm"TITLE="43.13 The Text Formatters nroff, troff, ditroff, ... "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 43.13 The Text Formatters nroff, troff, ditroff, ... "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">43.11 Big Letters: banner </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">43.13 The Text Formatters nroff, troff, ditroff, ... </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed &amp; awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -