Skip to content

Commit

Permalink
Add more to TeX documentation, and include new examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dpvc committed Feb 22, 2012
1 parent 39b78b1 commit 90f9948
Show file tree
Hide file tree
Showing 9 changed files with 419 additions and 7 deletions.
58 changes: 57 additions & 1 deletion docs/html/_sources/tex.txt
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,33 @@ load extensions into pages that didn't load them in their
configurations (and prevents you from having to load all the
extensions into all pages even if they aren't used).

It is also possible to create a macro that will autoload an extension
when it is first used (under the assumption that the extension will
redefine it to perform its true function). For example

.. code-block:: html

<script type="text/x-mathjax-config">
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{
cancel: ["Extension","cancel"],
bcancel: ["Extension","cancel"],
xcancel: ["Extension","cancel"],
cancelto: ["Extension","cancel"]
});
});
</script>

would declare the ``\cancel``, ``\bcancel``, ``\xcancel``, and
``\cancelto`` macros to load the `cancel` extension (where they are
actually defined). Whichever is used first will cause the extension
to be loaded, redefining all four to their proper values. Note that
this may be better than loading the extension explicitly, since it
avoids loading the extra file on pages where these macros are *not*
used. The `sample autoloading macros
<http://cdn.mathjax.org/mathjax/latest/test/sample-autoload.html>`_
example page shows this in action.

The main extensions are described below.


Expand Down Expand Up @@ -383,6 +410,9 @@ want to use the other macros that it defines. The `AMSsymbols` extension
is not loaded automatically, so you must include it explicitly if you want
to use the macros it defines.

Both extensions are included in all the combined configuration files
that load the TeX input processor.


Autobold
--------
Expand Down Expand Up @@ -742,7 +772,20 @@ the paragraph, use
}
}

You may also wish to set the font family, as the default is "serif".
You may also wish to set the font family or other CSS values here.

If you are using a combined configuration file that loads the TeX
input processor, it will also load the `noErrors` extension
automatically. If you want to disable the `noErrors` extension so
that you receive the normal TeX error messages, use the following
configuration:

.. code-block:: javascript

TeX: { noErrors: { disabled: true } }

Any math that includes errors will be replaced by an error message
indicating what went wrong.


noUndefined
Expand Down Expand Up @@ -777,6 +820,19 @@ default values set ``mathcolor`` to ``"red"``, but do not set any
other attributes. This example sets the background to a light pink,
and reduces the font size slightly.

If you are using a combined configuration file that loads the TeX
input processor, it will also load the `noUndefined` extension
automatically. If you want to disable the `noUndefined` extension so
that you receive the normal TeX error messages for undefined macros,
use the following configuration:

.. code-block:: javascript

TeX: { noUndefined: { disabled: true } }

Any math that includes an undefined control sequence name will be
replaced by an error message indicating what name was undefined.


Unicode support
---------------
Expand Down
2 changes: 1 addition & 1 deletion docs/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ <h2>Reference Pages<a class="headerlink" href="#reference-pages" title="Permalin
</li>
</ul>
<hr class="docutils" />
<p>This version of the documentation was built February 20, 2012.</p>
<p>This version of the documentation was built February 22, 2012.</p>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion docs/html/searchindex.js

Large diffs are not rendered by default.

47 changes: 46 additions & 1 deletion docs/html/tex.html
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,29 @@ <h2>TeX and LaTeX in HTML documents<a class="headerlink" href="#tex-and-latex-in
load extensions into pages that didn&#8217;t load them in their
configurations (and prevents you from having to load all the
extensions into all pages even if they aren&#8217;t used).</p>
<p>It is also possible to create a macro that will autoload an extension
when it is first used (under the assumption that the extension will
redefine it to perform its true function). 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">Register</span><span class="p">.</span><span class="nx">StartupHook</span><span class="p">(</span><span class="s2">&quot;TeX Jax Ready&quot;</span><span class="p">,</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
<span class="nx">MathJax</span><span class="p">.</span><span class="nx">Hub</span><span class="p">.</span><span class="nx">Insert</span><span class="p">(</span><span class="nx">MathJax</span><span class="p">.</span><span class="nx">InputJax</span><span class="p">.</span><span class="nx">TeX</span><span class="p">.</span><span class="nx">Definitions</span><span class="p">.</span><span class="nx">macros</span><span class="p">,{</span>
<span class="nx">cancel</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;Extension&quot;</span><span class="p">,</span><span class="s2">&quot;cancel&quot;</span><span class="p">],</span>
<span class="nx">bcancel</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;Extension&quot;</span><span class="p">,</span><span class="s2">&quot;cancel&quot;</span><span class="p">],</span>
<span class="nx">xcancel</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;Extension&quot;</span><span class="p">,</span><span class="s2">&quot;cancel&quot;</span><span class="p">],</span>
<span class="nx">cancelto</span><span class="o">:</span> <span class="p">[</span><span class="s2">&quot;Extension&quot;</span><span class="p">,</span><span class="s2">&quot;cancel&quot;</span><span class="p">]</span>
<span class="p">});</span>
<span class="p">});</span>
<span class="nt">&lt;/script&gt;</span>
</pre></div>
</div>
<p>would declare the <tt class="docutils literal"><span class="pre">\cancel</span></tt>, <tt class="docutils literal"><span class="pre">\bcancel</span></tt>, <tt class="docutils literal"><span class="pre">\xcancel</span></tt>, and
<tt class="docutils literal"><span class="pre">\cancelto</span></tt> macros to load the <cite>cancel</cite> extension (where they are
actually defined). Whichever is used first will cause the extension
to be loaded, redefining all four to their proper values. Note that
this may be better than loading the extension explicitly, since it
avoids loading the extra file on pages where these macros are <em>not</em>
used. The <a class="reference external" href="http://cdn.mathjax.org/mathjax/latest/test/sample-autoload.html">sample autoloading macros</a>
example page shows this in action.</p>
<p>The main extensions are described below.</p>
<div class="section" id="action">
<h3>Action<a class="headerlink" href="#action" title="Permalink to this headline"></a></h3>
Expand Down Expand Up @@ -366,6 +389,8 @@ <h3>AMSmath and AMSsymbols<a class="headerlink" href="#amsmath-and-amssymbols" t
want to use the other macros that it defines. The <cite>AMSsymbols</cite> extension
is not loaded automatically, so you must include it explicitly if you want
to use the macros it defines.</p>
<p>Both extensions are included in all the combined configuration files
that load the TeX input processor.</p>
</div>
<div class="section" id="autobold">
<h3>Autobold<a class="headerlink" href="#autobold" title="Permalink to this headline"></a></h3>
Expand Down Expand Up @@ -687,7 +712,17 @@ <h3>noErrors<a class="headerlink" href="#noerrors" title="Permalink to this head
<span class="p">}</span>
</pre></div>
</div>
<p>You may also wish to set the font family, as the default is &#8220;serif&#8221;.</p>
<p>You may also wish to set the font family or other CSS values here.</p>
<p>If you are using a combined configuration file that loads the TeX
input processor, it will also load the <cite>noErrors</cite> extension
automatically. If you want to disable the <cite>noErrors</cite> extension so
that you receive the normal TeX error messages, use the following
configuration:</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">TeX</span><span class="o">:</span> <span class="p">{</span> <span class="nx">noErrors</span><span class="o">:</span> <span class="p">{</span> <span class="nx">disabled</span><span class="o">:</span> <span class="kc">true</span> <span class="p">}</span> <span class="p">}</span>
</pre></div>
</div>
<p>Any math that includes errors will be replaced by an error message
indicating what went wrong.</p>
</div>
<div class="section" id="noundefined">
<h3>noUndefined<a class="headerlink" href="#noundefined" title="Permalink to this headline"></a></h3>
Expand Down Expand Up @@ -716,6 +751,16 @@ <h3>noUndefined<a class="headerlink" href="#noundefined" title="Permalink to thi
default values set <tt class="docutils literal"><span class="pre">mathcolor</span></tt> to <tt class="docutils literal"><span class="pre">&quot;red&quot;</span></tt>, but do not set any
other attributes. This example sets the background to a light pink,
and reduces the font size slightly.</p>
<p>If you are using a combined configuration file that loads the TeX
input processor, it will also load the <cite>noUndefined</cite> extension
automatically. If you want to disable the <cite>noUndefined</cite> extension so
that you receive the normal TeX error messages for undefined macros,
use the following configuration:</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">TeX</span><span class="o">:</span> <span class="p">{</span> <span class="nx">noUndefined</span><span class="o">:</span> <span class="p">{</span> <span class="nx">disabled</span><span class="o">:</span> <span class="kc">true</span> <span class="p">}</span> <span class="p">}</span>
</pre></div>
</div>
<p>Any math that includes an undefined control sequence name will be
replaced by an error message indicating what name was undefined.</p>
</div>
<div class="section" id="unicode-support">
<h3>Unicode support<a class="headerlink" href="#unicode-support" title="Permalink to this headline"></a></h3>
Expand Down
58 changes: 57 additions & 1 deletion docs/source/tex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,33 @@ load extensions into pages that didn't load them in their
configurations (and prevents you from having to load all the
extensions into all pages even if they aren't used).

It is also possible to create a macro that will autoload an extension
when it is first used (under the assumption that the extension will
redefine it to perform its true function). For example

.. code-block:: html

<script type="text/x-mathjax-config">
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{
cancel: ["Extension","cancel"],
bcancel: ["Extension","cancel"],
xcancel: ["Extension","cancel"],
cancelto: ["Extension","cancel"]
});
});
</script>

would declare the ``\cancel``, ``\bcancel``, ``\xcancel``, and
``\cancelto`` macros to load the `cancel` extension (where they are
actually defined). Whichever is used first will cause the extension
to be loaded, redefining all four to their proper values. Note that
this may be better than loading the extension explicitly, since it
avoids loading the extra file on pages where these macros are *not*
used. The `sample autoloading macros
<http://cdn.mathjax.org/mathjax/latest/test/sample-autoload.html>`_
example page shows this in action.

The main extensions are described below.


Expand Down Expand Up @@ -383,6 +410,9 @@ want to use the other macros that it defines. The `AMSsymbols` extension
is not loaded automatically, so you must include it explicitly if you want
to use the macros it defines.

Both extensions are included in all the combined configuration files
that load the TeX input processor.


Autobold
--------
Expand Down Expand Up @@ -742,7 +772,20 @@ the paragraph, use
}
}
You may also wish to set the font family, as the default is "serif".
You may also wish to set the font family or other CSS values here.

If you are using a combined configuration file that loads the TeX
input processor, it will also load the `noErrors` extension
automatically. If you want to disable the `noErrors` extension so
that you receive the normal TeX error messages, use the following
configuration:

.. code-block:: javascript
TeX: { noErrors: { disabled: true } }
Any math that includes errors will be replaced by an error message
indicating what went wrong.


noUndefined
Expand Down Expand Up @@ -777,6 +820,19 @@ default values set ``mathcolor`` to ``"red"``, but do not set any
other attributes. This example sets the background to a light pink,
and reduces the font size slightly.

If you are using a combined configuration file that loads the TeX
input processor, it will also load the `noUndefined` extension
automatically. If you want to disable the `noUndefined` extension so
that you receive the normal TeX error messages for undefined macros,
use the following configuration:

.. code-block:: javascript
TeX: { noUndefined: { disabled: true } }
Any math that includes an undefined control sequence name will be
replaced by an error message indicating what name was undefined.


Unicode support
---------------
Expand Down
11 changes: 9 additions & 2 deletions test/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>MathJax Example Page</title>
<!-- Copyright (c) 2012 Design Science, Inc. -->
<style>
li {margin-top: .25em}
li {margin-top: .2em}
</style>
</head>
<body>
Expand All @@ -21,14 +21,21 @@ <h1>MathJax Example Pages</h1>
<li><a href="sample-eqnum.html">Page of TeX equations with automatic numbering</a></li>
<li><a href="sample-eqnum.html">Page of TeX equations with equation references</a></li>
<p>
<li><a href="sample-signals.html">Page showing MathJax signals during page processing</a></li>
<li><a href="sample-macros.html">Example of defining TeX macros</a></li>
<li><a href="sample-autoload.html">Defining macros to autoload the extensions in
which they are implemented</a></li>
<p>
<li><a href="sample-all-at-once.html">Example of waiting until all the
math is typeset before displaying the page (avoids "flicker")</a></li>
<p>
<li><a href="sample-dynamic-steps.html">Showing an equation one step at a time</a></li>
<li><a href="sample-dynamic.html">Display an equation typed in by a user</a></li>
<li><a href="sample-dynamic-2.html">Preview text containing math typed in by a user</a></li>
<p>
<li><a href="sample-loader.html">Loading MathJax into a page after it is loaded</a></li>
<li><a href="sample-loader-config.html">Loading MathJax dynamically with in-line configuration</a></li>
<p>
<li><a href="sample-signals.html">Page showing MathJax signals during page processing</a></li>

</ul>

Expand Down
Loading

0 comments on commit 90f9948

Please sign in to comment.