Skip to content
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

Not compatible with LaTeX mode. #5

Closed
eduardo-vitral opened this issue Sep 23, 2020 · 2 comments
Closed

Not compatible with LaTeX mode. #5

eduardo-vitral opened this issue Sep 23, 2020 · 2 comments

Comments

@eduardo-vitral
Copy link

Dear dhaitz,

Congratulations for the package, it's very nice!

However, it doesn't seem to be compatible with LaTeX mode. For example, when doing:

import matplotlib.pyplot as plt
import mplcyberpunk

from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)

plt.style.use("cyberpunk")

plt.plot([1, 3, 9, 5, 2, 1, 1], marker='o')
plt.plot([4, 5, 5, 7, 9, 8, 6], marker='o')
plt.title(r'$\mathrm{test}$')

mplcyberpunk.add_glow_effects()

plt.show()

The code crashes. It would be nice to update it for scientific uses :)

cheers,
Eduardo

@dhaitz
Copy link
Owner

dhaitz commented Sep 23, 2020

Hey @eduardo-vitral ,

thanks for reporting this! What error do you get? Does it work without mplcyberpunk?

When I execute your code snippet (on MacOS, not sure my TeX is up to date), I get

CalledProcessError
....
RuntimeError: latex was not able to process the following string:
b'lp'

However, simply by setting usetex=False instead of True, it works:
Bildschirmfoto 2020-09-23 um 18 22 58

Note sure if this is related to daft-dev/daft#65 (comment)

Cheers,
Dominik

[edit: typo]

@eduardo-vitral
Copy link
Author

I get the same error then the following:

https://stackoverflow.com/questions/11354149/python-unable-to-render-tex-in-matplotlib

I guess it was due to conflicting installations when I did "pip install mplcyberpunk". It might be nice to check if it overwrites some necessary packages for LaTeX.

I managed to correct it in a similar way then proposed in the link above, but I uninstalled mplcyberpunk to be sure I could still plot some other plots from my work.

When using uselatex=False, the code works indeed, but I would suggest you to look into that so people using LaTeX can have Figures and texts with the same font :)

thanks for the quick reply,
cheers,
Eduardo

@dhaitz dhaitz closed this as completed Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants