Graphics, Figures & Tables.JPG and .eps images in the same file.

Information and discussion about graphics, figures & tables in LaTeX documents.
feddozz
Posts: 8
Joined: Wed Aug 12, 2009 3:15 pm

.JPG and .eps images in the same file.

Post by feddozz »

Hello guys,
I have problems including figures in my document. I found configuration that allowed me to make either .jpg or .eps work. But not the two formats at the same time.

I browsed the forum and I saw many suggestions and many solutions. I tried all of them without success. Now I am a bit confused.

I am using Texnic Centre 1.0 with MiKTeX 2.7

Can you suggest a valid configuration if existing?

Thanks

Recommended reading 2024:

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

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

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

.JPG and .eps images in the same file.

Post by frabjous »

feddozz wrote: I browsed the forum and I saw many suggestions and many solutions. I tried all of them without success. Now I am a bit confused.
Tell us specifically what you've tried and how it didn't work, or else, obviously, we'll just repeat the same unhelpful advice.
feddozz
Posts: 8
Joined: Wed Aug 12, 2009 3:15 pm

Re: .JPG and .eps images in the same file.

Post by feddozz »

I managed to obtain some improvements. I am almost there.
I use:
- Latex => pdf
- The following packages: \usepackage[pdftex]{graphicx} and \usepackage{epstopdf}
- --enable-write18 as a command line argument for the compiler.

Now I get all the figs in the .pdf. There is only one problem. The .eps get trimmed in the conversion and I lose a piece of the picture. I guess they get trimmed as big as an A4. Do you know how to fix it?
Now it should be more specific.
Thanks
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

.JPG and .eps images in the same file.

Post by frabjous »

Try scaling the image using the scale, and or width, height and keepaspect options to includegraphics, e.g.:

\includegraphics[scale=0.5]{myepsfile}

(makes it half size)

\includegraphics[width=4in,keepaspectratio]{myepsfile}

(makes it 4 inches wide, with whatever length then becomes appropriate to keep the aspect ratio)

Modify as needed.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

.JPG and .eps images in the same file.

Post by localghost »

feddozz wrote:[…] Now I get all the figs in the .pdf. There is only one problem. The .eps get trimmed in the conversion and I lose a piece of the picture. I guess they get trimmed as big as an A4. Do you know how to fix it? […]
To me it seems that the bounding box of the conderned EPS files is the cause. Perhaps you can attach one of those problematic files to your next post. Then we would be able to do some tests.

Best regards
Thorsten
feddozz
Posts: 8
Joined: Wed Aug 12, 2009 3:15 pm

Re: .JPG and .eps images in the same file.

Post by feddozz »

Thanks for the help guys. I was already using scaling factors and so on but it doesn't work.
It seems to me that I should specify a non-fixed dimension for the pdf page. Is it possible to specify that somewhere?

Anyway I'm sending the files, if you can find a solution that would be really appreciated.

P.s. remember I am compiling using Latex=>pdf.

Thanks!
Attachments
abc.zip
(4.89 KiB) Downloaded 227 times
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: .JPG and .eps images in the same file.

Post by frabjous »

Yeah, the .eps file itself extends beyonds its own dimensions. There might be a way around this with epstopdf.sty, but I didn't find its documentation useful... so I converted the .eps to a .pdf file without using the package, and made the appropriate changes to your file. See the attached bundle.
Attachments
abcd.zip
(5.41 KiB) Downloaded 221 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

.JPG and .eps images in the same file.

Post by localghost »

I corrected the bounding box with a simple text editor and then converted to PDF with the epstopdf command line tool. The result is attached.
Attachments
A.pdf
The submitted diagram corrected and converted.
(21.31 KiB) Downloaded 317 times
feddozz
Posts: 8
Joined: Wed Aug 12, 2009 3:15 pm

.JPG and .eps images in the same file.

Post by feddozz »

frabjous wrote:Yeah, the .eps file itself extends beyonds its own dimensions. There might be a way around this with epstopdf.sty, but I didn't find its documentation useful... so I converted the .eps to a .pdf file without using the package, and made the appropriate changes to your file. See the attached bundle.
It's great. Obviously I am looking for a way of converting the .eps automatically.
localghost wrote:I corrected the bounding box with a simple text editor and then converted to PDF with the epstopdf command line tool. The result is attached.
Ok, I opened for the first time an eps with a text editor. I found the bounding box line. Again I am looking for an automatic pocess, otherwise I can convert from eps to jpg and solve all the probs, but that would be a long process. My eps are generated with gnuplot. Is there a way of correcting the prob from the source (I know this is not a gnoplot forum, but you know...since we are discussing about it... :-) )?

Thanks for the help guys!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

.JPG and .eps images in the same file.

Post by localghost »

feddozz wrote:It's great. Obviously I am looking for a way of converting the .eps automatically. [...]
You can convert the files "on the fly" with the epstopdf package.
feddozz wrote:[...] Ok, I opened for the first time an eps with a text editor. I found the bounding box line. Again I am looking for an automatic pocess, otherwise I can convert from eps to jpg and solve all the probs, but that would be a long process. My eps are generated with gnuplot. Is there a way of correcting the prob from the source (I know this is not a gnoplot forum, but you know...since we are discussing about it [...]
Usually GnuPlot sets the right bounding box. But I don't know which terminal you are using for the output. When I used it to get my data sets plotted, I set the terminal to postscript.

Code: Select all

set term post eps enhanced
The GnuPlot manual shows that there are many more terminals (also pdf). The job is simplified by using the gnuplottex package. Nowadays I use pgfplots (based on pgf/tikZ) or pstricks to generate plots. The advantage is a better consistency of the whole document since the default font is used.
Post Reply