?? unx29.htm
字號:
<HTML>
<HEAD>
<TITLE>UNIX Unleashed unx29.htm</TITLE>
<LINK REL="ToC" HREF="index.htm">
<LINK REL="Next" HREF="unxpt6au.htm">
<LINK REL="Previous" HREF="unx28.htm"></HEAD>
<BODY TEXT="#000000" LINK="#0000FF" VLINK="#800080" bgcolor=white>
<P><A HREF="unx28.htm"><IMG SRC="bluprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>
<A HREF="index.htm"><IMG SRC="blutoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>
<A HREF="unxpt6au.htm"><IMG SRC="blunext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>
<A HREF="index.htm"><IMG SRC="bluprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Home"></A>
</P><UL>
<LI>
<A HREF="#I1">29</A></LI>
<UL>
<LI>
<A HREF="#I2">Processing and Printing Formatted Files</A></LI>
<UL>
<UL>
<UL>
<LI>
<A HREF="#I3">By Susan Peppard</A></LI></UL></UL>
<LI>
<A HREF="#I4">Basic Printing with nroff and troff</A></LI>
<UL>
<LI>
<A HREF="#I5">Displaying and Printying nroff Files</A></LI>
<LI>
<A HREF="#I6">Differences between nroff Output and troff Output</A></LI></UL>
<LI>
<A HREF="#I7">Options for the nroff and troff Commands</A></LI>
<LI>
<A HREF="#I8">Printing Files Formatted with Macro Packages</A></LI>
<UL>
<LI>
<A HREF="#I9">Printing Files Formatted with mm</A></LI>
<UL>
<LI>
<A HREF="#I10">Using the nroff or troff Command</A></LI>
<LI>
<A HREF="#I12">Using the mm or mmt Command</A></LI>
<LI>
<A HREF="#I13">Using with ms, me, and man</A></LI></UL>
<LI>
<A HREF="#I14">Printing Files Formatted with Your Own Macro Package</A></LI>
<LI>
<A HREF="#I15">Error Messages</A></LI>
<LI>
<A HREF="#I16">Deroffing, or Removing All Traces of nroff/troff</A></LI></UL>
<LI>
<A HREF="#I17">Summary</A></LI></UL></UL></UL>
<H1 ALIGN="CENTER">
<CENTER><A ID="I1" NAME="I1">
<BR>
<FONT SIZE=5><B>29</B>
<BR></FONT></A></CENTER></H1>
<H2 ALIGN="CENTER">
<CENTER><A ID="I2" NAME="I2">
<FONT SIZE=5><B>Processing and Printing Formatted Files</B>
<BR></FONT></A></CENTER></H2>
<H5 ALIGN="CENTER">
<CENTER><A ID="I3" NAME="I3">
<FONT SIZE=3><B>By Susan Peppard</B>
<BR></FONT></A></CENTER></H5>
<P>UNIX offers a selection of commands and utilities for printing. In addition, your system probably has a number of home-grown commands. Be guided by your colleagues and system administrator. If they always use a weird little shell script called prinnumup
to send their files to the printer, you'd better use prinnumup too.
<BR></P>
<P>This chapter attempts to find a safe ground somewhere between no information at all and a lot of information that won't work on your system. If you get tired of reading "ask your system administrator," think how tired I got of typing it.
<BR></P>
<P>The truth is that systems differ. Printers differ. And new models as well as entirely new printers are popping up all over the place. This chapter should guide you through the basics and give you an understanding of what happens to your file from the
time you type troff until the neat, white pages emerge from your printer.
<BR></P>
<H3 ALIGN="CENTER">
<CENTER><A ID="I4" NAME="I4">
<FONT SIZE=4><B>Basic Printing with </B><B><I>nroff</I></B><B> and </B><B><I>troff</I></B>
<BR></FONT></A></CENTER></H3>
<P>This section covers the basics of printing with nroff and troff. As it explains the ins and outs of how nroff and troff work, it shows the command lines for printing files that contain only troff primitives.
<BR></P>
<H4 ALIGN="CENTER">
<CENTER><A ID="I5" NAME="I5">
<FONT SIZE=3><B>Displaying and Printying </B><B><I>nroff</I></B><B> Files</B>
<BR></FONT></A></CENTER></H4>
<P>nroff enables you to format your file on the screen instead of (or before) you format it on a printer. (You can do this with troff, too, if you have a graphics terminal with windowing or layering capabilities, and if your local system provides this
option.)
<BR></P>
<P>To nroff a file containing only troff primitives to the standard output device (screen), use one of these commands:
<BR></P>
<PRE>nroff filename|pg
nroff filename|more</PRE>
<P>The choice between piping to pg or to more really depends on your system. Sometimes more produces just a single line of additional text rather than a new screenful.
<BR></P>
<H4 ALIGN="CENTER">
<CENTER><A ID="I6" NAME="I6">
<FONT SIZE=3><B>Differences between </B><B><I>nroff</I></B><B> Output and </B><B><I>troff</I></B><B> Output</B>
<BR></FONT></A></CENTER></H4>
<P>Printed files will look different, depending on whether they are formatted with nroff or troff. In general, nroffed files exhibit the following characteristics: All values are treated as a number of character positions (spaces) or line spaces. Vertical
space is in multiples of a full linespace. Tabs are set every 8 characters by default. Certain troff requests are not available (for example, .fp, .lg, .ss). Text in italic font is underlined; text in bold font is emboldened by overstriking. Point size and
vertical space requests (.ps and .vs) are ignored. Right-margin justification is turned off for the mm macros.
<BR></P>
<H3 ALIGN="CENTER">
<CENTER><A ID="I7" NAME="I7">
<FONT SIZE=4><B>Options for the </B><B><I>nroff </I></B><B>and </B><B><I>troff</I></B><B> Commands</B>
<BR></FONT></A></CENTER></H3>
<P>The options shown in Table 29.1 are available with current versions of nroff and (device-independent) troff:
<BR></P>
<UL>
<LH><B>Table 29.1. </B><B>nroff</B><B>/</B><B>troff</B><B> Options</B>
<BR></LH></UL>
<TABLE BORDER>
<TR>
<TD>
<PRE><I>Option</I>
<BR></PRE>
<TD COLSPAN=2>
<PRE><I>Effect</I>
<BR></PRE>
<TR>
<TD>
<P>-e</P>
<TD COLSPAN=2>
<P>(nroff only) produces equally spaced words in adjusted lines instead of using multiples of space character</P>
<TR>
<TD>
<P>-h</P>
<TD COLSPAN=2>
<P>(nroff only) uses output tabs (instead of spaces) during horizontal spacing to spread output and reduce output character count; tab settings are assumed to be every 8 characters</P>
<TR>
<TD>
<P>-i</P>
<TD COLSPAN=2>
<P>reads from standard input after files are exhausted</P>
<TR>
<TD>
<P>-mname</P>
<TD COLSPAN=2>
<P>prepends the macro file /usr/lib/tmac.name to the input file—in other words, uses the macros in filename</P>
<TR>
<TD>
<P>-nN</P>
<TD COLSPAN=2>
<P>numbers the first output page N</P>
<TR>
<TD>
<P>-olist</P>
<TD COLSPAN=2>
<P>prints only the pages specified in list; use commas to separate page numbers; use hyphens (-) to indicate page range; -12 prints all the pages up to and including page 12; 12- prints page 12 and all subsequent pages in the file (example:
-01,3,7,12-20,35,40-)</P>
<TR>
<TD>
<P>-q</P>
<TD COLSPAN=2>
<P>invokes the simultaneous input/output of the .rd primitive; that is, the file to be processed contains at least one .rd primitive</P>
<TR>
<TD>
<P>-ran</P>
<TD COLSPAN=2>
<P>sets register a to value N; DWB (version 3.1) documentation states that register name can be no more than 1 character</P>
<TR>
<TD>
<P>-sN</P>
<TD COLSPAN=2>
<P>(nroff only) stops printing every N pages (default is N=1); this lets you add or change paper; to resume printing, use a linefeed (a newline also works if no pipeline is involved)</P>
<TR>
<TD>
<P>-Tname</P>
<TD COLSPAN=2>
<P>(troff only) prepares output for typesetter/printer specified as name; default is post</P>
<TR>
<TD>
<P>-Ttype</P>
<TD COLSPAN=2>
<P>(nroff only) prepares output for terminal (printer) specified as type; the following types should be known to any system:</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>2631</P>
<TD>
<P>Hewlett-Packard 2631 printer in regular mode</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>2631-c</P>
<TD>
<P>Hewlett-Packard 2631 printer in compressed mode</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>2631-e</P>
<TD>
<P>Hewlett-Packard 2631 printer in expanded mode</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>300</P>
<TD>
<P>DASI-300 printer</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>300-12</P>
<TD>
<P>DASI-300 terminal set to 12 pitch (12 cpi)</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>300s</P>
<TD>
<P>DASI 300s printer</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>300s-12</P>
<TD>
<P>DASI-300s printer set to 12 pitch</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>37</P>
<TD>
<P>Teletype Model 37 terminal (default)</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>382</P>
<TD>
<P>DTC-382</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>4000a</P>
<TD>
<P>Trendata 4000a terminal</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>450</P>
<TD>
<P>DASI-450 (Diablo Hyterm) printer</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>450-12</P>
<TD>
<P>DASI-450 terminal set to 12 pitch</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>832</P>
<TD>
<P>Anderson Jacobson 832 terminal</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>8510</P>
<TD>
<P>C.Itoh printer</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>lp</P>
<TD>
<P>generic name for printers that can underline and tab; all text using reverse line feeds (such as files having tables) that is sent to lp must be processed with col.</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P>tn300</P>
<TD>
<P>GE Terminet 300 terminal</P>
<TR>
<TD>
<P>-uN</P>
<TD COLSPAN=2>
<P>(nroff only) sets the emboldening factor (number of character overstrikes) to N, or to 0 if N is not specified</P>
<TR>
<TD>
<P>-z</P>
<TD COLSPAN=2>
<P>prints only messages generated by the .tm primitive; useful for debugging or, if you are using .tm, to generate a list of some kind</P></TABLE>
<H3 ALIGN="CENTER">
<CENTER><A ID="I8" NAME="I8">
<FONT SIZE=4><B>Printing Files Formatted with Macro Packages</B>
<BR></FONT></A></CENTER></H3>
<P>You can use either nroff or troff to process files formatted with the standard macro packages, mm, ms, me, and man.
<BR></P>
<HR ALIGN=CENTER>
<NOTE>
<IMG SRC="caution.gif" WIDTH = 37 HEIGHT = 35><B>CAUTION:</B> You cannot use two macro packages to format one file. The urge to do so usually arises when you want to put a manpage in a text file. It can't be done. Make separate files; better yet, put the
manpage in an appendix and refer to it in your text.
<BR></NOTE>
<HR ALIGN=CENTER>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -