60

最近、ラップトップをSnow Leopardにアップグレードし、TeXをバージョン3.1415926(TeX Live 2011 / MacPorts 2011_5)に更新し、Python2.7.3をインストールしました。これらすべてのインストールの後、macportselfupdateとmacportupgradeを実行しました。ただし、matplotlibでTeXを使用しようとすると、次のように表示されます。

LaTeX was not able to process the following string:'lp'
Here is the full report generated by LaTeX: 

This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011/MacPorts 2011_5)
 restricted \write18 enabled.  
entering extended mode (./64a53cc27244d5ee10969789771e33fa.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, dumylang, nohyphenation, cz
ech, slovak, dutch, ukenglish, usenglishmax, basque, french, german-x-2009-06-1
9, ngerman-x-2009-06-19, german, ngerman, swissgerman, italian, polish, portugu
ese, spanish, catalan, galician, ukenglish, loaded.
(/opt/local/share/texmf-texlive-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/opt/local/share/texmf-texlive-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)


l.3 \renewcommand
             {\rmdefault}{pnc}^^M
No pages of output.

この前の質問と同様に、Pythonコードでパスを設定してみました。

os.environ['PATH'] = os.environ['PATH'] + ':/opt/local/bin/latex'

which latex降伏してから/opt/local/bin/latex。ただし、同じエラーメッセージが表示され、機能しませんでした。前の質問の例と同様に、texへのパスも試しました。変化なし。

次に、不足している可能性のあるパッケージを次の方法で強制しようとしました。

matplotlib.rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"]

しかし、それもうまくいきませんでした。

プロットを機能させる唯一の方法は、と言うことですがrc('text', usetex=False)、これは理想的ではありません。どんな助けでも大歓迎です。

4

4 に答える 4

68

Ubunutu 14.04 マシンでは、上記の回答の組み合わせが機能しました。私sudo apt-get installdvipngtexlive-latex-extra、およびtexlive-fonts-recommendedパッケージであり、それはトリックを行いました:

$ sudo apt-get install dvipng texlive-latex-extra texlive-fonts-recommended 

編集: Matplotlib 3.2.1 の時点で、パッケージも必要になりましたcm-super ( https://github.com/matplotlib/matplotlib/issues/16911を参照) 。

$ sudo apt-get install dvipng texlive-latex-extra texlive-fonts-recommended cm-super
于 2016-05-13T20:33:33.587 に答える
54

エラーメッセージは、type1cmパッケージが不足していることを示しています。MacPortsにはそれがの一部として含まれているtexlive-latex-extraようです。

于 2012-07-06T07:32:49.763 に答える