Title: \genfrac should accept a unit for thickness · Issue #19001 · matplotlib/matplotlib · GitHub
Open Graph Title: \genfrac should accept a unit for thickness · Issue #19001 · matplotlib/matplotlib
X Title: \genfrac should accept a unit for thickness · Issue #19001 · matplotlib/matplotlib
Description: In LaTeX, the third parameter (bar thickness) to genfrac requires a unit, but Matplotlib's mathtext parser does not accept it. This causes an inconsistency in the docs between Matplotlib and LaTeX, cf https://github.com/matplotlib/matplo...
Open Graph Description: In LaTeX, the third parameter (bar thickness) to genfrac requires a unit, but Matplotlib's mathtext parser does not accept it. This causes an inconsistency in the docs between Matplotlib and LaTeX,...
X Description: In LaTeX, the third parameter (bar thickness) to genfrac requires a unit, but Matplotlib's mathtext parser does not accept it. This causes an inconsistency in the docs between Matplotlib and La...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/19001
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\\genfrac should accept a unit for thickness","articleBody":"In LaTeX, the third parameter (bar thickness) to `genfrac` requires a unit, but Matplotlib's mathtext parser does not accept it. This causes an inconsistency in the docs between Matplotlib and LaTeX, cf https://github.com/matplotlib/matplotlib/pull/18948/files#diff-9d1b2ab4b8a5e77dc635425c7e7ec00af5667d684d0809e46a973185e8f9918fR97\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\n\r\nplt.text(0, 0, r'$\\genfrac{(}{)}{3pt}{0}{foo}{bar}$')\r\nplt.draw()\r\n```\r\n\r\n**Actual outcome**\r\n\r\n```pytb\r\nTraceback (most recent call last):\r\n File \"/usr/lib64/python3.8/tkinter/__init__.py\", line 1883, in __call__\r\n return self.func(*args)\r\n File \"/usr/lib64/python3.8/tkinter/__init__.py\", line 804, in callit\r\n func(*args)\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/backends/_backend_tk.py\", line 270, in idle_draw\r\n self.draw()\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/backends/backend_tkagg.py\", line 9, in draw\r\n super(FigureCanvasTkAgg, self).draw()\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/backends/backend_agg.py\", line 393, in draw\r\n self.figure.draw(self.renderer)\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/artist.py\", line 38, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/figure.py\", line 1735, in draw\r\n mimage._draw_list_compositing_images(\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/image.py\", line 137, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/artist.py\", line 38, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/axes/_base.py\", line 2630, in draw\r\n mimage._draw_list_compositing_images(renderer, self, artists)\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/image.py\", line 137, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/artist.py\", line 38, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/text.py\", line 685, in draw\r\n bbox, info, descent = textobj._get_layout(renderer)\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/text.py\", line 299, in _get_layout\r\n w, h, d = renderer.get_text_width_height_descent(\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/backends/backend_agg.py\", line 209, in get_text_width_height_descent\r\n self.mathtext_parser.parse(s, self.dpi, prop)\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/mathtext.py\", line 3354, in parse\r\n box = self._parser.parse(s, font_output, fontsize, dpi)\r\n File \"/usr/lib64/python3.8/site-packages/matplotlib/mathtext.py\", line 2583, in parse\r\n raise ValueError(\"\\n\".join([\"\",\r\nValueError: \r\n\\genfrac{(}{)}{3pt}{0}{foo}{bar}\r\n ^\r\nExpected \\genfrac{ldelim}{rdelim}{rulesize}{style}{num}{den}, found '{' (at char 8), (line:1, col:9)\r\n```\r\n\r\n**Expected outcome**\r\n\r\nDraws as if passing `3` instead of `3pt`, though possibly slightly different spacing, as I'm not sure in what unit we treat the 3 right now.","author":{"url":"https://github.com/QuLogic","@type":"Person","name":"QuLogic"},"datePublished":"2020-11-24T06:31:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/19001/matplotlib/issues/19001"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b37bb88e-f628-cf03-673a-56eb3b26337c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EB4A:35B2CA:7A7ED7:A45992:6A52883D |
| html-safe-nonce | 6f40e6868603fac05a5caf0be28e374cfea0b252d7e10731853bb1b81d4a3781 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjRBOjM1QjJDQTo3QTdFRDc6QTQ1OTkyOjZBNTI4ODNEIiwidmlzaXRvcl9pZCI6IjE2NzU2MjE5Njg4NjgzNTgyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3ab01be4e39a9bc2c64e587170ded8fafd1d67917d10a004046b1f918107f68c |
| hovercard-subject-tag | issue:749386563 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/19001/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c9bc5ce909072564fcf17d5d95ebdb40ab2124e74fe678abc3c5b02aea40f433/matplotlib/matplotlib/issues/19001 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c9bc5ce909072564fcf17d5d95ebdb40ab2124e74fe678abc3c5b02aea40f433/matplotlib/matplotlib/issues/19001 |
| og:image:alt | In LaTeX, the third parameter (bar thickness) to genfrac requires a unit, but Matplotlib's mathtext parser does not accept it. This causes an inconsistency in the docs between Matplotlib and LaTeX,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | QuLogic |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width