
###############################################################################
#                                                                             #
#  Lout @Eq package for equation formatting using TeX fonts (Version 2.5)     #
#                                                                             #
#  Versions 1.0 and 1.1 by Jeffrey H. Kingston, 10 April 1995                 #
#  Based on Version 2.0 of the ordinary @Eq package.                          #
#                                                                             #
#  Version 2.0 by Jeffrey H. Kingston, April 1996 (based on @Eq 3.07).        #
#  Version 2.5 by Jeffrey H. Kingston, 8 October 2000.                        #
#                                                                             #
#  This package reimplements the ordinary @Eq package using TeX fonts, in     #
#  an attempt to make nicer-looking equations.  The fonts themselves are      #
#  downloaded with each document by the @SysPrependGraphic command below,     #
#  which increases the output file size by 252 KB.                            #
#                                                                             #
###############################################################################

@SysPrependGraphic { "teq.lpg" }

@SysDatabase @FontDef { texfonts }

export	"`" "``" "```" bin rel punct non vctr big

	space exclam universal numbersign existential percent
	ampersand suchthat parenleft parenright asteriskmath
	plus comma minus period slash zero one two three four
	five six seven eight nine colon semicolon less equal
	greater question congruent Alpha Beta Chi Delta Epsilon
	Phi Gamma Eta Iota thetaone Kappa Lambda Mu Nu Omicron
	Pi Theta Rho Sigma Tau Upsilon sigmaone Omega Xi Psi Zeta
	bracketleft therefore bracketright perpendicular underscore
	radicalex alpha beta chi delta epsilon phi gamma eta iota
	phione kappa lambda mu nu omicron pi theta rho sigma tau
	upsilon omegaone omega xi psi zeta braceleft bar braceright
	similar Upsilonone minute lessequal fraction infinity florin
	club diamond heart spade arrowboth arrowleft arrowup
	arrowright arrowdown degree plusminus second greaterequal
	multiply proportional partialdiff bullet divide notequal
	equivalence approxequal ellipsis arrowvertex arrowhorizex
	carriagereturn aleph Ifraktur Rfraktur weierstrass
	circlemultiply circleplus emptyset intersection union
	propersuperset reflexsuperset notsubset propersubset
	reflexsubset element notelement angle gradient registerserif
	copyrightserif trademarkserif product radical dotmath
	logicalnot logicaland logicalor arrowdblboth arrowdblleft
	arrowdblup arrowdblright arrowdbldown lozenge angleleft
	registersans copyrightsans trademarksans summation parenlefttp
	parenleftex parenleftbt bracketlefttp bracketleftex
	bracketleftbt bracelefttp braceleftmid braceleftbt braceex
	angleright integral integraltp integralex integralbt
	parenrighttp parenrightex parenrightbt bracketrighttp
	bracketrightex bracketrightbt bracerighttp bracerightmid
	bracerightbt

	hbar Re Im partial infty prime nabla surd top bot dbar
	triangle backslash forall exists neg circle square

	"0" "1" "2" "3" "4" "5" "6" "7" "8" "9"

	sum prod coprod int oint bcap bcup bvee bwedge bodot botimes
	boplus buplus

	"+" "-" "+-" "-+" setminus cdot times "*" circ div cap cup uplus
	sqcap sqcup triangleleft triangleright wr bigcirc bigtriangleup
	bigtriangledown vee wedge oplus ominus otimes oslash odot dagger
	daggerdbl amalg

	"<" ">" "=" "<=" prec preceq "<<" subset subseteq sqsubseteq
	in vdash smile frown ">=" succ succeq ">>" supset supseteq
	sqsupseteq ni dashv mid parallel "==" "~" "-~" asymp "~~"
	"=~" bowtie propto models doteq perp notsub notin "!=" not
	"<->" "<--" "-->" up down "<=>" "<==" "==>" dblup dbldown
	":" "::" ":="

	lpar blpar rpar brpar lbrack blbrack rbrack brbrack lbrace blbrace
	rbrace brbrace lfloor blfloor rfloor brfloor lceil blceil
	rceil brceil langle blangle rangle brangle

	";" "," col
	
	"!" "?" "%" "(" ")" "[" "]"

	arccos arcsin arctan arg cos cosh cot coth csc deg det dim exp
	gcd hom inf ker lg lim liminf limsup ln log max min Pr sec sin
	sinh supr tan tanh mod ldots cdots vdots ddots del grad
	"..." ",...," "'" "''" "'''" "''''" empty
	
	leftarrow longleftarrow dblleftarrow dbllongleftarrow
	rightarrow longrightarrow dblrightarrow dbllongrightarrow
	leftrightarrow longleftrightarrow dblleftrightarrow dbllongleftrightarrow
	mapsto longmapsto hookleftarrow hookrightarrow leadsto
	leftharpoonup rightharpoonup leftharpoondown rightharpoondown
	rightleftharpoons
	uparrow dbluparrow downarrow dbldownarrow updownarrow dblupdownarrow
	nearrow searrow swarrow nwarrow

	sup sub tsub supp on ton frac half third over from to widefrom wideto
	dot dotdot hat tilde vec dyad overbar underbar sqrt root
	nextcol above labove cabove rabove mabove
	matrix pmatrix bmatrix brmatrix fmatrix cmatrix amatrix

def @Eq                  
    body @Body
@Begin

    ###################################################################
    #                                                                 #
    #  Context-sensitive format changes.                              #
    #                                                                 #
    #  Equation formatting (according to Knuth) demands changes in    #
    #  the appearance of equations depending on context.  These are:  #
    #                                                                 #
    #     @Smaller x      Superscripts and subscripts are to be set   #
    #                     in a smaller font size.  The @Smaller       #
    #                     symbol implements this by changing the      #
    #                     f unit.                                     #
    #                                                                 #
    #     @HSqueeze x     The horizontal space surrounding binary     #
    #                     operators and relations is to be reduced    #
    #                     within superscripts and subscripts, etc.    #
    #                     The @HSqueeze symbol implements this by     #
    #                     changing the y unit, which is not used by   #
    #                     Lout but which is used by symbols @ThinGap, #
    #                     @MedGap and @ThickGap.                      #
    #                                                                 #
    #     @VSqueeze x     The vertical space taken by superscripts    #
    #                     and subscripts is to be reduced within      #
    #                     built-up fractions and under root signs.    #
    #                     The @VSqueeze symbol implements this by     #
    #                     changing the z unit, which is not used by   #
    #                     Lout but is used by the @SupGap symbol.     #
    #                                                                 #
    #  Knuth also recommends some changes that depend on whether the  #
    #  equation is displayed or inline; these are not implemented.    #
    #                                                                 #
    ###################################################################
 
    def @SpaceGap { 0.05f  }
 
    def @Smaller  right x { 0.7f @Font @SpaceGap @Space x }
 
    def @HSqueeze right x { 0.2f @YUnit x }
 
    def @VSqueeze right x { 0.7f @ZUnit x }
 
    def @SkewGap  { 0.05f  }
    def @SupGap   { 0.43zk }
    def @ThinGap  { 0.15y  }
    def @MedGap   { 0.20y  }
    def @ThickGap { 0.25y  }
    def @ColGap   { 0.8f   }
    def @RowGap   { 0.5f   }

    def "`"       { &@ThinGap  }
    def "``"      { &@MedGap   }
    def "```"     { &@ThickGap }

    def bin	right x { ``  x ``  }
    def rel	right x { ``` x ``` }
    def punct	right x {     x `   }
    def non	right x { 0c @YUnit x }
    def big	right x { 1.3f @Font @SpaceGap @Space x }

    def @Base   right x { Base @Font x }
    def @Sym	right x { {Symbol Base} @Font x }
    def @Cmsy	right x { {cmsy Base} @Font @Char x }
    def @Cmmi	right x { {cmmi Base} @Font @Char x }
    def @Cmex	right x { {cmex Base} @Font @Char x }

    def not	right x	{@HContract {@OneCol x /0co &0.5rt @Cmmi "slash"}}

    def @Top          # shrink the top of the bounding box of x by "drop"
	left drop     # needed because of inaccuracies in the AFM files
	right x
    {
	@OneRow { //0.0fo drop @VShift x }
    }

    def @Left         # shrink the left of the bounding box of x by "drop"
	left drop     # needed because of inaccuracies in the AFM files
	right x
    {
	@OneCol { &0.0fo drop @HShift x }
    }

    def @HLine
	named line { "0.05 ft setlinewidth" }
    {  
	{ "0 0 moveto xsize 0 lineto" line "stroke" } @Graphic {}
    }

    def @VLine
    {
	"0 0 moveto 0 ysize lineto 0.05 ft setlinewidth stroke" @Graphic {}
    }

    def vctr
	right x
    {
	0.5w @VShift x
    }

    def @Strut right x
    {
	@OneCol { x | @OneRow { 0.5f @High ^/ 0.5f @High } }
    }

    ###################################################################
    #                                                                 #
    #   Full names                                                    #
    #                                                                 #
    #   These symbols and their names are taken directly from the     #
    #   Adobe Systems Inc. Symbol font (see PostScript Language       #
    #   Reference Manual, pp. 256-257).  The only differences are:    #
    #                                                                 #
    #      Adobe:  theta1        Eq:  thetaone                        #
    #              sigma1             sigmaone                        #
    #              phi1               phione                          #
    #              omega1             omegaone                        #
    #                                                                 #
    #   These were needed since Lout identifiers do not have digits.  #
    #                                                                 #
    ###################################################################

    def space           { @Base  " "				}
    def exclam          { @Base "!"				}
    def universal       { @Cmsy "universal"			}
    def numbersign      { @Cmmi "sharp" 			}
    def existential     { @Cmsy "existential"			}
    def percent         { @Base "%"				}
    def ampersand       { @Base "&"				}
    def suchthat        { 0.1f @Left @Cmsy "owner"		}
    def parenleft       { @Base "("				}
    def parenright      { @Base ")"				}
    def asteriskmath    { @Cmsy "asteriskmath"			}
    def plus            { @Base "+"				}
    def comma           { @Base ","				}
    def minus           { 0.09f @Left @Cmsy "minus" 		}
    def period          { @Base "."				}
    def slash           { @Cmmi "slash"				}
    def zero            { @Sym "\060"				}
    def one             { @Sym "\061"				}
    def two             { @Sym "\062"				}
    def three           { @Sym "\063"				}
    def four            { @Sym "\064"				}
    def five            { @Sym "\065"				}
    def six             { @Sym "\066"				}
    def seven           { @Sym "\067"				}
    def eight           { @Sym "\070"				}
    def nine            { @Sym "\071"				}
    def colon           { @Base ":"				}
    def semicolon       { @Base ";"				}
    def less            { @Cmmi "less"				}
    def equal           { @OneRow {minus ^//0.07f //0.07f minus}}
    def greater         { @Cmmi "greater"			}
    def question        { @Base "?"				}
    def congruent       { @HContract @OneRow {0.05f @Left @Cmsy
			    "similar" ^//0.1f @HScale equal }	}
    def Alpha           { @Cmmi "A"				}
    def Beta            { @Cmmi "B"				}
    def Chi             { @Cmmi "X"				}
    def Delta           { @Cmmi "Delta"				}
    def Epsilon         { @Cmmi "E"				}
    def Phi             { @Cmmi "Phi"				}
    def Gamma           { @Cmmi "Gamma"				}
    def Eta             { @Cmmi "H"				}
    def Iota            { @Cmmi "I"				}
    def thetaone        { @Cmmi "theta1"			}
    def Kappa           { @Cmmi "K"				}

    def Lambda          { @Cmmi "Lambda"			}
    def Mu              { @Cmmi "M"				}
    def Nu              { @Cmmi "N"				}
    def Omicron         { @Cmmi "O"				}
    def Pi              { @Cmmi "Pi"				}
    def Theta           { @Cmmi "Theta"				}
    def Rho             { @Cmmi "P"				}
    def Sigma           { @Cmmi "Sigma"				}
    def Tau             { @Cmmi "T"				}
    def Upsilon         { @Cmmi "Upsilon"			}
    def sigmaone        { @Cmmi "sigma1"			}
    def Omega           { @Cmmi "Omega"				}
    def Xi              { @Cmmi "Xi"				}
    def Psi             { @Cmmi "Psi"				}
    def Zeta            { @Cmmi "Z"				}
    def bracketleft     { @Base "["				}
    def therefore       { @Sym "\134"				}
    def bracketright    { @Base "]"				}
    def perpendicular   { @Cmsy "perpendicular"			}
    def underscore      { @Base "_"				}
    def radicalex       { @Sym "\140"				}
    def alpha           { @Cmmi "alpha"				}
    def beta            { @Cmmi "beta"				}
    def chi             { @Cmmi "chi"				}
    def delta           { @Cmmi "delta"				}
    def epsilon         { @Cmmi "epsilon"			}
    def phi             { @Cmmi "phi"				}
    def gamma           { @Cmmi "gamma"				}
    def eta             { @Cmmi "eta"				}
    def iota            { @Cmmi "iota"				}
    def phione          { @Cmmi "phi1"				}
    def kappa           { @Cmmi "kappa"				}
    def lambda          { @Cmmi "lambda"			}
    def mu              { @Cmmi "mu"				}
    def nu              { @Cmmi "nu"				}

    def omicron         { @Cmmi "o"				}
    def pi              { @Cmmi "pi"				}
    def theta           { @Cmmi "theta"				}
    def rho             { @Cmmi "rho"				}
    def sigma           { @Cmmi "sigma"				}
    def tau             { @Cmmi "tau"				}
    def upsilon         { @Cmmi "upsilon"			}
    def omegaone        { @Cmmi "omega"				}
    def omega           { @Cmmi "omega"				}
    def xi              { @Cmmi "xi"				}
    def psi             { @Cmmi "psi"				}
    def zeta            { @Cmmi "zeta"				}
    def braceleft       { @Cmsy "braceleft"			}
    def bar             { @Cmsy "bar"				}
    def braceright      { @Cmsy "braceright"			}
    def similar         { 0.05f @Left @Cmsy "similar"		}
    def Upsilonone      { @Cmmi "Upsilon"			}
    def minute          { @Sym "\242"				}
    def lessequal       { @Cmsy "lessequal"			}
    def fraction        { @Sym "\244"				}
    def infinity        { @Cmsy "infinity"			}
    def florin          { @Cmmi "f"				}
    def club            { @Cmsy "club"				}
    def diamond         { @Cmsy "diamond"			}
    def heart           { @Cmsy "heart"				}
    def spade           { @Cmsy "spade"				}
    def arrowboth       { @Cmsy "arrowboth"			}
    def arrowleft       { @Cmsy "arrowleft"			}
    def arrowup         { @Cmsy "arrowup"			}
    def arrowright      { @Cmsy "arrowright"			}
    def arrowdown       { @Cmsy "arrowdown"			}
    def degree          { @Sym "\260"				}
    def plusminus       { @Cmsy "plusminus"			}
    def second          { @Sym "\262"				}
    def greaterequal    { @Cmsy "greaterequal"			}

    def multiply        { 0.09f @Left @Cmsy "multiply"		}
    def proportional    { @Cmsy "proportional"			}
    def partialdiff     { @Cmmi "partialdiff"			}
    def bullet          { @Cmsy "bullet"			}
    def divide          { @Cmsy "divide"			}
    def notequal        { not equal				}
    def equivalence     { @Cmsy "equivalence"			}
    def approxequal     { 0.05f @Left @Cmsy "approxequal"	}
    def ellipsis        { @Sym "\274"				}
    def arrowvertex     { vctr @Cmex "arrowvertex"		}
    def arrowhorizex    { @Sym "\276"				}
    def carriagereturn  { @Sym "\277"				}
    def aleph           { @Cmsy "aleph"				}
    def Ifraktur        { @Cmsy "Ifractur"			}
    def Rfraktur        { @Cmsy "Rfractur"			}
    def weierstrass     { @Cmmi "weierstrass"			}
    def circlemultiply  { @Cmsy "circlemultiply"		}
    def circleplus      { @Cmsy "circleplus"			}
    def emptyset        { @Cmsy "emptyset"			}
    def intersection    { @Cmsy "intersection"			}
    def union           { @Cmsy "union"				}
    def propersuperset  { 0.1f @Left @Cmsy "propersuperset"	}
    def reflexsuperset  { 0.1f @Left @Cmsy "reflexsuperset"	}
    def notsubset       { not @Cmsy "propersubset"		}
    def propersubset    { 0.1f @Left @Cmsy "propersubset"	}
    def reflexsubset    { 0.1f @Left @Cmsy "reflexsubset"	}
    def element         { 0.1f @Left @Cmsy "element"		}
    def notelement      { not element				}
    def angle           { less					}
    def gradient        { @Cmsy "nabla"				}
    def registerserif   { @Sym "\322"				}
    def copyrightserif  { @Sym "\323"				}
    def trademarkserif  { @Sym "\324"				}
    def product         { 0.6w @VShift 0.2f @Top @Cmex "producttext" }
    def radical         { vctr { 0.19f @Top @Cmex "radicalbig" }	}
    def dotmath         { @Cmsy "periodcentered"		}

    def logicalnot      { @Cmsy "logicalnot"			}
    def logicaland      { @Cmsy "logicaland"			}
    def logicalor       { @Cmsy "logicalor"			}
    def arrowdblboth    { @Cmsy "arrowdblboth"			}
    def arrowdblleft    { @Cmsy "arrowdblleft"			}
    def arrowdblup      { @Cmsy "arrowdblup"			}
    def arrowdblright   { @Cmsy "arrowdblright"			}
    def arrowdbldown    { @Cmsy "arrowdbldown"			}
    def lozenge         { @Sym "\340"				}
    def angleleft       { @Cmsy "angbracketleft"		}
    def registersans    { @Sym "\342"				}
    def copyrightsans   { @Sym "\343"				}
    def trademarksans   { @Sym "\344"				}
    def summation       { 0.6w @VShift 0.2f @Top @Cmex "summationtext"}
    def parenlefttp     { vctr @Cmex "parenlefttp"		}
    def parenleftex     { vctr @Cmex "parenleftex"		}
    def parenleftbt     { vctr @Cmex "parenleftbt"		}
    def bracketlefttp   { vctr @Cmex "bracketlefttp"		}
    def bracketleftex   { vctr @Cmex "bracketleftex"		}
    def bracketleftbt   { vctr @Cmex "bracketleftbt"		}
    def bracelefttp     { vctr @Cmex "bracelefttp"		}
    def braceleftmid    { vctr @Cmex "braceleftmid"		}
    def braceleftbt     { vctr @Cmex "braceleftbt"		}
    def braceex         { vctr @Cmex "braceex"			}
    def angleright      { @Cmsy "angbracketright"		}
    def integral        { @Cmsy "integral"			}
    def integraltp      { vctr @Cmex "bracelefttp"		}
    def integralex      { vctr @Cmex "braceex"			}
    def integralbt      { vctr @Cmex "bracerightbt"		}
    def parenrighttp    { vctr @Cmex "parenrighttp"		}
    def parenrightex    { vctr @Cmex "parenrightex"		}
    def parenrightbt    { vctr @Cmex "parenrightbt"		}
    def bracketrighttp  { vctr @Cmex "bracketrighttp"		}
    def bracketrightex  { vctr @Cmex "bracketrightex"		}
    def bracketrightbt  { vctr @Cmex "bracketrightbt"		}
    def bracerighttp    { vctr @Cmex "bracerighttp"		}
    def bracerightmid   { vctr @Cmex "bracerightmid"		}
    def bracerightbt    { vctr @Cmex "bracerightbt"		}


    ###################################################################
    #                                                                 #
    #   Short names                                                   #
    #                                                                 #
    #   These symbols, their names, and their spacing, are based on   #
    #   the list in Appendix F of Donald E. Knuth's The TeXBook.      #
    #                                                                 #
    #   Group 1 (lowercase Greek letters):  see full names above      #
    #   Group 2 (uppercase Greek letters):  see full names above      #
    #   Group 3 (calligraphic capitals):    not provided by Eq        #
    #                                                                 #
    ###################################################################

    ###################################################################
    #                                                                 #
    #   Group 4 (miscellaneous Ord symbols)                           #
    #                                                                 #
    #   Not all of Knuth's symbols are available.  The four suits     #
    #   (heartsuit, etc.), have definitions above.                    #
    #                                                                 #
    ###################################################################

    def hbar         { @OneCol { &0.1f @Base "-" ^/0.25fo h }	}
    def Re           { Rfraktur					}
    def Im           { Ifraktur					}
    def partial      { partialdiff				}
    def infty        { infinity					}
    def prime        { minute        				}
   #def emptyset     { defined above				}
    def nabla        { gradient					}
    def surd         { radical					}
    def top          { 180d @Rotate perpendicular		}
    def bot          { perpendicular				}
    def dbar         { @Cmsy "bardbl"				}
   #def angle        { defined above				}
    def backslash    { "\\"					}
    def forall       { universal				}
    def exists       { existential				}
    def neg          { logicalnot				}

    def circle       { @HContract @VContract
		      { "xsize ysize 2 div moveto"
			"xsize 2 div ysize 2 div xsize 2 div 0 360 arc"
			"0.04 ft setlinewidth stroke"
		      }
		      @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High }
		     }

    def square       { @HContract @VContract
		      { "0 0 moveto xsize 0 lineto xsize ysize lineto"
			"0 ysize lineto closepath"
			"0.04 ft setlinewidth stroke"
		      }
		      @Graphic { 0.6f @Wide 0.3f @High ^/ 0.3f @High }
		     }

    def triangle     { @HContract @VContract
		      { "0 0 moveto xsize 0 lineto"
		        "xsize 2 div ysize lineto closepath"
			"0.04 ft setlinewidth stroke"
		      }
		      @Graphic
		      { 0.3f @Wide 0.3f @High ^| ^/
		        0.3f @Wide 0.3f @High
		      }
		     }

    ###################################################################
    #                                                                 #
    #   Group 5 (digits)                                              #
    #                                                                 #
    ###################################################################

    def "0" { zero            }
    def "1" { one             }
    def "2" { two             }
    def "3" { three           }
    def "4" { four            }
    def "5" { five            }
    def "6" { six             }
    def "7" { seven           }
    def "8" { eight           }
    def "9" { nine            }


    ###################################################################
    #                                                                 #
    #   Group 6 ("Large" operators)                                   #
    #                                                                 #
    #   Knuth's large operators automatically change size depending   #
    #   on whether the equation is display or inline.  Eq does not    #
    #   do this; instead, the `big' operator must be used.            #
    #                                                                 #
    ###################################################################

    def sum	{ summation					}
    def prod	{ product					}
    def coprod  { 0.6w @VShift 0.1f @Top @Cmex "coproducttext"	}
    def int	{ 1.3f @Font vctr integral			}
    def oint	{ 1.3f @Font vctr 0.1f @Top @Cmex "contintegraltext"}
    def bcap	{ 1.3f @Font intersection			}
    def bcup	{ 1.3f @Font union				}
    def bvee	{ 1.3f @Font logicalor				}
    def bwedge	{ 1.3f @Font logicaland				}
    def bodot	{ vctr 0.1f @Top @Cmex "circledottext"		}
    def botimes	{ vctr 0.1f @Top @Cmex "circlemultiplytext"	}
    def boplus	{ vctr 0.1f @Top @Cmex "circleplustext"		}
    def buplus	{ vctr 0.1f @Top @Cmex "unionmultitext"		}

    ###################################################################
    #                                                                 #
    #   Group 7 (binary operations)                                   #
    #                                                                 #
    #   All of Knuth's symbols are available except \star, \diamond   #
    #   and \bullet; a few have been given more mnemonic names.       #
    #                                                                 #
    ###################################################################

    def "+"		{ bin plus				}
    def "-"		{ bin minus				}
    def "+-"		{ bin plusminus				}
    def "-+"		{ bin 180d @Rotate plusminus		}
    def setminus	{ bin backslash				}
    def cdot		{ bin dotmath				}
    def times		{ bin multiply				}
    def "*"		{ bin asteriskmath			}
   #def diamond		{ name used above			}
    def circ		{ bin circle				}
   #def bullet		{ name used above			}
    def div		{ bin divide				}
    def cap		{ bin intersection			}
    def cup		{ bin union				}
    def uplus		{ bin @Cmsy "unionmulti"		}
    def sqcap		{ bin @Cmsy "intersectionsq"		}
    def sqcup		{ bin @Cmsy "unionsq"			}
    def triangleleft	{ bin 90d @Rotate 0.8f @Font triangle	}
    def triangleright	{ bin "-90d" @Rotate 0.8f @Font triangle}
    def wr		{ bin @Cmsy "wreathproduct"		}
    def bigcirc		{ bin 1.2f @Font circle			}
    def bigtriangleup	{ bin 1.2f @Font triangle		}
    def bigtriangledown	{ bin 180d @Rotate 1.2f @Font triangle	}
    def vee		{ bin logicalor				}
    def wedge		{ bin logicaland			}
    def oplus		{ bin circleplus			}
    def ominus		{ bin @Cmsy "circleminus"		}
    def otimes		{ bin circlemultiply			}
    def oslash		{ bin @Cmsy "circledivide"		}
    def odot		{ bin @Cmsy "circledot"			}
    def dagger		{ bin @Cmsy "dagger"			}
    def daggerdbl	{ bin @Cmsy "daggerdbl"			}
    def amalg		{ bin vctr @Cmsy "coproduct"		}

    ###################################################################
    #                                                                 #
    #   Group 8 (relations)                                           #
    #                                                                 #
    #   All Knuth's operators are available, but many have been       #
    #   given different, more mnemonic names.  Also included is       #
    #   a not operator for negating the relations (at top of file).   #
    #                                                                 #
    ###################################################################

    def "<"		{ rel less				}
    def ">"		{ rel greater				}
    def "="		{ rel equal				}
    def "<="		{ rel lessequal				}
    def prec		{ rel 0.1f @Left @Cmsy "precedes"	}
    def preceq		{ rel 0.1f @Left @Cmsy "precedesequal"	}
    def "<<"		{ rel @Cmsy "lessmuch"			}
    def subset		{ rel propersubset			}
    def subseteq	{ rel reflexsubset			}
    def sqsubseteq	{ rel @Cmsy "subsetsqequal"		}
    def in		{ rel element				}
    def vdash		{ rel @Cmsy "turnstileleft"		}
    def smile		{ rel @Cmmi "slurbelow"			}
    def frown		{ rel @Cmmi "slurabove"			}

    def ">="		{ rel greaterequal			}
    def succ		{ rel 0.1f @Left @Cmsy "follows"	}
    def succeq		{ rel 0.1f @Left @Cmsy "followsequal"	}
    def ">>"		{ rel @Cmsy "greatermuch"		}
    def supset		{ rel propersuperset			}
    def supseteq	{ rel reflexsuperset			}
    def sqsupseteq	{ rel @Cmsy "supersetsqequal"		}
    def ni		{ rel 0.1f @Left @Cmsy "owner"		}
    def dashv		{ rel @Cmsy "turnstileright"		}
    def mid		{ rel @Cmsy "bar"			}
    def parallel	{ rel @Cmsy "bardbl"			}

    def "=="		{ rel equivalence			}
    def "~"		{ rel similar				}
    def "-~"		{ rel 0.05f @Left @Cmsy "similarequal"	}
    def asymp		{ rel @Cmsy "equivasymptotic"		}
    def "~~"		{ rel approxequal			}
    def "=~"		{ rel congruent				}
    def bowtie		{ rel{non triangleright non triangleleft}}
    def propto		{ rel proportional			}
    def models		{ rel{@Base vctr "|" &0.05fo vctr equal}}
    def doteq		{ rel @OneRow @HContract {&0.5rt dotmath^/0.15f equal}}
    def perp		{ rel perpendicular			}

    def notsub		{ rel notsubset				}
    def notin		{ rel notelement			}
    def "!="		{ rel notequal				}

    def "<->"		{ rel arrowboth				}
    def "<--"		{ rel arrowleft				}
    def "-->"		{ rel arrowright			}
    def up		{ rel arrowup				}
    def down		{ rel arrowdown				}
    def "<=>"		{ rel arrowdblboth			}
    def "<=="		{ rel arrowdblleft			}
    def "==>"		{ rel arrowdblright			}
    def dblup		{ rel arrowdblup			}
    def dbldown		{ rel arrowdbldown			}

    def ":"		{ rel colon				}
    def "::"		{ rel @OneCol {colon ` colon}		}
    def ":="		{ rel { colon{ //0.03fo ` equal} }	}



    ###################################################################
    #                                                                 #
    #   Groups 11 and 12 - openings and closings.                     #
    #                                                                 #
    ###################################################################

    def lpar	{ parenleft			}
    def rpar	{ parenright			}
    def lbrack	{ bracketleft			}
    def rbrack	{ bracketright			}
    def lbrace	{ braceleft			}
    def rbrace	{ braceright			}
    def lfloor	{ @Cmsy "floorleft"		}
    def rfloor	{ @Cmsy "floorright"		}
    def lceil	{ @Cmsy "ceilingleft"		}
    def rceil	{ @Cmsy "ceilingright"		}
    def langle	{ angleleft			}
    def rangle	{ angleright			}

    def blpar	{ vctr 0.1f @Top 0.2f @Left @Cmex "parenleftBigg"	}
    def brpar	{ vctr 0.1f @Top @Cmex "parenrightBigg"			}
    def blbrack	{ vctr 0.1f @Top 0.2f @Left @Cmex "bracketleftBigg"	}
    def brbrack	{ vctr 0.1f @Top @Cmex "bracketrightBigg"		}
    def blbrace	{ vctr 0.1f @Top 0.2f @Left @Cmex "braceleftBigg"	}
    def brbrace	{ vctr 0.1f @Top @Cmex "bracerightBigg"			}
    def blfloor	{ vctr 0.1f @Top 0.2f @Left @Cmex "floorleftBigg"	}
    def brfloor	{ vctr 0.1f @Top @Cmex "floorrightBigg"			}
    def blceil	{ vctr 0.1f @Top 0.2f @Left @Cmex "ceilingleftBigg"	}
    def brceil	{ vctr 0.1f @Top @Cmex "ceilingrightBigg"		}
    def blangle	{ vctr 0.1f @Top 0.2f @Left @Cmex "angbracketleftBigg"	}
    def brangle	{ vctr 0.1f @Top @Cmex "angbracketrightBigg"		}


    ###################################################################
    #                                                                 #
    #   Group 13 - punctuation.                                       #
    #                                                                 #
    ###################################################################

    def ";"     { punct semicolon     }
    def ","     { punct comma         }
    def col     { punct colon         }


    ###################################################################
    #                                                                 #
    #   Additional short symbols (Knuth p. 132)                       #
    #                                                                 #
    ###################################################################

    def "!" { exclam          }
    def "?" { question        }
    def "%" { percent         }
    def "(" { parenleft       }
    def ")" { parenright      }
    def "[" { bracketleft     }
    def "]" { bracketright    }


    ###################################################################
    #                                                                 #
    #   Common mathematical functions (from Knuth p. 162).            #
    #   mod is included, since @Rel mod is easily typed if needed.    #
    #                                                                 #
    ###################################################################

    def arccos	{ @Base "arccos"	}
    def arcsin	{ @Base "arcsin"	}
    def arctan	{ @Base "arctan"	}
    def arg	{ @Base "arg"		}
    def cos	{ @Base "cos"		}
    def cosh	{ @Base "cosh"		}
    def cot	{ @Base "cot"		}
    def coth	{ @Base "coth"		}
    def csc	{ @Base "csc"		}
    def deg	{ @Base "deg"		}
    def det	{ @Base "det"		}
    def dim	{ @Base "dim"		}
    def exp	{ @Base "exp"		}
    def gcd	{ @Base "gcd"		}
    def hom	{ @Base "hom"		}
    def inf	{ @Base "inf"		}
    def ker	{ @Base "ker"		}
    def lg	{ @Base "lg"		}
    def lim	{ @Base "lim"		}
    def liminf	{ @OneCol { @Base "lim" ` @Base "inf" }	}
    def limsup	{ @OneCol { @Base "lim" ` @Base "sup" }	}
    def ln	{ @Base "ln"		}
    def log	{ @Base "log"		}
    def max	{ @Base "max"		}
    def min	{ @Base "min"		}
    def Pr	{ @Base "Pr"		}
    def sec	{ @Base "sec"		}
    def sin	{ @Base "sin"		}
    def sinh	{ @Base "sinh"		}
    def supr	{ @Base "sup"		}
    def tan	{ @Base "tan"		}
    def tanh	{ @Base "tanh"		}
    def mod	{ @Base "mod"		}


    ###################################################################
    #                                                                 #
    #  Arrow symbols.                                                 #
    #                                                                 #
    ###################################################################

    def leftarrow		{ @Cmsy "arrowleft" }
    def longleftarrow		{ { 1.6 1 } @Scale @Cmsy "arrowleft" }
    def dblleftarrow		{ @Cmsy "arrowdblleft" }
    def dbllongleftarrow	{ { 1.6 1 } @Scale @Cmsy "arrowdblleft" }
    def rightarrow		{ @Cmsy "arrowright" }
    def longrightarrow		{ { 1.6 1 } @Scale @Cmsy "arrowright" }
    def dblrightarrow		{ @Cmsy "arrowdblright" }
    def dbllongrightarrow	{ { 1.6 1 } @Scale @Cmsy "arrowdblright" }
    def leftrightarrow		{ @Cmsy "arrowboth" }
    def longleftrightarrow	{ { 1.6 1 } @Scale @Cmsy "arrowboth" }
    def dblleftrightarrow	{ @Cmsy "arrowdblboth" }
    def dbllongleftrightarrow	{ { 1.6 1 } @Scale @Cmsy "arrowdblboth" }

    def mapsto		{ @HContract { @Cmsy "mapsto" & @Cmsy "arrowright" } }
    def longmapsto		{ { 1.6 1 } @Scale mapsto }

    def hookleftarrow
    {
	@HContract {
	    @Cmsy "arrowleft" & &0fo "0.1f" @HShift @Cmmi "arrowhookright"
	}
    }

    def hookrightarrow
    {
	@HContract {
	    @Cmmi "arrowhookleft" & &0fo "0.1f" @HShift @Cmsy "arrowright"
	}
    }

    def leftharpoonup		{ @Cmmi "arrowlefttophalf" }
    def rightharpoonup		{ @Cmmi "arrowrighttophalf" }
    def leftharpoondown		{ @Cmmi "arrowleftbothalf" }
    def rightharpoondown	{ @Cmmi "arrowrightbothalf" }
    def rightleftharpoons
    {
	@HContract @VContract {
		rightharpoonup
		^//0.1fo
		 //0.1fo
		leftharpoondown
	}
    }

    def leadsto		{ @HContract { similar &0.4fo arrowright } }

    def uparrow		{ @Cmsy "arrowup" }
    def dbluparrow	{ @Cmsy "arrowdblup" }
    def downarrow	{ @Cmsy "arrowdown" }
    def dbldownarrow	{ @Cmsy "arrowdbldown" }
    def updownarrow	{ @Cmsy "arrowbothv" }
    def dblupdownarrow	{ @Cmsy "arrowdblbothv" }
    def nearrow		{ @Cmsy "arrownortheast" }
    def searrow		{ @Cmsy "arrowsoutheast" }
    def swarrow		{ @Cmsy "arrowsouthwest" }
    def nwarrow		{ @Cmsy "arrownorthwest" }



    ###################################################################
    #                                                                 #
    #   Other symbols taken from TeX.                                 #
    #                                                                 #
    ###################################################################

    def ldots { .       &0.3f .       &0.3f .			}
    def cdots { dotmath &0.3f dotmath &0.3f dotmath		}
    def vdots { @OneRow { dotmath ^/0.3f dotmath /0.3f dotmath } }
    def ddots { @OneCol @OneRow
	       {        dotmath
	         ^/0.3f |0.3f dotmath
                  /0.3f |     |0.3f dotmath
	       }
	      }


    ###################################################################
    #                                                                 #
    #   Symbols taken from eqn (Kernighan and Cherry 1975).           #
    #                                                                 #
    ###################################################################

    def del	{ gradient			}
    def grad	{ gradient			}
    def "..."	{ ellipsis			}
    def ",...,"	{ , ellipsis ``` ,		}
    def "'"	{ minute			}
    def "''"	{ minute minute			}
    def "'''"	{ minute minute minute		}
    def "''''"	{ minute minute minute minute	}
    def empty	{ emptyset			}


    ###################################################################
    #                                                                 #
    #   Symbols with parameters.                                      #
    #                                                                 #
    #   These symbols are essentially those of eqn, with some         #
    #   changes and additions.                                        #
    #                                                                 #
    ###################################################################

    def sup
	precedence 60
	associativity left
	left x
	named gap { @SupGap }
	right y
    {
	@HContract @VContract
	{          | 0.45w @VShift @Smaller @HSqueeze @VSqueeze y
	  ^/gap  x
	}
    }

    def sub
	precedence 60
	associativity left
	left x
	named gap { @SupGap }
	right y
    {
	@HContract @VContract
	{
	       x
	       # "." @KernShrink x
	  /gap    |  @Smaller @HSqueeze @VSqueeze y
	}
    }

    def tsub
	precedence 60
	associativity left
	left x
	named gap { @SupGap }
	right y
    {
	@HContract @VContract
	{
	       x
	  /gap    |  &0io 0.3f @HShift @Smaller @HSqueeze @VSqueeze y
	}
    }

    def supp
	precedence 60
	associativity left
	left x
	named gap { @SupGap }
	right y
    {
	@HContract @VContract
	{
	    { ^/gap x /gap } |  y
	}
    }

    def on
	precedence 61
	associativity left
	left x
	named gap { @SupGap }
	right y
    {
	@Smaller @HSqueeze @VSqueeze x ^/  /
	@Smaller @HSqueeze @VSqueeze y 
    }

    def ton
	precedence 61
	associativity left
	left x
	named gap { @SupGap }
	right y
    {
	@Smaller @HSqueeze @VSqueeze x ^/  /
	&0io 0.3f @HShift @Smaller @HSqueeze @VSqueeze y 
    }

    def frac
	precedence 54
	associativity left
	left x
	named gap { 0.2f }
	right y
    {  
	@HContract @VContract @Smaller @HSqueeze @VSqueeze
	{ 1w @VShift { x /gap } | fraction &0io | 0w @VShift { |gap y }
	}
    }

    def half { 1 frac 2 }
    def third { 1 frac 3 }

    def over
	precedence 54
	associativity left
	left x
	named gap { 0.2f }
	right y
    {  
	@HContract @VContract
	{          |0.5rt @OneCol @VSqueeze x
	  ^//gap   @HLine
	   //gap   |0.5rt @OneCol @VSqueeze @Strut y
	}
    }

    def from
	precedence 58
	associativity left
	left x
	named gap { @ThinGap  }
	named skew { 0c }
	right y
    {  
	@HContract @VContract
	{          |0.5rt x
	   //gap   |0.5rt &skew @Smaller @HSqueeze y
	}
    }

    def to
	precedence 58
	associativity left
	left x
	named gap { @ThinGap  }
	named skew { 0c }
	right y
    {
	@HContract @VContract
	{          |0.5rt &skew @Smaller @HSqueeze y
	  ^//gap   |0.5rt x
	}
    }

    def widefrom
	precedence 58
	associativity left
	left x
	named gap { @ThinGap  }
	right y
    {
	@HContract @VContract
	{
	    x //gap @HScale y
	}
    }

    def wideto
	precedence 58
	associativity left
	left x
	named gap { @ThinGap  }
	right y
    {
	@HContract @VContract
	{
	    @HScale y ^//gap x
	}
    }

    def dot
	precedence 62
	left x
	named gap { @ThinGap }
    {
	x to gap { gap } skew { @SkewGap } .
    }

    def dotdot
	precedence 62
	left x
	named gap { @ThinGap }
    {
	x to gap { gap } skew { @SkewGap } ..
    }

    def hat
	precedence 62
	left x
	named gap { @ThinGap }
    {
	x to gap { gap } skew { @SkewGap } @Base "^"
    }

    def tilde
	precedence 62
	left x
	named gap { @ThinGap }
    {
	x to gap { gap } skew { @SkewGap } @Base "~"
    }

    def vec
	precedence 62
	left x
	named gap { @ThinGap }
    {
	x to gap { gap } skew { @SkewGap } arrowright
    }

    def dyad
	precedence 62
	left x
	named gap { @ThinGap }
    {
	x to gap { gap } skew { @SkewGap } arrowboth
    }

    def overbar
	precedence 62
	left x
	named gap { @ThinGap }
    {
	x wideto gap { gap } minus
    }

    def underbar
	precedence 62
	left x
	named gap { @ThinGap }
    {
	x widefrom gap { gap } minus
    }

    def sqrt
	precedence 56
	named gap { @ThinGap }
	right x
    {
	@HContract @VContract
	{
	    @VScale surd | @OneRow
	    {
		@HLine line { "0.03 ft setlinewidth 2 setlinecap" }
		^//gap  |gap  @VSqueeze @Strut x # //gap
	    }
	}
    }

    def root
	precedence 56
	left x
	right y
    {
	"" sup x &0io sqrt y
    }

    def above
	precedence 52
	left x
	named gap { @RowGap }
	right y
    {
	|0.5rt x //gap |0.5rt y
    }

    def labove
	precedence 52
	left x
	named gap { @RowGap }
	right y
    {
	x //gap y
    }

    def cabove
	precedence 52
	left x
	named gap { @RowGap }
	right y
    {
	|0.5rt x //gap |0.5rt y
    }

    def rabove
	precedence 52
	left x
	named gap { @RowGap }
	right y
    {
	|1rt x //gap |1rt y
    }

    def mabove
	precedence 52
	left x
	named gap { @RowGap }
	right y
    {
	x /gap y
    }

    def nextcol
	precedence 50
	left x
	named gap { @ColGap }
	right y
    {
	x |gap y
    }

    export row axisrow col lcol ccol rcol mcol
    def matrix
	precedence 100
	named gap { @MedGap }
	named strut
	    named no  { }
	    named No  { }
	    named yes { 0.5f }
	    named Yes { 0.5f }
	{ No }
	named atleft {}
	named atright {}
	named userow { No }
	named shiftdelim { Yes }
	body x
    { 
	def @Strut
	{
	    strut @Case {
		"" @Yield {}
		else @Yield { @OneRow { strut @High ^/ strut @High } }
	    }
	}

	def newrow
	    precedence 50
	    associativity left
	    left x
	    right y
	{
	    x @Case {
		"" @Yield { y | @Strut }
		else @Yield { x /@RowGap y | @Strut }
	    }
	}

	macro row { newrow "" }

	def newaxisrow
	    precedence 50
	    associativity left
	    left x
	    right y
	{
	    x @Case {
		"" @Yield { y | @Strut }
		else @Yield { x ^/@RowGap y | @Strut }
	    }
	}

	macro axisrow { newaxisrow "" }

	def col
	    precedence 52
	    associativity left
	    left x
	    named indent { 0.5rt }
	    right y
	{
	    x @Case {
		""   @Yield {            &indent @OneCol y }
		else @Yield { x |@ColGap &indent @OneCol y }
	    }
	}

	def lcol
	    precedence 52
	    associativity left
	    left x
	    right y
	{
	    x col indent { 0i } y
	}

	def ccol
	    precedence 52
	    associativity left
	    left x
	    right y
	{
	    x col indent { 0.5rt } y
	}

	def rcol
	    precedence 52
	    associativity left
	    left x
	    right y
	{
	    x col indent { 1rt } y
	}

	def mcol
	    precedence 52
	    associativity left
	    left x
	    right y
	{
	    x @Case {
		""   @Yield {            @OneCol y }
		else @Yield { x |@ColGap @OneCol y }
	    }
	}

	def delim right x
	{
	    x @Case
	    {
		""   @Yield @Null
		else @Yield
		{
		    shiftdelim @Case {
		    { Yes yes } @Yield { @VScale x }
		    else        @Yield { @VCover x }
		    }
		}
	    }
	}

	@HContract @VContract {
	    delim atleft &@ThinGap
	    userow @Case {
		{Yes yes} @Yield @HContract @VContract {^//gap @OneRow x //gap}
		else      @Yield vctr @HContract @VContract { //gap x //gap }
	    }
	    &@ThinGap delim atright
	}
    }

    macro pmatrix  { matrix atleft { blpar   } atright { brpar   } }
    macro bmatrix  { matrix atleft { blbrack } atright { brbrack } }
    macro brmatrix { matrix atleft { blbrace } atright { brbrace } }
    macro fmatrix  { matrix atleft { blfloor } atright { brfloor } }
    macro cmatrix  { matrix atleft { blceil  } atright { brceil  } }
    macro amatrix  { matrix atleft { blangle } atright { brangle } }
 
    Slope @Font { separate @SpaceGap } @Space 1f @ZUnit 1f @YUnit @Body

@End @Eq                  

macro @E { @OneCol @Eq }
