Pictures, Images & Diagrams in LaTeX Documents
LaTeX has several mechanisms for incorporating graphical plots,
line drawings and images into a document.
Pictures & Images
- To incorporate graphics files in LaTeX, you
must have the
graphicx package (which comes with MiKTeX).
Inclusion of graphics in LaTeX is quite easy: simply add to the preamble at the start of
your LaTeX file the following:
\usepackage{graphicx}
Then wherever you wish to include a graphics file (say, 3dplot.pdf)
in your LaTeX document, you simply use:
\includegraphics[width=100mm]{3dplot.pdf}
The width, in this case, is set to 100mm. The height is scaled accordingly to
keep the correct aspect ratio. You can also use JPEG files:
\includegraphics[width=100mm]{mypic.jpg}
- You must use either
.jpg or .pdf formats.
If you have an application that generates other file formats, then you must convert
the file into pdf or jpg.
- For converting many different image file formats,
IrfanView is highly recommended.
- If you have any Encapsulated PostScript (
.eps) files, you have to convert them
into PDF format for pdflatex.
You do this using the command-line utility epstopdf, as follows:
eps2pdf 3dplot
This will take 3dplot.eps and convert it to 3dplot.pdf.
In MATLAB, for example, you can generate a .eps file for the current figure by typing
print -deps myplot.eps
For colour pictures, use
print -depsc myplot.eps
Then use epstopdf myplot.eps to generate myplot.pdf
- (Advanced) It is also possible to add LaTeX fonts to PostScript graphics.
For that, you need the
psfrag package, as descibed in
Adding LaTeX Fonts to Graphics.
You also need the Ghostview application.
Where can I get Ghostview?
Diagrams
- The PGF package
(alternate site) provides
macros for picture drawing in LaTeX, and generates PDF output directly.
The advantage of this approach is that it allows you to embed LaTeX text, fonts, equations, or any LaTeX
typesetting commands into the diagram.
- A free drawing package for Windows is Paint.Net.
You can save in formats suitable for LaTeX or web documents.
- If you wish to purchase a commercial drawing package,
SmartDraw
is worth a look.
- LaTeXPiX is an application
for Windows which allows you to draw PGF format graphics. It is less tedious
than manually entering object placement commands directly for PGF.
Back