Skip to content

Commit 7496626

Browse files
committed
Add section on automatic line numbering to the TeX documentation
1 parent 6e65afd commit 7496626

File tree

5 files changed

+218
-2
lines changed

5 files changed

+218
-2
lines changed

docs/html/_sources/tex.txt

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,83 @@ configuration file from your server. See :ref:`Using a Local
275275
Configuration File with the CDN <local-config-files>` for details.
276276

277277

278+
.. _tex-eq-numbers:
279+
280+
Autmatic Equation Numering
281+
==========================
282+
283+
New in MathJax v2.0 is the ability to have equations be numbered
284+
automatically. This is off by default, so that pages don't change
285+
when you update from v1.1 to v2.0, but it is easy to configure MathJax
286+
to produce automatic equation numbers by adding:
287+
288+
.. code-block:: html
289+
290+
<script type="text/x-mathjax-config">
291+
MathJax.Hub.Config({
292+
TeX: { equationNumbers: { autoNumber: "AMS" } }
293+
});
294+
</script>
295+
296+
to your page just before the ``<script>`` tag that loads
297+
``MathJax.js`` itself.
298+
299+
Equations can be numbered in two ways: either number the AMSmath
300+
environments as LaTeX would, or number all displayed equations (the
301+
example above uses AMS-style numbering). Set ``autoNumber`` to
302+
``"all"`` if you want every displayed equation to be numbered.
303+
You can use ``\notag`` or ``\nonumber`` to prevent
304+
individual equations from being numbered, and ``\tag{}`` can be used
305+
to override the usual equation number with your own symbol instead.
306+
307+
Note that the AMS environments come in two forms: starred and
308+
unstarred. The unstarred versions produce equation numbers (when
309+
``autoNumber`` is set to ``"AMS"``) and the starred ones don't. For
310+
example
311+
312+
.. code-block:: latex
313+
314+
\begin{equation}
315+
E = mc^2
316+
\end{equation}
317+
318+
will be numbered, while
319+
320+
.. code-block:: latex
321+
322+
\begin{equation*}
323+
e^{\pi i} - 1 = 0
324+
\end{equation*}
325+
326+
won't be numbered (when ``autoNumber`` is ``"AMS"``).
327+
328+
You can use ``\label`` to give an equation an identifier that you can
329+
use to refer to it later, and then use ``\ref`` or ``\eqref`` within
330+
your document to insert the actual equation number at that location,
331+
as a reference. For example,
332+
333+
.. code-block:: latex
334+
335+
In equation \eqref{eq:sample}, we find the value of an
336+
interesting integral:
337+
338+
\begin{equation}
339+
\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}
340+
\label{eq:sample}
341+
\end{equation}
342+
343+
includes a labeled equation and a reference to that equation. Note
344+
that references can come before the corresponding formula as well as
345+
after them. See the equation numbering links in the `MathJax examples
346+
page <http://cdn.mathjax.org/mathjax/latest/test/examples.html>`_ for
347+
more examples.
348+
349+
You can configure the way that numbers are displayed and how the
350+
references to them are made using paramters in the ``equationNumbers``
351+
block of your ``TeX`` configuration. See the :ref:`TeX configuration
352+
options <configure-TeX>` page for more details.
353+
354+
278355
.. _tex-extensions:
279356

280357
TeX and LaTeX extensions

docs/html/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/html/tex.html

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,67 @@ <h2>TeX and LaTeX in HTML documents<a class="headerlink" href="#tex-and-latex-in
274274
configuration file from your server. See <a class="reference internal" href="configuration.html#local-config-files"><em>Using a Local
275275
Configuration File with the CDN</em></a> for details.</p>
276276
</div>
277+
<div class="section" id="autmatic-equation-numering">
278+
<span id="tex-eq-numbers"></span><h2>Autmatic Equation Numering<a class="headerlink" href="#autmatic-equation-numering" title="Permalink to this headline"></a></h2>
279+
<p>New in MathJax v2.0 is the ability to have equations be numbered
280+
automatically. This is off by default, so that pages don&#8217;t change
281+
when you update from v1.1 to v2.0, but it is easy to configure MathJax
282+
to produce automatic equation numbers by adding:</p>
283+
<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>
284+
<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>
285+
<span class="nx">TeX</span><span class="o">:</span> <span class="p">{</span> <span class="nx">equationNumbers</span><span class="o">:</span> <span class="p">{</span> <span class="nx">autoNumber</span><span class="o">:</span> <span class="s2">&quot;AMS&quot;</span> <span class="p">}</span> <span class="p">}</span>
286+
<span class="p">});</span>
287+
<span class="nt">&lt;/script&gt;</span>
288+
</pre></div>
289+
</div>
290+
<p>to your page just before the <tt class="docutils literal"><span class="pre">&lt;script&gt;</span></tt> tag that loads
291+
<tt class="docutils literal"><span class="pre">MathJax.js</span></tt> itself.</p>
292+
<p>Equations can be numbered in two ways: either number the AMSmath
293+
environments as LaTeX would, or number all displayed equations (the
294+
example above uses AMS-style numbering). Set <tt class="docutils literal"><span class="pre">autoNumber</span></tt> to
295+
<tt class="docutils literal"><span class="pre">&quot;all&quot;</span></tt> if you want every displayed equation to be numbered.
296+
You can use <tt class="docutils literal"><span class="pre">\notag</span></tt> or <tt class="docutils literal"><span class="pre">\nonumber</span></tt> to prevent
297+
individual equations from being numbered, and <tt class="docutils literal"><span class="pre">\tag{}</span></tt> can be used
298+
to override the usual equation number with your own symbol instead.</p>
299+
<p>Note that the AMS environments come in two forms: starred and
300+
unstarred. The unstarred versions produce equation numbers (when
301+
<tt class="docutils literal"><span class="pre">autoNumber</span></tt> is set to <tt class="docutils literal"><span class="pre">&quot;AMS&quot;</span></tt>) and the starred ones don&#8217;t. For
302+
example</p>
303+
<div class="highlight-latex"><div class="highlight"><pre><span class="k">\begin</span><span class="nb">{</span>equation<span class="nb">}</span>
304+
E = mc<span class="nb">^</span>2
305+
<span class="k">\end</span><span class="nb">{</span>equation<span class="nb">}</span>
306+
</pre></div>
307+
</div>
308+
<p>will be numbered, while</p>
309+
<div class="highlight-latex"><div class="highlight"><pre><span class="k">\begin</span><span class="nb">{</span>equation*<span class="nb">}</span>
310+
e<span class="nb">^{</span><span class="k">\pi</span> i<span class="nb">}</span> - 1 = 0
311+
<span class="k">\end</span><span class="nb">{</span>equation*<span class="nb">}</span>
312+
</pre></div>
313+
</div>
314+
<p>won&#8217;t be numbered (when <tt class="docutils literal"><span class="pre">autoNumber</span></tt> is <tt class="docutils literal"><span class="pre">&quot;AMS&quot;</span></tt>).</p>
315+
<p>You can use <tt class="docutils literal"><span class="pre">\label</span></tt> to give an equation an identifier that you can
316+
use to refer to it later, and then use <tt class="docutils literal"><span class="pre">\ref</span></tt> or <tt class="docutils literal"><span class="pre">\eqref</span></tt> within
317+
your document to insert the actual equation number at that location,
318+
as a reference. For example,</p>
319+
<div class="highlight-latex"><div class="highlight"><pre>In equation <span class="k">\eqref</span><span class="nb">{</span>eq:sample<span class="nb">}</span>, we find the value of an
320+
interesting integral:
321+
322+
<span class="k">\begin</span><span class="nb">{</span>equation<span class="nb">}</span>
323+
<span class="k">\int</span><span class="nb">_</span>0<span class="nb">^</span><span class="k">\infty</span> <span class="k">\frac</span><span class="nb">{</span>x<span class="nb">^</span>3<span class="nb">}{</span>e<span class="nb">^</span>x-1<span class="nb">}</span><span class="k">\,</span>dx = <span class="k">\frac</span><span class="nb">{</span><span class="k">\pi</span><span class="nb">^</span>4<span class="nb">}{</span>15<span class="nb">}</span>
324+
<span class="k">\label</span><span class="nb">{</span>eq:sample<span class="nb">}</span>
325+
<span class="k">\end</span><span class="nb">{</span>equation<span class="nb">}</span>
326+
</pre></div>
327+
</div>
328+
<p>includes a labeled equation and a reference to that equation. Note
329+
that references can come before the corresponding formula as well as
330+
after them. See the equation numbering links in the <a class="reference external" href="http://cdn.mathjax.org/mathjax/latest/test/examples.html">MathJax examples
331+
page</a> for
332+
more examples.</p>
333+
<p>You can configure the way that numbers are displayed and how the
334+
references to them are made using paramters in the <tt class="docutils literal"><span class="pre">equationNumbers</span></tt>
335+
block of your <tt class="docutils literal"><span class="pre">TeX</span></tt> configuration. See the <a class="reference internal" href="options/TeX.html#configure-tex"><em>TeX configuration
336+
options</em></a> page for more details.</p>
337+
</div>
277338
<div class="section" id="tex-and-latex-extensions">
278339
<span id="tex-extensions"></span><h2>TeX and LaTeX extensions<a class="headerlink" href="#tex-and-latex-extensions" title="Permalink to this headline"></a></h2>
279340
<p>While MathJax includes nearly all of the Plain TeX math macros, and
@@ -1824,6 +1885,7 @@ <h3><a href="index.html">Table Of Contents</a></h3>
18241885
<li><a class="reference internal" href="#tex-and-latex-math-delimiters">TeX and LaTeX math delimiters</a></li>
18251886
<li><a class="reference internal" href="#tex-and-latex-in-html-documents">TeX and LaTeX in HTML documents</a></li>
18261887
<li><a class="reference internal" href="#defining-tex-macros">Defining TeX macros</a></li>
1888+
<li><a class="reference internal" href="#autmatic-equation-numering">Autmatic Equation Numering</a></li>
18271889
<li><a class="reference internal" href="#tex-and-latex-extensions">TeX and LaTeX extensions</a><ul>
18281890
<li><a class="reference internal" href="#action">Action</a></li>
18291891
<li><a class="reference internal" href="#amsmath-and-amssymbols">AMSmath and AMSsymbols</a></li>

docs/source/tex.rst

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,83 @@ configuration file from your server. See :ref:`Using a Local
275275
Configuration File with the CDN <local-config-files>` for details.
276276

277277

278+
.. _tex-eq-numbers:
279+
280+
Autmatic Equation Numering
281+
==========================
282+
283+
New in MathJax v2.0 is the ability to have equations be numbered
284+
automatically. This is off by default, so that pages don't change
285+
when you update from v1.1 to v2.0, but it is easy to configure MathJax
286+
to produce automatic equation numbers by adding:
287+
288+
.. code-block:: html
289+
290+
<script type="text/x-mathjax-config">
291+
MathJax.Hub.Config({
292+
TeX: { equationNumbers: { autoNumber: "AMS" } }
293+
});
294+
</script>
295+
296+
to your page just before the ``<script>`` tag that loads
297+
``MathJax.js`` itself.
298+
299+
Equations can be numbered in two ways: either number the AMSmath
300+
environments as LaTeX would, or number all displayed equations (the
301+
example above uses AMS-style numbering). Set ``autoNumber`` to
302+
``"all"`` if you want every displayed equation to be numbered.
303+
You can use ``\notag`` or ``\nonumber`` to prevent
304+
individual equations from being numbered, and ``\tag{}`` can be used
305+
to override the usual equation number with your own symbol instead.
306+
307+
Note that the AMS environments come in two forms: starred and
308+
unstarred. The unstarred versions produce equation numbers (when
309+
``autoNumber`` is set to ``"AMS"``) and the starred ones don't. For
310+
example
311+
312+
.. code-block:: latex
313+
314+
\begin{equation}
315+
E = mc^2
316+
\end{equation}
317+
318+
will be numbered, while
319+
320+
.. code-block:: latex
321+
322+
\begin{equation*}
323+
e^{\pi i} - 1 = 0
324+
\end{equation*}
325+
326+
won't be numbered (when ``autoNumber`` is ``"AMS"``).
327+
328+
You can use ``\label`` to give an equation an identifier that you can
329+
use to refer to it later, and then use ``\ref`` or ``\eqref`` within
330+
your document to insert the actual equation number at that location,
331+
as a reference. For example,
332+
333+
.. code-block:: latex
334+
335+
In equation \eqref{eq:sample}, we find the value of an
336+
interesting integral:
337+
338+
\begin{equation}
339+
\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}
340+
\label{eq:sample}
341+
\end{equation}
342+
343+
includes a labeled equation and a reference to that equation. Note
344+
that references can come before the corresponding formula as well as
345+
after them. See the equation numbering links in the `MathJax examples
346+
page <http://cdn.mathjax.org/mathjax/latest/test/examples.html>`_ for
347+
more examples.
348+
349+
You can configure the way that numbers are displayed and how the
350+
references to them are made using paramters in the ``equationNumbers``
351+
block of your ``TeX`` configuration. See the :ref:`TeX configuration
352+
options <configure-TeX>` page for more details.
353+
354+
278355
.. _tex-extensions:
279356

280357
TeX and LaTeX extensions

test/examples.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h1>MathJax Example Pages</h1>
1919
<li><a href="sample-asciimath.html">Page using AsciiMath notation</a></li>
2020
<li><a href="sample.html">Page included several examples TeX equations</a></li>
2121
<li><a href="sample-eqnum.html">Page of TeX equations with automatic numbering</a></li>
22-
<li><a href="sample-eqnum.html">Page of TeX equations with equation references</a></li>
22+
<li><a href="sample-eqrefs.html">Page of TeX equations with equation references</a></li>
2323
<p>
2424
<li><a href="sample-macros.html">Example of defining TeX macros</a></li>
2525
<li><a href="sample-autoload.html">Defining macros to autoload the extensions in

0 commit comments

Comments
 (0)