Login

Including Figures in TeX
[ see also Figures/Labeling... ]

LaTeX Code for including Figures

% The epstopdf package will automatically convert .eps files to .pdf
% when typesetting with pdftex
% The pdf file produced this way is much smaller than say, saving
% the .pdf file in Illustrator
%
%-------------------------------------------------------------------------
\documentclass[11pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{epstopdf}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}

\title{Brief Article}
\author{The Author}
%\date{}        % Activate to display a given date or no date

\begin{document}
\maketitle

% OPTIONS
%  \includegraphics{myfig}
%  \includegraphics[width=60mm]{myfig}
%  \includegraphics[height=60mm]{myfig}
%  \includegraphics[scale=0.75]{myfig}
%  \includegraphics[angle=45,width=52mm]{myfig}


\begin{figure}[htbp] %  figure placement: here, top, bottom, or page
   \centering
   \includegraphics[width=0.5\textwidth]{example}
   \caption{example caption}
   \label{fig:example}
\end{figure}

\end{document}




Practical Notes:








Creating figures in PDF format with Adobe Illustrator

When using Illustrator save the files as .eps. Do not save the .pdf version directly from Illustrator when trying to create a small file size. Better to use Adobe Distiller to convert the .eps to .pdf.


Alternatively, if the file is opened with TeXshop (by dragging and dropping the figure on to the TeXshop icon), TeXshop will automatically convert the file to .pdf using the epstopdf package. The resulting file will be smaller in size than one saved as pdf in Illustrator.


Another option is to let TeXShop do the conversion when typesetting by including the lines


      \usepackage{epstopdf}
      \DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}

in the preamble, as described in the section above.




Reducing the size of .eps and .pdf figures

Date: Sat, 9 Sep 2006 22:22:57 +0200
From: Siep Kroonenberg <{$ \mbox{siepo@cybercomm.nl} $}>
Reply-To: TeX on Mac OS X Mailing List <MacOSX-TeX@email.esm.psu.edu>
To: TeX on Mac OS X Mailing List <MacOSX-TeX@email.esm.psu.edu>
Subject: Re: [OS X TeX] [OT] (super)size of eps/pdf figures

On Fri, Sep 08, 2006 at 04:20:26PM -0400, Themis Matsoukas wrote:
> I have this figure which I saved in Illustrator as eps, and which is
> 1.6 MB. The pdf version of the figure that's created when I run
> pdflatex is 180 KB (yes, "K"). If I open this pdf figure in
> Illustrator and simply save it as eps, it blows up to 1.4 MB (yes,
> "M"). The problem is, I have 4 figures like that I need to upload to
> a server along with my latex source, but I can't b/c the figures are
> huge. (The server is supposed to assemble my latex file and its eps
> figures to create a pdf output.)

> -Is there a way to create lean eps files, either from a fat eps file
> or from a lean pdf?

Try pdftops from the xpdf suite; you can download an osx version
from
        http://users.phg-online.de/tk/MOSXS/
pdftops is a cli utility. It has an -eps option and works pretty
well. If you want a gui instead, have a look at my epspdf script
which you can download from
       http://tex.aanhet.net/epspdf/
This script likes to have pdftops available and definitely needs
Ghostscript, for which there exists an iPackage.

> -Does it make sense that size increases by a factor of 8 by merely
> saving from pdf to eps?
>
> I was curious so I saved an empty file (an empty 11x8.5 page) in
> Illustrator as eps. The resulting file is 380 KB(!)

An earlier discussion on this list suggested saving to an older
version of Illustrator eps, and deleting unused swatches, if you
prefer to save from Illustrator.

Siep Kroonenberg




from Will Adams
<http://tug.org/pipermail/macostex-archives/2006-September/024262.html>,
containing in particular:

>You can also reduce the filesize of an Illustrator file by removing
>all unused colours / swatches, not including a preview, and in some
>instances by saving down as a lower version #.