Skip to content

Fix use of psfrags in ps backend + usetex. #16913

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

Merged
merged 1 commit into from
Apr 15, 2020
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Mar 26, 2020

Looks like psfrags interacts badly with \newgeometry, so we need to
use \geometry instead in the custom preamble to set the paper size.

In turn this means that \usepackage{geometry} needs to move to before
the custom preamble into TexManager._get_preamble(), and thus we
can't pass the dvips option to it anymore, but fortunately dvips is
documented as the default driver anyways (section 5.6 of geometry
docs). Also, in order to keep everything under 79 characters wide,
change {72in,72in} to just 72in (which is synonymous per section
4.3.3 of geometry docs).

Also insert some extra newlines in the generated tex file for ease of
debugging.

Closes #16898; sorry I don't have a test for now.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 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

Looks like psfrags interacts badly with `\newgeometry`, so we need to
use `\geometry` instead in the custom preamble to set the paper size.

In turn this means that `\usepackage{geometry}` needs to move to before
the custom preamble into `TexManager._get_preamble()`, and thus we
can't pass the dvips option to it anymore, but fortunately dvips is
documented as the default driver anyways (section 5.6 of `geometry`
docs).  Also, in order to keep everything under 79 characters wide,
change `{72in,72in}` to just `72in` (which is synonymous per section
4.3.3 of `geometry` docs).

Also insert some extra newlines in the generated tex file for ease of
debugging.
@anntzer anntzer added Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. backend: ps topic: text/usetex labels Mar 26, 2020
@anntzer anntzer added this to the v3.2.2 milestone Mar 26, 2020
@QuLogic QuLogic merged commit da6dfab into matplotlib:master Apr 15, 2020
@lumberbot-app
Copy link

lumberbot-app bot commented Apr 15, 2020

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.2.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 da6dfab9f8c6f10207eef43906a9fdbc17486e9f
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #16913: Fix use of psfrags in ps backend + usetex.'
  1. Push to a named branch :
git push YOURFORK v3.2.x:auto-backport-of-pr-16913-on-v3.2.x
  1. Create a PR against branch v3.2.x, I would have named this PR:

"Backport PR #16913 on branch v3.2.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

@anntzer anntzer deleted the pstex branch April 15, 2020 23:40
@anntzer anntzer mentioned this pull request Apr 28, 2020
6 tasks
tacaswell pushed a commit to tacaswell/matplotlib that referenced this pull request Apr 28, 2020
Fix use of psfrags in ps backend + usetex.

Conflicts:
	lib/matplotlib/backends/backend_ps.py
          - near by change of rcParams -> mpl.rcParams
	lib/matplotlib/texmanager.py
          - do not implicitly backport rcParam deprecations
@tacaswell tacaswell mentioned this pull request Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: ps Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. topic: text/usetex
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EPS and usetex give blank output
3 participants