画像をincludegraphicsするとdvipdfmxがSIGABRT (signal 6)で落ちてしまう時の対処

今日LaTeXで書いている文書に, \includegraphicsで画像を貼りつけたらdvipdfmxがSIGABRTでお亡くなりになってしまい, 困ってしまいました.
どうもPreview.appで編集したファイルを取り込むと, dvipdfmxが落ちるのです.
原因が30分も分からずに, 時間を無駄にしてしまったので, 対処方法を書いておきます.

環境/アプリケーション

  1. Mac 10.8.4
  2. Preview.app Version 6.0.1 (765.6)
  3. platex
  4. dvipdfmx

バージョン

 $ platex --version
pTeX 3.141592-p3.1.10 (utf8.euc) (Web2C 7.5.4)
kpathsea version 3.5.6
ptexenc version 0.997
Copyright (C) 1997-2004 D.E. Knuth.
Kpathsea is copyright (C) 1997-2004 Free Software Foundation, Inc.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pTeX copyright and
the GNU General Public License.
For more information about these matters, see the files
named COPYING and the pTeX source.
Primary author of TeX: D.E. Knuth.
Kpathsea written by Karl Berry and others.

 $ dvipdfmx --version

This is dvipdfmx-20110311 by the DVIPDFMx project team,
an extended version of dvipdfm-0.13.2c developed by Mark A. Wicks.

Copyright (C) 2002-2011 by the DVIPDFMx project team

This is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
 $

dvipdfmxの落とし方

適当に画像を用意する. (jpgファイルを用意しました. 画像はWikipediaのりんごの項目から)

 $ open test.jpg


この画像をtexの文書にincludegraphicsする (╹⌓╹ )

 $ ebb test.jpg
 $ cat test.tex
\documentclass[a4j,11pt]{jarticle}
\usepackage[dvipdfm]{graphicx}
\begin{document}
\includegraphics[width=15cm]{test.jpg}
\end{document}
 $ platex test.tex
 $ dvipdfmx test.dvi
 $ open test.pdf

普通にコンパイルできる ∩(>◡<*)∩♡


test.jpgをPreviewで開く.

 $ open -a Preview test.jpg


適当に編集して

保存する (๑╹◡╹๑)


test.jpgを読み込もうとしているLaTeX文書をコンパイルしようとする.

 $ platex test.tex
 $ dvipdfmx test.tex
test.dvi -> test.pdf
[1zsh: abort      dvipdfmx test.dvi

SIGABRTで死ぬ. 楽しい.

楽しい!!✌(’ω’✌ )三✌(’ω’)✌三( ✌’ω’)✌!!

対処方法

Preview以外のアプリケーションで開き, 保存し直します.
例えば, convertコマンドを使います.
ここでのポイントは, 拡張子を変更するということです.
(拡張子を変更しなければ, 入力ファイルのコピーが作られる気がするため)

 $ convert -geometry 100% test.jpg test2.png
 $ ebb test2.png
 $ cat test.tex
\documentclass[a4j,11pt]{jarticle}
\usepackage[dvipdfm]{graphicx}
\begin{document}
\includegraphics[width=15cm]{test2.png}
\end{document}
 $ platex test.tex
 $ dvipdfmx test.dvi
test.dvi -> test.pdf
[1]
623302 bytes written
 $

うまくいきました!
元のファイルがpngならば, jpgにしてください.



この件を検索したら, http://tutimura.ath.cx/ptexlive/?tlptexlive%A5%EA%A5%DD%A5%B8%A5%C8%A5%EA%A1%BC%A3%B2%A3%B0%A3%B1%A3%B1http://oku.edu.mie-u.ac.jp/~okumura/texfaq/qa/56269.html くらいにしか言及されていませんでした.
困っている人は試してみて下さい.