Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix #1984 -- fix mathjax support
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Aug 31, 2015
1 parent 73c8f50 commit 86aa454
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
10 changes: 6 additions & 4 deletions docs/manual.txt
Expand Up @@ -1392,8 +1392,8 @@ Math
----

Nikola supports math input via MathJax. It is activated via the math roles and
directives of reStructuredText and the usual LaTeX delimiters (``\(inline\)``
and ``\[display\]``) for other input formats.
directives of reStructuredText and the usual LaTeX delimiters
(backslash-parentheses, backslash-brackets) for other input formats.

To use mathematics in a post, you must add the ``mathjax`` tag.

Expand All @@ -1419,7 +1419,8 @@ like this:
</script>
"""

Inline mathematics are produced using the reST `math` **role** or the ``\(…\)`` delimiters:
Inline mathematics are produced using the reST `math` **role** or the LaTeX
backslash-parentheses delimiters:

Euler’s formula: :math:`e^{ix} = \cos x + i\sin x`

Expand All @@ -1435,7 +1436,8 @@ In other input formats:

Euler’s formula: \(e^{ix} = \cos x + i\sin x\)

Display mathematics are produced using the reST `math` **directive** or the ``\[…\]`` delimiters:
Display mathematics are produced using the reST `math` **directive** or the
LaTeX backslash-brackets delimiters:

.. math::

Expand Down
7 changes: 5 additions & 2 deletions nikola/data/themes/base-jinja/templates/index_helper.tmpl
Expand Up @@ -20,8 +20,11 @@

{% macro mathjax_script(posts) %}
{% if posts|selectattr("is_mathjax")|list %}
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});</script>
<script src="/assets/js/mathjax.js"></script>
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
{% endif %}
{% endmacro %}
7 changes: 5 additions & 2 deletions nikola/data/themes/base-jinja/templates/post_helper.tmpl
Expand Up @@ -86,8 +86,11 @@

{% macro mathjax_script(post) %}
{% if post.is_mathjax %}
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});</script>
<script src="/assets/js/mathjax.js"></script>
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
{% endif %}
{% endmacro %}
11 changes: 0 additions & 11 deletions nikola/data/themes/base/assets/js/mathjax.js

This file was deleted.

7 changes: 5 additions & 2 deletions nikola/data/themes/base/templates/index_helper.tmpl
Expand Up @@ -20,8 +20,11 @@

<%def name="mathjax_script(posts)">
%if any(post.is_mathjax for post in posts):
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});</script>
<script src="/assets/js/mathjax.js"></script>
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
%endif
</%def>
7 changes: 5 additions & 2 deletions nikola/data/themes/base/templates/post_helper.tmpl
Expand Up @@ -86,8 +86,11 @@

<%def name="mathjax_script(post)">
%if post.is_mathjax:
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});</script>
<script src="/assets/js/mathjax.js"></script>
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
%endif
</%def>

0 comments on commit 86aa454

Please sign in to comment.