Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

\genfrac should accept a unit for thickness #19001

Closed as not planned
Closed as not planned
Labels
keepItems to be ignored by the “Stale” Github Actiontopic: text/mathtext
@QuLogic

Description

@QuLogic

In LaTeX, the third parameter (bar thickness) togenfrac requires a unit, but Matplotlib's mathtext parser does not accept it. This causes an inconsistency in the docs between Matplotlib and LaTeX, cfhttps://github.com/matplotlib/matplotlib/pull/18948/files#diff-9d1b2ab4b8a5e77dc635425c7e7ec00af5667d684d0809e46a973185e8f9918fR97

Code for reproduction

importmatplotlib.pyplotaspltplt.text(0,0,r'$\genfrac{(}{)}{3pt}{0}{foo}{bar}$')plt.draw()

Actual outcome

Traceback (most recent call last):  File"/usr/lib64/python3.8/tkinter/__init__.py", line1883, in__call__returnself.func(*args)  File"/usr/lib64/python3.8/tkinter/__init__.py", line804, incallit    func(*args)  File"/usr/lib64/python3.8/site-packages/matplotlib/backends/_backend_tk.py", line270, inidle_drawself.draw()  File"/usr/lib64/python3.8/site-packages/matplotlib/backends/backend_tkagg.py", line9, indrawsuper(FigureCanvasTkAgg,self).draw()  File"/usr/lib64/python3.8/site-packages/matplotlib/backends/backend_agg.py", line393, indrawself.figure.draw(self.renderer)  File"/usr/lib64/python3.8/site-packages/matplotlib/artist.py", line38, indraw_wrapperreturn draw(artist, renderer,*args,**kwargs)  File"/usr/lib64/python3.8/site-packages/matplotlib/figure.py", line1735, indraw    mimage._draw_list_compositing_images(  File"/usr/lib64/python3.8/site-packages/matplotlib/image.py", line137, in_draw_list_compositing_images    a.draw(renderer)  File"/usr/lib64/python3.8/site-packages/matplotlib/artist.py", line38, indraw_wrapperreturn draw(artist, renderer,*args,**kwargs)  File"/usr/lib64/python3.8/site-packages/matplotlib/axes/_base.py", line2630, indraw    mimage._draw_list_compositing_images(renderer,self, artists)  File"/usr/lib64/python3.8/site-packages/matplotlib/image.py", line137, in_draw_list_compositing_images    a.draw(renderer)  File"/usr/lib64/python3.8/site-packages/matplotlib/artist.py", line38, indraw_wrapperreturn draw(artist, renderer,*args,**kwargs)  File"/usr/lib64/python3.8/site-packages/matplotlib/text.py", line685, indraw    bbox, info, descent= textobj._get_layout(renderer)  File"/usr/lib64/python3.8/site-packages/matplotlib/text.py", line299, in_get_layout    w, h, d= renderer.get_text_width_height_descent(  File"/usr/lib64/python3.8/site-packages/matplotlib/backends/backend_agg.py", line209, inget_text_width_height_descentself.mathtext_parser.parse(s,self.dpi, prop)  File"/usr/lib64/python3.8/site-packages/matplotlib/mathtext.py", line3354, inparse    box=self._parser.parse(s, font_output, fontsize, dpi)  File"/usr/lib64/python3.8/site-packages/matplotlib/mathtext.py", line2583, inparseraiseValueError("\n".join(["",ValueError: \genfrac{(}{)}{3pt}{0}{foo}{bar}^Expected \genfrac{ldelim}{rdelim}{rulesize}{style}{num}{den}, found '{'  (at char 8), (line:1, col:9)

Expected outcome

Draws as if passing3 instead of3pt, though possibly slightly different spacing, as I'm not sure in what unit we treat the 3 right now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    keepItems to be ignored by the “Stale” Github Actiontopic: text/mathtext

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp