<!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>Getting Started — MathJax v2.0 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: '2.0', 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 v2.0 documentation" href="index.html" /> <link rel="next" title="Installing and Testing MathJax" href="installation.html" /> <link rel="prev" title="What is MathJax?" href="mathjax.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="installation.html" title="Installing and Testing MathJax" accesskey="N">next</a> |</li> <li class="right" > <a href="mathjax.html" title="What is MathJax?" accesskey="P">previous</a> |</li> <li><a href="index.html">MathJax v2.0 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="getting-started"> <span id="id1"></span><h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline">¶</a></h1> <p>MathJax allows you to include mathematics in your web pages, either using LaTeX, MathML, or AsciiMath notation, and the mathematics will be processed using javascript to produce HTML, SVG or MathML equations for viewing in any modern browser.</p> <p>There are two ways to access MathJax: the easiest way is to use the copy of MathJax available from our distributed network service at <tt class="docutils literal"><span class="pre">cdn.mathjax.org</span></tt>, but you can also download and install a copy of MathJax on your own server, or use it locally on your hard disk (with no need for network access). All three of these are described below, with links to more detailed explanations. This page gives the quickest and easiest ways to get MathJax up and running on your web site, but you may want to read the details in order to customize the setup for your pages.</p> <div class="section" id="using-the-mathjax-content-delivery-network-cdn"> <span id="mathjax-cdn"></span><h2>Using the MathJax Content Delivery Network (CDN)<a class="headerlink" href="#using-the-mathjax-content-delivery-network-cdn" title="Permalink to this headline">¶</a></h2> <p>To use MathJax from our server, you need to do two things:</p> <ol class="arabic simple"> <li>Link MathJax into the web pages that are to include mathematics.</li> <li>Put mathematics into your web pages so that MathJax can display it.</li> </ol> <p>You accomplish the first step by putting</p> <div class="highlight-html"><div class="highlight"><pre><span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span> <span class="na">src=</span><span class="s">"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"</span><span class="nt">></span> <span class="nt"></script></span> </pre></div> </div> <p>into the <tt class="docutils literal"><span class="pre"><head></span></tt> block of your document. (It can also go in the <tt class="docutils literal"><span class="pre"><body></span></tt> if necessary, but the head is to be preferred.) This will load the latest version of MathJax from the distributed server, and configure it to recognize mathematics in both TeX and MathML notation, and ask it to generate its output using MathML if the browser supports that well enough, and otherwise use HTML-with-CSS to display the mathematics. This is one of the most general configurations, and should suffice for most people’s needs. Other configurations are available, however, and you can also provide additional configuration parameters to taylor one of the configurations to your needs. More details can be found in the <a class="reference internal" href="configuration.html#loading"><em>Loading and Configuring MathJax</em></a> instructions.</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> <p>To see how to enter mathematics in your web pages, see <a class="reference internal" href="#putting-mathematics-in-a-web-page">Putting mathematics in a web page</a> below.</p> <div class="section" id="secure-access-to-the-cdn"> <h3>Secure Access to the CDN<a class="headerlink" href="#secure-access-to-the-cdn" title="Permalink to this headline">¶</a></h3> <p>When the the MathJax CDN is accessed via the address <tt class="docutils literal"><span class="pre">http://cdn.mathjax.org</span></tt>, data is downloaded over a regular, insecure HTTP connection. This introduces a security risk, since it is possible a hostile 3rd party could intercept the MathJax program data, and replace it. This is sometimes called a <a class="reference external" href="http://en.wikipedia.org/wiki/Man-in-the-middle_attack">man-in-the-middle</a> attack.</p> <p>To prevent such attacks, it is necessary to access the MathJax CDN over a secure HTTPS connection. This can be done easily by using the following <tt class="docutils literal"><span class="pre"><script></span></tt> tag instead of the one listed above:</p> <div class="highlight-html"><div class="highlight"><pre><span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span> <span class="na">src=</span><span class="s">"https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"</span><span class="nt">></span> <span class="nt"></script></span> </pre></div> </div> <p>Currently, the Amazon Cloudfront service used by the MathJax CDN does not support the use of a human-friendly name like <tt class="docutils literal"><span class="pre">cdn.mathjax.org</span></tt> for secure connections; however, the address given above is stable and safe to use.</p> </div> </div> <div class="section" id="installing-your-own-copy-of-mathjax"> <h2>Installing Your Own Copy of MathJax<a class="headerlink" href="#installing-your-own-copy-of-mathjax" title="Permalink to this headline">¶</a></h2> <p>We recommend using the CDN service if you can, but you can also install MathJax on your own server, or locally on your own hard disk. To do so you will need to do the following things:</p> <p>1. Obtain a copy of MathJax and make it available on your server or hard disk.</p> <ol class="arabic simple" start="2"> <li>Configure MathJax to suit the needs of your site.</li> <li>Link MathJax into the web pages that are to include mathematics.</li> <li>Put mathematics into your web pages so that MathJax can display it.</li> </ol> <div class="section" id="obtaining-and-installing-mathjax"> <h3>Obtaining and Installing MathJax<a class="headerlink" href="#obtaining-and-installing-mathjax" title="Permalink to this headline">¶</a></h3> <p>The easiest way to set up MathJax is to obtain the v2.0 archive from the <a class="reference external" href="http://www.mathjax.org/download/">MathJax download page</a> (you should obtain a file named something like <tt class="docutils literal"><span class="pre">mathjax-MathJax-v2.0-X-XXXXXXXX.zip</span></tt> where the X’s are random looking numbers and letters). This archive includes both the MathJax code and the MathJax webfonts, so it is the only file you need. Note that this is different from v1.0 and earlier releases, which had the fonts separate from the rest of the code.</p> <p>Unpack the archive and place the resulting MathJax folder onto your web server at a convenient location where you can include it into your web pages. For example, making <tt class="docutils literal"><span class="pre">MathJax</span></tt> a top-level directory on your server would be one natural way to do this. That would let you refer to the main MathJax file via the URL <tt class="docutils literal"><span class="pre">/MathJax/MathJax.js</span></tt> from within any page on your server.</p> <p><strong>Note:</strong> While this is the easiest way to set up MathJax initially, there is a better way to do it if you want to be able to keep your copy of MathJax up-to-date. That uses the <a class="reference external" href="http://git-scm.com/">Git</a> version control system, and is described in the <a class="reference internal" href="installation.html#getting-mathjax-git"><em>Installing MathJax</em></a> document. If you prefer using <a class="reference external" href="http://subversion.apache.org/">Subversion</a>, you can also use that to get a copy of MathJax (see <a class="reference internal" href="installation.html#getting-mathjax-svn"><em>Installing MathJax via SVN</em></a>).</p> <p>Once you have MathJax set up on your server, you can test it using the files in the <tt class="docutils literal"><span class="pre">MathJax/test</span></tt> directory. If you are putting MathJax on a server, load them in your browser using their web addresses rather than opening them locally (i.e., use an <tt class="docutils literal"><span class="pre">http://</span></tt> URL rather than a <tt class="docutils literal"><span class="pre">file://</span></tt> URL). When you view the <tt class="docutils literal"><span class="pre">index.html</span></tt> file, after a few moments you should see a message indicating that MathJax appears to be working. If not, 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.) Check the server log files for any errors that pertain to the MathJax installation; this may help locate problems in the permission or locations of files.</p> </div> <div class="section" id="configuring-your-copy-of-mathjax"> <h3>Configuring your copy of MathJax<a class="headerlink" href="#configuring-your-copy-of-mathjax" title="Permalink to this headline">¶</a></h3> <p>When you include MathJax into your web pages as described below, it will load the file <tt class="docutils literal"><span class="pre">config/TeX-AMS-MML_HTMLorMML.js</span></tt> (i.e., the file named <tt class="docutils literal"><span class="pre">TeX-AMS-MML_HTMLorMML.js</span></tt> in the <tt class="docutils literal"><span class="pre">config</span></tt> folder of the main <tt class="docutils literal"><span class="pre">MathJax</span></tt> folder). This file preloads all the most commonly-used components of MathJax, allowing it to process mathematics that is in the TeX or LaTeX format, or in MathML notation. It will produce output in MathML form if the user’s browser supports that sufficiently, and will use HTML-with-CSS to render the mathematics otherwise.</p> <p>There are a number of other prebuilt configuration files that you can choose from as well, or you could use the <tt class="docutils literal"><span class="pre">config/default.js</span></tt> file and customize the settings yourself. The combined configuration files are described more fully in <a class="reference internal" href="config-files.html#common-configurations"><em>Common Configurations</em></a>, and the configuration options are described in <a class="reference internal" href="options/index.html#configuration"><em>Configuration Options</em></a>.</p> <p>Note: The configuration process changed between MathJax v1.0 and v1.1, so if you have existing pages that use MathJax v1.0, you may need to modify the tag that loads MathJax so that it conforms with the new configuration process. See <a class="reference internal" href="installation.html#installation"><em>Installing and Configuring MathJax</em></a> for more details.</p> </div> <div class="section" id="linking-your-copy-of-mathjax-into-a-web-page"> <h3>Linking your copy of MathJax into a web page<a class="headerlink" href="#linking-your-copy-of-mathjax-into-a-web-page" title="Permalink to this headline">¶</a></h3> <p>You can include MathJax in your web page by putting</p> <div class="highlight-html"><div class="highlight"><pre><span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span> <span class="na">src=</span><span class="s">"path-to-MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"</span><span class="nt">></script></span> </pre></div> </div> <p>in your document’s <tt class="docutils literal"><span class="pre"><head></span></tt> block. Here, <tt class="docutils literal"><span class="pre">path-to-MathJax</span></tt> should be replaced by the URL for the main MathJax directory, so if you have put the <tt class="docutils literal"><span class="pre">MathJax</span></tt> directory at the top level of you server’s web site, you could use</p> <div class="highlight-html"><div class="highlight"><pre><span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span> <span class="na">src=</span><span class="s">"/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"</span><span class="nt">></script></span> </pre></div> </div> <p>to load MathJax in your page. For example, your page could look like</p> <div class="highlight-html"><div class="highlight"><pre><span class="nt"><html></span> <span class="nt"><head></span> ... <span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span> <span class="na">src=</span><span class="s">"/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"</span><span class="nt">></script></span> <span class="nt"></head></span> <span class="nt"><body></span> ... <span class="nt"></body></span> <span class="nt"></html></span> </pre></div> </div> <p>If you have installed MathJax on a server that is in a different domain from the one serving the page that loads MathJax, be sure to read the <a class="reference internal" href="installation.html#cross-domain-linking"><em>Notes About Shared Servers</em></a> for more details. In that case, you may wish to consider using the <a class="reference internal" href="#mathjax-cdn"><em>MathJax CDN</em></a> rather than installing your own copy of MathJax.</p> </div> </div> <div class="section" id="putting-mathematics-in-a-web-page"> <h2>Putting mathematics in a web page<a class="headerlink" href="#putting-mathematics-in-a-web-page" title="Permalink to this headline">¶</a></h2> <p>To put mathematics in your web page, you can use <a class="reference internal" href="glossary.html#term-tex"><em class="xref std std-term">TeX</em></a> and <a class="reference internal" href="glossary.html#term-latex"><em class="xref std std-term">LaTeX</em></a> notation, <a class="reference internal" href="glossary.html#term-mathml"><em class="xref std std-term">MathML</em></a> notation, <a class="reference internal" href="glossary.html#term-asciimath"><em class="xref std std-term">AsciiMath</em></a> notation, or a combination of all three within the same page; the MathJax configuration tells MathJax which you want to use, and how you plan to indicate the mathematics when you are using TeX notation. The configuration file used in the examples above tells MathJax to look for both TeX and MathML notation within your pages. Other configuration files tell MathJax to use AsciiMath input. These three formats are described in more detail below.</p> <div class="section" id="tex-and-latex-input"> <span id="id2"></span><h3>TeX and LaTeX input<a class="headerlink" href="#tex-and-latex-input" title="Permalink to this headline">¶</a></h3> <p>Mathematics that is written in <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-latex"><em class="xref std std-term">LaTeX</em></a> format is indicated using <em>math delimiters</em> that surround the mathematics, telling MathJax what part of your page represents mathematics and what is normal text. There are two types of equations: ones that occur within a paragraph (in-line mathematics), and larger equations that appear separated from the rest of the text on lines by themselves (displayed mathematics).</p> <p>The default math delimiters are <tt class="docutils literal"><span class="pre">$$...$$</span></tt> and <tt class="docutils literal"><span class="pre">\[...\]</span></tt> for displayed mathematics, and <tt class="docutils literal"><span class="pre">\(...\)</span></tt> for in-line mathematics. Note in particular that the <tt class="docutils literal"><span class="pre">$...$</span></tt> in-line delimiters are <strong>not</strong> used by default. That is because dollar signs appear too often in non-mathematical settings, which could cause some text to be treated as mathematics unexpectedly. For example, with single-dollar delimiters, ”... the cost is $2.50 for the first one, and $2.00 for each additional one ...” would cause the phrase “2.50 for the first one, and” to be treated as mathematics since it falls between dollar signs. For this reason, if you want to use single-dollars for in-line math mode, you must enable that explicitly in your configuration:</p> <div class="highlight-html"><div class="highlight"><pre><span class="nt"><script </span><span class="na">type=</span><span class="s">"text/x-mathjax-config"</span><span class="nt">></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="s1">'$'</span><span class="p">,</span><span class="s1">'$'</span><span class="p">],</span> <span class="p">[</span><span class="s1">'\\('</span><span class="p">,</span><span class="s1">'\\)'</span><span class="p">]]}</span> <span class="p">});</span> <span class="nt"></script></span> <span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span> <span class="na">src=</span><span class="s">"path-to-mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"</span><span class="nt">></script></span> </pre></div> </div> <p>See the <tt class="docutils literal"><span class="pre">config/default.js</span></tt> file, or the <a class="reference internal" href="options/tex2jax.html#configure-tex2jax"><em>tex2jax configuration options</em></a> page, for additional configuration parameters that you can specify for the <cite>tex2jax</cite> preprocessor, which is the component of MathJax that identifies TeX notation within the page. See the <a class="reference internal" href="tex.html#tex-support"><em>TeX and LaTeX</em></a> page for more on MathJax’s support for TeX, and in particular how to deal with single dollar signs in your text when you have enabled single dollar-sign delimiters.</p> <p>Here is a complete sample page containing TeX mathematics (also available in the <a class="reference external" href="http://cdn.mathjax.org/mathjax/2.0-latest/test/sample-tex.html">test/sample-tex.html</a> file):</p> <div class="highlight-html"><div class="highlight"><pre><span class="cp"><!DOCTYPE html></span> <span class="nt"><html></span> <span class="nt"><head></span> <span class="nt"><title></span>MathJax TeX Test Page<span class="nt"></title></span> <span class="nt"><script </span><span class="na">type=</span><span class="s">"text/x-mathjax-config"</span><span class="nt">></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="s1">'$'</span><span class="p">,</span><span class="s1">'$'</span><span class="p">],</span> <span class="p">[</span><span class="s1">'\\('</span><span class="p">,</span><span class="s1">'\\)'</span><span class="p">]]}});</span> <span class="nt"></script></span> <span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span> <span class="na">src=</span><span class="s">"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"</span><span class="nt">></span> <span class="nt"></script></span> <span class="nt"></head></span> <span class="nt"><body></span> When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$ <span class="nt"></body></span> <span class="nt"></html></span> </pre></div> </div> <p>Since the TeX notation is part of the text of the page, there are some caveats that you must keep in mind when you enter your mathematics. In particular, you need to be careful about the use of less-than signs, since those are what the browser uses to indicate the start of a tag in HTML. Putting a space on both sides of the less-than sign should be sufficient, but see <a class="reference internal" href="tex.html#tex-support"><em>TeX and LaTeX support</em></a> for details.</p> <p>If you are using MathJax within a blog, wiki, or other content management system, the markup language used by that system may interfere with the TeX notation used by MathJax. For example, if your blog uses <a class="reference internal" href="glossary.html#term-markdown"><em class="xref std std-term">Markdown</em></a> notation for authoring your pages, the underscores used by TeX to indicate subscripts may be confused with the use of underscores by Markdown to indicate italics, and the two uses may prevent your mathematics from being displayed. See <a class="reference internal" href="tex.html#tex-support"><em>TeX and LaTeX support</em></a> for some suggestions about how to deal with the problem.</p> <p>There are a number of extensions for the TeX input processor that are loaded by the <tt class="docutils literal"><span class="pre">TeX-AMS-MML_HTMLorMML</span></tt> configuration. These include:</p> <ul class="simple"> <li><cite>TeX/AMSmath.js</cite>, which defines the AMS math environments and macros,</li> <li><cite>TeX/AMSsymbols.js</cite>, which defines the macros for the symbols in the <cite>msam10</cite> and <cite>msbm10</cite> fonts,</li> <li><cite>TeX/noErrors.js</cite>, which shows the original TeX code rather than an error message when there is a problem processing the TeX, and</li> <li><cite>TeX/noUndefined.js</cite>, which prevents undefined macros from producing an error message, and instead shows the macro name in red.</li> </ul> <p>Other extensions may be loaded automatically when needed. See <a class="reference internal" href="tex.html#tex-support"><em>TeX and LaTeX support</em></a> for details on the other TeX extensions that are available.</p> </div> <div class="section" id="mathml-input"> <span id="id3"></span><h3>MathML input<a class="headerlink" href="#mathml-input" title="Permalink to this headline">¶</a></h3> <p>For mathematics written in <a class="reference internal" href="glossary.html#term-mathml"><em class="xref std std-term">MathML</em></a> notation, you mark your mathematics using standard <tt class="docutils literal"><span class="pre"><math></span></tt> tags, where <tt class="docutils literal"><span class="pre"><math</span> <span class="pre">display="block"></span></tt> represents displayed mathematics and <tt class="docutils literal"><span class="pre"><math</span> <span class="pre">display="inline"></span></tt> or just <tt class="docutils literal"><span class="pre"><math></span></tt> represents in-line mathematics.</p> <p>Note that this will work in HTML files, not just XHTML files (MathJax works with both), and that the web page need not be served with any special MIME-type. Also note that, unless you are using XHTML rather than HTML, you should not include a namespace prefix for your <tt class="docutils literal"><span class="pre"><math></span></tt> tags; for example, you should not use <tt class="docutils literal"><span class="pre"><m:math></span></tt> except in a file where you have tied the <tt class="docutils literal"><span class="pre">m</span></tt> namespace to the MathML DTD by adding the <tt class="docutils literal"><span class="pre">xmlns:m="http://www.w3.org/1998/Math/MathML"</span></tt> attribtue to your file’s <tt class="docutils literal"><span class="pre"><html></span></tt> tag.</p> <p>Although it is not required, it is recommended that you include the <tt class="docutils literal"><span class="pre">xmlns="http://www.w3.org/1998/Math/MathML"</span></tt> attribute on all <tt class="docutils literal"><span class="pre"><math></span></tt> tags in your document (and this is preferred to the use of a namespace prefix like <tt class="docutils literal"><span class="pre">m:</span></tt> above, since those are deprecated in HTML5) in order to make your MathML work in the widest range of situations.</p> <p>Here is a complete sample page containing MathML mathematics (also available in the <a class="reference external" href="http://cdn.mathjax.org/mathjax/2.0-latest/test/sample-mml.html">test/sample-mml.html</a> file):</p> <div class="highlight-html"><div class="highlight"><pre><span class="cp"><!DOCTYPE html></span> <span class="nt"><html></span> <span class="nt"><head></span> <span class="nt"><title></span>MathJax MathML Test Page<span class="nt"></title></span> <span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span> <span class="na">src=</span><span class="s">"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"</span><span class="nt">></span> <span class="nt"></script></span> <span class="nt"></head></span> <span class="nt"><body></span> <span class="nt"><p></span> When <span class="nt"><math</span> <span class="na">xmlns=</span><span class="s">"http://www.w3.org/1998/Math/MathML"</span><span class="nt">></span> <span class="nt"><mi></span>a<span class="nt"></mi><mo></span><span class="ni">&#x2260;</span><span class="nt"></mo><mn></span>0<span class="nt"></mn></span> <span class="nt"></math></span>, there are two solutions to <span class="nt"><math</span> <span class="na">xmlns=</span><span class="s">"http://www.w3.org/1998/Math/MathML"</span><span class="nt">></span> <span class="nt"><mi></span>a<span class="nt"></mi><msup><mi></span>x<span class="nt"></mi><mn></span>2<span class="nt"></mn></msup></span> <span class="nt"><mo></span>+<span class="nt"></mo></span> <span class="nt"><mi></span>b<span class="nt"></mi><mi></span>x<span class="nt"></mi></span> <span class="nt"><mo></span>+<span class="nt"></mo></span> <span class="nt"><mi></span>c<span class="nt"></mi></span> <span class="nt"><mo></span>=<span class="nt"></mo></span> <span class="nt"><mn></span>0<span class="nt"></mn></span> <span class="nt"></math></span> and they are <span class="nt"><math</span> <span class="na">xmlns=</span><span class="s">"http://www.w3.org/1998/Math/MathML"</span> <span class="na">display=</span><span class="s">"block"</span><span class="nt">></span> <span class="nt"><mi></span>x<span class="nt"></mi></span> <span class="nt"><mo></span>=<span class="nt"></mo></span> <span class="nt"><mrow></span> <span class="nt"><mfrac></span> <span class="nt"><mrow></span> <span class="nt"><mo></span><span class="ni">&#x2212;</span><span class="nt"></mo></span> <span class="nt"><mi></span>b<span class="nt"></mi></span> <span class="nt"><mo></span><span class="ni">&#x00B1;</span><span class="nt"></mo></span> <span class="nt"><msqrt></span> <span class="nt"><msup><mi></span>b<span class="nt"></mi><mn></span>2<span class="nt"></mn></msup></span> <span class="nt"><mo></span><span class="ni">&#x2212;</span><span class="nt"></mo></span> <span class="nt"><mn></span>4<span class="nt"></mn><mi></span>a<span class="nt"></mi><mi></span>c<span class="nt"></mi></span> <span class="nt"></msqrt></span> <span class="nt"></mrow></span> <span class="nt"><mrow></span> <span class="nt"><mn></span>2<span class="nt"></mn><mi></span>a<span class="nt"></mi></span> <span class="nt"></mrow></span> <span class="nt"></mfrac></span> <span class="nt"></mrow></span> <span class="nt"><mtext></span>.<span class="nt"></mtext></span> <span class="nt"></math></span> <span class="nt"></p></span> <span class="nt"></body></span> <span class="nt"></html></span> </pre></div> </div> <p>When entering MathML notation in an HTML page (rather than an XHTML page), you should <strong>not</strong> use self-closing tags, but should use explicit open and close tags for all your math elements. For example, you should use</p> <div class="highlight-html"><div class="highlight"><pre><span class="nt"><mspace</span> <span class="na">width=</span><span class="s">"5pt"</span><span class="nt">></mspace></span> </pre></div> </div> <p>rather than <tt class="docutils literal"><span class="pre"><mspace</span> <span class="pre">width="5pt"</span> <span class="pre">/></span></tt> in an HTML document. If you use the self-closing form, some browsers will not build the math tree properly, and MathJax will receive a damaged math structure, which will not be rendered as the original notation would have been. Typically, this will cause parts of your expression to not be displayed. Unfortunately, there is nothing MathJax can do about that, since the browser has incorrectly interpreted the tags long before MathJax has a chance to work with them.</p> <p>The component of MathJax that recognizes MathML notation within the page is called the <cite>mml2jax</cite> extension, and it has only a few configuration options; see the <tt class="docutils literal"><span class="pre">config/default.js</span></tt> file or the <a class="reference internal" href="options/mml2jax.html#configure-mml2jax"><em>mml2jax configuration options</em></a> page for more details. See the <a class="reference internal" href="mathml.html#mathml-support"><em>MathML</em></a> page for more on MathJax’s MathML support.</p> </div> <div class="section" id="asciimath-input"> <span id="id4"></span><h3>AsciiMath input<a class="headerlink" href="#asciimath-input" title="Permalink to this headline">¶</a></h3> <p>MathJax v2.0 includes a new input format: <a class="reference internal" href="glossary.html#term-asciimath"><em class="xref std std-term">AsciiMath</em></a> notation. For mathematics written in this form, you mark your mathematical expressions by surrounding them in “back-ticks”, i.e., <tt class="docutils literal"><span class="pre">`...`</span></tt>.</p> <p>Here is a complete sample page containing AsciiMath notation (also available in the <a class="reference external" href="http://cdn.mathjax.org/mathjax/2.0-latest/test/sample-asciimath.html">test/sample-asciimath.html</a> file):</p> <div class="highlight-html"><div class="highlight"><pre><span class="cp"><!DOCTYPE html></span> <span class="nt"><html></span> <span class="nt"><head></span> <span class="nt"><title></span>MathJax AsciiMath Test Page<span class="nt"></title></span> <span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span> <span class="na">src=</span><span class="s">"../MathJax.js?config=AM_HTMLorMML-full"</span><span class="nt">></script></span> <span class="nt"></head></span> <span class="nt"><body></span> <span class="nt"><p></span>When `a != 0`, there are two solutions to `ax^2 + bx + c = 0` and they are<span class="nt"></p></span> <span class="nt"><p</span> <span class="na">style=</span><span class="s">"text-align:center"</span><span class="nt">></span> `x = (-b +- sqrt(b^2-4ac))/(2a) .` <span class="nt"></p></span> <span class="nt"></body></span> <span class="nt"></html></span> </pre></div> </div> <p>The component of MathJax that recognizes asciimath notation within the page is called the <cite>asciimath2jax</cite> extension, and it has only a few configuration options; see the <tt class="docutils literal"><span class="pre">config/default.js</span></tt> file or the <a class="reference internal" href="options/asciimath2jax.html#configure-asciimath2jax"><em>asciimath2jax configuration options</em></a> page for more details. See the <a class="reference internal" href="asciimath.html#asciimath-support"><em>AsciiMath support</em></a> page for more on MathJax’s AsciiMath support.</p> </div> </div> <div class="section" id="where-to-go-from-here"> <h2>Where to go from here?<a class="headerlink" href="#where-to-go-from-here" title="Permalink to this headline">¶</a></h2> <p>If you have followed the instructions above, you should now have MathJax installed and configured on your web server, and you should be able to use it to write web pages that include mathematics. At this point, you can start making pages that contain mathematical content!</p> <p>You could also read more about the details of how to <a class="reference internal" href="configuration.html#loading"><em>customize MathJax</em></a>.</p> <p>If you are trying to use MathJax in blog or wiki software or in some other content-management system, you might want to read about <a class="reference internal" href="platforms/index.html#platforms"><em>using MathJax in popular platforms</em></a>.</p> <p>If you are working on dynamic pages that include mathematics, you might want to read about the <a class="reference internal" href="api/index.html#mathjax-api"><em>MathJax Application Programming Interface</em></a> (its API), so you know how to include mathematics in your interactive pages.</p> <p>If you are having trouble getting MathJax to work, you can read more about <a class="reference internal" href="installation.html#installation"><em>installing MathJax</em></a>, or <a class="reference internal" href="configuration.html#loading"><em>loading and configuring MathJax</em></a>.</p> <p>Finally, if you have questions or comments, or want to help support MathJax, you could visit the <a class="reference internal" href="community.html#community-forums"><em>MathJax community forums</em></a> or the <a class="reference internal" href="community.html#community-tracker"><em>MathJax bug tracker</em></a>.</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="#">Getting Started</a><ul> <li><a class="reference internal" href="#using-the-mathjax-content-delivery-network-cdn">Using the MathJax Content Delivery Network (CDN)</a><ul> <li><a class="reference internal" href="#secure-access-to-the-cdn">Secure Access to the CDN</a></li> </ul> </li> <li><a class="reference internal" href="#installing-your-own-copy-of-mathjax">Installing Your Own Copy of MathJax</a><ul> <li><a class="reference internal" href="#obtaining-and-installing-mathjax">Obtaining and Installing MathJax</a></li> <li><a class="reference internal" href="#configuring-your-copy-of-mathjax">Configuring your copy of MathJax</a></li> <li><a class="reference internal" href="#linking-your-copy-of-mathjax-into-a-web-page">Linking your copy of MathJax into a web page</a></li> </ul> </li> <li><a class="reference internal" href="#putting-mathematics-in-a-web-page">Putting mathematics in a web page</a><ul> <li><a class="reference internal" href="#tex-and-latex-input">TeX and LaTeX input</a></li> <li><a class="reference internal" href="#mathml-input">MathML input</a></li> <li><a class="reference internal" href="#asciimath-input">AsciiMath input</a></li> </ul> </li> <li><a class="reference internal" href="#where-to-go-from-here">Where to go from here?</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="mathjax.html" title="previous chapter">What is MathJax?</a></p> <h4>Next topic</h4> <p class="topless"><a href="installation.html" title="next chapter">Installing and Testing 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="installation.html" title="Installing and Testing MathJax" >next</a> |</li> <li class="right" > <a href="mathjax.html" title="What is MathJax?" >previous</a> |</li> <li><a href="index.html">MathJax v2.0 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2012 Design Science. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7. </div> </body> </html>