scribble-mathjax/docs/html/upgrade.html
2011-03-21 10:55:40 -04:00

327 lines
25 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>Migrating from MathJax v1.0 to v1.1 &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="next" title="Converting to MathJax from jsMath" href="jsMath.html" />
<link rel="prev" title="Whats New in MathJax v1.1" href="whats-new.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="jsMath.html" title="Converting to MathJax from jsMath"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="whats-new.html" title="Whats New in MathJax v1.1"
accesskey="P">previous</a> |</li>
<li><a href="index.html">MathJax v1.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="migrating-from-mathjax-v1-0-to-v1-1">
<span id="upgrade"></span><h1>Migrating from MathJax v1.0 to v1.1<a class="headerlink" href="#migrating-from-mathjax-v1-0-to-v1-1" title="Permalink to this headline"></a></h1>
<p>MathJax v1.1 fixes a number of bugs in v1.0, and improves support for
new versions of browsers and mobile devices. It includes changes to
increase its performance, and to make it more compliant with HTML5. It
has more flexible configuration options, and the ability to load
configuration files that combine multiple files into a single one to
increase loading speed when MathJax starts up. Finally, MathJax.org now
offers MathJax as a web service through a distributed &#8220;cloud&#8221; server.</p>
<p>This document describes the changes you may need to make to your MathJax
configurations in order to take advantage of these improvements.</p>
<div class="section" id="configuration-changes">
<h2>Configuration Changes<a class="headerlink" href="#configuration-changes" title="Permalink to this headline"></a></h2>
<p>The main changes that you will see as a page author are in the way that
MathJax can be loaded and configured. If you have been using in-line
configuration by putting a <tt class="xref py py-meth docutils literal"><span class="pre">MathJax.Hub.Config()</span></tt> call in the body of
the <tt class="docutils literal"><span class="pre">&lt;script&gt;</span></tt> tag that loads MathJax, then your site should work
unchanged with version 1.1 of MathJax. You may wish to consider moving to
the new HTML5-compliant method of configuring MathJax, however, which uses
a separate <tt class="docutils literal"><span class="pre">&lt;script&gt;</span></tt> tag to specify the configuration. That tag should
come <strong>before</strong> the one that loads <tt class="docutils literal"><span class="pre">Mathjax.js</span></tt>, and should have
<tt class="docutils literal"><span class="pre">type=&quot;text/x-mathjax-config&quot;</span></tt> rather than <tt class="docutils literal"><span class="pre">type=&quot;text/javascript&quot;</span></tt>.
For example,</p>
<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src=</span><span class="s">&quot;/MathJax/MathJax.js&quot;</span><span class="nt">&gt;</span>
<span class="nx">MathJax</span><span class="p">.</span><span class="nx">Hub</span><span class="p">.</span><span class="nx">Config</span><span class="p">({</span>
<span class="nx">jax</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;input/TeX&quot;</span><span class="p">,</span><span class="s2">&quot;output/HTML-CSS&quot;</span><span class="p">],</span>
<span class="nx">extensions</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;tex2jax.js&quot;</span><span class="p">]</span>
<span class="p">});</span>
<span class="nt">&lt;/script&gt;</span>
</pre></div>
</div>
<p>would become</p>
<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/x-mathjax-config&quot;</span><span class="nt">&gt;</span>
<span class="nx">MathJax</span><span class="p">.</span><span class="nx">Hub</span><span class="p">.</span><span class="nx">Config</span><span class="p">({</span>
<span class="nx">jax</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;input/TeX&quot;</span><span class="p">,</span><span class="s2">&quot;output/HTML-CSS&quot;</span><span class="p">],</span>
<span class="nx">extensions</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;tex2jax.js&quot;</span><span class="p">]</span>
<span class="p">});</span>
<span class="nt">&lt;/script&gt;</span>
<span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src=</span><span class="s">&quot;/MathJax/MathJax.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</pre></div>
</div>
<p>instead. This will make sure your pages pass HTML5 validation. Be sure
that you put the configuration block <strong>before</strong> the script that loads
MathJax. See <a class="reference internal" href="configuration.html#loading"><em>Loading and Configuring MathJax</em></a> for more
details.</p>
<p>If your page simply loads <tt class="docutils literal"><span class="pre">MathJax.js</span></tt> and relies on
<tt class="docutils literal"><span class="pre">config/MathJax.js</span></tt>, then you will need to modify your <tt class="docutils literal"><span class="pre">&lt;script&gt;</span></tt> tag
in order to use MathJax v1.1. This is because MathJax no longer loads a
default configuration file; you are required to explicitly specify the
configuration file if you use one. Furthermore, the name of the
<tt class="docutils literal"><span class="pre">config/MathJax.js</span></tt> file was a source of confusion, so it has been
renamed <tt class="docutils literal"><span class="pre">config/default.js</span></tt> instead. Thus, if you used</p>
<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src=</span><span class="s">&quot;/MathJax/MathJax.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</pre></div>
</div>
<p>in the past, you should replace it with</p>
<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src=</span><span class="s">&quot;/MathJax/MathJax.js?config=default&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</pre></div>
</div>
<p>instead. If you don&#8217;t do this, you will receive a warning message that
directs you to a page that explains how to update your script tags to use
the new configuration format.</p>
</div>
<div class="section" id="combined-configurations">
<h2>Combined Configurations<a class="headerlink" href="#combined-configurations" title="Permalink to this headline"></a></h2>
<p>New with version 1.1 is the ability to combine several files into a single
configuration file, and to load that via the same script that loads
MathJax. This should make configuring MathJax easier, and also helps to
speed up the initial loading of MathJax&#8217;s components, since only one file
needs to be downloaded.</p>
<p>MathJax comes with four pre-built configurations, and our hope is that one
of these will suit your needs. They are described in more detail in the
<a class="reference internal" href="configuration.html#config-files"><em>Using a Configuration File</em></a> section. To load one,
add <tt class="docutils literal"><span class="pre">?config=filename</span></tt> (where <tt class="docutils literal"><span class="pre">filename</span></tt> is the name of the
configuration file without the <tt class="docutils literal"><span class="pre">.js</span></tt>) to the URL that loads
<tt class="docutils literal"><span class="pre">MathJax.js</span></tt>. For example</p>
<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src=</span><span class="s">&quot;/MathJax/MathJax.js&quot;</span><span class="nt">&gt;</span>
<span class="nx">MathJax</span><span class="p">.</span><span class="nx">Hub</span><span class="p">.</span><span class="nx">Config</span><span class="p">({</span>
<span class="nx">jax</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;input/TeX&quot;</span><span class="p">,</span><span class="s2">&quot;output/HTML-CSS&quot;</span><span class="p">],</span>
<span class="nx">extensions</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;tex2jax.js&quot;</span><span class="p">,</span><span class="s2">&quot;AMSmath.js&quot;</span><span class="p">,</span><span class="s2">&quot;AMSsymbols.js&quot;</span><span class="p">]</span>
<span class="p">});</span>
<span class="nt">&lt;/script&gt;</span>
</pre></div>
</div>
<p>could be replaced by the single line</p>
<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src=</span><span class="s">&quot;/MathJax/MathJax.js?config=TeX-AMS_HTML&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</pre></div>
</div>
<p>In this way, you don&#8217;t have to include the in-line configuration, and all
the needed files will be downloaded when MathJax starts up. For complete
details about the contents of the combined configuration files, see the
<a class="reference internal" href="config-files.html#common-configurations"><em>Common Configurations</em></a> section.</p>
<p>If you want to use a pre-defined configuration file, but want to modify some
of the configuration parameters, you can use both a
<tt class="docutils literal"><span class="pre">text/x-mathjax-config</span></tt> block and a <tt class="docutils literal"><span class="pre">config=filename</span></tt> parameter in
combination. For example,</p>
<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/x-mathjax-config&quot;</span><span class="nt">&gt;</span>
<span class="nx">MathJax</span><span class="p">.</span><span class="nx">Hub</span><span class="p">.</span><span class="nx">Config</span><span class="p">({</span>
<span class="nx">tex2jax</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">inlineMath</span><span class="o">:</span> <span class="p">[</span> <span class="p">[</span><span class="s1">&#39;$&#39;</span><span class="p">,</span><span class="s1">&#39;$&#39;</span><span class="p">],</span> <span class="p">[</span><span class="s1">&#39;\\(&#39;</span><span class="p">,</span><span class="s1">&#39;\\)&#39;</span><span class="p">]</span> <span class="p">],</span>
<span class="nx">processEscapes</span><span class="o">:</span> <span class="kc">true</span>
<span class="p">}</span>
<span class="p">});</span>
<span class="nt">&lt;/script&gt;</span>
<span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src=</span><span class="s">&quot;/MathJax/MathJax.js?config=TeX-AMS_HTML&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</pre></div>
</div>
<p>would load the <tt class="docutils literal"><span class="pre">TeX-AMS_HTML</span></tt> configuration file, but would reconfigure
the inline math delimiters to include <tt class="docutils literal"><span class="pre">$...$</span></tt> in addition to
<tt class="docutils literal"><span class="pre">\(...\)</span></tt>, and would set the <tt class="docutils literal"><span class="pre">processEscapes</span></tt> parameter to <tt class="docutils literal"><span class="pre">true</span></tt>.</p>
</div>
<div class="section" id="loading-mathjax-from-the-cdn">
<h2>Loading MathJax from the CDN<a class="headerlink" href="#loading-mathjax-from-the-cdn" title="Permalink to this headline"></a></h2>
<p>The MathJax installation is fairly substantial (due to the large number of
images needed for the image fonts), and so you may not want to (or be able
to) store MathJax on your own server. Keeping MathJax up to date can also
be a maintenance problem, and you might prefer to let others handle that
for you. In either case, using the MathJax distributed network service may be
the best way for you to obtain MathJax. That way you can be sure you are
using an up-to-date version of MathJax, and that the server will be fast
and reliable.</p>
<p>To use the MathJax CDN service, simply load MathJax as follows:</p>
<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span>
<span class="na">src=</span><span class="s">&quot;http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;/scrip&gt;</span>
</pre></div>
</div>
<p>Of course, you can load any configuration file that you wish, or use a
<tt class="docutils literal"><span class="pre">text/x=mathajx-config</span></tt> block to configure MathJax in-line.
<a class="reference internal" href="configuration.html#loading-cdn"><em>More details</em></a> are available, if you need them.</p>
<p>The use of <tt class="docutils literal"><span class="pre">cdn.mathjax.org</span></tt> is governed by its <a class="reference external" href="http://www.mathjax.org/download/mathjax-cdn-terms-of-service/">terms of service</a>, so be
sure to read that before linking to the MathJax CDN server.</p>
</div>
<div class="section" id="change-in-default-tex-delimiters">
<h2>Change in default TeX delimiters<a class="headerlink" href="#change-in-default-tex-delimiters" title="Permalink to this headline"></a></h2>
<p>In addition to the fact that MathJax v1.1 no longer loads a default
configuration file, there is a second configuration change that could
affect your pages. The <tt class="docutils literal"><span class="pre">config/MathJax.js</span></tt> file properly configured the
<cite>tex2jax</cite> preprocessor to use only <tt class="docutils literal"><span class="pre">\(...\)</span></tt> and not <tt class="docutils literal"><span class="pre">$...$</span></tt> for in-line
math delimiters, but the <cite>tex2jax</cite> preprocessor itself incorrectly
defaulted to including <tt class="docutils literal"><span class="pre">$...$</span></tt> as in-line math delimiters. The result
was that if you used in-line configuration to specify the <tt class="docutils literal"><span class="pre">tex2jax</span></tt>
preprocessor, single-dollar delimiters were enabled by default, while if
you used file-based configuration, they weren&#8217;t.</p>
<p>This inconsistency was an error, and the correct behavior was supposed to
have the single-dollar delimiters disabled in both cases. This is now
true in v1.1 of MathJax. This means that if you used in-line
configuration to specify the <cite>tex2jax</cite> preprocessor, you will need to
change your configuration to explicitly enable the single-dollar
delimiters if you want to use them.</p>
<p>For example, if you had</p>
<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src=</span><span class="s">&quot;/MathJax/MathJax.js&quot;</span><span class="nt">&gt;</span>
<span class="nx">MathJax</span><span class="p">.</span><span class="nx">Hub</span><span class="p">.</span><span class="nx">Config</span><span class="p">({</span>
<span class="nx">jax</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;input/TeX&quot;</span><span class="p">,</span><span class="s2">&quot;output/HTML-CSS&quot;</span><span class="p">],</span>
<span class="nx">extensions</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;tex2jax.js&quot;</span><span class="p">]</span>
<span class="p">});</span>
<span class="nt">&lt;/script&gt;</span>
</pre></div>
</div>
<p>and you want to use single-dollar delimiters for in-line math, then you
should replace this with</p>
<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/x-mathjax-config&quot;</span><span class="nt">&gt;</span>
<span class="nx">MathJax</span><span class="p">.</span><span class="nx">Hub</span><span class="p">.</span><span class="nx">Config</span><span class="p">({</span>
<span class="nx">jax</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;input/TeX&quot;</span><span class="p">,</span><span class="s2">&quot;output/HTML-CSS&quot;</span><span class="p">],</span>
<span class="nx">extensions</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;tex2jax.js&quot;</span><span class="p">],</span>
<span class="nx">tex2jax</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">inlineMath</span><span class="o">:</span> <span class="p">[</span> <span class="p">[</span><span class="s1">&#39;$&#39;</span><span class="p">,</span><span class="s1">&#39;$&#39;</span><span class="p">],</span> <span class="p">[</span><span class="s1">&#39;\\(&#39;</span><span class="p">,</span><span class="s1">&#39;\\)&#39;</span><span class="p">]</span> <span class="p">],</span>
<span class="nx">processEscapes</span><span class="o">:</span> <span class="kc">true</span>
<span class="p">}</span>
<span class="p">});</span>
<span class="nt">&lt;/script&gt;</span>
<span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src=</span><span class="s">&quot;/MathJax/MathJax.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</pre></div>
</div>
<p>The same technique can be used in conjunction with a combined
configuration file. For example</p>
<div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/x-mathjax-config&quot;</span><span class="nt">&gt;</span>
<span class="nx">MathJax</span><span class="p">.</span><span class="nx">Hub</span><span class="p">.</span><span class="nx">Config</span><span class="p">({</span>
<span class="nx">tex2jax</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">inlineMath</span><span class="o">:</span> <span class="p">[</span> <span class="p">[</span><span class="s1">&#39;$&#39;</span><span class="p">,</span><span class="s1">&#39;$&#39;</span><span class="p">],</span> <span class="p">[</span><span class="s1">&#39;\\(&#39;</span><span class="p">,</span><span class="s1">&#39;\\)&#39;</span><span class="p">]</span> <span class="p">],</span>
<span class="nx">processEscapes</span><span class="o">:</span> <span class="kc">true</span>
<span class="p">}</span>
<span class="p">});</span>
<span class="nt">&lt;/script&gt;</span>
<span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src=</span><span class="s">&quot;/MathJax/MathJax.js?config=TeX-AMS_HTML&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
</pre></div>
</div>
<p>will load the pre-defined <tt class="docutils literal"><span class="pre">TeX-AMS_HTML</span></tt> configuration, but will modify
the settings to allow <tt class="docutils literal"><span class="pre">$...$</span></tt> delimiters, and to process <tt class="docutils literal"><span class="pre">\$</span></tt> to
produce dollar signs within the text of the page.</p>
</div>
<div class="section" id="new-distribution-location">
<h2>New Distribution Location<a class="headerlink" href="#new-distribution-location" title="Permalink to this headline"></a></h2>
<p>Version 1.0 of MathJax was distributed through <cite>SourceForge</cite>, but the
development of MathJax has switched to <a class="reference external" href="https://github.com/mathjax/MathJax/">GitHub</a>, which is now the primary location
for MathJax source code and distributions. The SourceForge repository will
no longer be actively maintained (and hasn&#8217;t been since November 2010), and
so you will not be able to obtain updates through <tt class="docutils literal"><span class="pre">svn</span></tt> if you checked
out MathJax from there.</p>
<p>You may be able to switch to using the MathJax CDN (see above) rather than
hosting your own copy of MathJax, and avoid the problem of updates all
together. If you must install your own copy, however, you should follow
the instructions at <a class="reference internal" href="installation.html#installation"><em>Installing and Testing MathJax</em></a>,
using either <tt class="docutils literal"><span class="pre">git</span></tt> or <tt class="docutils literal"><span class="pre">svn</span></tt> as described to obtain your copy from
GitHub. This will allow you to keep your copy of MathJax up to date as
development continues.</p>
<p>We apologize for the inconvenience of having to switch distributions, but
the git-to-svn bridge we tried to implement to keep both copies in synch
turned out to be unreliable, and so the SourceForge distribution was
retired in favor of the GitHub site.</p>
</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="#">Migrating from MathJax v1.0 to v1.1</a><ul>
<li><a class="reference internal" href="#configuration-changes">Configuration Changes</a></li>
<li><a class="reference internal" href="#combined-configurations">Combined Configurations</a></li>
<li><a class="reference internal" href="#loading-mathjax-from-the-cdn">Loading MathJax from the CDN</a></li>
<li><a class="reference internal" href="#change-in-default-tex-delimiters">Change in default TeX delimiters</a></li>
<li><a class="reference internal" href="#new-distribution-location">New Distribution Location</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="whats-new.html"
title="previous chapter">What&#8217;s New in MathJax v1.1</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="jsMath.html"
title="next chapter">Converting to MathJax from jsMath</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="jsMath.html" title="Converting to MathJax from jsMath"
>next</a> |</li>
<li class="right" >
<a href="whats-new.html" title="Whats New in MathJax v1.1"
>previous</a> |</li>
<li><a href="index.html">MathJax v1.1 documentation</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>