Mathematica からExportした eps を MacPorts の LaTeX の graphicx で includegraphics したものが dvipdfmx で扱えない

Mathematica 10 で Export["figure.eps".%] で保存した encapsulated postscript file を, graphicx でLaTeX に include することを考える.

OS X 10.10 の MacPorts の TeXlive 2015の場合

dvipdfmx で PDFにする段階で, 以下のようなエラーになる

[1Error: /typecheck in /findfont
Operand stack:
   9   MathematicaSans
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1967   1   3   %oparray_pop   1966   1   3   %oparray_pop   --nostringval--   1950   1   3   %oparray_pop   1836   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   1919   2   3   %oparray_pop
Dictionary stack:
   --dict:1195/1684(ro)(G)--   --dict:0/20(G)--   --dict:107/200(L)--
Current allocation mode is local
Last OS error: Invalid argument
Current file position is 34971
GPL Ghostscript 9.16: Unrecoverable error, exit code 1

dvipdfmx:warning: Filtering file via command -->gs -q -dNOPAUSE -dBATCH -dEPSCrop -sPAPERSIZE=a0 -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -sOutputFile='/var/folders/kw/189pr66j0sn52cgxkzzb9ldh000104/T//dvipdfm-x.f0098c1350bfdd53bc5e70ea9b9bfa29' '/Users/hig/path/fr.eps' -c quit<-- failed.
dvipdfmx:warning: Image format conversion for "/Users/hig/path/fr.eps" failed...
dvipdfmx:fatal: pdf_ref_obj(): passed invalid object.

Output file removed.

バージョンはこう.

hig@mac$ dvipdfmx --version
This is dvipdfmx Version 20150315 by the DVIPDFMx project team,
modified for TeX Live,
an extended version of dvipdfm-0.13.2c developed by Mark A. Wicks.
Copyright (C) 2002-2015 the DVIPDFMx project team
Copyright (C) 2006 SIL International.

hig@mac$ gs --version
9.16

MathematicaSans のところでエラーになっているので, フォントが足りない, フォント埋め込みするかしないか, のような問題かと一瞬思うわけだが, (Mathematicaをインストールしていない)Debian 7ではエラーにならないので, フォントライブラリだけの問題ではないようだ. Mathematica側のExport設定も調整してみたが, 解決できなかった.

Debian 7 の場合

同じことを Debian 7 のTeXlive 2012.2012061 で実行するとエラーにはならない. バージョンはこう.

hig@debian$ dvipdfmx --version
This is dvipdfmx-20120420 by the DVIPDFMx project team,
modified for TeX Live,
an extended version of dvipdfm-0.13.2c developed by Mark A. Wicks.
Copyright (C) 2002-2012 by the DVIPDFMx project team

hig@debian$ gs --version
9.05

Mac における回避策

  • graphicx はeps以外にpdf,jpg,png も扱えるわけだが, pdf,jpg,pngでは問題は起きない. ベクターグラフィックスでということなら, epsでなくpdfで. Mathematica から Export["figure.pdf",%]する. ただし,
    • DVIの段階では preview できない. pdfにしてから preview する必要
    • pdfに対してextractbb で .bb ファイルを作る必要