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

📄 tmac.m

📁 早期freebsd实现
💻 M
📖 第 1 页 / 共 4 页
字号:
...\"-----------.\" .toc@read-Ci lev1 lev2 lev3 lev4 ... lev7.de toc@read-Ci.nr toc*i 0 1.while \\n+[toc*i]<8 \{\.	nr toc*hl!\\n[toc*i] \\$\\n[toc*i].\}...\"-----------.de toc@save.\" collect maxsize of mark if string Ci don't exist..if !d Ci \{\.	if !r toc*hl!\\$1 .nr toc*hl!\\$1 0.	if \\n[toc*hl!\\$1]<=\w@\\$2@ \{\.		nr toc*hl!\\$1 \w@\\$2@u+1m.	\}.\}.am toc*list.\" .toc@set level headernumber text pagenr.toc@set \\$1 "\\$2" "\\$3" \\$4\\.....\"-----------.\" level mark text pagenumber.de toc@set.if \\$1<=\\n[toc*slevel] .SP \\n[toc*spacing]u.ne 2v.na.fi.nr toc*ind 0.nr toc*i 0 1.ie d Ci \{\.	nr toc*ind +\\n[toc*hl!\\$1]u.\}.el \{\.	while \\n+[toc*i]<\\$1 \{\.		nr toc*ind +\\n[toc*hl!\\n[toc*i]]u.	\}.\}.nr toc*text \\n[toc*ind]u+\\n[toc*hl!\\$1]u.in \\n[toc*text]u.ti -\\n[toc*hl!\\$1]u.\".\" length of headernum space.nr toc*i \\n[toc*hl!\\$1]-\w@\\$2@.\".ll \\n[@ll]u-\w@\\$4@u-2m.\" ragged right ---------------------------------.ie \\$1>\\n[toc*tlevel] \{\\\$2.	sp -1\\$3\ \ \ \\$4.	br.\}.el \{\.	\" unnumbered heading --------------------.	ie '\\$2'' \{\.		in \\n[toc*ind]u\\$3\h'1m'.	\}.	\" normal heading ------------------------.	el \{\\\$2.		sp -1\\$3\h'1m'.	\}.	ll \\n[@ll]u.	sp -1.	nr toc*sep (u;\\n[.l]-\\n[.n]-\\n[.i]-\w@\\$4@)-1m\h'|\\n[.n]u'\l'\\n[toc*sep]u.'\h'1m'\\$4.\}.ll \\n[@ll]u...\"########################### module lix ############################.\" LIST OF figures, tables, exhibits and equations .nr lix*fg-nr 0 1.nr lix*tb-nr 0 1.nr lix*ec-nr 0 1.nr lix*ex-nr 0 1.aln Fg lix*fg-nr.aln Tb lix*tb-nr.aln Ec lix*ec-nr.aln Ex lix*ex-nr.\"------------.de FG.lix@print-line fg Lf \\n+[lix*fg-nr] "\\$1" "\\$2" "\\$3" "\\$4"...de TB.lix@print-line tb Lt \\n+[lix*tb-nr] "\\$1" "\\$2" "\\$3" "\\$4"...de EC.lix@print-line ec Le \\n+[lix*ec-nr] "\\$1" "\\$2" "\\$3" "\\$4"...de EX.lix@print-line ex Lx \\n+[lix*ex-nr] "\\$1" "\\$2" "\\$3" "\\$4"...\"------------.\" print line with 'figure' in the text.\" type stringvar number text override flag refname.de lix@print-line.ds lix*text "\\$4.\".ie \\n[Sectf] .ds lix*numb \\n[H1]-\\$3.el .ds lix*numb \\$3.\".ie !\\n[Of] .ds lix*ds-form .\ \ \".el .ds lix*ds-form "\ \(em\ \".nr lix*in \\n[.i].ds lix*lable \\*[Li\\$1]\ \\*[lix*numb]\\*[lix*ds-form].if !'\\$5'' \{\.	if !0\\$6 .ds lix*lable \\*[Li\\$1]\ \\$5\\*[lix*numb]\\*[lix*ds-form].	if 0\\$6=1 .ds lix*lable \\*[Li\\$1]\ \\*[lix*numb]\\$5\\*[lix*ds-form].	if 0\\$6=2 .ds lix*lable \\*[Li\\$1]\ \\$5\\*[lix*ds-form].\}.ie \\n[Sectp] .ds lix*pgnr \\*[hd*sect-pg].el .ds lix*pgnr \\n[%].\" print line if not between DS/DE.ie \\n[ds*lvl]<1 .lix@print-text "\\*[lix*lable]" "\\*[lix*text]".el .lix@embedded-text "\\*[lix*lable]" "\\*[lix*text]".\".\" save line for LIST OF XXX.if !r lix*wth\\$1 .nr lix*wth\\$1 0.if \w@\\*[lix*lable]@>\\n[lix*wth\\$1] .nr lix*wth\\$1 \w@\\*[lix*lable]@.if \\n[\\$2] .lix@ds-save \\$1 \\*[lix*pgnr] "\\$4" "\\*[lix*lable]".if !'\\$7'' .SETR \\$7 \\*[lix*numb]...\"-----------.de lix@print-text.SP \\n[Lsp]u.misc@ev-keep lix.init@reset.br.ie (\w@\\$1\\$2@)>(\\n[.l]-\\n[.i]) \{\.	in +\w@\\$1@u.	ti 0.\}.el .ce 1\fB\\$1\fP\\$2.br.ev...\" hide printout until diversion is evaluated.de lix@embedded-text\!.SP \\n[Lsp]u\!.misc@ev-keep lix\!.init@reset\!.br\!.ie (\w@\\$1\\$2@)>(\\n[.l]-\\n[.i]) \{\\!.	in +\w@\\$1@u\!.	ti 0\!.\}\!.el .ce 1\!\fB\\$1\fP\\$2\!.br\!.ev...\"------------.\" print complete list of XXXX.de lix@print-ds.\" arg: fg,tb,ec,ex text.if !\\n[Cp] .pg@next-page.\" print LIST OF XXXX.ce\\$2.SP 3.in \\n[lix*wth\\$1]u.fi.lix*ds\\$1...\"------------.\" save line of list in macro.de lix@ds-save.\" type pagenumber text.am lix*ds\\$1.lix@dsln \\$1 \\$2 "\\$3" "\\$4" \\$5\\.....\"------------.\" print appended macro.\" lix@dsln type pagenumber text headernr.de lix@dsln.nr lix*i \\n[lix*wth\\$1]-\w@\\$4@.ne 2v.nr lix*sep \\n[.l]-\\n[lix*i]-\w'\\$4\\$3\\$2'-1m-1n-\\n[.i]\h'\\n[lix*i]u'\\$4\\$3\h'1n'\l'\\n[lix*sep]u.'\h'1m'\\$2.SP \\n[toc*spacing]u...\"########################### module fnt ############################.\" some font macros..de R.ft R.ul 0...\"-----------.de fnt@switch.ul 0.ds fnt*tmp.nr fnt*prev \\n[.f].nr fnt*i 2 1.while \\n+[fnt*i]<=\\n[.$] \{\.	if \\n[fnt*i]>3 .as fnt*tmp \,.	ie (\\n[fnt*i]%2)=1 .as fnt*tmp \\$1\\$[\\n[fnt*i]].	el .as fnt*tmp \\$2\\$[\\n[fnt*i]].	if \\n[fnt*i]<\\n[.$] .as fnt*tmp \/.\}\&\\*[fnt*tmp]\f[\\n[fnt*prev]]...\"-----------.de B.ie \\n[.$] .fnt@switch \fB \f[\\n[.f]] \\$@.el .ft B...de I.ie \\n[.$] .fnt@switch \fI \f[\\n[.f]] \\$@.el .ft I...de IB.if \\n[.$] .fnt@switch \fI \fB \\$@...de BI.if \\n[.$] .fnt@switch \fB \fI \\$@...de IR.if \\n[.$] .fnt@switch \fI \fR \\$@...de RI.if \\n[.$] .fnt@switch \fR \fI \\$@...de RB.if \\n[.$] .fnt@switch \fR \fB \\$@...de BR.if \\n[.$] .fnt@switch \fB \fR \\$@...\"########################### module box ############################.\" draw a box around some text. Text will be kept on the same page..\".nr box*ll 0.\" .B1 and .B2 works like .DS.de B1.if \\n[box*ll] .@error "B1: missing B2".nr box*ll \\n[.l].nr box*ind \\n[.i].nr box*hyp \\n[.hy].nr box*wid \\n[.l]-\\n[.i].\".\" jump to new environment..ev box*ev.di box*div.in 1n.ll (u;\\n[box*wid]-1n).hy \\n[.hy]...de B2.if !\\n[box*ll] .@error "B2: missing B1".br.di.nr box*height \\n[dn].ne \\n[dn]u+1v.ll \\n[box*ll]u.in \\n[box*ind]u.nr box*y-pos \\n[.d]u.nf.box*div.fi\v'-1v+.25m'\\D'l \\n[box*wid]u 0'\\D'l 0 -\\n[box*height]u'\\D'l -\\n[box*wid]u 0'\\D'l 0 \\n[box*height]u'.br.sp -1.ev.sp .20v.in \\n[box*ind]u.ll \\n[box*ll]u.rm box*div.nr box*ll 0...\"########################### module ref ############################.nr ref*nr 0 1.nr ref*nr-width 5n.nr ref*flag 0		\" for end-of-text.ds Rf \v'-.4m'\s-3[\\n+[ref*nr]]\s0\v'.4m'.\".\" start reference.de RS.if !''\\$1' .ds \\$1 \\n[ref*nr].nr ref*flag 1.ev ref*ev.da ref*div.init@reset.ll \\n[@ll]u.in \\n[ref*nr-width]u.ti -(\w@\\n[ref*nr].@u+1n)\\n[ref*nr]..sp -1...de RF.br.if \\n[Ls] .SP \\n[Lsp]u.di.ev...\"-----------.de RP.if !d ref*div .@error "RP: No references!".nr ref*flag 0.nr ref*i 0\\$2.if \\n[ref*i]<2 .SK.SP 2.ref@print-refs.if 0\\$1<1 .nr ref*nr 0 1.if ((\\n[ref*i]=0):(\\n[ref*i]=2)) .SK...\"-----------.\" called by end-of-text!.de ref@eot-print.if \\n[ref*flag] \{\.	if \\n[D]>2 .tm Print references, called by eot.	nr ref*flag 0.	br.	misc@ev-keep ne.	init@reset\c'	bp.	ev.	ref@print-refs.\}...\"-----------.\" prints the references.de ref@print-refs.toc@save 1 "" "\\*[Rp]" \\n[%].ev ref*ev.ce\fI\\*[Rp]\fP.sp.in 0.nf.ref*div.in.rm ref*div.ev...\"########################### module app ############################.\" .nr app*nr 0 1.af app*nr A.nr app*dnr 0 1.\"------------.\" .APP name text.\" name == "" -> autonumber.de APP.\" .if \\n[.$]<2 .@error "APP: too few arguments".app@set-ind "\\$1".\".ie \\n[Aph] .app@header \\*[app*ind] "\\$2".el .bp.app@index "\\*[app*ind]" "\\$2"...\"------------.\" .APPSK name pages text.\" name == "" -> autonumber.de APPSK.if \\n[.$]<2 .@error "APPSK: too few arguments".app@set-ind "\\$1".\".ie \\n[Aph] .app@header \\*[app*ind] "\\$3".el .bp.app@index "\\*[app*ind]" "\\$3".pn +\\$2...\"------------.de app@set-ind.ie \w@\\$1@ .ds app*ind \\$1.el \{\.	if !\\n[app*dnr] \{\.		nr H1 0 1.		af H1 A.	\}.	ds app*ind \\n+[app*nr].	nr H1 \\n+[app*dnr].\}.\"	clear lower counters.nr app*i 1 1.while \\n+[app*i]<8 .nr H\\n[app*i] 0 1...\"------------.de app@index.toc@save 1 "" "\\*[App] \\$1: \\$2" \\n[%]...\"------------.\" app@heaer name text.de app@header.bp.SP (u;\\n[Lsp]*4).ce 1\s+4\fB\\*[App]\ \\$1\fP\s0.SP (u;\\n[Lsp]*2).if \w@\\$2@<\\n[.l] .ce 1\fB\s+2\\$2\s0\fP.SP (u;\\n[Lsp]*4)...\"########################### module cov ############################.\" title stored in diversion cov*title.\" abstract stored in diversion cov*abstract.\"	arg to abstract stored in cov*abs-arg.\"	indent stored in cov*abs-ind.\" number of authors stored in cov*au.\" author(s) stored in cov*au!x!y.\" author(s) title stored in cov*at!x!y.\" 	x is the author-index [1-cov*au], y is the argument-index [1-9]..\" author(s) firm stored in cov*firm.\" new date (if .ND exists) is stored in cov*new-date.\".\".ds cov*abs-name ABSTRACT.\".nr cov*au 0.de TL.if \\n[.$]>0 .ds cov*title-charge-case \\$1.if \\n[.$]>1 .ds cov*title-file-case \\$2.pg@disable-top-trap.eo.de cov*title AU...\"-------------------.de cov@title-end.ec...\"-------------------.\" .AU name [initials [loc [dept [ext [room [arg [arg [arg]]]]]]]].de AU.cov@title-end.pg@disable-top-trap.if \\n[.$]<1 .@error "AU: no arguments".nr cov*au +1.nr cov*i 0 1.while \\n[.$]>=\\n+[cov*i] \{\.	ds cov*au!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]].\}.if (\\n[.$]>=3)&(\w@\\$3@) \{\.	if d cov*location-\\$3] \{\.		ds cov*au!3!\\n[cov*au] \\*[cov*location-\\$3].	\}.\}...\"-------------------.\" .AT title1 [title2 [... [title9] ]]]].\" Well, thats all that COVEND look for..\" Must appear directly after .AU.de AT.if \\n[.$]<1 .@error "AT: no arguments".nr cov*i 0 1.while \\n[.$]>=\\n+[cov*i] \{\.	ds cov*at!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]].\}...\"-------------------.de AF.cov@title-end.if \\n[.$]<1 .@error "AF: no arguments".ds cov*firm \\$1...de AST.ds cov*abs-name \\$1...de AS.pg@disable-top-trap.if d cov*abstract .@error "AS: only one abstract allowed".if !''\\n[.z]' .@error "AS: no diversion allowed (previous .AS?)".nr cov*abs-arg 0\\$1.nr cov*abs-ind (n;0\\$2).de cov*abstract AE...de AE...\" I am planning to use mgm some time :-).ie \\n[yr]<50 .ds cov*new-date \\*[MO\\n[mo]] \\n[dy], 20\\n[yr].el .ds cov*new-date \\*[MO\\n[mo]] \\n[dy], 19\\n[yr].als DT cov*new-date.de ND.\" don't remember why I did this: .pg@disable-top-trap.ds cov*new-date \\$1...\"-------------------.\" save technical numbers..de TM.nr cov*i 0 1.while \\n[.$]>=\\n+[cov*i] .ds cov*mt-tm!\\n[cov*i] \\$[\\n[cov*i]].nr cov*mt-tm-max \\n[.$]...\"-----------------------.\" cover sheet.\" the file must have the following last lines (somewhere):.\" .pg@enable-top-trap.\" .bp 1.\" .pg@enable-trap.ds cov*mt-file!0 0.MT.ds cov*mt-file!1 0.MT.ds cov*mt-file!2 0.MT.ds cov*mt-file!3 0.MT.ds cov*mt-file!4 4.MT.ds cov*mt-file!5 5.MT.ds cov*mt-file!6 0.MT.\"------------.de MT.ie \\n[.$] \{\.	ie d cov*mt-file!\\$1 .ds cov*mt-type \\$1.	el .ds cov*mt-type 6.\}.el .ds cov*mt-type 1.ds cov*mt-addresse "\\$2.ds cov*mt-type-text "\\$1.ie d @language .ds cov*str mm/\\*[@language]_.el .ds cov*str mm/.mso \\*[cov*str]\\*[cov*mt-file!\\*[cov*mt-type]]...de COVER.ie !\\n[.$] .ds cov*cov-type ms.el .ds cov*cov-type \\$1.pg@disable-top-trap.ie d @language .ds cov*str mm/\\*[@language]_\\*[cov*cov-type].cov.el .ds cov*str mm/\\*[cov*cov-type].cov.mso \\*[cov*str]...\"########################### module qrf ############################.\" forward and backward reference thru special files..\".\" init reference system.de INITR.if \\n[.$]<1 .@error "INITR:filename missing".\" ignore if INITR has already been used.if !r qrf*pass \{\.\".	ds qrf*file \\$1.	sy test -f \\*[qrf*file].tmp.	ie \\n[systat] \{\.		\" PASS 1.		if \\n[D]=1 .tm PASS 1.		if \\n[D]>1 .tm INITR: file \\*[qrf*file].tmp, PASS 1.		nr qrf*pass 1.		open qrf*stream \\*[qrf*file].tmp.		write qrf*stream .\\\\" references for \\*[qrf*file].		close qrf*stream.	\}.	el \{\.		nr qrf*pass 2.		if \\n[D]=1 .tm PASS 2.		if \\n[D]>1 .tm INITR: file \\*[qrf*file].tmp, PASS 2.		sy mv  \\*[qrf*file].tmp  \\*[qrf*file].qrf'		so  \\*[qrf*file].qrf.	\}.\}...\"---------------.\" set a reference..de SETR.if \\n[.$]<1 .@error "SETR:reference name missing".ie !r qrf*pass .tm "SETR: No .INITR in this file".el \{\.	ds qrf*name qrf*ref-\\$1.\" probably pass two if already defined.	if \\n[qrf*pass]<2 \{\.		if \\n[D]>2 .tm SETR: ref \\*[qrf*name]=\\*[hd*toc-mark],\\n[%].		\" heading-number.		ds \\*[qrf*name]-hn \\*[hd*toc-mark].		\" page-number.		ds \\*[qrf*name]-pn \\n[%].		\".		\" append to file.		opena qrf*stream \\*[qrf*file].tmp.		write qrf*stream .ds \\*[qrf*name]-hn \\*[hd*toc-mark].		write qrf*stream .ds \\*[qrf*name]-pn \\n[%].		if !'\\$2'' .write qrf*stream .ds \\*[qrf*name]-xx \\$2.		close qrf*stream.	\}.\}...\"---------------.\" get misc-string, output <->42<-> in pass 1.\" If two arg -> set var. arg to misc-string..de GETST.if \\n[.$]<1 .@error "GETST:reference name missing".if !r qrf*pass .tm "GETST: No .INITR in this file".ds qrf*name qrf*ref-\\$1.ie \\n[qrf*pass]=2 \{\.	ie !d \\*[qrf*name]-xx .tm "GETHN:\\$1 not defined".	el \{\.		ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-xx].		el \\*[\\*[qrf*name]-xx]\c.	\}.\}.\" The answer....el <->42<->\c...\"---------------.\" get header-number, output X.X.X. in pass 1.\" If two arg -> set var. arg to header-number..de GETHN.if \\n[.$]<1 .@error "GETHN:reference name missing".if !r qrf*pass .tm "GETHN: No .INITR in this file".ds qrf*name qrf*ref-\\$1.ie \\n[qrf*pass]=2 \{\.	ie !d \\*[qrf*name]-hn .tm "GETHN:\\$1 not defined".	el \{\.		ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-hn].		el \\*[\\*[qrf*name]-hn]\c.	\}.\}.el X.X.X.\c...\"---------------.\" get page-number, output 9999 in pass 1.\" If two arg -> set var. arg to page-number..de GETPN.if \\n[.$]<1 .@error "GETPN:reference name missing".if !r qrf*pass .tm "GETPN: No .INITR in this file".ds qrf*name qrf*ref-\\$1.ie \\n[qrf*pass]=2 \{\.	ie !d \\*[qrf*name]-pn .tm "GETPN:\\$1 not defined".	el \{\.		ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-pn].		el \\*[\\*[qrf*name]-pn]\c.	\}.\}.el 9999\c...\"----------.de GETR.if \\n[.$]<1 .@error "GETR:reference name missing".ie !r qrf*pass \{\.	tm "GETR: No .INITR in this file".\}.el \{\.	if \\n[qrf*pass]=2 \{\.		GETHN \\$1 Qrfh.		GETPN \\$1 Qrfp\\*[Qrf].	\}.\}..

⌨️ 快捷键说明

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