Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/421.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 除非重新加载页面,否则LaTeX不会转换为数学文本_Javascript_Jquery_Html_Ajax_Latex - Fatal编程技术网

Javascript 除非重新加载页面,否则LaTeX不会转换为数学文本

Javascript 除非重新加载页面,否则LaTeX不会转换为数学文本,javascript,jquery,html,ajax,latex,Javascript,Jquery,Html,Ajax,Latex,我正在使用mimetex.cgi将LaTeX文本转换为数学文本。为此,我在标题标签中添加了以下内容 <head> <script src="../../asciimath/js/ASCIIMathMLwFallback.js" type="text/javascript"> </script> <script type="text/javascript"> var AScgiloc = '../../

我正在使用mimetex.cgi将LaTeX文本转换为数学文本。为此,我在标题标签中添加了以下内容

<head>
    <script src="../../asciimath/js/ASCIIMathMLwFallback.js" type="text/javascript">    
    </script>
    <script type="text/javascript">
        var AScgiloc = '../../includes/svgimg.php';
        var AMTcgiloc = "http://www.imathas.com/cgi-bin/mimetex.cgi";
    </script>
</head>
它使用上述函数调用函数generic()。。。我想如果在ajax查询结束时调用此函数就可以了。

解决了它! AsciiMathLWfallback.js有一个名为generic()的函数,在此处的页面加载时调用该函数。该函数将Latex转换为数学函数

为了使用ajax查询将latex转换为数学函数,只需通过向ajax代码中添加以下内容来调用通用函数

generic.call();

这将确保所有乳胶都转换为数学

在通过Ajax加载LaTeX代码后,您可能必须手动强制转换。你必须检查你的第三方库的文档才能知道如何做到这一点。javascript在我浏览了代码之后就可以使用了。它使用window.addEventListener('load',generic,false)来启动
if(typeof window.addEventListener != 'undefined')
 {
  //.. gecko, safari, konqueror and standard
  window.addEventListener('load', generic, false);
 }
else if(typeof document.addEventListener != 'undefined')
 {
  //.. opera 7
  document.addEventListener('load', generic, false);
 }
 else if(typeof window.attachEvent != 'undefined')
 {
  //.. win/ie
  window.attachEvent('onload', generic);
  }
  //** remove this condition to degrade older browsers
 else
  {
   //.. mac/ie5 and anything else that gets this far
   //if there's an existing onload function
   if(typeof window.onload == 'function')
   {
     //store it
    var existing = onload;
    //add new onload handler
   window.onload = function()
    {
      //call existing onload function
      existing();
      //call generic onload function
      generic();
    };
   }
 else
   {
   //setup onload function
    window.onload = generic;
    }
 }

if (checkForMathML) {
      checkForMathML = false;
      var nd = AMisMathMLavailable();
      AMnoMathML = (nd != null);
  }
generic.call();