[OS X TeX] Every Other Tick in PSTricks

Herbert Schulz herbs at wideopenwest.com
Tue Jun 9 16:41:30 EDT 2009


On Jun 9, 2009, at 1:35 PM, Maurino P. Bautista, Ph.D. wrote:

> I have OS X 10.5.7, TeXShop 2.26, TeX Live 2008 with all the updates  
> via TeX Live Utility Manager. If I typeset the code below using TeX  
> and DVI, I get the right figure:
>
> \documentclass{minimal}
> \usepackage{pstricks-add}
>
> \listfiles
>
> \begin{document}
>
> \centering
>
> \begin{pspicture}(-1,-1)(6,6)
> \psaxes[showOriginTick=false,showorigin=false,Dx=2,Dy=2,subticks=2] 
> (6,6)
> \end{pspicture}
>
> \end{document}
>
> But if I typeset it using Pdftex, which is my default setting, I get  
> the error message:
>
> ....
> [Loading MPS to PDF converter (version 2006.09.02).]
> )
> ! Undefined control sequence.
> <recently read> \c at lor@to at ps
>
> 1.12 \end
>                 {pspicture}
> ?
> .....
>
> I understand that the high level PostScript commands generated by  
> pstricks are unknown to pdfTeX. A while back, I believe Herb wrote  
> the following code that used to work for me but now generates no  
> output and no error messages either:
>
> \documentclass{minimal}
>
> \usepackage{ifpdf}
> \ifpdf%
>  \usepackage{pdftricks}
>  \begin{psinputs}
>    \usepackage{pstricks}
> 	 \usepackage{pst-plot}
>  \end{psinputs}
> \else
>  \usepackage{pstricks}
>  \usepackage{pst-plot}
>  \newenvironment{pdfpic}{}{}
> \fi
>
> \begin{pdfpic}
>
> ....INSERT pspicture environment here....
>
> \end{pdfpic}
> \end{document}
>
> The idea I think is to detect if one is using pdfTeX and switch to  
> pdftricks to allow pstricks commands to be used. Any ideas on how to  
> fix the above code?
>
> Maurino P. Bautista, Ph.D.
> Professor of Mathematics
> maobautista at gmail.com


Howdy,

This works for me:

%%!TEX TS-program = pdftricksmk
\documentclass{minimal}

\usepackage{ifpdf}
\ifpdf%
  \usepackage{pdftricks}
  \begin{psinputs}
    \usepackage{pstricks}
    \usepackage{pst-plot}
    \usepackage{pstricks-add} % <- added this line!
  \end{psinputs}
\else
  \usepackage{pstricks}
  \usepackage{pst-plot}
  \usepackage{pstricks-add} % <- added this line!
  \newenvironment{pdfpic}{}{}
\fi

\begin{document} % <- why did I have to add this?
\centering
\begin{pdfpic}
\begin{pspicture}(-1,-1)(6,6)
\psaxes[showOriginTick=false,showorigin=false,Dx=2,Dy=2,subticks=2](6,6)
\end{pspicture}
\end{pdfpic}
\end{document}

By the way, I think it was someone else that made the suggestion. I  
tend to force what ever processing I need by use of the %%!TEX line  
rather than \ifpdf, etc.: in this case I'm using the pdftricksmk  
engine in TeXShop which uses latexmk and pdflatex to do the necessary  
processing when using the pdftricks package.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)






More information about the MacOSX-TeX mailing list