Latex - Inserting images
When we are writing documents, no matter if these are with MS Word, Open Office or Latex, sometimes we need to insert graphics on them.
Well if you are using Latex, there is a solution, and a good and easy one to insert graphics on the document.
The first thing you need to do is to add this line below the documentclass control sequence.
\usepackage{graphicx}
and then wherever you want to add the image use this code.
\begin{figure}
\includegraphics[scale=0.20]{ptop.eps}
\end{figure}
where ptop.eps, is the encapsulated post script graphic you may want to add to the file and the scale option is telling LaTeX to include the figure reduced to 20% of its original size.
You can of course add jpg or png images, but it is always better to use encapsulated post script (eps) files.
To insert png or jpg files you need to specify its size lets say in mm, and not a scale.
\begin{figure}
\includegraphics[width=80mm]{ptop.png}
\end{figure}
\begin{figure}
\includegraphics[height=40mm]{ptop.jpg}
\end{figure}
Now that I am recommending to use eps files rather than jpg or png, I will show you how to create eps files with Gimp and Dia
Creating eps (encapsulated post script files with Gimp

You just need to open or create the file, then choose
file->save as.
and proceed as in the figure.
Creating eps files with Dia
Once you have created your file with Dia, just save it as usual then go to the command prompt, and type this:
dia -e ptop.eps -t eps-builtin ptop.dia
Where ptop.dia is the name of the file you have just saved and ptop.eps is the output file
Note
Remember that if you insert images you need to follow this steps to get the PDF file:
latex document.tex
dvips document.dvi
ps2pdf document.ps
Trackback URL for this post:
If you like this article, subscribe to our full rss
Please post your question in our forum and use comments only to leave your comments about the article, thanks.













Post new comment