[Aimmath-commit] AIM/WEB-INF/maple/aim LaTeX.mpl,1.8,1.9
Brought to you by:
gustav_delius,
npstrick
From: <mo...@us...> - 2003-09-15 01:02:51
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv9687 Modified Files: LaTeX.mpl Log Message: fixed bug that causes and error for latex(``). Removed `` around nonstandard symbols in latex output Index: LaTeX.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/LaTeX.mpl,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** LaTeX.mpl 12 Sep 2003 03:16:07 -0000 1.8 --- LaTeX.mpl 15 Sep 2003 01:02:29 -0000 1.9 *************** *** 48,52 **** #): ! ## KM #`Package/Assign`( # `latex/latex/symbol`, --- 48,53 ---- #): ! # KM ! # WAS: #`Package/Assign`( # `latex/latex/symbol`, *************** *** 70,74 **** # RETURN(texlist); # end ! #): `Package/Assign`( --- 71,162 ---- # RETURN(texlist); # end ! ! `Package/Assign`( ! `latex/latex/symbol_no`, ! "This is the Maple 7 version of this routine, modified to prevent nonstandard symbols from being surrounded by single quotes, @`@, and fix a bug that caused and error when converting the symbol @``@ to latex. @aim/LaTeX(``)@ now returns @NULL@)", ! proc(QQ) ! local texlist, `{`, `}`, `\\_`, QQtmp; ! option system, remember; ! # KM ! # WAS: if assigned(`latex/special_names`[`` || QQ]) then ! if QQ = `` then return NULL; ! elif assigned(`latex/special_names`[`` || QQ]) then ! # END KM ! texlist := `latex/special_names`[evaln(`` || QQ)] ! elif member(QQ, eval(`latex/greek`, 1)) then ! texlist := `latex/latex/copy`(`\\` || QQ) ! elif has(`latex/mathops`, QQ) then ! texlist := `latex/latex/copy`(`\\` || QQ) ! elif 0 < length(QQ) and has({"A", "B", "C", "D", "E", "F", "G", "H", ! "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", ! "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", ! "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", ! "y", "z", "'"}, convert(substring(QQ, 1 .. 1), string)) and {} = ! convert(`latex/latex/chars_in_string`(QQ), 'set') minus ({"A", "B", ! "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", ! "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", ! "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", ! "s", "t", "u", "v", "w", "x", "y", "z", "'"} union ! {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}) then ! if length(QQ) = 1 then texlist := `latex/latex/copy`(QQ) ! else texlist := ! `{`, `latex/csname_font`, `latex/latex/copy`(QQ), `}` ! fi ! elif 0 < length(QQ) and has({"A", "B", "C", "D", "E", "F", "G", "H", ! "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", ! "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", ! "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", ! "y", "z", "'"} union {"_"}, convert(substring(QQ, 1 .. 1), string)) ! and {"_"} = convert(`latex/latex/chars_in_string`(QQ), 'set') minus ( ! {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", ! "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", ! "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", ! "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "'"} union ! {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}) then texlist := ! `{`, `latex/csname_font`, ! cat(op(subs("_" = "\\_", `latex/latex/chars_in_string`(QQ)))), `}` ! elif is(QQ, BottomProp) <> FAIL and substring(QQ, -1 .. -1) = '~' and ! 0 < length(QQ) and has({"A", "B", "C", "D", "E", "F", "G", "H", "I", ! "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", ! "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", ! "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", ! "z", "'"}, convert(substring(QQ, 1 .. 1), string)) and {"~"} = ! convert(`latex/latex/chars_in_string`(QQ), 'set') minus ({"A", "B", ! "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", ! "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", ! "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", ! "s", "t", "u", "v", "w", "x", "y", "z", "'"} union ! {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}) then ! QQtmp := substring(QQ, 1 .. -2); ! if length(QQtmp) = 1 then texlist := `latex/latex/copy`(QQtmp) ! else texlist := ! `{`, `latex/csname_font`, `latex/latex/copy`(QQtmp), `}` ! fi ! elif is(QQ, BottomProp) <> FAIL and substring(QQ, -1 .. -1) = '~' and ! 0 < length(QQ) and has({"A", "B", "C", "D", "E", "F", "G", "H", "I", ! "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", ! "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", ! "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", ! "z", "'"} union {"_"}, convert(substring(QQ, 1 .. 1), string)) and ! {"_", "~"} = convert(`latex/latex/chars_in_string`(QQ), 'set') minus ( ! {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", ! "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", ! "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", ! "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "'"} union ! {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}) then texlist := ! `{`, `latex/csname_font`, cat(op(subs("_" = "\\_", ! `latex/latex/chars_in_string`(substring(QQ, 1 .. -2))))), `}` ! # KM ! # WAS: else texlist := `\\mbox `, `{` $ 2, `latex/verbatim_font`, cat(`\``, ! else texlist := `\\mbox `, `{` $ 2, `latex/verbatim_font`, cat( ! op(subs("``" = "````", "#" = "\\#", "$" = "\\$", "%" = "\\%", ! "&" = "\\&", "_" = "\\_", "{" = "\\{", "}" = "\\}", "~" = "\\~{}", ! "^" = "\\^{}", "\\" = "$\\backslash$", "<" = "$<$", ">" = "$>$", ! # WAS: "|" = "$|$", `latex/latex/chars_in_string`(QQ))), `\``), `}` $ 2 ! "|" = "$|$", `latex/latex/chars_in_string`(QQ))) ), `}` $ 2 ! fi; ! return texlist ! end ! ): `Package/Assign`( *************** *** 93,99 **** # WAS: if op(2, e) <> 1/2 then # WAS: texlist := texlist, `[`, 1/op(2, e), `]` ! # WAS: end if; # WAS: texlist := texlist, `{`, `latex/print`(op(1, e)), `}` ! # WAS: end if if type(op(2, e),fraction) and op(2,e)=1/2 and type(op(1,e),integer) and 0<=op(1,e) and op(1,e)<10 then --- 181,187 ---- # WAS: if op(2, e) <> 1/2 then # WAS: texlist := texlist, `[`, 1/op(2, e), `]` ! # WAS: fi; # WAS: texlist := texlist, `{`, `latex/print`(op(1, e)), `}` ! # WAS: fi if type(op(2, e),fraction) and op(2,e)=1/2 and type(op(1,e),integer) and 0<=op(1,e) and op(1,e)<10 then *************** *** 117,145 **** ): - #proc (e::anything) - # local texlist,`[`,`\\frac `,`\\sqrt `,`]`,`{`,`}`; - # - # texlist := NULL; - # I don't ever want it to do any of this... I'll force it to simplify if I want it that way - # dist if type(op(2,e),'fraction') and abs(op([2, 1],e)) = 1 - # dist and abs(op([2, 2],e)) < 10 and op(2,e) < 0 then - # dist texlist:=texlist,`{`,`\\frac`,`{`,1,`}`,`{`,`latex/print`(1/e),`}`,`}` - # dist elif type(op(1,e),{name,numeric}) and op(2,e) = 1/2 then - # dist texlist := `\\sqrt `,`{`,`latex/print`(op(1,e)),`}`; - # dist 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)),`}`; - ## KM - ## dist fi; - ## END KM - # texlist - # end - #): - # KM `Package/Assign`( --- 205,208 ---- *************** *** 221,225 **** if type(op(1, e), 'numeric') and op(1, e) < 0 then return `latex/latex/copy`('`-`'), `latex/print`(-e) ! end if; if type(op(1, e), 'numeric') then # i := _LatexSmallFractionConstant; --- 284,288 ---- 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; *************** *** 229,233 **** # _LatexSmallFractionConstant := i; return texlist ! end if; texlist := NULL; num := 1; --- 292,296 ---- # _LatexSmallFractionConstant := i; return texlist ! fi; texlist := NULL; num := 1; *************** *** 240,244 **** op(2, subee) < 0 then den := den/subee else num := num*subee ! end if end do; if den <> 1 then --- 303,307 ---- op(2, subee) < 0 then den := den/subee else num := num*subee ! fi end do; if den <> 1 then *************** *** 248,257 **** if type(num, '`+`') then texlist := ` \\left( `, texlist, ` \\right) ` ! end if else texlist := NULL ! end if; if type(den, '`*`') then den := [op(den)] else den := [den] ! end if; for subexp in den do texlist := texlist, `latex/print`(1/subexp) --- 311,320 ---- 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) *************** *** 261,265 **** `latex/print`(num), '`}`', '`{`', `latex/print`(den), '`}`', `}` ! end if else i := 1; --- 324,328 ---- `latex/print`(num), '`}`', '`{`', `latex/print`(den), '`}`', `}` ! fi else i := 1; *************** *** 279,283 **** texlist := texlist, `latex/latex/prinpar`(ff[k]) else texlist := texlist, `latex/print`(ff[k]) ! end if; if i < nops(ee) and ( i = 1 and type(op(1, ee), 'integer') or type(ff[k], '`!`') or --- 342,346 ---- texlist := texlist, `latex/latex/prinpar`(ff[k]) else texlist := texlist, `latex/print`(ff[k]) ! fi; if i < nops(ee) and ( i = 1 and type(op(1, ee), 'integer') or type(ff[k], '`!`') or *************** *** 285,292 **** has([`latex/print`(ff[k])], '`\\sqrt `')) then texlist := texlist, `\\,` ! end if; i := i + 1 end do ! end if; texlist end --- 348,355 ---- has([`latex/print`(ff[k])], '`\\sqrt `')) then texlist := texlist, `\\,` ! fi; i := i + 1 end do ! fi; texlist end |