[texhax] includegraphics command in graphicx

Reinhard Kotucha reinhard.kotucha at web.de
Sun May 22 00:56:01 CEST 2011

On 2011-05-20 at 20:53:15 -0400, Michael S Cloud wrote:

 > Hi All
 >    I'm just starting out and I'm trying to do things that the
 >    manuals say work, and then gee what do you know, don't.  So this
 >    time I'm just trying to get an image made in a separate program
 >    to be incorporated into the document I'm working on.  So
 >    according to the easy starter guide that means I need to ...
 > \usepackage{graphicx}
 > .
 > .
 > .
 > \begin{center}
 > \includegraphics{filename}
 > \end{center}
 > So... doesn't work, of course.  I've come across many sources that
 > helpfully explain that the problem is the eps file I'm including is
 > not well formatted.  At this point I've used any number of programs
 > to try to generate eps files.  I've used photoshop, illustrator,
 > jpg2eps, ImageMagick, and others -- (I've forgotten the whole list
 > since I put this problem on the back burner).
 > So the question is, does anyone know how to actually do this?  I'd
 > prefer to be able to include jpgs (the idea that you can't is just
 > absurd).  Apparently pdfLatex allows this, but I'm Texnic Center
 > and it doesn't appear to offer this.  I'm doing
 > latex=>dvips=>ps2pdf (I think) when I compile.  I need to stick
 > with this because I finally got pstricks to work with this setup
 > and I don't want to have to fight that battle again.
 > I guess the main thing I need is a tool that will take a jpg file
 > and generate an eps file that will actually work when used in the
 > \includegraphics command.  But if there's a way to be able to
 > import jpgs I'd love to hear about it.

I don't know whether you are using TeX Live or MiKTeX, but TeX Live
already provides sam2p for Windows.

  sam2p filename.jpg filename.eps

certainly does what you need.  It creates much smaller files than
ImageMagick and is significantly faster.  I don't know whether sam2p
is provided by MiKTeX.

However, since PostScript and PDF understand JPEG, programs like
ImageMagick, sam2p,... don't actually convert JPEGs, they just put
wrappers around them which provide additional information needed by PS
or PDF processors.  Hence, if the EPS files can't be included in
LaTeX, it's possible that your JPEG is broken.

If in doubt, simply send me your JPEG file and I can investigate

Regarding pdf[la]tex, yes, it can include JPEG files directly.  It
just creates the wrapper itself.  Technically, there is no difference
whether you include a JPEG directly or "convert" it to PDF before and
include the PDF.  But dvips can't do that itself and relies on
external programs instead.

As Martin already pointed out, we need more information.  At least the
exact error message.  If external programs are involved, such as
JPEG->EPS converters, it's also helpful to know which TeX distribution
you are using.

And please don't rely too much on TeXnicCenter.  It's easier to do
things step-by-step on the command line first and configure
TeXnicCenter later.  If you configure TeXnicCenter, you have to know
how the programs havew to be invoked on the command line anyway.
Do the first step first, it's easier in this way. :)


Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha at web.de
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.

More information about the texhax mailing list