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

📄 tt14

📁 unix v7是最后一个广泛发布的研究型UNIX版本
💻
字号:
.NHDiversions.PPThere are numerous occasions in page layout when it is necessary to store some textfor a period of time without actually printing it.Footnotes are the most obvious example:the text of the footnote usually appears in the input well before the placeon the page where it is to be printed is reached.In fact,the place where it is output normally depends on how big it is,which implies that there must be a wayto process the footnote at leastenough to decide its sizewithout printing it..PP.UL troffprovides a mechanism called a diversionfor doing this processing.Any part of the output may be diverted into a macro insteadof being printed,and then at some convenient time the macro may be put back intothe input..PPThe command.BD .di\ xybegins a diversion _ all subsequent output is collected into the macro.BD xyuntil the command.BD .diwith no arguments is encountered.This terminates the diversion.The processed text is available at any time thereafter, simplyby giving the command.P1^xy.P2The vertical size of the last finished diversion is contained inthe built-in number register.BD dn ..PPAs a simple example,suppose we want to implement a `keep-release'operation,so that text between the commands.BD .KS and.BD .KEwill not be split across a page boundary(as for a figure or table).Clearly, when a.BD .KSis encountered, we have to begin divertingthe output so we can find out how big it is.Then when a.BD .KEis seen, we decidewhether the diverted text will fit on the current page,and print it either there if it fits, or at the top of the next page if it doesn't.So:.P1 2.ta .6i^de KS	\e" start keep^br	\e" start fresh line^ev 1	\e" collect in new environment^fi	\e" make it filled text^di XX	\e" collect in XX^^.P2.P1 2.ta .6i^de KE	\e" end keep^br	\e" get last partial line^di	\e" end diversion^if \e\en(dn>=\e\en(.t .bp   \e" bp if doesn't fit^nf	\e" bring it back in no-fill^XX	\e" text^ev	\e" return to normal environment^^.P2Recall that number register.BD nlis the current positionon the output page.Since output was being diverted, this remainsat its value when the diversion started..BD dnis the amount of text in the diversion;.BD .t(another built-in register)is the distance to the next trap,which we assume is at the bottom margin of the page.If the diversion is large enough to go past the trap,the.BD .ifis satisfied, anda.BD .bpis issued.In either case, the diverted output is then brought back with.BD .XX .It is essential to bring it back in no-fill mode so.UL troffwill do no further processing on it..PPThis is not the most general keep-release,nor is it robust in the face of all conceivable inputs,but it would require more space than we have here to write itin full generality.This section is not intendedto teach everything about diversions,but to sketch out enough that you can readexisting macro packages with some comprehension.

⌨️ 快捷键说明

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