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

📄 unx27.htm

📁 Linux Unix揭密.高质量电子书籍.对学习Linux有大帮助,欢迎下载学习.
💻 HTM
📖 第 1 页 / 共 5 页
字号:
1 pagesetup

10 R f

(\255 1 \255)2 166 1 2797 490 t

(UNIX Uleashed) 1 695 1 720 960 t

cleartomark

showpage

saveobj restore

%%EndPage: 1 1\%%Trailer

done

%%Pages: 1

%%DocumentFonts: Times-Roman</PRE>

<P>Font and point size are specified as 10 R f (10 point Roman). Text is enclosed in parentheses (which makes it easy to find). The showpage is crucial. Every page in your document needs a showpage in the PostScript file. Occasionally, PostScript output is 

truncated and the last showpage is lost. No showpage means no printed page.

<BR></P>

<H3 ALIGN="CENTER">

<CENTER><A ID="I24" NAME="I24">

<FONT SIZE=4><B>Hints for Creating a Macro Package</B>

<BR></FONT></A></CENTER></H3>

<P>The following suggestions may be helpful. Most of them are very obvious, but, since I've made all these mistakes myself at one time or another, I pass on this advice:

<BR></P>

<P>Starting from scratch is necessary if you intend to sell your macro package. If you just want to provide a nice format for your group, use ms or mm as a basis. Remove all the macros you don't need and add the ones you do need (lists from mm, if you're 
using ms, boxes from ms, if you're using mm). Don't reinvent the wheel. Copy, steal, and plagiarize.

<BR></P>

<P>Make sure to include autoindexing and automatic generation of master and chapter TOCs.

<BR></P>

<P>Write a format script for your users to send their files to the printer, preferably one that will prompt for options if they aren't given on the command line.

<BR></P>

<P>Write&#151;and use&#151;a test file that includes all the difficult macros you can think of (lists, tables, headers and footers, etc.).

<BR></P>

<P>Try to enlist one or two reliable friends to pre-test your package.

<BR></P>

<P>You'll never be able to anticipate all the weird things users do to macro packages. Start with a reasonable selection. Save lists within tables within diversions within lists for later.

<BR></P>

<P>Don't replace your current macro package with the new one while people are working. Do it at night or after sufficient warning.

<BR></P>

<P>Make sure the old macro package is accessible to your users (but not easily accessible, or they won't use your new one).

<BR></P>

<P>Don't use PostScript shading if most of your documents are Xeroxed rather than typeset. Copiers wreak havoc on shading. Also, there's always one person in your group who doesn't use a PostScript printer.

<BR></P>

<H3 ALIGN="CENTER">

<CENTER><A ID="I25" NAME="I25">

<FONT SIZE=4><B>Beyond Macro Packages</B>

<BR></FONT></A></CENTER></H3>

<P>If you've gone to the trouble of creating an entire macro package, you want it to be easy to use, and you want it to do everything your users could possible desire. This means that you should provide users with a format script. Although actual programs 

for these tools are beyond the scope of this chapter, the following hints should get you started:

<BR></P>

<UL>

<LI>The command format, entered with no arguments, should prompt users for each option; a version for experienced users should allow options to be entered on the command line.

<BR>

<BR></LI>

<LI>Your format program should invoke all the preprocessors (tbl, eqn, pic, and grap). If the file to be formatted has no pics or graps, no harm is done and very little time is wasted.

<BR>

<BR></LI>

<LI>Your program should allow users to specify the standard macro packages as well as your shiny new one. (But make your shiny new one the default.)

<BR>

<BR></LI>

<LI>Users should be able to specify a destination printer (assuming you have more than one printer available). Useful additional destinations are null and postscript.

<BR>

<BR></LI>

<LI>Users should not have to specify anything (or know anything) about a postprocessor.

<BR>

<BR></LI>

<LI>Users should see a message when their file is done processing (file sent to printer is adequate).

<BR>

<BR></LI>

<LI>Users should be able to select portrait or landscape page orientation&#151;and possibly page size.

<BR>

<BR></LI>

<LI>Your format command should be documented, and all your users should have a copy of the documentation. (If you can arrange to have your documentation added to UNIX's online manual, accessed with the man command, so much the better.)

<BR>

<BR></LI></UL>

<H3 ALIGN="CENTER">

<CENTER><A ID="I26" NAME="I26">

<FONT SIZE=4><B>Predefined Number Registers (</B><B><I>nroff/troff</I></B><B>)</B>

<BR></FONT></A></CENTER></H3>

<P>Table 26.1 lists the number registers that are predefined by troff. You can change the contents of these registers, but, whatever you do, don't use these names for your own number registers.

<BR></P>

<UL>

<LH><B>Table 26.1. Predefined Number Registers</B>

<BR></LH></UL>

<TABLE BORDER>

<TR>

<TD>

<PRE><I>Register Name</I>

<BR></PRE>

<TD>

<PRE><I>Description</I>

<BR></PRE>

<TR>

<TD>

<P>%</P>

<TD>

<P>current page number</P>

<TR>

<TD>

<P>ct</P>

<TD>

<P>character type (set by \w)</P>

<TR>

<TD>

<P>dl</P>

<TD>

<P>(maximum) width of last completed</P>

<TR>

<TD>

<P>dn</P>

<TD>

<P>height (vertical size) of last completed diversion</P>

<TR>

<TD>

<P>dw</P>

<TD>

<P>current day of the week (1-7)</P>

<TR>

<TD>

<P>dy</P>

<TD>

<P>current day of the month (1-31)</P>

<TR>

<TD>

<P>ln</P>

<TD>

<P>output line number</P>

<TR>

<TD>

<P>mo</P>

<TD>

<P>current month (1-12)</P>

<TR>

<TD>

<P>nl</P>

<TD>

<P>vertical position of last printed baseline</P>

<TR>

<TD>

<P>sb</P>

<TD>

<P>depth of string below baseline (generated by \w)</P>

<TR>

<TD>

<P>st</P>

<TD>

<P>height of string above baseline (generated by \w)</P>

<TR>

<TD>

<P>yr</P>

<TD>

<P>last 2 digits of current year</P></TABLE>

<H3 ALIGN="CENTER">

<CENTER><A ID="I27" NAME="I27">

<FONT SIZE=4><B>Predefined Read-Only Number Registers (</B><B><I>nroff/troff</I></B><B>)</B>

<BR></FONT></A></CENTER></H3>

<P>Table 26.2 lists the read-only number registers that are predefined by troff. You cannot change the contents of these registers, but you can inspect them and use their contents in condition statements and arithmetic expressions.

<BR></P>

<UL>

<LH><B>Table 26.2. Predefined Read-Only Number Registers</B>

<BR></LH></UL>

<TABLE BORDER>

<TR>

<TD>

<PRE><I>Register Name</I>

<BR></PRE>

<TD>

<PRE><I>Description</I>

<BR></PRE>

<TR>

<TD>

<P>$$</P>

<TD>

<P>process id of troff or nroff</P>

<TR>

<TD>

<P>.$</P>

<TD>

<P>number of arguments available at the current macro level</P>

<TR>

<TD>

<P>.a</P>

<TD>

<P>post-line extra line-space most recently used in \x'N'</P>

<TR>

<TD>

<P>.A</P>

<TD>

<P>set to 1 in troff if -a option used; always 1 in nroff</P>

<TR>

<TD>

<P>.b</P>

<TD>

<P>emboldening level</P>

<TR>

<TD>

<P>.c</P>

<TD>

<P>number of lines read from current input file</P>

<TR>

<TD>

<P>.d</P>

<TD>

<P>current vertical place in current diversion; equal to n1 if no diversion</P>

<TR>

<TD>

<P>.f</P>

<TD>

<P>current font number</P>

<TR>

<TD>

<P>.F</P>

<TD>

<P>current input filename</P>

<TR>

<TD>

<P>.h</P>

<TD>

<P>text baseline high-water mark on current page or diversion</P>

<TR>

<TD>

<P>.H</P>

<TD>

<P>available horizontal resolution in basic (troff) units</P>

<TR>

<TD>

<P>.I</P>

<TD>

<P>current indent</P>

<TR>

<TD>

<P>.j</P>

<TD>

<P>current ad mode</P>

<TR>

<TD>

<P>.k</P>

<TD>

<P>current output horizontal position</P>

<TR>

<TD>

<P>.l</P>

<TD>

<P>current line length</P>

<TR>

<TD>

<P>.L</P>

<TD>

<P>current ls value</P>

<TR>

<TD>

<P>.n</P>

<TD>

<P>length of text portion on previous output line</P>

<TR>

<TD>

<P>.o</P>

<TD>

<P>current page offset</P>

<TR>

⌨️ 快捷键说明

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