% 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.
+ ".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
% and , 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"
% set initial level of headings, in register il
+ ".nr il 0" +
+ ".if '\\*[printtoc]'true' .PX\n"
+ ".nr il 1" +
+ ".bp\n"
".rm LH\n.rm RH\n"
".TC" +
+ ".nr il 1" +
+ ".rm LH\n.rm RH\n"
".bp\n"
".TC" +
+ ".nr il -1" +
% Hacked up titlepag stuff to look more reasonable. Titles and author
% names are now stored in strings, printed by the end of .
% Wake up! This uses groff-like long string names. You must use groff
% to format this.
+ ".ds mdwtitle\n"
".ds mdwsubtitle\n"
".ds mdwdate\n"
".de printabstract\n"
"..\n" +
+ "\\*[mdwtitle]\n"
".br\n"
".if !'\\*[mdwsubtitle]'' \\*[mdwsubtitle]\n"
".br\n"
".printauthor\n"
".br\n"
"\\*[mdwdate]\n"
".br\n"
".printabstract\n"
".br\n"
%
+ ".TL" +
% + ".ds mdwtitle "
+
% + ".br\n"
% ".ft R\n"
% ".SM" +
% + ".LG" +
+ ".ds mdwsubtitle "
+
+ ".ds mdwdate "
+
+ ".de printabstract\n"
".LP\n"
+ ".." +
% author needs to be set up as its own macro, fired off from .printtitle.
+ ".de printauthor" +
+ ".." +
% + ".AU" +
% + ".br" +
"\\**\n"
".FS" +
+ ".FE" +
+ ".br" +
% + ".br" +
+ ".br"
+ ".EH '"
"'''" +
+ ".OH '''"
"'" +
+ "(*" +
+ "*)" +
% New abstract given above --mdw
% + ".AB" +
% + ".AE" +
+ ".af H1 A" +
% 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).
% + ".ds printtoc true"
% + ".bp\n"
".NH \\n(il " +
+ ".NH 1+\\n(il" +
+ ".NH 2+\\n(il" +
+ ".NH 3+\\n(il" +
+ ".NH 4+\\n(il" +
+ ".NH 5+\\n(il" +
".ds h "
+ "\\*h\n"
".XS \\n%\n"
"\\*(SN \\*h\n"
".XE\n"
".nr h 1\n" % set heading flag to true
+ ".Pp" +
+ ".nr ll +1\n" % increment list level
".nr t\\n(ll 0\n" % set type of level to itemize
+ ".nr ll -1\n" % decrement list level
+ ".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" +
+ ".if \\n(ll>1 .RE\n"
".br\n"
".nr el -1\n" % decrement enumeration level
".nr ll -1\n" % decrement list level
+ ".RS\n"
".nr ll +1\n" % increment list level
".nr t\\n(ll 2\n" % set type of level to 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.
+ ".nr bi 1\n.Pp" +
+ ".IP \"\\fB"
"\\fR\"\n"
".nr bi 1" +
""
""
""
""
+ ".\[\n[ID]\n.\]" +
+ ".\[\n[ID]\n.\]\n([NOTE])"
" (-- "
"--)" +
"\\*Q"
"\\*U"
+ ".RS\n"
".nr LL \\n(LL-\\n(PI" +
+ ".nr LL \\n(LL+\\n(PI\n"
".RE" +
"\\fI"
"\\fP"
"\\fB"
"\\fR"
"\\fI"
"\\fR"
"\\fR"
"\\fR"
"\\fI"
"\\fR"
% Changed by mdw
"\\fC"
"\\fR"
% Added by mdw
"\\fI<"
">\\fR"
"[NAME] <\\fC[URL]\\fR>"
"[NAME]"
"``[NAME]''"
+ "\\#"
"\\n"
+ "\\#"
"\\n"
"??"
+ ".\[\n"
"$LIST$\n"
".\]" +
+ ".DS L\n"
".hl\n"
".ft R\n" +
+ ".hl\n"
".DE\n"
".ft P\n"
% ".Pp" + % continue previous paragraph (changed mdw)
".LP"
+ ".DS L\n"
".ft R\n" +
+ ".DE\n"
".ft P\n"
% ".Pp" + % continue previous paragraph (changed mdw)
".LP"
% tscreen added by mdw
+ ".br\n"
".po 0.75i\n"
".ll 6.0i\n"
".ft C\n"
".LP\n" % Used to be Pp
+ ".br\n"
".po 0.25i\n"
".ll 7.0i\n"
".ft R\n" % This might not be correct
".LP\n" % Used to be Pp
+ ".br\n"
".po 0.75i\n"
".ll 6.0i\n"
".nr LL 6.0i\n"
".LP\n" % Used to be Pp
+ ".br\n"
".po 0.25i\n"
".ll 7.0i\n"
".nr LL 7.0i\n"
".LP\n" % Used to be Pp
% theorems and such
+ ".sp\n"
".nr def \\n\[def\]+1\n"
".B \"Definition \\n\[def\] \"" +
+ ".ft P\n.sp" +
+ ".sp\n"
".nr prop \\n\[prop\]+1\n"
".B \"Proposition \\n\[prop\] \"" +
+ ".ft P\n.sp" +
+ ".sp\n"
".nr lemma \\n\[lemma\]+1\n"
".B \"Lemma \\n\[lemma\] \"" +
+ ".ft P\n.sp" +
+ ".sp\n"
".nr coroll \\n\[coroll\]+1\n"
".B \"Corolloary \\n\[coroll\] \"" +
+ ".ft P\n.sp" +
+ ".sp\n"
".nr proof \\n\[proof\]+1\n"
".B \"Proof \\n\[proof\] \"" +
+ ".ft P\n.sp" +
+ ".sp\n"
".nr theorem \\n\[theorem\]+1\n"
".B \"Theorem \\n\[theorem\] \"" +
+ ".ft P\n.sp" +
+ ".B\n("
")\n.I" +
% mathematics -- this nroff version needs work.
+ ".DS L" +
+ ".DE" +
+ ".DS L" +
+ ".DE" +
"{"
"} over "
"{"
"}"
" from {"
"}"
" to {"
"}"
" prod "
" int "
" sum "
% limitation: eqn only does square roots!
" sqrt {"
"}"
+ ".TS\n"
"center, tab(|) ;\n"
"[ca]." +
+ ".TE" +
"\n"
"|"
" sup {"
"}"
" sub {"
"}"
"{"
"} under "
"{"
"} bar "
" bold{"
"}"
"{"
"} vec "
% limitation: no calligraphic characters, using helvetica italics instead. Is there a better font?
"\\fI"
"\\fP"
" roman }"
"}"
+ ".br" +
% figures
% + ".KE" +
+ ".if t .PSPIC [file].ps\n"
".if n .sp 4" +
% Are TeX units properly handled by this translation of ph?
+ ".sp [VSPACE]" +