-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
savefig to vector graphics with LaTeX fails with certain characters #10272
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
Comments
Oddly works fine for me on macosx both master and 2.1.1... @ImportanceOfBeingErnest did you duplicate this error? |
Yes I can replicate this using matplotlib 2.1 on python 2.7, windows 8.1. Using latex from miktex 2.9. This seems to be somehow related to the Edit: Here is a list of symbols I tried.
Does not work (fails with same error as above):
|
Also the \textwon symbol mentioned in #8068 is causing the error, which fits to the many \text* symbols in your list. |
The issue seems related/the same, but the outcome for me is different, since also for svg those symbols cause an error, not simply a warning as reported in #8068. |
Is there a way to isolate the file that is being fed to ghostscript causing it to fail? I can see that normally it's immediately destroyed after the exception occurs. |
Try adding logging to the end of the imports. I also got rid of the ticks so I only had three dvi files... import logging
logging.basicConfig(level=logging.DEBUG)
...
ax.set_xticks([])
ax.set_yticks([]) Your dvi files should be cached... |
Those DVI files do persist. One contains the symbol and the other says "lp", both very tiny. I'm interested in this line of the error message:
The output file is created and it's corrupted, while the input file is not there, presumably being deleted right after the exception is caught. It would be nice to somehow grab it and see what bothers ghostscript. |
Looks like you need to install the miktex/texlive "cm-super" package. Solves the issue for ps/pdf but not svg. todo: 1) investigate whether this is really necessary, 2) fix the svg situation, 3) update the docs accordingly. |
I have just installed the package but the problem persists. |
@tacaswell was saying something about gs on the gitter channel. Maybe related? |
I managed to capture the temporary PS file that crashes gs. You can find the file here: tmpfile_bad. I also did the same for a good input (no problematic characters): tmpfile_good. What someone could now do is:
I have no idea about ghostscript so that's about all I could do. EDIT: Here's the diff of the two. Apart from the obvious difference in positions there's something going on with fonts. |
Hello all, I seem to run into a problem when I use the (latex) package
with the following traceback:
Please let me know if there's a way to circumvent this issue. Thank you all in advance! |
Can you clarify how you installed concmath? I can't even make it work on a plain latex source, e.g. running latex on \documentclass{article}
\usepackage[OT1]{fontenc}
\usepackage{concmath}
\begin{document}
Hello, world.
\end{document} gives (with or without concmath-fonts installed as well)
|
Hi @anntzer, as far as I’m aware, it came pre installed with TexShop. The font seems to work fine for me, on both plain latex and matplotlib on python. Only saving to a pdf seems problematic. |
Please open a separate issue to track this, then. |
Uh oh!
There was an error while loading. Please reload this page.
Saving vector graphic figures with certain characters in LaTeX will fail. Here I tried to use the
\textmu
character. Could it be related to #8068?Code for reproduction
Here I'm saving to PostScript. It gives an error that I think is the most informative and points to some problems with ghostscript. Outputs for SVG and PDF below.
Output - PS
Output - SVG, PDF
For PDF it's nearly identical; the last line reads:
In case of PS and SVG, no file is produced. In case of PDF, a corrupted file results. Saving to raster formats and inline previews in jupyter notebook work fine.
Matplotlib version
Matplotlib from pip. Both Matplotlib and LaTeX are installed in userspace
The text was updated successfully, but these errors were encountered: