Graphics, Figures & TablesEquivalent of bounding box when compiling with pdflatex

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
samshort25
Posts: 1
Joined: Wed May 22, 2013 10:58 pm

Equivalent of bounding box when compiling with pdflatex

Post by samshort25 »

Hi there,

I'm having an issue inserting a .pdf image into my .tex file (an .eps works fine). A description of my problem is below.

When I insert an .eps figure (attached) by doing:

Code: Select all

 
\documentclass[a4paper,11pt]{article}
\usepackage{graphicx}

\begin{document}
\begin{figure}
\includegraphics[angle=90,bbllx=113bp,bblly=67bp,bburx=506bp,bbury=741bp,width=0.8\textwidth]{lipari-plot.eps}
\caption[]{}
\label{fig:liparieps}
\end{figure}
\end{document}
and compile my latex test.tex file using latex (i.e. by doing "latex test.tex; dvipdf test.dvi test.pdf;" on the command line) the figure looks as expected.

However, I need to compile my test.tex file using pdflatex (as my images need to be .pdf instead of .eps).

Unfortunately, I can't find an equivalent to a bounding box that will work with pdflatex. I have tried using viewport (as suggested by websites and the compiler), but the image doesn't appear correctly. (I compile it by doing "pdflatex test.tex;" on the command line.)

The code I have tried, for example, is

Code: Select all

\documentclass[a4paper,11pt]{article}
\usepackage{graphicx}

\begin{document}
\begin{figure}
\includegraphics[angle=90,viewport=113bp 67bp 506bp 741bp, clip, width=0.8\textwidth]{lipari-plot.pdf}
\caption[]{Caption}
\label{fig:liparipdf}
\end{figure}

\end{document}
Does anyone know a way to make the compiled version of my .pdf image look like the .eps version??

Thanks so much for your help :)
Sam
Attachments
test_eps.tex
.tex file for .eps example
(301 Bytes) Downloaded 408 times
test_pdf.tex
.tex file for .pdf example
(559 Bytes) Downloaded 402 times
lipari-plot.eps
.eps version of plot
(60.3 KiB) Downloaded 415 times
lipari-plot.pdf
.pdf version of plot
(14.37 KiB) Downloaded 282 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

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Equivalent of bounding box when compiling with pdflatex

Post by cgnieder »

Hi Sam,

Welcome to the LaTeX community!

I'd like to point out as information for potential helpers (and also since our board rules demand it) that this question has also been asked on TeX.sx.

Regards
site moderator & package author
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Equivalent of bounding box when compiling with pdflatex

Post by cgnieder »

I'd like to add the solution they found on TeX.sx here as well: it turned out that the eps file was corrupt and contained the wrong bounding box values. By editing the EPS file (in the editor of choice) and changing the lines

Code: Select all

%!PS-Adobe
%%Creator: The Mighty Setlink.
%%BoundingBox: 58 35 612 525
%%EndComments
into

Code: Select all

%!PS-Adobe-2.0 EPSF-2.0
%%BoundingBox: 124 78 479 735
%%HiResBoundingBox: 124.000000 78.500000 479.000000 735.000000
%%EndComments
the conversion worked as expected.

Regards
site moderator & package author
Post Reply