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

Herbert Schulz herbs at wideopenwest.com
Tue Mar 24 22:51:26 CET 2009


On Mar 24, 2009, at 4:19 PM, Randy Scott wrote:

> Hi Daniel,
>
> Thanks for your quick reply!
>
>>> 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}
>
> The PSTricks pictures are in a \begin{pspicture} . . . \end{pspicture}
> environment.
>
>> There are several ways to achieve this. One would be to "convince"
>> pstricks to work together with pdflatex, for example with the
>> pdftricks package. Other solutions can be found here
>> http://tug.org/PSTricks/main.cgi?file=pdf/pdfoutput
>
> Thanks for this reference. At the top of that page, it says "latex - 
> > dvips
> -> ps2pdf" is the absolute easiest way. I use texmaker as my GUI, so  
> it
> would seem that when I want to typeset the exam, I should choose  
> LaTeX from
> the tools menu, then dvi->ps from the tools menu, and finally ps- 
> >pdf from
> the same menu. There is also the Quick-Build option that uses LaTeX,  
> then
> dvi->ps, then ps2pdf, and then View PDF.
>
> Unfortunately, when I choose LaTeX, I get a message that says "process
> exited with errors." However, if I comment out all the lines with  
> \include
> graphics{...}, then the process completes normally. When I use the
> Quick-Build on the file with the \includegraphics{...}, the error  
> messages
> say "LaTeX Error: Cannot determine size of graphic in
> 270B_09-1_Exam_II_01.pdf (no
> BoundingBox)"
>
> Any further suggestions would be greatly appreciated.
>
> Thanks,
>
> Randy Scott
> Santiago Canyon College


Howdy,

The easiest way to include PS is, indeed, latex->dvips->ps3pdf.  
Unfortunately thata can't also include pdf files. You can use the  
pdftricks or pst-pdf packages which allow you to include PStricks in a  
pdflatex compile. These packages have somewhat different features so  
you should look at their documentation. Both packages end up producing  
separate file(s) with the pstricks items which are then compiled using  
latex->dvips->ps2pdf and cropped and then you recompile using pdflatex  
and those pdfs are loaded for the figures.

I don't know what Editor you use but if you use TeXShop (the one I'm  
familiar with) you can automatically have all the compilations, etc.,  
done with either the pdftricks package (use the noshell option) or the  
pst-pdf package by using the pdftricksmk or pst-pdfmk engines used  
with latexmk. See the installation and use information in ~/Library/ 
TeXShop/Engines/Inactive/Latexmk/ folder (remember that ~! is your  
HOME folder).

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)






More information about the macostex-archives mailing list