Skip to content

Commit 6bac56e

Browse files
authored
Merge pull request #78 from akhmerov/issue-77
Use math_block node directly instead of deprecated displaymath
2 parents 6eb778a + c30272d commit 6bac56e

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

doc/source/index.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ can use variables and functions defined in cells earlier in the document:
6464
print('second cell: a = {}'.format(a))
6565

6666
Because jupyter-sphinx uses the machinery of ``nbconvert``, it is capable of rendering
67-
much richer output than mere text; plots, for example:
67+
any rich output, for example plots:
6868

6969
.. jupyter-execute::
7070

@@ -78,6 +78,13 @@ much richer output than mere text; plots, for example:
7878
pyplot.plot(x, np.cos(x))
7979
pyplot.grid()
8080

81+
LaTeX output:
82+
83+
.. jupyter-execute::
84+
85+
from IPython.display import Latex
86+
Latex('∫_{-∞}^∞ e^{-x²}dx = \sqrt{π}')
87+
8188
or even full-blown javascript widgets:
8289

8390
.. jupyter-execute::

jupyter_sphinx/execute.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
from sphinx.transforms import SphinxTransform
1212
from sphinx.errors import ExtensionError
1313
from sphinx.addnodes import download_reference
14-
from sphinx.ext.mathbase import displaymath
1514

1615
import docutils
1716
from IPython.lib.lexers import IPythonTracebackLexer, IPython3Lexer
1817
from docutils.parsers.rst import Directive, directives
18+
from docutils.nodes import math_block
1919

2020
import nbconvert
2121
from nbconvert.preprocessors.execute import executenb
@@ -528,8 +528,8 @@ def cell_output_to_nodes(cell, data_priority, write_stderr, dir, thebe_config):
528528
format='html'
529529
))
530530
elif mime_type == 'text/latex':
531-
to_add.append(displaymath(
532-
latex=data,
531+
to_add.append(math_block(
532+
text=data,
533533
nowrap=False,
534534
number=None,
535535
))

0 commit comments

Comments
 (0)