1% linuxdoc replacement file
2% translates into nroff, using ms macros
3% manpages can be processed using the man macros
4% does not use neqn for math.
5
6% Based on qwertz replacement file by Tom Gordon
7% linuxdoc mods by mdw
8
9% Groff dependencies are few.  To port to another roff:
10% 1. Check and modify, if necessary, font changes.  (e.g. In psroff the
11% same fonts have other names.)
12% 2. Check the code for including Encapsulated PostScript, generated
13% for eps elements.
14% 3. Also make versions of general.grops and math.grops, which are sed
15% scripts translating character entities into groff character references.
16
17
18<birddoc>	+	".nr PS 11\n"
19
20			% Hacked by mdw
21			".nr PI 3n\n"
22			".ds CF \\\\n\%\n"
23			".ds CH \\&\n"
24			".ds dR $\n"   % dollar, to avoid EQN conflicts
25
26			% Start with no TOC
27			".ds printtoc\n"
28
29			% Footnote style
30			".nr FF 1\n"
31
32			% James Clark's trick to prevent unintended paragraph
33			% breaks
34
35			".tr \\&\n"
36
37			% horizontal line
38			".de hl\n"
39			".br\n"
40			"\\l'\\\\n(.lu-\\\\n(.iu'\n"
41			"..\n"
42
43			% paragraph spacing
44			".if n .nr PD 1v\n"
45
46			% margins added by mdw
47                        ".nr PO 0.25i\n"
48			".po 0.25i\n"
49                        ".nr LL 7.0i\n"
50                        ".nr TL 7.0i\n"
51                        ".nr HM 0i\n"
52                        ".nr FM 0i\n"
53
54			% Turn off right-margin filling
55			".na\n"
56
57			% h is 1 if first paragraph after heading
58
59			".nr h 0\n"
60
61			% initialize heading level
62
63			".nr il 1\n"
64
65			% Number registers for list
66
67			".nr bi 0\n"  % initialize begin items
68			".nr ll 0\n"  % list level, stores current level
69			".nr el 0\n"  % current enumeration level
70
71			% Not all list levels are enumerations, as
72			% itemizations can be embedded within enumerations
73			% and vice versa
74
75			% type of list level is in \n(t\n(ll, where
76			% 0 : itemize, 1 : enumerate, 2: description
77
78			% enumerator for an enumeration level is in
79			% \n(e\n(el -- i.e. \n(e1=2 means current item of
80			% enumeration level 1 is 2
81
82			% context-sensitive paragraph macro
83
84% Bug: There's some problem using this to re-start paragraphs after the
85% </verb> and </code>, so after verb and code I insert .LP. That's fine
86% except that is loses indentation when using verb or code inside of a list.
87
88".de Pp\n"
89".ie \\\\n(ll>0 \\{\\\n"   	 % within list?
90".ie \\\\n(bi=1 \\{\\\n"   % first par element of item?
91".nr bi 0\n"	 % reset bi flag
92% if itemization, mark with a bullet
93".if \\\\n(t\\\\n(ll=0 \\{.IP \\\\(bu\\}\n" % itemize
94%  if enumeration: increment and print enumerator
95% for this enumeration level
96".if \\\\n(t\\\\n(ll=1 \\{.IP \\\\n+(e\\\\n(el.\\}\n"
97% if first par element of descrip, do nothing
98".\\}\n"
99".el .sp \n"		% subsequent par element of item
100".\\}\n"
101".el \\{\\\n"		     	% not within list
102".ie \\\\nh=1 \\{\\\n"	% first par after heading
103".LP\n"
104".nr h 0\n"	% reset h flag
105".\\}\n"
106".el .LP \n"   % Changed from .PP, mdw
107".\\}\n"
108".nh\n"
109"..\n"
110
111
112
113			% for each level, a number register is created
114			% to store its type and current item number, where
115			% -1=bullet of an itemized list.
116
117			% Format of list level enumerators
118
119			".ds f1 1\n"
120			".ds f2 a\n"
121			".ds f3 i\n"
122			".ds f4 A\n"
123
124			% Number registers for theorems
125			".nr def 0\n"
126			".nr prop 0\n"
127			".nr lemma 0\n"
128			".nr coroll 0\n"
129			".nr proof 0\n"
130			".nr theorem 0\n"
131
132			% Reference commands
133
134% redefine superscript strings so that refer tags look like [this]
135
136			".ds \[. \[\n"
137			".ds .\] \]\n"
138
139</birddoc>
140
141% set initial level of headings, in register il
142
143<article>		+	".nr il 0"		+
144</article>		+	".if '\\*[printtoc]'true' .PX\n"
145
146<report>		+ 	".nr il 1"		+
147</report>	+	".bp\n"
148			".rm LH\n.rm RH\n"
149			".TC"			+
150
151<book>		+	".nr il 1"		+
152</book>		+	".rm LH\n.rm RH\n"
153			".bp\n"
154			".TC"			+
155
156<notes>
157</notes>
158
159<manpage>	+	".nr il -1"		+
160</manpage>
161
162<progdoc>
163</progdoc>
164
165% Hacked up titlepag stuff to look more reasonable. Titles and author
166% names are now stored in strings, printed by the end of </titlepag>.
167% Wake up! This uses groff-like long string names. You must use groff
168% to format this.
169
170<titlepag>	+	".ds mdwtitle\n"
171			".ds mdwsubtitle\n"
172			".ds mdwdate\n"
173			".de printabstract\n"
174			"..\n"			+
175</titlepag>	+	"\\*[mdwtitle]\n"
176			".br\n"
177			".if !'\\*[mdwsubtitle]'' \\*[mdwsubtitle]\n"
178			".br\n"
179			".printauthor\n"
180			".br\n"
181			"\\*[mdwdate]\n"
182			".br\n"
183			".printabstract\n"
184			".br\n"
185
186%<title>		+	".TL"			+
187%</title>
188
189<title>		+	".ds mdwtitle "
190</title>	+
191
192%<subtitle>	+	".br\n"
193%			".ft R\n"
194%			".SM"		+
195%</subtitle>	+	".LG"			+
196
197<subtitle>	+	".ds mdwsubtitle "
198</subtitle>	+
199
200<date>		+	".ds mdwdate "
201</date>		+
202
203<abstract>	+ 	".de printabstract\n"
204			".LP\n"
205</abstract>	+	".."			+
206
207% author needs to be set up as its own macro, fired off from .printtitle.
208
209<author>	+ 	".de printauthor"	+
210</author>	+	".."			+
211
212%<name>		+	".AU"			+
213%</name>
214
215<name>		+	".br"			+
216</name>
217
218<and>
219</and>
220
221<thanks>			"\\**\n"
222			".FS"			+
223</thanks>	+	".FE"			+
224
225<inst>		+	".br"			+
226</inst>
227
228%<newline>	+	".br"			+
229<newline>	+	".br"
230</newline>
231
232<label>
233</label>
234
235<header>
236</header>
237
238<lhead>		+	".EH '"
239</lhead>		"'''"		+
240
241<rhead>		+	".OH '''"
242</rhead>		"'"			+
243
244<comment>	+	"(*"	+
245</comment>	+	"*)"	+
246
247% New abstract given above --mdw
248%<abstract>	+	".AB"			+
249%</abstract>	+	".AE"			+
250
251<appendix>	+ 	".af H1 A"		+
252</appendix>
253
254% limitation: no list of figures or tables.  A table of contents
255% is always generated for books and reports. Thus these next three tags
256% are no-ops
257
258% For now, no table-of-contents in ASCII output. (Uncomment this if
259% desired).
260%<toc>		+	".ds printtoc true"
261%</toc>
262
263<toc>
264</toc>
265
266<lof>
267</lof>
268
269<lot>
270</lot>
271
272<chapt>		+	".bp\n"
273			".NH \\n(il "		+
274</chapt>
275
276<sect>		+	".NH 1+\\n(il" 		+
277</sect>
278
279<sect1>		+	".NH 2+\\n(il" 	+
280</sect1>
281
282<sect2>		+	".NH 3+\\n(il"		+
283</sect2>
284
285<sect3>		+	".NH 4+\\n(il"		+
286</sect3>
287
288<sect4>		+	".NH 5+\\n(il"		+
289</sect4>
290
291<heading>		".ds h "
292</heading>	+	"\\*h\n"
293			".XS \\n%\n"
294			"\\*(SN \\*h\n"
295			".XE\n"
296			".nr h 1\n"  % set heading flag to true
297
298<p>		+	".Pp"			+
299</p>
300
301<itemize>	+	".nr ll +1\n"	   % increment list level
302			".nr t\\n(ll 0\n"    % set type of level to itemize
303</itemize>	+	".nr ll -1\n"	% decrement list level
304
305<enum>		+	".nr ll +1\n"	    % increment list level
306			".nr el +1\n"	    % increment enumeration level
307			".nr t\\n(ll 1\n"   % set type of level to enum
308			".nr e\\n(el 0 1\n" % initialize enumerator
309			".af e\\n(el \\*(f\\n(el\n" % style of enumerator
310			".if \\n(ll>1 .RS"  +
311</enum>		+	".if \\n(ll>1 .RE\n"
312			".br\n"
313			".nr el -1\n"	    % decrement enumeration level
314			".nr ll -1\n"	    % decrement list level
315
316<descrip>	+	".RS\n"
317			".nr ll +1\n"	    % increment list level
318			".nr t\\n(ll 2\n"   % set type of level to descrip
319</descrip>	+	".nr ll -1\n"	    % decrement list level
320			".RE"		+
321
322% number register bi means "begin item".  Used in the .P macro to print
323% bullets or numbers at beginning of first paragraph of an item.
324% If bi=1 then the paragraph is the first one of the item.
325
326<item>		+	".nr bi 1\n.Pp"		+
327</item>
328
329<tag>		+	".IP \"\\fB"
330</tag>			"\\fR\"\n"
331			".nr bi 1"			+
332
333<m>			""
334</m>			""
335
336<cf>			""
337</cf>			""
338
339<cite>		+	".\[\n[ID]\n.\]"	+
340</cite>
341
342<ncite>		+	".\[\n[ID]\n.\]\n([NOTE])"
343</ncite>
344
345<footnote>		" (-- "
346</footnote>		"--)"			+
347
348<sq>			"\\*Q"
349</sq>			"\\*U"
350
351<lq>		+	".RS\n"
352			".nr LL \\n(LL-\\n(PI"	+
353</lq>		+	".nr LL \\n(LL+\\n(PI\n"
354			".RE"			+
355
356<em>			"\\fI"
357</em>		 	"\\fP"
358
359<bf>			"\\fB"
360</bf>			"\\fR"
361
362<it>			"\\fI"
363</it>			"\\fR"
364
365<sf>			"\\fR"
366</sf>			"\\fR"
367
368<sl>			"\\fI"
369</sl>			"\\fR"
370
371% Changed by mdw
372<tt>			"\\fC"
373</tt>			"\\fR"
374
375% Added by mdw
376<cparam>		"\\fI<"
377</cparam>		">\\fR"
378
379<url>			"[NAME] <\\fC[URL]\\fR>"
380</url>
381
382<htmlurl>		"[NAME]"
383</htmlurl>
384
385<ref>			"``[NAME]''"
386</ref>
387
388<nidx>			+ "\\#"
389</nidx>			  "\\n"
390
391<ncdx>			+ "\\#"
392</ncdx>			  "\\n"
393
394<pageref>		"??"
395</pageref>
396
397<x>
398</x>
399
400<mc>
401</mc>
402
403<biblio>	+	".\[\n"
404			"$LIST$\n"
405			".\]"			+
406</biblio>
407
408<code>		+	".DS L\n"
409			".hl\n"
410			".ft R\n"		+
411
412</code>		+	".hl\n"
413			".DE\n"
414			".ft P\n"
415		%	".Pp"	+ % continue previous paragraph (changed mdw)
416			".LP"
417
418<verb>		+	".DS L\n"
419			".ft R\n"		+
420
421</verb>		+	".DE\n"
422			".ft P\n"
423	 	%	".Pp"	+  % continue previous paragraph (changed mdw)
424			".LP"
425
426% tscreen added by mdw
427<tscreen>       +       ".br\n"
428                        ".po 0.75i\n"
429                        ".ll 6.0i\n"
430                        ".ft C\n"
431                        ".LP\n"         % Used to be Pp
432</tscreen>      +       ".br\n"
433                        ".po 0.25i\n"
434                        ".ll 7.0i\n"
435                        ".ft R\n"       % This might not be correct
436                        ".LP\n"         % Used to be Pp
437
438<quote>         +       ".br\n"
439                        ".po 0.75i\n"
440                        ".ll 6.0i\n"
441                        ".nr LL 6.0i\n"
442                        ".LP\n"         % Used to be Pp
443</quote>        +       ".br\n"
444                        ".po 0.25i\n"
445                        ".ll 7.0i\n"
446                        ".nr LL 7.0i\n"
447                        ".LP\n"         % Used to be Pp
448
449
450
451
452% theorems and such
453
454<def>		+	".sp\n"
455			".nr def \\n\[def\]+1\n"
456			".B \"Definition \\n\[def\] \"" +
457</def>		+	".ft P\n.sp" 		+
458
459<prop>		+	".sp\n"
460			".nr prop \\n\[prop\]+1\n"
461			".B \"Proposition \\n\[prop\] \"" +
462</prop>		+	".ft P\n.sp" 		+
463
464
465<lemma>		+	".sp\n"
466			".nr lemma \\n\[lemma\]+1\n"
467			".B \"Lemma \\n\[lemma\] \""	+
468</lemma>	+	".ft P\n.sp" 		+
469
470<coroll>	+	".sp\n"
471			".nr coroll \\n\[coroll\]+1\n"
472			".B \"Corolloary \\n\[coroll\] \"" +
473</coroll>	+	".ft P\n.sp" 		+
474
475<proof>		+	".sp\n"
476			".nr proof \\n\[proof\]+1\n"
477			".B \"Proof \\n\[proof\] \""	+
478</proof>	+	".ft P\n.sp" 		+
479
480<theorem>	+	".sp\n"
481			".nr theorem \\n\[theorem\]+1\n"
482			".B \"Theorem \\n\[theorem\] \"" +
483</theorem>	+	".ft P\n.sp" 		+
484
485<thtag>		+ 	".B\n("
486</thtag>		")\n.I"			+
487
488% mathematics -- this nroff version needs work.
489
490<f>
491</f>
492
493<dm>		+	".DS L"		        +
494</dm>		+	".DE"			+
495
496<eq>		+	".DS L"			+
497</eq>		+	".DE"			+
498
499<fr>
500</fr>
501
502<nu>			"{"
503</nu>			"} over "
504
505<de>			"{"
506</de>			"}"
507
508<lim>
509</lim>
510
511<op>
512</op>
513
514<ll>			" from {"
515</ll>			"}"
516
517<ul>			" to {"
518</ul>			"}"
519
520<opd>
521</opd>
522
523<pr>			" prod "
524</pr>
525
526<in>			" int "
527</in>
528
529<sum>			" sum "
530</sum>
531
532% limitation: eqn only does square roots!
533
534<root>			" sqrt {"
535</root>			"}"
536
537<ar>		+	".TS\n"
538			"center, tab(|) ;\n"
539			"[ca]."			+
540</ar>		+	".TE"			+
541
542<arr>   		"\n"
543</arr>
544
545<arc>   		"|"
546</arc>
547
548
549<sup>			" sup {"
550</sup>			"}"
551
552<inf>			" sub {"
553</inf>			"}"
554
555
556<unl>			"{"
557</unl>			"} under "
558
559<ovl>			"{"
560</ovl>			"} bar "
561
562<rf>			" bold{"
563</rf>			"}"
564
565<v>			"{"
566</v>			"} vec "
567
568% limitation: no calligraphic characters, using helvetica italics instead.  Is there a better font?
569
570<fi>			"\\fI"
571</fi>			"\\fP"
572
573<phr>			" roman }"
574</phr>			"}"
575
576
577<tu>		+	".br"		+
578</tu>
579
580% figures
581
582<figure>	% +	".KF"			+
583</figure>	% +	".KE"			+
584
585<eps>		+  	".if t .PSPIC [file].ps\n"
586			".if n .sp 4"	  	+
587</eps>
588
589% Are TeX units properly handled by this translation of ph?
590
591<ph>		+	".sp [VSPACE]"		+
592</ph>
593
594<caption>	+	".sp\n.ce"		+
595</caption>
596
597% tables
598
599<table>		+	".KF\n.R"		+
600</table>	+	".KE"			+
601
602<tabular>	+	".TS\n"
603			"center, tab(|) ; \n"
604			"[ca]."			+
605</tabular>	+	".TE"			+
606
607<rowsep>		"\n"			+
608</rowsep>
609
610<colsep>		"|"
611</colsep>
612
613%<hline>		+	"_"			+
614% gregh
615<hline>		+	".hl\n"			+
616
617</hline>
618
619<slides>	+ 	".nr PS 18"		+
620</slides>
621
622<slide>
623</slide>	+	".bp\n\\&"			+
624
625% letters -- replacement for email, using mh format.
626
627<letter>	+	".nf"	+
628</letter>	+
629
630<from>		+ 	"From: "
631<to>		+	"To: "
632
633<address>	+	".de Ad\n"
634</address>	+	".."	+
635
636<email>			" <"
637</email>		">"
638
639<subject>	+	"Subject: "
640
641<sref>		+	"Sref: "
642<rref>		+	"In-Reply-To: "
643
644<cc>		+	"cc: "
645
646<opening>	+	".fi\n.LP"	+
647
648<closing>	+	".LP"		+
649
650<encl>		+	".XP\n"
651			"encl: "
652
653<ps>		+	".LP\np.s."
654
655
656% end of roff replacement file
657