Skip to content

Commit 9d97bfd

Browse files
author
David Hall
committed
ENH: Add display.html.use_mathjax option (pandas-dev#19824).
Default value is True to maintain existing behavior.
1 parent f48f587 commit 9d97bfd

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

doc/source/options.rst

+4
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,10 @@ display.html.table_schema False Whether to publish a Table
402402
display.html.border 1 A ``border=value`` attribute is
403403
inserted in the ``<table>`` tag
404404
for the DataFrame HTML repr.
405+
display.html.use_mathjax True When True, IPython notebook will process
406+
table contents using MathJax, rendering
407+
mathematical expressions enclosed by the
408+
dollar symbol.
405409
io.excel.xls.writer xlwt The default Excel writer engine for
406410
'xls' files.
407411
io.excel.xlsm.writer openpyxl The default Excel writer engine for

pandas/core/config_init.py

+8
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ def use_numexpr_cb(key):
207207
(currently both are identical)
208208
"""
209209

210+
pc_html_use_mathjax_doc = """\
211+
: boolean
212+
When True, IPython notebook will process table contents using MathJax,
213+
rendering mathematical expressions enclosed by the dollar symbol.
214+
(default: True)
215+
"""
210216

211217
pc_width_doc = """
212218
: int
@@ -358,6 +364,8 @@ def table_schema_cb(key):
358364
validator=is_bool, cb=table_schema_cb)
359365
cf.register_option('html.border', 1, pc_html_border_doc,
360366
validator=is_int)
367+
cf.register_option('html.use_mathjax', True, pc_html_use_mathjax_doc,
368+
validator=is_bool)
361369

362370
with cf.config_prefix('html'):
363371
cf.register_option('border', 1, pc_html_border_doc,

pandas/core/frame.py

+6
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,14 @@ def _repr_html_(self):
674674
max_rows = get_option("display.max_rows")
675675
max_cols = get_option("display.max_columns")
676676
show_dimensions = get_option("display.show_dimensions")
677+
use_mathjax = get_option("display.html.use_mathjax")
678+
679+
classes = []
680+
if not use_mathjax:
681+
classes.append('tex2jax_ignore')
677682

678683
return self.to_html(max_rows=max_rows, max_cols=max_cols,
684+
classes=classes,
679685
show_dimensions=show_dimensions, notebook=True)
680686
else:
681687
return None

0 commit comments

Comments
 (0)