File: jax.html

package info (click to toggle)
mathjax 1.1-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 128,884 kB
  • sloc: makefile: 118; python: 21
file content (326 lines) | stat: -rw-r--r-- 17,481 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326

<!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.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 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.1 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">id</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">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 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>
<tt class="descname">Process</tt><big>(</big><em>script</em><big>)</big></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>.  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 itself to simplu return the callback for the laod operation
(so that further calls to it will cause the processing to wait for the
callback).  Once the <tt class="docutils literal"><span class="pre">jax.js</span></tt> file has loaded, this method is
replaced by the jax&#8217;s <a class="reference internal" href="#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> method, so that subsequent calls
to <a class="reference internal" href="hub.html#Process" title="Process"><tt class="xref py py-meth docutils literal"><span class="pre">Process()</span></tt></a> will perform the appropriate translation.</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="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 a stub for a routine that should be defined by the jax&#8217;s
<tt class="docutils literal"><span class="pre">jax.js</span></tt> file when it is loaded.  It should perform the translation
action for the specific jax.  For an input jax, it should return the
<cite>ElementJax</cite> object that it created.  The <a class="reference internal" href="#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> mehtod is
never called directly by MathJax; during the <a class="reference internal" href="ajax.html#loadComplete" title="loadComplete"><tt class="xref py py-meth docutils literal"><span class="pre">loadComplete()</span></tt></a>
call, this funciton is copied to the <a class="reference internal" href="hub.html#Process" title="Process"><tt class="xref py py-meth docutils literal"><span class="pre">Process()</span></tt></a> method, and is
called via that name.  The default <a class="reference internal" href="#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> method throws an
error indicating that the <a class="reference internal" href="#Translate" title="Translate"><tt class="xref py py-meth docutils literal"><span class="pre">Translate()</span></tt></a> meth was not been
redefined.  That way, if the <tt class="docutils literal"><span class="pre">jax.js</span></tt> file fails to load for some
reason, you will receive an error trying to process mathematics with
this 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">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="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>
<div><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> and
<tt class="docutils literal"><span class="pre">config.extensions</span></tt> arrays.</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>
</div></blockquote>
<p>Note that the configuration process (the <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> call) can
modify the <tt class="docutils literal"><span class="pre">require</span></tt> or <tt class="docutils literal"><span class="pre">config.extensions</span></tt> arrays to add more
files that need to be loaded, and that the <a class="reference internal" href="#Startup" title="Startup"><tt class="xref py py-meth docutils literal"><span class="pre">Startup()</span></tt></a> method
isn&#8217;t called until those files are completely loaded.</p>
</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>
<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.1 documentation</a> &raquo;</li>
          <li><a href="index.html" >The MathJax API</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2011 Design Science.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
    
  </body>
</html>