-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
RuntimeError: LaTeX was not able to process the following string: 'z=$\\\\mathregular{{}^{}_{\\\\}}$' in matplotlib #5076
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
attn @zblz You have been poking at this recently, any insight? |
I was poking at the non-latex stuff, but took a look to the issue. In the first case it's just that @neuronphysics: The following minimal working example works fine, can you provide a similar one that shows the issue?
|
@zblz Thanks! |
@zblz I suspect that it has something to do with the conflication of
and using
Because I even ran the code with the way you have pointed out and I still get error messages. |
Note that The following example with all these things baked in still works for me, so I'm not sure these are the culprits:
|
Well, in the script I would get this error message
and this warning at the beginning:
|
Can you reproduce this in a clean enviroment?
import matplotlib
matplotlib.use('PS')
matplotlib.rcParams['text.usetex']=True
matplotlib.rcParams['text.latex.unicode']=True
import pylab as plt
plt.switch_backend('PS')
string = r'z=${value}^{upper}_{lower}$'.format(
value='{' + str(0.27) + '}',
upper='{+' + str(0.01) + '}',
lower='{-' + str(0.01) + '}')
print(string)
fig = plt.figure(figsize=(3,1))
fig.text(0.1,0.5,string,size=24,va='center')
from matplotlib.backends.backend_pdf import PdfPages
pp = PdfPages('issue5076.pdf')
pp.savefig(fig)
pp.close() as @zblz posted above |
@tacaswell I can produce it! |
meaning the above works or the above generates an exception? |
The point is that I don't have a root permission and the latex library is not installed on my machine and I use a share library. I am getting this error:
which I guess it means they are not installed or updated or not compatible. Do you think it might be a reason? |
That does not look like a complete error message and it is still not clear to me you ran to generate that error. |
The first error message shows the LaTeX packages ucs and inputenc being included:
This originates from the usual matplotlib LaTeX unicode preamble. The problem in that case is that
Nothing in matplotlib loads |
I tried running the script that @tacaswell wrote on a clean enviroment and I get this error:
|
I did a line by line check and the problem arises when we create the pdf, i.e. the line
is run, the rest of the script runs perfectly fine. |
The relevant error message in that output is: sh: latex: command not found For some reason, the “latex” binary is not found by the shell. Perhaps it is installed in an unusual directory and some profile files need updating. |
Reinstalled MacTeX and it works now, thanks! |
Sounds like this can be closed now, so I will do so. |
I have been trying to generate
Latex
style plots for publication bywhere I want to plot different figures in multiple pages with this function:
But when I ran my script I've got the following errors:
even after I changed the text to
text = r"z=${value}^{upper}_{lower}$".format(
value=value, upper=upper, lower=lower)
I've got the following error:
How can I make this all work or avoid this error?
The text was updated successfully, but these errors were encountered: