LoginSignup
6
6

More than 5 years have passed since last update.

Gnuplottexを使う際の注意点(texmf.cnfの設定)

Posted at

LaTeXのgnuplottex.styを利用すると、LaTeXのソース内部に直接gnuplotソースを打ち込むことができ、LaTeXのコンパイル時に自動でgnuplotでグラフを生成してくれるようになります。ドキュメントとグラフのソースを一元化できて修正も楽になるので便利です。サンプルコードは以下の通りです。LaTeXとgnuplotがインストールされている必要があります。

gnuplot.tex
\usepackage[dvipdfm]{graphicx}
\usepackage{gnuplottex}
\begin{document}
たとえばこんなかんじにグラフを挿入できます。

\begin{gnuplot}
       splot sin(x)*cos(y)
\end{gnuplot}

\end{document}

これを

$ platex --shell-escape gnuplot.tex

でコンパイルします。この--shell-escapeは必須です。しかしこれだけでは、
Package gnuplottex Warning: Please convert gnuplot-gnuplottex-fig1.gnuplot manually.Permission deniedが発生することがあります。
これは、LaTeXからgnuplotを呼び出すときの実行権限のエラーが原因のようですので、
texmf.cnfを編集して、gnuplotを実行可能な外部プログラムとして指定しておく必要があります。texmf.cnfはたとえば/usr/local/texlive/texmf-local/web2cにあります(TeXLiveの場合)。

texmf.cnf
shell_escape_commands = \
bibtex,bibtex8,bibtexu,pbibtex,upbibtex,biber,\
kpsewhich,\
makeindex,mendex,texindy,\
mpost,pmpost,\
repstopdf,epspdf,extractbb,gnuplot

以上はMac OS X Marvericksで試した結果です。

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6