# [OS X TeX] Including pdf and ps graphics in the same document.

Daniel Becker daniel.becker at uni-rostock.de
Tue Mar 24 23:37:33 CET 2009

Hallo -

a very basic thing to know is that pdflatex (tex -> pdf) accepts PDF,
PNG, JPEG and GIF as graphic formats, latex (tex -> dvi (-> ps) ->
pdf) accepts only eps. Let's call them PDF-mode and DVI-mode...

So you have to decide whether you want to typeset in pdflatex or in
latex mode. (I prefer PDF-mode.)

>>> I have an exam that I'm putting together and would like to use some
>>> graphics
>>> that are in pdf and also some graphics created with PSTricks.
>
> The pdf graphics (created in Mathematica or Adobe Illustrator, and
> then run
> through Apple's Preview to save as a pdf (I like the results better
> than
> using either programs/ built in pdf)) are included in the document
> with
> \includegraphics[scale=1]{file.pdf}

So you have the graphics in eps? And then a conversion "by hand" with
preview.app? You could

1) use the eps-files directly, but then you need to typeset in DVI-
mode. Ross Moore's suggestion to use
\includegraphics[scale=1]{file} without extension means that file.eps
is used if typeseting is done in DVI-mode and file.pdf in PDF-mode.

2) even in pdf-mode, you can use the .eps-files directly. The packages
epstopdf and epspdfconversion both make sure that
\includegraphics[scale=1]{file.eps} works also in PDF-mode. In the
background, a conversion script is called, if you have a file file.eps
it gets converted into file.pdf. There are several advantages compared
with you approach of using preview.app, but read the documentation ....

Both packages need the --shell-escape option. In my texmaker copy, the
pdflatex-command is defined as
"/usr/texbin/pdflatex"  --shell-escape -interaction=nonstopmode %.tex

> The PSTricks pictures are in a \begin{pspicture} . . . \end{pspicture}
> environment.

Below you can find an example that works for me when typesetting in
PDF-mode in a situation like yours.

You will see that I include every graphic file with its eps/pdf/png/...

% To be typeset with pdflatex not latex, no DVI-mode
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc} %encoding
\usepackage{textcomp}

\usepackage{pdftricks}
\begin{psinputs}
\usepackage{pstricks}
\usepackage{pst-plot}
\usepackage{pst-text,pst-node,pst-tree}
\end{psinputs}

%for the conversion eps -> pdf
\usepackage[GRAY,bbox]{epspdfconversion}

\begin{document}

hallo

%inclusion of an eps-file, it gets converted to pdf in the background:
\includegraphics[scale=0.5]{epstest.eps}

huhu

%direct
\includegraphics[]{testbild.pdf}

hehe

\begin{pdfdisplay}
\begin{pspicture}(-1,-1)(5,7)
\psgrid[subgriddiv=1,griddots=10,gridlabels=10pt](-2,-2)(5,7)
\psaxes[labels=none,ticks=none,linewidth=0.2mm,Dx=10,Dy=10]{->}(0,0)
(4,6)
\end{pspicture}
\end{pdfdisplay}

\end{document}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4647 bytes
Desc: not available
Url : http://tug.org/pipermail/macostex-archives/attachments/20090324/8ff8a6ba/attachment.bin
-------------- next part --------------
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
List Archive: http://tug.org/pipermail/macostex-archives/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex