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

mathtext: Add- to spaced symbols, and do not space symbols at start of string#5020

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mdboom merged 3 commits intomatplotlib:masterfromzblz:fix-asy-unc
Sep 8, 2015

Conversation

zblz
Copy link
Member

@zblzzblz commentedSep 3, 2015

PR related to changes in symbol spacing made in#4872. This PR does two things:

  • Add- to set of_binary_operators that are then considered in_spaced_symbols, so that- is spaced equivalently to+:$1-2$ should be spaced exactly as$1+2$.
  • Following LaTeX: Remove the spacing when any binary operator (including- and+) is at the start of the string or of a unit delimited by{ }. This makes things like$+2$ or$21^{+2}_{-3}$ more natural, as the+ or- are not really a binary operator anymore but part of the number.

A test has been added to check for spacing in the second item, so that$-2$; $ -2$; ${-2}$; ${ -2}$ all render equally, but with different spacing than$6-2$.

attn@mdboom,@tacaswell (also sorry for not catching this in#4872!)

prev_char = s[loc-i]
while prev_char == ' ' and i <= loc:
i += 1
prev_char = s[loc-i]
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be more pythonic to usesix.xrange for this loop: i.e.:

for i in six.xrange(1, loc + 1):

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Definitely, I wasn't very happy with that loop

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It will need a break then:

for i in six.moves.xrange(1, loc + 1):    prev_char = s[loc-i]    if prev_char != ' ':        break

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think that's better.

@zblz
Copy link
MemberAuthor

zblz commentedSep 8, 2015

@mdboom: Anything else that should be changed in this PR?

@mdboom
Copy link
Member

No, this looks fine to me.

mdboom added a commit that referenced this pull requestSep 8, 2015
mathtext: Add `-` to spaced symbols, and do not space symbols at start of string
@mdboommdboom merged commite01241c intomatplotlib:masterSep 8, 2015
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@zblz@mdboom@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp