mets/METS.php0100644004706200001440000006544411553755030012360 0ustar meditusersloadXML($mathcode); $xsltom2c="contet2Latex/omtocmml.xsl"; $xslom2c = new DomDocument; $xslom2c->load($xsltom2c); $procom2c = new XSLTProcessor; $procom2c->importStyleSheet($xslom2c); $resultom2c= $procom2c->transformToXML($xmlom2c); if (!$resultom2c) { echo 'openamth to content fail! ' ; } else { $outmath=$resultom2c; } return $outmath; } } class CTOOM{// content to openmath var $mathcode; function c2om($mathcode) { $xmlc2om = new DomDocument; $xmlc2om->loadXML($mathcode); $xsltc2om="contet2Latex/cmmltoom.xsl"; $xslc2om = new DomDocument; $xslc2om->load($xsltc2om); $procc2om = new XSLTProcessor; $procc2om->importStyleSheet($xslc2om); $resultc2om= $procc2om->transformToXML($xmlc2om); if (!$resultc2om) { echo 'openamth to content fail! ' ; } else { $outmath=$resultc2om; } return $outmath; } } class CTOP{//content to presentaion var $mathcode; function c2pre($mathcode) { $xmlc2p = new DomDocument; $xmlc2p->loadXML($mathcode); $xsltc2p="contet2Latex/mmlctop.xsl"; $xslc2p = new DomDocument; $xslc2p->load($xsltc2p); $procc2p = new XSLTProcessor; $procc2p->importStyleSheet($xslc2p); $resultc2p= $procc2p->transformToXML($xmlc2p); if (!$resultc2p) { echo 'content to presentaion fail! ' ; } else { $outmath=$resultc2p; } return $outmath; } } class CTOB{//content to braille var $mathcode; function c2brl($mathcode) { $xmlc2b = new DomDocument; $xmlc2b->loadXML($mathcode); $xsltc2b="contet2Latex/mml2brl.xsl"; $xslc2b = new DomDocument; $xslc2b->load($xsltc2b); $procc2b = new XSLTProcessor; $procc2b->importStyleSheet($xslc2b); $resultc2b= $procc2b->transformToXML($xmlc2b); if (!$resultc2b) { echo 'content to braille fail! ' ; } else { $outmath=$resultc2b; } return $outmath; } } class PTOL{//content to presentaion var $mathcode; function pre2l($mathcode) { $xmlp2l = new DomDocument; $xmlp2l->loadXML($mathcode); $xsltp2l="contet2Latex/mmltex.xsl"; $xslp2l = new DomDocument; $xslp2l->load($xsltp2l); $procp2l = new XSLTProcessor; $procp2l->importStyleSheet($xslp2l); $resultp2l= $procp2l->transformToXML($xmlp2l); if (!$resultp2l) { echo 'presentaion to latex fail! ' ; } else { $outmath=$resultp2l; } return $outmath; } } class MTEX{// create tex var $latexcode; function ctex($latexcode) { $fname =time().rand("111","999"); $filename="$fname".".tex"; $fp = fopen($filename, "w+") or die("Couldn't open $filename"); $latex1="\documentclass[30pt]{article}"."\n"."\pagestyle{empty}"."\n"."\usepackage{amsmath}"."\n"."\begin{document}"."\n"."\begin{center}"."\n"; fwrite($fp,$latex1); //$latexexp="\Huge".$_GET['latexexp']; //$equetion='$\displaystyle\int^{2\pi}_0\sin^2\theta d\theta =\frac{1}{2}$'; fwrite($fp,$latexcode); $latex2="\n"."\end{center}"."\n"."\end{document}"; fwrite($fp,$latex2); chmod($filename,0777); return $fname; } } $informat=$_GET['reqFormat']; $incode=$_GET['reqCode']; $outformat=$_GET['outFormat']; $size=$_GET['size']; switch($informat) { case "openmath": { switch($outformat) { case "openmath": echo $incode; break; case "content": { $incode="".$incode; $mathom2c = new OMTOC; $outcontent=$mathom2c->om2c($incode); echo $outcontent ; } break; case "presentation": { $incode="".$incode; $mathom2c = new OMTOC; $outcontent=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outpresentation = $mathc2p->c2pre($outcontent); echo $outpresentation; } break; case "latex": { $incode="".$incode; $mathom2c = new OMTOC; $outcontent=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($outcontent); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); echo $outlatex ; } break; case "braille": { $incode="".$incode; $mathom2c = new OMTOC; $outcontent=$mathom2c->om2c($incode); $mathc2b = new CTOB; $outbraille=$mathc2b->c2brl($outcontent); $outbraille=str_replace(array("\r","\n"),array("",""),$outbraille); echo $outbraille ; } break; case "gif": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $outlatex=$size.$outlatex; $ftex = new MTEX; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvigif -O -5in,-5in $texname.dvi -o $texname.gif ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.gif picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.gif"; }break; case "png": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvipng -O -5in,-5in $texname.dvi -o $texname.png ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.png picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.png"; } break; case "pdf": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvipdfmx $texname.dvi ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.pdf picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.pdf"; }break; case "ps": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvips -O -5in,-5in $texname.dvi -o $texname.ps ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.ps picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.ps"; }break; case "dvi": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/temp/$texname.dvi"; }break; default: echo"fomat is wrong!1"; } }break; case "content": { switch($outformat) { case "openmath": { $incode="".$incode; $mathc2om = new CTOOM; $outopenmath=$mathc2om->c2om($incode); echo "$outopenmath"; }break; case "content": { $incode="".$incode; echo $incode; } break; case "presentation": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); echo $outpresentation ; } break; case "braille": { $incode="".$incode; $mathc2b = new CTOB; $outbraille=$mathc2b->c2brl($incode); $outbraille=str_replace(array("\r","\n"),array("",""),$outbraille); echo $outbraille ; } break; case "latex": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); echo $outlatex ; } break; case "gif": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvigif -O -5in,-5in $texname.dvi -o $texname.gif ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.gif picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.gif"; }break; case "png": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvipng -O -5in,-5in $texname.dvi -o $texname.png ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.png picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.png"; }break; case "pdf": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvipdfmx $texname.dvi ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.pdf picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.pdf"; }break; case "ps": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvips -O -5in,-5in $texname.dvi -o $texname.ps ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.ps picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.ps"; }break; case "dvi": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/temp/$texname.dvi"; }break; default: echo"fomat is wrong!"; } }break; case "presentation": { switch($outformat) { case "openmath": echo "Conversion is not feasible"; break; case "content": echo "Conversion is not feasible"; break; case "presentation": echo $incode; break; case "latex": { $incode="".$incode; $mathp2l = new PTOL; $outpresentation=$mathp2l->pre2l($incode); echo $outpresentation; } break; case "gif": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvigif -O -5in,-5in $texname.dvi -o $texname.gif ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.gif picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.gif"; }break; case "png": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvipng -O -5in,-5in $texname.dvi -o $texname.png ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.png picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.png"; }break; case "pdf": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); //exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvipdfmx $texname.dvi ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.pdf picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.pdf"; }break; case "ps": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvips -O -5in,-5in $texname.dvi -o $texname.ps ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.ps picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.ps"; }break; case "dvi": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/temp/$texname.dvi"; }break; default: echo" fomat is wrong!"; } }break; case "latex": { switch($outformat) { case "openmath": echo "can't convert"; break; case "content": echo "can't convert"; break; case "Presentation": echo "can't convert"; break; case "latex": echo $incode; break; case "gif": { $ftex = new MTEX; $incode=$size.$incode; $texname=$ftex->ctex($incode); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvigif -O -5in,-5in $texname.dvi -o $texname.gif ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.gif picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.gif"; }break; case "png": { $ftex = new MTEX; $texname=$ftex->ctex($incode); $incode=$size.$incode; exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvipng -O -5in,-5in $texname.dvi -o $texname.png ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.png picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.png"; }break; case "pdf": { $ftex = new MTEX; $texname=$ftex->ctex($incode); $incode=$size.$incode; exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvipdfmx $texname.dvi ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec(" mv $texname.pdf picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.pdf"; }break; case "ps": { $ftex = new MTEX; $texname=$ftex->ctex($incode); $incode=$size.$incode; exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec("/usr/local/texlive/2007/bin/i386-linux/dvips -O -5in,-5in $texname.dvi -o $texname.ps ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec(" mv $texname.ps picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.ps"; }break; case "dvi": { $ftex = new MTEX; $incode=$size.$incode; $texname=$ftex->ctex($incode); exec("/usr/local/texlive/2007/bin/i386-linux/latex $texname.tex",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/temp/$texname.dvi"; }break; default: echo"fomat is wrong!"; } }break; default: echo"fomat is wrong!"; } ?> mets/METS02.php0100644000000000000000000006016111244127073012155 0ustar rootrootloadXML($mathcode); $xsltom2c="contet2Latex/omtocmml.xsl"; $xslom2c = new DomDocument; $xslom2c->load($xsltom2c); $procom2c = new XSLTProcessor; $procom2c->importStyleSheet($xslom2c); $resultom2c= $procom2c->transformToXML($xmlom2c); if (!$resultom2c) { echo 'openamth to content fail! ' ; } else { $outmath=$resultom2c; } return $outmath; } } class CTOOM{// content to openmath var $mathcode; function c2om($mathcode) { $xmlc2om = new DomDocument; $xmlc2om->loadXML($mathcode); $xsltc2om="contet2Latex/cmmltoom.xsl"; $xslc2om = new DomDocument; $xslc2om->load($xsltc2om); $procc2om = new XSLTProcessor; $procc2om->importStyleSheet($xslc2om); $resultc2om= $procc2om->transformToXML($xmlc2om); if (!$resultc2om) { echo 'openamth to content fail! ' ; } else { $outmath=$resultc2om; } return $outmath; } } class CTOP{//content to presentaion var $mathcode; function c2pre($mathcode) { $xmlc2p = new DomDocument; $xmlc2p->loadXML($mathcode); $xsltc2p="contet2Latex/mmlctop.xsl"; $xslc2p = new DomDocument; $xslc2p->load($xsltc2p); $procc2p = new XSLTProcessor; $procc2p->importStyleSheet($xslc2p); $resultc2p= $procc2p->transformToXML($xmlc2p); if (!$resultc2p) { echo 'content to presentaion fail! ' ; } else { $outmath=$resultc2p; } return $outmath; } } class PTOL{//content to presentaion var $mathcode; function pre2l($mathcode) { $xmlp2l = new DomDocument; $xmlp2l->loadXML($mathcode); $xsltp2l="contet2Latex/mmltex.xsl"; $xslp2l = new DomDocument; $xslp2l->load($xsltp2l); $procp2l = new XSLTProcessor; $procp2l->importStyleSheet($xslp2l); $resultp2l= $procp2l->transformToXML($xmlp2l); if (!$resultp2l) { echo 'presentaion to latex fail! ' ; } else { $outmath=$resultp2l; } return $outmath; } } class MTEX{// create tex var $latexcode; function ctex($latexcode) { $fname =time().rand("111","999"); $filename="$fname".".tex"; $fp = fopen($filename, "w+") or die("Couldn't open $filename"); $latex1="\documentclass[30pt]{article}"."\n"."\pagestyle{empty}"."\n"."\begin{document}"."\n"."\begin{center}"."\n"; fwrite($fp,$latex1); //$latexexp="\Huge".$_GET['latexexp']; //$equetion='$\displaystyle\int^{2\pi}_0\sin^2\theta d\theta =\frac{1}{2}$'; fwrite($fp,$latexcode); $latex2="\n"."\end{center}"."\n"."\end{document}"; fwrite($fp,$latex2); chmod($filename,0777); return $fname; } } $informat=$_GET['reqFormat']; $incode=$_GET['reqCode']; $outformat=$_GET['outFormat']; $size=$_GET['size']; switch($informat) { case "openmath": { switch($outformat) { case "openmath": echo $incode; break; case "content": { $incode="".$incode; $mathom2c = new OMTOC; $outcontent=$mathom2c->om2c($incode); echo $outcontent ; } break; case "presentation": { $incode="".$incode; $mathom2c = new OMTOC; $outcontent=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outpresentation = $mathc2p->c2pre($outcontent); echo $outpresentation; } break; case "latex": { $incode="".$incode; $mathom2c = new OMTOC; $outcontent=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($outcontent); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); echo $outlatex ; } break; case "gif": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $outlatex=$size.$outlatex; $ftex = new MTEX; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvigif -O -5in,-5in $texname.dvi -o $texname.gif ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.gif picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.gif"; }break; case "png": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvipng -O -5in,-5in $texname.dvi -o $texname.png ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.png picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.png"; } break; case "pdf": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvipdf $texname.dvi $texname.pdf",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.pdf picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.pdf"; }break; case "ps": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvips -O -5in,-5in $texname.dvi -o $texname.ps ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.ps picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.ps"; }break; case "dvi": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/temp/$texname.dvi"; }break; default: echo"fomat is wrong!1"; } }break; case "content": { switch($outformat) { case "openmath": { $incode="".$incode; $mathc2om = new CTOOM; $outopenmath=$mathc2om->c2om($incode); echo "$outopenmath"; }break; case "content": { $incode="".$incode; echo $incode; } break; case "presentation": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); echo $outpresentation ; } break; case "latex": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); echo $outlatex ; } break; case "gif": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvigif -O -5in,-5in $texname.dvi -o $texname.gif ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.gif picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.gif"; }break; case "png": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvipng -O -5in,-5in $texname.dvi -o $texname.png ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.png picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.png"; }break; case "pdf": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvipdf $texname.dvi $texname.pdf",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.pdf picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.pdf"; }break; case "ps": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvips -O -5in,-5in $texname.dvi -o $texname.ps ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.ps picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.ps"; }break; case "dvi": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/temp/$texname.dvi"; }break; default: echo"fomat is wrong!"; } }break; case "presentation": { switch($outformat) { case "openmath": echo "Conversion is not feasible"; break; case "content": echo "Conversion is not feasible"; break; case "presentation": echo $incode; break; case "latex": { $incode="".$incode; $mathp2l = new PTOL; $outpresentation=$mathp2l->pre2l($incode); echo $outpresentation; } break; case "gif": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvigif -O -5in,-5in $texname.dvi -o $texname.gif ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.gif picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.gif"; }break; case "png": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvipng -O -5in,-5in $texname.dvi -o $texname.png ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.png picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.png"; }break; case "pdf": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("latex $texname.tex",$res, $rc); exec("dvipdf $texname.dvi $texname.pdf",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.pdf picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.pdf"; }break; case "ps": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvips -O -5in,-5in $texname.dvi -o $texname.ps ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.ps picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.ps"; }break; case "dvi": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/temp/$texname.dvi"; }break; default: echo" fomat is wrong!"; } }break; case "latex": { switch($outformat) { case "openmath": echo "can't convert"; break; case "content": echo "can't convert"; break; case "Presentation": echo "can't convert"; break; case "latex": echo $incode; break; case "gif": { $ftex = new MTEX; $incode=$size.$incode; $texname=$ftex->ctex($incode); exec("latex $texname.tex",$res, $rc); exec("dvigif -O -5in,-5in $texname.dvi -o $texname.gif ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.gif picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.gif"; }break; case "png": { $ftex = new MTEX; $texname=$ftex->ctex($incode); $incode=$size.$incode; exec("latex $texname.tex",$res, $rc); exec("dvipng -O -5in,-5in $texname.dvi -o $texname.png ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.png picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.png"; }break; case "pdf": { $ftex = new MTEX; $texname=$ftex->ctex($incode); $incode=$size.$incode; exec("latex $texname.tex",$res, $rc); exec("dvipdf $texname.dvi $texname.pdf ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.pdf picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.pdf"; }break; case "ps": { $ftex = new MTEX; $texname=$ftex->ctex($incode); $incode=$size.$incode; exec("latex $texname.tex",$res, $rc); exec("dvips -O -5in,-5in $texname.dvi -o $texname.ps ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.ps picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/picture/$texname.ps"; }break; case "dvi": { $ftex = new MTEX; $incode=$size.$incode; $texname=$ftex->ctex($incode); exec("latex $texname.tex",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/METS",$url); echo $res[0]."/temp/$texname.dvi"; }break; default: echo"fomat is wrong!"; } }break; default: echo"fomat is wrong!"; } ?> mets/METSnew.html0100644000000000000000000002437511516705103012707 0ustar rootroot WME: MathEdit

Mathematical Expression Translator Web Service

(METS)

     METS is a Web Service. It provides the translating services of different mathematical formula encoding and the generation services of picture, pdf, ps and dvi document.

The following translating services has been provided:

METS sends data in REST, and the result is returned by JSON. Try typing a url into your browser's locator window something like
http://wme.lzu.edu.cn/mathedit/mets/METS.php?reqFormat=latex&reqCode=\[\int^{\pi}_0\sin^2\theta d\theta =\frac{1}{2} \]&outFormat=gif&size =20pt
the return JSON
{"http://wme.lzu.edu.cn/mathedit/mets/picture/1243234837256.gif"}

The key word reqFormat is the format to be converted, reqCode is the code to be converted, outFormat is the translating result, size is the size of picture. There are four reqFormats and nine outFormats to choose.

reqFormat
content, presentation,latex, openmath
outFormat
content, presentation,latex, openmath, gif, png, pdf, dvi, ps

Here we are also to provide conversion interface. Translating Process is as following:

  1. Select the format.
  2. Enter the code.
  3. Select the result format.
  4. Press the Translate button.
  5. Get result.

1. Input format and code

Select format which you want to translate.

Enter the corresponding code, the Content and Presentation code must be between <math>...</math>, the OpenMath code must be <OMOBJ>...</OMOBJ>, the LaTeX code must be between the $....$ or\[...\] .

2. Get result

Decide what kind of output you want:

If the format is gif/gng/pdf/ps/dvi, you can select the size:

If the result is encoding, it will be displayed the following text area. If it is picture, the picture and the URL of the picture will be displayed. If it is that other document, the URL will be displayed. The URL can be directly used in web pages where it is needed, and also be downloaded to the local use.

mets/MTWS.html0100777000000000000000000002306711243410640012217 0ustar rootroot WME: MathEdit

Mathematical Expression Translator Web Service

(MTWS)

     MTWS is a Web Service. It provides the translating services of different mathematical formula encoding and the generation services of picture, pdf, ps and dvi document.

The following translating services has been provided:

MTWS sends data in REST, and the result is returned by JSON. Try typing a url into your browser's locator window something like
http://wme.lzu.edu.cn/mathedit/mets/MTWS.php?reqFormat=latex&reqCode=encodeURIComponent(\[\int^{\pi}_0\sin^2\theta d\theta =\frac{1}{2} \])&outFormat=gif&size=20pt
the return JSON
{"http://wme.lzu.edu.cn/mathedit/mets/picture/1243234837256.gif"}

The key word reqFormat is the format to be converted, reqCode is the code to be converted, outFormat is the translating result, size is the size of picture. There are four reqFormats and night outFormats to choose.

reqFormat
content, presentation,latex, openmath
outFormat
content, presentation,latex, openmath, gif, png, pdf, dvi, ps

Here we are also to provide conversion interface. Translating Process is as following:

  1. Select the format.
  2. Enter the code.
  3. Select the result format.
  4. Press the Translate button.
  5. Get result.

1. Input format and code

Select format which you want to translate.

Enter the corresponding code, the Content and Presentation code must be between <math>...</math>, the OpenMath code must be <OMOBJ>...</OMOBJ>, the LaTeX code must be between the $....$ or\[...\] .

2. Get result

Decide what kind of output you want:

If the format is gif/gng/pdf/ps/dvi, you can select the size:

If the result is encoding, it will be displayed the following text area. If it is picture, the picture and the URL of the picture will be displayed. If it is that other document, the URL will be displayed. The URL can be directly used in web pages where it is needed, and also be downloaded to the local use.

mets/MTWS.php0100777000000000000000000006016111243467163012052 0ustar rootrootloadXML($mathcode); $xsltom2c="contet2Latex/omtocmml.xsl"; $xslom2c = new DomDocument; $xslom2c->load($xsltom2c); $procom2c = new XSLTProcessor; $procom2c->importStyleSheet($xslom2c); $resultom2c= $procom2c->transformToXML($xmlom2c); if (!$resultom2c) { echo 'openamth to content fail! ' ; } else { $outmath=$resultom2c; } return $outmath; } } class CTOOM{// content to openmath var $mathcode; function c2om($mathcode) { $xmlc2om = new DomDocument; $xmlc2om->loadXML($mathcode); $xsltc2om="contet2Latex/cmmltoom.xsl"; $xslc2om = new DomDocument; $xslc2om->load($xsltc2om); $procc2om = new XSLTProcessor; $procc2om->importStyleSheet($xslc2om); $resultc2om= $procc2om->transformToXML($xmlc2om); if (!$resultc2om) { echo 'openamth to content fail! ' ; } else { $outmath=$resultc2om; } return $outmath; } } class CTOP{//content to presentaion var $mathcode; function c2pre($mathcode) { $xmlc2p = new DomDocument; $xmlc2p->loadXML($mathcode); $xsltc2p="contet2Latex/mmlctop.xsl"; $xslc2p = new DomDocument; $xslc2p->load($xsltc2p); $procc2p = new XSLTProcessor; $procc2p->importStyleSheet($xslc2p); $resultc2p= $procc2p->transformToXML($xmlc2p); if (!$resultc2p) { echo 'content to presentaion fail! ' ; } else { $outmath=$resultc2p; } return $outmath; } } class PTOL{//content to presentaion var $mathcode; function pre2l($mathcode) { $xmlp2l = new DomDocument; $xmlp2l->loadXML($mathcode); $xsltp2l="contet2Latex/mmltex.xsl"; $xslp2l = new DomDocument; $xslp2l->load($xsltp2l); $procp2l = new XSLTProcessor; $procp2l->importStyleSheet($xslp2l); $resultp2l= $procp2l->transformToXML($xmlp2l); if (!$resultp2l) { echo 'presentaion to latex fail! ' ; } else { $outmath=$resultp2l; } return $outmath; } } class MTEX{// create tex var $latexcode; function ctex($latexcode) { $fname =time().rand("111","999"); $filename="$fname".".tex"; $fp = fopen($filename, "w+") or die("Couldn't open $filename"); $latex1="\documentclass[30pt]{article}"."\n"."\pagestyle{empty}"."\n"."\begin{document}"."\n"."\begin{center}"."\n"; fwrite($fp,$latex1); //$latexexp="\Huge".$_GET['latexexp']; //$equetion='$\displaystyle\int^{2\pi}_0\sin^2\theta d\theta =\frac{1}{2}$'; fwrite($fp,$latexcode); $latex2="\n"."\end{center}"."\n"."\end{document}"; fwrite($fp,$latex2); chmod($filename,0777); return $fname; } } $informat=$_GET['reqFormat']; $incode=$_GET['reqCode']; $outformat=$_GET['outFormat']; $size=$_GET['size']; switch($informat) { case "openmath": { switch($outformat) { case "openmath": echo $incode; break; case "content": { $incode="".$incode; $mathom2c = new OMTOC; $outcontent=$mathom2c->om2c($incode); echo $outcontent ; } break; case "presentation": { $incode="".$incode; $mathom2c = new OMTOC; $outcontent=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outpresentation = $mathc2p->c2pre($outcontent); echo $outpresentation; } break; case "latex": { $incode="".$incode; $mathom2c = new OMTOC; $outcontent=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($outcontent); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); echo $outlatex ; } break; case "gif": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $outlatex=$size.$outlatex; $ftex = new MTEX; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvigif -O -5in,-5in $texname.dvi -o $texname.gif ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.gif picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.gif"; }break; case "png": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvipng -O -5in,-5in $texname.dvi -o $texname.png ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.png picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.png"; } break; case "pdf": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvipdf $texname.dvi $texname.pdf",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.pdf picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.pdf"; }break; case "ps": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvips -O -5in,-5in $texname.dvi -o $texname.ps ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.ps picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.ps"; }break; case "dvi": { $incode="".$incode; $mathom2c = new OMTOC; $outom2c=$mathom2c->om2c($incode); $mathc2p = new CTOP; $outc2p=$mathc2p->c2pre($outom2c); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outc2p); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/temp/$texname.dvi"; }break; default: echo"fomat is wrong!1"; } }break; case "content": { switch($outformat) { case "openmath": { $incode="".$incode; $mathc2om = new CTOOM; $outopenmath=$mathc2om->c2om($incode); echo "$outopenmath"; }break; case "content": { $incode="".$incode; echo $incode; } break; case "presentation": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); echo $outpresentation ; } break; case "latex": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); echo $outlatex ; } break; case "gif": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvigif -O -5in,-5in $texname.dvi -o $texname.gif ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.gif picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.gif"; }break; case "png": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvipng -O -5in,-5in $texname.dvi -o $texname.png ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.png picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.png"; }break; case "pdf": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvipdf $texname.dvi $texname.pdf",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.pdf picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.pdf"; }break; case "ps": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvips -O -5in,-5in $texname.dvi -o $texname.ps ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.ps picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.ps"; }break; case "dvi": { $incode="".$incode; $mathc2p = new CTOP; $outpresentation=$mathc2p->c2pre($incode); $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($outpresentation); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/temp/$texname.dvi"; }break; default: echo"fomat is wrong!"; } }break; case "presentation": { switch($outformat) { case "openmath": echo "Conversion is not feasible"; break; case "content": echo "Conversion is not feasible"; break; case "presentation": echo $incode; break; case "latex": { $incode="".$incode; $mathp2l = new PTOL; $outpresentation=$mathp2l->pre2l($incode); echo $outpresentation; } break; case "gif": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvigif -O -5in,-5in $texname.dvi -o $texname.gif ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.gif picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.gif"; }break; case "png": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvipng -O -5in,-5in $texname.dvi -o $texname.png ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.png picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.png"; }break; case "pdf": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("latex $texname.tex",$res, $rc); exec("dvipdf $texname.dvi $texname.pdf",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.pdf picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.pdf"; }break; case "ps": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec("dvips -O -5in,-5in $texname.dvi -o $texname.ps ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.ps picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.ps"; }break; case "dvi": { $incode="".$incode; $mathp2l = new PTOL; $outlatex=$mathp2l->pre2l($incode); $ftex = new MTEX; $outlatex=$size.$outlatex; $texname=$ftex->ctex($outlatex); exec("latex $texname.tex",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/temp/$texname.dvi"; }break; default: echo" fomat is wrong!"; } }break; case "latex": { switch($outformat) { case "openmath": echo "can't convert"; break; case "content": echo "can't convert"; break; case "Presentation": echo "can't convert"; break; case "latex": echo $incode; break; case "gif": { $ftex = new MTEX; $incode=$size.$incode; $texname=$ftex->ctex($incode); exec("latex $texname.tex",$res, $rc); exec("dvigif -O -5in,-5in $texname.dvi -o $texname.gif ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.gif picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.gif"; }break; case "png": { $ftex = new MTEX; $texname=$ftex->ctex($incode); $incode=$size.$incode; exec("latex $texname.tex",$res, $rc); exec("dvipng -O -5in,-5in $texname.dvi -o $texname.png ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.png picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.png"; }break; case "pdf": { $ftex = new MTEX; $texname=$ftex->ctex($incode); $incode=$size.$incode; exec("latex $texname.tex",$res, $rc); exec("dvipdf $texname.dvi $texname.pdf ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.pdf picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.pdf"; }break; case "ps": { $ftex = new MTEX; $texname=$ftex->ctex($incode); $incode=$size.$incode; exec("latex $texname.tex",$res, $rc); exec("dvips -O -5in,-5in $texname.dvi -o $texname.ps ",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); exec("mv $texname.ps picture",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/picture/$texname.ps"; }break; case "dvi": { $ftex = new MTEX; $incode=$size.$incode; $texname=$ftex->ctex($incode); exec("latex $texname.tex",$res, $rc); exec(" mv $texname.tex temp",$res, $rc); exec(" mv $texname.log temp",$res, $rc); exec(" mv $texname.aux temp",$res, $rc); exec(" mv $texname.dvi temp",$res, $rc); $url=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')?'https':'http'.'://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"]; $res=explode("/MTWS",$url); echo $res[0]."/temp/$texname.dvi"; }break; default: echo"fomat is wrong!"; } }break; default: echo"fomat is wrong!"; } ?> mets/contet2Latex/0040777000000000000000000000000011352100517013103 5ustar rootrootmets/contet2Latex/omtocmml.xsl0100777000000000000000000011201111206174343015464 0ustar rootroot -10 16 0 1 open closed open-closed closed-open all above below 16 Content MathML cannot add type for the object after this comment. x x 1 0.5 0 0.5 0 ERROR: Error Type: Error occured in CD: Error occured in symbol: ERROR: Error Type: Description: 0 1 π 󰀁 γ 𡑾 󰀂 󰀃 mets/contet2Latex/mml2brl.xsl0100644004706200001440000024650011352075757015554 0ustar meditusers # # - 6 ;I # , ; , ; < > [' .\ ;E/ : < > ,6 - < > - < > - # 6 / , : 2 4 \ \ ; ' < > % : ? % : ? ;5 ;9 6 % < > % < > _ _ _ _ / : < > ^ 3 $A $,RE $,IM < > @7 55 _ 3O 7> "[ ^[ @& @& &7 & 7 O [ O7 [7 ;7 $LN / : $L * : / : * : , < > 2 ;D \ ;D ; /9 $0' $0 $0 8 < > _D < > _# < > ;? < > ;- < > 8 _ _ _S _P .C 7 ./ : ! .* : .* ./ : < > ;D $LM .* 3O : .* : < > < > / : $S $C $T $SC $CS $CT $SH $CH $TH $SCH $CSH $CTH $AS $AC $AT $ASC $ACS $ACT $ASH $ACH $ATH $ASCH $ACSH $ACTH < > ( ) $DT /,T: 8 ' ;8 _Z ,R ,Q _N ,C _R ;E ;I NaN true false @0 .P .G #= mets/contet2Latex/mmlctop.xsl0100777000000000000000000034536311165277672015347 0ustar rootroot e - + &#x2062; &#x2148; - + &#x2062; &#x2148; Polar &#x2062; Polar &#x2062; &#x2061; [ ] -1 &#x03BB; &#x2061; &#x2218; &#x2218; id id domain codomain image &#x2061; { if otherwise &#x230A; &#x230B; &#x2147; ! max min max min | - - - + &#x2062; gcd lcm gcd lcm &#x2061; &#x2227; &#x2061; &#x2228; &#x2061; &#x22BB; &#x2061; &#x00AC; &#x2061; &#x00AC; &#x2061; &#x2200; : , &#x2203; : , &#x00AF; &#x211C; &#x2111; &#x2061; &#x230A; &#x2308; &#x230B; &#x2309; &#x2260; &#x2248; &#x2223; &#x2198; &#x2197; &#x2192; &#x21D2; &#x2208; &#x2209; &#x2284; &#x2288; &#x2286; &#x2282; &#x2265; &#x2264; &#x2261; ln ln log log log log &#x2146; &#x2146; &#x2146; &#x2146; &#x2032; &#x2145; &#x2202; &#x2202; &#x2202; &#x2202; &#x2202; &#x2202; &#x2207; 2 &#x2061; | &#x222A; &#x2229; \ &#x00D7; &#x2211; &#x220F; = &#x2211; &#x220F; &#x2211; &#x220F; &#x222B; &#x222B; &#x222B; &#x222B; &#x222B; &#x2146; lim &#x2192; &#x03C3; &#x03C3; 2 median mode det T &#x00D7; &#x22C5; &#x2297; &#x2124; &#x211D; &#x211A; &#x2115; &#x2102; &#x2119; &#x2147; &#x2148; NaN true false &#x2205; &#x03C0; &#x213D; &#x221E; mets/contet2Latex/tables.xsl0100777000000000000000000001023411165056675015126 0ustar rootroot \multicolumn{ }{c}{ } & \hfill \hfill & \\ \begin{array}{ | | } \hline \\ \hline \end{array} mets/contet2Latex/cmarkup.xsl0100777000000000000000000011002111165056562015304 0ustar rootroot + i / _{} e^{i } E \mathrm{} ( , ) () \left( \left[ , \right) \right] \left\{\right\} ^{(-1)} \mapsto \circ \mathrm{id} \mathop{\mathrm{ }} \begin{cases} \end{cases} & \text{if $ $} \\ & \text{otherwise} \left\lfloor\frac{ }{ }\right\rfloor ! \left( \frac{ }{ } \right) \ \{ \mid , \} - - ( - + ) ^{ } \mod ( \times ) \sqrt [ ] { } \gcd \land \lor \mathop{\mathrm{xor}} \neg \implies \ , \colon \left| \right| \overline{} \Re \Im \lfloor \rfloor \lceil \rceil = \neq > < \ge \le \equiv \approx | \int _{ } ^{ } \d ^\prime \frac{ d^{ } }{d ^{ } d }{d } D_{ , } \frac{\partial^{ + + } }{ \partial ^{ } } , \mathop{\mathrm{div}} \nabla^2 \{\} \left[\right] \colon , \cup \cap \in \notin \subseteq \subset \nsubseteq \not\subset \setminus | | \times ^{ } \sum \prod _{ } ^{ } \lim_{ } \to \searrow \nearrow \rightarrow \to \ \ \mathrm{ \,} \mathrm{ } e^{} \lg \log_{ } \langle , \rangle \sigma \sigma( )^2 \langle ^{ }\rangle _{ } \left(\begin{array}{c} \\ \end{array}\right) \begin{pmatrix} \end{pmatrix} & \\ \det \begin{vmatrix} \end{vmatrix} ^T _{ , } \cdot \otimes \mathbb{Z} \mathbb{R} \mathbb{Q} \mathbb{N} \mathbb{C} \mathbb{P} e i NaN \mbox{true} \mbox{false} \emptyset \pi \gamma \infty ( ) ( ) mets/contet2Latex/mmltex.xsl0100777000000000000000000000241211165035230015141 0ustar rootroot $ $ \[ \] mets/contet2Latex/scripts.xsl0100777000000000000000000003246411165035007015336 0ustar rootroot \overline{ } \overbrace{ } \overleftarrow{ } \overrightarrow{ } \overleftrightarrow{ } \underline{ } \underbrace{ } \underleftarrow{ } \underrightarrow{ } \underleftrightarrow{ } _{ }^{ } \underset{ }{\overset{ }{ }} \overline{ } \overbrace{ } \overleftarrow{ } \overrightarrow{ } \overleftrightarrow{ } \tilde{ } \check{ } \dot{ } \ddot{ } \widehat{ \hat{ } ^{ } \stackrel{ }{ } \underline{ } \underbrace{ } \underleftarrow{ } \underrightarrow{ } \underleftrightarrow{ } _{ } \underset{ }{ } { }_{ }^{ } { }^{ } { }_{ } {}_{ } {}^{ } {} _{ } ^{ } {} _{ } ^{ } mets/contet2Latex/cmmltoom.xsl0100777000000000000000000012500211206215535015467 0ustar rootroot ERROR: OpenMath does not support mixed MathML markup 10 ERROR: Non OpenMath symbol having the following URL: interval_oo interval_cc interval_oc interval_co integer_interval interval_cc ERROR: The use of "condition" by itself is not supported in OpenMath 2 defint int ERROR: Specification of domain is not supported 1 2 3 multiset1 set1 size cartesian_product ERROR: Specification of domain is not supported above below both_sides null ERROR: "Tendsto" is not supported in OpenMath 10 s_data1 s_dist1 ERROR: No arguement given ERROR: OpenMath does not support list selector ERROR: OpenMath's matrix selector cannot select a row of a matrix ERROR: Too many arguments for vector or matrixrow matrix_selector vector_selector vector_selector OpenMath does not support other encodings above below both_sides null mets/contet2Latex/entities.xsl0100777000000000000000000032225111165035247015475 0ustar rootroot