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

Don't insert spurious newlines by joining tex.preamble.#12805

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
jklymak merged 1 commit intomatplotlib:masterfromanntzer:texpreamble
Nov 19, 2018

Conversation

anntzer
Copy link
Contributor

The rc validator already makes it a single string.

Also reject non-strings in the validator, as there isn't much use to
them anyways in this context.

Closes#12804, I think.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

The rc validator already makes it a single string.Also reject non-strings in the validator, as there isn't much use tothem anyways in this context.
@anntzeranntzer added Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. topic: text/usetex labelsNov 14, 2018
@anntzeranntzer added this to thev3.1 milestoneNov 14, 2018
@sxntxn
Copy link
Contributor

Thanks! I forgot about that...

elif isinstance(s, Iterable):
return '\n'.join(s)
else:
raise TypeError
Copy link
Member

Choose a reason for hiding this comment

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

The try-except seem unnecessary. Afaics, this can only come from the explicit raise and thus can be simplified.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

No, it can also happen if s is not an iterable of strings.

Copy link
Member

Choose a reason for hiding this comment

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

Ok.

@jklymak
Copy link
Member

There are no reasonable tests for this?

@anntzer
Copy link
ContributorAuthor

I'm sure some could be added, but note that text.latex.preamble is "officially not supported".

@jklymakjklymak merged commit0f22259 intomatplotlib:masterNov 19, 2018
@anntzeranntzer deleted the texpreamble branchNovember 19, 2018 16:54
bcbnz added a commit to bcbnz/matplotlib-pgfutils that referenced this pull requestMar 23, 2019
The current matplotlib.rcParams validator for the preamble splits thestring on commas. The resulting list is subsequently re-joined withnewlines, causing TeX to fail when the preamble contained commas (e.g.,key-value configuration of a package). Two pull requests switching to aproper TeX validator have been accepted and should be included whenmatplotlib 3.1.0 is released:    *matplotlib/matplotlib#12674    *matplotlib/matplotlib#12805In the meantime, we can work around this by replacing the validator witha call to str.splitlines(). The workaround is implemented in afuture-proof manner as it is only installed if the TeX validator couldnot be imported, i.e., as soon as it is used with a version ofmatplotlib containing the validator the workaround should be ignored.This also adds a couple of unit tests which use the preamble to setcustom fonts. The font used is Cotham Sans, released under the SIL OpenFont License 1.1.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: text/usetex
Projects
None yet
Milestone
v3.1.0
Development

Successfully merging this pull request may close these issues.

Usetex produces preamble with one character per line
4 participants
@anntzer@sxntxn@jklymak@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp