[Aimmath-commit] AIM/WEB-INF/maple/aim LaTeX.mpl,1.2,1.3
Brought to you by:
gustav_delius,
npstrick
From: <nps...@us...> - 2003-08-30 21:06:15
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv13705/WEB-INF/maple/aim Modified Files: LaTeX.mpl Log Message: Removed redefinitions of various latex functions, as the Maple 8 versions of these functions have been improved and no longer need to be overriden. Index: LaTeX.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/LaTeX.mpl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LaTeX.mpl 25 Aug 2003 21:47:19 -0000 1.2 --- LaTeX.mpl 30 Aug 2003 21:06:11 -0000 1.3 *************** *** 48,149 **** ): - `Package/Assign`( - `latex/diff`, - "", - proc(a, b) - local `\\partial `,`\\frac `, `{`, `}`, - d, n, A, num,denom,ans, blist, x, y, i, c,short; - if nargs < 2 then ERROR(`invalid arguments`) fi; - - A := a; # the expression to differentiate - c := args[2 .. nargs]; # the list of variables wrt which to differentiate - - # It could happen that A is already a differential expression - # like Diff(B,x). If so, we want to remove the differential - # operator from A and absorb it into c. - blist := NULL; - while type(A, function) and member(op(0, A), {'diff', 'Diff'}) do - blist := op(2 .. nops(A), A), blist; A := op(1, A) - od; - - blist := [`latex/latex/reverse`(c, blist)]; - # blist is now the (possibly expanded) list of variables - # wrt which to differentiate. - - # denom is the denominator of the differential operator - # eg for Diff(f(x,y),x,x,y), denom would be a list of names - # that would concatenate to give {dx^2 dy}. - denom := `{`; - x := blist[1]; - n := 0; - for y in blist do - if y = x then n := n + 1; next fi; - denom := denom, d, `latex/print`(x^n); - x := y; - n := 1 - od; - denom := denom, d, `latex/print`(y^n), `}`; - - # If A is now a single character name (eg 'y') then - # we put short = true and format the derivative like - # \frac{dy}{dx}. If A is anything more complicated (eg 'f(x)') - # we put short = false and format the derivative like - # \frac{d}{dx} f(x). - short := - evalb(type([A],[symbol]) and length(convert(A,string)) = 1); - - num := `\\frac `, `{`, d; - if 1 < nops(blist) then - num := num, `^`, `{`, `latex/print`(nops(blist)), `}`; - fi; - if short then num := num, `latex/print`(A); fi; - num := num, `}`; - - ans := num,denom; - if not(short) then - ans := `{`,ans,`}`; - if type(A, {'function', 'name'}) then - ans := ans, `latex/print`(A) - else - ans := ans, `latex/latex/prinpar`(A) - fi; - fi; - - if 1 < nops(indets(A, name)) then - RETURN(op(subs(d = `\\partial `, [ans]))) - else RETURN(ans) - fi - end - ): - - `Package/Assign`( - `latex/latex/**`, - "This function overrides the default Maple routine for - LaTeX'ing powers, to prevent conversion of x^(1/n) to - \\sqrt[n]{x}. This is necessary because TtH cannot - render \\sqrt[n]{x} very well.", - proc (e::anything) - local texlist,`[`,`\\frac `,`\\sqrt `,`]`,`{`,`}`; - - texlist := NULL; - if type(op(2,e),'fraction') and abs(op([2, 1],e)) = 1 - and abs(op([2, 2],e)) < 10 and op(2,e) < 0 then - texlist:=texlist,`{`,`\\frac`,`{`,1,`}`,`{`,`latex/print`(1/e),`}`,`}` - elif type(op(1,e),{name,numeric}) and op(2,e) = 1/2 then - texlist := `\\sqrt `,`{`,`latex/print`(op(1,e)),`}`; - else - if - type(op(1,e),{'`+`','`*`','`^`','function','series','fraction','negative'}) - then - texlist:=texlist,`latex/latex/prinpar`(op(1,e)) - else - texlist:=texlist,`{`,`latex/print`(op(1,e)),`}` - fi; - texlist:=texlist,`^`,`{`,`latex/print`(op(2,e)),`}` - fi; - texlist - end - ): - `Package/Assign`( --- 48,51 ---- *************** *** 198,316 **** ): - `Package/Assign`( - `latex/latex/symbol`, - "", - proc(QQ) - local texlist, s,n,`{`, `}`, `\\_`; - option system, remember; - if assigned(`latex/special_names`[cat(``,QQ)]) then - texlist := `latex/special_names`[cat(``,QQ)] - elif member(QQ, eval(`latex/greek`, 1)) then - texlist := `latex/latex/copy`(cat(`\\`,QQ)) - else - texlist := `latex/latex/copy`(QQ); - s := convert(texlist,string); - if s <> "" and substring(s,1..1) = "&" then - s := substring(s,2..-1); - n := convert(s,name); - texlist := `latex/latex/copy`(n); - fi; - fi; - RETURN(texlist); - end - ): - - `Package/Assign`( - `latex/latex/*`, - "", - proc(e) - local subexp, den, ee, subee, i, num, texlist, lnum,lden, `\\,`, `\\frac `, `\\sqrt `, - `{`, `}`; - global _LatexSmallFractionConstant; - option - `Copyright (c) 1992 by the University of Waterloo. All rights reserved.`; - - if type(op(1, e), 'numeric') and op(1, e) < 0 then - RETURN(`latex/latex/copy`('`-`'), `latex/print`(-e)) - fi; - if type(op(1, e), 'numeric') then - i := _LatexSmallFractionConstant; - _LatexSmallFractionConstant := 50; - texlist := - `latex/print`(op(1, e)), `\\,`, `latex/print`(subsop(1 = 1, e)) - ; - _LatexSmallFractionConstant := i; - RETURN(texlist) - fi; - texlist := NULL; - num := 1; - den := 1; - ee := e; - for subee in [op(ee)] do - if type(subee, 'fraction') then - num := num*op(1, subee); den := den*op(2, subee) - elif type(subee, '`^`') and type(op(2, subee), 'rational') and - op(2, subee) < 0 then - if type(subee,table) then - den := den/op(subee) - else - den := den/subee - fi - else - if type(subee,table) then - num := num*op(subee) - else - num := num*subee - fi - fi - od; - if den <> 1 then - if type(num, '`latex/istall`') or type(den, '`latex/istall`') then - if num <> 1 then - texlist := `latex/print`(num); - if type(num, `+`) then - texlist := `\\left(`, texlist, `\\right)` - fi - else texlist := NULL - fi; - if type(den, '`*`') then den := [op(den)] else den := [den] fi; - for subexp in den do - texlist := texlist, `latex/print`(1/subexp) - od; - texlist - else - lnum := `if`(type(num,table), - `latex/print`(op(num)), - `latex/print`(num)); - lden := `if`(type(den,table), - `latex/print`(op(den)), - `latex/print`(den)); - texlist := texlist, `{`, '`\\frac `', '`{`', - lnum, '`}`', '`{`', lden, '`}`', `}`; - fi - else - i := 1; - for subee in ee do - if type(subee, {'series', '`+`'}) then - texlist := texlist, `latex/latex/prinpar`(subee) - elif i < nops(ee) and type(subee, 'function') and - member(op(0, subee), {diff, Diff}) then - texlist := texlist, `latex/latex/prinpar`(subee) - elif type(subee,table) then - texlist := texlist,`latex/print`(op(subee)); - else texlist := texlist, `latex/print`(subee) - fi; - if i < nops(ee) and ( - i = 1 and type(op(1, ee), 'integer') or type(subee, '`!`') or - type(subee, {'string', 'symbol'}) and 1 < length(subee) or - has([`latex/print`(subee)], '`\\sqrt `')) then - texlist := texlist, `\\,` - fi; - i := i + 1 - od - fi; - RETURN(texlist) - end - ): `Package/Assign`( --- 100,103 ---- *************** *** 511,514 **** --- 298,302 ---- `Package/Assign`(`LaTeX/Subs` ,"", `aim/LaTeX/Subs`): `Package/Assign`(`LaTeX/Wrap` ,"", `aim/LaTeX/Wrap`): + `Package/Assign`(`LaTeX/WrapSubs` ,"", `aim/LaTeX/WrapSubs`): `Package/Assign`(`LaTeX/Display` ,"", `aim/LaTeX/Display`): `Package/Assign`(`LaTeX/DisplayParse`,"", `aim/LaTeX/DisplayParse`): |