GeneralInsert Bitmaps, .GIF, .JPEG graphics

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
BMAcox
Posts: 40
Joined: Sun Dec 23, 2007 12:07 am

Insert Bitmaps, .GIF, .JPEG graphics

Post by BMAcox »

Hello All: So far I have only been able to insert .pdf graphs into my LaTex files that I build in TeXnicCenter from MikTex. In my headers, I have
\newif\ifpdf
\ifx\pdfoutput\undefined
\pdffalse
\else
\pdftrue
\pdfoutput=1
\fi
\documentclass{article}
\ifpdf
\usepackage[pdftex]{graphicx}
\pdfcompresslevel=9
\else
\usepackage{graphicx}
\fi
\usepackage{array}

But whenever I insert any files other than .pdf into my LaTex by use of the GUI 'Insert' drop-down menu, my output does not show that. And, if I would like to insert an Excel graph, how can that be done? Thanks!!!

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Insert Bitmaps, .GIF, .JPEG graphics

Post by localghost »

You can omit the above given code completely. Just use the graphicx package without any driver option. It will find the right graphics file by itself. Note that the compilation route is very important when inserting external graphics files. latex only accepts the EPS format, whereas pdflatex accepts JPG, PDF and PNG. So make sure that your graphics files are provided in these formats.


Best regards
Thorsten
BMAcox
Posts: 40
Joined: Sun Dec 23, 2007 12:07 am

Re: Insert Bitmaps, .GIF, .JPEG graphics

Post by BMAcox »

Hmmm, okay. So does that mean if I wanted to insert an Excel Graph, then I need to convert it into a .jpeg, first? And for my .bmp, I would just change the extensions to .jpeg?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Insert Bitmaps, .GIF, .JPEG graphics

Post by localghost »

BMAcox wrote:Hmmm, okay. So does that mean if I wanted to insert an Excel Graph, then I need to convert it into a .jpeg, first? [...]
Yes. But the preferable way would be to generate diagrams and plots with GNUplot or Octave as external programs. Internal solutions would be pgf/TikZ or PSTricks.
BMAcox wrote:[...] And for my .bmp, I would just change the extensions to .jpeg?
No. The format remains the same. You have to convert it.
User avatar
seano
Posts: 12
Joined: Tue Jan 29, 2008 3:38 pm

Insert Bitmaps, .GIF, .JPEG graphics

Post by seano »

Hi,
If you have a PDF print driver on your computer (or install one), you can create PDF files directly from Excel. Simply select the diagram you want to "convert" and then press print. This should then open up a window allowing you to name your new PDF.

A couple of things to keep in mind:
  • Before printing, change the margins, headers and footers to zero, otherwise you will end up with a lot of white space around your diagrams.
  • In the printer options, you will be able to define new page sizes. This is usefull if you don't want all of your diagrams to be A4 or US Letter shaped.
I prefer this method to using JPG files because you don't have to use a rasterised image and and the final result ends up looking (a little bit) better.

Thorsten is probably correct, the other programs will give you a better result. But if you're like me, the fact that Excel is sooooooooooooooo much easier to (continue to) use will be the winning factor!
Donald E. Knuth said that TeX was intended for the creation of beautiful books.
The plethora of confused, frustrated PhD students trying to use it must therefore be seen as an unintentional side effect.
Post Reply