Skip to content

Commit

Permalink
Merge pull request #117 from mathjax/v2.6-latest
Browse files Browse the repository at this point in the history
v2.6 documentation udpate
  • Loading branch information
pkra committed Dec 30, 2015
2 parents 74fe9f4 + f064610 commit 2a98727
Show file tree
Hide file tree
Showing 41 changed files with 1,865 additions and 853 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# MathJax Documentation

[![Documentation Status](https://readthedocs.org/projects/mathjax/badge/?version=latest)](https://docs.mathjax.org)


## Beautiful math in all browsers.

MathJax is an open-source JavaScript display engine for LaTeX, MathML, and
Expand All @@ -18,7 +21,7 @@ See <http://www.mathjax.org/> or <https://github.com/mathjax/MathJax/> for addit
## Beautiful documentation.

The MathJax installation and usage documentation is available in this repository. The documents are also
available on the MathJax web site on line at <http://docs.mathjax.org>. Please help us improve the documentation!
available on the MathJax web site on line at <http://docs.mathjax.org>. Please help us improve the documentation!
You can use the editor feature on github to to simplify this.

## Community
Expand All @@ -41,13 +44,13 @@ Also, please use the bug tracker for reporting bugs rather than the help forum.
Just like MathJax, this documentation is license under Apache License, Version 2.0.

> Copyright (c) 2009-2013 The MathJax Consortium
>
>
> Licensed under the Apache License, Version 2.0 (the "License");
> you may not use this file except in compliance with the License.
> You may obtain a copy of the License at
>
>
> http://www.apache.org/licenses/LICENSE-2.0
>
>
> Unless required by applicable law or agreed to in writing, software
> distributed under the License is distributed on an "AS IS" BASIS,
> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down
File renamed without changes.
69 changes: 69 additions & 0 deletions advanced/debugging-tips.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
.. _debugging-tips:

**********************
MathJax Debugging tips
**********************

This page documents basic tips for debugging MathJax in your application.


Using unpacked resources
========================

MathJax provides both packged (minified) and unpacked versions of all its components. For debugging, it is useful to switch to an unpacked versions.

For example, using the MathJax CDN just add `unpacked/` before `MathJax.js`, e.g., from


.. code-block:: html

<script type="text/javascript" async
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>

to


.. code-block:: html

<script type="text/javascript" async
src="https://cdn.mathjax.org/mathjax/latest/unpacked/MathJax.js?config=TeX-MML-AM_CHTML">
</script>


Getting traceback information
=============================

.. code-block:: javascript
MathJax.Hub.lastError
MathJax stores the error object from the last `Math Processing Error` in `MathJax.Hub.lastError`. This allow developers to access the stack trace information when needed.


Add listener for MathJax errors
===============================

MathJax provides a detailed signaling infrastructure which a developers can hook into.

The following example hooks into Math Processing Errors.

.. code-block:: javascript
MathJax.Hub.Register.MessageHook("Math Processing Error",function (message) {
// do something with the error. message[2] is the Error object that records the problem.
});
Another example hooks into TeX parsing errors.

.. code-block:: javascript
MathJax.Hub.Register.MessageHook("TeX Jax - parse error",function (message) {
// do something with the error. message[1] will contain the data about the error.
});
.. note::

For more information, see :ref:`mathjax-api`.
File renamed without changes.
33 changes: 16 additions & 17 deletions extension-writing.rst → advanced/extension-writing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ rendered by the output modes (in green) located in
components.


.. image:: _static/components.svg
.. image:: /_static/components.svg
:width: 50%
:alt: MathJax components

Expand Down Expand Up @@ -106,7 +106,7 @@ script just before the one loading MathJax. Use that to add
.. code-block:: html

<!-- MathJax/test/test1.html -->

...
<script type="text/x-mathjax-config">
MathJax.Hub.config.extensions.push("measureTime.js");
Expand Down Expand Up @@ -144,17 +144,17 @@ Finally when we listen the final End signal, we append the desired div
MathJax.Hub.Register.StartupHook("Begin Typeset", function () {
MathJax.Extension.measureTime.startTime = (new Date()).getTime();
});
MathJax.Hub.Register.StartupHook("End Typeset", function () {
MathJax.Extension.measureTime.endTime = (new Date()).getTime();
});
MathJax.Hub.Register.StartupHook("End", function () {
var delta = (MathJax.Extension.measureTime.endTime - MathJax.Extension.measureTime.startTime) / 1000.;
MathJax.HTML.addElement(document.body, "div", null,
["Typeset by MathJax in " + delta + " second(s)"]);
});
MathJax.Ajax.loadComplete("[MathJax]/extensions/measureTime.js");
Now load ``test1.html`` again (clearing the browser cache if necessary)
Expand Down Expand Up @@ -189,7 +189,7 @@ macros. Consider the following example:
}
});
});
MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/Taylor.js");
The structure is similar to the measureTime extension: we wait until the
Expand Down Expand Up @@ -223,7 +223,7 @@ You can finally use the Taylor extension in a test page:
...
<body>
\[ \exp(x) = \expexpansion \]
\[ \exp(x) = \expexpansion \]
\[ f(x) = \taylor{f}{x}{a} \]
Expand Down Expand Up @@ -255,7 +255,7 @@ appropriate place for that is of course after the macros are defined:
});
MathJax.Hub.Startup.signal.Post("TeX Taylor Ready");
});
MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/Taylor.js");
Now define Taylor2.js as follows:
Expand All @@ -271,7 +271,7 @@ Now define Taylor2.js as follows:
}
});
});
MathJax.Hub.Register.StartupHook("TeX Taylor Ready", function () {
MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions, {
macros: {
Expand Down Expand Up @@ -339,24 +339,24 @@ the TeX parser to understand how this extension is working.
}, null, true);
MathJax.InputJax.TeX.Parse.Augment({
Frac: function (name) {
var old = this.stack.env.bevelled; this.stack.env.bevelled = true;
var num = this.ParseArg(name);
var den = this.ParseArg(name);
this.stack.env.bevelled = old;
var frac = MathJax.ElementJax.mml.mfrac(num, den);
frac.bevelled = this.stack.env.bevelled;
this.Push(frac);
},
BFrac: function (name) {
var bevelled = this.GetBrackets(name);
if (bevelled === "auto")
bevelled = this.stack.env.bevelled;
else
bevelled = (bevelled !== "false");
var old = this.stack.env.bevelled; this.stack.env.bevelled = true;
var num = this.ParseArg(name);
var den = this.ParseArg(name);
Expand All @@ -367,12 +367,12 @@ the TeX parser to understand how this extension is working.
this.Push(frac);
}
});
});
MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mfracBevelled.js");
Again you can use this command in a ``test4`` page.
Again you can use this command in a ``test4`` page.
.. code-block:: html
Expand All @@ -394,4 +394,3 @@ Again you can use this command in a ``test4`` page.
\[ \bfrac {\frac a b}{\bfrac[auto] a b} \]
...
16 changes: 16 additions & 0 deletions advanced/mathjax-node.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. mathjax-node:
*****************************
MathJax-node API for NodeJS
*****************************

MathJax can be used in NodeJS via the `MathJax-node <https://github.com/mathjax/MathJax-node>`__
library.

To install via NPM use

.. code-block:: bash
npm install mathjax-node
For more information visit `the GitHub repository <https://github.com/mathjax/MathJax-node>`__.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 22 additions & 3 deletions typeset.rst → advanced/typeset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ make this call. That means that things like the size of the container
for the mathematics may not yet reflect the size of the typeset
mathematics. If you need to perform actions that depend on the
mathematics being typeset, you should push *those* actions onto the
``MathJax.Hub.queue`` as well.
``MathJax.Hub.queue`` as well.

This can be quite subtle, so you have to think carefully about the
structure of your code that works with the typeset mathematics. Also,
Expand Down Expand Up @@ -175,7 +175,7 @@ queue. If your startup code performs the commands
studentDisplay = MathJax.Hub.getAllJax("MathDiv")[0];
});
then you can use
then you can use

.. code-block:: javascript
Expand Down Expand Up @@ -237,7 +237,7 @@ available in `test/sample-dynamic.html
})();
</script>

Type some TeX code:
Type some TeX code:
<input id="MathInput" size="50" onchange="UpdateMath(this.value)" />
<p>

Expand All @@ -252,3 +252,22 @@ There are a number of additional example pages at `test/examples.html
<http://cdn.mathjax.org/mathjax/latest/test/examples.html>`_ that
illustrate how to call MathJax dynamically or perform other actions
with MathJax.


.. _reset-equation-numbers:

Reset Automatic Equation Numbering
==================================

The :ref:`TeX input <TeX-support>` allows you to automatically number equations. When modifying a page, this can lead to problems as numbered equations may be removed and added; most commonly, duplicate labels (and thus ``id``'s in the DOM) lead to issues.

You can reset equation numbering using the TeX Input's ``resetEquationNumbers`` but you will need to re-process the page to update the labels afterwards, e.g.,


.. code-block:: javascript
MathJax.Hub.Queue(
["resetEquationNumbers",MathJax.InputJax.TeX],
["PreProcess",MathJax.Hub],
["Reprocess",MathJax.Hub]
);

0 comments on commit 2a98727

Please sign in to comment.