# Special Characters in Latex Labels

**URL:** <https://discourse.bokeh.org/t/special-characters-in-latex-labels/12674>\
**Category:** Community Support\
**Created:** [November 24, 2025, 4:38pm UTC](https://discourse.bokeh.org/t/special-characters-in-latex-labels/12674 "2025-11-24T16:38:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dasNessie](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dasNessie](https://discourse.bokeh.org/u/dasNessie)\
**Post date:** [November 24, 2025, 4:38pm UTC](https://discourse.bokeh.org/t/special-characters-in-latex-labels/12674/1 "2025-11-24T16:38:04Z")

</div>

I’m working on an application that works with different SI units. For that application, I need to display units as bokeh labels in plots. However, I’m having issues with some of the symbols I need, and I’m not sure if the problem is in my usage of the library, or if it’s a bug with bokeh or MathJax.

In particular, I need a non-italic greek lowercase mu (μ) and a uppercase A with an overring (Å), but have been unable to get those. They are rendered almost correctly, but appear very small and on top of the other letters.

Here’s a minimal working example of everything I’ve tried so far:

```python
from bokeh.plotting import figure, curdoc
from bokeh.models import Label

p = figure(
    width=550,
    height=250,
    x_range=(-50, 500),
    y_range=(-125, 125),
)

label = Label(
    x=0,
    y=0,
    text=(
        r"$$\upmu\mathrm{N}\mathrm{m}$$ "
        r"$$\mbox{µ}\mathrm{N}\mathrm{m}$$ "
        r"$$\text{µ}\mathrm{N}\mathrm{m}$$ "
        r"$$\mbox{µ}^\circ\mathrm{C}\Omega\mbox{Å}\%'''^\circ{\hbar}E_\mathrm{h}$$ " # These are all the special characters I need. Most of them do work like this.
    ),
)

p.add_layout(label)

curdoc().add_root(p)

```

Here’s a screenshot of the resulting plot:

 ![bokeh_plot(1)](https://discourse-uploads.bokeh.org/original/2X/1/129051883efa7fa86d912f3710205e65e45d607c.png)

As you can see, the problematic letters are rendered almost correctly, they’re just very small and overlap the other letters.

Does anyone know why this happens or how I might fix it?

---

<div class="post-metadata">

**Author:** ![Bryan](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/bryan/32/3625_2.png) [@Bryan](https://discourse.bokeh.org/u/Bryan)\
**Post date:** [November 24, 2025, 10:14pm UTC](https://discourse.bokeh.org/t/special-characters-in-latex-labels/12674/2 "2025-11-24T22:14:25Z")

</div>

Well the [live demo](https://www.mathjax.org/#demo) on the MathJax site seems to render things properly (see below). That said, AFAIK all we do is immediately pass off LaTeX strings to MathJax to render so I am not sure how Bokeh could be causing any issue, either. It’s possible that Bokeh is using an old version of MathJax that had some bug in the past, in which case it might be as simple as updating to a newer MathJax version. But in any case it will take some investigation, so all I can suggest is to make a [GitHub Issue](https://github.com/bokeh/bokeh/issues) with all these details. _(Edit: and please, **always** include all relevant version information in any issue or help request)_

 ![Screenshot 2025-11-24 at 14.11.04](https://discourse-uploads.bokeh.org/original/2X/a/ae2a46b1f3acdcf2dd64fe0c5adc9479b0f16a8e.png)

---

<div class="post-metadata">

**Author:** ![Bryan](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/bryan/32/3625_2.png) [@Bryan](https://discourse.bokeh.org/u/Bryan)\
**Post date:** [November 24, 2025, 10:27pm UTC](https://discourse.bokeh.org/t/special-characters-in-latex-labels/12674/3 "2025-11-24T22:27:00Z")

</div>

OK a little more digging: Bokeh currently uses MathJax 3.2.2. Here is a pure HTML snippet that shows your content being mis-rendered, albeit in a different way, by MathJax 3.2.2.

```html
<!DOCTYPE html>
<html>
<head>
<title>MathJax 3.2.2 Test</title>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-mml-chtml.js"></script>
</head>
<body>
$$\mbox{µ}^\circ\mathrm{C}\Omega\mbox{Å}\%'''^\circ{\hbar}E_\mathrm{h}$$
</body>
</html>

```

Then:

![Screenshot 2025-11-24 at 14.25.57](https://discourse-uploads.bokeh.org/original/2X/1/1bee45dc85f2cba6223b4a163fa1969db26ecef1.png)

So at a minimum it seems like it’s time to see if Bokeh can be updated to use MathJax 4.0 and hopefully that solves the issue.

---

<div class="post-metadata">

**Author:** ![dasNessie](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dasNessie](https://discourse.bokeh.org/u/dasNessie)\
**Post date:** [November 25, 2025, 10:46am UTC](https://discourse.bokeh.org/t/special-characters-in-latex-labels/12674/4 "2025-11-25T10:46:01Z")

</div>

> [@Bryan](#):
>
> Edit: and please, **always** include all relevant version information in any issue or help request

Ah sorry, I tried answering all of the questions in the “new topic” template and as that doesn’t include the version number, I forgot.

```auto
$ pip freeze
bokeh==3.8.1
contourpy==1.3.3
Jinja2==3.1.6
MarkupSafe==3.0.3
narwhals==2.12.0
numpy==2.3.5
packaging==25.0
pandas==2.3.3
pillow==12.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.3
six==1.17.0
tornado==6.5.2
tzdata==2025.2
xyzservices==2025.11.0

```

I tried with older versions too, and it didn’t make a difference.

I’ve created a github issue here: [Some special chars in latex labels are not rendered correctly · Issue #14732 · bokeh/bokeh · GitHub](https://github.com/bokeh/bokeh/issues/14732)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads.bokeh.org/original/2X/1/14eb24f9e10e4e9b78e3f10f66c04ffa96446e5a.svg) [@system](https://discourse.bokeh.org/u/system)\
**Post date:** [February 23, 2026, 10:47am UTC](https://discourse.bokeh.org/t/special-characters-in-latex-labels/12674/5 "2026-02-23T10:47:00Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
