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

📄 ch43_13.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 43] 43.13 The Text Formatters nroff, troff, ditroff, ... </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:56Z"><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_12.htm"TITLE="43.12 Typesetting Overview "><LINKREL="next"HREF="ch43_14.htm"TITLE="43.14 nroff/troff and Macro Packages "></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_12.htm"TITLE="43.12 Typesetting Overview "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 43.12 Typesetting Overview "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_14.htm"TITLE="43.14 nroff/troff and Macro Packages "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 43.14 nroff/troff and Macro Packages "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-2520">43.13 The Text Formatters nroff, troff, ditroff, ... </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-48276"></A><ACLASS="indexterm"NAME="AUTOID-48278"></A><ACLASS="indexterm"NAME="AUTOID-48280"></A><ACLASS="indexterm"NAME="AUTOID-48282"></A><ACLASS="indexterm"NAME="AUTOID-48285"></A><ACLASS="indexterm"NAME="AUTOID-48288"></A><ACLASS="indexterm"NAME="AUTOID-48291"></A>Have you used a WYSIWYG (What You See Is What You Get) desktoppublishing program likeFrameMaker, WordPerfect, Interleaf, and so on?Then you might not have much experience with the original UNIX formatters,<EMCLASS="emphasis">nroff</EM> and <EMCLASS="emphasis">troff</EM>.</P><PCLASS="para">Instead of showing a picture of the completed document on your screen as youtype, these formatters read a <EMCLASS="emphasis">source file</EM> full of text and specialformatting commands.The formatted output goes into a file(text, PostScript, or some other format) or straight to a printer.You create and edit the source file with any text editor (like <EMCLASS="emphasis">vi</EM>).O'Reilly &amp; Associates still uses <EMCLASS="emphasis">troff</EM> to produce many of its books.For example, the start of the source file for this article looks like:</P><BLOCKQUOTECLASS="screen"><PRECLASS="screen">.Ah 2520 &quot;The Text Formatters nroff, troff, ditroff, ...&quot;Have you used a WYSIWYG (What You See Is What You Get) desktoppublishing program  like FrameMaker, WordPerfect, Interleaf and so on?Then you might not have much experience with the original UNIXformatters, \fInroff\fP and \fItroff\fP..LPInstead of showing a picture of the completed document on yourscreen as you type, these formatters read a \fIsource file\fP full...</PRE></BLOCKQUOTE><PCLASS="para">You might wonder, &quot;Why use these dinosaurs?&quot;</P><ULCLASS="itemizedlist"><LICLASS="listitem"><PCLASS="para">All UNIX systems have them or can get them, so they're portable.</P></LI><LICLASS="listitem"><PCLASS="para">The source files are usually much smaller than WYSIWYG formatters' files.</P></LI><LICLASS="listitem"><PCLASS="para">The source files are plain text with no non-printable characters; they'reeasy to copy from one system to another.For instance, I work on books on my DOS laptop, then transferthe files to UNIX for formatting.</P></LI><LICLASS="listitem"><PCLASS="para">The formatting language that's used has a powerful set of features thatgives professional typesetters (like O'Reilly &amp; Associates) excellent controlover the way the output page looks.</P></LI><LICLASS="listitem"><PCLASS="para">You can use UNIX utilities-<EMCLASS="emphasis">grep</EM>, <EMCLASS="emphasis">awk</EM>, shell scripts, and manyothers&nbsp;- to process the text.This adds even more power to the formatting setup.For example, that <CODECLASS="literal">2520</CODE> following the <CODECLASS="literal">.Ah</CODE> in theexample above is the filename. Each article in this book has anarbitrary four digit filename; this is mapped into the section numberprinted in the margin and in all the cross references throughout thebook using a system of scripts I wrote. I also built a crude outlineprocessor so that we could control the organization of the bookby changing a single file. All this was possible only because<EMCLASS="emphasis">troff</EM> wasn't forced to work alone&nbsp;- we could apply the fullpower of the UNIX environment.</P></LI></UL><PCLASS="para">Batch formatters like <EMCLASS="emphasis">nroff</EM> and <EMCLASS="emphasis">troff</EM>aren't the answer for all formatting jobs, but they'reworth looking into&nbsp;- especially for small or very complex jobs.</P><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">JP</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_12.htm"TITLE="43.12 Typesetting Overview "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 43.12 Typesetting Overview "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_14.htm"TITLE="43.14 nroff/troff and Macro Packages "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 43.14 nroff/troff and Macro Packages "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">43.12 Typesetting Overview </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.14 nroff/troff and Macro Packages </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 + -