You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Write Image as PDF with Box includes text "Loading [MathJax]/extensions/MathMenu.js" #3469
I am trying to write plot into PDF format, but I cannot get rid of this box saying "Loading [MathJax]/extensions/MathMenu.js", will you be able to tell me how should I fix it?
It only outputs such box if I am trying to write a PDF, the browser does not have such box. One peculiar issue is that if I am going to write multiple PDF plot in one file, this box will only show in the first PDF image.
This is pretty unfortunate. The cause is that the PDF is being generated by a browser essentially doing a print operation. If this happens while MathJax is still loading, then this box will appear in the output. @jonmmease any thoughts about how to wait a bit longer?
This is pretty unfortunate. The cause is that the PDF is being generated by a browser essentially doing a print operation. If this happens while MathJax is still loading, then this box will appear in the output. @jonmmease any thoughts about how to wait a bit longer?
Just for now, my solution is writing a random plot before my official plot. Of course, I would like to see this problem resolved if possible.
Otherwise, if saving a "throwaway" PDF first helps, I would recommend that: basically save your figure twice.
Reacted by Igor Yusipov, Julia Barbosa, Erdem Tuna, Sandro Valenzuela, Simon Waloschek, Jiacheng Cheng, Zhao Lizhi, Julien Laumonier, Huy Hoang Nguyen, Steven Cheng and 35 more
Reacted by ShurayukiHime, Alex Loebel, modest-Hamilton, Philipp Verpoort, Yang-Xijie, Alberto Mario Castillo, Alexander Reisach, Luís Gomes, Zhao Lizhi, longhl and 1 more
Saving a dummy figure before the desired figure doesn't work for me.
What browser does Plotly use by default for PDF saving? Could it be a browser-dependent issue?
Otherwise, if saving a "throwaway" PDF first helps, I would recommend that: basically save your figure twice.
Hi, I tried but it did remove the watermark, but fails to render the math any more. I need the math formula to be shown, what can I do now? @nicolaskruchten
I am having the same issue, I have tried in Windows 10, WSL and Ubuntu...
I am using the most recent versions of the libraries.
An option could be to export to svg and then convert with inkscape (I tried with cairosvg and it does not render the mathjax).
Any updates or alternatives?
changed the title [-]Write Image as PDF with Box saying "Loading [MathJax]/extensions/MathMenu.js"[/-][+]Write Image as PDF with Box includes text "Loading [MathJax]/extensions/MathMenu.js"[/+]on Aug 12, 2024
Activity
empet commentedon Nov 15, 2021
What Plotly version are you running? I checked your code with v 5.3.1 (the last one), and no such box is displayed.
kuppu commentedon Nov 15, 2021
I am getting the same box in PDF outputs with Plotly Version 5.3.1

empet commentedon Nov 15, 2021
I have no idea why that box is displayed. It could be your browser?!!!
vincentliuheyang commentedon Nov 16, 2021
It only outputs such box if I am trying to write a PDF, the browser does not have such box. One peculiar issue is that if I am going to write multiple PDF plot in one file, this box will only show in the first PDF image.
nicolaskruchten commentedon Nov 16, 2021
This is pretty unfortunate. The cause is that the PDF is being generated by a browser essentially doing a print operation. If this happens while MathJax is still loading, then this box will appear in the output. @jonmmease any thoughts about how to wait a bit longer?
vincentliuheyang commentedon Nov 16, 2021
Just for now, my solution is writing a random plot before my official plot. Of course, I would like to see this problem resolved if possible.
stansotn commentedon Nov 16, 2021
I am having the same issue with plotly 5.4.0 and kaleido 0.2.1.post1. I suspect the issue is with the latest kaleido.
willfindlay commentedon Dec 5, 2021
I'm also running into this with:
Thanks for the workaround @vincentliuheyang, it works well for me.
jlehrer1 commentedon Dec 13, 2021
Same issue with exact same versions as @willfindlay. Is there any workaround?
tahashmi commentedon Dec 14, 2021
Thanks to @vincentliuheyang.
@jlehrer1 Try something like this :-) :
jorgeboucas commentedon Dec 14, 2021
this worked for me:
plotly==5.3.1
jlehrer1 commentedon Dec 14, 2021
Thank you! I hadn't realized it was only on the first write when running a script. Interesting.
eric-vader commentedon Dec 15, 2021
I am experiencing the same problem as well, do we know what causes the problem?
nicolaskruchten commentedon Dec 15, 2021
Yes, we know the basic cause, see plotly/kaleido#122 for details.
Note that if the figure you're rendering doesn't actually use MathJax then you can prevent MathJax from being loaded at all by Kaleido with:
Otherwise, if saving a "throwaway" PDF first helps, I would recommend that: basically save your figure twice.
nicolaskruchten commentedon Dec 15, 2021
Is anyone seeing this with Kaleido 0.1 ?
4 remaining items
theo-brown commentedon May 23, 2023
Saving a dummy figure before the desired figure doesn't work for me.
What browser does Plotly use by default for PDF saving? Could it be a browser-dependent issue?
mjstahlberg commentedon May 23, 2023
I think a time delay of a second may be necessary.
zhimin-z commentedon Aug 27, 2023
Hi, I tried but it did remove the watermark, but fails to render the math any more. I need the math formula to be shown, what can I do now? @nicolaskruchten
Fratorhe commentedon Feb 2, 2024
I am having the same issue, I have tried in Windows 10, WSL and Ubuntu...
I am using the most recent versions of the libraries.
An option could be to export to svg and then convert with inkscape (I tried with cairosvg and it does not render the mathjax).
Any updates or alternatives?
[-]Write Image as PDF with Box saying "Loading [MathJax]/extensions/MathMenu.js"[/-][+]Write Image as PDF with Box includes text "Loading [MathJax]/extensions/MathMenu.js"[/+]ENH: address plotly writing to pdf with a mathjax dialog
PatrickRWright commentedon Feb 24, 2025
I am getting this when running in
Rviaplotly::save_image("afile.pdf").Here is the workaround for R:
https://stackoverflow.com/questions/79464233/loading-mathjax-extensions-mathmenu-js-box-visible-in-pdf-when-running-plotl/
emilykl commentedon Aug 31, 2026
plotly.py v7.0.0 now bundles MathJax v3 rather than v2 (see #5684), and the message bar is no longer included in v3, so this is resolved.
Note that Kaleido v1.4.0 or greater must be used for generating images, since that is the first version which uses MathJax v3 by default.