Skip to content

Commit 3e5c818

Browse files
committed
First pass at updating documentation for v2.0. Added docs for AsciiMath input and SVG output, plus some examples. Still need to go through configuration options to update those, and advanced topics, particularly the API documents.
1 parent 9d1480b commit 3e5c818

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+4964
-1346
lines changed

docs/html/CSS-styles.html

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<head>
77
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
88

9-
<title>CSS Style Objects &mdash; MathJax v1.1 documentation</title>
9+
<title>CSS Style Objects &mdash; MathJax v2.0 documentation</title>
1010
<link rel="stylesheet" href="_static/mj.css" type="text/css" />
1111
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
1212
<script type="text/javascript">
1313
var DOCUMENTATION_OPTIONS = {
1414
URL_ROOT: '',
15-
VERSION: '1.1',
15+
VERSION: '2.0',
1616
COLLAPSE_INDEX: false,
1717
FILE_SUFFIX: '.html',
1818
HAS_SOURCE: true
@@ -22,7 +22,7 @@
2222
<script type="text/javascript" src="_static/underscore.js"></script>
2323
<script type="text/javascript" src="_static/doctools.js"></script>
2424
<!--<script type="text/javascript" src="../../MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>-->
25-
<link rel="top" title="MathJax v1.1 documentation" href="index.html" />
25+
<link rel="top" title="MathJax v2.0 documentation" href="index.html" />
2626
<link rel="next" title="Glossary" href="glossary.html" />
2727
<link rel="prev" title="Describing HTML snippets" href="HTML-snippets.html" />
2828
</head>
@@ -40,7 +40,7 @@ <h3>Navigation</h3>
4040
<li class="right" >
4141
<a href="HTML-snippets.html" title="Describing HTML snippets"
4242
accesskey="P">previous</a> |</li>
43-
<li><a href="index.html">MathJax v1.1 documentation</a> &raquo;</li>
43+
<li><a href="index.html">MathJax v2.0 documentation</a> &raquo;</li>
4444
</ul>
4545
</div>
4646

@@ -52,8 +52,8 @@ <h3>Navigation</h3>
5252
<div class="section" id="css-style-objects">
5353
<span id="id1"></span><h1>CSS Style Objects<a class="headerlink" href="#css-style-objects" title="Permalink to this headline"></a></h1>
5454
<p>Many MathJax components allow you to specify CSS styles that control
55-
the look of the elements they create. These are described using CSS
56-
style objects, which are JavaScript objects that represent standard
55+
the look of the elements they create. These are described using <cite>CSS
56+
style objects</cite>, which are JavaScript objects that represent standard
5757
CSS declarations. The main CSS style object is a collection of
5858
<cite>name:value</cite> pairs where the <cite>name</cite> is the CSS selector that is being
5959
defined, and the <cite>value</cite> is an object that gives the style for that
@@ -73,25 +73,27 @@ <h3>Navigation</h3>
7373
declaration:</p>
7474
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">styles</span><span class="o">:</span> <span class="p">{</span>
7575

76+
<span class="s2">&quot;.MathJax_Display&quot;</span><span class="o">:</span> <span class="p">{</span>
77+
<span class="s2">&quot;text-align&quot;</span><span class="o">:</span> <span class="s2">&quot;center&quot;</span><span class="p">,</span>
78+
<span class="nx">margin</span><span class="o">:</span> <span class="s2">&quot;1em 0em&quot;</span>
79+
<span class="p">},</span>
80+
7681
<span class="s2">&quot;.MathJax .merror&quot;</span><span class="o">:</span> <span class="p">{</span>
7782
<span class="s2">&quot;background-color&quot;</span><span class="o">:</span> <span class="s2">&quot;#FFFF88&quot;</span><span class="p">,</span>
7883
<span class="nx">color</span><span class="o">:</span> <span class="s2">&quot;#CC0000&quot;</span><span class="p">,</span>
7984
<span class="nx">border</span><span class="o">:</span> <span class="s2">&quot;1px solid #CC0000&quot;</span><span class="p">,</span>
8085
<span class="nx">padding</span><span class="o">:</span> <span class="s2">&quot;1px 3px&quot;</span><span class="p">,</span>
81-
<span class="s2">&quot;font-family&quot;</span><span class="o">:</span> <span class="s2">&quot;serif&quot;</span><span class="p">,</span>
8286
<span class="s2">&quot;font-style&quot;</span><span class="o">:</span> <span class="s2">&quot;normal&quot;</span><span class="p">,</span>
8387
<span class="s2">&quot;font-size&quot;</span><span class="o">:</span> <span class="s2">&quot;90%&quot;</span>
84-
<span class="p">},</span>
85-
86-
<span class="s2">&quot;.MathJax_Preview&quot;</span><span class="o">:</span> <span class="p">{</span><span class="nx">color</span><span class="o">:</span> <span class="s2">&quot;#888888&quot;</span><span class="p">},</span>
88+
<span class="p">}</span>
8789

8890
<span class="p">}</span>
8991
</pre></div>
9092
</div>
91-
<p>This defines two CSS styles, one for the selector <tt class="docutils literal"><span class="pre">.MathJax</span>
92-
<span class="pre">.merror</span></tt>, which specifies a background color, foreground color,
93-
border, and so on, and a second for <tt class="docutils literal"><span class="pre">.MathJax_Preview</span></tt> that sets its
94-
color.</p>
93+
<p>This defines two CSS styles, one for the selector
94+
<tt class="docutils literal"><span class="pre">.MathJax_Display</span></tt>, which specifies its text alignment and margin
95+
settings, and a second for <tt class="docutils literal"><span class="pre">.MathJax</span> <span class="pre">.merror</span></tt>, which specifies a
96+
background color, foreground color, border, and so on.</p>
9597
<p>You can add as many such definitions to a <tt class="docutils literal"><span class="pre">styles</span></tt> object as you
9698
wish. Note, however, that since this is a JavaScript object, the
9799
selectors must be unique (e.g., you can&#8217;t use two definitions for
@@ -159,11 +161,11 @@ <h3>Navigation</h3>
159161
<li class="right" >
160162
<a href="HTML-snippets.html" title="Describing HTML snippets"
161163
>previous</a> |</li>
162-
<li><a href="index.html">MathJax v1.1 documentation</a> &raquo;</li>
164+
<li><a href="index.html">MathJax v2.0 documentation</a> &raquo;</li>
163165
</ul>
164166
</div>
165167
<div class="footer">
166-
&copy; Copyright 2011 Design Science.
168+
&copy; Copyright 2012 Design Science.
167169
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
168170
</div>
169171

docs/html/HTML-snippets.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<head>
77
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
88

9-
<title>Describing HTML snippets &mdash; MathJax v1.1 documentation</title>
9+
<title>Describing HTML snippets &mdash; MathJax v2.0 documentation</title>
1010
<link rel="stylesheet" href="_static/mj.css" type="text/css" />
1111
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
1212
<script type="text/javascript">
1313
var DOCUMENTATION_OPTIONS = {
1414
URL_ROOT: '',
15-
VERSION: '1.1',
15+
VERSION: '2.0',
1616
COLLAPSE_INDEX: false,
1717
FILE_SUFFIX: '.html',
1818
HAS_SOURCE: true
@@ -22,7 +22,7 @@
2222
<script type="text/javascript" src="_static/underscore.js"></script>
2323
<script type="text/javascript" src="_static/doctools.js"></script>
2424
<!--<script type="text/javascript" src="../../MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>-->
25-
<link rel="top" title="MathJax v1.1 documentation" href="index.html" />
25+
<link rel="top" title="MathJax v2.0 documentation" href="index.html" />
2626
<link rel="next" title="CSS Style Objects" href="CSS-styles.html" />
2727
<link rel="prev" title="The MathJax Object-Oriented Programming Model" href="api/object.html" />
2828
</head>
@@ -40,7 +40,7 @@ <h3>Navigation</h3>
4040
<li class="right" >
4141
<a href="api/object.html" title="The MathJax Object-Oriented Programming Model"
4242
accesskey="P">previous</a> |</li>
43-
<li><a href="index.html">MathJax v1.1 documentation</a> &raquo;</li>
43+
<li><a href="index.html">MathJax v2.0 documentation</a> &raquo;</li>
4444
</ul>
4545
</div>
4646

@@ -156,11 +156,11 @@ <h3>Navigation</h3>
156156
<li class="right" >
157157
<a href="api/object.html" title="The MathJax Object-Oriented Programming Model"
158158
>previous</a> |</li>
159-
<li><a href="index.html">MathJax v1.1 documentation</a> &raquo;</li>
159+
<li><a href="index.html">MathJax v2.0 documentation</a> &raquo;</li>
160160
</ul>
161161
</div>
162162
<div class="footer">
163-
&copy; Copyright 2011 Design Science.
163+
&copy; Copyright 2012 Design Science.
164164
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
165165
</div>
166166

docs/html/_sources/CSS-styles.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ CSS Style Objects
55
*****************
66

77
Many MathJax components allow you to specify CSS styles that control
8-
the look of the elements they create. These are described using CSS
9-
style objects, which are JavaScript objects that represent standard
8+
the look of the elements they create. These are described using `CSS
9+
style objects`, which are JavaScript objects that represent standard
1010
CSS declarations. The main CSS style object is a collection of
1111
`name:value` pairs where the `name` is the CSS selector that is being
1212
defined, and the `value` is an object that gives the style for that
@@ -31,24 +31,26 @@ declaration:
3131

3232
styles: {
3333

34+
".MathJax_Display": {
35+
"text-align": "center",
36+
margin: "1em 0em"
37+
},
38+
3439
".MathJax .merror": {
3540
"background-color": "#FFFF88",
3641
color: "#CC0000",
3742
border: "1px solid #CC0000",
3843
padding: "1px 3px",
39-
"font-family": "serif",
4044
"font-style": "normal",
4145
"font-size": "90%"
42-
},
43-
44-
".MathJax_Preview": {color: "#888888"},
46+
}
4547

4648
}
4749

48-
This defines two CSS styles, one for the selector ``.MathJax
49-
.merror``, which specifies a background color, foreground color,
50-
border, and so on, and a second for ``.MathJax_Preview`` that sets its
51-
color.
50+
This defines two CSS styles, one for the selector
51+
``.MathJax_Display``, which specifies its text alignment and margin
52+
settings, and a second for ``.MathJax .merror``, which specifies a
53+
background color, foreground color, border, and so on.
5254

5355
You can add as many such definitions to a ``styles`` object as you
5456
wish. Note, however, that since this is a JavaScript object, the

docs/html/_sources/asciimath.txt

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
.. _AsciiMath-support:
2+
3+
*************************
4+
MathJax AsciiMath Support
5+
*************************
6+
7+
The support for :term:`AsciiMath` in MathJax consists of two parts:
8+
the `asciimath2jax` preprocessor, and the `AsciiMath` input processor.
9+
The first of these looks for mathematics within your web page
10+
(indicated by delimiters like ```...```) and marks the mathematics for
11+
later processing by MathJax. The AsciiMath input processor is what
12+
converts the AsciiMath notation into MathJax's internal format, where
13+
one of MathJax's output processors then displays it in the web page.
14+
15+
The AsciiMath input jax actually includes a copy of Peter Jipsen's
16+
``ASCIIMathML.js`` file (see the `AsciiMath home page
17+
<http://www1.chapman.edu/~jipsen/mathml/asciimath.html>`_ for
18+
details), and is included by permission of the author. This means
19+
that the results of MathJax's AsciiMath processing should be the same
20+
as using the actual ``ASCIIMathML.js`` package (at least as far as the
21+
MathML that it generates is concerned). Thanks go to David Lippman
22+
for writing the initial version of the AsciiMath preprocessor and
23+
input jax.
24+
25+
The `asciimath2jax` preprocessor can be configured to look for whatever
26+
markers you want to use for your math delimiters. See the
27+
:ref:`asciimath2jax configuration options <configure-asciimath2jax>` section for
28+
details on how to customize the action of `asciimath2jax`.
29+
30+
The AsciiMath input processor handles conversion of your mathematical
31+
notation into MathJax's internal format (which is essentially MathML).
32+
The AsciiMath input processor has few configuration options (see the
33+
:ref:`AsciiMath options <configure-AsciiMath>` section for details).
34+
35+
The AsciiMath input jax handles only the original ASCIIMathML notation
36+
(from ASCIIMathML v1.4.7), not the extened LaTeXMathML notation added
37+
in version 2.0 of ASCIIMathML, though the AsciiMath input jax does
38+
expose the tables that define the symbols that AsciiMath processes,
39+
and so it would be possible to extend them to include additional
40+
symbols. In general, it is probably better to use MathJax's :ref:`TeX
41+
input jax <TeX-support>` to handle LaTeX notation instead.
42+
43+
44+
AsciiMath delimiters
45+
====================
46+
47+
By default, the `asciimath2jax` preprocessor defines the back-tick
48+
(`````) as the delimiters for mathematics in AsciiMath format. It
49+
does **not** define ``$...$`` as math delimiters. That is because
50+
dollar signs appear too often in non-mathematical settings, which
51+
could cause some text to be treated as mathematics unexpectedly. For
52+
example, with single-dollar delimiters, "... the cost is $2.50 for the
53+
first one, and $2.00 for each additional one ..." would cause the
54+
phrase "2.50 for the first one, and" to be treated as mathematics
55+
since it falls between dollar signs. For this reason, if you want to
56+
use single-dollars for AsciiMath notation, you must enable that
57+
explicitly in your configuration:
58+
59+
.. code-block:: javascript
60+
61+
MathJax.Hub.Config({
62+
asciimath2jax: {
63+
delimiters: [['$','$'], ['`','`']]
64+
}
65+
});
66+
67+
Note that the dollar signs are frequently used as a delimiter for
68+
mathematics in the :term:`TeX` format, and you can not enable the
69+
dollar-sign delimiter for both. It is probably best to leave dollar
70+
signs for TeX notation.
71+
72+
See the ``config/default.js`` file, or the :ref:`asiimath2jax
73+
configuration options <configure-asciimath2jax>` page, for additional
74+
configuration parameters that you can specify for the `asciimath2jax`
75+
preprocessor, which is the component of MathJax that identifies
76+
AsciiMath notation within the page.
77+
78+
79+
AsciiMath in HTML documents
80+
===============================
81+
82+
The AsciiMath syntax is descibed in the `ASCIIMathML syntax page
83+
<http://www1.chapman.edu/~jipsen/mathml/asciimathsyntax.html>`_.
84+
85+
Keep in mind that your mathematics is part of an HTML document, so you
86+
need to be aware of the special characters used by HTML as part of its
87+
markup. There cannot be HTML tags within the math delimiters (other
88+
than ``<BR>``) as AsciiMath-formatted math does not include HTML tags.
89+
Also, since the mathematics is initially given as text on the page,
90+
you need to be careful that your mathematics doesn't look like HTML
91+
tags to the browser (which parses the page before MathJax gets to see
92+
it). In particular, that means that you have to be careful about
93+
things like less-than and greater-than signs (``<`` and ``>``), and
94+
ampersands (``&``), which have special meaning to the browsers. For
95+
example,
96+
97+
.. code-block:: html
98+
99+
... when `x<y` we have ...
100+
101+
will cause a problem, because the brower will think ``<y`` is the
102+
beginning of a tag named ``y`` (even though there is no such tag in
103+
HTML). When this happens, the browser will think the tag continues up
104+
to the next ``>`` in the document (typically the end of the next
105+
actual tag in the HTML file), and you may notice that you are missing
106+
part of the text of the document. In the example above, the "``we
107+
have ...``" will not be displayed because the browser thinks it is
108+
part of the tag starting at ``<y``. This is one indication you can
109+
use to spot this problem; it is a common error and should be avoided.
110+
111+
Usually, it is sufficient to simply put spaces around these symbols to
112+
cause the browser to avoid them, so
113+
114+
.. code-block:: html
115+
116+
... when `x < y` we have ...
117+
118+
should work. Alternatively, you can use the HTML entities ``&lt;``,
119+
``&gt;`` and ``&amp;`` to encode these characters so that the browser
120+
will not interpret them, but MathJax will. E.g.,
121+
122+
.. code-block:: html
123+
124+
... when `x &lt; y` we have ...
125+
126+
Keep in mind that the browser interprets your text before MathJax
127+
does.

0 commit comments

Comments
 (0)