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

Appearance settings

Commit da6dfab

Browse filesBrowse files
authored
Merge pull request #16913 from anntzer/pstex
Fix use of psfrags in ps backend + usetex.
2 parents d44ceae + 6d83289 commit da6dfab
Copy full SHA for da6dfab

File tree

Expand file treeCollapse file tree

2 files changed

+14
-11
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-11
lines changed

‎lib/matplotlib/backends/backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_ps.py
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,18 +1097,20 @@ def convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble,
10971097
with mpl.rc_context({
10981098
"text.latex.preamble":
10991099
mpl.rcParams["text.latex.preamble"] +
1100-
r"\usepackage{psfrag,color}"
1101-
r"\usepackage[dvips]{graphicx}"
1102-
r"\PassOptionsToPackage{dvips}{geometry}"}):
1100+
r"\usepackage{psfrag,color}""\n"
1101+
r"\usepackage[dvips]{graphicx}""\n"
1102+
r"\geometry{papersize={%(width)sin,%(height)sin},"
1103+
r"body={%(width)sin,%(height)sin},margin=0in}"
1104+
% {"width": paper_width, "height": paper_height}
1105+
}):
11031106
dvifile = TexManager().make_dvi(
1104-
r"\newgeometry{papersize={%(width)sin,%(height)sin},"
1105-
r"body={%(width)sin,%(height)sin}, margin={0in,0in}}""\n"
1106-
r"\begin{figure}"
1107-
r"\centering\leavevmode%(psfrags)s"
1108-
r"\includegraphics*[angle=%(angle)s]{%(epsfile)s}"
1107+
"\n"
1108+
r"\begin{figure}""\n"
1109+
r" \centering\leavevmode""\n"
1110+
r" %(psfrags)s""\n"
1111+
r" \includegraphics*[angle=%(angle)s]{%(epsfile)s}""\n"
11091112
r"\end{figure}"
11101113
% {
1111-
"width": paper_width, "height": paper_height,
11121114
"psfrags": "\n".join(psfrags),
11131115
"angle": 90 if orientation == 'landscape' else 0,
11141116
"epsfile": pathlib.Path(tmpfile).resolve().as_posix(),

‎lib/matplotlib/texmanager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/texmanager.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ def _get_preamble(self):
185185
self._font_preamble,
186186
r"\usepackage[utf8]{inputenc}",
187187
r"\DeclareUnicodeCharacter{2212}{\ensuremath{-}}",
188+
# Needs to come early so that the custom preamble can change the
189+
# geometry, e.g. in convert_psfrags.
190+
r"\usepackage[papersize=72in,body=70in,margin=1in]{geometry}",
188191
self.get_custom_preamble(),
189192
])
190193

@@ -203,7 +206,6 @@ def make_tex(self, tex, fontsize):
203206
Path(texfile).write_text(
204207
r"""
205208
%s
206-
\usepackage[papersize={72in,72in},body={70in,70in},margin={1in,1in}]{geometry}
207209
\pagestyle{empty}
208210
\begin{document}
209211
%% The empty hbox ensures that a page is printed even for empty inputs.
@@ -239,7 +241,6 @@ def make_tex_preview(self, tex, fontsize):
239241
r"""
240242
%s
241243
\usepackage[active,showbox,tightpage]{preview}
242-
\usepackage[papersize={72in,72in},body={70in,70in},margin={1in,1in}]{geometry}
243244
244245
%% we override the default showbox as it is treated as an error and makes
245246
%% the exit status not zero

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.