I have already installed cm-super
. Yet, I keep getting the type1cm.sty not found
error (when saving plots with latex fonts).
Does anyone know a fix for this?
Matplotlib version: 3.7.0
Latex log:
$ tlmgr install cm-super
tlmgr: package repository https://mirror.niser.ac.in/ctan/systems/texlive/tlnet (verified)
tlmgr install: package already present: cm-super
Code:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.use('ps')
plt.rc('font', family='serif', size=11)
plt.rc('text', usetex=True)
plt.rc('figure', fc='white')
x = np.arange(10)
y = x**2
plt.plot(x, y)
plt.title("Sample Function")
plt.savefig("plot.eps", format="eps", dpi=1000)
Output:
Traceback (most recent call last):
File "bla.py", line 15, in <module>
plt.savefig("plot.eps", format="eps", dpi=1000)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/pyplot.py", line 996, in savefig
res = fig.savefig(*args, **kwargs)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/figure.py", line 3328, in savefig
self.canvas.print_figure(fname, **kwargs)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 2362, in print_figure
result = print_method(
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 2228, in <lambda>
print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/backends/backend_ps.py", line 862, in _print_ps
printer(fmt, outfile, dpi=dpi, dsc_comments=dsc_comments,
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/backends/backend_ps.py", line 1034, in _print_figure_tex
self.figure.draw(renderer)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/artist.py", line 95, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/artist.py", line 72, in draw_wrapper
return draw(artist, renderer)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/figure.py", line 3125, in draw
mimage._draw_list_compositing_images(
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/image.py", line 131, in _draw_list_compositing_images
a.draw(renderer)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/artist.py", line 72, in draw_wrapper
return draw(artist, renderer)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 3030, in draw
self._update_title_position(renderer)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 2974, in _update_title_position
ax.yaxis.get_tightbbox(renderer) # update offsetText
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/axis.py", line 1320, in get_tightbbox
self._update_label_position(renderer)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/axis.py", line 2569, in _update_label_position
bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/axis.py", line 2104, in _get_tick_boxes_siblings
tlb, tlb2 = axis._get_ticklabel_bboxes(ticks_to_draw, renderer)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/axis.py", line 1299, in _get_ticklabel_bboxes
return ([tick.label1.get_window_extent(renderer)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/axis.py", line 1299, in <listcomp>
return ([tick.label1.get_window_extent(renderer)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/text.py", line 959, in get_window_extent
bbox, info, descent = self._get_layout(self._renderer)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/text.py", line 378, in _get_layout
_, lp_h, lp_d = _get_text_metrics_with_cache(
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/text.py", line 97, in _get_text_metrics_with_cache
return _get_text_metrics_with_cache_impl(
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/text.py", line 105, in _get_text_metrics_with_cache_impl
return renderer_ref().get_text_width_height_descent(text, fontprop, ismath)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/backends/_backend_pdf_ps.py", line 107, in get_text_width_height_descent
return super().get_text_width_height_descent(s, prop, ismath)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 641, in get_text_width_height_descent
return self.get_texmanager().get_text_width_height_descent(
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/texmanager.py", line 368, in get_text_width_height_descent
dvifile = cls.make_dvi(tex, fontsize)
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/texmanager.py", line 300, in make_dvi
cls._run_checked_subprocess(
File "/home/shikhar/.local/lib/python3.8/site-packages/matplotlib/texmanager.py", line 263, in _run_checked_subprocess
raise RuntimeError(
RuntimeError: latex was not able to process the following string:
b'lp'
Here is the full command invocation and its output:
latex -interaction=nonstopmode --halt-on-error --output-directory=tmpeldaa0_6 c2d32ca4ff25585485f6633e7f715d26.tex
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
(./c2d32ca4ff25585485f6633e7f715d26.tex
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-08-03>
(/home/shikhar/.TinyTeX/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/home/shikhar/.TinyTeX/texmf-dist/tex/latex/base/size10.clo))
! LaTeX Error: File `type1cm.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
! Emergency stop.
<read *>
l.7 \usepackage
{type1ec}^^M
No pages of output.
Transcript written on tmpeldaa0_6/c2d32ca4ff25585485f6633e7f715d26.log.