Re: PDFLatex with included graphics
At 1029276456s since epoch (08/13/02 11:07:36 -0400 UTC), Neilen wrote:
> Thanks, this seems to do the trick. Is there no way to make my source
> "compatable" with both? Ie. no changes needed wheter I run with
> pdflatex or latex?
I'm a pdflatex fan, but my thesis had to be in both PS and PDF
format. I basically ran epstopdf on all the graphics, so I had both
EPS and PDF versions of each included file. Then, I use a preamble
like the one attached below. It's a little big, so I'll highlight the
main points:
I use the ifthen package to check if we're running as pdflatex or
regular latex. Based on that, I set PDF options as necessary, and
call the graphix package with the correct options as well. Finally, I
use \DeclareGraphicsExtensions{} to search the correct types for the
doc I'm making (PDF, JPEG, etc for PDF files, and EPS for PS files).
Since I have versions of the graphics in both forms, the document will
compile in both modes. Just be sure to include the graphics files
using the name without the extension. For example, "figure1" would be
the call, and the if-then will decide whether to use "figure1.eps" or
"figure1.pdf" for the include.
It's a little more work this way (as opposed to just making the PS
file and converting it), but if you like the native pdf features that
pdflatex provides, then it's a clean solution.
Hope that helps,
Jason
===== cut here =====
\documentclass[10pt]{article}
% allow us to use if-then-else in TeX macros
\usepackage{ifthen}
% Detect if we're running PDFLaTeX or good 'ol vanilla LaTeX
\newif\ifpdf
\ifx\pdfoutput\undefined
\pdffalse
\else
\pdfoutput=1
\pdftrue
\fi
%%% BEGIN PDF/LaTeX specific options
\ifpdf
%%% PDFLaTeX -- options for PDF generation
% Allow color (using the pdftex driver)
\usepackage[pdftex]{color}
% PDF Link colors
\definecolor{refcolor}{rgb}{0,0,0.4} % Color for the reference links
\definecolor{anchorcolor}{rgb}{0,0,0} % Color for anchor text
\definecolor{citecolor}{rgb}{0,0.4,0.4} % Color for bibligraphical citations
\definecolor{urlcolor}{rgb}{0.75,0,0} % Color for linked URLs
\definecolor{filecolor}{rgb}{0.75,0,0} % Color for URLs which open local files
\definecolor{menucolor}{rgb}{0.75,0,0} % Color for Acrobat menu items
\definecolor{pagecolor}{rgb}{0.75,0,0} % Color for links to other pages
% Make a PDF outta this
\usepackage[pdftex,
pdftitle={My Thesis},
pdfauthor={Jason Healy},
pdfsubject={The Automatic Generation of Penrose Tiling Empires},
pdfkeywords={foo bar baz quux},
hyperfigures=true, % provide links to figures
hyperindex=false, % provide links from index to pages (broken?)
pagebackref=true, % provide links to pages where bib is cited from
backref=false, % provide links to sec where bib is cited from
colorlinks=true, %***
linkcolor=refcolor, %
anchorcolor=anchorcolor, %
citecolor=citecolor, % Colors are defined above;
filecolor=filecolor, % change them there
menucolor=menucolor, %
pagecolor=pagecolor, %
urlcolor=urlcolor, %***
bookmarksopen=false, % whether to open bookmarks window on open
pdfpagemode=UseOutlines, % show the bookmarks in outline form
pdfstartview=FitB, % default window sizing
pdfview=FitB]{hyperref} % default view after clicking a link
% allow included graphics (see below for allowed graphic types)
\usepackage{graphicx}
% search for PDF compatible graphics formats
\DeclareGraphicsExtensions{.pdf,.jpg,.png,.tif,.tiff}
% force LaTeX character spacings
\pdfadjustspacing=1
% compress the PDF as much as possible
\pdfcompresslevel=9
%%% END of PDF-specific options
\else
%%% BEGIN LaTeX-specific options
\usepackage[dvips]{graphicx}
% search for LaTeX-compatible file types
\DeclareGraphicsExtensions{.eps,.ps,.tif,.tiff}
%%% END of PDF/LaTeX specific options
\fi
% put begin{document} and such after this line...
===== cut here =====
--
Jason Healy
http://www.logn.net/
Reply to: