I believe an update to my original answer is in order because my image inclusion practices have changed since 2009: I now almost exclusively use TikZ to directly create diagrams using TeX commands. In my (and many other people's) opinion it consistently produces the best-looking graphics, and also makes it easy to embed them within a LaTeX document because there is no separate image file involved; you don't need to worry about bounding boxes, file formats, driver compatibility, etc. It works with both PostScript output (dvips
) and PDF output (pdflatex
).
I used to prefer the EPS format for inclusion in LaTeX documents, but because it's a vector graphics format, anything that is drawn in EPS can in principle be closely reproduced with TikZ, so I don't use EPS figures anymore. I could see that being a useful option if you had some complex EPS figure that would take a long time to convert to TikZ; however, pdflatex
does not allow EPS figures. You can convert the EPS to a PDF file and include that, though.
For cases which require a raster image, e.g. if you're trying to include a photograph or screenshot, you can use pdflatex
with the package graphicx
(or graphics
, they're very similar) to directly include PNG images in LaTeX files:
\includegraphics[width=4in,height=4in,viewport=0 0 300 300]{figure.png}
latex
+ dvipdf
might also accept PNGs, I'm not sure. The disadvantage of this is that you can't use any Postscript-specific packages, like pstricks
or draftcopy
; however, again, the functionality of these packages is mostly duplicated by TikZ.
You are drawing outside the media size in Inkscape and CorelDraw. Then you export/print to PDF. But Inkscape uses the same media size for the PDF file. The graphics
package that loads the PDF file (e.g., driver pdftex.def
) only sees the media size. Also the Inkscape/Coreldraw might drop objects outside the media size. Even if the PDF file is manipulated by changing the /MediaBox
and /CropBox
values, there might be missing objects.
In Inkscape you can modify the "document settings" ("file" menu). It offers a button for fitting the page/media size to the contents. With German localization:
"Datei"->"Dokumenteneinstellungen"->"Seite in Auswahl einpassen"
(Addition:) Inkscape also allows the export of the whole drawing.
Likely CorelDraw also allows to change the media/paper size.
Then again export to PDF to get all objects on the page.
There options viewport
and trim
to get a smaller active bounding box for \includegraphics
and overlapping areas (clip
is disabled by default).
Best Answer
Instead of doing this using
\includegraphics{}
, I would suggest a workaround to achieve the desired goal. If you are running on Linux/CygWin you can do the following in command line prompt:After doing this, all the PDFs that were already in the directory will be renamed to
*-old.pdf
and the newly generated PDFs will be cropped tightly without white margin. Then you can use these PDFs in the TeX file without any trim option in\includegraphics{}
.