# Display math expressions in Datatable tooltips

**URL:** <https://community.plotly.com/t/display-math-expressions-in-datatable-tooltips/68133>\
**Category:** Dash Python\
**Created:** [September 20, 2022, 1:53pm UTC](https://community.plotly.com/t/display-math-expressions-in-datatable-tooltips/68133 "2022-09-20T13:53:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![simdeb](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@simdeb](https://community.plotly.com/u/simdeb)\
**Post date:** [September 20, 2022, 1:53pm UTC](https://community.plotly.com/t/display-math-expressions-in-datatable-tooltips/68133/1 "2022-09-20T13:53:36Z")

</div>

I’m using a Datatable in my Dash app and would like to show a mathematical expression in the tooltip to explain how a value is calculated. Since the tooltip text is displayed as markdown, I expected to just use `$` around the mathematical expression but this doesn’t seem to work Here is a simple example:

```auto
from dash import Dash, dash_table
import pandas as pd
from collections import OrderedDict

df = pd.DataFrame(OrderedDict([("x", [1, 2, 3]), ("x square", ["1", "4", "9"])]))

app = Dash( __name__ )

app.layout = dash_table.DataTable(
    data=df.to_dict('records'),
    columns=[{'id': c, 'name': c} for c in df.columns],
    tooltip_data=[{'x': {'value': 'This is the x value', 'type': 'markdown'},
                   'x square': {'value': 'This is the y value, it is caluclated as $y = x^2$', 'type': 'markdown'}}]*3,
)

if __name__ == ' __main__':
    app.run_server(debug=True)

```

This gives the following result instead of the expected `x²`:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/d/1/d134c1c002b0d84fc0279e0f1d6ca920dad5f534.png)

Is there a way to display math in a well-formatted way into these table tooltips?

---

<div class="post-metadata">

**Author:** ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)\
**Post date:** [September 20, 2022, 7:49pm UTC](https://community.plotly.com/t/display-math-expressions-in-datatable-tooltips/68133/2 "2022-09-20T19:49:22Z")

</div>

hi @simdeb  
Currently, you can incorporate mathjax into the `dcc.Graph` and the `dcc.Markdown`, but not the DataTable.

---

<div class="post-metadata">

**Author:** ![simdeb](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@simdeb](https://community.plotly.com/u/simdeb)\
**Post date:** [September 20, 2022, 10:39pm UTC](https://community.plotly.com/t/display-math-expressions-in-datatable-tooltips/68133/3 "2022-09-20T22:39:59Z")

</div>

Hi @adamschroeder, thanks for the response.  
Is there any reason why this is the case and is there any possibility that this will come in the future?

---

<div class="post-metadata">

**Author:** ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)\
**Post date:** [September 21, 2022, 2:06pm UTC](https://community.plotly.com/t/display-math-expressions-in-datatable-tooltips/68133/4 "2022-09-21T14:06:31Z")

</div>

Hi @simdeb  
No particular reason other than set of priorities.
