GeneralErrors in Inserting .eps files

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
spacefreak
Posts: 3
Joined: Mon Jan 14, 2008 4:58 am

Errors in Inserting .eps files

Post by spacefreak »

I'm trying to figure out how to add .eps files into my LaTeX document. To convert the images from .jpeg or .bmp, I'm just opening the file in Gimp 2.2 and then saving it as .eps file, which loads properly on GS View.

Within the LaTeX code itself, here is what I am entering and the subsequent error:

\documentclass{article}

\usepackage{graphicx}
\usepackage{epsfig}

\begin{document}

\begin{figure}
\includegraphics{SemiconductorConductivity.eps}
%Yes, I made sure to put that file in the same directory as the .tex file

\end{figure}

\end{document}

It gives me a blank area in the document where the picture should be. TeXnicCenter is giving me the following error:

! LaTeX Error: Unknown Graphics Extension: .eps

Does anyone know why it is not working, and how to fix it so that I can include graphs and such in my reports? Thanks

-----------------
Edit: I sorta got it by changing \usepackage{graphicx} to \usepackage[pdftex]{graphicx} and then just changing the filename to .jpg instead of .eps. I suppose this works now, but it loads the image on another page, not in the location where I need it. Is it possible through this method to shrink down the image and place it at a specific location on the page, and if so, how?

Right now this how my code is working:

\section{Calculations}

\subsection{Magnetic Field}

We will demonstrate how to calculate the magnetic field based on the available data. The magnetic field is calculated using the equation:

\begin{eqnarray}
\vec{B} & = & \mu_0 {\left(\frac{4}{5}\right)}^{3/2} {nI \over d}
\end{eqnarray}
where n is the number of turns around the coil and d is the distance between the coils. For this experiment, n = 130 and d = 15 cm.
\begin{eqnarray}
\vec{B} & = & 4\pi \cdot{10^{-7} T m/A} {\left(\frac{4}{5}\right)}^{3/2} {{\left(130 \right)}{\left(1.102 A\right)} \over 15cm} \nonumber \\
& = & 8.588*10^{-4} T \nonumber
\end{eqnarray}

\subsection{Velocity in terms of e and m}

\subsection{Compute the e/m ratio}

We will now demonstrate how to calculate the ratio of electron charge to electron mass:

%This is the location in the document where the picture is showing up

\begin{eqnarray}
{m \frac{v^2}{r}} = {evB}
\end{eqnarray}
Since $v = \sqrt{{2eV}\over m}$

\begin{eqnarray}
m \frac{\left(\sqrt{{2eV}\over m}\right)^2}{r} & = & {e \cdot B \cdot \sqrt{{2eV}\over m}} \nonumber \\
\frac{e}{m} & = & {{2 \cdot V} \over {B^2 \cdot r^2}}
\end{eqnarray}

\subsection{Average e/m ratio}

\begin{figure}
\begin{center}
\includegraphics{SemiconductorConductivity2.jpg}
\caption{Conductivity of a Semiconductor Material}
\end{center}
\end{figure}

%This is where I actually want the picture to show.

\subsection{Electron Velocity}

The velocity of the electron can be calculated as such:

\subsection{Error Analysis}

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Errors in Inserting .eps files

Post by gmedina »

You don't need the obsolete package epsfig. It's enough to use the graphicx package. Read the documentation of the package to see all the options it offers (amongst them, the ones you need).

When using the table or figure environments, the tables or figures will be treated as floating objects; which means that they can float through your docuement until LaTeX finds the right place for them; if you want to "force" LaTeX to place a floating object where you want, use something like the following: (read l2tabu (link below) to see the reasons for using \centering instead of \begin{center}...\end{center})

Code: Select all

\begin{figure}[!ht]
  \centering
  \includegraphics[width=4cm]{your_image.eps}
\end{figure}
Now, if you are using PDFLaTeX to process your .tex file, then you cannot use .eps images; you have to use .png .pdf or .jpg images.

If you use .eps images then you can produce a .dvi or a .ps final document.

The eqnarray environment sholdn't be used anymore (the reasons can be found in l2tabu). Use align or some of the other environments provided by the amsmath package.
Last edited by gmedina on Sat Jan 19, 2008 10:49 pm, edited 1 time in total.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
spacefreak
Posts: 3
Joined: Mon Jan 14, 2008 4:58 am

Re: Errors in Inserting .eps files

Post by spacefreak »

Got it! Thank you. I've been spinning my wheels on that one for hours now. The person that told me about LaTeX wasn't kidding when they said there is a learning curve for this.
Post Reply