%
%  The final and correct substitution file for article to troff.
%
%  Each macro is preceded and followed by a +,
%  forcing that the macro call is on a seperate line without
%  introducing empty lines.
%
%  October 20, new article dtd containing tree-pictures
%
<FRONT>
</FRONT>
</AFFIL>
<CHAP>
</SH>
</CHAP>
</LP>
</IP>
</PP>
%
%  Set the delimiters for eqn and define then and else as keywords
<DOC>		+	".hy 0\n"
			".PS\n"
			"forest = 0\n"
			".PE\n"
			".EQ\n"
			"delim $$\n"
			"define then 'roman{\"then\"}'\n"
			"define else 'roman{\"else\"}'\n"
			"define elsif 'roman{\"elsif\"}'\n"
			"define FROM ' from '\n"
			"define TO ' to '\n"
			".EN"			+
</DOC>
</AUTHORS>
</TITLE>
<EX-BODY>

%  The real macros

</EX>		+	".XE"			+
</EX-BODY>	+	".XB"			+
<TBL-BODY>	+	".TS"			+
</TBL-BODY>	+	".TE"			+
<PIC-BODY>	+	".PS"			+
</PIC-BODY>	+	".PE"			+
<TABLE>		+	".tS [keep]"		+
</TABLE>	+	".tE"			+
<PIC>		+	".pS [keep]"		+
</PIC>		+	".pE"			+
<FOOTNOTE>	+	".FS"			+
</FOOTNOTE>	+	".FE"			+
<ABSTRACT>	+	".AB\n"
			".hy 0"			+
</ABSTRACT>	+	".AE"			+
<AUTHORS>	+	".AU"			+
<AffIL>		+	".AI"			+
<SH>		+	".NH [lEvEl]"		+
<EX>		+	".EX [keep]"		+
<LP>		+	".LP\n"
			".hy 0"			+	
<IP>		+	".IP \"[label]\"\n"
			".hy 0"			+
<TITLE>		+	".TL"			+
<PP>		+	".LP\n"
			".hy 0"			+
<LABEL>		+	".lB"			+
</LABEL>	+	".lE"			+
<REF>		+	".\[\["			+
</REF>		+	".]]"
<form>		+	".EQ [align]"		+
</form>		+	".EN"			+
%
%  The following replacements must not be on a separate line,
%  so no +'s.
%
<ITALIC>	 	"\\fI"
</ITALIC>	 	"\\fP"
<BOLD>		 	"\\fB"
</BOLD>		 	"\\fP"
<ROMAN>		 	"\\fR"
</ROMAN>	 	"\\fP"
<COURIER>	 	"\\f5\\s9"
</COURIER>		"\\s10\\fP"
<inform>		"$"
</inform>		"$"
%
%  a forest, is a number of tree's
%
<forest>+ ".nr Ps \\\\n(.s\n"
	  ".ps 6\n"
	  ".EQ\n"
	  "gsize 8\n"
	  ".EN\n"
          ".PS\n"
	  "forest = 1\n"
	  "distance = [distance]\n"		+

</forest>+  "forest = 0\n"
	    ".PE\n"
	    ".EQ\n"
	    "gsize 10\n"
	    ".EN\n"
	    ".ps \\\\n(Ps\n"			+
%
% The root of the tree
%
<tree>  + ".nr Ps \\\\n(.s\n"
	  ".ps 6\n"
	  ".EQ\n"
	  "gsize 8\n"
	  ".EN\n"
	  ".PS\n"
	  "define LINE @ line \"$1\" \"\" from $2 to $3 chop @\n"
	  "define DASHED @ line \"$1\" \"\" dashed from $2 to $3 chop @\n"
	  "define DOTTED @ line \"$1\" \"\" dotted from $2 to $3 chop @\n"
	  "define INVIS @ line \"$1\" \"\" invis from $2 to $3 chop @\n"
	  "scale = [scale]\n"
	  "circlerad=[radius]\n"
	  "degree[id] = [degree]\n"
	  "tussen = [hspread]\n"
	  "hoogte = [vspread]\n"
	  "factor[id] = ((degree[id] - 1) / 2) * tussen\n"
	  "child[id]  = 1\n"
	  "[id]: circle invis \"[text]\""		+

</tree> + ".PE\n"
	  ".EQ\n"
	  "gsize 10\n"
	  ".EN\n"
	  ".ps \\\\n(Ps"			+

<sub-tree>  +
	  "define LINE @ line \"$1\" \"\" from $2 to $3 chop @\n"
	  "define DASHED @ line \"$1\" \"\" dashed from $2 to $3 chop @\n"
	  "define DOTTED @ line \"$1\" \"\" dotted from $2 to $3 chop @\n"
	  "define INVIS @ line \"$1\" \"\" invis from $2 to $3 chop @\n"
	  "scale = [scale]\n"
	  "circlerad=[radius]\n"
	  "degree[id] = [degree]\n"
	  "tussen = [hspread]\n"
	  "hoogte = [vspread]\n"
	  "factor[id] = ((degree[id] - 1) / 2) * tussen\n"
	  "child[id]  = 1\n"
	  "if (forest == 0) then "
	    "{[id]: circle invis \"[text]\"}\n"
	  "if (forest == 1) then "
	    "{First: [id]: circle invis \"[text]\"}\n"
	  "if (forest == 2) then "
	    "{Second: [id]: circle invis \"[text]\" at First +(distance, 0)}\n"
	  "if (forest == 3) then "
	    "{Third: [id]: circle invis \"[text]\" at Second +(distance, 0)}\n"
	  "if (forest > 0) then {forest = forest + 1}"		+

</sub-tree>
%
% nodes
%
<node>	+ "[id]: circle invis \"[text]\" at [idref] "
	  "-( ((degree[idref]-child[idref])*(tussen))-factor[idref], hoogte)\n"
	  "if (child[idref] > degree[idref]) then "
	      "{ sh @ echo <node> [id]: [idref] has too many children >`tty` @}\n"
	  "child[idref] = child[idref] + 1\n"
	  "child[id]  = 1\n"
	  "degree[id] = [degree]\n"
	  "factor[id] = ((degree[id] - 1) / 2) * tussen\n"
	  "[connect]([label], [idref], [id])"		+
%
% leaves
%
<leaf>	+ "circle invis \"[text]\" at [idref] "
	  "-( ((degree[idref]-child[idref])*(tussen))-factor[idref], hoogte)\n"
	  "if (child[idref] > degree[idref]) then "
	      "{ sh @ echo <leaf>: [idref] has too many children >`tty` @}\n"
	  "child[idref] = child[idref] + 1\n"
	  "[connect]([label], [idref], last circle)"		+

