[OS X TeX] a problem with pdftricks

Herb Schulz herbs at wideopenwest.com
Wed Apr 6 10:32:16 EDT 2005


On 4/4/05 7:40 PM, "Herb Schulz" <herbs at wideopenwest.com> wrote:

> 
> Howdy,
> 
> I'm sorry I couldn't reply earlier but I was off the net for the last week;
> the hinge holding the lcd onto the body of my old Powerbook actually snapped
> and the system was into Apple for repair.
> 
> If I compile the following file it all seems to work fine for me:
> 
> %&pdflatex
> \documentclass[10pt]{article}
> \usepackage{pdftricks}
> 
> \begin{psinputs}
>   \usepackage{pstricks-add}
>   \usepackage{pstricks}
>   \usepackage{rotating}
>   \usepackage{pst-plot}
>   \usepackage{pst-text,pst-node,pst-tree}
> \end{psinputs}
> 
> \begin{document}
> 
> \begin{pdfpic}
> \begin{pspicture}(0,0)(3.5,2.5)
> \psline(2,1)(3,2)
> \end{pspicture}
> \end{pdfpic}
> 
> \end{document}
> 
> Your original file with the \ifpdf stuff worked fine for me under pdflatex
> but not under patex+ghostcript because there was no
> \begin{psinputs}...\end{psinputs} but there still was the
> \usepackage{pdftricks} and \begin{pdfpic}...\end{pdfpic} environment
> surrounding the pspicture.
> 
> You've got to be a bit fancier if you want it to work in both situations:
> put the \usepackage{pdftricks} inside the \ifpdf and in the \else clause
> you've got the define the pdfpic environment as an empty environment.
> ...
> 
Howdy,

Ok, here's a version of the file that works with both latex+ghostscript
processing (via pstricks alone) or pdflatex (via pdftricks + pstricks):

\documentclass[10pt]{article}

\usepackage{ifpdf}

\ifpdf
\usepackage{pdftricks}
    \begin{psinputs}
        \usepackage{pstricks-add}
        \usepackage{pstricks}
        \usepackage{rotating}
        \usepackage{pst-plot}
        \usepackage{pst-text,pst-node,pst-tree}
    \end{psinputs}
\else
    \usepackage{pstricks-add}
    \usepackage{pstricks}
    \usepackage{rotating}
    \usepackage{pst-plot}
    \usepackage{pst-text,pst-node,pst-tree}
    \newenvironment{pdfpic}{\begin{center}\mbox\bgroup}{\egroup\end{center}}
\fi

\begin{document}

\begin{pdfpic}
\begin{pspicture}(0,0)(3.5,2.5)
\psline(2,1)(3,2)
\end{pspicture}
\end{pdfpic}

\end{document}

Please note that the pdfpic environment defined in the pdftricks package
puts the graphic (generated by making the file example-fig1.tex, etc.) in a
centered box so that is what the defined environment does when using
pstricks alone. I think the two methods then generate identical results.

Good Luck,

Herb Schulz
(herbs at wideopenwest.com)

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list