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

[MNT]: Does postscript output with usetex always need to be ghostscript-distilled? #22416

Open
@anntzer

Description

@anntzer

Summary

Currently, postscript output with text.usetex=True is always distilled with ghostscript if the latter is available, regardless ofrcParams["ps.usedistiller"]:

if (mpl.rcParams['ps.usedistiller']=='ghostscript'
ormpl.rcParams['text.usetex']):
_try_distill(gs_distill,
tmpfile,is_eps,ptype=papertype,bbox=bbox,
rotated=psfrag_rotated)

Comments in the source file and docs (the usetex tutorial) state that

In order to produce encapsulated PostScript (EPS) files that can be embedded in a new LaTeX document, the default behavior (NOTE: actually, not configurable other than by uninstalling ghostscript) of Matplotlib is to distill the output, which removes some PostScript operators used by LaTeX that are illegal in an EPS file.

Assuming that most EPS output will be used in tex files is actually probably quite reasonable, and it seems OK to provide some helpful behavior for end users there. But what are these "illegal operators"? It would seem that even without the distillation step, the files are still OK to embed: one can comment out thetry_distill(gs_distill, ...) line in backend_ps, generate an eps file withrcParams["text.usetex"] = True; plot(); savefig("/tmp/test/test.eps"), and compile a simple tex document

\documentclass{article}\usepackage{graphicx}\begin{document}\begin{figure}\centering\includegraphics{test.eps}\end{figure}\end{document}

with latex+dvips (we're including eps files, so that's using the "old" latex+dvips approach rather than pdflatex) and see that the resulting test.ps appears to be just fine.

Figuring out whether ghostscript should be run by default is relevant wrt.#22398 (comment).

Proposed fix

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp