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