Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Closed
Description
Bug summary
It seems for me the most welcomed\text command inmathtext does not seem to work (yet).
At least not out of the box.
My apologies if I am just missing something.
Code for reproduction
importmatplotlib.pyplotaspltplt.text(0.1,0.3,r"$\text{dashes (-) are retained}$")
Actual outcome
Traceback (most recent call last): File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/backends/backend_gtk4.py", line 277, in idle_draw self.draw() File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py", line 388, in draw self.figure.draw(self.renderer) File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/artist.py", line 95, in draw_wrapper result = draw(artist, renderer, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/artist.py", line 72, in draw_wrapper return draw(artist, renderer) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/figure.py", line 3154, in draw mimage._draw_list_compositing_images( File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/image.py", line 132, in _draw_list_compositing_images a.draw(renderer) File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/artist.py", line 72, in draw_wrapper return draw(artist, renderer) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/axes/_base.py", line 3070, in draw mimage._draw_list_compositing_images( File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/image.py", line 132, in _draw_list_compositing_images a.draw(renderer) File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/artist.py", line 72, in draw_wrapper return draw(artist, renderer) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/text.py", line 748, in draw bbox, info, descent = self._get_layout(renderer) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/text.py", line 381, in _get_layout w, h, d = _get_text_metrics_with_cache( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/text.py", line 69, in _get_text_metrics_with_cache return _get_text_metrics_with_cache_impl( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/text.py", line 77, in _get_text_metrics_with_cache_impl return renderer_ref().get_text_width_height_descent(text, fontprop, ismath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py", line 213, in get_text_width_height_descent return super().get_text_width_height_descent(s, prop, ismath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/backend_bases.py", line 652, in get_text_width_height_descent return self.get_texmanager().get_text_width_height_descent( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/texmanager.py", line 363, in get_text_width_height_descent dvifile = cls.make_dvi(tex, fontsize) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/texmanager.py", line 295, in make_dvi cls._run_checked_subprocess( File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/texmanager.py", line 258, in _run_checked_subprocess raise RuntimeError(RuntimeError: latex was not able to process the following string:b'$\\\\text{dashes (-) are retained}$'Here is the full command invocation and its output:latex -interaction=nonstopmode --halt-on-error --output-directory=tmpt1zptv_z 9e73bfe7c799e116dd6e80736e5eea76.texThis is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/CVE-2023-32700 patched) (preloaded format=latex) restricted \write18 enabled.entering extended mode(./9e73bfe7c799e116dd6e80736e5eea76.texLaTeX2e <2022-06-01> patch level 5L3 programming layer <2022-12-17>(/usr/share/texlive/texmf-dist/tex/latex/base/article.clsDocument Class: article 2021/10/04 v1.4n Standard LaTeX document class(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))(/usr/share/texlive/texmf-dist/tex/latex/type1cm/type1cm.sty)(/usr/share/texlive/texmf-dist/tex/latex/cm-super/type1ec.sty(/usr/share/texlive/texmf-dist/tex/latex/base/t1cmr.fd))(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty)(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)(/usr/share/texlive/texmf-dist/tex/generic/iftex/ifvtex.sty(/usr/share/texlive/texmf-dist/tex/generic/iftex/iftex.sty)))(/usr/share/texlive/texmf-dist/tex/latex/wasysym/wasysym.sty)(/usr/share/texlive/texmf-dist/tex/latex/underscore/underscore.sty)(/usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty)(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-dvips.def)No file 9e73bfe7c799e116dd6e80736e5eea76.aux.*geometry* driver: auto-detecting*geometry* detected driver: dvips(/usr/share/texlive/texmf-dist/tex/latex/wasysym/uwasy.fd)! Undefined control sequence.<recently read> \text l.29 {\sffamily $\text {dashes (-) are retained}$}%No pages of output.Transcript written on tmpt1zptv_z/9e73bfe7c799e116dd6e80736e5eea76.log.Traceback (most recent call last): File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/backends/backend_gtk4.py", line 277, in idle_draw self.draw() File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py", line 388, in draw self.figure.draw(self.renderer) File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/artist.py", line 95, in draw_wrapper result = draw(artist, renderer, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/artist.py", line 72, in draw_wrapper return draw(artist, renderer) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/figure.py", line 3154, in draw mimage._draw_list_compositing_images( File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/image.py", line 132, in _draw_list_compositing_images a.draw(renderer) File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/artist.py", line 72, in draw_wrapper return draw(artist, renderer) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/axes/_base.py", line 3070, in draw mimage._draw_list_compositing_images( File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/image.py", line 132, in _draw_list_compositing_images a.draw(renderer) File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/artist.py", line 72, in draw_wrapper return draw(artist, renderer) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/text.py", line 748, in draw bbox, info, descent = self._get_layout(renderer) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/text.py", line 381, in _get_layout w, h, d = _get_text_metrics_with_cache( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/text.py", line 69, in _get_text_metrics_with_cache return _get_text_metrics_with_cache_impl( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/text.py", line 77, in _get_text_metrics_with_cache_impl return renderer_ref().get_text_width_height_descent(text, fontprop, ismath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py", line 213, in get_text_width_height_descent return super().get_text_width_height_descent(s, prop, ismath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/backend_bases.py", line 652, in get_text_width_height_descent return self.get_texmanager().get_text_width_height_descent( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/texmanager.py", line 363, in get_text_width_height_descent dvifile = cls.make_dvi(tex, fontsize) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/texmanager.py", line 295, in make_dvi cls._run_checked_subprocess( File "/home/alex/Python/lib/python3.11/site-packages/matplotlib/texmanager.py", line 258, in _run_checked_subprocess raise RuntimeError(RuntimeError: latex was not able to process the following string:b'$\\\\text{dashes (-) are retained}$'Here is the full command invocation and its output:latex -interaction=nonstopmode --halt-on-error --output-directory=tmpx4zdudzo 9e73bfe7c799e116dd6e80736e5eea76.texThis is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/CVE-2023-32700 patched) (preloaded format=latex) restricted \write18 enabled.entering extended mode(./9e73bfe7c799e116dd6e80736e5eea76.texLaTeX2e <2022-06-01> patch level 5L3 programming layer <2022-12-17>(/usr/share/texlive/texmf-dist/tex/latex/base/article.clsDocument Class: article 2021/10/04 v1.4n Standard LaTeX document class(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))(/usr/share/texlive/texmf-dist/tex/latex/type1cm/type1cm.sty)(/usr/share/texlive/texmf-dist/tex/latex/cm-super/type1ec.sty(/usr/share/texlive/texmf-dist/tex/latex/base/t1cmr.fd))(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty)(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)(/usr/share/texlive/texmf-dist/tex/generic/iftex/ifvtex.sty(/usr/share/texlive/texmf-dist/tex/generic/iftex/iftex.sty)))(/usr/share/texlive/texmf-dist/tex/latex/wasysym/wasysym.sty)(/usr/share/texlive/texmf-dist/tex/latex/underscore/underscore.sty)(/usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty)(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-dvips.def)No file 9e73bfe7c799e116dd6e80736e5eea76.aux.*geometry* driver: auto-detecting*geometry* detected driver: dvips(/usr/share/texlive/texmf-dist/tex/latex/wasysym/uwasy.fd)! Undefined control sequence.<recently read> \text l.29 {\sffamily $\text {dashes (-) are retained}$}%No pages of output.Transcript written on tmpx4zdudzo/9e73bfe7c799e116dd6e80736e5eea76.log.Expected outcome
the figure from
https://matplotlib.org/stable/users/prev_whats_new/whats_new_3.8.0.html#mathtext-now-supports-text
Additional information
fresh start, nothing else (all my matplotlib 3.7 code seems to work)
Operating system
Fedora 38
Matplotlib Version
3.8.0
Matplotlib Backend
GTK4Agg
Python version
3.11.4 (build from source)
Jupyter version
IPython 8.16.0
Installation
pip