scratch/output/Scratch/js/MathJax/docs/html/api/jax.html

319 lines
16 KiB
HTML
Raw Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Base Jax Class &mdash; MathJax v1.0 documentation</title>
<link rel="stylesheet" href="../_static/mj.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="MathJax v1.0 documentation" href="../index.html" />
<link rel="up" title="The MathJax API" href="index.html" />
<link rel="next" title="The MathJax Object-Oriented Programming Model" href="object.html" />
<link rel="prev" title="The MathJax.ElementJax Class" href="elementjax.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="object.html" title="The MathJax Object-Oriented Programming Model"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="elementjax.html" title="The MathJax.ElementJax Class"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">MathJax v1.0 documentation</a> &raquo;</li>
<li><a href="index.html" accesskey="U">The MathJax API</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="the-base-jax-class">
<span id="api-jax"></span><h1>The Base Jax Class<a class="headerlink" href="#the-base-jax-class" title="Permalink to this headline"></a></h1>
<p>The <cite>MathJax.InputJax</cite>, <cite>MathJax.OutputJax</cite> and <cite>MathJax.ElementJax</cite>
classes are all subclasses of the base <cite>Jax</cite> class in MathJax. This
is a private class that implements the methods common to all three
other jax classes.</p>
<p>Unlike most MathJax.Object classes, calling the class object creates a
<em>subclass</em> of the class, rather than an instance of the class. E.g.,</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">MathJax</span><span class="p">.</span><span class="nx">InputJax</span><span class="p">.</span><span class="nx">MyInputJax</span> <span class="o">=</span> <span class="nx">MathJax</span><span class="p">.</span><span class="nx">InputJax</span><span class="p">({</span>
<span class="nx">name</span><span class="o">:</span> <span class="s2">&quot;MyInputJax&quot;</span><span class="p">,</span>
<span class="nx">version</span><span class="o">:</span> <span class="s2">&quot;1.0&quot;</span><span class="p">,</span>
<span class="p">...</span>
<span class="p">});</span>
</pre></div>
</div>
<p>creates <tt class="docutils literal"><span class="pre">MathJax.InputJax.MyInputJax</span></tt> as a subclass of <tt class="docutils literal"><span class="pre">MathJax.InputJax</span></tt>.</p>
<div class="section" id="class-properties">
<h2>Class Properties<a class="headerlink" href="#class-properties" title="Permalink to this headline"></a></h2>
<dl class="describe">
<dt>
<tt class="descname">directory</tt></dt>
<dd><p>The name of the jax directory (usually <tt class="docutils literal"><span class="pre">&quot;[MathJax]/jax&quot;).</span>
<span class="pre">Overridden</span> <span class="pre">in</span> <span class="pre">the</span> <span class="pre">subclass</span> <span class="pre">to</span> <span class="pre">be</span> <span class="pre">the</span> <span class="pre">specific</span> <span class="pre">directory</span> <span class="pre">for</span> <span class="pre">the</span>
<span class="pre">class,</span> <span class="pre">e.g.</span> <span class="pre">``&quot;[MathJax]/jax/input&quot;</span></tt>.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">extensionDir</tt></dt>
<dd><p>The name of the extensions directory (usually <tt class="docutils literal"><span class="pre">&quot;[MathJax]/extensions&quot;</span></tt>).</p>
</dd></dl>
</div>
<div class="section" id="instance-properties">
<h2>Instance Properties<a class="headerlink" href="#instance-properties" title="Permalink to this headline"></a></h2>
<dl class="describe">
<dt>
<tt class="descname">name</tt></dt>
<dd><p>The name of the jax.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">version</tt></dt>
<dd><p>The version number of the jax.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">directory</tt></dt>
<dd><p>The directory for the jax (e.g., <tt class="docutils literal"><span class="pre">&quot;[MathJax]/jax/input/TeX&quot;</span></tt>).</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">require: null</tt></dt>
<dd><p>An array of files to load before the <tt class="docutils literal"><span class="pre">jax.js</span></tt> file calls the
<tt class="xref py py-meth docutils literal"><span class="pre">MathJax.Ajax.loadComplete()</span></tt> method.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">config: {}</tt></dt>
<dd><p>An object that contains the default configuration options for the
jax. These can be modified by the author by including a
configuration subsection for the specific jax in question.</p>
</dd></dl>
</div>
<div class="section" id="methods">
<h2>Methods<a class="headerlink" href="#methods" title="Permalink to this headline"></a></h2>
<dl class="method">
<dt id="Translate">
<tt class="descname">Translate</tt><big>(</big><em>script</em><big>)</big><a class="headerlink" href="#Translate" title="Permalink to this definition"></a></dt>
<dd><p>This is the method that the <tt class="docutils literal"><span class="pre">MathJax.Hub</span></tt> calls when it needs
the input or output jax to process the given math <tt class="docutils literal"><span class="pre">&lt;script&gt;</span></tt>
call. Its default action is to start loading the jax&#8217;s <tt class="docutils literal"><span class="pre">jax.js</span></tt>
file, and redefine the <a class="reference internal" href="#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> method to be the
<a class="reference internal" href="#noTranslate" title="noTranslate"><tt class="xref py py-meth docutils literal"><span class="pre">noTranslate()</span></tt></a> method below. The <tt class="docutils literal"><span class="pre">jax.js</span></tt> file should
redefine the <a class="reference internal" href="#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> method to perform the translation
operation for the specific jax. For an input jax, it should
return the <cite>ElementJax</cite> object that it created.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first">
<li><dl class="first docutils">
<dt><strong>script</strong> &#8212; reference to the DOM <tt class="docutils literal"><span class="pre">&lt;script&gt;</span></tt> object for</dt>
<dd><p class="first last">the mathematics to be translated</p>
</dd>
</dl>
</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last">an <cite>ElementJax</cite> object, or <tt class="docutils literal"><span class="pre">null</span></tt></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="noTranslate">
<tt class="descname">noTranslate</tt><big>(</big><em>script</em><big>)</big><a class="headerlink" href="#noTranslate" title="Permalink to this definition"></a></dt>
<dd><p>This is a temporary routine that is used while the <tt class="docutils literal"><span class="pre">jax.js</span></tt> file
is loading. It throws an error indicating the the
<a class="reference internal" href="#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> method hasn&#8217;t been redefined. That way, if
the <tt class="docutils literal"><span class="pre">jax.js</span></tt> file failes to load for some reason, you will
receive an error trying to process mathematics with this input
jax.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first">
<li><dl class="first docutils">
<dt><strong>script</strong> &#8212; reference to the DOM <tt class="docutils literal"><span class="pre">&lt;script&gt;</span></tt> object for</dt>
<dd><p class="first last">the mathematics to be translated</p>
</dd>
</dl>
</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last"><tt class="docutils literal"><span class="pre">null</span></tt></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="Register">
<tt class="descname">Register</tt><big>(</big><em>mimetype</em><big>)</big><a class="headerlink" href="#Register" title="Permalink to this definition"></a></dt>
<dd><p>This method is overridden in the <cite>InputJax</cite>, <cite>OutputJax</cite> and
<cite>ElementJax</cite> subclasses to handle the registration of those
classes of jax.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple">
<li><strong>mimetype</strong> &#8212; the MIME-type to be associated with the jax</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last"><tt class="docutils literal"><span class="pre">null</span></tt></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt>
<tt class="descname">Config</tt><big>(</big><big>)</big></dt>
<dd><p>Inserts the configuration block for this jax from the author&#8217;s
configuration specification into the jax&#8217;s <tt class="docutils literal"><span class="pre">config</span></tt> property.
If the configuration includes an <tt class="docutils literal"><span class="pre">Augment</span></tt> object, that is used
to augment the jax (that is, the configuration can override the
methods of the object, as well as the data). This is called
automatically during the loading of the <tt class="docutils literal"><span class="pre">jax.js</span></tt> file.</p>
</dd></dl>
<dl class="method">
<dt id="Startup">
<tt class="descname">Startup</tt><big>(</big><big>)</big><a class="headerlink" href="#Startup" title="Permalink to this definition"></a></dt>
<dd><p>This is a method that can be overridden in the subclasses to
perform initialization at startup time (after the configuration
has occurred).</p>
</dd></dl>
<dl class="method">
<dt>
<tt class="descname">loadComplete</tt><big>(</big><em>file</em><big>)</big></dt>
<dd><p>This is called by the <tt class="docutils literal"><span class="pre">config.js</span></tt> and <tt class="docutils literal"><span class="pre">jax.js</span></tt> files when they
are completely loaded and are ready to signal that fact to
MathJax. For <tt class="docutils literal"><span class="pre">config.js</span></tt>, this simply calls the
<tt class="xref py py-meth docutils literal"><span class="pre">MathJax.Ajax.loadComplete()</span></tt> method for the <tt class="docutils literal"><span class="pre">config.js</span></tt>
file. For <tt class="docutils literal"><span class="pre">jax.js</span></tt>, the actions performed here are the
following:</p>
<blockquote>
<ol class="arabic simple">
<li>Post the &#8220;[name] Jax Config&#8221; message to the startup signal.</li>
<li>Perform the jax&#8217;s <a class="reference internal" href="hub.html#Config" title="Config"><tt class="xref py py-meth docutils literal"><span class="pre">Config()</span></tt></a> method.</li>
<li>Post the &#8220;[name] Jax Require&#8221; message to the startup signal.</li>
<li>Load the files from the jax&#8217;s <tt class="docutils literal"><span class="pre">require</span></tt> array (which may
have been modified during the configuration process).</li>
<li>Post the &#8220;[name] Jax Startup&#8221; message to the startup signal.</li>
<li>Perform the jax&#8217;s <a class="reference internal" href="#Startup" title="Startup"><tt class="xref py py-meth docutils literal"><span class="pre">Startup()</span></tt></a> method.</li>
<li>Post the &#8220;[name] Jax Ready&#8221; message to the startup signal.</li>
<li>perform the <tt class="xref py py-meth docutils literal"><span class="pre">MathJax.Ajax.loadComplete()</span></tt> call for the
<tt class="docutils literal"><span class="pre">jax.js</span></tt> file.</li>
</ol>
</blockquote>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">The Base Jax Class</a><ul>
<li><a class="reference internal" href="#class-properties">Class Properties</a></li>
<li><a class="reference internal" href="#instance-properties">Instance Properties</a></li>
<li><a class="reference internal" href="#methods">Methods</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="elementjax.html"
title="previous chapter">The MathJax.ElementJax Class</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="object.html"
title="next chapter">The MathJax Object-Oriented Programming Model</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/api/jax.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="object.html" title="The MathJax Object-Oriented Programming Model"
>next</a> |</li>
<li class="right" >
<a href="elementjax.html" title="The MathJax.ElementJax Class"
>previous</a> |</li>
<li><a href="../index.html">MathJax v1.0 documentation</a> &raquo;</li>
<li><a href="index.html" >The MathJax API</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2010 Design Science.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0b2.
</div>
</body>
</html>