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

Add overset and underset support for mathtext#18916

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
anntzer merged 3 commits intomatplotlib:masterfromaitikgupta:overset-feat
Jan 18, 2021

Conversation

aitikgupta
Copy link
Contributor

@aitikguptaaitikgupta commentedNov 8, 2020
edited
Loading

PR Summary

This PR addresses#18241, adds\overset and its variant\underset LaTeX symbol, which looks like this:

  • Overset:
    mathtext_cm_83
  • Underset:
    mathtext_cm_84

Also see:http://tex.wikidot.com/snippets:overset-and-underset

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

@aitikgupta
Copy link
ContributorAuthor

I followed the developer guide for image comparisons,ref, and I pass the tests locally.
Although, going through theresult_images, I find there weren't anysvg extensions generated for the test I appended - It only generatedpng andpdf extensions.
For all the previousbaseline_images, there aresvgs along withpngs andpdfs.

Is there something I missed, since previous PRs related tomathtext do havesvgs in them? For example,#8151.

@aitikgupta
Copy link
ContributorAuthor

Hey@QuLogic, could you take a look at this too? Thanks :D

@aitikgupta
Copy link
ContributorAuthor

Removed the extra commits

@QuLogicQuLogic changed the titleAdd overset and underset suppport for mathtextAdd overset and underset support for mathtextDec 22, 2020
@timhoffm
Copy link
Member

Doc build failure seems due to#19163.@aitikgupta could you please rebase on master to pick up that change, so that docs build cleanly?

@anntzer I'd like to have your review as our "master of fonts" 😄. Feel free to turn the request down if you don't have time.

aitikgupta reacted with thumbs up emoji

@anntzer
Copy link
Contributor

I didn't really follow@QuLogic's discussion about alignments, but right now looking at

rcParams["text.latex.preamble"]=r"\usepackage{amsmath}"s=r"$\overset{a}{a}\overset{p}{a}\overset{a}{b}\overset{p}{b}\underset{a}{a}\underset{b}{a}\underset{a}{p}\underset{b}{p}$"figtext(.5,.6,s,usetex=True)figtext(.5,.4,s)

we get
test
It looks like TeX's approach is to make sure the baselines of the main symbols stay always aligned (which seems more useful than trying to align the decorators?); likely we should do the same?

@aitikgupta
Copy link
ContributorAuthor

Looks like what@QuLogic said aboutunderset being a bit lower thanoverset is in TeX backend too:

usetex=True

usetex=False

With the latest commit, alignment looks like this:

@anntzer
Copy link
Contributor

I would think it would be better if the p's baselines could also be aligned?

@aitikgupta
Copy link
ContributorAuthor

aitikgupta commentedDec 26, 2020
edited
Loading

I would think it would be better if the p's baselines could also be aligned?

@anntzer Something like this?

timhoffm reacted with thumbs up emoji

@anntzer
Copy link
Contributor

anntzer commentedDec 26, 2020
edited
Loading

Yes (unless someone wants to argue in favor of the previous behavior...).

@jklymak
Copy link
Member

But thT is still not the same?

@aitikgupta
Copy link
ContributorAuthor

aitikgupta commentedDec 26, 2020
edited
Loading

But thT is still not the same?

@jklymak I'm not sure I understand, do you mean the baselines do not match? Maybe this will help:

@jklymak
Copy link
Member

The overset and underset baselines are not aligned

@timhoffm
Copy link
Member

They are not aligned in TeX either, but the spread here is a bit larger than in TeX. Personally, I don't find that too bad.

@aitikgupta
Copy link
ContributorAuthor

aitikgupta commentedDec 26, 2020
edited
Loading

The spread is a bit larger even for a normal text:

We could reduce the gap in the finalhlist theoretically, it will look something like this (have not pushed):

Just for reference, here is the current version (which is currently in the PR):

Should I update the PR to remove the gap?
@jklymak@timhoffm

@timhoffm
Copy link
Member

@aitikgupta I meant the spread of the baselines of the sub/supersets between a and p.
But you are right that the character spread is a bit larger too.

Personally I'm ok with both variants in both cases, but I'm not the most critical one here.

aitikgupta reacted with thumbs up emoji

Copy link
Contributor

@anntzeranntzer left a comment

Choose a reason for hiding this comment

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

Great work, and thanks for your patience handling the reviews :) I'll give it a day in case anyone else wants to comment but other than that, anyone can merge.
(Also, you can consider adding a whatsnew entry.)

jklymak reacted with thumbs up emojiaitikgupta reacted with heart emoji
@anntzer
Copy link
Contributor

@timhoffm Given your comment at#19186 (comment), do you want to comment wrt. baseline images? (Everything else looks great to me.)

@timhoffm
Copy link
Member

timhoffm commentedDec 29, 2020
edited
Loading

@anntzer TL;DR For the sake of simplicity, you can just merge with the new baseline images.

Here it's "only" a little over 40kB of baseline images and the positioning here is much more complex. I think this should be tested and adding the baseline images is okish. (The alternative would be splitting the tests into a separte PR and keep that open until we have less data heavy ways of doing the test - either with separated baseline images or by only using a subset; probably we don't need all combinations of fonts and output formats?).

Btw. what's the status with separating baseline images from the code repo?

@anntzer
Copy link
Contributor

I agree positioning matters here much more than for the sqrt PR (for which I agree we could do without the test images...).

Btw. what's the status with separating baseline images from the code repo?

Some day I'll have time to get back to it. But that day is not particularly close :(

@anntzeranntzer self-assigned thisDec 29, 2020
@anntzer
Copy link
Contributor

@aitikgupta Actually let's see whether we can resolve#19186 (comment) first to save a lot of disk space on the baseline images problem. However I don't want you to believe that I'm needlessly temporizing on this so regardless of whether the proposal at#19186 (comment) gets implemented I will make sure this is merged before 3.4 is released (hence the self-assignment).

aitikgupta reacted with rocket emoji

Copy link
Contributor

@anntzeranntzer left a comment

Choose a reason for hiding this comment

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

Actually#19201 turned out to quite simple to implement, so let's decide on that PR first.

Copy link
Member

@QuLogicQuLogic left a comment

Choose a reason for hiding this comment

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

For whenever we figure out test images.

Copy link
Contributor

@anntzeranntzer left a comment

Choose a reason for hiding this comment

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

@aitikgupta this needs to be rebased to use the new (cheaper) baseline images mechanism. (I can do the rebase if you prefer, just let me know.)

aitikgupta reacted with thumbs up emoji
@aitikgupta
Copy link
ContributorAuthor

(I can do the rebase if you prefer, just let me know.)

No that's fine, I'll do it

@aitikgupta
Copy link
ContributorAuthor

I think just rebasing wouldn't work, I'd need to generate the baseline images too?

@anntzer
Copy link
Contributor

Yes, sorry I forgot to mention that.

@aitikgupta
Copy link
ContributorAuthor

Is it fine the way it is now?
Or should I consider breaking down the current test into 2 (one for overset, one for underset), since the tests only compare a single png now

Copy link
Contributor

@anntzeranntzer left a comment

Choose a reason for hiding this comment

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

Let's still stick to a single test, it's also useful to be able to compare the alignment behaviors of over and underset easily.

@anntzeranntzer merged commit19bd709 intomatplotlib:masterJan 18, 2021
@anntzer
Copy link
Contributor

Thanks for the PR :)

aitikgupta reacted with rocket emoji

@aitikgupta
Copy link
ContributorAuthor

Uh, while rebasing the last time to add the new baseline images, one of my commits vanished: the whatsnew entry.
It was this commit I suppose:0a030d3

Now this is merged, but without the whatsnew entry.
Should we do something about it?
@anntzer@QuLogic

@anntzer
Copy link
Contributor

anntzer commentedFeb 10, 2021
edited
Loading

Open a separate PR.

aitikgupta reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

@anntzeranntzeranntzer approved these changes

Assignees

@anntzeranntzer

Projects
None yet
Milestone
v3.4.0
Development

Successfully merging this pull request may close these issues.

6 participants
@aitikgupta@timhoffm@anntzer@jklymak@QuLogic@dopplershift

[8]ページ先頭

©2009-2025 Movatter.jp