LoginSignup
1
0

More than 3 years have passed since last update.

epsファイルがLaTeXでズレる問題を解消

Last updated at Posted at 2018-12-24

問題

matplotlib等で作成したepsの座標がズレているために,LaTeXで図の位置がずれてしまう.という問題がある.
epsのBoundingBoxが悪さをしている.

解決方法

Ghostscriptを入れた際についてくる,ps2pdfpdf2psを用いる.
具体的には,ps2pdfを用いて一度epsファイルをpdfファイルにする.
pdf2ps を用いて,変換後のpdfファイルを再度epsファイルに変換する.

一度,PDFファイルに変更する事によって,上手く座標が調整される.

なお,Ghostscriptは以下のコマンドで手に入る.

brew install ghostscript

上記の動作を実現するために,
以下の様なスクリプトを書いている.

epsbound.sh
#!/bin/tcsh
set input = $1:r
ps2pdf -dEPSCrop -dPDFSETTINGS=/prepress $input.eps $input.pdf
pdf2ps $input.pdf {$input}_rev.eps
rm $input.pdf
1
0
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
1
0