home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / lout2.lzh / LOUT2 / LIB / include / eq < prev    next >
Text File  |  1994-02-26  |  36KB  |  1,037 lines

  1.  
  2. ###############################################################################
  3. #                                                                             #
  4. #  Lout @Eq package for equation formatting (Version 2.0)                     #
  5. #                                                                             #
  6. #  Version 1.0 by Jeffrey H. Kingston, December 1990.                         #
  7. #  Version 2.0 by Jeffrey H. Kingston, 22 December 1992.                      #
  8. #                                                                             #
  9. #  This package makes extensive use of the Adobe Systems Symbol font, and     #
  10. #  it assumes that the font has not been recoded.  It could be rewritten      #
  11. #  using the @Char symbol to be made independent of any recoding, but since   #
  12. #  there seems no reason to ever recode this font, I haven't bothered.        #
  13. #                                                                             #
  14. #  See "Eq - a Lout package for typesetting mathematics" for user             #
  15. #  information.  Acknowledgement:  the @Eq language is based closely on       #
  16. #  the Eqn language of B. W. Kernighan and L. L. Cherry; the spacing rules    #
  17. #  are similar to those of the TeX system by D. E. Knuth.                     #
  18. #                                                                             #
  19. ###############################################################################
  20.  
  21. export    "`" "``" "```" bin rel punct non vctr big
  22.  
  23.     space exclam universal numbersign existential percent
  24.     ampersand suchthat parenleft parenright asteriskmath
  25.     plus comma minus period slash zero one two three four
  26.     five six seven eight nine colon semicolon less equal
  27.     greater question congruent Alpha Beta Chi Delta Epsilon
  28.     Phi Gamma Eta Iota thetaone Kappa Lambda Mu Nu Omicron
  29.     Pi Theta Rho Sigma Tau Upsilon sigmaone Omega Xi Psi Zeta
  30.     bracketleft therefore bracketright perpendicular underscore
  31.     radicalex alpha beta chi delta epsilon phi gamma eta iota
  32.     phione kappa lambda mu nu omicron pi theta rho sigma tau
  33.     upsilon omegaone omega xi psi zeta braceleft bar braceright
  34.     similar Upsilonone minute lessequal fraction infinity florin
  35.     club diamond heart spade arrowboth arrowleft arrowup
  36.     arrowright arrowdown degree plusminus second greaterequal
  37.     multiply proportional partialdiff bullet divide notequal
  38.     equivalence approxequal ellipsis arrowvertex arrowhorizex
  39.     carriagereturn aleph Ifraktur Rfraktur weierstrass
  40.     circlemultiply circleplus emptyset intersection union
  41.     propersuperset reflexsuperset notsubset propersubset
  42.     reflexsubset element notelement angle gradient registerserif
  43.     copyrightserif trademarkserif product radical dotmath
  44.     logicalnot logicaland logicalor arrowdblboth arrowdblleft
  45.     arrowdblup arrowdblright arrowdbldown lozenge angleleft
  46.     registersans copyrightsans trademarksans summation parenlefttp
  47.     parenleftex parenleftbt bracketlefttp bracketleftex
  48.     bracketleftbt bracelefttp braceleftmid braceleftbt braceex
  49.     angleright integral integraltp integralex integralbt
  50.     parenrighttp parenrightex parenrightbt bracketrighttp
  51.     bracketrightex bracketrightbt bracerighttp bracerightmid
  52.     bracerightbt
  53.  
  54.     hbar Re Im partial infty prime nabla surd top bot dbar
  55.     triangle backslash forall exists neg circle square
  56.  
  57.     "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
  58.  
  59.     sum prod coprod int oint bcap bcup bvee bwedge bodot botimes
  60.     boplus buplus
  61.  
  62.     "+" "-" "+-" "-+" setminus cdot times "*" circ div cap cup uplus
  63.     sqcap sqcup triangleleft triangleright wr bigcirc bigtriangleup
  64.     bigtriangledown vee wedge oplus ominus otimes oslash odot dagger
  65.     daggerdbl amalg
  66.  
  67.     "<" ">" "=" "<=" prec preceq "<<" subset subseteq sqsubseteq
  68.     in vdash smile frown ">=" succ succeq ">>" supset supseteq
  69.     sqsupseteq ni dashv mid parallel "==" "~" "-~" asymp "~~"
  70.     "=~" bowtie propto models doteq perp notsub notin "!=" not
  71.     "<->" "<--" "-->" up down "<=>" "<==" "==>" dblup dbldown
  72.     ":" "::" ":="
  73.  
  74.     lpar blpar rpar brpar lbrack blbrack rbrack brbrack lbrace blbrace
  75.     rbrace brbrace lfloor blfloor rfloor brfloor lceil blceil
  76.     rceil brceil langle blangle rangle brangle
  77.  
  78.     ";" "," col
  79.     
  80.     "!" "?" "%" "(" ")" "[" "]"
  81.  
  82.     arccos arcsin arctan arg cos cosh cot coth csc deg det dim exp
  83.     gcd hom inf ker lg lim liminf limsup ln log max min Pr sec sin
  84.     sinh supr tan tanh mod ldots cdots vdots ddots del grad
  85.     "..." "'" empty
  86.     
  87.     sup sub supp on frac half third over from to widefrom wideto
  88.     dot dotdot hat tilde vec dyad overbar underbar sqrt root above
  89.     labove cabove rabove mabove nextcol matrix
  90.  
  91. def @Eq                  
  92.    body @Body
  93. @Begin
  94.  
  95.    def @SkewGap  { 0.05f  }
  96.    def @SupGap   { 0.40fk }
  97.    def @ThinGap  { 0.15v  }
  98.    def @MedGap   { 0.20v  }
  99.    def @ThickGap { 0.25v  }
  100.    def @ColGap   { 0.8f   }
  101.    def @RowGap   { 0.5f   }
  102.    def @FontRed  { 0.7f   }
  103.    def @FontInc  { 1.3f   }
  104.  
  105.    def "`"       { &@ThinGap  }
  106.    def "``"      { &@MedGap   }
  107.    def "```"     { &@ThickGap }
  108.  
  109.    def bin    right x { ``  x ``  }
  110.    def rel    right x { ``` x ``` }
  111.    def punct    right x {     x `   }
  112.    def non    right x { 0c @Break x }
  113.    def big    right x { @FontInc @Font 0c @Space @FontInc @Break x }
  114.  
  115.    def @Base    right x { Base @Font x }
  116.    def @Smaller right x { @FontRed @Font 0c @Space     0.2f @Break x }
  117.    def @Sym     right x { {Symbol Base} @Font x }
  118.  
  119.    def @HLine
  120.       named line { "0.05 ft setlinewidth" }
  121.    {  
  122.       { "0 0 moveto xsize 0 lineto" line "stroke" } @Graphic {}
  123.    }
  124.  
  125.    def @VLine
  126.    {
  127.       "0 0 moveto 0 ysize lineto 0.05 ft setlinewidth stroke" @Graphic {}
  128.    }
  129.  
  130.    def vctr
  131.       right x
  132.    { @OneRow {   -180d @Rotate { /0.5wo 180d @Rotate { / @OneRow @OneCol x  } }
  133.            ^/      @OneRow { /0.5wo      @OneRow { @OneRow @OneCol x ^/ } }
  134.          }
  135.    }
  136.  
  137.    ###################################################################
  138.    #                                                                 #
  139.    #   Full names                                                    #
  140.    #                                                                 #
  141.    #   These symbols and their names are taken directly from the     #
  142.    #   Adobe Systems Inc. Symbol font (see PostScript Language       #
  143.    #   Reference Manual, pp. 256-257).  The only differences are:    #
  144.    #                                                                 #
  145.    #      Adobe:  theta1        Eq:  thetaone                        #
  146.    #              sigma1             sigmaone                        #
  147.    #              phi1               phione                          #
  148.    #              omega1             omegaone                        #
  149.    #                                                                 #
  150.    #   These were needed since Lout identifiers do not have digits.  #
  151.    #                                                                 #
  152.    ###################################################################
  153.  
  154.    def space           { @Sym "\040"  }
  155.    def exclam          { @Sym "\041"  }
  156.    def universal       { @Sym "\042"  }
  157.    def numbersign      { @Sym "\043"  }
  158.    def existential     { @Sym "\044"  }
  159.    def percent         { @Sym "\045"  }
  160.    def ampersand       { @Sym "\046"  }
  161.    def suchthat        { @Sym "\047"  }
  162.    def parenleft       { @Sym "\050"  }
  163.    def parenright      { @Sym "\051"  }
  164.    def asteriskmath    { @Sym "\052"  }
  165.    def plus            { @Sym "+"     }
  166.    def comma           { @Sym "\054"  }
  167.    def minus           { @Sym "-"     }
  168.    def period          { @Sym "\056"  }
  169.    def slash           { @Sym "\057"  }
  170.    def zero            { @Sym "\060"  }
  171.    def one             { @Sym "\061"  }
  172.    def two             { @Sym "\062"  }
  173.    def three           { @Sym "\063"  }
  174.    def four            { @Sym "\064"  }
  175.    def five            { @Sym "\065"  }
  176.    def six             { @Sym "\066"  }
  177.    def seven           { @Sym "\067"  }
  178.    def eight           { @Sym "\070"  }
  179.    def nine            { @Sym "\071"  }
  180.    def colon           { @Sym "\072"  }
  181.    def semicolon       { @Sym "\073"  }
  182.    def less            { @Sym "\074"  }
  183.    def equal           { @Sym "\075"  }
  184.    def greater         { @Sym "\076"  }
  185.    def question        { @Sym "\077"  }
  186.    def congruent       { @Sym "\100"  }
  187.    def Alpha           { @Sym "\101"  }
  188.    def Beta            { @Sym "\102"  }
  189.    def Chi             { @Sym "\103"  }
  190.    def Delta           { @Sym "\104"  }
  191.    def Epsilon         { @Sym "\105"  }
  192.    def Phi             { @Sym "\106"  }
  193.    def Gamma           { @Sym "\107"  }
  194.    def Eta             { @Sym "\110"  }
  195.    def Iota            { @Sym "\111"  }
  196.    def thetaone        { @Sym "\112"  }
  197.    def Kappa           { @Sym "\113"  }
  198.  
  199.    def Lambda          { @Sym "\114"  }
  200.    def Mu              { @Sym "\115"  }
  201.    def Nu              { @Sym "\116"  }
  202.    def Omicron         { @Sym "\117"  }
  203.    def Pi              { @Sym "\120"  }
  204.    def Theta           { @Sym "\121"  }
  205.    def Rho             { @Sym "\122"  }
  206.    def Sigma           { @Sym "\123"  }
  207.    def Tau             { @Sym "\124"  }
  208.    def Upsilon         { @Sym "\125"  }
  209.    def sigmaone        { @Sym "\126"  }
  210.    def Omega           { @Sym "\127"  }
  211.    def Xi              { @Sym "\130"  }
  212.    def Psi             { @Sym "\131"  }
  213.    def Zeta            { @Sym "\132"  }
  214.    def bracketleft     { @Sym "\133"  }
  215.    def therefore       { @Sym "\134"  }
  216.    def bracketright    { @Sym "\135"  }
  217.    def perpendicular   { @Sym "\136"  }
  218.    def underscore      { @Sym "\137"  }
  219.    def radicalex       { @Sym "\140"  }
  220.    def alpha           { @Sym "\141"  }
  221.    def beta            { @Sym "\142"  }
  222.    def chi             { @Sym "\143"  }
  223.    def delta           { @Sym "\144"  }
  224.    def epsilon         { @Sym "\145"  }
  225.    def phi             { @Sym "\146"  }
  226.    def gamma           { @Sym "\147"  }
  227.    def eta             { @Sym "\150"  }
  228.    def iota            { @Sym "\151"  }
  229.    def phione          { @Sym "\152"  }
  230.    def kappa           { @Sym "\153"  }
  231.    def lambda          { @Sym "\154"  }
  232.    def mu              { @Sym "\155"  }
  233.    def nu              { @Sym "\156"  }
  234.  
  235.    def omicron         { @Sym "\157"  }
  236.    def pi              { @Sym "\160"  }
  237.    def theta           { @Sym "\161"  }
  238.    def rho             { @Sym "\162"  }
  239.    def sigma           { @Sym "\163"  }
  240.    def tau             { @Sym "\164"  }
  241.    def upsilon         { @Sym "\165"  }
  242.    def omegaone        { @Sym "\166"  }
  243.    def omega           { @Sym "\167"  }
  244.    def xi              { @Sym "\170"  }
  245.    def psi             { @Sym "\171"  }
  246.    def zeta            { @Sym "\172"  }
  247.    def braceleft       { @Sym "\173"  }
  248.    def bar             { @Sym "\174"  }
  249.    def braceright      { @Sym "\175"  }
  250.    def similar         { @Sym "\176"  }
  251.    def Upsilonone      { @Sym "\241"  }
  252.    def minute          { @Sym "\242"  }
  253.    def lessequal       { @Sym "\243"  }
  254.    def fraction        { @Sym "\244"  }
  255.    def infinity        { @Sym "\245"  }
  256.    def florin          { @Sym "\246"  }
  257.    def club            { @Sym "\247"  }
  258.    def diamond         { @Sym "\250"  }
  259.    def heart           { @Sym "\251"  }
  260.    def spade           { @Sym "\252"  }
  261.    def arrowboth       { @Sym "\253"  }
  262.    def arrowleft       { @Sym "\254"  }
  263.    def arrowup         { @Sym "\255"  }
  264.    def arrowright      { @Sym "\256"  }
  265.    def arrowdown       { @Sym "\257"  }
  266.    def degree          { @Sym "\260"  }
  267.    def plusminus       { @Sym "\261"  }
  268.    def second          { @Sym "\262"  }
  269.    def greaterequal    { @Sym "\263"  }
  270.  
  271.    def multiply        { @Sym "\264"  }
  272.    def proportional    { @Sym "\265"  }
  273.    def partialdiff     { @Sym "\266"  }
  274.    def bullet          { @Sym "\267"  }
  275.    def divide          { @Sym "\270"  }
  276.    def notequal        { @Sym "\271"  }
  277.    def equivalence     { @Sym "\272"  }
  278.    def approxequal     { @Sym "\273"  }
  279.    def ellipsis        { @Sym "\274"  }
  280.    def arrowvertex     { @Sym "\275"  }
  281.    def arrowhorizex    { @Sym "\276"  }
  282.    def carriagereturn  { @Sym "\277"  }
  283.    def aleph           { @Sym "\300"  }
  284.    def Ifraktur        { @Sym "\301"  }
  285.    def Rfraktur        { @Sym "\302"  }
  286.    def weierstrass     { @Sym "\303"  }
  287.    def circlemultiply  { @Sym "\304"  }
  288.    def circleplus      { @Sym "\305"  }
  289.    def emptyset        { @Sym "\306"  }
  290.    def intersection    { @Sym "\307"  }
  291.    def union           { @Sym "\310"  }
  292.    def propersuperset  { @Sym "\311"  }
  293.    def reflexsuperset  { @Sym "\312"  }
  294.    def notsubset       { @Sym "\313"  }
  295.    def propersubset    { @Sym "\314"  }
  296.    def reflexsubset    { @Sym "\315"  }
  297.    def element         { @Sym "\316"  }
  298.    def notelement      { @Sym "\317"  }
  299.    def angle           { @Sym "\320"  }
  300.    def gradient        { @Sym "\321"  }
  301.    def registerserif   { @Sym "\322"  }
  302.    def copyrightserif  { @Sym "\323"  }
  303.    def trademarkserif  { @Sym "\324"  }
  304.    def product         { @Sym "\325"  }
  305.    def radical         { @Sym "\326"  }
  306.    def dotmath         { @Sym "\327"  }
  307.  
  308.    def logicalnot      { @Sym "\330"  }
  309.    def logicaland      { @Sym "\331"  }
  310.    def logicalor       { @Sym "\332"  }
  311.    def arrowdblboth    { @Sym "\333"  }
  312.    def arrowdblleft    { @Sym "\334"  }
  313.    def arrowdblup      { @Sym "\335"  }
  314.    def arrowdblright   { @Sym "\336"  }
  315.    def arrowdbldown    { @Sym "\337"  }
  316.    def lozenge         { @Sym "\340"  }
  317.    def angleleft       { @Sym "\341"  }
  318.    def registersans    { @Sym "\342"  }
  319.    def copyrightsans   { @Sym "\343"  }
  320.    def trademarksans   { @Sym "\344"  }
  321.    def summation       { @Sym "\345"  }
  322.    def parenlefttp     { @Sym "\346"  }
  323.    def parenleftex     { @Sym "\347"  }
  324.    def parenleftbt     { @Sym "\350"  }
  325.    def bracketlefttp   { @Sym "\351"  }
  326.    def bracketleftex   { @Sym "\352"  }
  327.    def bracketleftbt   { @Sym "\353"  }
  328.    def bracelefttp     { @Sym "\354"  }
  329.    def braceleftmid    { @Sym "\355"  }
  330.    def braceleftbt     { @Sym "\356"  }
  331.    def braceex         { @Sym "\357"  }
  332.    def angleright      { @Sym "\361"  }
  333.    def integral        { @Sym "\362"  }
  334.    def integraltp      { @Sym "\363"  }
  335.    def integralex      { @Sym "\364"  }
  336.    def integralbt      { @Sym "\365"  }
  337.    def parenrighttp    { @Sym "\366"  }
  338.    def parenrightex    { @Sym "\367"  }
  339.    def parenrightbt    { @Sym "\370"  }
  340.    def bracketrighttp  { @Sym "\371"  }
  341.    def bracketrightex  { @Sym "\372"  }
  342.    def bracketrightbt  { @Sym "\373"  }
  343.    def bracerighttp    { @Sym "\374"  }
  344.    def bracerightmid   { @Sym "\375"  }
  345.    def bracerightbt    { @Sym "\376"  }
  346.  
  347.  
  348.    ###################################################################
  349.    #                                                                 #
  350.    #   Short names                                                   #
  351.    #                                                                 #
  352.    #   These symbols, their names, and their spacing, are based on   #
  353.    #   the list in Appendix F of Donald E. Knuth's The TeXBook.      #
  354.    #                                                                 #
  355.    #   Group 1 (lowercase Greek letters):  see full names above      #
  356.    #   Group 2 (uppercase Greek letters):  see full names above      #
  357.    #   Group 3 (calligraphic capitals):    not provided by Eq        #
  358.    #                                                                 #
  359.    ###################################################################
  360.  
  361.    ###################################################################
  362.    #                                                                 #
  363.    #   Group 4 (miscellaneous Ord symbols)                           #
  364.    #                                                                 #
  365.    #   Not all of Knuth's symbols are available.  The four suits     #
  366.    #   (heartsuit, etc.), have definitions above.                    #
  367.    #                                                                 #
  368.    ###################################################################
  369.  
  370.    def hbar         { @OneCol { &0.1f @Base "-" ^/0.25fo h }    }
  371.    def Re           { Rfraktur                    }
  372.    def Im           { Ifraktur                    }
  373.    def partial      { partialdiff                }
  374.    def infty        { infinity                    }
  375.    def prime        {  minute                        }
  376.   #def emptyset     { defined above                }
  377.    def nabla        { gradient                    }
  378.    def surd         { radical                    }
  379.    def top          { 180d @Rotate perpendicular        }
  380.    def bot          { perpendicular                }
  381.    def dbar         { @Base "||"                             }
  382.   #def angle        { defined above                }
  383.    def backslash    { "\\"                    }
  384.    def forall       { universal                    }
  385.    def exists       { existential                }
  386.    def neg          { logicalnot                }
  387.  
  388.    def circle       { @HContract @VContract
  389.               { "xsize ysize 2 div moveto"
  390.             "xsize 2 div ysize 2 div xsize 2 div 0 360 arc"
  391.             "0.04 ft setlinewidth stroke"
  392.               }
  393.               @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High }
  394.             }
  395.  
  396.    def square       { @HContract @VContract
  397.               { "0 0 moveto xsize 0 lineto xsize ysize lineto"
  398.             "0 ysize lineto closepath"
  399.             "0.04 ft setlinewidth stroke"
  400.               }
  401.               @Graphic { 0.6f @Wide 0.3f @High ^/ 0.3f @High }
  402.             }
  403.  
  404.    def triangle     { @HContract @VContract
  405.               { "0 0 moveto xsize 0 lineto"
  406.                 "xsize 2 div ysize lineto closepath"
  407.             "0.04 ft setlinewidth stroke"
  408.               }
  409.               @Graphic
  410.               { 0.3f @Wide 0.3f @High ^| ^/
  411.                 0.3f @Wide 0.3f @High
  412.               }
  413.             }
  414.  
  415.    ###################################################################
  416.    #                                                                 #
  417.    #   Group 5 (digits)                                              #
  418.    #                                                                 #
  419.    ###################################################################
  420.  
  421.    def "0" { zero            }
  422.    def "1" { one             }
  423.    def "2" { two             }
  424.    def "3" { three           }
  425.    def "4" { four            }
  426.    def "5" { five            }
  427.    def "6" { six             }
  428.    def "7" { seven           }
  429.    def "8" { eight           }
  430.    def "9" { nine            }
  431.  
  432.  
  433.    ###################################################################
  434.    #                                                                 #
  435.    #   Group 6 ("Large" operators)                                   #
  436.    #                                                                 #
  437.    #   Knuth's large operators automatically change size depending   #
  438.    #   on whether the equation is display or inline.  Eq does not    #
  439.    #   do this; instead, the `big' operator must be used.            #
  440.    #                                                                 #
  441.    ###################################################################
  442.  
  443.    def sum    { summation                    }
  444.    def prod    { product                    }
  445.    def coprod    { 180d @Rotate vctr product            }
  446.    def int    { 1.3f @Font vctr integral            }
  447.    def oint    { @OneCol { vctr degree |0.015fo int }        }
  448.    def bcap    { 1.3f @Font intersection            }
  449.    def bcup    { 1.3f @Font union                }
  450.    def bvee    { 1.3f @Font logicalor                }
  451.    def bwedge    { 1.3f @Font logicaland                }
  452.    def bodot    { & 1.3f @Font @HContract { circle /0io &0.5rt dotmath } }
  453.    def botimes    { 1.3f @Font circlemultiply            }
  454.    def boplus    { 1.3f @Font circleplus                }
  455.    def buplus    { & 1.3f @Font @HContract { &0.5rt 0.7f @Font plus ^/0.2fo union } }
  456.  
  457.    ###################################################################
  458.    #                                                                 #
  459.    #   Group 7 (binary operations)                                   #
  460.    #                                                                 #
  461.    #   All of Knuth's symbols are available except \star, \diamond   #
  462.    #   and \bullet; a few have been given more mnemonic names.       #
  463.    #                                                                 #
  464.    ###################################################################
  465.  
  466.    def "+"        { bin plus                }
  467.    def "-"        { bin minus                }
  468.    def "+-"        { bin plusminus                }
  469.    def "-+"        { bin 180d @Rotate plusminus        }
  470.    def setminus        { bin backslash                }
  471.    def cdot        { bin dotmath                }
  472.    def times        { bin multiply                }
  473.    def "*"        { bin asteriskmath            }
  474.   #def diamond        { name used above            }
  475.    def circ        { bin circle                }
  476.   #def bullet        { name used above            }
  477.    def div        { bin divide                }
  478.    def cap        { bin intersection            }
  479.    def cup        { bin union                }
  480.    def uplus        { bin @OneRow @HContract { &0.5rt 0.7f @Font plus ^/0.2fo union}}
  481.    def sqcap        { bin
  482.               { @HContract @VContract
  483.                 {    "0 0 moveto 0 ysize lineto xsize ysize lineto"
  484.                 "xsize 0 lineto"
  485.                 "0.04 ft setlinewidth stroke"
  486.                 }
  487.                 @Graphic
  488.                 {    0.3f @Wide 0.3f @High ^| ^/
  489.                 0.3f @Wide 0.3f @High
  490.                 }
  491.               }
  492.             }
  493.    def sqcup        { 180d @Rotate sqcap            }
  494.    def triangleleft    { bin 90d @Rotate 0.8f @Font triangle    }
  495.    def triangleright    { bin "-90d" @Rotate 0.8f @Font triangle}
  496.    def wr        { bin vctr {90d @Rotate similar}    }
  497.    def bigcirc        { bin 1.2f @Font circle            }
  498.    def bigtriangleup    { bin 1.2f @Font triangle        }
  499.    def bigtriangledown    { bin 180d @Rotate 1.2f @Font triangle    }
  500.    def vee        { bin logicalor                }
  501.    def wedge        { bin logicaland            }
  502.    def oplus        { bin circleplus            }
  503.    def ominus        { bin @OneRow @HContract { circle /0io &0.5rt minus}}
  504.    def otimes        { bin circlemultiply            }
  505.    def oslash        {`vctr 60d @Rotate @HContract {circle/0io &0.5rt minus`}}
  506.    def odot        { bin @OneRow @HContract {circle/0io &0.5rt dotmath}}
  507.    def dagger        { bin @Base @Char "dagger"        }
  508.    def daggerdbl    { bin @Base @Char "daggerdbl"        }
  509.    def amalg        { bin 180d @Rotate vctr product        }
  510.  
  511.    ###################################################################
  512.    #                                                                 #
  513.    #   Group 8 (relations)                                           #
  514.    #                                                                 #
  515.    #   All Knuth's operators are available, but many have been       #
  516.    #   given different, more mnemonic names.  Also included is       #
  517.    #   a not operator for negating the relations.                    #
  518.    #                                                                 #
  519.    ###################################################################
  520.  
  521.    def "<"        { rel less                }
  522.    def ">"        { rel greater                }
  523.    def "="        { rel equal                }
  524.    def "<="        { rel lessequal                }
  525.    def prec        { rel { 0.45f @Font "-90d" @Rotate
  526.                 { parenrighttp ^| parenlefttp }
  527.                   }
  528.             }
  529.    def preceq        { rel { @OneRow non prec /0.1f minus }    }
  530.    def "<<"        { rel {less less}            }
  531.    def subset        { rel propersubset            }
  532.    def subseteq        { rel reflexsubset            }
  533.    def sqsubseteq    { rel @HContract @VContract
  534.               {    { "xsize 0 moveto"
  535.                   "0 0 lineto"
  536.                   "0 ysize lineto"
  537.                   "xsize ysize lineto"
  538.                   "0.04 ft setlinewidth stroke"
  539.                 }
  540.                 @Graphic
  541.                 { 0.5f @Wide 0.25f @High ^/
  542.                   0.25f @High
  543.                 }
  544.                 /0.1f minus
  545.               }
  546.             }
  547.  
  548.    def in        { rel element                }
  549.    def vdash        { rel vctr{"-90d" @Rotate perpendicular}}
  550.    def smile        { rel vctr 90d @Rotate parenleft    }
  551.    def frown        { rel vctr 90d @Rotate parenright    }
  552.  
  553.    def ">="        { rel greaterequal            }
  554.    def succ        { rel { 0.45f @Font 90d @Rotate
  555.                     { parenrighttp ^| parenlefttp }
  556.                   }
  557.             }
  558.    def succeq        { rel { @OneRow non succ /0.1f minus }    }
  559.    def ">>"        { rel {greater greater}            }
  560.    def supset        { rel propersuperset            }
  561.    def supseteq        { rel reflexsuperset            }
  562.    def sqsupseteq    { rel @HContract @VContract
  563.               {    { "0 0 moveto xsize 0 lineto"
  564.                   "xsize ysize lineto"
  565.                   "0 ysize lineto"
  566.                   "0.04 ft setlinewidth stroke"
  567.                 }
  568.                 @Graphic
  569.                 { 0.5f @Wide 0.25f @High ^/
  570.                   0.25f @High
  571.                 }
  572.                 /0.1f minus
  573.               }
  574.             }
  575.    def ni        { rel 180d @Rotate element        }
  576.    def dashv        { rel vctr {90d @Rotate perpendicular}    }
  577.    def mid        { rel @Base "|"                }
  578.    def parallel        { rel @Base "||"            }
  579.  
  580.    def "=="        { rel equivalence            }
  581.    def "~"        { rel similar                }
  582.    def "-~"        { rel @OneRow{similar^/0.07f/0.07f minus}}
  583.    def asymp        { rel 0.7f @Font @OneRow
  584.                   { 90d @Rotate parenleft ^/0.008f
  585.                   /0.008f 90d @Rotate parenright }
  586.             }
  587.    def "~~"        { rel approxequal            }
  588.    def "=~"        { rel congruent                }
  589.    def bowtie        { rel{non triangleright non triangleleft}}
  590.    def propto        { rel proportional            }
  591.    def models        { rel{@Base vctr "|" &0.05fo vctr equal}}
  592.    def doteq        { rel @OneRow @HContract {&0.5rt dotmath^/0.15f equal}}
  593.    def perp        { rel perpendicular            }
  594.  
  595.    def notsub        { rel notsubset                }
  596.    def notin        { rel notelement            }
  597.    def "!="        { rel notequal                }
  598.  
  599.    def "<->"        { rel arrowboth                }
  600.    def "<--"        { rel arrowleft                }
  601.    def "-->"        { rel arrowright            }
  602.    def up        { rel arrowup                }
  603.    def down        { rel arrowdown                }
  604.    def "<=>"        { rel arrowdblboth            }
  605.    def "<=="        { rel arrowdblleft            }
  606.    def "==>"        { rel arrowdblright            }
  607.    def dblup        { rel arrowdblup            }
  608.    def dbldown        { rel arrowdbldown            }
  609.  
  610.    def ":"        { rel colon                }
  611.    def "::"        { rel @OneCol {colon ` colon}        }
  612.    def ":="        { rel { colon{ //0.05fo equal} }    }
  613.  
  614.    def not right x    { @HContract {@OneCol x /0co &0.5rt slash}}
  615.  
  616.  
  617.    ###################################################################
  618.    #                                                                 #
  619.    #   Groups 11 and 12 - openings and closings.                     #
  620.    #                                                                 #
  621.    ###################################################################
  622.  
  623.    def lpar    { parenleft        }
  624.    def rpar    { parenright        }
  625.    def lbrack    { bracketleft        }
  626.    def rbrack    { bracketright        }
  627.    def lbrace    { braceleft        }
  628.    def rbrace    { braceright        }
  629.    def lfloor    { bracketleftbt        }
  630.    def rfloor    { bracketrightbt    }
  631.    def lceil    { bracketlefttp        }
  632.    def rceil    { bracketrighttp    }
  633.    def langle    { angleleft        }
  634.    def rangle    { angleright        }
  635.  
  636.    def blpar    { @OneRow {parenlefttp    ^/ parenleftex    / parenleftbt   } }
  637.    def brpar    { @OneRow {parenrighttp   ^/ parenrightex   / parenrightbt  } }
  638.    def blbrack    { @OneRow {bracketlefttp  ^/ bracketleftex  / bracketleftbt } }
  639.    def brbrack    { @OneRow {bracketrighttp ^/ bracketrightex / bracketrightbt} }
  640.    def blbrace    { @OneRow {bracelefttp    ^/ braceleftmid   / braceleftbt   } }
  641.    def brbrace    { @OneRow {bracerighttp   ^/ bracerightmid  / bracerightbt  } }
  642.    def blfloor    { @OneRow {bracketleftex  ^/ bracketleftex  / bracketleftbt } }
  643.    def brfloor    { @OneRow {bracketrightex ^/ bracketrightex / bracketrightbt} }
  644.    def blceil    { @OneRow {bracketlefttp  ^/ bracketleftex  / bracketleftex } }
  645.    def brceil    { @OneRow {bracketrighttp ^/ bracketrightex / bracketrightex} }
  646.    def blangle    { @HContract @VContract
  647.           { "xsize 0 moveto"
  648.             "0 ysize 2 div lineto"
  649.             "xsize ysize lineto"
  650.             "0.04 ft setlinewidth stroke"
  651.               }
  652.               @Graphic { 0.5f @Wide 2f @High ^/ 2f @High }
  653.         }
  654.    def brangle    { @HContract @VContract
  655.           { "0 0 moveto"
  656.             "xsize ysize 2 div lineto"
  657.             "0 ysize lineto"
  658.             "0.04 ft setlinewidth stroke"
  659.               }
  660.               @Graphic { 0.5f @Wide 2f @High ^/ 2f @High }
  661.         }
  662.  
  663.  
  664.    ###################################################################
  665.    #                                                                 #
  666.    #   Group 13 - punctuation.                                       #
  667.    #                                                                 #
  668.    ###################################################################
  669.  
  670.    def ";"     { punct semicolon     }
  671.    def ","     { punct comma         }
  672.    def col     { punct colon         }
  673.  
  674.  
  675.    ###################################################################
  676.    #                                                                 #
  677.    #   Additional short symbols (Knuth p. 132)                       #
  678.    #                                                                 #
  679.    ###################################################################
  680.  
  681.    def "!" { exclam          }
  682.    def "?" { question        }
  683.    def "%" { percent         }
  684.    def "(" { parenleft       }
  685.    def ")" { parenright      }
  686.    def "[" { bracketleft     }
  687.    def "]" { bracketright    }
  688.  
  689.  
  690.    ###################################################################
  691.    #                                                                 #
  692.    #   Common mathematical functions (from Knuth p. 162).            #
  693.    #   mod is included, since @Rel mod is easily typed if needed.    #
  694.    #                                                                 #
  695.    ###################################################################
  696.  
  697.    def arccos    { @Base "arccos"    }
  698.    def arcsin    { @Base "arcsin"    }
  699.    def arctan    { @Base "arctan"    }
  700.    def arg    { @Base "arg"        }
  701.    def cos    { @Base "cos"        }
  702.    def cosh    { @Base "cosh"        }
  703.    def cot    { @Base "cot"        }
  704.    def coth    { @Base "coth"        }
  705.    def csc    { @Base "csc"        }
  706.    def deg    { @Base "deg"        }
  707.    def det    { @Base "det"        }
  708.    def dim    { @Base "dim"        }
  709.    def exp    { @Base "exp"        }
  710.    def gcd    { @Base "gcd"        }
  711.    def hom    { @Base "hom"        }
  712.    def inf    { @Base "inf"        }
  713.    def ker    { @Base "ker"        }
  714.    def lg    { @Base "lg"        }
  715.    def lim    { @Base "lim"        }
  716.    def liminf    { @OneCol { @Base "lim" ` @Base "inf" }    }
  717.    def limsup    { @OneCol { @Base "lim" ` @Base "sup" }    }
  718.    def ln    { @Base "ln"        }
  719.    def log    { @Base "log"        }
  720.    def max    { @Base "max"        }
  721.    def min    { @Base "min"        }
  722.    def Pr    { @Base "Pr"        }
  723.    def sec    { @Base "sec"        }
  724.    def sin    { @Base "sin"        }
  725.    def sinh    { @Base "sinh"        }
  726.    def supr    { @Base "sup"        }
  727.    def tan    { @Base "tan"        }
  728.    def tanh    { @Base "tanh"        }
  729.    def mod    { @Base "mod"        }
  730.  
  731.  
  732.    ###################################################################
  733.    #                                                                 #
  734.    #   Other symbols taken from TeX.                                 #
  735.    #                                                                 #
  736.    ###################################################################
  737.  
  738.    def ldots { .       &0.3f .       &0.3f .            }
  739.    def cdots { dotmath &0.3f dotmath &0.3f dotmath        }
  740.    def vdots { @OneRow { dotmath ^/0.3f dotmath /0.3f dotmath } }
  741.    def ddots { @OneCol @OneRow
  742.            {        dotmath
  743.              ^/0.3f |0.3f dotmath
  744.                   /0.3f |     |0.3f dotmath
  745.            }
  746.          }
  747.  
  748.  
  749.    ###################################################################
  750.    #                                                                 #
  751.    #   Symbols taken from eqn (Kernighan and Cherry 1975).           #
  752.    #                                                                 #
  753.    ###################################################################
  754.  
  755.    def del    { gradient        }
  756.    def grad    { gradient        }
  757.    def "..."    { ellipsis        }
  758.    def ",...,"    { , ellipsis ``` ,    }
  759.    def "'"    { minute        }
  760.    def empty    { emptyset        }
  761.  
  762.  
  763.  
  764.    ###################################################################
  765.    #                                                                 #
  766.    #   Symbols with parameters.                                      #
  767.    #                                                                 #
  768.    #   These symbols are essentially those of eqn, with some         #
  769.    #   changes and additions.                                        #
  770.    #                                                                 #
  771.    ###################################################################
  772.  
  773.    def sup
  774.       precedence 60
  775.       associativity left
  776.       left x
  777.       named gap { @SupGap }
  778.       right y
  779.    {  @HContract @VContract
  780.       {          | @Smaller y
  781.     ^/gap  x
  782.       }
  783.    }
  784.  
  785.    def sub
  786.       precedence 60
  787.       associativity left
  788.       left x
  789.       named gap { @SupGap }
  790.       right y
  791.    {  @HContract @VContract
  792.       {
  793.           x
  794.      /gap    |  @Smaller y
  795.       }
  796.    }
  797.  
  798.    def supp
  799.       precedence 60
  800.       associativity left
  801.       left x
  802.       named gap { @SupGap }
  803.       right y
  804.    {  @HContract @VContract
  805.       { { ^/gap x /gap } |  @Smaller y
  806.       }
  807.    }
  808.  
  809.    def on
  810.       precedence 61
  811.       associativity left
  812.       left x
  813.       named gap { @SupGap }
  814.       right y
  815.    {  x ^/  / y 
  816.    }
  817.  
  818.    def frac
  819.       precedence 54
  820.       associativity left
  821.       left x
  822.       named gap { 0ik }
  823.       right y
  824.    {  @HContract @VContract @Smaller
  825.       { x ^/gap | fraction /gap | | y }
  826.    }
  827.  
  828.    def half { 1 frac 2 }
  829.    def third { 1 frac 3 }
  830.  
  831.    def over
  832.       precedence 54
  833.       associativity left
  834.       left x
  835.       named gap { 0.2f }
  836.       right y
  837.    {  
  838.       @HContract @VContract
  839.       {          |0.5rt @OneCol x
  840.     ^//gap   @HLine
  841.      //gap   |0.5rt @OneCol y
  842.       }
  843.    }
  844.  
  845.    def from
  846.       precedence 58
  847.       associativity left
  848.       left x
  849.       named gap { @ThinGap  }
  850.       named skew { 0c }
  851.       right y
  852.    {  
  853.       @HContract @VContract
  854.       {          |0.5rt x
  855.      //gap   |0.5rt &skew @Smaller y
  856.       }
  857.    }
  858.  
  859.    def to
  860.       precedence 58
  861.       associativity left
  862.       left x
  863.       named gap { @ThinGap  }
  864.       named skew { 0c }
  865.       right y
  866.    {
  867.       @HContract @VContract
  868.       {          |0.5rt &skew @Smaller y
  869.     ^//gap   |0.5rt x
  870.       }
  871.    }
  872.  
  873.    def widefrom
  874.       precedence 58
  875.       associativity left
  876.       left x
  877.       named gap { @ThinGap  }
  878.       right y
  879.    {
  880.       @HContract @VContract
  881.       {  x //gap @HScale y
  882.       }
  883.    }
  884.  
  885.    def wideto
  886.       precedence 58
  887.       associativity left
  888.       left x
  889.       named gap { @ThinGap  }
  890.       right y
  891.    {
  892.       @HContract @VContract
  893.       { @HScale y ^//gap x
  894.       }
  895.    }
  896.  
  897.    def dot
  898.       precedence 62
  899.       left x
  900.       named gap { @ThinGap }
  901.    {  x to gap { gap } skew { @SkewGap } .
  902.    }
  903.  
  904.    def dotdot
  905.       precedence 62
  906.       left x
  907.       named gap { @ThinGap }
  908.    {  x to gap { gap } skew { @SkewGap } ..
  909.    }
  910.  
  911.    def hat
  912.       precedence 62
  913.       left x
  914.       named gap { @ThinGap }
  915.    {  x to gap { gap } skew { @SkewGap } @Base "^"
  916.    }
  917.  
  918.    def tilde
  919.       precedence 62
  920.       left x
  921.       named gap { @ThinGap }
  922.    {  x to gap { gap } skew { @SkewGap } @Base "~"
  923.    }
  924.  
  925.    def vec
  926.       precedence 62
  927.       left x
  928.       named gap { @ThinGap }
  929.    {  x to gap { gap } skew { @SkewGap } arrowright
  930.    }
  931.  
  932.    def dyad
  933.       precedence 62
  934.       left x
  935.       named gap { @ThinGap }
  936.    {  x to gap { gap } skew { @SkewGap } arrowboth
  937.    }
  938.  
  939.    def overbar
  940.       precedence 62
  941.       left x
  942.       named gap { @ThinGap }
  943.    {  x wideto gap { gap } minus
  944.    }
  945.  
  946.    def underbar
  947.       precedence 62
  948.       left x
  949.       named gap { @ThinGap }
  950.    {  x widefrom gap { gap } minus
  951.    }
  952.  
  953.    def sqrt
  954.       precedence 56
  955.       named gap { @ThinGap }
  956.       right x
  957.    {
  958.       @HContract @VContract
  959.       { @VScale surd | @OneRow
  960.     { @HLine line { "0.03 ft setlinewidth 2 setlinecap" }
  961.       ^//gap  |gap  x //gap
  962.     }
  963.       }
  964.    }
  965.  
  966.    def root
  967.       precedence 56
  968.       left x
  969.       right y
  970.    { "" sup x &0io sqrt y
  971.    }
  972.  
  973.    def above
  974.       precedence 52
  975.       left x
  976.       named gap { @RowGap }
  977.       right y
  978.    {  |0.5rt x //gap |0.5rt y
  979.    }
  980.  
  981.    def labove
  982.       precedence 52
  983.       left x
  984.       named gap { @RowGap }
  985.       right y
  986.    {  x //gap y
  987.    }
  988.  
  989.    def cabove
  990.       precedence 52
  991.       left x
  992.       named gap { @RowGap }
  993.       right y
  994.    {  |0.5rt x //gap |0.5rt y
  995.    }
  996.  
  997.    def rabove
  998.       precedence 52
  999.       left x
  1000.       named gap { @RowGap }
  1001.       right y
  1002.    {  |1rt x //gap |1rt y
  1003.    }
  1004.  
  1005.    def mabove
  1006.       precedence 52
  1007.       left x
  1008.       named gap { @RowGap }
  1009.       right y
  1010.    {  x /gap y
  1011.    }
  1012.  
  1013.    def nextcol
  1014.       precedence 50
  1015.       left x
  1016.       named gap { @ColGap }
  1017.       right y
  1018.    { x |gap y
  1019.    }
  1020.  
  1021.    def matrix
  1022.       precedence 100
  1023.       named gap { @MedGap }
  1024.       named atleft {}
  1025.       named atright {}
  1026.       right x
  1027.    { vctr @HContract @VContract
  1028.      {  @VScale atleft
  1029.     ||@ThinGap  { //gap x //gap } ||@ThinGap
  1030.     @VScale atright
  1031.      }
  1032.    }
  1033.  
  1034.    Slope @Font 1.2f @Break 0c @Space @Body
  1035.  
  1036. @End @Eq                  
  1037.