223 lines
10 KiB
HTML
223 lines
10 KiB
HTML
|
|
<!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 MathJax.InputJax Class — MathJax v1.1 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.1',
|
|
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>
|
|
<!--<script type="text/javascript" src="../../../MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>-->
|
|
<link rel="top" title="MathJax v1.1 documentation" href="../index.html" />
|
|
<link rel="up" title="The MathJax API" href="index.html" />
|
|
<link rel="next" title="The MathJax.OutputJax Class" href="outputjax.html" />
|
|
<link rel="prev" title="The MathJax.Callback.Signal Class" href="signal.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="outputjax.html" title="The MathJax.OutputJax Class"
|
|
accesskey="N">next</a> |</li>
|
|
<li class="right" >
|
|
<a href="signal.html" title="The MathJax.Callback.Signal Class"
|
|
accesskey="P">previous</a> |</li>
|
|
<li><a href="../index.html">MathJax v1.1 documentation</a> »</li>
|
|
<li><a href="index.html" accesskey="U">The MathJax API</a> »</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
<div class="body">
|
|
|
|
<div class="section" id="the-mathjax-inputjax-class">
|
|
<span id="api-input-jax"></span><h1>The MathJax.InputJax Class<a class="headerlink" href="#the-mathjax-inputjax-class" title="Permalink to this headline">¶</a></h1>
|
|
<p>Input jax are the components of MathJax that translate
|
|
mathematics from its original format (like <a class="reference internal" href="../glossary.html#term-tex"><em class="xref std std-term">TeX</em></a> or
|
|
<a class="reference internal" href="../glossary.html#term-mathml"><em class="xref std std-term">MathML</em></a>) to the MathJax internal format (an <cite>element jax</cite>).</p>
|
|
<p>An input jax is stored as a pair of files in a subdirectory of the
|
|
<tt class="docutils literal"><span class="pre">jax/input</span></tt> directory, with the subdirectory name being the name of
|
|
the input jax. For example, the TeX input jax is stored in
|
|
<cite>jax/input/TeX</cite>. The first file, <tt class="docutils literal"><span class="pre">config.js</span></tt>, is loaded when
|
|
MathJax is being loaded and configured, and is indicated by listing
|
|
the input jax directory in the <cite>jax</cite> array of the MathJax
|
|
configuration. The <tt class="docutils literal"><span class="pre">config.js</span></tt> file creates a subclass of the
|
|
<cite>MathJax.InputJax</cite> object for the new input jax and registers that
|
|
with MathJax, along with the MIME-type that will be used to indicate
|
|
the mathematics that is to be processed by the input jax.</p>
|
|
<p>The main body of the input jax is stored in the second file,
|
|
<tt class="docutils literal"><span class="pre">jax.js</span></tt>, which is loaded when the input jax is first called on to
|
|
translate some mathematics. This file augments the original input jax
|
|
subclass with the additional methods needed to do the translation.
|
|
MathJax calls the input jax’s <a class="reference internal" href="jax.html#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> method when it needs
|
|
the input jax to translate the contents of a math <tt class="docutils literal"><span class="pre"><script></span></tt> tag.</p>
|
|
<p>The <cite>MathJax.InputJax</cite> class is a subclass of the <a class="reference internal" href="jax.html#api-jax"><em>MathJax Jax</em></a> class, and inherits the properties and methods of that
|
|
class. Those listed below are the additional or overridden ones from
|
|
that class.</p>
|
|
<div class="section" id="properties">
|
|
<h2>Properties<a class="headerlink" href="#properties" title="Permalink to this headline">¶</a></h2>
|
|
<dl class="describe">
|
|
<dt>
|
|
<tt class="descname">id</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 where the jax files are stored (e.g., <tt class="docutils literal"><span class="pre">"[MathJax]/jax/input/TeX"</span></tt>).</p>
|
|
</dd></dl>
|
|
|
|
<dl class="describe">
|
|
<dt>
|
|
<tt class="descname">elementJax</tt></dt>
|
|
<dd><p>The name of the ElementJax class that this input jax will produce
|
|
(typically <tt class="docutils literal"><span class="pre">mml</span></tt>, as that is the only ElementJax at the moment).</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>
|
|
<tt class="descname">Translate</tt><big>(</big><em>script</em><big>)</big></dt>
|
|
<dd><p>This is the main routine called by MathJax when a <tt class="docutils literal"><span class="pre"><script></span></tt> of the
|
|
appropriate type is found. The default <a class="reference internal" href="jax.html#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> method
|
|
throws an error indicating that <a class="reference internal" href="jax.html#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> hasn’t been
|
|
redefined, so when the <tt class="docutils literal"><span class="pre">jax.js</span></tt> file loads, it should override the
|
|
default <a class="reference internal" href="jax.html#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> with its own version that does the actual
|
|
translation.</p>
|
|
<p>The translation process should include the creation of an
|
|
<a class="reference internal" href="elementjax.html#api-element-jax"><em>Element Jax</em></a> that stores the data needed
|
|
for this element.</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>script</strong> — the <tt class="docutils literal"><span class="pre"><script></span></tt> element to be translated</li>
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last">the <cite>element jax</cite> resulting from the translation</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt>
|
|
<tt class="descname">Register</tt><big>(</big><em>mimetype</em><big>)</big></dt>
|
|
<dd><p>This registers the MIME-type associated with this input jax so
|
|
that MathJax knows to call this input jax when it sees a
|
|
<tt class="docutils literal"><span class="pre"><script></span></tt> of that type. An input jax can register more than
|
|
one type, but it will be responsible for distinguishing elements
|
|
of the various types from one another.</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> — the MIME-type of the input this jax processes</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>
|
|
|
|
</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 MathJax.InputJax Class</a><ul>
|
|
<li><a class="reference internal" href="#properties">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="signal.html"
|
|
title="previous chapter">The MathJax.Callback.Signal Class</a></p>
|
|
<h4>Next topic</h4>
|
|
<p class="topless"><a href="outputjax.html"
|
|
title="next chapter">The MathJax.OutputJax Class</a></p>
|
|
<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="outputjax.html" title="The MathJax.OutputJax Class"
|
|
>next</a> |</li>
|
|
<li class="right" >
|
|
<a href="signal.html" title="The MathJax.Callback.Signal Class"
|
|
>previous</a> |</li>
|
|
<li><a href="../index.html">MathJax v1.1 documentation</a> »</li>
|
|
<li><a href="index.html" >The MathJax API</a> »</li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer">
|
|
© Copyright 2011 Design Science.
|
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
|
|
</div>
|
|
|
|
</body>
|
|
</html> |