Graphics, Figures & TablesAdjust trim margin for eps2pdf

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
NiallNixon
Posts: 9
Joined: Mon Aug 03, 2015 9:13 am

Adjust trim margin for eps2pdf

Post by NiallNixon »

Hi,

I'm having trouble with the my eps figures and the trimming them when they're converted to pdf. For some reason the eps figures are cropped to tightly which removes some of my figures. The plots are saved from Matlab.

I have tried saving the eps files differently, which didn't work and this kind of makes sense because the source files always look good. The only related post I could find was this: http://latex-community.org/forum/viewto ... =45&t=9559. And they only describe a different compile method which doesn't work for me. There must be an option in epstopdf to change the crop margin to be a little larger, anyone?

I'm using the ieeetran template with the graphicx package with option pdftex.
Attachments
hyp1_T-eps-converted-to.pdf
The resulting pdf file (bad)
(6.56 KiB) Downloaded 200 times
hyp1_T.eps
The source file (good)
(19.57 KiB) Downloaded 271 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Adjust trim margin for eps2pdf

Post by Johannes_B »

Welcome,

first of all, you should get rid of option pdftex everywhere. It doesn't do any good.

Rename the figure to something else and try again, a decently updated TeX distribution should convert the image on the fly without you even noticing it.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
NiallNixon
Posts: 9
Joined: Mon Aug 03, 2015 9:13 am

Adjust trim margin for eps2pdf

Post by NiallNixon »

Thanks for your quick reply. Took away pdftex and renamed the image to try again. My latex is up to date. Still produces the same result.

Here's a code example of how to reproduce the problem:

Code: Select all

\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage{graphicx}

\begin{document}

\begin{figure*}[h]
  \centering
  \includegraphics[width=0.45\textwidth]{hyp1_T}
  \caption{test}
\end{figure*}


\end{document}
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Adjust trim margin for eps2pdf

Post by Johannes_B »

Hm, that really is an odd graphic. Have you tried exporting it once more with Matlab? Can Matlab export pdfs directly?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
NiallNixon
Posts: 9
Joined: Mon Aug 03, 2015 9:13 am

Adjust trim margin for eps2pdf

Post by NiallNixon »

Yes I have, in multiple ways, there's print and saveas commands in matlab and I have tried them both with different settings, no luck.

Used your second advice though and tried saving directly as pdf, don't know why I never tried that. The plots are good then, just lots of whitespace around the plot. But found a tool to crop the pdf's from within matlab and together with the trim function in latex, the figures are perfect now.

Thanks alot!
Post Reply