380 lines
23 KiB
HTML
380 lines
23 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>Installing and Testing MathJax — 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="Loading and Configuring MathJax" href="configuration.html" />
|
|
<link rel="prev" title="Getting Started" href="start.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="configuration.html" title="Loading and Configuring MathJax"
|
|
accesskey="N">next</a> |</li>
|
|
<li class="right" >
|
|
<a href="start.html" title="Getting Started"
|
|
accesskey="P">previous</a> |</li>
|
|
<li><a href="index.html">MathJax v1.1 documentation</a> »</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
<div class="body">
|
|
|
|
<div class="section" id="installing-and-testing-mathjax">
|
|
<span id="installation"></span><h1>Installing and Testing MathJax<a class="headerlink" href="#installing-and-testing-mathjax" title="Permalink to this headline">¶</a></h1>
|
|
<p>The easiest way to use MathJax is to link directly to the MathJax
|
|
distributed network service (see <a class="reference internal" href="start.html#mathjax-cdn"><em>Using the MathJax CDN</em></a>). In that case, there is no need to install MathJax
|
|
yourself, and you can begin using MathJax right away; skip this document on
|
|
installation and go directly to <a class="reference internal" href="configuration.html#loading"><em>Configuring MathJax</em></a>.</p>
|
|
<p>MathJax can be loaded from a public web server or privately from your hard drive
|
|
or other local media. To use MathJax in either way, you will need to obtain a
|
|
copy of MathJax and its font package. There are three ways to do this: via
|
|
<tt class="docutils literal"><span class="pre">git</span></tt>, <tt class="docutils literal"><span class="pre">svn</span></tt>, or via a pre-packaged archive. We recommend git or svn, as it
|
|
is easier to keep your installation up to date with these tools.</p>
|
|
<div class="section" id="obtaining-mathjax-via-git">
|
|
<span id="getting-mathjax-git"></span><h2>Obtaining MathJax via Git<a class="headerlink" href="#obtaining-mathjax-via-git" title="Permalink to this headline">¶</a></h2>
|
|
<p>The easiest way to get MathJax and keep it up to date is to use the <a class="reference external" href="http://git-scm.com/">Git</a> version control system to access our <a class="reference external" href="http://github.com/mathjax/MathJax">GitHub repository</a>. Use the command</p>
|
|
<div class="highlight-sh"><div class="highlight"><pre>git clone git://github.com/mathjax/MathJax.git MathJax
|
|
</pre></div>
|
|
</div>
|
|
<p>to obtain and set up a copy of MathJax. Note that there is no longer
|
|
a <tt class="docutils literal"><span class="pre">fonts.zip</span></tt> file, and that the <tt class="docutils literal"><span class="pre">fonts</span></tt> directory is now part of
|
|
the repository itself.</p>
|
|
<p>Whenever you want to update MathJax, you can now use</p>
|
|
<div class="highlight-sh"><div class="highlight"><pre><span class="nb">cd </span>MathJax
|
|
git remote show origin
|
|
</pre></div>
|
|
</div>
|
|
<p>to check if there are updates to MathJax (this will print several
|
|
lines of data, but the last line should tell you if your copy is up to
|
|
date or out of date). If MathJax needs updating, use</p>
|
|
<div class="highlight-sh"><div class="highlight"><pre><span class="nb">cd </span>MathJax
|
|
git pull origin
|
|
</pre></div>
|
|
</div>
|
|
<p>to update your copy of MathJax to the current release version. If you
|
|
keep MathJax updated in this way, you will be sure that you have the
|
|
latest bug fixes and new features as they become available.</p>
|
|
<p>This gets you the current development copy of MathJax, which is the version
|
|
that contains all the latest changes to MathJax. Although we try to make
|
|
sure this version is a stable and usable version of MathJax, it is under
|
|
active development, and at times it may be less stable than the “release”
|
|
version. If you prefer to use the most stable version (that may not
|
|
include all the latest patches and features), you will want to get one
|
|
of the tagged releases. Use</p>
|
|
<div class="highlight-sh"><div class="highlight"><pre><span class="nb">cd </span>MathJax
|
|
git tag -l
|
|
</pre></div>
|
|
</div>
|
|
<p>to see all tagged versions, and use</p>
|
|
<div class="highlight-sh"><div class="highlight"><pre><span class="nb">cd </span>MathJax
|
|
git checkout <tag_name>
|
|
</pre></div>
|
|
</div>
|
|
<p>to checkout the indicated version of MathJax, where <tt class="docutils literal"><span class="pre"><tag_name></span></tt> is
|
|
the name of the tagged version you want to use. When you want to
|
|
upgrade to a new release, you will need to repeat this for the latest
|
|
release tag.</p>
|
|
<p>Each of the main releases also has a branch in which critical updates
|
|
are applied (we try hard not to patch the stable releases, but sometimes
|
|
there is a crucial change that needs to be made). If you want to use the
|
|
patched version of a release, then check out the branch rather than the
|
|
tag. Use</p>
|
|
<div class="highlight-sh"><div class="highlight"><pre><span class="nb">cd </span>MathJax
|
|
git branch
|
|
</pre></div>
|
|
</div>
|
|
<p>to get a list of the available branches. There are separate branches
|
|
for the main releases, but with <tt class="docutils literal"><span class="pre">-latest</span></tt> appended. These contain
|
|
all the patches for that particular release. You can check out one of
|
|
the branches just as you would a tagged copy. For example, the branch
|
|
for the <tt class="docutils literal"><span class="pre">v1.1</span></tt> tagged release is <tt class="docutils literal"><span class="pre">v1.1-latest</span></tt>. To get this
|
|
release, use</p>
|
|
<div class="highlight-sh"><div class="highlight"><pre><span class="nb">cd </span>MathJax
|
|
git checkout v1.1-latest
|
|
</pre></div>
|
|
</div>
|
|
<p>and to update it when changes occur, use</p>
|
|
<div class="highlight-sh"><div class="highlight"><pre><span class="nb">cd </span>MathJax
|
|
git pull origin v1.1-latest
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obtaining-mathjax-via-svn">
|
|
<span id="getting-mathjax-svn"></span><h2>Obtaining MathJax via SVN<a class="headerlink" href="#obtaining-mathjax-via-svn" title="Permalink to this headline">¶</a></h2>
|
|
<p>If you are more comfortable with the <a class="reference external" href="http://subversion.apache.org/">subversion</a> source control system, you may want
|
|
to use GitHub’s <tt class="docutils literal"><span class="pre">svn</span></tt> service to obtain MathJax. If you want to get the
|
|
latest revision using <tt class="docutils literal"><span class="pre">svn</span></tt>, use the command</p>
|
|
<div class="highlight-sh"><div class="highlight"><pre>svn checkout http://svn.github.com/mathjax/MathJax.git MathJax
|
|
</pre></div>
|
|
</div>
|
|
<p>to obtain and set up a copy of MathJax. Note that there is no longer
|
|
a <tt class="docutils literal"><span class="pre">fonts.zip</span></tt> file, and that the <tt class="docutils literal"><span class="pre">fonts</span></tt> directory is now part of
|
|
the repository itself.</p>
|
|
<p>Whenever you want to update MathJax, you can now use</p>
|
|
<div class="highlight-sh"><div class="highlight"><pre><span class="nb">cd </span>MathJax
|
|
svn status -u
|
|
</pre></div>
|
|
</div>
|
|
<p>to check if there are updates to MathJax. If MathJax needs updating,
|
|
use</p>
|
|
<div class="highlight-sh"><div class="highlight"><pre><span class="nb">cd </span>MathJax
|
|
svn update
|
|
</pre></div>
|
|
</div>
|
|
<p>to update your copy of MathJax to the current release version. If you
|
|
keep MathJax updated in this way, you will be sure that you have the
|
|
latest bug fixes and new features as they become available.</p>
|
|
<p>This gets you the current development copy of MathJax, which is the version
|
|
that contains all the latest changes to MathJax. Although we try to make
|
|
sure this version is a stable and usable version of MathJax, it is under
|
|
active development, and at times it may be less stable than the “release”
|
|
version. If you prefer to use one of the tagged releases instead, then
|
|
either use <tt class="docutils literal"><span class="pre">git</span></tt> as described above, or one of the archive files as
|
|
described below. You can use</p>
|
|
<div class="highlight-sh"><div class="highlight"><pre>svn checkout http://svn.github.com/mathjax/MathJax.git@nnn mathjax
|
|
</pre></div>
|
|
</div>
|
|
<p>to check out revision number <cite>nnn</cite>, but it is not easy to tell what
|
|
svn revision number is associated with a particular release. GitHub’s
|
|
<tt class="docutils literal"><span class="pre">svn</span></tt> service doesn’t appear to allow you to specify a particular
|
|
tagged version.</p>
|
|
</div>
|
|
<div class="section" id="obtaining-mathjax-via-an-archive">
|
|
<span id="getting-mathjax-zip"></span><h2>Obtaining MathJax via an archive<a class="headerlink" href="#obtaining-mathjax-via-an-archive" title="Permalink to this headline">¶</a></h2>
|
|
<p>Release versions of MathJax are available in archive files from the
|
|
<a class="reference external" href="http://www.mathjax.org/download/">MathJax download page</a> or the
|
|
<a class="reference external" href="http://github.com/mathjax/mathjax/">GitHub downloads</a> (click the
|
|
big download button on the right), where you can download the archive
|
|
that you need.</p>
|
|
<p>You should download the v1.1 archive (which will get you a file with a
|
|
name like <tt class="docutils literal"><span class="pre">mathjax-MathJax-v1.1-X-XXXXXXXX.zip</span></tt>, where the X’s are
|
|
some sequence of random-looking letters and numbers), then simply unzip
|
|
it. Once the MathJax directory is unpacked, you should move it to the
|
|
desired location on your server (or your hard disk, if you are using
|
|
it locally rather then through a web server). One natural location is
|
|
to put it at the top level of your web server’s hierarchy. That would
|
|
let you refer to the main MathJax file as <tt class="docutils literal"><span class="pre">/MathJax/MathJax.js</span></tt> from
|
|
within any page on your server.</p>
|
|
<p>From the <a class="reference external" href="http://github.com/mathjax/mathjax/">MathJax GitHub download link</a> (the download button at the
|
|
right), you can also select the <tt class="docutils literal"><span class="pre">Download</span> <span class="pre">.tar.gz</span></tt> or <tt class="docutils literal"><span class="pre">Download</span>
|
|
<span class="pre">.zip</span></tt> buttons to get a copy of the current development version of
|
|
MathJax that contains all the latest changes and bug-fixes. You can
|
|
also get older tagged versions (if there are any).</p>
|
|
<p>If a packaged release receives any important updates, then those
|
|
updates will be part of the <cite>branch</cite> for that version. The link to
|
|
the <tt class="docutils literal"><span class="pre">.zip</span></tt> file in the download list will be the original release
|
|
version, not the patched version. To obtain the patched version, use
|
|
the <cite>Branches</cite> drop down menu (at the far left of the menus within the
|
|
page) to select the release branch that you want (for example
|
|
<tt class="docutils literal"><span class="pre">v1.1-latest</span></tt>), and then use the download button and the <tt class="docutils literal"><span class="pre">Download</span>
|
|
<span class="pre">.tar.gz</span></tt> or <tt class="docutils literal"><span class="pre">Download</span> <span class="pre">.zip</span></tt> button to get the latest patched
|
|
version of that release.</p>
|
|
</div>
|
|
<div class="section" id="testing-your-installation">
|
|
<h2>Testing your installation<a class="headerlink" href="#testing-your-installation" title="Permalink to this headline">¶</a></h2>
|
|
<p>Use the HTML files in the <tt class="docutils literal"><span class="pre">test</span></tt> directory to see if your
|
|
installation is working properly:</p>
|
|
<div class="highlight-python"><pre>test/
|
|
index.html # Tests default configuration
|
|
index-images.html # Tests image-font fallback display
|
|
sample.html # Sample page with lots of pretty equations</pre>
|
|
</div>
|
|
<p>Open these files in your browser to see that they appear to be working
|
|
properly. If you have installed MathJax on a server, use the web
|
|
address for those files rather than opening them locally. When you
|
|
view the <tt class="docutils literal"><span class="pre">index.html</span></tt> file, you should see (after a few moments) a
|
|
message that MathJax appears to be working. If not, you should check
|
|
that the files have been transferred to the server completely, and that
|
|
the permissions allow the server to access the files and folders that
|
|
are part of the MathJax directory (be sure to verify the MathJax
|
|
folder’s permissions as well). Checking the server logs may help
|
|
locate problems with the installation.</p>
|
|
</div>
|
|
<div class="section" id="notes-about-shared-installations">
|
|
<span id="cross-domain-linking"></span><h2>Notes about shared installations<a class="headerlink" href="#notes-about-shared-installations" title="Permalink to this headline">¶</a></h2>
|
|
<p>Typically, you want to have MathJax installed on the same server as
|
|
your web pages that use MathJax. There are times, however, when that
|
|
may be impractical, or when you want to use a MathJax installation at
|
|
a different site. For example, a departmental server at
|
|
<tt class="docutils literal"><span class="pre">www.math.yourcollege.edu</span></tt> might like to use a college-wide
|
|
installation at <tt class="docutils literal"><span class="pre">www.yourcollege.edu</span></tt> rather than installing a
|
|
separate copy on the departmental machine. MathJax can certainly
|
|
be loaded from another server, but there is one important caveat —
|
|
Firefox’s and IE9’s same-origin security policy for cross-domain scripting.</p>
|
|
<p>Firefox’s interpretation of the same-origin policy is more strict than most
|
|
other browsers, and it affects how fonts are loaded with the <cite>@font-face</cite>
|
|
CSS directive. MathJax uses this directive to load web-based math fonts
|
|
into a page when the user doesn’t have them installed locally on their own
|
|
computer. Firefox’s security policy, however, only allows this when the
|
|
fonts come from the same server as the web page itself, so if you load
|
|
MathJax (and hence its web fonts) from a different server, Firefox won’t be
|
|
able to access those web fonts. In this case, MathJax will pause while
|
|
waiting for the font to download (which will never happen); it will time
|
|
out after about 5 seconds and switch to image fonts as a fallback.
|
|
Similarly, IE9 has a similar same-origin policy in its <cite>IE9 standards
|
|
mode</cite>, so it exhibits this same behavior.</p>
|
|
<p>There is a solution to this, however, if you manage the server where
|
|
MathJax is installed, and if that server is running the <a class="reference external" href="http://www.apache.org/">Apache web
|
|
server</a>. In the remote server’s
|
|
<tt class="docutils literal"><span class="pre">MathJax/fonts/HTML-CSS/TeX/otf</span></tt> folder, create a file called
|
|
<tt class="docutils literal"><span class="pre">.htaccess</span></tt> that contains the following lines:</p>
|
|
<div class="highlight-python"><pre><FilesMatch "\.(ttf|otf|eot)$">
|
|
<IfModule mod_headers.c>
|
|
Header set Access-Control-Allow-Origin "*"
|
|
</IfModule>
|
|
</FilesMatch></pre>
|
|
</div>
|
|
<p>and make sure the permissions allow the server to read this file. (The
|
|
file’s name starts with a period, which causes it to be an “invisible” file
|
|
on unix-based operating systems. Some systems, particularly those with
|
|
graphical user interfaces, may not allow you to create such files, so you
|
|
might need to use the command-line interface to accomplish this.)</p>
|
|
<p>This file should make it possible for pages at other sites to load MathJax
|
|
from this server in such a way that Firefox and IE9 will be able to
|
|
download the web-based fonts. If you want to restrict the sites that can
|
|
access the web fonts, change the <tt class="docutils literal"><span class="pre">Access-Control-Allow-Origin</span></tt> line to
|
|
something like:</p>
|
|
<div class="highlight-python"><pre>Header set Access-Control-Allow-Origin "http://www.math.yourcollege.edu"</pre>
|
|
</div>
|
|
<p>so that only pages at <tt class="docutils literal"><span class="pre">www.math.yourcollege.edu</span></tt> will be able to
|
|
download the fonts from this site. See the open font library
|
|
discussion of <a class="reference external" href="http://openfontlibrary.org/wiki/Web_Font_linking_and_Cross-Origin_Resource_Sharing">web-font linking</a>
|
|
for more details.</p>
|
|
</div>
|
|
<div class="section" id="firefox-and-local-fonts">
|
|
<span id="ff-local-fonts"></span><h2>Firefox and local fonts<a class="headerlink" href="#firefox-and-local-fonts" title="Permalink to this headline">¶</a></h2>
|
|
<p>Firefox’s same-origin security policy affects its ability to load
|
|
web-based fonts, as described above. This has implications not only
|
|
to cross-domain loading of MathJax, but also to using MathJax locally
|
|
from your hard disk. Firefox’s interpretation of the same-origin
|
|
policy for local files is that the “same domain” for a page is the
|
|
directory where that page exists, or any of its subdirectories. So if
|
|
you use MathJax in a page with a <tt class="docutils literal"><span class="pre">file://</span></tt> URL, and if MathJax is
|
|
loaded from a directory other than the one containing the original
|
|
page, then MathJax will not be able to access the web-based fonts in
|
|
Firefox. In that case, MathJax will fall back on image fonts to
|
|
display the mathematics.</p>
|
|
<p>In order for Firefox to be able to load the fonts properly for a local
|
|
file, your MathJax installation must be in a subdirectory of the one
|
|
containing the page that uses MathJax. This is an unfortunate
|
|
restriction, but it is a limitiation imposed by Firefox’s security
|
|
model that MathJax can not circumvent. Currently, this is not a
|
|
problem for other browsers.</p>
|
|
<p>One solution to this problem is to install the MathJax fonts locally, so
|
|
that Firefox will not have to use web-based fonts in the first place. To
|
|
do that, either install the <a class="reference external" href="http://stixfonts.org">STIX fonts</a>, or copy
|
|
the fonts from <tt class="docutils literal"><span class="pre">MathJax/fonts/HTML-CSS/TeX/otf</span></tt> into your systems fonts
|
|
directory and restart your browser (see the <a class="reference external" href="http://www.mathjax.org/help/fonts">MathJax fonts help page</a> for details).</p>
|
|
</div>
|
|
<div class="section" id="ie9-and-remote-fonts">
|
|
<h2>IE9 and remote fonts<a class="headerlink" href="#ie9-and-remote-fonts" title="Permalink to this headline">¶</a></h2>
|
|
<p>IE9’s same-origin policy affects its ability to load web-based fonts, as
|
|
described above. This has implications not ony to cross-domain loading of
|
|
MathJax, but also to the case where you view a local page (with a
|
|
<tt class="docutils literal"><span class="pre">file://</span></tt> URL) that accesses MathJax from a remote site, like the MathJax
|
|
CDN service. In this case, IE9 does <strong>not</strong> honor the
|
|
<tt class="docutils literal"><span class="pre">Access-Control-Allow-Origin</span></tt> setting of the remote server (as it would
|
|
if the web page came from an <tt class="docutils literal"><span class="pre">http://</span></tt> URL), and so it <strong>never</strong> allows the
|
|
font to be accessed.</p>
|
|
<p>One solution to this problem is to install the MathJax fonts locally so
|
|
that MathJax doesn’t have to use web-based fonts in the first place. Your
|
|
best bet is to install the <a class="reference external" href="http://stixfonts.org">STIX fonts</a> on your system (see the <a class="reference external" href="http://www.mathjax.org/help/fonts">MathJax
|
|
fonts help page</a> for details).</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="#">Installing and Testing MathJax</a><ul>
|
|
<li><a class="reference internal" href="#obtaining-mathjax-via-git">Obtaining MathJax via Git</a></li>
|
|
<li><a class="reference internal" href="#obtaining-mathjax-via-svn">Obtaining MathJax via SVN</a></li>
|
|
<li><a class="reference internal" href="#obtaining-mathjax-via-an-archive">Obtaining MathJax via an archive</a></li>
|
|
<li><a class="reference internal" href="#testing-your-installation">Testing your installation</a></li>
|
|
<li><a class="reference internal" href="#notes-about-shared-installations">Notes about shared installations</a></li>
|
|
<li><a class="reference internal" href="#firefox-and-local-fonts">Firefox and local fonts</a></li>
|
|
<li><a class="reference internal" href="#ie9-and-remote-fonts">IE9 and remote fonts</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
<h4>Previous topic</h4>
|
|
<p class="topless"><a href="start.html"
|
|
title="previous chapter">Getting Started</a></p>
|
|
<h4>Next topic</h4>
|
|
<p class="topless"><a href="configuration.html"
|
|
title="next chapter">Loading and Configuring MathJax</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="configuration.html" title="Loading and Configuring MathJax"
|
|
>next</a> |</li>
|
|
<li class="right" >
|
|
<a href="start.html" title="Getting Started"
|
|
>previous</a> |</li>
|
|
<li><a href="index.html">MathJax v1.1 documentation</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> |