Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Issue #26377 - Auto-escape % Symbol in Latex in pie labels #26981

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

Vashesh08
Copy link
Contributor

@Vashesh08 Vashesh08 commented Oct 3, 2023

PR summary

Fixes Issue #26377 - Adding Support For % operator in Latex. Continued From #26642
'%' operator is considered as the start of a comment in LaTeX. In order to avoid this behavior, \% needs to be used.
Uses Regex to substitute \% instead of %. It also resolves in case the string is already pre-escaped.

PR checklist

Copy link
Member

@ksunden ksunden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super close, just needs a marker to skip the test when latex isn't available and to make the test name a bit more descriptive.

lib/matplotlib/tests/test_axes.py Outdated Show resolved Hide resolved
lib/matplotlib/tests/test_axes.py Outdated Show resolved Hide resolved
Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could do with a comment explaining the regex substitution - otherwise looks good.

@tacaswell
Copy link
Member

I am a tad confused by the title. It says "operator", but it is only letting % pass without triggerin a comment?

I think this needs a whats new entry so that we can highlight this if anyone has been (ab)using this to intentionally put comments into strings.

@Vashesh08 Vashesh08 changed the title Fixes Issue #26377 - Adding Support For % operator in Latex Fixes Issue #26377 - Adding Support For % Symbol in Latex Feb 24, 2024
@tacaswell tacaswell changed the title Fixes Issue #26377 - Adding Support For % Symbol in Latex Fixes Issue #26377 - Auto-escape % Symbol in Latex in pie labels Mar 27, 2024
Fixes Issue matplotlib#26377 - Adding Support For % operator in Latex

Excaping The % Operator in LaTeX for the Pie method

Update _axes.py

Added usetex key in textprops dictionary in pie method

Removing Flake Issues and Prioritizing textprops parameter

Fixes % operator in Latex in Pie Method

Removed Trailing Whitespace

Removed Unnecessary Label Test in Pie

Update lib/matplotlib/tests/test_axes.py

Skip Test when latex is not available

Co-authored-by: Kyle Sunden <git@ksunden.space>

Update lib/matplotlib/tests/test_axes.py

Update test_name for % operator in Latex in Pie Method

Co-authored-by: Kyle Sunden <git@ksunden.space>

Added Dependency for needs_usetex testing for checking Latex dependency

Comment For Using Regex To Support % Symbol in Latex

Comments added to escape %  if not already escaped using regex

Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
@QuLogic
Copy link
Member

QuLogic commented Apr 3, 2024

Going to skip waiting for AppVeyor, as the fix for it isn't in yet, and this shouldn't affect it.

@QuLogic QuLogic merged commit 428f569 into matplotlib:main Apr 3, 2024
42 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

[Bug]: Pie chart autopcr % symbol disappears with text.usetex="True"
8 participants