1(* 2*) 3open Input 4 5fun test f x = (f x) handle (ex as BasicTypes.NotImplemented s) 6 => (print " ---> "; print s; print " <---"; raise ex) 7 8val disp = test Formula.displayFormula 9val line = test Formula.inlineFormula 10 11fun form formula = ShipOut.shipOut [disp formula, line formula] 12 13val bigop = sum (SOME (trans "i=1")) (SOME (trans "n")) 14 15val mlar = trans "1+2=3" 16val mlop = [bigop] 17val mleq = bigop :: trans "i=" @ [fraction (trans "n.(n+1)") (trans "2")] 18val one = trans "1" 19fun scr s = let val nuc = trans s 20 in [sub nuc one, sup nuc one, supsub nuc one one] end 21val mlss = scr "M" @ scr "P" @ scr "g" @ scr "f" @ scr "ac" @ scr "ab" 22 23fun fss f = let val One = SOME one 24 in [f One NONE, f NONE One, f One One] end 25 26val mlss' = fss sum @ fss int @ scr "a" @ scr "b" @ scr "aa" @ scr "ab" 27 28val overmlss' = [overline mlss'] 29 30val out = ShipOut.shipOut 31fun test1 () = (out [disp mlar, line mlar, disp mleq, line mleq]; "test1 complete") 32fun test2 () = (out [disp mlss', disp overmlss', line mlss', line overmlss']; "test2 complete") 33 34 35 36val mlaccents = accent "check" (trans "a") :: trans "+" @ 37 accent "check" (trans "T") :: trans "+" @ 38 accent "hat" (trans "a") :: trans "+" @ 39 [accent "tilde" (trans "g")] 40val mlwidehat = accent "widehat" (trans "a") :: trans "+" @ 41 accent "widehat" (trans "aa") :: trans "+" @ 42 [accent "widehat" (trans "aaa")] 43val two = trans "2"; 44val mlaccentscripts = accent "check" (trans "a") :: trans "+" @ 45 trans "a+" @ 46 sup [accent "check" (trans "a")] two :: trans "+" @ 47 sup (trans "a") two :: trans "+" @ 48 sub [accent "check" (trans "a")] two :: trans "+" @ 49 sub (trans "a") two :: trans "+" @ 50 supsub [accent "check" (trans "a")] two two :: trans "+" @ 51 [supsub (trans "a") two two] 52 53fun testaccents () = (out [line mlwidehat, line mlaccents, line mlaccentscripts]; "testaccents complete") 54 55val mlradical = sqrt (trans "a") :: trans "=" @ 56 sqrt (trans "2x-3") :: trans "." @ 57 [sqrt [(supsub (trans "y") one one)]] 58fun testradical () = (out [disp mlradical]; "testradical complete") 59 60val mltall' = [atop [atop mlar mlar] [atop mlar mlar]] 61val mltall = [atop mltall' mltall'] 62val mldelims = MathTypes.LeftRight (delim "lparen", mlar, delim "rparen") :: trans "+" @ 63 MathTypes.LeftRight (delim "langle", mleq, delim "rangle") :: trans "+" @ 64 [MathTypes.LeftRight (delim "lbracket", mltall, delim "rbracket")] 65fun testdelims () = (out [line mldelims, disp mldelims]; "testdelims complete")