[Tex/LaTex] gnuplot epslatex pdflatex

gnuplotpdftex

I'm trying to embed my plot created in gnuplot. Just setting the terminal to latex works fine but only creates a black and white plot. With the color screens getting cheaper these days this isn't quite satisfying 😀

The manual also mentions the possibility to use epslatex, then converting the eps file to a pdf file and include the generated latex file completely messes up the spacing between the labels on the axis and the actual graph. This happens both times, when creating a latex file for inclusion and also when creating a standalone file.

Guessing that I'm not the only one I ask myself what I am doing wrong and weather there is an easy workaround.

Messed up spacing

Best Answer

There are several tools for EPS to PDF conversion: at least ps2pdf, epspdf and epstopdf. It can be verified that the first one of these (which uses GhostScript) creates a PDF of page size (say, A4 or US Letter) and not content size, while the other two work as expected. Some internet digging shows that GhostScript accepts the -dEPSCrop option, which clips the picture to its bounding box.

So, use either of epspdf, epstopdf or ps2pdf -dEPSCrop to properly convert the picture.