318 lines
18 KiB
HTML
318 lines
18 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>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 commands</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 udpate 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
|
||
“bleeding-edge” version that contains all the latest changes to
|
||
MathJax. At times, however, these 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), use <tt class="docutils literal"><span class="pre">git</span> <span class="pre">tag</span>
|
||
<span class="pre">-l</span></tt> to see all versions and use <tt class="docutils literal"><span class="pre">git</span> <span class="pre">checkout</span> <span class="pre"><tag_name></span></tt> to
|
||
checkout that version of MathJax. When you want to upgrade to a new
|
||
release, you will need to repeat this for the latest release tag.</p>
|
||
</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 commands</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 udpate 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
|
||
“bleeding-edge” version that contains all the latest changes to
|
||
MathJax. At times, however, these 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 sepecify 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 big 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 “bleeding-edge” version of
|
||
MathJax that contains all the latest changes and bug-fixes.</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, that
|
||
the fonts archive has been unpacked in the correct location, 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 imporant caveat —
|
||
Firefox’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) and will time out after about 15
|
||
seconds for each font it tries to access. Typically that is three or
|
||
four fonts, so your Firefox users will experience a minute or so
|
||
delay before mathematics is displayed, and then it will probably
|
||
display incorrectly because the browser doesn’t have access to the
|
||
correct fonts.</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 graphic 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 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="forefox-and-local-fonts">
|
||
<span id="ff-local-fonts"></span><h2>Forefox and Local Fonts<a class="headerlink" href="#forefox-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 diretory 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>
|
||
</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="#forefox-and-local-fonts">Forefox and Local 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>
|
||
<h3>This Page</h3>
|
||
<ul class="this-page-menu">
|
||
<li><a href="_sources/installation.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="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> |